1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5894],{35894:function(e,t,r){r.r(t),r.d(t,{default:function(){return l}});var n=r(57437),o=r(2265);let a=["Make the headline braver.","Turn the orange to forest green.","Add a banner about free shipping through Friday.","Make the text a little bigger.","Delete the navigation."],s="#FF5500";function l(){let{targetId:e="post-body"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},[t,r]=(0,o.useState)(""),[l,c]=(0,o.useState)([]),[i,u]=(0,o.useState)(!1),[d,p]=(0,o.useState)(!1),m=(0,o.useRef)(null),f=(0,o.useRef)(null),h=(0,o.useRef)(null),x=(0,o.useRef)(s),g=(0,o.useRef)([]),b=(0,o.useRef)(null),y=(0,o.useRef)(!1),k=(0,o.useRef)(null),w=()=>document.getElementById(e),v=()=>{var e;if(f.current)return f.current;let t=w(),r=null!==(e=(null==t?void 0:t.querySelector("h1, h2"))||document.querySelector("h1"))&&void 0!==e?e:null;return f.current=r,r},N=()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches,j=e=>{N()||e.animate([{filter:"brightness(1.8)"},{filter:"brightness(1)"}],{duration:750,easing:"cubic-bezier(0.22, 1, 0.36, 1)"})},A=()=>{!N()&&k.current&&k.current.animate([{transform:"translateX(0)"},{transform:"translateX(-7px)"},{transform:"translateX(6px)"},{transform:"translateX(-4px)"},{transform:"translateX(0)"}],{duration:420,easing:"ease-out"})},S=(e,t)=>{c(r=>[...r,{text:e,kind:t}]),"done"===t&&u(!0)},C=e=>{if(h.current)return;h.current=[];let t=e=>null!==k.current&&k.current.contains(e);e.querySelectorAll("[style]").forEach(e=>{if(t(e))return;let r=e.getAttribute("style")||"";/color:\s*#ff5500/i.test(r)&&!/background/i.test(r)&&h.current.push({el:e,prop:"color",old:e.style.color}),/background:\s*#ff5500/i.test(r)&&h.current.push({el:e,prop:"background",old:e.style.background})}),e.querySelectorAll(".text-primary").forEach(e=>{t(e)||h.current.push({el:e,prop:"color",old:e.style.color})}),e.querySelectorAll(".bg-primary").forEach(e=>{t(e)||h.current.push({el:e,prop:"background",old:e.style.background})})},E=e=>{let t=w();if(!t){S("Owner Mode could not find its page region. That is a bug on our side, not a wall.","note");return}switch(e.op){case"setAccent":C(t),x.current=e.color,h.current.forEach(t=>{let{el:r,prop:n}=t;r.style.transition="color 0.6s ease, background 0.6s ease","color"===n?r.style.color=e.color:r.style.background=e.color,j(r)}),b.current&&(b.current.style.background=e.color),S(e.color.toUpperCase()===s?"Accent back to orange, where it belongs.":"Accent repainted, ".concat(h.current.length," places with one sentence."),"done");break;case"setHeadline":{let t=v();t&&e.text&&(null===m.current&&(m.current=t.textContent),t.textContent=e.text,t.scrollIntoView({behavior:N()?"auto":"smooth",block:"center"}),N()||t.animate([{transform:"scale(0.96)",opacity:.4},{transform:"scale(1.03)",opacity:1},{transform:"scale(1)"}],{duration:600,easing:"cubic-bezier(0.22, 1, 0.36, 1)"}),S("Headline rewritten. Look up.","done"));break}case"addBanner":if(!b.current){let e=document.createElement("div");e.setAttribute("style","margin: 0 0 1.5em; padding: 14px 18px; border-radius: 12px; color: #0A0A0A; font-weight: 800; letter-spacing: 0.08em; text-align: center;"),t.prepend(e),b.current=e}b.current.textContent=e.text||"20% OFF THROUGH FRIDAY",b.current.style.background=x.current,N()||b.current.animate([{transform:"translateY(-16px) scale(0.97)",opacity:0},{transform:"none",opacity:1}],{duration:480,easing:"cubic-bezier(0.22, 1, 0.36, 1)"}),j(b.current),S("Banner is up.","done");break;case"removeBanner":b.current&&(b.current.remove(),b.current=null,S("Banner is down.","done"));break;case"trimIntro":if(0===g.current.length){let e=Array.from(t.querySelectorAll("p")).filter(e=>!(null!==k.current&&k.current.contains(e)));for(let t=1;t<=3&&t<e.length;t++)g.current.push(e[t]),e[t].style.display="none";S("Introduction trimmed. Your copy only.","done")}break;case"restoreIntro":g.current.forEach(e=>e.style.display=""),g.current=[],S("Introduction restored.","done");break;case"textScale":t.style.transition="font-size 0.45s ease",t.style.zoom=String(e.scale/100),k.current&&t.contains(k.current)&&(k.current.style.zoom=String(100/e.scale)),y.current=100!==e.scale,S("Body text at ".concat(e.scale," percent."),"done");break;case"say":e.text&&S(e.text,"note");break;case"refuse":A(),S(e.text||"That is part of the protected structure. Owner Mode cannot change it.","refused")}},R=e=>{let t=e.toLowerCase();return/(nav|menu)/.test(t)?E({op:"refuse",color:"",text:"",scale:100}):/headline|title/.test(t)?E({op:"setHeadline",color:"",text:"The business had the truth.",scale:100}):/blue|green|color|colour|orange/.test(t)?E({op:"setAccent",color:/green/.test(t)?"#1F7A4D":/orange/.test(t)?s:"#2F7BFF",text:"",scale:100}):/banner|sale|shipping|off/.test(t)?E({op:"addBanner",color:"",text:"FREE SHIPPING THROUGH FRIDAY",scale:100}):/bigger|larger/.test(t)?E({op:"textScale",color:"",text:"",scale:112}):/smaller/.test(t)?E({op:"textScale",color:"",text:"",scale:92}):/intro|shorter/.test(t)?E({op:"trimIntro",color:"",text:"",scale:100}):void S("Owner Mode did not catch that one. Try one of the suggestions.","note")},I=async e=>{if(!d){p(!0);try{var t;let r=await fetch("/api/ownermode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e})});if(!r.ok)throw Error(String(r.status));let n=await r.json();(null===(t=n.actions)||void 0===t?void 0:t.length)?n.actions.forEach(E):R(e)}catch(t){R(e)}finally{p(!1)}}};return(0,n.jsx)("div",{className:"max-w-3xl mx-auto px-6 mb-14",children:(0,n.jsxs)("div",{ref:k,className:"border border-border/25 rounded-[1.75rem] bg-card/10 p-5 md:p-8",children:[(0,n.jsx)("p",{className:"font-mono text-[10px] font-black uppercase tracking-[0.2em] text-primary mb-2",children:"This page has an Owner Mode"}),(0,n.jsxs)("p",{className:"text-sm text-muted-foreground font-medium leading-relaxed mb-4",children:["Ask it to change something. It can alter the article you are seeing. It cannot touch the website around it. ",(0,n.jsx)("span",{className:"text-foreground font-bold",children:"Tap an example to see."})]}),(0,n.jsx)("p",{className:"font-mono text-[10px] font-black uppercase tracking-[0.18em] text-muted-foreground mb-2",children:"Tap one to try it"}),(0,n.jsx)("div",{className:"grid grid-cols-1 gap-1.5 sm:flex sm:flex-wrap sm:gap-2 mb-1 pr-10 sm:pr-0",children:a.map(e=>(0,n.jsxs)("button",{type:"button",disabled:d,onClick:()=>I(e),className:"text-left text-[13px] sm:text-xs font-semibold text-muted-foreground border border-border/30 rounded-2xl sm:rounded-full px-4 py-2.5 sm:px-3.5 sm:py-1.5 hover:border-primary/50 hover:text-foreground transition-colors disabled:opacity-60",children:[(0,n.jsx)("span",{className:"text-primary font-black mr-1.5","aria-hidden":!0,
1children:"âº"}),e]},e))}),(0,n.jsxs)("form",{onSubmit:e=>{e.preventDefault(),t.trim()&&!d&&(I(t.trim()),r(""))},className:"flex flex-col sm:flex-row gap-2 mt-3",children:[(0,n.jsx)("input",{value:t,onChange:e=>r(e.target.value),placeholder:d?"Owner Mode is working...":"Or type your own change...",disabled:d,className:"flex-1 h-12 w-full rounded-full bg-background/60 border border-border/30 px-5 text-base sm:text-sm text-foreground placeholder:text-muted-foreground/60 focus:outline-none focus:border-primary/50 disabled:opacity-60"}),(0,n.jsx)("button",{type:"submit",disabled:d,className:"px-6 h-12 w-full sm:w-auto whitespace-nowrap rounded-full bg-primary text-primary-foreground font-black uppercase tracking-wider text-xs hover:opacity-90 transition-opacity disabled:opacity-60",children:d?"...":"Change it"})]}),l.length>0&&(0,n.jsxs)("div",{className:"mt-4 border-t border-border/20 pt-4 space-y-1.5",children:[l.map((e,t)=>(0,n.jsxs)("p",{className:"text-sm font-medium leading-snug",children:[(0,n.jsx)("span",{className:"font-mono text-[10px] font-black uppercase tracking-[0.15em] mr-2 ".concat("done"===e.kind?"text-emerald-400":"refused"===e.kind?"text-amber-400":"text-sky-400"),children:"done"===e.kind?"Changed":"refused"===e.kind?"Refused":"Owner Mode"}),e.text]},t)),i&&(0,n.jsxs)("p",{className:"pt-3 text-lg md:text-xl font-black uppercase italic tracking-tight text-foreground animate-in fade-in slide-in-from-bottom-2 duration-500",children:["You changed the page. ",(0,n.jsx)("span",{className:"text-primary",children:"You never touched the website."})]}),(0,n.jsx)("button",{type:"button",onClick:()=>{var e,t;f.current&&null!==m.current&&(f.current.textContent=m.current),m.current=null,f.current=null,null===(e=h.current)||void 0===e||e.forEach(e=>{let{el:t,prop:r,old:n}=e;"color"===r?t.style.color=n:t.style.background=n}),h.current=null,x.current=s,g.current.forEach(e=>e.style.display=""),g.current=[],null===(t=b.current)||void 0===t||t.remove(),b.current=null;let r=w();r&&y.current&&(r.style.fontSize="",r.style.zoom="",k.current&&(k.current.style.zoom="")),y.current=!1,c([]),u(!1)},className:"mt-1 font-mono text-[11px] uppercase tracking-[0.15em] text-muted-foreground hover:text-foreground transition-colors",children:"Reset the page â"})]}),(0,n.jsx)("p",{className:"mt-4 font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground/70 leading-relaxed",children:"An AI with one job and hard walls: it can change this page for you, but it cannot touch the site around it. Owner Mode, in miniature. Changes live only in your browser."})]})})}}}]);
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.