@buoy-gg/location 7.0.74 → 7.0.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/index.js +1 -1
- package/lib/module/index.js +1 -1
- package/lib/web/index.mjs +2 -2
- package/package.json +4 -4
package/lib/commonjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"BUILT_IN_PLACES",{enumerable:true,get:function(){return _fixtures.BUILT_IN_PLACES}});Object.defineProperty(exports,"LOCATION_CHIP_ID",{enumerable:true,get:function(){return _LocationChip.LOCATION_CHIP_ID}});Object.defineProperty(exports,"LOCATION_TOOL_ICON_COLOR",{enumerable:true,get:function(){return _sharedUi.LOCATION_TOOL_ICON_COLOR}});Object.defineProperty(exports,"LocationBody",{enumerable:true,get:function(){return _LocationBody.LocationBody}});Object.defineProperty(exports,"LocationChip",{enumerable:true,get:function(){return _LocationChip.LocationChip}});Object.defineProperty(exports,"LocationToolIcon",{enumerable:true,get:function(){return _sharedUi.LocationToolIcon}});Object.defineProperty(exports,"LocationToolView",{enumerable:true,get:function(){return _LocationToolView.LocationToolView}});Object.defineProperty(exports,"ROUTE_PRESETS",{enumerable:true,get:function(){return _fixtures.ROUTE_PRESETS}});Object.defineProperty(exports,"bearingDegrees",{enumerable:true,get:function(){return _geo.bearingDegrees}});Object.defineProperty(exports,"bootLocation",{enumerable:true,get:function(){return _store.bootLocation}});Object.defineProperty(exports,"buildPresetRoute",{enumerable:true,get:function(){return _fixtures.buildPresetRoute}});Object.defineProperty(exports,"createLocationTool",{enumerable:true,get:function(){return _preset.createLocationTool}});Object.defineProperty(exports,"destination",{enumerable:true,get:function(){return _geo.destination}});Object.defineProperty(exports,"distanceMeters",{enumerable:true,get:function(){return _geo.distanceMeters}});Object.defineProperty(exports,"getLocationSnapshot",{enumerable:true,get:function(){return _store.getLocationSnapshot}});Object.defineProperty(exports,"installLocationAdapters",{enumerable:true,get:function(){return _adapters.installLocationAdapters}});Object.defineProperty(exports,"isLocationActive",{enumerable:true,get:function(){return _store.isLocationActive}});Object.defineProperty(exports,"locationSyncAdapter",{enumerable:true,get:function(){return _locationSyncAdapter.locationSyncAdapter}});Object.defineProperty(exports,"locationToolPreset",{enumerable:true,get:function(){return _preset.locationToolPreset}});Object.defineProperty(exports,"moveToRegion",{enumerable:true,get:function(){return _store.moveToRegion}});Object.defineProperty(exports,"parseCoordinate",{enumerable:true,get:function(){return _geo.parseCoordinate}});Object.defineProperty(exports,"pauseRoute",{enumerable:true,get:function(){return _store.pauseRoute}});Object.defineProperty(exports,"refreshLocationPermission",{enumerable:true,get:function(){return _store.refreshLocationPermission}});Object.defineProperty(exports,"registerLocationPlaces",{enumerable:true,get:function(){return _store.registerLocationPlaces}});Object.defineProperty(exports,"registerLocationRoutes",{enumerable:true,get:function(){return _store.registerLocationRoutes}});Object.defineProperty(exports,"resetLocation",{enumerable:true,get:function(){return _store.resetLocation}});Object.defineProperty(exports,"resumeRoute",{enumerable:true,get:function(){return _store.resumeRoute}});Object.defineProperty(exports,"seekRoute",{enumerable:true,get:function(){return _store.seekRoute}});Object.defineProperty(exports,"setConditions",{enumerable:true,get:function(){return _store.setConditions}});Object.defineProperty(exports,"setPlace",{enumerable:true,get:function(){return _store.setPlace}});Object.defineProperty(exports,"setRouteSpeed",{enumerable:true,get:function(){return _store.setRouteSpeed}});Object.defineProperty(exports,"setServices",{enumerable:true,get:function(){return _store.setServices}});Object.defineProperty(exports,"setSignal",{enumerable:true,get:function(){return _store.setSignal}});Object.defineProperty(exports,"startRoute",{enumerable:true,get:function(){return _store.startRoute}});Object.defineProperty(exports,"stopRoute",{enumerable:true,get:function(){return _store.stopRoute}});Object.defineProperty(exports,"subscribeLocation",{enumerable:true,get:function(){return _store.subscribeLocation}});Object.defineProperty(exports,"tuneOverride",{enumerable:true,get:function(){return _store.tuneOverride}});Object.defineProperty(exports,"useRealLocation",{enumerable:true,get:function(){return _store.useRealLocation}});var _store=require("./engine/store");var _adapters=require("./engine/adapters");var _LocationChip=require("./components/LocationChip");var _preset=require("./preset");var _LocationBody=require("./components/LocationBody");var _LocationToolView=require("./components/LocationToolView");var _sharedUi=require("@buoy-gg/shared-ui");var _locationSyncAdapter=require("./sync/locationSyncAdapter");var _fixtures=require("./engine/fixtures");var _geo=require("./engine/geo");const isReactNativeRuntime=typeof navigator!=="undefined"&&navigator.product==="ReactNative";const isCapacitorShell=(()=>{try{const e=globalThis.Capacitor;return e?.isNativePlatform?.()===true}catch{return false}})();if(isReactNativeRuntime||isCapacitorShell){(0,_LocationChip.watchLocationChip)();if(typeof __DEV__!=="undefined"&&__DEV__){(0,_adapters.installLocationAdapters)();(0,_store.bootLocation)()}}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"BUILT_IN_PLACES",{enumerable:true,get:function(){return _fixtures.BUILT_IN_PLACES}});Object.defineProperty(exports,"LOCATION_CHIP_ID",{enumerable:true,get:function(){return _LocationChip.LOCATION_CHIP_ID}});Object.defineProperty(exports,"LOCATION_TOOL_ICON_COLOR",{enumerable:true,get:function(){return _sharedUi.LOCATION_TOOL_ICON_COLOR}});Object.defineProperty(exports,"LocationBody",{enumerable:true,get:function(){return _LocationBody.LocationBody}});Object.defineProperty(exports,"LocationChip",{enumerable:true,get:function(){return _LocationChip.LocationChip}});Object.defineProperty(exports,"LocationToolIcon",{enumerable:true,get:function(){return _sharedUi.LocationToolIcon}});Object.defineProperty(exports,"LocationToolView",{enumerable:true,get:function(){return _LocationToolView.LocationToolView}});Object.defineProperty(exports,"ROUTE_PRESETS",{enumerable:true,get:function(){return _fixtures.ROUTE_PRESETS}});Object.defineProperty(exports,"bearingDegrees",{enumerable:true,get:function(){return _geo.bearingDegrees}});Object.defineProperty(exports,"bootLocation",{enumerable:true,get:function(){return _store.bootLocation}});Object.defineProperty(exports,"buildPresetRoute",{enumerable:true,get:function(){return _fixtures.buildPresetRoute}});Object.defineProperty(exports,"createLocationTool",{enumerable:true,get:function(){return _preset.createLocationTool}});Object.defineProperty(exports,"destination",{enumerable:true,get:function(){return _geo.destination}});Object.defineProperty(exports,"distanceMeters",{enumerable:true,get:function(){return _geo.distanceMeters}});Object.defineProperty(exports,"getLocationSnapshot",{enumerable:true,get:function(){return _store.getLocationSnapshot}});Object.defineProperty(exports,"installLocationAdapters",{enumerable:true,get:function(){return _adapters.installLocationAdapters}});Object.defineProperty(exports,"isLocationActive",{enumerable:true,get:function(){return _store.isLocationActive}});Object.defineProperty(exports,"locationSyncAdapter",{enumerable:true,get:function(){return _locationSyncAdapter.locationSyncAdapter}});Object.defineProperty(exports,"locationToolPreset",{enumerable:true,get:function(){return _preset.locationToolPreset}});Object.defineProperty(exports,"moveToRegion",{enumerable:true,get:function(){return _store.moveToRegion}});Object.defineProperty(exports,"parseCoordinate",{enumerable:true,get:function(){return _geo.parseCoordinate}});Object.defineProperty(exports,"pauseRoute",{enumerable:true,get:function(){return _store.pauseRoute}});Object.defineProperty(exports,"refreshLocationPermission",{enumerable:true,get:function(){return _store.refreshLocationPermission}});Object.defineProperty(exports,"registerLocationPlaces",{enumerable:true,get:function(){return _store.registerLocationPlaces}});Object.defineProperty(exports,"registerLocationRoutes",{enumerable:true,get:function(){return _store.registerLocationRoutes}});Object.defineProperty(exports,"resetLocation",{enumerable:true,get:function(){return _store.resetLocation}});Object.defineProperty(exports,"resumeRoute",{enumerable:true,get:function(){return _store.resumeRoute}});Object.defineProperty(exports,"seekRoute",{enumerable:true,get:function(){return _store.seekRoute}});Object.defineProperty(exports,"setConditions",{enumerable:true,get:function(){return _store.setConditions}});Object.defineProperty(exports,"setPlace",{enumerable:true,get:function(){return _store.setPlace}});Object.defineProperty(exports,"setRouteSpeed",{enumerable:true,get:function(){return _store.setRouteSpeed}});Object.defineProperty(exports,"setServices",{enumerable:true,get:function(){return _store.setServices}});Object.defineProperty(exports,"setSignal",{enumerable:true,get:function(){return _store.setSignal}});Object.defineProperty(exports,"startRoute",{enumerable:true,get:function(){return _store.startRoute}});Object.defineProperty(exports,"stopRoute",{enumerable:true,get:function(){return _store.stopRoute}});Object.defineProperty(exports,"subscribeLocation",{enumerable:true,get:function(){return _store.subscribeLocation}});Object.defineProperty(exports,"tuneOverride",{enumerable:true,get:function(){return _store.tuneOverride}});Object.defineProperty(exports,"useRealLocation",{enumerable:true,get:function(){return _store.useRealLocation}});var _store=require("./engine/store");var _adapters=require("./engine/adapters");var _LocationChip=require("./components/LocationChip");var _preset=require("./preset");var _LocationBody=require("./components/LocationBody");var _LocationToolView=require("./components/LocationToolView");var _sharedUi=require("@buoy-gg/shared-ui");var _locationSyncAdapter=require("./sync/locationSyncAdapter");var _fixtures=require("./engine/fixtures");var _geo=require("./engine/geo");const isReactNativeRuntime=typeof navigator!=="undefined"&&navigator.product==="ReactNative";const isCapacitorShell=(()=>{try{const e=globalThis.Capacitor;return e?.isNativePlatform?.()===true}catch{return false}})();const isBrowserPage=!isReactNativeRuntime&&typeof globalThis.document!=="undefined";if(isReactNativeRuntime||isCapacitorShell||isBrowserPage){(0,_LocationChip.watchLocationChip)();if(typeof __DEV__!=="undefined"&&__DEV__){(0,_adapters.installLocationAdapters)();(0,_store.bootLocation)()}}
|
package/lib/module/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{bootLocation as
|
|
1
|
+
"use strict";import{bootLocation as e}from"./engine/store";import{installLocationAdapters as i}from"./engine/adapters";import{watchLocationChip as r}from"./components/LocationChip";const o=typeof navigator!=="undefined"&&navigator.product==="ReactNative";const a=(()=>{try{const t=globalThis.Capacitor;return t?.isNativePlatform?.()===true}catch{return false}})();const n=!o&&typeof globalThis.document!=="undefined";if(o||a||n){r();if(typeof __DEV__!=="undefined"&&__DEV__){i();e()}}export{locationToolPreset,createLocationTool}from"./preset";export{LocationBody}from"./components/LocationBody";export{LocationToolView}from"./components/LocationToolView";export{LocationChip,LOCATION_CHIP_ID}from"./components/LocationChip";export{LocationToolIcon,LOCATION_TOOL_ICON_COLOR}from"@buoy-gg/shared-ui";export{locationSyncAdapter}from"./sync/locationSyncAdapter";export{bootLocation,setPlace,startRoute,pauseRoute,resumeRoute,seekRoute,setRouteSpeed,tuneOverride,setSignal,setServices,setConditions,stopRoute,moveToRegion,useRealLocation,resetLocation,registerLocationPlaces,registerLocationRoutes,getLocationSnapshot,subscribeLocation,isLocationActive,refreshLocationPermission}from"./engine/store";export{installLocationAdapters}from"./engine/adapters";export{BUILT_IN_PLACES,ROUTE_PRESETS,buildPresetRoute}from"./engine/fixtures";export{distanceMeters,bearingDegrees,destination,parseCoordinate}from"./engine/geo";
|
package/lib/web/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use client";var Yt=Object.defineProperty;var Mi=Object.getOwnPropertyDescriptor;var Ei=Object.getOwnPropertyNames;var Ri=Object.prototype.hasOwnProperty;var Ni=(e,t)=>{for(var n in t)Yt(e,n,{get:t[n],enumerable:true})},Qt=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ei(t))!Ri.call(e,o)&&o!==n&&Yt(e,o,{get:()=>t[o],enumerable:!(i=Mi(t,o))||i.enumerable});return e},Oi=(e,t,n)=>(Qt(e,t,"default"),n&&Qt(n,t,"default"));var Xt=(()=>{try{let e=globalThis.Capacitor;if(e&&typeof e.isNativePlatform=="function"&&e.isNativePlatform())return e.DEBUG===true}catch{}return process.env.NODE_ENV!=="production"})();typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);import{realNow as O}from"@buoy-gg/shared-ui/web";var Zt=63710088e-1,X=e=>e*Math.PI/180,yt=e=>e*180/Math.PI;function Ie(e){if(!e||typeof e!="object")return false;let{latitude:t,longitude:n}=e;return typeof t=="number"&&typeof n=="number"&&Number.isFinite(t)&&Number.isFinite(n)&&Math.abs(t)<=90&&Math.abs(n)<=180}function en(e){let t=((e+180)%360+360)%360-180;return t===-180&&e>0?180:t}function V(e,t){let n=X(t.latitude-e.latitude),i=X(t.longitude-e.longitude),o=Math.sin(n/2)**2+Math.cos(X(e.latitude))*Math.cos(X(t.latitude))*Math.sin(i/2)**2;return 2*Zt*Math.asin(Math.min(1,Math.sqrt(o)))}function Ze(e,t){let n=X(e.latitude),i=X(t.latitude),o=X(t.longitude-e.longitude),r=Math.sin(o)*Math.cos(i),a=Math.cos(n)*Math.sin(i)-Math.sin(n)*Math.cos(i)*Math.cos(o);return(yt(Math.atan2(r,a))+360)%360}function je(e,t,n){let i=n/Zt,o=X(t),r=X(e.latitude),a=X(e.longitude),c=Math.asin(Math.sin(r)*Math.cos(i)+Math.cos(r)*Math.sin(i)*Math.cos(o)),d=a+Math.atan2(Math.sin(o)*Math.sin(i)*Math.cos(r),Math.cos(i)-Math.sin(r)*Math.sin(c));return{latitude:yt(c),longitude:en(yt(d))}}function Di(e,t,n){if(n<=0)return{latitude:e.latitude,longitude:e.longitude};if(n>=1)return{latitude:t.latitude,longitude:t.longitude};let i=V(e,t);return i<1e-6?{latitude:e.latitude,longitude:e.longitude}:je(e,Ze(e,t),i*n)}function tn(e){let t=[];for(let n=1;n<e.length;n++)t.push(V(e[n-1],e[n]));return t}function bt(e){return tn(e).reduce((t,n)=>t+n,0)}function et(e,t){let{points:n}=e;if(n.length===0)throw new Error("A route needs at least one point.");let i=n[0];if(n.length===1)return{...i,along:0,heading:0,leg:0,finished:true,inGap:false};let o=tn(n),r=o.reduce((p,x)=>p+x,0),a=Math.max(0,t),c=false;r<=0?(a=0,c=!e.loop):e.loop?a=a%r:a>=r&&(a=r,c=true);let d=(e.gaps??[]).some(([p,x])=>a>=p&&a<x),h=a;for(let p=0;p<o.length;p++){let x=o[p],I=n[p],A=n[p+1],F=p===o.length-1;if(h<x||F){let _=x>0?Math.min(1,h/x):1;return{...Di(I,A,_),along:a,heading:Ze(I,A),leg:p,finished:c,inGap:d}}h-=x}return{...n[n.length-1],along:a,heading:0,leg:o.length-1,finished:c,inGap:d}}function Bi(e,t,n){if(t<=0)return{latitude:e.latitude,longitude:e.longitude};let i=nn(Math.sin(n*12.9898)*43758.5453),o=nn(Math.sin(n*78.233)*12543.1234);return je(e,i*360,Math.sqrt(o)*t)}function nn(e){return e-Math.floor(e)}var ji=3e3;function Fi(e){let t=Math.round(e.latitude/.03)*.03,n=.03/Math.max(.2,Math.cos(X(t))),i=Math.round(e.longitude/n)*n;return{...e,latitude:on(t),longitude:on(en(i)),accuracy:Math.max(e.accuracy,ji),heading:null,speed:null}}function on(e){return Math.round(e*1e6)/1e6}function _i(e,t){return V(e,t)<=e.radius}function zi(e,t,n){let i={},o=[];for(let r of e){let a=t[r.identifier]??"unknown",c=_i(r,n)?"inside":"outside";if(i[r.identifier]=c,a===c)continue;let d=c==="inside"?"enter":"exit",h=a==="unknown";(h||(d==="enter"?r.notifyOnEnter:r.notifyOnExit))&&o.push({identifier:r.identifier,kind:d,initial:h})}return{states:i,transitions:o}}function Wi(e,t,n){if(t==="inside")return{latitude:e.latitude,longitude:e.longitude};let i=n&&V(e,n)>1?Ze(e,n):0;return je(e,i,e.radius+Math.max(50,e.radius*.25))}function rn(e,t){if(!Ie(e))return null;let n=e,i=Number(n.radius);return!Number.isFinite(i)||i<=0?null:{identifier:typeof n.identifier=="string"&&n.identifier?n.identifier:`region-${t+1}`,latitude:n.latitude,longitude:n.longitude,radius:i,notifyOnEnter:n.notifyOnEnter!==false,notifyOnExit:n.notifyOnExit!==false}}function vt(e){let t=e.trim(),n=[/@(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)/,/[?&](?:q|ll|query|center)=(-?\d+(?:\.\d+)?)(?:,|%2C)\s*(-?\d+(?:\.\d+)?)/i,/^(-?\d+(?:\.\d+)?)\s*[,\s]\s*(-?\d+(?:\.\d+)?)$/];for(let i of n){let o=t.match(i);if(o){let r={latitude:Number(o[1]),longitude:Number(o[2])};if(Ie(r))return r}}return null}function Fe(e,t=5){return`${e.latitude.toFixed(t)}, ${e.longitude.toFixed(t)}`}var wt={persist:true,showChip:true},Ui={latitude:37.3349,longitude:-122.009,label:"Apple Park"};function kt(){return{mode:"real",place:{...Ui},altitude:30,accuracy:5,jitter:0,heading:null,route:null,playing:false,anchorReal:0,anchorMeters:0,signal:true,services:true,interval:1e3}}function _e(e){return!!e&&(e.mode!=="real"||!e.signal||!e.services)}function Ae(e){return!!e&&e.mode!=="real"}function ye(e,t,n=-1/0,i=1/0){let o=typeof e=="number"?e:Number(e);return Number.isFinite(o)?Math.min(i,Math.max(n,o)):t}function Hi(e,t){if(e===null)return null;let n=typeof e=="number"?e:Number(e);return e!==void 0&&Number.isFinite(n)?n:t}function xt(e){if(!e||typeof e!="object")return null;let t=e,n=Array.isArray(t.points)?t.points.filter(Ie):[];if(n.length<2)return null;let i=Array.isArray(t.gaps)?t.gaps.filter(o=>Array.isArray(o)&&o.length===2&&o.every(r=>typeof r=="number"&&Number.isFinite(r))):void 0;return{id:typeof t.id=="string"?t.id:void 0,name:typeof t.name=="string"?t.name:void 0,points:n.map(o=>({latitude:o.latitude,longitude:o.longitude})),speed:ye(t.speed,1.4,.1,400),loop:t.loop===true,gaps:i&&i.length?i:void 0}}function an(e){if(!e||typeof e!="object")return null;let t=e,n=kt(),i=t.mode==="fixed"||t.mode==="route"?t.mode:"real",o=t.place,r=Ie(o)?{latitude:o.latitude,longitude:o.longitude,label:typeof o.label=="string"?o.label:void 0}:n.place,a=xt(t.route);return{mode:i==="route"&&!a?"fixed":i,place:r,altitude:Hi(t.altitude,n.altitude),accuracy:ye(t.accuracy,n.accuracy,0,1e5),jitter:ye(t.jitter,0,0,1e4),heading:t.heading===null||t.heading===void 0?null:ye(t.heading,0,0,360)%360,route:a,playing:t.playing===true&&!!a,anchorReal:ye(t.anchorReal,0),anchorMeters:ye(t.anchorMeters,0,0),signal:t.signal!==false,services:t.services!==false,interval:ye(t.interval,n.interval,100,6e4)}}var ln={good:{accuracy:5,jitter:0,signal:true,services:true},weak:{accuracy:65,jitter:50,signal:true,services:true},"no-signal":{accuracy:5,jitter:0,signal:false,services:true},off:{accuracy:5,jitter:0,signal:true,services:false}};function Vi(e){if(!e.services)return"off";if(!e.signal)return"no-signal";for(let t of["good","weak"]){let n=ln[t];if(e.accuracy===n.accuracy&&e.jitter===n.jitter)return t}return null}import{devToolsStorageKeys as qi,persistentStorage as sn}from"@buoy-gg/shared-ui/web";function Gi(){try{let e=globalThis.localStorage;return e?cn(e.getItem(Ct)):void 0}catch{return}}var Ct=qi.location.state();function Ki(e){if(!e||typeof e!="object")return null;let t=e;return typeof t.name!="string"||!t.name||t.kind!=="geofencing"&&t.kind!=="locationUpdates"?null:{name:t.name,kind:t.kind,library:typeof t.library=="string"?t.library:"expo-location",options:t.options&&typeof t.options=="object"?t.options:{}}}function cn(e){if(!e)return null;try{let t=JSON.parse(e);if(!t||t.v!==1)return null;let n=t.settings??{};return{v:1,override:an(t.override),settings:{persist:typeof n.persist=="boolean"?n.persist:wt.persist,showChip:typeof n.showChip=="boolean"?n.showChip:wt.showChip},tasks:Array.isArray(t.tasks)?t.tasks.map(Ki).filter(i=>i!==null):[]}}catch{return null}}async function Ji(){try{return cn(await sn.getItem(Ct))}catch{return null}}var It=Promise.resolve();function Yi(e){let t=JSON.stringify(e);return It=It.then(()=>sn.setItem(Ct,t)).catch(()=>{}),It.then(()=>{})}function un(){return globalThis.__buoyRealTimers??globalThis}function z(e,t){return un().setTimeout(e,t)}function Qi(e){un().clearTimeout(e)}var g=kt(),de={...wt},Te="full",Se=null,At=false,tt=false,Le=new Map,oe=new Map,D=new Map,Pe=[],Xi=0,dn=null,pn=1,ze=[],nt=[],it=new Set,We=null;function W(){We=null;for(let e of Array.from(it))try{e()}catch{}}function Ue(e){return it.add(e),()=>{it.delete(e)}}var fn=100;function S(e,t,n,i){Pe.push({id:++Xi,at:O(),kind:e,library:t,text:n,...i?{detail:i}:{}}),Pe.length>fn&&Pe.splice(0,Pe.length-fn),W()}function P(){return _e(g)}function be(){return g.services}function Zi(e){!e||e===Te||(Te=e,W())}function eo(e){if(!e)return;let t=Se&&Se.status===e.status&&Se.background===e.background&&Se.precision===e.precision;e.precision!==Te&&(Te=e.precision),!t&&(Se=e,W())}function $e(e){return g.route?g.playing?g.anchorMeters+Math.max(0,e-g.anchorReal)/1e3*g.route.speed:g.anchorMeters:0}function re(e=O()){if(!g.services)return{fix:null,reason:"services"};if(!g.signal)return{fix:null,reason:"signal"};if(g.mode==="real")return{fix:null,reason:"real"};let t,n=g.heading,i=0;if(g.mode==="route"&&g.route){let r=et(g.route,$e(e));if(r.inGap)return{fix:null,reason:"gap"};t=r;let a=g.playing&&!r.finished;n=r.heading,i=a?g.route.speed:0}else t=g.place;g.jitter>0&&(t=Bi(t,g.jitter,Math.floor(e/g.interval)+pn));let o={latitude:t.latitude,longitude:t.longitude,altitude:g.altitude,accuracy:Math.max(g.accuracy,g.jitter),altitudeAccuracy:g.altitude===null?null:3,heading:n,speed:i};return Te==="reduced"&&(o=Fi(o)),{fix:o,reason:null}}var Me=null,gn=0;function to(){return Ae(g)?oe.size>0||D.size>0?true:g.mode==="route"&&g.playing&&it.size>0:false}function ot(){Me===null&&to()&&(Me=z(()=>{Me=null,bn(),ot()},g.interval))}function hn(){Me!==null&&Qi(Me),Me=null}function mn(){hn(),bn(),ot()}function yn(e,t){let n=Number(e.options[t]);return Number.isFinite(n)&&n>0?n:0}function bn(){let e=O(),{fix:t}=re(e);if(g.mode==="route"&&g.route&&g.playing){let n=et(g.route,$e(e));n.finished&&(g={...g,playing:false,anchorMeters:n.along,anchorReal:e},Re())}t&&(vn(t,false),wn(t)),e-gn>5e3&&(gn=e,oo()),W()}function vn(e,t){for(let n of Array.from(oe.values())){if(n.kind==="heading"){let i=e.heading??0;if(!t&&n.lastHeading===i&&n.updates>0)continue;n.lastHeading=i}else{let i=yn(n,"distanceInterval");if(!t&&n.last&&V(n.last,e)<Math.max(i,.01))continue;n.last={latitude:e.latitude,longitude:e.longitude}}n.updates+=1,dn=O();try{n.deliver(e)}catch(i){S("error",n.library,`Watch ${n.id} callback threw: ${String(i?.message??i)}`)}}}function wn(e){for(let t of Array.from(D.values()))if(t.kind==="geofencing"){let{states:n,transitions:i}=zi(t.regions,t.states,e);t.states=n;for(let o of i)no(t,o)}else{let n=yn(t,"distanceInterval");if(t.lastBatchAt&&V(t.lastBatchAt,e)<Math.max(n,.01))continue;t.lastBatchAt={latitude:e.latitude,longitude:e.longitude},kn(t,{locations:[e]},"a location update")}}function no(e,t){let n=e.regions.find(o=>o.identifier===t.identifier);if(!n)return;S(t.kind,e.library,`${t.kind==="enter"?"Entered":"Left"} ${st(n)??n.identifier}`,`${e.name} \xB7 region ${n.identifier}${t.initial?" \xB7 first check after monitoring started":""}`);let i=st(n)??n.identifier;kn(e,{eventType:t.kind==="enter"?1:2,region:n},`${t.kind==="enter"?"entering":"leaving"} ${i}`)}function kn(e,t,n){let i=Le.get(e.library);if(!i?.fireTask)return;e.runs+=1,e.kind==="locationUpdates"&&S("batch",e.library,"Sent a background location update",e.name),i.fireTask(e,t).then(o=>{S("task",e.library,`Task ran for ${n}`,o!=null?`${e.name} \xB7 returned ${io(o)}`:e.name)},o=>{S("error",e.library,`Task failed for ${n}`,`${e.name} \xB7 ${String(o?.message??o)}`)})}function io(e){try{let t=typeof e=="string"?e:JSON.stringify(e);return t.length>80?`${t.slice(0,77)}\u2026`:t}catch{return String(e)}}function oo(){rt()}function rt(){for(let e of Le.values())e.readPermission?.().then(eo,()=>{})}function at(e){Le.set(e.library,e),W()}function lt(e){let t=`${e.library}:${e.kind}:${e.id}`;oe.set(t,{...e,key:t,since:O(),updates:0,last:null,lastHeading:null}),S("watch",e.library,e.kind==="heading"?"The app started watching the compass heading":"The app started watching location",`watch ${e.id} \xB7 ${e.library}`),z(()=>{let n=oe.get(t);if(!n)return;let{fix:i,reason:o}=re();i?(vn(i,false),W()):o==="services"&&n.fail?.("Location services are disabled")},0),ot()}function ae(e,t,n){let i=`${e}:${t}:${n}`,o=oe.delete(i);return o&&S("watch",e,t==="heading"?"The app stopped watching the heading":"The app stopped watching location",`watch ${n} \xB7 ${e}`),o}function ro(e,t,n){return oe.has(`${e}:${t}:${n}`)}function Tt(e,t){let n=e.kind==="geofencing"?(e.options.regions??[]).map((i,o)=>rn(i,o)).filter(i=>i!==null):[];D.set(e.name,{...e,regions:n,states:{},since:O(),runs:0,intercepted:t,lastBatchAt:null}),S("task",e.library,e.kind==="geofencing"?`The app started monitoring ${n.length} geofence${n.length===1?"":"s"}`:"The app started background location updates",e.name),Re(),Ae(g)&&z(()=>{let{fix:i}=re(),o=D.get(e.name);i&&o&&(wn(i),W())},0),ot()}function St(e){let t=D.get(e);return t?(D.delete(e),S("task",t.library,t.kind==="geofencing"?"The app stopped monitoring geofences":"The app stopped background updates",t.name),Re(),t):null}function Ee(e){return D.get(e)??null}function Lt(e){return Array.from(D.values()).filter(t=>!e||t.kind===e)}function xn(e,t){let n=D.get(e);n&&(n.intercepted=t,t||(n.states={}),Re())}function ao(e){for(let t of e){let n=ze.findIndex(i=>i.label&&i.label===t.label);n>=0?ze[n]={...t}:ze.push({...t})}W()}function st(e){let t=null,n=1/0;for(let i of ze){if(!i.label)continue;let o=V(i,e);o<=Math.max(50,e.radius)&&o<n&&(t=i,n=o)}return t?.label??null}function lo(e){for(let t of e){let n=xt(t);if(!n)continue;let i=nt.findIndex(o=>(o.id??o.name)===(n.id??n.name));i>=0?nt[i]=n:nt.push(n)}W()}function q(e){g=e;let t=_e(g);if(t!==tt){tt=t;for(let n of Le.values())try{n.onActiveChange?.(t)}catch(i){S("error",n.library,`Switching failed: ${String(i?.message??i)}`)}}return Re(),Ae(g)?mn():(hn(),W()),E()}function ct(e){return q({...g,mode:"fixed",place:{latitude:e.latitude,longitude:e.longitude,label:e.label},playing:false})}function He(){return g.mode==="route"&&g.route?et(g.route,$e(O())):g.place}function Cn(e){let t=xt(e);if(!t)throw new Error("A route needs two or more valid points.");return q({...g,mode:"route",route:t,playing:true,anchorReal:O(),anchorMeters:0})}function Pt(){if(g.mode!=="route"||!g.playing)return E();let e=O();return q({...g,playing:false,anchorMeters:$e(e),anchorReal:e})}function $t(){if(g.mode!=="route"||!g.route)return E();let e=bt(g.route.points),t=!g.route.loop&&g.anchorMeters>=e?0:g.anchorMeters;return q({...g,playing:true,anchorReal:O(),anchorMeters:t})}function In(e){if(g.mode!=="route"||!g.route)throw new Error("No route is playing.");return q({...g,anchorMeters:Math.max(0,e),anchorReal:O()})}function An(e){if(!g.route)throw new Error("No route is loaded.");if(!Number.isFinite(e)||e<=0)throw new Error("Speed must be a positive number of m/s.");let t=O();return q({...g,route:{...g.route,speed:e},anchorMeters:$e(t),anchorReal:t})}function Tn(e){let t=an({...g,...so(e)});return t?q({...t,anchorMeters:g.anchorMeters,anchorReal:g.anchorReal}):E()}function so(e){let t={};for(let[n,i]of Object.entries(e))i!==void 0&&(t[n]=i);return t}function Sn(e){return q({...g,signal:e})}function Ln(e){let t=q({...g,services:e});if(!e){for(let n of Array.from(oe.values()))n.kind==="position"&&n.fail?.("Location services are disabled");S("error","device","Location services switched off","open watches got an error")}return t}function Pn(e){let t=ln[e];if(!t)throw new Error(`Unknown conditions "${String(e)}". Use good, weak, no-signal or off.`);let n=g.services,i=e==="good"||e==="weak"?t:{signal:t.signal,services:t.services},o=q({...g,...i});if(n&&!t.services){for(let r of Array.from(oe.values()))r.kind==="position"&&r.fail?.("Location services are disabled");S("error","device","Location services switched off","open watches got an error")}return o}function $n(){if(g.mode!=="route"||!g.route)return E();let e=He();return ct({latitude:e.latitude,longitude:e.longitude})}function Mn(){return q({...g,mode:"real",playing:false})}function Mt(e,t,n){for(let i of D.values()){if(n&&i.name!==n)continue;let o=i.regions.find(c=>c.identifier===e);if(!o)continue;let r=Wi(o,t,He()),a=st(o)??o.identifier;return ct({...r,label:t==="inside"?`At ${a}`:`Outside ${a}`})}throw new Error(`No geofence region "${e}" is being monitored.`)}function Et(){let e=kt();return q({...e,place:g.place})}function co(e){return de={persist:typeof e.persist=="boolean"?e.persist:de.persist,showChip:typeof e.showChip=="boolean"?e.showChip:de.showChip},Re(),W(),E()}function uo(){return de}function po(){return Pe.length=0,W(),E()}function E(){if(We)return We;let e=O(),{fix:t,reason:n}=re(e),i=null;if(g.mode==="route"&&g.route){let a=et(g.route,$e(e)),c=bt(g.route.points);i={along:a.along,length:c,finished:a.finished,leg:a.leg,etaMs:g.playing&&!g.route.loop&&!a.finished?(c-a.along)/g.route.speed*1e3:null}}let o=Ae(g)?He():null,r=t??o;return We={active:_e(g),simulating:Ae(g),override:g,current:{fix:t,reason:n,precision:Te},permission:Se,position:o?{latitude:o.latitude,longitude:o.longitude}:null,progress:i,watches:Array.from(oe.values()).map(a=>({key:a.key,library:a.library,id:a.id,kind:a.kind,options:a.options,since:a.since,updates:a.updates})),tasks:Array.from(D.values()).map(a=>({name:a.name,kind:a.kind,library:a.library,intercepted:a.intercepted,since:a.since,runs:a.runs,options:a.options,regions:a.regions.map(c=>({...c,label:st(c),state:a.states[c.identifier]??"unknown",distance:r?V(c,r):null}))})),log:Pe.slice(-50),libraries:Array.from(Le.keys()),places:ze.slice(),routes:nt.slice(),settings:de,lastDeliveryAt:dn},We}function Re(){if(!At)return;let e={v:1,override:de.persist&&_e(g)?g:null,settings:de,tasks:Array.from(D.values()).filter(t=>t.intercepted).map(({name:t,kind:n,library:i,options:o})=>({name:t,kind:n,library:i,options:o}))};Yi(e)}function En(e){if(e){de=e.settings;for(let t of e.tasks)D.has(t.name)||fo(t);e.override&&_e(e.override)&&(g=e.override,tt=true)}}function fo(e){let t=e.kind==="geofencing"?(e.options.regions??[]).map((n,i)=>rn(n,i)).filter(n=>!!n):[];D.set(e.name,{...e,regions:t,states:{},since:O(),runs:0,intercepted:true,lastBatchAt:null})}function Rt(){if(At)return;At=true,pn=Math.floor(Math.random()*1e3)+1;let e=Gi();if(e!==void 0){En(e),Rn();return}Ji().then(t=>{En(t),Rn()})}function Rn(){for(let e of Le.values())e.onActiveChange?.(tt);Ae(g)?z(mn,0):W()}var Nn="__buoyLocationNext";function L(e,t,n){let i=e[t];if(typeof i!="function")return null;let o=i[Nn]??i,r=(...c)=>o.apply(e,c),a=n(r);a[Nn]=o;try{e[t]=a}catch{return null}return e[t]===a?r:null}function go(e,t){let n=new Error(t);return n.code=e,n}var Nt={};Ni(Nt,{AccessibilityInfo:()=>bo,ActivityIndicator:()=>mr,Alert:()=>vr,Animated:()=>vo,AppRegistry:()=>ko,AppState:()=>xo,Appearance:()=>wo,BackHandler:()=>Co,Button:()=>yr,CheckBox:()=>jo,Clipboard:()=>Io,DeviceEventEmitter:()=>Dn,Dimensions:()=>Ao,Easing:()=>To,FlatList:()=>Fo,I18nManager:()=>So,Image:()=>_o,ImageBackground:()=>zo,InteractionManager:()=>Po,Keyboard:()=>Lo,KeyboardAvoidingView:()=>Wo,LayoutAnimation:()=>$o,Linking:()=>Mo,LogBox:()=>Zo,Modal:()=>gr,NativeEventEmitter:()=>Eo,NativeModules:()=>yo,PanResponder:()=>Ro,Picker:()=>Uo,PixelRatio:()=>No,Platform:()=>On,Pressable:()=>fr,ProgressBar:()=>Ho,RefreshControl:()=>Vo,SafeAreaView:()=>qo,ScrollView:()=>zn,SectionList:()=>Go,Share:()=>Oo,StatusBar:()=>Ko,StyleSheet:()=>le,Switch:()=>hr,Text:()=>T,TextInput:()=>_n,Touchable:()=>Jo,TouchableHighlight:()=>dr,TouchableNativeFeedback:()=>Yo,TouchableOpacity:()=>se,TouchableWithoutFeedback:()=>pr,UIManager:()=>Do,Vibration:()=>Bo,View:()=>v,VirtualizedList:()=>Qo,YellowBox:()=>Xo,findNodeHandle:()=>br,unstable_createElement:()=>mo,useColorScheme:()=>er,useLocaleContext:()=>tr,useWindowDimensions:()=>nr});Oi(Nt,ho);import*as ho from"react-native-web";import{unstable_createElement as mo,NativeModules as yo,AccessibilityInfo as bo,Animated as vo,Appearance as wo,AppRegistry as ko,AppState as xo,BackHandler as Co,Clipboard as Io,Dimensions as Ao,Easing as To,I18nManager as So,Keyboard as Lo,InteractionManager as Po,LayoutAnimation as $o,Linking as Mo,NativeEventEmitter as Eo,PanResponder as Ro,PixelRatio as No,Platform as On,Share as Oo,StyleSheet as le,UIManager as Do,Vibration as Bo,CheckBox as jo,FlatList as Fo,Image as _o,ImageBackground as zo,KeyboardAvoidingView as Wo,Picker as Uo,ProgressBar as Ho,RefreshControl as Vo,SafeAreaView as qo,SectionList as Go,StatusBar as Ko,Touchable as Jo,TouchableNativeFeedback as Yo,VirtualizedList as Qo,YellowBox as Xo,LogBox as Zo,DeviceEventEmitter as Dn,useColorScheme as er,useLocaleContext as tr,useWindowDimensions as nr}from"react-native-web";import*as U from"react-native-web";import{createElement as Ot,forwardRef as Bn,useCallback as ir,useRef as or}from"react";import{useEffect as rr,useState as ar}from"react";import{createPortal as lr}from"react-dom";var sr='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';import{jsx as cr}from"react/jsx-runtime";var Ve=Symbol.for("@buoy-gg/portal-host"),jn=e=>{if(!(e instanceof Element))return false;if(e.closest("input, textarea, select"))return true;let t=e.closest("[contenteditable]")?.getAttribute("contenteditable")?.toLowerCase();return t===""||t==="true"||t==="plaintext-only"};function Fn(){let e=document;if(e[Ve])return e[Ve].host;let t=document.createElement("div");t.dataset.buoyPortalHost="",Object.assign(t.style,{position:"fixed",inset:"0",zIndex:"2147483647",pointerEvents:"none",fontFamily:sr});let n=()=>{let p=document.fullscreenElement,x=p&&p.tagName!=="CANVAS"?p:document.body;t.parentElement!==x&&x.appendChild(t)},i=new Map,o=p=>{(!t.contains(p.target)||!jn(p.target))&&i.set(p.code||p.key,{key:p.key,code:p.code,location:p.location,keyCode:p.keyCode,which:p.which,altKey:p.altKey,ctrlKey:p.ctrlKey,metaKey:p.metaKey,shiftKey:p.shiftKey})},r=p=>{i.delete(p.code||p.key)},a=()=>i.clear(),c=()=>{let p=[...i.values()];i.clear();for(let x of p)document.dispatchEvent(new KeyboardEvent("keyup",{...x,bubbles:true}))},d=p=>{jn(p.target)&&p.stopPropagation()},h=p=>p.stopPropagation();return n(),document.addEventListener("fullscreenchange",n),document.addEventListener("keydown",o,true),document.addEventListener("keyup",r,true),window.addEventListener("blur",a),t.addEventListener("focusin",c),t.addEventListener("keydown",d),t.addEventListener("keyup",d),t.addEventListener("keypress",d),t.addEventListener("wheel",h,{passive:true}),e[Ve]={host:t,users:0,dispose:()=>{document.removeEventListener("fullscreenchange",n),document.removeEventListener("keydown",o,true),document.removeEventListener("keyup",r,true),window.removeEventListener("blur",a),t.remove(),delete e[Ve]}},t}function ur({children:e}){let[t,n]=ar(null);return rr(()=>{let i=Fn(),o=document[Ve];return o.users++,n(i),()=>{--o.users===0&&o.dispose()}},[]),t?lr(cr("div",{"data-buoy-root":"",style:{display:"contents",pointerEvents:"auto"},children:e}),t):null}function G(e){let t=Bn((i,o)=>{let{accessibilityState:r,accessibilityValue:a,...c}=i;for(let d of["busy","checked","disabled","expanded","selected"])r?.[d]!==void 0&&c[`aria-${d}`]===void 0&&(c[`aria-${d}`]=r[d]);for(let[d,h]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))a?.[d]!==void 0&&c[`aria-${h}`]===void 0&&(c[`aria-${h}`]=a[d]);return Ot(e,{...c,ref:o})}),n=e.State;return n&&Object.assign(t,{State:n}),t.displayName=e.displayName??e.name??"NativeWebView",t}var v=G(U.View),T=G(U.Text),_n=G(U.TextInput),se=G(U.TouchableOpacity),dr=G(U.TouchableHighlight),pr=G(U.TouchableWithoutFeedback),fr=G(U.Pressable),zn=G(U.ScrollView),Wn=Bn((e,t)=>{let n=or(null),i=ir(o=>{if(o){let r=o;for(;r.parentElement&&r.parentElement!==document.body;)r=r.parentElement;r.parentElement===document.body&&(n.current=r,Object.assign(r.style,{position:"relative",zIndex:"2147483647",pointerEvents:"auto"}),Fn().appendChild(r))}else n.current&&(document.body.appendChild(n.current),n.current=null);typeof t=="function"?t(o):t&&(t.current=o)},[t]);return Ot(ur,null,Ot(U.Modal,{...e,ref:i}))});Wn.displayName="Modal";var gr=G(Wn),hr=G(U.Switch),mr=G(U.ActivityIndicator),yr=G(U.Button),br=U.findNodeHandle,vr={alert(e,t,n,i){if(typeof document>"u")return;let o=document.createElement("dialog");o.dataset.buoyRoot="",o.setAttribute("aria-label",e),o.style.cssText="position:fixed;inset:0;margin:auto;width:min(440px,90vw);padding:24px;border:1px solid #475569;border-radius:14px;background:#17212e;color:#f1f5f9;font:14px system-ui;box-shadow:0 20px 80px #0008;z-index:2147483647";let r=document.createElement("h2");if(r.textContent=e,r.style.cssText="font-size:18px;margin:0 0 12px",o.appendChild(r),t){let h=document.createElement("p");h.textContent=t,h.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",o.appendChild(h)}let a=document.createElement("div");a.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let c=n?.length?n:[{text:"OK"}],d=()=>{o.close?.(),o.remove()};for(let h of c){let p=document.createElement("button");p.type="button",p.textContent=h.text??"OK",p.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${h.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,p.onclick=()=>{d(),h.onPress?.()},a.appendChild(p)}o.addEventListener("cancel",h=>{h.preventDefault(),i?.cancelable!==false&&(d(),i?.onDismiss?.())}),o.appendChild(a),document.body.appendChild(o),o.showModal?o.showModal():o.setAttribute("open","")}};var wr=[{module:"RNCGeolocation",library:"@react-native-community/geolocation"},{module:"RNFusedLocation",library:"react-native-geolocation-service"}],kr={PERMISSION_DENIED:1,POSITION_UNAVAILABLE:2,TIMEOUT:3};function Dt(e,t){return{code:e,message:t,...kr}}function Un(){return Nt}function xr(e){let t=Un();if(!t)return null;let n=null;try{(globalThis.__turboModuleProxy!=null||typeof t.TurboModuleRegistry?.get=="function")&&(n=t.TurboModuleRegistry?.get?.(e))}catch{n=null}if(!n)try{n=t.NativeModules?.[e]}catch{n=null}return n&&typeof n=="object"?n:null}function Hn(e,t,n){let i={coords:{latitude:e.latitude,longitude:e.longitude,altitude:e.altitude,accuracy:e.accuracy,altitudeAccuracy:e.altitudeAccuracy,heading:e.heading??(t==="ios"?-1:0),speed:e.speed??(t==="ios"?-1:0)},timestamp:n};return t==="android"&&(i.mocked=false),i}var Cr=[];function Ir(e){let t=xr(e.module);if(!t||typeof t.getCurrentPosition!="function")return false;Cr.push(t);let n=Un(),i=n?.Platform?.OS??"ios",o=(h,p)=>n?.DeviceEventEmitter?.emit(h,p),r={options:null,native:false,on:false},a=()=>lt({library:e.library,id:"observer",kind:"position",options:r.options??{},deliver:h=>o("geolocationDidChange",Hn(h,i,Date.now())),fail:h=>o("geolocationError",Dt(2,h))});L(t,"getCurrentPosition",h=>(...p)=>{if(!P())return h(...p);let x=p[1],I=p[2];if(!be()){S("request",e.library,"getCurrentPosition \u2192 services off"),I?.(Dt(2,"No location provider available."));return}let{fix:A}=re();if(!A){S("request",e.library,"getCurrentPosition \u2192 no signal"),z(()=>I?.(Dt(3,"Unable to fetch location within 1.0s.")),1e3);return}S("request",e.library,`getCurrentPosition \u2192 ${A.latitude.toFixed(5)}, ${A.longitude.toFixed(5)}`),z(()=>x?.(Hn(A,i,Date.now())),0)});let c=L(t,"startObserving",h=>(...p)=>{if(r.options=p[0]&&typeof p[0]=="object"?p[0]:{},r.on=true,!P())return r.native=true,h(...p);r.native=false,a()}),d=L(t,"stopObserving",h=>(...p)=>{if(r.on=false,ae(e.library,"position","observer"),r.native)return r.native=false,h(...p)});return at({library:e.library,onActiveChange(h){r.on&&(h&&r.native?(r.native=false,d?.(),a()):!h&&!r.native&&(ae(e.library,"position","observer"),r.native=true,c?.(r.options??{})))}}),true}function Ar(){return wr.filter(Ir).map(e=>e.library)}function Tr(e){return null}function Sr(e){return null}var N="expo-location";function Lr(){return On?.OS??"ios"}function Vn(e){try{let n=globalThis.expo?.modules?.[e];if(n&&typeof n=="object")return n}catch{}let t=Tr(e);return t&&typeof t=="object"?t:null}function Bt(e,t,n){let i=t==="ios",o={coords:{latitude:e.latitude,longitude:e.longitude,altitude:e.altitude??(i?0:null),accuracy:e.accuracy,altitudeAccuracy:e.altitudeAccuracy??(i?-1:null),heading:e.heading??(i?-1:null),speed:e.speed??(i?-1:null)},timestamp:n};return t==="android"&&(o.mocked=false),o}function Pr(e,t,n){return n==="ios"?`Calling the '${e}' function has failed
|
|
1
|
+
"use client";var Qt=Object.defineProperty;var Di=Object.getOwnPropertyDescriptor;var Bi=Object.getOwnPropertyNames;var ji=Object.prototype.hasOwnProperty;var Fi=(e,t)=>{for(var n in t)Qt(e,n,{get:t[n],enumerable:true})},en=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Bi(t))!ji.call(e,o)&&o!==n&&Qt(e,o,{get:()=>t[o],enumerable:!(i=Di(t,o))||i.enumerable});return e},_i=(e,t,n)=>(en(e,t,"default"),n&&en(n,t,"default"));var tn=(()=>{try{let e=globalThis.Capacitor;if(e&&typeof e.isNativePlatform=="function"&&e.isNativePlatform())return e.DEBUG===true}catch{}return process.env.NODE_ENV!=="production"})();typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);import{realNow as O}from"@buoy-gg/shared-ui/web";var nn=63710088e-1,Z=e=>e*Math.PI/180,vt=e=>e*180/Math.PI;function Se(e){if(!e||typeof e!="object")return false;let{latitude:t,longitude:n}=e;return typeof t=="number"&&typeof n=="number"&&Number.isFinite(t)&&Number.isFinite(n)&&Math.abs(t)<=90&&Math.abs(n)<=180}function on(e){let t=((e+180)%360+360)%360-180;return t===-180&&e>0?180:t}function V(e,t){let n=Z(t.latitude-e.latitude),i=Z(t.longitude-e.longitude),o=Math.sin(n/2)**2+Math.cos(Z(e.latitude))*Math.cos(Z(t.latitude))*Math.sin(i/2)**2;return 2*nn*Math.asin(Math.min(1,Math.sqrt(o)))}function tt(e,t){let n=Z(e.latitude),i=Z(t.latitude),o=Z(t.longitude-e.longitude),r=Math.sin(o)*Math.cos(i),a=Math.cos(n)*Math.sin(i)-Math.sin(n)*Math.cos(i)*Math.cos(o);return(vt(Math.atan2(r,a))+360)%360}function _e(e,t,n){let i=n/nn,o=Z(t),r=Z(e.latitude),a=Z(e.longitude),p=Math.asin(Math.sin(r)*Math.cos(i)+Math.cos(r)*Math.sin(i)*Math.cos(o)),c=a+Math.atan2(Math.sin(o)*Math.sin(i)*Math.cos(r),Math.cos(i)-Math.sin(r)*Math.sin(p));return{latitude:vt(p),longitude:on(vt(c))}}function zi(e,t,n){if(n<=0)return{latitude:e.latitude,longitude:e.longitude};if(n>=1)return{latitude:t.latitude,longitude:t.longitude};let i=V(e,t);return i<1e-6?{latitude:e.latitude,longitude:e.longitude}:_e(e,tt(e,t),i*n)}function rn(e){let t=[];for(let n=1;n<e.length;n++)t.push(V(e[n-1],e[n]));return t}function wt(e){return rn(e).reduce((t,n)=>t+n,0)}function nt(e,t){let{points:n}=e;if(n.length===0)throw new Error("A route needs at least one point.");let i=n[0];if(n.length===1)return{...i,along:0,heading:0,leg:0,finished:true,inGap:false};let o=rn(n),r=o.reduce((u,v)=>u+v,0),a=Math.max(0,t),p=false;r<=0?(a=0,p=!e.loop):e.loop?a=a%r:a>=r&&(a=r,p=true);let c=(e.gaps??[]).some(([u,v])=>a>=u&&a<v),g=a;for(let u=0;u<o.length;u++){let v=o[u],S=n[u],I=n[u+1],_=u===o.length-1;if(g<v||_){let z=v>0?Math.min(1,g/v):1;return{...zi(S,I,z),along:a,heading:tt(S,I),leg:u,finished:p,inGap:c}}g-=v}return{...n[n.length-1],along:a,heading:0,leg:o.length-1,finished:p,inGap:c}}function Wi(e,t,n){if(t<=0)return{latitude:e.latitude,longitude:e.longitude};let i=an(Math.sin(n*12.9898)*43758.5453),o=an(Math.sin(n*78.233)*12543.1234);return _e(e,i*360,Math.sqrt(o)*t)}function an(e){return e-Math.floor(e)}var Ui=3e3;function Hi(e){let t=Math.round(e.latitude/.03)*.03,n=.03/Math.max(.2,Math.cos(Z(t))),i=Math.round(e.longitude/n)*n;return{...e,latitude:ln(t),longitude:ln(on(i)),accuracy:Math.max(e.accuracy,Ui),heading:null,speed:null}}function ln(e){return Math.round(e*1e6)/1e6}function Vi(e,t){return V(e,t)<=e.radius}function qi(e,t,n){let i={},o=[];for(let r of e){let a=t[r.identifier]??"unknown",p=Vi(r,n)?"inside":"outside";if(i[r.identifier]=p,a===p)continue;let c=p==="inside"?"enter":"exit",g=a==="unknown";(g||(c==="enter"?r.notifyOnEnter:r.notifyOnExit))&&o.push({identifier:r.identifier,kind:c,initial:g})}return{states:i,transitions:o}}function Gi(e,t,n){if(t==="inside")return{latitude:e.latitude,longitude:e.longitude};let i=n&&V(e,n)>1?tt(e,n):0;return _e(e,i,e.radius+Math.max(50,e.radius*.25))}function sn(e,t){if(!Se(e))return null;let n=e,i=Number(n.radius);return!Number.isFinite(i)||i<=0?null:{identifier:typeof n.identifier=="string"&&n.identifier?n.identifier:`region-${t+1}`,latitude:n.latitude,longitude:n.longitude,radius:i,notifyOnEnter:n.notifyOnEnter!==false,notifyOnExit:n.notifyOnExit!==false}}function kt(e){let t=e.trim(),n=[/@(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)/,/[?&](?:q|ll|query|center)=(-?\d+(?:\.\d+)?)(?:,|%2C)\s*(-?\d+(?:\.\d+)?)/i,/^(-?\d+(?:\.\d+)?)\s*[,\s]\s*(-?\d+(?:\.\d+)?)$/];for(let i of n){let o=t.match(i);if(o){let r={latitude:Number(o[1]),longitude:Number(o[2])};if(Se(r))return r}}return null}function ze(e,t=5){return`${e.latitude.toFixed(t)}, ${e.longitude.toFixed(t)}`}var xt={persist:true,showChip:true},Ki={latitude:37.3349,longitude:-122.009,label:"Apple Park"};function Ct(){return{mode:"real",place:{...Ki},altitude:30,accuracy:5,jitter:0,heading:null,route:null,playing:false,anchorReal:0,anchorMeters:0,signal:true,services:true,interval:1e3}}function We(e){return!!e&&(e.mode!=="real"||!e.signal||!e.services)}function Ie(e){return!!e&&e.mode!=="real"}function ye(e,t,n=-1/0,i=1/0){let o=typeof e=="number"?e:Number(e);return Number.isFinite(o)?Math.min(i,Math.max(n,o)):t}function Yi(e,t){if(e===null)return null;let n=typeof e=="number"?e:Number(e);return e!==void 0&&Number.isFinite(n)?n:t}function St(e){if(!e||typeof e!="object")return null;let t=e,n=Array.isArray(t.points)?t.points.filter(Se):[];if(n.length<2)return null;let i=Array.isArray(t.gaps)?t.gaps.filter(o=>Array.isArray(o)&&o.length===2&&o.every(r=>typeof r=="number"&&Number.isFinite(r))):void 0;return{id:typeof t.id=="string"?t.id:void 0,name:typeof t.name=="string"?t.name:void 0,points:n.map(o=>({latitude:o.latitude,longitude:o.longitude})),speed:ye(t.speed,1.4,.1,400),loop:t.loop===true,gaps:i&&i.length?i:void 0}}function cn(e){if(!e||typeof e!="object")return null;let t=e,n=Ct(),i=t.mode==="fixed"||t.mode==="route"?t.mode:"real",o=t.place,r=Se(o)?{latitude:o.latitude,longitude:o.longitude,label:typeof o.label=="string"?o.label:void 0}:n.place,a=St(t.route);return{mode:i==="route"&&!a?"fixed":i,place:r,altitude:Yi(t.altitude,n.altitude),accuracy:ye(t.accuracy,n.accuracy,0,1e5),jitter:ye(t.jitter,0,0,1e4),heading:t.heading===null||t.heading===void 0?null:ye(t.heading,0,0,360)%360,route:a,playing:t.playing===true&&!!a,anchorReal:ye(t.anchorReal,0),anchorMeters:ye(t.anchorMeters,0,0),signal:t.signal!==false,services:t.services!==false,interval:ye(t.interval,n.interval,100,6e4)}}var un={good:{accuracy:5,jitter:0,signal:true,services:true},weak:{accuracy:65,jitter:50,signal:true,services:true},"no-signal":{accuracy:5,jitter:0,signal:false,services:true},off:{accuracy:5,jitter:0,signal:true,services:false}};function Ji(e){if(!e.services)return"off";if(!e.signal)return"no-signal";for(let t of["good","weak"]){let n=un[t];if(e.accuracy===n.accuracy&&e.jitter===n.jitter)return t}return null}import{devToolsStorageKeys as Xi,persistentStorage as dn}from"@buoy-gg/shared-ui/web";function Zi(){try{let e=globalThis.localStorage;return e?pn(e.getItem(It)):void 0}catch{return}}var It=Xi.location.state();function Qi(e){if(!e||typeof e!="object")return null;let t=e;return typeof t.name!="string"||!t.name||t.kind!=="geofencing"&&t.kind!=="locationUpdates"?null:{name:t.name,kind:t.kind,library:typeof t.library=="string"?t.library:"expo-location",options:t.options&&typeof t.options=="object"?t.options:{}}}function pn(e){if(!e)return null;try{let t=JSON.parse(e);if(!t||t.v!==1)return null;let n=t.settings??{};return{v:1,override:cn(t.override),settings:{persist:typeof n.persist=="boolean"?n.persist:xt.persist,showChip:typeof n.showChip=="boolean"?n.showChip:xt.showChip},tasks:Array.isArray(t.tasks)?t.tasks.map(Qi).filter(i=>i!==null):[]}}catch{return null}}async function eo(){try{return pn(await dn.getItem(It))}catch{return null}}var At=Promise.resolve();function to(e){let t=JSON.stringify(e);return At=At.then(()=>dn.setItem(It,t)).catch(()=>{}),At.then(()=>{})}function fn(){return globalThis.__buoyRealTimers??globalThis}function W(e,t){return fn().setTimeout(e,t)}function no(e){fn().clearTimeout(e)}var h=Ct(),de={...xt},Ae="full",Te=null,Tt=false,it=false,$e=new Map,oe=new Map,D=new Map,Le=[],io=0,gn=null,hn=1,Ue=[],ot=[],rt=new Set,He=null;function U(){He=null;for(let e of Array.from(rt))try{e()}catch{}}function Ve(e){return rt.add(e),()=>{rt.delete(e)}}var mn=100;function T(e,t,n,i){Le.push({id:++io,at:O(),kind:e,library:t,text:n,...i?{detail:i}:{}}),Le.length>mn&&Le.splice(0,Le.length-mn),U()}function L(){return We(h)}function be(){return h.services}function oo(e){!e||e===Ae||(Ae=e,U())}function ro(e){if(!e)return;let t=Te&&Te.status===e.status&&Te.background===e.background&&Te.precision===e.precision;e.precision!==Ae&&(Ae=e.precision),!t&&(Te=e,U())}function Pe(e){return h.route?h.playing?h.anchorMeters+Math.max(0,e-h.anchorReal)/1e3*h.route.speed:h.anchorMeters:0}function re(e=O()){if(!h.services)return{fix:null,reason:"services"};if(!h.signal)return{fix:null,reason:"signal"};if(h.mode==="real")return{fix:null,reason:"real"};let t,n=h.heading,i=0;if(h.mode==="route"&&h.route){let r=nt(h.route,Pe(e));if(r.inGap)return{fix:null,reason:"gap"};t=r;let a=h.playing&&!r.finished;n=r.heading,i=a?h.route.speed:0}else t=h.place;h.jitter>0&&(t=Wi(t,h.jitter,Math.floor(e/h.interval)+hn));let o={latitude:t.latitude,longitude:t.longitude,altitude:h.altitude,accuracy:Math.max(h.accuracy,h.jitter),altitudeAccuracy:h.altitude===null?null:3,heading:n,speed:i};return Ae==="reduced"&&(o=Hi(o)),{fix:o,reason:null}}var Ee=null,yn=0;function ao(){return Ie(h)?oe.size>0||D.size>0?true:h.mode==="route"&&h.playing&&rt.size>0:false}function at(){Ee===null&&ao()&&(Ee=W(()=>{Ee=null,kn(),at()},h.interval))}function bn(){Ee!==null&&no(Ee),Ee=null}function vn(){bn(),kn(),at()}function wn(e,t){let n=Number(e.options[t]);return Number.isFinite(n)&&n>0?n:0}function kn(){let e=O(),{fix:t}=re(e);if(h.mode==="route"&&h.route&&h.playing){let n=nt(h.route,Pe(e));n.finished&&(h={...h,playing:false,anchorMeters:n.along,anchorReal:e},Re())}t&&(xn(t,false),Cn(t)),e-yn>5e3&&(yn=e,co()),U()}function xn(e,t){for(let n of Array.from(oe.values())){if(n.kind==="heading"){let i=e.heading??0;if(!t&&n.lastHeading===i&&n.updates>0)continue;n.lastHeading=i}else{let i=wn(n,"distanceInterval");if(!t&&n.last&&V(n.last,e)<Math.max(i,.01))continue;n.last={latitude:e.latitude,longitude:e.longitude}}n.updates+=1,gn=O();try{n.deliver(e)}catch(i){T("error",n.library,`Watch ${n.id} callback threw: ${String(i?.message??i)}`)}}}function Cn(e){for(let t of Array.from(D.values()))if(t.kind==="geofencing"){let{states:n,transitions:i}=qi(t.regions,t.states,e);t.states=n;for(let o of i)lo(t,o)}else{let n=wn(t,"distanceInterval");if(t.lastBatchAt&&V(t.lastBatchAt,e)<Math.max(n,.01))continue;t.lastBatchAt={latitude:e.latitude,longitude:e.longitude},Sn(t,{locations:[e]},"a location update")}}function lo(e,t){let n=e.regions.find(o=>o.identifier===t.identifier);if(!n)return;T(t.kind,e.library,`${t.kind==="enter"?"Entered":"Left"} ${ut(n)??n.identifier}`,`${e.name} \xB7 region ${n.identifier}${t.initial?" \xB7 first check after monitoring started":""}`);let i=ut(n)??n.identifier;Sn(e,{eventType:t.kind==="enter"?1:2,region:n},`${t.kind==="enter"?"entering":"leaving"} ${i}`)}function Sn(e,t,n){let i=$e.get(e.library);if(!i?.fireTask)return;e.runs+=1,e.kind==="locationUpdates"&&T("batch",e.library,"Sent a background location update",e.name),i.fireTask(e,t).then(o=>{T("task",e.library,`Task ran for ${n}`,o!=null?`${e.name} \xB7 returned ${so(o)}`:e.name)},o=>{T("error",e.library,`Task failed for ${n}`,`${e.name} \xB7 ${String(o?.message??o)}`)})}function so(e){try{let t=typeof e=="string"?e:JSON.stringify(e);return t.length>80?`${t.slice(0,77)}\u2026`:t}catch{return String(e)}}function co(){lt()}function lt(){for(let e of $e.values())e.readPermission?.().then(ro,()=>{})}function st(e){$e.set(e.library,e),U()}function ct(e){let t=`${e.library}:${e.kind}:${e.id}`;oe.set(t,{...e,key:t,since:O(),updates:0,last:null,lastHeading:null}),T("watch",e.library,e.kind==="heading"?"The app started watching the compass heading":"The app started watching location",`watch ${e.id} \xB7 ${e.library}`),W(()=>{let n=oe.get(t);if(!n)return;let{fix:i,reason:o}=re();i?(xn(i,false),U()):o==="services"&&n.fail?.("Location services are disabled")},0),at()}function ae(e,t,n){let i=`${e}:${t}:${n}`,o=oe.delete(i);return o&&T("watch",e,t==="heading"?"The app stopped watching the heading":"The app stopped watching location",`watch ${n} \xB7 ${e}`),o}function uo(e,t,n){return oe.has(`${e}:${t}:${n}`)}function $t(e,t){let n=e.kind==="geofencing"?(e.options.regions??[]).map((i,o)=>sn(i,o)).filter(i=>i!==null):[];D.set(e.name,{...e,regions:n,states:{},since:O(),runs:0,intercepted:t,lastBatchAt:null}),T("task",e.library,e.kind==="geofencing"?`The app started monitoring ${n.length} geofence${n.length===1?"":"s"}`:"The app started background location updates",e.name),Re(),Ie(h)&&W(()=>{let{fix:i}=re(),o=D.get(e.name);i&&o&&(Cn(i),U())},0),at()}function Lt(e){let t=D.get(e);return t?(D.delete(e),T("task",t.library,t.kind==="geofencing"?"The app stopped monitoring geofences":"The app stopped background updates",t.name),Re(),t):null}function Me(e){return D.get(e)??null}function Pt(e){return Array.from(D.values()).filter(t=>!e||t.kind===e)}function In(e,t){let n=D.get(e);n&&(n.intercepted=t,t||(n.states={}),Re())}function po(e){for(let t of e){let n=Ue.findIndex(i=>i.label&&i.label===t.label);n>=0?Ue[n]={...t}:Ue.push({...t})}U()}function ut(e){let t=null,n=1/0;for(let i of Ue){if(!i.label)continue;let o=V(i,e);o<=Math.max(50,e.radius)&&o<n&&(t=i,n=o)}return t?.label??null}function fo(e){for(let t of e){let n=St(t);if(!n)continue;let i=ot.findIndex(o=>(o.id??o.name)===(n.id??n.name));i>=0?ot[i]=n:ot.push(n)}U()}function q(e){h=e;let t=We(h);if(t!==it){it=t;for(let n of $e.values())try{n.onActiveChange?.(t)}catch(i){T("error",n.library,`Switching failed: ${String(i?.message??i)}`)}}return Re(),Ie(h)?vn():(bn(),U()),M()}function dt(e){return q({...h,mode:"fixed",place:{latitude:e.latitude,longitude:e.longitude,label:e.label},playing:false})}function qe(){return h.mode==="route"&&h.route?nt(h.route,Pe(O())):h.place}function An(e){let t=St(e);if(!t)throw new Error("A route needs two or more valid points.");return q({...h,mode:"route",route:t,playing:true,anchorReal:O(),anchorMeters:0})}function Et(){if(h.mode!=="route"||!h.playing)return M();let e=O();return q({...h,playing:false,anchorMeters:Pe(e),anchorReal:e})}function Mt(){if(h.mode!=="route"||!h.route)return M();let e=wt(h.route.points),t=!h.route.loop&&h.anchorMeters>=e?0:h.anchorMeters;return q({...h,playing:true,anchorReal:O(),anchorMeters:t})}function Tn(e){if(h.mode!=="route"||!h.route)throw new Error("No route is playing.");return q({...h,anchorMeters:Math.max(0,e),anchorReal:O()})}function $n(e){if(!h.route)throw new Error("No route is loaded.");if(!Number.isFinite(e)||e<=0)throw new Error("Speed must be a positive number of m/s.");let t=O();return q({...h,route:{...h.route,speed:e},anchorMeters:Pe(t),anchorReal:t})}function Ln(e){let t=cn({...h,...go(e)});return t?q({...t,anchorMeters:h.anchorMeters,anchorReal:h.anchorReal}):M()}function go(e){let t={};for(let[n,i]of Object.entries(e))i!==void 0&&(t[n]=i);return t}function Pn(e){return q({...h,signal:e})}function En(e){let t=q({...h,services:e});if(!e){for(let n of Array.from(oe.values()))n.kind==="position"&&n.fail?.("Location services are disabled");T("error","device","Location services switched off","open watches got an error")}return t}function Mn(e){let t=un[e];if(!t)throw new Error(`Unknown conditions "${String(e)}". Use good, weak, no-signal or off.`);let n=h.services,i=e==="good"||e==="weak"?t:{signal:t.signal,services:t.services},o=q({...h,...i});if(n&&!t.services){for(let r of Array.from(oe.values()))r.kind==="position"&&r.fail?.("Location services are disabled");T("error","device","Location services switched off","open watches got an error")}return o}function Rn(){if(h.mode!=="route"||!h.route)return M();let e=qe();return dt({latitude:e.latitude,longitude:e.longitude})}function Nn(){return q({...h,mode:"real",playing:false})}function Rt(e,t,n){for(let i of D.values()){if(n&&i.name!==n)continue;let o=i.regions.find(p=>p.identifier===e);if(!o)continue;let r=Gi(o,t,qe()),a=ut(o)??o.identifier;return dt({...r,label:t==="inside"?`At ${a}`:`Outside ${a}`})}throw new Error(`No geofence region "${e}" is being monitored.`)}function Nt(){let e=Ct();return q({...e,place:h.place})}function ho(e){return de={persist:typeof e.persist=="boolean"?e.persist:de.persist,showChip:typeof e.showChip=="boolean"?e.showChip:de.showChip},Re(),U(),M()}function mo(){return de}function yo(){return Le.length=0,U(),M()}function M(){if(He)return He;let e=O(),{fix:t,reason:n}=re(e),i=null;if(h.mode==="route"&&h.route){let a=nt(h.route,Pe(e)),p=wt(h.route.points);i={along:a.along,length:p,finished:a.finished,leg:a.leg,etaMs:h.playing&&!h.route.loop&&!a.finished?(p-a.along)/h.route.speed*1e3:null}}let o=Ie(h)?qe():null,r=t??o;return He={active:We(h),simulating:Ie(h),override:h,current:{fix:t,reason:n,precision:Ae},permission:Te,position:o?{latitude:o.latitude,longitude:o.longitude}:null,progress:i,watches:Array.from(oe.values()).map(a=>({key:a.key,library:a.library,id:a.id,kind:a.kind,options:a.options,since:a.since,updates:a.updates})),tasks:Array.from(D.values()).map(a=>({name:a.name,kind:a.kind,library:a.library,intercepted:a.intercepted,since:a.since,runs:a.runs,options:a.options,regions:a.regions.map(p=>({...p,label:ut(p),state:a.states[p.identifier]??"unknown",distance:r?V(p,r):null}))})),log:Le.slice(-50),libraries:Array.from($e.keys()),places:Ue.slice(),routes:ot.slice(),settings:de,lastDeliveryAt:gn},He}function Re(){if(!Tt)return;let e={v:1,override:de.persist&&We(h)?h:null,settings:de,tasks:Array.from(D.values()).filter(t=>t.intercepted).map(({name:t,kind:n,library:i,options:o})=>({name:t,kind:n,library:i,options:o}))};to(e)}function On(e){if(e){de=e.settings;for(let t of e.tasks)D.has(t.name)||bo(t);e.override&&We(e.override)&&(h=e.override,it=true)}}function bo(e){let t=e.kind==="geofencing"?(e.options.regions??[]).map((n,i)=>sn(n,i)).filter(n=>!!n):[];D.set(e.name,{...e,regions:t,states:{},since:O(),runs:0,intercepted:true,lastBatchAt:null})}function Ot(){if(Tt)return;Tt=true,hn=Math.floor(Math.random()*1e3)+1;let e=Zi();if(e!==void 0){On(e),Dn();return}eo().then(t=>{On(t),Dn()})}function Dn(){for(let e of $e.values())e.onActiveChange?.(it);Ie(h)?W(vn,0):U()}var Bn="__buoyLocationNext";function $(e,t,n){let i=e[t];if(typeof i!="function")return null;let o=i[Bn]??i,r=(...p)=>o.apply(e,p),a=n(r);a[Bn]=o;try{e[t]=a}catch{return null}return e[t]===a?r:null}function vo(e,t){let n=new Error(t);return n.code=e,n}var Dt={};Fi(Dt,{AccessibilityInfo:()=>Co,ActivityIndicator:()=>Cr,Alert:()=>Ar,Animated:()=>yr,AppRegistry:()=>Io,AppState:()=>Ao,Appearance:()=>So,BackHandler:()=>To,Button:()=>Sr,CheckBox:()=>Wo,Clipboard:()=>$o,DeviceEventEmitter:()=>Fn,Dimensions:()=>Lo,Easing:()=>Po,FlatList:()=>Uo,I18nManager:()=>Eo,Image:()=>Ho,ImageBackground:()=>Vo,InteractionManager:()=>Ro,Keyboard:()=>Mo,KeyboardAvoidingView:()=>qo,LayoutAnimation:()=>No,Linking:()=>Oo,LogBox:()=>ir,Modal:()=>kr,NativeEventEmitter:()=>Do,NativeModules:()=>xo,PanResponder:()=>Bo,Picker:()=>Go,PixelRatio:()=>jo,Platform:()=>jn,Pressable:()=>wr,ProgressBar:()=>Ko,RefreshControl:()=>Yo,SafeAreaView:()=>Jo,ScrollView:()=>Vn,SectionList:()=>Xo,Share:()=>Fo,StatusBar:()=>Zo,StyleSheet:()=>le,Switch:()=>xr,Text:()=>A,TextInput:()=>Hn,Touchable:()=>Qo,TouchableHighlight:()=>br,TouchableNativeFeedback:()=>er,TouchableOpacity:()=>se,TouchableWithoutFeedback:()=>vr,UIManager:()=>_o,Vibration:()=>zo,View:()=>b,VirtualizedList:()=>tr,YellowBox:()=>nr,findNodeHandle:()=>Ir,unstable_createElement:()=>ko,useColorScheme:()=>or,useLocaleContext:()=>rr,useWindowDimensions:()=>ar});_i(Dt,wo);import*as wo from"react-native-web";import{unstable_createElement as ko,NativeModules as xo,AccessibilityInfo as Co,Appearance as So,AppRegistry as Io,AppState as Ao,BackHandler as To,Clipboard as $o,Dimensions as Lo,Easing as Po,I18nManager as Eo,Keyboard as Mo,InteractionManager as Ro,LayoutAnimation as No,Linking as Oo,NativeEventEmitter as Do,PanResponder as Bo,PixelRatio as jo,Platform as jn,Share as Fo,UIManager as _o,Vibration as zo,CheckBox as Wo,FlatList as Uo,Image as Ho,ImageBackground as Vo,KeyboardAvoidingView as qo,Picker as Go,ProgressBar as Ko,RefreshControl as Yo,SafeAreaView as Jo,SectionList as Xo,StatusBar as Zo,Touchable as Qo,TouchableNativeFeedback as er,VirtualizedList as tr,YellowBox as nr,LogBox as ir,DeviceEventEmitter as Fn,useColorScheme as or,useLocaleContext as rr,useWindowDimensions as ar}from"react-native-web";import*as B from"react-native-web";import{createElement as Bt,forwardRef as _n,useCallback as lr,useRef as sr}from"react";import{useEffect as cr,useState as ur}from"react";import{createPortal as dr}from"react-dom";var pr='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';import{jsx as fr}from"react/jsx-runtime";var Ge=Symbol.for("@buoy-gg/portal-host"),zn=e=>{if(!(e instanceof Element))return false;if(e.closest("input, textarea, select"))return true;let t=e.closest("[contenteditable]")?.getAttribute("contenteditable")?.toLowerCase();return t===""||t==="true"||t==="plaintext-only"};function Wn(){let e=document;if(e[Ge])return e[Ge].host;let t=document.createElement("div");t.dataset.buoyPortalHost="",Object.assign(t.style,{position:"fixed",inset:"0",zIndex:"2147483647",pointerEvents:"none",fontFamily:pr});let n=()=>{let u=document.fullscreenElement,v=u&&u.tagName!=="CANVAS"?u:document.body;t.parentElement!==v&&v.appendChild(t)},i=new Map,o=u=>{(!t.contains(u.target)||!zn(u.target))&&i.set(u.code||u.key,{key:u.key,code:u.code,location:u.location,keyCode:u.keyCode,which:u.which,altKey:u.altKey,ctrlKey:u.ctrlKey,metaKey:u.metaKey,shiftKey:u.shiftKey})},r=u=>{i.delete(u.code||u.key)},a=()=>i.clear(),p=()=>{let u=[...i.values()];i.clear();for(let v of u)document.dispatchEvent(new KeyboardEvent("keyup",{...v,bubbles:true}))},c=u=>{zn(u.target)&&u.stopPropagation()},g=u=>u.stopPropagation();return n(),document.addEventListener("fullscreenchange",n),document.addEventListener("keydown",o,true),document.addEventListener("keyup",r,true),window.addEventListener("blur",a),t.addEventListener("focusin",p),t.addEventListener("keydown",c),t.addEventListener("keyup",c),t.addEventListener("keypress",c),t.addEventListener("wheel",g,{passive:true}),e[Ge]={host:t,users:0,dispose:()=>{document.removeEventListener("fullscreenchange",n),document.removeEventListener("keydown",o,true),document.removeEventListener("keyup",r,true),window.removeEventListener("blur",a),t.remove(),delete e[Ge]}},t}function gr({children:e}){let[t,n]=ur(null);return cr(()=>{let i=Wn(),o=document[Ge];return o.users++,n(i),()=>{--o.users===0&&o.dispose()}},[]),t?dr(fr("div",{"data-buoy-root":"",style:{display:"contents",pointerEvents:"auto"},children:e}),t):null}var Ne=B,hr=["shadowColor","shadowOffset","shadowOpacity","shadowRadius","textShadowColor","textShadowOffset","textShadowRadius"],Oe=e=>typeof e=="number"?`${e}px`:e;function jt(e){if(Array.isArray(e)){let v=e.map(jt);return v.some((S,I)=>S!==e[I])?v:e}if(!e||typeof e!="object"||!hr.some(v=>e[v]!=null))return e;let{shadowColor:t,shadowOffset:n,shadowOpacity:i,shadowRadius:o,textShadowColor:r,textShadowOffset:a,textShadowRadius:p,...c}=e;if(t!=null||n!=null||i!=null||o!=null){let v=t??"black",S=i==null?v:`color-mix(in srgb, ${v} ${Math.min(i,1)*100}%, transparent)`,I=`${Oe(n?.width??0)} ${Oe(n?.height??0)} ${Oe(o??0)} ${S}`;c.boxShadow=typeof c.boxShadow=="string"?`${c.boxShadow}, ${I}`:c.boxShadow??I}let{width:g=0,height:u=0}=a??{};if(r&&(g||u||p)){let v=`${Oe(g)} ${Oe(u)} ${Oe(p??0)} ${r}`;c.textShadow=c.textShadow?`${c.textShadow}, ${v}`:v}return c}var mr=Ne.StyleSheet.create({auto:{pointerEvents:"auto"},none:{pointerEvents:"none"},"box-none":{pointerEvents:"box-none"},"box-only":{pointerEvents:"box-only"}});function Un(e,t){if(typeof e=="function")return i=>Un(e(i),t);let n=jt(e);return t?[n,mr[t]]:n}var le={...Ne.StyleSheet,create:e=>Ne.StyleSheet.create(Object.fromEntries(Object.entries(e).map(([t,n])=>[t,jt(n)])))};function G(e){let t=_n((i,o)=>{let{accessibilityState:r,accessibilityValue:a,pointerEvents:p,...c}=i;for(let u of["busy","checked","disabled","expanded","selected"])r?.[u]!==void 0&&c[`aria-${u}`]===void 0&&(c[`aria-${u}`]=r[u]);for(let[u,v]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))a?.[u]!==void 0&&c[`aria-${v}`]===void 0&&(c[`aria-${v}`]=a[u]);let g=Un(c.style,p);return g!==c.style&&(c.style=g),Bt(e,{...c,ref:o})}),n=e.State;return n&&Object.assign(t,{State:n}),t.displayName=e.displayName??e.name??"NativeWebView",t}var b=G(B.View),A=G(B.Text),yr={...Ne.Animated,View:Ne.Animated.createAnimatedComponent(b),Text:Ne.Animated.createAnimatedComponent(A)},Hn=G(B.TextInput),se=G(B.TouchableOpacity),br=G(B.TouchableHighlight),vr=G(B.TouchableWithoutFeedback),wr=G(B.Pressable),Vn=G(B.ScrollView),qn=_n((e,t)=>{let n=sr(null),i=lr(o=>{if(o){let r=o;for(;r.parentElement&&r.parentElement!==document.body;)r=r.parentElement;r.parentElement===document.body&&(n.current=r,Object.assign(r.style,{position:"relative",zIndex:"2147483647",pointerEvents:"auto"}),Wn().appendChild(r))}else n.current&&(document.body.appendChild(n.current),n.current=null);typeof t=="function"?t(o):t&&(t.current=o)},[t]);return Bt(gr,null,Bt(B.Modal,{...e,ref:i}))});qn.displayName="Modal";var kr=G(qn),xr=G(B.Switch),Cr=G(B.ActivityIndicator),Sr=G(B.Button),Ir=B.findNodeHandle,Ar={alert(e,t,n,i){if(typeof document>"u")return;let o=document.createElement("dialog");o.dataset.buoyRoot="",o.setAttribute("aria-label",e),o.style.cssText="position:fixed;inset:0;margin:auto;width:min(440px,90vw);padding:24px;border:1px solid #475569;border-radius:14px;background:#17212e;color:#f1f5f9;font:14px system-ui;box-shadow:0 20px 80px #0008;z-index:2147483647";let r=document.createElement("h2");if(r.textContent=e,r.style.cssText="font-size:18px;margin:0 0 12px",o.appendChild(r),t){let g=document.createElement("p");g.textContent=t,g.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",o.appendChild(g)}let a=document.createElement("div");a.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let p=n?.length?n:[{text:"OK"}],c=()=>{o.close?.(),o.remove()};for(let g of p){let u=document.createElement("button");u.type="button",u.textContent=g.text??"OK",u.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${g.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,u.onclick=()=>{c(),g.onPress?.()},a.appendChild(u)}o.addEventListener("cancel",g=>{g.preventDefault(),i?.cancelable!==false&&(c(),i?.onDismiss?.())}),o.appendChild(a),document.body.appendChild(o),o.showModal?o.showModal():o.setAttribute("open","")}};var Tr=[{module:"RNCGeolocation",library:"@react-native-community/geolocation"},{module:"RNFusedLocation",library:"react-native-geolocation-service"}],$r={PERMISSION_DENIED:1,POSITION_UNAVAILABLE:2,TIMEOUT:3};function Ft(e,t){return{code:e,message:t,...$r}}function Gn(){return Dt}function Lr(e){let t=Gn();if(!t)return null;let n=null;try{(globalThis.__turboModuleProxy!=null||typeof t.TurboModuleRegistry?.get=="function")&&(n=t.TurboModuleRegistry?.get?.(e))}catch{n=null}if(!n)try{n=t.NativeModules?.[e]}catch{n=null}return n&&typeof n=="object"?n:null}function Kn(e,t,n){let i={coords:{latitude:e.latitude,longitude:e.longitude,altitude:e.altitude,accuracy:e.accuracy,altitudeAccuracy:e.altitudeAccuracy,heading:e.heading??(t==="ios"?-1:0),speed:e.speed??(t==="ios"?-1:0)},timestamp:n};return t==="android"&&(i.mocked=false),i}var Pr=[];function Er(e){let t=Lr(e.module);if(!t||typeof t.getCurrentPosition!="function")return false;Pr.push(t);let n=Gn(),i=n?.Platform?.OS??"ios",o=(g,u)=>n?.DeviceEventEmitter?.emit(g,u),r={options:null,native:false,on:false},a=()=>ct({library:e.library,id:"observer",kind:"position",options:r.options??{},deliver:g=>o("geolocationDidChange",Kn(g,i,Date.now())),fail:g=>o("geolocationError",Ft(2,g))});$(t,"getCurrentPosition",g=>(...u)=>{if(!L())return g(...u);let v=u[1],S=u[2];if(!be()){T("request",e.library,"getCurrentPosition \u2192 services off"),S?.(Ft(2,"No location provider available."));return}let{fix:I}=re();if(!I){T("request",e.library,"getCurrentPosition \u2192 no signal"),W(()=>S?.(Ft(3,"Unable to fetch location within 1.0s.")),1e3);return}T("request",e.library,`getCurrentPosition \u2192 ${I.latitude.toFixed(5)}, ${I.longitude.toFixed(5)}`),W(()=>v?.(Kn(I,i,Date.now())),0)});let p=$(t,"startObserving",g=>(...u)=>{if(r.options=u[0]&&typeof u[0]=="object"?u[0]:{},r.on=true,!L())return r.native=true,g(...u);r.native=false,a()}),c=$(t,"stopObserving",g=>(...u)=>{if(r.on=false,ae(e.library,"position","observer"),r.native)return r.native=false,g(...u)});return st({library:e.library,onActiveChange(g){r.on&&(g&&r.native?(r.native=false,c?.(),a()):!g&&!r.native&&(ae(e.library,"position","observer"),r.native=true,p?.(r.options??{})))}}),true}function Mr(){return Tr.filter(Er).map(e=>e.library)}function Rr(e){return null}function Nr(e){return null}var N="expo-location";function Or(){return jn?.OS??"ios"}function Yn(e){try{let n=globalThis.expo?.modules?.[e];if(n&&typeof n=="object")return n}catch{}let t=Rr(e);return t&&typeof t=="object"?t:null}function _t(e,t,n){let i=t==="ios",o={coords:{latitude:e.latitude,longitude:e.longitude,altitude:e.altitude??(i?0:null),accuracy:e.accuracy,altitudeAccuracy:e.altitudeAccuracy??(i?-1:null),heading:e.heading??(i?-1:null),speed:e.speed??(i?-1:null)},timestamp:n};return t==="android"&&(o.mocked=false),o}function Dr(e,t,n){return n==="ios"?`Calling the '${e}' function has failed
|
|
2
2
|
\u2192 Caused by: ${t}`:`Call to function 'ExpoLocation.${e}' has been rejected.
|
|
3
|
-
\u2192 Caused by: ${t}`}var qn={denied:{ios:{code:"ERR_DENIED_FOREGROUND_LOCATION_PERMISSION",reason:"Location permission is required to do this operation"},android:{code:"ERR_LOCATION_UNAUTHORIZED",reason:"Not authorized to use location services"}},deniedBackground:{ios:{code:"ERR_DENIED_BACKGROUND_LOCATION_PERMISSION",reason:"Background location permission is required to do this operation"},android:{code:"ERR_LOCATION_BACKGROUND_UNAUTHORIZED",reason:"Not authorized to use background location services"}},services:{ios:{code:"ERR_LOCATION_SERVICES_DISABLED",reason:"Location services are disabled"},android:{code:"ERR_LOCATION_SETTINGS_UNSATISFIED",reason:"Location request failed due to unsatisfied device settings"}},unavailable:{ios:{code:"ERR_LOCATION_UNAVAILABLE",reason:"Cannot obtain current location"},android:{code:"ERR_CURRENT_LOCATION_IS_UNAVAILABLE",reason:"Current location is unavailable. Make sure that location services are enabled"}}};function ce(e,t,n){let i=n==="android"?qn[e].android:qn[e].ios;return Promise.reject(go(i.code,Pr(t,i.reason,n)))}var Gn=false;function $r(){let e=Vn("ExpoLocation");if(!e||typeof e.getCurrentPositionAsync!="function")return false;let t=e,n=Vn("ExpoTaskManager"),i=Lr(),o=new Map,r={},a=()=>Date.now(),c=u=>s=>t.emit?.("Expo.locationChanged",{watchId:u,location:Bt(s,i,a())}),d=u=>s=>{let f=s.heading??0;t.emit?.("Expo.headingChanged",{watchId:u,heading:{trueHeading:f,magHeading:f,accuracy:3}})},h=u=>s=>t.emit?.("Expo.locationError",{watchId:u,reason:s});async function p(){let u=t.getForegroundPermissionsAsync,s={granted:true,status:"granted",precision:"full",reported:false};if(typeof u!="function")return s;try{let f=await u.call(t),w=f?.ios?.accuracy==="reduced"||f?.android?.accuracy==="coarse"?"reduced":"full";Zi(w);let C=f?.granted===true,ie=C?"granted":f?.status==="undetermined"?"undetermined":"denied";return{granted:C,status:ie,precision:w,reported:true}}catch{return s}}async function x(){let u=t.getBackgroundPermissionsAsync;if(typeof u!="function")return null;try{return(await u.call(t))?.granted===true}catch{return null}}async function I(){let u=t.getBackgroundPermissionsAsync;if(typeof u!="function")return true;try{return(await u.call(t))?.granted===true}catch{return true}}function A(u,s){lt({library:N,id:u,kind:s.kind,options:s.options,deliver:s.kind==="position"?c(u):d(u),fail:h(u)})}r.getCurrentPositionAsync=L(t,"getCurrentPositionAsync",u=>async(...s)=>{if(!P())return u(...s);let f="getCurrentPositionAsync";if(!be())return S("request",N,"getCurrentPositionAsync \u2192 services off"),ce("services",f,i);if(!(await p()).granted)return S("request",N,"getCurrentPositionAsync \u2192 permission denied"),ce("denied",f,i);let{fix:w}=re();return w?(S("request",N,`getCurrentPositionAsync \u2192 ${w.latitude.toFixed(5)}, ${w.longitude.toFixed(5)}`),Bt(w,i,a())):(S("request",N,"getCurrentPositionAsync \u2192 no signal"),await new Promise(C=>z(()=>C(null),1e3)),ce("unavailable",f,i))}),r.getLastKnownPositionAsync=L(t,"getLastKnownPositionAsync",u=>async(...s)=>{if(!P())return u(...s);if(!(await p()).granted)return ce("denied","getLastKnownPositionAsync",i);let{fix:f}=re();return S("request",N,`getLastKnownPositionAsync \u2192 ${f?"simulated":"null"}`),f?Bt(f,i,a()):null}),r.watchPositionImplAsync=L(t,"watchPositionImplAsync",u=>async(...s)=>{let f=Number(s[0]),w=s[1]&&typeof s[1]=="object"?s[1]:{};if(!P()){let ie=await u(...s),ue={kind:"position",options:w,native:true};return o.set(f,ue),P()&&Ce(f,ue),ie}if(!(await p()).granted)return ce("denied","watchPositionImplAsync",i);if(!P())return o.set(f,{kind:"position",options:w,native:true}),u(...s);let C={kind:"position",options:w,native:false};o.set(f,C),A(f,C)}),r.watchDeviceHeading=L(t,"watchDeviceHeading",u=>async(...s)=>{let f=Number(s[0]);if(!P()){let C=await u(...s),ie={kind:"heading",options:{},native:true};return o.set(f,ie),P()&&Ce(f,ie),C}if(!(await p()).granted)return ce("denied","watchDeviceHeading",i);if(!P())return o.set(f,{kind:"heading",options:{},native:true}),u(...s);let w={kind:"heading",options:{},native:false};o.set(f,w),A(f,w)}),r.removeWatchAsync=L(t,"removeWatchAsync",u=>async(...s)=>{let f=Number(s[0]),w=o.get(f);if(o.delete(f),ae(N,"position",f),ae(N,"heading",f),!w||w.native)return u(...s)}),L(t,"hasServicesEnabledAsync",u=>async(...s)=>P()&&!be()?false:u(...s)),L(t,"getProviderStatusAsync",u=>async(...s)=>{let f=await u(...s);if(!P()||be())return f;let w={...f,locationServicesEnabled:false};for(let C of["gpsAvailable","networkAvailable","passiveAvailable"])C in w&&(w[C]=false);return w});let F=(u,s)=>L(t,s,f=>async(...w)=>{let C=String(w[0]),ie=w[1]&&typeof w[1]=="object"?w[1]:{},ue={name:C,kind:u,library:N,options:ie};if(!P()){let mt=await f(...w);return Tt(ue,false),P()&&b(true),mt}if(u==="locationUpdates"&&!be())return ce("services",s,i);if(!(await p()).granted)return ce("denied",s,i);if(u==="geofencing"&&!await I())return ce("deniedBackground",s,i);Tt(ue,true)});r.startLocationUpdatesAsync=F("locationUpdates","startLocationUpdatesAsync"),r.startGeofencingAsync=F("geofencing","startGeofencingAsync");let _=(u,s)=>L(t,s,f=>async(...w)=>{let C=Ee(String(w[0]));if(!(C&&C.kind===u&&(St(C.name),C.intercepted)))return f(...w)});r.stopLocationUpdatesAsync=_("locationUpdates","stopLocationUpdatesAsync"),r.stopGeofencingAsync=_("geofencing","stopGeofencingAsync");let ge=(u,s)=>L(t,s,f=>async(...w)=>{let C=Ee(String(w[0]));return C&&C.kind===u?true:f(...w)});ge("locationUpdates","hasStartedLocationUpdatesAsync"),ge("geofencing","hasStartedGeofencingAsync");let he=new Map,ht=0,Qe={geofencing:"geofencing",locationUpdates:"location"};n&&(L(n,"notifyTaskFinishedAsync",u=>async(...s)=>{let f=s[1]??{},w=f.eventId?he.get(f.eventId):void 0;if(w&&f.eventId){he.delete(f.eventId),w(f.result);return}return u(...s)}),L(n,"isTaskRegisteredAsync",u=>async(...s)=>Ee(String(s[0]))?.intercepted?true:u(...s)),L(n,"getTaskOptionsAsync",u=>async(...s)=>{let f=Ee(String(s[0]));return f?.intercepted?f.options:u(...s)}),L(n,"getRegisteredTasksAsync",u=>async(...s)=>{let f=await u(...s)??[],w=Lt().filter(C=>C.intercepted).map(C=>({taskName:C.name,taskType:Qe[C.kind],options:C.options}));return[...f,...w]}),L(n,"unregisterTaskAsync",u=>async(...s)=>{let f=Ee(String(s[0]));if(!(f&&(St(f.name),f.intercepted)))return u(...s)}),L(n,"unregisterAllTasksAsync",u=>async(...s)=>{for(let f of Lt())St(f.name);return u(...s)}));function Be(){if(!n)return null;if(n.__expo_module_name__&&typeof n.emit=="function")return(s,f)=>n.emit(s,f);let u=Dn;return u?(s,f)=>u.emit(s,f):null}async function me(u){for(let s=0;s<5e3&&Sr(u)===false;s+=100)await new Promise(f=>z(()=>f(null),100))}async function Xe(u,s){await me(u.name);let f=Be();if(!f)return Promise.reject(new Error("expo-task-manager is not installed"));let w=`buoy-location-${++ht}`,C=typeof n?.EVENT_NAME=="string"?n.EVENT_NAME:"TaskManager.executeTask";return new Promise((ie,ue)=>{he.set(w,ie),z(()=>{he.delete(w)&&ue(new Error("did not finish within 30 s"))},3e4);try{f(C,{data:s,error:null,executionInfo:{eventId:w,taskName:u.name,appState:"active"}})}catch(mt){he.delete(w),ue(mt)}})}function Ce(u,s){s.native&&(s.native=false,Promise.resolve(r.removeWatchAsync?.(u)).catch(()=>{}),A(u,s))}function b(u){for(let[s,f]of Array.from(o.entries()))if(u&&f.native)Ce(s,f);else if(!u&&!f.native){ae(N,f.kind,s);let w=f.kind==="position"?r.watchPositionImplAsync:r.watchDeviceHeading;f.native=true,Promise.resolve(f.kind==="position"?w?.(s,f.options):w?.(s)).catch(C=>{f.native=false,h(s)(String(C?.message??C))})}else u&&!f.native&&!ro(N,f.kind,s)&&A(s,f);for(let s of Lt()){if(s.library!==N)continue;let f=s.kind==="geofencing";if(u&&!s.intercepted){let w=f?r.stopGeofencingAsync:r.stopLocationUpdatesAsync;Promise.resolve(w?.(s.name)).catch(()=>{}),xn(s.name,true)}else if(!u&&s.intercepted){let w=f?r.startGeofencingAsync:r.startLocationUpdatesAsync;xn(s.name,false),Promise.resolve(w?.(s.name,s.options)).catch(C=>{S("error",N,`Could not restart ${s.name} natively: ${String(C?.message??C)}`)})}}}return at({library:N,fireTask:Xe,onActiveChange:b,readPermission:async()=>{let u=await p();if(!u.reported)return null;let s=u.status==="granted"?await x():false;return{status:u.status,background:s,precision:u.precision}}}),Gn||(Gn=true,n&&typeof n.getRegisteredTasksAsync=="function"&&Promise.resolve(n.getRegisteredTasksAsync.call(n)).then(u=>{for(let s of u??[]){if(!s?.taskName||Ee(s.taskName))continue;let f=s.taskType==="geofencing"?"geofencing":s.taskType==="location"?"locationUpdates":null;f&&(Tt({name:s.taskName,kind:f,library:N,options:s.options??{}},false),P()&&b(true))}}).catch(()=>{})),true}import{callCapacitorAsApp as Mr,callCapacitorNative as Kn,callCapacitorNativeCallback as Er,capacitorPlatform as Rr,hasCapacitorPlugin as Nr,installCapacitorBridge as Or,interceptCapacitor as jt,makeCapacitorCallbackId as Dr}from"@buoy-gg/license/web";var ve="@capacitor/geolocation",pe="Geolocation";function Jn(e,t){return{timestamp:t,coords:{latitude:e.latitude,longitude:e.longitude,accuracy:e.accuracy,altitude:e.altitude,altitudeAccuracy:e.altitudeAccuracy,speed:e.speed,heading:e.heading}}}function Ft(e){return new Error(e)}function Br(e){if(!e||typeof e!="object")return null;let t=e.location,n=e.coarseLocation??t;return{status:t==="granted"||n==="granted"?"granted":t==="denied"&&(n==="denied"||n===void 0)?"denied":"undetermined",background:null,precision:t!=="granted"&&n==="granted"?"reduced":"full"}}function Yn(e,t){return(n,i)=>{e.gen===t&&e.nativeId!==null&&e.callback(n,i)}}var qe=new Map,Qn=false;function Xn(e){lt({library:ve,id:e.id,kind:"position",options:e.options,deliver:t=>e.callback(Jn(t,Date.now())),fail:t=>e.callback(null,Ft(t))})}function jr(e){let t=++e.gen;e.nativeId=Er(pe,"watchPosition",e.options,Yn(e,t))}function Fr(e){if(e.gen++,e.nativeId===null)return;let t=e.nativeId;e.nativeId=null,Kn(pe,"clearWatch",{id:t}).catch(()=>{})}function _r(){return Qn?true:!Rr()||!Nr(pe)||!Or()?false:(Qn=true,jt({plugin:pe,methods:["getCurrentPosition"],promise:(e,t)=>{if(!P())return t();if(!be())return S("request",ve,"getCurrentPosition \u2192 services off"),Promise.reject(Ft("Location services are not enabled"));let{fix:n}=re();return n?(S("request",ve,`getCurrentPosition \u2192 ${n.latitude.toFixed(5)}, ${n.longitude.toFixed(5)}`),Jn(n,Date.now())):(S("request",ve,"getCurrentPosition \u2192 no signal"),new Promise((i,o)=>z(()=>o(Ft("Timeout")),1e3)))}}),jt({plugin:pe,methods:["watchPosition"],callback:(e,t,n)=>{if(!P()){let o={id:"",options:e.options,callback:t,nativeId:null,gen:1},r=n(Yn(o,1));return r===null?null:(o.id=r,o.nativeId=r,qe.set(r,o),r)}let i={id:Dr(),options:e.options,callback:t,nativeId:null,gen:1};return qe.set(i.id,i),Xn(i),i.id}}),jt({plugin:pe,methods:["clearWatch"],promise:(e,t)=>{let n=String(e.options.id??""),i=qe.get(n);if(!i)return t();if(qe.delete(n),i.gen++,ae(ve,"position",n),i.nativeId===null)return;let o=i.nativeId;return i.nativeId=null,o===n?t():Kn(pe,"clearWatch",{id:o})}}),at({library:ve,onActiveChange(e){for(let t of qe.values())e&&t.nativeId!==null?(Fr(t),Xn(t)):!e&&t.nativeId===null&&(ae(ve,"position",t.id),jr(t))},async readPermission(){try{return Br(await Mr(pe,"checkPermissions"))}catch{return null}}}),true)}var we="navigator.geolocation",zr={PERMISSION_DENIED:1,POSITION_UNAVAILABLE:2,TIMEOUT:3};function _t(e,t){return{code:e,message:t,...zr}}function Zn(e,t){let n={latitude:e.latitude,longitude:e.longitude,altitude:e.altitude,accuracy:e.accuracy,altitudeAccuracy:e.altitudeAccuracy,heading:e.heading,speed:e.speed};return{coords:{...n,toJSON:()=>n},timestamp:t,toJSON:()=>({coords:n,timestamp:t})}}function ei(e,t){let n=()=>e.gen===t&&e.nativeId!==null;return[(...i)=>n()?e.success(...i):void 0,(...i)=>n()?e.error?.(...i):void 0]}var Ge=new Map,Wr=1e6,ti=false;function Ur(){if(ti)return true;let e=globalThis.navigator?.geolocation;if(!e||typeof e.getCurrentPosition!="function")return false;ti=true;let t=null,n=null,i=o=>lt({library:we,id:o.id,kind:"position",options:o.options,deliver:r=>o.success(Zn(r,Date.now())),fail:r=>o.error?.(_t(2,r))});return L(e,"getCurrentPosition",o=>(...r)=>{if(!P())return o(...r);let a=r[0],c=r[1];if(!be()){S("request",we,"getCurrentPosition \u2192 services off"),z(()=>c?.(_t(2,"Location services are disabled")),0);return}let{fix:d}=re();if(!d){S("request",we,"getCurrentPosition \u2192 no signal"),z(()=>c?.(_t(3,"Timeout expired")),1e3);return}S("request",we,`getCurrentPosition \u2192 ${d.latitude.toFixed(5)}, ${d.longitude.toFixed(5)}`),z(()=>a?.(Zn(d,Date.now())),0)}),t=L(e,"watchPosition",o=>(...r)=>{let a=r[0],c=r[1],d=r[2]&&typeof r[2]=="object"?r[2]:{};if(!P()){let p={id:0,success:a,error:c,options:d,nativeId:null,gen:1},[x,I]=ei(p,1),A=o(x,I,r[2]);return p.id=A,p.nativeId=A,Ge.set(A,p),A}let h={id:Wr++,success:a,error:c,options:d,nativeId:null,gen:1};return Ge.set(h.id,h),i(h),h.id}),n=L(e,"clearWatch",o=>(...r)=>{let a=r[0],c=Ge.get(a);if(!c)return o(...r);if(Ge.delete(a),c.gen++,ae(we,"position",a),c.nativeId!==null)return o(c.nativeId)}),at({library:we,onActiveChange(o){for(let r of Ge.values())if(o&&r.nativeId!==null)r.gen++,n?.(r.nativeId),r.nativeId=null,i(r);else if(!o&&r.nativeId===null){ae(we,"position",r.id);let a=++r.gen,[c,d]=ei(r,a);r.nativeId=t?.(c,d,r.options)??null}}}),true}var ke=null;function zt(){return ke||(ke=[],$r()&&ke.push("expo-location"),ke.push(...Ar()),_r()&&ke.push("@capacitor/geolocation"),Ur()&&ke.push("navigator.geolocation"),ke)}import{useSyncExternalStore as Hr}from"react";import{FloatingTool as Vr,LocationToolIcon as ni,Pause as qr,Play as Gr,RefreshCw as Kr,X as Jr,dismissFloatingTool as Yr,getFloatingTools as Qr,night as fe,openFloatingTool as Xr}from"@buoy-gg/shared-ui/web";var Zr=new Set(["US","GB","LR","MM"]),ii=null;function ea(){try{let e=Intl.DateTimeFormat().resolvedOptions().locale,t=/[-_]([A-Z]{2})\b/.exec(e);return t?t[1]:null}catch{return null}}var Wt=null;function Ne(){return ii!==null?ii:(Wt===null&&(Wt=Zr.has(ea()??"")),Wt)}var oi=3.28084,ri=1609.344;function K(e){if(!Number.isFinite(e))return"\u2013";let t=Math.abs(e);if(Ne()){let n=t/ri;return n<.1?`${Math.round(t*oi/10)*10} ft`:`${ai(n)} mi`}return t<1e3?`${Math.round(t)} m`:`${ai(t/1e3)} km`}function ai(e){let t=Math.round(e*10)/10;return t<10?t.toFixed(1):Math.round(e).toLocaleString("en-US")}function li(e){return Number.isFinite(e)?e>=1e3?`\xB1${K(e)}`:Ne()?`\xB1${Math.round(e*oi)} ft`:`\xB1${Math.round(e)} m`:"\u2013"}function Ut(e){if(e==null||e<0)return"\u2013";let t=Ne()?e*3600/ri:e*3.6,n=Ne()?"mph":"km/h";return`${t<10?t.toFixed(1):Math.round(t)} ${n}`}function ta(e){if(!Number.isFinite(e)||e<0)return"\u2013";let t=Math.round(e/6e4);if(t<1)return`${Math.max(1,Math.round(e/1e3))} sec`;if(t<60)return`${t} min`;let n=Math.floor(t/60),i=t%60;return i?`${n} hr ${i} min`:`${n} hr`}function na(e,t){let n=Math.max(0,Math.round((t-e)/1e3));if(n<5)return"now";if(n<60)return`${n}s ago`;try{return new Date(e).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}catch{let i=new Date(e);return`${i.getHours()}:${String(i.getMinutes()).padStart(2,"0")}`}}function si(e){return e.override.services?e.override.signal?e.override.mode==="real"?"Real Location":e.override.mode==="route"?e.override.route?.name??"Route":e.override.place.label||"Dropped Pin":"No GPS Signal":"Location Services Off"}function ia(e){return!e.override.services||!e.override.signal?"broken":e.override.mode==="real"?"real":"simulated"}function oa(e){if(!e.override.services)return"The app is told location services are off";if(!e.override.signal)return"Updates stop and location requests fail";if(e.override.mode==="real")return"The app gets the device's location";let t=[];if(e.override.mode==="route"&&e.progress){let i=e.progress;i.finished?t.push("Arrived"):e.override.playing||t.push("Paused"),e.current.reason==="gap"&&t.push("no signal here"),i.finished||(t.push(`${K(i.along)} of ${K(i.length)}`),i.etaMs!=null?t.push(`${ta(i.etaMs)} left`):e.override.route?.loop&&t.push("on repeat"))}else t.push("Pinned");let n=e.current.fix;return n&&e.override.mode==="fixed"&&t.push(li(n.accuracy)),e.current.precision==="reduced"&&t.push("approximate"),t.join(" \xB7 ")}function ra(e){return e.status==="denied"?"Not Allowed":e.status==="undetermined"?"Not Asked Yet":`${e.background?"Always":"While Using"} \xB7 ${e.precision==="reduced"?"Approximate":"Precise"}`}function aa(e){if(!e.override.services)return"The app is told location is off";if(!e.override.signal)return"Updates stop, requests fail";if(e.override.mode==="route"&&e.progress){if(e.progress.finished)return"Arrived";let n=`${K(e.progress.along)} of ${K(e.progress.length)}`;return e.override.playing?n:`Paused \xB7 ${n}`}let t=e.current.fix;return t?`Pinned \xB7 ${Fe(t,3)}`:"Pinned"}import{jsx as H,jsxs as ci}from"react/jsx-runtime";var ut="location-chip",la={id:ut,render:e=>H(fi,{...e})},sa=()=>Qr().some(e=>e.id===ut),ui=false,Ht=false,di=null;function pi(e){Ht!==e&&(Ht=e,di?.())}function ca(){if(ui)return;ui=true;let e=false,t=()=>{let n=E().active&&uo().showChip&&!Ht;n&&!e?Xr(la):!n&&sa()&&Yr(ut),e=n};di=t,Ue(t),t()}function fi({id:e,revealToken:t}){let n=Hr(Ue,E,E),i=si(n),o=n.override.mode==="route"&&n.progress,r=n.override.playing,a=!!o&&o.finished;return H(Vr,{id:e,revealToken:t,variant:"strip",dragFromSurface:true,defaultPlacement:"top",accessibilityLabel:`Move or hide the location chip. ${i}`,handleAdornment:H(ni,{size:12}),children:ci(v,{style:xe.row,children:[H(ni,{size:18}),ci(v,{style:xe.text,children:[H(T,{style:xe.title,numberOfLines:1,testID:"location-chip-title",children:i}),H(T,{style:xe.detail,numberOfLines:1,testID:"location-chip-detail",children:aa(n)})]}),o?H(se,{testID:"location-chip-playpause",accessibilityRole:"button",accessibilityLabel:r?"Pause the route":a?"Play the route again":"Resume the route",onPress:()=>r?Pt():$t(),style:xe.pill,hitSlop:{top:8,bottom:8,left:4,right:4},children:r?H(qr,{size:14,color:fe.color.accent}):a?H(Kr,{size:14,color:fe.color.accent}):H(Gr,{size:14,color:fe.color.accent})}):null,H(v,{style:xe.separator}),H(se,{testID:"location-chip-reset",accessibilityRole:"button",accessibilityLabel:"Back to the real location",onPress:()=>Et(),style:xe.button,hitSlop:{top:8,bottom:8,left:4,right:8},children:H(Jr,{size:16,color:fe.color.textSecondary})})]})})}var xe=le.create({row:{flexDirection:"row",alignItems:"center",gap:10,paddingLeft:10,paddingRight:4,paddingVertical:6,minWidth:230,maxWidth:340},text:{flexShrink:1,minWidth:120},title:{color:fe.color.text,fontSize:14,fontWeight:"600"},detail:{color:fe.color.textSecondary,fontSize:11,fontVariant:["tabular-nums"]},pill:{width:30,height:30,borderRadius:15,alignItems:"center",justifyContent:"center",backgroundColor:fe.color.accentFill},button:{width:32,height:32,alignItems:"center",justifyContent:"center",borderRadius:16},separator:{width:le.hairlineWidth,height:20,backgroundColor:fe.color.separator}});import{LocationToolIcon as ua,LOCATION_TOOL_ICON_COLOR as da,createToolFactory as pa,defineToolPreset as fa}from"@buoy-gg/shared-ui/web";import{useEffect as ga,useState as ha}from"react";import{FeatureGate as ma}from"@buoy-gg/shared-ui/web";import{createSyncAdapter as ya}from"@buoy-gg/shared-ui/web";var dt=[{latitude:37.3349,longitude:-122.009,label:"Apple Park"},{latitude:37.422,longitude:-122.0841,label:"Googleplex"},{latitude:40.758,longitude:-73.9855,label:"Times Square"},{latitude:51.508,longitude:-.1281,label:"Trafalgar Square"},{latitude:48.8584,longitude:2.2945,label:"Eiffel Tower"},{latitude:35.6595,longitude:139.7005,label:"Shibuya Crossing"},{latitude:-33.8568,longitude:151.2153,label:"Sydney Opera House"},{latitude:-23.5614,longitude:-46.6559,label:"S\xE3o Paulo"},{latitude:0,longitude:0,label:"Null Island"}],Oe=[{id:"walk",name:"Walk",description:"1 km north from here at walking pace",speed:1.4},{id:"run",name:"Run",description:"3 km north, then east, at running pace",speed:3.3},{id:"drive",name:"City Drive",description:"4 km of city streets with turns",speed:13.4},{id:"highway",name:"Highway",description:"30 km north at highway speed",speed:30},{id:"tunnel",name:"Tunnel",description:"3 km drive with no signal for 600 m in the middle",speed:13.4},{id:"loop",name:"Block Loop",description:"A 400 m block, walked on repeat",speed:1.4}];function gi(e,t,n=0){let i=Oe.find(h=>h.id===e);if(!i)throw new Error(`Unknown route preset "${e}". Use one of: ${Oe.map(h=>h.id).join(", ")}.`);let o={latitude:t.latitude,longitude:t.longitude},r=(h,p,x)=>je(h,n+p,x),a,c,d=false;switch(e){case"walk":a=[o,r(o,0,1e3)];break;case"run":a=[o,r(o,0,1500),r(r(o,0,1500),90,1500)];break;case"drive":{let h=r(o,0,1200),p=r(h,90,800),x=r(p,0,1e3),I=r(x,-90,1e3);a=[o,h,p,x,I];break}case"highway":a=[o,r(o,0,3e4)];break;case"tunnel":a=[o,r(o,0,3e3)],c=[[1200,1800]];break;case"loop":{let h=r(o,0,100),p=r(h,90,100),x=r(p,180,100);a=[o,h,p,x,o],d=true;break}}return{id:`preset:${e}`,name:i.name,points:a,speed:i.speed,loop:d,gaps:c}}function ba(e,t,n){return{id:"line",name:t.label?`To ${t.label}`:"Straight line",points:[{latitude:e.latitude,longitude:e.longitude},{latitude:t.latitude,longitude:t.longitude}],speed:n}}function Z(e){return e&&typeof e=="object"?e:{}}function Ke(e,...t){for(let n of t){let i=e[n];if(typeof i=="boolean")return i;if(i==="true"||i==="on")return true;if(i==="false"||i==="off")return false}}function J(e,...t){for(let n of t){let i=e[n];if(i==null||i==="")continue;let o=Number(i);if(Number.isFinite(o))return o}}function $(){return{...E(),builtInPlaces:dt,presets:Oe}}function va(e){let t=e.trim().toLowerCase(),n=[...E().places,...dt];return n.find(i=>i.label?.toLowerCase()===t)??n.find(i=>i.label?.toLowerCase().includes(t))??null}function hi(e){let t=typeof e.label=="string"?e.label:void 0,n=J(e,"latitude","lat"),i=J(e,"longitude","lon","lng");if(n!==void 0&&i!==void 0){let o={latitude:n,longitude:i};if(!Ie(o))throw new Error("latitude must be within \xB190 and longitude within \xB1180.");return{...o,label:t}}for(let o of["place","to","query","coordinate","at"]){let r=e[o];if(Ie(r))return{...r,label:r.label??t};if(typeof r=="string"&&r.trim()){let a=vt(r);if(a)return{...a,label:t};let c=va(r);if(c)return c;throw new Error(`No place called "${r}". Give latitude and longitude, or one of: ${wa()}.`)}}return null}function wa(){return[...E().places,...dt].map(e=>e.label).filter(Boolean).join(", ")}function ka(e){let t=J(e,"speed","metersPerSecond"),n=J(e,"heading","bearing")??0;if(Array.isArray(e.points))return{points:e.points,speed:t??1.4,loop:Ke(e,"loop")??false,name:typeof e.name=="string"?e.name:"Custom route",gaps:Array.isArray(e.gaps)?e.gaps:void 0};let i=typeof e.route=="string"?e.route:typeof e.routeId=="string"?e.routeId:typeof e.preset=="string"?e.preset:void 0;if(i){let r=E().routes.find(d=>d.id===i||d.name?.toLowerCase()===i.toLowerCase());if(r)return t?{...r,speed:t}:r;let a=Oe.find(d=>d.id===i||d.name.toLowerCase()===i.toLowerCase());if(a){let d=gi(a.id,He(),n);return t?{...d,speed:t}:d}let c=[...E().routes.map(d=>d.id??d.name),...Oe.map(d=>d.id)];throw new Error(`No route "${i}". Use one of: ${c.join(", ")}; or pass points.`)}let o=hi(e);if(o)return ba(He(),o,t??1.4);throw new Error("startRoute needs `points` (two or more {latitude, longitude}), `route` (a preset or app route id), or `to` (a place).")}var Vt=ya({version:1,getSnapshot(){return $()},subscribe(e){return Ue(e)},actions:{getState(){return $()},setLocation(e){let t=hi(Z(e));if(!t)throw new Error('setLocation needs `latitude` and `longitude`, `query` ("lat, lon" or a map link), or `place` (a place name).');return ct(t),$()},startRoute(e){return Cn(ka(Z(e))),$()},stopRoute(){return $n(),$()},setConditions(e){let t=Z(e),n=(typeof t.conditions=="string"?t.conditions:typeof t.preset=="string"?t.preset:"").trim().toLowerCase().replace(/[\s_]+/g,"-"),i={good:"good",weak:"weak","no-signal":"no-signal",nosignal:"no-signal",off:"off","services-off":"off","location-off":"off"}[n];if(!i)throw new Error("setConditions needs `conditions`: good, weak, no-signal or off.");return Pn(i),$()},pauseRoute(){return Pt(),$()},resumeRoute(){return $t(),$()},seekRoute(e){let t=Z(e),n=J(t,"meters","along"),i=J(t,"fraction","progress"),o=E().progress?.length??0;if(n===void 0&&i===void 0)throw new Error("seekRoute needs `meters` or `fraction` (0 to 1).");return In(n??(i??0)*o),$()},setSpeed(e){let t=J(Z(e),"speed","metersPerSecond");if(t===void 0)throw new Error("setSpeed needs `speed` in meters per second.");return An(t),$()},tune(e){let t=Z(e);return Tn({accuracy:J(t,"accuracy"),jitter:J(t,"jitter","drift"),altitude:t.altitude===null?null:J(t,"altitude"),heading:t.heading===null?null:J(t,"heading"),interval:J(t,"interval","intervalMs")}),$()},setSignal(e){let t=Ke(Z(e),"on","signal","enabled");if(t===void 0)throw new Error("setSignal needs `on`: true or false.");return Sn(t),$()},setServices(e){let t=Ke(Z(e),"on","services","enabled");if(t===void 0)throw new Error("setServices needs `on`: true or false.");return Ln(t),$()},enterRegion(e){let t=Z(e),n=typeof t.identifier=="string"?t.identifier:typeof t.region=="string"?t.region:void 0;if(!n)throw new Error("enterRegion needs `identifier` (a monitored geofence region).");return Mt(n,"inside",typeof t.task=="string"?t.task:void 0),$()},exitRegion(e){let t=Z(e),n=typeof t.identifier=="string"?t.identifier:typeof t.region=="string"?t.region:void 0;if(!n)throw new Error("exitRegion needs `identifier` (a monitored geofence region).");return Mt(n,"outside",typeof t.task=="string"?t.task:void 0),$()},useRealLocation(){return Mn(),$()},reset(){return Et(),$()},updateSettings(e){let t=Z(e);return co({persist:Ke(t,"persist"),showChip:Ke(t,"showChip")}),$()},clearLog(){return po(),$()}}});import{useEffect as xa,useState as De}from"react";import{Check as Ca,ChevronLeft as Ia,ChevronRight as Aa,NightButton as mi,NightCard as R,NightFootnote as ee,NightRows as te,NightSectionLabel as Y,NightSegmented as qt,NightSwitch as Ta,Pause as Sa,Play as La,RefreshCw as Pa,copyToClipboard as $a,monoFont as Ma,night as m,realNow as Gt,useSafeAreaInsets as Ea,useToolScreenHeader as Ra}from"@buoy-gg/shared-ui/web";import{night as ne}from"@buoy-gg/shared-ui/web";import{jsx as Q,jsxs as pt}from"react/jsx-runtime";var yi="#F87171",Je=1.8,Na=6e4,Oa=400;function Da({snapshot:e,onPinPlace:t,onCrossRegion:n}){let i=e.position,o=e.override.mode==="route"?e.override.route:null,r=i??e.places[0]??Ba(e.tasks)??null;if(!r)return null;let a=b=>!i||V(i,b)<=Na,c=e.places.filter(a),d=e.tasks.filter(b=>b.kind==="geofencing").flatMap(b=>b.regions.filter(a).map(u=>({task:b,region:u}))),h=e.places.length-c.length,p=Math.cos(r.latitude*Math.PI/180),x=b=>({x:(b.longitude-r.longitude)*111320*p,y:(b.latitude-r.latitude)*110540}),I=[];i&&I.push({...x(i),r:60});for(let b of o?.points??[])I.push({...x(b),r:0});for(let b of c)I.push({...x(b),r:60});for(let b of d)I.push({...x(b.region),r:b.region.radius});let A=1/0,F=-1/0,_=1/0,ge=-1/0;for(let b of I)A=Math.min(A,b.x-b.r),F=Math.max(F,b.x+b.r),_=Math.min(_,b.y-b.r),ge=Math.max(ge,b.y+b.r);let he=(A+F)/2,ht=(_+ge)/2,Qe=Math.max(Oa,(ge-_)*1.35,(F-A)*1.2/Je),Be=Qe*Je,me=b=>{let u=x(b);return{x:.5+(u.x-he)/Be,y:.5-(u.y-ht)/Qe}},Xe=Fa(Be),Ce=e.override.mode==="fixed"?e.override.place.label:void 0;return Q(v,{children:pt(v,{style:M.map,testID:"location-map",accessibilityLabel:"Map of places, geofences and the simulated position",children:[bi.map(b=>Q(v,{style:[M.gridV,{left:B(b)}]},`v${b}`)),bi.map(b=>Q(v,{style:[M.gridH,{top:B(b)}]},`h${b}`)),d.map(({task:b,region:u})=>{let s=me(u),f=2*u.radius/Be,w=f*Je,C=u.state==="inside";return Q(se,{testID:`location-map-region-${vi(u.identifier)}`,accessibilityRole:"button",accessibilityLabel:`${C?"Leave":"Enter"} ${u.label??u.identifier}`,activeOpacity:.6,onPress:()=>n(b,u),style:[M.fence,C?M.fenceInside:null,{left:B(s.x-f/2),top:B(s.y-w/2),width:B(f),height:B(w)}]},`${b.name}:${u.identifier}`)}),o?ja(o.points.map(me)).map((b,u)=>Q(v,{pointerEvents:"none",style:[M.segment,{left:B(b.midX-b.length/2),top:B(b.midY),width:B(b.length),transform:[{rotate:`${b.angle}rad`}]}]},`seg${u}`)):null,c.map((b,u)=>{let s=me(b),f=!!Ce&&Ce===b.label;return pt(se,{testID:`location-map-place-${vi(b.label??String(u))}`,accessibilityRole:"button",accessibilityLabel:`Pin ${b.label??"this place"}`,activeOpacity:.6,onPress:()=>t(b),style:[M.placeHit,{left:B(s.x),top:B(s.y)}],children:[Q(v,{style:[M.placeDot,f?M.placeDotSelected:null]}),b.label?Q(T,{style:M.placeLabel,numberOfLines:1,children:b.label}):null]},`${b.label??u}`)}),i?pt(v,{pointerEvents:"none",style:[M.pinWrap,{left:B(me(i).x),top:B(me(i).y)}],children:[Q(v,{style:M.pinHalo}),Q(v,{style:[M.pin,e.current.reason==="gap"?M.pinHollow:null]})]}):null,pt(v,{style:M.scale,pointerEvents:"none",children:[Q(v,{style:[M.scaleBar,{width:B(Xe.fraction)}]}),Q(T,{style:M.scaleLabel,children:Xe.label})]}),h>0?Q(T,{style:M.offMap,pointerEvents:"none",children:`${h} more ${h===1?"place":"places"} off the map`}):null]})})}var bi=[.2,.4,.6,.8];function B(e){return`${e*100}%`}function Ba(e){for(let t of e)if(t.regions[0])return t.regions[0];return null}function ja(e){let t=[];for(let n=1;n<e.length;n++){let i=e[n-1],o=e[n],r=o.x-i.x,a=(o.y-i.y)/Je;t.push({midX:(i.x+o.x)/2,midY:(i.y+o.y)/2,length:Math.sqrt(r*r+a*a),angle:Math.atan2(a,r)})}return t}function Fa(e){let t=e/4,n=Ne()?1609.344:1e3,i=Ne()?[.01,.02,.05,.1,.2,.5,1,2,5,10,20,50,100].map(r=>r*n):[10,20,50,100,200,500,1e3,2e3,5e3,1e4,2e4,5e4,1e5],o=i[0];for(let r of i)r<=t&&(o=r);return{fraction:o/e,label:K(o)}}function vi(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}var M=le.create({map:{width:"100%",aspectRatio:Je,borderRadius:ne.radius.card,borderWidth:1,borderColor:ne.color.border,backgroundColor:ne.color.surface,overflow:"hidden"},gridV:{position:"absolute",top:0,bottom:0,width:le.hairlineWidth,backgroundColor:"rgba(255, 255, 255, 0.04)"},gridH:{position:"absolute",left:0,right:0,height:le.hairlineWidth,backgroundColor:"rgba(255, 255, 255, 0.04)"},fence:{position:"absolute",zIndex:1,borderRadius:9999,borderWidth:1,borderColor:"rgba(255, 255, 255, 0.22)",backgroundColor:"rgba(255, 255, 255, 0.04)",minWidth:10,minHeight:10},fenceInside:{borderColor:ne.color.accentBorderStrong,backgroundColor:ne.color.accentSoft},segment:{position:"absolute",height:3,marginTop:-1.5,borderRadius:1.5,backgroundColor:"rgba(248, 113, 113, 0.45)"},placeHit:{position:"absolute",flexDirection:"row",alignItems:"center",gap:4,height:24,marginTop:-12,marginLeft:-12,paddingLeft:8,paddingRight:4},placeDot:{width:8,height:8,borderRadius:4,backgroundColor:ne.color.textSecondary},placeDotSelected:{backgroundColor:ne.color.text},placeLabel:{color:ne.color.textSecondary,fontSize:10,fontWeight:"500",maxWidth:110},pinWrap:{position:"absolute",width:28,height:28,marginLeft:-14,marginTop:-14,alignItems:"center",justifyContent:"center"},pinHalo:{position:"absolute",width:28,height:28,borderRadius:14,backgroundColor:"rgba(248, 113, 113, 0.22)"},pin:{width:14,height:14,borderRadius:7,backgroundColor:yi,borderWidth:2,borderColor:"#FFFFFF"},pinHollow:{backgroundColor:"transparent",borderColor:yi},scale:{position:"absolute",left:10,right:10,bottom:8,gap:3},scaleBar:{height:2,borderRadius:1,backgroundColor:ne.color.textTertiary},scaleLabel:{color:ne.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},offMap:{position:"absolute",right:10,bottom:8,color:ne.color.textTertiary,fontSize:10}});import{Fragment as Ye,jsx as l,jsxs as k}from"react/jsx-runtime";var wi={places:"Other Location",routes:"Route",speed:"Speed",accuracy:"Accuracy & Drift",activity:"Activity",options:"Options"},_a="#F87171",ki=[{key:"1.4",label:"Walking"},{key:"3.3",label:"Running"},{key:"5.5",label:"Cycling"},{key:"13.4",label:"City Traffic"},{key:"30",label:"Highway"},{key:"250",label:"Airplane"}],xi=[{key:"good",label:"Good"},{key:"weak",label:"Weak"},{key:"no-signal",label:"No Signal"},{key:"off",label:"Off"}],za={good:"Precise fixes, like outdoors with a clear sky.",weak:"Fixes are \xB165 m and wander by up to 50 m, like indoors or between tall buildings.","no-signal":"Watches get no updates and location requests fail.",off:"The app is told location services are turned off.",custom:"Custom accuracy and drift."},Ci=[{key:"5",label:"5 m"},{key:"20",label:"20 m"},{key:"65",label:"65 m"},{key:"1000",label:"1 km"}],Ii=[{key:"0",label:"Off"},{key:"10",label:"10 m"},{key:"50",label:"50 m"},{key:"200",label:"200 m"}],Wa=4;function Kt(e){let[t,n]=De(()=>Gt());return xa(()=>{if(!e)return;let i=setInterval(()=>n(Gt()),1e3);return()=>clearInterval(i)},[e]),t}function Ai({snapshot:e,onAction:t}){let n=Ea({minBottom:16}),[i,o]=De(null),[r,a]=De("main"),c=()=>a("main"),d=Ra(r==="main"?null:{title:wi[r],subtitle:"",onBack:c,searchable:false},[r]),h=(A,F)=>{o(null),t(A,F).catch(_=>{o(_ instanceof Error?_.message:String(_))})};if(!e)return l(v,{style:y.waiting,testID:"location-waiting",children:l(ee,{centered:true,children:"Waiting for the app\u2026"})});let p=i?l(ee,{tone:"danger",centered:true,children:l(T,{testID:"location-error",children:i})}):null,x=(A,F)=>{h(A,F),c()},I;switch(r){case"places":I=l(Ka,{snapshot:e,pick:x});break;case"routes":I=l(Xa,{snapshot:e,pick:x});break;case"speed":I=l(el,{snapshot:e,pick:x});break;case"accuracy":I=l(al,{snapshot:e,run:h});break;case"activity":I=l(sl,{snapshot:e,run:h});break;case"options":I=l(ul,{snapshot:e,run:h});break;default:I=k(Ye,{children:[l(Ua,{snapshot:e,run:h}),p,l(Va,{snapshot:e,run:h}),l(qa,{snapshot:e,run:h,open:a}),l(Ya,{snapshot:e,open:a}),l(nl,{snapshot:e,run:h}),l(rl,{snapshot:e,run:h,open:a}),l(ll,{snapshot:e,open:a})]})}return k(zn,{style:y.fill,contentContainerStyle:[y.content,{paddingBottom:n.bottom}],testID:"location-scroll",keyboardShouldPersistTaps:"handled",children:[r!=="main"&&!d?l(dl,{title:wi[r],onBack:c}):null,r!=="main"?p:null,I]},r)}function Ua({snapshot:e,run:t}){let n=e.override,i=n.mode==="route"?n.route:null,o=e.progress;Kt(!!i&&n.playing);let r=ia(e),a=e.current.fix,c=o&&o.length>0?Math.min(1,o.along/o.length):0,[d,h]=De(false);return k(R,{children:[k(v,{style:y.status,children:[l(T,{style:[y.statusTitle,r==="simulated"?y.titleSimulated:r==="broken"?y.titleBroken:null],testID:"location-hero-title",numberOfLines:1,adjustsFontSizeToFit:true,children:si(e)}),l(T,{style:y.statusLine,testID:"location-hero-status",children:oa(e)}),a&&e.simulating?l(se,{testID:"location-copy-coordinates",accessibilityRole:"button",accessibilityLabel:"Copy coordinates",activeOpacity:.6,onPress:()=>{$a(`${a.latitude}, ${a.longitude}`).then(p=>{p&&(h(true),setTimeout(()=>h(false),1500))})},children:l(T,{style:y.coordinates,children:d?"Copied":Fe(a,5)})}):null,i&&o?k(v,{style:y.progressTrack,testID:"location-route-progress",children:[l(v,{style:[y.progressFill,{width:`${c*100}%`}]}),(i.gaps??[]).map(([p,x],I)=>l(v,{style:[y.progressGap,{left:`${p/o.length*100}%`,width:`${(x-p)/o.length*100}%`}]},I))]}):null,e.active?k(v,{style:y.statusButtons,children:[i&&o?l(Ha,{testID:n.playing?"location-route-pause":"location-route-resume",label:n.playing?"Pause":o.finished?"Play again":"Resume",onPress:()=>t(n.playing?"pauseRoute":"resumeRoute"),children:n.playing?l(Sa,{size:18,color:m.color.onAccent}):o.finished?l(Pa,{size:18,color:m.color.onAccent}):l(La,{size:18,color:m.color.onAccent})}):null,l(v,{style:y.flex,children:l(mi,{label:"Use Real Location",size:"md",testID:"location-reset",onPress:()=>t("reset")})})]}):null]}),e.permission?k(v,{style:y.permission,testID:"location-permission",children:[k(v,{style:y.rowBetween,children:[l(T,{style:y.rowTitle,children:"Permission"}),l(T,{style:[y.rowValue,e.permission.status!=="granted"?y.valueWarning:null],testID:"location-permission-value",children:ra(e.permission)})]}),e.permission.status!=="granted"?l(T,{style:y.detail,children:"The app's location requests fail until it's allowed. Change it in Settings or the Permissions tool."}):null]}):null]})}function Ha({children:e,label:t,onPress:n,testID:i}){return l(se,{testID:i,accessibilityRole:"button",accessibilityLabel:t,activeOpacity:.7,onPress:n,style:y.round,children:e})}function Va({snapshot:e,run:t}){return!!e.position||e.places.length>0||e.tasks.some(n=>n.regions.length>0)?k(v,{children:[l(Da,{snapshot:e,onPinPlace:n=>t("setLocation",{latitude:n.latitude,longitude:n.longitude,label:n.label}),onCrossRegion:(n,i)=>t(i.state==="inside"?"exitRegion":"enterRegion",{identifier:i.identifier,task:n.name})}),l(ee,{children:"Map views in the app still show the device's own blue dot. Move the simulator's location for those."})]}):null}function qa({snapshot:e,run:t,open:n}){let i=e.places.length>0?e.places:e.builtInPlaces.slice(0,Wa),o=e.override.mode==="fixed"?e.override.place:null,r=e.position,a=!!o&&!i.some(c=>ft(c,o));return k(v,{children:[l(Y,{children:"Location"}),l(R,{children:k(te,{children:[i.map((c,d)=>l(j,{title:c.label??Fe(c,4),value:r&&!(o&&ft(c,o))?Ga(r,c):void 0,checked:!!o&&ft(c,o),testID:`location-place-${gt(c.label??String(d))}`,onPress:()=>t("setLocation",{latitude:c.latitude,longitude:c.longitude,label:c.label})},`${c.label??d}`)),l(j,{title:"Other Location\u2026",value:a?o.label||Fe(o,3):void 0,chevron:true,testID:"location-other",onPress:()=>n("places")},"other")]})})]})}function Ga(e,t){let n=V(e,t);return n<30?"Here":K(n)}function ft(e,t){return e.label&&t.label?e.label===t.label:V(e,t)<1}function Ka({snapshot:e,pick:t}){let[n,i]=De(""),o=vt(n),r=e.override.mode==="fixed"?e.override.place:null,a=()=>{o&&(t("setLocation",{query:n}),i(""))};return k(Ye,{children:[k(v,{children:[l(Y,{children:"Coordinates"}),l(R,{children:k(v,{style:y.editor,children:[k(v,{style:y.inputRow,children:[l(_n,{value:n,onChangeText:i,placeholder:"Coordinates or a Maps link",placeholderTextColor:m.color.placeholder,autoCapitalize:"none",autoCorrect:false,style:y.input,testID:"location-coordinate-input",accessibilityLabel:"Coordinates or a Maps link",returnKeyType:"done",onSubmitEditing:a}),l(mi,{label:"Pin",size:"md",variant:"primary",disabled:!o,testID:"location-coordinate-set",onPress:a})]}),n.length>0?l(T,{style:o?y.detail:y.warning,testID:"location-coordinate-preview",children:o?Ja(o):"Type a latitude and longitude, like 40.7580, -73.9855, or paste a Google or Apple Maps link."}):null]})})]}),k(v,{children:[l(Y,{children:"Places"}),l(R,{children:l(te,{children:e.builtInPlaces.map((c,d)=>l(j,{title:c.label??Fe(c,4),detail:c.label==="Null Island"?"0, 0: catches code that treats 0 as no location":void 0,checked:!!r&&ft(c,r),testID:`location-place-${gt(c.label??String(d))}`,onPress:()=>t("setLocation",{latitude:c.latitude,longitude:c.longitude,label:c.label})},`${c.label??d}`))})}),e.places.length===0?l(ee,{children:"Add your own places, such as your stores, with registerLocationPlaces()."}):null]})]})}function Ja(e){let t=`${Math.abs(e.latitude).toFixed(4)}\xB0 ${e.latitude>=0?"N":"S"}`,n=`${Math.abs(e.longitude).toFixed(4)}\xB0 ${e.longitude>=0?"E":"W"}`;return`${t}, ${n}`}function Ya({snapshot:e,open:t}){let n=e.override.mode==="route"?e.override.route:null;return k(v,{children:[l(Y,{children:"Movement"}),l(R,{children:k(te,{children:[l(j,{title:"Route",value:n?.name??"None",chevron:true,testID:"location-route",onPress:()=>t("routes")},"route"),n?l(j,{title:"Speed",value:Qa(n.speed),chevron:true,testID:"location-speed",onPress:()=>t("speed")},"speed"):null]})})]})}function Qa(e){let t=ki.find(n=>Math.abs(Number(n.key)-e)<.05);return t?t.label:Ut(e)}function Xa({snapshot:e,pick:t}){let n=e.override.mode==="route"?e.override.route:null,i=n?.id;return k(Ye,{children:[n?l(v,{children:l(R,{children:l(te,{children:l(j,{title:"Stop Here",detail:"End the route and stay where it got to",testID:"location-route-stop",onPress:()=>t("stopRoute")},"stop")})})}):null,e.routes.length>0?k(v,{children:[l(Y,{children:"This App"}),l(R,{children:l(te,{children:e.routes.map((o,r)=>l(j,{title:o.name??o.id??`Route ${r+1}`,detail:`${K(bt(o.points))} at ${Ut(o.speed)}${o.loop?", on repeat":""}`,checked:!!i&&i===o.id,testID:`location-route-${gt(o.id??o.name??String(r))}`,onPress:()=>t("startRoute",{route:o.id??o.name})},o.id??`${o.name}-${r}`))})})]}):null,k(v,{children:[l(Y,{children:"From Here"}),l(R,{children:l(te,{children:e.presets.map(o=>l(j,{title:o.name,detail:Za(o.id)??o.description,checked:i===`preset:${o.id}`,testID:`location-preset-${o.id}`,onPress:()=>t("startRoute",{route:o.id})},o.id))})}),l(ee,{children:"These start where the app is now."})]})]})}function Za(e){let t=K;switch(e){case"walk":return`${t(1e3)} north at walking pace`;case"run":return`${t(3e3)} north, then east, at running pace`;case"drive":return`${t(4e3)} of city streets with turns`;case"highway":return`${t(3e4)} north at highway speed`;case"tunnel":return`${t(3e3)} drive with no signal for ${t(600)} in the middle`;case"loop":return`A ${t(400)} block, walked on repeat`;default:return null}}function el({snapshot:e,pick:t}){let n=e.override.route?.speed??0;return k(v,{children:[l(R,{children:l(te,{children:ki.map(i=>l(j,{title:i.label,value:Ut(Number(i.key)),checked:Math.abs(Number(i.key)-n)<.05,testID:`location-speed-${i.key}`,onPress:()=>t("setSpeed",{speed:Number(i.key)})},i.key))})}),l(ee,{children:"Heading and speed follow the route."})]})}var tl=1e4;function nl({snapshot:e,run:t}){let n=e.tasks.filter(d=>d.kind==="geofencing"&&d.regions.length>0),[i,o]=De(null),r=Kt(!!i);if(n.length===0)return null;let a=n.length>1,c=n.map(d=>d.name).join(", ");return k(v,{children:[l(Y,{children:"Geofences"}),l(R,{children:l(te,{children:n.flatMap(d=>d.regions.map(h=>{let p=`${d.name}:${h.identifier}`,x=h.state==="inside",I=i?.key===p&&r-i.at<tl?i:null,A=[il(h)];return a&&A.push(d.name),l(j,{title:h.label??h.identifier,detail:A.join(" \xB7 "),note:I?ol(e,d,I.at):void 0,action:x?"Leave":"Enter",testID:`location-region-${gt(h.identifier)}`,onPress:()=>{o({key:p,at:Gt()}),t(x?"exitRegion":"enterRegion",{identifier:h.identifier,task:d.name})}},p)}))})}),k(ee,{children:["Tap a region to cross its edge. ",a?"The app's tasks":`The app's ${c} task`," runs as it would from the OS."]})]})}function il(e){return e.state==="inside"?"Inside":e.distance==null?`${K(e.radius)} radius`:`${K(Math.max(0,e.distance-e.radius))} away`}function ol(e,t,n){let i=e.log.filter(r=>r.at>=n-50&&(r.detail??"").startsWith(t.name)),o=i.find(r=>r.kind==="error");return o?{text:`Task failed: ${o.detail?.slice(t.name.length+3)??""}`,tone:"bad"}:i.find(r=>r.kind==="task")?{text:"Task ran",tone:"ok"}:i.find(r=>r.kind==="enter"||r.kind==="exit")?{text:"Running the app's task\u2026",tone:"wait"}:{text:"Already on this side",tone:"wait"}}function rl({snapshot:e,run:t,open:n}){let i=e.override,o=Vi(i),r=e.simulating?xi:xi.filter(a=>a.key!=="weak");return k(v,{children:[l(Y,{children:"Conditions"}),k(R,{children:[l(v,{style:y.segmentWrap,children:l(qt,{tabs:r,activeKey:o??"",size:"sm",testIDPrefix:"location-conditions",onChange:a=>t("setConditions",{conditions:a})})}),e.simulating&&i.services&&i.signal?l(v,{style:y.separatorTop,children:l(j,{title:"Accuracy & Drift",value:`${li(i.accuracy)}${i.jitter>0?` \xB7 drifts ${K(i.jitter)}`:""}`,chevron:true,testID:"location-accuracy",onPress:()=>n("accuracy")})}):null]}),l(ee,{children:za[o??"custom"]})]})}function al({snapshot:e,run:t}){let n=e.override;return k(Ye,{children:[k(v,{children:[l(Y,{children:"Accuracy"}),l(R,{children:l(v,{style:y.segmentWrap,children:l(qt,{tabs:Ci,activeKey:Si(Ci,n.accuracy)??"",size:"sm",testIDPrefix:"location-accuracy",onChange:i=>t("tune",{accuracy:Number(i)})})})}),l(ee,{children:"The accuracy radius the app is given with each fix."})]}),k(v,{children:[l(Y,{children:"Drift"}),l(R,{children:l(v,{style:y.segmentWrap,children:l(qt,{tabs:Ii,activeKey:Si(Ii,n.jitter)??"0",size:"sm",testIDPrefix:"location-drift",onChange:i=>t("tune",{jitter:Number(i)})})})}),l(ee,{children:"Moves each fix by up to this much at random, the way a real fix wanders."})]})]})}function ll({snapshot:e,open:t}){let n=e.log.length;return l(v,{children:l(R,{children:k(te,{children:[l(j,{title:"Activity",value:n===0?"None":`${n} ${n===1?"event":"events"}`,chevron:true,testID:"location-activity",onPress:()=>t("activity")},"activity"),l(j,{title:"Options",chevron:true,testID:"location-options",onPress:()=>t("options")},"options")]})})})}function sl({snapshot:e,run:t}){let n=Kt(true),i=e.log.slice().reverse(),o=e.watches.filter(d=>d.kind==="position").length,r=e.tasks.filter(d=>d.kind==="locationUpdates").length,a=e.tasks.filter(d=>d.kind==="geofencing").reduce((d,h)=>d+h.regions.length,0),c=[o?`${o} location ${o===1?"watch":"watches"}`:null,a?`${a} ${a===1?"geofence":"geofences"}`:null,r?"background updates":null].filter(Boolean);return k(Ye,{children:[k(v,{children:[l(Y,{children:"The App Is Using"}),l(R,{children:k(v,{style:y.editor,children:[l(T,{style:y.rowTitle,testID:"location-activity-summary",children:c.length?c.join(", "):"Nothing right now"}),l(T,{style:y.detail,children:e.libraries.length?`Through ${e.libraries.join(" and ")}.`:"No supported location library was found in this app."})]})})]}),k(v,{children:[l(Y,{children:"Recent"}),l(R,{children:k(te,{children:[i.length===0?l(v,{style:y.editor,children:l(T,{style:y.detail,children:"Location requests, watches and geofence crossings show up here."})},"empty"):i.map(d=>k(v,{style:y.logRow,testID:"location-log-entry",children:[l(v,{style:[y.logDot,cl(d.kind)]}),k(v,{style:y.flex,children:[l(T,{style:y.logText,children:d.text}),d.detail?l(T,{style:y.logDetail,numberOfLines:2,children:d.detail}):null]}),l(T,{style:y.logWhen,children:na(d.at,n)})]},d.id)),i.length>0?l(j,{title:"Clear",tint:true,testID:"location-clear-log",onPress:()=>t("clearLog")},"clear"):null]})})]})]})}function cl(e){return e==="enter"?y.dotEnter:e==="exit"?y.dotExit:e==="error"?y.dotError:e==="task"?y.dotTask:null}function ul({snapshot:e,run:t}){return k(v,{children:[l(R,{children:k(te,{children:[l(Ti,{title:"Keep Across Reloads",value:e.settings.persist,testID:"location-setting-persist",onValueChange:n=>t("updateSettings",{persist:n})},"persist"),l(Ti,{title:"Show Floating Status",value:e.settings.showChip,testID:"location-setting-showChip",onValueChange:n=>t("updateSettings",{showChip:n})},"chip")]})}),l(ee,{children:"The floating status stays on screen while the app is somewhere else, so a simulated location is never left on by accident."})]})}function dl({title:e,onBack:t}){return k(se,{testID:"location-back",accessibilityRole:"button",accessibilityLabel:"Back",activeOpacity:.6,onPress:t,style:y.backRow,children:[l(Ia,{size:18,color:m.color.accent}),l(T,{style:y.backLabel,children:"Location"}),l(T,{style:y.backTitle,numberOfLines:1,children:e})]})}function j({title:e,detail:t,note:n,value:i,action:o,checked:r,chevron:a,tint:c,onPress:d,testID:h}){return k(se,{testID:h,accessibilityRole:"button",accessibilityLabel:o?`${o} ${e}`:e,accessibilityState:r?{selected:true}:void 0,activeOpacity:.6,onPress:d,style:y.row,children:[k(v,{style:y.rowText,children:[l(T,{style:[y.rowTitle,c?y.titleTint:null],numberOfLines:1,children:e}),t?l(T,{style:y.detail,children:t}):null,n?l(T,{style:[y.note,n.tone==="ok"?y.noteOk:n.tone==="bad"?y.noteBad:null],testID:`${h}-result`,children:n.text}):null]}),i?l(T,{style:y.rowValue,numberOfLines:1,children:i}):null,o?l(T,{style:y.rowAction,children:o}):null,r?l(Ca,{size:18,color:m.color.accent}):null,a?l(Aa,{size:16,color:m.color.textTertiary}):null]})}function Ti({title:e,value:t,onValueChange:n,testID:i}){return k(v,{style:y.row,children:[l(v,{style:y.rowText,children:l(T,{style:y.rowTitle,children:e})}),l(Ta,{value:t,testID:i,accessibilityLabel:e,onValueChange:n})]})}function Si(e,t){let n=null,i=1/0;for(let o of e){let r=Math.abs(Number(o.key)-t);r<i&&(n=o.key,i=r)}return n!==null&&i<=Math.max(.05,Number(n)*.05)?n:null}function gt(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}var y=le.create({fill:{flex:1},flex:{flex:1},content:{paddingHorizontal:m.gutter,paddingTop:8,gap:m.groupGap},waiting:{flex:1,alignItems:"center",justifyContent:"center",padding:24},status:{padding:m.cardPad+2,gap:6},statusTitle:{color:m.color.text,fontSize:28,fontWeight:"600"},titleSimulated:{color:m.color.accent},titleBroken:{color:_a},statusLine:{color:m.color.textSecondary,fontSize:m.font.row,fontVariant:["tabular-nums"]},coordinates:{color:m.color.textTertiary,fontSize:m.font.caption,fontFamily:Ma},statusButtons:{flexDirection:"row",alignItems:"center",gap:10,marginTop:10},round:{width:44,height:44,borderRadius:22,alignItems:"center",justifyContent:"center",backgroundColor:m.color.accent},progressTrack:{height:6,borderRadius:3,marginTop:8,backgroundColor:m.color.fillSecondary,overflow:"hidden"},progressFill:{position:"absolute",left:0,top:0,bottom:0,backgroundColor:m.color.accent},progressGap:{position:"absolute",top:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.28)"},permission:{borderTopWidth:le.hairlineWidth,borderTopColor:m.color.separator,paddingHorizontal:m.rowPadH,paddingVertical:12,gap:4},rowBetween:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:12},valueWarning:{color:m.color.warning},row:{flexDirection:"row",alignItems:"center",gap:10,minHeight:48,paddingHorizontal:m.rowPadH,paddingVertical:10},rowText:{flex:1,gap:2},rowTitle:{color:m.color.text,fontSize:m.font.row},titleTint:{color:m.color.accent},rowValue:{color:m.color.textSecondary,fontSize:m.font.row,maxWidth:"50%"},rowAction:{color:m.color.accent,fontSize:m.font.row,fontWeight:"500"},detail:{color:m.color.textTertiary,fontSize:m.font.caption},note:{color:m.color.textSecondary,fontSize:m.font.caption,marginTop:2},noteOk:{color:m.color.accent},noteBad:{color:m.color.danger},warning:{color:m.color.warning,fontSize:m.font.caption},separatorTop:{borderTopWidth:le.hairlineWidth,borderTopColor:m.color.separator},segmentWrap:{flexDirection:"row",padding:10},editor:{paddingHorizontal:m.rowPadH,paddingVertical:14,gap:8},inputRow:{flexDirection:"row",alignItems:"center",gap:8},input:{flex:1,color:m.color.text,fontSize:m.font.body,backgroundColor:m.color.bg,borderRadius:m.radius.input,borderWidth:1,borderColor:m.color.border,paddingHorizontal:12,paddingVertical:9},backRow:{flexDirection:"row",alignItems:"center",gap:4,paddingVertical:4},backLabel:{color:m.color.accent,fontSize:m.font.row},backTitle:{flex:1,color:m.color.text,fontSize:m.font.row,fontWeight:"600",textAlign:"center",marginRight:70},logRow:{flexDirection:"row",alignItems:"flex-start",gap:10,paddingHorizontal:m.rowPadH,paddingVertical:10},logDot:{width:8,height:8,borderRadius:4,marginTop:6,backgroundColor:m.color.textTertiary},dotEnter:{backgroundColor:m.color.accent},dotExit:{backgroundColor:m.color.warning},dotError:{backgroundColor:m.color.danger},dotTask:{backgroundColor:m.color.info},logText:{color:m.color.text,fontSize:m.font.body},logDetail:{color:m.color.textTertiary,fontSize:m.font.caption,marginTop:2},logWhen:{color:m.color.textTertiary,fontSize:m.font.caption,fontVariant:["tabular-nums"],marginTop:1}});import{jsx as Li}from"react/jsx-runtime";var pl=Vt.actions;async function fl(e,t){let n=pl[e];if(!n)throw new Error(`Unknown location action: ${e}`);return n(t)}var Jt=()=>Vt.getSnapshot(),gl=2e3;function Pi(){let[e,t]=ha(Jt);return ga(()=>{zt(),Rt(),t(Jt()),pi(true),rt();let n=setInterval(rt,gl),i=Ue(()=>t(Jt()));return()=>{clearInterval(n),i(),pi(false)}},[]),Li(ma,{featureName:"Location",children:Li(Ai,{snapshot:e,onAction:fl})})}import{jsx as hl}from"react/jsx-runtime";var $i=fa({id:"location",name:"LOCATION",description:"Pin the app anywhere, play routes, trigger geofences",slot:"both",color:da,icon:({size:e,color:t})=>hl(ua,{size:e,color:t}),component:Pi,modal:{subtitle:"simulate where the app is"}}),ml=pa($i);import{LocationToolIcon as yl,LOCATION_TOOL_ICON_COLOR as bl}from"@buoy-gg/shared-ui/web";var vl=typeof navigator<"u"&&navigator.product==="ReactNative",wl=(()=>{try{return globalThis.Capacitor?.isNativePlatform?.()===true}catch{return false}})();(vl||wl)&&(ca(),typeof Xt<"u"&&Xt&&(zt(),Rt()));export{dt as BUILT_IN_PLACES,ut as LOCATION_CHIP_ID,bl as LOCATION_TOOL_ICON_COLOR,Pi as LocationBody,fi as LocationChip,yl as LocationToolIcon,Ai as LocationToolView,Oe as ROUTE_PRESETS,Ze as bearingDegrees,Rt as bootLocation,gi as buildPresetRoute,ml as createLocationTool,je as destination,V as distanceMeters,E as getLocationSnapshot,zt as installLocationAdapters,P as isLocationActive,Vt as locationSyncAdapter,$i as locationToolPreset,Mt as moveToRegion,vt as parseCoordinate,Pt as pauseRoute,rt as refreshLocationPermission,ao as registerLocationPlaces,lo as registerLocationRoutes,Et as resetLocation,$t as resumeRoute,In as seekRoute,Pn as setConditions,ct as setPlace,An as setRouteSpeed,Ln as setServices,Sn as setSignal,Cn as startRoute,$n as stopRoute,Ue as subscribeLocation,Tn as tuneOverride,Mn as useRealLocation};
|
|
3
|
+
\u2192 Caused by: ${t}`}var Jn={denied:{ios:{code:"ERR_DENIED_FOREGROUND_LOCATION_PERMISSION",reason:"Location permission is required to do this operation"},android:{code:"ERR_LOCATION_UNAUTHORIZED",reason:"Not authorized to use location services"}},deniedBackground:{ios:{code:"ERR_DENIED_BACKGROUND_LOCATION_PERMISSION",reason:"Background location permission is required to do this operation"},android:{code:"ERR_LOCATION_BACKGROUND_UNAUTHORIZED",reason:"Not authorized to use background location services"}},services:{ios:{code:"ERR_LOCATION_SERVICES_DISABLED",reason:"Location services are disabled"},android:{code:"ERR_LOCATION_SETTINGS_UNSATISFIED",reason:"Location request failed due to unsatisfied device settings"}},unavailable:{ios:{code:"ERR_LOCATION_UNAVAILABLE",reason:"Cannot obtain current location"},android:{code:"ERR_CURRENT_LOCATION_IS_UNAVAILABLE",reason:"Current location is unavailable. Make sure that location services are enabled"}}};function ce(e,t,n){let i=n==="android"?Jn[e].android:Jn[e].ios;return Promise.reject(vo(i.code,Dr(t,i.reason,n)))}var Xn=false;function Br(){let e=Yn("ExpoLocation");if(!e||typeof e.getCurrentPositionAsync!="function")return false;let t=e,n=Yn("ExpoTaskManager"),i=Or(),o=new Map,r={},a=()=>Date.now(),p=d=>s=>t.emit?.("Expo.locationChanged",{watchId:d,location:_t(s,i,a())}),c=d=>s=>{let f=s.heading??0;t.emit?.("Expo.headingChanged",{watchId:d,heading:{trueHeading:f,magHeading:f,accuracy:3}})},g=d=>s=>t.emit?.("Expo.locationError",{watchId:d,reason:s});async function u(){let d=t.getForegroundPermissionsAsync,s={granted:true,status:"granted",precision:"full",reported:false};if(typeof d!="function")return s;try{let f=await d.call(t),k=f?.ios?.accuracy==="reduced"||f?.android?.accuracy==="coarse"?"reduced":"full";oo(k);let C=f?.granted===true,ie=C?"granted":f?.status==="undetermined"?"undetermined":"denied";return{granted:C,status:ie,precision:k,reported:true}}catch{return s}}async function v(){let d=t.getBackgroundPermissionsAsync;if(typeof d!="function")return null;try{return(await d.call(t))?.granted===true}catch{return null}}async function S(){let d=t.getBackgroundPermissionsAsync;if(typeof d!="function")return true;try{return(await d.call(t))?.granted===true}catch{return true}}function I(d,s){ct({library:N,id:d,kind:s.kind,options:s.options,deliver:s.kind==="position"?p(d):c(d),fail:g(d)})}r.getCurrentPositionAsync=$(t,"getCurrentPositionAsync",d=>async(...s)=>{if(!L())return d(...s);let f="getCurrentPositionAsync";if(!be())return T("request",N,"getCurrentPositionAsync \u2192 services off"),ce("services",f,i);if(!(await u()).granted)return T("request",N,"getCurrentPositionAsync \u2192 permission denied"),ce("denied",f,i);let{fix:k}=re();return k?(T("request",N,`getCurrentPositionAsync \u2192 ${k.latitude.toFixed(5)}, ${k.longitude.toFixed(5)}`),_t(k,i,a())):(T("request",N,"getCurrentPositionAsync \u2192 no signal"),await new Promise(C=>W(()=>C(null),1e3)),ce("unavailable",f,i))}),r.getLastKnownPositionAsync=$(t,"getLastKnownPositionAsync",d=>async(...s)=>{if(!L())return d(...s);if(!(await u()).granted)return ce("denied","getLastKnownPositionAsync",i);let{fix:f}=re();return T("request",N,`getLastKnownPositionAsync \u2192 ${f?"simulated":"null"}`),f?_t(f,i,a()):null}),r.watchPositionImplAsync=$(t,"watchPositionImplAsync",d=>async(...s)=>{let f=Number(s[0]),k=s[1]&&typeof s[1]=="object"?s[1]:{};if(!L()){let ie=await d(...s),ue={kind:"position",options:k,native:true};return o.set(f,ue),L()&&Ce(f,ue),ie}if(!(await u()).granted)return ce("denied","watchPositionImplAsync",i);if(!L())return o.set(f,{kind:"position",options:k,native:true}),d(...s);let C={kind:"position",options:k,native:false};o.set(f,C),I(f,C)}),r.watchDeviceHeading=$(t,"watchDeviceHeading",d=>async(...s)=>{let f=Number(s[0]);if(!L()){let C=await d(...s),ie={kind:"heading",options:{},native:true};return o.set(f,ie),L()&&Ce(f,ie),C}if(!(await u()).granted)return ce("denied","watchDeviceHeading",i);if(!L())return o.set(f,{kind:"heading",options:{},native:true}),d(...s);let k={kind:"heading",options:{},native:false};o.set(f,k),I(f,k)}),r.removeWatchAsync=$(t,"removeWatchAsync",d=>async(...s)=>{let f=Number(s[0]),k=o.get(f);if(o.delete(f),ae(N,"position",f),ae(N,"heading",f),!k||k.native)return d(...s)}),$(t,"hasServicesEnabledAsync",d=>async(...s)=>L()&&!be()?false:d(...s)),$(t,"getProviderStatusAsync",d=>async(...s)=>{let f=await d(...s);if(!L()||be())return f;let k={...f,locationServicesEnabled:false};for(let C of["gpsAvailable","networkAvailable","passiveAvailable"])C in k&&(k[C]=false);return k});let _=(d,s)=>$(t,s,f=>async(...k)=>{let C=String(k[0]),ie=k[1]&&typeof k[1]=="object"?k[1]:{},ue={name:C,kind:d,library:N,options:ie};if(!L()){let bt=await f(...k);return $t(ue,false),L()&&w(true),bt}if(d==="locationUpdates"&&!be())return ce("services",s,i);if(!(await u()).granted)return ce("denied",s,i);if(d==="geofencing"&&!await S())return ce("deniedBackground",s,i);$t(ue,true)});r.startLocationUpdatesAsync=_("locationUpdates","startLocationUpdatesAsync"),r.startGeofencingAsync=_("geofencing","startGeofencingAsync");let z=(d,s)=>$(t,s,f=>async(...k)=>{let C=Me(String(k[0]));if(!(C&&C.kind===d&&(Lt(C.name),C.intercepted)))return f(...k)});r.stopLocationUpdatesAsync=z("locationUpdates","stopLocationUpdatesAsync"),r.stopGeofencingAsync=z("geofencing","stopGeofencingAsync");let ge=(d,s)=>$(t,s,f=>async(...k)=>{let C=Me(String(k[0]));return C&&C.kind===d?true:f(...k)});ge("locationUpdates","hasStartedLocationUpdatesAsync"),ge("geofencing","hasStartedGeofencingAsync");let he=new Map,yt=0,Qe={geofencing:"geofencing",locationUpdates:"location"};n&&($(n,"notifyTaskFinishedAsync",d=>async(...s)=>{let f=s[1]??{},k=f.eventId?he.get(f.eventId):void 0;if(k&&f.eventId){he.delete(f.eventId),k(f.result);return}return d(...s)}),$(n,"isTaskRegisteredAsync",d=>async(...s)=>Me(String(s[0]))?.intercepted?true:d(...s)),$(n,"getTaskOptionsAsync",d=>async(...s)=>{let f=Me(String(s[0]));return f?.intercepted?f.options:d(...s)}),$(n,"getRegisteredTasksAsync",d=>async(...s)=>{let f=await d(...s)??[],k=Pt().filter(C=>C.intercepted).map(C=>({taskName:C.name,taskType:Qe[C.kind],options:C.options}));return[...f,...k]}),$(n,"unregisterTaskAsync",d=>async(...s)=>{let f=Me(String(s[0]));if(!(f&&(Lt(f.name),f.intercepted)))return d(...s)}),$(n,"unregisterAllTasksAsync",d=>async(...s)=>{for(let f of Pt())Lt(f.name);return d(...s)}));function Fe(){if(!n)return null;if(n.__expo_module_name__&&typeof n.emit=="function")return(s,f)=>n.emit(s,f);let d=Fn;return d?(s,f)=>d.emit(s,f):null}async function me(d){for(let s=0;s<5e3&&Nr(d)===false;s+=100)await new Promise(f=>W(()=>f(null),100))}async function et(d,s){await me(d.name);let f=Fe();if(!f)return Promise.reject(new Error("expo-task-manager is not installed"));let k=`buoy-location-${++yt}`,C=typeof n?.EVENT_NAME=="string"?n.EVENT_NAME:"TaskManager.executeTask";return new Promise((ie,ue)=>{he.set(k,ie),W(()=>{he.delete(k)&&ue(new Error("did not finish within 30 s"))},3e4);try{f(C,{data:s,error:null,executionInfo:{eventId:k,taskName:d.name,appState:"active"}})}catch(bt){he.delete(k),ue(bt)}})}function Ce(d,s){s.native&&(s.native=false,Promise.resolve(r.removeWatchAsync?.(d)).catch(()=>{}),I(d,s))}function w(d){for(let[s,f]of Array.from(o.entries()))if(d&&f.native)Ce(s,f);else if(!d&&!f.native){ae(N,f.kind,s);let k=f.kind==="position"?r.watchPositionImplAsync:r.watchDeviceHeading;f.native=true,Promise.resolve(f.kind==="position"?k?.(s,f.options):k?.(s)).catch(C=>{f.native=false,g(s)(String(C?.message??C))})}else d&&!f.native&&!uo(N,f.kind,s)&&I(s,f);for(let s of Pt()){if(s.library!==N)continue;let f=s.kind==="geofencing";if(d&&!s.intercepted){let k=f?r.stopGeofencingAsync:r.stopLocationUpdatesAsync;Promise.resolve(k?.(s.name)).catch(()=>{}),In(s.name,true)}else if(!d&&s.intercepted){let k=f?r.startGeofencingAsync:r.startLocationUpdatesAsync;In(s.name,false),Promise.resolve(k?.(s.name,s.options)).catch(C=>{T("error",N,`Could not restart ${s.name} natively: ${String(C?.message??C)}`)})}}}return st({library:N,fireTask:et,onActiveChange:w,readPermission:async()=>{let d=await u();if(!d.reported)return null;let s=d.status==="granted"?await v():false;return{status:d.status,background:s,precision:d.precision}}}),Xn||(Xn=true,n&&typeof n.getRegisteredTasksAsync=="function"&&Promise.resolve(n.getRegisteredTasksAsync.call(n)).then(d=>{for(let s of d??[]){if(!s?.taskName||Me(s.taskName))continue;let f=s.taskType==="geofencing"?"geofencing":s.taskType==="location"?"locationUpdates":null;f&&($t({name:s.taskName,kind:f,library:N,options:s.options??{}},false),L()&&w(true))}}).catch(()=>{})),true}import{callCapacitorAsApp as jr,callCapacitorNative as Zn,callCapacitorNativeCallback as Fr,capacitorPlatform as _r,hasCapacitorPlugin as zr,installCapacitorBridge as Wr,interceptCapacitor as zt,makeCapacitorCallbackId as Ur}from"@buoy-gg/license/web";var ve="@capacitor/geolocation",pe="Geolocation";function Qn(e,t){return{timestamp:t,coords:{latitude:e.latitude,longitude:e.longitude,accuracy:e.accuracy,altitude:e.altitude,altitudeAccuracy:e.altitudeAccuracy,speed:e.speed,heading:e.heading}}}function Wt(e){return new Error(e)}function Hr(e){if(!e||typeof e!="object")return null;let t=e.location,n=e.coarseLocation??t;return{status:t==="granted"||n==="granted"?"granted":t==="denied"&&(n==="denied"||n===void 0)?"denied":"undetermined",background:null,precision:t!=="granted"&&n==="granted"?"reduced":"full"}}function ei(e,t){return(n,i)=>{e.gen===t&&e.nativeId!==null&&e.callback(n,i)}}var Ke=new Map,ti=false;function ni(e){ct({library:ve,id:e.id,kind:"position",options:e.options,deliver:t=>e.callback(Qn(t,Date.now())),fail:t=>e.callback(null,Wt(t))})}function Vr(e){let t=++e.gen;e.nativeId=Fr(pe,"watchPosition",e.options,ei(e,t))}function qr(e){if(e.gen++,e.nativeId===null)return;let t=e.nativeId;e.nativeId=null,Zn(pe,"clearWatch",{id:t}).catch(()=>{})}function Gr(){return ti?true:!_r()||!zr(pe)||!Wr()?false:(ti=true,zt({plugin:pe,methods:["getCurrentPosition"],promise:(e,t)=>{if(!L())return t();if(!be())return T("request",ve,"getCurrentPosition \u2192 services off"),Promise.reject(Wt("Location services are not enabled"));let{fix:n}=re();return n?(T("request",ve,`getCurrentPosition \u2192 ${n.latitude.toFixed(5)}, ${n.longitude.toFixed(5)}`),Qn(n,Date.now())):(T("request",ve,"getCurrentPosition \u2192 no signal"),new Promise((i,o)=>W(()=>o(Wt("Timeout")),1e3)))}}),zt({plugin:pe,methods:["watchPosition"],callback:(e,t,n)=>{if(!L()){let o={id:"",options:e.options,callback:t,nativeId:null,gen:1},r=n(ei(o,1));return r===null?null:(o.id=r,o.nativeId=r,Ke.set(r,o),r)}let i={id:Ur(),options:e.options,callback:t,nativeId:null,gen:1};return Ke.set(i.id,i),ni(i),i.id}}),zt({plugin:pe,methods:["clearWatch"],promise:(e,t)=>{let n=String(e.options.id??""),i=Ke.get(n);if(!i)return t();if(Ke.delete(n),i.gen++,ae(ve,"position",n),i.nativeId===null)return;let o=i.nativeId;return i.nativeId=null,o===n?t():Zn(pe,"clearWatch",{id:o})}}),st({library:ve,onActiveChange(e){for(let t of Ke.values())e&&t.nativeId!==null?(qr(t),ni(t)):!e&&t.nativeId===null&&(ae(ve,"position",t.id),Vr(t))},async readPermission(){try{return Hr(await jr(pe,"checkPermissions"))}catch{return null}}}),true)}var we="navigator.geolocation",Kr={PERMISSION_DENIED:1,POSITION_UNAVAILABLE:2,TIMEOUT:3};function Ut(e,t){return{code:e,message:t,...Kr}}function ii(e,t){let n={latitude:e.latitude,longitude:e.longitude,altitude:e.altitude,accuracy:e.accuracy,altitudeAccuracy:e.altitudeAccuracy,heading:e.heading,speed:e.speed};return{coords:{...n,toJSON:()=>n},timestamp:t,toJSON:()=>({coords:n,timestamp:t})}}function oi(e,t){let n=()=>e.gen===t&&e.nativeId!==null;return[(...i)=>n()?e.success(...i):void 0,(...i)=>n()?e.error?.(...i):void 0]}var Ye=new Map,Yr=1e6,ri=false;function Jr(){if(ri)return true;let e=globalThis.navigator?.geolocation;if(!e||typeof e.getCurrentPosition!="function")return false;ri=true;let t=null,n=null,i=o=>ct({library:we,id:o.id,kind:"position",options:o.options,deliver:r=>o.success(ii(r,Date.now())),fail:r=>o.error?.(Ut(2,r))});return $(e,"getCurrentPosition",o=>(...r)=>{if(!L())return o(...r);let a=r[0],p=r[1];if(!be()){T("request",we,"getCurrentPosition \u2192 services off"),W(()=>p?.(Ut(2,"Location services are disabled")),0);return}let{fix:c}=re();if(!c){T("request",we,"getCurrentPosition \u2192 no signal"),W(()=>p?.(Ut(3,"Timeout expired")),1e3);return}T("request",we,`getCurrentPosition \u2192 ${c.latitude.toFixed(5)}, ${c.longitude.toFixed(5)}`),W(()=>a?.(ii(c,Date.now())),0)}),t=$(e,"watchPosition",o=>(...r)=>{let a=r[0],p=r[1],c=r[2]&&typeof r[2]=="object"?r[2]:{};if(!L()){let u={id:0,success:a,error:p,options:c,nativeId:null,gen:1},[v,S]=oi(u,1),I=o(v,S,r[2]);return u.id=I,u.nativeId=I,Ye.set(I,u),I}let g={id:Yr++,success:a,error:p,options:c,nativeId:null,gen:1};return Ye.set(g.id,g),i(g),g.id}),n=$(e,"clearWatch",o=>(...r)=>{let a=r[0],p=Ye.get(a);if(!p)return o(...r);if(Ye.delete(a),p.gen++,ae(we,"position",a),p.nativeId!==null)return o(p.nativeId)}),st({library:we,onActiveChange(o){for(let r of Ye.values())if(o&&r.nativeId!==null)r.gen++,n?.(r.nativeId),r.nativeId=null,i(r);else if(!o&&r.nativeId===null){ae(we,"position",r.id);let a=++r.gen,[p,c]=oi(r,a);r.nativeId=t?.(p,c,r.options)??null}}}),true}var ke=null;function Ht(){return ke||(ke=[],Br()&&ke.push("expo-location"),ke.push(...Mr()),Gr()&&ke.push("@capacitor/geolocation"),Jr()&&ke.push("navigator.geolocation"),ke)}import{useSyncExternalStore as Xr}from"react";import{FloatingTool as Zr,LocationToolIcon as ai,Pause as Qr,Play as ea,RefreshCw as ta,X as na,dismissFloatingTool as ia,getFloatingTools as oa,night as fe,openFloatingTool as ra}from"@buoy-gg/shared-ui/web";var aa=new Set(["US","GB","LR","MM"]),li=null;function la(){try{let e=Intl.DateTimeFormat().resolvedOptions().locale,t=/[-_]([A-Z]{2})\b/.exec(e);return t?t[1]:null}catch{return null}}var Vt=null;function De(){return li!==null?li:(Vt===null&&(Vt=aa.has(la()??"")),Vt)}var si=3.28084,ci=1609.344;function K(e){if(!Number.isFinite(e))return"\u2013";let t=Math.abs(e);if(De()){let n=t/ci;return n<.1?`${Math.round(t*si/10)*10} ft`:`${ui(n)} mi`}return t<1e3?`${Math.round(t)} m`:`${ui(t/1e3)} km`}function ui(e){let t=Math.round(e*10)/10;return t<10?t.toFixed(1):Math.round(e).toLocaleString("en-US")}function di(e){return Number.isFinite(e)?e>=1e3?`\xB1${K(e)}`:De()?`\xB1${Math.round(e*si)} ft`:`\xB1${Math.round(e)} m`:"\u2013"}function qt(e){if(e==null||e<0)return"\u2013";let t=De()?e*3600/ci:e*3.6,n=De()?"mph":"km/h";return`${t<10?t.toFixed(1):Math.round(t)} ${n}`}function sa(e){if(!Number.isFinite(e)||e<0)return"\u2013";let t=Math.round(e/6e4);if(t<1)return`${Math.max(1,Math.round(e/1e3))} sec`;if(t<60)return`${t} min`;let n=Math.floor(t/60),i=t%60;return i?`${n} hr ${i} min`:`${n} hr`}function ca(e,t){let n=Math.max(0,Math.round((t-e)/1e3));if(n<5)return"now";if(n<60)return`${n}s ago`;try{return new Date(e).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}catch{let i=new Date(e);return`${i.getHours()}:${String(i.getMinutes()).padStart(2,"0")}`}}function pi(e){return e.override.services?e.override.signal?e.override.mode==="real"?"Real Location":e.override.mode==="route"?e.override.route?.name??"Route":e.override.place.label||"Dropped Pin":"No GPS Signal":"Location Services Off"}function ua(e){return!e.override.services||!e.override.signal?"broken":e.override.mode==="real"?"real":"simulated"}function da(e){if(!e.override.services)return"The app is told location services are off";if(!e.override.signal)return"Updates stop and location requests fail";if(e.override.mode==="real")return"The app gets the device's location";let t=[];if(e.override.mode==="route"&&e.progress){let i=e.progress;i.finished?t.push("Arrived"):e.override.playing||t.push("Paused"),e.current.reason==="gap"&&t.push("no signal here"),i.finished||(t.push(`${K(i.along)} of ${K(i.length)}`),i.etaMs!=null?t.push(`${sa(i.etaMs)} left`):e.override.route?.loop&&t.push("on repeat"))}else t.push("Pinned");let n=e.current.fix;return n&&e.override.mode==="fixed"&&t.push(di(n.accuracy)),e.current.precision==="reduced"&&t.push("approximate"),t.join(" \xB7 ")}function pa(e){return e.status==="denied"?"Not Allowed":e.status==="undetermined"?"Not Asked Yet":`${e.background?"Always":"While Using"} \xB7 ${e.precision==="reduced"?"Approximate":"Precise"}`}function fa(e){if(!e.override.services)return"The app is told location is off";if(!e.override.signal)return"Updates stop, requests fail";if(e.override.mode==="route"&&e.progress){if(e.progress.finished)return"Arrived";let n=`${K(e.progress.along)} of ${K(e.progress.length)}`;return e.override.playing?n:`Paused \xB7 ${n}`}let t=e.current.fix;return t?`Pinned \xB7 ${ze(t,3)}`:"Pinned"}import{jsx as H,jsxs as fi}from"react/jsx-runtime";var pt="location-chip",ga={id:pt,render:e=>H(yi,{...e})},ha=()=>oa().some(e=>e.id===pt),gi=false,Gt=false,hi=null;function mi(e){Gt!==e&&(Gt=e,hi?.())}function ma(){if(gi)return;gi=true;let e=false,t=()=>{let n=M().active&&mo().showChip&&!Gt;n&&!e?ra(ga):!n&&ha()&&ia(pt),e=n};hi=t,Ve(t),t()}function yi({id:e,revealToken:t}){let n=Xr(Ve,M,M),i=pi(n),o=n.override.mode==="route"&&n.progress,r=n.override.playing,a=!!o&&o.finished;return H(Zr,{id:e,revealToken:t,variant:"strip",dragFromSurface:true,defaultPlacement:"top",accessibilityLabel:`Move or hide the location chip. ${i}`,handleAdornment:H(ai,{size:12}),children:fi(b,{style:xe.row,children:[H(ai,{size:18}),fi(b,{style:xe.text,children:[H(A,{style:xe.title,numberOfLines:1,testID:"location-chip-title",children:i}),H(A,{style:xe.detail,numberOfLines:1,testID:"location-chip-detail",children:fa(n)})]}),o?H(se,{testID:"location-chip-playpause",accessibilityRole:"button",accessibilityLabel:r?"Pause the route":a?"Play the route again":"Resume the route",onPress:()=>r?Et():Mt(),style:xe.pill,hitSlop:{top:8,bottom:8,left:4,right:4},children:r?H(Qr,{size:14,color:fe.color.accent}):a?H(ta,{size:14,color:fe.color.accent}):H(ea,{size:14,color:fe.color.accent})}):null,H(b,{style:xe.separator}),H(se,{testID:"location-chip-reset",accessibilityRole:"button",accessibilityLabel:"Back to the real location",onPress:()=>Nt(),style:xe.button,hitSlop:{top:8,bottom:8,left:4,right:8},children:H(na,{size:16,color:fe.color.textSecondary})})]})})}var xe=le.create({row:{flexDirection:"row",alignItems:"center",gap:10,paddingLeft:10,paddingRight:4,paddingVertical:6,minWidth:230,maxWidth:340},text:{flexShrink:1,minWidth:120},title:{color:fe.color.text,fontSize:14,fontWeight:"600"},detail:{color:fe.color.textSecondary,fontSize:11,fontVariant:["tabular-nums"]},pill:{width:30,height:30,borderRadius:15,alignItems:"center",justifyContent:"center",backgroundColor:fe.color.accentFill},button:{width:32,height:32,alignItems:"center",justifyContent:"center",borderRadius:16},separator:{width:le.hairlineWidth,height:20,backgroundColor:fe.color.separator}});import{LocationToolIcon as ya,LOCATION_TOOL_ICON_COLOR as ba,createToolFactory as va,defineToolPreset as wa}from"@buoy-gg/shared-ui/web";import{useEffect as ka,useState as xa}from"react";import{FeatureGate as Ca}from"@buoy-gg/shared-ui/web";import{createSyncAdapter as Sa}from"@buoy-gg/shared-ui/web";var ft=[{latitude:37.3349,longitude:-122.009,label:"Apple Park"},{latitude:37.422,longitude:-122.0841,label:"Googleplex"},{latitude:40.758,longitude:-73.9855,label:"Times Square"},{latitude:51.508,longitude:-.1281,label:"Trafalgar Square"},{latitude:48.8584,longitude:2.2945,label:"Eiffel Tower"},{latitude:35.6595,longitude:139.7005,label:"Shibuya Crossing"},{latitude:-33.8568,longitude:151.2153,label:"Sydney Opera House"},{latitude:-23.5614,longitude:-46.6559,label:"S\xE3o Paulo"},{latitude:0,longitude:0,label:"Null Island"}],Be=[{id:"walk",name:"Walk",description:"1 km north from here at walking pace",speed:1.4},{id:"run",name:"Run",description:"3 km north, then east, at running pace",speed:3.3},{id:"drive",name:"City Drive",description:"4 km of city streets with turns",speed:13.4},{id:"highway",name:"Highway",description:"30 km north at highway speed",speed:30},{id:"tunnel",name:"Tunnel",description:"3 km drive with no signal for 600 m in the middle",speed:13.4},{id:"loop",name:"Block Loop",description:"A 400 m block, walked on repeat",speed:1.4}];function bi(e,t,n=0){let i=Be.find(g=>g.id===e);if(!i)throw new Error(`Unknown route preset "${e}". Use one of: ${Be.map(g=>g.id).join(", ")}.`);let o={latitude:t.latitude,longitude:t.longitude},r=(g,u,v)=>_e(g,n+u,v),a,p,c=false;switch(e){case"walk":a=[o,r(o,0,1e3)];break;case"run":a=[o,r(o,0,1500),r(r(o,0,1500),90,1500)];break;case"drive":{let g=r(o,0,1200),u=r(g,90,800),v=r(u,0,1e3),S=r(v,-90,1e3);a=[o,g,u,v,S];break}case"highway":a=[o,r(o,0,3e4)];break;case"tunnel":a=[o,r(o,0,3e3)],p=[[1200,1800]];break;case"loop":{let g=r(o,0,100),u=r(g,90,100),v=r(u,180,100);a=[o,g,u,v,o],c=true;break}}return{id:`preset:${e}`,name:i.name,points:a,speed:i.speed,loop:c,gaps:p}}function Ia(e,t,n){return{id:"line",name:t.label?`To ${t.label}`:"Straight line",points:[{latitude:e.latitude,longitude:e.longitude},{latitude:t.latitude,longitude:t.longitude}],speed:n}}function Q(e){return e&&typeof e=="object"?e:{}}function Je(e,...t){for(let n of t){let i=e[n];if(typeof i=="boolean")return i;if(i==="true"||i==="on")return true;if(i==="false"||i==="off")return false}}function Y(e,...t){for(let n of t){let i=e[n];if(i==null||i==="")continue;let o=Number(i);if(Number.isFinite(o))return o}}function P(){return{...M(),builtInPlaces:ft,presets:Be}}function Aa(e){let t=e.trim().toLowerCase(),n=[...M().places,...ft];return n.find(i=>i.label?.toLowerCase()===t)??n.find(i=>i.label?.toLowerCase().includes(t))??null}function vi(e){let t=typeof e.label=="string"?e.label:void 0,n=Y(e,"latitude","lat"),i=Y(e,"longitude","lon","lng");if(n!==void 0&&i!==void 0){let o={latitude:n,longitude:i};if(!Se(o))throw new Error("latitude must be within \xB190 and longitude within \xB1180.");return{...o,label:t}}for(let o of["place","to","query","coordinate","at"]){let r=e[o];if(Se(r))return{...r,label:r.label??t};if(typeof r=="string"&&r.trim()){let a=kt(r);if(a)return{...a,label:t};let p=Aa(r);if(p)return p;throw new Error(`No place called "${r}". Give latitude and longitude, or one of: ${Ta()}.`)}}return null}function Ta(){return[...M().places,...ft].map(e=>e.label).filter(Boolean).join(", ")}function $a(e){let t=Y(e,"speed","metersPerSecond"),n=Y(e,"heading","bearing")??0;if(Array.isArray(e.points))return{points:e.points,speed:t??1.4,loop:Je(e,"loop")??false,name:typeof e.name=="string"?e.name:"Custom route",gaps:Array.isArray(e.gaps)?e.gaps:void 0};let i=typeof e.route=="string"?e.route:typeof e.routeId=="string"?e.routeId:typeof e.preset=="string"?e.preset:void 0;if(i){let r=M().routes.find(c=>c.id===i||c.name?.toLowerCase()===i.toLowerCase());if(r)return t?{...r,speed:t}:r;let a=Be.find(c=>c.id===i||c.name.toLowerCase()===i.toLowerCase());if(a){let c=bi(a.id,qe(),n);return t?{...c,speed:t}:c}let p=[...M().routes.map(c=>c.id??c.name),...Be.map(c=>c.id)];throw new Error(`No route "${i}". Use one of: ${p.join(", ")}; or pass points.`)}let o=vi(e);if(o)return Ia(qe(),o,t??1.4);throw new Error("startRoute needs `points` (two or more {latitude, longitude}), `route` (a preset or app route id), or `to` (a place).")}var Kt=Sa({version:1,getSnapshot(){return P()},subscribe(e){return Ve(e)},actions:{getState(){return P()},setLocation(e){let t=vi(Q(e));if(!t)throw new Error('setLocation needs `latitude` and `longitude`, `query` ("lat, lon" or a map link), or `place` (a place name).');return dt(t),P()},startRoute(e){return An($a(Q(e))),P()},stopRoute(){return Rn(),P()},setConditions(e){let t=Q(e),n=(typeof t.conditions=="string"?t.conditions:typeof t.preset=="string"?t.preset:"").trim().toLowerCase().replace(/[\s_]+/g,"-"),i={good:"good",weak:"weak","no-signal":"no-signal",nosignal:"no-signal",off:"off","services-off":"off","location-off":"off"}[n];if(!i)throw new Error("setConditions needs `conditions`: good, weak, no-signal or off.");return Mn(i),P()},pauseRoute(){return Et(),P()},resumeRoute(){return Mt(),P()},seekRoute(e){let t=Q(e),n=Y(t,"meters","along"),i=Y(t,"fraction","progress"),o=M().progress?.length??0;if(n===void 0&&i===void 0)throw new Error("seekRoute needs `meters` or `fraction` (0 to 1).");return Tn(n??(i??0)*o),P()},setSpeed(e){let t=Y(Q(e),"speed","metersPerSecond");if(t===void 0)throw new Error("setSpeed needs `speed` in meters per second.");return $n(t),P()},tune(e){let t=Q(e);return Ln({accuracy:Y(t,"accuracy"),jitter:Y(t,"jitter","drift"),altitude:t.altitude===null?null:Y(t,"altitude"),heading:t.heading===null?null:Y(t,"heading"),interval:Y(t,"interval","intervalMs")}),P()},setSignal(e){let t=Je(Q(e),"on","signal","enabled");if(t===void 0)throw new Error("setSignal needs `on`: true or false.");return Pn(t),P()},setServices(e){let t=Je(Q(e),"on","services","enabled");if(t===void 0)throw new Error("setServices needs `on`: true or false.");return En(t),P()},enterRegion(e){let t=Q(e),n=typeof t.identifier=="string"?t.identifier:typeof t.region=="string"?t.region:void 0;if(!n)throw new Error("enterRegion needs `identifier` (a monitored geofence region).");return Rt(n,"inside",typeof t.task=="string"?t.task:void 0),P()},exitRegion(e){let t=Q(e),n=typeof t.identifier=="string"?t.identifier:typeof t.region=="string"?t.region:void 0;if(!n)throw new Error("exitRegion needs `identifier` (a monitored geofence region).");return Rt(n,"outside",typeof t.task=="string"?t.task:void 0),P()},useRealLocation(){return Nn(),P()},reset(){return Nt(),P()},updateSettings(e){let t=Q(e);return ho({persist:Je(t,"persist"),showChip:Je(t,"showChip")}),P()},clearLog(){return yo(),P()}}});import{useEffect as La,useState as je}from"react";import{Check as Pa,ChevronLeft as Ea,ChevronRight as Ma,NightButton as wi,NightCard as R,NightFootnote as ee,NightRows as te,NightSectionLabel as J,NightSegmented as Yt,NightSwitch as Ra,Pause as Na,Play as Oa,RefreshCw as Da,copyToClipboard as Ba,monoFont as ja,night as m,realNow as Jt,useSafeAreaInsets as Fa,useToolScreenHeader as _a}from"@buoy-gg/shared-ui/web";import{night as ne}from"@buoy-gg/shared-ui/web";import{jsx as X,jsxs as gt}from"react/jsx-runtime";var ki="#F87171",Xe=1.8,za=6e4,Wa=400;function Ua({snapshot:e,onPinPlace:t,onCrossRegion:n}){let i=e.position,o=e.override.mode==="route"?e.override.route:null,r=i??e.places[0]??Ha(e.tasks)??null;if(!r)return null;let a=w=>!i||V(i,w)<=za,p=e.places.filter(a),c=e.tasks.filter(w=>w.kind==="geofencing").flatMap(w=>w.regions.filter(a).map(d=>({task:w,region:d}))),g=e.places.length-p.length,u=Math.cos(r.latitude*Math.PI/180),v=w=>({x:(w.longitude-r.longitude)*111320*u,y:(w.latitude-r.latitude)*110540}),S=[];i&&S.push({...v(i),r:60});for(let w of o?.points??[])S.push({...v(w),r:0});for(let w of p)S.push({...v(w),r:60});for(let w of c)S.push({...v(w.region),r:w.region.radius});let I=1/0,_=-1/0,z=1/0,ge=-1/0;for(let w of S)I=Math.min(I,w.x-w.r),_=Math.max(_,w.x+w.r),z=Math.min(z,w.y-w.r),ge=Math.max(ge,w.y+w.r);let he=(I+_)/2,yt=(z+ge)/2,Qe=Math.max(Wa,(ge-z)*1.35,(_-I)*1.2/Xe),Fe=Qe*Xe,me=w=>{let d=v(w);return{x:.5+(d.x-he)/Fe,y:.5-(d.y-yt)/Qe}},et=qa(Fe),Ce=e.override.mode==="fixed"?e.override.place.label:void 0;return X(b,{children:gt(b,{style:E.map,testID:"location-map",accessibilityLabel:"Map of places, geofences and the simulated position",children:[xi.map(w=>X(b,{style:[E.gridV,{left:j(w)}]},`v${w}`)),xi.map(w=>X(b,{style:[E.gridH,{top:j(w)}]},`h${w}`)),c.map(({task:w,region:d})=>{let s=me(d),f=2*d.radius/Fe,k=f*Xe,C=d.state==="inside";return X(se,{testID:`location-map-region-${Ci(d.identifier)}`,accessibilityRole:"button",accessibilityLabel:`${C?"Leave":"Enter"} ${d.label??d.identifier}`,activeOpacity:.6,onPress:()=>n(w,d),style:[E.fence,C?E.fenceInside:null,{left:j(s.x-f/2),top:j(s.y-k/2),width:j(f),height:j(k)}]},`${w.name}:${d.identifier}`)}),o?Va(o.points.map(me)).map((w,d)=>X(b,{pointerEvents:"none",style:[E.segment,{left:j(w.midX-w.length/2),top:j(w.midY),width:j(w.length),transform:[{rotate:`${w.angle}rad`}]}]},`seg${d}`)):null,p.map((w,d)=>{let s=me(w),f=!!Ce&&Ce===w.label;return gt(se,{testID:`location-map-place-${Ci(w.label??String(d))}`,accessibilityRole:"button",accessibilityLabel:`Pin ${w.label??"this place"}`,activeOpacity:.6,onPress:()=>t(w),style:[E.placeHit,{left:j(s.x),top:j(s.y)}],children:[X(b,{style:[E.placeDot,f?E.placeDotSelected:null]}),w.label?X(A,{style:E.placeLabel,numberOfLines:1,children:w.label}):null]},`${w.label??d}`)}),i?gt(b,{pointerEvents:"none",style:[E.pinWrap,{left:j(me(i).x),top:j(me(i).y)}],children:[X(b,{style:E.pinHalo}),X(b,{style:[E.pin,e.current.reason==="gap"?E.pinHollow:null]})]}):null,gt(b,{style:E.scale,pointerEvents:"none",children:[X(b,{style:[E.scaleBar,{width:j(et.fraction)}]}),X(A,{style:E.scaleLabel,children:et.label})]}),g>0?X(A,{style:E.offMap,pointerEvents:"none",children:`${g} more ${g===1?"place":"places"} off the map`}):null]})})}var xi=[.2,.4,.6,.8];function j(e){return`${e*100}%`}function Ha(e){for(let t of e)if(t.regions[0])return t.regions[0];return null}function Va(e){let t=[];for(let n=1;n<e.length;n++){let i=e[n-1],o=e[n],r=o.x-i.x,a=(o.y-i.y)/Xe;t.push({midX:(i.x+o.x)/2,midY:(i.y+o.y)/2,length:Math.sqrt(r*r+a*a),angle:Math.atan2(a,r)})}return t}function qa(e){let t=e/4,n=De()?1609.344:1e3,i=De()?[.01,.02,.05,.1,.2,.5,1,2,5,10,20,50,100].map(r=>r*n):[10,20,50,100,200,500,1e3,2e3,5e3,1e4,2e4,5e4,1e5],o=i[0];for(let r of i)r<=t&&(o=r);return{fraction:o/e,label:K(o)}}function Ci(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}var E=le.create({map:{width:"100%",aspectRatio:Xe,borderRadius:ne.radius.card,borderWidth:1,borderColor:ne.color.border,backgroundColor:ne.color.surface,overflow:"hidden"},gridV:{position:"absolute",top:0,bottom:0,width:le.hairlineWidth,backgroundColor:"rgba(255, 255, 255, 0.04)"},gridH:{position:"absolute",left:0,right:0,height:le.hairlineWidth,backgroundColor:"rgba(255, 255, 255, 0.04)"},fence:{position:"absolute",zIndex:1,borderRadius:9999,borderWidth:1,borderColor:"rgba(255, 255, 255, 0.22)",backgroundColor:"rgba(255, 255, 255, 0.04)",minWidth:10,minHeight:10},fenceInside:{borderColor:ne.color.accentBorderStrong,backgroundColor:ne.color.accentSoft},segment:{position:"absolute",height:3,marginTop:-1.5,borderRadius:1.5,backgroundColor:"rgba(248, 113, 113, 0.45)"},placeHit:{position:"absolute",flexDirection:"row",alignItems:"center",gap:4,height:24,marginTop:-12,marginLeft:-12,paddingLeft:8,paddingRight:4},placeDot:{width:8,height:8,borderRadius:4,backgroundColor:ne.color.textSecondary},placeDotSelected:{backgroundColor:ne.color.text},placeLabel:{color:ne.color.textSecondary,fontSize:10,fontWeight:"500",maxWidth:110},pinWrap:{position:"absolute",width:28,height:28,marginLeft:-14,marginTop:-14,alignItems:"center",justifyContent:"center"},pinHalo:{position:"absolute",width:28,height:28,borderRadius:14,backgroundColor:"rgba(248, 113, 113, 0.22)"},pin:{width:14,height:14,borderRadius:7,backgroundColor:ki,borderWidth:2,borderColor:"#FFFFFF"},pinHollow:{backgroundColor:"transparent",borderColor:ki},scale:{position:"absolute",left:10,right:10,bottom:8,gap:3},scaleBar:{height:2,borderRadius:1,backgroundColor:ne.color.textTertiary},scaleLabel:{color:ne.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},offMap:{position:"absolute",right:10,bottom:8,color:ne.color.textTertiary,fontSize:10}});import{Fragment as Ze,jsx as l,jsxs as x}from"react/jsx-runtime";var Si={places:"Other Location",routes:"Route",speed:"Speed",accuracy:"Accuracy & Drift",activity:"Activity",options:"Options"},Ga="#F87171",Ii=[{key:"1.4",label:"Walking"},{key:"3.3",label:"Running"},{key:"5.5",label:"Cycling"},{key:"13.4",label:"City Traffic"},{key:"30",label:"Highway"},{key:"250",label:"Airplane"}],Ai=[{key:"good",label:"Good"},{key:"weak",label:"Weak"},{key:"no-signal",label:"No Signal"},{key:"off",label:"Off"}],Ka={good:"Precise fixes, like outdoors with a clear sky.",weak:"Fixes are \xB165 m and wander by up to 50 m, like indoors or between tall buildings.","no-signal":"Watches get no updates and location requests fail.",off:"The app is told location services are turned off.",custom:"Custom accuracy and drift."},Ti=[{key:"5",label:"5 m"},{key:"20",label:"20 m"},{key:"65",label:"65 m"},{key:"1000",label:"1 km"}],$i=[{key:"0",label:"Off"},{key:"10",label:"10 m"},{key:"50",label:"50 m"},{key:"200",label:"200 m"}],Ya=4;function Xt(e){let[t,n]=je(()=>Jt());return La(()=>{if(!e)return;let i=setInterval(()=>n(Jt()),1e3);return()=>clearInterval(i)},[e]),t}function Li({snapshot:e,onAction:t}){let n=Fa({minBottom:16}),[i,o]=je(null),[r,a]=je("main"),p=()=>a("main"),c=_a(r==="main"?null:{title:Si[r],subtitle:"",onBack:p,searchable:false},[r]),g=(I,_)=>{o(null),t(I,_).catch(z=>{o(z instanceof Error?z.message:String(z))})};if(!e)return l(b,{style:y.waiting,testID:"location-waiting",children:l(ee,{centered:true,children:"Waiting for the app\u2026"})});let u=i?l(ee,{tone:"danger",centered:true,children:l(A,{testID:"location-error",children:i})}):null,v=(I,_)=>{g(I,_),p()},S;switch(r){case"places":S=l(tl,{snapshot:e,pick:v});break;case"routes":S=l(rl,{snapshot:e,pick:v});break;case"speed":S=l(ll,{snapshot:e,pick:v});break;case"accuracy":S=l(fl,{snapshot:e,run:g});break;case"activity":S=l(hl,{snapshot:e,run:g});break;case"options":S=l(yl,{snapshot:e,run:g});break;default:S=x(Ze,{children:[l(Ja,{snapshot:e,run:g}),u,l(Za,{snapshot:e,run:g}),l(Qa,{snapshot:e,run:g,open:a}),l(il,{snapshot:e,open:a}),l(cl,{snapshot:e,run:g}),l(pl,{snapshot:e,run:g,open:a}),l(gl,{snapshot:e,open:a})]})}return x(Vn,{style:y.fill,contentContainerStyle:[y.content,{paddingBottom:n.bottom}],testID:"location-scroll",keyboardShouldPersistTaps:"handled",children:[r!=="main"&&!c?l(bl,{title:Si[r],onBack:p}):null,r!=="main"?u:null,S]},r)}function Ja({snapshot:e,run:t}){let n=e.override,i=n.mode==="route"?n.route:null,o=e.progress;Xt(!!i&&n.playing);let r=ua(e),a=e.current.fix,p=o&&o.length>0?Math.min(1,o.along/o.length):0,[c,g]=je(false);return x(R,{children:[x(b,{style:y.status,children:[l(A,{style:[y.statusTitle,r==="simulated"?y.titleSimulated:r==="broken"?y.titleBroken:null],testID:"location-hero-title",numberOfLines:1,adjustsFontSizeToFit:true,children:pi(e)}),l(A,{style:y.statusLine,testID:"location-hero-status",children:da(e)}),a&&e.simulating?l(se,{testID:"location-copy-coordinates",accessibilityRole:"button",accessibilityLabel:"Copy coordinates",activeOpacity:.6,onPress:()=>{Ba(`${a.latitude}, ${a.longitude}`).then(u=>{u&&(g(true),setTimeout(()=>g(false),1500))})},children:l(A,{style:y.coordinates,children:c?"Copied":ze(a,5)})}):null,i&&o?x(b,{style:y.progressTrack,testID:"location-route-progress",children:[l(b,{style:[y.progressFill,{width:`${p*100}%`}]}),(i.gaps??[]).map(([u,v],S)=>l(b,{style:[y.progressGap,{left:`${u/o.length*100}%`,width:`${(v-u)/o.length*100}%`}]},S))]}):null,e.active?x(b,{style:y.statusButtons,children:[i&&o?l(Xa,{testID:n.playing?"location-route-pause":"location-route-resume",label:n.playing?"Pause":o.finished?"Play again":"Resume",onPress:()=>t(n.playing?"pauseRoute":"resumeRoute"),children:n.playing?l(Na,{size:18,color:m.color.onAccent}):o.finished?l(Da,{size:18,color:m.color.onAccent}):l(Oa,{size:18,color:m.color.onAccent})}):null,l(b,{style:y.flex,children:l(wi,{label:"Use Real Location",size:"md",testID:"location-reset",onPress:()=>t("reset")})})]}):null]}),e.permission?x(b,{style:y.permission,testID:"location-permission",children:[x(b,{style:y.rowBetween,children:[l(A,{style:y.rowTitle,children:"Permission"}),l(A,{style:[y.rowValue,e.permission.status!=="granted"?y.valueWarning:null],testID:"location-permission-value",children:pa(e.permission)})]}),e.permission.status!=="granted"?l(A,{style:y.detail,children:"The app's location requests fail until it's allowed. Change it in Settings or the Permissions tool."}):null]}):null]})}function Xa({children:e,label:t,onPress:n,testID:i}){return l(se,{testID:i,accessibilityRole:"button",accessibilityLabel:t,activeOpacity:.7,onPress:n,style:y.round,children:e})}function Za({snapshot:e,run:t}){return!!e.position||e.places.length>0||e.tasks.some(n=>n.regions.length>0)?x(b,{children:[l(Ua,{snapshot:e,onPinPlace:n=>t("setLocation",{latitude:n.latitude,longitude:n.longitude,label:n.label}),onCrossRegion:(n,i)=>t(i.state==="inside"?"exitRegion":"enterRegion",{identifier:i.identifier,task:n.name})}),l(ee,{children:"Map views in the app still show the device's own blue dot. Move the simulator's location for those."})]}):null}function Qa({snapshot:e,run:t,open:n}){let i=e.places.length>0?e.places:e.builtInPlaces.slice(0,Ya),o=e.override.mode==="fixed"?e.override.place:null,r=e.position,a=!!o&&!i.some(p=>ht(p,o));return x(b,{children:[l(J,{children:"Location"}),l(R,{children:x(te,{children:[i.map((p,c)=>l(F,{title:p.label??ze(p,4),value:r&&!(o&&ht(p,o))?el(r,p):void 0,checked:!!o&&ht(p,o),testID:`location-place-${mt(p.label??String(c))}`,onPress:()=>t("setLocation",{latitude:p.latitude,longitude:p.longitude,label:p.label})},`${p.label??c}`)),l(F,{title:"Other Location\u2026",value:a?o.label||ze(o,3):void 0,chevron:true,testID:"location-other",onPress:()=>n("places")},"other")]})})]})}function el(e,t){let n=V(e,t);return n<30?"Here":K(n)}function ht(e,t){return e.label&&t.label?e.label===t.label:V(e,t)<1}function tl({snapshot:e,pick:t}){let[n,i]=je(""),o=kt(n),r=e.override.mode==="fixed"?e.override.place:null,a=()=>{o&&(t("setLocation",{query:n}),i(""))};return x(Ze,{children:[x(b,{children:[l(J,{children:"Coordinates"}),l(R,{children:x(b,{style:y.editor,children:[x(b,{style:y.inputRow,children:[l(Hn,{value:n,onChangeText:i,placeholder:"Coordinates or a Maps link",placeholderTextColor:m.color.placeholder,autoCapitalize:"none",autoCorrect:false,style:y.input,testID:"location-coordinate-input",accessibilityLabel:"Coordinates or a Maps link",returnKeyType:"done",onSubmitEditing:a}),l(wi,{label:"Pin",size:"md",variant:"primary",disabled:!o,testID:"location-coordinate-set",onPress:a})]}),n.length>0?l(A,{style:o?y.detail:y.warning,testID:"location-coordinate-preview",children:o?nl(o):"Type a latitude and longitude, like 40.7580, -73.9855, or paste a Google or Apple Maps link."}):null]})})]}),x(b,{children:[l(J,{children:"Places"}),l(R,{children:l(te,{children:e.builtInPlaces.map((p,c)=>l(F,{title:p.label??ze(p,4),detail:p.label==="Null Island"?"0, 0: catches code that treats 0 as no location":void 0,checked:!!r&&ht(p,r),testID:`location-place-${mt(p.label??String(c))}`,onPress:()=>t("setLocation",{latitude:p.latitude,longitude:p.longitude,label:p.label})},`${p.label??c}`))})}),e.places.length===0?l(ee,{children:"Add your own places, such as your stores, with registerLocationPlaces()."}):null]})]})}function nl(e){let t=`${Math.abs(e.latitude).toFixed(4)}\xB0 ${e.latitude>=0?"N":"S"}`,n=`${Math.abs(e.longitude).toFixed(4)}\xB0 ${e.longitude>=0?"E":"W"}`;return`${t}, ${n}`}function il({snapshot:e,open:t}){let n=e.override.mode==="route"?e.override.route:null;return x(b,{children:[l(J,{children:"Movement"}),l(R,{children:x(te,{children:[l(F,{title:"Route",value:n?.name??"None",chevron:true,testID:"location-route",onPress:()=>t("routes")},"route"),n?l(F,{title:"Speed",value:ol(n.speed),chevron:true,testID:"location-speed",onPress:()=>t("speed")},"speed"):null]})})]})}function ol(e){let t=Ii.find(n=>Math.abs(Number(n.key)-e)<.05);return t?t.label:qt(e)}function rl({snapshot:e,pick:t}){let n=e.override.mode==="route"?e.override.route:null,i=n?.id;return x(Ze,{children:[n?l(b,{children:l(R,{children:l(te,{children:l(F,{title:"Stop Here",detail:"End the route and stay where it got to",testID:"location-route-stop",onPress:()=>t("stopRoute")},"stop")})})}):null,e.routes.length>0?x(b,{children:[l(J,{children:"This App"}),l(R,{children:l(te,{children:e.routes.map((o,r)=>l(F,{title:o.name??o.id??`Route ${r+1}`,detail:`${K(wt(o.points))} at ${qt(o.speed)}${o.loop?", on repeat":""}`,checked:!!i&&i===o.id,testID:`location-route-${mt(o.id??o.name??String(r))}`,onPress:()=>t("startRoute",{route:o.id??o.name})},o.id??`${o.name}-${r}`))})})]}):null,x(b,{children:[l(J,{children:"From Here"}),l(R,{children:l(te,{children:e.presets.map(o=>l(F,{title:o.name,detail:al(o.id)??o.description,checked:i===`preset:${o.id}`,testID:`location-preset-${o.id}`,onPress:()=>t("startRoute",{route:o.id})},o.id))})}),l(ee,{children:"These start where the app is now."})]})]})}function al(e){let t=K;switch(e){case"walk":return`${t(1e3)} north at walking pace`;case"run":return`${t(3e3)} north, then east, at running pace`;case"drive":return`${t(4e3)} of city streets with turns`;case"highway":return`${t(3e4)} north at highway speed`;case"tunnel":return`${t(3e3)} drive with no signal for ${t(600)} in the middle`;case"loop":return`A ${t(400)} block, walked on repeat`;default:return null}}function ll({snapshot:e,pick:t}){let n=e.override.route?.speed??0;return x(b,{children:[l(R,{children:l(te,{children:Ii.map(i=>l(F,{title:i.label,value:qt(Number(i.key)),checked:Math.abs(Number(i.key)-n)<.05,testID:`location-speed-${i.key}`,onPress:()=>t("setSpeed",{speed:Number(i.key)})},i.key))})}),l(ee,{children:"Heading and speed follow the route."})]})}var sl=1e4;function cl({snapshot:e,run:t}){let n=e.tasks.filter(c=>c.kind==="geofencing"&&c.regions.length>0),[i,o]=je(null),r=Xt(!!i);if(n.length===0)return null;let a=n.length>1,p=n.map(c=>c.name).join(", ");return x(b,{children:[l(J,{children:"Geofences"}),l(R,{children:l(te,{children:n.flatMap(c=>c.regions.map(g=>{let u=`${c.name}:${g.identifier}`,v=g.state==="inside",S=i?.key===u&&r-i.at<sl?i:null,I=[ul(g)];return a&&I.push(c.name),l(F,{title:g.label??g.identifier,detail:I.join(" \xB7 "),note:S?dl(e,c,S.at):void 0,action:v?"Leave":"Enter",testID:`location-region-${mt(g.identifier)}`,onPress:()=>{o({key:u,at:Jt()}),t(v?"exitRegion":"enterRegion",{identifier:g.identifier,task:c.name})}},u)}))})}),x(ee,{children:["Tap a region to cross its edge. ",a?"The app's tasks":`The app's ${p} task`," runs as it would from the OS."]})]})}function ul(e){return e.state==="inside"?"Inside":e.distance==null?`${K(e.radius)} radius`:`${K(Math.max(0,e.distance-e.radius))} away`}function dl(e,t,n){let i=e.log.filter(r=>r.at>=n-50&&(r.detail??"").startsWith(t.name)),o=i.find(r=>r.kind==="error");return o?{text:`Task failed: ${o.detail?.slice(t.name.length+3)??""}`,tone:"bad"}:i.find(r=>r.kind==="task")?{text:"Task ran",tone:"ok"}:i.find(r=>r.kind==="enter"||r.kind==="exit")?{text:"Running the app's task\u2026",tone:"wait"}:{text:"Already on this side",tone:"wait"}}function pl({snapshot:e,run:t,open:n}){let i=e.override,o=Ji(i),r=e.simulating?Ai:Ai.filter(a=>a.key!=="weak");return x(b,{children:[l(J,{children:"Conditions"}),x(R,{children:[l(b,{style:y.segmentWrap,children:l(Yt,{tabs:r,activeKey:o??"",size:"sm",testIDPrefix:"location-conditions",onChange:a=>t("setConditions",{conditions:a})})}),e.simulating&&i.services&&i.signal?l(b,{style:y.separatorTop,children:l(F,{title:"Accuracy & Drift",value:`${di(i.accuracy)}${i.jitter>0?` \xB7 drifts ${K(i.jitter)}`:""}`,chevron:true,testID:"location-accuracy",onPress:()=>n("accuracy")})}):null]}),l(ee,{children:Ka[o??"custom"]})]})}function fl({snapshot:e,run:t}){let n=e.override;return x(Ze,{children:[x(b,{children:[l(J,{children:"Accuracy"}),l(R,{children:l(b,{style:y.segmentWrap,children:l(Yt,{tabs:Ti,activeKey:Ei(Ti,n.accuracy)??"",size:"sm",testIDPrefix:"location-accuracy",onChange:i=>t("tune",{accuracy:Number(i)})})})}),l(ee,{children:"The accuracy radius the app is given with each fix."})]}),x(b,{children:[l(J,{children:"Drift"}),l(R,{children:l(b,{style:y.segmentWrap,children:l(Yt,{tabs:$i,activeKey:Ei($i,n.jitter)??"0",size:"sm",testIDPrefix:"location-drift",onChange:i=>t("tune",{jitter:Number(i)})})})}),l(ee,{children:"Moves each fix by up to this much at random, the way a real fix wanders."})]})]})}function gl({snapshot:e,open:t}){let n=e.log.length;return l(b,{children:l(R,{children:x(te,{children:[l(F,{title:"Activity",value:n===0?"None":`${n} ${n===1?"event":"events"}`,chevron:true,testID:"location-activity",onPress:()=>t("activity")},"activity"),l(F,{title:"Options",chevron:true,testID:"location-options",onPress:()=>t("options")},"options")]})})})}function hl({snapshot:e,run:t}){let n=Xt(true),i=e.log.slice().reverse(),o=e.watches.filter(c=>c.kind==="position").length,r=e.tasks.filter(c=>c.kind==="locationUpdates").length,a=e.tasks.filter(c=>c.kind==="geofencing").reduce((c,g)=>c+g.regions.length,0),p=[o?`${o} location ${o===1?"watch":"watches"}`:null,a?`${a} ${a===1?"geofence":"geofences"}`:null,r?"background updates":null].filter(Boolean);return x(Ze,{children:[x(b,{children:[l(J,{children:"The App Is Using"}),l(R,{children:x(b,{style:y.editor,children:[l(A,{style:y.rowTitle,testID:"location-activity-summary",children:p.length?p.join(", "):"Nothing right now"}),l(A,{style:y.detail,children:e.libraries.length?`Through ${e.libraries.join(" and ")}.`:"No supported location library was found in this app."})]})})]}),x(b,{children:[l(J,{children:"Recent"}),l(R,{children:x(te,{children:[i.length===0?l(b,{style:y.editor,children:l(A,{style:y.detail,children:"Location requests, watches and geofence crossings show up here."})},"empty"):i.map(c=>x(b,{style:y.logRow,testID:"location-log-entry",children:[l(b,{style:[y.logDot,ml(c.kind)]}),x(b,{style:y.flex,children:[l(A,{style:y.logText,children:c.text}),c.detail?l(A,{style:y.logDetail,numberOfLines:2,children:c.detail}):null]}),l(A,{style:y.logWhen,children:ca(c.at,n)})]},c.id)),i.length>0?l(F,{title:"Clear",tint:true,testID:"location-clear-log",onPress:()=>t("clearLog")},"clear"):null]})})]})]})}function ml(e){return e==="enter"?y.dotEnter:e==="exit"?y.dotExit:e==="error"?y.dotError:e==="task"?y.dotTask:null}function yl({snapshot:e,run:t}){return x(b,{children:[l(R,{children:x(te,{children:[l(Pi,{title:"Keep Across Reloads",value:e.settings.persist,testID:"location-setting-persist",onValueChange:n=>t("updateSettings",{persist:n})},"persist"),l(Pi,{title:"Show Floating Status",value:e.settings.showChip,testID:"location-setting-showChip",onValueChange:n=>t("updateSettings",{showChip:n})},"chip")]})}),l(ee,{children:"The floating status stays on screen while the app is somewhere else, so a simulated location is never left on by accident."})]})}function bl({title:e,onBack:t}){return x(se,{testID:"location-back",accessibilityRole:"button",accessibilityLabel:"Back",activeOpacity:.6,onPress:t,style:y.backRow,children:[l(Ea,{size:18,color:m.color.accent}),l(A,{style:y.backLabel,children:"Location"}),l(A,{style:y.backTitle,numberOfLines:1,children:e})]})}function F({title:e,detail:t,note:n,value:i,action:o,checked:r,chevron:a,tint:p,onPress:c,testID:g}){return x(se,{testID:g,accessibilityRole:"button",accessibilityLabel:o?`${o} ${e}`:e,accessibilityState:r?{selected:true}:void 0,activeOpacity:.6,onPress:c,style:y.row,children:[x(b,{style:y.rowText,children:[l(A,{style:[y.rowTitle,p?y.titleTint:null],numberOfLines:1,children:e}),t?l(A,{style:y.detail,children:t}):null,n?l(A,{style:[y.note,n.tone==="ok"?y.noteOk:n.tone==="bad"?y.noteBad:null],testID:`${g}-result`,children:n.text}):null]}),i?l(A,{style:y.rowValue,numberOfLines:1,children:i}):null,o?l(A,{style:y.rowAction,children:o}):null,r?l(Pa,{size:18,color:m.color.accent}):null,a?l(Ma,{size:16,color:m.color.textTertiary}):null]})}function Pi({title:e,value:t,onValueChange:n,testID:i}){return x(b,{style:y.row,children:[l(b,{style:y.rowText,children:l(A,{style:y.rowTitle,children:e})}),l(Ra,{value:t,testID:i,accessibilityLabel:e,onValueChange:n})]})}function Ei(e,t){let n=null,i=1/0;for(let o of e){let r=Math.abs(Number(o.key)-t);r<i&&(n=o.key,i=r)}return n!==null&&i<=Math.max(.05,Number(n)*.05)?n:null}function mt(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}var y=le.create({fill:{flex:1},flex:{flex:1},content:{paddingHorizontal:m.gutter,paddingTop:8,gap:m.groupGap},waiting:{flex:1,alignItems:"center",justifyContent:"center",padding:24},status:{padding:m.cardPad+2,gap:6},statusTitle:{color:m.color.text,fontSize:28,fontWeight:"600"},titleSimulated:{color:m.color.accent},titleBroken:{color:Ga},statusLine:{color:m.color.textSecondary,fontSize:m.font.row,fontVariant:["tabular-nums"]},coordinates:{color:m.color.textTertiary,fontSize:m.font.caption,fontFamily:ja},statusButtons:{flexDirection:"row",alignItems:"center",gap:10,marginTop:10},round:{width:44,height:44,borderRadius:22,alignItems:"center",justifyContent:"center",backgroundColor:m.color.accent},progressTrack:{height:6,borderRadius:3,marginTop:8,backgroundColor:m.color.fillSecondary,overflow:"hidden"},progressFill:{position:"absolute",left:0,top:0,bottom:0,backgroundColor:m.color.accent},progressGap:{position:"absolute",top:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.28)"},permission:{borderTopWidth:le.hairlineWidth,borderTopColor:m.color.separator,paddingHorizontal:m.rowPadH,paddingVertical:12,gap:4},rowBetween:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:12},valueWarning:{color:m.color.warning},row:{flexDirection:"row",alignItems:"center",gap:10,minHeight:48,paddingHorizontal:m.rowPadH,paddingVertical:10},rowText:{flex:1,gap:2},rowTitle:{color:m.color.text,fontSize:m.font.row},titleTint:{color:m.color.accent},rowValue:{color:m.color.textSecondary,fontSize:m.font.row,maxWidth:"50%"},rowAction:{color:m.color.accent,fontSize:m.font.row,fontWeight:"500"},detail:{color:m.color.textTertiary,fontSize:m.font.caption},note:{color:m.color.textSecondary,fontSize:m.font.caption,marginTop:2},noteOk:{color:m.color.accent},noteBad:{color:m.color.danger},warning:{color:m.color.warning,fontSize:m.font.caption},separatorTop:{borderTopWidth:le.hairlineWidth,borderTopColor:m.color.separator},segmentWrap:{flexDirection:"row",padding:10},editor:{paddingHorizontal:m.rowPadH,paddingVertical:14,gap:8},inputRow:{flexDirection:"row",alignItems:"center",gap:8},input:{flex:1,color:m.color.text,fontSize:m.font.body,backgroundColor:m.color.bg,borderRadius:m.radius.input,borderWidth:1,borderColor:m.color.border,paddingHorizontal:12,paddingVertical:9},backRow:{flexDirection:"row",alignItems:"center",gap:4,paddingVertical:4},backLabel:{color:m.color.accent,fontSize:m.font.row},backTitle:{flex:1,color:m.color.text,fontSize:m.font.row,fontWeight:"600",textAlign:"center",marginRight:70},logRow:{flexDirection:"row",alignItems:"flex-start",gap:10,paddingHorizontal:m.rowPadH,paddingVertical:10},logDot:{width:8,height:8,borderRadius:4,marginTop:6,backgroundColor:m.color.textTertiary},dotEnter:{backgroundColor:m.color.accent},dotExit:{backgroundColor:m.color.warning},dotError:{backgroundColor:m.color.danger},dotTask:{backgroundColor:m.color.info},logText:{color:m.color.text,fontSize:m.font.body},logDetail:{color:m.color.textTertiary,fontSize:m.font.caption,marginTop:2},logWhen:{color:m.color.textTertiary,fontSize:m.font.caption,fontVariant:["tabular-nums"],marginTop:1}});import{jsx as Mi}from"react/jsx-runtime";var vl=Kt.actions;async function wl(e,t){let n=vl[e];if(!n)throw new Error(`Unknown location action: ${e}`);return n(t)}var Zt=()=>Kt.getSnapshot(),kl=2e3;function Ri(){let[e,t]=xa(Zt);return ka(()=>{Ht(),Ot(),t(Zt()),mi(true),lt();let n=setInterval(lt,kl),i=Ve(()=>t(Zt()));return()=>{clearInterval(n),i(),mi(false)}},[]),Mi(Ca,{featureName:"Location",children:Mi(Li,{snapshot:e,onAction:wl})})}import{jsx as xl}from"react/jsx-runtime";var Ni=wa({id:"location",name:"LOCATION",description:"Pin the app anywhere, play routes, trigger geofences",slot:"both",color:ba,icon:({size:e,color:t})=>xl(ya,{size:e,color:t}),component:Ri,modal:{subtitle:"simulate where the app is"}}),Cl=va(Ni);import{LocationToolIcon as Sl,LOCATION_TOOL_ICON_COLOR as Il}from"@buoy-gg/shared-ui/web";var Oi=typeof navigator<"u"&&navigator.product==="ReactNative",Al=(()=>{try{return globalThis.Capacitor?.isNativePlatform?.()===true}catch{return false}})(),Tl=!Oi&&typeof globalThis.document<"u";(Oi||Al||Tl)&&(ma(),typeof tn<"u"&&tn&&(Ht(),Ot()));export{ft as BUILT_IN_PLACES,pt as LOCATION_CHIP_ID,Il as LOCATION_TOOL_ICON_COLOR,Ri as LocationBody,yi as LocationChip,Sl as LocationToolIcon,Li as LocationToolView,Be as ROUTE_PRESETS,tt as bearingDegrees,Ot as bootLocation,bi as buildPresetRoute,Cl as createLocationTool,_e as destination,V as distanceMeters,M as getLocationSnapshot,Ht as installLocationAdapters,L as isLocationActive,Kt as locationSyncAdapter,Ni as locationToolPreset,Rt as moveToRegion,kt as parseCoordinate,Et as pauseRoute,lt as refreshLocationPermission,po as registerLocationPlaces,fo as registerLocationRoutes,Nt as resetLocation,Mt as resumeRoute,Tn as seekRoute,Mn as setConditions,dt as setPlace,$n as setRouteSpeed,En as setServices,Pn as setSignal,An as startRoute,Rn as stopRoute,Ve as subscribeLocation,Ln as tuneOverride,Nn as useRealLocation};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/location",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.75",
|
|
4
4
|
"description": "Location override for React Native: pin the app to any place, play routes with speed and heading, trigger geofences and test signal loss. Works with expo-location, @react-native-community/geolocation and react-native-geolocation-service.",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -17,17 +17,17 @@
|
|
|
17
17
|
"./lib/web/**/*.mjs"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@buoy-gg/shared-ui": "^7.0.
|
|
20
|
+
"@buoy-gg/shared-ui": "^7.0.75"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@buoy-gg/license": "7.0.
|
|
23
|
+
"@buoy-gg/license": "7.0.75",
|
|
24
24
|
"react": "*"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/react": "^19.1.0",
|
|
28
28
|
"@types/react-native": "^0.73.0",
|
|
29
29
|
"typescript": "~5.8.3",
|
|
30
|
-
"@buoy-gg/license": "^7.0.
|
|
30
|
+
"@buoy-gg/license": "^7.0.75"
|
|
31
31
|
},
|
|
32
32
|
"react-native-builder-bob": {
|
|
33
33
|
"source": "src",
|