class t{constructor(t=null,i={}){this.apiKey=t;this.options=i;if(typeof window==="undefined"){throw new Error("google-maps is supported only in browser environment")}}load(){if(typeof this.api!=="undefined"){return Promise.resolve(this.api)}if(typeof this.loader!=="undefined"){return this.loader}window[t.CALLBACK_NAME]=()=>{this.api=window["google"];if(typeof this.resolve==="undefined"){throw new Error("Should not happen")}this.resolve(this.api)};window["gm_authFailure"]=()=>{if(typeof this.reject==="undefined"){throw new Error("Should not happen")}this.reject(new Error("google-maps: authentication error"))};return this.loader=new Promise(((t,i)=>{this.resolve=t;this.reject=i;const e=document.createElement("script");e.src=this.createUrl();e.async=true;e.onerror=t=>i(t);document.head.appendChild(e)}))}createUrl(){const i=[`callback=${t.CALLBACK_NAME}`];if(this.apiKey){i.push(`key=${this.apiKey}`)}for(let t in this.options){if(this.options.hasOwnProperty(t)){let e=this.options[t];if(t==="version"){t="v"}if(t==="libraries"){e=e.join(",")}i.push(`${t}=${e}`)}}return`https://maps.googleapis.com/maps/api/js?${i.join("&")}`}}t.CALLBACK_NAME="_dk_google_maps_loader_cb";export{t as L};
//# sourceMappingURL=p-29d0604b.js.map