PageSourceSearch

https://betterness.ai/_next/static/chunks/72513-5192ae4ab6908b6b.js

js betterness.ai collected 2026-10-05 02:49:53 UTC 21,261 bytes, 1 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e7705a20-0b5e-4ba4-9c08-926a128c9ed3",e._sentryDebugIdIdentifier="sentry-dbid-e7705a20-0b5e-4ba4-9c08-926a128c9ed3")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[72513],{66906:function(e,t,n){n.d(t,{l:function(){return o}});var l=n(58736),a=n(42334),r=n(2265);function o(e){let t=null==e?void 0:e.country,n=null==e?void 0:e.latitude,o=null==e?void 0:e.longitude,[i,s]=(0,r.useState)(null),{origin:c,onFocus:u}=(0,l.O)("number"==typeof n&&"number"==typeof o?{lat:n,lng:o}:i),[d,m]=(0,r.useState)(""),[f,p]=(0,r.useState)([]),[x,g]=(0,r.useState)(!1),[h,y]=(0,r.useState)(!1),b=(0,r.useRef)(0),v=(0,r.useRef)(),w=(0,r.useRef)(!1);(0,r.useEffect)(()=>{if(v.current&&clearTimeout(v.current),w.current){w.current=!1;return}if(d.length<3){p([]),y(!1);return}return v.current=setTimeout(async()=>{let e=++b.current;g(!0);try{var n;let l=(0,a.FO)(c,t);l.set("input",d);let r=await fetch("/api/places/autocomplete?".concat(l.toString()));if(!r.ok)throw Error("HTTP ".concat(r.status));let o=await r.json();if(e!==b.current)return;let i=null!==(n=o.suggestions)&&void 0!==n?n:[];p(i),y(i.length>0)}catch(t){console.error("[useAddressAutocomplete] fetch error:",t),e===b.current&&(p([]),y(!1))}finally{e===b.current&&g(!1)}},300),()=>{v.current&&clearTimeout(v.current)}},[d,t,c]);let k=(0,r.useCallback)(async e=>{y(!1),p([]);try{let t=await fetch("/api/places/details?placeId=".concat(encodeURIComponent(e.placeId)));if(!t.ok)throw Error("HTTP ".concat(t.status));let n=await t.json(),l={lat:n.latitude,lng:n.longitude};return(0,a.C7)(l)&&s({...l,city:n.city}),n}catch(e){return console.error("[useAddressAutocomplete] details error:",e),null}},[]),N=(0,r.useCallback)(()=>{y(!1)},[]),j=(0,r.useCallback)(e=>{w.current=!0,v.current&&clearTimeout(v.current),m(e),p([]),y(!1)},[]);return{origin:c,onFocus:u,query:d,setQuery:m,suggestions:f,loading:x,open:h,close:N,commit:j,selectSuggestion:k}}},5826:function(e,t,n){n.d(t,{B:function(){return o}});var l=n(57437),a=n(38706),r=n(46414);function o(e){let{origin:t}=e,n=(0,a.T)("memberLocation");return(0,l.jsx)(r.x,{variant:"caption",className:"text-tertiary",role:"status",children:t.city?n("searchingNear",{city:t.city}):n("device"===t.source?"usingDevice":t.source?"usingSaved":"requestHint")})}},68787:function(e,t,n){n.d(t,{i:function(){return j}});var l=n(57437),a=n(58736),r=n(42334),o=n(5826),i=n(2265),s=n(54887),c=n(30166),u=n(83774),d=n(51817),m=n(32489),f=n(38706),p=n(66906),x=n(171),g=n(1424);let h=(0,c.default)(()=>n.e(98877).then(n.bind(n,98877)).then(e=>e.LocationMiniMap),{loadableGenerated:{webpack:()=>[98877]},ssr:!1});function y(e){return e.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLocaleLowerCase().replace(RegExp("[^\\p{L}\\p{N}]+","gu")," ").trim().replace(/\s+/g," ")}function b(e){let t=y(e.address);return t&&t!==y(e.name)?t:null}function v(e){return!!(null==e?void 0:e.startsWith("member-place:"))}function w(e){var t,n,l,a;let r=[...new Set((null!==(t=e.aliases)&&void 0!==t?t:[]).map(y).filter(t=>t&&t!==y(e.name)))].sort().join("|"),o="number"==typeof e.lat&&"number"==typeof e.lng?"".concat(e.lat.toFixed(5),",").concat(e.lng.toFixed(5)):"";return[null!==(n=b(e))&&void 0!==n?n:"",o,r,null!==(l=e.usageCount)&&void 0!==l?l:"",null!==(a=e.confirmedAt)&&void 0!==a?a:""].join("::")}function k(e,t){let n=w(e);return t.filter(e=>w(e)===n).length>1}function N(e,t){var n;let l=new Set([e.name,...null!==(n=e.aliases)&&void 0!==n?n:[]].map(y).filter(Boolean)),a=b(e),r=!!e.place_id&&!v(e.place_id);return t.filter(t=>{var n;if(e.place_id&&t.place_id===e.place_id)return!0;let o=[t.name,...null!==(n=t.aliases)&&void 0!==n?n:[]].map(y).some(e=>l.has(e)),i=b(t),s=!!(a&&i===a);return r?v(t.place_id)&&o&&s:o||s})}function j(e){let{open:t,value:n,onChange:c,savedPlaces:w=[]}=e,j=(0,f.T)("flow"),C=(0,f.G)(),_=(0,x._)(),M=(0,a.O)((null==n?void 0:n.lat)!=null&&null!=n.lng?{lat:n.lat,lng:n.lng}:null),{requestLocation:L}=M,S=(0,p.l)({latitude:null==n?void 0:n.lat,longitude:null==n?void 0:n.lng}),T=S.setQuery,A=(0,i.useRef)(null),[F,q]=(0,i.useState)(null),[E,I]=(0,i.useState)(null),[P,z]=(0,i.useState)(!1),[D,Q]=(0,i.useState)(!1),[H,R]=(0,i.useState)(null),[O,Z]=(0,i.useState)(null),[B,K]=(0,i.useState)(!1),U=(0,i.useRef)(0);(0,i.useEffect)(()=>K(!0),[]),(0,i.useEffect)(()=>{U.current+=1},[t,n]),(0,i.useEffect)(()=>
1{if(!t||n)return;let e=!0,l=new AbortController;return I(null),Q(!1),z(!0),L().then(async t=>{if(e){Q(!(0,r.C7)(t)),R((0,r.C7)(t)?{lat:t.lat,lng:t.lng}:null);try{let n=await fetch("/api/places/nearby?".concat((0,r.FO)(t)),{signal:l.signal}),a=n.ok?await n.json():{places:[]};e&&I(Array.isArray(a.places)?a.places:[])}catch(t){e&&I([])}finally{e&&z(!1)}}}),()=>{e=!1,l.abort()}},[t,n,L]),(0,i.useEffect)(()=>{t||(I(null),Q(!1),z(!1),R(null),Z(null),q(null),T(""))},[t,T]),(0,i.useEffect)(()=>{if(!t||n){q(null);return}let e=()=>{A.current&&q(A.current.getBoundingClientRect())};return e(),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[t,n]);let G=(0,i.useCallback)(e=>{let t=w.find(t=>e.place_id&&t.place_id===e.place_id);if(t){c({...e,place_id:t.place_id}),Z(null),S.setQuery("");return}let n=N(e,w);if(1===n.length){var l;c({...e,place_id:null===(l=n[0])||void 0===l?void 0:l.place_id}),Z(null),S.setQuery("");return}let a=w.filter(t=>v(t.place_id)&&function(e,t){var n,l;let a=new Set([e.name,...null!==(n=e.aliases)&&void 0!==n?n:[]].map(y).filter(Boolean));return[t.name,...null!==(l=t.aliases)&&void 0!==l?l:[]].map(y).some(e=>a.has(e))}(e,t)),r=n.length>1?n:a;if(r.length>0){Z({candidate:e,savedMatches:r}),S.setQuery("");return}c(e),Z(null),S.setQuery("")},[S,c,w]),W=(0,i.useCallback)(e=>{G({name:e.name,address:e.address,...null!==e.lat?{lat:e.lat}:{},...null!==e.lng?{lng:e.lng}:{},place_id:e.placeId})},[G]),$=(0,i.useCallback)(async e=>{let t=++U.current,n=await S.selectSuggestion(e);t===U.current&&G({name:e.mainText,address:(null==n?void 0:n.formattedAddress)||e.secondaryText,place_id:e.placeId,..."number"==typeof(null==n?void 0:n.latitude)?{lat:n.latitude}:{},..."number"==typeof(null==n?void 0:n.longitude)?{lng:n.longitude}:{}})},[S,G]),J=(0,i.useCallback)(()=>{let e=S.query.trim();if(e.length<2)return;let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"").slice(0,80)||"place",n=H?"".concat(H.lat.toFixed(5),":").concat(H.lng.toFixed(5)):"unmapped";c({name:e,address:e,place_id:"member-place:".concat(n,":").concat(crypto.randomUUID(),":").concat(t),...H||{}}),S.setQuery("")},[S,H,c]),V=S.query.trim().length>=2?N({name:S.query,address:S.query},w):[];return(0,l.jsxs)(l.Fragment,{children:[t&&!n?(0,l.jsxs)("div",{className:"mt-3 rounded-xl border border-stroke-soft bg-elevation-minus1 p-3",children:[(0,l.jsxs)("div",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-tertiary",children:[(0,l.jsx)(u.Z,{className:"size-3.5","aria-hidden":!0}),j("composerLocation.title"),P?(0,l.jsx)(d.Z,{className:"size-3.5 animate-spin","aria-hidden":!0}):null]}),O?(0,l.jsxs)("div",{className:"mt-2.5 rounded-xl border border-stroke-selection bg-selection-bg p-3",children:[(0,l.jsx)("p",{className:"text-sm font-semibold text-primary",children:j("composerLocation.matchPrompt",{name:O.candidate.name})}),(0,l.jsx)("p",{className:"mt-1 text-xs text-secondary",children:j("composerLocation.matchHelp")}),(0,l.jsxs)("div",{className:"mt-2 space-y-1.5",children:[O.savedMatches.map(e=>{var t;let n=b(e)?e.address:null,a="number"==typeof e.lat&&"number"==typeof e.lng?"".concat(e.lat.toFixed(4),", ").concat(e.lng.toFixed(4)):null,r="number"==typeof e.usageCount&&e.confirmedAt?j("composerLocation.savedPlaceMeta",{count:e.usageCount,date:C.dateTime(new Date(e.confirmedAt),{month:"short",day:"numeric",year:"numeric"})}):null,o=(null!==(t=e.aliases)&&void 0!==t?t:[]).filter(t=>y(t)!==y(e.name)).join(", "),i=k(e,O.savedMatches);return(0,l.jsxs)("button",{type:"button",disabled:i,className:"flex w-full items-center gap-2 rounded-lg border border-stroke-soft bg-elevation-0 px-3 py-2 text-left text-sm text-primary transition-colors hover:border-stroke-selection hover:bg-elevation-1 disabled:cursor-not-allowed disabled:opacity-60",onClick:()=>{c({...O.candidate,place_id:e.place_id}),Z(null)},children:[(0,l.jsx)(u.Z,{className:"size-4 shrink-0 text-icon-selection","aria-hidden":!0}),(0,l.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,l.jsx)("span",{className:"block truncate font-medium",children:e.name}),[n,a,r,o?j("composerLocation.savedPlaceAliases",{aliases:o}
1):null].filter(Boolean).map(e=>(0,l.jsx)("span",{className:"block truncate text-xs text-tertiary",children:e},e)),i?(0,l.jsx)("span",{className:"block text-xs text-secondary",children:j("composerLocation.savedPlaceNeedsRename")}):null]})]},e.place_id)}),(0,l.jsx)("button",{type:"button",className:"w-full rounded-lg border border-dashed border-stroke-medium bg-elevation-0 px-3 py-2 text-left text-sm font-medium text-primary transition-colors hover:border-stroke-selection hover:bg-elevation-1",onClick:()=>{c(O.candidate),Z(null)},children:j("composerLocation.saveAsNew",{name:O.candidate.name})})]})]}):null,!O&&E&&E.length>0?(0,l.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:E.slice(0,6).map(e=>(0,l.jsxs)("button",{type:"button",onClick:()=>W(e),className:"inline-flex max-w-full items-center gap-1.5 rounded-full border border-stroke-soft bg-elevation-0 px-3 py-1.5 text-xs text-primary transition-colors hover:border-stroke-selection hover:bg-elevation-1",children:[(0,l.jsx)(u.Z,{className:"size-3 shrink-0 text-success","aria-hidden":!0}),(0,l.jsx)("span",{className:"truncate font-medium",children:e.name}),null!==e.distanceM?(0,l.jsx)("span",{className:"shrink-0 text-tertiary",children:(0,g.Bb)(e.distanceM,_,{sourceUnit:"m"})}):null]},e.placeId))}):null,O||!E||0!==E.length||P?null:(0,l.jsx)("p",{className:"mt-2 text-xs text-tertiary",children:D?j("composerLocation.geoDenied"):j("composerLocation.noneNearby")}),(0,l.jsx)(o.B,{origin:M.origin}),O?null:(0,l.jsx)("input",{ref:A,value:S.query,onFocus:S.onFocus,onChange:e=>S.setQuery(e.target.value),placeholder:j("composerLocation.searchPlaceholder"),"aria-label":j("composerLocation.searchPlaceholder"),className:"mt-2.5 w-full rounded-lg border border-stroke-soft bg-elevation-0 px-3 py-2 text-sm text-primary placeholder:text-tertiary focus:outline-none focus:ring-1 focus:ring-stroke-selection"}),O?null:V.map((e,t)=>{var n,a;let r=b(e)?e.address:null,o="number"==typeof e.lat&&"number"==typeof e.lng?"".concat(e.lat.toFixed(4),", ").concat(e.lng.toFixed(4)):null,i="number"==typeof e.usageCount&&e.confirmedAt?j("composerLocation.savedPlaceMeta",{count:e.usageCount,date:C.dateTime(new Date(e.confirmedAt),{month:"short",day:"numeric",year:"numeric"})}
1):null,s=(null!==(n=e.aliases)&&void 0!==n?n:[]).filter(t=>y(t)!==y(e.name)).join(", "),d=k(e,V);return(0,l.jsxs)("button",{type:"button",disabled:d,className:"mt-2 flex w-full items-center gap-2 rounded-lg border border-stroke-selection bg-selection-bg px-3 py-2 text-left text-sm text-primary transition-colors hover:bg-elevation-1 disabled:cursor-not-allowed disabled:opacity-60",onClick:()=>{c(e),S.setQuery("")},children:[(0,l.jsx)(u.Z,{className:"size-4 shrink-0 text-icon-selection","aria-hidden":!0}),(0,l.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,l.jsx)("span",{className:"block font-medium",children:j("composerLocation.useName",{name:e.name})}),[r,o,i,s?j("composerLocation.savedPlaceAliases",{aliases:s}):null].filter(Boolean).map(e=>(0,l.jsx)("span",{className:"block truncate text-xs text-tertiary",children:e},e)),d?(0,l.jsx)("span",{className:"block text-xs text-secondary",children:j("composerLocation.savedPlaceNeedsRename")}):null]})]},null!==(a=e.place_id)&&void 0!==a?a:"".concat(e.name,"-").concat(t))}),!O&&S.query.trim().length>=2?(0,l.jsxs)("button",{type:"button",className:"mt-2 flex w-full items-center gap-2 rounded-lg border border-dashed border-stroke-medium bg-elevation-0 px-3 py-2 text-left text-sm text-primary transition-colors hover:border-stroke-selection hover:bg-elevation-1",onClick:J,children:[(0,l.jsx)(u.Z,{className:"size-4 shrink-0 text-icon-selection","aria-hidden":!0}),(0,l.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,l.jsx)("span",{className:"block font-medium",children:V.length>0?j("composerLocation.saveAsNew",{name:S.query.trim()}):j("composerLocation.useName",{name:S.query.trim()})}),(0,l.jsx)("span",{className:"block text-xs text-tertiary",children:H?j("composerLocation.useCurrentPosition"):j("composerLocation.withoutMap")})]})]}):null]}):null,n?(0,l.jsxs)("div",{className:"relative mt-3 overflow-hidden rounded-xl border border-stroke-soft",children:["number"==typeof n.lat&&"number"==typeof n.lng?(0,l.jsx)(h,{lat:n.lat,lng:n.lng,label:n.name||n.address}):null,(0,l.jsxs)("div",{className:"flex items-center gap-2 bg-elevation-minus1 px-3 py-2.5",children:[(0,l.jsx)(u.Z,{className:"size-4 shrink-0 text-success","aria-hidden":!0}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsx)("p",{className:"truncate text-sm font-medium text-primary",children:n.name||n.address}),n.name&&n.address?(0,l.jsx)("p",{className:"truncate text-xs text-tertiary",children:n.address}):null]}),(0,l.jsx)("button",{type:"button",onClick:()=>c(null),className:"grid size-7 shrink-0 place-items-center rounded-full text-tertiary transition-colors hover:bg-elevation-1 hover:text-primary","aria-label":j("composerLocation.remove"),children:(0,l.jsx)(m.Z,{className:"size-4","aria-hidden":!0})})]})]}):null,B&&t&&!n&&!O&&F&&S.suggestions.length>0?(0,s.createPortal)((0,l.jsx)("ul",{role:"listbox","data-composer-safe":"true",className:"fixed z-[90] max-h-60 overflow-auto rounded-xl border border-stroke-soft bg-elevation-1 py-1 shadow-lg",style:{top:F.bottom+4,left:F.left,width:F.width},children:S.suggestions.map(e=>(0,l.jsx)("li",{children:(0,l.jsxs)("button",{type:"button",onClick:()=>$(e),className:"flex w-full items-start gap-2 px-3 py-2 text-left hover:bg-elevation-2",children:[(0,l.jsx)(u.Z,{className:"mt-0.5 size-3.5 shrink-0 text-tertiary","aria-hidden":!0}),(0,l.jsxs)("span",{className:"min-w-0",children:[(0,l.jsx)("span",{className:"block truncate text-sm text-primary",children:e.mainText}),(0,l.jsx)("span",{className:"block truncate text-xs text-tertiary",children:e.secondaryText})]})]})},e.placeId))}),document.body):null]})}},34955:function(e,t,n){n.d(t,{D:function(){return c}});var l=n(57437),a=n(2265),r=n(94457),o=n(38407),i=n(32098);let s={xs:{container:"size-5",text:"text-[8px] font-bold text-secondary"},sm:{container:"size-6",text:"text-[10px] font-medium text-secondary"},md:{container:"size-8",text:"text-[10px] font-semibold text-secondary"},lg:{container:"size-10",text:"text-xs font-bold text-secondary"},xl:{container:"size-[42px]",text:"text-sm font-medium text-secondary"},"2xl":{container:"size-[54px]",text:"text-sm font-bold text-primary"}};function c(e){let{src:t,firstName:n,lastName:c,size:u="lg",className:d}=e,[m,f]=(0,a.useState)(!1),{container:p,text:x}=s[u],g=(0,i.Q)(n,c),h="".concat(n," ").concat(c).trim(),y=(0,o.kM)(t);return(0,a.useEffect)(()=>f(!1),[y]),(0,l.jsx)("div",{className:(0,r.cn)("rounded-full bg-elevation-1 flex items-center justify-center shrink-0 overflow-hidden",p,d),"aria-label":h||void 0,children:y&&!m?(0,l.jsx)("img",{src:y,alt:h,className:"h-full w-full object-cover",onError:()=>f(!0)}):(0,l.jsx)("span",{className:(0,r.cn)("uppercase leading-none",x),children:g})})}},32098:function(e,t,n){function l(e,t){let n=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(n<60)return t;let l=Math.floor(n/60);if(l<60)return"".concat(l,"m");let a=Math.floor(l/60);if(a<24)return"".concat(a,"h");let r=Math.floor(a/24);if(r<7)return"".concat(r,"d");let o=Math.floor(r/7);if(o<4)return"".concat(o,"w");let i=Math.floor(r/30);return i<12?"".concat(i,"mo"):"".concat(Math.floor(r/365),"y")}function a(e,t){return"".concat(e.charAt(0)).concat(t.charAt(0)).toUpperCase()||"?"}n.d(t,{Q:function(){return a},S:function(){return l}})},69120:function(e,t,n){n.d(t,{LG:function(){return r},QO:function(){return a},yN:function(){return o}});var l=n(56689);async function a(e){if(l.Capacitor.isNativePlatform()){let{Geolocation:t}=await n.e(58581).then(n.bind(n,58581)),l=await t.getCurrentPosition(e);return{lat:l.coords.latitude,lng:l.coords.longitude}}return new Promise((t,n)=>{if(!navigator.geolocation){n(Error("geolocation_unavailable"));return}navigator.geolocation.getCurrentPosition(e=>
1t({lat:e.coords.latitude,lng:e.coords.longitude}),n,e)})}function r(e,t){let n=(t.lat-e.lat)*Math.PI/180,l=(t.lng-e.lng)*Math.PI/180;return 7917.5226*Math.asin(Math.sqrt(Math.sin(n/2)**2+Math.cos(e.lat*Math.PI/180)*Math.cos(t.lat*Math.PI/180)*Math.sin(l/2)**2))}function o(e){let t=Math.max(.1,e);return t<10?t.toFixed(1):Math.round(t).toString()}},42334:function(e,t,n){n.d(t,{C7:function(){return a},FO:function(){return o},Tg:function(){return l},kk:function(){return r}});let l={lat:null,lng:null,source:null,countryCode:null,updatedAt:null};function a(e){return"number"==typeof(null==e?void 0:e.lat)&&Number.isFinite(e.lat)&&90>=Math.abs(e.lat)&&"number"==typeof e.lng&&Number.isFinite(e.lng)&&180>=Math.abs(e.lng)}function r(e){var t,n,r;for(let l of["chosen","home","device","profile","recent_workout","recent_place"]){let r=e[l];if(a(r))return{...r,source:l,countryCode:null!==(t=e.countryCode)&&void 0!==t?t:null,updatedAt:null!==(n=r.updatedAt)&&void 0!==n?n:null}}return{...l,countryCode:null!==(r=e.countryCode)&&void 0!==r?r:null}}function o(e,t){let n=new URLSearchParams;if(a(e)){var l;n.set("lat",String(e.lat)),n.set("lng",String(e.lng)),n.set("source",null!==(l=e.source)&&void 0!==l?l:"chosen")}return(t||e.countryCode)&&n.set("country",t||e.countryCode),n}},58736:function(e,t,n){n.d(t,{O:function(){return u}});var l=n(2265),a=n(71632),r=n(80573),o=n(27151),i=n(85830),s=n(69120),c=n(42334);function u(e){let t=(0,o.Fe)(e=>{var t;return null===(t=e.activeSession)||void 0===t?void 0:t.externalId}),n=(0,l.useCallback)(async()=>{let e=await fetch("/api/member/origin",{headers:(0,i.Od)(),cache:"no-store",signal:AbortSignal.timeout(12e3)});if(!e.ok)throw Error("member_origin_unavailable");return e.json()},[]),{data:u,isLoading:d,refetch:m}=(0,a.a)({queryKey:["member-origin",t],enabled:!!t,staleTime:6e4,queryFn:n},r.H),f=(0,l.useCallback)(async()=>{try{return{...await (0,s.QO)({enableHighAccuracy:!0,timeout:1e4,maximumAge:6e4}),updatedAt:new Date().toISOString()}}catch(e){return null}},[]),{data:p}=(0,a.a)({queryKey:["member-device-origin",t],enabled:!1,staleTime:6e4,queryFn:f},r.H),x=null!=u?u:c.Tg,g=(0,l.useRef)({externalId:t,lat:null==e?void 0:e.lat,lng:null==e?void 0:e.lng});(g.current.lat!==(null==e?void 0:e.lat)||g.current.lng!==(null==e?void 0:e.lng))&&(g.current={externalId:t,lat:null==e?void 0:e.lat,lng:null==e?void 0:e.lng});let h=g.current.externalId===t,y=h?null==e?void 0:e.lat:void 0,b=h?null==e?void 0:e.lng:void 0,v=h?null==e?void 0:e.city:void 0,w=(0,l.useMemo)(()=>{var e;return(0,c.kk)({chosen:(0,c.C7)({lat:y,lng:b})?{lat:y,lng:b,city:v}:null,...x.source&&(0,c.C7)(x)?{[x.source]:x}:{},device:p&&Date.now()-Date.parse(null!==(e=p.updatedAt)&&void 0!==e?e:"")<6e4?p:null,countryCode:x.countryCode})},[x,y,b,v,p]),k=(0,l.useCallback)(async function(){var e,l,a;let i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!t)return c.Tg;let s=await r.H.fetchQuery({queryKey:["member-origin",t],staleTime:6e4,queryFn:n}).catch(()=>c.Tg);if((null===(e=o.Fe.getState().activeSession)||void 0===e?void 0:e.externalId)!==t)return c.Tg;let u=r.H.getQueryData(["member-device-origin",t]),d=(0,c.kk)({chosen:(0,c.C7)({lat:y,lng:b})?{lat:y,lng:b,city:v}:null,...s.source&&(0,c.C7)(s)?{[s.source]:s}:{},device:u&&Date.now()-Date.parse(null!==(a=u.updatedAt)&&void 0!==a?a:"")<6e4?u:null,countryCode:s.countryCode});if(!i&&d.source&&"profile"!==d.source)return d;let m=await r.H.fetchQuery({queryKey:["member-device-origin",t],staleTime:null===r.H.getQueryData(["member-device-origin",t])?1/0:6e4,retry:!1,queryFn:f});return(null===(l=o.Fe.getState().activeSession)||void 0===l?void 0:l.externalId)!==t?c.Tg:m?(0,c.kk)({device:m,countryCode:s.countryCode}):d},[t,n,f,y,b,v]);(0,l.useEffect)(()=>{var e;if("undefined"==typeof navigator||!(null===(e=navigator.permissions)||void 0===e?void 0:e.query)||void 0!==r.H.getQueryData(["member-device-origin",t]))return;let n=!0;return navigator.permissions.query({name:"geolocation"}).then(e=>{n&&"granted"===e.state&&r.H.fetchQuery({queryKey:["member-device-origin",t],staleTime:6e4,retry:!1,queryFn:f}).catch(()=>void 0)}).catch(()=>void 0),()=>{n=!1}},[t,f]);let N=(0,l.useCallback)(()=>{k()},[k]),j=(0,l.useCallback)(async()=>{let e=await k(!0);if(!(0,c.C7)(e))throw Error("geolocation_unavailable");return{lat:e.lat,lng:e.lng}},[k]);return{origin:w,loading:d,refresh:(0,l.useCallback)(()=>m(),[m]),onFocus:N,requestLocation:k,getCoordinates:j}}}}]);

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.