1import{u as we,r as b,j as e}from"./vendor-react-q2zF07hT.js";import{e as $e}from"./CreateGoalView-D9b_r4wa.js";import{t as i,e as I,s as V,a0 as J,c1 as Ne,a2 as ne,C as Z,aj as se,P as le,f as De,cC as Ce,cB as ke,cI as Ge,bJ as He,L as Ee,aG as Re,aa as Me,cy as Ie,bq as Oe,A as Pe,bh as Ae,ax as _}from"./index-BDz9Ot1x.js";import{a as ze}from"./PunishmentScreen-smEKxhJ3.js";import{l as Be}from"./vendor-firebase-D9HXyH8B.js";import{N as Ve,V as Le,K as _e,i as Ue,X as Ke,j as We,b5 as qe}from"./vendor-icons-1fnEs_cQ.js";import"./CalendarPicker-JGX8eT5h.js";import"./vendor-markdown-_yXCZ_vV.js";import"./CreatePunishmentScreen-CxZ7cpVA.js";const Je=["gym","bed","walk","vitamins","wakeUp"];function me(){return Je.map(t=>({key:t,label:i(`create.firstGoal.habits.${t}.label`),photo:i(`create.firstGoal.habits.${t}.photo`),confirm:i(`create.firstGoal.habits.${t}.confirm`)}))}function Ye(t,n){const r=me().find(a=>a.label===t.trim());return r?n==="selfVerify"?r.confirm:r.photo:null}function Xe(t){return t==="timelapse"?i("create.firstGoal.criteria.titleTimelapse"):t==="selfVerify"?i("create.firstGoal.criteria.titleSelfVerify"):i("create.firstGoal.criteria.titlePhoto")}function Qe(t,n){return t==="selfVerify"?i("create.firstGoal.criteria.helperSelfVerify"):n?i("create.firstGoal.criteria.helperHuman"):i("create.firstGoal.criteria.helperAi")}function Ze(t){switch(t){case"timelapse":return"create.firstGoal.pledge.timelapse(rich)";case"camera":return"create.firstGoal.pledge.camera(rich)";case"selfVerify":return"create.firstGoal.pledge.selfVerify(rich)";default:return"create.firstGoal.pledge.photo(rich)"}}const et=[{label:null,value:"09:00"},{label:null,value:"13:00"},{label:null,value:"17:00"},{label:"Midnight",value:"23:59"}],tt=["07:00","08:00","10:00","11:00","12:00","14:00","15:00","16:00","18:00","19:00","20:00","21:00","22:00","23:00"];function U(t){const[n,r]=t.split(":");return Number(n)*60+Number(r)}function ie(t,n){const[r,a]=n.split(":");return new Date(t.getFullYear(),t.getMonth(),t.getDate(),Number(r),Number(a))}function H(t,n,r=new Date){return I(t,r)?ie(t,n).getTime()<r.getTime():V(t).getTime()<V(r).getTime()}function ge(t,n=new Date){return et.filter(r=>!H(t,r.value,n))}function xe(t,n=4,r=new Date){const a=ge(t,r),l=tt.filter(h=>!H(t,h,r));for(;a.length<n&&l.length>0;){let h=l[0],p=-1;for(const c of l){const T=a.length===0?1073741824:Math.min(...a.map(u=>Math.abs(U(u.value)-U(c))));T>p&&(p=T,h=c)}l.splice(l.indexOf(h),1),a.push({label:null,value:h})}return a.sort((h,p)=>U(h.value)-U(p.value)),a}function oe(t,n=new Date){const r=xe(t,4,n);return r.length===0?null:r[0].value}function nt(t=14,n=new Date){const r=V(n),a=[];for(let l=0;l<t;l++)a.push(J(r,l));return a.filter(l=>ge(l,n).length>0)}function re(t){const[n,r]=t.split(":"),a=Number(n),l=r;return Ne()?`${String(a).padStart(2,"0")}:${l}`:`${a%12===0?12:a%12}:${l} ${a>=12?"pm":"am"}`}function st(t){const n=re(t),r=n.lastIndexOf(" ");return r<0?{time:n,meridiem:""}:{time:n.slice(0,r),meridiem:n.slice(r+1)}}function it(t){return t.label===null?re(t.value):i("create.firstGoal.when.midnight")}function rt(t,n=new Date){const r=t.getTime()-n.getTime();if(r<=0)return i("create.firstGoal.when.passed");const a=Math.trunc(r/6e4);if(a<60)return i("create.firstGoal.when.inMinutes",{n:a});const l=Math.trunc(r/36e5);if(l<24){const p=a%60;return p===0?i("create.firstGoal.when.inHours",{n:l}):i("create.firstGoal.when.inHoursMinutes",{hours:l,minutes:p})}const h=Math.round(l/24);return i("create.firstGoal.when.inDays",{n:h})}const be=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],at=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ce(t,n=new Date){return I(t,n)?i("common.today"):I(t,J(n,1))?i("common.tomorrow"):`${be[t.getDay()]} ${t.getDate()}`}function lt(t,n=new Date){return I(t,n)?i("create.firstGoal.when.dayToday"):I(t,J(n,1))?i("create.firstGoal.when.dayTomorrow"):i("create.firstGoal.when.dayOnDate",{date:`${be[t.getDay()]} ${t.getDate()} ${at[t.getMonth()]}`})}function de(t,n){for(const r of n)if(t>r.index&&!r.answered)return r.index;return null}const o="create.firstGoal",ee=7,ot=0,z=1,ue=2,M=3,K=4,ct=5,fe=6,N="#0D0D0D",ye="#007AFF";function Tt(){const t=we(),n=ne,r=ne(s=>s.reset),a=Z(s=>s.overlordSettings.humanVerificationEnabled===!0),l=Z(s=>s.info),[h,p]=b.useState(ot),[c,T]=b.useState(""),[u,x]=b.useState(""),[y,E]=b.useState("photo"),[j,R]=b.useState(()=>V(new Date)),[m,O]=b.useState("17:00"),[P,F]=b.useState(!1),[$,A]=b.useState(null),f=b.useRef(null),v=b.useRef(null),[,L]=b.useState(0);b.useEffect(()=>{const s=setInterval(()=>L(d=>d+1),3e4);return()=>clearInterval(s)},[]),b.useEffect(()=>{r();const s=new Date,d=V(s);n.setState({isRepeating:!1,isInfiniteGoal:!1,selectedFrequency:"One-off",startDate:d,endDate:d}),n.getState().fcUpdateEvidenceType("photo");const g=Z.getState().info;if(n.setState({penaltyCurrencyName:g.currencyName??"USD",penaltyCurrencySymbol:g.currencySymbol??"$"}),H(d,"17:00",s)){const k=oe(d,s);if(k!==null)O(k),n.setState({deadline:k});else{const Q=J(d,1);R(Q),n.setState({startDate:Q,endDate:Q,deadline:"17:00"})}}else n.setState({deadline:"17:00"})},[r,n]);const C=(s,d)=>{const g=Ye(s,d);x(k=>k.trim()===""||k===f.current?(f.current=g,g??""):(f.current=g,k))},S=de(ee,[{index:z,answered:c.trim()!==""},{index:M,answered:u.trim()!==""},{index:K,answered:!H(j,m)}])??fe,D=(s,d=c)=>
1{if(!(s<0||s>=ee)){if(s>h){const g=de(s,[{index:z,answered:d.trim()!==""},{index:M,answered:u.trim()!==""},{index:K,answered:!H(j,m)}]);if(g!==null){A(g),p(g),ae(g);return}}p(s),ae(s),s===M&&C(c,y)}},ae=s=>{const d=v.current;d&&requestAnimationFrame(()=>d.scrollTo({top:s*d.clientHeight,behavior:"smooth"}))},je=s=>{R(s);let d=m;H(s,m)&&(d=oe(s)??m,O(d)),n.setState({startDate:s,endDate:s,deadline:d})},Y=c.trim()!==""&&u.trim()!=="",Fe=async()=>{if(P||!Y)return;if(ie(j,m).getTime()<Date.now()){le(i(`${o}.errors.deadlinePassedTitle`),i(`${o}.errors.deadlinePassedBody`),"warning"),D(K);return}F(!0);const d=n.getState();try{const g=De(j);await Ce({description:u.trim()||c.trim(),name:c.split(` 2`)[0],startDate:g,endDate:g,evidenceType:y,penalties:[...d.fcPunishments],nextDeadline:m,frequencyInstructions:"One-off",integrationsEnabled:[],isInfinite:!1,additionalConfig:{forfeitConfig:ke(d,{useImperialUnits:l.useImperialUnits===!0}),allowExtensions:!1},goalType:"active"}),Ge(d.fcPunishments),$e(t)}catch(g){console.warn("[FirstGoalFlow] create failed",g),le(i(`${o}.errors.notSavedTitle`),i(`${o}.errors.notSavedBodyMoney`),"error"),F(!1)}},ve=[{type:"photo",title:i("common.evidenceTypes.photo"),subtitle:i(`${o}.proof.photoSubtitle`),icon:e.jsx(Ve,{size:20,color:"#FFFFFF"}),tint:"blue"},{type:"timelapse",title:i("common.evidenceTypes.timelapse"),subtitle:i(`${o}.proof.timelapseSubtitle`),icon:e.jsx(Le,{size:20,color:"#FFFFFF"}),tint:"purple"},{type:"camera",title:i("common.evidenceTypes.cameraOnly"),subtitle:i(`${o}.proof.cameraSubtitle`),icon:e.jsx(_e,{size:20,color:"#FFFFFF"}),tint:"orange"},{type:"selfVerify",title:i("common.evidenceTypes.selfVerify"),subtitle:i(`${o}.proof.selfVerifySubtitle`),icon:e.jsx(Ue,{size:20,color:"#FFFFFF"}),tint:"green"}],Se=b.useMemo(()=>nt(),[]),Te=xe(j),X=st(m);return e.jsxs("div",{"data-theme":"light",className:"app-frame flex flex-col",style:{background:"#FFFFFF",color:N},children:[e.jsxs("button",{type:"button","aria-label":i("common.close"),onClick:()=>t(-1),className:"absolute z-10 flex items-center justify-center",style:{top:"calc(var(--sat) + 10px)",right:16,width:44,height:44},children:[e.jsx(ft,{progress:h/(ee-1)}),e.jsx(Ke,{size:18,color:N,className:"absolute"})]}),e.jsxs("div",{ref:v,className:"min-h-0 flex-1 snap-y snap-mandatory scroll-y",style:{scrollbarWidth:"none"},onScroll:s=>p(Math.min(S,Math.round(s.currentTarget.scrollTop/s.currentTarget.clientHeight))),children:[e.jsxs(G,{hidden:S<0,children:[e.jsx(ut,{children:i(`${o}.intro.title`)}),e.jsx("div",{style:{height:36}}),dt().map((s,d)=>e.jsxs("div",{className:"flex items-center",style:{gap:16,paddingTop:d===0?0:22},children:[e.jsx("span",{className:"flex shrink-0 items-center justify-center font-figtree-bold text-[18px] text-white",style:{width:48,height:48,borderRadius:24,background:N},children:d+1}),e.jsx("span",{className:"font-figtree-semibold text-[17px]",children:s})]},s)),e.jsx("div",{style:{height:34}}),e.jsxs("button",{type:"button",onClick:()=>q(()=>_(t,"/create")),className:"w-full text-left",style:{padding:"12px 14px",borderRadius:18,background:"#FFFFFF",border:"1px solid rgba(0,0,0,0.09)"},children:[e.jsx("div",{className:"font-figtree-semibold text-[15px]",children:i(`${o}.intro.skipTitle`)}),e.jsx("div",{className:"font-figtree text-[12.5px]",style:{color:"rgba(0,0,0,0.5)"},children:i(`${o}.intro.skipSubtitle`)})]}),e.jsx("div",{style:{height:24}}),e.jsxs("button",{type:"button",onClick:()=>D(z),className:"flex items-center justify-center gap-2 font-figtree text-[13.5px]",style:{minHeight:44,color:"rgba(0,0,0,0.52)"},children:[e.jsx(We,{size:18}),i(`${o}.intro.scrollToStart`)]})]}),e.jsxs(G,{hidden:S<1,children:[e.jsx(B,{children:i(`${o}.habit.title`)}),e.jsx(he,{value:c,onChange:s=>{T(s),s.trim()!==""&&$===z&&A(null)},placeholder:i(`${o}.habit.hint`),attention:$===z,rows:2}),e.jsx("div",{className:"flex flex-wrap",style:{gap:8,paddingTop:16},children:me().map(s=>e.jsx(te,{label:s.label,selected:c.trim()===s.label,onClick:()=>{T(s.label),C(s.label,y),D(ue,s.label)}},s.key))}),c.trim()!==""&&e.jsx(W,{onClick:()=>D(ue)})]}),e.jsxs(G,{hidden:S<2,children:[e.jsx(B,{children:i(`${o}.proof.title`)}),e.jsxs("div",{className:"flex flex-col",style:{gap:10,paddingTop:20},children:[ve.map(s=>e.jsx(pe,{icon:s.icon,tint:s.tint,title:s.title,subtitle:s.subtitle,onClick:()=>{E(s.type),n.getState().fcUpdateEvidenceType(s.type),C(c,s.type),D(M)}},s.type)),e.jsx(pe,{icon:e.jsx(qe,{size:20,color:"#FFFFFF"}),tint:"grey",title:i(`${o}.proof.somethingElseTitle`),subtitle:i(`${o}.proof.somethingElseSubtitle`),onClick:()=>q(()=>_(t,"/create"))})]})]}),e.jsxs(G,{hidden:S<3,children:[e.jsx(B,{children:Xe(y)}),e.jsx(he,{value:u,onChange:s=>{x(s),s.trim()!==""&&$===M&&A(null)},placeholder:y==="selfVerify"?i(`${o}.habits.gym.confirm`):i(`${o}.habits.gym.photo`),attention:$===M,rows:3}),e.jsx("p",{className:"font-figtree text-[14px]",style:{paddingTop:16,color:"rgba(0,0,0,0.5)"},children:Qe(y,a)}),u.trim()!==""&&e.jsx(W,{onClick:()=>D(K)})]}),e.jsxs(G,{hidden:S<4,padded:!1,children:[e.jsx("div",{style:{padding:"0 24px"},children:e.jsx(B,{children:i(`${o}.when.title`)})}),e.jsxs("div",{className:"flex items-end",style:{padding:"24px 24px 0"},children:[e.jsx("span",{className:"font-figtree-extrabold",style:{fontSize:76,lineHeight:1,letterSpacing:-3.6},children:X.time}),X.meridiem!==""&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{width:10}}),e.jsx("span",{className:"font-figtree-bold",style:{fontSize:24,letterSpacing:-.6,paddingBottom:6},children:X.meridiem})]})]}),e.jsx("p",{className:"font-figtree text-[15px]",style:{padding:"12px 24px 0",color:"rgba(0,0,0,0.5)"},children:`${ce(j)} · ${rt(ie(j,m))}`}),e.jsx("div",{className:"no-scrollbar flex overflow-x-auto",style:{gap:8,padding:"26px 24px 0"},children:Se.map(s=>e.jsx(te,{label:ce(s),selected:I(s,j),onClick:()=>je(s)},s.toISOString()))}),e.jsx("div",{className:"flex flex-wrap",style:{gap:8,padding:"14px 24px 0"},children:Te.map(s=>e.jsx(te,{label:it(s),selected:m===s.value,onClick:()=>{O(s.value),n.setState({deadline:s.value})}},s.value))}),e.jsxs("div",{className:"flex items-center",style:{padding:"28px 24px 0"},children:[e.jsx("button",{type:"button",onClick:()=>q(()=>_(t,"/create")),className:"font-figtree text-[15px]",style:{opacity:.75,minHeight:44},children:i(`${o}.when.needSomethingElse`)}),e.jsx("span",{className:"flex-1"}),!H(j,m)&&e.jsx(W,{onClick:()=>D(ct),inline:!0})]})]}),e.jsxs(G,{hidden:S<5,children:[e.jsx(B,{children:i(`${o}.stake.title`)}),e.jsx("div",{style:{paddingTop:20},children:e.jsx(ze,{})}),e.jsx(W,{onClick:()=>D(fe)})]}),e.jsxs(G,{hidden:S<6,children:[e.jsx(ht,{evidenceType:y,habit:c,selectedDate:j,deadline:m,currencyName:l.currencyName??"USD",currencySymbol:l.currencySymbol??"$",pointsMode:l.pointsModeEnabled===!0}),e.jsx("p",{className:"font-figtree text-[14px]",style:{paddingTop:14,color:"rgba(0,0,0,0.5)"},children:i(`${o}.pledge.deleteNote`)}),e.jsx("div",{style:{height:24}}),e.jsx(se,{label:Y?i(`${o}.pledge.create`):i(`${o}.pledge.answerFirst`),disabled:!Y,isLoading:P,onClick:()=>void Fe()})]})]}),e.jsx("div",{className:"shrink-0 px-6",style:{paddingBottom:"max(12px, var(--sab))"},children:e.jsx("button",{type:"button",disabled:P,onClick:()=>q(()=>_(t,"/create")),className:"w-full font-figtree-semibold text-[15px]",style:{minHeight:44,color:"rgba(0,0,0,0.55)"},children:i(`${o}.intro.skipTitle`)})})]})}function dt(){return He(`${o}.intro.loop`)}function G({children:t,padded:n=!0,hidden:r=!1}){return e.jsx("section",{className:"flex h-full snap-start flex-col justify-center",style:{padding:n?"0 24px":"0",minHeight:"100%",display:r?"none":void 0},children:e.jsx("div",{className:"scroll-y",style:{maxHeight:"100%",paddingTop:24,paddingBottom:24},children:t})})}function ut({children:t}){return e.jsx("h1",{className:"font-figtree-extrabold",style:{fontSize:36,lineHeight:1.04,letterSpacing:-1.5},children:t})}function B({children:t}){return e.jsx("h2",{className:"font-figtree-bold",style:{fontSize:28,lineHeight:1.12,letterSpacing:-.9,paddingBottom:16},children:t})}function he({value:t,onChange:n,placeholder:r,attention:a,rows:l}){return e.jsx("textarea",{value:t,rows:l,placeholder:r,onChange:h=>n(h.target.value),className:"w-full resize-none bg-transparent font-figtree outline-none",style:{fontSize:18,lineHeight:1.4,padding:"14px 16px",borderRadius:22,border:a?`2px solid ${ye}`:"1px solid rgba(0,0,0,0.1)",transition:"border-color 220ms ease-out"}})}function te({label:t,selected:n,onClick:r}){return e.jsx("button",{type:"button",onClick:r,className:"shrink-0 font-figtree-semibold text-[14px]",style:{minHeight:38,padding:"0 14px",borderRadius:19,background:n?N:"#FFFFFF",color:n?"#F
2FFFFF":N,border:`1px solid ${n?N:"rgba(0,0,0,0.1)"}`},children:t})}function pe({icon:t,tint:n,title:r,subtitle:a,onClick:l}){return e.jsxs("button",{type:"button",onClick:l,className:"flex w-full items-center text-left",style:{gap:14,padding:12,borderRadius:24,background:"#FFFFFF",border:"1px solid rgba(0,0,0,0.09)"},children:[e.jsx(Me,{icon:t,tint:n,solid:!0,size:44}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block font-figtree-semibold text-[16px]",children:r}),e.jsx("span",{className:"block font-figtree text-[12.5px]",style:{color:"rgba(0,0,0,0.5)"},children:a})]})]})}function W({onClick:t,inline:n=!1}){return e.jsx("div",{className:n?"":"flex justify-end",style:n?void 0:{paddingTop:20},children:e.jsxs("button",{type:"button",onClick:t,className:"flex items-center font-figtree-semibold text-[15px] text-white",style:{gap:8,padding:"13px 16px 13px 20px",borderRadius:999,background:N},children:[i("common.next"),e.jsx("span",{"aria-hidden":!0,children:"â"})]})})}function ft({progress:t}){if(t<=0)return null;const n=19,r=2*Math.PI*n;return e.jsxs("svg",{width:44,height:44,viewBox:"0 0 44 44",className:"absolute","aria-hidden":!0,children:[e.jsx("circle",{cx:22,cy:22,r:n,fill:"none",stroke:"rgba(0,0,0,0.1)",strokeWidth:3}),e.jsx("circle",{cx:22,cy:22,r:n,fill:"none",stroke:N,strokeWidth:3,strokeLinecap:"round",strokeDasharray:r,strokeDashoffset:r*(1-Math.min(1,t)),transform:"rotate(-90 22 22)",style:{transition:"stroke-dashoffset 320ms ease-out"}})]})}function ht({evidenceType:t,habit:n,selectedDate:r,deadline:a,currencyName:l,currencySymbol:h,pointsMode:p}){const c=ne(f=>f.fcPunishments),T=Ie(c),u=`${o}.stakeClause`,x=f=>e.jsx("span",{style:{color:ye},children:f}),y=f=>{const v=[];for(const L of c)if(L.punishmentType===f)for(const C of L.recipients){const S=C.name.trim()||(f==="text"?C.phoneNumber:C.email)||"";S!==""&&!v.includes(S)&&v.push(S)}return v.length===0?null:v.length===1?v[0]:v.length===2?i(`${u}.namesTwo`,{first:v[0],second:v[1]}):i(`${u}.namesMore`,{n:v.length-1,first:v[0]})},E=c.some(f=>f.punishmentType==="text"),j=c.some(f=>f.punishmentType==="email"),R=E?y("text"):null,m=j?y("email"):null,O=f=>R!==null?w(`${u}.textedNamed(rich)`,{names:f?x(R):R}):w(`${u}.textGoesOut(rich)`,{},f?x:void 0),P=f=>m!==null?w(`${u}.emailedNamed(rich)`,{names:f?x(m):m}):w(`${u}.emailGoesOut(rich)`,{},f?x:void 0),F=[...E?[O]:[],...j?[P]:[]];let $;if(T>0){const f=p?w(`${u}.losePoints(rich)`,{points:x(`${T*100}FP`)}):w(`${u}.charged(rich)`,{amount:x(Oe(h,l,T))});$=F.length===0?f:F.length===1?w(`${u}.joinTwo(rich)`,{first:f,second:F[0](!1)}):w(`${u}.joinThree(rich)`,{first:f,second:F[0](!1),third:F[1](!1)})}else F.length===0?$=i(`${u}.none`):$=F.length>1?w(`${u}.joinTwo(rich)`,{first:F[0](!0),second:F[1](!1)}):F[0](!0);const A=n.trim()===""?i(`${o}.pledge.yourGoal`):n.trim();return e.jsx("p",{className:"font-figtree-bold",style:{fontSize:26,lineHeight:1.3,letterSpacing:-.7},children:w(Ze(t),{goal:x(A),day:lt(r),deadline:x(re(a)),stake:$})})}function w(t,n,r){const a=i(t),l=[],h=/\{(\w+)(?:\(([^)]*)\))?\}/g;let p=0,c,T=0;for(;(c=h.exec(a))!==null;){c.index>p&&l.push(a.slice(p,c.index));const[,u,x]=c,y=n[u],E=y!==void 0?y:x!==void 0?r?r(x):x:c[0];l.push(e.jsx("span",{children:E},`${u}-${T++}`)),p=c.index+c[0].length}return p<a.length&&l.push(a.slice(p)),e.jsx(e.Fragment,{children:l})}function q(t){Ee(n=>e.jsxs("div",{style:{padding:"6px 24px max(16px, var(--sab))"},children:[e.jsx(Re,{}),e.jsx("h2",{className:"font-figtree-bold",style:{fontSize:24,lineHeight:1.15,letterSpacing:-.7,color:N},children:i(`${o}.skipSheet.title`)}),e.jsx("div",{style:{height:10}}),e.jsx("p",{className:"font-figtree text-[15px]",style:{lineHeight:1.4,color:"rgba(0,0,0,0.55)"},children:i(`${o}.skipSheet.body`)}),e.jsx("div",{style:{height:22}}),e.jsx(se,{label:i(`${o}.skipSheet.fullSetup`),onClick:()=>{pt(),n(),t()}}),e.jsx("div",{style:{height:4}}),e.jsx(se,{label:i(`${o}.skipSheet.keepGoing`),variant:"ghost",onClick:n})]}))}async function pt(){const t=Pe();if(t)try{await Be(Ae(t,"info"),{hasCreatedFirstGoal:!0},{merge:!0})}catch{}}export{Tt 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.