PageSourceSearch

https://bbcc.ai/build/assets/PageList-7HDcEhOT.js

js bbcc.ai collected 2026-10-05 12:12:57 UTC 78,404 bytes, 72 lines download raw bytes

1import{r,b as $,j as e,H as Mt,a as Ft}from"./app-DP13319Q.js";import{D as _t}from"./DraggableMenu-Bk7Spryo.js";import{M as Et}from"./react-tooltip.min-DW3XhwOj.js";import{F as W,h as st,i as Lt,f as rt,a as ze,j as zt,k as Oe}from"./index-CtyZ6W6U.js";import{E as $t,l as Bt,u as Wt,a as Ht,P as Dt}from"./react-stripe.esm-D6Ettci4.js";/* empty css            */import"./index-DQkUn08L.js";const Vt=[{value:"recent",label:"Most recent"},{value:"oldest",label:"Oldest first"},{value:"title-asc",label:"Title A-Z"},{value:"title-desc",label:"Title Z-A"}],Rt=Bt("pk_live_51IyCo8Dpr0bpQPac24tix9UpShzoMw1uWsW3JvzcMrKVFnvUsXAnvBknJSPYucZCYSLT4Z0UVBeKx49jlYakdjIw00coa3YVdn"),at=n=>{if(typeof document>"u")return n;const h=document.createElement("div");return h.innerHTML=n,h.textContent||h.innerText||""},J=({size:n=20})=>e.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"animate-spin",children:e.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),Ut=({message:n,type:h,onClose:M})=>{r.useEffect(()=>{const C=setTimeout(()=>{M()},5e3);return()=>clearTimeout(C)},[M]);const S={success:"bg-green-50 border-green-200 text-green-800",error:"bg-red-50 border-red-200 text-red-800",info:"bg-blue-50 border-blue-200 text-blue-800",warning:"bg-yellow-50 border-yellow-200 text-yellow-800"},k={success:e.jsx("svg",{className:"w-5 h-5 text-green-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 13l4 4L19 7"})}),error:e.jsx("svg",{className:"w-5 h-5 text-red-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})}),info:e.jsx("svg",{className:"w-5 h-5 text-blue-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),warning:e.jsx("svg",{className:"w-5 h-5 text-yellow-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})};return e.jsx("div",{className:`fixed top-20 right-4 z-[200] p-4 rounded-xl border shadow-lg ${S[h]} animate-slide-left max-w-md`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex-shrink-0",children:k[h]}),e.jsx("div",{className:"flex-1 text-sm font-medium break-words",children:n}),e.jsx("button",{onClick:M,className:"flex-shrink-0 opacity-50 hover:opacity-100 transition-opacity",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})})]})})},Ot=({price:n,clientSecret:h,onSuccess:M,onBack:S,onError:k,email:C})=>{const u=Wt(),i=Ht(),[g,P]=r.useState(!1),[p,j]=r.useState(""),[v,x]=r.useState(!1),T=async F=>{if(F.preventDefault(),j(""),!u||!i){j("Payment system not ready. Please try again.");return}P(!0);try{const{error:H}=await i.submit();if(H){j(H.message||"Payment form validation failed");return}const{error:E,paymentIntent:D}=await u.confirmPayment({elements:i,confirmParams:{return_url:`${window.location.origin}/payment-success`,payment_method_data:{billing_details:{email:C}}},clientSecret:h,redirect:"if_required"});if(E){j(E.message||"Payment failed");return}if(!D){j("Payment processing failed. No payment intent received.");return}switch(D.status){case"succeeded":M();break;case"requires_action":j("Payment requires additional authentication. Please complete the verification.");break;case"processing":j("Payment is processing. Please wait for confirmation.");break;case"requires_payment_method":case"canceled":case"requires_confirmation":default:j(`Payment failed. Status: ${D.status}`)}}catch(H){const E=H instanceof Error?H.message:"Payment processing failed. Please try again.";j(E)}finally{P(!1)}};return e.jsxs("form",{onSubmit:T,children:[p&&e.jsxs("div",{className:"mb-4 p-3 bg-red-500/90 text-white rounded-lg flex items-center gap-2",children:[e.jsx(W,{icon:ze}),e.jsx("span",{"data-tooltip-id":"main-tooltip","data-tooltip-content":"Error notification",children:p})]}),e.jsx("div",{className:"mt-4 text-sm text-gray-300",children:e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{children:"Amount:"}),e.jsxs("span",{className:"text-yellow-400",children:["US$",n.toFixed(2)]})]})}),e.jsx("div",{className:"mt-6 space-y-4",children:e.jsx(Dt,{options:{layout:"tabs",fields:{billingDetails:{email:"never"}}},onReady:()=>x(!0)})}),e.jsx("div",{className:"mt-6",children:e.jsx("button",{type:"submit",disabled:g||!u||!v,className:`w-full bg-yellow-400 text-black font-bold py-3 px-4 roun
1ded-full hover:bg-yellow-500 transition-colors ${g||!u||!v?"opacity-70 cursor-not-allowed":""}`,children:g?e.jsxs(e.Fragment,{children:[e.jsx(W,{icon:Oe,className:"animate-spin mr-2"}),"Processing..."]}):`Pay US${n.toFixed(2)}`})}),e.jsxs("div",{className:"mt-4 text-center",children:[e.jsx("button",{type:"button",onClick:S,className:"text-sm text-yellow-400 hover:underline",children:"Back"}),e.jsx("p",{className:"mt-2 text-xs text-gray-500",children:"Payment secured by STRIPE. You'll be redirected after payment."})]})]})},It=({htmlContent:n,onContentChange:h,onExtractTitle:M})=>{const[S,k]=r.useState("paste"),[C,u]=r.useState(!1),i=r.useRef(null),g=x=>{if(!x.name.endsWith(".html")&&x.type!=="text/html"){alert("Please upload an HTML file");return}const T=new FileReader;T.onload=F=>{var E;const H=(E=F.target)==null?void 0:E.result;h(H)},T.onerror=()=>{alert("Error reading file")},T.readAsText(x)},P=x=>{x.preventDefault(),u(!0)},p=x=>{x.preventDefault(),u(!1)},j=x=>{x.preventDefault(),u(!1),x.dataTransfer.files[0]&&g(x.dataTransfer.files[0])},v=x=>{var T;(T=x.target.files)!=null&&T[0]&&g(x.target.files[0])};return e.jsxs("div",{className:"border border-gray-200 rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"grid grid-cols-2 border-b border-gray-200",children:[e.jsxs("button",{onClick:()=>k("upload"),className:`flex items-center justify-center gap-2 py-3 text-sm font-medium transition-all duration-200 ${S==="upload"?"bg-white text-green-600 border-b-2 border-green-600":"bg-gray-50 text-gray-500 hover:text-gray-700 hover:bg-gray-100"}`,children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.5861.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),"File Upload"]}),e.jsxs("button",{onClick:()=>k("paste"),className:`flex items-center justify-center gap-2 py-3 text-sm font-medium transition-all duration-200 ${S==="paste"?"bg-white text-green-600 border-b-2 border-green-600":"bg-gray-50 text-gray-500 hover:text-gray-700 hover:bg-gray-100"}`,children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"}),e.jsx("polyline",{points:"22,6 12,13 2,6"})]}),"Paste Code"]}
1)]}),S==="upload"&&e.jsx("div",{className:"p-4",children:e.jsxs("div",{onDragOver:P,onDragLeave:p,onDrop:j,onClick:()=>{var x;return(x=i.current)==null?void 0:x.click()},className:`
2                            border-2 border-dashed rounded-xl p-8 text-center cursor-pointer transition-all duration-200
3                            ${C?"border-green-500 bg-green-50":"border-gray-300 hover:border-green-400 bg-gray-50/50"}
4                            ${n?"border-green-400 bg-green-50/30":""}
5                        `,children:[e.jsx("input",{ref:i,type:"file",accept:".html,.htm,text/html",onChange:v,className:"hidden"}),e.jsx("div",{className:"w-12 h-12 bg-white rounded-xl flex items-center justify-center mx-auto mb-3 shadow-sm",children:n?e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"#22c55e",strokeWidth:"2",children:e.jsx("path",{d:"M20 6L9 17l-5-5"})}):e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"#9ca3af",strokeWidth:"2",children:e.jsx("path",{d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.5861.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),n?e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-green-700 mb-1",children:"File loaded successfully!"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Click or drop to replace"})]}):e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-700 mb-1",children:"Drop your HTML file here"}),e.jsx("p",{className:"text-sm text-gray-500",children:"or click to browse"}),e.jsx("p",{className:"text-xs text-gray-400 mt-2",children:"Supports .html, .htm"})]})]})}),S==="paste"&&e.jsx("div",{className:"p-4",children:e.jsx("textarea",{value:n,onChange:x=>h(x.target.value),placeholder:`<!DOCTYPE html>
6<html>
7<head>
8  <title>My Page</title>
9  <meta charset="UTF-8">
10  <meta name="viewport" content="width=device-width, initial-scale=1.0">
11</head>
12<body>
13  <h1>Hello World</h1>
14  <p>Your content here...</p>
15</body>
16</html>`,className:"w-full min-h-[300px] px-4 py-3 border-2 border-gray-200 rounded-xl font-mono text-sm focus:outline-none focus:ring-2 focus:ring-green-500/20 focus:border-green-500 transition-all duration-200 resize-y"})})]})},Yt=({page:n,isOpen:h,onClose:M,onUpdate:S,onUpdateContent:k,onCheckSlug:C,isUpdating:u=!1,onShowAlert:i})=>{var je;const[g,P]=r.useState(""),[p,j]=r.useState(""),[v,x]=r.useState(""),[T,F]=r.useState(""),[H,E]=r.useState(""),[D,ie]=r.useState(""),[ee,O]=r.useState(""),[Fe,ce]=r.useState(!1),[te,A]=r.useState(""),[ge,pe]=r.useState(""),[fe,B]=r.useState(!1),[U,_]=r.useState("details"),[q,_e]=r.useState(!1),[de,se]=r.useState(""),K=r.useRef(),xe=r.useRef();r.useEffect(()=>{if(n){P(n.title),j(n.slug),E(n.title),ie(n.slug);const c=n.html_content||"";x(c),F(c),O(""),A(""),pe(""),se(""),B(!1)}},[n]),r.useEffect(()=>(p&&p!==D&&p.length>=3?(K.current&&clearTimeout(K.current),K.current=setTimeout(async()=>{ce(!0),await C(p,n==null?void 0:n.id)?(O(""),A("Slug is available!")):(O("Slug is already taken"),A("")),ce(!1)},500)):p===D&&(O(""),A("")),()=>{K.current&&clearTimeout(K.current)}),[p,D,n,C]),r.useEffect(()=>(v!==T&&n&&(xe.current&&clearTimeout(xe.current),xe.current=setTimeout(()=>{be()},2e3)),()=>{xe.current&&clearTimeout(xe.current)}),[v,T,n]);const be=async()=>{if(!(!n||v===T)){_e(!0);try{await k(n.id,v)?(F(v),B(!0),i&&i("Content saved automatically!","success"),setTimeout(()=>B(!1),3e3)):i&&i("Failed to save content","error")}catch(c){console.error("Failed to save content:",c),i&&i("Failed to save content","error")}finally{_e(!1)}}},ye=async()=>{if(!n||!g.trim()){se("Title cannot be empty");return}se("");try{await S(n,g,p,void 0),E(g),pe("Title updated successfully!"),i&&i("Title updated successfully!","success"),setTimeout(()=>pe(""),3e3)}catch(c){console.error("Failed to update title:",c),se("Failed to update title"),i&&i("Failed to update title","error")}},Ee=async()=>{if(!n||!p.trim()){O("Slug cannot be empty");return}if(p!==D){if(ee){i&&i("Please fix the slug error before saving","error");return}try{await S(n,g,p,void 0),ie(p),A("Slug updated successfully!"),i&&i("Slug updated successfully!","success"),setTimeout(()=>A(""),3e3)}catch(c){O(c.message||"Failed to update slug"),i&&i(c.message||"Failed to update slug","error")}}},X=()=>{var re;const c=v.match(/<title[^>]*>([^<]*)<\/title>/i);(re=c==null?void 0:c[1])!=null&&re.trim()?(P(c[1].trim()),i&&i("Title extracted from HTML!","success")):i&&i("No title tag found in HTML","warning")};return!h||!n?null:e.jsxs("div",{className:"w-full bg-white border border-gray-200 rounded-3xl shadow-xl flex flex-col h-full",children:[e.jsxs("div",{className:"p-6 border-b border-gray-200 flex justify-between items-center",children:[e.jsxs("h2",{className:"text-lg font-bold text-gray-800 flex items-center gap-2",children:[e.jsx("svg",{className:"h-5 w-5 text-green-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:"2",children:e.jsx("path",{d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"Edit Page"]}),e.jsx("button",{onClick:M,className:"text-gray-400 hover:text-gray-600 p-1 rounded-full hover:bg-gray-100 transition",children:e.jsx("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"px-6 flex border-b border-gray-200",children:[e.jsx("button",{onClick:()=>_("details"),className:`py-4 px-2 text-sm font-bold ${U==="details"?"text-green-600 border-b-2 border-green-500":"text-gray-400 hover:text-gray-600"} transition-colors`,children:"Page Details"}),e.jsx("button",{onClick:()=>_("content"),className:`py-4 px-6 text-sm font-medium ${U==="content"?"text-green-600 border-b-2 border-green-500":"text-gray-400 hover:text-gray-600"} transition-colors`,children:"HTML Content"})]}),e.jsx("div",{className:"p-6 space-y-7 overflow-y-auto custom-scrollbar flex-1",children:U==="details"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-1.5",children:"Title"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:g,onChange:c=>{P(c.target.value),se("")},className:`flex-1 px-4 py-2.5 border rounded-xl focus:ring-2 focus:ring-green-500/30 focus:border-green-400 outline-none text-sm font-medium bg-gray-50/30 ${de?"border-red-300":"border-gray-200"}`,placeholder:"Page title"}),e.jsx("button",{onClick:ye,disabled:u||!g.trim()||g===H,className:"bg-[#A7F3D0] text-green-800 px-5 py-2.5 rounded-xl text-sm font-bold hover:bg-green-200 transition shadow-sm disabled:opacity-50",children:u?e.jsx(J,{size:16}):"Update"})]}),de&&e.jsx("p",{className:"text-xs text-red-600 mt-1",children:de}),ge&&e.jsxs("p",{className:"text-xs text-green-600 mt-1 flex items-center gap-1",children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M20 6L9 17l-5-5"})}),ge]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-1.5",children:"Slug"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx("span",{className:"inline-flex items-center px-3 py-2.5 rounded-l-xl border border-r-0 border-gray-200 bg-gray-50 text-gray-500 text-sm",children:"/page/"}),e.jsx("input",{type:"text",value:p,onChange:c=>{const re=c.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-");j(re)},className:`flex-1 px-4 py-2.5 border rounded-r-xl focus:ring-2 focus:ring-green-500/30 focus:border-green-400 outline-none text-sm font-medium bg-gray-50/30 ${ee?"border-red-300":te?"border-green-300":"border-gray-200"}`,placeholder:"url-slug"})]}),Fe&&e.jsx("div",{className:"absolute right-3 top-3.5",children:e.jsx(J,{size:16})})]}),e.jsx("button",{onClick:Ee,disabled:u||!p.trim()||p===D||ee!=="",className:"bg-[#A7F3D0] text-green-800 px-5 py-2.5 rounded-xl text-sm font-bold hover:bg-green-200 transition shadow-sm disabled:opacity-50",children:u?e.jsx(J,{size:16}):"Update"})]}),ee&&e.jsx("p",{className:"text-xs text-red-600 mt-1",children:ee}),te&&e.jsxs("p",{className:"text-xs text-green-600 mt-1 flex items-center gap-1",children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M20 6L9 17l-5-5"})}),te]}),e.jsxs("p",{className:"text-[11px] text-gray-400 mt-2 font-mono italic",children:["🔗 Current URL: /page/",D]})]}),n.hasSecrets&&e.jsxs("div",{className:"bg-yellow-50 border border-yellow-200 rounded-xl p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-yellow-700 mb-2",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),e.jsx("span",{className:"text-sm font-bold",children:"Page contains secrets"})]}),e.jsxs("p",{className:"text-xs text-yellow-600",children:[((je=n.secrets)==null?void 0:je.length)||0," secret(s) detected and will be automatically handled when viewing the page."]})]}),e.jsxs("div",{className:"pt-2",children:[e.jsx("h3",{className:"text-sm font-bold text-gray-600 mb-4 uppercase tracking-wider",children:"Page Stats"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-gray-50/80 p-5 rounded-xl border border-gray-100",children:[e.jsxs("div",{className:"flex items-center gap-2 text-gray-400 mb-1",children:[e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),e.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),e.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),e.jsx("p",{className:"text-[10px] text-gray-400 font-bold uppercase",children:"Created"})]}),e.jsx("p",{className:"text-sm font-semibold text-gray-800",children:n.created_at_formatted})]}),e.jsxs("div",{className:"bg-gray-50/80 p-5 rounded-xl border border-gray-100",children:[e.jsxs("div",{className:"flex items-center gap-2 text-gray-400 mb-1",children:[e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),e.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),e.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),e.jsx("p",{className:"text-[10px] text-gray-400 font-bold uppercase",children:"Last Updated"})]}),e.jsx("p",{className:"text-sm font-semibold text-gray-800",children:n.updated_at_formatted})]})]})]}),e.jsx("div",{className:"border-t border-gray-200 pt-4",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("a",{href:`/page/${n.slug}`,target:"_blank",rel:"noopener noreferrer",className:"flex-1 flex items-center justify-center gap-2 px-4 py-2.5 bg-blue-50 hover:bg-blue-100 text-blue-700 rounded-xl text-sm font-semibold transition",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),"View Page"]}),e.jsxs("button",{onClick:()=>{const c=`${window.location.origin}/page/${n.slug}`;navigator.clipboard.writeText(c),i&&i("URL copied to clipboard!","success")},className:"flex-1 flex items-center justify-center gap-2 px-4 py-2.5 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-xl text-sm font-semibold transition",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),e.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),"Copy URL"]})]})}),e.jsxs("div",{className:"border-t border-gray-200 pt-4 mt-2 text-center text-gray-400 text-[10px] font-medium",children:["Page ID: ",n.id]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"HTML Content"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:X,className:"text-xs text-blue-600 hover:text-blue-700 flex items-center gap-1",children:[e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"}),e.jsx("polyline",{points:"22,6 12,13 2,6"})]}),"Extract Title"]}),fe&&e.jsxs("span",{className:"text-xs text-green-600 flex items-center gap-1",children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M20 6L9 17l-5-5"})}),"Saved"]}),q&&e.jsxs("span",{className:"text-xs text-gray-500 flex items-center gap-1",children:[e.jsx(J,{size:12}),"Saving..."]})]})]}),e.jsx(It,{htmlContent:v,onContentChange:x,onExtractTitle:X}),e.jsxs("div",{className:"flex items-center justify-between mt-3",children:[e.jsxs("p",{className:"text-[11px] text-gray-400",children:[v.length.toLocaleStr
16ing()," characters"]}),v!==T&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:()=>{x(T),i&&i("Changes reverted","info")},className:"text-xs text-gray-500 hover:text-gray-700 flex items-center gap-1",children:[e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),e.jsx("path",{d:"M3 3v5h5"})]}),"Revert"]}),e.jsxs("button",{onClick:be,disabled:q,className:"text-xs bg-green-500 text-white px-3 py-1 rounded-lg hover:bg-green-600 flex items-center gap-1 disabled:opacity-50",children:[e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),e.jsx("polyline",{points:"17 21 17 13 7 13 7 21"}),e.jsx("polyline",{points:"7 3 7 8 15 8"})]}),"Save Now"]})]})]})]}),v&&e.jsxs("div",{className:"bg-white border-2 border-gray-200 rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-gray-200 bg-gray-50 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("polygon",{points:"12 2 2 7 12 12 22 7 12 2"}),e.jsx("polyline",{points:"2 17 12 22 22 17"}),e.jsx("polyline",{points:"2 12 12 17 22 12"})]}),e.jsx("span",{className:"text-sm font-medium text-gray-700",children:"HTML Preview"})]}),e.jsxs("span",{className:"text-xs bg-white text-gray-600 px-2 py-1 rounded-md shadow-sm",children:[v.length.toLocaleString()," characters"]})]}),e.jsx("div",{className:"p-4",children:e.jsxs("pre",{className:"text-xs bg-gray-50 p-4 rounded-lg overflow-x-auto max-h-64 overflow-y-auto text-gray-600 font-mono",children:[v.substring(0,2e3),v.length>2e3&&`
17
18<!-- ... truncated ... -->`]})})]})]})})]})},At=({page:n,isOpen:h,onClose:M})=>{const[S,k]=r.useState(!0),[C,u]=r.useState(null),i=r.useRef(null);r.useEffect(()=>{h&&n&&(k(!0),u(null),i.current&&(i.current.src=`/page-preview/${n.slug}`))},[h,n]);const g=()=>{k(!1)},P=()=>{k(!1),u("Failed to load page preview")};return!h||!n?null:e.jsx("div",{className:"fixed inset-0 bg-black/50 z-[70] flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-white rounded-xl shadow-2xl w-full max-w-5xl h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"px-6 py-4 border-b border-gray-200 flex items-center justify-between rounded-t-xl",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-green-500 to-green-600 rounded-xl flex items-center justify-center",children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",children:[e.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:n.title}),e.jsxs("p",{className:"text-xs text-gray-500",children:["/page/",n.slug]})]})]}),e.jsx("button",{onClick:M,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#9ca3af",strokeWidth:"2",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]}),e.jsxs("div",{className:"flex-1 relative",children:[S&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-50",children:e.jsxs("div",{className:"text-center",children:[e.jsx(J,{size:40}),e.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Loading preview..."})]})}),C&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-50",children:e.jsxs("div",{className:"text-center text-red-500",children:[e.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),e.jsx("p",{className:"mt-2",children:C})]})}),e.jsx("iframe",{ref:i,className:"w-full h-full border-0 rounded-b-xl",title:"Page Preview",onLoad:g,onError:P,sandbox:"allow-same-origin allow-scripts allow-popups allow-forms allow-modals"})]}),e.jsx("div",{className:"px-6 py-3 border-t border-gray-200 bg-gray-50 rounded-b-xl flex justify-end",children:e.jsxs("a",{href:`/page/${n.slug}`,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-green-600 hover:text-green-700 flex items-center gap-1",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),"Open in new tab"]})})]})})},qt=({page:n,isOpen:h,onClose:M,onConfirm:S,isDeleting:k=!1})=>!h||!n?null:e.jsx("div",{className:"fixed inset-0 bg-black/50 z-[80] flex items-center justify-center p-4",children:e.jsx("div",{className:"bg-white rounded-xl shadow-2xl max-w-md w-full animate-in fade-in slide-in-from-bottom-2 duration-300",children:e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-red-100 flex items-center justify-center flex-shrink-0",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#ef4444",strokeWidth:"2",children:e.jsx("path",{d:"M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Delete Page"}),e.jsx("p",{className:"text-sm text-gray-500",children:"This action cannot be undone."})]})]}),e.jsxs("div",{className:"mb-6 p-3 bg-gray-50 rounded-lg",children:[e.jsxs("p",{className:"text-sm text-gray-600",children:["Are you sure you want to delete ",e.jsx("strong",{children:n.title}),"?"]}),e.jsxs("p",{className:"text-xs text-gray-500 mt-2",children:["Slug: /page/",n.slug]}),n.hasSecrets&&e.jsxs("p",{className:"text-xs text-yellow-600 mt-2 flex items-center gap-1",children:[e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"This page contains secrets that will be permanently deleted."]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{onClick:S,disabled:k,className:"flex-1 px-4 py-2 bg-red-500 hover:bg-red-600 text-white rounded-lg transition-colors disabled:opacity-50 flex items-center justify-center gap-2",children:k?e.jsxs(e.Fragment,{children:[e.jsx(J,{size:16}),e.jsx("span",{children:"Deleting..."})]}):e.jsxs(e.Fragment,{children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})}),e.jsx("span",{children:"Delete"})]})}),e.jsx("button",{onClick:M,disabled:k,className:"flex-1 px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-lg transition-colors disabled:opacity-50",children:"Cancel"})]})]})})});function ss({pages:n,totalPages:h,currentPage:M,lastPage:S,perPage:k,domains:C,auth:u}){var tt;const[i,g]=r.useState([]),[P,p]=r.useState(!1),[j,v]=r.useState(M<S),[x,T]=r.useState(M),[F,H]=r.useState(""),[E,D]=r.useState([]),[ie,ee]=r.useState("recent"),[O,Fe]=r.useState(C||[]),[ce,te]=r.useState(!1),[A,ge]=r.useState(!1),[pe,fe]=r.useState(!1),[B,U]=r.useState(null),[_,q]=r.useState(null),[_e,de]=r.useState(!1),[se,K]=r.useState(!1),[xe,be]=r.useState({}),[ye,Ee]=r.useState({show:!1,message:"",type:"info"}),[X,je]=r.useState(!1),[c,re]=r.useState(null),[Ie,$e]=r.useState(""),[Ye,Be]=r.useState(""),[Ae,qe]=r.useState(null),[Le,nt]=r.useState("page"),[w,ve]=r.useState(""),[L,We]=r.useState(""),[ae,Ke]=r.useState("domain"),[we,Xe]=r.useState(!1),[Z,Ne]=r.useState(""),[ke,Ce]=r.useState(!1),[me,f]=r.useState(""),[Ze,He]=r.useState(""),[d,G]=r.useState({checking:!1,available:null,message:""}),[z,I]=r.useState({valid:null,message:"",discount:0}),[lt,ot]=r.useState(""),[it,Se]=r.useState(!1),[ct,Pe]=r.useState(1),[De,Ve]=r.useState(""),[dt,Re]=r.useState(""),[Te,ne]=r.useState(!1),[le,ue]=r.useState({success:!1,message:"",url:""}),[xt,mt]=r.useState(0),[Kt,Me]=r.useState(null),Ge=r.useRef(null),ut=r.useRef(null),he=r.useRef(new Map),m=r.useCallback((t,a="error")=>{Ee({show:!0,message:t,type:a})},[]);r.useEffect(()=>{if(me){const t=setTimeout(()=>{f("")},6e4);return()=>clearTimeout(t)}},[me]),r.useEffect(()=>{if(Ze){const t=setTimeout(()=>{He("")},6e4);return()=>clearTimeout(t)}},[Ze]),r.useEffect(()=>{if(le.success){const t=setTimeout(()=>{Je()},6e4);return()=>clearTimeout(t)}},[le.success]),r.useEffect(()=>{if(C&&C.length>0)Fe(C),We(C[0].domain);else{console.warn("No domains received from backend, using fallback");const t=[{id:1,domain:"com"},{id:2,domain:"io"},{id:3,domain:"net"},{id:4,domain:"org"}];Fe(t),We(t[0].domain)}},[C]),r.useEffect(()=>{const t=(n==null?void 0:n.data)||[];g(t),t.forEach(a=>{var s,o;(a.ezFunnelToken||(s=a.customDomains)!=null&&s.length||(o=a.handleDomains)!=null&&o.length)&&he.current.set(a.id,{ezFunnelToken:a.ezFunnelToken,customDomains:a.customDomains,handleDomains:a.handleDomains})})},[n]),r.useEffect(()=>{let t=[...i];if(F.trim()){const a=F.toLowerCase();t=t.filter(s=>s.title.toLowerCase().includes(a)||s.slug.toLowerCase().includes(a))}t.sort((a,s)=>{switch(ie){case"oldest":return new Date(a.created_at).getTime()-new Date(s.created_at).getTime();case"title-asc":return a.title.localeCompare(s.title);case"title-desc":return s.title.localeCompare(a.title);
18case"recent":default:return new Date(s.created_at).getTime()-new Date(a.created_at).getTime()}}),D(t)},[i,F,ie]),r.useEffect(()=>{if(w.trim()&&L&&X){const t=setTimeout(()=>{Ue()},800);return()=>clearTimeout(t)}},[w,L,X]),r.useEffect(()=>{if(Z.trim()&&w.trim()&&X){const t=setTimeout(()=>{jt()},800);return()=>clearTimeout(t)}else I({valid:null,message:"",discount:0,domain_discount:0})},[Z,w,X]),r.useEffect(()=>{const t=new IntersectionObserver(s=>{s[0].isIntersecting&&j&&!P&&ht()},{threshold:.5,rootMargin:"100px"}),a=Ge.current;return a&&t.observe(a),()=>{a&&t.unobserve(a)}},[j,P]);const ht=r.useCallback(async()=>{if(!(P||!j)){p(!0);try{const t=await $.get("/pages-list/load-more",{params:{page:x+1,per_page:k}});if(t.data.success){const a=t.data.data;a.forEach(s=>{var o,l;(s.ezFunnelToken||(o=s.customDomains)!=null&&o.length||(l=s.handleDomains)!=null&&l.length)&&he.current.set(s.id,{ezFunnelToken:s.ezFunnelToken,customDomains:s.customDomains,handleDomains:s.handleDomains})}),g(s=>[...s,...a]),T(t.data.meta.current_page),v(t.data.meta.current_page<t.data.meta.last_page)}}catch(t){console.error("Failed to load more pages:",t),m("Failed to load more pages","error")}finally{p(!1)}}},[P,j,x,k,m]),Q=r.useCallback(async t=>{try{const a=await $.get(`/pages-list/${t}`);if(a.data.success&&a.data.page){const s=a.data.page,o=he.current.get(t);g(l=>l.map(b=>b.id===t?{...b,title:s.title||b.title,slug:s.slug||b.slug,hasSecrets:s.hasSecrets??b.hasSecrets,updated_at:s.updated_at||b.updated_at,updated_at_formatted:s.updated_at_formatted||b.updated_at_formatted,ezFunnelToken:(o==null?void 0:o.ezFunnelToken)??s.ezFunnelToken??b.ezFunnelToken,ezFunnelId:s.ezFunnelId??b.ezFunnelId,customDomains:(o==null?void 0:o.customDomains)??s.customDomains??b.customDomains??[],handleDomains:(o==null?void 0:o.handleDomains)??s.handleDomains??b.handleDomains??[]}:b)),_&&_.id===t&&q(l=>l?{...l,title:s.title||l.title,slug:s.slug||l.slug,hasSecrets:s.hasSecrets??l.hasSecrets,updated_at:s.updated_at||l.updated_at,updated_at_formatted:s.updated_at_formatted||l.updated_at_formatted,html_content:s.html_content??l.html_content,processed_html:s.processed_html??l.processed_html,restored_html:s.restored_html??l.restored_html,secrets:s.secrets??l.secrets,ezFunnelToken:(o==null?void 0:o.ezFunnelToken)??l.ezFunnelToken,ezFunnelId:s.ezFunnelId??l.ezFunnelId,customDomains:(o==null?void 0:o.customDomains)??l.customDomains??[],handleDomains:(o==null?void 0:o.handleDomains)??l.handleDomains??[]}:null)}}catch(a){console.error("Failed to refresh page data:",a)}},[_]),gt=async t=>{be(a=>({...a,[t.id]:!0}));try{const a=await $.get(`/pages-list/${t.id}`);if(a.data.success){const s=a.data.page;return he.current.set(t.id,{ezFunnelToken:s.ezFunnelToken,customDomains:s.customDomains,handleDomains:s.handleDomains}),s}return null}catch(a){return console.error("Failed to fetch page details:",a),m("Failed to load page details","error"),null}finally{be(a=>({...a,[t.id]:!1}))}},Qe=async t=>{U(t);const a=await gt(t);a&&(q(a),te(!0))},pt=()=>{te(!1),U(null),q(null)},ft=t=>{U(t),ge(!0)},bt=t=>{U(t),fe(!0)},yt=t=>{re(t),$e(t.slug),Be(t.title);const a=t.ezFunnelId?t.ezFunnelId:null;qe(a),je(!0),ve(""),G({checking:!1,available:null,message:""}),Ne(""),I({valid:null,message:"",discount:0,domain_discount:0}),Ce(!1),ue({success:!1,message:"",url:""}),f(""),He(""),Ke("domain")},Je=()=>{je(!1),ve(""),G({checking:!1,available:null,message:""}),Ne(""),I({valid:null,message:"",discount:0,domain_discount:0}),Ce(!1),ue({success:!1,message:"",url:""}),f(""),He(""),Se(!1),Pe(1),Ve(""),Re(""),Me(null),ne(!1),re(null),$e(""),Be(""),qe(null)},Ue=async()=>{var a,s;if(!w.trim()||!L){G({checking:!1,available:!1,message:"Please enter a brand name and select a domain"});return}const t=`${w.trim()}-${L}-${ae}`;ot(t),Xe(!0),G({checking:!0,available:null,message:"Checking availability..."});try{const o=await $.post("/ezai/check-ezpressstandard-domain",{handle:w.trim(),domain:L});ue({success:!1,message:"",url:""});const l=o.data.price||0,b=o.data.promoPrice||0,oe=o.data.charCount||0;G({checking:!1,available:o.data.available,message:o.data.message,price:Number(l),promoPrice:Number(b),charCount:Number(oe)})}catch(o){G({checking:!1,available:!1,message:((s=(a=o.response)==null?void 0:a.data)==null?void 0:s.message)||"Error checking availability",price:0,promoPrice:0,charCount:0})}finally{Xe(!1)}},jt=async()=>
18{if(!Z.trim()||!w.trim()){I({valid:!1,message:"Please enter a coupon code and brand name",discount:0,domain_discount:0});return}try{I({valid:null,message:"Validating coupon...",discount:0,domain_discount:0});const t=await $.post("/ezai/couponcodecustomdomain",{couponcode:Z.trim(),domainurl:w.trim(),type:ae});if(t.data.valid){const a=t.data.offprice!==void 0?t.data.offprice:t.data.original_price,s=at(t.data.title||"Coupon applied successfully!");I({valid:!0,message:s,discount:Number(a),domain_discount:Number(a)}),mt(o=>o+1),m("Coupon applied successfully!","success")}else{const a=at(t.data.title||"Invalid coupon code");I({valid:!1,message:a,discount:0,domain_discount:0}),m(a,"error")}}catch(t){console.error("Error validating coupon:",t),I({valid:!1,message:"Error validating coupon. Please try again.",discount:0,domain_discount:0}),m("Error validating coupon. Please try again.","error")}},V=r.useMemo(()=>{let a=d.promoPrice&&d.promoPrice>0?Number(d.promoPrice)||0:Number(d.price)||0;return z.valid&&z.domain_discount!==void 0&&(a=Number(z.domain_discount)),a>0&&a<1&&(a=1),{domainPrice:Number(a),totalPrice:Number(a)}},[d,z,xt]),vt=()=>{const t=`${w.trim()}-${L}-${ae}`;if(!w.trim()||!L||d.available===!1||lt!==t){f("Please check availability first"),m("Please check availability first","error");return}if(!ke){f("Please agree to the terms and conditions"),m("Please agree to the terms and conditions","error");return}const a=(c==null?void 0:c.slug)||"",s=(c==null?void 0:c.title)||"";if(!a){f("No page selected for domain purchase"),m("No page selected for domain purchase","error");return}$e(a),Be(s||""),Me(ae),wt()},wt=async()=>{var o,l,b,oe,Y,R;let t=Number(V.totalPrice);t>0&&t<1&&(t=1);const a=Ie,s=Ye;if(!a){f("No page selected for domain purchase"),m("No page selected for domain purchase","error");return}if(t===0){f(""),ne(!0);try{const N=await $.post("/ezai/free-purchase-after-login",{custom_handle:w.trim(),domain:L,type:ae,coupon_code:Z,slug:a,slug_id:c==null?void 0:c.id,title:s,view_mode:Le,ezFunnelId:Ae},{headers:{"X-CSRF-TOKEN":((o=document.querySelector('meta[name="csrf-token"]'))==null?void 0:o.getAttribute("content"))||""}});if(N.data.success){const y=`https://${w.trim()}.${L}`;ue({success:!0,message:"Purchase successful! Your new URL: ",url:y}),m(`Purchase successful! Your new URL: ${y}`,"success"),Se(!1),Me(null),f(""),c&&await Q(c.id),setTimeout(()=>{ve(""),G({checking:!1,available:null,message:""}),Ne(""),I({valid:null,message:"",discount:0,domain_discount:0}),Ce(!1)},6e4)}else{const y=N.data.error||N.data.message||"Free purchase failed";f(y),m(y,"error")}}catch(N){console.error("Free purchase error:",N);let y="Failed to process free purchase";$.isAxiosError(N)?N.response?y=((l=N.response.data)==null?void 0:l.error)||((b=N.response.data)==null?void 0:b.message)||`Error ${N.response.status}: ${N.response.statusText}`:N.request?y="No response from server. Please check your connection.":y=N.message||"Failed to process free purchase":N instanceof Error&&(y=N.message),f(y),m(y,"error")}finally{ne(!1)}return}if(t<1&&t!==0){f("Minimum payment amount is $1"),m("Minimum payment amount is $1","error");return}f(""),ne(!0);try{const y=await $.post("/ezai/initiate-domain-homepayment-after-login",{price:Number(V.domainPrice),custom_handle:w.trim(),domain:L,promo_price:Number(t),coupon_code:Z,selling_price:0,payment_method:"usd",view_mode:Le},{headers:{"X-CSRF-TOKEN":((oe=document.querySelector('meta[name="csrf-token"]'))==null?void 0:oe.getAttribute("content"))||""}});Ve(y.data.clientSecret),Re(y.data.payment_intent_id),Me(ae),Pe(2),Se(!0)}catch(N){if($.isAxiosError(N)){const y=((R=(Y=N.response)==null?void 0:Y.data)==null?void 0:R.error)||"Failed to initialize payment";f(y),m(y,"error")}else{const y="Failed to connect to payment service";f(y),m(y,"error")}}finally{ne(!1)}},Nt=async()=>{var t,a,s;ne(!0),f("");try{const o=await $.post("/ezai/home-domain-handle-success-after-login",{payment_intent_id:dt,slug:Ie,title:Ye,view_mode:Le,slug_id:c==null?void 0:c.id,ezFunnelId:Ae},{headers:{"X-CSRF-TOKEN":((t=document.querySelector('meta[name="csrf-token"]'))==null?void 0:t.getAttribute("content"))||""}});if(o.data.success){const l=`https://${w.trim()}.${L}`;ue({success:!0,message:"Purchase successful! Your new URL: ",url:l}),m(`Payment successful! Your new URL: ${l}`,"success"),Se(!1),Me(null),Pe(1),Ve(""),Re(""),f(""),c&&await Q(c.id),setTimeout(()=>{ve(""),G({checking:!1,available:null,message:""}),Ne(""),I({valid:null,message:"",discount:0,domain_discount:0}),Ce(!1)},6e4)}else{const l=o.data.error||"Payment verification failed";f(l),m(l,"error")}}catch(o){const l=((s=(a=o.response)==null?void 0:a.data)==null?void 0:s.error)||"Payment verification failed";f(l),m(l,"error")}finally{ne(!1)}},kt=r.useCallback(async(t,a,s,o)=>{var b,oe;de(!0);const l=he.current.get(t.id);g(Y=>Y.map(R=>R.id===t.id?{...R,title:a,slug:s,ezFunnelToken:(l==null?void 0:l.ezFunnelToken)??R.ezFunnelToken,customDomains:(l==null?void 0:l.customDomains)??R.customDomains??[],handleDomains:(l==null?void 0:l.handleDomains)??R.handleDomains??[]}:R)),_&&q({..._,title:a,slug:s,ezFunnelToken:(l==null?void 0:l.ezFunnelToken)??_.ezFunnelToken,customDomains:(l==null?void 0:l.customDomains)??_.customDomains??[],handleDomains:(l==null?void 0:l.handleDomains)??_.handleDomains??[]});try{const Y=await $.put(`/pages-list/${t.id}`,{title:a,slug:s});if(Y.data.success)return await Q(t.id),m("Page updated successfully!","success"),Promise.resolve();throw await Q(t.id),new Error(Y.data.message||"Failed to update page")}catch(Y){await Q(t.id);const R=((oe=(b=Y.response)==null?void 0:b.data)==null?void 0:oe.message)||Y.message||"Failed to update page";return m(R,"error"),Promise.reject(new Error(R))}finally{de(!1)}},[Q,m,_]),Ct=r.useCallback(async(t,a)=>{var s,o;try{const l=await $.put(`/pages-list/${t}/content`,{html_content:a});if(l.data.success)return await Q(t),!0;throw new Error(l.data.message||"Failed to update content")}catch(l){const b=((o=(s=l.response)==null?void 0:s.data)==null?void 0:o.message)||l.message||"Failed to update content";return m(b,"error"),!1}},[Q,m]),St=async()=>{var t,a;if(B){K(!0);try{const s=await $.delete(`/pages-list/${B.id}`);if(s.data.success)he.current.delete(B.id),g(o=>o.filter(l=>l.id!==B.id)),fe(!1),U(null),ce&&(te(!1),q(null)),m("Page deleted successfully!","success");else throw new Error(s.data.message||"Failed to delete page")}catch(s){const o=((a=(t=s.response)==null?void 0:t.data)==null?void 0:a.message)||s.message||"Failed to delete page";m(o,"error")}finally{K(!1)}}},Pt=r.useCallback(async(t,a)=>
18{try{return(await $.get("/pages-list/check-slug",{params:{slug:t,page_id:a}})).data.available}catch(s){return console.error("Failed to check slug:",s),!1}},[]),et=()=>{Ft.get("/pagegen/generate-page")},Tt=r.useMemo(()=>({totalSecrets:i.filter(a=>a.hasSecrets).length}),[i]);return e.jsxs(e.Fragment,{children:[e.jsx(Mt,{title:"Page Management"}),e.jsx(Et,{id:"main-tooltip",place:"top",className:"!bg-gray-900 !text-white !text-xs !px-3 !py-2 !rounded-lg !z-[100] !shadow-xl",effect:"solid"}),e.jsx(_t,{auth:u}),e.jsx("style",{children:`
19                @keyframes fade-in {
20                    from { opacity: 0; }
21                    to { opacity: 1; }
22                }
23                @keyframes slide-in-from-bottom-2 {
24                    from { transform: translateY(0.5rem); opacity: 0; }
25                    to { transform: translateY(0); opacity: 1; }
26                }
27                @keyframes slide-left {
28                    from { transform: translateX(100%); opacity: 0; }
29                    to { transform: translateX(0); opacity: 1; }
30                }
31                @keyframes spin {
32                    from { transform: rotate(0deg); }
33                    to { transform: rotate(360deg); }
34                }
35                .animate-in {
36                    animation-duration: 0.3s;
37                    animation-fill-mode: both;
38                }
39                .fade-in {
40                    animation-name: fade-in;
41                }
42                .slide-in-from-bottom-2 {
43                    animation-name: slide-in-from-bottom-2;
44                }
45                .animate-slide-left {
46                    animation: slide-left 0.3s ease-out;
47                }
48                .animate-spin {
49                    animation: spin 1s linear infinite;
50                }
51                .page-card {
52                    transition: all 0.2s ease;
53                }
54                .page-card:hover {
55                    border-color: #86efac;
56                    box-shadow: 0 8px 20px -6px rgba(34, 197, 94, 0.15);
57                }
58                .custom-scrollbar::-webkit-scrollbar {
59                    width: 5px;
60                }
61                .custom-scrollbar::-webkit-scrollbar-track {
62                    background: #f1f5f9;
63                    border-radius: 20px;
64                }
65                .custom-scrollbar::-webkit-scrollbar-thumb {
66                    background: #cbd5e1;
67                    border-radius: 20px;
68                }
69                .custom-scrollbar::-webkit-scrollbar-thumb:hover {
70                    background: #94a3b8;
71                }
72            `}),e.jsx("div",{className:"flex min-h-screen bg-[#F9FAFB] text-gray-800 antialiased",children:e.jsxs("main",{className:"flex-1 flex flex-col p-8 overflow-hidden bg-[#F9FAFB]",children:[e.jsxs("div",{className:"flex justify-between items-start mb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-800 tracking-tight",children:"Page Management"}),e.jsxs("div",{className:"flex gap-4 mt-2 items-center",children:[e.jsxs("span",{className:"bg-green-100 text-green-700 px-3 py-1 rounded-full text-xs font-semibold",children:[h," page",h!==1?"s":""]}),e.jsxs("span",{className:"text-gray-400 text-xs",children:["• ",Tt.totalSecrets," with secrets"]})]})]}),e.jsxs("button",{onClick:et,className:"bg-[#22C55E] hover:bg-green-600 text-white px-5 py-2.5 rounded-xl flex items-center gap-2 font-semibold text-sm transition shadow-sm shadow-green-200",children:[e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",children:e.jsx("path",{d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Create New Page"]})]}),e.jsxs("div",{className:"flex flex-1 gap-7 overflow-hidden",children:[e.jsxs("div",{className:"w-[40%] flex flex-col",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4 px-1",children:[e.jsxs("p",{className:"text-xs text-gray-500 font-medium",children:["Showing ",E.length," of ",h," pages"]}),e.jsx("select",{value:ie,onChange:t=>ee(t.target.value),className:"flex items-center gap-2 border border-gray-200 rounded-lg px-4 py-2 bg-white text-xs font-semibold cursor-pointer shadow-sm hover:bg-gray-50 outline-none",children:Vt.map(t=>e.jsx("option",{value:t.value,children:t.label},t.value))})]}),e.jsx("div",{className:"mb-6",children:e.jsxs("div",{className:"relative w-full",children:[e.jsx("span",{className:"absolute inset-y-0 left-0 flex items-center pl-4 text-gray-400",children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"m21 21-4.3-4.3"})]})}),e.jsx("input",{ref:ut,type:"text",value:F,onChange:t=>H(t.target.value),placeholder:"Search pages by title or slug...",className:"w-full pl-11 pr-5 py-3.5 border border-gray-200 rounded-2xl focus:ring-2 focus:ring-green-500/30 focus:border-green-400 outline-none bg-white shadow-sm transition"}),F&&e.jsx("button",{onClick:()=>H(""),className:"absolute right-3 top-1/2 transform -translate-y-1/2 p-1 hover:bg-gray-100 rounded-full",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#9ca3af",strokeWidth:"2",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]})}),e.jsx("div",{className:"space-y-3 overflow-y-auto pr-2 custom-scrollbar max-h-[calc(100vh-280px)]",children:E.length===0?e.jsxs("div",{className:"text-center py-20 bg-white rounded-2xl border-2 border-gray-200 shadow-sm",children:[e.jsx("div",{className:"w-24 h-24 mx-auto mb-6 bg-gradient-to-br from-gray-100 to-gray-200 rounded-full flex items-center justify-center",children:e.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"#9ca3af",strokeWidth:"1.5",children:[e.jsx("path",{d:"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"}),e.jsx("polyline",{points:"22,6 12,13 2,6"})]})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:F?"No pages found":"No pages yet"}),e.jsx("p",{className:"text-gray-600 mb-8 max-w-md mx-auto",children:F?`No pages match "${F}". Try different keywords.`:"Create your first HTML page by uploading content."}),e.jsxs("button",{onClick:et,className:"inline-flex items-center px-6 py-3 bg-[#22C55E] hover:bg-green-600 text-white rounded-xl text-sm font-semibold transition shadow-sm shadow-green-200",children:[e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"mr-2",children:e.jsx("path",{d:"M12 5v14M5 12h14"})}),"Create Your First Page"]})]}):E.map(t=>{var a;return e.jsx("div",{className:`page-card bg-white border-2 rounded-2xl p-4 shadow-sm relative transition cursor-pointer ${(B==null?void 0:B.id)===t.id?"border-green-500 bg-green-50/30":"border-gray-200 hover:border-green-400"}`,onClick:()=>Qe(t),children:e.jsx("div",{className:"flex justify-between items-start",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[e.jsx("h3",{className:"font-bold text-gray-800 text-base truncate",children:t.title}),e.jsxs("div",{className:"flex gap-2.5 text-gray-300 ml-3 flex-shrink-0",children:[e.jsx("button",{onClick:s=>{s.stopPropagation(),ft(t)},className:"p-2 hover:bg-blue-50 rounded-xl transition-colors text-gray-500 hover:text-blue-600","data-tooltip-id":"main-tooltip","data-tooltip-content":"Preview page",children:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),e.jsx("button",{onClick:s=>{s.stopPropagation(),Qe(t)},className:"p-2 hover:bg-green-50 rounded-xl transition-colors text-gray-500 hover:text-green-600","data-tooltip-id":"main-tooltip","data-tooltip-content":"Edit page",children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})})}),e.jsxs("button",{onClick:s=>{s.stopPropagation(),yt(t)},className:"relative group overflow-hidden bg-gradient-to-r from-purple-500 to-purple-600 hover:from-purple-600 hover:to-purple-700 text-white px-3 py-1.5 rounded-xl text-xs font-semibold transition-all duration-300 shadow-md hover:shadow-lg hover:shadow-
72purple-500/30 flex items-center gap-1.5 border border-purple-400/20","data-tooltip-id":"main-tooltip","data-tooltip-content":"✨ Get a custom domain for this page",children:[e.jsx("span",{className:"absolute inset-0 w-full h-full bg-gradient-to-r from-transparent via-white/20 to-transparent -skew-x-12 translate-x-[-200%] group-hover:translate-x-[200%] transition-transform duration-1000"}),e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",className:"relative z-10 group-hover:rotate-12 transition-transform duration-300",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),e.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]}),e.jsx("span",{className:"relative z-10",children:"Buy domain"}),e.jsxs("span",{className:"relative z-10 flex h-2 w-2",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-yellow-300 opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-yellow-400"})]})]}),e.jsx("button",{onClick:s=>{s.stopPropagation(),bt(t)},className:"p-2 hover:bg-red-50 rounded-xl transition-colors text-gray-500 hover:text-red-600","data-tooltip-id":"main-tooltip","data-tooltip-content":"Delete page",children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})})})]})]}),e.jsxs("p",{className:"text-[11px] text-gray-400 mb-2",children:[t.created_at_formatted," • ",((a=u==null?void 0:u.user)==null?void 0:a.email)||"Anonymous"]}),e.jsx("div",{className:"bg-gray-50 rounded-lg px-3 py-2 border border-gray-100",children:e.jsxs("a",{href:`/page/${t.slug}`,target:"_blank",rel:"noopener noreferrer",className:"text-xs font-mono text-gray-600 hover:text-green-600 truncate flex items-center gap-1 transition-colors group",title:`Click to open /page/${t.slug} in new tab`,onClick:s=>s.stopPropagation(),children:[e.jsx("span",{className:"text-gray-400 group-hover:text-green-500 transition-colors",children:"🔗"}),e.jsxs("span",{className:"flex-1 truncate",children:["/page/",t.slug]}),e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"opacity-0 group-hover:opacity-100 transition-opacity text-green-500",children:[e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})]})}),t.ezFunnelToken&&e.jsx("div",{className:"mt-2 bg-gradient-to-r from-purple-50 to-purple-100 rounded-lg px-3 py-2 border border-purple-200",children:e.jsxs("a",{href:`https://ez.wiki/${t.ezFunnelToken}`,target:"_blank",rel:"noopener noreferrer",className:"text-xs font-mono text-purple-700 hover:text-purple-600 truncate flex items-center gap-1 transition-colors group",title:`Click to open https://ez.wiki/${t.ezFunnelToken} in new tab`,onClick:s=>s.stopPropagation(),children:[e.jsx("span",{className:"text-purple-500 group-hover:text-purple-600 transition-colors",children:"✨"}),e.jsxs("span",{className:"flex-1 truncate font-semibold",children:["https://ez.wiki/",t.ezFunnelToken]}),e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"opacity-0 group-hover:opacity-100 transition-opacity text-purple-500",children:[e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})]})}),t.customDomains&&t.customDomains.length>0&&e.jsx("div",{className:"mt-2 space-y-2",children:t.customDomains.map(s=>e.jsx("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 rounded-lg px-3 py-2 border border-blue-200",children:e.jsxs("a",{href:`https://${s.domainselected}/${s.domain}`,target:"_blank",rel:"noopener noreferrer",className:"text-xs font-mono text-blue-700 hover:text-blue-600 truncate flex items-center gap-1 transition-colors group",title:`Click to open https://${s.domainselected}/${s.domain} in new tab`,onClick:o=>o.stopPropagation(),children:[e.jsx("span",{className:"text-blue-500 group-hover:text-blue-600 transition-colors",children:"🌐"}),e.jsxs("span",{className:"flex-1 truncate font-semibold",children:["https://",s.domainselected,"/",s.domain]}),e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"opacity-0 group-hover:opacity-100 transition-opacity text-blue-500",children:[e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})]})},s.id))}),t.handleDomains&&t.handleDomains.length>0&&e.jsx("div",{className:"mt-2 space-y-2",children:t.handleDomains.map(s=>e.jsxs("div",{className:"bg-gradient-to-r from-purple-50 to-pink-50 rounded-lg px-3 py-2 border border-purple-200",children:[e.jsxs("a",{href:`https://${s.domain}.${s.domainselected}`,target:"_blank",rel:"noopener noreferrer",className:"text-xs font-mono text-purple-700 hover:text-purple-600 truncate flex items-center gap-1 transition-colors group",title:`Click to open https://${s.domain}.${s.domainselected} in new tab`,onClick:o=>o.stopPropagation(),children:[e.jsx("span",{className:"text-purple-500 group-hover:text-purple-600 transition-colors",children:"🔗"}),e.jsxs("span",{className:"flex-1 truncate font-semibold",children:["https://",s.domain,".",s.domainselected]}),e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"opacity-0 group-hover:opacity-100 transition-opacity text-purple-500",children:[e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})]}),s.hashtag&&e.jsxs("div",{className:"mt-1 text-[10px] text-purple-400 flex items-center gap-1",children:[e.jsx("span",{children:"#"}),e.jsx("span",{children:s.hashtag})]})]},s.id))})]})})},t.id)})}),e.jsxs("div",{ref:Ge,className:"py-12 text-center",children:[P&&e.jsxs("div",{className:"inline-flex items-center gap-3 px-6 py-3 bg-white border-2 border-gray-200 rounded-2xl shadow-sm",children:[e.jsx(J,{size:22}),e.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Loading more pages..."})]}),!j&&i.length>0&&e.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm text-gray-500",children:[e.jsx("div",{className:"w-12 h-px bg-gradient-to-r from-transparent to-gray-300"}),e.jsx("span",{children:"You've reached the end"}),e.jsx("div",{className:"w-12 h-px bg-gradient-to-l from-transparent to-gray-300"})]})]})]}),e.jsx("div",{className:"w-[60%]",children:ce&&_?e.jsx(Yt,{page:_,isOpen:ce,onClose:pt,onUpdate:kt,onUpdateContent:Ct,onCheckSlug:Pt,isUpdating:_e,onShowAlert:m},_.updated_at):e.jsxs("div",{className:"bg-white border border-gray-200 rounded-3xl shadow-xl flex flex-col h-full",children:[e.jsx("div",{className:"p-6 border-b border-gray-200",children:e.jsxs("h2",{className:"text-lg font-bold text-gray-800 flex items-center gap-2",children:[e.jsx("svg",{className:"h-5 w-5 text-green-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:"2",children:e.jsx("path",{d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"Edit Page"]})}),e.jsxs("div",{className:"p-8 flex-1 flex flex-col items-center justify-center text-center space-y-6",children:[e.jsx("div",{className:"w-24 h-24 bg-gradient-to-br from-green-50 to-green-100 rounded-3xl flex items-center justify-center",children:e.jsx("svg",{className:"w-12 h-12 text-green-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:"1.5",children:e.jsx("path",{d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xl font-bold text-gray-800 mb
72-2",children:"No Page Selected"}),e.jsx("p",{className:"text-gray-500 max-w-sm",children:"Select a page from the list to edit its title, slug, and HTML content."})]}),e.jsxs("div",{className:"w-full max-w-sm space-y-4 mt-4",children:[e.jsxs("div",{className:"flex items-start gap-3 text-left",children:[e.jsx("div",{className:"w-6 h-6 rounded-full bg-green-100 flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"w-3.5 h-3.5 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:"3",children:e.jsx("path",{d:"M20 6L9 17l-5-5"})})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-800 text-sm",children:"Edit Title & Slug"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Customize the page URL and display name"})]})]}),e.jsxs("div",{className:"flex items-start gap-3 text-left",children:[e.jsx("div",{className:"w-6 h-6 rounded-full bg-green-100 flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"w-3.5 h-3.5 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:"3",children:e.jsx("path",{d:"M20 6L9 17l-5-5"})})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-800 text-sm",children:"Edit HTML Content"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Upload or paste HTML code"})]})]}),e.jsxs("div",{className:"flex items-start gap-3 text-left",children:[e.jsx("div",{className:"w-6 h-6 rounded-full bg-green-100 flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"w-3.5 h-3.5 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:"3",children:e.jsx("path",{d:"M20 6L9 17l-5-5"})})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-800 text-sm",children:"Auto-save"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Changes are saved automatically"})]})]})]}),e.jsx("div",{className:"mt-6 p-4 bg-gray-50 rounded-xl border border-gray-100",children:e.jsxs("p",{className:"text-xs text-gray-500 flex items-center gap-2",children:[e.jsxs("svg",{className:"w-4 h-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 16v-4M12 8h.01"})]}),e.jsx("span",{children:"Click on any page card to start editing"})]})})]}),e.jsx("div",{className:"p-4 border-t border-gray-200",children:e.jsx("p",{className:"text-[10px] text-gray-400 text-center",children:"Changes are saved automatically when you update"})})]})})]})]})}),e.jsx(At,{page:B,isOpen:A,onClose:()=>{ge(!1),U(null)}}),e.jsx(qt,{page:B,isOpen:pe,onClose:()=>{fe(!1),U(null)},onConfirm:St,isDeleting:se}),X&&c&&e.jsx("div",{className:"fixed inset-0 bg-black/70 min-h-screen flex items-center justify-center z-[100] p-4 overflow-y-auto",children:e.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl max-w-4xl w-full relative max-h-[90vh] overflow-y-auto border border-gray-200",children:[e.jsx("button",{onClick:Je,className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600 transition-colors z-10 bg-gray-100 hover:bg-gray-200 rounded-full w-8 h-8 flex items-center justify-center","data-tooltip-id":"main-tooltip","data-tooltip-content":"Close express domain modal",children:e.jsx(W,{icon:st,className:"text-gray-600"})}),e.jsxs("div",{className:"p-8",children:[e.jsxs("div",{className:"text-center mb-10",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 bg-gradient-to-br from-green-100 to-green-200 rounded-2xl mb-4","data-tooltip-id":"main-tooltip","data-tooltip-content":"Express Domain Service",children:e.jsx(W,{icon:Lt,className:"text-2xl text-green-600"})}),e.jsx("h3",{className:"text-3xl font-bold text-gray-900 mb-3",children:"Get Your Express Domain"}),e.jsx("p",{className:"text-gray-600 text-lg",children:"Choose your preferred option to establish your Web3 presence"})]}),le.success&&e.jsxs("div",{className:"mb-6 p-4 bg-green-50 border border-green-200 rounded-xl relative",children:[e.jsx("button",{onClick:()=>ue({success:!1,message:"",url:""}),className:"absolute top-4 right-4 text-green-600 hover:text-green-800 transition-colors","aria-label":"Close alert","data-tooltip-id":"main-tooltip","data-tooltip-content":"Close success notification",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})}),e.jsxs("div",{className:"flex items-center justify-center gap-3 text-green-600 mb-2",children:[e.jsx(W,{icon:rt,className:"text-2xl"}),e.jsx("span",{className:"text-lg font-semibold",children:"Purchase Successful!"})]}),e.jsxs("div",{className:"text-center text-gray-700 mb-3",children:[le.message,e.jsx("a",{href:le.url,target:"_blank",rel:"noopener noreferrer",className:"text-green-600 hover:text-green-700 hover:underline font-medium ml-1","data-tooltip-id":"main-tooltip","data-tooltip-content":"Visit your new domain",children:le.url})]})]}),me&&e.jsxs("div",{className:"mb-6 p-4 bg-red-50 border border-red-200 rounded-xl relative",children:[e.jsx("button",{onClick:()=>f(""),className:"absolute top-4 right-4 text-red-600 hover:text-red-800 transition-colors","aria-label":"Close error",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})}),e.jsxs("div",{className:"flex items-center justify-center gap-3 text-red-600 mb-2",children:[e.jsx(W,{icon:ze,className:"text-2xl"}),e.jsx("span",{className:"text-lg font-semibold",children:"Error"})]}),e.jsx("div",{className:"text-center text-gray-700",children:me})]}),e.jsx("div",{className:"flex justify-center items-center gap-4 mb-10",children:e.jsxs("button",{onClick:()=>Ke("domain"),className:`flex items-center justify-center py-3 px-8 rounded-xl shadow-sm font-semibold transition-all ${ae==="domain"?"bg-green-500 text-white shadow-md shadow-green-200":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,"data-tooltip-id":"main-tooltip","data-tooltip-content":"Get a full domain name (yourbrand.domain)",children:[e.jsx(W,{icon:zt,className:"mr-2"}),"Brand Domain"]})}),e.jsxs("div",{className:"flex flex-col md:flex-row justify-center items-center gap-4 max-w-3xl mx-auto mb-8",children:[e.jsx("div",{className:"relative w-full md:w-2/5",children:e.jsx("input",{type:"text",placeholder:"Enter your brand name",className:"w-full bg-gray-50 border border-gray-200 text-gray-900 py-4 px-6 rounded-xl focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-transparent placeholder-gray-400",value:w,onChange:t=>ve(t.target.value),onKeyPress:t=>{t.key==="Enter"&&Ue()},"data-tooltip-id":"main-tooltip","data-tooltip-content":"Enter your desired brand name or handle"})}),e.jsxs("div",{className:"relative w-full md:w-2/5",children:[e.jsx("select",{className:"w-full bg-gray-50 text-gray-900 py-4 px-6 pr-10 rounded-xl border border-gray-200 focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-transparent appearance-none",value:L,onChange:t=>We(t.target.value),"data-tooltip-id":"main-tooltip","data-tooltip-content":"Select a domain extension",children:O==null?void 0:O.map(t=>e.jsxs("option",{value:t.domain,children:[".",t.domain]},t.id))}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center px-3 text-gray-400",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})})]}),e.jsx("button",{onClick:Ue,className:`w-full md:w-1/5 font-bold py-4 px-6 rounded-xl shadow-sm flex items-center justify-center transition-all ${d.checking?"bg-gray-100 text-gray-500":d.available!==null?d.available?"bg-green-500 text-white hover:bg-green-600 shadow-md shadow-green-200":"bg-red-500 text-white hover:bg-red-600":"bg-green-500 text-white hover:bg-green-600 shadow-md shadow-green-200"}`,disabled:we||!w||d.checking,"data-tooltip-id":"main-tooltip","data-tooltip-content":w?d.checking?"Checking availability...":d.available?"Domain is available!":"Check if your domain is available":"Enter a brand name first",children:e.jsx("span",{children:d.checking?"Checking...":d.available!==null?d.available?"Available ✓":"Unavailable ✗":"Check Availability"})})]}),!le.success&&d.message&&e.jsxs("div",{className:`text-center mb-4 transition-all duration-300 ${d.checking?"opacity-70":"opacity-100"}`,children:[e.jsx("div",{className:`flex items-center justify-center gap-2 text-sm font-medium mb-4 ${d.available?"text-green-600":d.available===!1?"text-red-500":"text-yellow-600"}`,children:d.checking?e.jsxs(e.Fragment,{children:[e.jsx(W,{icon:Oe,className:"animate-spin"}),d.message||"Checking availability..."]}):e.jsxs(e.Fragment,{children:[d.available?e.jsx(W,{icon:rt,className:"text-green-500"}):e.jsx(W,{icon:ze,className:"text-red-500"}),d.message]})}),d.available&&d.price!==void 0&&e.jsxs("div",{className:"mt-8 max-w-2xl mx-auto",children:[e.jsx("div",{className:"bg-gradient-to-br from-gray-50 to-white border border-gray-200 rounded-xl p-6 mb-6",children:e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500 mb-1",children:"Your domain will be:"}),e.jsxs("p",{className:"text-2xl font-bold text-gray-900","data-tooltip-id":"main-tooltip","data-tooltip-content":"Your new domain",children:[w.trim(),".",L]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"text-sm text-gray-500","data-tooltip-id":"main-tooltip","data-tooltip-content":`${d.charCount||0} characters in your brand name`,children:[d.charCount," characters"]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-sm text-gray-500",children:"Price"}),e.jsxs("p",{className:"text-2xl font-bold text-green-600","data-tooltip-id":"main-tooltip","data-tooltip-content":"Final price after any discounts",children:["US$",Number(V.domainPrice).toFixed(2),z.valid&&e.jsx("span",{className:"text-green-400 text-sm ml-2",children:"🎉"})]})]})]})]})}),z.valid&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-4 items-stretch mb-4",children:[e.jsxs("div",{className:"flex-1 bg-gradient-to-r from-emerald-50 to-teal-50 border border-emerald-200 p-4 rounded-xl text-center flex flex-col justify-center shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-1",children:[e.jsx("svg",{className:"w-5 h-5 text-emerald-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),e.jsx("p",{className:"text-emerald-700 text-sm font-semibold",children:(()=>{const t=d.promoPrice&&d.promoPrice>0?Number(d.promoPrice)||0:Number(d.price)||0,a=z.discount||0,s=t-a;return s>0?`You save US${s.toFixed(2)}!`:a>0?"Discount applied!":"Coupon applied!"})()})]}),(()=>{const t=d.promoPrice&&d.promoPrice>0?Number(d.promoPrice)||0:Number(d.price)||0,a=z.discount||0;return t-a>0?e.jsxs("p",{className:"text-xs text-gray-500 line-through",children:["Original: US$",t.toFixed(2)]}):null})()]}),e.jsxs("div",{className:"flex-1 bg-gradient-to-r from-amber-50 to-orange-50 border border-amber-200 p-4 rounded-xl text-center flex flex-col justify-center shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-1",children:[e.jsx("svg",{className:"w-5 h-5 text-amber-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),e.jsx("p",{className:"text-amber-700 font-semibold text-base",children:"Final Price"})]}),e.jsxs("p",{className:"text-2xl font-bold text-gray-900",children:["US$",Number(V.domainPrice).toFixed(2)]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Including all fees"})]})]}),!z.valid&&Number(d.promoPrice)>0&&e.jsx("div",{className:"bg-blue-50 border border-blue-200 p-4 rounded-xl mb-6",children:e.jsxs("p",{className:"text-blue-700 font-semibold flex items-center justify-center gap-2","data-tooltip-id":"main-tooltip","data-tooltip-content":"Pre-launch promotional price",children:[e.jsx("span",{className:"text-xl",children:"✨"}),"Pre-launch Price: US$",Number(d.promoPrice).toFixed(2)]})}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Have a coupon code?"}),e.jsx("div",{className:"flex gap-2",children:e.jsx("input",{type:"text",className:"flex-1 bg-gray-50 border border-gray-200 text-gray-900 px-4 py-3 rounded-xl focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-transparent",placeholder:"Enter coupon code",value:Z,onChange:t=>Ne(t.target.value),"data-tooltip-id":"main-tooltip","data-tooltip-content":"Enter a coupon code for discounts"})}),Z&&e.jsx("div",{className:`mt-2 text-sm ${z.valid?"text-green-600":z.valid===!1?"text-red-500":"text-yellow-600"}`,children:z.message||"Validating coupon..."})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"View Mode"}),e.jsxs("select",{className:"w-full bg-gray-50 border border-gray-200 text-gray-900 px-4 py-3 rounded-xl focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-transparent appearance-none",value:Le,onChange:t=>nt(t.target.value),"data-tooltip-id":"main-tooltip","data-tooltip-content":"Choose how you want to view this content",children:[e.jsx("option",{value:"page",children:"Page View"}),e.jsx("option",{value:"ai",children:"AI View"}),e.jsx("option",{value:"naked",children:"HYBRID View"}),e.jsx("option",{value:"dressed",children:"EZ View"})]})]}),e.jsx("div",{className:"bg-gray-50 border border-gray-200 p-4 rounded-xl mb-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-gray-700 font-medium",children:"Total Amount:"}),e.jsxs("span",{className:"text-2xl font-bold text-green-600","data-tooltip-id":"main-tooltip","data-tooltip-content":"Final amount to pay",children:["US$",Number(V.totalPrice).toFixed(2)]})]})}),e.jsx("div",{className:"mb-6",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("input",{type:"checkbox",id:"terms-checkbox",required:!0,className:"mt-1 mr-3 rounded border-gray-300 text-green-600 focus:ring-green-500",checked:ke,onChange:t=>Ce(t.target.checked),"data-tooltip-id":"main-tooltip","data-tooltip-content":"You must agree to the terms to continue"}),e.jsxs("label",{htmlFor:"terms-checkbox",className:"text-sm text-gray-600",children:["By claiming your domain you agree to the"," ",e.jsx("button",{type:"button",onClick:()=>window.open("/terms-and-conditions","_blank"),className:"text-green-600 hover:text-green-700 hover:underline focus:outline-none","data-tooltip-id":"main-tooltip","data-tooltip-content":"View terms and conditions",children:"Terms and Conditions"})," ","and"," ",e.jsx("button",{type:"button",onClick:()=>window.open("/privacy-policy","_blank"),className:"text-green-600 hover:text-green-700 hover:underline focus:outline-none","data-tooltip-id":"main-tooltip","data-tooltip-content":"View privacy policy",children:"Privacy Policy"})]})]})}),e.jsx("button",{onClick:vt,disabled:we||!ke||Te,className:`w-full font-bold py-4 px-6 rounded-xl transition-all duration-200 flex items-center justify-center gap-2 shadow-lg ${we||!ke||Te?"bg-gray-400 cursor-not-allowed opacity-50":(Number(V.totalPrice)===0,"bg-green-500 hover:bg-green-600 text-white shadow-green-200")}`,"data-tooltip-id":"main-tooltip","data-tooltip-content":ke?we?"Processing your purchase...":Te?"Please wait...":Number(V.totalPrice)===0?"Claim your free domain":"Proceed to payment":"Please agree to terms first",children:we||Te?e.jsxs(e.Fragment,{children:[e.jsx(J,{size:20}),e.jsx("span",{children:"Processing..."})]}):Number(V.totalPrice)===0?"Claim Free Domain":`Purchase Domain for US${Number(V.totalPrice).toFixed(2)
72}`})]})]})]})]})}),it&&ct===2&&e.jsx("div",{className:"fixed inset-0 bg-black/70 min-h-screen flex items-center justify-center z-[100] p-4 overflow-y-auto",children:e.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl max-w-md w-full relative max-h-[90vh] overflow-y-auto border border-gray-200",children:[e.jsx("button",{onClick:()=>{Se(!1),Pe(1),f("")},className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600 transition-colors z-10 bg-gray-100 hover:bg-gray-200 rounded-full w-8 h-8 flex items-center justify-center",disabled:Te,children:e.jsx(W,{icon:st,className:"text-gray-600"})}),e.jsxs("div",{className:"p-6",children:[me&&e.jsxs("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 text-red-600 rounded-lg flex items-center gap-2",children:[e.jsx(W,{icon:ze}),e.jsx("span",{"data-tooltip-id":"main-tooltip","data-tooltip-content":"Error notification",children:me})]}),e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-14 h-14 bg-gradient-to-br from-green-100 to-green-200 rounded-xl mb-4",children:e.jsx("img",{src:"https://ez.wiki/logo.gif",className:"w-8 h-8 rounded-full object-cover",alt:"ez.wiki Logo"})}),e.jsx("h2",{className:"text-xl font-bold text-gray-900",children:"Domain Purchase"}),e.jsx("p",{className:"text-green-600 font-medium mt-1",children:`${w.trim()}.${L}`})]}),e.jsxs("div",{className:"bg-gray-50 border border-gray-200 rounded-xl p-4 mb-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("span",{className:"text-gray-600",children:"Domain Price:"}),e.jsxs("span",{className:"text-gray-900 font-semibold",children:["US$",Number(V.domainPrice).toFixed(2)]})]}),e.jsxs("div",{className:"flex justify-between items-center pt-2 border-t border-gray-200",children:[e.jsx("span",{className:"text-gray-900 font-bold",children:"Total:"}),e.jsxs("span",{className:"text-green-600 font-bold text-xl",children:["US$",Number(V.totalPrice).toFixed(2)]})]}),z.valid&&e.jsx("div",{className:"mt-3 p-2 bg-green-50 border border-green-200 rounded-lg text-center",children:e.jsxs("span",{className:"text-green-600 text-sm",children:["Coupon applied: ",z.message]})})]}),e.jsx($t,{stripe:Rt,options:{clientSecret:De,appearance:{theme:"stripe",variables:{colorPrimary:"#22c55e",colorBackground:"#ffffff",colorText:"#1f2937",colorDanger:"#ef4444",fontFamily:"Inter, system-ui, sans-serif",borderRadius:"12px"}}},children:De?e.jsx(Ot,{price:Number(V.totalPrice),clientSecret:De,onSuccess:Nt,onBack:()=>Pe(1),onError:t=>f(t),email:(tt=u==null?void 0:u.user)==null?void 0:tt.email}):e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(W,{icon:Oe,className:"animate-spin text-2xl text-green-500"})})}),e.jsxs("div",{className:"text-center text-xs text-gray-500 mt-4",children:[e.jsx("p",{children:"Payment secured by STRIPE."}),e.jsxs("p",{className:"mt-1",children:[e.jsx("a",{href:"/terms",className:"text-green-600 hover:underline",children:"Terms"})," and"," ",e.jsx("a",{href:"/privacy",className:"text-green-600 hover:underline",children:"Privacy"}),"."]})]})]})]})}),ye.show&&e.jsx(Ut,{message:ye.message,type:ye.type,onClose:()=>Ee({show:!1,message:"",type:"info"})})]})}export{ss 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.