import{$ as P}from"./CZDTFSLu.js";function M(i,e,t,s){function l(r){return r instanceof t?r:new t(function(n){n(r)})}return new(t||(t=Promise))(function(r,n){function c(a){try{o(s.next(a))}catch(p){n(p)}}function h(a){try{o(s.throw(a))}catch(p){n(p)}}function o(a){a.done?r(a.value):l(a.value).then(c,h)}o((s=s.apply(i,[])).next())})}function O(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var _=function i(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var s,l,r;if(Array.isArray(e)){if(s=e.length,s!=t.length)return!1;for(l=s;l--!==0;)if(!i(e[l],t[l]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(r=Object.keys(e),s=r.length,s!==Object.keys(t).length)return!1;for(l=s;l--!==0;)if(!Object.prototype.hasOwnProperty.call(t,r[l]))return!1;for(l=s;l--!==0;){var n=r[l];if(!i(e[n],t[n]))return!1}return!0}return e!==e&&t!==t},A=O(_);const E="__googleMapsScriptId";var u;(function(i){i[i.INITIALIZED=0]="INITIALIZED",i[i.LOADING=1]="LOADING",i[i.SUCCESS=2]="SUCCESS",i[i.FAILURE=3]="FAILURE"})(u||(u={}));class f{constructor({apiKey:e,authReferrerPolicy:t,channel:s,client:l,id:r=E,language:n,libraries:c=[],mapIds:h,nonce:o,region:a,retries:p=3,url:g="https://maps.googleapis.com/maps/api/js",version:y}){if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=e,this.authReferrerPolicy=t,this.channel=s,this.client=l,this.id=r||E,this.language=n,this.libraries=c,this.mapIds=h,this.nonce=o,this.region=a,this.retries=p,this.url=g,this.version=y,f.instance){if(!A(this.options,f.instance.options))throw new Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(f.instance.options)}`);return f.instance}f.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url,authReferrerPolicy:this.authReferrerPolicy}}get status(){return this.errors.length?u.FAILURE:this.done?u.SUCCESS:this.loading?u.LOADING:u.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){let e=this.url;return e+="?callback=__googleMapsCallback&loading=async",this.apiKey&&(e+=`&key=${this.apiKey}`),this.channel&&(e+=`&channel=${this.channel}`),this.client&&(e+=`&client=${this.client}`),this.libraries.length>0&&(e+=`&libraries=${this.libraries.join(",")}`),this.language&&(e+=`&language=${this.language}`),this.region&&(e+=`&region=${this.region}`),this.version&&(e+=`&v=${this.version}`),this.mapIds&&(e+=`&map_ids=${this.mapIds.join(",")}`),this.authReferrerPolicy&&(e+=`&auth_referrer_policy=${this.authReferrerPolicy}`),e}deleteScript(){const e=document.getElementById(this.id);e&&e.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise((e,t)=>{this.loadCallback(s=>{s?t(s.error):e(window.google)})})}importLibrary(e){return this.execute(),google.maps.importLibrary(e)}loadCallback(e){this.callbacks.push(e),this.execute()}setScript(){var e,t;if(document.getElementById(this.id)){this.callback();return}const s={key:this.apiKey,channel:this.channel,client:this.client,libraries:this.libraries.length&&this.libraries,v:this.version,mapIds:this.mapIds,language:this.language,region:this.region,authReferrerPolicy:this.authReferrerPolicy};Object.keys(s).forEach(r=>!s[r]&&delete s[r]),!((t=(e=window==null?void 0:window.google)===null||e===void 0?void 0:e.maps)===null||t===void 0)&&t.importLibrary||(r=>{let n,c,h,o="The Google Maps JavaScript API",a="google",p="importLibrary",g="__ib__",y=document,d=window;d=d[a]||(d[a]={});const m=d.maps||(d.maps={}),T=new Set,b=new URLSearchParams,S=()=>n||(n=new Promise((w,v)=>M(this,void 0,void 0,function*(){var I;yield c=y.createElement("script"),c.id=this.id,b.set("libraries",[...T]+"");for(h in r)b.set(h.replace(/[A-Z]/g,k=>"_"+k[0].toLowerCase()),r[h]);b.set("callback",a+".maps."+g),c.src=this.url+"?"+b,m[g]=w,c.onerror=()=>n=v(Error(o+" could not load.")),c.nonce=this.nonce||((I=y.querySelector("script[nonce]"))===null||I===void 0?void 0:I.nonce)||"",y.head.append(c)})));m[p]?console.warn(o+" only loads once. Ignoring:",r):m[p]=(w,...v)=>T.add(w)&&S().then(()=>m[p](w,...v))})(s);const l=this.libraries.map(r=>this.importLibrary(r));l.length||l.push(this.importLibrary("core")),Promise.all(l).then(()=>this.callback(),r=>{const n=new ErrorEvent("error",{error:r});this.loadErrorCallback(n)})}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(e){if(this.errors.push(e),this.errors.length<=this.retries){const t=this.errors.length*Math.pow(2,this.errors.length);console.error(`Failed to load Google Maps script, retrying in ${t} ms.`),setTimeout(()=>{this.deleteScript(),this.setScript()},t)}else this.onerrorEvent=e,this.callback()}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach(e=>{e(this.onerrorEvent)}),this.callbacks=[]}execute(){if(this.resetIfRetryingFailed(),!this.loading)if(this.done)this.callback();else{if(window.google&&window.google.maps&&window.google.maps.version){console.warn("Google Maps already loaded outside @googlemaps/js-api-loader. This may result in undesirable behavior as options and script parameters may not match."),this.callback();return}this.loading=!0,this.setScript()}}}const R=[{elementType:"geometry",stylers:[{color:"#f5f5f5"}]},{elementType:"labels.icon",stylers:[{visibility:"off"}]},{elementType:"labels.text.fill",stylers:[{color:"#616161"}]},{elementType:"labels.text.stroke",stylers:[{color:"#f5f5f5"}]},{featureType:"administrative.land_parcel",elementType:"labels.text.fill",stylers:[{color:"#bdbdbd"}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#eeeeee"}]},{featureType:"poi",elementType:"labels.text.fill",stylers:[{color:"#757575"}]},{featureType:"poi.park",elementType:"geometry",stylers:[{color:"#e5e5e5"}]},{featureType:"poi.park",elementType:"labels.text.fill",stylers:[{color:"#9e9e9e"}]},{featureType:"road",elementType:"geometry",stylers:[{color:"#ffffff"}]},{featureType:"road.arterial",elementType:"labels.text.fill",stylers:[{color:"#757575"}]},{featureType:"road.highway",elementType:"geometry",stylers:[{color:"#dadada"}]},{featureType:"road.highway",elementType:"labels.text.fill",stylers:[{color:"#616161"}]},{featureType:"road.local",elementType:"labels.text.fill",stylers:[{color:"#9e9e9e"}]},{featureType:"transit.line",elementType:"geometry",stylers:[{color:"#e5e5e5"}]},{featureType:"transit.station",elementType:"geometry",stylers:[{color:"#eeeeee"}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#c9c9c9"}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{color:"#9e9e9e"}]}];async function C(){const i=P().public.googleMapsAPIKey;!window.google&&i&&await new f({apiKey:i,version:"weekly",libraries:["places"]}).load()}function x(i,e,t,s,l="K"){const r=Math.PI*i/180,n=Math.PI*t/180,c=e-s,h=Math.PI*c/180;let o=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos(h);return o>1&&(o=1),o=Math.acos(o),o=o*180/Math.PI,o=o*60*1.1515,l==="K"&&(o=o*1.609344),l==="N"&&(o=o*.8684),o}export{x as g,C as l,R as o};
