1import{aV as g}from"./main-B6fnd0Aw.js";import"./use-reduced-motion-j_xtnFDQ.js";class m extends g{constructor(){if(super(),this.latestOrientation=null,typeof window<"u"){const i=window;"ondeviceorientationabsolute"in i?i.addEventListener("deviceorientationabsolute",t=>this.updateOrientation(t,!0),!0):"ondeviceorientation"in i&&i.addEventListener("deviceorientation",t=>this.updateOrientation(t,!1),!0)}}updateOrientation(i,t){let a=null,e=null,l=null;t&&i.alpha!==null?a=(360-i.alpha)%360:i.webkitCompassHeading!==void 0&&i.webkitCompassHeading!==null?(e=i.webkitCompassHeading,l=i.webkitCompassAccuracy):i.alpha!==null&&i.absolute===!0?a=(360-i.alpha)%360:i.alpha!==null&&(e=(360-i.alpha)%360),(a!==null||e!==null)&&(this.latestOrientation={trueHeading:a,magneticHeading:e,headingAccuracy:l})}augmentPosition(i,t=!1){var a,e,l,s,u,r,d;const o=i.coords,n=t?this.latestOrientation:null,c=(l=(e=(a=n==null?void 0:n.trueHeading)!==null&&a!==void 0?a:n==null?void 0:n.magneticHeading)!==null&&e!==void 0?e:t?o.heading:null)!==null&&l!==void 0?l:null;return{timestamp:i.timestamp,coords:{latitude:o.latitude,longitude:o.longitude,accuracy:o.accuracy,altitude:o.altitude,altitudeAccuracy:o.altitudeAccuracy,speed:o.speed,heading:c,magneticHeading:(s=n==null?void 0:n.magneticHeading)!==null&&s!==void 0?s:null,trueHeading:(u=n==null?void 0:n.trueHeading)!==null&&u!==void 0?u:null,headingAccuracy:(r=n==null?void 0:n.headingAccuracy)!==null&&r!==void 0?r:null,course:(d=t?o.heading:null)!==null&&d!==void 0?d:null}}}async getCurrentPosition(i){return new Promise((t,a)=>{navigator.geolocation.getCurrentPosition(e=>{t(this.augmentPosition(e,!1))},e=>{a(e)},Object.assign({enableHighAccuracy:!1,timeout:1e4,maximumAge:0},i))})}async watchPosition(i,t){return`${navigator.geolocation.watchPosition(e=>{t(this.augmentPosition(e,!0))},e=>{t(null,e)},Object.assign({enableHighAccuracy:!1,timeout:1e4,maximumAge:0,minimumUpdateInterval:5e3},i))}`}async clearWatch(i){navigator.geolocation.clearWatch(parseInt(i.id,10))}async checkPermissions(){if(typeof navigator>"u"||!navigator.permissions)throw this.unavailable("Permissions API not available in this browser");const i=await navigator.permissions.query({name:"geolocation"});return{location:i.state,coarseLocation:i.state}}async requestPermissions(){throw this.unimplemented("Not implemented on web.")}}const f=new m;export{f as Geolocation,m as GeolocationWeb};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.