@local-logic/sdks-app 1.7.1 → 2.0.0
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/dist/assets/{index-legacy.9e6e31fb.js → index-legacy.5b5c89be.js} +1 -1
- package/dist/assets/{index-legacy.8a8cb342.js → index-legacy.6f7be327.js} +1 -1
- package/dist/assets/index-legacy.873d2f5f.js +1 -0
- package/dist/assets/{index-legacy.93d69255.js → index-legacy.8b48df8f.js} +1 -1
- package/dist/assets/index-legacy.a2e5122a.js +23 -0
- package/dist/assets/{index-legacy.46f64d17.js → index-legacy.b4a1ea09.js} +1 -1
- package/dist/assets/index-legacy.e333988e.js +106 -0
- package/dist/assets/index.1b34a15d.js +35 -0
- package/dist/assets/index.24661964.js +247 -0
- package/dist/assets/index.3039bacf.js +161 -0
- package/dist/assets/index.3eec99ca.js +1318 -0
- package/dist/assets/index.77b51154.js +1 -0
- package/dist/assets/index.aae000f4.js +1 -0
- package/dist/assets/{index.fb08bd56.js → index.d89a7cee.js} +1 -1
- package/dist/assets/polyfills-legacy.db2bc606.js +1 -0
- package/dist/assets/{useIsMobile-legacy.cb5792f6.js → useIsMobile-legacy.7fb572d8.js} +1 -1
- package/dist/assets/{useIsMobile.8a6bbdf7.js → useIsMobile.b5e8d9ad.js} +1 -1
- package/dist/assets/{useQuery-legacy.9e74d2d1.js → useQuery-legacy.7e93cb2c.js} +1 -1
- package/dist/assets/useQuery.19a6ca1c.js +9 -0
- package/dist/index.html +3 -3
- package/dist/types/context/languageProvider/data-explorer/locales/en/index.d.ts.map +1 -1
- package/dist/types/context/languageProvider/data-explorer/locales/en/index.js +2 -0
- package/dist/types/context/languageProvider/data-explorer/locales/en/index.js.map +1 -1
- package/dist/types/context/languageProvider/data-explorer/locales/fr/index.d.ts.map +1 -1
- package/dist/types/context/languageProvider/data-explorer/locales/fr/index.js +2 -0
- package/dist/types/context/languageProvider/data-explorer/locales/fr/index.js.map +1 -1
- package/dist/types/context/languageProvider/data-explorer/types.d.ts +2 -2
- package/dist/types/context/languageProvider/data-explorer/types.d.ts.map +1 -1
- package/dist/types/context/languageProvider/index.d.ts +2 -2
- package/dist/types/context/languageProvider/index.d.ts.map +1 -1
- package/dist/types/features/calculateRoute/useCommute.js +2 -2
- package/dist/types/features/calculateRoute/useCommute.js.map +1 -1
- package/dist/types/features/reverse-geocodes/useReverseGeocodes.js +2 -2
- package/dist/types/features/reverse-geocodes/useReverseGeocodes.js.map +1 -1
- package/dist/types/main.d.ts +1 -1
- package/dist/types/main.d.ts.map +1 -1
- package/dist/types/main.js +2 -13
- package/dist/types/main.js.map +1 -1
- package/dist/types/sdks/DataExplorer/components/Table/index.d.ts +4 -0
- package/dist/types/sdks/DataExplorer/components/Table/index.d.ts.map +1 -0
- package/dist/types/sdks/DataExplorer/components/Table/index.js +65 -0
- package/dist/types/sdks/DataExplorer/components/Table/index.js.map +1 -0
- package/dist/types/sdks/DataExplorer/components/Table/styles.d.ts +6 -0
- package/dist/types/sdks/DataExplorer/components/Table/styles.d.ts.map +1 -0
- package/dist/types/sdks/DataExplorer/components/Table/styles.js +27 -0
- package/dist/types/sdks/DataExplorer/components/Table/styles.js.map +1 -0
- package/dist/types/sdks/DataExplorer/context.d.ts +3 -0
- package/dist/types/sdks/DataExplorer/context.d.ts.map +1 -1
- package/dist/types/sdks/DataExplorer/context.js +3 -0
- package/dist/types/sdks/DataExplorer/context.js.map +1 -1
- package/dist/types/sdks/DataExplorer/index.d.ts.map +1 -1
- package/dist/types/sdks/DataExplorer/index.js +8 -0
- package/dist/types/sdks/DataExplorer/index.js.map +1 -1
- package/dist/types/sdks/Demographics/components/Content/Household/index.d.ts.map +1 -1
- package/dist/types/sdks/Demographics/components/Content/Household/index.js +2 -1
- package/dist/types/sdks/Demographics/components/Content/Household/index.js.map +1 -1
- package/dist/types/sdks/Demographics/components/Content/Household/styles.d.ts +3 -0
- package/dist/types/sdks/Demographics/components/Content/Household/styles.d.ts.map +1 -0
- package/dist/types/sdks/Demographics/components/Content/Household/styles.js +19 -0
- package/dist/types/sdks/Demographics/components/Content/Household/styles.js.map +1 -0
- package/dist/types/sdks/Demographics/components/Content/Housing/index.d.ts.map +1 -1
- package/dist/types/sdks/Demographics/components/Content/Housing/index.js +10 -7
- package/dist/types/sdks/Demographics/components/Content/Housing/index.js.map +1 -1
- package/dist/types/sdks/Demographics/components/Content/Housing/styles.d.ts +3 -0
- package/dist/types/sdks/Demographics/components/Content/Housing/styles.d.ts.map +1 -0
- package/dist/types/sdks/Demographics/components/Content/Housing/styles.js +12 -0
- package/dist/types/sdks/Demographics/components/Content/Housing/styles.js.map +1 -0
- package/dist/types/sdks/Demographics/components/Content/Languages/index.d.ts +3 -0
- package/dist/types/sdks/Demographics/components/Content/Languages/index.d.ts.map +1 -0
- package/dist/types/sdks/Demographics/components/Content/Languages/index.js +14 -0
- package/dist/types/sdks/Demographics/components/Content/Languages/index.js.map +1 -0
- package/dist/types/sdks/Demographics/components/Content/index.d.ts.map +1 -1
- package/dist/types/sdks/Demographics/components/Content/index.js +3 -0
- package/dist/types/sdks/Demographics/components/Content/index.js.map +1 -1
- package/dist/types/sdks/Demographics/components/Content/styles.js +1 -1
- package/dist/types/sdks/Demographics/components/Content/styles.js.map +1 -1
- package/dist/types/sdks/Demographics/context.d.ts +3 -0
- package/dist/types/sdks/Demographics/context.d.ts.map +1 -1
- package/dist/types/sdks/Demographics/context.js.map +1 -1
- package/dist/types/sdks/Demographics/styles.d.ts.map +1 -1
- package/dist/types/sdks/Demographics/styles.js +0 -1
- package/dist/types/sdks/Demographics/styles.js.map +1 -1
- package/dist/types/utils/errorTracker/index.d.ts +23 -0
- package/dist/types/utils/errorTracker/index.d.ts.map +1 -0
- package/dist/types/utils/errorTracker/index.js +100 -0
- package/dist/types/utils/errorTracker/index.js.map +1 -0
- package/package.json +5 -4
- package/dist/assets/index-legacy.02b7ed30.js +0 -1
- package/dist/assets/index-legacy.0500abfa.js +0 -106
- package/dist/assets/index-legacy.4d0178fa.js +0 -1
- package/dist/assets/index.3e70a7fa.js +0 -28
- package/dist/assets/index.414e070d.js +0 -1374
- package/dist/assets/index.630bec89.js +0 -120
- package/dist/assets/index.693f2772.js +0 -247
- package/dist/assets/index.d464e7cf.js +0 -1
- package/dist/assets/index.e63e2d64.js +0 -1
- package/dist/assets/polyfills-legacy.147ba02d.js +0 -1
- package/dist/assets/useQuery.fe83c221.js +0 -9
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import{R as S,r as u,ab as $,u as M,j as s,e as m,ac as d,s as l,C as i,c as D,p as w,G as _,ad as c,o as R,l as j,U as H}from"./index.3eec99ca.js";import{u as E}from"./useIsMobile.b5e8d9ad.js";import{d as I}from"./keyFactory.e1cd5707.js";import{u as P}from"./useQuery.19a6ca1c.js";const C=S.createContext({}),r=()=>u.exports.useContext(C),T=({children:a})=>{var v,b;const t=E(),[e,n]=u.exports.useState($[0].value),{sdkState:o}=M(),[p,h]=u.exports.useReducer((g,y)=>({...g,...y}),{location:{lat:((v=o.options)==null?void 0:v.lat)||43.661337,lng:((b=o.options)==null?void 0:b.lng)||-79.401903},demographics:{radius:2500}}),f=u.exports.useMemo(()=>({demographicsState:p,setDemographicsState:h,activeCategory:e,setActiveCategory:n}),[e,n,p,h]),x=g=>{n(g.data)};return s(C.Provider,{value:f,children:m(d.Root,{options:{activeTab:e},onChange:x,children:[t?s(d.Select,{}):s(d.Tabs,{}),a]})})},k=l.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
background-color: ${i["--ll-color-background"]};
|
|
6
|
+
`,G=l.div`
|
|
7
|
+
overflow-y: auto;
|
|
8
|
+
padding: ${i["--ll-spacing-medium"]};
|
|
9
|
+
`,z=()=>{const{translations:a}=D();return s(w,{variant:"h3",weight:"--ll-font-weight-bold",children:a.DEMOGRAPHICS_TITLE})},A=l.div`
|
|
10
|
+
margin: ${i["--ll-spacing-xx-small"]} 0;
|
|
11
|
+
`;l.div`
|
|
12
|
+
display: flex;
|
|
13
|
+
padding: ${i["--ll-spacing-x-small"]} ${i["--ll-spacing-medium"]}
|
|
14
|
+
${i["--ll-spacing-xx-small"]} ${i["--ll-spacing-medium"]};
|
|
15
|
+
`;const O=l.div`
|
|
16
|
+
height: 40px;
|
|
17
|
+
display: flex;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
align-items: center;
|
|
20
|
+
margin-right: ${i["--ll-spacing-medium"]};
|
|
21
|
+
`;function U({lat:a,lng:t,radius:e}){const{client:n}=_(),o={lat:a,lng:t,radius:e};return P(I.list(o),async()=>n.getDemographics(o),{enabled:!!o})}const B=()=>{const{demographicsState:{income:a}}=r();return s(c.AvgIncomeCard,{options:{incomeTypes:(a==null?void 0:a.variables)||[]}})},J=()=>{const{demographicsState:{population_age:a}}=r();return s(c.PopulationByAgeChart,{options:{labels:(a==null?void 0:a.variables.map(t=>t.label))||[],data:(a==null?void 0:a.variables.map(t=>Math.round(t.value*100)))||[]}})},K=l.div`
|
|
22
|
+
display: flex;
|
|
23
|
+
justify-content: space-between;
|
|
24
|
+
gap: ${i["--ll-spacing-medium"]};
|
|
25
|
+
|
|
26
|
+
@media (max-width: ${R.screenSizes.tablet}px) {
|
|
27
|
+
flex-wrap: wrap;
|
|
28
|
+
}
|
|
29
|
+
`,L=()=>{const{demographicsState:{housing_tenancy:a,housing_type:t}}=r();return s(K,{children:s(c.OwnersRentersCard,{options:{datasets:(a==null?void 0:a.variables.map(e=>({label:e.label,data:Math.round(e.value*100)})))||[]}})})},Q=()=>{const{demographicsState:{household_composition:a,family_composition:t}}=r(),e=a==null?void 0:a.variables.map(n=>({...n,value:Math.round(n.value*100)})).filter(n=>Math.round(n.value*100)>0);return s(c.HouseholdCompositionCard,{options:{labels:(e==null?void 0:e.map(n=>`${n.value}% ${n.label}`))||[],data:(e==null?void 0:e.map(n=>n.value))||[]}})},V=()=>{const{demographicsState:{commute_mode:a}}=r(),t=a==null?void 0:a.variables.map(e=>({...e,value:Math.round(e.value*100)})).filter(e=>Math.round(e.value*100)>0);return s(c.CommuteModeCard,{options:{labels:(t==null?void 0:t.map(e=>`${e.value}% ${e.label}`))||[],data:(t==null?void 0:t.map(e=>e.value))||[]}})},q=()=>{const{demographicsState:{education_level:a}}=r();return s(c.EducationLevelChart,{options:{labels:(a==null?void 0:a.variables.map(t=>t.label))||[],data:(a==null?void 0:a.variables.map(t=>Math.round(t.value*100)))||[]}})},N=()=>{const{demographicsState:{mother_tongue:a}}=r(),t=a==null?void 0:a.variables.map(e=>({...e,value:Math.round(e.value*100)})).filter(e=>e.value>0);return s(c.MotherTongueChart,{options:{labels:(t==null?void 0:t.map(e=>e.label))||[],data:(t==null?void 0:t.map(e=>e.value))||[]}})},W=()=>{const{demographicsState:a,activeCategory:t,setDemographicsState:e}=r(),{data:n,isFetching:o}=U({lat:a.location.lat,lng:a.location.lng,radius:a.demographics.radius});u.exports.useEffect(()=>{!o&&n&&e({...n})},[o]);const p=()=>{if(o)return s(O,{children:s(j,{})});switch(t){case"income":return s(B,{});case"population":return s(J,{});case"housing":return s(L,{});case"household":return s(Q,{});case"commute":return s(V,{});case"education":return s(q,{});case"languages":return s(N,{});default:return m("div",{children:[t," tab"]})}};return s(A,{children:s(d.Content,{options:{value:t},children:p()})})},X=l.div`
|
|
30
|
+
padding: ${i["--ll-spacing-small"]};
|
|
31
|
+
|
|
32
|
+
a {
|
|
33
|
+
justify-content: end;
|
|
34
|
+
}
|
|
35
|
+
`,Y=()=>s(X,{children:s(H.Root,{})}),ta=()=>s(T,{children:s(k,{children:m(G,{children:[s(z,{}),s(W,{}),s(Y,{})]})})});export{ta as default};
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import{M as Ne,d as ee,p as wt,s as bt,a as je,b as Mt,$ as $t,c as St,e as Lt,f as kt,S as Pt,g as Et,h as At,i as _t,A as It,u as Rt,j as Tt,m as zt,k as Ot,N as Zt,P as Pe}from"./index.d89a7cee.js";import{R as T,r as m,o as Ue,j as a,M as X,G as Ce,u as D,a as xe,Q as W,s as x,m as Dt,C as p,b as Ht,c as se,d as Vt,w as me,I as j,e as L,Z as ue,X as G,n as de,F as J,f as E,K as Y,g as O,O as q,k as Be,q as Fe,J as ge,h as Ke,L as N,i as te,l as Gt,p as K,U as Nt,t as We,v as jt}from"./index.3eec99ca.js";import{u as ve}from"./useIsMobile.b5e8d9ad.js";import{u as ae}from"./useQuery.19a6ca1c.js";const Qe=T.createContext({}),A=()=>m.exports.useContext(Qe),Ut=(t,e)=>{switch(e.type){case"CATEGORY":return{...t,activeCategory:e.value};case"SCORE":{const o=X.find(n=>e.value===""?n.value===t.activeCategory:n.scores.includes(e.value)).value;return{activeCategory:o,activeScoreByCategory:{...t.activeScoreByCategory,[o]:e.value}}}}},Bt=({children:t})=>{const e=window.innerWidth<Ue.screenSizes.tablet?{activeCategory:"commute",activeScoreByCategory:{commute:"transit_friendly",amenities:"groceries",character:"quiet",nature:"parks",education:"primary_schools"}}:{activeCategory:"commute",activeScoreByCategory:{commute:"",amenities:"",character:"",nature:"",education:""}},[o,n]=m.exports.useReducer(Ut,e),[r,s]=m.exports.useState(),[i,c]=m.exports.useState(),[l,u]=m.exports.useState(),[d,h]=m.exports.useState(),[f,g]=m.exports.useState(),[y,M]=m.exports.useState(!1),{activeCategory:C}=o,$=o.activeScoreByCategory[C],b=v=>{n({type:"SCORE",value:v})},w=v=>{n({type:"CATEGORY",value:v})},S=m.exports.useMemo(()=>({activeScore:$,setActiveScore:b,activeCategory:C,setActiveCategory:w,activePOI:r,setActivePOI:s,hoveredPOI:i,setHoveredPOI:c,commuteGeojson:l,setCommuteGeojson:u,destination:f,setDestination:g,showCommuteCalculator:y,setShowCommuteCalculator:M,schoolCatchment:d,setSchoolCatchment:h}),[$,b,C,w,r,s,i,c,l,u,f,g,y,M,d,h]);return a(Qe.Provider,{value:S,children:t})};function re(t,e){if(!t)throw new Error(e)}let Ft=0;function Kt(t,e,o){if(t.style&&t.style._loaded){const n={...o};return delete n.id,delete n.children,t.addSource(e,n),t.getSource(e)}return null}function Wt(t,e,o){re(e.id===o.id,"source id changed"),re(e.type===o.type,"source type changed");let n="",r=0;for(const i in e)i!=="children"&&i!=="id"&&!ee(o[i],e[i])&&(n=i,r++);if(!r)return;const s=e.type;if(s==="geojson")t.setData(e.data);else if(s==="image")t.updateImage({url:e.url,coordinates:e.coordinates});else if((s==="canvas"||s==="video")&&r===1&&n==="coordinates")t.setCoordinates(e.coordinates);else if(s==="vector"&&"setUrl"in t)switch(n){case"url":t.setUrl(e.url);break;case"tiles":t.setTiles(e.tiles);break}else console.warn(`Unable to update <Source> prop: ${n}`)}function Ee(t){const e=m.exports.useContext(Ne).map.getMap(),o=m.exports.useRef(t),[,n]=m.exports.useState(0),r=m.exports.useMemo(()=>t.id||`jsx-source-${Ft++}`,[]);m.exports.useEffect(()=>{if(e){const i=()=>n(c=>c+1);return e.on("styledata",i),i(),()=>{var c;if(e.off("styledata",i),e.style&&e.style._loaded&&e.getSource(r)){const l=(c=e.getStyle())===null||c===void 0?void 0:c.layers;if(l)for(const u of l)u.source===r&&e.removeLayer(u.id);e.removeSource(r)}}}},[e]);let s=e&&e.style&&e.getSource(r);return s?Wt(s,t,o.current):s=Kt(e,r,t),o.current=t,s&&m.exports.Children.map(t.children,i=>i&&m.exports.cloneElement(i,{source:r}))||null}function Qt(t,e,o,n){if(re(o.id===n.id,"layer id changed"),re(o.type===n.type,"layer type changed"),o.type==="custom"||n.type==="custom")return;const{layout:r={},paint:s={},filter:i,minzoom:c,maxzoom:l,beforeId:u}=o;if(u!==n.beforeId&&t.moveLayer(e,u),r!==n.layout){const d=n.layout||{};for(const h in r)ee(r[h],d[h])||t.setLayoutProperty(e,h,r[h]);for(const h in d)r.hasOwnProperty(h)||t.setLayoutProperty(e,h,void 0)}if(s!==n.paint){const d=n.paint||{};for(const h in s)ee(s[h],d[h])||t.setPaintProperty(e,h,s[h]);for(const h in d)s.hasOwnProperty(h)||t.setPaintProperty(e,h,void 0)}ee(i,n.filter)||t.setFilter(e,i),(c!==n.minzoom||l!==n.maxzoom)&&t.setLayerZoomRange(e,c,l)}function Xt(t,e,o){if(t.style&&t.style._loaded&&(!("source"in o)||t.getSource(o.source))){const n={...o,id:e};delete n.beforeId,t.addLayer(n,o.beforeId)}}let Jt=0;function Ae(t){const e=m.exports.useContext(Ne).map.getMap(),o=m.exports.useRef(t),[,n]=m.exports.useState(0),r=m.exports.useMemo(()=>t.id||`jsx-layer-${Jt++}`,[]);if(m.exports.useEffect(()=>{if(e){const i=()=>n(c=>c+1);return e.on("styledata",i),i(),()=>{e.off("styledata",i),e.style&&e.style._loaded&&e.getLayer(r)&&e.removeLayer(r)}}},[e]),e&&e.style&&e.getLayer(r))try{Qt(e,r,t,o.current)}catch(i){console.warn(i)}else Xt(e,r,t);return o.current=t,null}function Xe(t,e,o){o===void 0&&(o={});var n={type:"Feature"};return(o.id===0||o.id)&&(n.id=o.id),o.bbox&&(n.bbox=o.bbox),n.properties=e||{},n.geometry=t,n}function he(t,e,o){if(o===void 0&&(o={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!_e(t[0])||!_e(t[1]))throw new Error("coordinates must contain numbers");var n={type:"Point",coordinates:t};return Xe(n,e,o)}function Yt(t,e,o){o===void 0&&(o={});var n={type:"MultiPoint",coordinates:t};return Xe(n,e,o)}function _e(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function Je(t,e,o){if(t!==null)for(var n,r,s,i,c,l,u,d=0,h=0,f,g=t.type,y=g==="FeatureCollection",M=g==="Feature",C=y?t.features.length:1,$=0;$<C;$++){u=y?t.features[$].geometry:M?t.geometry:t,f=u?u.type==="GeometryCollection":!1,c=f?u.geometries.length:1;for(var b=0;b<c;b++){var w=0,S=0;if(i=f?u.geometries[b]:u,i!==null){l=i.coordinates;var v=i.type;switch(d=o&&(v==="Polygon"||v==="MultiPolygon")?1:0,v){case null:break;case"Point":if(e(l,h,$,w,S)===!1)return!1;h++,w++;break;case"LineString":case"MultiPoint":for(n=0;n<l.length;n++){if(e(l[n],h,$,w,S)===!1)return!1;h++,v==="MultiPoint"&&w++}v==="LineString"&&w++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(r=0;r<l[n].length-d;r++){if(e(l[n][r],h,$,w,S)===!1)return!1;h++}v==="MultiLineString"&&w++,v==="Polygon"&&S++}v==="Polygon"&&w++;break;case"MultiPolygon":for(n=0;n<l.length;n++){for(S=0,r=0;r<l[n].length;r++){for(s=0;s<l[n][r].length-d;s++){if(e(l[n][r][s],h,$,w,S)===!1)return!1;h++}S++}w++}break;case"GeometryCollection":for(n=0;n<i.geometries.length;n++)if(Je(i.geometries[n],e,o)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function fe(t){var e=[1/0,1/0,-1/0,-1/0];return Je(t,function(o){e[0]>o[0]&&(e[0]=o[0]),e[1]>o[1]&&(e[1]=o[1]),e[2]<o[0]&&(e[2]=o[0]),e[3]<o[1]&&(e[3]=o[1])}),e}fe.default=fe;function Ye(){var c;const{client:t}=Ce(),{sdkState:e}=D(),o=xe(e.options,250),{activeScore:n}=A(),r=n?W[n]:void 0,i={...m.exports.useMemo(()=>o!=null&&o.marker?o.marker:{lat:o==null?void 0:o.lat,lng:o==null?void 0:o.lng},[o]),limit:10,radius:2e3,include:r};return ae(wt.list(i),async()=>t.getPois(i),{enabled:!!i&&!!((c=i.include)!=null&&c.length)&&!!i.lat&&!!i.lng})}function qe(){const{client:t}=Ce(),{sdkState:e}=D(),o=xe(e.options,250),{activeScore:n}=A(),r=n==="high_schools"||n==="primary_schools",i={...m.exports.useMemo(()=>o!=null&&o.marker?o.marker:{lat:o==null?void 0:o.lat,lng:o==null?void 0:o.lng},[o]),limit:10,radius:2e3,include_catchments:!1};return ae(bt.list(i),async()=>t.getSchools(i),{enabled:!!i&&!!i.lat&&!!i.lng&&r})}const et=T.createContext({}),tt=()=>m.exports.useContext(et),qt=({children:t,mapRef:e,mapPadding:o})=>a(et.Provider,{value:{mapRef:e,mapPadding:o},children:t});function ye(t,e,o,n,r,s){if(r-n<=o)return;const i=n+r>>1;ot(t,e,i,n,r,s%2),ye(t,e,o,n,i-1,s+1),ye(t,e,o,i+1,r,s+1)}function ot(t,e,o,n,r,s){for(;r>n;){if(r-n>600){const u=r-n+1,d=o-n+1,h=Math.log(u),f=.5*Math.exp(2*h/3),g=.5*Math.sqrt(h*f*(u-f)/u)*(d-u/2<0?-1:1),y=Math.max(n,Math.floor(o-d*f/u+g)),M=Math.min(r,Math.floor(o+(u-d)*f/u+g));ot(t,e,o,y,M,s)}const i=e[2*o+s];let c=n,l=r;for(F(t,e,n,o),e[2*r+s]>i&&F(t,e,n,r);c<l;){for(F(t,e,c,l),c++,l--;e[2*c+s]<i;)c++;for(;e[2*l+s]>i;)l--}e[2*n+s]===i?F(t,e,n,l):(l++,F(t,e,l,r)),l<=o&&(n=l+1),o<=l&&(r=l-1)}}function F(t,e,o,n){pe(t,o,n),pe(e,2*o,2*n),pe(e,2*o+1,2*n+1)}function pe(t,e,o){const n=t[e];t[e]=t[o],t[o]=n}function eo(t,e,o,n,r,s,i){const c=[0,t.length-1,0],l=[];let u,d;for(;c.length;){const h=c.pop(),f=c.pop(),g=c.pop();if(f-g<=i){for(let C=g;C<=f;C++)u=e[2*C],d=e[2*C+1],u>=o&&u<=r&&d>=n&&d<=s&&l.push(t[C]);continue}const y=Math.floor((g+f)/2);u=e[2*y],d=e[2*y+1],u>=o&&u<=r&&d>=n&&d<=s&&l.push(t[y]);const M=(h+1)%2;(h===0?o<=u:n<=d)&&(c.push(g),c.push(y-1),c.push(M)),(h===0?r>=u:s>=d)&&(c.push(y+1),c.push(f),c.push(M))}return l}function to(t,e,o,n,r,s){const i=[0,t.length-1,0],c=[],l=r*r;for(;i.length;){const u=i.pop(),d=i.pop(),h=i.pop();if(d-h<=s){for(let C=h;C<=d;C++)Ie(e[2*C],e[2*C+1],o,n)<=l&&c.push(t[C]);continue}const f=Math.floor((h+d)/2),g=e[2*f],y=e[2*f+1];Ie(g,y,o,n)<=l&&c.push(t[f]);const M=(u+1)%2;(u===0?o-r<=g:n-r<=y)&&(i.push(h),i.push(f-1),i.push(M)),(u===0?o+r>=g:n+r>=y)&&(i.push(f+1),i.push(d),i.push(M))}return c}function Ie(t,e,o,n){const r=t-o,s=e-n;return r*r+s*s}const oo=t=>t[0],no=t=>t[1];class Re{constructor(e,o=oo,n=no,r=64,s=Float64Array){this.nodeSize=r,this.points=e;const i=e.length<65536?Uint16Array:Uint32Array,c=this.ids=new i(e.length),l=this.coords=new s(e.length*2);for(let u=0;u<e.length;u++)c[u]=u,l[2*u]=o(e[u]),l[2*u+1]=n(e[u]);ye(c,l,r,0,c.length-1,0)}range(e,o,n,r){return eo(this.ids,this.coords,e,o,n,r,this.nodeSize)}within(e,o,n){return to(this.ids,this.coords,e,o,n,this.nodeSize)}}const ro={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},ie=Math.fround||(t=>e=>(t[0]=+e,t[0]))(new Float32Array(1));class io{constructor(e){this.options=Q(Object.create(ro),e),this.trees=new Array(this.options.maxZoom+1)}load(e){const{log:o,minZoom:n,maxZoom:r,nodeSize:s}=this.options;o&&console.time("total time");const i=`prepare ${e.length} points`;o&&console.time(i),this.points=e;let c=[];for(let l=0;l<e.length;l++)!e[l].geometry||c.push(ao(e[l],l));this.trees[r+1]=new Re(c,ze,Oe,s,Float32Array),o&&console.timeEnd(i);for(let l=r;l>=n;l--){const u=+Date.now();c=this._cluster(c,l),this.trees[l]=new Re(c,ze,Oe,s,Float32Array),o&&console.log("z%d: %d clusters in %dms",l,c.length,+Date.now()-u)}return o&&console.timeEnd("total time"),this}getClusters(e,o){let n=((e[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,e[1]));let s=e[2]===180?180:((e[2]+180)%360+360)%360-180;const i=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)n=-180,s=180;else if(n>s){const d=this.getClusters([n,r,180,i],o),h=this.getClusters([-180,r,s,i],o);return d.concat(h)}const c=this.trees[this._limitZoom(o)],l=c.range(oe(n),ne(i),oe(s),ne(r)),u=[];for(const d of l){const h=c.points[d];u.push(h.numPoints?Te(h):this.points[h.index])}return u}getChildren(e){const o=this._getOriginId(e),n=this._getOriginZoom(e),r="No cluster with the specified id.",s=this.trees[n];if(!s)throw new Error(r);const i=s.points[o];if(!i)throw new Error(r);const c=this.options.radius/(this.options.extent*Math.pow(2,n-1)),l=s.within(i.x,i.y,c),u=[];for(const d of l){const h=s.points[d];h.parentId===e&&u.push(h.numPoints?Te(h):this.points[h.index])}if(u.length===0)throw new Error(r);return u}getLeaves(e,o,n){o=o||10,n=n||0;const r=[];return this._appendLeaves(r,e,o,n,0),r}getTile(e,o,n){const r=this.trees[this._limitZoom(e)],s=Math.pow(2,e),{extent:i,radius:c}=this.options,l=c/i,u=(n-l)/s,d=(n+1+l)/s,h={features:[]};return this._addTileFeatures(r.range((o-l)/s,u,(o+1+l)/s,d),r.points,o,n,s,h),o===0&&this._addTileFeatures(r.range(1-l/s,u,1,d),r.points,s,n,s,h),o===s-1&&this._addTileFeatures(r.range(0,u,l/s,d),r.points,-1,n,s,h),h.features.length?h:null}getClusterExpansionZoom(e){let o=this._getOriginZoom(e)-1;for(;o<=this.options.maxZoom;){const n=this.getChildren(e);if(o++,n.length!==1)break;e=n[0].properties.cluster_id}return o}_appendLeaves(e,o,n,r,s){const i=this.getChildren(o);for(const c of i){const l=c.properties;if(l&&l.cluster?s+l.point_count<=r?s+=l.point_count:s=this._appendLeaves(e,l.cluster_id,n,r,s):s<r?s++:e.push(c),e.length===n)break}return s}_addTileFeatures(e,o,n,r,s,i){for(const c of e){const l=o[c],u=l.numPoints;let d,h,f;if(u)d=nt(l),h=l.x,f=l.y;else{const M=this.points[l.index];d=M.properties,h=oe(M.geometry.coordinates[0]),f=ne(M.geometry.coordinates[1])}const g={type:1,geometry:[[Math.round(this.options.extent*(h*s-n)),Math.round(this.options.extent*(f*s-r))]],tags:d};let y;u?y=l.id:this.options.generateId?y=l.index:this.points[l.index].id&&(y=this.points[l.index].id),y!==void 0&&(g.id=y),i.features.push(g)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,o){const n=[],{radius:r,extent:s,reduce:i,minPoints:c}=this.options,l=r/(s*Math.pow(2,o));for(let u=0;u<e.length;u++){const d=e[u];if(d.zoom<=o)continue;d.zoom=o;const h=this.trees[o+1],f=h.within(d.x,d.y,l),g=d.numPoints||1;let y=g;for(const M of f){const C=h.points[M];C.zoom>o&&(y+=C.numPoints||1)}if(y>g&&y>=c){let M=d.x*g,C=d.y*g,$=i&&g>1?this._map(d,!0):null;const b=(u<<5)+(o+1)+this.points.length;for(const w of f){const S=h.points[w];if(S.zoom<=o)continue;S.zoom=o;const v=S.numPoints||1;M+=S.x*v,C+=S.y*v,S.parentId=b,i&&($||($=this._map(d,!0)),i($,this._map(S)))}d.parentId=b,n.push(so(M/y,C/y,b,y,$))}else if(n.push(d),y>1)for(const M of f){const C=h.points[M];C.zoom<=o||(C.zoom=o,n.push(C))}}return n}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,o){if(e.numPoints)return o?Q({},e.properties):e.properties;const n=this.points[e.index].properties,r=this.options.map(n);return o&&r===n?Q({},r):r}}function so(t,e,o,n,r){return{x:ie(t),y:ie(e),zoom:1/0,id:o,parentId:-1,numPoints:n,properties:r}}function ao(t,e){const[o,n]=t.geometry.coordinates;return{x:ie(oe(o)),y:ie(ne(n)),zoom:1/0,index:e,parentId:-1}}function Te(t){return{type:"Feature",id:t.id,properties:nt(t),geometry:{type:"Point",coordinates:[lo(t.x),co(t.y)]}}}function nt(t){const e=t.numPoints,o=e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?`${Math.round(e/100)/10}k`:e;return Q(Q({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:o})}function oe(t){return t/360+.5}function ne(t){const e=Math.sin(t*Math.PI/180),o=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return o<0?0:o>1?1:o}function lo(t){return(t-.5)*360}function co(t){const e=(180-t*360)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function Q(t,e){for(const o in e)t[o]=e[o];return t}function ze(t){return t.x}function Oe(t){return t.y}var Ze=Object.prototype.hasOwnProperty;function De(t,e,o){for(o of t.keys())if(H(o,e))return o}function H(t,e){var o,n,r;if(t===e)return!0;if(t&&e&&(o=t.constructor)===e.constructor){if(o===Date)return t.getTime()===e.getTime();if(o===RegExp)return t.toString()===e.toString();if(o===Array){if((n=t.length)===e.length)for(;n--&&H(t[n],e[n]););return n===-1}if(o===Set){if(t.size!==e.size)return!1;for(n of t)if(r=n,r&&typeof r=="object"&&(r=De(e,r),!r)||!e.has(r))return!1;return!0}if(o===Map){if(t.size!==e.size)return!1;for(n of t)if(r=n[0],r&&typeof r=="object"&&(r=De(e,r),!r)||!H(n[1],e.get(r)))return!1;return!0}if(o===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(o===DataView){if((n=t.byteLength)===e.byteLength)for(;n--&&t.getInt8(n)===e.getInt8(n););return n===-1}if(ArrayBuffer.isView(t)){if((n=t.byteLength)===e.byteLength)for(;n--&&t[n]===e[n];);return n===-1}if(!o||typeof t=="object"){n=0;for(o in t)if(Ze.call(t,o)&&++n&&!Ze.call(e,o)||!(o in e)||!H(t[o],e[o]))return!1;return Object.keys(e).length===n}}return t!==t&&e!==e}function uo(t){var e=m.exports.useRef(t),o=m.exports.useRef(0);return H(t,e.current)||(e.current=t,o.current+=1),m.exports.useMemo(function(){return e.current},[o.current])}function ho(t,e){return m.exports.useEffect(t,uo(e))}var po=function(e){var o=e.points,n=e.bounds,r=e.zoom,s=e.options,i=m.exports.useRef(),c=m.exports.useRef(),l=m.exports.useState([]),u=l[0],d=l[1],h=Math.round(r);return ho(function(){(!i.current||!H(c.current,o)||!H(i.current.options,s))&&(i.current=new io(s),i.current.load(o)),n&&d(i.current.getClusters(n,h)),c.current=o},[o,n,h,s]),{clusters:u,supercluster:i.current}};const mo=x(Dt.div)`
|
|
2
|
+
border-radius: 50%;
|
|
3
|
+
background: linear-gradient(
|
|
4
|
+
to top,
|
|
5
|
+
${p["--ll-color-primary-variant1"]},
|
|
6
|
+
${p["--ll-color-primary"]}
|
|
7
|
+
);
|
|
8
|
+
color: ${p["--ll-color-on-primary"]};
|
|
9
|
+
height: ${({diameter:t})=>t}px;
|
|
10
|
+
width: ${({diameter:t})=>t}px;
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
line-height: 1;
|
|
15
|
+
font-family: ${p["--ll-font-family"]};
|
|
16
|
+
font-size: ${({diameter:t})=>t/2.5}px;
|
|
17
|
+
border: 2px solid #fff;
|
|
18
|
+
box-shadow: ${p["--ll-shadow-small"]};
|
|
19
|
+
cursor: default;
|
|
20
|
+
`,go=x.ul`
|
|
21
|
+
list-style: none;
|
|
22
|
+
padding: 0;
|
|
23
|
+
margin: 0;
|
|
24
|
+
`,fo=x.li`
|
|
25
|
+
font-family: ${p["--ll-font-family"]};
|
|
26
|
+
padding: ${p["--ll-spacing-x-small"]};
|
|
27
|
+
background-color: ${p["--ll-color-background"]};
|
|
28
|
+
border-radius: ${p["--ll-border-radius-small"]};
|
|
29
|
+
border: 1px solid ${p["--ll-color-border"]};
|
|
30
|
+
cursor: default;
|
|
31
|
+
|
|
32
|
+
&:not(:last-child) {
|
|
33
|
+
margin-bottom: ${p["--ll-spacing-xx-small"]};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&:hover {
|
|
37
|
+
background-color: ${p["--ll-color-surface"]};
|
|
38
|
+
}
|
|
39
|
+
`,rt={all:()=>["commute-calculator"],list:t=>[...rt.all(),t]},yo="https://router.hereapi.com/v8/routes?";function it({transportMode:t,origin:e,destination:o,isOpen:n}){const r={return:"polyline,summary,typicalDuration",transportMode:t,origin:e,destination:`${o==null?void 0:o.lat},${o==null?void 0:o.lng}`,apiKey:"KDL0aAzsbOcv7p53P2ovno2izfDOe93hyzZRrayktbE"},s=()=>fetch(yo+new URLSearchParams(r)).then(i=>i.json()).then(i=>i.routes.length>0&&i.routes[0].sections.length>0?i.routes[0].sections[0]:[]).catch(i=>{Ht.captureException(i)});return ae(rt.list(r),s,{enabled:!!r&&!!o&&!!e&&n})}const st=({poi:t,poiType:e,rect:o,activePOI:n,hoveredPOI:r,isMapMoving:s,setActivePOI:i,isMobile:c})=>{var v,P,U,z;const[l,u]=m.exports.useState(!1),d=r===t,h=["rapid_transit_stations"],{translations:f}=se(),{sdkState:g}=D(),{setCommuteGeojson:y,setDestination:M,setShowCommuteCalculator:C,setSchoolCatchment:$}=A(),{data:b}=it({destination:{lat:t.lat,lng:t.lng},transportMode:"pedestrian",origin:`${(P=(v=g==null?void 0:g.options)==null?void 0:v.marker)==null?void 0:P.lat},${(z=(U=g==null?void 0:g.options)==null?void 0:U.marker)==null?void 0:z.lng}`,isOpen:l});m.exports.useEffect(()=>{if(u(n===t),n===t){const I=e==="high_schools"||e==="primary_schools"?"school":"poi";Vt.poi.isSchool(t,I)&&(t==null?void 0:t.catchments)&&Object.keys((t==null?void 0:t.catchments)||[]).length>0&&$(me.formatGeometry.formatGeometry(t.catchments[0].geometry))}},[n,t]);const w=m.exports.useMemo(()=>{if(!(b!=null&&b.summary)||!l)return null;const I=Math.floor(b.summary.typicalDuration/60/60),V=Math.floor(b.summary.typicalDuration/60%60);return I===0?`${V} ${j.pluralize(f.MINUTE,V)}`:`${I} ${j.pluralize(f.HOUR,I)} ${V} ${j.pluralize(f.MINUTE,V)}`},[b,l]),S=()=>{!(b!=null&&b.summary)||!l||(M({label:t.name,lat:t.lat,lng:t.lng}),y(me.polyline.decode(b.polyline)),C(!0),u(!1))};return a(je,{latitude:t.lat,longitude:t.lng,style:{zIndex:l?1:0},children:L(ue.Root,{options:{type:e,poi:t,isOpen:s?!1:l,isHovered:d,side:"top",size:h.includes(e)?"medium":"small",collisionPadding:c?{top:o.height+32,bottom:G*2,left:G*2,right:G*2}:{left:o.width+32,right:G*2,top:G*2,bottom:G*2},walkingTime:w,calculateRoute:S},onChange:I=>{I.type==="open-change"&&(I.data?setTimeout(()=>{i(t)},0):l&&(i(void 0),$()))},children:[a(ue.Marker,{}),a(ue.Content,{})]})})},Co={default:{scale:1},hovered:{scale:1.2}},He=17,xo=({cluster:t,supercluster:e,pointsCount:o,onClick:n,zoom:r,activePOI:s,hoveredPOI:i,setActivePOI:c,rect:l,isMobile:u,isMapMoving:d})=>{const[h,f]=m.exports.useState(!1),y=20+t.properties.point_count/o*25,M=()=>{if(r>He){f(!0);return}n&&n(t)},C=w=>{r<=He||f(w)},$=m.exports.useMemo(()=>e==null?void 0:e.getChildren(t.id).map(w=>w.properties).filter(w=>!!w),[e,t]),b=$==null?void 0:$.find(w=>!!s&&w.poi===s);return b?a(st,{rect:l,poi:b.poi,poiType:b.type,isMobile:u,activePOI:s,hoveredPOI:i,isMapMoving:d,setActivePOI:c}):L(de.Root,{open:d?!1:h,onOpenChange:C,children:[a(de.Trigger,{children:a(mo,{diameter:y,onClick:M,variants:Co,animate:h?"hovered":"default",whileHover:{scale:1.2},transition:Ue.transitions.default,children:t.properties.point_count})}),a(de.Content,{side:"top",children:a(go,{children:$==null?void 0:$.map((w,S)=>{var v;return a(fo,{onClick:()=>c(w.poi),children:(v=w.poi)==null?void 0:v.name},S)})})})]})};function vo(t){return t.properties.cluster!==void 0}const at=T.memo(({rect:t,zoom:e,mapRef:o,points:n,isMobile:r,activePOI:s,hoveredPOI:i,isMapMoving:c,setActivePOI:l})=>{var f;const u=(f=o==null?void 0:o.current)==null?void 0:f.getMap().getBounds().toArray().flat(),{clusters:d,supercluster:h}=po({points:n,bounds:u,zoom:e,options:{radius:50,maxZoom:30}});return a(J,{children:d.map((g,y)=>{const[M,C]=g.geometry.coordinates;return vo(g)?a(je,{latitude:C,longitude:M,children:a(xo,{rect:t,zoom:e,cluster:g,supercluster:h,pointsCount:n.length,activePOI:s,setActivePOI:l,isMobile:r,isMapMoving:c,hoveredPOI:i,onClick:()=>{var b;const $=Math.min(h.getClusterExpansionZoom(g.id),20);(b=o.current)==null||b.flyTo({zoom:$,center:[M,C],duration:1e3,essential:!0})}})},`cluster-${g.id}`):a(st,{rect:t,poi:g.properties.poi,poiType:g.properties.type,isMobile:r,activePOI:s,hoveredPOI:i,isMapMoving:c,setActivePOI:l},y)})})});at.displayName="Markers";const lt=t=>m.exports.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...t},m.exports.createElement("path",{d:"M12 2C8.13 2 5 5.13 5 9C5 14.25 12 22 12 22C12 22 19 14.25 19 9C19 5.13 15.87 2 12 2ZM12 11.5C10.62 11.5 9.5 10.38 9.5 9C9.5 7.62 10.62 6.5 12 6.5C13.38 6.5 14.5 7.62 14.5 9C14.5 10.38 13.38 11.5 12 11.5Z"})),ct=t=>m.exports.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},m.exports.createElement("path",{d:"M10 20V14H14V20H19V12H22L12 3L2 12H5V20H10Z"}));function we(t){const{client:e}=Ce(),{sdkState:o}=D(),n=xe(o.options,250),s={...m.exports.useMemo(()=>n!=null&&n.marker?n.marker:{lat:n==null?void 0:n.lat,lng:n==null?void 0:n.lng},[n]),geographyLevels:["20","30"],locationScoresRounding:!1,include:t};return ae(Mt.list(s),async()=>e.getScores(s),{enabled:!!s})}const wo=x.div`
|
|
40
|
+
padding: ${p["--ll-spacing-small"]} ${p["--ll-spacing-medium"]};
|
|
41
|
+
background-color: ${p["--ll-color-surface"]};
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
flex: 1;
|
|
46
|
+
`,bo=x.div`
|
|
47
|
+
display: grid;
|
|
48
|
+
grid-template-columns: min-content 1fr;
|
|
49
|
+
grid-gap: ${p["--ll-spacing-medium"]};
|
|
50
|
+
margin-bottom: ${p["--ll-spacing-medium"]};
|
|
51
|
+
`,Mo=()=>{var i,c;const{sdkState:t}=D(),{activeCategory:e,activeScore:o}=A(),n=X.find(l=>l.value===e),{data:r,isLoading:s}=we(n.scores);return o&&(r==null?void 0:r.location[o])?s?a("div",{children:"Loading"}):a(E.Root,{options:{score:o,scoresData:r},children:L(wo,{children:[L(bo,{children:[a(E.Badge,{}),a(E.BarChart,{options:{renderNeighbourhoodAvg:!1,locationIcon:((c=(i=t.options)==null?void 0:i.marker)==null?void 0:c.icon)==="pin"?lt:ct}})]}),a(E.Description,{})]})}):null},$o=x.div`
|
|
52
|
+
display: flex;
|
|
53
|
+
overflow-x: scroll;
|
|
54
|
+
padding: ${p["--ll-spacing-x-small"]} ${p["--ll-spacing-medium"]};
|
|
55
|
+
flex-shrink: 0;
|
|
56
|
+
position: relative;
|
|
57
|
+
`,So=x.button`
|
|
58
|
+
position: relative;
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-direction: column;
|
|
61
|
+
align-items: center;
|
|
62
|
+
background: none;
|
|
63
|
+
border: none;
|
|
64
|
+
min-width: 60px;
|
|
65
|
+
padding: 0;
|
|
66
|
+
margin: 0 8px;
|
|
67
|
+
flex-shrink: 0;
|
|
68
|
+
|
|
69
|
+
&:first-child {
|
|
70
|
+
margin-left: 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&:last-child {
|
|
74
|
+
margin-right: 0;
|
|
75
|
+
}
|
|
76
|
+
`,Lo=x.div`
|
|
77
|
+
position: absolute;
|
|
78
|
+
top: -6px;
|
|
79
|
+
right: 4px;
|
|
80
|
+
border: 2px solid ${p["--ll-color-background"]};
|
|
81
|
+
border-radius: 6px;
|
|
82
|
+
`,ko=x.div`
|
|
83
|
+
flex: 1;
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
`,Po=x.div`
|
|
87
|
+
margin: 0 2px;
|
|
88
|
+
`,Eo=({category:t})=>{const{data:e,isLoading:o,isFetching:n}=we(t.scores),{activeScore:r,setActiveScore:s,setActiveCategory:i}=A();return a($o,{children:t.scores.map(c=>{const l=c===r,u=l?"--ll-color-primary":"--ll-color-disabled";return o||n?a(Po,{children:a(Y,{height:"44px",width:"60px"})},c):a(E.Root,{options:{score:c,scoresData:e},children:L(So,{onClick:()=>{i(t.value),s(c)},children:[a(E.Icon,{options:{color:u,height:28,width:28}}),a(ko,{children:a(E.Title,{options:{variant:"caption1",color:u,lineClamp:1,noMargin:!0,weight:"--ll-font-weight-bold"}})}),a(Lo,{children:a(E.Badge,{options:{variant:"small",isPrimary:l}})})]})},c)})})},Ao=x.div`
|
|
89
|
+
display: flex;
|
|
90
|
+
padding: ${p["--ll-spacing-x-small"]} ${p["--ll-spacing-medium"]}
|
|
91
|
+
${p["--ll-spacing-xx-small"]} ${p["--ll-spacing-medium"]};
|
|
92
|
+
`,_o=x.div`
|
|
93
|
+
position: absolute;
|
|
94
|
+
top: 0;
|
|
95
|
+
left: 0;
|
|
96
|
+
right: 0;
|
|
97
|
+
z-index: 3;
|
|
98
|
+
box-shadow: rgba(0, 0, 0, 0.15) 0px 3px 8px;
|
|
99
|
+
overflow: hidden;
|
|
100
|
+
display: flex;
|
|
101
|
+
flex-direction: column;
|
|
102
|
+
background-color: ${p["--ll-color-background"]};
|
|
103
|
+
border: 1px solid ${p["--ll-color-border"]};
|
|
104
|
+
`,ut=T.forwardRef((t,e)=>{const{activeCategory:o,setActiveCategory:n}=A();return L(_o,{ref:e,children:[a(Ao,{children:L(O.Root,{value:o,onValueChange:r=>n(r),children:[a(O.Trigger,{size:"large",children:a(q.Root,{options:{scoreCategory:o},children:a(q.Title,{options:{color:"inherit",noMargin:!0,variant:"h6",lineHeight:1}})},o)}),a(O.Content,{children:X.map(r=>a(q.Root,{options:{scoreCategory:r.value},children:a(O.Item,{value:r.value,children:a(q.Title,{options:{color:"inherit",noMargin:!0,variant:"h6"}})})},r.value))})]})}),a(Eo,{category:X.find(r=>r.value===o)}),a(Mo,{})]})});ut.displayName="MobileScores";const Io=Be({from:{height:0},to:{height:"var(--radix-accordion-content-height)"}}),Ro=Be({from:{height:"var(--radix-accordion-content-height)"},to:{height:0}}),To=x($t)`
|
|
105
|
+
margin: 0;
|
|
106
|
+
z-index: 1;
|
|
107
|
+
position: relative;
|
|
108
|
+
margin: 0 calc(-1 * ${p["--ll-spacing-medium"]});
|
|
109
|
+
padding: 0 ${p["--ll-spacing-medium"]};
|
|
110
|
+
|
|
111
|
+
&:hover {
|
|
112
|
+
background-color: ${p["--ll-color-surface"]};
|
|
113
|
+
box-shadow: ${p["--ll-shadow-small"]};
|
|
114
|
+
}
|
|
115
|
+
`,dt=x(St)`
|
|
116
|
+
background: none;
|
|
117
|
+
border: none;
|
|
118
|
+
display: flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
width: 100%;
|
|
121
|
+
padding: ${p["--ll-spacing-x-small"]} 0;
|
|
122
|
+
`,zo=x(Lt)`
|
|
123
|
+
background-color: ${p["--ll-color-surface"]};
|
|
124
|
+
position: relative;
|
|
125
|
+
overflow: hidden;
|
|
126
|
+
margin-left: calc(-1 * ${p["--ll-spacing-medium"]});
|
|
127
|
+
margin-right: calc(-1 * ${p["--ll-spacing-medium"]});
|
|
128
|
+
|
|
129
|
+
[data-state="open"] & {
|
|
130
|
+
/* TODO: Re-implement this once StyledComponents is fixed. https://locallogic.atlassian.net/browse/LL22-1107 */
|
|
131
|
+
/* animation: ${Io} 300ms cubic-bezier(0.87, 0, 0.13, 1); */
|
|
132
|
+
visibility: visible;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
[data-state="closed"] & {
|
|
136
|
+
/* TODO: Re-implement this once StyledComponents is fixed. https://locallogic.atlassian.net/browse/LL22-1107 */
|
|
137
|
+
/* animation: ${Ro} 300ms cubic-bezier(0.87, 0, 0.13, 1); */
|
|
138
|
+
visibility: hidden;
|
|
139
|
+
}
|
|
140
|
+
`,Oo=x.div`
|
|
141
|
+
padding: ${p["--ll-spacing-medium"]};
|
|
142
|
+
border-top: 1px solid ${p["--ll-color-border"]};
|
|
143
|
+
border-bottom: 1px solid ${p["--ll-color-border"]};
|
|
144
|
+
`,Zo=x.span`
|
|
145
|
+
${dt}[data-state=open] & {
|
|
146
|
+
transform: rotate(90deg);
|
|
147
|
+
} ;
|
|
148
|
+
`;x.div`
|
|
149
|
+
display: flex;
|
|
150
|
+
align-items: flex-start;
|
|
151
|
+
justify-content: space-between;
|
|
152
|
+
`;const be=x.div`
|
|
153
|
+
margin: ${p["--ll-spacing-small"]} 0;
|
|
154
|
+
`,Do=x.div`
|
|
155
|
+
margin-top: ${p["--ll-spacing-large"]};
|
|
156
|
+
&:empty {
|
|
157
|
+
margin: 0;
|
|
158
|
+
}
|
|
159
|
+
`,Ho=({score:t})=>{const{data:e,isLoading:o}=qe(),{activePOI:n,setActivePOI:r,hoveredPOI:s,setHoveredPOI:i}=A(),{mapRef:c,mapPadding:l}=tt();return o?a(J,{children:[...Array(10)].map((u,d)=>a(be,{children:a(Y,{height:"34px",width:"100%"})},d))}):e?a(Fe.Root,{options:{type:"school",data:e==null?void 0:e[t],activePOI:n,hoveredPOI:s},onChange:u=>{var d;if(u.type==="poi-click"){const h=u.data;r(h);const f=window.innerWidth-l.left,g=window.innerWidth/2,y=f/2+l.left-g;h&&((d=c.current)==null||d.easeTo({zoom:18,center:[h.lng,h.lat],duration:1e3,offset:[y,0]}))}u.type==="poi-hover"&&i(u.data)}}):null},ht=T.memo(({result:t,poi:e})=>{const{activePOI:o,setActivePOI:n,hoveredPOI:r,setHoveredPOI:s}=A(),{mapRef:i,mapPadding:c}=tt();return!t.data||!t.data[e]?null:a(ge.Content,{options:{value:e},children:a(Fe.Root,{options:{type:"poi",data:t.data[e],activePOI:o,hoveredPOI:r},onChange:l=>{var u;if(l.type==="poi-click"){const d=l.data;n(d);const h=window.innerWidth-c.left,f=window.innerWidth/2,g=h/2+c.left-f;d&&((u=i.current)==null||u.flyTo({zoom:18,center:[d.lng,d.lat],duration:1e3,offset:[g,0],essential:!0}))}l.type==="poi-hover"&&s(l.data)}})},e)});ht.displayName="POI";const pt=T.memo(({include:t})=>{const e=Ye(),o=t==null?void 0:t.filter(n=>{var r;return(((r=e==null?void 0:e.data)==null?void 0:r[n])||[]).length>0});return e.isLoading&&o.length?a(J,{children:[...Array(10)].map((n,r)=>a(be,{children:a(Y,{height:"34px",width:"100%"})},r))}):e.data?L(ge.Root,{options:{include:o},children:[a(ge.Tabs,{}),o.map(n=>a(ht,{poi:n,result:e},n))]}):null});pt.displayName="POIs";const mt=T.memo(({score:t,isLoading:e,scoresData:o})=>{var i,c;const{sdkState:n}=D(),{activeScore:r}=A(),s=t===r;return e?a(be,{children:a(Y,{height:"34px",width:"100%"},t)}):o!=null&&o.location[t]?a(kt,{value:t,children:L(E.Root,{options:{score:t,scoresData:o},children:[a(To,{children:L(dt,{children:[a(Zo,{children:a(Ke,{SVGElement:Pt,fill:p["--ll-color-on-background-variant1"]})}),a(N,{spacing:"--ll-spacing-small"}),a(E.Icon,{}),a(N,{spacing:"--ll-spacing-small"}),a(E.Title,{}),a(N,{}),a(E.Badge,{options:{isPrimary:s}})]})}),a(zo,{children:L(Oo,{children:[a(E.Description,{}),a(N,{vertical:!0,spacing:"--ll-spacing-small"}),a(E.BarChart,{options:{renderNeighbourhoodAvg:!1,locationIcon:((c=(i=n.options)==null?void 0:i.marker)==null?void 0:c.icon)==="pin"?lt:ct}}),a(Do,{children:t==="high_schools"||t==="primary_schools"?a(Ho,{score:t}):a(pt,{include:W[t]})})]})})]})},t):null});mt.displayName="Score";const Vo=x.div`
|
|
160
|
+
padding: ${p["--ll-spacing-small"]} ${p["--ll-spacing-medium"]};
|
|
161
|
+
`,Go=x.div`
|
|
162
|
+
display: flex;
|
|
163
|
+
justify-content: space-between;
|
|
164
|
+
align-items: center;
|
|
165
|
+
`,gt=T.memo(({tabContent:t})=>{const{data:e,isLoading:o,isFetching:n}=we(t.scores),{translations:r}=se();return L(Vo,{children:[L(Go,{children:[a(te.Title,{options:{variant:"h4",noMargin:!0,weight:"--ll-font-weight-medium"}}),n&&!o&&a(Gt,{size:"small"})]}),a(N,{spacing:"--ll-spacing-small",vertical:!0}),!n&&!Object.keys((e==null?void 0:e.location)||{}).length&&a(K,{color:"--ll-color-on-background-variant1",children:r.EMPTY_TEXT}),t.scores.map(s=>a(mt,{score:s,isLoading:o,scoresData:e},s))]})});gt.displayName="ScoreCategory";const ft=T.memo(({tabContent:t})=>{const{activeScore:e,setActiveScore:o}=A();return m.exports.useEffect(()=>{o(t.scores[0])},[]),a(Et,{value:e,onValueChange:n=>{o(n)},type:"single",collapsible:!0,children:a(gt,{tabContent:t})})});ft.displayName="ScoreCategoryAccordion";const No=x.div`
|
|
166
|
+
overflow-y: auto;
|
|
167
|
+
`,jo=x.div`
|
|
168
|
+
position: absolute;
|
|
169
|
+
top: ${p["--ll-spacing-medium"]};
|
|
170
|
+
left: ${p["--ll-spacing-medium"]};
|
|
171
|
+
width: 360px;
|
|
172
|
+
max-height: calc(100% - 2 * ${p["--ll-spacing-medium"]});
|
|
173
|
+
z-index: 1;
|
|
174
|
+
border-radius: ${p["--ll-border-radius-medium"]};
|
|
175
|
+
box-shadow: rgba(0, 0, 0, 0.15) 0px 3px 8px;
|
|
176
|
+
background-color: #fff;
|
|
177
|
+
overflow: hidden;
|
|
178
|
+
display: flex;
|
|
179
|
+
flex-direction: column;
|
|
180
|
+
background-color: ${p["--ll-color-background"]};
|
|
181
|
+
border: 1px solid ${p["--ll-color-border"]};
|
|
182
|
+
`;x.div`
|
|
183
|
+
display: flex;
|
|
184
|
+
justify-content: center;
|
|
185
|
+
padding: ${p["--ll-spacing-small"]};
|
|
186
|
+
`;const Uo=x.div`
|
|
187
|
+
padding: ${p["--ll-spacing-xx-small"]};
|
|
188
|
+
border-bottom: 1px solid ${p["--ll-color-border"]};
|
|
189
|
+
`,Bo=x.div`
|
|
190
|
+
display: flex;
|
|
191
|
+
justify-content: center;
|
|
192
|
+
padding: ${p["--ll-spacing-small"]};
|
|
193
|
+
background-color: ${p["--ll-color-background"]};
|
|
194
|
+
`,yt=()=>a(Bo,{children:a(Nt.Root,{})}),Ct=T.forwardRef((t,e)=>{const{activeCategory:o,setActiveCategory:n}=A();return a(te.Root,{options:{currentTab:o},onChange:r=>{n(r.data)},children:L(jo,{ref:e,children:[a(Uo,{children:a(te.Tabs,{})}),a(No,{children:X.map(r=>a(te.Content,{options:{value:r.value},children:a(ft,{tabContent:r},r.value)},r.value))}),a(yt,{})]})})});Ct.displayName="DesktopScores";const Fo=x.div`
|
|
195
|
+
position: relative;
|
|
196
|
+
display: flex;
|
|
197
|
+
flex-direction: column;
|
|
198
|
+
height: 100vh;
|
|
199
|
+
`,Ve=t=>m.exports.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...t},m.exports.createElement("path",{d:"M22.4275 10.5938L13.4175 1.58383C12.6675 0.833834 11.3475 0.823834 10.5875 1.58383L1.58745 10.5838C0.807453 11.3638 0.807453 12.6238 1.58745 13.4038L10.5875 22.4038C10.9775 22.7938 11.4875 22.9838 11.9975 22.9838C12.5075 22.9838 13.0175 22.7938 13.4075 22.4038L22.3975 13.4138C23.1875 12.6538 23.1975 11.3938 22.4275 10.5938ZM12.0075 20.9938L3.00745 11.9938L12.0075 2.99383L21.0075 11.9938L12.0075 20.9938ZM7.99745 11.0038V15.0038H9.99745V12.0038H13.9975V14.5038L17.4975 11.0038L13.9975 7.50383V10.0038H8.99745C8.44745 10.0038 7.99745 10.4538 7.99745 11.0038Z"})),Ko=t=>m.exports.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...t},m.exports.createElement("path",{d:"M13.5 5.5C14.6 5.5 15.5 4.6 15.5 3.5C15.5 2.4 14.6 1.5 13.5 1.5C12.4 1.5 11.5 2.4 11.5 3.5C11.5 4.6 12.4 5.5 13.5 5.5ZM9.8 8.9L7 23H9.1L10.9 15L13 17V23H15V15.5L12.9 13.5L13.5 10.5C14.8 12 16.8 13 19 13V11C17.1 11 15.5 10 14.7 8.6L13.7 7C13.14 6.11 12.02 5.75 11.05 6.16L6 8.3V13H8V9.6L9.8 8.9Z"})),Wo=t=>m.exports.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...t},m.exports.createElement("path",{d:"M18.92 6.01C18.72 5.42 18.16 5 17.5 5H6.5C5.84 5 5.29 5.42 5.08 6.01L3 12V20C3 20.55 3.45 21 4 21H5C5.55 21 6 20.55 6 20V19H18V20C18 20.55 18.45 21 19 21H20C20.55 21 21 20.55 21 20V12L18.92 6.01ZM6.85 7H17.14L18.22 10.11H5.77L6.85 7ZM19 17H5V12H19V17Z"}),m.exports.createElement("path",{d:"M7.5 16C8.32843 16 9 15.3284 9 14.5C9 13.6716 8.32843 13 7.5 13C6.67157 13 6 13.6716 6 14.5C6 15.3284 6.67157 16 7.5 16Z"}),m.exports.createElement("path",{d:"M16.5 16C17.3284 16 18 15.3284 18 14.5C18 13.6716 17.3284 13 16.5 13C15.6716 13 15 13.6716 15 14.5C15 15.3284 15.6716 16 16.5 16Z"})),Qo=t=>m.exports.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...t},m.exports.createElement("path",{d:"M12,2C6.47,2,2,6.47,2,12s4.47,10,10,10s10-4.47,10-10S17.53,2,12,2z M17,15.59L15.59,17L12,13.41L8.41,17L7,15.59 L10.59,12L7,8.41L8.41,7L12,10.59L15.59,7L17,8.41L13.41,12L17,15.59z"})),Xo=x.div`
|
|
200
|
+
max-height: calc(100% - 2 * ${p["--ll-spacing-medium"]});
|
|
201
|
+
border-radius: ${p["--ll-border-radius-medium"]};
|
|
202
|
+
box-shadow: ${p["--ll-shadow-small"]};
|
|
203
|
+
background-color: ${p["--ll-color-background"]};
|
|
204
|
+
border: 1px solid ${p["--ll-color-border"]};
|
|
205
|
+
padding: ${p["--ll-spacing-x-small"]};
|
|
206
|
+
`,Jo=x.div`
|
|
207
|
+
display: flex;
|
|
208
|
+
justify-content: space-between;
|
|
209
|
+
align-items: end;
|
|
210
|
+
|
|
211
|
+
${At} {
|
|
212
|
+
// Adjust if text of commute transport mode changes
|
|
213
|
+
width: 52%;
|
|
214
|
+
margin-right: ${p["--ll-spacing-x-small"]};
|
|
215
|
+
}
|
|
216
|
+
`,Ge=x.div`
|
|
217
|
+
background-color: ${p["--ll-color-surface"]};
|
|
218
|
+
padding: ${p["--ll-spacing-x-small"]} ${p["--ll-spacing-small"]} 0;
|
|
219
|
+
border-radius: ${p["--ll-border-radius-medium"]};
|
|
220
|
+
`,Yo=x(We)`
|
|
221
|
+
position: absolute;
|
|
222
|
+
right: ${p["--ll-spacing-xx-small"]};
|
|
223
|
+
top: ${p["--ll-spacing-xx-small"]};
|
|
224
|
+
`,xt=({className:t,onClose:e})=>{var $,b,w,S;const{sdkState:o}=D(),{setCommuteGeojson:n,destination:r,setDestination:s}=A(),[i,c]=m.exports.useState("pedestrian"),l=ve(),{translations:u}=se(),{data:d,isFetching:h,isFetched:f}=it({destination:r,transportMode:i,origin:`${(b=($=o==null?void 0:o.options)==null?void 0:$.marker)==null?void 0:b.lat},${(S=(w=o==null?void 0:o.options)==null?void 0:w.marker)==null?void 0:S.lng}`,isOpen:!0});m.exports.useEffect(()=>{!(d!=null&&d.summary)||n(me.polyline.decode(d.polyline))},[d]);const g={pedestrian:[u.WALKING,Ko],car:[u.DRIVING,Wo]},y=m.exports.useMemo(()=>{if(!(d!=null&&d.summary))return null;const v=Math.floor(d.summary.typicalDuration/60/60),P=Math.floor(d.summary.typicalDuration/60%60);return v===0?`${P} ${j.pluralize(u.MINUTE,P)}`:`${v} ${j.pluralize(u.HOUR,v)} ${P} ${j.pluralize(u.MINUTE,P)}`},[d]),M=m.exports.useMemo(()=>{if(!(d!=null&&d.summary))return null;const v=Math.floor(d.summary.length/1e3);return v===0?`${d.summary.length} m`:`${v} km`},[d]),C=()=>h?a(Y,{height:"70.4px",width:"100%"}):d!=null&&d.summary?L(Ge,{children:[a(K,{variant:"h5",children:y}),L(K,{children:[M," \u2013 ",u.FAST_ROUTE]})]}):L(Ge,{children:[a(K,{variant:"h5",children:u.NO_ROUTE}),a(K,{children:u.TRY_SUGGESTION})]});return L(Xo,{className:t,children:[a(Yo,{size:"medium",color:"neutral",onClick:e,SVGElement:Qo}),L(Jo,{children:[a(_t,{label:u.CALCULATE_COMMUTE,placeholder:(r==null?void 0:r.label)||u.SEARCH_MAP,renderListAbove:l,renderListAbovePosition:30,onSearch:v=>{s({lat:v.latitude,lng:v.longitude})}}),a(O.Root,{value:i,onValueChange:v=>{c(v)},children:L(O.Trigger,{children:[a(Ke,{SVGElement:g[i][1],fill:p["--ll-color-on-background-variant1"],width:16}),g[i][0],L(O.Content,{children:[a(O.Item,{value:"car",children:u.DRIVING}),a(O.Item,{value:"pedestrian",children:u.WALKING})]})]})})]}),(f||h)&&L(J,{children:[a(N,{vertical:!0,spacing:"--ll-spacing-x-small"}),a(It,{open:!!d,children:C()})]})]})},qo=x.div`
|
|
225
|
+
position: absolute;
|
|
226
|
+
bottom: 0;
|
|
227
|
+
right: 0;
|
|
228
|
+
left: 0;
|
|
229
|
+
z-index: 3;
|
|
230
|
+
`,en=x.div`
|
|
231
|
+
position: absolute;
|
|
232
|
+
top: ${p["--ll-spacing-medium"]};
|
|
233
|
+
right: ${p["--ll-spacing-medium"]};
|
|
234
|
+
z-index: 3;
|
|
235
|
+
max-width: 356px;
|
|
236
|
+
`,tn=x(We)`
|
|
237
|
+
box-shadow: ${p["--ll-shadow-medium"]};
|
|
238
|
+
position: absolute;
|
|
239
|
+
bottom: ${p["--ll-spacing-medium"]};
|
|
240
|
+
right: ${p["--ll-spacing-medium"]};
|
|
241
|
+
`,on=x(xt)``,nn=x(xt)`
|
|
242
|
+
border-radius: ${p["--ll-border-radius-small"]}
|
|
243
|
+
${p["--ll-border-radius-small"]} 0 0;
|
|
244
|
+
border: 0;
|
|
245
|
+
`,rn=x(jt)`
|
|
246
|
+
box-shadow: ${p["--ll-shadow-small"]};
|
|
247
|
+
`,sn=()=>{const{setCommuteGeojson:t,setDestination:e,showCommuteCalculator:o,setShowCommuteCalculator:n}=A(),{translations:r}=se(),s=ve(),i=()=>{e(void 0),t(void 0),n(!1)},c=()=>{n(!0)};return s?a(J,{children:o?a(qo,{children:a(nn,{onClose:i})}):a(tn,{size:"large",SVGElement:Ve,onClick:c})}):a(en,{children:o?a(on,{onClose:i}):a(rn,{onClick:c,startAdornment:a(Ve,{}),children:r.CALCULATE_COMMUTE})})},an=()=>{var Me,$e,Se;const{sdkState:t,setSdkState:e}=D(),{activeScore:o,activePOI:n,setActivePOI:r,hoveredPOI:s,commuteGeojson:i,destination:c,schoolCatchment:l}=A(),u=ve(),d=Ye(),h=qe(),f=(($e=(Me=t==null?void 0:t.globalOptions)==null?void 0:Me.appearance)==null?void 0:$e.theme)==="night"?"dd191599-2a92-49fc-9a33-e12391753ad5":"600d69cb-288d-445e-9839-3dfe4d76b31a",y={id:"point",type:"line",paint:{"line-width":6,"line-color":getComputedStyle(document.documentElement).getPropertyValue("--ll-color-link")}},C={id:"school",type:"line",source:"schoolCatchment",paint:{"line-width":3,"line-color":getComputedStyle(document.documentElement).getPropertyValue("--ll-color-on-background")}},[$,b]=m.exports.useState(!1),w=m.exports.useMemo(()=>{var k,_;return(o==="high_schools"||o==="primary_schools")&&!h.isFetching?{[o]:((k=h==null?void 0:h.data)==null?void 0:k[o])||[]}:!(W&&o&&W[o]&&((_=W[o])==null?void 0:_.length))&&!d.isFetching?{[o]:[]}:d.data},[d.data,h.data,o]),S=m.exports.useMemo(()=>w?Object.entries(w).map(([_,Z])=>Z.map(R=>he([R.lng,R.lat],{poi:R,type:_}))).flat().filter((_,Z,R)=>R.findIndex(ce=>["lat","lng","name"].every(B=>ce.properties.poi[B]===_.properties.poi[B]))===Z):[],[w]),v=m.exports.useMemo(()=>{var _,Z,R;const k=((_=t==null?void 0:t.options)==null?void 0:_.marker)&&he([(Z=t==null?void 0:t.options)==null?void 0:Z.marker.lng,(R=t==null?void 0:t.options)==null?void 0:R.marker.lat]);return[...S,...k?[k]:[],...c?[he([c==null?void 0:c.lng,c==null?void 0:c.lat])]:[]]},[S,(Se=t==null?void 0:t.options)==null?void 0:Se.marker,c]),P=m.exports.useRef(),[U,z]=Rt(),I=m.exports.useMemo(()=>({top:25+z.height,bottom:25,left:25,right:25}),[z.height]),V=m.exports.useMemo(()=>({top:50,bottom:50,left:z.width+32+50,right:50}),[z.width]),le=u?I:V,vt=k=>{e({...t,options:{...t.options,lat:k.viewState.latitude,lng:k.viewState.longitude,zoom:k.viewState.zoom,bearing:k.viewState.bearing,pitch:k.viewState.pitch}})};return m.exports.useEffect(()=>{var B,Le;if(!v.length||!((B=t.options)!=null&&B.marker))return;const k=Yt(v.map(({geometry:ke})=>[ke.coordinates[1],ke.coordinates[0]])),[_,Z,R,ce]=fe(k);(Le=P==null?void 0:P.current)==null||Le.fitBounds([[Z,_],[ce,R]],{maxZoom:17,padding:le,duration:1e3})},[v,le,l]),t.options?a(qt,{mapRef:P,mapPadding:le,children:L(Fo,{children:[L(Tt,{ref:P,mapLib:zt,latitude:t.options.lat,longitude:t.options.lng,zoom:t.options.zoom,pitch:t.options.pitch,bearing:t.options.bearing,style:{flex:1,width:"100vw"},mapStyle:`https://api.maptiler.com/maps/${f}/style.json?key=9jNGatuzs05Q1oNlctEs`,onMove:vt,cooperativeGestures:t.options.cooperativeGestures,onMoveStart:()=>b(!0),onMoveEnd:()=>b(!1),attributionControl:!1,children:[a(Ot,{compact:!0,position:u?"bottom-left":"bottom-right"}),a(Zt,{position:u?"top-right":"bottom-right",showCompass:!0,style:{marginTop:u?16+z.height:16,marginRight:16}}),t.options.marker&&a(Pe,{marker:t.options.marker}),a(at,{rect:z,zoom:t.options.zoom,mapRef:P,points:S,isMobile:u,activePOI:n,hoveredPOI:s,isMapMoving:$,setActivePOI:r}),u?a(ut,{ref:U}):a(Ct,{ref:U}),a(sn,{}),c&&a(Pe,{marker:{icon:"pin",...c}}),i&&a(Ee,{type:"geojson",data:i,children:a(Ae,{...y})}),l&&a(Ee,{type:"geojson",data:l,children:a(Ae,{...C})})]}),u&&a(yt,{})]})}):a("div",{children:"No options provided."})},hn=()=>a(Bt,{children:a(an,{})});export{hn as default};
|