1/*! For license information please see 7297.36a0c1b5.chunk.js.LICENSE.txt */ 2"use strict";(globalThis.webpackChunkknitify_ai=globalThis.webpackChunkknitify_ai||[]).push([[7297],{12492(e,t,r){r.r(t),r.d(t,{default:()=>oe});var s=r(92166),a=r(99103),n=r(43830),i=r(6540),o=r(71823),l=r(1053),d=r(97154),c=r(69755),x=r(99519),h=r(34412),p=r(49307),u=r(37218),g=r(3929),m=r(81347),b=r(44487),y=r(60881),f=r(77674),A=r(52440),j=r(11621),v=r(24901),w=r(93126),k=r(87282),C=r(60082),S=r(35605),z=r(86577),P=r(91289),M=r(87592),W=r(5193),R=r(11405),I=r(83677),B=r(61112),L=r(74524),_=r(19586),$=r(20327),T=r(74178),F=r(39250),q=r(99292),H=r(31523),U=r(62176),D=r(84827),E=r(23723),N=r(20131),V=r(24184),O=r(41619),Y=r(12306),G=r(45928),Q=r(72302),J=r(44746),K=r(21405),Z=r(89606),X=r(12425),ee=r(10572),te=r(32699),re=r(64304),se=r(38011),ae=r(10422);const ne=e=>({profession:{primary:"#667eea",secondary:"#8b9cff"},brand_voice:{primary:"#10b981",secondary:"#34d399"},brand_tone:{primary:"#f59e0b",secondary:"#fbbf24"}}[e]),ie=e=>{let{initialTab:t,hideTabNav:r=!1}=e;const{t:ie}=(0,se.Bd)(),oe=(0,n.Zp)(),[le]=(0,n.ok)(),de=r?t||"products":le.get("tab")||t||"products",[ce,xe]=(0,s.useState)(null),[he,pe]=(0,s.useState)(null),[ue,ge]=(0,s.useState)(!0),[me,be]=(0,s.useState)(!1),[ye,fe]=(0,s.useState)(null),[Ae,je]=(0,s.useState)(null),[ve,we]=(0,s.useState)(""),[ke,Ce]=(0,s.useState)(""),[Se,ze]=(0,s.useState)(!1),[Pe,Me]=(0,s.useState)("consumer"),[We,Re]=(0,s.useState)(""),[Ie,Be]=(0,s.useState)(de),[Le,_e]=(0,s.useState)(""),[$e,Te]=(0,s.useState)(!1),[Fe,qe]=(0,s.useState)(""),[He,Ue]=(0,s.useState)(""),[De,Ee]=(0,s.useState)(""),[Ne,Ve]=(0,s.useState)("#667eea"),[Oe,Ye]=(0,s.useState)("#ffffff"),[Ge,Qe]=(0,s.useState)(""),[Je,Ke]=(0,s.useState)(null),[Ze,Xe]=(0,s.useState)(!1),[et,tt]=(0,s.useState)(""),[rt,st]=(0,s.useState)(""),[at,nt]=(0,s.useState)(!1),[it,ot]=(0,s.useState)([]),[lt,dt]=(0,s.useState)(!1),[ct,xt]=(0,s.useState)(!1),[ht,pt]=(0,s.useState)(null),[ut,gt]=(0,s.useState)(""),[mt,bt]=(0,s.useState)(""),[yt,ft]=(0,s.useState)(!0),[At,jt]=(0,s.useState)(!1),[vt,wt]=(0,s.useState)(null),[kt,Ct]=(0,s.useState)(null),[St,zt]=(0,s.useState)("content"),[Pt,Mt]=(0,s.useState)([]),[Wt,Rt]=(0,s.useState)([]),[It,Bt]=(0,s.useState)(""),[Lt,_t]=(0,s.useState)(""),[$t,Tt]=(0,s.useState)(""),Ft=["dashboard","campaigns","campaign","login","signup","forgot-password","reset-password","builder","brand-hub","transactions","membership","settings","research-hub","terms","api","public","admin","user","profile","preferences","products","assets"];(0,s.useEffect)(()=>{qt()},[]),(0,s.useEffect)(()=>{if(!r){const e=le.get("tab")||"products";e!==Ie&&Be(e)}},[le,r]),(0,s.useEffect)(()=>{"public-page"===Ie&&Ut()},[Ie]),(0,s.useEffect)(()=>{if(!Le||Le.length<3)return Ke(null),void Xe(!1);if(Ht(Le))return Ke(null),void Xe(!1);Xe(!0);const e=setTimeout(async()=>{try{const e=await i.FH.get(`/profile/check-handler/${Le}`);Ke(e.data.available),!e.data.available&&e.data.reason&&Qe(e.data.reason)}catch(e){a.R.error("Handler availability check failed",{handler:Le,error:e}),Ke(null)}finally{Xe(!1)}},300);return()=>clearTimeout(e)},[Le]),(0,s.useEffect)(()=>{!Le&&$e&&Te(!1)},[Le,$e]);const qt=async()=>{try{var e,t;ge(!0);const[r,s]=await Promise.all([i.gu.getPreferences(),i.gu.getOptions()]);xe(r),pe(s),_e(r.handler||""),Te(r.page_enabled||!1),qe(r.bio||""),Ue(r.company||""),Ee(r.link||""),Ve((null===(e=r.page_config)||void 0===e?void 0:e.banner_color)||"#667eea"),Ye((null===(t=r.page_config)||void 0===t?void 0:t.text_color)||"#ffffff");const a=r.logo_url;tt(a?`${a}?t=${Date.now()}`:"")}catch(r){fe("Failed to load profile data"),a.R.error("Profile data fetch failed",{error:r})}finally{ge(!1)}},Ht=e=>e?e.length<3?"Handler must be at least 3 characters":Ft.includes(e)?"This URL is reserved and cannot be used":"":"",Ut=async()=>{try{dt(!0);const e=await i.FH.get("/brand-content/mine");ot(e.data)}catch(e){a.R.error("Contents fetch failed",{error:e}),fe("Failed to load contents")}finally{dt(!1)}},Dt=e=>{e?(pt(e),gt(e.title),bt(e.content_html),ft(e.viewable),Mt(e.faq||[]),Rt(e.products||[]),Bt(e.meta_description||""),_t(e.url_slug||"")):(pt(null),gt(""),bt(""),ft(!0),Mt([]),Rt([]),Bt(""),_t("")),zt("content"),Tt(""),xt(!0)},Et=()=>{xt(!1),pt(null),gt(""),bt(""),ft(!0),Mt([]),Rt([]),Bt(""),_t(""),zt("content"),Tt("")},Nt=e=>{switch(e){case"profession":return(0,ae.jsx)(L.A,{});case"brand_voice":return(0,ae.jsx)(_.A,{});case"brand_tone":return(0,ae.jsx)($.A,{});default:return null}},Vt=e=>{switch(e){case"profession":return"Professional Identity";case"brand_voice":return"Brand Voice";case"brand_tone":return"Brand Tone";default:return""}},Ot=e=>{switch(e){case"profession":return"Define your professional expertise and specialization";case"brand_voice":return"The personality and style of your communication";
2case"brand_tone":return"The emotional quality and mood of your content";default:return""}},Yt=()=>(0,ae.jsxs)(o.A,{maxWidth:"lg",children:[(0,ae.jsxs)(l.A,{sx:{mb:4},children:[(0,ae.jsx)(d.A,{variant:"text",width:200,height:40}),(0,ae.jsx)(d.A,{variant:"text",width:400,height:24,sx:{mt:1}})]}),(0,ae.jsx)(c.Ay,{container:!0,spacing:3,children:[1,2,3].map(e=>(0,ae.jsx)(c.Ay,{item:!0,xs:12,md:4,children:(0,ae.jsx)(d.A,{variant:"rectangular",height:280,sx:{borderRadius:3}})},e))})]});return ue?(0,ae.jsx)(Yt,{}):(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsxs)(o.A,{maxWidth:"lg",sx:{position:"relative"},children:[(0,ae.jsx)(l.A,{sx:{position:"absolute",top:-40,left:0,right:0,height:300,background:"linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%)",zIndex:-1,borderRadius:4}}),(0,ae.jsxs)(l.A,{sx:{mb:6},children:[(0,ae.jsxs)(l.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,"@media (max-width: 768px)":{flexDirection:"column",alignItems:"flex-start",gap:2}},children:[(0,ae.jsx)(x.A,{variant:"text",startIcon:(0,ae.jsx)(T.A,{size:20}),onClick:()=>oe(r?"/apps-hub":"/dashboard"),sx:{color:"text.secondary","@media (max-width: 768px)":{fontSize:12,padding:"6px 12px","& .MuiButton-startIcon":{marginRight:"4px","& svg":{width:14,height:14}}}},children:r?"Apps":"Dashboard"}),"public-page"===Ie&&Le&&$e&&(0,ae.jsx)(x.A,{variant:"contained",startIcon:(0,ae.jsx)(F.A,{size:18}),onClick:()=>window.open(`/brands/${Le}`,"_blank"),sx:{background:"linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%)",color:"white",textTransform:"none",fontWeight:600,px:3,py:1,borderRadius:2,boxShadow:"0 4px 12px rgba(236, 72, 153, 0.3)","&:hover":{background:"linear-gradient(135deg, #db2777 0%, #7c3aed 100%)",boxShadow:"0 6px 16px rgba(236, 72, 153, 0.4)",transform:"translateY(-2px)"},transition:"all 0.3s ease","@media (max-width: 768px)":{fontSize:12,px:2,py:.75,"& .MuiButton-startIcon":{marginRight:"4px","& svg":{width:14,height:14}}}},children:ie("View Public Page")})]}),(0,ae.jsxs)(l.A,{sx:{display:"flex",alignItems:"center",mb:2},children:[(0,ae.jsx)(l.A,{sx:{p:2,borderRadius:3,background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",color:"white",mr:3,display:"flex",alignItems:"center",justifyContent:"center","@media (max-width: 768px)":{p:1.5,mr:2,"& svg":{width:24,height:24}}},children:(0,ae.jsx)(q.A,{size:32})}),(0,ae.jsxs)(l.A,{children:[(0,ae.jsx)(h.A,{variant:"h3",component:"h1",sx:{fontWeight:700,background:"linear-gradient(135deg, #1f2937 0%, #667eea 100%)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text","@media (max-width: 768px)":{fontSize:28}},children:ie("Apps")}),(0,ae.jsx)(h.A,{variant:"h6",color:"text.secondary",sx:{opacity:.8,"@media (max-width: 768px)":{fontSize:14}},children:ie("Manage your brand identity and business assets")})]})]})]}),!r&&(0,ae.jsx)(p.A,{sx:{mb:4,borderRadius:2},children:(0,ae.jsxs)(u.A,{value:Ie,onChange:(e,t)=>
2Be(t),sx:{borderBottom:1,borderColor:"divider","& .MuiTab-root":{textTransform:"none",fontWeight:500,fontSize:16,minHeight:64,px:3}},children:[(0,ae.jsx)(g.A,{label:ie("Products & Services"),value:"products",icon:(0,ae.jsx)(H.A,{size:20}),iconPosition:"start"}),(0,ae.jsx)(g.A,{label:ie("Brand Preferences"),value:"preferences",icon:(0,ae.jsx)(U.A,{size:20}),iconPosition:"start"}),(0,ae.jsx)(g.A,{label:ie("Public Brand Page"),value:"public-page",icon:(0,ae.jsx)(F.A,{size:20}),iconPosition:"start"})]})}),"preferences"===Ie&&(0,ae.jsxs)(ae.Fragment,{children:[We&&(0,ae.jsx)(m.A,{in:!!We,children:(0,ae.jsx)(b.A,{severity:"success",icon:(0,ae.jsx)(D.A,{size:16}),sx:{mb:3},onClose:()=>Re(""),children:We})}),ye&&(0,ae.jsx)(m.A,{in:!!ye,children:(0,ae.jsx)(b.A,{severity:"error",sx:{mb:3},onClose:()=>fe(null),children:ye})}),(0,ae.jsx)(c.Ay,{container:!0,spacing:4,sx:{mb:6},children:["profession","brand_voice","brand_tone"].map((e,t)=>{const r=null===ce||void 0===ce?void 0:ce[e],s=!!r,a={profession:{primary:"#667eea",secondary:"#8b9cff"},brand_voice:{primary:"#10b981",secondary:"#34d399"},brand_tone:{primary:"#f59e0b",secondary:"#fbbf24"}}[e];return(0,ae.jsx)(c.Ay,{item:!0,xs:12,md:4,children:(0,ae.jsx)(y.A,{elevation:3,sx:{height:"100%",cursor:"pointer",background:"linear-gradient(145deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.9) 100%)",backdropFilter:"blur(20px)",border:`2px solid ${s?a.primary:"rgba(0,0,0,0.1)"}`,borderRadius:3,transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",position:"relative",overflow:"visible","&:before":{content:'""',position:"absolute",top:0,left:0,right:0,height:"4px",background:`linear-gradient(90deg, ${a.primary} 0%, ${a.secondary} 100%)`,borderRadius:"12px 12px 0 0",opacity:s?1:0,transition:"opacity 0.3s ease"},"&:hover":{transform:"translateY(-6px) scale(1.02)",boxShadow:`0px 20px 40px ${a.primary}20, 0px 8px 16px rgba(0, 0, 0, 0.1)`,borderColor:a.primary,"&:before":{opacity:1}}},onClick:()=>(e=>{var t;je(e),ze(!1),Ce("");const r=(null===ce||void 0===ce||null===(t=ce[e])||void 0===t?void 0:t.value)||"";we(r)})(e),children:(0,ae.jsxs)(f.A,{sx:{p:{xs:2,sm:4},pb:2},children:[(0,ae.jsxs)(l.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:{xs:2,sm:3}},children:[(0,ae.jsx)(l.A,{sx:{width:{xs:40,sm:56},height:{xs:40,sm:56},borderRadius:2,background:`linear-gradient(135deg, ${a.primary} 0%, ${a.secondary} 100%)`,color:"white",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:`0px 4px 12px ${a.primary}30`,"& svg":{width:{xs:20,sm:24},height:{xs:20,sm:24}}},children:Nt(e)}),(0,ae.jsx)(E.A,{size:20,color:a.primary})]}),(0,ae.jsx)(h.A,{variant:"h5",fontWeight:600,gutterBottom:!0,sx:{fontSize:{xs:"1.1rem",sm:"1.5rem"}},children:Vt(e)}),(0,ae.jsx)(h.A,{variant:"body2",color:"text.secondary",sx:{mb:{xs:2,sm:3},fontSize:{xs:"0.8rem",sm:"0.875rem"}},children:Ot(e)}),(0,ae.jsx)(l.A,{sx:{p:{xs:1.5,sm:2},borderRadius:2,bgcolor:s?`${a.primary}08`:"grey.50",border:"1px solid "+(s?`${a.primary}20`:"rgba(0,0,0,0.08)"),minHeight:{xs:60,sm:80},display:"flex",flexDirection:"column",justifyContent:"center"},children:s?(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsxs)(l.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",mb:1},children:[(0,ae.jsx)(h.A,{variant:"subtitle2",fontWeight:600,color:a.primary,sx:{fontSize:{xs:"0.8rem",sm:"0.875rem"}},children:r.is_custom?`Custom ${Vt(e)}`:r.display_name}),r.is_custom&&(0,ae.jsx)(A.A,{label:ie("Custom"),size:"small",sx:{bgcolor:a.primary,color:"white",fontSize:11,height:20}})]}),(0,ae.jsx)(h.A,{variant:"body2",color:"text.secondary",sx:{fontSize:{xs:"0.75rem",sm:"0.875rem"}},children:r.description||r.value})]}):(0,ae.jsxs)(h.A,{variant:"body2",color:"text.secondary",sx:{textAlign:"center",fontStyle:"italic",display:"flex",alignItems:"center",justifyContent:"center",gap:1,fontSize:{xs:"0.75rem",sm:"0.875rem"}},children:[(0,ae.jsx)(N.A,{size:14}),ie("Click to configure")]})})]})})},e)})}),(0,ae.jsxs)(p.A,{elevation:2,sx:{p:4,background:"linear-gradient(145deg, rgba(102, 126, 234, 0.03) 0%, rgba(118, 75, 162, 0.03) 100%)",border:"1px solid rgba(102, 126, 234, 0.1)",borderRadius:3},children:[(0,ae.jsxs)(l.A,{sx:{display:"flex",alignItems:"center",mb:4},children:[(0,ae.jsx)(l.A,{sx:{p:1.5,borderRadius:2,background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",color:"white",mr:2,display:"flex",alignItems:"center",justifyContent:"center"},children:(0,ae.jsx)(V.A,{size:24})}),(0,ae.jsx)(h.A,{variant:"h4",fontWeight:600,color:"primary",children:ie("AI-Powered Personalization")})]}),(0,ae.jsxs)(c.Ay,{container:!0,spacing:3,children:[(0,ae.jsx)(c.Ay,{item:!0,xs:12,md:4,children:(0,ae.jsxs)(l.A,{sx:{display:"flex",alignItems:"flex-start"},children:[(0,ae.jsx)(l.A,{sx:{p:1,borderRadius:2,bgcolor:"warning.light",color:"warning.contrastText",mr:2,mt:.5},children:(0,ae.jsx)(O.A,{size:20})}),(0,ae.jsxs)(l.A,{children:[(0,ae.jsx)(h.A,{variant:"h6",fontWeight:600,gutterBottom:!0,children:ie("Consistent Voice")}),(0,ae.jsx)(h.A,{variant:"body2",color:"text.secondary",children:ie("Your preferences shape every piece of content generated by the AI")})]})]})}),(0,ae.jsx)(c.Ay,{item:!0,xs:12,md:4,children:(0,ae.jsxs)(l.A,{sx:{display:"flex",alignItems:"flex-start"},children:[(0,ae.jsx)(l.A,{sx:{p:1,borderRadius:2,bgcolor:"secondary.light",color:"secondary.c
2ontrastText",mr:2,mt:.5},children:(0,ae.jsx)(U.A,{size:20})}),(0,ae.jsxs)(l.A,{children:[(0,ae.jsx)(h.A,{variant:"h6",fontWeight:600,gutterBottom:!0,children:ie("Flexible Options")}),(0,ae.jsx)(h.A,{variant:"body2",color:"text.secondary",children:ie("Choose from professional presets or create custom values")})]})]})}),(0,ae.jsx)(c.Ay,{item:!0,xs:12,md:4,children:(0,ae.jsxs)(l.A,{sx:{display:"flex",alignItems:"flex-start"},children:[(0,ae.jsx)(l.A,{sx:{p:1,borderRadius:2,bgcolor:"primary.light",color:"primary.contrastText",mr:2,mt:.5},children:(0,ae.jsx)(q.A,{size:20})}),(0,ae.jsxs)(l.A,{children:[(0,ae.jsx)(h.A,{variant:"h6",fontWeight:600,gutterBottom:!0,children:ie("Smart Generation")}),(0,ae.jsx)(h.A,{variant:"body2",color:"text.secondary",children:ie("AI adapts to your unique professional brand identity")})]})]})})]})]})]}),"public-page"===Ie&&(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsxs)(p.A,{elevation:2,sx:{p:{xs:2,sm:3,md:4},mb:4,background:"linear-gradient(145deg, rgba(236, 72, 153, 0.03) 0%, rgba(124, 58, 237, 0.03) 100%)",border:"1px solid rgba(236, 72, 153, 0.1)",borderRadius:3},children:[(0,ae.jsxs)(l.A,{sx:{display:"flex",alignItems:"center",mb:3},children:[(0,ae.jsx)(Y.A,{size:24,style:{marginRight:"12px",color:"#ec4899"}}),(0,ae.jsx)(h.A,{variant:"h5",fontWeight:600,sx:{fontSize:{xs:"1.25rem",sm:"1.5rem"}},children:ie("Brand Page Settings")})]}),(0,ae.jsxs)(j.A,{spacing:3,children:[(0,ae.jsxs)(l.A,{children:[(0,ae.jsx)(h.A,{variant:"subtitle1",fontWeight:600,gutterBottom:!0,children:ie("Brand Logo")}),(0,ae.jsxs)(l.A,{sx:{display:"flex",gap:3,alignItems:"flex-start",flexWrap:"wrap"},children:[(0,ae.jsxs)(l.A,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:2},children:[(0,ae.jsx)(v.A,{src:et,alt:ie("Brand Logo"),sx:{width:100,height:100,border:"2px solid rgba(102, 126, 234, 0.2)",bgcolor:"rgba(102, 126, 234, 0.1)"},children:!et&&(0,ae.jsx)(G.A,{size:40})}),(0,ae.jsxs)(l.A,{sx:{display:"flex",gap:1},children:[(0,ae.jsx)("input",{accept:"image/*",style:{display:"none"},id:"logo-upload-file",type:"file",onChange:async e=>{var t;const r=null===(t=e.target.files)||void 0===t?void 0:t[0];if(r)if(r.type.startsWith("image/"))if(r.size>5242880)fe("File size must be less than 5MB");else try{nt(!0),fe("");const t=new FormData;t.append("logo_file",r);const s=`${(await i.FH.post("/profile/logo",t)).data.logo_url}?t=${Date.now()}`;tt(s),Re("Logo uploaded successfully!"),setTimeout(()=>Re(""),3e3),e.target.value=""}catch(o){var s,n;a.R.error("Logo upload failed",{error:o,file:null===r||void 0===r?void 0:r.name}),fe((null===(s=o.response)||void 0===s||null===(n=s.data)||void 0===n?void 0:n.detail)||"Failed to upload logo")}finally{nt(!1)}else fe("Please select an image file")},disabled:at}),(0,ae.jsx)("label",{htmlFor:"logo-upload-file",children:(0,ae.jsx)(x.A,{variant:"outlined",component:"span",size:"small",disabled:at,startIcon:at?(0,ae.jsx)(w.A,{size:16}):(0,ae.jsx)(Q.A,{size:16}),children:at?"Uploading...":"Upload"})}),et&&(0,ae.jsx)(k.A,{size:"small",onClick:async()=>{try{await i.FH.put("/profile/preferences",{logo_url:null}),tt(""),Re("Logo removed"),setTimeout(()=>Re(""),3e3)}catch(e){a.R.error("Logo removal failed",{error:e}),fe("Failed to remove logo")}},disabled:at,color:"error",children:(0,ae.jsx)(J.A,{size:16})})]})]}),(0,ae.jsxs)(l.A,{sx:{flex:1,minWidth:"250px"},children:[(0,ae.jsx)(h.A,{variant:"body2",color:"text.secondary",gutterBottom:!0,children:ie("Or paste image URL:")}),(0,ae.jsxs)(l.A,{sx:{display:"flex",gap:1},children:[(0,ae.jsx)(C.A,{size:"small",placeholder:"https://example.com/logo.png",value:rt,onChange:e=>st(e.target.value),disabled:at,fullWidth:!0}),(0,ae.jsx)(x.A,{variant:"contained",size:"small",onClick:async()=>{if(rt.trim())try{nt(!0),fe("");const e=new FormData;e.append("logo_url_source",rt);const t=`${(await i.FH.post("/profile/logo",e)).data.logo_url}?t=${Date.now()}`;tt(t),st(""),Re("Logo loaded from URL successfully!"),setTimeout(()=>Re(""),3e3)}catch(r){var e,t;fe((null===(e=r.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to load logo from URL"),a.R.error("Logo URL load failed",{logoSourceUrl:rt,error:r})}finally{nt(!1)}else fe("Please enter an image URL")},disabled:at||!rt.trim(),children:ie("Load")})]}),(0,ae.jsx)(h.A,{variant:"caption",color:"text.secondary",sx:{mt:1,display:"block"},children:ie("Max 5MB \u2022 Supported: JPG, PNG, WebP, SVG")})]})]})]}),(0,ae.jsx)(S.A,{}),(0,ae.jsx)(C.A,{label:ie("Page URL Handler"),value:Le,onChange:e=>(e=>{const t=e.toLowerCase().replace(/[^a-z0-9-]/g,"");_e(t),Qe(Ht(t))})(e.target.value),placeholder:ie("your-brand-name"),error:!!Ge,helperText:Ge||(Le?`Your page: ${window.location.origin}/brands/${Le}`:"Choose a unique URL for your brand page (3-50 characters, lowercase, letters, numbers, dashes only)"),fullWidth:!0,inputProps:{maxLength:50},InputProps:{endAdornment:(0,ae.jsxs)(l.A,{sx:{display:"flex",alignItems:"center",mr:1},children:[Ze&&(0,ae.jsx)(w.A,{size:20}),!Ze&&!0===Je&&!Ge&&(0,ae.jsx)(K.A,{size:20,color:"#10b981"}),!Ze&&!1===Je&&!Ge&&(0,ae.jsx)(Z.A,{size:20,color:"#ef4444"})]})}}
2),(0,ae.jsx)(C.A,{label:ie("Company/Brand Name"),value:He,onChange:e=>Ue(e.target.value),placeholder:ie("Your Company Name"),fullWidth:!0,inputProps:{maxLength:255},helperText:`${He.length}/255 characters - This will be displayed in the hero section of your brand page`}),(0,ae.jsx)(C.A,{label:ie("Bio"),value:Fe,onChange:e=>qe(e.target.value),placeholder:ie("Tell visitors about yourself and what you offer..."),multiline:!0,rows:4,fullWidth:!0,inputProps:{maxLength:500},helperText:`${Fe.length}/500 characters`}),(0,ae.jsx)(C.A,{label:ie("External Link (Optional)"),value:De,onChange:e=>Ee(e.target.value),placeholder:"https://example.com",fullWidth:!0,inputProps:{maxLength:500},helperText:ie("Add a link to your website, store, or other platform (max 500 characters)")}),(0,ae.jsxs)(l.A,{children:[(0,ae.jsx)(h.A,{variant:"subtitle2",gutterBottom:!0,sx:{mb:1},children:ie("Banner Color")}),(0,ae.jsxs)(l.A,{sx:{display:"flex",gap:2,alignItems:"center"},children:[(0,ae.jsx)("input",{type:"color",value:Ne,onChange:e=>Ve(e.target.value),style:{width:"60px",height:"40px",border:"1px solid #ddd",borderRadius:"4px",cursor:"pointer"}}),(0,ae.jsx)(C.A,{value:Ne,onChange:e=>Ve(e.target.value),placeholder:"#667eea",size:"small",sx:{width:"120px"},inputProps:{maxLength:7}}),(0,ae.jsx)(h.A,{variant:"caption",color:"text.secondary",children:ie("Choose the header background color for your brand page")})]})]}),(0,ae.jsxs)(l.A,{children:[(0,ae.jsx)(h.A,{variant:"subtitle2",gutterBottom:!0,sx:{mb:1},children:ie("Text Color")}),(0,ae.jsxs)(l.A,{sx:{display:"flex",gap:2,alignItems:"center"},children:[(0,ae.jsx)("input",{type:"color",value:Oe,onChange:e=>Ye(e.target.value),style:{width:"60px",height:"40px",border:"1px solid #ddd",borderRadius:"4px",cursor:"pointer"}}),(0,ae.jsx)(C.A,{value:Oe,onChange:e=>Ye(e.target.value),placeholder:"#ffffff",size:"small",sx:{width:"120px"},inputProps:{maxLength:7}}),(0,ae.jsx)(h.A,{variant:"caption",color:"text.secondary",children:ie("Choose the text color for company name, profession, and bio")})]})]}),(0,ae.jsxs)(l.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,ae.jsxs)(l.A,{children:[(0,ae.jsx)(h.A,{variant:"body1",fontWeight:600,children:ie("Make Page Public")}),(0,ae.jsx)(h.A,{variant:"body2",color:"text.secondary",children:Le?"Enable your brand page to be visible to visitors":"Set a Page URL Handler above to enable your brand page"})]}),(0,ae.jsx)(z.A,{checked:$e,onChange:e=>{!e.target.checked||Le?(fe(null),Te(e.target.checked)):fe("Please set a Page URL Handler before enabling your brand page")},disabled:!Le,sx:{"& .MuiSwitch-switchBase.Mui-checked":{color:"#ec4899"},"& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track":{backgroundColor:"#ec4899"}}})]}),(0,ae.jsxs)(l.A,{sx:{display:"flex",gap:2,flexWrap:"wrap"},children:[(0,ae.jsx)(x.A,{variant:"contained",onClick:async()=>{try{var e;if(be(!0),fe(null),Le){const e=Ht(Le);if(e)return Qe(e),fe(e),void be(!1)}if($e&&!Le)return fe("Please set a Page URL Handler before enabling your brand page"),void be(!1);const t={handler:Le||null,page_enabled:$e,bio:Fe||null,company:He||null,link:De||null,page_config:{banner_color:Ne,text_color:Oe}},r=await i.gu.updatePreferences(t);xe(r),_e(r.handler||""),Te(r.page_enabled||!1),qe(r.bio||""),Ue(r.company||""),Ee(r.link||""),Ve((null===(e=r.page_config)||void 0===e?void 0:e.banner_color)||"#667eea"),Re("Brand page settings saved successfully!"),setTimeout(()=>Re(""),3e3)}catch(s){var t,r;const e=(null===s||void 0===s||null===(t=s.response)||void 0===t||null===(r=t.data)||void 0===r?void 0:r.detail)||(null===s||void 0===s?void 0:s.message)||"Failed to save brand page settings";fe(e),a.R.error("Brand page settings save failed",{error:s})}finally{be(!1)}},disabled:me,sx:{flex:1,minWidth:"200px",background:"linear-gradient(135deg, #ec4899 0%, #7c3aed 100%)",color:"white","&:hover":{background:"linear-gradient(135deg, #db2777 0%, #6d28d9 100%)"}},children:me?"Saving...":"Save Brand Page Settings"}),Le&&$e&&(0,ae.jsx)(x.A,{variant:"outlined",onClick:()=>window.open(`/brands/${Le}`,"_blank"),sx:{flex:1,minWidth:"200px",borderColor:"#ec4899",color:"#ec4899","&:hover":{borderColor:"#db2777",bgcolor:"rgba(236, 72, 153, 0.08)"}},children:ie("View Public Page")})]})]})]}
2),(0,ae.jsx)(S.A,{sx:{my:5}}),(0,ae.jsxs)(l.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:4,flexWrap:"wrap",gap:2},children:[(0,ae.jsx)(h.A,{variant:"h5",fontWeight:600,sx:{fontSize:{xs:"1.25rem",sm:"1.5rem"}},children:ie("Blog Posts & Articles")}),(0,ae.jsx)(x.A,{variant:"contained",startIcon:(0,ae.jsx)(N.A,{size:20}),onClick:()=>Dt(),sx:{background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)","&:hover":{background:"linear-gradient(135deg, #5568d3 0%, #6a3f92 100%)"},fontSize:{xs:"0.875rem",sm:"1rem"},px:{xs:2,sm:3},py:{xs:.75,sm:1}},children:ie("Create Content")})]}),lt?(0,ae.jsx)(l.A,{sx:{display:"flex",justifyContent:"center",py:8},children:(0,ae.jsx)(w.A,{})}):0===it.length?(0,ae.jsxs)(p.A,{elevation:0,sx:{p:{xs:4,sm:6,md:8},textAlign:"center",border:"2px dashed rgba(0,0,0,0.1)",borderRadius:3},children:[(0,ae.jsx)(X.A,{size:48,style:{opacity:.3,marginBottom:16}}),(0,ae.jsx)(h.A,{variant:"h6",color:"text.secondary",gutterBottom:!0,sx:{fontSize:{xs:"1.1rem",sm:"1.25rem"}},children:ie("No content yet")}),(0,ae.jsx)(h.A,{variant:"body2",color:"text.secondary",sx:{mb:3,fontSize:{xs:"0.875rem",sm:"1rem"}},children:ie("Create your first blog post or article to share on your brand page")}),(0,ae.jsx)(x.A,{variant:"outlined",startIcon:(0,ae.jsx)(N.A,{size:20}),onClick:()=>Dt(),sx:{fontSize:{xs:"0.875rem",sm:"1rem"},px:{xs:2,sm:3}},children:ie("Create Your First Post")})]}):(0,ae.jsx)(j.A,{spacing:3,children:it.map(e=>(0,ae.jsx)(y.A,{elevation:2,sx:{border:"1px solid rgba(0,0,0,0.08)",borderRadius:2,transition:"all 0.3s ease","&:hover":{boxShadow:"0px 8px 24px rgba(0,0,0,0.1)",transform:"translateY(-2px)"}},children:(0,ae.jsx)(f.A,{sx:{p:{xs:2,sm:3}},children:(0,ae.jsxs)(l.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",flexDirection:{xs:"column",sm:"row"},gap:{xs:2,sm:0}},children:[(0,ae.jsxs)(l.A,{sx:{flex:1,width:{xs:"100%",sm:"auto"}},children:[(0,ae.jsxs)(l.A,{sx:{display:"flex",alignItems:"center",gap:2,mb:2,flexWrap:"wrap"},children:[(0,ae.jsx)(h.A,{variant:"h6",fontWeight:600,sx:{fontSize:{xs:"1rem",sm:"1.25rem"}},children:e.title}),(0,ae.jsx)(A.A,{label:e.viewable?"Published":"Draft",size:"small",color:e.viewable?"success":"default",sx:{height:24}})]}),(0,ae.jsx)(l.A,{sx:{mb:2,color:"text.secondary","& *":{display:"inline"}},children:(0,ae.jsxs)(h.A,{variant:"body2",color:"text.secondary",sx:{fontSize:{xs:"0.875rem",sm:"1rem"}},children:[e.content_html.replace(/<[^>]*>/g,"").substring(0,200),e.content_html.replace(/<[^>]*>/g,"").length>200?"...":""]})}),(0,ae.jsxs)(h.A,{variant:"caption",color:"text.secondary",sx:{fontSize:{xs:"0.7rem",sm:"0.75rem"}},children:[ie("Last updated:")," ",new Date(e.updated_at).toLocaleDateString()]})]}),(0,ae.jsxs)(l.A,{sx:{display:"flex",gap:2,ml:{xs:0,sm:2},justifyContent:{xs:"flex-end",sm:"flex-start"},alignItems:"center",width:{xs:"100%",sm:"auto"}},children:[(0,ae.jsxs)(l.A,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,ae.jsx)(h.A,{variant:"caption",color:"text.secondary",sx:{fontSize:12},children:e.viewable?"Published":"Draft"}),(0,ae.jsx)(z.A,{checked:e.viewable,onChange:()=>(async e=>{if(kt===e.id)return;Ct(e.id);const t=e.viewable,r=!e.viewable;ot(it.map(t=>t.id===e.id?{...t,viewable:r}:t));try{await i.FH.put(`/brand-content/${e.id}`,{viewable:r}),Re(`Content ${r?"published":"unpublished"} successfully!`),setTimeout(()=>Re(""),3e3)}catch(o){var s,n;a.R.error("Content viewable toggle failed",{contentId:e.id,newViewable:r,error:o}),ot(it.map(r=>r.id===e.id?{...r,viewable:t}:r));const i=(null===(s=o.response)||void 0===s||null===(n=s.data)||void 0===n?void 0:n.detail)||"Unknown error occurred";fe(`Failed to ${r?"publish":"unpublish"} "${e.title}": ${i}`)}finally{Ct(null)}})(e),disabled:kt===e.id,size:"small",sx:{"& .MuiSwitch-switchBase.Mui-checked":{color:"#10b981"},"& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track":{backgroundColor:"#10b981"}}})]}),(0,ae.jsx)(S.A,{orientation:"vertical",flexItem:!0,sx:{my:.5}}),(0,ae.jsx)(P.A,{title:ie("Edit"),children:(0,ae.jsx)(k.A,{size:"small",onClick:()=>Dt(e),color:"primary",children:(0,ae.jsx)(ee.A,{size:18})})}),(0,ae.jsx)(P.A,{title:ie("Delete"),children:(0,ae.jsx)(k.A,{size:"small",onClick:()=>{wt(e),jt(!0)},color:"error",children:(0,ae.jsx)(J.A,{size:18})})})]})]})})},e.id))})]}),"products"===Ie&&(0,ae.jsx)(re.A,{})]}),(0,ae.jsx)(M.A,{open:!!Ae,onClose:()=>je(null),maxWidth:"md",fullWidth:!0,PaperProps:{sx:{borderRadius:3,background:"linear-gradient(145deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.9) 100%)",backdropFilter:"blur(20px)"}},TransitionComponent:W.A,TransitionProps:{direction:"up"},children:Ae&&(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsxs)(R.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",pb:1,background:`linear-gradient(135deg, ${ne(Ae).primary}08 0%, ${ne(Ae).secondary}08 100%)`,borderBottom:`2px solid ${ne(Ae).primary}20`},children:[(0,ae.jsxs)(l.A,{sx:{display:"flex",alignItems:"center"},children:[(0,ae.jsx)(l.A,{sx:{p:1.5,borderRadius:2,background:`linear-gradient(135deg, ${ne(Ae).primary} 0%, ${ne(Ae).secondary} 100%)`,color:"white",mr:2,display:"flex",alignItems:"center",justifyContent:"center"},children:Nt(Ae)}),(0,ae.jsxs)(l.A,{children:[(0,ae.jsxs)(h.A,{variant:"h5",fontWeight:600,children:[ie("Select")," ",Vt(Ae)]}),(0,ae.jsx)(h.A,{variant:"body2",color:"text.secondary",children:Ot(Ae)})]})]}),(0,ae.jsx)(k.A,{onClick:()=>je(null),sx:{color:"text.secondary"},children:(0,ae.jsx)(te.A,{size:24})})]}),(0,ae.jsx)(I.A,{sx:{p:3},children:Se?(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsx)(x.A,{startIcon:(0,ae.jsx)(T.A,{size:16}),onClick:()=>{ze(!1),Ce("")},sx:{mb:3,color:"text.secondary","@media (max-width: 768px)":{fontSize:12,padding:"6px 12px","& .MuiButton-startIcon":{marginRight:"4px","& svg":{width:14,height:14}}}},children:ie("Back to presets")}),(0,ae.jsxs)(l.A,{children:[(0,ae.jsxs)(h.A,{variant:"h6",gutterBottom:!0,children:[ie("Describe your")," ",Vt(Ae).toLowerCase()]}),(0,ae.jsx)(C.A,{fullWidth:!0,multiline:!0,rows:6,value:ke,onChange:e=>Ce(e.target.value),placeholder:`Enter a detailed description of your ${Vt(Ae).toLowerCase()}
2...`,autoFocus:!0,sx:{mb:2}}),(0,ae.jsx)(h.A,{variant:"body2",color:"text.secondary",children:ie("Be specific - this will help AI generate content that matches your unique professional style")})]})]}):(0,ae.jsxs)(ae.Fragment,{children:["profession"===Ae&&he&&(0,ae.jsx)(l.A,{sx:{borderBottom:1,borderColor:"divider",mb:3},children:(0,ae.jsxs)(l.A,{sx:{display:"flex"},children:[(0,ae.jsxs)(x.A,{onClick:()=>Me("consumer"),sx:{flex:1,py:1.5,px:2,textTransform:"none",fontWeight:"consumer"===Pe?600:400,color:"consumer"===Pe?"primary.main":"text.secondary",borderBottom:"consumer"===Pe?2:0,borderColor:"primary.main",borderRadius:0,"&:hover":{backgroundColor:"rgba(0,0,0,0.04)"}},children:[ie("For Consumers"),(0,ae.jsx)(l.A,{component:"span",sx:{ml:1,px:1,py:.25,bgcolor:"grey.200",borderRadius:10,fontSize:12},children:he.professions.filter(e=>{var t;return null===(t=e.tags)||void 0===t?void 0:t.includes("for consumers")}).length})]}),(0,ae.jsxs)(x.A,{onClick:()=>Me("business"),sx:{flex:1,py:1.5,px:2,textTransform:"none",fontWeight:"business"===Pe?600:400,color:"business"===Pe?"primary.main":"text.secondary",borderBottom:"business"===Pe?2:0,borderColor:"primary.main",borderRadius:0,"&:hover":{backgroundColor:"rgba(0,0,0,0.04)"}},children:[ie("For Businesses"),(0,ae.jsx)(l.A,{component:"span",sx:{ml:1,px:1,py:.25,bgcolor:"grey.200",borderRadius:10,fontSize:12},children:he.professions.filter(e=>{var t;return null===(t=e.tags)||void 0===t?void 0:t.includes("for businesses")}).length})]})]})}),(0,ae.jsx)(c.Ay,{container:!0,spacing:2,sx:{mb:3},children:(e=>{if(!he)return[];switch(e){case"profession":return he.professions.filter(e=>{const t=e.tags||[],r=t.includes("for consumers"),s=t.includes("for businesses");return"consumer"===Pe?r:s});case"brand_voice":return he.brand_voices;case"brand_tone":return he.brand_tones;default:return[]}})(Ae).map(e=>(0,ae.jsx)(c.Ay,{item:!0,xs:12,sm:6,children:(0,ae.jsxs)(y.A,{elevation:ve===e.id?3:1,sx:{cursor:"pointer",position:"relative",border:ve===e.id?`2px solid ${ne(Ae).primary}`:"1px solid rgba(0,0,0,0.1)",background:ve===e.id?`linear-gradient(145deg, ${ne(Ae).primary}08 0%, ${ne(Ae).secondary}08 100%)`:"rgba(255,255,255,0.9)",transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)","&:hover":{transform:"translateY(-2px)",boxShadow:`0px 8px 20px ${ne(Ae).primary}20`}},onClick:()=>we(e.id),children:[ve===e.id&&(0,ae.jsx)(l.A,{sx:{position:"absolute",top:12,right:12,width:24,height:24,borderRadius:"50%",bgcolor:ne(Ae).primary,color:"white",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1},children:(0,ae.jsx)(D.A,{size:14})}),(0,ae.jsxs)(f.A,{sx:{p:3,pr:5},children:[(0,ae.jsx)(h.A,{variant:"h6",fontWeight:600,gutterBottom:!0,children:e.display_name}),(0,ae.jsx)(h.A,{variant:"body2",color:"text.secondary",sx:{mb:2},children:e.description}),e.tags.length>0&&(0,ae.jsx)(j.A,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:e.tags.map(e=>(0,ae.jsx)(A.A,{label:e,size:"small",sx:{bgcolor:`${ne(Ae).primary}20`,color:ne(Ae).primary,fontSize:11,height:22}},e))})]})]})},e.id))}),(0,ae.jsxs)(x.A,{fullWidth:!0,variant:"outlined",size:"large",startIcon:(0,ae.jsx)(N.A,{size:20}),onClick:()=>{ze(!0),we("")},sx:{p:2,borderStyle:"dashed",borderWidth:2,borderColor:ne(Ae).primary,color:ne(Ae).primary,"&:hover":{borderStyle:"dashed",borderWidth:2,bgcolor:`${ne(Ae).primary}08`}},children:[ie("Create Custom")," ",Vt(Ae)]})]})}),(0,ae.jsxs)(B.A,{sx:{p:3,pt:0},children:[(0,ae.jsx)(x.A,{onClick:()=>je(null),variant:"outlined",sx:{mr:2,"@media (max-width: 768px)":{fontSize:12,padding:"6px 12px"}},children:ie("Cancel")}),(0,ae.jsx)(x.A,{onClick:async()=>{if(Ae)try{be(!0),fe(null);const e={};e[Ae]=Se?{value:ke}:ve;const t=await i.gu.updatePreferences(e);xe(t),Re(`${Vt(Ae)} updated successfully!`),setTimeout(()=>Re(""),3e3),je(null),we(""),Ce(""),ze(!1)}catch(e){fe("Failed to save preference"),a.R.error("Preference save failed",{selectedField:Ae,error:e})}finally{be(!1)}},disabled:!ve&&!ke||me,variant:"contained",startIcon:me?void 0:(0,ae.jsx)(D.A,{size:20}),sx:{minWidth:140,background:`linear-gradient(135deg, ${ne(Ae).primary} 0%, ${ne(Ae).secondary} 100%)`,"@media (max-width: 768px)":{fontSize:12,padding:"6px 12px",minWidth:"auto","& .MuiButton-startIcon":{marginRight:"4px","& svg":{width:14,height:14}}}},children:me?"Saving...":"Save Changes"})]})]})}),(0,ae.jsxs)(M.A,{open:ct,onClose:Et,maxWidth:"lg",fullWidth:!0,PaperProps:{sx:{borderRadius:3,maxHeight:"90vh"}},children:[(0,ae.jsxs)(R.A,{sx:{pb:0,borderBottom:"1px solid rgba(0,0,0,0.08)"},children:[(0,ae.jsxs)(l.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:2},children:[(0,ae.jsx)(h.A,{variant:"h5",fontWeight:600,children:ht?"Edit Content":"Create New Content"}),(0,ae.jsx)(k.A,{onClick:Et,children:(0,ae.jsx)(te.A,{size:24})})]}),(0,ae.jsxs)(u.A,{value:St,onChange:(e,t)=>
2zt(t),sx:{minHeight:48,"& .MuiTab-root":{minHeight:48,textTransform:"none",fontWeight:500,fontSize:16}},children:[(0,ae.jsx)(g.A,{label:ie("Content"),value:"content",icon:(0,ae.jsx)(X.A,{size:16}),iconPosition:"start"}),(0,ae.jsx)(g.A,{label:"FAQ",value:"faq",icon:(0,ae.jsx)(_.A,{size:16}),iconPosition:"start"}),(0,ae.jsx)(g.A,{label:ie("Products"),value:"products",icon:(0,ae.jsx)(H.A,{size:16}),iconPosition:"start"}),(0,ae.jsx)(g.A,{label:"SEO",value:"seo",icon:(0,ae.jsx)(F.A,{size:16}),iconPosition:"start"})]})]}),(0,ae.jsxs)(I.A,{sx:{p:3,overflow:"auto"},children:["content"===St&&(0,ae.jsxs)(j.A,{spacing:3,children:[(0,ae.jsx)(C.A,{label:ie("Title"),value:ut,onChange:e=>gt(e.target.value),placeholder:ie("Enter a compelling title..."),fullWidth:!0,required:!0,inputProps:{maxLength:255}}),(0,ae.jsxs)(l.A,{children:[(0,ae.jsx)(h.A,{variant:"subtitle2",gutterBottom:!0,children:ie("Content (HTML)")}),(0,ae.jsx)(C.A,{value:mt,onChange:e=>bt(e.target.value),placeholder:ie("<p>Write your content here...</p>"),multiline:!0,rows:14,fullWidth:!0,required:!0,sx:{"& .MuiInputBase-input":{fontFamily:"monospace",fontSize:14}}}),(0,ae.jsx)(h.A,{variant:"caption",color:"text.secondary",sx:{mt:1,display:"block"},children:ie("Supported tags: p, br, strong, em, u, h1-h6, ul, ol, li, a, blockquote, code, pre")})]}),(0,ae.jsxs)(l.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,ae.jsxs)(l.A,{children:[(0,ae.jsx)(h.A,{variant:"body1",fontWeight:600,children:ie("Publish to Brand Page")}),(0,ae.jsx)(h.A,{variant:"body2",color:"text.secondary",children:ie("Make this content visible on your public page")})]}),(0,ae.jsx)(z.A,{checked:yt,onChange:e=>ft(e.target.checked)})]})]}),"faq"===St&&(0,ae.jsxs)(j.A,{spacing:3,children:[(0,ae.jsxs)(l.A,{children:[(0,ae.jsx)(h.A,{variant:"h6",gutterBottom:!0,children:ie("Frequently Asked Questions")}),(0,ae.jsx)(h.A,{variant:"body2",color:"text.secondary",sx:{mb:3},children:ie("Add questions and answers to help your readers understand your content better")})]}),Pt.map((e,t)=>(0,ae.jsxs)(p.A,{elevation:1,sx:{p:2,border:"1px solid rgba(0,0,0,0.08)"},children:[(0,ae.jsxs)(l.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,ae.jsxs)(h.A,{variant:"subtitle2",fontWeight:600,children:[ie("FAQ #"),t+1]}),(0,ae.jsx)(k.A,{size:"small",color:"error",onClick:()=>Mt(Pt.filter((e,r)=>r!==t)),children:(0,ae.jsx)(J.A,{size:16})})]}),(0,ae.jsx)(C.A,{label:ie("Question"),value:e.question,onChange:e=>{const r=[...Pt];r[t].question=e.target.value,Mt(r)},placeholder:ie("What is your question?"),fullWidth:!0,sx:{mb:2},inputProps:{maxLength:1e3}}),(0,ae.jsx)(C.A,{label:ie("Answer"),value:e.answer,onChange:e=>{const r=[...Pt];r[t].answer=e.target.value,Mt(r)},placeholder:ie("Provide a detailed answer..."),multiline:!0,rows:3,fullWidth:!0,inputProps:{maxLength:5e3}})]},t)),(0,ae.jsx)(x.A,{variant:"outlined",startIcon:(0,ae.jsx)(N.A,{size:18}),onClick:()=>Mt([...Pt,{question:"",answer:""}]),sx:{alignSelf:"flex-start"},children:ie("Add FAQ Item")})]}),"products"===St&&(0,ae.jsxs)(j.A,{spacing:3,children:[(0,ae.jsxs)(l.A,{children:[(0,ae.jsx)(h.A,{variant:"h6",gutterBottom:!0,children:ie("Featured Products")}),(0,ae.jsx)(h.A,{variant:"body2",color:"text.secondary",sx:{mb:3},children:ie("Showcase products or services mentioned in your content")})]}),Wt.map((e,t)=>(0,ae.jsxs)(p.A,{elevation:1,sx:{p:2,border:"1px solid rgba(0,0,0,0.08)"},children:[(0,ae.jsxs)(l.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,ae.jsxs)(h.A,{variant:"subtitle2",fontWeight:600,children:[ie("Product #"),t+1]}),(0,ae.jsx)(k.A,{size:"small",color:"error",onClick:()=>Rt(Wt.filter((e,r)=>r!==t)),children:(0,ae.jsx)(J.A,{size:16})})]}),(0,ae.jsxs)(j.A,{spacing:2,children:[(0,ae.jsx)(C.A,{label:ie("Product Name"),value:e.name,onChange:e=>{const r=[...Wt];r[t].name=e.target.value,Rt(r)},placeholder:ie("Product or Service Name"),fullWidth:!0,inputProps:{maxLength:500}}),(0,ae.jsx)(C.A,{label:ie("Product URL"),value:e.link,onChange:e=>{const r=[...Wt];r[t].link=e.target.value,Rt(r)},placeholder:"https://example.com/product",fullWidth:!0,inputProps:{maxLength:2e3}}),(0,ae.jsx)(C.A,{label:ie("Description"),value:e.description,onChange:e=>{const r=[...Wt];r[t].description=e.target.value,Rt(r)},placeholder:ie("Brief description of the product..."),multiline:!0,rows:2,fullWidth:!0,inputProps:{maxLength:5e3}})]})]},t)),(0,ae.jsx)(x.A,{variant:"outlined",startIcon:(0,ae.jsx)(N.A,{size:18}),onClick:()=>Rt([...Wt,{name:"",link:"",description:""}]),sx:{alignSelf:"flex-start"},children:ie("Add Product")})]}),"seo"===St&&(0,ae.jsxs)(j.A,{spacing:3,children:[(0,ae.jsxs)(l.A,{children:[(0,ae.jsx)(h.A,{variant:"h6",gutterBottom:!0,children:ie("Search Engine Optimization")}),(0,ae.jsx)(h.A,{variant:"body2",color:"text.secondary",sx:{mb:3},children:ie("Optimize how your content appears in search results and when shared on social media")})]}),(0,ae.jsx)(l.A,{children:(0,ae.jsx)(C.A,{label:ie("Meta Description"),value:
2It,onChange:e=>Bt(e.target.value),placeholder:ie("A brief summary of this content (150-160 characters recommended)"),multiline:!0,rows:3,fullWidth:!0,inputProps:{maxLength:200},helperText:`${It.length}/200 characters - This appears in search results and social media previews`})}),(0,ae.jsx)(l.A,{children:(0,ae.jsx)(C.A,{label:ie("URL Slug"),value:Lt,onChange:e=>{const t=e.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");_t(t),Tt("")},placeholder:ie("my-seo-friendly-url"),fullWidth:!0,error:!!$t,helperText:$t||(Lt?`Your post URL: /brands/${Le||"your-handler"}/posts/${Lt}`:"Create a SEO-friendly URL for this post (lowercase, hyphens, no spaces)"),inputProps:{maxLength:100}})}),(0,ae.jsxs)(p.A,{elevation:0,sx:{p:2,bgcolor:"rgba(102, 126, 234, 0.05)",border:"1px solid rgba(102, 126, 234, 0.2)",borderRadius:2},children:[(0,ae.jsx)(h.A,{variant:"subtitle2",fontWeight:600,gutterBottom:!0,children:ie("\ud83d\udca1 SEO Tips")}),(0,ae.jsx)(h.A,{variant:"body2",color:"text.secondary",sx:{mb:1},children:ie("\u2022 Meta descriptions should be compelling and accurately describe your content")}),(0,ae.jsx)(h.A,{variant:"body2",color:"text.secondary",sx:{mb:1},children:ie("\u2022 Keep URL slugs short, descriptive, and keyword-rich")}),(0,ae.jsx)(h.A,{variant:"body2",color:"text.secondary",children:ie("\u2022 Use hyphens (-) to separate words in URL slugs, not underscores")})]})]})]}),(0,ae.jsxs)(B.A,{sx:{p:3,pt:2,borderTop:"1px solid rgba(0,0,0,0.08)"},children:[(0,ae.jsx)(x.A,{onClick:Et,variant:"outlined",children:ie("Cancel")}),(0,ae.jsx)(x.A,{onClick:async()=>{try{if(be(!0),fe(null),Lt&&!/^[a-z0-9-]+$/.test(Lt))return Tt("URL slug can only contain lowercase letters, numbers, and hyphens"),void be(!1);const e={title:ut,content_html:mt,viewable:yt};Pt.length>0&&(e.faq=Pt.filter(e=>e.question.trim()&&e.answer.trim())),Wt.length>0&&(e.products=Wt.filter(e=>e.name.trim()&&e.link.trim()&&e.description.trim())),It.trim()&&(e.meta_description=It.trim()),Lt.trim()&&(e.url_slug=Lt.trim()),ht?(await i.FH.put(`/brand-content/${ht.id}`,e),Re("Content updated successfully!")):(await i.FH.post("/brand-content",e),Re("Content created successfully!")),setTimeout(()=>Re(""),3e3),Et(),Ut()}catch(r){var e,t;a.R.error("Content save failed",{editingContent:!!ht,error:r}),fe((null===(e=r.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to save content")}finally{be(!1)}},variant:"contained",disabled:!ut.trim()||!mt.trim()||me,startIcon:me?(0,ae.jsx)(w.A,{size:16}):(0,ae.jsx)(D.A,{size:16}),sx:{background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)","&:hover":{background:"linear-gradient(135deg, #5568d3 0%, #6a3f92 100%)"}},children:me?"Saving...":ht?"Update Content":"Create Content"})]})]}),(0,ae.jsxs)(M.A,{open:At,onClose:()=>jt(!1),maxWidth:"xs",fullWidth:!0,children:[(0,ae.jsx)(R.A,{children:ie("Delete Content?")}),(0,ae.jsx)(I.A,{children:(0,ae.jsxs)(h.A,{children:[ie('Are you sure you want to delete "'),null===vt||void 0===vt?void 0:vt.title,ie('"? This action cannot be undone.')]})}),(0,ae.jsxs)(B.A,{sx:{p:3,pt:2},children:[(0,ae.jsx)(x.A,{onClick:()=>jt(!1),variant:"outlined",children:ie("Cancel")}),(0,ae.jsx)(x.A,{onClick:async()=>{if(vt)try{be(!0),fe(null),await i.FH.delete(`/brand-content/${vt.id}`),Re("Content deleted successfully!"),setTimeout(()=>Re(""),3e3),jt(!1),wt(null),Ut()}catch(r){var e,t;a.R.error("Content delete failed",{contentId:null===vt||void 0===vt?void 0:vt.id,error:r}),fe((null===(e=r.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to delete content")}finally{be(!1)}},variant:"contained",color:"error",disabled:me,children:me?"Deleting...":"Delete"})]})]})]})},oe=()=>(0,ae.jsx)(ie,{initialTab:"preferences",hideTabNav:!0})},10699(e,t,r){r.d(t,{A:()=>m});var s=r(69244),a=r(78621),n=r(92166),i=r(24178),o=r(30774),l=r(17562),d=r(94795),c=r(83096),x=r(60168);function h(e){return(0,x.Ay)("MuiCardActions",e)}(0,c.A)("MuiCardActions",["root","spacing"]);var p=r(10422);const u=["disableSpacing","className"],g=(0,l.Ay)("div",{name:"MuiCardActions",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,!r.disableSpacing&&t.spacing]}})(e=>{let{ownerState:t}=e;
2return(0,a.A)({display:"flex",alignItems:"center",padding:8},!t.disableSpacing&&{"& > :not(style) ~ :not(style)":{marginLeft:8}})}),m=n.forwardRef(function(e,t){const r=(0,d.b)({props:e,name:"MuiCardActions"}),{disableSpacing:n=!1,className:l}=r,c=(0,s.A)(r,u),x=(0,a.A)({},r,{disableSpacing:n}),m=(e=>{const{classes:t,disableSpacing:r}=e,s={root:["root",!r&&"spacing"]};return(0,o.A)(s,h,t)})(x);return(0,p.jsx)(g,(0,a.A)({className:(0,i.A)(m.root,l),ownerState:x,ref:t},c))})},22771(e,t,r){r.d(t,{A:()=>s});const s=(0,r(75681).A)("arrow-down-wide-narrow",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]])},74178(e,t,r){r.d(t,{A:()=>s});const s=(0,r(75681).A)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},57234(e,t,r){r.d(t,{A:()=>s});const s=(0,r(75681).A)("arrow-up-narrow-wide",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]])},22224(e,t,r){r.d(t,{A:()=>s});const s=(0,r(75681).A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},27304(e,t,r){r.d(t,{A:()=>s});const s=(0,r(75681).A)("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},89606(e,t,r){r.d(t,{A:()=>s});const s=(0,r(75681).A)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},41378(e,t,r){r.d(t,{A:()=>s});const s=(0,r(75681).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"}]])},22667(e,t,r){r.d(t,{A:()=>s});const s=(0,r(75681).A)("file-code",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]])},98914(e,t,r){r.d(t,{A:()=>s});const s=(0,r(75681).A)("grid-3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]])},10299(e,t,r){r.d(t,{A:()=>s});const s=(0,r(75681).A)("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]])},19586(e,t,r){r.d(t,{A:()=>s});const s=(0,r(75681).A)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]])},10572(e,t,r){r.d(t,{A:()=>s});const s=(0,r(75681).A)("pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]])},53767(e,t,r){r.d(t,{A:()=>s});const s=(0,r(75681).A)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},13457(e,t,r){r.d(t,{A:()=>s});const s=(0,r(75681).A)("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]])},41619(e,t,r){r.d(t,{A:()=>s});const s=(0,r(75681).A)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]])},43651(e,t,r){r.d(t,{A:()=>s});const s=(0,r(75681).A)("tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.
2172 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"}]])},61963(e,t,r){r.d(t,{A:()=>s});const s=(0,r(75681).A)("type",[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]])},65037(e,t,r){r.d(t,{A:()=>s});const s=(0,r(75681).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"}]])},74524(e,t,r){r.d(t,{A:()=>s});const s=(0,r(75681).A)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]])}}]);
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.