1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4357],{267:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/dash",function(){return s(7866)}])},7866:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return r}});var a=s(5893),l=s(7294),i=s(9008),n=s.n(i);function r(){var e,t,s,i,r,g,u,f;let[y,j]=(0,l.useState)({kind:"login"}),[b,v]=(0,l.useState)("");async function S(e){j({kind:"loading"});try{let t=await fetch("/api/dash/data?key=".concat(encodeURIComponent(e))),s=await t.text(),a={};try{a=JSON.parse(s)}catch(e){a={error:"bad_json",raw:s.substring(0,200)}}if(401===t.status){sessionStorage.removeItem("bp_dash_pw"),j({kind:"login",error:a.hint||"Wrong password"});return}if(!t.ok||a.error){j({kind:"error",msg:"".concat(a.error||t.status,": ").concat(a.hint||a.raw||"Unknown error")});return}sessionStorage.setItem("bp_dash_pw",e),j({kind:"data",data:a})}catch(e){j({kind:"error",msg:(null==e?void 0:e.message)||"Network failure"})}}(0,l.useEffect)(()=>{let e=sessionStorage.getItem("bp_dash_pw");e&&S(e)},[]);let _="\n body { margin: 0; background: #faf7f2; color: #0b0f1a; font-family: 'Inter', -apple-system, sans-serif; }\n .dash-wrap { max-width: 1180px; margin: 0 auto; padding: 40px 24px; }\n .dash-card { background: #fffdf9; border: 1px solid #e8e2d8; border-radius: 14px; }\n .dash-eyebrow { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11px; color: #ff6b1a; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 600; }\n .dash-title { font-family: 'Fraunces', Georgia, serif; font-weight: 600; letter-spacing: -0.025em; margin: 0; }\n .dash-mute { color: #6b6558; }\n .dash-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }\n table { width: 100%; border-collapse: collapse; font-size: 13px; }\n th { padding: 14px 18px; text-align: left; background: #faf7f2; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10px; color: #6b6558; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 600; }\n td { padding: 12px 18px; }\n tr + tr td { border-top: 1px solid #f1ece3; }\n a { color: #ff6b1a; text-decoration: none; font-weight: 600; }\n button { font-family: inherit; cursor: pointer; }\n @import url('https://fonts.googleapis.com/css2?family=Fraunces:wght@400;500;600&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');\n ";if("login"===y.kind)return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n(),{children:(0,a.jsx)("title",{children:"Dashboard â BetterPrice"})}),(0,a.jsx)("style",{dangerouslySetInnerHTML:{__html:_}}),(0,a.jsxs)("div",{style:{maxWidth:420,margin:"120px auto",padding:32,background:"#fffdf9",border:"1px solid #e8e2d8",borderRadius:16},children:[(0,a.jsx)("div",{className:"dash-eyebrow",style:{marginBottom:12},children:"â Dashboard"}),(0,a.jsx)("h1",{className:"dash-title",style:{fontSize:32,marginBottom:24},children:"Sign in"}),(0,a.jsxs)("form",{onSubmit:e=>{e.preventDefault(),b&&S(b)},children:[(0,a.jsx)("input",{type:"password",autoFocus:!0,value:b,onChange:e=>v(e.target.value),placeholder:"Admin password",style:{width:"100%",padding:"12px 14px",fontSize:14,border:"1px solid #e8e2d8",borderRadius:10,background:"#faf7f2",marginBottom:12,fontFamily:"inherit",boxSizing:"border-box"}}),(0,a.jsx)("button",{type:"submit",style:{width:"100%",padding:"12px 14px",fontSize:14,fontWeight:600,background:"#0b0f1a",color:"white",border:"none",borderRadius:10},children:"Sign in"}),y.error&&(0,a.jsx)("div",{style:{marginTop:12,padding:"10px 14px",background:"#fee2e2",color:"#ef4444",borderRadius:8,fontSize:13},children:y.error})]})]})]});if("loading"===y.kind)return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("style",{dangerouslySetInnerHTML:{__html:_}}),(0,a.jsx)("div",{style:{textAlign:"center",padding:120,color:"#6b6558"},children:"Loadingâ¦"})]});if("error"===y.kind)return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n(),{children:(0,a.jsx)("title",{children:"Error â Dashboard"})}),(0,a.jsx)("style",{dangerouslySetInnerHTML:{__html:_}}),(0,a.jsxs)("div",{style:{maxWidth:720,margin:"80px auto",padding:32,background:"#fffdf9",border:"1px solid #e8e2d8",borderRadius:16},children:[(0,a.jsx)("div",{className:"dash-eyebrow",style:{color:"#ef4444",marginBottom:12},children:"â Error"}),(0,a.jsx)("h1",{className:"dash-title",style:{fontSize:24,marginBottom:16},children:"Could not load data"}),(0,a.jsx)("pre",{style:{background:"#faf7f2",padding:16,borderRadius:8,fontSize:12,color:"#6b6558",overflow:"auto",whiteSpace:"pre-wrap"},children:y.msg}),(0,a.jsx)("button",{onClick:()=>{sessionStorage.removeItem("bp_dash_pw"),j({kind:"login"}),v("")},style:{marginTop:16,padding:"10px 16px",fontSize:13,fontWeight:600,background:"#0b0f1a",color:"white",border:"none",borderRadius:8},children:"Sign in again"})]})]});let w=y.data||{},N=w.counts||{},k=Array.isArray(w.recent)?w.recent:[],z=Array.isArray(w.trend)?w.trend:[],A=Array.isArray(w.topStores)?w.topStores:[],B=w.cascadeDistribution||{},C=w.slotCTR||{},T=Array.isArray(w.lowQuality)?w.lowQuality:[],D=Array.isArray(w.clicksTrend)?w.clicksTrend:[],W=Array.isArray(w.sharesTrend)?w.sharesTrend:[],R=Array.isArray(w.topClicked)?w.topClicked:[],E=Array.isArray(w.ctrByStore)?w.ctrByStore:[],F=w.gateBreakdown||{},L=Array.isArray(w.recentBlocks)?w.recentBlocks:[],I=e=>
1"number"!=typeof e||isNaN(e)?"0":e.toLocaleString(),O=e=>"".concat("number"!=typeof e||isNaN(e)?0:e,"%"),M=Math.max(1,...z.map(e=>Number(null==e?void 0:e.count)||0)),P=Math.max(1,...D.map(e=>Number(null==e?void 0:e.count)||0)),H=Math.max(1,...W.map(e=>Number(null==e?void 0:e.count)||0));return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n(),{children:(0,a.jsx)("title",{children:"Dashboard â BetterPrice"})}),(0,a.jsx)("style",{dangerouslySetInnerHTML:{__html:_}}),(0,a.jsxs)("div",{className:"dash-wrap",children:[(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-end",marginBottom:32,flexWrap:"wrap",gap:12},children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"dash-eyebrow",style:{marginBottom:8},children:"â Admin Dashboard"}),(0,a.jsx)("h1",{className:"dash-title",style:{fontSize:44},children:"System health"})]}),(0,a.jsxs)("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:11,color:"#6b6558",textTransform:"uppercase",letterSpacing:"0.1em"},children:w.generated_at?"Updated ".concat(new Date(w.generated_at).toLocaleString()):""}),(0,a.jsx)("a",{href:"/dash/reddit",style:{padding:"6px 12px",fontSize:12,fontWeight:600,background:"#FF4500",color:"#fff",border:"1px solid #FF4500",borderRadius:6,textDecoration:"none"},children:"\uD83D\uDCCB Reddit Queue"}),(0,a.jsx)("button",{onClick:()=>{sessionStorage.removeItem("bp_dash_pw"),j({kind:"login"}),v("")},style:{padding:"6px 12px",fontSize:12,fontWeight:600,background:"transparent",color:"#6b6558",border:"1px solid #e8e2d8",borderRadius:6},children:"Sign out"})]})]}),(0,a.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:16,marginBottom:40},children:[["Total pages",I(N.total),"#0b0f1a"],["Today",I(N.today),"#ff6b1a"],["This week",I(N.week),"#ff6b1a"],["Avg savings",O(N.avgSavings),"#16a34a"],["Total clicks",I(N.clicksTotal),"#0b0f1a"],["Clicks today",I(N.clicksDay),"#ff6b1a"],["Clicks this week",I(N.clicksWeek),"#ff6b1a"],["CTR",O(N.ctr),"#16a34a"],["Shares (30d)",I(N.sharesTotal30d),"#7e22ce"],["Welcome views (30d)",I(N.welcomeViewsTotal30d),"#7e22ce"],["Pages blocked (30d)",I(N.gateBlocked),"#dc2626"],["Block rate",O(N.gateBlockRate||0),"#dc2626"]].map(e=>{let[t,s,l]=e;return(0,a.jsxs)("div",{className:"dash-card",style:{padding:"20px 22px"},children:[(0,a.jsx)("div",{className:"dash-mono",style:{fontSize:10,color:"#6b6558",textTransform:"uppercase",letterSpacing:"0.12em",marginBottom:10},children:t}),(0,a.jsx)("div",{className:"dash-title",style:{fontSize:32,color:l},children:s})]},t)})}),z.length>0&&(0,a.jsxs)("div",{style:{marginBottom:40},children:[(0,a.jsx)("div",{className:"dash-eyebrow",style:{marginBottom:8},children:"â Trend"}),(0,a.jsx)("h2",{className:"dash-title",style:{fontSize:28,marginBottom:16},children:"Pages created â last 30 days"}),(0,a.jsxs)("div",{className:"dash-card",style:{padding:"24px 28px"},children:[(0,a.jsx)("div",{style:{display:"flex",alignItems:"flex-end",gap:4,height:160},children:z.map((e,t)=>{let s=Number(null==e?void 0:e.count)||0;return(0,a.jsxs)("div",{title:"".concat(null==e?void 0:e.date,": ").concat(s),style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"flex-end",position:"relative"},children:[s>0&&(0,a.jsx)("div",{className:"dash-mono",style:{position:"absolute",top:-16,fontSize:9,color:"#9a9384"},children:s}),(0,a.jsx)("div",{style:{width:"100%",height:"".concat(s/M*100,"%"),background:t===z.length-1?"#ff6b1a":"#1a1a2e",borderRadius:"3px 3px 0 0",minHeight:s>0?2:0}})]},(null==e?void 0:e.date)||t)})}),(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",marginTop:12},children:[(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:10,color:"#9a9384"},children:null===(e=z[0])||void 0===e?void 0:e.date}),(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:10,color:"#9a9384"},children:null===(t=z[z.length-1])||void 0===t?void 0:t.date})]})]})]}),D.length>0&&(0,a.jsxs)("div",{style:{marginBottom:40},children:[(0,a.jsx)("div",{className:"dash-eyebrow",style:{marginBottom:8},children:"â Clicks"}),(0,a.jsx)("h2",{className:"dash-title",style:{fontSize:28,marginBottom:8},children:"Clicks â last 30 days"}),(0,a.jsxs)("p",{style:{fontSize:13,color:"#6b6558",marginBottom:16},children:["Stacked by affiliate slot. ",(0,a.jsx)("span",{style:{color:"#ff6b1a",fontWeight:600},children:"Best Overall"})," \xb7 ",(0,a.jsx)("span",{style:{color:"#7e22ce",fontWeight:600},children:"Best Value"})," \xb7 ",(0,a.jsx)("span",{style:{color:"#16a34a",fontWeight:600},children:"Top Rated"})]}),(0,a.jsxs)("div",{className:"dash-card",style:{padding:"24px 28px"},children:[(0,a.jsx)("div",{style:{display:"flex",alignItems:"flex-end",gap:4,height:160},children:D.map((e,t)=>{let s=Number(null==e?void 0:e.count)||0,l=Number(null==e?void 0:e.tag1)||0,i=Number(null==e?void 0:e.tag2)||0,n=Number(null==e?void 0:e.tag3)||0,r=l/P*100,o=i/P*100,d=n/P*100;return(0,a.jsxs)("div",{title:"".concat(null==e?void 0:e.date,": ").concat(s," clicks (Best Overall ").concat(l,", Best Value ").concat(i,", Top Rated ").concat(n,")"),style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"flex-end",position:"relative"},children:[s>0&&(0,a.jsx)("div",{className:"dash-mono",style:{position:"absolute",top:-16,left:"50%",transform:"translateX(-50%)",fontSize:9,color:"#9a9384"},children:s}),(0,a.jsxs)("div",{style:{width:"100%",display:"flex",flexDirection:"column-reverse"},children:[l>0&&(0,a.jsx)("div",{style:{height:"".concat(r,"%"),background:"#ff6b1a",minHeight:2}}),i>0&&(0,a.jsx)("div",{style:{height:"".concat(o,"%"),background:"#7e22ce",minHeight:2}}),n>0&&(0,a.jsx)("div",{style:{height:"".concat(d,"%"),background:"#16a34a",minHeight:2,borderRadius:"3px 3px 0 0"}})]})]},(null==e?void 0:e.date)||t)})}),(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",marginTop:12},children:[(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:10,
1color:"#9a9384"},children:null===(s=D[0])||void 0===s?void 0:s.date}),(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:10,color:"#9a9384"},children:null===(i=D[D.length-1])||void 0===i?void 0:i.date})]})]})]}),W.length>0&&N.sharesTotal30d>0&&(0,a.jsxs)("div",{style:{marginBottom:40},children:[(0,a.jsx)("div",{className:"dash-eyebrow",style:{marginBottom:8},children:"â Virality"}),(0,a.jsx)("h2",{className:"dash-title",style:{fontSize:28,marginBottom:16},children:"Share clicks â last 30 days"}),(0,a.jsxs)("div",{className:"dash-card",style:{padding:"24px 28px"},children:[(0,a.jsx)("div",{style:{display:"flex",alignItems:"flex-end",gap:4,height:120},children:W.map((e,t)=>{let s=Number(null==e?void 0:e.count)||0;return(0,a.jsxs)("div",{title:"".concat(null==e?void 0:e.date,": ").concat(s," shares"),style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"flex-end",position:"relative"},children:[s>0&&(0,a.jsx)("div",{className:"dash-mono",style:{position:"absolute",top:-16,fontSize:9,color:"#9a9384"},children:s}),(0,a.jsx)("div",{style:{width:"100%",height:"".concat(s/H*100,"%"),background:"#7e22ce",borderRadius:"3px 3px 0 0",minHeight:s>0?2:0}})]},(null==e?void 0:e.date)||t)})}),(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",marginTop:12},children:[(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:10,color:"#9a9384"},children:null===(r=W[0])||void 0===r?void 0:r.date}),(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:10,color:"#9a9384"},children:null===(g=W[W.length-1])||void 0===g?void 0:g.date})]})]})]}),A.length>0&&(0,a.jsxs)("div",{style:{marginBottom:40},children:[(0,a.jsx)("div",{className:"dash-eyebrow",style:{marginBottom:8},children:"â Top stores"}),(0,a.jsx)("h2",{className:"dash-title",style:{fontSize:28,marginBottom:16},children:"Top stores by deal volume"}),(0,a.jsx)("div",{className:"dash-card",style:{overflow:"hidden"},children:(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Store"}),(0,a.jsx)("th",{style:{textAlign:"right"},children:"Pages"}),(0,a.jsx)("th",{style:{textAlign:"right"},children:"Avg savings"}),(0,a.jsx)("th",{style:{textAlign:"right"},children:"Max savings"})]})}),(0,a.jsx)("tbody",{children:A.map((e,t)=>(0,a.jsxs)("tr",{children:[(0,a.jsxs)("td",{children:[(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:12,color:"#6b6558",marginRight:10},children:(t+1).toString().padStart(2,"0")}),e.host||"â"]}),(0,a.jsx)("td",{style:{textAlign:"right"},children:I(e.count)}),(0,a.jsx)("td",{style:{textAlign:"right"},children:O(e.avgSavings)}),(0,a.jsx)("td",{style:{textAlign:"right",color:"#16a34a"},children:O(e.maxSavings)})]},e.host||t))})]})})]}),R.length>0&&(0,a.jsxs)("div",{style:{marginBottom:40},children:[(0,a.jsx)("div",{className:"dash-eyebrow",style:{marginBottom:8},children:"â Top clicked"}),(0,a.jsx)("h2",{className:"dash-title",style:{fontSize:28,marginBottom:16},children:"Most clicked products"}),(0,a.jsx)("div",{className:"dash-card",style:{overflow:"hidden"},children:(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Title"}),(0,a.jsx)("th",{children:"Store"}),(0,a.jsx)("th",{style:{textAlign:"right"},children:"Savings"}),(0,a.jsx)("th",{style:{textAlign:"center"},children:"Clicks"}),(0,a.jsx)("th",{style:{textAlign:"center"},children:"Slot 1 / 2 / 3"}),(0,a.jsx)("th",{children:"Last click"}),(0,a.jsx)("th",{})]})}),(0,a.jsx)("tbody",{children:R.map((e,t)=>(0,a.jsxs)("tr",{children:[(0,a.jsxs)("td",{style:{maxWidth:320,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:11,color:"#6b6558",marginRight:8},children:(t+1).toString().padStart(2,"0")}),e.product_title||"â"]}),(0,a.jsx)("td",{children:e.store_hostname||"â"}),(0,a.jsx)("td",{style:{textAlign:"right",color:"#16a34a"},children:e.savings_pct?O(e.savings_pct):"â"}),(0,a.jsx)("td",{style:{textAlign:"center",fontWeight:700},children:I(e.clicks_total)}),(0,a.jsx)("td",{style:{textAlign:"center"},children:(0,a.jsxs)("span",{className:"dash-mono",style:{fontSize:11,color:"#6b6558"},children:[e.clicks_slot0," / ",e.clicks_slot1," / ",e.clicks_slot2]})}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:11,color:"#6b6558"}
1,children:e.last_click?new Date(e.last_click).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"â"})}),(0,a.jsx)("td",{children:e.product_slug&&(0,a.jsx)("a",{href:"/compare/".concat(e.product_slug),target:"_blank",style:{fontSize:12},children:"View â"})})]},e.product_slug||t))})]})})]}),E.length>0&&(0,a.jsxs)("div",{style:{marginBottom:40},children:[(0,a.jsx)("div",{className:"dash-eyebrow",style:{marginBottom:8},children:"â CTR by store"}),(0,a.jsx)("h2",{className:"dash-title",style:{fontSize:28,marginBottom:8},children:"Which stores convert best"}),(0,a.jsx)("p",{style:{fontSize:13,color:"#6b6558",marginBottom:16},children:"Click-through rate per store: clicks \xf7 pages_created. Higher = users on that store actually click through."}),(0,a.jsx)("div",{className:"dash-card",style:{overflow:"hidden"},children:(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Store"}),(0,a.jsx)("th",{style:{textAlign:"right"},children:"Pages"}),(0,a.jsx)("th",{style:{textAlign:"right"},children:"Clicks"}),(0,a.jsx)("th",{style:{textAlign:"right"},children:"CTR"})]})}),(0,a.jsx)("tbody",{children:E.map((e,t)=>(0,a.jsxs)("tr",{children:[(0,a.jsxs)("td",{children:[(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:12,color:"#6b6558",marginRight:10},children:(t+1).toString().padStart(2,"0")}),e.host||"â"]}),(0,a.jsx)("td",{style:{textAlign:"right"},children:I(e.pages)}),(0,a.jsx)("td",{style:{textAlign:"right",fontWeight:700},children:I(e.clicks)}),(0,a.jsx)("td",{style:{textAlign:"right",color:e.ctr>=5?"#16a34a":e.ctr>=1?"#ff6b1a":"#6b6558"},children:O(e.ctr)})]},e.host||t))})]})})]}),(0,a.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(380px, 1fr))",gap:24,marginBottom:40},children:[(0,a.jsx)(o,{title:"Cascade level distribution",eyebrow:"â Match quality",entries:[["exact","Exact title match","#16a34a",Number(B.exact)||0],["close","Close fallback","#65A30D",Number(B.close)||0],["medium","Medium fallback","#CA8A04",Number(B.medium)||0],["broad","Broad fallback","#EA580C",Number(B.broad)||0],["fallback","Category fallback","#ff6b1a",Number(B.fallback)||0],["none","Pre-cascade (legacy)","#9a9384",Number(B.none)||0]],empty:"No cascade data yet."}),(0,a.jsx)(o,{title:"Clicks by slot tag",eyebrow:"â Slot performance",entries:[["slot1","â Best Overall","#ff6b1a",Number(C.slot1)||0],["slot2","\uD83D\uDCB8 Best Value","#ff6b1a",Number(C.slot2)||0],["slot3","\uD83C\uDF1F Top Rated","#ff6b1a",Number(C.slot3)||0]],empty:"No clicks logged yet. Click data appears here once users buy."})]}),T.length>0&&(0,a.jsxs)("div",{style:{marginBottom:40},children:[(0,a.jsx)("div",{className:"dash-eyebrow",style:{marginBottom:8},children:"â Quality alerts"}),(0,a.jsx)("h2",{className:"dash-title",style:{fontSize:28,marginBottom:16},children:"Pages flagged for review"}),(0,a.jsx)("div",{className:"dash-card",style:{overflow:"hidden"},children:(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Title"}),(0,a.jsx)("th",{children:"Store"}),(0,a.jsx)("th",{style:{textAlign:"right"},children:"Savings"}),(0,a.jsx)("th",{children:"Flags"}),(0,a.jsx)("th",{})]})}),(0,a.jsx)("tbody",{children:T.map((e,t)=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{style:{maxWidth:320,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.product_title||"â"}),(0,a.jsx)("td",{children:e.store_hostname||"â"}),(0,a.jsx)("td",{style:{textAlign:"right"},children:O(e.savings_pct)}),(0,a.jsx)("td",{children:(0,a.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:(e.flags||[]).map(e=>(0,a.jsx)(c,{type:e},e))})}),(0,a.jsx)("td",{children:e.product_slug&&(0,a.jsx)("a",{href:"/compare/".concat(e.product_slug),target:"_blank",style:{fontSize:12},children:"View â"})})]},e.product_slug||t))})]})})]}),((null===(u=w.cartHealth)||void 0===u?void 0:u.length)>0||(null===(f=w.outlierSavings)||void 0===f?void 0:f.length)>0)&&(0,a.jsxs)("div",{style:{marginBottom:40},children:[(0,a.jsx)("div",{className:"dash-eyebrow",style:{marginBottom:8},children:"â Insights"}),(0,a.jsx)("h2",{className:"dash-title",style:{fontSize:28,marginBottom:16},children:"Things worth reviewing"}),(0,a.jsx)("p",{style:{fontSize:14,color:"#6b6558",marginBottom:20},children:"Auto-flagged from event logs. Use the SQL kit (scan-queries.sql) for deeper investigation."}),(0,a.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(380px, 1fr))",gap:16},children:[(w.cartHealth||[]).length>0&&(0,a.jsxs)("div",{className:"dash-card",style:{padding:20},children:[(0,a.jsx)("div",{className:"dash-mono",style:{fontSize:11,color:"#ef4444",textTransform:"uppercase",letterSpacing:"0.12em",marginBottom:10,fontWeight:600},children:"â Cart extraction failures"}),(w.cartHealth||[]).map((e,t)=>(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",padding:"4px 0",fontSize:13},children:[(0,a.jsx)("span",{style:{color:"#0b0f1a"},children:e.host}),(0,a.jsxs)("span",{className:"dash-mono",children:[(0,a.jsxs)("span",{style:{color:"#ef4444"},children:[e.failed," failed"]}),(0,a.jsxs)("span",{style:{color:"#6b6558",marginLeft:8},children:[e.success_pct,"% ok"]})]})]},e.host||t)),(0,a.jsx)("div",{style:{marginTop:10,fontSize:11,color:"#9a9384",fontStyle:"italic"},children:"Suggests adding a new cart-extraction strategy for these stores."})]}),(w.outlierSavings||[]).length>0&&(0,a.jsxs)("div",{className:"dash-card",style:{padding:20},children:[(0,a.jsx)("div",{className:"dash-mono",style:{fontSize:11,color:"#ff6b1a",textTransform:"uppercase",letterSpacing:"0.12em",marginBottom:10,fontWeight:600},children:"â Extreme savings (verify manually)"}),(w.outlierSavings||[]).map((e,t)=>{var s,l,i;return(0,a.jsxs)("div",{style:{padding:"6px 0",fontSize:12,borderBottom:t<w.outlierSavings.length-1?"1px solid #f1ece3":"none"},children:[(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between"},children:[(0,a.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:240},children:e.product_title}),(0,a.jsxs)("span",{className:"dash-mono",style:{color:"#ff6b1a",fontWeight:600},children:["â",e.pct_off,"%"]})]}
1),(0,a.jsxs)("div",{className:"dash-mono",style:{fontSize:10,color:"#9a9384",marginTop:2},children:[e.store_hostname," \xb7 $",null===(s=e.store_price_usd)||void 0===s?void 0:s.toFixed(2)," â $",null===(i=e.matched_prices)||void 0===i?void 0:null===(l=i[0])||void 0===l?void 0:l.toFixed(2)]})]},t)}),(0,a.jsx)("div",{style:{marginTop:10,fontSize:11,color:"#9a9384",fontStyle:"italic"},children:"Real deal or wrong category? Click View â on the live feed to verify."})]}),w.cascadeUsage&&Object.values(w.cascadeUsage).some(e=>e>0)&&(0,a.jsxs)("div",{className:"dash-card",style:{padding:20},children:[(0,a.jsx)("div",{className:"dash-mono",style:{fontSize:11,color:"#65A30D",textTransform:"uppercase",letterSpacing:"0.12em",marginBottom:10,fontWeight:600},children:"â Cascade quality"}),[["lvl_0","Level 0 (exact)","#16a34a"],["lvl_1_2","Levels 1-2 (close)","#65A30D"],["lvl_3_4","Levels 3-4 (medium)","#CA8A04"],["lvl_5plus","Level 5+ (broad)","#EA580C"]].map(e=>{let[t,s,l]=e,i=Object.values(w.cascadeUsage||{}).reduce((e,t)=>e+t,0)||1,n=w.cascadeUsage[t]||0,r=n/i*100;return(0,a.jsxs)("div",{style:{marginBottom:10},children:[(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",fontSize:12,marginBottom:3},children:[(0,a.jsx)("span",{children:s}),(0,a.jsxs)("span",{className:"dash-mono",style:{color:"#6b6558"},children:[n," \xb7 ",r.toFixed(0),"%"]})]}),(0,a.jsx)("div",{style:{background:"#f1ece3",borderRadius:3,height:6},children:(0,a.jsx)("div",{style:{background:l,width:"".concat(r,"%"),height:"100%",borderRadius:3}})})]},t)}),(0,a.jsx)("div",{style:{marginTop:10,fontSize:11,color:"#9a9384",fontStyle:"italic"},children:"Higher levels = smart query was too narrow. Lots of L3+ â tune the cascade."})]})]})]}),Object.keys(w.eventCounts||{}).length>0&&(0,a.jsxs)("div",{style:{marginBottom:40},children:[(0,a.jsx)("div",{className:"dash-eyebrow",style:{marginBottom:8},children:"â Matcher events"}),(0,a.jsx)("h2",{className:"dash-title",style:{fontSize:28,marginBottom:16},children:"What's happening under the hood"}),(0,a.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:12,marginBottom:20},children:Object.entries(w.eventCounts||{}).sort((e,t)=>t[1]-e[1]).map(e=>{let[t,s]=e,[l,i]={panel_shown:["Panel shown","#16a34a"],panel_suppressed:["Suppressed (>95% off)","#EA580C"],no_match:["No match found","#9a9384"],cascade_fallback:["Cascade fallback","#CA8A04"],cart_extracted:["Cart extracted","#65A30D"],cart_extract_failed:["Cart failed","#ef4444"],sanity_rejection:["Sanity rejections","#9333EA"],low_quality_warn:["Low quality","#ff6b1a"]}[t]||[t,"#6b6558"];return(0,a.jsxs)("div",{className:"dash-card",style:{padding:"16px 18px"},children:[(0,a.jsx)("div",{className:"dash-mono",style:{fontSize:10,color:"#6b6558",textTransform:"uppercase",letterSpacing:"0.1em",marginBottom:6},children:l}),(0,a.jsx)("div",{className:"dash-title",style:{fontSize:24,color:i},children:s})]},t)})}),(w.topSuppressions||[]).length>0&&(0,a.jsxs)("div",{style:{marginBottom:16},children:[(0,a.jsx)("div",{className:"dash-mono",style:{fontSize:11,color:"#6b6558",textTransform:"uppercase",letterSpacing:"0.12em",marginBottom:8},children:"Most-suppressed stores (custom products / no Amazon match)"}),(0,a.jsx)("div",{className:"dash-card",style:{padding:"16px 20px"},children:(w.topSuppressions||[]).map(e=>(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",padding:"4px 0",fontSize:13},children:[(0,a.jsx)("span",{children:e.host}),(0,a.jsxs)("span",{className:"dash-mono",style:{color:"#EA580C",fontWeight:600},children:[e.count," suppressions"]})]},e.host))})]}),(0,a.jsx)("div",{className:"dash-card",style:{overflow:"hidden"},children:(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"When"}),(0,a.jsx)("th",{children:"Event"}),(0,a.jsx)("th",{children:"Store"}),(0,a.jsx)("th",{children:"Product"}),(0,a.jsx)("th",{style:{textAlign:"right"},children:"Got/Pass"}),(0,a.jsx)("th",{style:{textAlign:"center"},children:"Reason"})]})}),(0,a.jsx)("tbody",{children:(w.recentEvents||[]).slice(0,30).map((e,t)=>{var s,l;return(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:11,color:"#6b6558"}
1,children:e.occurred_at?new Date(e.occurred_at).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"â"})}),(0,a.jsx)("td",{children:(0,a.jsx)(m,{type:e.event_type})}),(0,a.jsx)("td",{children:e.store_hostname||"â"}),(0,a.jsx)("td",{style:{maxWidth:260,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.product_title||"â"}),(0,a.jsx)("td",{style:{textAlign:"right"},children:(0,a.jsxs)("span",{className:"dash-mono",style:{fontSize:11},children:[null!==(s=e.num_candidates)&&void 0!==s?s:"â"," / ",null!==(l=e.num_passed)&&void 0!==l?l:"â"]})}),(0,a.jsx)("td",{style:{textAlign:"center"},children:(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:10,color:"#6b6558"},children:e.reason||"â"})})]},e.id||t)})})]})})]}),(w.recentClicks||[]).length>0&&(0,a.jsxs)("div",{style:{marginBottom:40},children:[(0,a.jsx)("div",{className:"dash-eyebrow",style:{marginBottom:8},children:"â Click stream"}),(0,a.jsx)("h2",{className:"dash-title",style:{fontSize:28,marginBottom:16},children:"Latest clicks (last 30)"}),(0,a.jsx)("div",{className:"dash-card",style:{overflow:"hidden"},children:(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"When"}),(0,a.jsx)("th",{children:"Slot"}),(0,a.jsx)("th",{children:"Tag"}),(0,a.jsx)("th",{children:"Source"}),(0,a.jsx)("th",{children:"Product"}),(0,a.jsx)("th",{})]})}),(0,a.jsx)("tbody",{children:(w.recentClicks||[]).map((e,t)=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:11,color:"#6b6558"},children:e.occurred_at?new Date(e.occurred_at).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"â"})}),(0,a.jsx)("td",{children:(0,a.jsx)(x,{slot:e.slot_index})}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:11},children:e.affiliate_tag||"â"})}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:11,color:"#6b6558"},children:e.source||"â"})}),(0,a.jsx)("td",{style:{maxWidth:320,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.product_title||e.product_slug||"â"}),(0,a.jsx)("td",{children:e.product_slug&&(0,a.jsx)("a",{href:"/compare/".concat(e.product_slug),target:"_blank",style:{fontSize:12},children:"View â"})})]},t))})]})})]}),k.length>0&&(0,a.jsxs)("div",{style:{marginBottom:40},children:[(0,a.jsx)("div",{className:"dash-eyebrow",style:{marginBottom:8},children:"â Live feed"}),(0,a.jsx)("h2",{className:"dash-title",style:{fontSize:28,marginBottom:16},children:"Recent pages (latest 50)"}),(0,a.jsx)("div",{className:"dash-card",style:{overflow:"hidden"},children:(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Created"}),(0,a.jsx)("th",{children:"Title"}),(0,a.jsx)("th",{children:"Store"}),(0,a.jsx)("th",{style:{textAlign:"right"},children:"Savings"}),(0,a.jsx)("th",{style:{textAlign:"center"},children:"Cascade"}),(0,a.jsx)("th",{style:{textAlign:"center"},children:"Clicks"}),(0,a.jsx)("th",{})]})}),(0,a.jsx)("tbody",{children:k.map((e,t)=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:11,color:"#6b6558"},children:e.created_at?new Date(e.created_at).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"â"})}),(0,a.jsx)("td",{style:{maxWidth:320,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.product_title||"â"}),(0,a.jsx)("td",{children:e.store_hostname||"â"}),(0,a.jsx)("td",{style:{textAlign:"right",color:"#16a34a"},children:O(e.savings_pct)}),(0,a.jsx)("td",{style:{textAlign:"center"},children:(0,a.jsx)(d,{level:e.cascade_level})}),(0,a.jsx)("td",{style:{textAlign:"center"},children:(0,a.jsx)(h,{clicks:e.clicks})}),(0,a.jsx)("td",{children:e.product_slug&&(0,a.jsx)("a",{href:"/compare/".concat(e.product_slug),target:"_blank",style:{fontSize:12},children:"View â"})})]},e.product_slug||t))})]})})]}),(N.gateTotal||0)>0&&(0,a.jsxs)("div",{style:{marginBottom:40},children:[(0,a.jsx)("div",{className:"dash-eyebrow",style:{marginBottom:8},children:"â Quality gate"}),(0,a.jsx)("h2",{className:"dash-title",style:{fontSize:28,marginBottom:8},children:"Page creation gate (last 30 days)"}),(0,a.jsx)("p",{style:{fontSize:13,color:"#6b6558",marginBottom:16},children:"Clicks always log for analytics. But /compare/[slug] pages are only created when the match passes our quality gate. Click events still earn affiliate revenue regardless."}),(0,a.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:16,marginBottom:16},children:[(0,a.jsxs)("div",{className:"dash-card",style:{padding:"20px 22px"},children:[(0,a.jsx)("div",{className:"dash-mono",style:{fontSize:10,
1color:"#6b6558",textTransform:"uppercase",letterSpacing:"0.12em",marginBottom:10},children:"Total decisions"}),(0,a.jsx)("div",{className:"dash-title",style:{fontSize:28,color:"#0b0f1a"},children:I(N.gateTotal)})]}),(0,a.jsxs)("div",{className:"dash-card",style:{padding:"20px 22px"},children:[(0,a.jsx)("div",{className:"dash-mono",style:{fontSize:10,color:"#16a34a",textTransform:"uppercase",letterSpacing:"0.12em",marginBottom:10},children:"Pages created"}),(0,a.jsx)("div",{className:"dash-title",style:{fontSize:28,color:"#16a34a"},children:I(F.pass||0)})]}),(0,a.jsxs)("div",{className:"dash-card",style:{padding:"20px 22px"},children:[(0,a.jsx)("div",{className:"dash-mono",style:{fontSize:10,color:"#9333EA",textTransform:"uppercase",letterSpacing:"0.12em",marginBottom:10},children:"Blocked: cascade too broad"}),(0,a.jsx)("div",{className:"dash-title",style:{fontSize:28,color:"#9333EA"},children:I(F.cascade_too_broad||0)})]}),(0,a.jsxs)("div",{className:"dash-card",style:{padding:"20px 22px"},children:[(0,a.jsx)("div",{className:"dash-mono",style:{fontSize:10,color:"#EA580C",textTransform:"uppercase",letterSpacing:"0.12em",marginBottom:10},children:"Blocked: brand mismatch"}),(0,a.jsx)("div",{className:"dash-title",style:{fontSize:28,color:"#EA580C"},children:I(F.brand_mismatch||0)})]}),(0,a.jsxs)("div",{className:"dash-card",style:{padding:"20px 22px"},children:[(0,a.jsx)("div",{className:"dash-mono",style:{fontSize:10,color:"#DC2626",textTransform:"uppercase",letterSpacing:"0.12em",marginBottom:10},children:"Blocked: savings > 60%"}),(0,a.jsx)("div",{className:"dash-title",style:{fontSize:28,color:"#DC2626"},children:I(F.savings_too_high||0)})]})]}),L.length>0&&(0,a.jsxs)("details",{className:"dash-card",style:{padding:"16px 20px"},children:[(0,a.jsxs)("summary",{style:{cursor:"pointer",fontSize:13,fontWeight:600,color:"#6b6558"},children:["Recent blocked matches (",L.length,") â click to expand"]}),(0,a.jsx)("div",{style:{marginTop:12,overflow:"auto"},children:(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"When"}),(0,a.jsx)("th",{children:"Title"}),(0,a.jsx)("th",{children:"Store"}),(0,a.jsx)("th",{style:{textAlign:"right"},children:"Store $"}),(0,a.jsx)("th",{style:{textAlign:"right"},children:"Amzn $"}),(0,a.jsx)("th",{children:"Blocked for"})]})}),(0,a.jsx)("tbody",{children:L.map((e,t)=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:11,color:"#6b6558"},children:e.occurred_at?new Date(e.occurred_at).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"â"})}),(0,a.jsx)("td",{style:{maxWidth:280,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.product_title||"â"}),(0,a.jsx)("td",{children:e.store_hostname||"â"}),(0,a.jsx)("td",{style:{textAlign:"right"},children:null!=e.store_price_usd?"$"+Number(e.store_price_usd).toFixed(2):"â"}),(0,a.jsx)("td",{style:{textAlign:"right"},children:null!=e.amazon_price?"$"+Number(e.amazon_price).toFixed(2):"â"}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:4,background:"savings_too_high"===e.reason?"#FEE2E2":"brand_mismatch"===e.reason?"#FED7AA":"#E9D5FF",color:"savings_too_high"===e.reason?"#991B1B":"brand_mismatch"===e.reason?"#9A3412":"#581C87"},children:(e.reason||"unknown").replace(/_/g," ")})})]},t))})]})})]})]}),(0,a.jsx)(p,{}),0===k.length&&z.every(e=>!e.count)&&0===A.length&&(0,a.jsxs)("div",{className:"dash-card",style:{padding:"60px 24px",textAlign:"center",color:"#6b6558"},children:[(0,a.jsx)("div",{style:{fontSize:32,marginBottom:12},children:"\uD83D\uDCCA"}),(0,a.jsx)("div",{style:{fontSize:16,fontWeight:600,color:"#0b0f1a",marginBottom:8},children:"No data yet"}),(0,a.jsx)("div",{style:{fontSize:14},children:"Once a click is logged, this dashboard fills up."})]})]})]})}function o(e){let{eyebrow:t,title:s,entries:l,empty:i}=e,n=l.reduce((e,t)=>{let[,,,s]=t;return e+s},0);return(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"dash-eyebrow",style:{marginBottom:8},children:t}),(0,a.jsx)("h2",{className:"dash-title",style:{fontSize:28,marginBottom:16},children:s}),(0,a.jsx)("div",{className:"dash-card",style:{padding:24},children:0===n?(0,a.jsx)("div",{style:{fontSize:13,color:"#6b6558",textAlign:"center",padding:16},children:i}):l.map(e=>{let[t,s,l,i]=e,r=n>0?i/n*100:0;return(0,a.jsxs)("div",{style:{marginBottom:12},children:[(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",fontSize:13,marginBottom:4},children:[(0,a.jsx)("span",{children:s}),(0,a.jsxs)("span",{className:"dash-mono",style:{color:"#6b6558"},children:[i," \xb7 ",r.toFixed(0),"%"]})]}),(0,a.jsx)("div",{style:{background:"#f1ece3",borderRadius:4,height:8},children:(0,a.jsx)("div",{style:{background:l,width:"".concat(r,"%"),height:"100%",borderRadius:4}})})]},t)})})]})}function d(e){let{level:t}=e;if(null==t||""===t)return(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:11,color:"#9a9384"},children:"â"});let s=Number(t);if(isNaN(s))return(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:11,color:"#9a9384"},children:"â"});let l="#16a34a",i="L".concat(s);return s>=100?(l="#ff6b1a",i="FB"):s>=5?l="#EA580C":s>=3?l="#CA8A04":s>=1&&(l="#65A30D"),(0,a.jsx)("span",{className:"dash-mono",style:{display:"inline-block",padding:"2px 8px",borderRadius:6,background:l,color:"white",fontSize:10,fontWeight:700},children:i})}function c(e){let{type:t}=e,[s,l]={low_savings:["low savings","#ff6b1a"],no_brand:["no brand","#6b6558"],no_model:["no model","#6b6558"],broad_cascade:["broad cascade","#EA580C"],fallback_search:["fallback search","#ff6b1a"]}[t]||[t,"#6b6558"];return(0,a.jsx)("span",{className:"dash-mono",style:{display:"inline-block",padding:"2px 7px",borderRadius:4,background:l,color:"white",fontSize:9,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em"},children:s})}function h(e){let{clicks:t}=e,s=t||{total:0,slot0:0,slot1:0,slot2:0};return s.total&&0!==s.total?(0,a.jsxs)("span",{className:"dash-mono",style:{fontSize:11,fontWeight:600},title:"Slot 0: ".concat(s.slot0," \xb7 Slot 1: ").concat(s.slot1," \xb7 Slot 2: ").concat(s.slot2),children:[(0,a.jsx)("span",{style:{color:"#0b0f1a"},children:s.total}),(0,a.jsxs)("span",{style:{color:"#9a9384",marginLeft:6},children:["(",s.slot0,"/",s.slot1,"/",s.slot2,")"]})]}):(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:11,color:"#9a9384"},children:"â"})}function x(e){let{slot:t}=e,s=Number(t);return isNaN(s)?(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:11,color:"#9a9384"},children:"â"}):(0,a.jsx)("span",{className:"dash-mono",style:{display:"inline-block",padding:"2px 8px",borderRadius:6,background:["#ff6b1a","#65A30D","#9333EA"][s]||"#6b6558",color:"white",fontSize:10,fontWeight:700},children:["â Best","\uD83D\uDCB8 Value","\uD83C\uDF1F Top"][s]||"S".concat(s)})}function m(e){let{type:t}=e,[s,l]={panel_shown:["shown","#16a34a"],panel_suppressed:["suppress","#EA580C"],no_match:["no match","#9a9384"],cascade_fallback:["fallback","#CA8A04"],cart_extracted:["cart â","#65A30D"],cart_extract_failed:["cart â","#ef4444"],sanity_rejection:["rejected","#9333EA"],low_quality_warn:["low qual","#ff6b1a"]}[t]||[t,"#6b6558"];return(0,a.jsx)("span",{className:"dash-mono",style:{display:"inline-block",padding:"2px 8px",borderRadius:4,background:l,color:"white",fontSize:9,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em"},children:s})}function p(){let[e,t]=(0,l.useState)(1),[s,i]=(0,l.useState)(""),[n,r]=(0,l.useState)(""),[o,d]=(0,l.useState)("created_at"),[c,h]=(0,l.useState)("desc"),[x,m]=(0,l.useState)(!1),[p,u]=(0,l.useState)(null),[f,y]=(0,l.useState)(!1),[j,b]=(0,l.useState)(null),[v,S]=(0,l.useState)(null);async function _(e,t){if(!e)return;let s=t?"unhide":"hide";if(!t&&!confirm('Hide "'.concat(e,"\" from the website? You can restore it later by toggling 'Show hidden'.")))return;let a=sessionStorage.getItem("bp_dash_pw")||"";S(e);try{let l=await fetch("/api/dash/hide-page",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:a,product_slug:e,hidden:!t})}),i=await l.json();if(i.error){alert("Failed to ".concat(s,": ").concat(i.error));return}u(s=>{if(!s)return s;let a={...s,rows:s.rows.map(s=>s.product_slug===e?{...s,is_hidden:!t}:s)};return x||t||(a.rows=a.rows.filter(t=>t.product_slug!==e)),a})}catch(e){alert("Failed to ".concat(s,": ").concat((null==e?void 0:e.message)||"unknown error"))}finally{S(null)}}function w(e){o===e?h(e=>"asc"===e?"desc":"asc"):(d(e),h("desc"))}function N(e){return o!==e?"":"asc"===c?" â":" â"}if((0,l.useEffect)(()=>{let e=setTimeout(()=>r(s.trim()),400);return()=>clearTimeout(e)},[s]),(0,l.useEffect)(()=>{t(1)},[n,o,c,x]),(0,l.useEffect)(()=>{let t=sessionStorage.getItem("bp_dash_pw");
1if(!t)return;y(!0),b(null);let s=new URLSearchParams({key:t,page:String(e),sort:o,dir:c});n&&s.set("q",n),x&&s.set("include_hidden","1"),fetch("/api/dash/pages?".concat(s.toString())).then(e=>e.json()).then(e=>{e.error?b(e.error):u(e)}).catch(e=>b((null==e?void 0:e.message)||"fetch failed")).finally(()=>y(!1))},[e,n,o,c,x]),!p&&!f&&!j)return null;let k=Array.isArray(null==p?void 0:p.rows)?p.rows:[],z=Number(null==p?void 0:p.total_pages)||1,A=Number(null==p?void 0:p.total_rows)||0,B=Number(null==p?void 0:p.capped_total)||0,C=0===A?0:(e-1)*100+1,T=Math.min(100*e,B);return(0,a.jsxs)("div",{style:{marginBottom:40},children:[(0,a.jsx)("div",{className:"dash-eyebrow",style:{marginBottom:8},children:"â Deep dive"}),(0,a.jsx)("h2",{className:"dash-title",style:{fontSize:28,marginBottom:8},children:"All pages â paginated"}),(0,a.jsxs)("p",{style:{fontSize:13,color:"#6b6558",marginBottom:16},children:["100 per page, up to 1000 most recent. Click column headers to sort. ",A>B?"(".concat((A-B).toLocaleString()," older rows beyond the 1,000-row cap.)"):""]}),(0,a.jsxs)("div",{className:"dash-card",style:{padding:"14px 18px",marginBottom:12,display:"flex",flexWrap:"wrap",gap:12,alignItems:"center"},children:[(0,a.jsx)("input",{type:"search",value:s,onChange:e=>i(e.target.value),placeholder:"Search title, store, or slugâ¦",style:{flex:"1 1 280px",padding:"8px 12px",fontSize:14,border:"1px solid #e8e2d8",borderRadius:8,background:"#fff",color:"#0b0f1a",outline:"none",fontFamily:"inherit"}}),(0,a.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:"#6b6558",cursor:"pointer"},children:[(0,a.jsx)("input",{type:"checkbox",checked:x,onChange:e=>m(e.target.checked)}),"Show hidden"]}),(n||"created_at"!==o||"desc"!==c||x)&&(0,a.jsx)("button",{onClick:()=>{i(""),d("created_at"),h("desc"),m(!1)},style:{padding:"6px 12px",fontSize:12,fontWeight:600,background:"transparent",color:"#6b6558",border:"1px solid #e8e2d8",borderRadius:6,cursor:"pointer"},children:"Clear filters"}),f&&(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:11,color:"#9a9384"},children:"Loadingâ¦"})]}),j&&(0,a.jsxs)("div",{className:"dash-card",style:{padding:20,color:"#ef4444"},children:[(0,a.jsx)("strong",{children:"Error:"})," ",j]}),p&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"dash-card",style:{overflow:"hidden"},children:0===k.length?(0,a.jsx)("div",{style:{padding:32,textAlign:"center",color:"#6b6558"},children:n?'No pages match "'.concat(n,'".'):"No pages on this page."}):(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsxs)("th",{onClick:()=>w("created_at"),style:{cursor:"pointer"},children:["Created",N("created_at")]}),(0,a.jsx)("th",{children:"Title"}),(0,a.jsxs)("th",{onClick:()=>w("store_hostname"),style:{cursor:"pointer"},children:["Store",N("store_hostname")]}),(0,a.jsxs)("th",{onClick:()=>w("store_price_usd"),style:{textAlign:"right",cursor:"pointer"},children:["Store $",N("store_price_usd")]}),(0,a.jsxs)("th",{onClick:()=>w("amazon_price"),style:{textAlign:"right",cursor:"pointer"},children:["Amzn $",N("amazon_price")]}),(0,a.jsxs)("th",{onClick:()=>w("savings_pct"),style:{textAlign:"right",cursor:"pointer"},children:["Savings",N("savings_pct")]}),(0,a.jsx)("th",{style:{textAlign:"center"},children:"Clicks"}),(0,a.jsx)("th",{}),(0,a.jsx)("th",{})]})}),(0,a.jsx)("tbody",{children:k.map((e,t)=>{var s,l;return(0,a.jsxs)("tr",{style:{opacity:e.is_hidden?.5:1},children:[(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:11,color:"#6b6558"},children:e.created_at?new Date(e.created_at).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"â"})}),(0,a.jsxs)("td",{style:{maxWidth:320,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[e.is_hidden&&(0,a.jsx)("span",{style:{display:"inline-block",padding:"1px 6px",fontSize:9,fontWeight:700,background:"#9a9384",color:"white",borderRadius:3,marginRight:6,verticalAlign:"middle"},children:"HIDDEN"}),e.product_title||"â"]}),(0,a.jsx)("td",{children:e.store_hostname||"â"}),(0,a.jsx)("td",{style:{textAlign:"right"},children:null!=e.store_price_usd?"$"+Number(e.store_price_usd).toFixed(2):"â"}),(0,a.jsx)("td",{style:{textAlign:"right"},children:null!=e.amazon_price?"$"+Number(e.amazon_price).toFixed(2):"â"}),(0,a.jsx)("td",{style:{textAlign:"right",color:"#16a34a"},children:null!=e.savings_pct?e.savings_pct+"%":"â"}),(0,a.jsx)("td",{style:{textAlign:"center"},children:(0,a.jsx)("span",{className:"dash-mono",style:{fontSize:11,fontWeight:700,color:(null===(s=e.clicks)||void 0===s?void 0:s.total)>0?"#16a34a":"#9a9384"},children:(null===(l=e.clicks)||void 0===l?void 0:l.total)||0})}),(0,a.jsx)("td",{children:e.product_slug&&(0,a.jsx)("a",{href:"/compare/".concat(e.product_slug),target:"_blank",rel:"noopener",style:{fontSize:12},children:"View â"})}),(0,a.jsx)("td",{children:(0,a.jsx)("button",{onClick:()=>_(e.product_slug,e.is_hidden),disabled:v===e.product_slug,style:{padding:"4px 10px",fontSize:11,fontWeight:600,background:e.is_hidden?"#16a34a":"transparent",color:e.is_hidden?"white":"#dc2626",border:"1px solid ".concat(e.is_hidden?"#16a34a":"#fecaca"),borderRadius:6,cursor:v===e.product_slug?"wait":"pointer"},children:v===e.product_slug?"â¦":e.is_hidden?"Restore":"Hide"})})]},e.product_slug||t)})})]})}),z>1&&(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:16,gap:12,flexWrap:"wrap"},children:[(0,a.jsxs)("span",{className:"dash-mono",style:{fontSize:11,color:"#6b6558"}
1,children:["Showing ",C.toLocaleString(),"â",T.toLocaleString()," of ",B.toLocaleString(),A>B?" (capped from ".concat(A.toLocaleString(),")"):""]}),(0,a.jsxs)("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[(0,a.jsx)("button",{onClick:()=>t(1),disabled:e<=1||f,style:g(e<=1||f),children:"\xab First"}),(0,a.jsx)("button",{onClick:()=>t(e=>Math.max(1,e-1)),disabled:e<=1||f,style:g(e<=1||f),children:"â¹ Prev"}),(0,a.jsxs)("span",{className:"dash-mono",style:{fontSize:12,padding:"0 12px",color:"#0b0f1a",fontWeight:700},children:["Page ",e," / ",z]}),(0,a.jsx)("button",{onClick:()=>t(e=>Math.min(z,e+1)),disabled:e>=z||f,style:g(e>=z||f),children:"Next âº"}),(0,a.jsx)("button",{onClick:()=>t(z),disabled:e>=z||f,style:g(e>=z||f),children:"Last \xbb"})]})]})]})]})}function g(e){return{padding:"6px 12px",fontSize:12,fontWeight:600,background:e?"#f5f1ea":"#ffffff",color:e?"#9a9384":"#0b0f1a",border:"1px solid #e8e2d8",borderRadius:6,cursor:e?"not-allowed":"pointer"}}}},function(e){e.O(0,[2888,9774,179],function(){return e(e.s=267)}),_N_E=e.O()}]);
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.