PageSourceSearch

https://bbcc.ai/build/assets/GeneratePage-VR7x3zS_.js

js bbcc.ai collected 2026-10-05 12:12:54 UTC 19,486 bytes, 31 lines download raw bytes

1import{r as s,j as e,H as D,L as U}from"./app-DP13319Q.js";import{D as O}from"./DraggableMenu-Bk7Spryo.js";import{M as E}from"./react-tooltip.min-DW3XhwOj.js";import{A as $}from"./arrow-left-BDpJVyQf.js";import{C as z,E as ae,U as k}from"./upload-oE_Ye03u.js";import{C as re,S}from"./sparkles-UmslOrlU.js";import{C as se}from"./circle-alert-CZkNghCu.js";import{c as ne}from"./createLucideIcon-BZKkeQZf.js";import{F as G}from"./file-code-BUDOOVKZ.js";import{L as Y}from"./loader-circle-C-YIUsb6.js";/* empty css            */import"./index-CtyZ6W6U.js";import"./index-DQkUn08L.js";/**
2 * @license lucide-react v0.475.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const le=[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]],oe=ne("Type",le);function je({auth:P={user:null},tooltips:u={}}){const[i,d]=s.useState(""),[n,x]=s.useState(""),[h,y]=s.useState(""),[q,j]=s.useState(!1),[v,T]=s.useState(null),[L,A]=s.useState(!1),[F,l]=s.useState(null),[f,N]=s.useState("upload"),[w,b]=s.useState(!1),[H,I]=s.useState(!1),[m,C]=s.useState(null),c=s.useRef(null),B=s.useRef(null),t=s.useCallback((a,o,r)=>{let g=(u==null?void 0:u[a])||o;if(r)for(const[p,_]of Object.entries(r))g=g.replace(new RegExp(`{${p}}`,"g"),String(_));return g},[u]),W=s.useCallback(a=>{a.preventDefault(),j(!0)},[]),J=s.useCallback(a=>{a.preventDefault(),j(!1)},[]),M=a=>{if(!a.name.endsWith(".html")&&a.type!=="text/html"){l(t("generate_page_invalid_file","Please upload an HTML file"));return}const o=new FileReader;o.onload=r=>{var _,R;const g=(_=r.target)==null?void 0:_.result;x(g),l(null);const p=g.match(/<title[^>]*>([^<]*)<\/title>/i);(R=p==null?void 0:p[1])!=null&&R.trim()?d(p[1].trim()):d(a.name.replace(".html","").replace(".htm",""))},o.onerror=()=>{l(t("generate_page_read_error","Error reading file"))},o.readAsText(a)},K=s.useCallback(a=>{a.preventDefault(),j(!1),a.dataTransfer.files[0]&&M(a.dataTransfer.files[0])},[]),V=s.useCallback(a=>{var o;(o=a.target.files)!=null&&o[0]&&M(a.target.files[0])},[]),X=()=>{x(""),d(""),l(null),c.current&&(c.current.value="")},Q=async()=>{var a;if(!n.trim()){l(t("generate_page_no_html","Please provide HTML content first"));return}if(!i.trim()){l(t("generate_page_no_title","Please enter a title"));return}I(!0),l(null);try{const r=await(await fetch("/api/pages/ai-convert",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-TOKEN":((a=document.querySelector('meta[name="csrf-token"]'))==null?void 0:a.getAttribute("content"))||""},body:JSON.stringify({htmlContent:n,title:i})})).json();r.success&&r.reactCode?(C(r.reactCode),b(!0)):l(r.error||t("generate_page_ai_failed","AI conversion failed. Please try again."))}catch(o){console.error("AI conversion error:",o),l(t("generate_page_ai_error","Network error during AI conversion"))}finally{I(!1)}},Z=async()=>{var a;if(!i.trim()){l(t("generate_page_title_required","Please enter a page title"));return}if(!n.trim()){l(t("generate_page_html_required","Please provide HTML content"));return}A(!0),l(null);try{const r=await(await fetch("/pages-generate",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-TOKEN":((a=document.querySelector('meta[name="csrf-token"]'))==null?void 0:a.getAttribute("content"))||""},body:JSON.stringify({title:i.trim(),htmlContent:n.trim(),customSlug:h.trim()||void 0,useAI:!!(w&&m),reactCode:w&&m?m:void 0})})).json();r.success?(T(r.slug),d(""),x(""),y(""),b(!1),C(null)):l(r.error||t("generate_page_failed","Failed to create page"))}catch(o){console.error("Submit error:",o),l(t("generate_page_network_error","Network error. Please try again."))}finally{A(!1)}},ee=a=>{navigator.clipboard.writeText(a),alert(t("generate_page_copied","Copied to clipboard!"))},te=()=>{T(null),d(""),x(""),y(""),b(!1),C(null),l(null),N("upload"),c.current&&(c.current.value="")};if(v){const a=`${window.location.origin}/page/${v}`;return e.jsxs(e.Fragment,{children:[e.jsx(D,{title:t("generate_page_success_title","Page Created - ezbar.ai")}),e.jsx(E,{id:"generate-tooltip",place:"top",className:"!bg-gray-900 !text-white !text-xs !px-3 !py-2 !rounded-lg",effect:"solid"}),e.jsx(O,{auth:P}),e.jsx("div",{className:"min-h-screen bg-[#FCFCFC]",children:e.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 lg:px-8 py-12",children:[e.jsxs(U,{href:"/",className:"inline-flex items-center gap-2 text-slate-600 mb-8 hover:text-slate-900 transition-colors",children:[e.jsx($,{className:"w-4 h-4"}),t("generate_page_back","Back to Home")]}),e.jsxs("div",{className:"bg-white rounded-2xl shadow-xl border border-gray-200 overflow-hidden",children:[e.jsxs("div",{className:"p-8 text-center",children:[e.jsx("div",{className:"w-20 h-20 bg-gradient-to-br from-green-50 to-emerald-100 rounded-full flex items-center justify-center mx-auto mb-6",children:e.jsx(z,{className:"w-10 h-10 text-green-600"})}),e.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:t("generate_page_created","Page Created Successfully!")}),e.jsx("p",{className:"text-gray-500 mb-6",children:t("generate_page_live","Your page is now live and ready to be shared.")}),e.jsxs("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200 mb-6 text-left",children:[e.jsx("div",{className:"text-xs font-medium text-gray-500 mb-1 uppercase tracking-wider",children:t("generate_page_url_label","Page URL")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 text-sm font-mono text-green-600 truncate bg-white px-3 py-2 rounded-lg border border-gray-200",children:a}),e.jsx("button",{onClick:()=>ee(a),className:"p-2 hover:bg-gray-200 rounded-lg transition-colors shrink-0","data-tooltip-id":"generate-tooltip","data-tooltip-content":t("generate_page_copy_url","Copy URL to clipboard"),
6children:e.jsx(re,{className:"w-5 h-5 text-gray-500"})})]})]}),e.jsxs("div",{className:"flex gap-3 justify-center flex-wrap",children:[e.jsxs("a",{href:`/page/${v}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 bg-gradient-to-r from-green-500 to-emerald-600 hover:from-green-600 hover:to-emerald-700 text-white px-6 py-3 rounded-xl font-medium transition-all duration-200 shadow-md hover:shadow-lg","data-tooltip-id":"generate-tooltip","data-tooltip-content":t("generate_page_view_page","View your published page"),children:[e.jsx(ae,{className:"w-4 h-4"}),t("generate_page_view_page","View Page")]}),e.jsxs("button",{onClick:te,className:"inline-flex items-center gap-2 border-2 border-gray-300 hover:border-green-500 bg-white hover:bg-green-50 px-6 py-3 rounded-xl font-medium transition-all duration-200","data-tooltip-id":"generate-tooltip","data-tooltip-content":t("generate_page_upload_another","Create another page"),children:[e.jsx(k,{className:"w-4 h-4 text-gray-600"}),t("generate_page_upload_another","Upload Another")]})]})]}),e.jsx("div",{className:"px-6 py-4 bg-gray-50 border-t border-gray-200 text-center",children:e.jsx("p",{className:"text-xs text-gray-500",children:t("generate_page_powered_by","Powered by ezbar.ai • Your page is publicly accessible")})})]})]})})]})}return e.jsxs(e.Fragment,{children:[e.jsx(D,{title:t("generate_page_title","Generate HTML Page - ezbar.ai")}),e.jsx(E,{id:"generate-tooltip",place:"top",className:"!bg-gray-900 !text-white !text-xs !px-3 !py-2 !rounded-lg",effect:"solid"}),e.jsx(O,{auth:P}),e.jsx("div",{className:"min-h-screen bg-[#FCFCFC] pb-32",children:e.jsxs("div",{className:"max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[e.jsxs(U,{href:"/",className:"inline-flex items-center gap-2 text-slate-600 mb-6 hover:text-slate-900 transition-colors",children:[e.jsx($,{className:"w-4 h-4"}),t("generate_page_back","Back to Home")]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-bold bg-gradient-to-r from-gray-900 to-gray-600 bg-clip-text text-transparent mb-2",children:t("generate_page_heading","Generate HTML Page")}),e.jsx("p",{className:"text-gray-500",children:t("generate_page_description","Upload your HTML file or paste the code. We'll process it and create a live page.")})]}),F&&e.jsxs("div",{className:"mb-6 p-4 bg-red-50 border border-red-200 rounded-xl flex items-start gap-3",children:[e.jsx(se,{className:"w-5 h-5 text-red-500 flex-shrink-0 mt-0.5"}),e.jsx("div",{className:"flex-1",children:e.jsx("p",{className:"text-sm text-red-700",children:F})}),e.jsx("button",{onClick:()=>l(null),className:"text-red-400 hover:text-red-600 transition-colors",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium mb-2 text-gray-700",children:[e.jsx(oe,{className:"w-4 h-4 text-green-500"}),t("generate_page_title_label","Page Title"),e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"text",placeholder:t("generate_page_title_placeholder","Enter a title for your page"),value:i,onChange:a=>d(a.target.value),className:"w-full px-4 py-3 border-2 border-gray-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-green-500/20 focus:border-green-500 transition-all duration-200 text-gray-800","data-tooltip-id":"generate-tooltip","data-tooltip-content":t("generate_page_title_tooltip","This will be used as the page title and SEO")})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium mb-2 text-gray-700",children:[e.jsx(S,{className:"w-4 h-4 text-green-500"}),t("generate_page_slug_label","Custom Slug (Optional)")]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap sm:flex-nowrap",children:[e.jsxs("span",{className:"text-sm text-gray-500 whitespace-nowrap shrink-0 bg-gray-100 px-3 py-2 rounded-lg",children:[window.location.origin,"/page/"]}),e.jsx("input",{type:"text",placeholder:t("generate_page_slug_placeholder","auto-generated"),value:h,onChange:a=>y(a.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-")),className:"flex-1 px-4 py-3 border-2 border-gray-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-green-500/20 focus:border-green-500 transition-all duration-200 text-gray-800","data-tooltip-id":"generate-tooltip","data-tooltip-content":t("generate_page_slug_tooltip","Custom URL slug (letters, numbers, hyphens only)")})]}),h&&e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:t("generate_page_slug_preview","Your page will be available at: {url}",{url:`${window.location.origin}/page/${h}`})})]}),e.jsxs("div",{className:"border-2 border-gray-200 rounded-xl overflow-hidden bg-white",children:[e.jsxs("div",{className:"grid grid-cols-2 border-b border-gray-200",children:[e.jsxs("button",{onClick:()=>N("upload"),className:`flex items-center justify-center gap-2 py-3.5 text-sm font-medium transition-all duration-200 ${f==="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"}`,"data-tooltip-id":"generate-tooltip","data-tooltip-content":t("generate_page_upload_tab","Upload HTML file from your computer"),children:[e.jsx(k,{className:"w-4 h-4"}),t("generate_page_upload_tab","File Upload")]}),e.jsxs("button",{onClick:()=>N("paste"),className:`flex items-center justify-center gap-2 py-3.5 text-sm font-medium transition-all duration-200 ${f==="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"}`,"data-tooltip-id":"generate-tooltip","data-tooltip-content":t("generate_page_paste_tab","Paste HTML code directly"),children:[e.jsx(G,{className:"w-4 h-4"}),t("generate_page_paste_tab","Paste Code")]})]}),f==="upload"&&e.jsx("div",{className:"p-6",children:e.jsxs("div",{onDragOver:W,onDragLeave:J,onDrop:K,onClick:()=>{var a;return(a=c.current)==null?void 0:a.click()},className:`
7                                            border-2 border-dashed rounded-xl p-10 text-center cursor-pointer transition-all duration-200
8                                            ${q?"border-green-500 bg-green-50":"border-gray-300 hover:border-green-400 bg-gray-50/50"}
9                                            ${n?"border-green-400 bg-green-50/30":""}
10                                        `,children:[e.jsx("input",{ref:c,type:"file",accept:".html,.htm,text/html",onCh
10ange:V,className:"hidden"}),e.jsx("div",{className:"w-16 h-16 bg-white rounded-2xl flex items-center justify-center mx-auto mb-4 shadow-sm",children:n?e.jsx(z,{className:"w-8 h-8 text-green-600"}):e.jsx(k,{className:"w-8 h-8 text-gray-400"})}),n?e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-green-700 mb-1",children:t("generate_page_file_loaded","File loaded successfully!")}),e.jsx("p",{className:"text-sm text-gray-500",children:t("generate_page_click_replace","Click or drop to replace")}),e.jsx("button",{onClick:a=>{a.stopPropagation(),X()},className:"text-xs text-red-500 mt-2 hover:underline",children:t("generate_page_clear_file","Clear file")})]}):e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-700 mb-1",children:t("generate_page_drop_zone","Drop your HTML file here")}),e.jsx("p",{className:"text-sm text-gray-500",children:t("generate_page_or_click","or click to browse")}),e.jsx("p",{className:"text-xs text-gray-400 mt-2",children:t("generate_page_supported","Supports .html, .htm")})]})]})}),f==="paste"&&e.jsx("div",{className:"p-6",children:e.jsx("textarea",{ref:B,placeholder:t("generate_page_paste_placeholder",`<!DOCTYPE html>
11<html>
12<head>
13  <title>My Page</title>
14  <meta charset="UTF-8">
15  <meta name="viewport" content="width=device-width, initial-scale=1.0">
16</head>
17<body>
18  <h1>Hello World</h1>
19  <p>Your content here...</p>
20</body>
21</html>`),value:n,onChange:a=>{var o;if(x(a.target.value),!i){const r=a.target.value.match(/<title[^>]*>([^<]*)<\/title>/i);(o=r==null?void 0:r[1])!=null&&o.trim()&&d(r[1].trim())}l(null)},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","data-tooltip-id":"generate-tooltip","data-tooltip-content":t("generate_page_paste_tooltip","Paste your HTML code here")})})]}),n&&e.jsxs("div",{className:"bg-gradient-to-r from-purple-50 to-indigo-50 border-2 border-purple-200 rounded-xl p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(S,{className:"w-5 h-5 text-purple-600"}),e.jsx("label",{className:"font-medium text-purple-900",children:t("generate_page_ai_option","AI-Powered Conversion (Premium)")}),e.jsx("span",{className:"text-xs bg-purple-200 text-purple-700 px-2 py-0.5 rounded-full",children:t("generate_page_coming_soon","Coming Soon")})]}),e.jsx("p",{className:"text-sm text-purple-700",children:t("generate_page_ai_description","Convert your HTML to a React component with interactive features and dynamic behavior.")})]}),e.jsx("button",{onClick:Q,disabled:H||!0,className:"px-4 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg font-medium transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap","data-tooltip-id":"generate-tooltip","data-tooltip-content":t("generate_page_ai_tooltip","AI conversion will be available soon"),children:H?e.jsxs(e.Fragment,{children:[e.jsx(Y,{className:"w-4 h-4 animate-spin inline mr-2"}),t("generate_page_processing","Processing...")]}):t("generate_page_ai_convert","AI Convert (Beta)")})]}),m&&w&&e.jsxs("div",{className:"mt-4 p-3 bg-white rounded-lg border border-purple-200",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs font-medium text-purple-600",children:t("generate_page_ai_result","AI Conversion Result")}),e.jsx("button",{onClick:()=>b(!1),className:"text-xs text-gray-500 hover:text-gray-700",children:t("generate_page_use_original","Use Original")})]}),e.jsxs("pre",{className:"text-xs text-gray-600 overflow-x-auto max-h-32",children:[m.substring(0,500),"..."]})]})]}),n&&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.jsx(G,{className:"w-4 h-4 text-gray-500"}),e.jsx("span",{className:"text-sm font-medium text-gray-700",children:t("generate_page_preview","HTML Preview")})]}),e.jsxs("span",{className:"text-xs bg-white text-gray-600 px-2 py-1 rounded-md shadow-sm",children:[n.length.toLocaleStr
21ing()," ",t("generate_page_characters","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-48 overflow-y-auto text-gray-600 font-mono",children:[n.substring(0,1e3),n.length>1e3&&`
22
23<!-- ... truncated ... -->`]})})]})]})]})}),e.jsx("div",{className:"fixed bottom-0 left-0 right-0 bg-white/95 backdrop-blur-sm border-t-2 border-gray-200 shadow-lg z-50",children:e.jsx("div",{className:"max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 py-3",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:e.jsx("p",{className:"text-sm text-gray-600 truncate",children:i?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-medium text-gray-900",children:i}),n&&e.jsxs("span",{className:"text-gray-400 ml-1",children:["(",n.length.toLocaleString()," chars)"]})]}):e.jsx("span",{className:"text-gray-400",children:t("generate_page_ready","Ready to generate your page")})})}),e.jsx("button",{onClick:Z,disabled:L||!i||!n,className:"shrink-0 px-6 py-3 rounded-xl font-medium text-white transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed bg-gradient-to-r from-green-500 to-emerald-600 hover:from-green-600 hover:to-emerald-700 shadow-md hover:shadow-lg active:scale-95","data-tooltip-id":"generate-tooltip","data-tooltip-content":i?n?t("generate_page_generate_tooltip","Generate your live page"):t("generate_page_needs_html","Please provide HTML content"):t("generate_page_needs_title","Please enter a title"),children:L?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Y,{className:"w-4 h-4 animate-spin"}),e.jsx("span",{className:"hidden sm:inline",children:t("generate_page_generating","Generating...")}),e.jsx("span",{className:"sm:hidden",children:"..."})]}):e.jsxs("span",{className:"flex items-center gap-2 whitespace-nowrap",children:[e.jsx(S,{className:"w-4 h-4 shrink-0"}),e.jsx("span",{children:t("generate_page_generate","Generate Page")})]})})]})})}),e.jsx("style",{children:`
24                @keyframes fadeIn {
25                    from { opacity: 0; transform: translateY(10px); }
26                    to { opacity: 1; transform: translateY(0); }
27                }
28                .animate-fadeIn {
29                    animation: fadeIn 0.3s ease-out;
30                }
31            `})]})}export{je 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.