1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,354523,e=>{"use strict";var t=e.i(843476),l=e.i(500932),s=e.i(271645);e.i(436180);var n=e.i(98925),r=e.i(176009),o=e.i(403403),i=e.i(522016),a=e.i(657688),c=e.i(709375),d=e.i(618566),h=e.i(531278),x=e.i(870273);function p(e){let n,r,o,i,a,c=(0,l.c)(20),{tags:d,activeTag:h,onTagClick:x}=e,[p,m]=(0,s.useState)(!1);c[0]!==p||c[1]!==d?(n=p?d:d.slice(0,8),c[0]=p,c[1]=d,c[2]=n):n=c[2];let u=n,g=d.length-8;if(c[3]!==h||c[4]!==x||c[5]!==u){let e;c[7]!==h||c[8]!==x?(e=e=>(0,t.jsxs)("button",{onClick:()=>x(e),className:`text-xs px-3 py-1.5 rounded-full border transition-all 2 ${h===e?"bg-red-600 border-red-500 text-white":"bg-neutral-900/50 border-white/10 text-neutral-400 hover:border-yellow-400/50 hover:text-yellow-200"}`,children:["#",e]},e),c[7]=h,c[8]=x,c[9]=e):e=c[9],r=u.map(e),c[3]=h,c[4]=x,c[5]=u,c[6]=r}else r=c[6];return c[10]!==p||c[11]!==g?(o=!p&&g>0&&(0,t.jsxs)("button",{onClick:()=>m(!0),className:"text-xs px-3 py-1.5 rounded-full border border-white/20 text-neutral-300 hover:bg-neutral-800 transition",children:["+",g]}),c[10]=p,c[11]=g,c[12]=o):o=c[12],c[13]!==p||c[14]!==d.length?(i=p&&d.length>8&&(0,t.jsx)("button",{onClick:()=>m(!1),className:"text-xs px-3 py-1.5 rounded-full border border-white/20 text-neutral-300 hover:bg-neutral-800 transition",children:"Thu gá»n"}),c[13]=p,c[14]=d.length,c[15]=i):i=c[15],c[16]!==r||c[17]!==o||c[18]!==i?(a=(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 items-center",children:[r,o,i]}),c[16]=r,c[17]=o,c[18]=i,c[19]=a):a=c[19],a}var m=e.i(283086),u=e.i(37727),g=e.i(664659);let b=(0,e.i(475254).default)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);var f=e.i(63209),w=e.i(997625),y=e.i(440160),v=e.i(286536);let j=["container","container-fluid","row","col","col-6","col-md-6","col-lg-4","d-flex","justify-content-center","justify-content-between","align-items-center","p-1","p-2","p-3","p-4","p-5","px-3","py-2","m-1","m-2","m-3","mt-3","mb-4","text-center","text-start","text-end","fw-bold","bg-primary","bg-secondary","bg-dark","text-white","text-muted","btn","btn-primary","btn-success","btn-danger","btn-outline-primary","border","rounded","rounded-circle","shadow","shadow-lg"],k=["flex","inline-flex","grid","block","hidden","items-center","items-start","items-end","justify-center","justify-between","justify-around","p-1","p-2","p-3","p-4","p-5","p-6","px-2","px-4","px-6","py-2","py-3","py-4","m-1","m-2","m-4","mt-2","mt-4","mb-4","w-full","w-screen","w-auto","h-full","h-screen","text-sm","text-base","text-lg","text-xl","font-bold","font-medium","text-center","text-left","bg-white","bg-black","bg-gray-100","bg-gray-900","bg-purple-500","bg-blue-500","text-white","text-black","text-gray-500","border","border-2","border-gray-300","rounded","rounded-lg","rounded-xl","rounded-full","shadow","shadow-lg","hover:bg-gray-200","hover:scale-105","transition"];function N(e,t){let l=e.trim().toLowerCase();if(!l)return t.slice(0,12);let s=t.filter(e=>e.startsWith(l)),n=t.filter(e=>e.includes(l)&&!s.includes(e));return[...s,...n].slice(0,12)}let S=[{value:"tailwind",label:"Tailwind"},{value:"bootstrap",label:"Bootstrap"},{value:"vanilla",label:"HTML/CSS/JS"}],z=["html","css","js"],C={tailwind:'<script src="https://cdn.tailwindcss.com"></script>',bootstrap:'<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">\n<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css">\n<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" defer></script>',vanilla:""},P={html:"text/html",css:"text/css",js:"text/javascript"},_={html:`<!-- HTML --> 3<div class="p-10 text-center"> 4 <h1>ððHello P-SPACE AI ð</h1> 5</div>`,css:`/* CSS */ 6body { 7 font-family: sans-serif; 8}`,js:`// JS 9console.log("Ready"); 10`};function E(e,t,l){let s=e.currentTarget,n=s.selectionStart,r=s.selectionEnd;if(">"===e.key){let o=t.substring(0,n),i=o.match(/<([a-zA-Z0-9]+)$/);if(i){e.preventDefault();let a=i[1];l(o+">"+`</${a}>`+t.substring(r)),requestAnimationFrame(()=>{s.selectionStart=s.selectionEnd=n+1})}}}function A(e,t,l){if(!e)return;let s=URL.createObjectURL(new Blob([e],{type:l}));Object.assign(document.createElement("a"),{href:s,download:t}).click(),URL.revokeObjectURL(s)}function T({prompt:e,detail:l}
10){let[n,r]=(0,s.useState)(_),[o,i]=(0,s.useState)("tailwind"),[a,c]=(0,s.useState)("html"),[d,x]=(0,s.useState)("split"),[p,m]=(0,s.useState)(!1),[u,g]=(0,s.useState)(""),b=!!n.html,[$,L]=(0,s.useState)(n),[D,I]=(0,s.useState)(!0),M=D?` 11/* ===== DEBUG MODE STRONG ===== */ 12div { 13 outline: 1px dashed rgba(168,85,247,.7) !important; 14 background-color: rgba(168,85,247,.15) !important; 15} 16 17section { 18 outline: 1px dashed rgba(59,130,246,.7) !important; 19 background-color: rgba(59,130,246,.15) !important; 20} 21 22header { 23 outline: 1px dashed rgba(34,197,94,.7) !important; 24 background-color: rgba(34,197,94,.15) !important; 25} 26 27footer { 28 outline: 1px dashed rgba(239,68,68,.7) !important; 29 background-color: rgba(239,68,68,.15) !important; 30} 31 32main { 33 outline: 1px dashed rgba(234,179,8,.7) !important; 34 background-color: rgba(234,179,8,.15) !important; 35} 36 37/* hover cực r\xf5 */ 38*:hover { 39 outline: 2px solid #facc15 !important; 40 background-color: rgba(250,204,21,.25) !important; 41} 42`:"";(0,s.useEffect)(()=>{let e=setTimeout(()=>{L(n)},300);return()=>clearTimeout(e)},[n]);let V=(0,s.useMemo)(()=>{if(!b)return"";let e=$.html.trim(),t=$.css.trim(),l=$.js.trim();return` 43<!DOCTYPE html> 44<html lang="en"> 45<head> 46<meta charset="UTF-8" /> 47<meta name="viewport" content="width=device-width, initial-scale=1.0" /> 48 49${C[o]} 50 51<style> 52/* ===== DEBUG VISUAL DOM ===== */ 53* { 54 box-sizing: border-box; 55} 56 57/* Highlight block elements */ 58div { 59 outline: 1px dashed rgba(168, 85, 247, 0.5); 60 background-color: rgba(168, 85, 247, 0.05); 61} 62 63section { 64 outline: 1px dashed rgba(59, 130, 246, 0.5); 65 background-color: rgba(59, 130, 246, 0.05); 66} 67 68header { 69 outline: 1px dashed rgba(34, 197, 94, 0.5); 70 background-color: rgba(34, 197, 94, 0.05); 71} 72 73footer { 74 outline: 1px dashed rgba(239, 68, 68, 0.5); 75 background-color: rgba(239, 68, 68, 0.05); 76} 77 78main { 79 outline: 1px dashed rgba(234, 179, 8, 0.5); 80 background-color: rgba(234, 179, 8, 0.05); 81} 82 83/* Inline elements nhẹ hơn */ 84span { 85 outline: 1px dotted rgba(255,255,255,0.2); 86} 87 88/* Hover highlight */ 89*:hover { 90 outline: 2px solid #facc15 !important; 91 background-color: rgba(250, 204, 21, 0.15) !important; 92} 93 94/* ===== USER CSS ===== */ 95 96${t} 97${M} 98</style> 99</head> 100<body> 101 102${e} 103 104<script> 105${l} 106</script> 107 108</body> 109</html> 110`},[$,o,b]),R=(0,s.useCallback)(async()=>{if(!p){if(!e||e.trim().length<3)return void g("Please enter a valid prompt (at least 3 characters)");m(!0),g(""),r(_);try{let t=await fetch("/api/ai-template",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:e,detail:l,framework:o})}),s=await t.json();if(!s.success)throw Error(s.error||"AI generation failed");r({html:s.files?.html??"",css:s.files?.css??"",js:s.files?.js??""})}catch(e){g(e instanceof Error?e.message:"Unexpected error occurred")}finally{m(!1)}}},[p,e,l,o]),U=(0,s.useCallback)(()=>{z.forEach((e,t)=>{setTimeout(()=>A(n[e],`index.${e}`,P[e]),300*t)})}
110,[n]),[O,B]=(0,s.useState)([]),[H,K]=(0,s.useState)(!1),[F,G]=(0,s.useState)(0),[W,q]=(0,s.useState)({top:0,left:0});function X(e,t){let l=e.slice(0,t).match(/class="([^"]*)$/);if(!l)return null;let s=l[1].split(" ");return{last:s[s.length-1],startIndex:t-s[s.length-1].length}}function J(e){let t=n[a],l=X(t,F);if(!l)return;let s=t.slice(0,l.startIndex),o=t.slice(F),i=s+e+(o.startsWith(" ")?"":" ")+o;r(e=>({...e,[a]:i})),K(!1),setTimeout(()=>{let t=document.querySelector("textarea");if(t){let l=s.length+e.length+1;t.setSelectionRange(l,l),t.focus()}},0)}let[Y,Q]=(0,s.useState)(0);return(0,t.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden min-h-0",children:[(0,t.jsxs)("div",{className:" flex flex-wrap items-center justify-between gap-2 px-2 sm:px-4 py-2 border-b border-zinc-700 bg-zinc-900 flex-shrink-0 ",children:[(0,t.jsx)("div",{className:"flex gap-1 bg-zinc-800 rounded-lg p-1 overflow-x-auto max-w-full",children:S.map(({value:e,label:l})=>(0,t.jsx)("button",{onClick:()=>i(e),className:`px-3 py-1 rounded-md text-xs font-medium transition-colors ${o===e?"bg-purple-600 text-white":"text-zinc-400 hover:text-white"}`,children:l},e))}),(0,t.jsx)("div",{className:"flex gap-1 bg-zinc-800 rounded-lg p-1 overflow-x-auto max-w-full",children:["code","split","preview"].map(e=>(0,t.jsx)("button",{onClick:()=>x(e),className:`px-2 py-1 rounded-md text-xs transition-colors ${d===e?"bg-zinc-600 text-white":"text-zinc-400 hover:text-white"}`,children:"code"===e?(0,t.jsx)(w.Code2,{size:14}):"preview"===e?(0,t.jsx)(v.Eye,{size:14}):"Split"},e))}),(0,t.jsx)("button",{onClick:()=>I(e=>!e),className:`px-3 py-1 text-xs rounded ${D?"bg-yellow-600 text-white":"bg-zinc-700 text-zinc-300"}`,children:"Debug DOM"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[b&&(0,t.jsxs)("div",{className:"flex gap-1",children:[z.map(e=>(0,t.jsx)("button",{onClick:()=>A(n[e],`index.${e}`,P[e]),className:"px-2 py-1 text-xs bg-zinc-700 hover:bg-zinc-600 text-zinc-300 rounded transition-colors uppercase",children:e},e)),(0,t.jsxs)("button",{onClick:U,className:"flex items-center gap-1 px-3 py-1 text-xs bg-green-700 hover:bg-green-600 text-white rounded transition-colors",children:[(0,t.jsx)(y.Download,{size:12})," All"]})]}),(0,t.jsx)("button",{disabled:p,onClick:R,className:"flex items-center gap-2 px-4 py-1.5 bg-purple-600 hover:bg-purple-500 disabled:opacity-50 text-white text-sm rounded-lg font-medium transition-colors",children:p?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.Loader2,{size:14,className:"animate-spin"})," Generatingâ¦"]}):"Generate"})]})]}),u&&(0,t.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 bg-red-950 border-b border-red-800 text-red-300 text-xs flex-shrink-0",children:[(0,t.jsx)(f.AlertCircle,{size:13})," ",u]}),(0,t.jsxs)("div",{className:"flex flex-1 flex-col sm:flex-row overflow-hidden",children:["preview"!==d&&(0,t.jsxs)("div",{className:` 111 ${"split"===d?"w-full sm:w-[65%]":"w-full"} 112 flex flex-col 113 border-r border-zinc-700 114 bg-zinc-950 115 overflow-hidden 116`,children:[(0,t.jsxs)("div",{className:"flex border-b border-zinc-800 flex-shrink-0",children:[z.map(e=>(0,t.jsxs)("button",{onClick:()=>c(e),className:`px-4 py-2 text-xs font-mono border-r border-zinc-800 transition-colors ${a===e?"bg-zinc-800 text-white border-b-2 border-b-purple-500":"text-zinc-500 hover:text-zinc-300 hover:bg-zinc-900"}`,children:["index.",e]},e)),b&&(0,t.jsxs)("span",{className:"ml-auto px-3 flex items-center text-xs text-zinc-600",children:[n[a].split("\n").length," lines"]})]}),(0,t.jsx)("div",{className:"flex-1 overflow-auto p-2 sm:p-4",children:p?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-3 text-zinc-500",children:[(0,t.jsx)(h.Loader2,{size:24,className:"animate-spin text-purple-500"}),(0,t.jsx)("p",{className:"text-sm",children:"AI is generating your templateâ¦"}),(0,t.jsx)("p",{className:"text-xs text-zinc-600",children:"This may take 10â20 seconds"})]}):n[a]?(0,t.jsxs)(t.Fragment,{children:[" ",H&&O.length>0&&(0,t.jsx)("div",{className:"fixed z-[999] bg-zinc-900 border border-zinc-700 rounded-lg shadow-xl max-h-48 overflow-auto",style:{to
116p:W.top,left:W.left,width:220},children:O.map((e,l)=>(0,t.jsx)("div",{onClick:()=>J(e),onMouseEnter:()=>Q(l),className:`px-3 py-2 text-xs cursor-pointer ${l===Y?"bg-purple-600 text-white":"text-zinc-300 hover:bg-purple-600"}`,children:e},e))})," ",(0,t.jsx)("textarea",{value:n[a],onChange:e=>{let t=e.target.value,l=e.target.selectionStart;r(e=>({...e,[a]:t})),G(l),Q(0);let s=X(t,l);if(s){let e=s.last.trim();if(!e)return void K(!1);let t=N(e,"tailwind"===o?k:j);0===t.length?K(!1):(B(t),K(!0),Q(0))}else K(!1)},onKeyDown:e=>{if(H){if("ArrowDown"===e.key){e.preventDefault(),e.stopPropagation(),Q(e=>e<O.length-1?e+1:0);return}if("ArrowUp"===e.key){e.preventDefault(),e.stopPropagation(),Q(e=>e>0?e-1:O.length-1);return}if("Enter"===e.key||"Tab"===e.key){e.preventDefault(),J(O[Y]);return}if("Escape"===e.key)return void K(!1)}E(e,n[a],e=>r(t=>({...t,[a]:e})))},className:" w-full h-full bg-black text-green-400 font-mono text-xs sm:text-sm p-4 sm:p-5 sm:text-[14px] leading-relaxed outline-none resize-none overflow-auto "})," ",H&&O.length>0&&(0,t.jsx)("div",{className:"absolute pointer-events-none text-zinc-500 px-5 py-5 font-mono text-sm opacity-40",children:O[Y]})]}):(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-zinc-600",children:[(0,t.jsx)(w.Code2,{size:32,className:"opacity-30"}),(0,t.jsx)("textarea",{value:n[a],onChange:e=>{let t=e.target.value,l=e.target.selectionStart;r(e=>({...e,[a]:t})),Q(0),G(l);let s=X(t,l);if(s){let e=s.last.trim();if(!e)return void K(!1);let t=N(e,"tailwind"===o?k:j);0===t.length?K(!1):(B(t),K(!0),Q(0))}else K(!1)},onKeyDown:e=>{if(H){if("ArrowDown"===e.key){e.preventDefault(),e.stopPropagation(),Q(e=>e<O.length-1?e+1:0);return}if("ArrowUp"===e.key){e.preventDefault(),e.stopPropagation(),Q(e=>e>0?e-1:O.length-1);return}if("Enter"===e.key||"Tab"===e.key){e.preventDefault(),J(O[Y]);return}if("Escape"===e.key)return void K(!1)}E(e,n[a],e=>r(t=>({...t,[a]:e})))},className:" w-full h-full min-h-0 bg-black text-green-400 font-mono text-sm sm:text-[14px] p-4 sm:p-5 leading-relaxed outline-none resize-none overflow-auto "}),H&&O.length>0&&(0,t.jsx)("div",{className:"absolute pointer-events-none text-zinc-500 px-5 py-5 font-mono text-sm opacity-40",children:O[Y]}),H&&O.length>0&&(0,t.jsx)("div",{className:"fixed z-[999] bg-zinc-900 border border-zinc-700 rounded-lg shadow-xl max-h-48 overflow-auto",style:{to
116p:W.top,left:W.left,width:220},children:O.map((e,l)=>(0,t.jsx)("div",{onClick:()=>J(e),onMouseEnter:()=>Q(l),className:`px-3 py-2 text-xs cursor-pointer ${l===Y?"bg-purple-600 text-white":"text-zinc-300 hover:bg-purple-600"}`,children:e},e))})]})})]}),"code"!==d&&(0,t.jsx)("div",{className:` 117 ${"split"===d?"w-full sm:w-1/2":"w-full"} 118 bg-white 119 overflow-hidden 120`,children:b?(0,t.jsx)("iframe",{srcDoc:V,className:"w-full h-full border-0",sandbox:"allow-scripts allow-same-origin",title:"Template Preview"},V):(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-3 bg-zinc-100 text-zinc-400",children:[(0,t.jsx)(v.Eye,{size:32,className:"opacity-30"}),(0,t.jsx)("p",{className:"text-sm",children:"Preview will appear here"})]})})]})]})}let $=["Landing page SaaS","Dashboard admin","Portfolio website","Blog template","Pricing page","E-commerce store","Login & Register","Restaurant website","Agency website","News portal","Crypto dashboard","AI chatbot UI","Booking app UI","Social media app","Fitness a
120pp UI","Education platform"];function L(e){let n,r,o,i,a,c,d,h,x,p,m,f,w,y,v,j,k,N=(0,l.c)(42),{onClose:S}=e,[z,C]=(0,s.useState)(""),[P,_]=(0,s.useState)(""),[E,A]=(0,s.useState)(!1),[L,M]=(0,s.useState)(!1);if(N[0]===Symbol.for("react.memo_cache_sentinel")?(n=(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-purple-500 animate-pulse"}),(0,t.jsx)("h2",{className:"text-base font-bold text-purple-400",children:"P-SPACE AI Template Generator"})]}),N[0]=n):n=N[0],N[1]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)(u.X,{size:18}),N[1]=r):r=N[1],N[2]!==S?(o=(0,t.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b border-zinc-700 flex-shrink-0",children:[n,(0,t.jsx)("button",{onClick:S,className:"p-1.5 rounded-lg hover:bg-zinc-700 text-zinc-400 hover:text-white transition-colors",children:r})]}),N[2]=S,N[3]=o):o=N[3],N[4]===Symbol.for("react.memo_cache_sentinel")?(i=e=>C(e.target.value),N[4]=i):i=N[4],N[5]!==z?(a=(0,t.jsx)("input",{value:z,onChange:i,placeholder:"Describe the template you want to create...",className:"w-full bg-zinc-800 border border-zinc-700 focus:border-purple-500 text-white text-sm px-4 py-2.5 rounded-xl outline-none placeholder:text-zinc-500 transition-colors"}),N[5]=z,N[6]=a):a=N[6],N[7]!==z||N[8]!==L){let e;N[10]!==z?(e=e=>(0,t.jsx)("button",{onClick:()=>C(e),className:`px-3 py-1 rounded-full text-xs border transition-colors ${z===e?"border-purple-500 bg-purple-500/20 text-purple-300":"border-zinc-700 bg-zinc-800 text-zinc-400 hover:border-purple-500 hover:text-purple-300"}`,children:e},e),N[10]=z,N[11]=e):e=N[11],c=(L?$:$.slice(0,4)).map(e),N[7]=z,N[8]=L,N[9]=c}else c=N[9];N[12]!==c?(d=(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:c}),N[12]=c,N[13]=d):d=N[13],N[14]!==L?(h=$.length>4&&(0,t.jsx)("button",{onClick:()=>M(I),className:"text-xs text-purple-400 hover:text-purple-300 transition-colors",children:L?"Show less â":"Show more â"}),N[14]=L,N[15]=h):h=N[15],N[16]!==d||N[17]!==h?(x=(0,t.jsxs)("div",{className:"space-y-2",children:[d,h]}),N[16]=d,N[17]=h,N[18]=x):x=N[18],N[19]===Symbol.for("react.memo_cache_sentinel")?(p=()=>A(D),N[19]=p):p=N[19],N[20]!==E?(m=E?(0,t.jsx)(b,{size:13}):(0,t.jsx)(g.ChevronDown,{size:13}),N[20]=E,N[21]=m):m=N[21];let V=E?"Hide":"Add";return N[22]!==m||N[23]!==V?(f=(0,t.jsxs)("button",{onClick:p,className:"flex items-center gap-1.5 text-xs text-zinc-500 hover:text-zinc-300 transition-colors",children:[m,V," details (colors, style, featuresâ¦)"]}),N[22]=m,N[23]=V,N[24]=f):f=N[24],N[25]!==P||N[26]!==E?(w=E&&(0,t.jsx)("textarea",{value:P,onChange:e=>_(e.target.value),placeholder:"e.g. Dark theme, blue accent, sticky navbar, Vietnamese content, scroll animationsâ¦",rows:3,className:"mt-2 w-full bg-zinc-800 border border-zinc-700 focus:border-purple-500/60 text-white text-xs px-3 py-2 rounded-lg outline-none placeholder:text-zinc-600 resize-none transition-colors leading-relaxed"}),N[25]=P,N[26]=E,N[27]=w):w=N[27],N[28]!==f||N[29]!==w?(y=(0,t.jsxs)("div",{children:[f,w]}),N[28]=f,N[29]=w,N[30]=y):y=N[30],N[31]!==y||N[32]!==a||N[33]!==x?(v=(0,t.jsxs)("div",{className:"px-5 py-3 border-b border-zinc-700 flex-shrink-0 space-y-3",children:[a,x,y]}),N[31]=y,N[32]=a,N[33]=x,N[34]=v):v=N[34],N[35]!==P||N[36]!==z?(j=(0,t.jsx)(T,{prompt:z,detail:P}),N[35]=P,N[36]=z,N[37]=j):j=N[37],N[38]!==v||N[39]!==j||N[40]!==o?(k=(0,t.jsx)("div",{className:"fixed inset-0 z-[300] bg-black/80 flex items-center justify-center p-4",children:(0,t.jsxs)("div",{className:"w-full max-w-7xl h-[88vh] bg-zinc-900 rounded-2xl flex flex-col border border-zinc-700 shadow-2xl overflow-hidden",children:[o,v,j]})}),N[38]=v,N[39]=j,N[40]=o,N[41]=k):k=N[41],k}function D(e){return!e}function I(e){return!e}function M({visible:e,userId:l}){let[n,r]=(0,s.useState)(!1),[o,i]=(0,s.useState)("false"!==localStorage.getItem("ai_tool_enabled")),[a,c]=(0,s.useState)(!1);return((0,s.useEffect)(()=>{let e=()=>{i("false"!==localStorage.getItem("ai_tool_enabled"))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[]),(0,s.useEffect)(()=>{l&&(async()=>{try{let e=await fetch(`/api/user-package?userId=${l}`),t=await e.json();c(t?.isActive===!0)}catch(e){console.error(e),c(!1)}})()}
120,[l]),e&&a)?(0,t.jsxs)(t.Fragment,{children:[!o&&(0,t.jsx)(t.Fragment,{}),o&&(0,t.jsxs)("div",{className:"fixed bottom-6 right-6 z-[200] flex items-center gap-2",children:[(0,t.jsxs)("button",{onClick:()=>r(!0),className:"flex items-center gap-2 px-4 py-3 rounded-full bg-purple-600 text-white shadow-xl hover:scale-105 transition",children:[(0,t.jsx)(m.Sparkles,{size:16})," P-SPACE AI"]}),(0,t.jsx)("button",{onClick:()=>{localStorage.setItem("ai_tool_enabled",String(!1)),i(!1)},className:"p-2 rounded-full bg-zinc-800 hover:bg-zinc-700 text-zinc-400",children:(0,t.jsx)(u.X,{size:15})})]}),n&&(0,t.jsx)(L,{onClose:()=>r(!1)})]}):null}var V=e.i(243371),R=e.i(776788);let U=[{id:"member",name:"Member",threshold:0,discount:0},{id:"silver",name:"Silver",threshold:10,discount:2},{id:"gold",name:"Gold",threshold:100,discount:4},{id:"diamond",name:"Diamond",threshold:1e3,discount:6},{id:"king",name:"King of Products",threshold:1e5,discount:8}],O="pspace_cookie_policy_accepted_v1",B={vi:{featuredProducts:"Sản phẩm ná»i báºt",tabs:{all:"Tất cả",template:"Template",software:"Phần Má»m",app:"Ứng Dụng",articles:"Kết Ná»i"},gridView:"Dạng Lưá»i",listView:"Dạng Danh Sách",allPlatforms:"Tất cả ná»n tảng",newest:"Má»i nhất",mostViewed:"Xem nhiá»u nhất",hottest:"Hot nhất (Views + Like + Comment)",emptyResults:"Không tìm thấy ná»i dung nà o phù hợp.",loadingMore:"Äang tải thêm...",paid:"Äà THANH TOÃN",details:"Chi Tiết",download:"Tải Xuá»ng",downloadNow:"Tải xuá»ng",chooseVersion:"Chá»n phiên bản tải xuá»ng",latest:"Latest",close:"Äóng",noPreview:"No Preview",seoTitle:"Danh mục phần má»m và ứng dụng",seoIntro:"Kho ứng dụng cá»§a chúng tôi bao gá»m nhiá»u phần má»m, template và công cụ như:",seoPopular:"Ngưá»i dùng có thá» tìm thấy các ứng dụng phá» biến như"},en:{featuredProducts:"Featured products",tabs:{all:"All",template:"Templates",software:"Software",app:"Apps",articles:"Connect"},gridView:"Grid view",listView:"List view",allPlatforms:"All platforms",newest:"Newest",mostViewed:"Most viewed",hottest:"Hottest (Views + Likes + Comments)",emptyResults:"No matching content found.",loadingMore:"Loading more...",paid:"PAID",details:"Details",download:"Download",downloadNow:"Download",chooseVersion:"Choose download version",latest:"Latest",close:"Close",noPreview:"No Preview",seoTitle:"Software and app categories",seoIntro:"Our app store includes many software products, templates, and tools such as:",seoPopular:"Users can find popular apps such as"}},H={vi:{title:"ChÃnh sách cookie",subtitle:"P-SPACE Store sá» dụng cookie và công nghá» tương tá»± Äá» váºn hà nh website, bảo vá» tà i khoản, cải thiá»n trải nghiá»m mua phần má»m và Äo lưá»ng hiá»u quả dá»ch vụ.",effective:"Ngà y hiá»u lá»±c: 21/05/2026",intro:"Cookie là các Äoạn dữ liá»u nhá» ÄÆ°á»£c lưu trên trình duyá»t hoặc thiết bá» cá»§a bạn. Các công nghá» tương tá»± như local storage, pixel tag, mã Äá»nh danh thiết bá» và dữ liá»u phiên có thá» ÄÆ°á»£c dùng cho cùng mục ÄÃch.",sections:[{title:"Váºn hà nh dá»ch vụ",body:"Chúng tôi dùng cookie cần thiết Äá» ghi nhá» ngôn ngữ, giao diá»n, phiên ÄÄng nháºp, giá» hà ng, sản phẩm Äã mua, lá»±a chá»n tải xuá»ng và các cà i Äặt bạn yêu cầu."},{title:"Bảo máºt",body:"Cookie giúp xác thá»±c ngưá»i dùng, chá»ng spam, gian láºn, truy cáºp trái phép, lạm dụng thanh toán và há» trợ phát hiá»n lá»i há» thá»ng."},{title:"Phân tÃch và cải thiá»n",body:"Dữ liá»u sá» dụng như lượt xem, thiết bá», trình duyá»t, thao tác nhấp, thá»i lượng truy cáºp và hiá»u nÄng trang có thá» ÄÆ°á»£c dùng Äá» cải thiá»n ná»i dung, sản phẩm, tìm kiếm và trải nghiá»m tải."},{title:"Quảng cáo và cá nhân hóa",body:"Khi ÄÆ°á»£c pháp luáºt cho phép hoặc khi bạn Äá»ng ý, chúng tôi và Äá»i tác như Google, Meta hoặc ná»n tảng quảng cáo khác có thá» dùng cookie Äá» Äo lưá»ng chiến dá»ch, giá»i hạn tần suất quảng cáo và hiá»n thá» ná»i dung phù hợp hÆ¡n."},{title:"Bên thứ ba",body:"Má»t sá» trang có thá» nhúng dá»ch vụ thanh toán, video, phân tÃch, ÄÄng nháºp, bản Äá» hoặc quảng cáo. Các bên thứ ba nà y có thá» Äặt cookie theo chÃnh sách riêng cá»§a há»."},{title:"Quyá»n kiá»m soát",body:"Bạn có thá» xóa hoặc chặn cookie trong cà i Äặt trình duyá»t. Nếu xóa dữ liá»u website, thông báo nà y sẽ xuất hiá»n lại Äá» bạn chá»n lại."}],note:"Nếu bạn chá»n Äá»ng ý, chúng tôi sẽ ghi nhá» lá»±a chá»n nà y trên trình duyá»t hiá»n tại. Nếu bạn chá»n Há»§y, trang sẽ tải lại và yêu
120cầu chá»n lại trưá»c khi tiếp tục.",agree:"Äá»ng ý",cancel:"Há»§y",language:"English"},en:{title:"Cookie Policy",subtitle:"P-SPACE Store uses cookies and similar technologies to operate the website, protect accounts, improve software shopping experiences, and measure service performance.",effective:"Effective date: May 21, 2026",intro:"Cookies are small pieces of data stored on your browser or device. Similar technologies such as local storage, pixel tags, device identifiers, and session data may serve the same purposes.",sections:[{title:"Service functionality",body:"We use necessary cookies to remember language, theme, sign-in sessions, cart data, purchased products, download choices, and settings you request."},{title:"Security",body:"Cookies help authenticate users, prevent spam, fraud, unauthorized access, payment abuse, and support system error detection."},{title:"Analytics and improvement",body:"Usage data such as views, device type, browser, clicks, visit duration, and page performance may be used to improve content, products, search, and download experiences."},{title:"Advertising and personalization",body:"Where permitted by law or with your consent, we and partners such as Google, Meta, or other advertising platforms may use cookies to measure campaigns, limit ad frequency, and show more relevant content."},{title:"Third parties",body:"Some pages may embed payment, video, analytics, sign-in, map, or advertising services. These third parties may set cookies under their own policies."},{title:"Your controls",body:"You can delete or block cookies in your browser settings. If website data is cleared, this notice will appear again so you can choose again."}],note:"If you choose Agree, we will remember this choice in the current browser. If you choose Cancel, the page will reload and ask again before you continue.",agree:"Agree",cancel:"Cancel",language:"Tiếng Viá»t"}},K=({product:e,hasPurchased:l,viewMode:n,labels:o,lang:h})=>{let p,m,u=(m=e.translations?.[h]?.title||e.localizedTitle?.[h]||("en"===h?e.titleEn||e.title_en:e.titleVi||e.title_vi),m?.trim()||e.title),g=(p=(0,s.useRef)(!1),(0,s.useEffect)(()=>{p.current=!0},[]),p.current),b=Array.isArray(e.versions)&&e.versions.length>0,f=l||0===e.price,[w,y]=(0,s.useState)(!1),v=(0,d.useRouter)(),[j]=(0,c.useAuthState)(r.auth),k=(0,s.useMemo)(()=>{if(!g||!j)return 0;let e=localStorage.getItem(`rank_${j.uid}`);if(!e)return 0;let t=U.find(t=>t.id===e);return t?.discount??0},[j,g]),{originalPrice:N,finalPrice:S,totalDiscountPercent:z}=(0,s.useMemo)(()=>{let t=e.price;if("account"===e.deliveryType&&"limited"===e.durationMode&&e.durationOptions?.length&&(t=(e.durationOptions.find(e=>e.isDefault)||e.durationOptions[0]).price),0===t)return{originalPrice:0,finalPrice:0,totalDiscountPercent:0};if(!g)return{originalPrice:t,finalPrice:t,totalDiscountPercent:0};let l=k;0===new Date().getDay()&&(l+=5);let s=t*l/100,n=Math.max(0,Math.ceil(t-s));return{originalPrice:t,finalPrice:n,totalDiscountPercent:l}},[e,k,g]),C=[];e.thumbnailUrl&&C.push({type:"image",content:e.thumbnailUrl}),e.youtubeId&&C.push({type:"video",content:e.youtubeId}),0===C.length&&C.push({type:"empty",content:null});let[P,_]=(0,s.useState)(0),E=C[P],A="premium"===e.type||"pro"===e.type||"account"===e.deliveryType,T=()=>{v.push(`/products/${e.id}`)};return(0,t.jsxs)("div",{className:"group relative h-full cursor-pointer",onClick:T,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),T())},role:"button",tabIndex:0,children:[l&&(0,t.jsx)("div",{className:"absolute top-1 left-1 z-30 rounded bg-green-500/95 px-1.5 py-0.5 text-[8px] md:text-[10px] font-semibold uppercase tracking-wide text-white shadow-md",children:o.paid}),!l&&z>0&&(0,t.jsxs)("div",{className:"absolute top-1 left-1 z-30 rounded bg-red-600/95 px-2 py-0.5 text-[10px] font-bold uppercase tracking-wide text-white shadow-md animate-pulse",children:["-",z,"%"]}),(0,t.jsxs)("div",{className:"relative h-full overflow-hidden rounded-2xl p-px transition-transform duration-300 hover:-translate-y-1",children:[(0,t.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-yellow-400/60 via-yellow-500/40 to-yellow-300/60 blur-[6px] opacity-70 group-hover:opacity-100 transition-opacity duration-500"}),(0,t.jsxs)("div",{className:`relative flex h-full rounded-2xl bg-neutral-900/95 border border-yellow-400/50 backdrop-blur-xl shadow-[0_0_20px_rgba(253,224,71,0.1)] overflow-hidden ${"list"===n?"flex-row":"flex-col"}`,children:[(0,t.jsxs)("div",{className:`relative border-yellow-400/20 bg-black/50 overflow-hidden shrink-0 ${"list"===n?"w-28 md:w-48 border-r":"w-full aspect-video border-b"}`,children:[(0,t.jsx)("div",{className:"w-full h-full absolute inset-0",children:"image"===E.type?(0,t.jsx)(a.default,{src:(0,V.cloudinaryImageUrl)(E.content,{width:"list"===n?384:640,crop:"limit"}),alt:u,fill:!0,className:"object-cover",unoptimized:!0}):"video"===E.type?(0,t.jsx)("div",{className:"w-full h-full",onClick:e=>{e.stopPropagation()},onTouchStart:e=>{e.stopPropagation()},children:(0,t.jsx)("iframe",{src:`https://www.youtube.com/embed/${E.content??""}?playsinline=1&rel=0&modestbranding=1&iv_load_policy=3&enablejsapi=0`,className:"w-full h-full pointer-events-auto",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,title:u,referrerPolicy:"str
120ict-origin-when-cross-origin"})}):(0,t.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-neutral-800",children:(0,t.jsx)("span",{className:"text-yellow-100/30 font-medium text-xs",children:o.noPreview})})}),(0,t.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-neutral-900/80 to-transparent opacity-40 pointer-events-none"}),C.length>1&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),_(e=>(e-1+C.length)%C.length)},className:"absolute left-1 top-1/2 -translate-y-1/2 z-20 p-1 rounded-full bg-black/50 text-white hover:bg-yellow-400 hover:text-black transition-colors",children:(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,t.jsx)("path",{d:"m15 18-6-6 6-6"})})}),(0,t.jsx)("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),_(e=>(e+1)%C.length)},className:"absolute right-1 top-1/2 -translate-y-1/2 z-20 p-1 rounded-full bg-black/50 text-white hover:bg-yellow-400 hover:text-black transition-colors",children:(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,t.jsx)("path",{d:"m9 18 6-6-6-6"})})}),(0,t.jsx)("div",{className:"absolute bottom-1 left-1/2 -translate-x-1/2 flex gap-1 z-20",children:C.map((e,l)=>(0,t.jsx)("div",{className:`w-1.5 h-1.5 rounded-full ${l===P?"bg-yellow-400":"bg-white/30"}`},l))})]})]}),(0,t.jsxs)("div",{className:"flex-1 flex flex-col p-2 md:p-4 relative z-10 min-w-0",children:[(0,t.jsxs)("div",{className:"flex justify-between items-start mb-2",children:[(0,t.jsx)("h1",{className:`font-bold truncate pr-2 text-yellow-200 tracking-wide drop-shadow-sm leading-tight 121 ${"list"===n?"text-[13px] md:text-xl line-clamp-1":"text-[12px] sm:text-sm md:text-xl line-clamp-2 md:line-clamp-1"}`,children:u}),(0,t.jsx)("span",{className:"shrink-0 rounded-lg border border-yellow-400/40 bg-yellow-400/10 px-1.5 py-0.5 text-[9px] sm:text-[10px] text-yellow-100 uppercase font-bold tracking-wider",children:"android"===e.type?"APK":"windows"===e.type?"EXE":"premium"===e.type?"PREMIUM":"pro"===e.type?"PRO":A?"KEY":"APP"})]}),(0,t.jsx)("p",{className:`text-yellow-100/70 mb-2 md:mb-3 flex-1 leading-relaxed 122 ${"list"===n?"text-[10px] md:text-sm line-clamp-2 md:line-clamp-3":"text-[11px] sm:text-xs md:text-sm line-clamp-2 md:line-clamp-3"}`,children:e.description}),e.tags&&e.tags.length>0&&(0,t.jsx)("div",{className:`flex flex-wrap gap-1 mb-2 ${"list"===n?"hidden md:flex":"flex"}`,children:e.tags.slice(0,3).map(l=>(0,t.jsx)("span",{className:"text-[9px] sm:text-[10px] px-1.5 py-0.5 rounded-full bg-black/40 border border-yellow-400/30 text-yellow-100",children:l},`${e.id}-${l}`))}),(0,t.jsxs)("div",{className:"mt-auto pt-2 md:pt-4 md:border-t border-yellow-400/20 flex flex-col md:flex-row items-start md:items-center justify-between gap-1 md:gap-0",children:[(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1 my-1",children:[(0,t.jsx)("div",{className:"flex",children:[1,2,3,4,5].map(l=>(0,t.jsx)(x.Star,{size:12,className:`${l<=Math.round(e.ratingAverage||5)?"fill-yellow-400 text-yellow-400":"fill-zinc-800 text-zinc-700"}`},l))}),(0,t.jsxs)("span",{className:"text-[10px] text-zinc-500",children:["(",e.ratingCount||0,")"]})]}),!l&&(0,t.jsx)(t.Fragment,{children:0===N?(0,t.jsx)("span",{className:"text-[12px] sm:text-sm md:text-lg font-bold text-green-400 drop-shadow-[0_0_5px_rgba(253,224,71,0.5)]"}):z>0?(0,t.jsxs)("div",{className:"flex flex-col items-start leading-tight",children:[(0,t.jsxs)("span",{className:"text-[10px] text-zinc-500 line-through decoration-red-500 decoration-1",children:[N.toLocaleString(),"Ä"]}),(0,t.jsxs)("span",{className:"text-[12px] sm:text-sm md:text-lg font-bold text-red-500 drop-shadow-[0_0_5px_rgba(255,0,0,0.5)]",children:[S.toLocaleStr
122ing()," Ä"]})]}):(0,t.jsxs)("span",{className:"text-[12px] sm:text-sm md:text-lg font-bold text-yellow-300 drop-shadow-[0_0_5px_rgba(253,224,71,0.5)]",children:[N.toLocaleString()," Ä"]})})]}),(0,t.jsxs)("div",{className:"flex w-full md:w-auto gap-2 justify-end",children:[(0,t.jsx)(i.default,{href:`/products/${e.id}`,onClick:e=>{e.stopPropagation()},className:"w-full md:w-auto text-center rounded-lg md:rounded-xl border border-yellow-400/60 bg-yellow-400/20 px-2 py-1.5 md:px-4 md:py-2 text-[11px] sm:text-xs md:text-sm font-semibold text-yellow-100 transition-all hover:bg-yellow-400/40 hover:scale-105",children:o.details}),b?(0,t.jsx)("button",{type:"button",onClick:t=>{(t.stopPropagation(),f)?y(!0):v.push(`/products/${e.id}`)},className:"w-full md:w-auto text-center rounded-lg md:rounded-xl border border-red-500/80 bg-red-500/15 px-2 py-1.5 md:px-4 md:py-2 text-[11px] sm:text-xs md:text-sm font-semibold text-red-100 transition-all hover:bg-red-500/40 hover:border-red-400 hover:scale-105",children:o.download}):e.driveLink&&(l||0===e.price)&&(0,t.jsxs)("a",{href:e.driveLink,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"w-full md:w-auto text-center rounded-lg md:rounded-xl border border-red-500/80 bg-red-500/15 px-2 py-1.5 md:px-4 md:py-2 text-[11px] sm:text-xs md:text-sm font-semibold text-red-100 transition-all hover:bg-red-500/40 hover:border-red-400 hover:scale-105",children:["â¬ï¸ ",o.downloadNow]})]})]})]})]})]}),w&&b&&(0,t.jsx)("div",{className:"fixed inset-0 z-[100] bg-black/80 backdrop-blur-sm flex items-center justify-center p-4",onClick:()=>y(!1),children:(0,t.jsxs)("div",{className:"bg-zinc-900 border border-zinc-700 rounded-2xl max-w-md w-full p-5",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)("h3",{className:"text-lg font-bold text-yellow-300 mb-4",children:["ð¦ ",o.chooseVersion]}),(0,t.jsx)("div",{className:"space-y-2",children:e.versions.map(e=>(0,t.jsxs)("a",{href:e.driveLink,target:"_blank",rel:"noopener noreferrer",className:"flex justify-between items-center p-3 rounded-xl border text-sm transition bg-zinc-800 border-zinc-600 text-white hover:border-yellow-400 hover:bg-zinc-700",children:[(0,t.jsxs)("span",{className:"font-mono",children:[e.version,e.isLatest&&(0,t.jsxs)("span",{className:"ml-2 text-green-400",children:["⢠",o.latest]})]}),(0,t.jsxs)("span",{className:"text-xs",children:["â¬ï¸ ",o.downloadNow]})]},e.version))}),(0,t.jsx)("button",{onClick:()=>y(!1),className:"mt-4 w-full text-center py-2 rounded-lg bg-zinc-800 hover:bg-zinc-700 text-sm text-zinc-300",children:o.close})]})})]})};function F(e){return(0,t.jsxs)("article",{className:"rounded-xl border border-white/10 bg-neutral-900/70 p-3",children:[(0,t.jsx)("h3",{className:"text-sm font-bold text-yellow-200",children:e.title}),(0,t.jsx)("p",{className:"mt-2 text-sm leading-relaxed text-zinc-400",children:e.body})]},e.title)}function G(e,t){return{"@type":"Thing",position:t+1,name:e}}function W(e){return(0,t.jsx)("span",{children:e},e)}function q(e){return e+8}function X(e,t){let l=(e.views??0)+(e.likeCount??0)*5+(e.commentCount??0)*3;return(t.views??0)+(t.likeCount??0)*5+(t.commentCount??0)*3-l}function J(e,t){return(t.views??0)-(e.views??0)}function Y(e){return e.tag}function Q(e){return e+8}function Z(){window.localStorage.removeItem(O),window.location.reload()}e.s(["default",0,function(e){let i,a,x,m,u,g,b,f,w,y,v,j,k,N,S,z,C,P,_,E,A,T,$,L,D,I,V,U,ee,et,el,es,en,er,eo,ei,ea,ec,ed,eh,ex,ep,em,eu,eg,eb,ef,ew,ey,ev,ej,ek,eN,eS,ez,eC,eP,e_,eE,eA,eT,e$,eL,eD,eI,eM,eV,eR=(0,l.c)(160),{initialProducts:eU}=e,{lang:eO}=(0,R.useAppContext)(),eB=B[eO],[eH,eK]=(0,s.useState)(eO),[eF,eG]=(0,s.useState)(!1);eR[0]!==eO?(i=function(e){let t=[],l="vi"===eO?["miá»
n phÃ","dá»ch vụ","chất lượng má»i nhất","giá rẻ"]:["free","service","latest quality","best price"];return e.forEach(e=>{t.push(`${e} app`),t.push(`${e} software`),t.push(`${e} download`),t.push(`${e} tool`),l.forEach(l=>{t.push(`${e} ${l}`)}),t.push(`${e} 2026`),t.push(`${e} ios`),t.push(`${e} for you`),t.push(`${e} trending`)}),[...new Set(t)]},eR[0]=eO,eR[1]=i):i=eR[1];
122let eW=i,[eq,eX]=(0,s.useState)(eU);eR[2]!==eU?(a=()=>{eX(eU)},x=[eU],eR[2]=eU,eR[3]=a,eR[4]=x):(a=eR[3],x=eR[4]),(0,s.useEffect)(a,x),eR[5]===Symbol.for("react.memo_cache_sentinel")?(m=[],eR[5]=m):m=eR[5];let[eJ,eY]=(0,s.useState)(m),[eQ,eZ]=(0,s.useState)("grid"),[e0,e1]=(0,s.useState)(8),[e2,e5]=(0,s.useState)(!1),e4=(0,s.useRef)(null),[e3,e6]=(0,s.useState)("all"),[e8,e7]=(0,s.useState)(null),[e9,te]=(0,s.useState)("newest"),[tt,tl]=(0,s.useState)("all"),[ts]=(0,c.useAuthState)(r.auth),tn=(0,d.useRouter)(),tr=H[eH];eR[6]!==eO?(u=()=>{eK(eO)},g=[eO],eR[6]=eO,eR[7]=u,eR[8]=g):(u=eR[7],g=eR[8]),(0,s.useEffect)(u,g),eR[9]===Symbol.for("react.memo_cache_sentinel")?(b=()=>{eG("accepted"!==window.localStorage.getItem(O))},f=[],eR[9]=b,eR[10]=f):(b=eR[9],f=eR[10]),(0,s.useEffect)(b,f),eR[11]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{window.localStorage.setItem(O,"accepted"),eG(!1)},eR[11]=w):w=eR[11];let to=w;if(eR[12]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual"),window.innerWidth<640&&eZ("list")},v=[],eR[12]=y,eR[13]=v):(y=eR[12],v=eR[13]),(0,s.useEffect)(y,v),eR[14]!==ts?(j=()=>{(async()=>{if(!ts)return eY([]);let e=(0,n.doc)(r.db,"users",ts.uid),t=await (0,n.getDoc)(e);t.exists()?eY(t.data().purchasedProducts??[]):eY([])})()},k=[ts],eR[14]=ts,eR[15]=j,eR[16]=k):(j=eR[15],k=eR[16]),(0,s.useEffect)(j,k),eR[17]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{let e=()=>{window.innerHeight+document.documentElement.scrollTop+100>=document.documentElement.offsetHeight&&e1(Q)};return window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)},S=[],eR[17]=N,eR[18]=S):(N=eR[17],S=eR[18]),(0,s.useEffect)(N,S),eR[19]!==e3||eR[20]!==eq||eR[21]!==e9){let e,t="all"===e3?eq:eq.filter(e=>e.category===e3),l=new Map;t.forEach(e=>{if(!e.tags||0===e.tags.length)return;let t=e.views??0,s=e.likeCount??0,n=e.commentCount??0,r=(e=>{if(!e)return 0;if("number"==typeof e)return e;try{return e.toMillis()}catch{return 0}})(e.createdAt);e.tags.forEach(e=>{let o=l.get(e);o?(o.totalViews=o.totalViews+t,o.totalLikes=o.totalLikes+s,o.totalComments=o.totalComments+n,r>o.latestCreatedAt&&(o.latestCreatedAt=r)):l.set(e,{tag:e,totalViews:t,totalLikes:s,totalComments:n,latestCreatedAt:r})})}),z=Array.from(l.values()),eR[23]!==e9?(e=(e,t)=>{if("views"===e9)return t.totalViews-e.totalViews;if("popular"===e9){let l=e.totalViews+5*e.totalLikes+3*e.totalComments;return t.totalViews+5*t.totalLikes+3*t.totalComments-l}return t.latestCreatedAt-e.latestCreatedAt},eR[23]=e9,eR[24]=e):e=eR[24],z.sort(e),eR[19]=e3,eR[20]=eq,eR[21]=e9,eR[22]=z}else z=eR[22];let ti=z;eR[25]!==ti?(C=ti.map(Y),eR[25]=ti,eR[26]=C):C=eR[26];let ta=C;eR[27]!==e3||eR[28]!==e8||eR[29]!==tt||eR[30]!==eq||eR[31]!==e9?(P=[...eq],"all"!==e3&&(P=P.filter(e=>e.category===e3)),"all"!==tt&&(P=P.filter(e=>e.type===tt)),e8&&(P=P.filter(e=>e.tags&&e.tags.includes(e8))),"views"===e9?P.sort(J):"popular"===e9&&P.sort(X),eR[27]=e3,eR[28]=e8,eR[29]=tt,eR[30]=eq,eR[31]=e9,eR[32]=P):P=eR[32];let tc=P;eR[33]!==tc||eR[34]!==e0?(_=tc.slice(0,e0),eR[33]=tc,eR[34]=e0,eR[35]=_):_=eR[35];let td=_;eR[36]!==tc.length||eR[37]!==e2||eR[38]!==e0?(E=()=>{let e=new IntersectionObserver(e=>{e[0].isIntersecting&&!e2&&e0<tc.length&&(e5(!0),setTimeout(()=>{e1(q),e5(!1)},500))},{root:null,rootMargin:"50px",threshold:.1}),t=e4.current;return t&&e.observe(t),()=>{t&&e.unobserve(t)}},A=[tc.length,e0,e2],eR[36]=tc.length,eR[37]=e2,eR[38]=e0,eR[39]=E,eR[40]=A):(E=eR[39],A=eR[40]),(0,s.useEffect)(E,A),eR[41]!==tn?(T=function(e){"articles"===e?tn.push("/articles"):(e6(e),e1(8))},eR[41]=tn,eR[42]=T):T=eR[42];let th=T;eR[43]===Symbol.for("react.memo_cache_sentinel")?($=e=>{e7(t=>t===e?null:e),e1(8)},eR[43]=$):$=eR[43];let tx=$;eR[44]===Symbol.for("react.memo_cache_sentinel")?(L=e=>{te(e.target.value),e1(8)},eR[44]=L):L=eR[44];let tp=L;eR[45]===Symbol.for("react.memo_cache_sentinel")?(D=e=>{tl(e.target.value),e1(8)},eR[45]=D):D=eR[45];let tm=D;eR[46]===Symbol.for("react.memo_cache_sentinel")?(I=(0,t.jsx)(o.default,{}),eR[46]=I):I=eR[46],eR[47]!==eB.featuredProducts?(V=(0,t.jsx)("h1",{className:"text-2xl sm:text-3xl font-bold text-yellow-400 sm:bg-clip-text sm:text-transparent sm:bg-gradient-to-r sm:from-yellow-200 sm:to-yellow-500 font-semibold whitespace-nowrap",children:eB.featuredProducts}),eR[47]=eB.featuredProducts,eR[48]=V):V=eR[48];let tu="template"===e3,tg=ts?.uid;eR[49]!==tu||eR[50]!==tg?(U=(0,t.jsx)(M,{visible:tu,userId:tg}),eR[49]=tu,eR[50]=tg,eR[51]=U):U=eR[51],eR[52]!==eB.tabs.all?(ee={id:"all",label:eB.tabs.all},eR[52]=eB.tabs.all,eR[53]=ee):ee=eR[53],eR[54]!==eB.tabs.template?(et={i
122d:"template",label:eB.tabs.template},eR[54]=eB.tabs.template,eR[55]=et):et=eR[55],eR[56]!==eB.tabs.software?(el={id:"software",label:eB.tabs.software},eR[56]=eB.tabs.software,eR[57]=el):el=eR[57],eR[58]!==eB.tabs.app?(es={id:"app",label:eB.tabs.app},eR[58]=eB.tabs.app,eR[59]=es):es=eR[59],eR[60]!==eB.tabs.articles?(en={id:"articles",label:eB.tabs.articles},eR[60]=eB.tabs.articles,eR[61]=en):en=eR[61],eR[62]!==ee||eR[63]!==et||eR[64]!==el||eR[65]!==es||eR[66]!==en?(er=[ee,et,el,es,en],eR[62]=ee,eR[63]=et,eR[64]=el,eR[65]=es,eR[66]=en,eR[67]=er):er=eR[67],eR[68]!==e3||eR[69]!==th||eR[70]!==er?(eo=(0,t.jsx)("div",{className:"flex gap-1.5 md:gap-2 p-1 rounded-xl border border-white/10 max-w-full overflow-x-auto overflow-y-hidden snap-x scroll-smooth [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",children:er.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>th(e.id),className:`shrink-0 snap-center whitespace-nowrap px-3 py-1.5 md:px-4 md:py-2 rounded-lg md:rounded-xl text-xs md:text-sm font-semibold transition-all ${e3===e.id?"border border-purple-400/60 bg-purple-400/20 text-purple-100 md:hover:scale-105 hover:shadow-[0_0_15px_rgba(251,18,162,0.3)]":"text-neutral-400 hover:text-white"}`,children:e.label},e.id))}),eR[68]=e3,eR[69]=th,eR[70]=er,eR[71]=eo):eo=eR[71],eR[72]!==V||eR[73]!==U||eR[74]!==eo?(ei=(0,t.jsxs)("div",{className:"flex flex-col md:flex-row justify-between items-center mb-6 gap-4",children:[V,U,eo]}),eR[72]=V,eR[73]=U,eR[74]=eo,eR[75]=ei):ei=eR[75],eR[76]!==e8||eR[77]!==ta?(ea=(0,t.jsx)("div",{className:"flex-1",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:(0,t.jsx)(p,{tags:ta,activeTag:e8,onTagClick:tx})})}),eR[76]=e8,eR[77]=ta,eR[78]=ea):ea=eR[78],eR[79]!==ta||eR[80]!==eW||eR[81]!==eB.seoIntro||eR[82]!==eB.seoPopular||eR[83]!==eB.seoTitle?(ec=ta.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("section",{className:"hidden",children:[(0,t.jsx)("h2",{children:eB.seoTitle}),(0,t.jsxs)("p",{children:[eB.seoIntro," ",ta.join(", "),"."]}),(0,t.jsxs)("p",{children:[eB.seoPopular," ",eW(ta).slice(0,40).join(", "),"."]})]}),(0,t.jsx)("div",{className:"hidden",children:eW(ta).map(W)}),(0,t.jsx)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify({"@context":"https://schema.org","@type":"ItemList",itemListElement:ta.map(G)})}})]}),eR[79]=ta,eR[80]=eW,eR[81]=eB.seoIntro,eR[82]=eB.seoPopular,eR[83]=eB.seoTitle,eR[84]=ec):ec=eR[84],eR[85]===Symbol.for("react.memo_cache_sentinel")?(ed=()=>eZ("grid"),eR[85]=ed):ed=eR[85];let tb=`p-2 rounded transition-colors ${"grid"===eQ?"bg-yellow-400 text-black":"text-zinc-400 hover:text-white"}`;eR[86]===Symbol.for("react.memo_cache_sentinel")?(eh=(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{width:"7",height:"7",x:"3",y:"3",rx:"1"}),(0,t.jsx)("rect",{width:"7",height:"7",x:"14",y:"3",rx:"1"}),(0,t.jsx)("rect",{width:"7",height:"7",x:"14",y:"14",rx:"1"}),(0,t.jsx)("rect",{width:"7",height:"7",x:"3",y:"14",rx:"1"})]}),eR[86]=eh):eh=eR[86],eR[87]!==tb||eR[88]!==eB.gridView?(ex=(0,t.jsx)("button",{onClick:ed,className:tb,title:eB.gridView,children:eh}),eR[87]=tb,eR[88]=eB.gridView,eR[89]=ex):ex=eR[89],eR[90]===Symbol.for("react.memo_cache_sentinel")?(ep=()=>eZ("list"),eR[90]=ep):ep=eR[90];let tf=`p-2 rounded transition-colors ${"list"===eQ?"bg-yellow-400 text-black":"text-zinc-400 hover:text-white"}`;eR[91]===Symbol.for("react.memo_cache_sentinel")?(em=(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("line",{x1:"8",x2:"21",y1:"6",y2:"6"}),(0,t.jsx)("line",{x1:"8",x2:"21",y1:"12",y2:"12"}),(0,t.jsx)("line",{x1:"8",x2:"21",y1:"18",y2:"18"}),(0,t.jsx)("line",{x1:"3",x2:"3.01",y1:"6",y2:"6"}),(0,t.jsx)("line",{x1:"3",x2:"3.01",y1:"12",y2:"12"}),(0,t.jsx)("line",{x1:"3",x2:"3.01",y1:"18",y2:"18"})]}),eR[91]=em):em=eR[91],eR[92]!==tf||eR[93]!==eB.listView?(eu=(0,t.jsx)("button",{onClick:ep,className:tf,title:eB.listView,children:em}),eR[92]=tf,eR[93]=eB.listView,eR[94]=eu):eu=eR[94],eR[95]!==ex||eR[96]!==eu?(eg=(0,t.jsxs)("div",{className:"flex items-center bg-neutral-900 border border-white/10 rounded-lg p-1 h-[42px] shrink-0",children:[ex,eu]}),eR[95]=ex,eR[96]=eu,eR[97]=eg):eg=eR[97],eR[98]!==eB.allPlatforms?(eb=(0,t.jsxs)("option",{value:"all",children:["ð ",eB.allPlatforms]}),eR[98]=eB.allPlatforms,eR[99]=eb):eb=eR[99],eR[100]===Symbol.for("react.memo_cache_sentinel")?(ef=(0,t.jsx)("option",{value:"android",children:"ð¤ Android (APK)"}),ew=(0,t.jsx)("option",{value:"windows",children:"ð» Windows (EXE)"}),ey=(0,t.jsx)("option",{value:"ios",children:"ð iOS"}),ev=(0,t.jsx)("option",{value:"premium",children:"ð Premium Acc"}),ej=(0,t.jsx)("option",{value:"pro",children:"ð Pro Key"}),eR[100]=ef,eR[101]=ew,eR[102]=ey,eR[103]=ev,eR[104]=ej):(ef=eR[100],ew=eR[101],ey=eR[102],ev=eR[103],ej=eR[104]),eR[105]!==tt||eR[106]!==eb?(ek=(0,t.jsx)("div",{className:"flex-1 sm:w-auto min-w-[140px]",children:(0,t.jsxs)("select",{value:tt,onCh
122ange:tm,className:"w-full h-[42px] bg-neutral-900 border border-white/10 text-white text-sm rounded-lg p-2.5 focus:ring-yellow-500 focus:border-yellow-500 outline-none",children:[eb,ef,ew,ey,ev,ej]})}),eR[105]=tt,eR[106]=eb,eR[107]=ek):ek=eR[107],eR[108]!==eg||eR[109]!==ek?(eN=(0,t.jsxs)("div",{className:"flex gap-2 w-full sm:w-auto",children:[eg,ek]}),eR[108]=eg,eR[109]=ek,eR[110]=eN):eN=eR[110],eR[111]!==eB.newest?(eS=(0,t.jsxs)("option",{value:"newest",children:["ð
",eB.newest]}),eR[111]=eB.newest,eR[112]=eS):eS=eR[112],eR[113]!==eB.mostViewed?(ez=(0,t.jsxs)("option",{value:"views",children:["ðï¸ ",eB.mostViewed]}),eR[113]=eB.mostViewed,eR[114]=ez):ez=eR[114],eR[115]!==eB.hottest?(eC=(0,t.jsxs)("option",{value:"popular",children:["ð¥ ",eB.hottest]}),eR[115]=eB.hottest,eR[116]=eC):eC=eR[116],eR[117]!==e9||eR[118]!==eS||eR[119]!==ez||eR[120]!==eC?(eP=(0,t.jsx)("div",{className:"w-full sm:w-auto min-w-[170px]",children:(0,t.jsxs)("select",{value:e9,onChange:tp,className:"w-full h-[42px] bg-neutral-900 border border-white/10 text-white text-sm rounded-lg p-2.5 focus:ring-yellow-500 focus:border-yellow-500",children:[eS,ez,eC]})}),eR[117]=e9,eR[118]=eS,eR[119]=ez,eR[120]=eC,eR[121]=eP):eP=eR[121],eR[122]!==eN||eR[123]!==eP?(e_=(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2 shrink-0",children:[eN,eP]}),eR[122]=eN,eR[123]=eP,eR[124]=e_):e_=eR[124],eR[125]!==ea||eR[126]!==ec||eR[127]!==e_?(eE=(0,t.jsxs)("div",{className:"flex flex-col md:flex-row gap-6 mb-8",children:[ea,ec,e_]}),eR[125]=ea,eR[126]=ec,eR[127]=e_,eR[128]=eE):eE=eR[128];let tw=`grid gap-6 ${"list"===eQ?"grid-cols-1":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`;return eR[129]!==eO||eR[130]!==eJ||eR[131]!==eB||eR[132]!==eQ||eR[133]!==td?(eA=td.map(e=>(0,t.jsx)("div",{className:"animate-in fade-in slide-in-from-bottom-8 duration-700 ease-out fill-mode-backwards",children:(0,t.jsx)(K,{product:e,hasPurchased:eJ.includes(e.id),viewMode:eQ,labels:eB,lang:eO})},e.id)),eR[129]=eO,eR[130]=eJ,eR[131]=eB,eR[132]=eQ,eR[133]=td,eR[134]=eA):eA=eR[134],eR[135]!==tc.length||eR[136]!==eB.emptyResults?(eT=0===tc.length&&(0,t.jsx)("div",{className:"col-span-full text-center py-20 text-neutral-500",children:eB.emptyResults}),eR[135]=tc.length,eR[136]=eB.emptyResults,eR[137]=eT):eT=eR[137],eR[138]!==tc.length||eR[139]!==eB.loadingMore||eR[140]!==e0?(e$=e0<tc.length&&(0,t.jsxs)("div",{className:"flex items-center gap-2 text-yellow-500 bg-neutral-900/50 px-4 py-2 rounded-full border border-white/5 backdrop-blur-sm",children:[(0,t.jsx)(h.Loader2,{className:"animate-spin",size:20}),(0,t.jsx)("span",{className:"text-zinc-400 text-sm font-medium",children:eB.loadingMore})]}),eR[138]=tc.length,eR[139]=eB.loadingMore,eR[140]=e0,eR[141]=e$):e$=eR[141],eR[142]!==e$?(eL=(0,t.jsx)("div",{ref:e4,className:"w-full flex justify-center items-center py-8 mt-4 min-h-[60px]",children:e$}),eR[142]=e$,eR[143]=eL):eL=eR[143],eR[144]!==tw||eR[145]!==eA||eR[146]!==eT||eR[147]!==eL?(eD=(0,t.jsxs)("div",{className:tw,children:[eA,eT,eL]}),eR[144]=tw,eR[145]=eA,eR[146]=eT,eR[147]=eL,eR[148]=eD):eD=eR[148],eR[149]!==ei||eR[150]!==eE||eR[151]!==eD?(eI=(0,t.jsxs)("div",{className:"pt-24 px-4 max-w-7xl mx-auto",children:[ei,eE,eD]}),eR[149]=ei,eR[150]=eE,eR[151]=eD,eR[152]=eI):eI=eR[152],eR[153]!==eH||eR[154]!==tr||eR[155]!==eF?(eM=eF&&(0,t.jsx)("div",{className:"pointer-events-none fixed inset-x-0 bottom-0 z-[120] px-3 pb-3 sm:px-5 sm:pb-5 lg:px-8",children:(0,t.jsxs)("section",{role:"region","aria-labelledby":"cookie-policy-title",className:"pointer-events-auto mx-auto flex max-h-[78dvh] w-full max-w-6xl flex-col overflow-hidden rounded-2xl border border-yellow-400/30 bg-neutral-950/95 text-white shadow-2xl shadow-black/70 backdrop-blur-xl sm:max-h-[64dvh] lg:max-h-[52dvh]",children:[(0,t.jsxs)("div",{className:"shrink-0 border-b border-white/10 px-4 py-3 sm:px-5",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.2em] text-yellow-300",children:"P-SPACE Store"}),(0,t.jsx)("h2",{id:"cookie-policy-title",className:"mt-1 text-lg font-bold text-yellow-100 sm:text-xl",children:tr.title}),(0,t.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:tr.effective})]}),(0,t.jsxs)("div",{className:"grid shrink-0 grid-cols-2 gap-2 sm:flex sm:items-center",children:[(0,t.jsx)("button",{type:"button",onClick:()=>eK("en"),"aria-pressed":"en"===eH,className:`rounded-full border px-3 py-2 text-xs font-bold transition ${"en"===eH?"border-yellow-400 bg-yellow-400 text-black":"border-yellow-400/40 text-yellow-100 hover:bg-yellow-400/15"}`,children:"English"}),(0,t.jsx)("button",{type:"button",onClick:()=>eK("vi"),"aria-pressed":"vi"===eH,className:`rounded-full border px-3 py-2 text-xs font-bold transition ${"vi"===eH?"border-yellow-400 bg-yellow-400 text-black":"border-yellow-400/40 text-yellow-100 hover:bg-yellow-400/15"}`,children:"Tiếng Viá»t"}),(0,t.jsx)("button",{type:"button",onClick:Z,className:"rounded-full border border-zinc-700 px-3 py-2 text-xs font-bold text-zinc-300 transition hover:bg-zinc-900 sm:min-w-24",children:tr.cancel}),(0,t.jsx)("button",{type:"button",onClick:to,className:"rounded-full bg-yellow-400 px-4 py-2 text-xs font-black text-black transition hover:bg-yellow-300 sm:min-w-24",children:tr.agree})]})]}),(0,t.jsx)("p",{className:"mt-2 text-sm leading-relaxed text-zinc-300",children:tr.subtitle})]}),(0,t.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-3 sm:px-5",children:[(0,t.jsx)("p",{className:"rounded-xl border border-white/10 bg-white/[0.03] p-3 text-sm leading-relaxed text-zinc-300",children:tr.intro}),(0,t.jsx)("div",{className:"mt-3 grid gap-3 md:grid-cols-3",children:tr.sections.map(F)}),(0,t.jsx)("p",{className:"mt-4 rounded-xl border border-yellow-400/20 bg-yellow-400/10 p-3 text-sm leading-relaxed text-yellow-50",children:tr.note})]})]})}),eR[153]=eH,eR[154]=tr,eR[155]=eF,eR[156]=eM):eM=eR[156],eR[157]!==eI||eR[158]!==eM?(eV=(0,t.jsxs)("main",{className:"min-h-screen text-white pb-20 bg-background",children:[I,eI,eM]}),eR[157]=eI,eR[158]=eM,eR[159]=eV):eV=eR[159],eV}],354523)}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.