import{t as it}from"./custom-element-BhZVzxrc.js";import{n as N}from"./property-1JAdfsvf.js";import{r as nt}from"./state-D77yjKEp.js";import{e as ot}from"./query-__j_ZMY6.js";import{r as at,i as ct,h as lt,k as q}from"./lit-element-DDcuVA3y.js";import{g as ht}from"./_commonjsHelpers-CqkleIqs.js";import{a as pt,h as tt,i as V}from"./variables-BWf6YqMz.js";import{C as ut}from"./cookie-layer-00ENyUxO.js";import"./cookie-overlay-DCey0JyH.js";function dt(a,t,e,r){function s(i){return i instanceof e?i:new e(function(o){o(i)})}return new(e||(e=Promise))(function(i,o){function l(h){try{p(r.next(h))}catch(c){o(c)}}function n(h){try{p(r.throw(h))}catch(c){o(c)}}function p(h){h.done?i(h.value):s(h.value).then(l,n)}p((r=r.apply(a,[])).next())})}function ft(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var gt=function a(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var r,s,i;if(Array.isArray(t)){if(r=t.length,r!=e.length)return!1;for(s=r;s--!==0;)if(!a(t[s],e[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();if(i=Object.keys(t),r=i.length,r!==Object.keys(e).length)return!1;for(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[s]))return!1;for(s=r;s--!==0;){var o=i[s];if(!a(t[o],e[o]))return!1}return!0}return t!==t&&e!==e},mt=ft(gt);const J="__googleMapsScriptId";var O;(function(a){a[a.INITIALIZED=0]="INITIALIZED",a[a.LOADING=1]="LOADING",a[a.SUCCESS=2]="SUCCESS",a[a.FAILURE=3]="FAILURE"})(O||(O={}));class C{constructor({apiKey:t,authReferrerPolicy:e,channel:r,client:s,id:i=J,language:o,libraries:l=[],mapIds:n,nonce:p,region:h,retries:c=3,url:u="https://maps.googleapis.com/maps/api/js",version:d}){if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=t,this.authReferrerPolicy=e,this.channel=r,this.client=s,this.id=i||J,this.language=o,this.libraries=l,this.mapIds=n,this.nonce=p,this.region=h,this.retries=c,this.url=u,this.version=d,C.instance){if(!mt(this.options,C.instance.options))throw new Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(C.instance.options)}`);return C.instance}C.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?O.FAILURE:this.done?O.SUCCESS:this.loading?O.LOADING:O.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){let t=this.url;return t+="?callback=__googleMapsCallback&loading=async",this.apiKey&&(t+=`&key=${this.apiKey}`),this.channel&&(t+=`&channel=${this.channel}`),this.client&&(t+=`&client=${this.client}`),this.libraries.length>0&&(t+=`&libraries=${this.libraries.join(",")}`),this.language&&(t+=`&language=${this.language}`),this.region&&(t+=`&region=${this.region}`),this.version&&(t+=`&v=${this.version}`),this.mapIds&&(t+=`&map_ids=${this.mapIds.join(",")}`),this.authReferrerPolicy&&(t+=`&auth_referrer_policy=${this.authReferrerPolicy}`),t}deleteScript(){const t=document.getElementById(this.id);t&&t.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise((t,e)=>{this.loadCallback(r=>{r?e(r.error):t(window.google)})})}importLibrary(t){return this.execute(),google.maps.importLibrary(t)}loadCallback(t){this.callbacks.push(t),this.execute()}setScript(){var t,e;if(document.getElementById(this.id)){this.callback();return}const r={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(r).forEach(i=>!r[i]&&delete r[i]),!((e=(t=window==null?void 0:window.google)===null||t===void 0?void 0:t.maps)===null||e===void 0)&&e.importLibrary||(i=>{let o,l,n,p="The Google Maps JavaScript API",h="google",c="importLibrary",u="__ib__",d=document,f=window;f=f[h]||(f[h]={});const m=f.maps||(f.maps={}),g=new Set,y=new URLSearchParams,w=()=>o||(o=new Promise((k,I)=>dt(this,void 0,void 0,function*(){var E;yield l=d.createElement("script"),l.id=this.id,y.set("libraries",[...g]+"");for(n in i)y.set(n.replace(/[A-Z]/g,D=>"_"+D[0].toLowerCase()),i[n]);y.set("callback",h+".maps."+u),l.src=this.url+"?"+y,m[u]=k,l.onerror=()=>o=I(Error(p+" could not load.")),l.nonce=this.nonce||((E=d.querySelector("script[nonce]"))===null||E===void 0?void 0:E.nonce)||"",d.head.append(l)})));m[c]?console.warn(p+" only loads once. Ignoring:",i):m[c]=(k,...I)=>g.add(k)&&w().then(()=>m[c](k,...I))})(r);const s=this.libraries.map(i=>this.importLibrary(i));s.length||s.push(this.importLibrary("core")),Promise.all(s).then(()=>this.callback(),i=>{const o=new ErrorEvent("error",{error:i});this.loadErrorCallback(o)})}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(t){if(this.errors.push(t),this.errors.length<=this.retries){const e=this.errors.length*Math.pow(2,this.errors.length);console.error(`Failed to load Google Maps script, retrying in ${e} ms.`),setTimeout(()=>{this.deleteScript(),this.setScript()},e)}else this.onerrorEvent=t,this.callback()}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach(t=>{t(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()}}}var yt=function a(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var r,s,i;if(Array.isArray(t)){if(r=t.length,r!=e.length)return!1;for(s=r;s--!==0;)if(!a(t[s],e[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();if(i=Object.keys(t),r=i.length,r!==Object.keys(e).length)return!1;for(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[s]))return!1;for(s=r;s--!==0;){var o=i[s];if(!a(t[o],e[o]))return!1}return!0}return t!==t&&e!==e};const H=ht(yt),W=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],F=1,P=8;class z{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,r]=new Uint8Array(t,0,2);if(e!==219)throw new Error("Data does not appear to be in a KDBush format.");const s=r>>4;if(s!==F)throw new Error(`Got v${s} data when expected v${F}.`);const i=W[r&15];if(!i)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[l]=new Uint32Array(t,4,1);return new z(l,o,i,t)}constructor(t,e=64,r=Float64Array,s){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const i=W.indexOf(this.ArrayType),o=t*2*this.ArrayType.BYTES_PER_ELEMENT,l=t*this.IndexArrayType.BYTES_PER_ELEMENT,n=(8-l%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${r}.`);s&&s instanceof ArrayBuffer?(this.data=s,this.ids=new this.IndexArrayType(this.data,P,t),this.coords=new this.ArrayType(this.data,P+l+n,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(P+o+l+n),this.ids=new this.IndexArrayType(this.data,P,t),this.coords=new this.ArrayType(this.data,P+l+n,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(F<<4)+i]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=e,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return $(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:o,nodeSize:l}=this,n=[0,i.length-1,0],p=[];for(;n.length;){const h=n.pop()||0,c=n.pop()||0,u=n.pop()||0;if(c-u<=l){for(let g=u;g<=c;g++){const y=o[2*g],w=o[2*g+1];y>=t&&y<=r&&w>=e&&w<=s&&p.push(i[g])}continue}const d=u+c>>1,f=o[2*d],m=o[2*d+1];f>=t&&f<=r&&m>=e&&m<=s&&p.push(i[d]),(h===0?t<=f:e<=m)&&(n.push(u),n.push(d-1),n.push(1-h)),(h===0?r>=f:s>=m)&&(n.push(d+1),n.push(c),n.push(1-h))}return p}within(t,e,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:i,nodeSize:o}=this,l=[0,s.length-1,0],n=[],p=r*r;for(;l.length;){const h=l.pop()||0,c=l.pop()||0,u=l.pop()||0;if(c-u<=o){for(let g=u;g<=c;g++)X(i[2*g],i[2*g+1],t,e)<=p&&n.push(s[g]);continue}const d=u+c>>1,f=i[2*d],m=i[2*d+1];X(f,m,t,e)<=p&&n.push(s[d]),(h===0?t-r<=f:e-r<=m)&&(l.push(u),l.push(d-1),l.push(1-h)),(h===0?t+r>=f:e+r>=m)&&(l.push(d+1),l.push(c),l.push(1-h))}return n}}function $(a,t,e,r,s,i){if(s-r<=e)return;const o=r+s>>1;et(a,t,o,r,s,i),$(a,t,e,r,o-1,1-i),$(a,t,e,o+1,s,1-i)}function et(a,t,e,r,s,i){for(;s>r;){if(s-r>600){const p=s-r+1,h=e-r+1,c=Math.log(p),u=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*u*(p-u)/p)*(h-p/2<0?-1:1),f=Math.max(r,Math.floor(e-h*u/p+d)),m=Math.min(s,Math.floor(e+(p-h)*u/p+d));et(a,t,e,f,m,i)}const o=t[2*e+i];let l=r,n=s;for(L(a,t,r,e),t[2*s+i]>o&&L(a,t,r,s);l<n;){for(L(a,t,l,n),l++,n--;t[2*l+i]<o;)l++;for(;t[2*n+i]>o;)n--}t[2*r+i]===o?L(a,t,r,n):(n++,L(a,t,n,s)),n<=e&&(r=n+1),e<=n&&(s=n-1)}}function L(a,t,e,r){Z(a,e,r),Z(t,2*e,2*r),Z(t,2*e+1,2*r+1)}function Z(a,t,e){const r=a[t];a[t]=a[e],a[e]=r}function X(a,t,e,r){const s=a-e,i=t-r;return s*s+i*i}const wt={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:a=>a},Y=Math.fround||(a=>t=>(a[0]=+t,a[0]))(new Float32Array(1)),A=2,b=3,U=4,M=5,rt=6;class kt{constructor(t){this.options=Object.assign(Object.create(wt),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:e,minZoom:r,maxZoom:s}=this.options;e&&console.time("total time");const i=`prepare ${t.length} points`;e&&console.time(i),this.points=t;const o=[];for(let n=0;n<t.length;n++){const p=t[n];if(!p.geometry)continue;const[h,c]=p.geometry.coordinates,u=Y(j(h)),d=Y(R(c));o.push(u,d,1/0,n,-1,1),this.options.reduce&&o.push(0)}let l=this.trees[s+1]=this._createTree(o);e&&console.timeEnd(i);for(let n=s;n>=r;n--){const p=+Date.now();l=this.trees[n]=this._createTree(this._cluster(l,n)),e&&console.log("z%d: %d clusters in %dms",n,l.numItems,+Date.now()-p)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let r=((t[0]+180)%360+360)%360-180;const s=Math.max(-90,Math.min(90,t[1]));let i=t[2]===180?180:((t[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,i=180;else if(r>i){const c=this.getClusters([r,s,180,o],e),u=this.getClusters([-180,s,i,o],e);return c.concat(u)}const l=this.trees[this._limitZoom(e)],n=l.range(j(r),R(o),j(i),R(s)),p=l.data,h=[];for(const c of n){const u=this.stride*c;h.push(p[u+M]>1?Q(p,u,this.clusterProps):this.points[p[u+b]])}return h}getChildren(t){const e=this._getOriginId(t),r=this._getOriginZoom(t),s="No cluster with the specified id.",i=this.trees[r];if(!i)throw new Error(s);const o=i.data;if(e*this.stride>=o.length)throw new Error(s);const l=this.options.radius/(this.options.extent*Math.pow(2,r-1)),n=o[e*this.stride],p=o[e*this.stride+1],h=i.within(n,p,l),c=[];for(const u of h){const d=u*this.stride;o[d+U]===t&&c.push(o[d+M]>1?Q(o,d,this.clusterProps):this.points[o[d+b]])}if(c.length===0)throw new Error(s);return c}getLeaves(t,e,r){e=e||10,r=r||0;const s=[];return this._appendLeaves(s,t,e,r,0),s}getTile(t,e,r){const s=this.trees[this._limitZoom(t)],i=Math.pow(2,t),{extent:o,radius:l}=this.options,n=l/o,p=(r-n)/i,h=(r+1+n)/i,c={features:[]};return this._addTileFeatures(s.range((e-n)/i,p,(e+1+n)/i,h),s.data,e,r,i,c),e===0&&this._addTileFeatures(s.range(1-n/i,p,1,h),s.data,i,r,i,c),e===i-1&&this._addTileFeatures(s.range(0,p,n/i,h),s.data,-1,r,i,c),c.features.length?c:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const r=this.getChildren(t);if(e++,r.length!==1)break;t=r[0].properties.cluster_id}return e}_appendLeaves(t,e,r,s,i){const o=this.getChildren(e);for(const l of o){const n=l.properties;if(n&&n.cluster?i+n.point_count<=s?i+=n.point_count:i=this._appendLeaves(t,n.cluster_id,r,s,i):i<s?i++:t.push(l),t.length===r)break}return i}_createTree(t){const e=new z(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let r=0;r<t.length;r+=this.stride)e.add(t[r],t[r+1]);return e.finish(),e.data=t,e}_addTileFeatures(t,e,r,s,i,o){for(const l of t){const n=l*this.stride,p=e[n+M]>1;let h,c,u;if(p)h=st(e,n,this.clusterProps),c=e[n],u=e[n+1];else{const m=this.points[e[n+b]];h=m.properties;const[g,y]=m.geometry.coordinates;c=j(g),u=R(y)}const d={type:1,geometry:[[Math.round(this.options.extent*(c*i-r)),Math.round(this.options.extent*(u*i-s))]],tags:h};let f;p||this.options.generateId?f=e[n+b]:f=this.points[e[n+b]].id,f!==void 0&&(d.id=f),o.features.push(d)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,e){const{radius:r,extent:s,reduce:i,minPoints:o}=this.options,l=r/(s*Math.pow(2,e)),n=t.data,p=[],h=this.stride;for(let c=0;c<n.length;c+=h){if(n[c+A]<=e)continue;n[c+A]=e;const u=n[c],d=n[c+1],f=t.within(n[c],n[c+1],l),m=n[c+M];let g=m;for(const y of f){const w=y*h;n[w+A]>e&&(g+=n[w+M])}if(g>m&&g>=o){let y=u*m,w=d*m,k,I=-1;const E=((c/h|0)<<5)+(e+1)+this.points.length;for(const D of f){const _=D*h;if(n[_+A]<=e)continue;n[_+A]=e;const K=n[_+M];y+=n[_]*K,w+=n[_+1]*K,n[_+U]=E,i&&(k||(k=this._map(n,c,!0),I=this.clusterProps.length,this.clusterProps.push(k)),i(k,this._map(n,_)))}n[c+U]=E,p.push(y/g,w/g,1/0,E,-1,g),i&&p.push(I)}else{for(let y=0;y<h;y++)p.push(n[c+y]);if(g>1)for(const y of f){const w=y*h;if(!(n[w+A]<=e)){n[w+A]=e;for(let k=0;k<h;k++)p.push(n[w+k])}}}}return p}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e,r){if(t[e+M]>1){const o=this.clusterProps[t[e+rt]];return r?Object.assign({},o):o}const s=this.points[t[e+b]].properties,i=this.options.map(s);return r&&i===s?Object.assign({},i):i}}function Q(a,t,e){return{type:"Feature",id:a[t+b],properties:st(a,t,e),geometry:{type:"Point",coordinates:[vt(a[t]),Mt(a[t+1])]}}}function st(a,t,e){const r=a[t+M],s=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?`${Math.round(r/100)/10}k`:r,i=a[t+rt],o=i===-1?{}:Object.assign({},e[i]);return Object.assign(o,{cluster:!0,cluster_id:a[t+b],point_count:r,point_count_abbreviated:s})}function j(a){return a/360+.5}function R(a){const t=Math.sin(a*Math.PI/180),e=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return e<0?0:e>1?1:e}function vt(a){return(a-.5)*360}function Mt(a){const t=(180-a*360)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function bt(a,t){var e={};for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&t.indexOf(r)<0&&(e[r]=a[r]);if(a!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(a);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(a,r[s])&&(e[r[s]]=a[r[s]]);return e}class v{static isAdvancedMarkerAvailable(t){return google.maps.marker&&t.getMapCapabilities().isAdvancedMarkersAvailable===!0}static isAdvancedMarker(t){return google.maps.marker&&t instanceof google.maps.marker.AdvancedMarkerElement}static setMap(t,e){this.isAdvancedMarker(t)?t.map=e:t.setMap(e)}static getPosition(t){if(this.isAdvancedMarker(t)){if(t.position){if(t.position instanceof google.maps.LatLng)return t.position;if(t.position.lat&&t.position.lng)return new google.maps.LatLng(t.position.lat,t.position.lng)}return new google.maps.LatLng(null)}return t.getPosition()}static getVisible(t){return this.isAdvancedMarker(t)?!0:t.getVisible()}}class B{constructor({markers:t,position:e}){this.markers=t,e&&(e instanceof google.maps.LatLng?this._position=e:this._position=new google.maps.LatLng(e))}get bounds(){if(this.markers.length===0&&!this._position)return;const t=new google.maps.LatLngBounds(this._position,this._position);for(const e of this.markers)t.extend(v.getPosition(e));return t}get position(){return this._position||this.bounds.getCenter()}get count(){return this.markers.filter(t=>v.getVisible(t)).length}push(t){this.markers.push(t)}delete(){this.marker&&(v.setMap(this.marker,null),this.marker=void 0),this.markers.length=0}}class Et{constructor({maxZoom:t=16}){this.maxZoom=t}noop({markers:t}){return _t(t)}}const _t=a=>a.map(e=>new B({position:v.getPosition(e),markers:[e]}));class At extends Et{constructor(t){var{maxZoom:e,radius:r=60}=t,s=bt(t,["maxZoom","radius"]);super({maxZoom:e}),this.state={zoom:-1},this.superCluster=new kt(Object.assign({maxZoom:this.maxZoom,radius:r},s))}calculate(t){let e=!1;const r={zoom:t.map.getZoom()};if(!H(t.markers,this.markers)){e=!0,this.markers=[...t.markers];const s=this.markers.map(i=>{const o=v.getPosition(i);return{type:"Feature",geometry:{type:"Point",coordinates:[o.lng(),o.lat()]},properties:{marker:i}}});this.superCluster.load(s)}return e||(this.state.zoom<=this.maxZoom||r.zoom<=this.maxZoom)&&(e=!H(this.state,r)),this.state=r,e&&(this.clusters=this.cluster(t)),{clusters:this.clusters,changed:e}}cluster({map:t}){return this.superCluster.getClusters([-180,-90,180,90],Math.round(t.getZoom())).map(e=>this.transformCluster(e))}transformCluster({geometry:{coordinates:[t,e]},properties:r}){if(r.cluster)return new B({markers:this.superCluster.getLeaves(r.cluster_id,1/0).map(i=>i.properties.marker),position:{lat:e,lng:t}});const s=r.marker;return new B({markers:[s],position:v.getPosition(s)})}}class Ct{constructor(t,e){this.markers={sum:t.length};const r=e.map(i=>i.count),s=r.reduce((i,o)=>i+o,0);this.clusters={count:e.length,markers:{mean:s/e.length,sum:s,min:Math.min(...r),max:Math.max(...r)}}}}class xt{render({count:t,position:e},r,s){const o=`<svg fill="${t>Math.max(10,r.clusters.markers.mean)?"#ff0000":"#0000ff"}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240" width="50" height="50">
<circle cx="120" cy="120" opacity=".6" r="70" />
<circle cx="120" cy="120" opacity=".3" r="90" />
<circle cx="120" cy="120" opacity=".2" r="110" />
<text x="50%" y="50%" style="fill:#fff" text-anchor="middle" font-size="50" dominant-baseline="middle" font-family="roboto,arial,sans-serif">${t}</text>
</svg>`,l=`Cluster of ${t} markers`,n=Number(google.maps.Marker.MAX_ZINDEX)+t;if(v.isAdvancedMarkerAvailable(s)){const c=new DOMParser().parseFromString(o,"image/svg+xml").documentElement;c.setAttribute("transform","translate(0 25)");const u={map:s,position:e,zIndex:n,title:l,content:c};return new google.maps.marker.AdvancedMarkerElement(u)}const p={position:e,zIndex:n,title:l,icon:{url:`data:image/svg+xml;base64,${btoa(o)}`,anchor:new google.maps.Point(25,25)}};return new google.maps.Marker(p)}}function It(a,t){for(let e in t.prototype)a.prototype[e]=t.prototype[e]}class G{constructor(){It(G,google.maps.OverlayView)}}var T;(function(a){a.CLUSTERING_BEGIN="clusteringbegin",a.CLUSTERING_END="clusteringend",a.CLUSTER_CLICK="click"})(T||(T={}));const Ot=(a,t,e)=>{e.fitBounds(t.bounds)};class St extends G{constructor({map:t,markers:e=[],algorithmOptions:r={},algorithm:s=new At(r),renderer:i=new xt,onClusterClick:o=Ot}){super(),this.markers=[...e],this.clusters=[],this.algorithm=s,this.renderer=i,this.onClusterClick=o,t&&this.setMap(t)}addMarker(t,e){this.markers.includes(t)||(this.markers.push(t),e||this.render())}addMarkers(t,e){t.forEach(r=>{this.addMarker(r,!0)}),e||this.render()}removeMarker(t,e){const r=this.markers.indexOf(t);return r===-1?!1:(v.setMap(t,null),this.markers.splice(r,1),e||this.render(),!0)}removeMarkers(t,e){let r=!1;return t.forEach(s=>{r=this.removeMarker(s,!0)||r}),r&&!e&&this.render(),r}clearMarkers(t){this.markers.length=0,t||this.render()}render(){const t=this.getMap();if(t instanceof google.maps.Map&&t.getProjection()){google.maps.event.trigger(this,T.CLUSTERING_BEGIN,this);const{clusters:e,changed:r}=this.algorithm.calculate({markers:this.markers,map:t,mapCanvasProjection:this.getProjection()});if(r||r==null){const s=new Set;for(const o of e)o.markers.length==1&&s.add(o.markers[0]);const i=[];for(const o of this.clusters)o.marker!=null&&(o.markers.length==1?s.has(o.marker)||v.setMap(o.marker,null):i.push(o.marker));this.clusters=e,this.renderClusters(),requestAnimationFrame(()=>i.forEach(o=>v.setMap(o,null)))}google.maps.event.trigger(this,T.CLUSTERING_END,this)}}onAdd(){this.idleListener=this.getMap().addListener("idle",this.render.bind(this)),this.render()}onRemove(){google.maps.event.removeListener(this.idleListener),this.reset()}reset(){this.markers.forEach(t=>v.setMap(t,null)),this.clusters.forEach(t=>t.delete()),this.clusters=[]}renderClusters(){const t=new Ct(this.markers,this.clusters),e=this.getMap();this.clusters.forEach(r=>{r.markers.length===1?r.marker=r.markers[0]:(r.marker=this.renderer.render(r,t,e),r.markers.forEach(s=>v.setMap(s,null)),this.onClusterClick&&r.marker.addListener("click",s=>{google.maps.event.trigger(this,T.CLUSTER_CLICK,r),this.onClusterClick(s,r,e)})),v.setMap(r.marker,e)})}}const Pt=at(`${pt}`),Lt=ct`
    :host {
        display: block;
    }

    #map {
        border-radius: var(--sbkBannerBoxBorderRadiusLg);

        .gm-style-iw-d {
            font: var(--sbkTypographyContentSmallScrBodyRegularXs);
            @media all and (min-width: ${Pt}) {
                font: var(--sbkTypographyContentLargeScrBodyRegularXs);
            }

            p {
                margin: 0 0 var(--sbkTypographySmallScr2xs);
            }
            
            .section--no-padding {
                margin: 0 0 var(--sbkTypographySmallScr2xs);
                p {
                    margin: 0;
                }
            }
        }
    }
`;var Tt=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,S=(a,t,e,r)=>{for(var s=r>1?void 0:r?jt(t,e):t,i=a.length-1,o;i>=0;i--)(o=a[i])&&(s=(r?o(t,e,s):o(s))||s);return r&&s&&Tt(t,e,s),s};let x=class extends lt{constructor(){super(),this.mapId="",this.markers="",this.zoom=15,this._onCookiesAccepted=()=>{this.cookiesAccepted=!0},this.cookiesAccepted=ut.isCookieConsentLoaded()}connectedCallback(){super.connectedCallback(),document.addEventListener("third-party-cookies-accepted",this._onCookiesAccepted)}disconnectedCallback(){document.removeEventListener("third-party-cookies-accepted",this._onCookiesAccepted),super.disconnectedCallback()}render(){return this.cookiesAccepted?q`
            <div id="map" @load=${this.initializeMap} class="googleMaps cookie-consent-iframe" style="width: 100%;height: 400px"></div>
        `:q`
            <sbk-cookie-overlay></sbk-cookie-overlay>
        `}static get styles(){return[Lt]}updated(a){a.has("cookiesAccepted")&&this._map&&this.initializeMap()}initializeMap(){new C({apiKey:"AIzaSyBw4heb8V5yMdNPkyp2UdB553qx0CsmOcI",version:"weekly"}).load().then(async()=>{const{Map:t,InfoWindow:e}=await google.maps.importLibrary("maps"),{AdvancedMarkerElement:r,PinElement:s}=await google.maps.importLibrary("marker"),i=this.mapId?this.mapId:"SBK_MAP_ID",o=new t(this._map,{zoom:11,mapTypeId:google.maps.MapTypeId.ROADMAP,mapId:i}),l=new e({content:"",maxWidth:300}),n=new google.maps.LatLngBounds,h=JSON.parse(this.markers).map(c=>{const u=new google.maps.LatLng({lat:parseFloat(c.lat),lng:parseFloat(c.lng)}),d=new s({background:tt,glyphColor:V,borderColor:V}),f=new r({position:u,content:d.element});return f.addListener("click",()=>{l.setContent(c.content),l.open(o,f)}),n.extend(u),f});new St({markers:h,map:o,renderer:new Rt}),o.setCenter(n.getCenter()),o.setZoom(this.zoom)})}};S([ot("#map")],x.prototype,"_map",2);S([N({attribute:"map-id"})],x.prototype,"mapId",2);S([N()],x.prototype,"markers",2);S([N({type:Number})],x.prototype,"zoom",2);S([nt()],x.prototype,"cookiesAccepted",2);x=S([it("sbk-map")],x);class Rt{render({count:t,position:e}){const r=tt,s=window.btoa(`
        <svg fill="${r}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240">
          <circle cx="120" cy="120" opacity="1" r="70" />
          <circle cx="120" cy="120" opacity=".5" r="90" />
          <circle cx="120" cy="120" opacity=".3" r="110" />
          <circle cx="120" cy="120" opacity=".1" r="130" />
        </svg>`);return new google.maps.Marker({position:e,icon:{url:`data:image/svg+xml;base64,${s}`,scaledSize:new google.maps.Size(45,45)},label:{text:String(t),color:"rgba(255,255,255,0.9)",fontSize:"12px"},zIndex:1e3+t})}}
//# sourceMappingURL=map-BqeXJeV5.js.map