PageSourceSearch

https://artpanda.ai/assets/Products-DLDXZ_l4.js

js artpanda.ai collected 2026-10-05 11:49:00 UTC 42,692 bytes, 11 lines download raw bytes

1import{P as at,r as n,j as e,U as Pe,a6 as rt,a4 as it,ak as Me,ae as Ie,f as be,al as lt,F as ge,z as d,M as T}from"./index-D-jN7C_p.js";import{a as Ee}from"./admin.service-lgqACIba.js";import{C as ie,a as le,c as ne}from"./card-DJh-Qkx_.js";import{I as m}from"./input-374BwHQW.js";import{B as v}from"./button-boV1ZC-X.js";import{A as nt,a as ct,b as ce,c as de}from"./AdminPageShell-A-9cqZDi.js";function Te(H){return at({attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M7 2a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0M7 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0M7 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m-3 3a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m-3 3a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0"},child:[]}]})(H)}function dt(){return"prod_"+Math.random().toString(36).slice(2,8)}function bt(){const[H,ve]=n.useState(!0),[Ne,G]=n.useState(""),[N,oe]=n.useState([]),[b,me]=n.useState([]),[L,je]=n.useState(!1),[D,V]=n.useState(1),q=10,[U,W]=n.useState(1),X=10,[J,A]=n.useState(null),[Le,P]=n.useState(!1),[K,fe]=n.useState("product"),[h,w]=n.useState({id:"",name:"",credits:"",priceUsd:"",currency:"USD",featured:!1,rank:0,active:!0,description:"",highlights:"",imageUrl:""}),[u,S]=n.useState({id:"",name:"",monthlyCredits:"",priceUsd:"",currency:"USD",featured:!1,rank:0,active:!0,description:"",highlights:"",imageUrl:""}),[_e,_]=n.useState(!1),[xe,ye]=n.useState("product"),[i,g]=n.useState(null),[f,M]=n.useState({enabled:!1,percent:0,appliesTo:"all",minAmountUsd:""}),[I,Ce]=n.useState({enabled:!1,percent:0,appliesTo:"all",minAmountUsd:""}),[z,we]=n.useState(!1),[E,R]=n.useState(!1),[Q,he]=n.useState("50"),[Y,Se]=n.useState("50"),[Z,ue]=n.useState("100"),[ee,ke]=n.useState("100"),[te,pe]=n.useState("100"),[se,De]=n.useState("100"),[ae,Ue]=n.useState(!1),[F,Fe]=n.useState(!1),[$,re]=n.useState({open:!1,payload:null});async function ze(){ve(!0),G("");try{const s=(await Ee.priceTable())?.data||{};oe((s.products||[]).map(a=>({...a,description:a.description||"",highlights:Array.isArray(a.highlights)?a.highlights:[],imageUrl:a.imageUrl||"",featured:!!a.featured,rank:Number(a.rank??0)||0,currency:a.currency||"USD",priceUsd:(Number(a.price||0)/100).toFixed(2)}))),me((s.subscriptions||[]).map(a=>({...a,description:a.description||"",highlights:Array.isArray(a.highlights)?a.highlights:[],imageUrl:a.imageUrl||"",featured:!!a.featured,rank:Number(a.rank??0)||0,currency:a.currency||"USD",priceUsd:(Number(a.price||0)/100).toFixed(2)})))}catch(t){G(t.message||"Failed to load products")}finally{ve(!1)}}async function Re(){we(!0);try{const t=await T.getCryptoDiscount(),s=t?.data||t||{},a=Number.isFinite(Number(s.percent))?Number(s.percent):0,l=Number(s.minAmountCents||0);let c="";Number.isFinite(l)&&l>0&&(c=(l/100).toFixed(2));const x={enabled:!!s.enabled,percent:a,appliesTo:s.appliesTo||"all",minAmountUsd:c};M(x),Ce(x)}catch(t){d.error(t.message||"Failed to load crypto discount")}finally{we(!1)}}async function $e(){Ue(!0);try{const[t,s]=await Promise.all([T.getDailyFreeCredits(),T.getDailyFreeCreditLimits()]),a=t?.data||t||{},l=s?.data||s||{},c=Number.isFinite(Number(a.credits))?String(Number(a.credits)):"50",x=Number.isFinite(Number(l.ipCap))?String(Number(l.ipCap)):"100",o=Number.isFinite(Number(l.deviceCap))?String(Number(l.deviceCap)):"100";he(c),Se(c),ue(x),ke(x),pe(o),De(o)}catch(t){d.error(t.message||"Failed to load daily free credits")}finally{Ue(!1)}}n.useEffect(()=>{ze(),Re(),$e()},[]);const B=n.useMemo(()=>Math.max(1,Math.ceil((N.length||0)/q)),[N,q]),O=n.useMemo(()=>Math.max(1,Math.ceil((b.length||0)/X)),[b,X]);n.useEffect(()=>{D>B&&V(B)},[D,B]),n.useEffect(()=>{U>O&&W(O)},[U,O]);const Be=n.useMemo(()=>{const t=(D-1)*q;return N.slice(t,t+q)},[N,D]),Oe=n.useMemo(()=>{const t=(U-1)*X;return b.slice(t,t+X)},[b,U]),He=n.useMemo(()=>I?!!f.enabled!=!!I.enabled||Number(f.percent||0)!==Number(I.percent||0)||String(f.appliesTo||"")!==String(I.appliesTo||"")||String(f.minAmountUsd||"")!==String(I.minAmountUsd||""):!1,[f,I]),Ge=n.useMemo(()=>String(Q||"")!==String(Y||"")||String(Z||"")!==String(ee||"")||String(te||"")!==String(se||""),[Q,Y,Z,ee,te,se]);function Ve(t){const s=b.map(a=>a.id===t?{...a,active:!a.active}:a);k(N,s)}function Ae(t,s,a){const l=t.slice(),[c]=l.splice(s,1);return l.splice(a,0,c),l}async function qe(t,s){if(!(!t||!s||t===s))try{const a=N.findIndex(o=>o.id===t),l=N.findIndex(o=>o.id===s);if(a<0||l<0)return;const c=Ae(N,a,l).map((o,y)=>({...o,rank:y})),x=d.loading("Updating order...");await k(c,b),d.success("Rank updated",{id:x})}catch(a){d.error(a.message||"Failed to update rank")}finally{A(null)}}async function We(t,s){if(!(!t||!s||t===s))try{const a=b.findIndex(o=>o.id===t),l=b.findIndex(o=>o.id===s);if(a<0||l<0)return;const c=Ae(b,a,l).map((o,y)=>({...o,rank:y})),x=d.loading("Updating order...");await k(N,c),d.success("Rank updated",{id:x})}catch(a){d.error(a.message||"Failed to update rank")}finally{A(null)}}async function k(t,s=b){je(!0),G("");try{const l={items:[...t.map(r=>({planId:r.id,name:r.name,type:"one-time",credits:Number(r.credits),price:Math.round(Number(r.priceUsd)*100),currency:r.currency||"USD",interval:null,renew
1al:!1,active:r.active!==!1,featured:!!r.featured,rank:Number(r.rank??0)||0,description:r.description||void 0,highlights:Array.isArray(r.highlights)?r.highlights:String(r.highlights||"").split(`
2`).map(C=>C.trim()).filter(Boolean),imageUrl:r.imageUrl||void 0})),...s.map(r=>({planId:r.id,name:r.name,type:"subscription",credits:Number(r.monthlyCredits),price:Math.round(Number(r.priceUsd)*100),currency:r.currency||"USD",interval:"month",renewal:!0,active:r.active!==!1,featured:!!r.featured,rank:Number(r.rank??0)||0,description:r.description||void 0,highlights:Array.isArray(r.highlights)?r.highlights:String(r.highlights||"").split(`
3`).map(C=>C.trim()).filter(Boolean),imageUrl:r.imageUrl||void 0}))],replace:!0},x=(await Ee.updatePriceTable(l))?.data||{},o=Array.isArray(x.products)?x.products:null,y=Array.isArray(x.subscriptions)?x.subscriptions:null;if(o){const r=new Map(t.map(j=>[j.id,j])),C=o.map(j=>{const p={...r.get(j.id)||{},...j};return{...p,description:p.description||"",highlights:Array.isArray(p.highlights)?p.highlights:[],imageUrl:p.imageUrl||"",featured:!!p.featured,rank:Number(p.rank??0)||0,currency:p.currency||"USD",priceUsd:(Number(p.price||0)/100).toFixed(2)}});oe(C)}else oe(t.map(r=>({...r,priceUsd:(Number(r.price||0)/100).toFixed(2)})));if(y){const r=new Map(s.map(j=>[j.id,j])),C=y.map(j=>{const p={...r.get(j.id)||{},...j};return{...p,description:p.description||"",highlights:Array.isArray(p.highlights)?p.highlights:[],imageUrl:p.imageUrl||"",featured:!!p.featured,rank:Number(p.rank??0)||0,currency:p.currency||"USD",priceUsd:(Number(p.price||0)/100).toFixed(2)}});me(C)}else me(s.map(r=>({...r,priceUsd:(Number(r.price||0)/100).toFixed(2)})))}catch(a){G(a.message||"Failed to save products")}finally{je(!1)}}async function Xe(){R(!0);try{const t=Number(f.percent);if(!Number.isFinite(t)||t<0||t>100){d.error("Percent must be between 0 and 100"),R(!1);return}const s=f.appliesTo||"all";if(!["all","one_time","subscription"].includes(s)){d.error("Invalid appliesTo value"),R(!1);return}const a=f.minAmountUsd,l=a===""?0:Number(a);if(!Number.isFinite(l)||l<0){d.error("Minimum amount must be a non-negative number"),R(!1);return}const c={enabled:!!f.enabled,percent:t,appliesTo:s,minAmountCents:l>0?Math.round(l*100):0},x=await T.setCryptoDiscount(c),o=x?.data||x||c,y=Number.isFinite(Number(o.percent))?Number(o.percent):0,r=Number(o.minAmountCents||0);let C="";Number.isFinite(r)&&r>0&&(C=(r/100).toFixed(2));const j={enabled:!!o.enabled,percent:y,appliesTo:o.appliesTo||"all",minAmountUsd:C};M(j),Ce(j),d.success("Crypto discount saved")}catch(t){d.error(t.message||"Failed to save crypto discount")}finally{R(!1)}}function Je(){const t=Number(Q),s=Number(Z),a=Number(te);return!Number.isFinite(t)||t<0||!Number.isInteger(t)||!Number.isFinite(s)||s<0||!Number.isInteger(s)||!Number.isFinite(a)||a<0||!Number.isInteger(a)?(d.error("Daily credit values must be non-negative whole numbers"),null):t>1e5||s>1e5||a>1e5?(d.error("Daily credit values must be 100,000 or less"),null):{credits:t,ipCap:s,deviceCap:a}}function Ke(){const t=Je();t&&re({open:!0,payload:t})}async function Qe(t=$.payload){if(!t)return;const{credits:s,ipCap:a,deviceCap:l}=t;Fe(!0);try{const[c,x]=await Promise.all([T.setDailyFreeCredits(s),T.setDailyFreeCreditLimits({ipCap:a,deviceCap:l})]),o=c?.data||c||{credits:s},y=x?.data||x||{ipCap:a,deviceCap:l},r=Number.isFinite(Number(o.credits))?String(Number(o.credits)):String(s),C=Number.isFinite(Number(y.ipCap))?String(Number(y.ipCap)):String(a),j=Number.isFinite(Number(y.deviceCap))?String(Number(y.deviceCap)):String(l);he(r),Se(r),ue(C),ke(C),pe(j),De(j),re({open:!1,payload:null}),d.success("Daily free credit settings saved")}catch(c){d.error(c.message||"Failed to save daily free credits")}finally{Fe(!1)}}function Ye(){if(K==="product"){const t=Number(h.credits),s=Number(h.priceUsd);if(!Number.isFinite(t)||t<=0){d.error("Credits must be a positive number");return}if(!Number.isFinite(s)||s<=0){d.error("Price must be a positive number");return}const a=(h.id||"").trim()||dt(),l=String(h.highlights||"").split(`
4`).map(o=>
4o.trim()).filter(Boolean),x=[{id:a,name:h.name||`${t} credits`,credits:t,priceUsd:s,currency:h.currency||"USD",active:h.active!==!1,featured:!!h.featured,rank:Number(h.rank??0)||0,description:h.description||"",highlights:l,imageUrl:h.imageUrl||""},...N];w({id:"",name:"",credits:"",priceUsd:"",currency:"USD",featured:!1,rank:0,active:!0,description:"",highlights:"",imageUrl:""}),P(!1),V(1),k(x,b)}else{const t=Number(u.monthlyCredits),s=Number(u.priceUsd);if(!Number.isFinite(t)||t<=0){d.error("Monthly credits must be a positive number");return}if(!Number.isFinite(s)||s<=0){d.error("Price must be a positive number");return}const a=(u.id||"").trim()||"sub_"+Math.random().toString(36).slice(2,8),l=String(u.highlights||"").split(`
5`).map(o=>o.trim()).filter(Boolean),x=[{id:a,name:u.name||`${t} credits/mo`,monthlyCredits:t,priceUsd:s,currency:u.currency||"USD",active:u.active!==!1,featured:!!u.featured,rank:Number(u.rank??0)||0,description:u.description||"",highlights:l,imageUrl:u.imageUrl||""},...b];S({id:"",name:"",monthlyCredits:"",priceUsd:"",currency:"USD",featured:!1,rank:0,active:!0,description:"",highlights:"",imageUrl:""}),P(!1),W(1),k(N,x)}}function Ze(t){const s=N.filter(a=>a.id!==t);k(s,b)}function et(t){const s=N.map(a=>a.id===t?{...a,active:!a.active}:a);k(s,b)}function tt(t){const s=b.filter(a=>a.id!==t);k(N,s)}return e.jsxs(nt,{title:"Product Catalog",description:"Manage credit packs, subscriptions, and checkout discount rules from one pricing workspace.",children:[Ne&&e.jsx("div",{className:ct,children:Ne}),e.jsxs(ie,{className:ce,children:[e.jsx(le,{className:"border-b-0 p-0",children:e.jsx(de,{icon:Pe,title:"Daily Free Credits",description:"Set how many free credits verified users receive when their daily balance resets."})}),e.jsx(ne,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"User credits per day"}),e.jsx(m,{type:"number",min:"0",step:"1",value:Q,onChange:t=>he(t.target.value),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500",placeholder:"50",disabled:ae||F})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Per IP free cap"}),e.jsx(m,{type:"number",min:"0",step:"1",value:Z,onChange:t=>ue(t.target.value),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500",placeholder:"100",disabled:ae||F})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Per device free cap"}),e.jsx(m,{type:"number",min:"0",step:"1",value:te,onChange:t=>pe(t.target.value),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500",placeholder:"100",disabled:ae||F})]})]}),e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-3",children:[e.jsx("p",{className:"text-[11px] text-slate-500",children:"User credits reset daily. IP and device caps limit the total free daily credits shared by accounts on the same network or browser."}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"text-xs text-slate-400",children:["Current:"," ",e.jsxs("span",{className:"font-semibold text-slate-100",children:[Number(Y||0).toLocaleString("en-US")," user /"," ",Number(ee||0).toLocaleString("en-US")," IP /"," ",Number(se||0).toLocaleString("en-US")," device"]})]}),e.jsx(v,{size:"sm",onClick:Ke,disabled:!Ge||ae||F,className:"bg-slate-600 hover:bg-slate-700 text-white disabled:opacity-60",children:F?"Saving...":"Save Daily Credits"})]})]})]})})]}),e.jsxs(ie,{className:ce,children:[e.jsx(le,{className:"border-b-0 p-0",children:e.jsx(de,{icon:rt,title:"Discounts",description:"Offer an automatic discount when users pay with cryptocurrency via NOWPayments."})}),e.jsx(ne,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",title:"Enable crypto discount",children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",checked:!!f.enabled,onChange:t=>M(s=>({...s,enabled:t.target.checked})),disabled:z||E}),e.jsx("div",{className:"w-10 h-5 rounded-full bg-slate-600 peer-checked:bg-blue-500 transition-colors"}),e.jsx("div",{className:"absolute left-0.5 top-0.5 w-4 h-4 bg-slate-800 rounded-full transition-transform transform peer-checked:translate-x-5 shadow"})]}),e.jsx("span",{className:"text-sm text-slate-100 select-none",children:"Enable crypto discount"})]}),e.jsx("div",{className:"text-xs text-slate-400 text-right space-y-1",children:e.jsx("div",{children:f.enabled?`Crypto: ${Number(f.percent||0)}% off`:"Crypto discount disabled"})})]}),f.enabled&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Discount %"}),e.jsx(m,{type:"number",min:"0",max:"100",step:"1",value:f.percent,onChange:t=>M(s=>({...s,percent:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500",placeholder:"10",disabled:z||E})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Applies To"}),e.jsxs("select",{value:f.appliesTo,onChange:t=>M(s=>({...s,appliesTo:t.target.value})),className:"w-full rounded-md border border-slate-600/50 bg-slate-700/50 px-2 py-1.5 text-sm text-white",disabled:z||E,children:[e.jsx("option",{value:"all",children:"All products & subscriptions"}),e.jsx("option",{value:"one_time",children:"One-time packs only"}),e.jsx("option",{value:"subscription",children:"Subscriptions only"})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Minimum total (USD, optional)"}),e.jsx(m,{type:"number",step:"0.01",min:"0",value:f.minAmountUsd,onChange:t=>M(s=>({...s,minAmountUsd:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500",placeholder:"0.00",disabled:z||E})]})]}),He?e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between pt-1 gap-3",children:[e.jsx("p",{className:"text-[11px] text-slate-500",children:"Example: with 10% crypto discount, a $29.00 plan becomes $26.10 when paid in crypto."}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(v,{size:"sm",onClick:Xe,disabled:z||E,className:"bg-slate-600 hover:bg-slate-700 text-white disabled:opacity-60",children:E?"Saving...":"Save Crypto Discount"})})]}):null]})})]}),e.jsxs(ie,{className:`${ce} mt-2`,children:[e.jsx(le,{className:"border-b-0 p-0",children:e.jsx(de,{icon:it,title:"Credit Packs",de
5scription:"One-time credit packs for crypto payments. IDs should stay stable and prices are stored in USD.",actions:e.jsx(v,{onClick:()=>{fe("product"),P(!0)},className:"border-slate-600/50 hover:bg-slate-700/50 text-slate-300 hover:text-white",children:"Add New"})})}),e.jsxs(ne,{children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-sm",children:[e.jsx("thead",{className:"bg-slate-700/50",children:e.jsxs("tr",{className:"text-left",children:[e.jsx("th",{className:"p-2 border-b border-slate-600/50 text-slate-300",children:"Name"}),e.jsx("th",{className:"p-2 border-b border-slate-600/50 text-slate-300",children:"Credits"}),e.jsx("th",{className:"p-2 border-b border-slate-600/50 text-slate-300",children:"Price "}),e.jsx("th",{className:"p-2 border-b border-slate-600/50 text-slate-300",children:"Currency"}),e.jsx("th",{className:"p-2 border-b border-slate-600/50 text-center text-slate-300",children:"Actions"}),e.jsx("th",{className:"p-2 border-b border-slate-600/50 w-10 text-slate-300",children:"Order"})]})}),e.jsx("tbody",{children:H?e.jsx("tr",{children:e.jsx("td",{className:"p-3 text-slate-400",colSpan:6,children:"Loading..."})}):N.length===0?e.jsx("tr",{children:e.jsx("td",{className:"p-3 text-slate-400",colSpan:6,children:"No products yet"})}):Be.map(t=>e.jsxs("tr",{draggable:!0,onDragStart:()=>A({type:"product",id:t.id}),onDragEnd:()=>A(null),onDragOver:s=>s.preventDefault(),onDrop:()=>J?.type==="product"&&qe(J.id,t.id),children:[e.jsx("td",{className:"p-2 border-b border-slate-600/50 text-white/80",children:t.name}),e.jsx("td",{className:"p-2 border-b border-slate-600/50 text-white/80",children:t.credits}),e.jsx("td",{className:"p-2 border-b border-slate-600/50 text-white/80",children:Number(t.priceUsd).toFixed(2)}),e.jsx("td",{className:"p-2 border-b border-slate-600/50 text-white/80",children:t.currency||"USD"}),e.jsx("td",{className:"p-2 border-b border-slate-600/50 text-center",children:e.jsxs("div",{className:"inline-flex items-center gap-2",children:[e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",title:"Active",children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",checked:!!t.active,onChange:()=>et(t.id),disabled:L}),e.jsx("div",{className:"w-10 h-5 rounded-full bg-slate-600 peer-checked:bg-emerald-500 transition-colors"}),e.jsx("div",{className:"absolute left-0.5 top-0.5 w-4 h-4 bg-slate-800 rounded-full transition-transform transform peer-checked:translate-x-5 shadow"})]}),e.jsx(v,{size:"sm",variant:"outline","aria-label":"Edit",title:"Edit",onClick:()=>{ye("product"),g({...t}),_(!0)},className:"border-slate-600/50 hover:bg-slate-700/50 text-slate-300 hover:text-white",children:e.jsx(Me,{className:"h-4 w-4"})}),e.jsx(v,{size:"sm",variant:"outline","aria-label":"Delete",title:"Delete",onClick:()=>Ze(t.id),disabled:L,className:"border-slate-600/50 hover:bg-red-600/50 text-slate-300 hover:text-red-400",children:e.jsx(Ie,{className:"h-4 w-4"})})]})}),e.jsx("td",{className:"p-2 border-b border-slate-600/50 align-middle select-none cursor-grab text-right",title:"Drag to place the rank",children:e.jsx(Te,{className:"h-4 w-4 text-slate-400"})})]},t.id))})]})}),e.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[e.jsxs("div",{className:"text-xs text-slate-400",children:["Page ",D," of ",B]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{size:"sm",variant:"outline",disabled:D<=1,onClick:()=>V(D-1),className:"border-slate-600/50 hover:bg-slate-700/50 text-slate-300 hover:text-white",children:"Previous"}),e.jsx(v,{size:"sm",variant:"outline",disabled:D>=B,onClick:()=>V(D+1),className:"border-slate-600/50 hover:bg-slate-700/50 text-slate-300 hover:text-white",children:"Next"})]})]})]})]}),e.jsxs(ie,{className:ce,children:[e.jsx(le,{className:"border-b-0 p-0",children:e.jsx(de,{icon:Pe,accent:"emerald",title:"Subscriptions",description:"Recurring plans with monthly credits. Values map directly to your live price table.",actions:e.jsx(v,{onClick:()=>{fe("subscription"),P(!0)},className:"border-slate-600/50 hover:bg-slate-700/50 text-slate-300 hover:text-white",children:"Add New"})})}),e.jsxs(ne,{children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-sm",children:[e.jsx("thead",{className:"bg-slate-700/50",children:e.jsxs("tr",{className:"text-left",children:[e.jsx("th",{className:"p-2 border-b border-slate-600/50 text-slate-300",children:"Name"}),e.jsx("th",{className:"p-2 border-b border-slate-600/50 text-slate-300",children:"Monthly Credits"}),e.jsx("th",{className:"p-2 border-b border-slate-600/50 text-slate-300",children:"Price "}),e.jsx("th",{className:"p-2 border-b border-slate-600/50 text-slate-300",children:"Currency"}),e.jsx("th",{className:"p-2 border-b border-slate-600/50 text-center text-slate-300",children:"Actions"}),e.jsx("th",{className:"p-2 border-b border-slate-600/50 w-10 text-slate-300",children:"Order"})]})}),e.jsx("tbody",{children:H?e.jsx("tr",{children:e.jsx("td",{className:"p-3 text-slate-400",colSpan:6,children:"Loading..."})}):b.length===0?e.jsx("tr",{children:e.jsx("td",{className:"p-3 text-slate-400",colSpan:6,children:"No subscriptions yet"})}):Oe.map(t=>e.jsxs("tr",{draggable:!0,onDragStart:()=>A({type:"subscription",id:t.id}),onDragEnd:()=>A(null),onDragOver:s=>s.preventDefault(),onDrop:()=>J?.type==="subscription"&&We(J.id,t.id),children:[e.jsx("td",{className:"p-2 border-b border-slate-600/50 text-white/80",children:t.name}),e.jsx("td",{className:"p-2 border-b border-slate-600/50 text-white/80",children:t.monthlyCredits}),e.jsx("td",{className:"p-2 border-b border-slate-600/50 text-white/80",children:Number(t.priceUsd).toFixed(2)}),e.jsx("td",{className:"p-2 border-b border-slate-600/50 text-white/80",children:t.currency||"USD"}),e.jsx("td",{className:"p-2 border-b border-slate-600/50 text-center",children:e.jsxs("div",{className:"inline-flex items-center gap-2",children:[e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",title:"Active",children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",checked:!!t.active,onChange:()=>Ve(t.id),disabled:L}),e.jsx("div",{className:"w-10 h-5 rounded-full bg-slate-600 peer-checked:bg-emerald-500 transition-colors"}),e.jsx("div",{className:"absolute left-0.5 top-0.5 w-4 h-4 bg-slate-800 rounded-full transition-transform transform peer-checked:translate-x-5 shadow"})]}),e.jsx(v,{size:"sm",variant:"outline","aria-label":"Edit",title:"Edit",onClick:()=>{ye("subscription"),g({...t}),_(!0)},className:"border-slate-600/50 hover:bg-slate-700/50 text-slate-300 hover:text-white",children:e.jsx(Me,{className:"h-4 w-4"})}),e.jsx(v,{size:"sm",variant:"outline","aria-label":"Delete",title:"Delete",onClick:()=>tt(t.id),disabled:L,className:"border-slate-600/50 hover:bg-red-600/50 text-slate-300 hover:text-red-400",children:e.jsx(Ie,{className:"h-4 w-4"})})]})}),e.jsx("td",{className:"p-2 border-b border-slate-600/50 align-middle select-none cursor-grab text-right",title:"Drag to place the rank",children:e.jsx(Te,{className:"h-4 w-4 text-slate-400"})})]},t.id))})]})}),e.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[e.jsxs("div",{className:"text-xs text-slate-400",children:["Page ",U," of ",O]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{size:"sm",variant:"outline",disabled:U<=1,onClick:()=>W(U-1),className:"border-slate-600/50 hover:bg-slate-700/50 text-slate-300 hover:text-white",children:"Previous"}),e.jsx(v,{size:"sm",variant:"outline",disabled:U>=O,onClick:()=>W(U+1),className:"border-slate-600/50 hover:bg-slate-700/50 text-slate-300 hover:text-white",children:"Next"})]})]})]})]}),$.open&&be.createPortal(e.jsx("div",{className:"fixed inset-0 z-[20000] grid place-items-center bg-black/50 p-4",role:"dialog","aria-modal":"true",children:e.jsxs("div",{className:"w-full max-w-md rounded-xl border border-slate-700/60 bg-slate-900 shadow-xl shadow-black/40",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-slate-700/60 p-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-amber-500/30 bg-amber-500/10 text-amber-300",children:e.jsx(lt,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-slate-100",children:"Confirm Daily Credit Settings"}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:"These values affect the next daily reset and free-credit abuse limits."})]})]}),e.jsx("button",{className:"text-slate-500 hover:text-slate-300 disabled:opacity-50",onClick:()=>re({open:!1,payload:null}),disabled:F,"aria-label":"Close",children:e.jsx(ge,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"space-y-3 p-4 text-sm text-slate-200",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsxs("div",{className:"rounded-lg border border-slate-700/60 bg-slate-950/40 p-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-wide text-slate-500",children:"User"}),e.jsx("div",{className:"mt-1 font-semibold text-slate-100",children:Number($.payload?.credits||0).toLocaleStr
5ing("en-US")})]}),e.jsxs("div",{className:"rounded-lg border border-slate-700/60 bg-slate-950/40 p-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-wide text-slate-500",children:"IP Cap"}),e.jsx("div",{className:"mt-1 font-semibold text-slate-100",children:Number($.payload?.ipCap||0).toLocaleString("en-US")})]}),e.jsxs("div",{className:"rounded-lg border border-slate-700/60 bg-slate-950/40 p-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-wide text-slate-500",children:"Device"}),e.jsx("div",{className:"mt-1 font-semibold text-slate-100",children:Number($.payload?.deviceCap||0).toLocaleString("en-US")})]})]}),e.jsxs("p",{className:"text-xs leading-5 text-slate-400",children:["Current values are ",Number(Y||0).toLocaleString("en-US")," user,"," ",Number(ee||0).toLocaleString("en-US")," IP, and"," ",Number(se||0).toLocaleString("en-US")," device."]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-slate-700/60 p-4",children:[e.jsx(v,{variant:"outline",onClick:()=>re({open:!1,payload:null}),disabled:F,className:"border-slate-600/50 hover:bg-slate-700/50 text-slate-300 hover:text-white",children:"Cancel"}),e.jsx(v,{onClick:()=>Qe(),disabled:F,className:"bg-amber-600 hover:bg-amber-700 text-white disabled:opacity-60",children:F?"Saving...":"Confirm Save"})]})]})}),document.body),Le&&be.createPortal(e.jsx("div",{className:"fixed inset-0 z-[20000] grid place-items-center bg-black/40 p-4",role:"dialog","aria-modal":"true",children:e.jsxs("div",{className:"w-full max-w-lg rounded-xl border backdrop-blur-sm shadow-xl border-slate-700/50 bg-slate-800/50",children:[e.jsxs("div",{className:"p-4 border-b flex items-center justify-between border-slate-700/50",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-white/90",children:K==="subscription"?"Add New Subscription":"Add New Credit Pack"}),e.jsx("p",{className:"mt-0.5 text-xs text-slate-400",children:K==="subscription"?"Create a recurring subscription plan.":"Create a one-time credit pack."})]}),e.jsx("button",{className:"text-slate-400 hover:text-slate-300",onClick:()=>P(!1),children:e.jsx(ge,{className:"h-6 w-6"})})]}),e.jsx("div",{className:"p-4 space-y-4",children:K==="product"?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Name"}),e.jsx(m,{placeholder:"e.g. 100 credits",value:h.name,onChange:t=>w(s=>({...s,name:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Custom ID (optional)"}),e.jsx(m,{placeholder:"e.g. pack_small",value:h.id,onChange:t=>w(s=>({...s,id:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Credits"}),e.jsx(m,{type:"number",placeholder:"100",value:h.credits,onChange:t=>w(s=>({...s,credits:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Price "}),e.jsx(m,{type:"number",step:"0.01",placeholder:"5.00",value:h.priceUsd,onChange:t=>w(s=>({...s,priceUsd:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500"})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Description"}),e.jsx("textarea",{className:"w-full border border-slate-600/50 rounded-md p-2 text-sm bg-slate-700/50 text-white placeholder:text-slate-500",rows:2,placeholder:"Short description",value:h.description,onChange:t=>w(s=>({...s,description:t.target.value}))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Highlights (one per line)"}),e.jsx("textarea",{className:"w-full border border-slate-600/50 rounded-md p-2 text-sm bg-slate-700/50 text-white placeholder:text-slate-500",rows:3,placeholder:`e.g.
6Fast processing
7High resolution`,value:h.highlights,onChange:t=>w(s=>({...s,highlights:t.target.value}))})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Currency"}),e.jsx(m,{placeholder:"USD",value:h.currency,onChange:t=>w(s=>({...s,currency:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500"})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-6",children:[e.jsx("input",{id:"feat_p",type:"checkbox",checked:!!h.featured,onChange:t=>w(s=>({...s,featured:t.target.checked}))}),e.jsx("label",{htmlFor:"feat_p",className:"text-sm text-white/80",children:"Featured"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Rank"}),e.jsx(m,{type:"number",placeholder:"0",value:h.rank,onChange:t=>w(s=>({...s,rank:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{id:"act_p",type:"checkbox",checked:!!h.active,onChange:t=>w(s=>({...s,active:t.target.checked}))}),e.jsx("label",{htmlFor:"act_p",className:"text-sm text-white/80",children:"Active"})]})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Name"}),e.jsx(m,{placeholder:"e.g. Basic 300/mo",value:u.name,onChange:t=>S(s=>({...s,name:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Custom ID (optional)"}),e.jsx(m,{placeholder:"e.g. sub_basic",value:u.id,onChange:t=>S(s=>({...s,id:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Monthly Credits"}),e.jsx(m,{type:"number",placeholder:"300",value:u.monthlyCredits,onChange:t=>S(s=>({...s,monthlyCredits:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Price "}),e.jsx(m,{type:"number",step:"0.01",placeholder:"15.00",value:u.priceUsd,onChange:t=>S(s=>({...s,priceUsd:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500"})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Description"}),e.jsx("textarea",{className:"w-full border border-slate-600/50 rounded-md p-2 text-sm bg-slate-700/50 text-white placeholder:text-slate-500",rows:2,placeholder:"Short description",value:u.description,onChange:t=>S(s=>({...s,description:t.target.value}))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Highlights (one per line)"}),e.jsx("textarea",{className:"w-full border border-slate-600/50 rounded-md p-2 text-sm bg-slate-700/50 text-white placeholder:text-slate-500",rows:3,placeholder:`e.g.
8Unlimited generations
9Priority support`,value:u.highlights,onChange:t=>S(s=>({...s,highlights:t.target.value}))})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Currency"}),e.jsx(m,{placeholder:"USD",value:u.currency,onChange:t=>S(s=>({...s,currency:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500"})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-6",children:[e.jsx("input",{id:"feat_s",type:"checkbox",checked:!!u.featured,onChange:t=>S(s=>({...s,featured:t.target.checked}))}),e.jsx("label",{htmlFor:"feat_s",className:"text-sm text-white/80",children:"Featured"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Rank"}),e.jsx(m,{type:"number",placeholder:"0",value:u.rank,onChange:t=>S(s=>({...s,rank:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{id:"act_s",type:"checkbox",checked:!!u.active,onChange:t=>S(s=>({...s,active:t.target.checked}))}),e.jsx("label",{htmlFor:"act_s",className:"text-sm text-white/80",children:"Active"})]})]})}),e.jsxs("div",{className:"p-4 border-t border-slate-700/50 flex items-center justify-end gap-2",children:[e.jsx(v,{variant:"outline",onClick:()=>P(!1),className:"border-slate-600/50 hover:bg-slate-700/50 text-slate-300 hover:text-white",children:"Cancel"}),e.jsx(v,{onClick:Ye,disabled:L,className:"bg-slate-600 hover:bg-slate-700 text-white",children:"Add"})]})]})}),document.body),_e&&be.createPortal(e.jsx("div",{className:"fixed inset-0 z-[20000] grid place-items-center bg-black/40 p-4",role:"dialog","aria-modal":"true",children:e.jsxs("div",{className:"w-full max-w-lg rounded-xl border backdrop-blur-sm shadow-xl border-slate-700/50 bg-slate-800/50",children:[e.jsxs("div",{className:"p-4 border-b flex items-center justify-between border-slate-700/50",children:[e.jsxs("div",{className:"font-semibold text-white/90",children:["Edit ",xe==="product"?"Product":"Subscription"]}),e.jsx("button",{className:"text-slate-400 hover:text-slate-300",onClick:()=>_(!1),children:e.jsx(ge,{className:"h-6 w-6"})})]}),e.jsx("div",{className:"p-4 space-y-4",children:xe==="product"?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Name"}),e.jsx(m,{value:i?.name||"",onChange:t=>g(s=>({...s,name:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Credits"}),e.jsx(m,{type:"number",value:i?.credits??"",onChange:t=>g(s=>({...s,credits:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Price "}),e.jsx(m,{type:"number",step:"0.01",value:i?.priceUsd??"",onChange:t=>g(s=>({...s,priceUsd:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500"})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Description"}),e.jsx("textarea",{className:"w-full border border-slate-600/50 rounded-md p-2 text-sm bg-slate-700/50 text-white placeholder:text-slate-500",rows:2,value:i?.description||"",onChange:t=>g(s=>({...s,description:t.target.value}))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Highlights (one per line)"}),e.jsx("textarea",{className:"w-full border border-slate-600/50 rounded-md p-2 text-sm bg-slate-700/50 text-white placeholder:text-slate-500",rows:3,value:Array.isArray(i?.highlights)?(i?.highlights||[]).join(`
10`):i?.highlights||"",onChange:t=>g(s=>({...s,highlights:t.target.value}))})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Currency"}),e.jsx(m,{value:i?.currency||"USD",onChange:t=>g(s=>({...s,currency:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500"})]}),e.jsx("div",{className:"pt-6",children:e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",title:"Featured",children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",checked:!!i?.featured,onChange:t=>g(s=>({...s,featured:t.target.checked}))}),e.jsx("div",{className:"w-10 h-5 rounded-full bg-slate-600 peer-checked:bg-emerald-500 transition-colors"}),e.jsx("div",{className:"absolute left-0.5 top-0.5 w-4 h-4 bg-slate-800 rounded-full transition-transform transform peer-checked:translate-x-5 shadow"}),e.jsx("span",{className:"ml-2 text-sm select-none text-white/80",children:"Featured"})]})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Rank"}),e.jsx(m,{type:"number",value:i?.rank??0,onChange:t=>g(s=>({...s,rank:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500"})]})]})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Name"}),e.jsx(m,{value:i?.name||"",onChange:t=>g(s=>({...s,name:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Monthly Credits"}),e.jsx(m,{type:"number",value:i?.monthlyCredits??"",onChange:t=>g(s=>({...s,monthlyCredits:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Price "}),e.jsx(m,{type:"number",step:"0.01",value:i?.priceUsd??"",onChange:t=>g(s=>({...s,priceUsd:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500"})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Description"}),e.jsx("textarea",{className:"w-full border border-slate-600/50 rounded-md p-2 text-sm bg-slate-700/50 text-white placeholder:text-slate-500",rows:2,value:i?.description||"",onChange:t=>g(s=>({...s,description:t.target.value}))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Highlights (one per line)"}),e.jsx("textarea",{className:"w-full border border-slate-600/50 rounded-md p-2 text-sm bg-slate-700/50 text-white placeholder:text-slate-500",rows:3,value:Array.isArray(i?.highlights)?(i?.highlights||[]).join(`
11`):i?.highlights||"",onChange:t=>g(s=>({...s,highlights:t.target.value}))})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Currency"}),e.jsx(m,{value:i?.currency||"USD",onChange:t=>g(s=>({...s,currency:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500"})]}),e.jsx("div",{className:"pt-6",children:e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",title:"Featured",children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",checked:!!i?.featured,onChange:t=>g(s=>({...s,featured:t.target.checked}))}),e.jsx("div",{className:"w-10 h-5 rounded-full bg-slate-600 peer-checked:bg-emerald-500 transition-colors"}),e.jsx("div",{className:"absolute left-0.5 top-0.5 w-4 h-4 bg-slate-800 rounded-full transition-transform transform peer-checked:translate-x-5 shadow"}),e.jsx("span",{className:"ml-2 text-sm select-none text-white/80",children:"Featured"})]})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-400 mb-1",children:"Rank"}),e.jsx(m,{type:"number",value:i?.rank??0,onChange:t=>g(s=>({...s,rank:t.target.value})),className:"bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500"})]})]})]})}),e.jsxs("div",{className:"p-4 border-t border-slate-700/50 flex items-center justify-end gap-2",children:[e.jsx(v,{variant:"outline",onClick:()=>_(!1),className:"border-slate-600/50 hover:bg-slate-700/50 text-slate-300 hover:text-white",children:"Cancel"}),e.jsx(v,{onClick:async()=>
11{if(i){if(xe==="product"){const t=Number(i.credits),s=Number(i.priceUsd);if(!Number.isFinite(t)||t<=0){d.error("Credits must be positive");return}if(!Number.isFinite(s)||s<=0){d.error("Price must be positive");return}const a=N.map(c=>c.id===i.id?{...c,name:i.name,credits:t,priceUsd:s,currency:i.currency||"USD",featured:!!i.featured,rank:Number(i.rank??0)||0,description:i.description||"",highlights:i.highlights,imageUrl:i.imageUrl||""}:c),l=d.loading("Saving...");try{await k(a,b),d.success("Saved",{id:l})}catch(c){d.error(c.message||"Failed to save",{id:l})}}else{const t=Number(i.monthlyCredits),s=Number(i.priceUsd);if(!Number.isFinite(t)||t<=0){d.error("Monthly credits must be positive");return}if(!Number.isFinite(s)||s<=0){d.error("Price must be positive");return}const a=b.map(c=>c.id===i.id?{...c,name:i.name,monthlyCredits:t,priceUsd:s,currency:i.currency||"USD",featured:!!i.featured,rank:Number(i.rank??0)||0,description:i.description||"",highlights:i.highlights,imageUrl:i.imageUrl||""}:c),l=d.loading("Saving...");try{await k(N,a),d.success("Saved",{id:l})}catch(c){d.error(c.message||"Failed to save",{id:l})}}_(!1)}},className:"bg-slate-600 hover:bg-slate-700 text-white",children:"Save"})]})]})}),document.body)]})}
11export{bt as default};

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.