PageSourceSearch

https://sf-bloomwalk.lovable.app/assets/stroll-DONbgv8q.js

js sf-bloomwalk.lovable.app collected 2026-10-03 03:44:23 UTC 8,849 bytes, 1 lines download raw bytes

1import{a as e,c as t,i as n,l as r,o as i,r as a,s as o,t as s,u as c}from"./planner.functions-DL7h1E38.js";import{A as l,O as u,S as d,n as f,t as p,x as m}from"./index-SARM2CwS.js";import{t as h}from"./SiteHeader-Dk1yQIDq.js";var g=l(u()),_=d(),v={lat:37.7749,lng:-122.4194};function y(){let l=c(s),u=c(a),{month:d,isOverridden:y}=p(`/stroll`),[b,x]=(0,g.useState)(`Hayes Valley, San Francisco`),[S,C]=(0,g.useState)(null),[w,T]=(0,g.useState)(30),[E,D]=(0,g.useState)(`default`),[O,k]=(0,g.useState)(!1),[A,j]=(0,g.useState)(null),[M,N]=(0,g.useState)(null),[P,F]=(0,g.useState)(!0),[I,L]=(0,g.useState)(!0),{open:R,menuHeight:z}=f(),B=I&&R?{maxHeight:`calc(100dvh - ${56+z+12}px)`}:void 0,V=E===`toddler`?Math.min(w,20):w,H=E===`toddler`?[10,15,20]:[15,30,60];async function U(e){N(await u({data:{origin:{lat:e.lat,lng:e.lng},durationMin:V,mode:E,month:d}}))}async function W(e){e?.preventDefault(),j(null),k(!0);try{let e=await l({data:{query:b}});if(!e)throw Error(`Couldn't find "${b}" in San Francisco.`);let t={lat:e.lat,lng:e.lng,label:e.label.split(`,`)[0]};C(t),await U(t)}catch(e){j(e instanceof Error?e.message:`Something went wrong.`)}finally{k(!1)}}function G(){if(!navigator.geolocation){j(`Geolocation isn't available in this browser.`);return}k(!0),navigator.geolocation.getCurrentPosition(async e=>{let t={lat:e.coords.latitude,lng:e.coords.longitude,label:`You are here`};C(t),x(`Current location`);try{await U(t)}catch(e){j(e instanceof Error?e.message:`Something went wrong.`)}finally{k(!1)}},e=>{j(e.message),k(!1)},{timeout:8e3})}let K=(0,g.useRef)(d);(0,g.useEffect)(()=>{if(!S||K.current===d)return;K.current=d;let e=setTimeout(()=>{U(S)},350);return()=>clearTimeout(e)},[d]);let q=M?(M.route.distanceMeters/1e3).toFixed(2):null,J=M?Math.round(M.route.durationSeconds/60):null,Y=M?[...M.nearbyTrees,...M.parkStops]:[],X=new Set([...M?.waypoints.map(e=>e.id)??[],...M?.parkStops.map(e=>e.id)??[]]);return(0,_.jsxs)(`div`,{className:`h-screen flex flex-col overflow-hidden`,children:[(0,_.jsx)(h,{}),(0,_.jsxs)(`main`,{className:`flex-1 min-h-0 relative lg:grid lg:grid-cols-[380px_1fr]`,children:[(0,_.jsx)(`div`,{className:`absolute inset-0 lg:static lg:order-2 lg:col-start-2 lg:row-start-1 lg:h-full isolate z-0`,children:(0,_.jsx)(m,{fallback:(0,_.jsx)(`div`,{className:`absolute inset-0 bg-secondary animate-pulse`}),children:(0,_.jsx)(n,{className:`absolute inset-0`,center:S??v,origin:S,encodedPolyline:M?.route.encoded??null,trees:Y,highlightIds:X})})}),(0,_.jsxs)(`aside`,{className:[`lg:relative lg:translate-x-0 lg:translate-y-0 lg:max-h-none lg:rounded-none lg:shadow-none lg:border-r lg:border-b-0`,`lg:order-1 lg:col-start-1 lg:row-start-1 lg:h-full`,`bg-card border-border overflow-y-auto`,`transition-[transform,max-height] duration-300 z-20`,`absolute inset-x-0 bottom-0 max-h-[75vh] rounded-t-2xl shadow-2xl border-t`,I?`translate-y-0`:`translate-y-[calc(100%-max(20dvh,3.25rem))]`,`md:max-lg:inset-y-0 md:max-lg:bottom-auto md:max-lg:left-0 md:max-lg:right-auto`,`md:max-lg:w-[360px] md:max-lg:max-w-[85vw] md:max-lg:max-h-none`,`md:max-lg:rounded-none md:max-lg:border-t-0 md:max-lg:border-r md:max-lg:shadow-xl`,P?`md:max-lg:translate-x-0`:`md:max-lg:-translate-x-full`,`md:translate-y-0`].join(` `),style:B,children:[(0,_.jsxs)(`button`,{type:`button`,onClick:()=>L(e=>!e),"aria-label":I?`Collapse panel`:`Expand panel`,"aria-expanded":I,className:`md:hidden sticky top-0 z-10 w-full flex items-center justify-between px-5 py-3 bg-card border-b border-border rounded-t-2xl`,children:[(0,_.jsxs)(`span`,{className:`flex flex-col items-start`,children:[(0,_.jsx)(`span`,{className:`block w-10 h-1 rounded-full bg-border mb-1.5 self-center`}),(0,_.jsx)(`span`,{className:`font-display text-base leading-none`,children:I?`Stroll nearby`:M?`${q} km · ${J} min loop`:`Stroll nearby`})]}),I?(0,_.jsx)(r,{size:18}):(0,_.jsx)(i,{size:18})]}),(0,_.jsxs)(`div`,{className:`p-5 space-y-5`,children:[(0,_.jsxs)(`div`,{className:`hidden md:block`,children:[(0,_.jsx)(`h1`,{className:`font-display text-2xl`,children:`Stroll nearby`}),(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`A loop near you. Out and back, mostly past flowers.`})]}
1),(0,_.jsx)(e,{month:d,isOverridden:y}),(0,_.jsxs)(`form`,{onSubmit:W,className:`space-y-3`,children:[(0,_.jsxs)(`label`,{className:`block`,children:[(0,_.jsx)(`div`,{className:`text-xs uppercase tracking-wider text-muted-foreground mb-1`,children:`Starting from`}),(0,_.jsx)(`input`,{type:`text`,value:b,onChange:e=>{x(e.target.value),C(null)},className:`w-full px-3 py-2 rounded-md border border-input bg-paper text-sm`}),(0,_.jsx)(`button`,{type:`button`,onClick:G,className:`text-xs underline text-moss mt-1`,children:`Use my location`})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`div`,{className:`text-xs uppercase tracking-wider text-muted-foreground mb-2`,children:`Walker type`}),(0,_.jsx)(`div`,{className:`grid grid-cols-3 gap-2 mb-3`,children:[`default`,`stroller`,`toddler`].map(e=>(0,_.jsx)(`button`,{type:`button`,onClick:()=>D(e),className:`px-2 py-1.5 rounded-md border text-xs font-medium capitalize ${E===e?`bg-ink text-paper border-ink`:`bg-paper border-border hover:border-ink`}`,children:e},e))}),E!=="default"&&(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground mb-3`,children:E===`stroller`?`Avoids steep hills, prefers flat corridors.`:`Caps distance, routes via a playground when possible.`})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`div`,{className:`text-xs uppercase tracking-wider text-muted-foreground mb-2`,children:`How long`}),(0,_.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:H.map(e=>(0,_.jsxs)(`button`,{type:`button`,onClick:()=>T(e),className:`px-3 py-2 rounded-md border text-sm font-medium ${V===e?`bg-ink text-paper border-ink`:`bg-paper border-border hover:border-ink`}`,children:[e,` min`]},e))})]}),(0,_.jsx)(`button`,{type:`submit`,disabled:O,className:`w-full px-4 py-2.5 rounded-md bg-ink text-paper font-medium disabled:opacity-60`,children:O?`Planning…`:M?`Re-plan`:`Find a stroll`})]}),A&&(0,_.jsx)(`div`,{className:`text-sm rounded-md border border-destructive/40 bg-destructive/10 text-destructive p-3`,children:A}),M&&(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`div`,{className:`rounded-md border border-border p-3 grid grid-cols-2 gap-2 text-center`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsxs)(`div`,{className:`font-display text-lg`,children:[q,` km`]}),(0,_.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:`Distance`})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsxs)(`div`,{className:`font-display text-lg`,children:[J,` min`]}),(0,_.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:`Time`})]})]}),M.steepWarning&&M.maxGradePct!==null&&(0,_.jsxs)(`div`,{className:`text-sm rounded-md border border-amber-400/50 bg-amber-100/40 text-amber-900 p-3`,children:[`Best loop has a `,Math.round(M.maxGradePct),`% grade segment — may be a push.`]}),M.parkStops.length>0&&(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`h2`,{className:`font-display text-lg mb-2`,children:`Rest stops`}),(0,_.jsx)(`ul`,{className:`space-y-2`,children:M.parkStops.map(e=>(0,_.jsxs)(`li`,{className:`rounded-md border border-border bg-paper p-3 flex gap-3`,children:[(0,_.jsx)(`div`,{className:`w-6 h-6 rounded-md border-2 border-ink shrink-0 mt-0.5 bg-moss`}),(0,_.jsxs)(`div`,{className:`text-sm`,children:[(0,_.jsx)(`div`,{className:`font-medium`,children:e.address}),(0,_.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:e.genusSpecies})]})]},e.id))})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsxs)(`h2`,{className:`font-display text-lg mb-2`,children:[`Bloom stops`,(0,_.jsx)(`span`,{className:`text-muted-foreground text-sm font-sans ml-2`,children:M.waypoints.length})]}),(0,_.jsx)(`ul`,{className:`space-y-2`,children:M.waypoints.map((e,t)=>(0,_.jsxs)(`li`,{className:`rounded-md border border-border bg-paper p-3 flex gap-3`,children:[(0,_.jsx)(`div`,{className:`w-6 h-6 rounded-full border-2 border-ink shrink-0 mt-0.5`,style:{background:e.color}}),(0,_.jsxs)(`div`,{className:`text-sm`,children:[(0,_.jsxs)(`div`,{className:`font-medium`,children:[t+1,`. `,e.common]}),(0,_.jsx)(`div`,{className:`italic text-muted-foreground text-xs`,children:e.genusSpecies}),(0,_.jsx)(`div`,{className:`text-muted-foreground text-xs mt-0.5`,children:e.address})]})]},e.id))})]})]})]})]}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>F(e=>!e),"aria-label":P?`Hide planner`:`Show planner`,"aria-expanded":P,className:`hidden md:max-lg:flex absolute top-3 z-30 w-8 h-8 items-center justify-center rounded-md border border-border bg-card shadow transition-[left] duration-300`,style:{left:P?`min(360px, 85vw)`:`0.5rem`},children:P?(0,_.jsx)(t,{size:16}):(0,_.jsx)(o,{size:16})})]})]})}export{y as component};

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.