1import{j as e,i as n}from"./vendor-react-B5Pseaix.js";import{B as A}from"./full-app-18EMxhwu.js";import{H as F}from"./HideawayMapCanvas-CaGCKCl9.js";import{l as H}from"./location-pins-epLuB5X7.js";import{I as V}from"./boot-splash-AtJZf0AM.js";import"./runtime-CXNh-kxh.js";import"./zk-private-playback-resource-event-goq3u1hy.js";import"./privacy-baseline-BcFSn41l.js";import"./zk-file-attachments-CZSe1Z2M.js";import"./personal-preview-cache-B39e4-gA.js";import"./Button-CrUKVqFn.js";import"./recovery-code-input-B70lrfPT.js";import{a as z}from"./locale-DyzxhBRz.js";import{cW as w,ef as B,d3 as Z}from"./HideawayBrand-B6JCvqDo.js";import{h as U,L as W}from"./message-location-z_JgyX7p.js";import"./index-B8iGKxjQ.js";import"./hideaways-api-x3SE4Eo1.js";import"./public-links-CbjS7WkX.js";import"./Toast-CcSXSCl4.js";import"./privacy-mode-policy-BVsxtZzg.js";import"./crypto-store-key-B4FvvkIe.js";import"./beta-access-DXDtLBoG.js";import"./network-path-policy-dVxdVi9s.js";import"./core-media-telemetry-BpVhhgaJ.js";import"./GhostSignal-C1cOgE16.js";import"./map-tiles-DMdsu8VP.js";import"./matrix-media-BFF5jega.js";import"./burn-timer-_MRqHuou.js";function Y({lifted:l}){return e.jsx("span",{className:"hideaway-drop-pin","data-lifted":l?"true":"false","aria-hidden":"true",children:e.jsxs("span",{className:"hideaway-drop-pin__body",children:[e.jsx("span",{className:"hideaway-drop-pin__head"}),e.jsx("span",{className:"hideaway-drop-pin__stem"})]})})}const b=25,q=10,$={lat:20,lng:0};function y(l,r){const c=Math.PI/180,s=(r.lat-l.lat)*c,o=(r.lng-l.lng)*c,d=Math.sin(s/2)**2+Math.cos(l.lat*c)*Math.cos(r.lat*c)*Math.sin(o/2)**2;return 2*6371e3*Math.asin(Math.sqrt(d))}function Ne({onClose:l,onSend:r}){const c=n.useId(),s=z(),[o,d]=n.useState(()=>typeof navigator<"u"&&navigator.geolocation?"locating":"unavailable"),[a,v]=n.useState(null),[j,h]=n.useState($),[N,x]=n.useState(2),[i,M]=n.useState(null),[k,C]=n.useState(2),[L,S]=n.useState(0),[f,_]=n.useState(!1),{user:I}=V(),[E,g]=n.useState(!1),u=n.useRef(null);n.useEffect(()=>()=>{u.current&&window.clearTimeout(u.current)},[]);const O=n.useCallback(t=>{M({lat:t.centerLat,lng:t.centerLng}),C(t.zoom),g(!0),u.current&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>g(!1),160)},[]),m=n.useCallback(()=>{typeof navigator>"u"||!navigator.geolocation||navigator.geolocation.getCurrentPosition(t=>{const p={lat:t.coords.latitude,lng:t.coords.longitude,accuracyMeters:Number.isFinite(t.coords.accuracy)?t.coords.accuracy:void 0};v(p),h({lat:p.lat,lng:p.lng}),x(16),d("ready")},t=>d(t.code===t.PERMISSION_DENIED?"denied":"unavailable"),{enableHighAccuracy:!0,timeout:12e3,maximumAge:3e4})},[]),T=n.useCallback(()=>{typeof navigator>"u"||!navigator.geolocation||(d("locating"),m())},[m]);n.useEffect(()=>{m()},[m]);const R=!!(a&&i&&o==="ready"&&y(i,a)<=b),D=!!(i&&k>=q&&(!a||y(i,a)>b)),P=o==="ready"?U(a?.accuracyMeters)||s("location.ready"):s(o==="locating"?"location.findingYou":o==="denied"?"location.off":"location.unavailable");return e.jsxs(A,{open:!0,onClose:l,labelledBy:c,title:s("location.title"),panelClassName:"md:max-w-md",children:[e.jsx("div",{className:"-mx-5 -mt-4",children:e.jsxs("div",{className:"relative",children:[e.jsx(F,{markers:[],things:a&&o==="ready"?[H({id:"you",label:"You",lat:a.lat,lng:a.lng,kind:"self",avatarUrl:I?.avatarUrl,accuracyMeters:a.accuracyMeters})]:[],focusLocation:j,focusZoom:N,onViewChange:O,seamless:!0,showHeader:!1,showHint:!1,fitControl:!1,controlsLayout:"stack",controls:e.jsx("button",{type:"button",className:"hideaway-map-stack__key","aria-label":s("location.goToMe"),title:s("location.goToMe"),onClick:()=>{if(a){const t=L%2*1e-5;S(p=>p+1),h({lat:a.lat+t,lng:a.lng}),x(16)}else T()},children:e.jsx(w,{size:18,"aria-hidden":"true"})}),heightClassName:"h-[min(300px,42dvh)]"}),R?null:e.jsx(Y,{lifted:E})]})}),e.jsxs("div",{className:"mt-3 space-y-1",children:[e.jsxs("button",{type:"button",disabled:o!=="ready"||!a,onClick:()=>a&&r({...a,kind:"self"}),className:"hideaway-pressable flex w-full items-center gap-3 rounded-[var(--control-radius)] px-2 py-2.5 text-left transition-colors hover:bg-white/[0.05] disabled:cursor-default disabled:hover:bg-transparent",children:[e.jsx("span",{className:"inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-white/[0.08] text-white",children:e.jsx(w,{size:18})}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:`block text-[14px] ${o==="ready"?"text-white":"text-white/50"}`,children:s("location.sendCurrent")}),e.jsx("span",{className:"block text-[12px] text-white/50",children:P})]})]}),e.jsxs("button",{type:"button",disabled:o!=="ready"||!a,"aria-expanded":f,onClick:()=>_(t=>!t),className:"hideaway-pressable flex w-full items-center gap-3 rounded-[var(--control-radius)] px-2 py-2.5 text-left transition-colors hover:bg-white/[0.05] disabled:cursor-default disabled:hover:bg-transparent",children:[e.jsx("span",{className:"inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-white/[0.08] text-white",children:e.jsx(B,{size:18})}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:`block text-[14px] ${o==="ready"?"text-white":"text-white/50"}`,children:s("location.shareLive")}),e.jsx("span",{className:"block text-[12px] text-white/50",children:s("location.shareLiveHint")})]})]}),f&&a?e.jsx("div",{className:"flex gap-2 pb-1 pl-[60px]",role:"group","aria-label":s("location.shareLiveFor"),children:W.map(t=>e.jsx("button",{type:"button",onClick:()=>r({...a,kind:"self",live:{expiresAt:Date.now()+t.ms}}),className:"hideaway-pressable rounded-[var(--control-radius-sm)] bg-white/[0.08] px-3 py-1.5 text-[13px] text-white transition-colors hover:bg-white/[0.14]",children:s(t.labelKey)},t.ms))}):null,D&&i?e.jsxs("button",{type:"button",onClick:()=>r({lat:i.lat,lng:i.lng,kind:"pin"}),className:"hideaway-pressable flex w-full items-center gap-3 rounded-[var(--control-radius)] px-2 py-2.5 text-left transition-colors hover:bg-white/[0.05]",children:[e.jsx("span",{className:"inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-white/[0.08] text-white",children:e.jsx(Z,{size:18})}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block text-[14px] text-white",children:s("location.sendSpot")}),e.jsxs("span",{className:"block text-[12px] tabular-nums text-white/50",children:[i.lat.toFixed(5),", ",i.lng.toFixed(5)]})]})]}):e.jsx("p",{className:"px-2 pt-1 text-[12px] text-white/40",children:s("location.moveMap")})]})]})}export{Ne 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.