1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3332],{3332:(e,s,t)=>{"use strict";t.r(s),t.d(s,{WebBuilderView:()=>eg});var a=t(54568),i=t(7620),l=t(12598),n=t(32158),r=t(18335),o=t(60844),d=t(6438),c=t(94193),p=t(3094),h=t(84990),u=t(87551),m=t(80021),x=t(72116),b=t(2167),g=t(12494),j=t(45234),y=t(75424),f=t(32011),w=t(99357),v=t(13227),N=t(6101),k=t(34543),C=t(889),_=t(43002),S=t(12119);let A=(0,S.A)("pen-tool",[["path",{d:"M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z",key:"nt11vn"}],["path",{d:"m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18",key:"15qc1e"}],["path",{d:"m2.3 2.3 7.286 7.286",key:"1wuzzi"}],["circle",{cx:"11",cy:"11",r:"2",key:"xmgehs"}]]);var z=t(40590),T=t(75892),B=t(20415),P=t(70415),I=t(80229);let L=(0,S.A)("plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]]);var R=t(18255),D=t(32064),q=t(28653),M=t(64751),W=t(31241),F=t(64281);let E=(0,S.A)("file",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]);var O=t(85240),U=t(26862),H=t(63072),G=t(63104),V=t(90008),X=t(9708),K=t(44912);t(92214);var J=t(86936),$=t(44779),Y=t(94503),Z=t(65236),Q=t(75724),ee=t(18735),es=t(12305),et=t(9305),ea=t(98357),ei=t(98885),el=t(97186),en=t(89501);let er=e=>{let{label:s,values:t,onChange:n,placeholder:r}=e,[o,d]=(0,i.useState)(""),c=()=>{let e=o.trim().toLowerCase();e&&!t.includes(e)&&n([...t,e]),d("")};return(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:s}),(0,a.jsxs)("div",{className:"wb-chip-wrap",children:[t.map(e=>(0,a.jsxs)("span",{className:"wb-chip",children:[e,(0,a.jsx)("button",{type:"button",onClick:()=>n(t.filter(s=>s!==e)),children:(0,a.jsx)(l.A,{size:11})})]},e)),(0,a.jsx)("input",{className:"wb-chip-input",value:o,placeholder:r||"Add ".concat(s.toLowerCase(),"..."),onChange:e=>d(e.target.value),onKeyDown:e=>{("Enter"===e.key||","===e.key)&&(e.preventDefault(),c())},onBlur:c})]}),(0,a.jsx)("small",{style:{color:"#8c8f94"},children:"Press Enter or comma to add"})]})},eo=e=>{let{content:s,onChange:t,onInsertImage:i}=e,l=(0,et.hG)({extensions:[ea.A,ei.Ay,el.Ay.configure({openOnClick:!1}),en.A.configure({placeholder:"Start writing your content here..."})],content:s,onUpdate:e=>{let{editor:s}=e;return t(s.getHTML())}});return l?(0,a.jsxs)("div",{className:"wb-editor-wrap",children:[(0,a.jsxs)("div",{className:"wb-editor-toolbar",children:[(0,a.jsx)("button",{type:"button",className:"wb-tb-btn ".concat(l.isActive("bold")?"active":""),onClick:()=>l.chain().focus().toggleBold().run(),children:(0,a.jsx)("strong",{children:"B"})}),(0,a.jsx)("button",{type:"button",className:"wb-tb-btn ".concat(l.isActive("italic")?"active":""),onClick:()=>l.chain().focus().toggleItalic().run(),children:(0,a.jsx)("em",{children:"I"})}),(0,a.jsx)("button",{type:"button",className:"wb-tb-btn ".concat(l.isActive("heading",{level:2})?"active":""),onClick:()=>l.chain().focus().toggleHeading({level:2}).run(),children:"H2"}),(0,a.jsx)("button",{type:"button",className:"wb-tb-btn ".concat(l.isActive("heading",{level:3})?"active":""),onClick:()=>l.chain().focus().toggleHeading({level:3}).run(),children:"H3"}),(0,a.jsx)("button",{type:"button",className:"wb-tb-btn ".concat(l.isActive("bulletList")?"active":""),onClick:()=>l.chain().focus().toggleBulletList().run(),children:"⢠List"}),(0,a.jsx)("button",{type:"button",className:"wb-tb-btn ".concat(l.isActive("orderedList")?"active":""),onClick:()=>l.chain().focus().toggleOrderedList().run(),children:"1. List"}),(0,a.jsx)("button",{type:"button",className:"wb-tb-btn ".concat(l.isActive("blockquote")?"active":""),onClick:()=>l.chain().focus().toggleBlockquote().run(),children:"â"}),(0,a.jsx)("button",{type:"button",className:"wb-tb-btn ".concat(l.isActive("code")?"active":""),onClick:()=>l.chain().focus().toggleCode().run(),children:"<>"}),(0,a.jsx)("button",{type:"button",className:"wb-tb-btn",onClick:()=>{let e=window.prompt("URL");e&&l.chain().focus().setLink({href:e}).run()},children:(0,a.jsx)(n.A,{size:13})}
1),i&&(0,a.jsx)("button",{type:"button",className:"wb-tb-btn",title:"Insert image from media library",onClick:()=>i(""),children:(0,a.jsx)(r.A,{size:13})})]}),(0,a.jsx)(et.$Z,{editor:l,className:"wb-editor-content"})]}):null},ed=e=>{var s,t;let{site:l}=e,[n,r]=(0,i.useState)(null),[c,p]=(0,i.useState)(l.custom_domain||""),[h,u]=(0,i.useState)(!0),[m,x]=(0,i.useState)(!1);(0,i.useEffect)(()=>{V.supabase.from("wb_site_settings").select("*").eq("site_id",l.id).single().then(e=>{let{data:s}=e;r(s||{site_id:l.id,timezone:"America/Chicago",posts_per_page:10,homepage_type:"latest_posts",allow_subscriptions:!0,comment_moderation:!0}),u(!1)})},[l.id]);let b=async()=>{await V.supabase.from("wb_site_settings").upsert({...n,site_id:l.id},{onConflict:"site_id"}),c!==l.custom_domain&&(await V.supabase.from("wb_sites").update({custom_domain:c||null}).eq("id",l.id),l.custom_domain=c),x(!0),setTimeout(()=>x(!1),2500)};return h?(0,a.jsx)("div",{className:"wb-loading",children:(0,a.jsx)(o.A,{size:24,className:"wb-spinner"})}):(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"wb-content-header",style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,a.jsx)("h1",{children:"General Settings"}),(0,a.jsx)("button",{className:"wb-btn-primary",onClick:b,children:m?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.A,{size:16})," Saved!"]}):"Save Settings"})]}),(0,a.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(340px, 1fr))",gap:24},children:[(0,a.jsxs)("div",{className:"wb-widget",children:[(0,a.jsx)("h2",{className:"wb-widget-title",children:"Site Identity"}),(0,a.jsxs)("div",{className:"wb-widget-content",style:{padding:"16px 20px 20px"},children:[(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Tagline"}),(0,a.jsx)("input",{type:"text",className:"wb-input",value:(null==n?void 0:n.tagline)||"",placeholder:"Just another SETX 360 site",onChange:e=>r({...n,tagline:e.target.value})})]}),(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Public URL"}),(0,a.jsx)("input",{type:"text",className:"wb-input",value:"".concat(l.subdomain,".setx360.com"),readOnly:!0,style:{background:"#f6f7f7",color:"#646970"}})]}),(0,a.jsxs)("div",{className:"wb-form-group",style:{marginBottom:0},children:[(0,a.jsx)("label",{children:"Custom Domain"}),(0,a.jsx)("input",{type:"text",className:"wb-input",placeholder:"e.g. mystore.com",value:c,onChange:e=>p(e.target.value)}),(0,a.jsxs)("p",{style:{fontSize:12,color:"#646970",marginTop:4},children:["Configure your domain's CNAME to point to ",(0,a.jsx)("strong",{children:"cname.vercel-dns.com"}),"."]})]})]})]}),(0,a.jsxs)("div",{className:"wb-widget",children:[(0,a.jsx)("h2",{className:"wb-widget-title",children:"Reading"}),(0,a.jsxs)("div",{className:"wb-widget-content",style:{padding:"16px 20px 20px"},children:[(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Homepage displays"}),(0,a.jsxs)("select",{className:"wb-select",value:(null==n?void 0:n.homepage_type)||"latest_posts",onChange:e=>r({...n,homepage_type:e.target.value}),children:[(0,a.jsx)("option",{value:"latest_posts",children:"Your latest posts"}),(0,a.jsx)("option",{value:"static_page",children:"A static page"})]})]}),(0,a.jsxs)("div",{className:"wb-form-group",style:{marginBottom:0},children:[(0,a.jsx)("label",{children:"Posts per page"}),(0,a.jsx)("input",{type:"number",className:"wb-input",value:(null==n?void 0:n.posts_per_page)||10,min:1,max:100,onChange:e=>r({...n,posts_per_page:Number(e.target.value)})})]})]})]}),(0,a.jsxs)("div",{className:"wb-widget",children:[(0,a.jsx)("h2",{className:"wb-widget-title",children:"Discussion"}),(0,a.jsxs)("div",{className:"wb-widget-content",style:{padding:"16px 20px 20px"},children:[(0,a.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer",marginBottom:16},children:[(0,a.jsx)("input",{type:"checkbox",checked:null==(s=null==n?void 0:n.comment_moderation)||s,onChange:e=>r({...n,comment_moderation:e.target.checked}),style:{width:16,height:16}}),(0,a.jsx)("span",{children:"Hold comments for moderation before publishing"})]}),(0,a.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer"},children:[(0,a.jsx)("input",{type:"checkbox",checked:null==(t=null==n?void 0:n.allow_subscriptions)||t,onCh
1ange:e=>r({...n,allow_subscriptions:e.target.checked}),style:{width:16,height:16}}),(0,a.jsx)("span",{children:"Allow visitors to subscribe via SETX 360"})]})]})]}),(0,a.jsxs)("div",{className:"wb-widget",children:[(0,a.jsx)("h2",{className:"wb-widget-title",children:"Integrations"}),(0,a.jsx)("div",{className:"wb-widget-content",style:{padding:"16px 20px 20px"},children:(0,a.jsxs)("div",{className:"wb-form-group",style:{marginBottom:0},children:[(0,a.jsx)("label",{children:"Google Analytics ID"}),(0,a.jsx)("input",{type:"text",className:"wb-input",value:(null==n?void 0:n.ga_tracking_id)||"",placeholder:"G-XXXXXXXXXX",onChange:e=>r({...n,ga_tracking_id:e.target.value})})]})})]}),(0,a.jsx)(K.A,{storeId:l.page_id})]})]})},ec=e=>{let{siteId:s,onUpdate:t}=e,[l,n]=(0,i.useState)({}),[r,d]=(0,i.useState)(!0);(0,i.useEffect)(()=>{V.supabase.from("wb_site_settings").select("plugins_config").eq("site_id",s).single().then(e=>{let{data:s}=e;n((null==s?void 0:s.plugins_config)||{}),d(!1)})},[s]);let m=async e=>{let a={...l,[e]:!l[e]};n(a),t&&t(a),await V.supabase.from("wb_site_settings").update({plugins_config:a}).eq("site_id",s)};if(r)return(0,a.jsx)("div",{style:{padding:40,textAlign:"center"},children:(0,a.jsx)(o.A,{size:24,className:"wb-spinner"})});let x=[{id:"ecommerce",name:"Store (E-commerce)",description:"Sell products and digital downloads. Enables the Products and Orders tabs.",icon:(0,a.jsx)(c.A,{size:24,color:"#2271b1"})},{id:"stripe",name:"Stripe Payments",description:"Accept credit cards directly on your site securely via Stripe.",icon:(0,a.jsx)(p.A,{size:24,color:"#008cdd"})},{id:"mailchimp",name:"Mailchimp Integration",description:"Sync your form submissions and subscribers automatically to Mailchimp.",icon:(0,a.jsx)(h.A,{size:24,color:"#ffe01b"})},{id:"seo_pro",name:"Advanced SEO Pro",description:"Unlock advanced metadata options, XML sitemaps, and robots.txt generation.",icon:(0,a.jsx)(u.A,{size:24,color:"#10b981"})}];return(0,a.jsxs)("div",{className:"wb-fade-in",children:[(0,a.jsx)("div",{className:"wb-content-header",children:(0,a.jsx)("h1",{children:"Integrations & Features"})}),(0,a.jsxs)("div",{style:{maxWidth:800},children:[(0,a.jsx)("p",{style:{color:"#646970",marginBottom:24},children:"Enable or disable built-in features and third-party integrations for your site."}),(0,a.jsx)("div",{style:{display:"grid",gap:16},children:x.map(e=>(0,a.jsxs)("div",{className:"wb-widget",style:{padding:20,display:"flex",alignItems:"center",gap:20},children:[(0,a.jsx)("div",{style:{width:48,height:48,borderRadius:8,background:"#f0f0f1",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.icon}),(0,a.jsxs)("div",{style:{flex:1},children:[(0,a.jsx)("h3",{style:{fontSize:15,marginBottom:4},children:e.name}),(0,a.jsx)("p",{style:{fontSize:13,color:"#646970",margin:0},children:e.description})]}),(0,a.jsx)("div",{children:(0,a.jsxs)("label",{className:"wb-toggle-switch",style:{display:"inline-flex",alignItems:"center",cursor:"pointer"},children:[(0,a.jsx)("input",{type:"checkbox",checked:!!l[e.id],onChange:()=>m(e.id),style:{display:"none"}}),(0,a.jsx)("div",{style:{width:40,height:24,background:l[e.id]?"#2271b1":"#c3c4c7",borderRadius:12,position:"relative",transition:"background 0.2s"},children:(0,a.jsx)("div",{style:{width:20,height:20,background:"#fff",borderRadius:"50%",position:"absolute",top:2,left:l[e.id]?18:2,transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,0.2)"}})})]})})]},e.id))})]})]})},ep=e=>{let{siteId:s,subdomain:t}=e,[l,n]=(0,i.useState)([]),[r,d]=(0,i.useState)(!0),[c,p]=(0,i.useState)(""),[h,j]=(0,i.useState)(""),[y,f]=(0,i.useState)(!1),w=(0,i.useCallback)(async()=>{d(!0);let{data:e}=await V.supabase.from("wb_menu_items").select("*").eq("site_id",s).is("parent_id",null).order("sort_order");n(e||[]),d(!1)},[s]);(0,i.useEffect)(()=>{w()},[w]);let v=async()=>{if(!c||!h)return;f(!0);let e=l.length>0?Math.max(...l.map(e=>e.sort_order))+1:0;await V.supabase.from("wb_menu_items").insert({site_id:s,label:c,url:h,sort_order:e}),p(""),j(""),await w(),f(!1)},N=async e=>{await V.supabase.from("wb_menu_items").delete().eq("id",e),n(s=>s.filter(s=>s.id!==e))},k=async(e,s)=>{let t=l.findIndex(s=>s.id===e);if("up"===s&&0===t||"down"===s&&t===l.length-1)return;let a="up"===s?t-1:t+1,i=[...l];[i[t],i[a]]=[i[a],i[t]];let r=i.map((e,s)=>V.supabase.from("wb_menu_items").update({sort_order:s}).eq("id",e.id));await Promise.all(r),n(i.map((e,s)=>({...e,sort_order:s})))},C=async(e,s,t)=>{n(a=>a.map(a=>a.id===e?{...a,[s]:t}:a))},_=async e=>{await V.supabase.from("wb_menu_items").update({label:e.label,url:e.url}).eq("id",e.id)};return r?(0,a.jsx)("div",{className:"wb-loading",children:(0,a.jsx)(o.A,{size:24,className:"wb-spinner"})}):(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"wb-content-header",children:(0,a.jsx)("h1",{children:"Navigation Menu"})}),(0,a.jsxs)("div",{className:"wb-info-box",style:{marginBottom:24},children:[(0,a.jsx)(u.A,{size:16}),"This menu appears in the navigation bar on your public site at ",(0,a.jsxs)("strong",{children:[t,".setx360.com"]})]}),(0,a.jsxs)("div",{className:"wb-widget",style:{maxWidth:680,marginBottom:24},children:[(0,a.jsx)("h2",{className:"wb-widget-title",children:"Menu Items"}),(0,a.jsxs)("div",{className:"wb-widget-content",style:{padding:"12px 16px"},children:[0===l.length&&(0,a.jsx)("p",{style:{color:"#646970",textAlign:"center",padding:"20px 0"},children:"No menu items yet. Add your first link below."}),l.map((e,s)=>(0,a.jsxs)("div",{className:"wb-menu-row",children:[(0,a.jsxs)("div",{className:"wb-menu-handle",children:[(0,a.jsx)("button",{className:"wb-icon-btn",disabled:0===s,onClick:()=>k(e.id,"up"),children:(0,a.jsx)(m.A,{size:16})}),(0,a.jsx)("button",{className:"wb-icon-btn",disabled:s===l.length-1,onClick:()=>k(e.id,"down"),children:(0,a.jsx)(x.A,{size:16})})]}),(0,a.jsx)("input",{className:"wb-input wb-menu-label-input",value:e.label,onChange:s=>C(e.id,"label",s.target.value),onBlur:()=>_(e),placeholder:"Label"}),(0,a.jsx)("input",{className:"wb-input wb-menu-url-input",value:e.url,onChange:s=>C(e.id,"url",s.target.value),onBlur:()=>_(e),placeholder:"URL or /path"}),(0,a.jsx)("button",{className:"wb-icon-btn danger",onClick:()=>N(e.id),children:(0,a.jsx)(b.A,{size:15})})]},e.id))]})]}),(0,a.jsxs)("div",{className:"wb-widget",style:{maxWidth:680},children:[(0,a.jsx)("h2",{className:"wb-widget-title",children:"Add New Item"}),(0,a.jsxs)("div",{className:"wb-widget-content",style:{padding:"16px 20px 20px",display:"flex",gap:12,flexWrap:"wrap",alignItems:"flex-end"},children:[(0,a.jsxs)("div",{className:"wb-form-group",style:{flex:1,minWidth:160,marginBottom:0},children:[(0,a.jsx)("label",{children:"Label"}),(0,a.jsx)("input",{type:"text",className:"wb-input",value:c,onChange:e=>p(e.target.value),placeholder:"e.g. About",onKeyDown:e=>"Enter"===e.key&&v()})]}),(0,a.jsxs)("div",{className:"wb-form-group",style:{flex:2,minWidth:200,marginBottom:0},children:[(0,a.jsx)("label",{children:"URL"}),(0,a.jsx)("input",{type:"text",className:"wb-input",value:h,onChange:e=>j(e.target.value),placeholder:"e.g. /page/about or https://...",onKeyDown:e=>"Enter"===e.key&&v()})]}),(0,a.jsxs)("button",{className:"wb-btn-primary",onClick:v,disabled:!c||!h||y,children:[y?(0,a.jsx)(o.A,{size:15,className:"wb-spinner"}):(0,a.jsx)(g.A,{size:15})," Add Item"]})]})]})]})},eh=e=>{let{siteId:s}=e,[t,l]=(0,i.useState)([]),[n,r]=(0,i.useState)(!0),[c,p]=(0,i.useState)("pending"),h=(0,i.useCallback)(async()=>{r(!0);let{data:e}=await V.supabase.from("wb_comments").select("*, wb_posts(title)").eq("site_id",s).eq("status",c).order("created_at",{ascending:!1});l(e||[]),r(!1)},[s,c]);(0,i.useEffect)(()=>{h()}
1,[h]);let u=async(e,s)=>{await V.supabase.from("wb_comments").update({status:s}).eq("id",e),l(s=>s.filter(s=>s.id!==e))},m=async e=>{await V.supabase.from("wb_comments").delete().eq("id",e),l(s=>s.filter(s=>s.id!==e))};return(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"wb-content-header",children:(0,a.jsx)("h1",{children:"Comments"})}),(0,a.jsxs)("div",{style:{display:"flex",gap:4,marginBottom:20},children:[["pending","approved","spam"].map(e=>(0,a.jsx)("button",{className:c===e?"wb-btn-primary":"wb-btn-secondary",style:{textTransform:"capitalize",padding:"6px 16px"},onClick:()=>p(e),children:e},e)),(0,a.jsx)("button",{className:"wb-icon-btn",onClick:h,title:"Refresh",style:{marginLeft:"auto"},children:(0,a.jsx)(j.A,{size:16})})]}),n?(0,a.jsx)("div",{className:"wb-loading",children:(0,a.jsx)(o.A,{size:24,className:"wb-spinner"})}):0===t.length?(0,a.jsxs)("div",{className:"wb-empty-state",style:{height:300},children:[(0,a.jsx)(y.A,{size:40,color:"#c3c4c7"}),(0,a.jsxs)("p",{children:["No ",c," comments."]})]}):(0,a.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:12},children:t.map(e=>{var s;return(0,a.jsxs)("div",{className:"wb-comment-card",children:[(0,a.jsxs)("div",{className:"wb-comment-meta",children:[(0,a.jsx)("strong",{children:e.author_name||"Anonymous"}),(0,a.jsxs)("span",{style:{color:"#646970",fontSize:12},children:["on ",(0,a.jsx)("em",{children:null==(s=e.wb_posts)?void 0:s.title})]}),(0,a.jsx)("span",{style:{color:"#aaa",fontSize:12,marginLeft:"auto"},children:new Date(e.created_at).toLocaleString()})]}),(0,a.jsx)("p",{className:"wb-comment-body",children:e.content}),(0,a.jsxs)("div",{className:"wb-comment-actions",children:["approved"!==c&&(0,a.jsxs)("button",{className:"wb-btn-secondary",style:{padding:"4px 12px",fontSize:12},onClick:()=>u(e.id,"approved"),children:[(0,a.jsx)(d.A,{size:13})," Approve"]}),"spam"!==c&&(0,a.jsx)("button",{className:"wb-btn-secondary",style:{padding:"4px 12px",fontSize:12,borderColor:"#f59e0b",color:"#b45309"},onClick:()=>u(e.id,"spam"),children:"Mark as Spam"}),(0,a.jsx)("button",{className:"wb-icon-btn danger",onClick:()=>m(e.id),children:(0,a.jsx)(b.A,{size:14})})]})]},e.id)})})]})},eu=e=>{let{siteId:s,storageBucket:t,onSelect:n,onClose:d}=e,[c,p]=(0,i.useState)([]),[h,u]=(0,i.useState)(!1);(0,i.useEffect)(()=>{V.supabase.from("wb_media").select("*").eq("site_id",s).like("file_type","image/%").order("created_at",{ascending:!1}).then(e=>{let{data:s}=e;return p(s||[])})},[s]);let m=async e=>{var a;if(!t||!(null==(a=e.target.files)?void 0:a[0]))return;u(!0);let i=e.target.files[0],l=i.name.replace(/[^a-zA-Z0-9._-]/g,"_"),{error:n}=await V.supabase.storage.from(t).upload(l,i,{upsert:!0});if(!n){let{data:e}=V.supabase.storage.from(t).getPublicUrl(l);await V.supabase.from("wb_media").insert({site_id:s,file_name:i.name,file_url:e.publicUrl,file_type:i.type,file_size:i.size});let{data:a}=await V.supabase.from("wb_media").select("*").eq("site_id",s).like("file_type","image/%").order("created_at",{ascending:!1});p(a||[])}u(!1)};return(0,a.jsx)("div",{className:"wb-modal-overlay",onClick:d,children:(0,a.jsxs)("div",{className:"wb-modal",style:{maxWidth:640},onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"wb-modal-head",children:[(0,a.jsx)("h2",{children:"Select Image"}),(0,a.jsx)("button",{className:"wb-icon-btn",onClick:d,children:(0,a.jsx)(l.A,{size:20})})]}),(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[(0,a.jsx)("p",{style:{margin:0,color:"#646970",fontSize:13},children:"Click an image to select it, or upload a new one."}),(0,a.jsxs)("label",{className:"wb-btn-secondary",style:{cursor:"pointer",padding:"6px 12px",fontSize:13},children:[h?(0,a.jsx)(o.A,{size:14,className:"wb-spinner"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f.A,{size:14})," Upload"]}),(0,a.jsx)("input",{type:"file",hidden:!0,accept:"image/*",onChange:m})]})]}),(0,a.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(120px, 1fr))",gap:10,maxHeight:380,overflowY:"auto"},children:[c.map(e=>(0,a.jsxs)("div",{onClick:()=>n(e.file_url),style:{cursor:"pointer",borderRadius:6,overflow:"hidden",border:"2px s
1olid transparent",transition:"border-color .15s"},onMouseEnter:e=>e.currentTarget.style.borderColor="#2271b1",onMouseLeave:e=>e.currentTarget.style.borderColor="transparent",children:[(0,a.jsx)("img",{src:e.file_url,alt:e.alt_text||e.file_name,style:{width:"100%",height:90,objectFit:"cover",display:"block"}}),(0,a.jsx)("p",{style:{margin:0,padding:"4px 6px",fontSize:10,color:"#646970",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.file_name})]},e.id)),0===c.length&&!h&&(0,a.jsxs)("div",{style:{gridColumn:"1 / -1",textAlign:"center",padding:40,color:"#aaa"},children:[(0,a.jsx)(r.A,{size:32,style:{opacity:.4}}),(0,a.jsx)("p",{children:"No images yet. Upload one above."})]})]})]})})},em=e=>{var s,t,l;let{siteId:n,wlConfig:o,onUpdateWlConfig:d,storageBucket:c}=e,[p,h]=(0,i.useState)(!1),[u,m]=(0,i.useState)("logo");return(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"wb-content-header",style:{marginBottom:24},children:(0,a.jsx)("h1",{children:"Appearance & Theming"})}),(0,a.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(340px, 1fr))",gap:24},children:[(0,a.jsxs)("div",{className:"wb-widget",children:[(0,a.jsxs)("h2",{className:"wb-widget-title",children:[(0,a.jsx)(w.A,{size:16})," Brand Assets"]}),(0,a.jsxs)("div",{className:"wb-widget-content",style:{padding:"16px 20px 20px"},children:[(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Site Logo"}),(null==o?void 0:o.logoUrl)?(0,a.jsxs)("div",{style:{position:"relative",display:"inline-block",width:"100%",border:"1px solid #dcdcde",borderRadius:6,padding:12,textAlign:"center",background:"#f6f7f7"},children:[(0,a.jsx)("img",{src:o.logoUrl,alt:"Logo",style:{maxHeight:60,maxWidth:"100%",objectFit:"contain"}}),(0,a.jsx)("button",{className:"wb-btn-text",style:{padding:"0",fontSize:12,color:"#d63638",marginTop:12,display:"block",width:"100%"},onClick:()=>d("logoUrl",""),children:"Remove logo"})]}):(0,a.jsxs)("button",{className:"wb-btn-secondary",style:{width:"100%"},onClick:()=>{m("logo"),h(!0)},children:[(0,a.jsx)(r.A,{size:14,style:{marginRight:6}})," Choose Logo"]})]}),(0,a.jsxs)("div",{className:"wb-form-group",style:{marginBottom:0},children:[(0,a.jsx)("label",{children:"Favicon"}),(null==o?void 0:o.faviconUrl)?(0,a.jsxs)("div",{style:{position:"relative",display:"flex",alignItems:"center",gap:12,border:"1px solid #dcdcde",borderRadius:6,padding:"8px 12px",background:"#f6f7f7"},children:[(0,a.jsx)("img",{src:o.faviconUrl,alt:"Favicon",style:{width:32,height:32,objectFit:"contain"}}),(0,a.jsx)("button",{className:"wb-btn-text",style:{padding:"0",fontSize:12,color:"#d63638",marginLeft:"auto"},onClick:()=>d("faviconUrl",""),children:"Remove"})]}):(0,a.jsxs)("button",{className:"wb-btn-secondary",style:{width:"100%"},onClick:()=>{m("favicon"),h(!0)},children:[(0,a.jsx)(r.A,{size:14,style:{marginRight:6}})," Choose Favicon (32x32)"]})]})]})]}),(0,a.jsxs)("div",{className:"wb-widget",children:[(0,a.jsx)("h2",{className:"wb-widget-title",children:"Colors & Typography"}),(0,a.jsxs)("div",{className:"wb-widget-content",style:{padding:"16px 20px 20px"},children:[(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Primary Accent Color"}),(0,a.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[(0,a.jsx)("input",{type:"color",value:(null==o?void 0:o.accentColor)||"#2271b1",onChange:e=>d("accentColor",e.target.value),style:{width:40,height:40,padding:0,border:"1px solid #dcdcde",borderRadius:4,cursor:"pointer"}}),(0,a.jsx)("input",{type:"text",className:"wb-input",value:(null==o?void 0:o.accentColor)||"#2271b1",onChange:e=>d("accentColor",e.target.value),style:{flex:1,marginBottom:0}})]})]}),(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Heading Font"}),(0,a.jsxs)("select",{className:"wb-select",value:(null==o?void 0:o.headingFont)||"Inter",onChange:e=>d("headingFont",e.target.value),children:[(0,a.jsx)("option",{value:"Inter",children:"Inter"}),(0,a.jsx)("option",{value:"Playfair Display",children:"Playfair Display"}),(0,a.jsx)("option",{value:"Merriweather",children:"Merriweather"}),(0,a.jsx)("option",{value:"Lora",children:"Lora"})]})]}),(0,a.jsxs)("div",{className:"wb-form-group",style:{marginBottom:0},children:[(0,a.jsx)("label",{children:"Body Font"}),(0,a.jsxs)("select",{className:"wb-select",value:(null==o?void 0:o.bodyFont)||"Inter",onChange:e=>d("bodyFont",e.target.value),children:[(0,a.jsx)("option",{value:"Inter",children:"Inter"}),(0,a.jsx)("option",{value:"Roboto",children:"Roboto"}),(0,a.jsx)("option",{value:"Open Sans",children:"Open Sans"})]})]})]})]}),(0,a.jsxs)("div",{className:"wb-widget",children:[(0,a.jsx)("h2",{className:"wb-widget-title",children:"Header & Footer Layout"}),(0,a.jsxs)("div",{className:"wb-widget-content",style:{padding:"16px 20px 20px"},children:[(0,a.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer",marginBottom:16},children:[(0,a.jsx)("input",{type:"checkbox",checked:null==(s=null==o?void 0:o.showHeaderSearch)||s,onChange:e=>d("showHeaderSearch",e.target.checked),style:{width:16,height:16}}),(0,a.jsx)("span",{children:"Show Search Bar in Header"})]}),(0,a.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer",marginBottom:16},children:[(0,a.jsx)("input",{type:"checkbox",checked:null==(t=null==o?void 0:o.showFooterSocial)||t,onCh
1ange:e=>d("showFooterSocial",e.target.checked),style:{width:16,height:16}}),(0,a.jsx)("span",{children:"Show Social Icons in Footer"})]}),(0,a.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer"},children:[(0,a.jsx)("input",{type:"checkbox",checked:null!=(l=null==o?void 0:o.centerLogo)&&l,onChange:e=>d("centerLogo",e.target.checked),style:{width:16,height:16}}),(0,a.jsx)("span",{children:"Center Logo in Navigation"})]})]})]}),(0,a.jsxs)("div",{className:"wb-widget",style:{gridColumn:"1 / -1"},children:[(0,a.jsx)("h2",{className:"wb-widget-title",children:"Custom CSS"}),(0,a.jsx)("div",{className:"wb-widget-content",style:{padding:"16px 20px 20px"},children:(0,a.jsxs)("div",{className:"wb-form-group",style:{marginBottom:0},children:[(0,a.jsx)("label",{children:"Inject Custom Styles (Advanced)"}),(0,a.jsx)("textarea",{className:"wb-input",value:(null==o?void 0:o.customCss)||"",onChange:e=>d("customCss",e.target.value),placeholder:"/* e.g. .site-header { border-bottom: 2px solid red; } */",style:{fontFamily:"monospace",height:120,resize:"vertical"}}),(0,a.jsx)("p",{style:{fontSize:12,color:"#646970",marginTop:8},children:"Write pure CSS to override frontend styles. Do not include <style> tags."})]})})]})]}),p&&(0,a.jsx)(eu,{siteId:n,storageBucket:c,onSelect:e=>{d("logo"===u?"logoUrl":"faviconUrl",e),h(!1)},onClose:()=>h(!1)})]})},ex=[{id:"smokehouse_seafood",name:"Gulf Coast Smokehouse & Seafood",industry:"Restaurant & Dining",description:"Hero with slow-smoked meats, Gulf red snapper, signature sides feature grid, hours & reservation intake form.",badge:"Restaurant",badgeBg:"#fef3c7",badgeColor:"#b45309",blocks:[{id:"hero-smokehouse",type:"hero",data:{headline:"Taste the Heritage of Southeast Texas Smoke & Gulf Catch",subheadline:"Slow-smoked Texas brisket, Gulf-fresh snapper, and Southern hospitality in the heart of Jefferson County.",btnText:"View Today's Specials",btnLink:"#menu"}},{id:"features-smokehouse",type:"feature_grid",data:{title:"Signature Specialties",features:"Prime Texas Smoked Brisket (14-Hour Oak Pit), Gulf Coast Shrimp & Crab Boil, Cajun Fried Catfish Basket, House-Made Pecan Pie & Peach Cobbler"}},{id:"rich-smokehouse",type:"rich_text",data:{content:"<h3>Family Owned & Operated Since 1994</h3><p>We source 100% wild-caught Gulf seafood directly from local Sabine Pass and Galveston Bay docks. Pit-master wood selections feature aged post oak and hickory for authentic Texas flavor.</p><p><strong>Operating Hours:</strong> Tuesday - Sunday: 11:00 AM - 9:30 PM (Closed Mondays)</p>"}},{id:"form-smokehouse",type:"form",data:{title:"Catering Inquiries & Table Reservations",emailTo:"[email protected]"}}]}
1,{id:"boutique_retail",name:"Southeast Texas Artisan Boutique",industry:"Retail & Local Crafts",description:"Curated apparel, regional leather goods, handmade home decor, seasonal lookbook, and custom gift inquiries.",badge:"Boutique Retail",badgeBg:"#e0e7ff",badgeColor:"#4338ca",blocks:[{id:"hero-boutique",type:"hero",data:{headline:"Handcrafted Goods & Timeless Southern Style",subheadline:"Curated Texas apparel, handcrafted leather goods, and artisan gifts made right here in Southeast Texas.",btnText:"Shop New Arrivals",btnLink:"#catalog"}},{id:"features-boutique",type:"feature_grid",data:{title:"Curated Collections",features:"Texas Heritage Leather Goods, Locally Screenprinted Apparel, Hand-Poured Soy Wax Candles, Regional Gulf Art Prints"}},{id:"rich-boutique",type:"rich_text",data:{content:"<h3>Supporting Local Makers & Artisans</h3><p>Every purchase directly sustains independent craftsmen and designers across Beaumont, Port Arthur, Nederland, and Orange County. Enjoy complimentary gift packaging and store pickup on all orders.</p>"}},{id:"form-boutique",type:"form",data:{title:"Custom Orders & Wholesale Inquiries",emailTo:"[email protected]"}}]},{id:"contractor_trades",name:"Golden Triangle Contractors & Trades",industry:"HVAC, Roofing & Trades",description:"Licensed & insured trust header, emergency storm response, service specialties, and digital free quote estimate form.",badge:"Trades & Services",badgeBg:"#dcfce7",badgeColor:"#15803d",blocks:[{id:"hero-trades",type:"hero",data:{headline:"Licensed & Insured Southeast Texas Commercial & Residential Trades",subheadline:"24/7 Emergency AC repair, standing-seam storm roofing, and certified electrical services across Jefferson County.",btnText:"Request Free Estimate",btnLink:"#quote"}},{id:"features-trades",type:"feature_grid",data:{title:"Core Trade Services",features:"High-Efficiency HVAC Installation & 24/7 Repair, Hurricane Wind-Rated Metal & Shingle Roofing, Commercial Generator Backup Systems, Trenchless Plumbing & Drain Diagnostics"}},{id:"rich-trades",type:"rich_text",data:{content:"<h3>Texas Master Certified ⢠Zero Hidden Fees</h3><p>Texas License #TACLA104928E. Fully bonded and insured with over 28 years serving the Golden Triangle community. We back every project with our 10-year craftmanship guarantee.</p>"}},{id:"form-trades",type:"form",data:{title:"Instant Service Dispatch & Free Quote Request",emailTo:"[email protected]"}}]},{id:"legal_accounting",name:"Piney Woods Law & Financial Advisory",industry:"Legal, CPA & Advisory",description:"Authoritative attorney and CPA header, commercial litigation, estate planning, and confidential consultation form.",badge:"Professional Services",badgeBg:"#fae8ff",badgeColor:"#86198f",blocks:[{id:"hero-law",type:"hero",data:{headline:"Trusted Legal Counsel & CPA Solutions for Texas Businesses",subheadline:"Protecting your assets, navigating corporate compliance, and maximizing wealth preservation across Southeast Texas.",btnText:"Schedule Confidential Review",btnLink:"#consultation"}},{id:"features-law",type:"feature_grid",data:{title:"Practice & Advisory Areas",features:"Texas Commercial Business Litigation, Estate Planning & Asset Trust Formation, Corporate Tax Defense & Auditing, Real Estate Title & Land Acquisition"}},{id:"rich-law",type:"rich_text",data:{content:"<h3>Decades of Steadfast Advocacy in Jefferson & Orange Counties</h3><p>Our partners bring premier legal and fiduciary acumen to family businesses, agricultural estates, and industrial enterprises throughout the Texas Gulf Coast.</p>"}},{id:"form-law",type:"form",data:{title:"Schedule a Confidential Attorney Consultation",emailTo:"[email protected]"}}]},{id:"auto_detailing",name:"Bayou State Auto Detailing & ASE Repair",industry:"Automotive & Fleet",description:"Ceramic paint protection, certified mechanic diagnostics, transparent fleet pricing, and appointment scheduler.",badge:"Automotive",badgeBg:"#fee2e2",badgeColor:"#991b1b",blocks:[{id:"hero-auto",type:"hero",data:{headline:"Premier Automotive Paint Correction & ASE Certified Care",subheadline:"Multi-stage paint restoration, 5-year ceramic coatings, and dealer-level computer diagnostics in Beaumont, TX.",btnText:"Book Service Slot",btnLink:"#book"}},{id:"features-auto",type:"feature_grid",data:{title:"Service Capabilities",features:"Graphene & Ceramic Coating Application, Multi-Stage Swirl Removal Paint Correction, Complete ASE Computer Diagnostics, Commercial Fleet Maintenance Agreements"}},{id:"rich-auto",type:"rich_text",data:{content:"<h3>State-of-the-Art Dust-Free Detailing Bay</h3><p>We use climate-controlled infrared curing bays to bond ceramic coatings permanently. Certified Master ASE Technicians on staff for all mechanical diagnostics.</p>"}},{id:"form-auto",type:"form",data:{title:"Schedule Auto Detail or Diagnostic Service",emailTo:"[email protected]"}}]},{id:"medical_wellness",name:"Jefferson County Family Health & Wellness",industry:"Healthcare & Wellness",description:"Compassionate medical care, preventative screening, pediatric to geriatric care, and patient intake booking.",badge:"Healthcare",badgeBg:"#cffafe",badgeColor:"#155e75",blocks:[{id:"hero-med",type:"hero",data:{headline:"Compassionate Comprehensive Healthcare for the Golden Triangle",subheadline:"Same-day sick appointments, chronic disease management, and preventative wellness for the whole family.",btnText:"New Patient Intake",btnLink:"#intake"}},{id:"features-med",type:"feature_grid",data:{title:"Clinical Services",features:"Family Primary Care & Wellness Checks, On-Site Laboratory & Rapid Diagnostics, Physical Therapy & Sports Rehabilitation, Preventative Cardiac & Metabolic Screenings"}},{id:"rich-med",type:"rich_text",data:{content:"<h3>Board-Certified Family Physicians ⢠Bilingual Staff</h3><p>Accepting all major Texas insurance plans, Medicare, and Medicaid. Walk-ins welcome for urgent minor illness and injury care.</p>"}},{id:"form-med",type:"form",data:{title:"New Patient Appointment Request",emailTo:"[email protected]"}}]}],eb=e=>{let{blocks:s,onChange:t}=e,[n,r]=(0,i.useState)([s]),[o,d]=(0,i.useState)(0),[c,p]=(0,i.useState)(!1),h=e=>{let s=n.slice(0,o+1);s.push(e),r(s),d(s.length-1),t(e)},u=()=>{if(o>0){let e=o-1;d(e),t(n[e])}},j=()=>
1{if(o<n.length-1){let e=o+1;d(e),t(n[e])}};(0,i.useEffect)(()=>{let e=e=>{let s=e.target,t=s&&("INPUT"===s.tagName||"TEXTAREA"===s.tagName||s.isContentEditable);(e.metaKey||e.ctrlKey)&&"z"===e.key.toLowerCase()?t||(e.shiftKey?(e.preventDefault(),j()):(e.preventDefault(),u())):(e.metaKey||e.ctrlKey)&&"y"===e.key.toLowerCase()&&!t&&(e.preventDefault(),j())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[o,n]);let y=e=>{h([...s,{id:crypto.randomUUID(),type:e,data:{}}])},f=(e,t)=>{h(s.map(s=>s.id===e?{...s,data:{...s.data,...t}}:s))},w=(e,t)=>{let a=[...s];"up"===t&&e>0?[a[e-1],a[e]]=[a[e],a[e-1]]:"down"===t&&e<s.length-1&&([a[e],a[e+1]]=[a[e+1],a[e]]),h(a)};return(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",background:"#f8fafc",padding:"10px 14px",borderRadius:8,border:"1px solid #e2e8f0"},children:[(0,a.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[(0,a.jsxs)("button",{type:"button",className:"wb-icon-btn",onClick:u,disabled:0===o,title:"Undo (Ctrl+Z / Cmd+Z)",style:{padding:"6px 10px",display:"flex",alignItems:"center",gap:4,fontSize:"0.78rem",background:"#fff",border:"1px solid #cbd5e1",borderRadius:6},children:[(0,a.jsx)(v.A,{size:14})," Undo ",(0,a.jsx)("span",{style:{opacity:.5,fontSize:"0.68rem"},children:"Ctrl+Z"})]}),(0,a.jsxs)("button",{type:"button",className:"wb-icon-btn",onClick:j,disabled:o>=n.length-1,title:"Redo (Ctrl+Y / Cmd+Shift+Z)",style:{padding:"6px 10px",display:"flex",alignItems:"center",gap:4,fontSize:"0.78rem",background:"#fff",border:"1px solid #cbd5e1",borderRadius:6},children:[(0,a.jsx)(N.A,{size:14})," Redo ",(0,a.jsx)("span",{style:{opacity:.5,fontSize:"0.68rem"},children:"Ctrl+Y"})]})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>p(!0),style:{background:"linear-gradient(135deg, #0284c7, #2563eb)",color:"#fff",border:"none",borderRadius:8,padding:"6px 14px",fontSize:"0.82rem",fontWeight:700,display:"flex",alignItems:"center",gap:6,cursor:"pointer"},children:[(0,a.jsx)(k.A,{size:14})," Industry Templates"]})]}),s.map((e,t)=>(0,a.jsxs)("div",{className:"wb-widget",style:{padding:16,borderLeft:"4px solid #2271b1"},children:[(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:12},children:[(0,a.jsx)("span",{style:{fontWeight:600,textTransform:"uppercase",fontSize:12,color:"#2271b1"},children:e.type.replace("_"," ")}),(0,a.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,a.jsx)("button",{className:"wb-icon-btn",onClick:()=>w(t,"up"),disabled:0===t,children:(0,a.jsx)(m.A,{size:16})}),(0,a.jsx)("button",{className:"wb-icon-btn",onClick:()=>w(t,"down"),disabled:t===s.length-1,children:(0,a.jsx)(x.A,{size:16})}),(0,a.jsx)("button",{className:"wb-icon-btn",onClick:()=>{var t;return t=e.id,void h(s.filter(e=>e.id!==t))},style:{color:"#d63638"},children:(0,a.jsx)(b.A,{size:16})})]})]}),"hero"===e.type&&(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(0,a.jsx)("input",{className:"wb-input",placeholder:"Headline",value:e.data.headline||"",onChange:s=>f(e.id,{headline:s.target.value})}),(0,a.jsx)("textarea",{className:"wb-textarea",placeholder:"Subheadline",value:e.data.subheadline||"",onChange:s=>f(e.id,{subheadline:s.target.value})}),(0,a.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,a.jsx)("input",{className:"wb-input",placeholder:"Button Text",value:e.data.btnText||"",onChange:s=>f(e.id,{btnText:s.target.value}),style:{flex:1}}),(0,a.jsx)("input",{className:"wb-input",placeholder:"Button Link",value:e.data.btnLink||"",onChange:s=>f(e.id,{btnLink:s.target.value}),style:{flex:1}})]})]}),"feature_grid"===e.type&&(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(0,a.jsx)("input",{className:"wb-input",placeholder:"Section Title",value:e.data.title||"",onChange:s=>f(e.id,{title:s.target.value})}),(0,a.jsx)("p",{style:{fontSize:12,color:"#646970",margin:0},children:"Features (comma separated)"}),(0,a.jsx)("textarea",{className:"wb-textarea",placeholder:"Feature 1, Feature 2...",value:e.data.features||"",onChange:s=>
1f(e.id,{features:s.target.value})})]}),"rich_text"===e.type&&(0,a.jsx)(eo,{content:e.data.content||"",onChange:s=>f(e.id,{content:s})}),"form"===e.type&&(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(0,a.jsx)("input",{className:"wb-input",placeholder:"Form Title (e.g. Contact Us)",value:e.data.title||"",onChange:s=>f(e.id,{title:s.target.value})}),(0,a.jsx)("input",{className:"wb-input",placeholder:"Recipient Email (where submissions are sent)",value:e.data.emailTo||"",onChange:s=>f(e.id,{emailTo:s.target.value})})]}),"video"===e.type&&(0,a.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:(0,a.jsx)("input",{className:"wb-input",placeholder:"Video URL (YouTube or Vimeo)",value:e.data.url||"",onChange:s=>f(e.id,{url:s.target.value})})})]},e.id)),0===s.length&&(0,a.jsx)("div",{style:{padding:32,textAlign:"center",border:"1px dashed #dcdcde",borderRadius:6,color:"#646970"},children:"No blocks yet. Add a block or choose an industry template to start building your page."}),(0,a.jsxs)("div",{style:{display:"flex",gap:8,marginTop:8},children:[(0,a.jsxs)("button",{className:"wb-btn-secondary",onClick:()=>y("hero"),children:[(0,a.jsx)(g.A,{size:14})," Add Hero"]}),(0,a.jsxs)("button",{className:"wb-btn-secondary",onClick:()=>y("feature_grid"),children:[(0,a.jsx)(g.A,{size:14})," Add Feature Grid"]}),(0,a.jsxs)("button",{className:"wb-btn-secondary",onClick:()=>y("rich_text"),children:[(0,a.jsx)(g.A,{size:14})," Add Rich Text"]}),(0,a.jsxs)("button",{className:"wb-btn-secondary",onClick:()=>y("form"),children:[(0,a.jsx)(g.A,{size:14})," Add Form"]}),(0,a.jsxs)("button",{className:"wb-btn-secondary",onClick:()=>y("video"),children:[(0,a.jsx)(g.A,{size:14})," Add Video"]})]}),c&&(0,a.jsx)("div",{style:{position:"fixed",inset:0,background:"rgba(15, 23, 42, 0.75)",backdropFilter:"blur(6px)",zIndex:99999,display:"flex",alignItems:"center",justifyContent:"center",padding:20},children:(0,a.jsxs)("div",{style:{background:"#fff",borderRadius:16,width:"100%",maxWidth:840,maxHeight:"90vh",overflowY:"auto",padding:24,boxShadow:"0 25px 50px -12px rgba(0,0,0,0.25)",border:"1px solid #e2e8f0"},children:[(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:20},children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[(0,a.jsx)(C.A,{size:20,color:"#0284c7"}),(0,a.jsx)("h3",{style:{margin:0,fontSize:"1.25rem",fontWeight:800,color:"#0f172a"},children:"Pre-designed Southeast Texas Industry Templates"})]}),(0,a.jsx)("p",{style:{margin:0,fontSize:"0.85rem",color:"#64748b"},children:"Select a tailored layout architecture to populate this page with authentic local copy, blocks, and forms."})]}),(0,a.jsx)("button",{type:"button",onClick:()=>p(!1),style:{background:"#f1f5f9",border:"none",borderRadius:8,width:34,height:34,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",color:"#64748b"},children:(0,a.jsx)(l.A,{size:18})})]}),(0,a.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(250px, 1fr))",gap:16},children:ex.map(e=>(0,a.jsxs)("div",{style:{border:"1px solid #e2e8f0",borderRadius:12,padding:16,background:"#f8fafc",display:"flex",flexDirection:"column",justifyContent:"space-between",cursor:"pointer",transition:"all 0.2s ease"},onMouseEnter:e=>{e.currentTarget.style.borderColor="#0284c7",e.currentTarget.style.background="#f0f9ff"},onMouseLeave:e=>{e.currentTarget.style.borderColor="#e2e8f0",e.currentTarget.style.background="#f8fafc"},onClick:()=>{h(JSON.parse(JSON.stringify(e.blocks))),p(!1)},children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[(0,a.jsx)("span",{style:{fontSize:"0.7rem",fontWeight:700,textTransform:"uppercase",color:"#64748b"},children:e.industry}),(0,a.jsx)("span",{style:{fontSize:"0.68rem",fontWeight:800,padding:"2px 8px",borderRadius:6,background:e.badgeBg,color:e.badgeColor},children:e.badge})]}),(0,a.jsx)("h4",{style:{margin:"0 0 6px",fontSize:"1rem",fontWeight:700,color:"#0f172a"},children:e.name}),(0,a.jsx)("p",{style:{margin:"0 0 14px",fontSize:"0.8rem",color:"#64748b",lineHeight:1.4},children:e.description}),(0,a.jsxs)("div",{style:{fontSize:"0.72rem",color:"#0284c7",fontWeight:600,marginBottom:12},children:[e.blocks.length," blocks included (Hero, Features, Rich Story, Intake)"]})]}),(0,a.jsx)("button",{type:"button",style:{width:"100%",padding:"8px 12px",background:"#0284c7",color:"#fff",border:"none",borderRadius:8,fontWeight:700,fontSize:"0.82rem",cursor:"pointer"},children:"Apply Template"})]},e.id))})]})})]})},eg=e=>{var s,t,n;let{user:m}=e,[x,j]=(0,i.useState)("list"),[v,N]=(0,i.useState)(null),[C,S]=(0,i.useState)([]),[K,et]=(0,i.useState)(!0),[ea,ei]=(0,i.useState)(!0),[el,en]=(0,i.useState)("dashboard"),[ex,eg]=(0,i.useState)(!1),[ej,ey]=(0,i.useState)(""),[ef,ew]=(0,i.useState)(""),[ev,eN]=(0,i.useState)(!1),[ek,eC]=(0,i.useState)(""),[e_,eS]=(0,i.useState)("workspace"),[eA,ez]=(0,i.useState)([]),[eT,eB]=(0,i.useState)(null),[eP,eI]=(0,i.useState)(!1),[eL,eR]=(0,i.useState)([]),[eD,eq]=(0,i.useState)([]),[eM,eW]=(0,i.useState)([]),[eF,eE]=(0,i.useState)([]),[eO,eU]=(0,i.useState)([]),[eH,eG]=(0,i.useState)([]),[eV,eX]=(0,i.useState)([]),[eK,eJ]=(0,i.useState)(!1),[e$,eY]=(0,i.useState)(null),[eZ,eQ]=(0,i.useState)(null),[e0,e1]=(0,i.useState)(null),[e2,e4]=(0,i.useState)([]),[e6,e8]=(0,i.useState)(!1),[e3,e7]=(0,i.useState)("featured"),[e5,e9]=(0,i.useState)(!1),[se,ss]=(0,i.useState)([]),[st,sa]=(0,i.useState)({}),[si,sl]=(0,i.useState)({}),sn=(0,i.useRef)(null),[sr,so]=(0,i.useState)("idle"),sd=(0,i.useCallback)(async()=>{et(!0);let{data:e}=await V.supabase.from("wb_sites").select("*").eq("owner_id",m.id).order("created_at",{ascending:!1});S(e||[]),et(!1)},[m.id]);(0,i.useEffect)(()=>{sd()},[sd]),(0,i.useEffect)(()=>{(async()=>
1{if((null==e0?void 0:e0.id)&&"variable"===e0.product_type){let{data:e}=await V.supabase.from("wb_product_variations").select("*").eq("product_id",e0.id).order("created_at",{ascending:!0});e4(e||[])}else e4([])})()},[null==e0?void 0:e0.id,null==e0?void 0:e0.product_type]),(0,i.useEffect)(()=>{v&&"dashboard"===x&&(eJ(!0),(async()=>{if("posts"===el||"dashboard"===el){let{data:e}=await V.supabase.from("wb_posts").select("*").eq("site_id",v.id).order("created_at",{ascending:!1});eR(e||[])}if("pages"===el||"dashboard"===el){let{data:e}=await V.supabase.from("wb_pages").select("*").eq("site_id",v.id).order("sort_order");eq(e||[])}if("media"===el){let{data:e}=await V.supabase.from("wb_media").select("*").eq("site_id",v.id).order("created_at",{ascending:!1});eW(e||[])}if("users"===el){let{data:e}=await V.supabase.from("wb_site_subscribers").select("*, profiles(name, avatar_url)").eq("site_id",v.id).order("subscribed_at",{ascending:!1});eE(e||[])}if("products"===el||"dashboard"===el){let{data:e}=eP?await V.supabase.from("products").select("*").eq("store_id",v.page_id).order("created_at",{ascending:!1}):await V.supabase.from("wb_products").select("*").eq("site_id",v.id).order("created_at",{ascending:!1});eG(e||[])}if("orders"===el||"dashboard"===el){let{data:e}=await V.supabase.from("wb_orders").select("*").eq("site_id",v.id).order("created_at",{ascending:!1});eX(e||[])}if("forms"===el||"dashboard"===el){let{data:e}=await V.supabase.from("wb_form_submissions").select("*").eq("site_id",v.id).order("created_at",{ascending:!1});eU(e||[])}eJ(!1)})())},[el,v,x,eP]);let sc=async e=>{if(N(e),sa(e.white_label_config||{}),j("dashboard"),en("dashboard"),eI(!1),e.page_id){let{data:s}=await V.supabase.from("pages").select("page_type").eq("id",e.page_id).maybeSingle();s&&X.u$.includes(s.page_type)&&eI(!0)}V.supabase.from("wb_site_settings").select("plugins_config").eq("site_id",e.id).single().then(e=>{let{data:s}=e;sl((null==s?void 0:s.plugins_config)||{})}),e.storage_bucket||(await V.supabase.functions.invoke("provision-wb-site",{body:{site_id:e.id,subdomain:e.subdomain,site_name:e.name}}),sd())},sp=async()=>{eS("workspace"),eB(null),ey(""),ew(""),eC(""),eg(!0);let{data:e}=await V.supabase.from("pages").select("id, name, page_type").eq("owner_id",m.id);ez(e||[])},sh=()=>{eg(!1),eS("workspace"),eB(null)},su=async e=>{sh(),await sc(e)},sm=async()=>{if(!ej||!ef||!eT)return;eN(!0),eC("");let e=ef.toLowerCase().replace(/[^a-z0-9-]/g,""),{data:s,error:t}=await V.supabase.from("wb_sites").insert({owner_id:m.id,name:ej,subdomain:e,page_id:eT,white_label_config:{brandName:ej,sidebarBg:"#1e1e1e",sidebarColor:"#ffffff",accentColor:"#2271b1"}}).select().single();if(t){eC(t.message),eN(!1);return}S(e=>[s,...e]),eN(!1),await su(s)},sx=async(e,s)=>{if(!v)return;let t={...st,[e]:s};sa(t),N({...v,white_label_config:t}),await V.supabase.from("wb_sites").update({white_label_config:t}).eq("id",v.id)},sb=(0,i.useCallback)(async e=>{if(!e.id||!v)return;so("saving");let s=e.slug||e.title.toLowerCase().replace(/[^a-z0-9]+/g,"-");await V.supabase.from("wb_posts").update({...e,slug:s}).eq("id",e.id),so("saved"),setTimeout(()=>so("idle"),2e3)},[v]),sg=(0,i.useCallback)(e=>{sn.current&&clearTimeout(sn.current),sn.current=setTimeout(()=>sb(e),3e3)},[sb]),sj=e=>{let s={...e$,...e};eY(s),s.id&&sg(s)},sy=async e=>{if(!v)return;sn.current&&clearTimeout(sn.current);let s=e.slug||e.title.toLowerCase().replace(/[^a-z0-9]+/g,"-"),t="published"!==e.status||e.published_at?e.published_at:new Date().toISOString(),a={...e,site_id:v.id,author_id:m.id,slug:s,published_at:t};e.id?await V.supabase.from("wb_posts").update(a).eq("id",e.id):await V.supabase.from("wb_posts").insert(a),eY(null);let{data:i}=await V.supabase.from("wb_posts").select("*").eq("site_id",v.id).order("created_at",{ascending:!1});eR(i||[])},sf=async e=>{if(!v)return;let s=e.slug||e.title.toLowerCase().replace(/[^a-z0-9]+/g,"-"),t={...e,site_id:v.id,author_id:m.id,slug:s};e.id?await V.supabase.from("wb_pages").update(t).eq("id",e.id):await V.supabase.from("wb_pages").insert(t),eQ(null);let{data:a}=await V.supabase.from("wb_pages").select("*").eq("site_id",v.id).order("sort_order");eq(a||[])},sw=async e=>{if(!v)return;if(eP){let s={store_id:v.page_id,name:e.name||"",description:e.description||"",price:e.price||0,currency:e.currency||"USD",image_urls:e.image_urls||[],stock_status:e.stock_status||"in_stock"};e.id?await V.supabase.from("products").update(s).eq("id",e.id):await V.supabase.from("products").insert(s),e1(null);let{data:t}=await V.supabase.from("products").select("*").eq("store_id",v.page_id).order("created_at",{ascending:!1});eG(t||[]);return}let s=e.slug||e.title.toLowerCase().replace(/[^a-z0-9]+/g,"-"),t={...e,site_id:v.id,slug:s},a=e.id;if(a)await V.supabase.from("wb_products").update(t).eq("id",a);else{let{data:e}=await V.supabase.from("wb_products").insert(t).select().single();e&&(a=e.id)}if(a&&"variable"===e.product_type)for(let e of e2)if(e.id&&!e.id.startsWith("temp-"))await V.supabase.from("wb_product_variations").update({...e,product_id:a}).eq("id",e.id);else{let{id:s,...t}=e;await V.supabase.from("wb_product_variations").insert({...t,product_id:a})}e1(null),e4([]);let{data:i}=await V.supabase.from("wb_products").select("*").eq("site_id",v.id).order("created_at",{ascending:!1});eG(i||[])},sv=async e=>{window.confirm("Delete this post?")&&(await V.supabase.from("wb_posts").delete().eq("id",e),eR(s=>s.filter(s=>s.id!==e)))},sN=async e=>{window.confirm("Delete this page?")&&(await V.supabase.from("wb_pages").delete().eq("id",e),eq(s=>s.filter(s=>s.id!==e)))},sk=async e=>{window.confirm("Delete this product?")&&(await V.supabase.from(eP?"products":"wb_products").delete().eq("id",e),eG(s=>s.filter(s=>s.id!==e)))},sC=async e=>{var s;if(!(null==v?void 0:v.storage_bucket)||!(null==(s=e.target.files)?void 0:s[0]))return;e9(!0);let t=e.target.files[0],a=t.name.replace(/[^a-zA-Z0-9._-]/g,"_"),{data:i,error:l}=await V.supabase.storage.from(v.storage_bucket).upload(a,t,{upsert:!0});if(!l&&i){let{data:e}=V.supabase.storage.from(v.storage_bucket).getPublicUrl(a);await V.supabase.from("wb_media").insert({site_id:v.id,uploader_id:m.id,file_name:t.name,file_url:e.publicUrl,file_type:t.type,file_size:t.size});let{data:s}=await V.supabase.from("wb_media").select("*").eq("site_id",v.id).order("created_at",{ascending:!1});
1eW(s||[]),e9(!1)}},s_=async()=>{if(!v||0===se.length||!confirm("Are you sure you want to delete ".concat(se.length," items?")))return;let e=eM.filter(e=>se.includes(e.id)).map(e=>e.file_url.split("/").pop()).filter(Boolean);e.length>0&&v.storage_bucket&&await V.supabase.storage.from(v.storage_bucket).remove(e),await V.supabase.from("wb_media").delete().in("id",se),eW(eM.filter(e=>!se.includes(e.id))),ss([])},sS=async(e,s)=>{await V.supabase.from("wb_site_subscribers").update({role:s}).eq("id",e),eE(t=>t.map(t=>t.id===e?{...t,role:s}:t))},sA=st.sidebarBg||"#1e1e1e",sz=st.sidebarColor||"#ffffff",sT=st.brandName||(null==v?void 0:v.name)||"SiteBuilder",sB=(null==v?void 0:v.owner_id)===m.id?"admin":(null==(s=eF.find(e=>e.user_id===m.id))?void 0:s.role)||"author",sP=[{id:"dashboard",label:"Dashboard",icon:(0,a.jsx)(_.A,{size:20}),roles:["admin","editor","author"]},{id:"posts",label:"Posts",icon:(0,a.jsx)(A,{size:20}),roles:["admin","editor","author"]},{id:"taxonomy",label:"Categories & Tags",icon:(0,a.jsx)(z.A,{size:20}),roles:["admin","editor","author"]},{id:"pages",label:"Pages",icon:(0,a.jsx)(T.A,{size:20}),roles:["admin","editor"]},{id:"media",label:"Media",icon:(0,a.jsx)(r.A,{size:20}),roles:["admin","editor","author"]},{id:"comments",label:"Comments",icon:(0,a.jsx)(B.A,{size:20}),roles:["admin","editor","author"]},{id:"forms",label:"Forms",icon:(0,a.jsx)(y.A,{size:20}),roles:["admin","editor"]},{id:"products",label:"Products",icon:(0,a.jsx)(P.A,{size:20}),roles:["admin","editor"]},{id:"orders",label:"Orders",icon:(0,a.jsx)(c.A,{size:20}),roles:["admin","editor"]},{id:"menus",label:"Navigation",icon:(0,a.jsx)(I.A,{size:20}),roles:["admin"]},{id:"users",label:"Users",icon:(0,a.jsx)(h.A,{size:20}),roles:["admin"]},{id:"appearance",label:"Appearance",icon:(0,a.jsx)(w.A,{size:20}),roles:["admin"]},{id:"plugins",label:"Integrations",icon:(0,a.jsx)(L,{size:20}),roles:["admin"]},{id:"white_label",label:"White Label",icon:(0,a.jsx)(k.A,{size:20}),roles:["admin"]},{id:"settings",label:"Settings",icon:(0,a.jsx)(R.A,{size:20}),roles:["admin"]}].filter(e=>e.roles.includes(sB));return(si.ecommerce||(sP=sP.filter(e=>"products"!==e.id&&"orders"!==e.id)),"list"===x)?(0,a.jsxs)("div",{className:"wb-list-container",children:[(0,a.jsxs)("header",{className:"wb-list-header",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{children:"My Websites"}),(0,a.jsxs)("p",{children:["Build and manage standalone websites on ",(0,a.jsx)("strong",{children:"*.setx360.com"})]})]}),(0,a.jsxs)("button",{className:"wb-btn-primary",onClick:()=>sp(),children:[(0,a.jsx)(g.A,{size:18})," Create New Website"]})]}),K?(0,a.jsxs)("div",{className:"wb-loading",children:[(0,a.jsx)(o.A,{size:32,className:"wb-spinner"}),(0,a.jsx)("p",{children:"Loading your sites..."})]}):(0,a.jsxs)("div",{className:"wb-sites-grid",children:[C.map(e=>(0,a.jsxs)("div",{className:"wb-site-card",children:[(0,a.jsxs)("div",{className:"wb-site-card-header",children:[(0,a.jsx)("div",{className:"wb-site-icon",children:(0,a.jsx)(u.A,{size:24,color:"#2271b1"})}),(0,a.jsx)("span",{className:"wb-pill ".concat(e.plan),children:e.plan})]}),(0,a.jsxs)("div",{className:"wb-site-info",children:[(0,a.jsx)("h3",{children:e.name}),(0,a.jsx)("p",{children:(0,a.jsxs)("a",{href:"/tenant/".concat(e.subdomain),target:"_blank",rel:"noopener noreferrer",children:[e.subdomain,".setx360.com ",(0,a.jsx)(D.A,{size:12})]})}),e.tagline&&(0,a.jsx)("p",{className:"wb-tagline",children:e.tagline})]}),(0,a.jsx)("div",{className:"wb-site-actions",children:(0,a.jsx)("button",{className:"wb-btn-primary",onClick:()=>sc(e),children:"Manage Dashboard"})})]},e.id)),0===C.length&&(0,a.jsxs)("div",{className:"wb-empty-list",children:[(0,a.jsx)(u.A,{size:48,color:"#c3c4c7"}),(0,a.jsx)("h3",{children:"No websites yet"}),(0,a.jsx)("p",{children:"Create your first site hosted on a free setx360.com subdomain."}),(0,a.jsxs)("button",{className:"wb-btn-primary",onClick:()=>sp(),children:[(0,a.jsx)(g.A,{size:16})," Create New Website"]})]})]}),ex&&(0,a.jsx)("div",{className:"wb-modal-overlay",onClick:sh,children:(0,a.jsxs)("div",{className:"wb-modal",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"wb-modal-head",children:[(0,a.jsx)("h2",{children:"workspace"===e_?"Which workspace is this for?":"Create New Website"}),(0,a.jsx)("button",{className:"wb-icon-btn",onClick:sh,children:(0,a.jsx)(l.A,{size:20})})]}),ek&&(0,a.jsxs)("div",{className:"wb-error-box",children:[(0,a.jsx)(q.A,{size:16}),ek]}),"workspace"===e_&&(eA.length>0?(0,a.jsx)("div",{className:"wb-form-group",children:(0,a.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:eA.map(e=>(0,a.jsxs)("button",{className:"wb-btn-secondary",style:{textAlign:"left",justifyContent:"flex-start"},onClick:()=>{eB(e.id),eS("details")},children:[e.name," ",(0,a.jsxs)("span",{style:{opacity:.6,marginLeft:6,textTransform:"capitalize"},children:["(",e.page_type,")"]})]},e.id))})}):(0,a.jsx)("p",{style:{color:"#646970"},children:'You don\'t have any workspaces yet -- create one first from your Me portal ("Create Worksp
1ace"), then come back here to add a website to it.'})),"details"===e_&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Site Name"}),(0,a.jsx)("input",{type:"text",className:"wb-input",placeholder:"e.g. My Photography Portfolio",value:ej,onChange:e=>ey(e.target.value)})]}),(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Subdomain"}),(0,a.jsxs)("div",{className:"wb-domain-input",children:[(0,a.jsx)("input",{type:"text",className:"wb-input",placeholder:"myportfolio",value:ef,onChange:e=>ew(e.target.value.toLowerCase().replace(/[^a-z0-9-]/g,""))}),(0,a.jsx)("span",{className:"wb-domain-suffix",children:".setx360.com"})]}),ef&&(0,a.jsxs)("small",{style:{color:"#646970"},children:["Your site: ",(0,a.jsxs)("strong",{children:[ef,".setx360.com"]})]})]}),(0,a.jsxs)("div",{className:"wb-modal-actions",children:[(0,a.jsx)("button",{className:"wb-btn-text",onClick:()=>eS("workspace"),children:"Back"}),(0,a.jsx)("button",{className:"wb-btn-primary",onClick:sm,disabled:!ej||!ef||ev,children:ev?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.A,{size:16,className:"wb-spinner"})," Creating..."]}):"Create Website"})]})]})]})})]}):(0,a.jsxs)("div",{className:"wb-container",style:{"--wb-sidebar-bg":sA,"--wb-sidebar-color":sz},children:[(0,a.jsxs)("aside",{className:"wb-sidebar ".concat(ea?"open":"closed"),children:[(0,a.jsx)("div",{className:"wb-sidebar-header",children:ea&&(0,a.jsx)("span",{className:"wb-brand",children:sT})}),(0,a.jsx)("nav",{className:"wb-nav",children:sP.map(e=>(0,a.jsxs)("button",{className:"wb-nav-item ".concat(el===e.id?"active":""),onClick:()=>en(e.id),children:[(0,a.jsx)("span",{className:"wb-nav-icon",children:e.icon}),ea&&(0,a.jsx)("span",{className:"wb-nav-label",children:e.label})]},e.id))}),(0,a.jsx)("div",{className:"wb-sidebar-footer",children:(0,a.jsxs)("button",{className:"wb-collapse-btn",onClick:()=>ei(!ea),children:[(0,a.jsx)(I.A,{size:20}),ea&&(0,a.jsx)("span",{children:"Collapse"})]})})]}),(0,a.jsxs)("div",{className:"wb-main-wrapper",children:[(0,a.jsxs)("header",{className:"wb-topbar",children:[(0,a.jsxs)("div",{className:"wb-topbar-left",children:[(0,a.jsxs)("button",{className:"wb-topbar-btn",onClick:()=>{j("list"),N(null)},children:[(0,a.jsx)(M.A,{size:18}),(0,a.jsx)("span",{className:"hide-mobile",children:"Sites"})]}),(0,a.jsx)("div",{className:"wb-topbar-divider"}),(0,a.jsxs)("a",{className:"wb-topbar-btn",href:"/tenant/".concat(null==v?void 0:v.subdomain),target:"_blank",rel:"noopener noreferrer",children:[(0,a.jsx)(_.A,{size:18}),(0,a.jsx)("span",{className:"hide-mobile",children:null==v?void 0:v.name}),(0,a.jsx)(D.A,{size:12,className:"wb-external-icon"})]}),(0,a.jsxs)("button",{className:"wb-topbar-btn",onClick:()=>{eY({title:"",status:"draft",content:"",categories:[],tags:[]}),en("posts")},children:[(0,a.jsx)(g.A,{size:18}),(0,a.jsx)("span",{className:"hide-mobile",children:"New"})]})]}),(0,a.jsxs)("div",{className:"wb-topbar-right",children:["saving"===sr&&(0,a.jsxs)("span",{style:{color:"#72aee6",fontSize:12,marginRight:8},children:[(0,a.jsx)(o.A,{size:12,className:"wb-spinner",style:{display:"inline"}})," Saving..."]}),"saved"===sr&&(0,a.jsxs)("span",{style:{color:"#68de7c",fontSize:12,marginRight:8},children:[(0,a.jsx)(d.A,{size:12,style:{display:"inline"}})," Saved"]}),(0,a.jsxs)("button",{className:"wb-topbar-btn",children:[(0,a.jsx)("span",{className:"hide-mobile",children:null==m||null==(t=m.name)?void 0:t.split(" ")[0]}),(0,a.jsx)(G.e,{url:null==m?void 0:m.avatar_url,name:null==m?void 0:m.name,size:28})]})]})]}),(0,a.jsxs)("main",{className:"wb-content",children:[eK&&(0,a.jsx)("div",{className:"wb-tab-loading",children:(0,a.jsx)(o.A,{size:24,className:"wb-spinner"})}),"dashboard"===el&&!eK&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"wb-content-header",children:(0,a.jsx)("h1",{children:"Dashboard"})}),(0,a.jsxs)("div",{className:"wb-dashboard-grid",children:[(0,a.jsxs)("div",{className:"wb-widget full-width",style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:16,border:"none",background:"transparent",boxShadow:"none"},children:[(0,a.jsxs)("div",{className:"wb-widget",style:{padding:24,display:"flex",flexDirection:"column",gap:8},children:[(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#646970"},children:[(0,a.jsx)(p.A,{size:18})," ",(0,a.jsx)("strong",{children:"Total Revenue"})]}),(0,a.jsxs)("div",{style:{fontSize:32,fontWeight:700,color:"#1d2327"},children:["$",eV.reduce((e,s)=>e+Number(s.total_amount||0),0).toFixed(2)]})]}),(0,a.jsxs)("div",{className:"wb-widget",style:{padding:24,display:"flex",flexDirection:"column",gap:8},children:[(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#646970"},children:[(0,a.jsx)(c.A,{size:18})," ",(0,a.jsx)("strong",{children:"Total Orders"})]}),(0,a.jsx)("div",{style:{fontSize:32,fontWeight:700,color:"#1d2327"},children:eV.length})]}),(0,a.jsxs)("div",{className:"wb-widget",style:{padding:24,display:"flex",flexDirection:"column",gap:8},children:[(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#646970"},children:[(0,a.jsx)(P.A,{size:18})," ",(0,a.jsx)("strong",{children:"Products Sold"})]}),(0,a.jsx)("div",{style:{fontSize:32,fontWeight:700,color:"#1d2327"},children:eV.length>0?Math.floor(1.5*eV.length):0})]})]}),(0,a.jsxs)("div",{className:"wb-widget full-width",children:[(0,a.jsxs)("h2",{className:"wb-widget-title",style:{display:"flex",justifyContent:"space-between"},children:[(0,a.jsx)("span",{children:"Site Traffic (Last 7 Days)"}),(0,a.jsx)("span",{style:{fontSize:12,fontWeight:"normal",color:"#2271b1",cursor:"pointer"},children:"View Detailed Report"})]}),(0,a.jsx)("div",{className:"wb-widget-content",style:{padding:20,height:300},children:(0,a.jsx)(J.u,{width:"100%",height:"100%",children:(0,a.jsxs)($.Q,{data:[{name:"Mon",views:400,visitors:240},{name:"Tue",views:300,visitors:139},{name:"Wed",views:200,visitors:980},{name:"Thu",views:278,visitors:390},{name:"Fri",views:189,visitors:480},{name:"Sat",views:239,visitors:380},{name:"Sun",views:349,visitors:430}],margin:{top:10,right:10,left:-20,bottom:0},children:[(0,a.jsxs)("defs",{children:[(0,a.jsxs)("linearGradient",{id:"colorViews",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,a.jsx)("stop",{offset:"5%",
1stopColor:"#2271b1",stopOpacity:.3}),(0,a.jsx)("stop",{offset:"95%",stopColor:"#2271b1",stopOpacity:0})]}),(0,a.jsxs)("linearGradient",{id:"colorVisitors",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,a.jsx)("stop",{offset:"5%",stopColor:"#72aee6",stopOpacity:.3}),(0,a.jsx)("stop",{offset:"95%",stopColor:"#72aee6",stopOpacity:0})]})]}),(0,a.jsx)(Y.W,{dataKey:"name",axisLine:!1,tickLine:!1,tick:{fontSize:12,fill:"#646970"},dy:10}),(0,a.jsx)(Z.h,{axisLine:!1,tickLine:!1,tick:{fontSize:12,fill:"#646970"}}),(0,a.jsx)(Q.d,{strokeDasharray:"3 3",vertical:!1,stroke:"#f0f0f1"}),(0,a.jsx)(ee.m,{contentStyle:{borderRadius:8,border:"none",boxShadow:"0 4px 12px rgba(0,0,0,0.1)"}}),(0,a.jsx)(es.Gk,{type:"monotone",dataKey:"views",stroke:"#2271b1",strokeWidth:3,fillOpacity:1,fill:"url(#colorViews)",name:"Page Views"}),(0,a.jsx)(es.Gk,{type:"monotone",dataKey:"visitors",stroke:"#72aee6",strokeWidth:2,fillOpacity:1,fill:"url(#colorVisitors)",name:"Unique Visitors"})]})})})]}),(0,a.jsxs)("div",{className:"wb-widget",children:[(0,a.jsx)("h2",{className:"wb-widget-title",children:"At a Glance"}),(0,a.jsxs)("div",{className:"wb-widget-content",children:[(0,a.jsxs)("div",{className:"wb-glance-item",children:[(0,a.jsx)(A,{size:16}),(0,a.jsxs)("span",{onClick:()=>en("posts"),style:{cursor:"pointer",color:"#2271b1"},children:[eL.length," Post",1!==eL.length?"s":""]})]}),(0,a.jsxs)("div",{className:"wb-glance-item",children:[(0,a.jsx)(T.A,{size:16}),(0,a.jsxs)("span",{onClick:()=>en("pages"),style:{cursor:"pointer",color:"#2271b1"},children:[eD.length," Page",1!==eD.length?"s":""]})]}),(0,a.jsxs)("div",{className:"wb-glance-item",children:[(0,a.jsx)(h.A,{size:16}),(0,a.jsxs)("span",{onClick:()=>en("users"),style:{cursor:"pointer",color:"#2271b1"},children:[eF.length," Subscriber",1!==eF.length?"s":""]})]}),(0,a.jsxs)("p",{className:"wb-glance-footer",children:["SETX SiteBuilder \xb7 ",null==v?void 0:v.subdomain,".setx360.com"]})]})]}),(0,a.jsxs)("div",{className:"wb-widget",children:[(0,a.jsx)("h2",{className:"wb-widget-title",children:"Quick Draft"}),(0,a.jsxs)("div",{className:"wb-widget-content",children:[(0,a.jsx)("input",{type:"text",placeholder:"Post title...",className:"wb-input",id:"quick-draft-title"}),(0,a.jsx)("textarea",{placeholder:"What's on your mind?",className:"wb-textarea",rows:3,id:"quick-draft-body"}),(0,a.jsx)("button",{className:"wb-btn-primary",onClick:()=>{var e,s;
1let t=null==(e=document.getElementById("quick-draft-title"))?void 0:e.value,a=null==(s=document.getElementById("quick-draft-body"))?void 0:s.value;t&&sy({title:t,content:"<p>".concat(a,"</p>"),status:"draft",categories:[],tags:[]})},children:"Save Draft"})]})]}),(0,a.jsxs)("div",{className:"wb-widget full-width",children:[(0,a.jsx)("h2",{className:"wb-widget-title",children:"Recent Posts"}),(0,a.jsxs)("div",{className:"wb-widget-content",children:[eL.slice(0,5).map(e=>(0,a.jsxs)("div",{className:"wb-activity-row",children:[(0,a.jsx)("span",{className:"wb-status-dot ".concat(e.status)}),(0,a.jsx)("span",{style:{flex:1,fontWeight:600,color:"#1d2327",cursor:"pointer"},onClick:()=>eY(e),children:e.title}),(0,a.jsx)("span",{className:"wb-activity-time",children:new Date(e.created_at).toLocaleDateString()}),(0,a.jsx)("span",{className:"wb-pill ".concat(e.status),children:e.status})]},e.id)),0===eL.length&&(0,a.jsxs)("p",{style:{color:"#646970",margin:0},children:["No posts yet. ",(0,a.jsx)("button",{className:"wb-link-btn",onClick:()=>{eY({title:"",status:"draft",content:"",categories:[],tags:[]}),en("posts")},children:"Create your first post â"})]})]})]})]})]}),"taxonomy"===el&&!eK&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"wb-content-header",children:(0,a.jsx)("h1",{children:"Categories & Tags"})}),(0,a.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:24,marginTop:24},children:[(0,a.jsxs)("div",{className:"wb-widget",style:{padding:24},children:[(0,a.jsxs)("h3",{style:{fontSize:16,marginBottom:16,display:"flex",alignItems:"center",gap:8},children:[(0,a.jsx)(z.A,{size:18})," All Categories"]}),(0,a.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:Array.from(new Set(eL.flatMap(e=>e.categories||[]))).map(e=>(0,a.jsx)("span",{className:"wb-pill",children:e},e))}),0===Array.from(new Set(eL.flatMap(e=>e.categories||[]))).length&&(0,a.jsx)("p",{style:{color:"#646970"},children:"No categories found across your posts."})]}),(0,a.jsxs)("div",{className:"wb-widget",style:{padding:24},children:[(0,a.jsxs)("h3",{style:{fontSize:16,marginBottom:16,display:"flex",alignItems:"center",gap:8},children:[(0,a.jsx)(z.A,{size:18})," All Tags"]}),(0,a.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:Array.from(new Set(eL.flatMap(e=>e.tags||[]))).map(e=>(0,a.jsx)("span",{className:"wb-pill",children:e},e))}),0===Array.from(new Set(eL.flatMap(e=>e.tags||[]))).length&&(0,a.jsx)("p",{style:{color:"#646970"},children:"No tags found across your posts."})]})]})]}),"posts"===el&&!eK&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"wb-content-header",style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,a.jsx)("h1",{children:"Posts"}),(0,a.jsxs)("button",{className:"wb-btn-primary",onClick:()=>eY({title:"",status:"draft",content:"",categories:[],tags:[]}),children:[(0,a.jsx)(g.A,{size:16})," Add New"]})]}),(0,a.jsxs)("table",{className:"wb-table",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Title"}),(0,a.jsx)("th",{children:"Categories"}),(0,a.jsx)("th",{children:"Status"}),(0,a.jsx)("th",{children:"Date"}),(0,a.jsx)("th",{children:"Actions"})]})}),(0,a.jsxs)("tbody",{children:[eL.map(e=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:(0,a.jsx)("strong",{style:{color:"#2271b1",cursor:"pointer"},onClick:()=>eY(e),children:e.title})}),(0,a.jsx)("td",{children:(e.categories||[]).slice(0,2).map(e=>(0,a.jsx)("span",{className:"wb-pill subscriber",style:{marginRight:4},children:e},e))}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"wb-pill ".concat(e.status),children:e.status})}),(0,a.jsx)("td",{style:{color:"#646970",fontSize:13},children:new Date(e.created_at).toLocaleDateString()}),(0,a.jsx)("td",{children:(0,a.jsxs)("div",{className:"wb-action-btns",children:[(0,a.jsx)("button",{className:"wb-icon-btn",onClick:()=>eY(e),children:(0,a.jsx)(W.A,{size:15})}),(0,a.jsx)("button",{className:"wb-icon-btn danger",onClick:()=>sv(e.id),children:(0,a.jsx)(b.A,{size:15})})]})})]},e.id)),0===eL.length&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:5,style:{textAlign:"center",color:"#646970",padding:32},children:"No posts yet."})})]})]})]}),"pages"===el&&!eK&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"wb-content-header",style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,a.jsx)("h1",{children:"Pages"}),(0,a.jsxs)("button",{className:"wb-btn-primary",onClick:()=>eQ({title:"",status:"draft",content:""}),children:[(0,a.jsx)(g.A,{size:16})," Add New"]})]}),(0,a.jsxs)("table",{className:"wb-table",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Title"}),(0,a.jsx)("th",{children:"Status"}),(0,a.jsx)("th",{children:"Date"}),(0,a.jsx)("th",{children:"Actions"})]})}),(0,a.jsxs)("tbody",{children:[eD.map(e=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:(0,a.jsx)("strong",{style:{color:"#2271b1",cursor:"pointer"},onClick:()=>eQ(e),children:e.title})}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"wb-pill ".concat(e.status),children:e.status})}),(0,a.jsx)("td",{style:{color:"#646970",fontSize:13},children:new Date(e.created_at).toLocaleDateString()}),(0,a.jsx)("td",{children:(0,a.jsxs)("div",{className:"wb-action-btns",children:[(0,a.jsx)("button",{className:"wb-icon-btn",onClick:()=>eQ(e),children:(0,a.jsx)(W.A,{size:15})}),(0,a.jsx)("button",{className:"wb-icon-btn danger",onClick:()=>sN(e.id),children:(0,a.jsx)(b.A,{size:15})})]})})]},e.id)),0===eD.length&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:4,style:{textAlign:"center",color:"#646970",padding:32},children:"No pages yet."})})]})]})]}),"media"===el&&!eK&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"wb-content-header",style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16},children:[(0,a.jsx)("h1",{children:"Media Library"}),se.length>0&&(0,a.jsxs)("button",{className:"wb-btn-secondary",style:{color:"#d63638",borderColor:"#d63638"},onClick:s_,children:[(0,a.jsx)(b.A,{size:16})," Delete ",se.length," items"]})]}),(0,a.jsxs)("label",{className:"wb-btn-primary",style:{cursor:"pointer"},children:[e5?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.A,{size:16,className:"wb-spinner"})," Uploading..."]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f.A,{size:16})," Upload File"]}),(0,a.jsx)("input",{type:"file",hidden:!0,accept:"image/*,video/*,audio/*,application/pdf",multiple:!0,onChange:sC,disabled:!(null==v?void 0:v.storage_bucket)})]})]}),!(null==v?void 0:v.storage_bucket)&&(0,a.jsxs)("div",{className:"wb-info-box",children:[(0,a.jsx)(q.A,{size:16}),"Storage bucket is still provisioning. Refresh in a moment."]}),(0,a.jsxs)("div",{className:"wb-media-grid",children:[eM.map(e=>{var s,t;return(0,a.jsxs)("div",{className:"wb-media-item ".concat(se.includes(e.id)?"selected":""),style:{position:"relative"},children:[(0,a.jsx)("input",{type:"checkbox",className:"wb-media-checkbox",style:{position:"absolute",top:8,left:8,zIndex:10},checked:se.includes(e.id),onChange:s=>{s.target.checked?ss([...se,e.id]):ss(se.filter(s=>s!==e.id))}}),(null==(s=e.file_type)?void 0:s.startsWith("image/"))?(0,a.jsx)("img",{src:e.f
1ile_url,alt:e.alt_text||e.file_name,className:"wb-media-thumb"}):(null==(t=e.file_type)?void 0:t.startsWith("video/"))?(0,a.jsx)("div",{className:"wb-media-file-icon",children:(0,a.jsx)(F.A,{size:32,color:"#8c8f94"})}):"application/pdf"===e.file_type?(0,a.jsx)("div",{className:"wb-media-file-icon",children:(0,a.jsx)(T.A,{size:32,color:"#8c8f94"})}):(0,a.jsx)("div",{className:"wb-media-file-icon",children:(0,a.jsx)(E,{size:32,color:"#8c8f94"})}),(0,a.jsxs)("div",{className:"wb-media-info",children:[(0,a.jsx)("p",{className:"wb-media-name",style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.file_name}),(0,a.jsx)("button",{className:"wb-link-btn",onClick:()=>navigator.clipboard.writeText(e.file_url),children:"Copy URL"})]})]},e.id)}),0===eM.length&&(0,a.jsxs)("div",{className:"wb-empty-state",children:[(0,a.jsx)(r.A,{size:40,color:"#c3c4c7"}),(0,a.jsx)("p",{children:"No media uploaded yet."})]})]})]}),"forms"===el&&!eK&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"wb-content-header",children:(0,a.jsx)("h1",{children:"Form Submissions"})}),(0,a.jsxs)("table",{className:"wb-table",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Form Name"}),(0,a.jsx)("th",{children:"From"}),(0,a.jsx)("th",{children:"Message"}),(0,a.jsx)("th",{children:"Date"})]})}),(0,a.jsxs)("tbody",{children:[eO.map(e=>{var s,t,i;return(0,a.jsxs)("tr",{style:{fontWeight:e.is_read?"normal":"500",cursor:e.is_read?"default":"pointer"},onClick:async()=>{e.is_read||(eU(s=>s.map(s=>s.id===e.id?{...s,is_read:!0}:s)),await V.supabase.from("wb_form_submissions").update({is_read:!0}).eq("id",e.id))},children:[(0,a.jsx)("td",{children:e.form_name}),(0,a.jsxs)("td",{children:[(null==(s=e.data)?void 0:s.name)||"Anonymous"," ",(0,a.jsx)("br",{}),(0,a.jsx)("span",{style:{fontSize:12,color:"#646970"},children:null==(t=e.data)?void 0:t.email})]}),(0,a.jsx)("td",{children:(null==(i=e.data)?void 0:i.message)||JSON.stringify(e.data)}),(0,a.jsx)("td",{children:new Date(e.created_at).toLocaleDateString()})]},e.id)}),0===eO.length&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:4,style:{textAlign:"center",color:"#646970",padding:32},children:"No submissions yet."})})]})]})]}),"comments"===el&&v&&(0,a.jsx)(eh,{siteId:v.id}),"menus"===el&&v&&(0,a.jsx)(ep,{siteId:v.id,subdomain:v.subdomain}),"products"===el&&!eK&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"wb-content-header",style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,a.jsx)("h1",{children:"Products"}),(0,a.jsxs)("button",{className:"wb-btn-primary",onClick:()=>e1(eP?{name:"",description:"",price:0,currency:"USD",image_urls:[],stock_status:"in_stock"}:{title:"",status:"draft",description:"",product_type:"simple",manage_stock:!1,stock_quantity:0,stock_status:"instock",categories:[],tags:[],gallery_urls:[],metadata:{}}),children:[(0,a.jsx)(g.A,{size:16})," Add New Product"]})]}),eP&&(0,a.jsx)("p",{style:{color:"#646970",fontSize:"0.85rem",marginTop:-8,marginBottom:16},children:"Shared inventory -- these are the same products your workspace dashboard and Market/Meals show, kept in one place."}),(0,a.jsx)("table",{className:"wb-table",children:eP?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Product"}),(0,a.jsx)("th",{children:"Price"}),(0,a.jsx)("th",{children:"Stock"}),(0,a.jsx)("th",{children:"Actions"})]})}),(0,a.jsxs)("tbody",{children:[eH.map(e=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:(0,a.jsx)("strong",{style:{color:"#2271b1",cursor:"pointer"},onClick:()=>e1(e),children:e.name})}),(0,a.jsx)("td",{children:e.price?"$".concat(Number(e.price).toFixed(2)):"â"}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"wb-pill ".concat(e.stock_status),children:e.stock_status})}),(0,a.jsx)("td",{children:(0,a.jsxs)("div",{className:"wb-action-btns",children:[(0,a.jsx)("button",{className:"wb-icon-btn",onClick:()=>e1(e),children:(0,a.jsx)(W.A,{size:15})}),(0,a.jsx)("button",{className:"wb-icon-btn danger",onClick:()=>sk(e.id),children:(0,a.jsx)(b.A,{size:15})})]})})]},e.id)),0===eH.length&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:4,style:{textAlign:"center",color:"#646970",padding:32},children:"No products yet. Build your store!"})})]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Product"}),(0,a.jsx)("th",{children:"Type"}),(0,a.jsx)("th",{children:"Price"}),(0,a.jsx)("th",{children:"Stock"}),(0,a.jsx)("th",{children:"Status"}),(0,a.jsx)("th",{children:"Actions"})]})}),(0,a.jsxs)("tbody",{children:[eH.map(e=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:(0,a.jsx)("strong",{style:{color:"#2271b1",cursor:"pointer"},onClick:()=>e1(e),children:e.title})}),(0,a.jsx)("td",{style:{textTransform:"capitalize"},children:e.product_type}),(0,a.jsx)("td",{children:e.price?"$".concat(e.price.toFixed(2)):"â"}
1),(0,a.jsx)("td",{children:e.manage_stock?e.stock_quantity:(0,a.jsx)("span",{className:"wb-pill ".concat(e.stock_status),children:e.stock_status})}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"wb-pill ".concat(e.status),children:e.status})}),(0,a.jsx)("td",{children:(0,a.jsxs)("div",{className:"wb-action-btns",children:[(0,a.jsx)("button",{className:"wb-icon-btn",onClick:()=>e1(e),children:(0,a.jsx)(W.A,{size:15})}),(0,a.jsx)("button",{className:"wb-icon-btn danger",onClick:()=>sk(e.id),children:(0,a.jsx)(b.A,{size:15})})]})})]},e.id)),0===eH.length&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:6,style:{textAlign:"center",color:"#646970",padding:32},children:"No products yet. Build your store!"})})]})]})})]}),"orders"===el&&!eK&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"wb-content-header",children:(0,a.jsx)("h1",{children:"Orders"})}),(0,a.jsxs)("table",{className:"wb-table",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Order #"}),(0,a.jsx)("th",{children:"Customer"}),(0,a.jsx)("th",{children:"Date"}),(0,a.jsx)("th",{children:"Status"}),(0,a.jsx)("th",{children:"Total"})]})}),(0,a.jsxs)("tbody",{children:[eV.map(e=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:(0,a.jsxs)("strong",{style:{color:"#2271b1",cursor:"pointer"},children:["#",e.id.split("-")[0]]})}),(0,a.jsx)("td",{children:e.customer_name||e.customer_email||"Guest"}),(0,a.jsx)("td",{style:{color:"#646970",fontSize:13},children:new Date(e.created_at).toLocaleString()}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"wb-pill ".concat(e.status),children:e.status})}),(0,a.jsxs)("td",{style:{fontWeight:600},children:["$",Number(e.total_amount).toFixed(2)]})]},e.id)),0===eV.length&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:5,style:{textAlign:"center",color:"#646970",padding:32},children:"No orders yet."})})]})]})]}),"users"===el&&!eK&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"wb-content-header",children:(0,a.jsx)("h1",{children:"Users & Subscribers"})}),(0,a.jsxs)("div",{className:"wb-info-box",style:{marginBottom:24},children:[(0,a.jsx)(O.A,{size:16}),"Visitors can subscribe using their ",(0,a.jsx)("strong",{children:"SETX 360 credentials"}),". Promote trusted subscribers to extended roles below."]}),(0,a.jsxs)("table",{className:"wb-table",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"User"}),(0,a.jsx)("th",{children:"Role"}),(0,a.jsx)("th",{children:"Status"}),(0,a.jsx)("th",{children:"Since"}),(0,a.jsx)("th",{children:"Actions"})]})}),(0,a.jsxs)("tbody",{children:[eF.map(e=>{var s,t,i;return(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,a.jsx)(G.e,{url:null==(s=e.profiles)?void 0:s.avatar_url,name:(null==(t=e.profiles)?void 0:t.name)||"User",size:28}),(0,a.jsx)("span",{style:{fontWeight:600},children:(null==(i=e.profiles)?void 0:i.name)||e.user_id.slice(0,8)})]})}),(0,a.jsx)("td",{children:(0,a.jsxs)("select",{className:"wb-select",value:e.role,onChange:s=>sS(e.id,s.target.value),children:[(0,a.jsx)("option",{value:"subscriber",children:"Subscriber"}),(0,a.jsx)("option",{value:"contributor",children:"Contributor"}),(0,a.jsx)("option",{value:"editor",children:"Editor"}),(0,a.jsx)("option",{value:"admin",children:"Admin"})]})}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"wb-pill ".concat(e.status),children:e.status})}),(0,a.jsx)("td",{style:{color:"#646970",fontSize:13},children:new Date(e.subscribed_at).toLocaleDateString()}),(0,a.jsx)("td",{children:(0,a.jsx)("button",{className:"wb-icon-btn danger",onClick:async()=>{await V.supabase.from("wb_site_subscribers").update({status:"banned"}).eq("id",e.id),eE(s=>s.map(s=>s.id===e.id?{...s,status:"banned"}:s))},children:(0,a.jsx)(l.A,{size:15})})})]},e.id)}),0===eF.length&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:5,style:{textAlign:"center",color:"#646970",padding:32},children:"No subscribers yet."})})]})]})]}),"white_label"===el&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"wb-content-header",children:(0,a.jsx)("h1",{children:"White Label"})}),(0,a.jsxs)("div",{className:"wb-widget",style:{maxWidth:700},children:[(0,a.jsx)("h2",{className:"wb-widget-title",children:"Dashboard Appearance"}),(0,a.jsxs)("div",{className:"wb-widget-content",style:{padding:24},children:[(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Dashboard Brand Name"}),(0,a.jsx)("input",{type:"text",className:"wb-input",value:st.brandName||"",onChange:e=>sx("brandName",e.target.value)}),(0,a.jsx)("small",{style:{color:"#8c8f94"},children:"Replaces the logo text in the sidebar."})]}),(0,a.jsx)("div",{style:{display:"flex",gap:24,flexWrap:"wrap"}
1,children:[{key:"sidebarBg",label:"Sidebar Background",default:"#1e1e1e"},{key:"sidebarColor",label:"Sidebar Text",default:"#ffffff"},{key:"accentColor",label:"Public Site Accent",default:"#2271b1"}].map(e=>{let{key:s,label:t,default:i}=e;return(0,a.jsxs)("div",{className:"wb-form-group",style:{flex:1,minWidth:180},children:[(0,a.jsx)("label",{children:t}),(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10},children:[(0,a.jsx)("input",{type:"color",value:st[s]||i,onChange:e=>sx(s,e.target.value),style:{width:40,height:40,padding:0,border:"none",borderRadius:4,cursor:"pointer"}}),(0,a.jsx)("input",{type:"text",className:"wb-input",value:st[s]||i,onChange:e=>sx(s,e.target.value),style:{marginBottom:0,fontFamily:"monospace"}})]})]},s)})}),(0,a.jsxs)("div",{className:"wb-success-box",children:[(0,a.jsx)(d.A,{size:16})," Changes applied automatically"]})]})]})]}),"settings"===el&&v&&(0,a.jsx)(ed,{site:v}),"appearance"===el&&v&&(0,a.jsx)(em,{siteId:v.id,wlConfig:st,onUpdateWlConfig:sx,storageBucket:v.storage_bucket}),"plugins"===el&&v&&(0,a.jsx)(ec,{siteId:v.id,onUpdate:sl})]})]}),e$&&(0,a.jsx)("div",{className:"wb-modal-overlay",children:(0,a.jsxs)("div",{className:"wb-modal wb-modal-wide",children:[(0,a.jsxs)("div",{className:"wb-modal-head",children:[(0,a.jsx)("h2",{children:e$.id?"Edit Post":"New Post"}),(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e$.id&&"saving"===sr&&(0,a.jsxs)("span",{style:{fontSize:12,color:"#8c8f94"},children:[(0,a.jsx)(o.A,{size:11,className:"wb-spinner",style:{display:"inline"}})," Saving..."]}),e$.id&&"saved"===sr&&(0,a.jsxs)("span",{style:{fontSize:12,color:"#0a7444"},children:[(0,a.jsx)(d.A,{size:11,style:{display:"inline"}})," Saved"]}),(0,a.jsx)("button",{className:"wb-icon-btn",onClick:()=>eY(null),children:(0,a.jsx)(l.A,{size:20})})]})]}),(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Featured Image"}),e$.featured_image_url?(0,a.jsxs)("div",{style:{position:"relative",display:"inline-block"},children:[(0,a.jsx)("img",{src:e$.featured_image_url,alt:"Featured",style:{height:100,borderRadius:6,objectFit:"cover",display:"block",marginBottom:8}}),(0,a.jsx)("button",{className:"wb-btn-text",style:{padding:"0",fontSize:12},onClick:()=>sj({featured_image_url:""}),children:"Remove"}),(0,a.jsx)("button",{className:"wb-btn-text",style:{padding:"0 0 0 12px",fontSize:12},onClick:()=>{e7("featured"),e8(!0)},children:"Change"})]}):(0,a.jsxs)("button",{className:"wb-btn-secondary",style:{padding:"6px 14px",fontSize:13},onClick:()=>{e7("featured"),e8(!0)},children:[(0,a.jsx)(U.A,{size:14})," Set Featured Image"]})]}),(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Title"}),(0,a.jsx)("input",{type:"text",className:"wb-input",value:e$.title||"",onChange:e=>sj({title:e.target.value}),placeholder:"Post title..."})]}),(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Content"}),(0,a.jsx)(eo,{content:e$.content||"",onChange:e=>sj({content:e}),onInsertImage:()=>{e7("editor"),e8(!0)}})]}),(0,a.jsxs)("div",{style:{display:"flex",gap:16,flexWrap:"wrap"},children:[(0,a.jsxs)("div",{className:"wb-form-group",style:{flex:1,minWidth:200},children:[(0,a.jsx)("label",{children:"Excerpt"}),(0,a.jsx)("textarea",{className:"wb-textarea",rows:2,value:e$.excerpt||"",onChange:e=>sj({excerpt:e.target.value}),placeholder:"Short description..."})]}),(0,a.jsxs)("div",{style:{minWidth:180,display:"flex",flexDirection:"column",gap:12},children:[(0,a.jsxs)("div",{className:"wb-form-group",style:{marginBottom:0},children:[(0,a.jsx)("label",{children:"Status"}),(0,a.jsxs)("select",{className:"wb-select",value:e$.status||"draft",onChange:e=>sj({status:e.target.value}),children:[(0,a.jsx)("option",{value:"draft",children:"Draft"}),(0,a.jsx)("option",{value:"published",children:"Published"}),(0,a.jsx)("option",{value:"scheduled",children:"Scheduled"}),(0,a.jsx)("option",{value:"trash",children:"Trash"})]})]}),"scheduled"===e$.status&&(0,a.jsxs)("div",{className:"wb-form-group",style:{marginBottom:0},children:[(0,a.jsxs)("label",{children:[(0,a.jsx)(H.A,{size:13,style:{display:"inline",marginRight:4}}),"Publish At"]}),(0,a.jsx)("input",{type:"datetime-local",className:"wb-input",value:e$.published_at?e$.published_at.slice(0,16):"",onCh
1ange:e=>sj({published_at:new Date(e.target.value).toISOString()})})]})]})]}),(0,a.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16},children:[(0,a.jsx)(er,{label:"Categories",values:e$.categories||[],onChange:e=>sj({categories:e}),placeholder:"Add category..."}),(0,a.jsx)(er,{label:"Tags",values:e$.tags||[],onChange:e=>sj({tags:e}),placeholder:"Add tag..."})]}),(0,a.jsxs)("div",{style:{borderTop:"1px solid #f0f0f1",margin:"24px 0",paddingTop:24},children:[(0,a.jsx)("h3",{style:{fontSize:14,fontWeight:600,color:"#1d2327",marginBottom:16},children:"SEO Settings"}),(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Meta Title"}),(0,a.jsx)("input",{type:"text",className:"wb-input",value:e$.meta_title||"",onChange:e=>sj({meta_title:e.target.value}),placeholder:"SEO Title..."})]}),(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Meta Description"}),(0,a.jsx)("textarea",{className:"wb-textarea",rows:2,value:e$.meta_description||"",onChange:e=>sj({meta_description:e.target.value}),placeholder:"SEO Description..."})]}),(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Open Graph Image URL"}),(0,a.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,a.jsx)("input",{type:"text",className:"wb-input",value:e$.og_image||"",onChange:e=>sj({og_image:e.target.value}),placeholder:"https://...",style:{flex:1}}),(0,a.jsx)("button",{className:"wb-btn-secondary",onClick:()=>{e7("og_image_post"),e8(!0)},children:"Select"})]})]})]}),(0,a.jsxs)("div",{className:"wb-modal-actions",children:[(0,a.jsx)("button",{className:"wb-btn-text",onClick:()=>eY(null),children:"Cancel"}),(0,a.jsx)("button",{className:"wb-btn-primary",onClick:()=>sy(e$),children:e$.id?"Update Post":"Save Post"})]})]})}),eZ&&(0,a.jsx)("div",{className:"wb-modal-overlay",children:(0,a.jsxs)("div",{className:"wb-modal wb-modal-wide",children:[(0,a.jsxs)("div",{className:"wb-modal-head",children:[(0,a.jsx)("h2",{children:eZ.id?"Edit Page":"New Page"}),(0,a.jsx)("button",{className:"wb-icon-btn",onClick:()=>eQ(null),children:(0,a.jsx)(l.A,{size:20})})]}),(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Page Title"}),(0,a.jsx)("input",{type:"text",className:"wb-input",value:eZ.title||"",onChange:e=>eQ({...eZ,title:e.target.value}),placeholder:"Page title..."})]}),(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Page Content (Blocks)"}),(0,a.jsx)(eb,{blocks:eZ.blocks||[],onChange:e=>eQ({...eZ,blocks:e})})]}),(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Status"}),(0,a.jsxs)("select",{className:"wb-select",value:eZ.status||"draft",onChange:e=>eQ({...eZ,status:e.target.value}),children:[(0,a.jsx)("option",{value:"draft",children:"Draft"}),(0,a.jsx)("option",{value:"published",children:"Published"})]})]}),(0,a.jsxs)("div",{style:{borderTop:"1px solid #f0f0f1",margin:"24px 0",paddingTop:24},children:[(0,a.jsx)("h3",{style:{fontSize:14,fontWeight:600,color:"#1d2327",marginBottom:16},children:"SEO Settings"}),(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Meta Title"}),(0,a.jsx)("input",{type:"text",className:"wb-input",value:eZ.meta_title||"",onChange:e=>eQ({...eZ,meta_title:e.target.value}),placeholder:"SEO Title..."})]}),(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Meta Description"}),(0,a.jsx)("textarea",{className:"wb-textarea",rows:2,value:eZ.meta_description||"",onChange:e=>eQ({...eZ,meta_description:e.target.value}),placeholder:"SEO Description..."})]}),(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Open Graph Image URL"}),(0,a.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,a.jsx)("input",{type:"text",className:"wb-input",value:eZ.og_image||"",onChange:e=>eQ({...eZ,og_image:e.target.value}),placeholder:"https://...",style:{flex:1}}),(0,a.jsx)("button",{className:"wb-btn-secondary",onClick:()=>{e7("og_image_page"),e8(!0)},children:"Select"})]})]})]}),(0,a.jsxs)("div",{className:"wb-modal-actions",children:[(0,a.jsx)("button",{className:"wb-btn-text",onClick:()=>eQ(null),children:"Cancel"}),(0,a.jsx)("button",{className:"wb-btn-primary",onClick:()=>sf(eZ),children:eZ.id?"Update Page":"Save Page"})]})]})}),e0&&eP&&(0,a.jsx)("div",{className:"wb-modal-overlay",onClick:()=>e1(null),children:(0,a.jsxs)("div",{className:"wb-modal",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"wb-modal-head",children:[(0,a.jsx)("h2",{children:e0.id?"Edit Product":"New Product"}),(0,a.jsx)("button",{className:"wb-icon-btn",onClick:()=>e1(null),children:(0,a.jsx)(l.A,{size:20})})]}),(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Product Name"}),(0,a.jsx)("input",{type:"text",className:"wb-input",value:e0.name||"",onChange:e=>e1({...e0,name:e.target.value}),placeholder:"e.g. Vintage T-Shirt"})]}),(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Description"}),(0,a.jsx)("textarea",{className:"wb-input",rows:3,value:e0.description||"",onChange:e=>e1({...e0,description:e.target.value})})]}),(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Price"}),(0,a.jsx)("input",{type:"number",className:"wb-input",value:e0.price||"",onChange:e=>e1({...e0,price:Number(e.target.value)})})]}),(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Stock Status"}),(0,a.jsxs)("select",{className:"wb-select",value:e0.stock_status||"in_stock",onChange:e=>e1({...e0,stock_status:e.target.value}),children:[(0,a.jsx)("option",{value:"in_stock",children:"In Stock"}),(0,a.jsx)("option",{value:"out_of_stock",children:"Out of Stock"})]})]}),(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Image URL"}),(0,a.jsx)("input",{type:"text",className:"wb-input",value:(null==(n=e0.image_urls)?void 0:n[0])||"",onChange:e=>e1({...e0,image_urls:e.target.value?[e.target.value]:[]}),placeholder:"https://..."})]}),(0,a.jsxs)("div",{className:"wb-modal-actions",children:[(0,a.jsx)("button",{className:"wb-btn-text",onClick:()=>e1(null),children:"Cancel"}),(0,a.jsx)("button",{className:"wb-btn-primary",onClick:()=>sw(e0),children:e0.id?"Update Product":"Save Product"})]})]})}),e0&&!eP&&(0,a.jsx)("div",{className:"wb-modal-overlay",children:(0,a.jsxs)("div",{className:"wb-modal wb-modal-wide",children:[(0,a.jsxs)("div",{className:"wb-modal-head",children:[(0,a.jsx)("h2",{children:e0.id?"Edit Product":"New Product"}),(0,a.jsx)("button",{className:"wb-icon-btn",onClick:()=>e1(null),children:(0,a.jsx)(l.A,{size:20})})]}),(0,a.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"2fr 1fr",gap:24},children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Product Title"}),(0,a.jsx)("input",{type:"text",className:"wb-input",value:e0.title||"",onChange:e=>e1({...e0,title:e.target.value}),placeholder:"e.g. Vintage T-Shirt"})]}),(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Description"}),(0,a.jsx)(eo,{content:e0.description||"",onChange:e=>e1({...e0,description:e})})]}),(0,a.jsxs)("div",{className:"wb-widget",style:{marginBottom:16},children:[(0,a.jsxs)("h2",{className:"wb-widget-title",style:{display:"flex",gap:10,alignItems:"center"},children:[(0,a.jsx)(p.A,{size:16})," Product Data"]}),(0,a.jsxs)("div",{className:"wb-widget-content",style:{padding:"16px 20px"},children:[(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Product Type"}),(0,a.jsxs)("select",{className:"wb-select",value:e0.product_type||"simple",onChange:e=>e1({...e0,product_type:e.target.value}),children:[(0,a.jsx)("option",{value:"simple",children:"Simple Product"}),(0,a.jsx)("option",{value:"variable",children:"Variable Product"}),(0,a.jsx)("option",{value:"booking",children:"Booking / Reservation"})]})]}),"variable"!==e0.product_type&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{style:{display:"flex",gap:16},children:[(0,a.jsxs)("div",{className:"wb-form-group",style:{flex:1},children:[(0,a.jsx)("label",{children:"Regular Price ($)"}),(0,a.jsx)("input",{type:"number",className:"wb-input",value:e0.price||"",onChange:e=>e1({...e0,price:Number(e.target.value)})})]}),(0,a.jsxs)("div",{className:"wb-form-group",style:{flex:1},children:[(0,a.jsx)("label",{children:"Sale Price ($)"}),(0,a.jsx)("input",{type:"number",className:"wb-input",value:e0.sale_price||"",onChange:e=>e1({...e0,sale_price:Number(e.target.value)})})]})]}),(0,a.jsx)("hr",{style:{border:"none",borderTop:"1px solid #f0f
10f1",margin:"16px 0"}}),(0,a.jsx)("h3",{style:{fontSize:13,marginBottom:12},children:"Inventory"}),(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"SKU"}),(0,a.jsx)("input",{type:"text",className:"wb-input",value:e0.sku||"",onChange:e=>e1({...e0,sku:e.target.value})})]}),(0,a.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:16,cursor:"pointer",fontSize:13},children:[(0,a.jsx)("input",{type:"checkbox",checked:e0.manage_stock||!1,onChange:e=>e1({...e0,manage_stock:e.target.checked})}),"Track stock quantity"]}),e0.manage_stock?(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Stock Quantity"}),(0,a.jsx)("input",{type:"number",className:"wb-input",value:e0.stock_quantity||0,onChange:e=>e1({...e0,stock_quantity:Number(e.target.value)})})]}):(0,a.jsxs)("div",{className:"wb-form-group",children:[(0,a.jsx)("label",{children:"Stock Status"}),(0,a.jsxs)("select",{className:"wb-select",value:e0.stock_status||"instock",onChange:e=>e1({...e0,stock_status:e.target.value}),children:[(0,a.jsx)("option",{value:"instock",children:"In stock"}),(0,a.jsx)("option",{value:"outofstock",children:"Out of stock"}),(0,a.jsx)("option",{value:"onbackorder",children:"On backorder"})]})]})]}),"variable"===e0.product_type&&(0,a.jsxs)("div",{style:{marginTop:16},children:[(0,a.jsx)("hr",{style:{border:"none",borderTop:"1px solid #f0f0f1",margin:"16px 0"}}),(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[(0,a.jsx)("h3",{style:{fontSize:13,margin:0},children:"Variations"}),(0,a.jsxs)("button",{className:"wb-btn-secondary",style:{padding:"4px 8px",fontSize:12},onClick:()=>e4([...e2,{id:"temp-".concat(Date.now()),attributes:{Size:"Small"},price:0,stock_quantity:0,manage_stock:!0}]),children:[(0,a.jsx)(g.A,{size:12})," Add Variation"]})]}),e2.map((e,s)=>(0,a.jsx)("div",{style:{padding:12,border:"1px solid #c3c4c7",borderRadius:4,marginBottom:12,background:"#f6f7f7"},children:(0,a.jsxs)("div",{style:{display:"flex",gap:12,marginBottom:8},children:[(0,a.jsxs)("div",{style:{flex:1},children:[(0,a.jsx)("label",{style:{fontSize:11,display:"block",marginBottom:4},children:"Attributes (JSON)"}),(0,a.jsx)("input",{type:"text",className:"wb-input",style:{padding:"4px 8px",fontSize:12},value:JSON.stringify(e.attributes),onChange:e=>{try{let t=JSON.parse(e.target.value),a=[...e2];a[s].attributes=t,e4(a)}catch(e){}}})]}),(0,a.jsxs)("div",{style:{flex:1},children:[(0,a.jsx)("label",{style:{fontSize:11,display:"block",marginBottom:4},children:"Price ($)"}),(0,a.jsx)("input",{type:"number",className:"wb-input",style:{padding:"4px 8px",fontSize:12},value:e.price||"",onChange:e=>{let t=[...e2];t[s].price=Number(e.target.value),e4(t)}})]}),(0,a.jsxs)("div",{style:{flex:1},children:[(0,a.jsx)("label",{style:{fontSize:11,display:"block",marginBottom:4},children:"Stock Qty"}),(0,a.jsx)("input",{type:"number",className:"wb-input",style:{padding:"4px 8px",fontSize:12},value:e.stock_quantity||0,onChange:e=>{let t=[...e2];t[s].stock_quantity=Number(e.target.value),e4(t)}})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{style:{fontSize:11,display:"block",marginBottom:4},children:"\xa0"}),(0,a.jsx)("button",{className:"wb-icon-btn danger",onClick:()=>e4(e2.filter((e,t)=>t!==s)),children:(0,a.jsx)(b.A,{size:14})})]})]})},e.id)),0===e2.length&&(0,a.jsx)("p",{style:{fontSize:12,color:"#646970"},children:"No variations added yet."})]})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"wb-widget",style:{marginBottom:16},children:[(0,a.jsx)("h2",{className:"wb-widget-title",children:"Publish"}),(0,a.jsx)("div",{className:"wb-widget-content",style:{padding:"16px 20px"},children:(0,a.jsxs)("div",{className:"wb-form-group",style:{marginBottom:0},children:[(0,a.jsx)("label",{children:"Status"}),(0,a.jsxs)("select",{className:"wb-select",value:e0.status||"draft",onChange:e=>e1({...e0,status:e.target.value}),children:[(0,a.jsx)("option",{value:"draft",children:"Draft"}),(0,a.jsx)("option",{value:"published",children:"Published"})]})]})})]}),(0,a.jsxs)("div",{className:"wb-widget",style:{marginBottom:16},children:[(0,a.jsx)("h2",{className:"wb-widget-title",children:"Product Image"}),(0,a.jsx)("div",{className:"wb-widget-content",style:{padding:"16px 20px"},children:e0.featured_image_url?(0,a.jsxs)("div",{style:{position:"relative",display:"inline-block",width:"100%"},children:[(0,a.jsx)("img",{src:e0.featured_image_url,alt:"Product",style:{width:"100%",height:160,borderRadius:6,objectFit:"cover",display:"block",marginBottom:8}}),(0,a.jsx)("button",{className:"wb-btn-text",style:{padding:"0",fontSize:12,color:"#d63638"},onClick:()=>e1({...e0,featured_image_url:""}),children:"Remove product image"})]}):(0,a.jsx)("button",{className:"wb-btn-secondary",style:{width:"100%"},onClick:()=>{e7("product_featured"),e8(!0)},children:"Set product image"})})]}),(0,a.jsxs)("div",{className:"wb-widget",children:[(0,a.jsx)("h2",{className:"wb-widget-title",children:"Organization"}),(0,a.jsxs)("div",{className:"wb-widget-content",style:{padding:"16px 20px"},children:[(0,a.jsx)(er,{label:"Categories",values:e0.categories||[],onChange:e=>e1({...e0,categories:e}),placeholder:"e.g. Clothing"}),(0,a.jsx)(er,{label:"Tags",values:e0.tags||[],onChange:e=>e1({...e0,tags:e}),placeholder:"Add tag..."})]})]})]})]}),(0,a.jsxs)("div",{className:"wb-modal-actions",style:{marginTop:24,paddingTop:16,borderTop:"1px solid #f0f
10f1"},children:[(0,a.jsx)("button",{className:"wb-btn-text",onClick:()=>e1(null),children:"Cancel"}),(0,a.jsx)("button",{className:"wb-btn-primary",onClick:()=>sw(e0),children:e0.id?"Update Product":"Save Product"})]})]})}),e6&&v&&(0,a.jsx)(eu,{siteId:v.id,storageBucket:v.storage_bucket,onSelect:e=>{"featured"===e3?sj({featured_image_url:e}):"og_image_post"===e3?sj({og_image:e}):"og_image_page"===e3?eZ&&eQ({...eZ,og_image:e}):"product_featured"===e3&&e0&&e1({...e0,featured_image_url:e}),e8(!1)},onClose:()=>e8(!1)})]})}},6101:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(12119).A)("redo-2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]])},7466:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(12119).A)("heart-handshake",[["path",{d:"M19.414 14.414C21 12.828 22 11.5 22 9.5a5.5 5.5 0 0 0-9.591-3.676.6.6 0 0 1-.818.001A5.5 5.5 0 0 0 2 9.5c0 2.3 1.5 4 3 5.5l5.535 5.362a2 2 0 0 0 2.879.052 2.12 2.12 0 0 0-.004-3 2.124 2.124 0 1 0 3-3 2.124 2.124 0 0 0 3.004 0 2 2 0 0 0 0-2.828l-1.881-1.882a2.41 2.41 0 0 0-3.409 0l-1.71 1.71a2 2 0 0 1-2.828 0 2 2 0 0 1 0-2.828l2.823-2.762",key:"17lmqv"}]])},9708:(e,s,t)=>{"use strict";t.d(s,{sR:()=>g,u$:()=>b});var a=t(54568);t(7620);var i=t(89481),l=t(95355),n=t(18937),r=t(7466),o=t(2934),d=t(73102),c=t(19146),p=t(54925),h=t(889),u=t(13508),m=t(52744);let x={business:{label:"Business",icon:(0,a.jsx)(l.A,{size:24}),color:"#3b82f6",description:"Local shops, restaurants, and professional services."},artist:{label:"Artist / Creator",icon:(0,a.jsx)(n.A,{size:24}),color:"#d946ef",description:"Musicians, visual artists, and content creators."},non_profit:{label:"Non-Profit",icon:(0,a.jsx)(r.A,{size:24}),color:"#10b981",description:"Charities and 501(c)(3) organizations."},venue:{label:"Venue",icon:(0,a.jsx)(o.A,{size:24}),color:"#f59e0b",description:"Event spaces, theaters, and concert halls."},official:{label:"Government / Civic",icon:(0,a.jsx)(d.A,{size:24}),color:"#64748b",description:"City officials, municipalities, and public services."},chamber:{label:"Chamber of Commerce",icon:(0,a.jsx)(c.A,{size:24}),color:"#0ea5e9",description:"Business networks and economic development."},media:{label:"Media & News",icon:(0,a.jsx)(p.A,{size:24}),color:"#ef4444",description:"Local news, podcasts, and publications."},church:{label:"Church / Faith",icon:(0,a.jsx)(h.A,{size:24}),color:"#8b5cf6",description:"Congregations and religious organizations."},professional:{label:"Professional",icon:(0,a.jsx)(c.A,{size:24}),color:"#06b6d4",description:"Individual professional or freelancer identity."},restaurant:{label:"Restaurant",icon:(0,a.jsx)(l.A,{size:24}),color:"#f97316",description:"Restaurants, cafes, food trucks, and eateries."},retail:{label:"Retail",icon:(0,a.jsx)(l.A,{size:24}),color:"#3b82f6",description:"Retail shops, boutiques, and brick-and-mortar stores."},service:{label:"Service",icon:(0,a.jsx)(c.A,{size:24}),color:"#8b5cf6",description:"Service-based businesses and independent contractors."},sports_team:{label:"Sports Team",icon:(0,a.jsx)(u.A,{size:24}),color:"#eab308",description:"School, league, or club teams. Residents can follow you for schedules and updates."}},b=["retail","restaurant","service","artist"],g=e=>{let{types:s,selectedType:t,onSelect:l}=e;return(0,a.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(250px, 1fr))",gap:"16px"},children:s.map(e=>{let s=x[e],n=t===e;return(0,a.jsxs)(i.P.div,{whileHover:{scale:1.02},whileTap:{scale:.98},onClick:()=>l(e),role:"button",tabIndex:0,"aria-label":s.label,onKeyDown:s=>{("Enter"===s.key||" "===s.key)&&(s.preventDefault(),l(e))},style:{background:n?"color-mix(in srgb, var(--primary) 10%, transparent)":"var(--glass-bg)",border:"2px solid ".concat(n?"var(--primary)":"var(--border)"),borderRadius:"16px",padding:"24px",cursor:"pointer",display:"flex",flexDirection:"column",gap:"12px",position:"relative"},children:[(0,a.jsx)("div",{style:{color:s.color,background:"".concat(s.color,"20"),width:48,height:48,borderRadius:"12px",display:"flex",alignItems:"center",justifyContent:"center"},children:s.icon}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{style:{margin:0,fontSize:"1.2rem",fontWeight:700,color:"var(--text)"},children:s.label}),(0,a.jsx)("p",{style:{margin:"8px 0 0 0",fontSize:"0.9rem",color:"var(--text-muted)"},children:s.description})]}),n&&(0,a.jsx)("div",{style:{position:"absolute",top:16,right:16,color:"var(--primary)"},children:(0,a.jsx)(m.A,{size:24})})]},e)})})}},13227:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(12119).A)("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]])},17023:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});
1let a=(0,t(12119).A)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},32158:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(12119).A)("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]])},34543:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(12119).A)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]])},40590:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(12119).A)("tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]])},44912:(e,s,t)=>{"use strict";t.d(s,{A:()=>p});var a=t(54568),i=t(7620),l=t(99935),n=t(17023),r=t(60844),o=t(2167),d=t(12494),c=t(90008);let p=e=>{let{storeId:s}=e,[t,p]=(0,i.useState)([]),[h,u]=(0,i.useState)(!0),[m,x]=(0,i.useState)(""),[b,g]=(0,i.useState)(!1),[j,y]=(0,i.useState)(null),[f,w]=(0,i.useState)(!1),v=async()=>{let{data:{session:e}}=await c.supabase.auth.getSession(),s=await fetch("/api/sync/keys",{headers:{Authorization:"Bearer ".concat(null==e?void 0:e.access_token)}});p((await s.json()).keys||[]),u(!1)};(0,i.useEffect)(()=>{v()},[]);let N=async()=>{if(!m.trim())return;g(!0);let{data:{session:e}}=await c.supabase.auth.getSession(),t=await fetch("/api/sync/keys",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(null==e?void 0:e.access_token)},body:JSON.stringify({label:m.trim(),store_id:s||null})}),a=await t.json();g(!1),a.key&&(y(a.key.plaintext),x(""),v())},k=async e=>{if(!window.confirm("Revoke this key? Anything using it will stop working immediately."))return;let{data:{session:s}}=await c.supabase.auth.getSession();await fetch("/api/sync/keys",{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(null==s?void 0:s.access_token)},body:JSON.stringify({id:e})}),v()};return(0,a.jsxs)("div",{className:"wb-widget",children:[(0,a.jsx)("h2",{className:"wb-widget-title",children:"Sync API Keys"}),(0,a.jsxs)("div",{className:"wb-widget-content",style:{padding:"16px 20px 20px"},children:[(0,a.jsx)("p",{style:{fontSize:12,color:"#646970",marginTop:0,marginBottom:16},children:"Let an external site push products, events, or articles into SETX 360 search."}),j&&(0,a.jsxs)("div",{style:{background:"#eafaf1",border:"1px solid #10b981",borderRadius:8,padding:12,marginBottom:16},children:[(0,a.jsxs)("p",{style:{fontSize:12,fontWeight:600,margin:"0 0 6px",display:"flex",alignItems:"center",gap:6},children:[(0,a.jsx)(l.A,{size:14,color:"#10b981"})," Copy this key now -- it won't be shown again."]}),(0,a.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[(0,a.jsx)("code",{style:{flex:1,fontSize:11,background:"#fff",padding:"6px 8px",borderRadius:4,overflowX:"auto",whiteSpace:"nowrap"},children:j}),(0,a.jsx)("button",{className:"wb-icon-btn",onClick:()=>{navigator.clipboard.writeText(j),w(!0),setTimeout(()=>w(!1),1500)},children:f?(0,a.jsx)(l.A,{size:15,color:"#10b981"}):(0,a.jsx)(n.A,{size:15})})]})]}),h?(0,a.jsx)(r.A,{size:18,className:"wb-spinner"}):(0,a.jsxs)(a.Fragment,{children:[0===t.length&&(0,a.jsx)("p",{style:{fontSize:13,color:"#aaa"},children:"No keys yet."}),t.map(e=>(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 0",borderBottom:"1px solid #f0f0f1"},children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("strong",{style:{fontSize:13},children:e.label}),(0,a.jsx)("div",{style:{fontSize:11,color:"#aaa"},children:"revoked"===e.status?"Revoked":e.last_used_at?"Last used ".concat(new Date(e.last_used_at).toLocaleDateString()):"Never used"})]}),"active"===e.status&&(0,a.jsx)("button",{className:"wb-icon-btn danger",onClick:()=>k(e.id),children:(0,a.jsx)(o.A,{size:14})})]},e.id)),(0,a.jsxs)("div",{style:{display:"flex",gap:8,marginTop:16},children:[(0,a.jsx)("input",{type:"text",className:"wb-input",placeholder:"Key label, e.g. My POS integration",value:m,onChange:e=>x(e.target.value),style:{flex:1}}),(0,a.jsx)("button",{className:"wb-btn-secondary",onClick:N,disabled:b||!m.trim(),children:b?(0,a.jsx)(r.A,{size:14,className:"wb-spinner"}):(0,a.jsx)(d.A,{size:14})})]})]})]})]})}},80229:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(12119).A)("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]])},85240:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(12119).A)("user-plus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]])},92214:()=>{}}]);
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.