1import{d as X,l as v,q as T,x as J,v as Z,w as ee,aa as V,bz as te,bV as P,b7 as D,cD as oe,U as l,O as f,_ as t,L as j,u as c,P as m,a8 as b,K as S,a3 as se,$ as h,F as g,a0 as u,a2 as ne,V as W,aR as Y,aC as ae,M as n}from"./icons-Bgx76RDF.js";import{_ as re}from"./InputError.vue_vue_type_script_setup_true_lang-DEdWSwcD.js";import{_ as ie}from"./LoginForm.vue_vue_type_script_setup_true_lang-E8Vy50GZ.js";import{_ as le}from"./LinkLayout.vue_vue_type_script_setup_true_lang-DN42OQtL.js";import{u as ce,b as de,h as ue,l as R,r as $}from"./app-1To86AzH.js";import"./utils-CDN07tui.js";import"./index-B_Re349R.js";import"./reka-ui-CxQDcGDz.js";import"./index-CvoMWG5z.js";import"./Label.vue_vue_type_script_setup_true_lang-CQc2ZaV7.js";import"./index-DgDhoHPE.js";import"./FieldGroup.vue_vue_type_script_setup_true_lang-BROUGhDq.js";import"./Input.vue_vue_type_script_setup_true_lang-DhF2TxEr.js";import"./index-DQD3-gx9.js";import"./index-DzzYwkmi.js";import"./PasswordInput.vue_vue_type_script_setup_true_lang-Qp0NM0xY.js";const pe={class:"relative min-h-screen overflow-hidden bg-gradient-to-br from-stone-950 via-stone-900 to-we-green py-24"},fe={class:"relative z-10 mx-auto max-w-xl space-y-6 px-4 sm:px-6"},me={class:"font-poppins text-2xl font-semibold text-white sm:text-3xl md:text-4xl"},he={class:"mt-2 font-poppins text-sm text-stone-400 sm:text-base"},ge={class:"relative space-y-6 rounded-2xl border border-stone-700/50 bg-gradient-to-br from-stone-800/90 to-stone-900/95 p-6 shadow-2xl backdrop-blur-md sm:p-8"},be={class:"text-center font-poppins text-sm text-stone-400"},xe={class:"flex items-center justify-center gap-2 sm:gap-3"},ve={key:0,class:"text-2xl text-stone-500"},we=["value","aria-label","autofocus","onInput","onKeydown","onPaste"],ye=["disabled"],ke={class:"space-y-3 text-center"},Ce={class:"flex items-center justify-center gap-1.5 sm:gap-2"},Te={key:0,class:"text-xl text-stone-500"},Ve={class:"flex h-12 w-10 items-center justify-center rounded-lg border border-stone-600 bg-stone-800/60 font-mono text-2xl font-semibold text-white"},_e={key:0,class:"inline-flex items-center gap-2 font-poppins text-sm text-stone-400"},Ee={key:0,class:"flex gap-3 rounded-xl border border-red-500/30 bg-red-500/10 p-4 font-poppins text-sm text-red-200"},Ae={class:"flex items-center gap-3 rounded-xl border border-stone-700/60 bg-stone-900/50 p-4"},je={class:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-we-orange/15 text-amber-400"},Se={class:"min-w-0 flex-1 font-poppins"},Be={class:"text-xs text-stone-500"},Fe={class:"truncate text-sm font-medium text-white"},Le={class:"flex gap-3"},Ne=["disabled"],Pe=["disabled"],De={class:"text-center font-poppins text-stone-300"},We={class:"font-medium text-white"},Ye={class:"text-center font-poppins text-sm text-stone-500"},Re={key:4,class:"text-center"},$e="BCDFGHJKLMNPQRSTVWXZ",k=6,st=X({layout:le,__name:"Link",props:{step:{},code:{},device:{},email:{},accountHint:{},error:{},canResetPassword:{type:Boolean}},setup(s){const d=s,H=ce(),K=v(()=>{var o;return((o=H.props.errors)==null?void 0:o.code)??null}),p=T(Array(k).fill("")),x=T([]),w=T(!1),_=v(()=>p.value.every(o=>o!=="")),B=()=>Z(()=>{var o;return(o=x.value[0])==null?void 0:o.focus()}),C=T(!1);J(()=>{requestAnimationFrame(()=>C.value=!0),d.step==="enter"&&B()}),ee(()=>d.step,o=>{o==="enter"&&B()});const F=()=>{!_.value||w.value||(w.value=!0,$.get(route("link"),{code:p.value.join("")},{onFinish:()=>w.value=!1}))},L=(o,e)=>{var r;const a=e.toUpperCase().split("").filter(i=>$e.includes(i));if(a.length===0){p.value[o]="";return}a.slice(0,k-o).forEach((i,Q)=>p.value[o+Q]=i),(r=x.value[Math.min(o+a.length,k-1)])==null||r.focus(),_.value&&F()},M=(o,e)=>{const a=e.target;L(o,a.value),a.value=p.value[o]},z=(o,e)=>{var a,r,i;e.key==="Backspace"&&p.value[o]===""&&o>0?(p.value[o-1]="",(a=x.value[o-1])==null||a.focus(),e.preventDefault()):e.key==="ArrowLeft"&&o>0?(r=x.value[o-1])==null||r.focus():e.key==="ArrowRight"&&o<k-1&&((i=x.value[o+1])==null||i.focus())},U=(o,e)=>{var a;e.preventDefault(),L(o,((a=e.clipboardData)==null?void 0:a.getData("text"))??"")},y=de({code:d.code??""}),I=()=>y.post(route("link.approve")),O=()=>y.post(route("link.deny")),N=()=>$.post(route("link.switch-account"),{code:d.code??""}),q=v(()=>(d.code??"").replace("-","").split("")),E=v(()=>d.step==="done"||d.step==="confirmed"),G=v(()=>E.value||d.step==="cancelled"),A=v(()=>{switch(d.step){case"sign_in":return{icon:V,title:"Connect your TV",text:"Sign in or create an account, then approve the code on your TV."};case"approve":return{icon:V,title:"Sign in on your TV?",text:"Check that this code matches the one on your TV."};case"confirm":return{icon:oe,title:"Confirm it's you",text:"Your TV asked to delete your WildEarth account."};case"wrong_account":return{icon:D,title:"A different account",text:"This TV is signed in with another WildEarth account."};case"done":return{icon:P,title:"You're all set",text:"Your TV is signing in now. You can close this page."};case"confirmed":return{icon:P,title:"Confirmed",text:"Your TV can finish deleting your account. You can close this page."};case"cancelled":return{icon:te,title:"Cancelled",text:"The code was cancelled, and nothing changed on your TV."};default:return{icon:V,title:"Connect your TV",text:"Enter the code shown on your TV screen."}}});return(o,e)=>(n(),l(g,null,[f(c(ue),{title:"Link your TV | WildEarth"},{default:j(()=>[...e[1]||(e[1]=[t("meta",{name:"robots",content:"noindex, nofollow","head-key":"robots"},null,-1)])]),_:1}),t("section",pe,[e[12]||(e[12]=t("div",{class:"absolute inset-0"},[t("img",{src:"/images/Explorer_CTA_bg.jpg",alt:"",class:"h-full w-full object-cover object-center",loading:"eager"}),t("div",{class:"absolute inset-0 bg-gradient-to-br from-stone-950/90 via-stone-900/85 to-we-green/70"})],-1)),e[13]||(e[13]=t("div",{class:"pointer-events-none absolute top-20 left-1/4 hidden h-96 w-96 rounded-full bg-we-orange opacity-20 blur-[120px] sm:block"},null,-1)),t("div",fe,[t("div",{class:b(["text-center transition-all duration-700 ease-out",C.value?"translate-y-0 opacity-100":"translate-y-6 opacity-0"])},[t("div",{class:b(["mb-4 inline-flex h-14 w-14 items-center justify-center rounded-full border",E.value?"border-emerald-500/40 bg-emerald-500/15":s.step==="cancelled"?"border-stone-600 bg-stone-800/60":"border-we-orange/30 bg-gradient-to-br from-we-orange/20 to-amber-500/10"])},[(n(),S(se(A.value.icon),{class:b(["h-7 w-7",E.value?"text-emerald-400":s.step==="cancelled"?"text-stone-400":"text-amber-400"])}
1,null,8,["class"]))],2),t("h1",me,h(A.value.title),1),t("p",he,h(A.value.text),1)],2),t("div",{class:b(["relative transition-all delay-150 duration-700 ease-out",C.value?"translate-y-0 opacity-100":"translate-y-6 opacity-0"])},[e[10]||(e[10]=t("div",{class:"absolute -inset-0.5 rounded-2xl bg-gradient-to-r from-we-orange/20 via-transparent to-teal-500/20 opacity-30 blur"},null,-1)),t("div",ge,[s.step==="sign_in"?(n(),l(g,{key:0},[f(ie,{"can-reset-password":s.canResetPassword,"show-heading":!1,"show-sign-up":!1},null,8,["can-reset-password"]),t("p",be,[e[3]||(e[3]=u(" New to WildEarth? ",-1)),f(c(R),{href:o.route("register.account"),class:"font-medium text-we-orange underline-offset-2 hover:underline"},{default:j(()=>[...e[2]||(e[2]=[u("Create an account",-1)])]),_:1},8,["href"])])],64)):s.step==="enter"?(n(),l("form",{key:1,class:"space-y-6",onSubmit:ne(F,["prevent"])},[t("div",xe,[(n(!0),l(g,null,W(p.value,(a,r)=>(n(),l(g,{key:r},[r===3?(n(),l("span",ve,"-")):m("",!0),t("input",{ref_for:!0,ref:i=>x.value[r]=i,value:a,"aria-label":`Code character ${r+1} of ${k}`,autofocus:r===0,class:b(["h-14 w-11 rounded-xl border bg-stone-800/60 text-center font-mono text-2xl font-semibold text-white uppercase caret-we-orange transition-colors outline-none focus:border-we-orange focus:ring-2 focus:ring-we-orange/30 sm:h-16 sm:w-13 sm:text-3xl",a?"border-stone-500":"border-stone-700"]),inputmode:"text",autocomplete:"one-time-code",autocapitalize:"characters",spellcheck:"false",onInput:i=>M(r,i),onKeydown:i=>z(r,i),onPaste:i=>U(r,i),onFocus:e[0]||(e[0]=i=>i.target.select())},null,42,we)],64))),128))]),f(re,{class:"text-center",message:s.error??K.value??void 0},null,8,["message"]),t("button",{type:"submit",disabled:w.value||!_.value,class:"flex w-full items-center justify-center gap-2 rounded-xl bg-gradient-to-r from-we-orange to-amber-500 px-6 py-3 font-poppins font-semibold text-white shadow-lg shadow-we-orange/20 transition-all hover:shadow-we-orange/40 disabled:cursor-not-allowed disabled:opacity-50"},[w.value?(n(),S(c(Y),{key:0,class:"h-4 w-4 animate-spin"})):m("",!0),e[4]||(e[4]=u(" Continue ",-1))],8,ye)],32)):s.step==="approve"||s.step==="confirm"?(n(),l(g,{key:2},[t("div",ke,[t("div",Ce,[(n(!0),l(g,null,W(q.value,(a,r)=>(n(),l(g,{key:r},[r===3?(n(),l("span",Te,"-")):m("",!0),t("span",Ve,h(a),1)],64))),128))]),s.device?(n(),l("p",_e,[f(c(V),{class:"h-4 w-4"}),u(" "+h(s.device),1)])):m("",!0)]),s.step==="confirm"?(n(),l("div",Ee,[f(c(ae),{class:"mt-0.5 h-4 w-4 shrink-0"}),e[5]||(e[5]=t("p",null,"Approving lets this TV delete your WildEarth account. For 30 days after that, [email protected] can restore it.",-1))])):m("",!0),t("div",Ae,[t("div",je,[f(c(D),{class:"h-5 w-5"})]),t("div",Se,[t("p",Be,h(s.step==="confirm"?"Account":"Signing in as"),1),t("p",Fe,h(s.email),1)]),t("button",{type:"button",class:"shrink-0 font-poppins text-xs text-we-orange underline-offset-2 hover:underline",onClick:N}," Not you? ")]),t("div",Le,[t("button",{type:"button",disabled:c(y).processing,class:"flex-1 rounded-xl border border-stone-600 px-6 py-3 font-poppins font-semibold text-stone-200 transition-colors hover:bg-stone-800 disabled:opacity-50",onClick:O}," Cancel ",8,Ne),t("button",{type:"button",disabled:c(y).processing,class:b(["flex flex-1 items-center justify-center gap-2 rounded-xl px-6 py-3 font-poppins font-semibold text-white shadow-lg transition-all disabled:opacity-50",s.step==="confirm"?"bg-red-600 shadow-red-600/20 hover:bg-red-500":"bg-gradient-to-r from-we-orange to-amber-500 shadow-we-orange/20 hover:shadow-we-orange/40"]),onClick:I},[c(y).processing?(n(),S(c(Y),{key:0,class:"h-4 w-4 animate-spin"})):m("",!0),e[6]||(e[6]=u(" Approve ",-1))],10,Pe)])],64)):s.step==="wrong_account"?(n(),l(g,{key:3},[t("p",De,[e[7]||(e[7]=u(" The TV is signed in with ",-1)),t("span",We,h(s.accountHint??"another account"),1),e[8]||(e[8]=u(". Sign in with that account to confirm, or cancel on the TV. ",-1))]),t("p",Ye,"You're signed in as "+h(s.email)+".",1),t("button",{type:"button",class:"w-full rounded-xl bg-gradient-to-r from-we-orange to-amber-500 px-6 py-3 font-poppins font-semibold text-white shadow-lg shadow-we-orange/20",onClick:N}," Sign out and use the other account ")],64)):G.value?(n(),l("div",Re,[f(c(R),{href:o.route("link"),
1class:"font-poppins text-sm text-we-orange underline-offset-2 hover:underline"},{default:j(()=>[...e[9]||(e[9]=[u(" Enter another code ",-1)])]),_:1},8,["href"])])):m("",!0)])],2),s.step==="enter"||s.step==="sign_in"?(n(),l("div",{key:0,class:b(["space-y-2 text-center font-poppins text-sm text-stone-400 transition-all delay-300 duration-700",C.value?"opacity-100":"opacity-0"])},[...e[11]||(e[11]=[t("p",null,"No code on your TV? Open WildEarth on your TV and choose Sign in.",-1),t("p",{class:"text-stone-500"},[u(" Questions? "),t("a",{href:"mailto:[email protected]",class:"text-we-orange underline hover:text-amber-400"},"[email protected]")],-1)])],2)):m("",!0)])])],64))}});export{st as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.