@local-logic/sdks-app 1.2.4 → 1.3.1
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.008d8ab5.js +40 -0
- package/dist/assets/index-legacy.74694904.js +1 -0
- package/dist/assets/index-legacy.ad6dd738.js +8 -0
- package/dist/assets/{index-legacy.8274fd62.js → index-legacy.f7e0f85f.js} +1 -1
- package/dist/assets/{index.5e5913ac.js → index.1e974327.js} +9 -9
- package/dist/assets/{index.1798f035.js → index.3a10cc5f.js} +80 -75
- package/dist/assets/index.465d1ec4.js +242 -0
- package/dist/assets/index.c6852ed8.js +1109 -0
- package/dist/assets/{polyfills-legacy.bf9b122f.js → polyfills-legacy.9624f473.js} +1 -1
- package/dist/index.html +3 -3
- package/dist/types/components/Search/index.d.ts +3 -3
- package/dist/types/components/Search/index.d.ts.map +1 -1
- package/dist/types/components/Search/index.js +26 -20
- package/dist/types/components/Search/index.js.map +1 -1
- package/dist/types/components/Search/styles.d.ts +2 -2
- package/dist/types/components/Search/styles.js +3 -3
- package/dist/types/sdks/DataExplorer/components/Map/index.d.ts.map +1 -1
- package/dist/types/sdks/DataExplorer/components/Map/index.js +1 -1
- package/dist/types/sdks/DataExplorer/components/Map/index.js.map +1 -1
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/CommuteCalculator/index.js +1 -1
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/index.d.ts.map +1 -1
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/index.js +1 -2
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/index.js.map +1 -1
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/styles.d.ts +1 -0
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/styles.d.ts.map +1 -1
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/styles.js +4 -1
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/styles.js.map +1 -1
- package/dist/types/sdks/LocalContent/Map/Markers/Cluster/index.d.ts +14 -1
- package/dist/types/sdks/LocalContent/Map/Markers/Cluster/index.d.ts.map +1 -1
- package/dist/types/sdks/LocalContent/Map/Markers/Cluster/index.js +44 -3
- package/dist/types/sdks/LocalContent/Map/Markers/Cluster/index.js.map +1 -1
- package/dist/types/sdks/LocalContent/Map/Markers/Cluster/styles.d.ts +3 -1
- package/dist/types/sdks/LocalContent/Map/Markers/Cluster/styles.d.ts.map +1 -1
- package/dist/types/sdks/LocalContent/Map/Markers/Cluster/styles.js +23 -1
- package/dist/types/sdks/LocalContent/Map/Markers/Cluster/styles.js.map +1 -1
- package/dist/types/sdks/LocalContent/Map/Markers/Marker/index.d.ts +16 -0
- package/dist/types/sdks/LocalContent/Map/Markers/Marker/index.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/Markers/Marker/index.js +53 -0
- package/dist/types/sdks/LocalContent/Map/Markers/Marker/index.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/Markers/index.d.ts.map +1 -1
- package/dist/types/sdks/LocalContent/Map/Markers/index.js +6 -52
- package/dist/types/sdks/LocalContent/Map/Markers/index.js.map +1 -1
- package/dist/types/sdks/LocalContent/Map/index.d.ts.map +1 -1
- package/dist/types/sdks/LocalContent/Map/index.js +6 -0
- package/dist/types/sdks/LocalContent/Map/index.js.map +1 -1
- package/dist/types/services/storage/browserStorage.d.ts +46 -0
- package/dist/types/services/storage/browserStorage.d.ts.map +1 -0
- package/dist/types/services/storage/browserStorage.js +56 -0
- package/dist/types/services/storage/browserStorage.js.map +1 -0
- package/dist/types/services/storage/commuteHistory.d.ts +46 -0
- package/dist/types/services/storage/commuteHistory.d.ts.map +1 -0
- package/dist/types/services/storage/commuteHistory.js +54 -0
- package/dist/types/services/storage/commuteHistory.js.map +1 -0
- package/package.json +4 -3
- package/dist/assets/index-legacy.ab2806f1.js +0 -40
- package/dist/assets/index-legacy.b0c3b101.js +0 -1
- package/dist/assets/index-legacy.ee970dd3.js +0 -1
- package/dist/assets/index.299746d3.js +0 -221
- package/dist/assets/index.603e3d3b.js +0 -1155
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import{M as Ge,d as ee,u as se,p as Ct,s as bt,a as Ue,b as wt,$ as Mt,c as $t,e as St,f as Lt,S as kt,g as Et,h as Pt,i as It,A as At,j as Tt,k as _t,m as Rt,l as Ot,N as zt,P as Ie}from"./index.3a10cc5f.js";import{R as O,r as h,Z as xe,j as c,l as Q,c as J,d as Ce,u as N,a as be,$ as W,s as x,m as jt,y as p,b as k,H as le,C as H,o as ce,F as Y,k as P,e as q,n as z,f as X,U as Fe,N as We,z as me,q as Ke,T as V,g as we,h as te,O as Dt,i as F,M as Zt,p as Nt,Q as Qe,A as Ht}from"./index.c6852ed8.js";const Ye=O.createContext({}),I=()=>h.exports.useContext(Ye),Vt=(t,e)=>{switch(e.type){case"CATEGORY":return{...t,activeCategory:e.value};case"SCORE":{const n=Q.find(o=>e.value===""?o.value===t.activeCategory:o.scores.includes(e.value)).value;return{activeCategory:n,activeScoreByCategory:{...t.activeScoreByCategory,[n]:e.value}}}}},Bt=({children:t})=>{const e=window.innerWidth<xe.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:""}},[n,o]=h.exports.useReducer(Vt,e),[r,i]=h.exports.useState(),[s,l]=h.exports.useState(),[a,d]=h.exports.useState(),[u,f]=h.exports.useState(),{activeCategory:m}=n,g=n.activeScoreByCategory[m],y=C=>{o({type:"SCORE",value:C})},b=C=>{o({type:"CATEGORY",value:C})},v=h.exports.useMemo(()=>({activeScore:g,setActiveScore:y,activeCategory:m,setActiveCategory:b,activePOI:r,setActivePOI:i,hoveredPOI:s,setHoveredPOI:l,commuteGeojson:a,setCommuteGeojson:d,destination:u,setDestination:f}),[g,y,m,b,r,i,s,l,a,d,u,f]);return c(Ye.Provider,{value:v,children:t})};function re(t,e){if(!t)throw new Error(e)}let Gt=0;function Ut(t,e,n){if(t.style&&t.style._loaded){const o={...n};return delete o.id,delete o.children,t.addSource(e,o),t.getSource(e)}return null}function Ft(t,e,n){re(e.id===n.id,"source id changed"),re(e.type===n.type,"source type changed");let o="",r=0;for(const s in e)s!=="children"&&s!=="id"&&!ee(n[s],e[s])&&(o=s,r++);if(!r)return;const i=e.type;if(i==="geojson")t.setData(e.data);else if(i==="image")t.updateImage({url:e.url,coordinates:e.coordinates});else if((i==="canvas"||i==="video")&&r===1&&o==="coordinates")t.setCoordinates(e.coordinates);else if(i==="vector"&&"setUrl"in t)switch(o){case"url":t.setUrl(e.url);break;case"tiles":t.setTiles(e.tiles);break}else console.warn(`Unable to update <Source> prop: ${o}`)}function Wt(t){const e=h.exports.useContext(Ge).map.getMap(),n=h.exports.useRef(t),[,o]=h.exports.useState(0),r=h.exports.useMemo(()=>t.id||`jsx-source-${Gt++}`,[]);h.exports.useEffect(()=>{if(e){const s=()=>o(l=>l+1);return e.on("styledata",s),s(),()=>{var l;if(e.off("styledata",s),e.style&&e.style._loaded&&e.getSource(r)){const a=(l=e.getStyle())===null||l===void 0?void 0:l.layers;if(a)for(const d of a)d.source===r&&e.removeLayer(d.id);e.removeSource(r)}}}},[e]);let i=e&&e.style&&e.getSource(r);return i?Ft(i,t,n.current):i=Ut(e,r,t),n.current=t,i&&h.exports.Children.map(t.children,s=>s&&h.exports.cloneElement(s,{source:r}))||null}function Kt(t,e,n,o){if(re(n.id===o.id,"layer id changed"),re(n.type===o.type,"layer type changed"),n.type==="custom"||o.type==="custom")return;const{layout:r={},paint:i={},filter:s,minzoom:l,maxzoom:a,beforeId:d}=n;if(d!==o.beforeId&&t.moveLayer(e,d),r!==o.layout){const u=o.layout||{};for(const f in r)ee(r[f],u[f])||t.setLayoutProperty(e,f,r[f]);for(const f in u)r.hasOwnProperty(f)||t.setLayoutProperty(e,f,void 0)}if(i!==o.paint){const u=o.paint||{};for(const f in i)ee(i[f],u[f])||t.setPaintProperty(e,f,i[f]);for(const f in u)i.hasOwnProperty(f)||t.setPaintProperty(e,f,void 0)}ee(s,o.filter)||t.setFilter(e,s),(l!==o.minzoom||a!==o.maxzoom)&&t.setLayerZoomRange(e,l,a)}function Qt(t,e,n){if(t.style&&t.style._loaded&&(!("source"in n)||t.getSource(n.source))){const o={...n,id:e};delete o.beforeId,t.addLayer(o,n.beforeId)}}let Yt=0;function qt(t){const e=h.exports.useContext(Ge).map.getMap(),n=h.exports.useRef(t),[,o]=h.exports.useState(0),r=h.exports.useMemo(()=>t.id||`jsx-layer-${Yt++}`,[]);if(h.exports.useEffect(()=>{if(e){const s=()=>o(l=>l+1);return e.on("styledata",s),s(),()=>{e.off("styledata",s),e.style&&e.style._loaded&&e.getLayer(r)&&e.removeLayer(r)}}},[e]),e&&e.style&&e.getLayer(r))try{Kt(e,r,t,n.current)}catch(s){console.warn(s)}else Qt(e,r,t);return n.current=t,null}function qe(t,e,n){n===void 0&&(n={});var o={type:"Feature"};return(n.id===0||n.id)&&(o.id=n.id),n.bbox&&(o.bbox=n.bbox),o.properties=e||{},o.geometry=t,o}function ue(t,e,n){if(n===void 0&&(n={}),!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(!Ae(t[0])||!Ae(t[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:t};return qe(o,e,n)}function Jt(t,e,n){n===void 0&&(n={});var o={type:"MultiPoint",coordinates:t};return qe(o,e,n)}function Ae(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function Je(t,e,n){if(t!==null)for(var o,r,i,s,l,a,d,u=0,f=0,m,g=t.type,y=g==="FeatureCollection",b=g==="Feature",v=y?t.features.length:1,C=0;C<v;C++){d=y?t.features[C].geometry:b?t.geometry:t,m=d?d.type==="GeometryCollection":!1,l=m?d.geometries.length:1;for(var S=0;S<l;S++){var M=0,$=0;if(s=m?d.geometries[S]:d,s!==null){a=s.coordinates;var w=s.type;switch(u=n&&(w==="Polygon"||w==="MultiPolygon")?1:0,w){case null:break;case"Point":if(e(a,f,C,M,$)===!1)return!1;f++,M++;break;case"LineString":case"MultiPoint":for(o=0;o<a.length;o++){if(e(a[o],f,C,M,$)===!1)return!1;f++,w==="MultiPoint"&&M++}w==="LineString"&&M++;break;case"Polygon":case"MultiLineString":for(o=0;o<a.length;o++){for(r=0;r<a[o].length-u;r++){if(e(a[o][r],f,C,M,$)===!1)return!1;f++}w==="MultiLineString"&&M++,w==="Polygon"&&$++}w==="Polygon"&&M++;break;case"MultiPolygon":for(o=0;o<a.length;o++){for($=0,r=0;r<a[o].length;r++){for(i=0;i<a[o][r].length-u;i++){if(e(a[o][r][i],f,C,M,$)===!1)return!1;f++}$++}M++}break;case"GeometryCollection":for(o=0;o<s.geometries.length;o++)if(Je(s.geometries[o],e,n)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function ge(t){var e=[1/0,1/0,-1/0,-1/0];return Je(t,function(n){e[0]>n[0]&&(e[0]=n[0]),e[1]>n[1]&&(e[1]=n[1]),e[2]<n[0]&&(e[2]=n[0]),e[3]<n[1]&&(e[3]=n[1])}),e}ge.default=ge;var Xt="Expected a function",Te=0/0,en="[object Symbol]",tn=/^\s+|\s+$/g,nn=/^[-+]0x[0-9a-f]+$/i,on=/^0b[01]+$/i,rn=/^0o[0-7]+$/i,sn=parseInt,an=typeof J=="object"&&J&&J.Object===Object&&J,ln=typeof self=="object"&&self&&self.Object===Object&&self,cn=an||ln||Function("return this")(),un=Object.prototype,dn=un.toString,fn=Math.max,pn=Math.min,de=function(){return cn.Date.now()};function hn(t,e,n){var o,r,i,s,l,a,d=0,u=!1,f=!1,m=!0;if(typeof t!="function")throw new TypeError(Xt);e=_e(e)||0,ye(n)&&(u=!!n.leading,f="maxWait"in n,i=f?fn(_e(n.maxWait)||0,e):i,m="trailing"in n?!!n.trailing:m);function g(L){var A=o,D=r;return o=r=void 0,d=L,s=t.apply(D,A),s}function y(L){return d=L,l=setTimeout(C,e),u?g(L):s}function b(L){var A=L-a,D=L-d,B=e-A;return f?pn(B,i-D):B}function v(L){var A=L-a,D=L-d;return a===void 0||A>=e||A<0||f&&D>=i}function C(){var L=de();if(v(L))return S(L);l=setTimeout(C,b(L))}function S(L){return l=void 0,m&&o?g(L):(o=r=void 0,s)}function M(){l!==void 0&&clearTimeout(l),d=0,o=a=r=l=void 0}function $(){return l===void 0?s:S(de())}function w(){var L=de(),A=v(L);if(o=arguments,r=this,a=L,A){if(l===void 0)return y(a);if(f)return l=setTimeout(C,e),g(a)}return l===void 0&&(l=setTimeout(C,e)),s}return w.cancel=M,w.flush=$,w}function ye(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function mn(t){return!!t&&typeof t=="object"}function gn(t){return typeof t=="symbol"||mn(t)&&dn.call(t)==en}function _e(t){if(typeof t=="number")return t;if(gn(t))return Te;if(ye(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=ye(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(tn,"");var n=on.test(t);return n||rn.test(t)?sn(t.slice(2),n?2:8):nn.test(t)?Te:+t}var yn=hn;const Me=()=>{const[t,e]=h.exports.useState(!1);return h.exports.useLayoutEffect(()=>{const n=()=>{e(window.innerWidth<xe.screenSizes.tablet)};return window.addEventListener("resize",yn(n,250)),n(),()=>window.removeEventListener("resize",n)},[]),t};function Xe(){var l;const{client:t}=Ce(),{sdkState:e}=N(),n=be(e.options,250),{activeScore:o}=I(),r=o?W[o]:void 0,s={...h.exports.useMemo(()=>n!=null&&n.marker?n.marker:{lat:n==null?void 0:n.lat,lng:n==null?void 0:n.lng},[n]),limit:10,radius:2e3,include:r};return se(Ct.list(s),async()=>t.getPois(s),{enabled:!!s&&!!((l=s.include)!=null&&l.length)&&!!s.lat&&!!s.lng})}function et(){const{client:t}=Ce(),{sdkState:e}=N(),n=be(e.options,250),{activeScore:o}=I(),r=o==="high_schools"||o==="primary_schools",s={...h.exports.useMemo(()=>n!=null&&n.marker?n.marker:{lat:n==null?void 0:n.lat,lng:n==null?void 0:n.lng},[n]),limit:10,radius:2e3};return se(bt.list(s),async()=>t.getSchools(s),{enabled:!!s&&!!s.lat&&!!s.lng&&r})}const tt=O.createContext({}),nt=()=>h.exports.useContext(tt),vn=({children:t,mapRef:e,mapPadding:n})=>c(tt.Provider,{value:{mapRef:e,mapPadding:n},children:t});function ve(t,e,n,o,r,i){if(r-o<=n)return;const s=o+r>>1;ot(t,e,s,o,r,i%2),ve(t,e,n,o,s-1,i+1),ve(t,e,n,s+1,r,i+1)}function ot(t,e,n,o,r,i){for(;r>o;){if(r-o>600){const d=r-o+1,u=n-o+1,f=Math.log(d),m=.5*Math.exp(2*f/3),g=.5*Math.sqrt(f*m*(d-m)/d)*(u-d/2<0?-1:1),y=Math.max(o,Math.floor(n-u*m/d+g)),b=Math.min(r,Math.floor(n+(d-u)*m/d+g));ot(t,e,n,y,b,i)}const s=e[2*n+i];let l=o,a=r;for(U(t,e,o,n),e[2*r+i]>s&&U(t,e,o,r);l<a;){for(U(t,e,l,a),l++,a--;e[2*l+i]<s;)l++;for(;e[2*a+i]>s;)a--}e[2*o+i]===s?U(t,e,o,a):(a++,U(t,e,a,r)),a<=n&&(o=a+1),n<=a&&(r=a-1)}}function U(t,e,n,o){fe(t,n,o),fe(e,2*n,2*o),fe(e,2*n+1,2*o+1)}function fe(t,e,n){const o=t[e];t[e]=t[n],t[n]=o}function xn(t,e,n,o,r,i,s){const l=[0,t.length-1,0],a=[];let d,u;for(;l.length;){const f=l.pop(),m=l.pop(),g=l.pop();if(m-g<=s){for(let v=g;v<=m;v++)d=e[2*v],u=e[2*v+1],d>=n&&d<=r&&u>=o&&u<=i&&a.push(t[v]);continue}const y=Math.floor((g+m)/2);d=e[2*y],u=e[2*y+1],d>=n&&d<=r&&u>=o&&u<=i&&a.push(t[y]);const b=(f+1)%2;(f===0?n<=d:o<=u)&&(l.push(g),l.push(y-1),l.push(b)),(f===0?r>=d:i>=u)&&(l.push(y+1),l.push(m),l.push(b))}return a}function Cn(t,e,n,o,r,i){const s=[0,t.length-1,0],l=[],a=r*r;for(;s.length;){const d=s.pop(),u=s.pop(),f=s.pop();if(u-f<=i){for(let v=f;v<=u;v++)Re(e[2*v],e[2*v+1],n,o)<=a&&l.push(t[v]);continue}const m=Math.floor((f+u)/2),g=e[2*m],y=e[2*m+1];Re(g,y,n,o)<=a&&l.push(t[m]);const b=(d+1)%2;(d===0?n-r<=g:o-r<=y)&&(s.push(f),s.push(m-1),s.push(b)),(d===0?n+r>=g:o+r>=y)&&(s.push(m+1),s.push(u),s.push(b))}return l}function Re(t,e,n,o){const r=t-n,i=e-o;return r*r+i*i}const bn=t=>t[0],wn=t=>t[1];class Oe{constructor(e,n=bn,o=wn,r=64,i=Float64Array){this.nodeSize=r,this.points=e;const s=e.length<65536?Uint16Array:Uint32Array,l=this.ids=new s(e.length),a=this.coords=new i(e.length*2);for(let d=0;d<e.length;d++)l[d]=d,a[2*d]=n(e[d]),a[2*d+1]=o(e[d]);ve(l,a,r,0,l.length-1,0)}range(e,n,o,r){return xn(this.ids,this.coords,e,n,o,r,this.nodeSize)}within(e,n,o){return Cn(this.ids,this.coords,e,n,o,this.nodeSize)}}const Mn={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 $n{constructor(e){this.options=K(Object.create(Mn),e),this.trees=new Array(this.options.maxZoom+1)}load(e){const{log:n,minZoom:o,maxZoom:r,nodeSize:i}=this.options;n&&console.time("total time");const s=`prepare ${e.length} points`;n&&console.time(s),this.points=e;let l=[];for(let a=0;a<e.length;a++)!e[a].geometry||l.push(Ln(e[a],a));this.trees[r+1]=new Oe(l,je,De,i,Float32Array),n&&console.timeEnd(s);for(let a=r;a>=o;a--){const d=+Date.now();l=this._cluster(l,a),this.trees[a]=new Oe(l,je,De,i,Float32Array),n&&console.log("z%d: %d clusters in %dms",a,l.length,+Date.now()-d)}return n&&console.timeEnd("total time"),this}getClusters(e,n){let o=((e[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,e[1]));let i=e[2]===180?180:((e[2]+180)%360+360)%360-180;const s=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)o=-180,i=180;else if(o>i){const u=this.getClusters([o,r,180,s],n),f=this.getClusters([-180,r,i,s],n);return u.concat(f)}const l=this.trees[this._limitZoom(n)],a=l.range(ne(o),oe(s),ne(i),oe(r)),d=[];for(const u of a){const f=l.points[u];d.push(f.numPoints?ze(f):this.points[f.index])}return d}getChildren(e){const n=this._getOriginId(e),o=this._getOriginZoom(e),r="No cluster with the specified id.",i=this.trees[o];if(!i)throw new Error(r);const s=i.points[n];if(!s)throw new Error(r);const l=this.options.radius/(this.options.extent*Math.pow(2,o-1)),a=i.within(s.x,s.y,l),d=[];for(const u of a){const f=i.points[u];f.parentId===e&&d.push(f.numPoints?ze(f):this.points[f.index])}if(d.length===0)throw new Error(r);return d}getLeaves(e,n,o){n=n||10,o=o||0;const r=[];return this._appendLeaves(r,e,n,o,0),r}getTile(e,n,o){const r=this.trees[this._limitZoom(e)],i=Math.pow(2,e),{extent:s,radius:l}=this.options,a=l/s,d=(o-a)/i,u=(o+1+a)/i,f={features:[]};return this._addTileFeatures(r.range((n-a)/i,d,(n+1+a)/i,u),r.points,n,o,i,f),n===0&&this._addTileFeatures(r.range(1-a/i,d,1,u),r.points,i,o,i,f),n===i-1&&this._addTileFeatures(r.range(0,d,a/i,u),r.points,-1,o,i,f),f.features.length?f:null}getClusterExpansionZoom(e){let n=this._getOriginZoom(e)-1;for(;n<=this.options.maxZoom;){const o=this.getChildren(e);if(n++,o.length!==1)break;e=o[0].properties.cluster_id}return n}_appendLeaves(e,n,o,r,i){const s=this.getChildren(n);for(const l of s){const a=l.properties;if(a&&a.cluster?i+a.point_count<=r?i+=a.point_count:i=this._appendLeaves(e,a.cluster_id,o,r,i):i<r?i++:e.push(l),e.length===o)break}return i}_addTileFeatures(e,n,o,r,i,s){for(const l of e){const a=n[l],d=a.numPoints;let u,f,m;if(d)u=rt(a),f=a.x,m=a.y;else{const b=this.points[a.index];u=b.properties,f=ne(b.geometry.coordinates[0]),m=oe(b.geometry.coordinates[1])}const g={type:1,geometry:[[Math.round(this.options.extent*(f*i-o)),Math.round(this.options.extent*(m*i-r))]],tags:u};let y;d?y=a.id:this.options.generateId?y=a.index:this.points[a.index].id&&(y=this.points[a.index].id),y!==void 0&&(g.id=y),s.features.push(g)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,n){const o=[],{radius:r,extent:i,reduce:s,minPoints:l}=this.options,a=r/(i*Math.pow(2,n));for(let d=0;d<e.length;d++){const u=e[d];if(u.zoom<=n)continue;u.zoom=n;const f=this.trees[n+1],m=f.within(u.x,u.y,a),g=u.numPoints||1;let y=g;for(const b of m){const v=f.points[b];v.zoom>n&&(y+=v.numPoints||1)}if(y>g&&y>=l){let b=u.x*g,v=u.y*g,C=s&&g>1?this._map(u,!0):null;const S=(d<<5)+(n+1)+this.points.length;for(const M of m){const $=f.points[M];if($.zoom<=n)continue;$.zoom=n;const w=$.numPoints||1;b+=$.x*w,v+=$.y*w,$.parentId=S,s&&(C||(C=this._map(u,!0)),s(C,this._map($)))}u.parentId=S,o.push(Sn(b/y,v/y,S,y,C))}else if(o.push(u),y>1)for(const b of m){const v=f.points[b];v.zoom<=n||(v.zoom=n,o.push(v))}}return o}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,n){if(e.numPoints)return n?K({},e.properties):e.properties;const o=this.points[e.index].properties,r=this.options.map(o);return n&&r===o?K({},r):r}}function Sn(t,e,n,o,r){return{x:ie(t),y:ie(e),zoom:1/0,id:n,parentId:-1,numPoints:o,properties:r}}function Ln(t,e){const[n,o]=t.geometry.coordinates;return{x:ie(ne(n)),y:ie(oe(o)),zoom:1/0,index:e,parentId:-1}}function ze(t){return{type:"Feature",id:t.id,properties:rt(t),geometry:{type:"Point",coordinates:[kn(t.x),En(t.y)]}}}function rt(t){const e=t.numPoints,n=e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?`${Math.round(e/100)/10}k`:e;return K(K({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:n})}function ne(t){return t/360+.5}function oe(t){const e=Math.sin(t*Math.PI/180),n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return n<0?0:n>1?1:n}function kn(t){return(t-.5)*360}function En(t){const e=(180-t*360)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function K(t,e){for(const n in e)t[n]=e[n];return t}function je(t){return t.x}function De(t){return t.y}var Ze=Object.prototype.hasOwnProperty;function Ne(t,e,n){for(n of t.keys())if(Z(n,e))return n}function Z(t,e){var n,o,r;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((o=t.length)===e.length)for(;o--&&Z(t[o],e[o]););return o===-1}if(n===Set){if(t.size!==e.size)return!1;for(o of t)if(r=o,r&&typeof r=="object"&&(r=Ne(e,r),!r)||!e.has(r))return!1;return!0}if(n===Map){if(t.size!==e.size)return!1;for(o of t)if(r=o[0],r&&typeof r=="object"&&(r=Ne(e,r),!r)||!Z(o[1],e.get(r)))return!1;return!0}if(n===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(n===DataView){if((o=t.byteLength)===e.byteLength)for(;o--&&t.getInt8(o)===e.getInt8(o););return o===-1}if(ArrayBuffer.isView(t)){if((o=t.byteLength)===e.byteLength)for(;o--&&t[o]===e[o];);return o===-1}if(!n||typeof t=="object"){o=0;for(n in t)if(Ze.call(t,n)&&++o&&!Ze.call(e,n)||!(n in e)||!Z(t[n],e[n]))return!1;return Object.keys(e).length===o}}return t!==t&&e!==e}function Pn(t){var e=h.exports.useRef(t),n=h.exports.useRef(0);return Z(t,e.current)||(e.current=t,n.current+=1),h.exports.useMemo(function(){return e.current},[n.current])}function In(t,e){return h.exports.useEffect(t,Pn(e))}var An=function(e){var n=e.points,o=e.bounds,r=e.zoom,i=e.options,s=h.exports.useRef(),l=h.exports.useRef(),a=h.exports.useState([]),d=a[0],u=a[1],f=Math.round(r);return In(function(){(!s.current||!Z(l.current,n)||!Z(s.current.options,i))&&(s.current=new $n(i),s.current.load(n)),o&&u(s.current.getClusters(o,f)),l.current=n},[n,o,f,i]),{clusters:d,supercluster:s.current}};const Tn=x(jt.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
|
+
`,_n=x.ul`
|
|
21
|
+
list-style: none;
|
|
22
|
+
padding: 0;
|
|
23
|
+
margin: 0;
|
|
24
|
+
`,Rn=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
|
+
`,it=({poi:t,poiType:e,rect:n,activePOI:o,hoveredPOI:r,isMapMoving:i,setActivePOI:s,isMobile:l})=>{const a=o===t,d=r===t,u=["rapid_transit_stations"];return c(Ue,{latitude:t.lat,longitude:t.lng,style:{zIndex:a?1:0},children:k(le.Root,{options:{type:e,poi:t,isOpen:i?!1:a,isHovered:d,side:"top",size:u.includes(e)?"medium":"small",collisionPadding:l?{top:n.height+32,bottom:H*2,left:H*2,right:H*2}:{left:n.width+32,right:H*2,top:H*2,bottom:H*2}},onChange:f=>{f.type==="open-change"&&(f.data?setTimeout(()=>{s(t)},0):a&&s(void 0))},children:[c(le.Marker,{}),c(le.Content,{})]})})},On={default:{scale:1},hovered:{scale:1.2}},He=17,zn=({cluster:t,supercluster:e,pointsCount:n,onClick:o,zoom:r,activePOI:i,hoveredPOI:s,setActivePOI:l,rect:a,isMobile:d,isMapMoving:u})=>{const[f,m]=h.exports.useState(!1),y=20+t.properties.point_count/n*25,b=()=>{if(r>He){m(!0);return}o&&o(t)},v=M=>{r<=He||m(M)},C=h.exports.useMemo(()=>e==null?void 0:e.getChildren(t.id).map(M=>M.properties).filter(M=>!!M),[e,t]),S=C==null?void 0:C.find(M=>!!i&&M.poi===i);return S?c(it,{rect:a,poi:S.poi,poiType:S.type,isMobile:d,activePOI:i,hoveredPOI:s,isMapMoving:u,setActivePOI:l}):k(ce.Root,{open:u?!1:f,onOpenChange:v,children:[c(ce.Trigger,{children:c(Tn,{diameter:y,onClick:b,variants:On,animate:f?"hovered":"default",whileHover:{scale:1.2},transition:xe.transitions.default,children:t.properties.point_count})}),c(ce.Content,{side:"top",children:c(_n,{children:C==null?void 0:C.map((M,$)=>{var w;return c(Rn,{onClick:()=>l(M.poi),children:(w=M.poi)==null?void 0:w.name},$)})})})]})};function jn(t){return t.properties.cluster!==void 0}const st=O.memo(({rect:t,zoom:e,mapRef:n,points:o,isMobile:r,activePOI:i,hoveredPOI:s,isMapMoving:l,setActivePOI:a})=>{var m;const d=(m=n==null?void 0:n.current)==null?void 0:m.getMap().getBounds().toArray().flat(),{clusters:u,supercluster:f}=An({points:o,bounds:d,zoom:e,options:{radius:50,maxZoom:30}});return c(Y,{children:u.map((g,y)=>{const[b,v]=g.geometry.coordinates;return jn(g)?c(Ue,{latitude:v,longitude:b,children:c(zn,{rect:t,zoom:e,cluster:g,supercluster:f,pointsCount:o.length,activePOI:i,setActivePOI:a,isMobile:r,isMapMoving:l,hoveredPOI:s,onClick:()=>{var S;const C=Math.min(f.getClusterExpansionZoom(g.id),20);(S=n.current)==null||S.flyTo({zoom:C,center:[b,v],duration:1e3,essential:!0})}})},`cluster-${g.id}`):c(it,{rect:t,poi:g.properties.poi,poiType:g.properties.type,isMobile:r,activePOI:i,hoveredPOI:s,isMapMoving:l,setActivePOI:a},y)})})});st.displayName="Markers";const at=t=>h.exports.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...t},h.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"})),lt=t=>h.exports.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},h.exports.createElement("path",{d:"M10 20V14H14V20H19V12H22L12 3L2 12H5V20H10Z"}));function $e(t){const{client:e}=Ce(),{sdkState:n}=N(),o=be(n.options,250),i={...h.exports.useMemo(()=>o!=null&&o.marker?o.marker:{lat:o==null?void 0:o.lat,lng:o==null?void 0:o.lng},[o]),geographyLevels:["20","30"],locationScoresRounding:!1,include:t};return se(wt.list(i),async()=>e.getScores(i),{enabled:!!i})}const Dn=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
|
+
`,Zn=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
|
+
`,Nn=()=>{var s,l;const{sdkState:t}=N(),{activeCategory:e,activeScore:n}=I(),o=Q.find(a=>a.value===e),{data:r,isLoading:i}=$e(o.scores);return n&&(r==null?void 0:r.location[n])?i?c("div",{children:"Loading"}):c(P.Root,{options:{score:n,scoresData:r},children:k(Dn,{children:[k(Zn,{children:[c(P.Badge,{}),c(P.BarChart,{options:{locationIcon:((l=(s=t.options)==null?void 0:s.marker)==null?void 0:l.icon)==="pin"?at:lt}})]}),c(P.Description,{})]})}):null},Hn=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
|
+
`,Vn=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
|
+
`,Bn=x.div`
|
|
77
|
+
position: absolute;
|
|
78
|
+
top: -6px;
|
|
79
|
+
right: 4px;
|
|
80
|
+
border: 2px solid ${p["--ll-color-background"]};
|
|
81
|
+
border-radius: 6px;
|
|
82
|
+
`,Gn=x.div`
|
|
83
|
+
flex: 1;
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
`,Un=x.div`
|
|
87
|
+
margin: 0 2px;
|
|
88
|
+
`,Fn=({category:t})=>{const{data:e,isLoading:n,isFetching:o}=$e(t.scores),{activeScore:r,setActiveScore:i,setActiveCategory:s}=I();return c(Hn,{children:t.scores.map(l=>{const a=l===r,d=a?"--ll-color-primary":"--ll-color-disabled";return n||o?c(Un,{children:c(q,{height:"44px",width:"60px"})},l):c(P.Root,{options:{score:l,scoresData:e},children:k(Vn,{onClick:()=>{s(t.value),i(l)},children:[c(P.Icon,{options:{color:d,height:28,width:28}}),c(Gn,{children:c(P.Title,{options:{variant:"caption1",color:d,noWrap:!0,noMargin:!0,weight:"--ll-font-weight-bold"}})}),c(Bn,{children:c(P.Badge,{options:{variant:"small",isPrimary:a}})})]})},l)})})},Wn=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
|
+
`,Kn=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
|
+
`,ct=O.forwardRef((t,e)=>{const{activeCategory:n,setActiveCategory:o}=I();return k(Kn,{ref:e,children:[c(Wn,{children:k(z.Root,{value:n,onValueChange:r=>o(r),children:[c(z.Trigger,{size:"large",children:c(X.Root,{options:{scoreCategory:n},children:c(X.Title,{options:{color:"inherit",noMargin:!0,variant:"h6",lineHeight:1}})},n)}),c(z.Content,{children:Q.map(r=>c(X.Root,{options:{scoreCategory:r.value},children:c(z.Item,{value:r.value,children:c(X.Title,{options:{color:"inherit",noMargin:!0,variant:"h6"}})})},r.value))})]})}),c(Fn,{category:Q.find(r=>r.value===n)}),c(Nn,{})]})});ct.displayName="MobileScores";const Qn=Fe({from:{height:0},to:{height:"var(--radix-accordion-content-height)"}}),Yn=Fe({from:{height:"var(--radix-accordion-content-height)"},to:{height:0}}),qn=x(Mt)`
|
|
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
|
+
`,ut=x($t)`
|
|
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
|
+
`,Jn=x(St)`
|
|
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
|
+
animation: ${Qn} 300ms cubic-bezier(0.87, 0, 0.13, 1);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
[data-state="closed"] & {
|
|
134
|
+
animation: ${Yn} 300ms cubic-bezier(0.87, 0, 0.13, 1);
|
|
135
|
+
}
|
|
136
|
+
`,Xn=x.div`
|
|
137
|
+
padding: ${p["--ll-spacing-medium"]};
|
|
138
|
+
border-top: 1px solid ${p["--ll-color-border"]};
|
|
139
|
+
border-bottom: 1px solid ${p["--ll-color-border"]};
|
|
140
|
+
`,eo=x.span`
|
|
141
|
+
${ut}[data-state=open] & {
|
|
142
|
+
transform: rotate(90deg);
|
|
143
|
+
} ;
|
|
144
|
+
`;x.div`
|
|
145
|
+
display: flex;
|
|
146
|
+
align-items: flex-start;
|
|
147
|
+
justify-content: space-between;
|
|
148
|
+
`;const Se=x.div`
|
|
149
|
+
margin: ${p["--ll-spacing-small"]} 0;
|
|
150
|
+
`,to=x.div`
|
|
151
|
+
margin-top: ${p["--ll-spacing-large"]};
|
|
152
|
+
&:empty {
|
|
153
|
+
margin: 0;
|
|
154
|
+
}
|
|
155
|
+
`,no=({score:t})=>{const{data:e,isLoading:n}=et(),{activePOI:o,setActivePOI:r,hoveredPOI:i,setHoveredPOI:s}=I(),{mapRef:l,mapPadding:a}=nt();return n?c(Y,{children:[...Array(10)].map((d,u)=>c(Se,{children:c(q,{height:"34px",width:"100%"})},u))}):e?c(We.Root,{options:{type:"school",data:e==null?void 0:e[t],activePOI:o,hoveredPOI:i},onChange:d=>{var u;if(d.type==="poi-click"){const f=d.data;r(f);const m=window.innerWidth-a.left,g=window.innerWidth/2,y=m/2+a.left-g;f&&((u=l.current)==null||u.easeTo({zoom:18,center:[f.lng,f.lat],duration:1e3,offset:[y,0]}))}d.type==="poi-hover"&&s(d.data)}}):null},dt=O.memo(({result:t,poi:e})=>{const{activePOI:n,setActivePOI:o,hoveredPOI:r,setHoveredPOI:i}=I(),{mapRef:s,mapPadding:l}=nt();return!t.data||!t.data[e]?null:c(me.Content,{options:{value:e},children:c(We.Root,{options:{type:"poi",data:t.data[e],activePOI:n,hoveredPOI:r},onChange:a=>{var d;if(a.type==="poi-click"){const u=a.data;o(u);const f=window.innerWidth-l.left,m=window.innerWidth/2,g=f/2+l.left-m;u&&((d=s.current)==null||d.flyTo({zoom:18,center:[u.lng,u.lat],duration:1e3,offset:[g,0],essential:!0}))}a.type==="poi-hover"&&i(a.data)}})},e)});dt.displayName="POI";const ft=O.memo(({include:t})=>{const e=Xe(),n=t==null?void 0:t.filter(o=>{var r;return(((r=e==null?void 0:e.data)==null?void 0:r[o])||[]).length>0});return e.isLoading&&n.length?c(Y,{children:[...Array(10)].map((o,r)=>c(Se,{children:c(q,{height:"34px",width:"100%"})},r))}):e.data?k(me.Root,{options:{include:n},children:[c(me.Tabs,{}),n.map(o=>c(dt,{poi:o,result:e},o))]}):null});ft.displayName="POIs";const pt=O.memo(({score:t,isLoading:e,scoresData:n})=>{var s,l;const{sdkState:o}=N(),{activeScore:r}=I(),i=t===r;return e?c(Se,{children:c(q,{height:"34px",width:"100%"},t)}):n!=null&&n.location[t]?c(Lt,{value:t,children:k(P.Root,{options:{score:t,scoresData:n},children:[c(qn,{children:k(ut,{children:[c(eo,{children:c(Ke,{SVGElement:kt,fill:p["--ll-color-on-background-variant1"]})}),c(V,{spacing:"--ll-spacing-small"}),c(P.Icon,{}),c(V,{spacing:"--ll-spacing-small"}),c(P.Title,{}),c(V,{}),c(P.Badge,{options:{isPrimary:i}})]})}),c(Jn,{children:k(Xn,{children:[c(P.Description,{}),c(V,{vertical:!0,spacing:"--ll-spacing-small"}),c(P.BarChart,{options:{locationIcon:((l=(s=o.options)==null?void 0:s.marker)==null?void 0:l.icon)==="pin"?at:lt}}),c(to,{children:t==="high_schools"||t==="primary_schools"?c(no,{score:t}):c(ft,{include:W[t]})})]})})]})},t):null});pt.displayName="Score";const oo=x.div`
|
|
156
|
+
padding: ${p["--ll-spacing-small"]} ${p["--ll-spacing-medium"]};
|
|
157
|
+
`,ro=x.div`
|
|
158
|
+
display: flex;
|
|
159
|
+
justify-content: space-between;
|
|
160
|
+
align-items: center;
|
|
161
|
+
`,ht=O.memo(({tabContent:t})=>{const{data:e,isLoading:n,isFetching:o}=$e(t.scores),{translations:r}=we();return k(oo,{children:[k(ro,{children:[c(te.Title,{options:{variant:"h4",noMargin:!0,weight:"--ll-font-weight-medium"}}),o&&!n&&c(Dt,{size:"small"})]}),c(V,{spacing:"--ll-spacing-small",vertical:!0}),!o&&!Object.keys((e==null?void 0:e.location)||{}).length&&c(F,{color:"--ll-color-on-background-variant1",children:r.EMPTY_TEXT}),t.scores.map(i=>c(pt,{score:i,isLoading:n,scoresData:e},i))]})});ht.displayName="ScoreCategory";const mt=O.memo(({tabContent:t})=>{const{activeScore:e,setActiveScore:n}=I();return h.exports.useEffect(()=>{n(t.scores[0])},[]),c(Et,{value:e,onValueChange:o=>{n(o)},type:"single",collapsible:!0,children:c(ht,{tabContent:t})})});mt.displayName="ScoreCategoryAccordion";const io=x.div`
|
|
162
|
+
overflow-y: auto;
|
|
163
|
+
`,so=x.div`
|
|
164
|
+
position: absolute;
|
|
165
|
+
top: ${p["--ll-spacing-medium"]};
|
|
166
|
+
left: ${p["--ll-spacing-medium"]};
|
|
167
|
+
width: 360px;
|
|
168
|
+
max-height: calc(100% - 2 * ${p["--ll-spacing-medium"]});
|
|
169
|
+
z-index: 1;
|
|
170
|
+
border-radius: ${p["--ll-border-radius-medium"]};
|
|
171
|
+
box-shadow: rgba(0, 0, 0, 0.15) 0px 3px 8px;
|
|
172
|
+
background-color: #fff;
|
|
173
|
+
overflow: hidden;
|
|
174
|
+
display: flex;
|
|
175
|
+
flex-direction: column;
|
|
176
|
+
background-color: ${p["--ll-color-background"]};
|
|
177
|
+
border: 1px solid ${p["--ll-color-border"]};
|
|
178
|
+
`;x.div`
|
|
179
|
+
display: flex;
|
|
180
|
+
justify-content: center;
|
|
181
|
+
padding: ${p["--ll-spacing-small"]};
|
|
182
|
+
`;const ao=x.div`
|
|
183
|
+
padding: ${p["--ll-spacing-xx-small"]};
|
|
184
|
+
border-bottom: 1px solid ${p["--ll-color-border"]};
|
|
185
|
+
`,lo=x.div`
|
|
186
|
+
display: flex;
|
|
187
|
+
justify-content: center;
|
|
188
|
+
padding: ${p["--ll-spacing-small"]};
|
|
189
|
+
background-color: ${p["--ll-color-background"]};
|
|
190
|
+
`,gt=()=>c(lo,{children:c(Zt.Root,{})}),yt=O.forwardRef((t,e)=>{const{activeCategory:n,setActiveCategory:o}=I();return c(te.Root,{options:{currentTab:n},onChange:r=>{o(r.data)},children:k(so,{ref:e,children:[c(ao,{children:c(te.Tabs,{})}),c(io,{children:Q.map(r=>c(te.Content,{options:{value:r.value},children:c(mt,{tabContent:r},r.value)},r.value))}),c(gt,{})]})})});yt.displayName="DesktopScores";const co=x.div`
|
|
191
|
+
position: relative;
|
|
192
|
+
display: flex;
|
|
193
|
+
flex-direction: column;
|
|
194
|
+
height: 100vh;
|
|
195
|
+
`,Ve=t=>h.exports.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...t},h.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"})),uo=t=>h.exports.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...t},h.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"}),h.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"}),h.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"})),fo=t=>h.exports.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...t},h.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"})),po=t=>h.exports.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...t},h.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"})),vt={all:()=>["commute-calc"],list:t=>[...vt.all(),t]},ho="https://router.hereapi.com/v8/routes?";function mo({transportMode:t,origin:e,destination:n}){const o={return:"polyline,summary,typicalDuration",transportMode:t,origin:e,destination:`${n==null?void 0:n.lat},${n==null?void 0:n.lng}`,apiKey:"KDL0aAzsbOcv7p53P2ovno2izfDOe93hyzZRrayktbE"},r=()=>fetch(ho+new URLSearchParams(o)).then(i=>i.json()).then(i=>i.routes.length>0&&i.routes[0].sections.length>0?i.routes[0].sections[0]:[]).catch(i=>{Nt(i)});return se(vt.list(o),r,{enabled:!!o&&!!n&&!!e})}const pe=(t,e,n)=>e===1?t:n!=null?n:`${t}s`,go=[62,-1,-1,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,63,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],yo=1,_=typeof BigInt<"u"?BigInt:Number;function vo(t){const e=t.charCodeAt(0);return go[e-45]}function xo(t){let e=_(0),n=_(0);const o=[];if(t.split("").forEach(r=>{const i=_(vo(r));e|=(i&_(31))<<n,(i&_(32))===_(0)?(o.push(e),e=_(0),n=_(0)):n+=_(5)}),n>0)throw new Error("Invalid encoding");return o}function Co(t,e){if(+t.toString()!==yo)throw new Error("Invalid format version");const n=+e.toString(),o=n&15,r=n>>4&7,i=n>>7&15;return{precision:o,thirdDim:r,thirdDimPrecision:i}}function he(t){let e=t;return e&_(1)&&(e=~e),e>>=_(1),+e.toString()}function bo(t){const e=xo(t),n=Co(e[0],e[1]),o=10**n.precision,r=10**n.thirdDimPrecision,{thirdDim:i}=n;let s=0,l=0,a=0;const d=[];let u=2;for(;u<e.length;){const m=he(e[u])/o,g=he(e[u+1])/o;if(s+=m,l+=g,i){const y=he(e[u+2])/r;a+=y,d.push([l,s,a]),u+=3}else d.push([l,s]),u+=2}if(u!==e.length)throw new Error("Invalid encoding. Premature ending reached");return{type:"FeatureCollection",features:[{id:"route",type:"Feature",geometry:{type:"LineString",coordinates:d}}]}}const wo=x.div`
|
|
196
|
+
max-height: calc(100% - 2 * ${p["--ll-spacing-medium"]});
|
|
197
|
+
border-radius: ${p["--ll-border-radius-medium"]};
|
|
198
|
+
box-shadow: ${p["--ll-shadow-small"]};
|
|
199
|
+
background-color: ${p["--ll-color-background"]};
|
|
200
|
+
border: 1px solid ${p["--ll-color-border"]};
|
|
201
|
+
padding: ${p["--ll-spacing-x-small"]};
|
|
202
|
+
`,Mo=x.div`
|
|
203
|
+
display: flex;
|
|
204
|
+
justify-content: space-between;
|
|
205
|
+
align-items: end;
|
|
206
|
+
|
|
207
|
+
${Pt} {
|
|
208
|
+
width: 229px;
|
|
209
|
+
margin-right: ${p["--ll-spacing-x-small"]};
|
|
210
|
+
}
|
|
211
|
+
`,Be=x.div`
|
|
212
|
+
background-color: ${p["--ll-color-surface"]};
|
|
213
|
+
padding: ${p["--ll-spacing-x-small"]} ${p["--ll-spacing-small"]} 0;
|
|
214
|
+
border-radius: ${p["--ll-border-radius-medium"]};
|
|
215
|
+
`,$o=x(Qe)`
|
|
216
|
+
position: absolute;
|
|
217
|
+
right: ${p["--ll-spacing-xx-small"]};
|
|
218
|
+
top: ${p["--ll-spacing-xx-small"]};
|
|
219
|
+
`,xt=({className:t,onClose:e})=>{var C,S,M,$;const{sdkState:n}=N(),{setCommuteGeojson:o,destination:r,setDestination:i}=I(),[s,l]=h.exports.useState("pedestrian"),a=Me(),{translations:d}=we(),{data:u,isFetching:f,isFetched:m}=mo({destination:r,transportMode:s,origin:`${(S=(C=n==null?void 0:n.options)==null?void 0:C.marker)==null?void 0:S.lat},${($=(M=n==null?void 0:n.options)==null?void 0:M.marker)==null?void 0:$.lng}`});h.exports.useEffect(()=>{!(u!=null&&u.summary)||o(bo(u.polyline))},[u]);const g={pedestrian:[d.WALKING,fo],car:[d.DRIVING,uo]},y=h.exports.useMemo(()=>{if(!(u!=null&&u.summary))return null;const w=Math.floor(u.summary.typicalDuration/60/60),L=Math.floor(u.summary.typicalDuration/60%60);return w===0?`${L} ${pe(d.MINUTE,L)}`:`${w} ${pe(d.HOUR,w)} ${L} ${pe(d.MINUTE,L)}`},[u]),b=h.exports.useMemo(()=>{if(!(u!=null&&u.summary))return null;const w=Math.floor(u.summary.length/1e3);return w===0?`${u.summary.length} m`:`${w} km`},[u]),v=()=>f?c(q,{height:"70.4px",width:"100%"}):u!=null&&u.summary?k(Be,{children:[c(F,{variant:"h5",children:y}),k(F,{children:[b," \u2013 ",d.FAST_ROUTE]})]}):k(Be,{children:[c(F,{variant:"h5",children:d.NO_ROUTE}),c(F,{children:d.TRY_SUGGESTION})]});return k(wo,{className:t,children:[c($o,{size:"medium",color:"neutral",onClick:e,SVGElement:po}),k(Mo,{children:[c(It,{label:d.CALCULATE_COMMUTE,placeholder:d.SEARCH_MAP,renderListAbove:a,renderListAbovePosition:30,onSearch:w=>{i({lat:w.latitude,lng:w.longitude})}}),c(z.Root,{value:s,onValueChange:w=>{l(w)},children:k(z.Trigger,{children:[c(Ke,{SVGElement:g[s][1],fill:p["--ll-color-on-background-variant1"],width:16}),g[s][0],k(z.Content,{children:[c(z.Item,{value:"car",children:d.DRIVING}),c(z.Item,{value:"pedestrian",children:d.WALKING})]})]})})]}),(m||f)&&k(Y,{children:[c(V,{vertical:!0,spacing:"--ll-spacing-x-small"}),c(At,{open:!!u,children:v()})]})]})},So=x.div`
|
|
220
|
+
position: absolute;
|
|
221
|
+
bottom: 0;
|
|
222
|
+
right: 0;
|
|
223
|
+
left: 0;
|
|
224
|
+
z-index: 3;
|
|
225
|
+
`,Lo=x.div`
|
|
226
|
+
position: absolute;
|
|
227
|
+
top: ${p["--ll-spacing-medium"]};
|
|
228
|
+
right: ${p["--ll-spacing-medium"]};
|
|
229
|
+
z-index: 3;
|
|
230
|
+
max-width: 356px;
|
|
231
|
+
`,ko=x(Qe)`
|
|
232
|
+
box-shadow: ${p["--ll-shadow-medium"]};
|
|
233
|
+
position: absolute;
|
|
234
|
+
bottom: ${p["--ll-spacing-medium"]};
|
|
235
|
+
right: ${p["--ll-spacing-medium"]};
|
|
236
|
+
`,Eo=x(xt)``,Po=x(xt)`
|
|
237
|
+
border-radius: ${p["--ll-border-radius-small"]}
|
|
238
|
+
${p["--ll-border-radius-small"]} 0 0;
|
|
239
|
+
border: 0;
|
|
240
|
+
`,Io=x(Ht)`
|
|
241
|
+
box-shadow: ${p["--ll-shadow-small"]};
|
|
242
|
+
`,Ao=()=>{const{setCommuteGeojson:t,setDestination:e}=I(),[n,o]=h.exports.useState(!1),{translations:r}=we(),i=Me(),s=()=>{e(void 0),t(void 0),o(!1)},l=()=>{o(!0)};return i?c(Y,{children:n?c(So,{children:c(Po,{onClose:s})}):c(ko,{size:"large",SVGElement:Ve,onClick:l})}):c(Lo,{children:n?c(Eo,{onClose:s}):c(Io,{onClick:l,startAdornment:c(Ve,{}),children:r.CALCULATE_COMMUTE})})},To=()=>{var B,Le,ke;const{sdkState:t,setSdkState:e}=N(),{activeScore:n,activePOI:o,setActivePOI:r,hoveredPOI:i,commuteGeojson:s,destination:l}=I(),a=Me(),d=Xe(),u=et(),f=((Le=(B=t==null?void 0:t.globalOptions)==null?void 0:B.appearance)==null?void 0:Le.theme)==="night"?"dd191599-2a92-49fc-9a33-e12391753ad5":"600d69cb-288d-445e-9839-3dfe4d76b31a",m={id:"point",type:"line",paint:{"line-width":6,"line-color":"#0056D3"}},[g,y]=h.exports.useState(!1),b=h.exports.useMemo(()=>{var E,T;return(n==="high_schools"||n==="primary_schools")&&!u.isFetching?{[n]:((E=u==null?void 0:u.data)==null?void 0:E[n])||[]}:!(W&&n&&W[n]&&((T=W[n])==null?void 0:T.length))&&!d.isFetching?{[n]:[]}:d.data},[d.data,u.data,n]),v=h.exports.useMemo(()=>b?Object.entries(b).map(([T,j])=>j.map(R=>ue([R.lng,R.lat],{poi:R,type:T}))).flat().filter((T,j,R)=>R.findIndex(ae=>["lat","lng","name"].every(G=>ae.properties.poi[G]===T.properties.poi[G]))===j):[],[b]),C=h.exports.useMemo(()=>{var T,j,R;const E=((T=t==null?void 0:t.options)==null?void 0:T.marker)&&ue([(j=t==null?void 0:t.options)==null?void 0:j.marker.lng,(R=t==null?void 0:t.options)==null?void 0:R.marker.lat]);return[...v,...E?[E]:[],...l?[ue([l==null?void 0:l.lng,l==null?void 0:l.lat])]:[]]},[v,(ke=t==null?void 0:t.options)==null?void 0:ke.marker,l]),S=h.exports.useRef(),[M,$]=Tt(),w=h.exports.useMemo(()=>({top:25+$.height,bottom:25,left:25,right:25}),[$.height]),L=h.exports.useMemo(()=>({top:50,bottom:50,left:$.width+32+50,right:50}),[$.width]),A=a?w:L,D=E=>{e({...t,options:{...t.options,lat:E.viewState.latitude,lng:E.viewState.longitude,zoom:E.viewState.zoom,bearing:E.viewState.bearing,pitch:E.viewState.pitch}})};return h.exports.useEffect(()=>{var G,Ee;if(!C.length||!((G=t.options)!=null&&G.marker))return;const E=Jt(C.map(({geometry:Pe})=>[Pe.coordinates[1],Pe.coordinates[0]])),[T,j,R,ae]=ge(E);(Ee=S==null?void 0:S.current)==null||Ee.fitBounds([[j,T],[ae,R]],{maxZoom:17,padding:A,duration:1e3})},[C,A]),t.options?c(vn,{mapRef:S,mapPadding:A,children:k(co,{children:[k(_t,{ref:S,mapLib:Rt,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:D,cooperativeGestures:t.options.cooperativeGestures,onMoveStart:()=>y(!0),onMoveEnd:()=>y(!1),attributionControl:!1,children:[c(Ot,{compact:!0,position:a?"bottom-left":"bottom-right"}),c(zt,{position:a?"top-right":"bottom-right",showCompass:!0,style:{marginTop:a?16+$.height:16,marginRight:16}}),t.options.marker&&c(Ie,{marker:t.options.marker}),c(st,{rect:$,zoom:t.options.zoom,mapRef:S,points:v,isMobile:a,activePOI:o,hoveredPOI:i,isMapMoving:g,setActivePOI:r}),a?c(ct,{ref:M}):c(yt,{ref:M}),c(Ao,{}),l&&c(Ie,{marker:{icon:"pin",...l}}),s&&c(Wt,{type:"geojson",data:s,children:c(qt,{...m})})]}),a&&c(gt,{})]})}):c("div",{children:"No options provided."})},Oo=()=>c(Bt,{children:c(To,{})});export{Oo as default};
|