@mappedin/mappedin-js 6.0.0-alpha.4 → 6.0.0-alpha.6
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/lib/esm/get-venue/index.js +1 -1
- package/lib/esm/navigator/index.js +1 -1
- package/lib/esm/renderer/{browser-BSXGVGOV.js → browser-WPAQQEDG.js} +1 -1
- package/lib/esm/renderer/chunk-E2TKAR44.js +1 -0
- package/lib/esm/renderer/index.js +1 -1
- package/lib/mappedin.js +1 -1
- package/lib/node/index.js +1 -1
- package/package.json +2 -2
- package/lib/esm/renderer/chunk-3HR2E7UG.js +0 -1
package/lib/node/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _,oi=Object.create,St=Object.defineProperty,li=Object.getOwnPropertyDescriptor,ui=Object.getOwnPropertyNames,ci=Object.getPrototypeOf,di=Object.prototype.hasOwnProperty,pi=(t,e,n)=>e in t?St(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,hi=(t,e)=>()=>(t&&(e=t(t=0)),e),Qe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),mi=(t,e)=>{for(var n in e)St(t,n,{get:e[n],enumerable:!0})},Wa=(t,e,n,r)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let i of ui(e))!di.call(t,i)&&i!==n&&St(t,i,{get:()=>e[i],enumerable:!(r=li(e,i))||r.enumerable});return t},Zt=(t,e,n)=>(n=null!=t?oi(ci(t)):{},Wa(!e&&t&&t.__esModule?n:St(n,"default",{value:t,enumerable:!0}),t)),gi=t=>Wa(St({},"__esModule",{value:!0}),t),Ee=(t,e,n)=>(pi(t,"symbol"!=typeof e?e+"":e,n),n),Ha=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},C=(t,e,n)=>(Ha(t,e,"read from private field"),n?n.call(t):e.get(t)),ve=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},ue=(t,e,n,r)=>(Ha(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),w=hi((()=>{_={env:{NODE_ENV:"production",npm_package_version:"6.0.0-alpha.4"}}})),Ya=Qe(((t,e)=>{w(),function(n){var r="object"==typeof t&&t,i="object"==typeof e&&e&&e.exports==r&&e,a="object"==typeof global&&global;(a.global===a||a.window===a)&&(n=a);var s=function(t){this.message=t};(s.prototype=new Error).name="InvalidCharacterError";var o=function(t){throw new s(t)},l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=/[\t\n\f\r ]/g,h={encode:function(t){t=String(t),/[^\0-\xFF]/.test(t)&&o("The string to be encoded contains characters outside of the Latin1 range.");for(var e,n,r,i,a=t.length%3,s="",u=-1,h=t.length-a;++u<h;)e=t.charCodeAt(u)<<16,n=t.charCodeAt(++u)<<8,r=t.charCodeAt(++u),s+=l.charAt((i=e+n+r)>>18&63)+l.charAt(i>>12&63)+l.charAt(i>>6&63)+l.charAt(63&i);return 2==a?(e=t.charCodeAt(u)<<8,n=t.charCodeAt(++u),s+=l.charAt((i=e+n)>>10)+l.charAt(i>>4&63)+l.charAt(i<<2&63)+"="):1==a&&(i=t.charCodeAt(u),s+=l.charAt(i>>2)+l.charAt(i<<4&63)+"=="),s},decode:function(t){var e=(t=String(t).replace(u,"")).length;e%4==0&&(e=(t=t.replace(/==?$/,"")).length),(e%4==1||/[^+a-zA-Z0-9/]/.test(t))&&o("Invalid character: the string to be decoded is not correctly encoded.");for(var n,r,i=0,a="",s=-1;++s<e;)r=l.indexOf(t.charAt(s)),n=i%4?64*n+r:r,i++%4&&(a+=String.fromCharCode(255&n>>(-2*i&6)));return a},version:"1.0.0"};if("function"==typeof define&&"object"==typeof define.amd&&define.amd)define((function(){return h}));else if(r&&!r.nodeType)if(i)i.exports=h;else for(var c in h)h.hasOwnProperty(c)&&(r[c]=h[c]);else n.base64=h}(t)})),Ja=Qe(((t,e)=>{var n,r;w(),n=typeof self<"u"?self:t,r=function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e||4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){n.r(e),n.d(e,"computeDestinationPoint",(function(){return B})),n.d(e,"convertArea",(function(){return D})),n.d(e,"convertDistance",(function(){return j})),n.d(e,"convertSpeed",(function(){return R})),n.d(e,"decimalToSexagesimal",(function(){return z})),n.d(e,"findNearest",(function(){return U})),n.d(e,"getAreaOfPolygon",(function(){return q})),n.d(e,"getBounds",(function(){return K})),n.d(e,"getBoundsOfDistance",(function(){return J})),n.d(e,"getCenter",(function(){return Y})),n.d(e,"getCenterOfBounds",(function(){return H})),n.d(e,"getCompassDirection",(function(){return X})),n.d(e,"getCoordinateKey",(function(){return g})),n.d(e,"getCoordinateKeys",(function(){return b})),n.d(e,"getDistance",(function(){return $})),n.d(e,"getDistanceFromLine",(function(){return Z})),n.d(e,"getGreatCircleBearing",(function(){return Q})),n.d(e,"getLatitude",(function(){return F})),n.d(e,"getLongitude",(function(){return T})),n.d(e,"getPathLength",(function(){return et})),n.d(e,"getPreciseDistance",(function(){return nt})),n.d(e,"getRhumbLineBearing",(function(){return V})),n.d(e,"getRoughCompassDirection",(function(){return rt})),n.d(e,"getSpeed",(function(){return it})),n.d(e,"isDecimal",(function(){return y})),n.d(e,"isPointInLine",(function(){return at})),n.d(e,"isPointInPolygon",(function(){return st})),n.d(e,"isPointNearLine",(function(){return ot})),n.d(e,"isPointWithinRadius",(function(){return lt})),n.d(e,"isSexagesimal",(function(){return m})),n.d(e,"isValidCoordinate",(function(){return E})),n.d(e,"isValidLatitude",(function(){return x})),n.d(e,"isValidLongitude",(function(){return I})),n.d(e,"orderByDistance",(function(){return G})),n.d(e,"sexagesimalToDecimal",(function(){return v})),n.d(e,"toDecimal",(function(){return O})),n.d(e,"toRad",(function(){return k})),n.d(e,"toDeg",(function(){return C})),n.d(e,"wktToPolygon",(function(){return ht})),n.d(e,"sexagesimalPattern",(function(){return r})),n.d(e,"earthRadius",(function(){return i})),n.d(e,"MINLAT",(function(){return a})),n.d(e,"MAXLAT",(function(){return s})),n.d(e,"MINLON",(function(){return o})),n.d(e,"MAXLON",(function(){return l})),n.d(e,"longitudeKeys",(function(){return u})),n.d(e,"latitudeKeys",(function(){return h})),n.d(e,"altitudeKeys",(function(){return c})),n.d(e,"distanceConversion",(function(){return d})),n.d(e,"timeConversion",(function(){return p})),n.d(e,"areaConversion",(function(){return f}));var r=/^([0-9]{1,3})°\s*([0-9]{1,3}(?:\.(?:[0-9]{1,}))?)['′]\s*(([0-9]{1,3}(\.([0-9]{1,}))?)["″]\s*)?([NEOSW]?)$/,i=6378137,a=-90,s=90,o=-180,l=180,u=["lng","lon","longitude",0],h=["lat","latitude",1],c=["alt","altitude","elevation","elev",2],d={m:1,km:.001,cm:100,mm:1e3,mi:1/1609.344,sm:1/1852.216,ft:100/30.48,in:100/2.54,yd:1/.9144},p={m:60,h:3600,d:86400},f={m2:1,km2:1e-6,ha:1e-4,a:.01,ft2:10.763911,yd2:1.19599,in2:1550.0031};f.sqm=f.m2,f.sqkm=f.km2,f.sqft=f.ft2,f.sqyd=f.yd2,f.sqin=f.in2;var g=function(t,e){return e.reduce((function(e,n){if(null==t)throw new Error("'".concat(t,"' is no valid coordinate."));return Object.prototype.hasOwnProperty.call(t,n)&&void 0!==n&&void 0===e?(e=n,n):e}),void 0)},y=function(t){var e=t.toString().trim();return!isNaN(parseFloat(e))&&parseFloat(e)===Number(e)},m=function(t){return r.test(t.toString().trim())},v=function(t){var e=new RegExp(r).exec(t);if(null==e)throw new Error("Given value is not in sexagesimal format");var n=Number(e[2])/60||0,i=Number(e[4])/3600||0,a=parseFloat(e[1])+n+i;return["S","W"].includes(e[7])?-a:a};function _(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function w(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?_(Object(n),!0).forEach((function(e){M(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function M(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var b=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{longitude:u,latitude:h,altitude:c},n=g(t,e.longitude),r=g(t,e.latitude),i=g(t,e.altitude);return w({latitude:r,longitude:n},i?{altitude:i}:{})},x=function t(e){return y(e)?!(parseFloat(e)>s||e<a):!!m(e)&&t(v(e))},I=function t(e){return y(e)?!(parseFloat(e)>l||e<o):!!m(e)&&t(v(e))},E=function(t){var e=b(t),n=e.latitude,r=e.longitude;if(Array.isArray(t)&&t.length>=2)return I(t[0])&&x(t[1]);if(void 0===n||void 0===r)return!1;var i=t[r],a=t[n];return void 0!==a&&void 0!==i&&!1!==x(a)&&!1!==I(i)};function S(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function N(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?S(Object(n),!0).forEach((function(e){A(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):S(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function A(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var O=function t(e){if(y(e))return Number(e);if(m(e))return v(e);if(E(e)){var n=b(e);return Array.isArray(e)?e.map((function(e,n){return[0,1].includes(n)?t(e):e})):N(N(N({},e),n.latitude&&A({},n.latitude,t(e[n.latitude]))),n.longitude&&A({},n.longitude,t(e[n.longitude])))}return Array.isArray(e)?e.map((function(e){return E(e)?t(e):e})):e},F=function(t,e){var n=g(t,h);if(null!=n){var r=t[n];return!0===e?r:O(r)}},T=function(t,e){var n=g(t,u);if(null!=n){var r=t[n];return!0===e?r:O(r)}},k=function(t){return t*Math.PI/180},C=function(t){return 180*t/Math.PI},B=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:6371e3,i=F(t),a=T(t),s=e/r,u=k(n),h=k(i),c=k(a),d=Math.asin(Math.sin(h)*Math.cos(s)+Math.cos(h)*Math.sin(s)*Math.cos(u)),p=c+Math.atan2(Math.sin(u)*Math.sin(s)*Math.cos(h),Math.cos(s)-Math.sin(h)*Math.sin(d)),f=C(p);return(f<o||f>l)&&(p=(p+3*Math.PI)%(2*Math.PI)-Math.PI,f=C(p)),{latitude:C(d),longitude:f}},D=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"m",n=f[e];if(n)return t*n;throw new Error("Invalid unit used for area conversion.")},j=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"m",n=d[e];if(n)return t*n;throw new Error("Invalid unit used for distance conversion.")},R=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"kmh";switch(e){case"kmh":return t*p.h*d.km;case"mph":return t*p.h*d.mi;default:return t}};function L(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var P=function(t){var e=Math.pow(10,12);return Math.round(t*e)/e},z=function(t){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(typeof Symbol>"u")&&Symbol.iterator in Object(t)){var n=[],r=!0,i=!1,a=void 0;try{for(var s,o=t[Symbol.iterator]();!(r=(s=o.next()).done)&&(n.push(s.value),!e||n.length!==e);r=!0);}catch(t){i=!0,a=t}finally{try{r||null==o.return||o.return()}finally{if(i)throw a}}return n}}(t,e)||function(t,e){if(t){if("string"==typeof t)return L(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return L(t,e)}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t.toString().split("."),2),n=e[0],r=e[1],i=Math.abs(Number(n)),a=P(60*Number("0."+(r||0))),s=Math.floor(a),o=P(60*(a%s||0));return i+"° "+Number(s.toFixed(6)).toString().split(".").map((function(t,e){return 0===e?t.padStart(2,"0"):t})).join(".")+"' "+Number(o.toFixed(4)).toString().split(".").map((function(t,e){return 0===e?t.padStart(2,"0"):t})).join(".")+'"'},W=function(t){return t>1?1:t<-1?-1:t},$=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;n=void 0===n||isNaN(n)?1:n;var r=F(t),a=T(t),s=F(e),o=T(e),l=Math.acos(W(Math.sin(k(s))*Math.sin(k(r))+Math.cos(k(s))*Math.cos(k(r))*Math.cos(k(a)-k(o))))*i;return Math.round(l/n)*n},G=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$;return n="function"==typeof n?n:$,e.slice().sort((function(e,r){return n(t,e)-n(t,r)}))},U=function(t,e){return G(t,e)[0]},q=function(t){var e=0;if(t.length>2){for(var n,r,a,s=0;s<t.length;s++){s===t.length-2?(n=t.length-2,r=t.length-1,a=0):s===t.length-1?(n=t.length-1,r=0,a=1):(n=s,r=s+1,a=s+2);var o=T(t[n]),l=F(t[r]),u=T(t[a]);e+=(k(u)-k(o))*Math.sin(k(l))}e=e*i*i/2}return Math.abs(e)},K=function(t){if(!1===Array.isArray(t)||0===t.length)throw new Error("No points were given.");return t.reduce((function(t,e){var n=F(e),r=T(e);return{maxLat:Math.max(n,t.maxLat),minLat:Math.min(n,t.minLat),maxLng:Math.max(r,t.maxLng),minLng:Math.min(r,t.minLng)}}),{maxLat:-1/0,minLat:1/0,maxLng:-1/0,minLng:1/0})},J=function(t,e){var n,r,u=F(t),h=T(t),c=k(u),d=k(h),p=e/i,f=c-p,g=c+p,y=k(s),m=k(a),v=k(l),_=k(o);if(f>m&&g<y){var w=Math.asin(Math.sin(p)/Math.cos(c));(n=d-w)<_&&(n+=2*Math.PI),(r=d+w)>v&&(r-=2*Math.PI)}else f=Math.max(f,m),g=Math.min(g,y),n=_,r=v;return[{latitude:C(f),longitude:C(n)},{latitude:C(g),longitude:C(r)}]},Y=function(t){if(!1===Array.isArray(t)||0===t.length)return!1;var e=t.length,n=t.reduce((function(t,e){var n=k(F(e)),r=k(T(e));return{X:t.X+Math.cos(n)*Math.cos(r),Y:t.Y+Math.cos(n)*Math.sin(r),Z:t.Z+Math.sin(n)}}),{X:0,Y:0,Z:0}),r=n.X/e,i=n.Y/e,a=n.Z/e;return{longitude:C(Math.atan2(i,r)),latitude:C(Math.atan2(a,Math.sqrt(r*r+i*i)))}},H=function(t){var e=K(t),n=e.minLat+(e.maxLat-e.minLat)/2,r=e.minLng+(e.maxLng-e.minLng)/2;return{latitude:parseFloat(n.toFixed(6)),longitude:parseFloat(r.toFixed(6))}},V=function(t,e){var n=k(T(e))-k(T(t)),r=Math.log(Math.tan(k(F(e))/2+Math.PI/4)/Math.tan(k(F(t))/2+Math.PI/4));return Math.abs(n)>Math.PI&&(n=n>0?-1*(2*Math.PI-n):2*Math.PI+n),(C(Math.atan2(n,r))+360)%360},X=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:V,r="function"==typeof n?n(t,e):V(t,e);if(isNaN(r))throw new Error("Could not calculate bearing for given points. Check your bearing function");switch(Math.round(r/22.5)){case 1:return"NNE";case 2:return"NE";case 3:return"ENE";case 4:return"E";case 5:return"ESE";case 6:return"SE";case 7:return"SSE";case 8:return"S";case 9:return"SSW";case 10:return"SW";case 11:return"WSW";case 12:return"W";case 13:return"WNW";case 14:return"NW";case 15:return"NNW";default:return"N"}},Z=function(t,e,n){var r=$(e,t),i=$(t,n),a=$(e,n),s=Math.acos(W((r*r+a*a-i*i)/(2*r*a))),o=Math.acos(W((i*i+a*a-r*r)/(2*i*a)));return s>Math.PI/2?r:o>Math.PI/2?i:Math.sin(s)*r},Q=function(t,e){var n=F(e),r=T(e),i=F(t),a=T(t);return(C(Math.atan2(Math.sin(k(r)-k(a))*Math.cos(k(n)),Math.cos(k(i))*Math.sin(k(n))-Math.sin(k(i))*Math.cos(k(n))*Math.cos(k(r)-k(a))))+360)%360};function tt(t){return(tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var et=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$;return t.reduce((function(t,n){return"object"===tt(t)&&null!==t.last&&(t.distance+=e(n,t.last)),t.last=n,t}),{last:null,distance:0}).distance},nt=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;n=void 0===n||isNaN(n)?1:n;var r,a,s,o,l,u,h,c=F(t),d=T(t),p=F(e),f=T(e),g=6356752.314245,y=1/298.257223563,m=k(f-d),v=Math.atan((1-y)*Math.tan(k(parseFloat(c)))),_=Math.atan((1-y)*Math.tan(k(parseFloat(p)))),w=Math.sin(v),M=Math.cos(v),b=Math.sin(_),x=Math.cos(_),I=m,E=100;do{var S=Math.sin(I),N=Math.cos(I);if(0===(u=Math.sqrt(x*S*(x*S)+(M*b-w*x*N)*(M*b-w*x*N))))return 0;r=w*b+M*x*N,a=Math.atan2(u,r),l=r-2*w*b/(o=1-(s=M*x*S/u)*s),isNaN(l)&&(l=0);var A=y/16*o*(4+y*(4-3*o));h=I,I=m+(1-A)*y*s*(a+A*u*(l+A*r*(2*l*l-1)))}while(Math.abs(I-h)>1e-12&&--E>0);if(0===E)return NaN;var O=o*(i*i-g*g)/(g*g),C=1+O/16384*(4096+O*(O*(320-175*O)-768)),B=O/1024*(256+O*(O*(74-47*O)-128)),D=B*u*(l+B/4*(r*(2*l*l-1)-B/6*l*(4*u*u-3)*(4*l*l-3))),j=g*C*(a-D);return Math.round(j/n)*n},rt=function(t){return/^NNE|NE|NNW|N$/.test(t)?"N":/^ENE|E|ESE|SE$/.test(t)?"E":/^SSE|S|SSW|SW$/.test(t)?"S":/^WSW|W|WNW|NW$/.test(t)?"W":void 0},it=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$,r=n(t,e),i=Number(e.time)-Number(t.time),a=r/i*1e3;return a},at=function(t,e,n){return $(e,t)+$(t,n)===$(e,n)},st=function(t,e){for(var n=!1,r=e.length,i=-1,a=r-1;++i<r;a=i)(T(e[i])<=T(t)&&T(t)<T(e[a])||T(e[a])<=T(t)&&T(t)<T(e[i]))&&F(t)<(F(e[a])-F(e[i]))*(T(t)-T(e[i]))/(T(e[a])-T(e[i]))+F(e[i])&&(n=!n);return n},ot=function(t,e,n,r){return Z(t,e,n)<r},lt=function(t,e,n){return $(t,e)<n};function ut(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var ht=function(t){if(!t.startsWith("POLYGON"))throw new Error("Invalid wkt.");return t.slice(t.indexOf("(")+2,t.indexOf(")")).split(", ").map((function(t){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(typeof Symbol>"u")&&Symbol.iterator in Object(t)){var n=[],r=!0,i=!1,a=void 0;try{for(var s,o=t[Symbol.iterator]();!(r=(s=o.next()).done)&&(n.push(s.value),!e||n.length!==e);r=!0);}catch(t){i=!0,a=t}finally{try{r||null==o.return||o.return()}finally{if(i)throw a}}return n}}(t,e)||function(t,e){if(t){if("string"==typeof t)return ut(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ut(t,e)}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t.split(" "),2),n=e[0],r=e[1];return{longitude:parseFloat(n),latitude:parseFloat(r)}}))}}])},"object"==typeof t&&"object"==typeof e?e.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof t?t.geolib=r():n.geolib=r()})),En=Qe(((t,e)=>{w(),e.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,(t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`))})),Cn=Qe(((t,e)=>{w();var n="%[a-f0-9]{2}",r=new RegExp("("+n+")|([^%]+?)","gi"),i=new RegExp("("+n+")+","gi");function a(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(1===t.length)return t;e=e||1;var n=t.slice(0,e),r=t.slice(e);return Array.prototype.concat.call([],a(n),a(r))}function s(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(r)||[],n=1;n<e.length;n++)e=(t=a(e,n).join("")).match(r)||[];return t}}e.exports=function(t){if("string"!=typeof t)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return function(t){for(var e={"%FE%FF":"��","%FF%FE":"��"},n=i.exec(t);n;){try{e[n[0]]=decodeURIComponent(n[0])}catch{var r=s(n[0]);r!==n[0]&&(e[n[0]]=r)}n=i.exec(t)}e["%C2"]="�";for(var a=Object.keys(e),o=0;o<a.length;o++){var l=a[o];t=t.replace(new RegExp(l,"g"),e[l])}return t}(t)}}})),Rn=Qe(((t,e)=>{w(),e.exports=(t,e)=>{if("string"!=typeof t||"string"!=typeof e)throw new TypeError("Expected the arguments to be of type `string`");if(""===e)return[t];let n=t.indexOf(e);return-1===n?[t]:[t.slice(0,n),t.slice(n+e.length)]}})),Dn=Qe(((t,e)=>{w(),e.exports=function(t,e){for(var n={},r=Object.keys(t),i=Array.isArray(e),a=0;a<r.length;a++){var s=r[a],o=t[s];(i?-1!==e.indexOf(s):e(s,o,t))&&(n[s]=o)}return n}})),Yn=Qe((t=>{w();var e=En(),n=Cn(),r=Rn(),i=Dn(),a=Symbol("encodeFragmentIdentifier");function s(t){if("string"!=typeof t||1!==t.length)throw new TypeError("arrayFormatSeparator must be single character string")}function o(t,n){return n.encode?n.strict?e(t):encodeURIComponent(t):t}function l(t,e){return e.decode?n(t):t}function u(t){return Array.isArray(t)?t.sort():"object"==typeof t?u(Object.keys(t)).sort(((t,e)=>Number(t)-Number(e))).map((e=>t[e])):t}function h(t){let e=t.indexOf("#");return-1!==e&&(t=t.slice(0,e)),t}function c(t){let e=(t=h(t)).indexOf("?");return-1===e?"":t.slice(e+1)}function d(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&"string"==typeof t&&""!==t.trim()?t=Number(t):e.parseBooleans&&null!==t&&("true"===t.toLowerCase()||"false"===t.toLowerCase())&&(t="true"===t.toLowerCase()),t}function p(t,e){s((e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e)).arrayFormatSeparator);let n=function(t){let e;switch(t.arrayFormat){case"index":return(t,n,r)=>{e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),e?(void 0===r[t]&&(r[t]={}),r[t][e[1]]=n):r[t]=n};case"bracket":return(t,n,r)=>{e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),e?void 0!==r[t]?r[t]=[].concat(r[t],n):r[t]=[n]:r[t]=n};case"comma":case"separator":return(e,n,r)=>{let i="string"==typeof n&&n.includes(t.arrayFormatSeparator),a="string"==typeof n&&!i&&l(n,t).includes(t.arrayFormatSeparator);n=a?l(n,t):n;let s=i||a?n.split(t.arrayFormatSeparator).map((e=>l(e,t))):null===n?n:l(n,t);r[e]=s};case"bracket-separator":return(e,n,r)=>{let i=/(\[\])$/.test(e);if(e=e.replace(/\[\]$/,""),!i)return void(r[e]=n&&l(n,t));let a=null===n?[]:n.split(t.arrayFormatSeparator).map((e=>l(e,t)));void 0!==r[e]?r[e]=[].concat(r[e],a):r[e]=a};default:return(t,e,n)=>{void 0!==n[t]?n[t]=[].concat(n[t],e):n[t]=e}}}(e),i=Object.create(null);if("string"!=typeof t||!(t=t.trim().replace(/^[?#&]/,"")))return i;for(let a of t.split("&")){if(""===a)continue;let[t,s]=r(e.decode?a.replace(/\+/g," "):a,"=");s=void 0===s?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?s:l(s,e),n(l(t,e),s,i)}for(let t of Object.keys(i)){let n=i[t];if("object"==typeof n&&null!==n)for(let t of Object.keys(n))n[t]=d(n[t],e);else i[t]=d(n,e)}return!1===e.sort?i:(!0===e.sort?Object.keys(i).sort():Object.keys(i).sort(e.sort)).reduce(((t,e)=>{let n=i[e];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?t[e]=u(n):t[e]=n,t}),Object.create(null))}t.extract=c,t.parse=p,t.stringify=(t,e)=>{if(!t)return"";s((e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e)).arrayFormatSeparator);let n=n=>e.skipNull&&(t=>null==t)(t[n])||e.skipEmptyString&&""===t[n],r=function(t){switch(t.arrayFormat){case"index":return e=>(n,r)=>{let i=n.length;return void 0===r||t.skipNull&&null===r||t.skipEmptyString&&""===r?n:null===r?[...n,[o(e,t),"[",i,"]"].join("")]:[...n,[o(e,t),"[",o(i,t),"]=",o(r,t)].join("")]};case"bracket":return e=>(n,r)=>void 0===r||t.skipNull&&null===r||t.skipEmptyString&&""===r?n:null===r?[...n,[o(e,t),"[]"].join("")]:[...n,[o(e,t),"[]=",o(r,t)].join("")];case"comma":case"separator":case"bracket-separator":{let e="bracket-separator"===t.arrayFormat?"[]=":"=";return n=>(r,i)=>void 0===i||t.skipNull&&null===i||t.skipEmptyString&&""===i?r:(i=null===i?"":i,0===r.length?[[o(n,t),e,o(i,t)].join("")]:[[r,o(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(n,r)=>void 0===r||t.skipNull&&null===r||t.skipEmptyString&&""===r?n:null===r?[...n,o(e,t)]:[...n,[o(e,t),"=",o(r,t)].join("")]}}(e),i={};for(let e of Object.keys(t))n(e)||(i[e]=t[e]);let a=Object.keys(i);return!1!==e.sort&&a.sort(e.sort),a.map((n=>{let i=t[n];return void 0===i?"":null===i?o(n,e):Array.isArray(i)?0===i.length&&"bracket-separator"===e.arrayFormat?o(n,e)+"[]":i.reduce(r(n),[]).join("&"):o(n,e)+"="+o(i,e)})).filter((t=>t.length>0)).join("&")},t.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[n,i]=r(t,"#");return Object.assign({url:n.split("?")[0]||"",query:p(c(t),e)},e&&e.parseFragmentIdentifier&&i?{fragmentIdentifier:l(i,e)}:{})},t.stringifyUrl=(e,n)=>{n=Object.assign({encode:!0,strict:!0,[a]:!0},n);let r=h(e.url).split("?")[0]||"",i=t.extract(e.url),s=t.parse(i,{sort:!1}),l=Object.assign(s,e.query),u=t.stringify(l,n);u&&(u=`?${u}`);let c=function(t){let e="",n=t.indexOf("#");return-1!==n&&(e=t.slice(n)),e}(e.url);return e.fragmentIdentifier&&(c=`#${n[a]?o(e.fragmentIdentifier,n):e.fragmentIdentifier}`),`${r}${u}${c}`},t.pick=(e,n,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[a]:!1},r);let{url:s,query:o,fragmentIdentifier:l}=t.parseUrl(e,r);return t.stringifyUrl({url:s,query:i(o,n),fragmentIdentifier:l},r)},t.exclude=(e,n,r)=>{let i=Array.isArray(n)?t=>!n.includes(t):(t,e)=>!n(t,e);return t.pick(e,i,r)}})),Zn=Qe(((t,e)=>{var n,r;w(),n=t,r=function(){var t=function(){return t=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},t.apply(this,arguments)};function e(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function n(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,a=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=a.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return s}var r,i="KEYS",a="VALUES",s="",o=function(){function t(t,e){var n=t._tree,r=Array.from(n.keys());this.set=t,this._type=e,this._path=r.length>0?[{node:n,keys:r}]:[]}return t.prototype.next=function(){var t=this.dive();return this.backtrack(),t},t.prototype.dive=function(){if(0===this._path.length)return{done:!0,value:void 0};var t=l(this._path),e=t.node,n=t.keys;if(l(n)===s)return{done:!1,value:this.result()};var r=e.get(l(n));return this._path.push({node:r,keys:Array.from(r.keys())}),this.dive()},t.prototype.backtrack=function(){if(0!==this._path.length){var t=l(this._path).keys;t.pop(),!(t.length>0)&&(this._path.pop(),this.backtrack())}},t.prototype.key=function(){return this.set._prefix+this._path.map((function(t){var e=t.keys;return l(e)})).filter((function(t){return t!==s})).join("")},t.prototype.value=function(){return l(this._path).node.get(s)},t.prototype.result=function(){switch(this._type){case a:return this.value();case i:return this.key();default:return[this.key(),this.value()]}},t.prototype[Symbol.iterator]=function(){return this},t}(),l=function(t){return t[t.length-1]},u=function(t,n,r,i,a,o,l,h){var c,d,p=o*l;try{t:for(var f=e(t.keys()),g=f.next();!g.done;g=f.next()){var y=g.value;if(y===s){var m=a[p-1];m<=r&&i.set(h,[t.get(y),m])}else{for(var v=o,_=0;_<y.length;++_,++v){for(var w=y[_],M=l*v,b=M-l,x=a[M],I=Math.max(0,v-r-1),E=Math.min(l-1,v+r),S=I;S<E;++S){var N=w!==n[S],A=a[b+S]+ +N,O=a[b+S+1]+1,F=a[M+S]+1,T=a[M+S+1]=Math.min(A,O,F);T<x&&(x=T)}if(x>r)continue t}u(t.get(y),n,r,i,a,v,l,h+y)}}}catch(t){c={error:t}}finally{try{g&&!g.done&&(d=f.return)&&d.call(f)}finally{if(c)throw c.error}}},h=function(){function t(t,e){void 0===t&&(t=new Map),void 0===e&&(e=""),this._size=void 0,this._tree=t,this._prefix=e}return t.prototype.atPrefix=function(r){var i,a;if(!r.startsWith(this._prefix))throw new Error("Mismatched prefix");var o=n(c(this._tree,r.slice(this._prefix.length)),2),l=o[0],u=o[1];if(void 0===l){var h=n(m(u),2),d=h[0],p=h[1];try{for(var f=e(d.keys()),g=f.next();!g.done;g=f.next()){var y=g.value;if(y!==s&&y.startsWith(p)){var v=new Map;return v.set(y.slice(p.length),d.get(y)),new t(v,r)}}}catch(t){i={error:t}}finally{try{g&&!g.done&&(a=f.return)&&a.call(f)}finally{if(i)throw i.error}}}return new t(l,r)},t.prototype.clear=function(){this._size=void 0,this._tree.clear()},t.prototype.delete=function(t){return this._size=void 0,f(this._tree,t)},t.prototype.entries=function(){return new o(this,"ENTRIES")},t.prototype.forEach=function(t){var r,i;try{for(var a=e(this),s=a.next();!s.done;s=a.next()){var o=n(s.value,2);t(o[0],o[1],this)}}catch(t){r={error:t}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}},t.prototype.fuzzyGet=function(t,e){return function(t,e,n){var r=new Map;if(void 0===e)return r;for(var i=e.length+1,a=i+n,s=new Uint8Array(a*i).fill(n+1),o=0;o<i;++o)s[o]=o;for(var l=1;l<a;++l)s[l*i]=l;return u(t,e,n,r,s,1,i,""),r}(this._tree,t,e)},t.prototype.get=function(t){var e=d(this._tree,t);return void 0!==e?e.get(s):void 0},t.prototype.has=function(t){var e=d(this._tree,t);return void 0!==e&&e.has(s)},t.prototype.keys=function(){return new o(this,i)},t.prototype.set=function(t,e){if("string"!=typeof t)throw new Error("key must be a string");return this._size=void 0,p(this._tree,t).set(s,e),this},Object.defineProperty(t.prototype,"size",{get:function(){if(this._size)return this._size;this._size=0;for(var t=this.entries();!t.next().done;)this._size+=1;return this._size},enumerable:!1,configurable:!0}),t.prototype.update=function(t,e){if("string"!=typeof t)throw new Error("key must be a string");this._size=void 0;var n=p(this._tree,t);return n.set(s,e(n.get(s))),this},t.prototype.fetch=function(t,e){if("string"!=typeof t)throw new Error("key must be a string");this._size=void 0;var n=p(this._tree,t),r=n.get(s);return void 0===r&&n.set(s,r=e()),r},t.prototype.values=function(){return new o(this,a)},t.prototype[Symbol.iterator]=function(){return this.entries()},t.from=function(r){var i,a,s=new t;try{for(var o=e(r),l=o.next();!l.done;l=o.next()){var u=n(l.value,2),h=u[0],c=u[1];s.set(h,c)}}catch(t){i={error:t}}finally{try{l&&!l.done&&(a=o.return)&&a.call(o)}finally{if(i)throw i.error}}return s},t.fromObject=function(e){return t.from(Object.entries(e))},t}(),c=function(t,n,r){var i,a;if(void 0===r&&(r=[]),0===n.length||null==t)return[t,r];try{for(var o=e(t.keys()),l=o.next();!l.done;l=o.next()){var u=l.value;if(u!==s&&n.startsWith(u))return r.push([t,u]),c(t.get(u),n.slice(u.length),r)}}catch(t){i={error:t}}finally{try{l&&!l.done&&(a=o.return)&&a.call(o)}finally{if(i)throw i.error}}return r.push([t,n]),c(void 0,"",r)},d=function(t,n){var r,i;if(0===n.length||null==t)return t;try{for(var a=e(t.keys()),o=a.next();!o.done;o=a.next()){var l=o.value;if(l!==s&&n.startsWith(l))return d(t.get(l),n.slice(l.length))}}catch(t){r={error:t}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}},p=function(t,n){var r,i,a=n.length;t:for(var o=0;t&&o<a;){try{for(var l=(r=void 0,e(t.keys())),u=l.next();!u.done;u=l.next()){var h=u.value;if(h!==s&&n[o]===h[0]){for(var c=Math.min(a-o,h.length),d=1;d<c&&n[o+d]===h[d];)++d;var p=t.get(h);if(d===h.length)t=p;else{var f=new Map;f.set(h.slice(d),p),t.set(n.slice(o,o+d),f),t.delete(h),t=f}o+=d;continue t}}}catch(t){r={error:t}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}var g=new Map;return t.set(n.slice(o),g),g}return t},f=function(t,e){var r=n(c(t,e),2),i=r[0],a=r[1];if(void 0!==i)if(i.delete(s),0===i.size)g(a);else if(1===i.size){var o=n(i.entries().next().value,2),l=o[0],u=o[1];y(a,l,u)}},g=function(t){if(0!==t.length){var e=n(m(t),2),r=e[0],i=e[1];if(r.delete(i),0===r.size)g(t.slice(0,-1));else if(1===r.size){var a=n(r.entries().next().value,2),o=a[0],l=a[1];o!==s&&y(t.slice(0,-1),o,l)}}},y=function(t,e,r){if(0!==t.length){var i=n(m(t),2),a=i[0],s=i[1];a.set(s+e,r),a.delete(s)}},m=function(t){return t[t.length-1]},v="or",_=function(){function r(e){if(null==e?.fields)throw new Error('MiniSearch: option "fields" must be provided');this._options=t(t(t({},I),e),{searchOptions:t(t({},E),e.searchOptions||{})}),this._index=new h,this._documentCount=0,this._documentIds=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this.addFields(this._options.fields)}return r.prototype.add=function(t){var n,r,i,a,s=this._options,o=s.extractField,l=s.tokenize,u=s.processTerm,h=s.fields,c=s.idField,d=o(t,c);if(null==d)throw new Error('MiniSearch: document does not have ID field "'.concat(c,'"'));var p=this.addDocumentId(d);this.saveStoredFields(p,t);try{for(var f=e(h),g=f.next();!g.done;g=f.next()){var y=g.value,m=o(t,y);if(null!=m){var v=l(m.toString(),y),_=this._fieldIds[y],w=new Set(v).size;this.addFieldLength(p,_,this._documentCount-1,w);try{for(var M=(i=void 0,e(v)),b=M.next();!b.done;b=M.next()){var x=u(b.value,y);x&&this.addTerm(_,p,x)}}catch(t){i={error:t}}finally{try{b&&!b.done&&(a=M.return)&&a.call(M)}finally{if(i)throw i.error}}}}}catch(t){n={error:t}}finally{try{g&&!g.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}},r.prototype.addAll=function(t){var n,r;try{for(var i=e(t),a=i.next();!a.done;a=i.next()){var s=a.value;this.add(s)}}catch(t){n={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},r.prototype.addAllAsync=function(t,e){var n=this;void 0===e&&(e={});var r=e.chunkSize,i=void 0===r?10:r,a={chunk:[],promise:Promise.resolve()},s=t.reduce((function(t,e,r){var a=t.chunk,s=t.promise;return a.push(e),(r+1)%i==0?{chunk:[],promise:s.then((function(){return new Promise((function(t){return setTimeout(t,0)}))})).then((function(){return n.addAll(a)}))}:{chunk:a,promise:s}}),a),o=s.chunk;return s.promise.then((function(){return n.addAll(o)}))},r.prototype.remove=function(t){var r,i,a,s,o,l,u=this._options,h=u.tokenize,c=u.processTerm,d=u.extractField,p=u.fields,f=u.idField,g=d(t,f);if(null==g)throw new Error('MiniSearch: document does not have ID field "'.concat(f,'"'));try{for(var y=e(this._documentIds),m=y.next();!m.done;m=y.next()){var v=n(m.value,2),_=v[0];if(g===v[1]){try{for(var w=(a=void 0,e(p)),M=w.next();!M.done;M=w.next()){var b=M.value,x=d(t,b);if(null!=x){var I=h(x.toString(),b),E=this._fieldIds[b],S=new Set(I).size;this.removeFieldLength(_,E,this._documentCount,S);try{for(var N=(o=void 0,e(I)),A=N.next();!A.done;A=N.next()){var O=c(A.value,b);O&&this.removeTerm(E,_,O)}}catch(t){o={error:t}}finally{try{A&&!A.done&&(l=N.return)&&l.call(N)}finally{if(o)throw o.error}}}}}catch(t){a={error:t}}finally{try{M&&!M.done&&(s=w.return)&&s.call(w)}finally{if(a)throw a.error}}return this._storedFields.delete(_),this._documentIds.delete(_),this._fieldLength.delete(_),void(this._documentCount-=1)}}}catch(t){r={error:t}}finally{try{m&&!m.done&&(i=y.return)&&i.call(y)}finally{if(r)throw r.error}}throw new Error("MiniSearch: cannot remove document with ID ".concat(g,": it is not in the index"))},r.prototype.removeAll=function(t){var n,r;if(t)try{for(var i=e(t),a=i.next();!a.done;a=i.next()){var s=a.value;this.remove(s)}}catch(t){n={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new h,this._documentCount=0,this._documentIds=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}},r.prototype.search=function(t,r){var i,a;void 0===r&&(r={});var s=this.executeQuery(t,r),o=[];try{for(var l=e(s),u=l.next();!u.done;u=l.next()){var h=n(u.value,2),c=h[0],d=h[1],p=d.score,f=d.terms,g=d.match,y=f.length,m={id:this._documentIds.get(c),score:p*y,terms:Object.keys(g),match:g};Object.assign(m,this._storedFields.get(c)),(null==r.filter||r.filter(m))&&o.push(m)}}catch(t){i={error:t}}finally{try{u&&!u.done&&(a=l.return)&&a.call(l)}finally{if(i)throw i.error}}return o.sort(O),o},r.prototype.autoSuggest=function(r,i){var a,s,o,l;void 0===i&&(i={}),i=t(t({},S),i);var u=new Map;try{for(var h=e(this.search(r,i)),c=h.next();!c.done;c=h.next()){var d=c.value,p=d.score,f=(M=d.terms).join(" ");null!=(_=u.get(f))?(_.score+=p,_.count+=1):u.set(f,{score:p,terms:M,count:1})}}catch(t){a={error:t}}finally{try{c&&!c.done&&(s=h.return)&&s.call(h)}finally{if(a)throw a.error}}var g=[];try{for(var y=e(u),m=y.next();!m.done;m=y.next()){var v=n(m.value,2),_=v[0],w=v[1],M=(p=w.score,w.terms),b=w.count;g.push({suggestion:_,terms:M,score:p/b})}}catch(t){o={error:t}}finally{try{m&&!m.done&&(l=y.return)&&l.call(y)}finally{if(o)throw o.error}}return g.sort(O),g},Object.defineProperty(r.prototype,"documentCount",{get:function(){return this._documentCount},enumerable:!1,configurable:!0}),r.loadJSON=function(t,e){if(null==e)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return r.loadJS(JSON.parse(t),e)},r.getDefault=function(t){if(I.hasOwnProperty(t))return w(I,t);throw new Error('MiniSearch: unknown option "'.concat(t,'"'))},r.loadJS=function(t,i){var a,s,o,l,u=t.index,c=t.documentCount,d=t.nextId,p=t.documentIds,f=t.fieldIds,g=t.fieldLength,y=t.averageFieldLength,m=t.storedFields,v=t.serializationVersion;if(1!==v&&2!==v)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var _=new r(i);_._documentCount=c,_._nextId=d,_._documentIds=T(p),_._fieldIds=f,_._fieldLength=T(g),_._avgFieldLength=y,_._storedFields=T(m),_._index=new h;try{for(var w=e(u),M=w.next();!M.done;M=w.next()){var b=n(M.value,2),x=b[0],I=b[1],E=new Map;try{for(var S=(o=void 0,e(Object.keys(I))),N=S.next();!N.done;N=S.next()){var A=N.value,O=I[A];1===v&&(O=O.ds),E.set(parseInt(A,10),T(O))}}catch(t){o={error:t}}finally{try{N&&!N.done&&(l=S.return)&&l.call(S)}finally{if(o)throw o.error}}_._index.set(x,E)}}catch(t){a={error:t}}finally{try{M&&!M.done&&(s=w.return)&&s.call(w)}finally{if(a)throw a.error}}return _},r.prototype.executeQuery=function(e,n){var r=this;if(void 0===n&&(n={}),"string"!=typeof e){var i=t(t(t({},n),e),{queries:void 0}),a=e.queries.map((function(t){return r.executeQuery(t,i)}));return this.combineResults(a,e.combineWith)}var s=this._options,o=s.tokenize,l=s.processTerm,u=s.searchOptions,h=t(t({tokenize:o,processTerm:l},u),n),c=h.tokenize,d=h.processTerm,p=c(e).map((function(t){return d(t)})).filter((function(t){return!!t})).map(x(h)).map((function(t){return r.executeQuerySpec(t,h)}));return this.combineResults(p,h.combineWith)},r.prototype.executeQuerySpec=function(r,i){var a,s,o,l,u,h,c=t(t({},this._options.searchOptions),i),d=(c.fields||this._options.fields).reduce((function(e,n){var r;return t(t({},e),((r={})[n]=w(e,n)||1,r))}),c.boost||{}),p=c.boostDocument,f=c.weights,g=c.maxFuzzy,y=t(t({},E.weights),f),m=y.fuzzy,v=y.prefix,_=this._index.get(r.term),M=this.termResults(r.term,r.term,1,_,d,p);if(r.prefix&&(u=this._index.atPrefix(r.term)),r.fuzzy){var b=!0===r.fuzzy?.2:r.fuzzy,x=b<1?Math.min(g,Math.round(r.term.length*b)):b;x&&(h=this._index.fuzzyGet(r.term,x))}if(u)try{for(var I=e(u),S=I.next();!S.done;S=I.next()){var N=n(S.value,2),A=N[0],O=N[1];if(C=A.length-r.term.length){h?.delete(A);var F=v*A.length/(A.length+.3*C);this.termResults(r.term,A,F,O,d,p,M)}}}catch(t){a={error:t}}finally{try{S&&!S.done&&(s=I.return)&&s.call(I)}finally{if(a)throw a.error}}if(h)try{for(var T=e(h.keys()),k=T.next();!k.done;k=T.next()){A=k.value;var C,B=n(h.get(A),2),D=B[0];(C=B[1])&&(F=m*A.length/(A.length+C),this.termResults(r.term,A,F,D,d,p,M))}}catch(t){o={error:t}}finally{try{k&&!k.done&&(l=T.return)&&l.call(T)}finally{if(o)throw o.error}}return M},r.prototype.combineResults=function(t,e){if(void 0===e&&(e=v),0===t.length)return new Map;var n=e.toLowerCase();return t.reduce(M[n])||new Map},r.prototype.toJSON=function(){var t,r,i,a,s=[];try{for(var o=e(this._index),l=o.next();!l.done;l=o.next()){var u=n(l.value,2),h=u[0],c=u[1],d={};try{for(var p=(i=void 0,e(c)),f=p.next();!f.done;f=p.next()){var g=n(f.value,2),y=g[0],m=g[1];d[y]=Object.fromEntries(m)}}catch(t){i={error:t}}finally{try{f&&!f.done&&(a=p.return)&&a.call(p)}finally{if(i)throw i.error}}s.push([h,d])}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),index:s,serializationVersion:2}},r.prototype.termResults=function(t,n,r,i,a,s,o){var l,u,h,c,d;if(void 0===o&&(o=new Map),null==i)return o;try{for(var p=e(Object.keys(a)),f=p.next();!f.done;f=p.next()){var g=f.value,y=a[g],m=this._fieldIds[g],v=i.get(m);if(null!=v){var _=v.size,M=this._avgFieldLength[m];try{for(var x=(h=void 0,e(v.keys())),I=x.next();!I.done;I=x.next()){var E=I.value,S=s?s(this._documentIds.get(E),n):1;if(S){var A=v.get(E),O=this._fieldLength.get(E)[m],F=r*y*S*b(A,_,this._documentCount,O,M),T=o.get(E);if(T){T.score+=F,N(T.terms,t);var k=w(T.match,n);k?k.push(g):T.match[n]=[g]}else o.set(E,{score:F,terms:[t],match:(d={},d[n]=[g],d)})}}}catch(t){h={error:t}}finally{try{I&&!I.done&&(c=x.return)&&c.call(x)}finally{if(h)throw h.error}}}}}catch(t){l={error:t}}finally{try{f&&!f.done&&(u=p.return)&&u.call(p)}finally{if(l)throw l.error}}return o},r.prototype.addTerm=function(t,e,n){var r=this._index.fetch(n,F),i=r.get(t);if(null==i)(i=new Map).set(e,1),r.set(t,i);else{var a=i.get(e);i.set(e,(a||0)+1)}},r.prototype.removeTerm=function(t,e,n){if(this._index.has(n)){var r=this._index.fetch(n,F),i=r.get(t);null==i||null==i.get(e)?this.warnDocumentChanged(e,t,n):i.get(e)<=1?i.size<=1?r.delete(t):i.delete(e):i.set(e,i.get(e)-1),0===this._index.get(n).size&&this._index.delete(n)}else this.warnDocumentChanged(e,t,n)},r.prototype.warnDocumentChanged=function(t,n,r){var i,a;if(null!=console&&null!=console.warn)try{for(var s=e(Object.keys(this._fieldIds)),o=s.next();!o.done;o=s.next()){var l=o.value;if(this._fieldIds[l]===n)return void console.warn("MiniSearch: document with ID ".concat(this._documentIds.get(t),' has changed before removal: term "').concat(r,'" was not present in field "').concat(l,'". Removing a document after it has changed can corrupt the index!'))}}catch(t){i={error:t}}finally{try{o&&!o.done&&(a=s.return)&&a.call(s)}finally{if(i)throw i.error}}},r.prototype.addDocumentId=function(t){var e=this._nextId;return this._documentIds.set(e,t),this._documentCount+=1,this._nextId+=1,e},r.prototype.addFields=function(t){for(var e=0;e<t.length;e++)this._fieldIds[t[e]]=e},r.prototype.addFieldLength=function(t,e,n,r){var i=this._fieldLength.get(t);null==i&&this._fieldLength.set(t,i=[]),i[e]=r;var a=(this._avgFieldLength[e]||0)*n+r;this._avgFieldLength[e]=a/(n+1)},r.prototype.removeFieldLength=function(t,e,n,r){var i=this._avgFieldLength[e]*n-r;this._avgFieldLength[e]=i/(n-1)},r.prototype.saveStoredFields=function(t,n){var r,i,a=this._options,s=a.storeFields,o=a.extractField;if(null!=s&&0!==s.length){var l=this._storedFields.get(t);null==l&&this._storedFields.set(t,l={});try{for(var u=e(s),h=u.next();!h.done;h=u.next()){var c=h.value,d=o(n,c);void 0!==d&&(l[c]=d)}}catch(t){r={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}},r}(),w=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0},M=((r={}).or=function(t,n){var r,i;try{for(var a=e(n.keys()),s=a.next();!s.done;s=a.next()){var o=s.value,l=t.get(o);if(null==l)t.set(o,n.get(o));else{var u=n.get(o),h=u.score,c=u.terms,d=u.match;l.score=l.score+h,l.match=Object.assign(l.match,d),A(l.terms,c)}}}catch(t){r={error:t}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return t},r.and=function(t,n){var r,i,a=new Map;try{for(var s=e(n.keys()),o=s.next();!o.done;o=s.next()){var l=o.value,u=t.get(l);if(null!=u){var h=n.get(l),c=h.score,d=h.terms,p=h.match;A(u.terms,d),a.set(l,{score:u.score+c,terms:u.terms,match:Object.assign(u.match,p)})}}}catch(t){r={error:t}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return a},r.and_not=function(t,n){var r,i;try{for(var a=e(n.keys()),s=a.next();!s.done;s=a.next()){var o=s.value;t.delete(o)}}catch(t){r={error:t}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return t},r),b=function(t,e,n,r,i){return Math.log(1+(n-e+.5)/(e+.5))*(.5+2.2*t/(t+1.2*(1-.7+.7*r/i)))},x=function(t){return function(e,n,r){return{term:e,fuzzy:"function"==typeof t.fuzzy?t.fuzzy(e,n,r):t.fuzzy||!1,prefix:"function"==typeof t.prefix?t.prefix(e,n,r):!0===t.prefix}}},I={idField:"id",extractField:function(t,e){return t[e]},tokenize:function(t,e){return t.split(k)},processTerm:function(t,e){return t.toLowerCase()},fields:void 0,searchOptions:void 0,storeFields:[]},E={combineWith:v,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375}},S={prefix:function(t,e,n){return e===n.length-1}},N=function(t,e){t.includes(e)||t.push(e)},A=function(t,n){var r,i;try{for(var a=e(n),s=a.next();!s.done;s=a.next()){var o=s.value;t.includes(o)||t.push(o)}}catch(t){r={error:t}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}},O=function(t,e){var n=t.score;return e.score-n},F=function(){return new Map},T=function(t){var n,r,i=new Map;try{for(var a=e(Object.keys(t)),s=a.next();!s.done;s=a.next()){var o=s.value;i.set(parseInt(o,10),t[o])}}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i},k=/[\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u;return _},"object"==typeof t&&typeof e<"u"?e.exports=r():"function"==typeof define&&define.amd?define(r):(n=typeof globalThis<"u"?globalThis:n||self).MiniSearch=r()})),gr={};mi(gr,{Mappedin:()=>lt,MappedinDestinationSet:()=>dt,OfflineSearch:()=>Vt,getVenue:()=>Da,getVenueBundle:()=>Ga,initialize:()=>mr}),module.exports=gi(gr),w(),w();var ai=Zt(Ya(),1);w(),w(),w();var Xa=Zt(Ja(),1);w();var ga=class{origin;destination;vortex;distance;angle;weight;constructor({origin:t,destination:e,vortex:n,elevationDelta:r=0,distance:i=0,angle:a=0}){let s,o;if(this.origin=t,this.destination=e,this.vortex=n,this.distance=i,this.angle=a,n?(this.distance=0,this.angle=0,s=void 0!==n.weight&&n.weight>0?n.weight:"elevator"===n.type?2e3:1e3,o=n.multiplier&&n.multiplier>=1?n.multiplier:1,this.weight=r*o+s):(s=e.weight&&e.weight>=0?e.weight:0,o=e.multiplier&&e.multiplier>=1?e.multiplier:1,this.weight=this.distance*o+s),isNaN(this.angle))throw new Error("nan angle")}},ea=ga;w();var fa="mi-debug",yi={loggingEnabled:()=>"development"===_.env.NODE_ENV||"dev"===_.env.NODE_ENV||"test"===_.env.NODE_ENV||"true"===globalThis.sessionStorage?.getItem(fa),log(...t){this.loggingEnabled()&&console.log("[MappedInJS]",...t)},warn(...t){this.loggingEnabled()&&console.warn("[MappedInJS]",...t)},error(...t){this.loggingEnabled()&&console.error("[MappedInJS]",...t)},assert(...t){this.loggingEnabled()&&console.assert(...t)},time(t){this.loggingEnabled()&&console.time(t)},timeEnd(t){this.loggingEnabled()&&console.timeEnd(t)}},A=yi;function ki(t){if(t.scale||t.x_scale)return 1/(t.scale||t.x_scale||1);try{if(!t.georeference)throw new Error(`map ${t.name||t.shortName||t.id} does not have a georeference field`);if(t.georeference.length<3)throw new Error(`map ${t.name||t.shortName||t.id} has less than 3 georeference points, we require at least 3 for proper map scaling`);let e=t.georeference[0],n=t.georeference[2],r=(0,Xa.getDistance)({latitude:e.target.x,longitude:e.target.y},{latitude:n.target.x,longitude:n.target.y}),i=e.control.x-n.control.x,a=e.control.y-n.control.y;return Math.sqrt(i*i+a*a)/r}catch(t){return A.error(t),1}}function bi(t,e){let n=t.x-e.x,r=t.y-e.y;return(Math.atan2(r,n)+2.5*Math.PI)%(2*Math.PI)}var ya=class{edges;nodesById;mapsById;constructor({nodes:t,vortexes:e,maps:n,showVortexNames:r=!1}){this.edges={},this.mapsById=n.map((t=>({...t,_scale:ki(t)}))).reduce(((t,e)=>(t[e.id]=e,t)),{});let i=t.filter((t=>!!this.mapsById[t.map])).map((t=>({...t,paths:t.paths?t.paths.filter((({map:e})=>e===t.map)):[]})));this.nodesById=i.reduce(((t,e)=>(t[e.id]=e,t)),{});for(let t in this.nodesById)this.nodesById.hasOwnProperty(t)&&(this.nodesById[t].paths=this.nodesById[t].paths.filter((({node:t})=>!!this.nodesById[t])));let a=e.map((t=>({...t,name:r?t.name:t.type,nodes:t.nodes?t.nodes.filter((t=>!!this.nodesById[t])):[]})));i.forEach((t=>{this.edges[t.id]=t.paths.map((({node:e})=>{let n=this.nodesById[e];return new ea({angle:bi(t,n),destination:n,distance:this.getDistance(t,n),origin:t})}))})),a.forEach((t=>{if(null==t.nodes||0===t.nodes.length)return;let e=0;for(;e<t.nodes.length-1;){let n=this.nodesById[t.nodes[e]];if(e++,null==n)continue;let r=e;for(;r<t.nodes.length;){let e=this.nodesById[t.nodes[r]];if(r++,null==e)continue;let i=this.mapsById[n.map].elevation||0,a=this.mapsById[e.map].elevation||0,s=Math.abs(i-a);this.edges[n.id].push(new ea({destination:e,elevationDelta:s,origin:n,vortex:t})),this.edges[e.id].push(new ea({destination:n,elevationDelta:s,origin:e,vortex:t}))}}}))}aStar(t,e,n){let r=t.map((t=>this.nodesById[t])).filter((t=>t)),i=e.map((t=>this.nodesById[t])).filter((t=>t));if(0===r.length||0===i.length)return[];let a=[],s={},o={};for(r.forEach((t=>{let e=this.getShortestEuclideanDistance(t,i);a.push({origin:t,priority:e}),s[t.id]=null,o[t.id]=0})),a.sort(((t,e)=>t.priority-e.priority));a.length>0;){let t=a[0];if(i.includes(t.origin)){let e=[],n=s[t.origin.id];for(;null!=n;){e.push(n);let t=s[n.origin.id];n=null!=t?t:null}return e.reverse()}for(let e of this.edges[t.origin.id]){let r=e.vortex&&!1===e.vortex.accessible;if(n&&(r||!1===e.origin.accessible||!1===e.destination.accessible))continue;let l=o[t.origin.id]+e.weight;if(null==o[e.destination.id]||l<o[e.destination.id]){o[e.destination.id]=l;let t=l+this.getShortestEuclideanDistance(e.destination,i);a.push({origin:e.destination,priority:t}),s[e.destination.id]=e}}a.splice(0,1),a.sort(((t,e)=>t.priority-e.priority))}return[]}getDistance(t,e){let n,r=t.x-e.x,i=t.y-e.y,a=r*r+i*i;return n=null==this.mapsById[t.map]?1:this.mapsById[t.map]._scale,Math.sqrt(a)/n}getShortestEuclideanDistance(t,e){return e.reduce(((e,n)=>{let r=this.getDistance(t,n);return Math.min(e,r)}),Number.MAX_VALUE)}},ka=ya;function vi(t){switch(t){case"down":case"up":return`${t} `;default:return""}}w(),w();var ba=class{node;instruction;action;atLocation;type;distance=0;constructor({origin:t,action:e,distance:n,atLocation:r,instruction:i}){this.node=t,this.action=e,this.distance=n||0,this.atLocation=r,this.instruction="",i?this.instruction=i:(null!=e&&"Departure"===e.type?this.instruction=null!=r?`Depart from ${r.name}`:"Depart from current location":null!=e&&"Arrival"===e.type?this.instruction=null!=r?`Arrive at ${r.name}`:"Arrive at destination":null!=e&&"TakeVortex"===e.type?this.instruction=`Take ${r&&r.name} ${vi(e.direction)}to ${e.toMap.name}`:null!=e&&"ExitVortex"===e.type?this.instruction=`Exit ${r&&r.name} at ${e.toMap.name}`:null!=e&&"Right"===e.bearing?this.instruction="Turn right":null!=e&&"SlightRight"===e.bearing?this.instruction="Turn slightly right":null!=e&&"Straight"===e.bearing?this.instruction="Head straight":null!=e&&"SlightLeft"===e.bearing?this.instruction="Turn slightly left":null!=e&&"Left"===e.bearing&&(this.instruction="Turn left"),null!=e&&"Turn"===e.type&&r&&(this.instruction+=` at ${r.name}`))}},et=ba,ta=.1*Math.PI;function aa(t,e){return((e-t+Math.PI)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)-Math.PI}var va=class{graph;locationsByNodeId;constructor({locations:t,nodes:e,vortexes:n,maps:r,showVortexNames:i}){this.graph=new ka({maps:r,nodes:e,showVortexNames:i,vortexes:n}),this.locationsByNodeId=t.reduce(((t,e)=>(e.nodes&&e.nodes.forEach((n=>{t[n.node]=e})),e.polygons&&e.polygons.forEach((n=>{n.entrances&&n.entrances.forEach((n=>{t[n]=e}))})),t)),{})}getClosestLocationInRay(t,e=.5*Math.PI,n=10){let r=0,i=0,a=t;for(;Math.abs(r)<e&&i<n;){let t=this.graph.edges[a.destination.id],s=null,o=0;for(let e of t)if(e.distance>0)if(null!=s){let t=-aa(a.angle,e.angle);Math.abs(t)<Math.abs(o)&&(s=e,o=t)}else s=e,o=-aa(a.angle,e.angle);if(null==s)return null;{if(Math.abs(o)>=e||(r+=o,i+=s.distance,Math.abs(r)>=e||i>n))return null;let t=this.locationsByNodeId[s.destination.id];if(null!=t)return t;a=s}}return null}getDirections({originIds:t,destinationNodeIds:e,accessible:n,departFrom:r,arriveAt:i}){let a=this.graph.aStar(t,e,n);if(0===a.length)return{distance:0,instructions:[new et({distance:0,instruction:"No Valid Path Available"})],path:[]};let s=0,o=new Array(a.length+1);for(let t=0;t<a.length;t++)o[t]=a[t].origin;o[a.length]=a[a.length-1].destination;let l=[],u=null,h=null,c=0,d=0;for(let t=0;t<a.length;t++){let e=a[t],n=e.origin,o=e.destination;if(s+=e.distance,c+=h?.distance||0,0===t&&l.push(new et({action:{type:"Departure"},atLocation:r,distance:0,origin:n})),null!=e.vortex){let t=this.graph.mapsById[n.map],r=this.graph.mapsById[o.map],i="none";if(null!=t.elevation&&null!=r.elevation){let e=t.elevation-r.elevation;e>0?i="down":e<0&&(i="up")}l.push(new et({action:{direction:i,fromMap:t,toMap:r,type:"TakeVortex"},atLocation:e.vortex,distance:c,origin:n})),d+=c,c=0}else if(null!=u&&null!=h)if(null!=h.vortex){let t=this.graph.mapsById[u.map],e=this.graph.mapsById[h.destination.map];l.push(new et({action:{fromMap:t,toMap:e,type:"ExitVortex"},atLocation:h.vortex,distance:c,origin:n})),d+=c,c=0}else{let t=this.graph.edges[n.id].filter((t=>t.destination!==u&&t.destination!==e.destination));if(t.length>0){let r=-aa(h.angle,e.angle),i=t.reduce(((t,n)=>{let r=-aa(e.angle,n.angle);return Math.min(t,Math.abs(r))}),Math.PI);if(Math.abs(r)>=ta||Math.abs(i)<=ta){let t;t=r<=-Math.PI/4?"Right":r<=-ta?"SlightRight":r<=ta?"Straight":r<=Math.PI/4?"SlightLeft":"Left";let e=this.locationsByNodeId[n.id];if(e||(e=this.getClosestLocationInRay(h,.5*Math.PI,10)),null!=e){let r=new et({action:{bearing:t,referencePosition:"At",type:"Turn"},atLocation:e,distance:c,origin:n});r.type=t,l.push(r)}else l.push(new et({action:{bearing:t,referencePosition:"At",type:"Turn"},distance:c,origin:n}));d+=c,c=0}}}t===a.length-1&&(l.push(new et({action:{type:"Arrival"},atLocation:i,distance:s-d<0?0:s-d,origin:e.destination})),d+=c,c=0),u=n,h=e}let p=[],f=null;for(let t=l.length-1;t>=0;t--){let e=l[t],{action:n}=e;n&&"TakeVortex"===n.type?(f=e.node,p.unshift(e)):n&&"Turn"===n.type&&null!=f?this.graph.getDistance(e.node,f)>5&&p.unshift(e):p.unshift(e)}return{distance:s,instructions:p,path:o}}},Ma=va;function Za(t){let e=+this._x.call(null,t),n=+this._y.call(null,t);return Qa(this.cover(e,n),e,n,t)}function Qa(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,a,s,o,l,u,h,c,d,p=t._root,f={data:r},g=t._x0,y=t._y0,m=t._x1,v=t._y1;if(!p)return t._root=f,t;for(;p.length;)if((u=e>=(a=(g+m)/2))?g=a:m=a,(h=n>=(s=(y+v)/2))?y=s:v=s,i=p,!(p=p[c=h<<1|u]))return i[c]=f,t;if(o=+t._x.call(null,p.data),l=+t._y.call(null,p.data),e===o&&n===l)return f.next=p,i?i[c]=f:t._root=f,t;do{i=i?i[c]=new Array(4):t._root=new Array(4),(u=e>=(a=(g+m)/2))?g=a:m=a,(h=n>=(s=(y+v)/2))?y=s:v=s}while((c=h<<1|u)==(d=(l>=s)<<1|o>=a));return i[d]=p,i[c]=f,t}function en(t){var e,n,r,i,a=t.length,s=new Array(a),o=new Array(a),l=1/0,u=1/0,h=-1/0,c=-1/0;for(n=0;n<a;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(i=+this._y.call(null,e))||(s[n]=r,o[n]=i,r<l&&(l=r),r>h&&(h=r),i<u&&(u=i),i>c&&(c=i));if(l>h||u>c)return this;for(this.cover(l,u).cover(h,c),n=0;n<a;++n)Qa(this,s[n],o[n],t[n]);return this}function tn(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,a=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,a=(r=Math.floor(e))+1;else{for(var s,o,l=i-n||1,u=this._root;n>t||t>=i||r>e||e>=a;)switch(o=(e<r)<<1|t<n,s=new Array(4),s[o]=u,u=s,l*=2,o){case 0:i=n+l,a=r+l;break;case 1:n=i-l,a=r+l;break;case 2:i=n+l,r=a-l;break;case 3:n=i-l,r=a-l}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=r,this._x1=i,this._y1=a,this}function an(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t}function nn(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function je(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function rn(t,e,n){var r,i,a,s,o,l,u,h=this._x0,c=this._y0,d=this._x1,p=this._y1,f=[],g=this._root;for(g&&f.push(new je(g,h,c,d,p)),null==n?n=1/0:(h=t-n,c=e-n,d=t+n,p=e+n,n*=n);l=f.pop();)if(!(!(g=l.node)||(i=l.x0)>d||(a=l.y0)>p||(s=l.x1)<h||(o=l.y1)<c))if(g.length){var y=(i+s)/2,m=(a+o)/2;f.push(new je(g[3],y,m,s,o),new je(g[2],i,m,y,o),new je(g[1],y,a,s,m),new je(g[0],i,a,y,m)),(u=(e>=m)<<1|t>=y)&&(l=f[f.length-1],f[f.length-1]=f[f.length-1-u],f[f.length-1-u]=l)}else{var v=t-+this._x.call(null,g.data),_=e-+this._y.call(null,g.data),w=v*v+_*_;if(w<n){var M=Math.sqrt(n=w);h=t-M,c=e-M,d=t+M,p=e+M,r=g.data}}return r}function sn(t){if(isNaN(a=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t)))return this;var e,n,r,i,a,s,o,l,u,h,c,d,p=this._root,f=this._x0,g=this._y0,y=this._x1,m=this._y1;if(!p)return this;if(p.length)for(;;){if((u=a>=(o=(f+y)/2))?f=o:y=o,(h=s>=(l=(g+m)/2))?g=l:m=l,e=p,!(p=p[c=h<<1|u]))return this;if(!p.length)break;(e[c+1&3]||e[c+2&3]||e[c+3&3])&&(n=e,d=c)}for(;p.data!==t;)if(r=p,!(p=p.next))return this;return(i=p.next)&&delete p.next,r?(i?r.next=i:delete r.next,this):e?(i?e[c]=i:delete e[c],(p=e[0]||e[1]||e[2]||e[3])&&p===(e[3]||e[2]||e[1]||e[0])&&!p.length&&(n?n[d]=p:this._root=p),this):(this._root=i,this)}function on(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this}function ln(){return this._root}function un(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t}function cn(t){var e,n,r,i,a,s,o=[],l=this._root;for(l&&o.push(new je(l,this._x0,this._y0,this._x1,this._y1));e=o.pop();)if(!t(l=e.node,r=e.x0,i=e.y0,a=e.x1,s=e.y1)&&l.length){var u=(r+a)/2,h=(i+s)/2;(n=l[3])&&o.push(new je(n,u,h,a,s)),(n=l[2])&&o.push(new je(n,r,h,u,s)),(n=l[1])&&o.push(new je(n,u,i,a,h)),(n=l[0])&&o.push(new je(n,r,i,u,h))}return this}function dn(t){var e,n=[],r=[];for(this._root&&n.push(new je(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var i=e.node;if(i.length){var a,s=e.x0,o=e.y0,l=e.x1,u=e.y1,h=(s+l)/2,c=(o+u)/2;(a=i[0])&&n.push(new je(a,s,o,h,c)),(a=i[1])&&n.push(new je(a,h,o,l,c)),(a=i[2])&&n.push(new je(a,s,c,h,u)),(a=i[3])&&n.push(new je(a,h,c,l,u))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this}function pn(t){return t[0]}function hn(t){return arguments.length?(this._x=t,this):this._x}function mn(t){return t[1]}function gn(t){return arguments.length?(this._y=t,this):this._y}function Ct(t,e,n){var r=new wa(e??pn,n??mn,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function wa(t,e,n,r,i,a){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function fn(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}w(),w(),w(),w(),w(),w(),w(),w(),w(),w(),w(),w(),w(),w(),w(),w();var _e=Ct.prototype=wa.prototype;_e.copy=function(){var t,e,n=new wa(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=fn(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=fn(e));return n},_e.add=Za,_e.addAll=en,_e.cover=tn,_e.data=an,_e.extent=nn,_e.find=rn,_e.remove=sn,_e.removeAll=on,_e.root=ln,_e.size=un,_e.visit=cn,_e.visitAfter=dn,_e.x=hn,_e.y=gn;var De,Me,ct=class{constructor(t){ve(this,De,void 0),Ee(this,"categories"),Ee(this,"locations"),Ee(this,"vortexes"),Ee(this,"maps"),Ee(this,"nodes"),Ee(this,"polygons"),Ee(this,"events"),Ee(this,"mapGroups"),Ee(this,"locationStates"),Ee(this,"rankings"),ve(this,Me,{}),ue(this,De,t)}get polygonsByMapId(){if(C(this,Me).polygonsByMapId)return C(this,Me).polygonsByMapId;let t,e={};for(let n=0,r=C(this,De).polygons.length;n<r;++n)t=C(this,De).polygons[n],e[t.map.id]||(e[t.map.id]=[]),e[t.map.id].push(t);let n=Object.entries(e).reduce(((t,[e,n])=>(t.set(e,n),t)),new Map);return C(this,Me).polygonsByMapId=n,C(this,Me).polygonsByMapId}get nodesByMapId(){if(C(this,Me).nodesByMapId)return C(this,Me).nodesByMapId;let t,e={};for(let n=0,r=C(this,De).nodes.length;n<r;++n)t=C(this,De).nodes[n],e[t.map.id]||(e[t.map.id]=[]),e[t.map.id].push(t);let n=Object.entries(e).reduce(((t,[e,n])=>(t.set(e,n),t)),new Map);return C(this,Me).nodesByMapId=n,C(this,Me).nodesByMapId}findNearestNodeOnMap(t,e){if(C(this,Me).nodeTreesByMap||(C(this,Me).nodeTreesByMap=new Map),!C(this,Me).nodeTreesByMap.has(t)){let e=this.nodesByMapId.get(t)??[],n=Ct();n.x((t=>t.x)),n.y((t=>t.y)),n.addAll(e),C(this,Me).nodeTreesByMap.set(t,n)}return C(this,Me).nodeTreesByMap.get(t).find(e.x,e.y)}get locationsByMapId(){if(C(this,Me).locationsByMapId)return C(this,Me).locationsByMapId;let t,e={};for(let n=0,r=C(this,De).locations.length;n<r;++n){t=C(this,De).locations[n];for(let n=0,r=t.polygons.length;n<r;++n)e[t.polygons[n].map.id]||(e[t.polygons[n].map.id]=[]),e[t.polygons[n].map.id].push(t)}let n=Object.entries(e).reduce(((t,[e,n])=>(t.set(e,n),t)),new Map);return C(this,Me).locationsByMapId=n,C(this,Me).locationsByMapId}static create(t){return ct.instances.has(t)||ct.instances.set(t,new ct(t)),ct.instances.get(t)}static clear(){ct.instances.clear()}},na=ct;De=new WeakMap,Me=new WeakMap,Ee(na,"instances",new Map);var Pe=na;w(),w(),w(),w();var yn=" ",Ne=class{static get separator(){return yn}static set separator(t){yn=t}static parse(t){if(!isNaN(parseFloat(t))&&isFinite(t))return Number(t);let e=String(t).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==e[e.length-1]&&e.splice(e.length-1),""==e)return NaN;let n=null;switch(e.length){case 3:n=e[0]/1+e[1]/60+e[2]/3600;break;case 2:n=e[0]/1+e[1]/60;break;case 1:n=e[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(n=-n),Number(n)}static toDms(t,e="d",n){if(isNaN(t)||"string"==typeof t&&""==t.trim()||"boolean"==typeof t||t==1/0||null==t)return null;if(void 0===n)switch(e){case"d":case"deg":n=4;break;case"dm":case"deg+min":n=2;break;case"dms":case"deg+min+sec":n=0;break;default:e="d",n=4}t=Math.abs(t);let r=null,i=null,a=null,s=null;switch(e){default:case"d":case"deg":i=t.toFixed(n),i<100&&(i="0"+i),i<10&&(i="0"+i),r=i+"°";break;case"dm":case"deg+min":i=Math.floor(t),a=(60*t%60).toFixed(n),60==a&&(a=(0).toFixed(n),i++),i=("000"+i).slice(-3),a<10&&(a="0"+a),r=i+"°"+Ne.separator+a+"′";break;case"dms":case"deg+min+sec":i=Math.floor(t),a=Math.floor(3600*t/60)%60,s=(3600*t%60).toFixed(n),60==s&&(s=(0).toFixed(n),a++),60==a&&(a=0,i++),i=("000"+i).slice(-3),a=("00"+a).slice(-2),s<10&&(s="0"+s),r=i+"°"+Ne.separator+a+"′"+Ne.separator+s+"″"}return r}static toLat(t,e,n){let r=Ne.toDms(Ne.wrap90(t),e,n);return null===r?"–":r.slice(1)+Ne.separator+(t<0?"S":"N")}static toLon(t,e,n){let r=Ne.toDms(Ne.wrap180(t),e,n);return null===r?"–":r+Ne.separator+(t<0?"W":"E")}static toBrng(t,e,n){let r=Ne.toDms(Ne.wrap360(t),e,n);return null===r?"–":r.replace("360","0")}static fromLocale(t){let e=123456.789.toLocaleString(),n={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(n.thousands,"⁜").replace(n.decimal,".").replace("⁜",",")}static toLocale(t){let e=123456.789.toLocaleString(),n={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(/,([0-9])/,"⁜$1").replace(".",n.decimal).replace("⁜",n.thousands)}static compassPoint(t,e=3){if(![1,2,3].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);t=Ne.wrap360(t);let n=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*n/360)%n*16/n]}static wrap360(t){return 0<=t&&t<360?t:(t%360+360)%360}static wrap180(t){return-180<t&&t<=180?t:(t+540)%360-180}static wrap90(t){return-90<=t&&t<=90?t:Math.abs((t%360+270)%360-180)-90}};Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};var K=Ne,he=Math.PI,S=class{constructor(t,e){if(isNaN(t))throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e))throw new TypeError(`invalid lon ‘${e}’`);this._lat=K.wrap90(Number(t)),this._lon=K.wrap180(Number(e))}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?K.wrap90(K.parse(t)):K.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?K.wrap90(K.parse(t)):K.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid latitude ‘${t}’`)}get lon(){return this._lon}get lng(){return this._lon}get longitude(){return this._lon}set lon(t){if(this._lon=isNaN(t)?K.wrap180(K.parse(t)):K.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?K.wrap180(K.parse(t)):K.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?K.wrap180(K.parse(t)):K.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${t}’`)}static get metresToKm(){return.001}static get metresToMiles(){return 1/1609.344}static get metresToNauticalMiles(){return 1/1852}static parse(...t){if(0==t.length)throw new TypeError("invalid (empty) point");if(null===t[0]||null===t[1])throw new TypeError("invalid (null) point");let e,n;if(2==t.length&&([e,n]=t,e=K.wrap90(K.parse(e)),n=K.wrap180(K.parse(n)),isNaN(e)||isNaN(n)))throw new TypeError(`invalid point ‘${t.toString()}’`);if(1==t.length&&"string"==typeof t[0]&&([e,n]=t[0].split(","),e=K.wrap90(K.parse(e)),n=K.wrap180(K.parse(n)),isNaN(e)||isNaN(n)))throw new TypeError(`invalid point ‘${t[0]}’`);if(1==t.length&&"object"==typeof t[0]){let r=t[0];if("Point"==r.type&&Array.isArray(r.coordinates)?[n,e]=r.coordinates:(null!=r.latitude&&(e=r.latitude),null!=r.lat&&(e=r.lat),null!=r.longitude&&(n=r.longitude),null!=r.lng&&(n=r.lng),null!=r.lon&&(n=r.lon),e=K.wrap90(K.parse(e)),n=K.wrap180(K.parse(n))),isNaN(e)||isNaN(n))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if(isNaN(e)||isNaN(n))throw new TypeError(`invalid point ‘${t.toString()}’`);return new S(e,n)}distanceTo(t,e=6371e3){if(t instanceof S||(t=S.parse(t)),isNaN(e))throw new TypeError(`invalid radius ‘${e}’`);let n=e,r=this.lat.toRadians(),i=this.lon.toRadians(),a=t.lat.toRadians(),s=a-r,o=t.lon.toRadians()-i,l=Math.sin(s/2)*Math.sin(s/2)+Math.cos(r)*Math.cos(a)*Math.sin(o/2)*Math.sin(o/2);return n*(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)))}initialBearingTo(t){if(t instanceof S||(t=S.parse(t)),this.equals(t))return NaN;let e=this.lat.toRadians(),n=t.lat.toRadians(),r=(t.lon-this.lon).toRadians(),i=Math.cos(e)*Math.sin(n)-Math.sin(e)*Math.cos(n)*Math.cos(r),a=Math.sin(r)*Math.cos(n),s=Math.atan2(a,i).toDegrees();return K.wrap360(s)}finalBearingTo(t){t instanceof S||(t=S.parse(t));let e=t.initialBearingTo(this)+180;return K.wrap360(e)}midpointTo(t){t instanceof S||(t=S.parse(t));let e=this.lat.toRadians(),n=this.lon.toRadians(),r=t.lat.toRadians(),i=(t.lon-this.lon).toRadians(),a=Math.cos(e),s=0,o=Math.sin(e),l={x:a+Math.cos(r)*Math.cos(i),y:s+Math.cos(r)*Math.sin(i),z:o+Math.sin(r)},u=Math.atan2(l.z,Math.sqrt(l.x*l.x+l.y*l.y)),h=n+Math.atan2(l.y,l.x),c=u.toDegrees(),d=h.toDegrees();return new S(c,d)}intermediatePointTo(t,e){if(t instanceof S||(t=S.parse(t)),this.equals(t))return new S(this.lat,this.lon);let n=this.lat.toRadians(),r=this.lon.toRadians(),i=t.lat.toRadians(),a=t.lon.toRadians(),s=i-n,o=a-r,l=Math.sin(s/2)*Math.sin(s/2)+Math.cos(n)*Math.cos(i)*Math.sin(o/2)*Math.sin(o/2),u=2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),h=Math.sin((1-e)*u)/Math.sin(u),c=Math.sin(e*u)/Math.sin(u),d=h*Math.cos(n)*Math.cos(r)+c*Math.cos(i)*Math.cos(a),p=h*Math.cos(n)*Math.sin(r)+c*Math.cos(i)*Math.sin(a),f=h*Math.sin(n)+c*Math.sin(i),g=Math.atan2(f,Math.sqrt(d*d+p*p)),y=Math.atan2(p,d),m=g.toDegrees(),v=y.toDegrees();return new S(m,v)}destinationPoint(t,e,n=6371e3){let r=t/n,i=Number(e).toRadians(),a=this.lat.toRadians(),s=this.lon.toRadians(),o=Math.sin(a)*Math.cos(r)+Math.cos(a)*Math.sin(r)*Math.cos(i),l=Math.asin(o),u=Math.sin(i)*Math.sin(r)*Math.cos(a),h=Math.cos(r)-Math.sin(a)*o,c=s+Math.atan2(u,h),d=l.toDegrees(),p=c.toDegrees();return new S(d,p)}static intersection(t,e,n,r){if(t instanceof S||(t=S.parse(t)),n instanceof S||(n=S.parse(n)),isNaN(e))throw new TypeError(`invalid brng1 ‘${e}’`);if(isNaN(r))throw new TypeError(`invalid brng2 ‘${r}’`);let i=t.lat.toRadians(),a=t.lon.toRadians(),s=n.lat.toRadians(),o=n.lon.toRadians(),l=Number(e).toRadians(),u=Number(r).toRadians(),h=s-i,c=o-a,d=2*Math.asin(Math.sqrt(Math.sin(h/2)*Math.sin(h/2)+Math.cos(i)*Math.cos(s)*Math.sin(c/2)*Math.sin(c/2)));if(Math.abs(d)<Number.EPSILON)return new S(t.lat,t.lon);let p=(Math.sin(s)-Math.sin(i)*Math.cos(d))/(Math.sin(d)*Math.cos(i)),f=(Math.sin(i)-Math.sin(s)*Math.cos(d))/(Math.sin(d)*Math.cos(s)),g=Math.acos(Math.min(Math.max(p,-1),1)),y=Math.acos(Math.min(Math.max(f,-1),1)),m=l-(Math.sin(o-a)>0?g:2*he-g),v=(Math.sin(o-a)>0?2*he-y:y)-u;if(0==Math.sin(m)&&0==Math.sin(v)||Math.sin(m)*Math.sin(v)<0)return null;let _=-Math.cos(m)*Math.cos(v)+Math.sin(m)*Math.sin(v)*Math.cos(d),w=Math.atan2(Math.sin(d)*Math.sin(m)*Math.sin(v),Math.cos(v)+Math.cos(m)*_),M=Math.asin(Math.min(Math.max(Math.sin(i)*Math.cos(w)+Math.cos(i)*Math.sin(w)*Math.cos(l),-1),1)),b=a+Math.atan2(Math.sin(l)*Math.sin(w)*Math.cos(i),Math.cos(w)-Math.sin(i)*Math.sin(M)),x=M.toDegrees(),I=b.toDegrees();return new S(x,I)}crossTrackDistanceTo(t,e,n=6371e3){t instanceof S||(t=S.parse(t)),e instanceof S||(e=S.parse(e));let r=n;if(this.equals(t))return 0;let i=t.distanceTo(this,r)/r,a=t.initialBearingTo(this).toRadians(),s=t.initialBearingTo(e).toRadians();return Math.asin(Math.sin(i)*Math.sin(a-s))*r}alongTrackDistanceTo(t,e,n=6371e3){t instanceof S||(t=S.parse(t)),e instanceof S||(e=S.parse(e));let r=n;if(this.equals(t))return 0;let i=t.distanceTo(this,r)/r,a=t.initialBearingTo(this).toRadians(),s=t.initialBearingTo(e).toRadians(),o=Math.asin(Math.sin(i)*Math.sin(a-s));return Math.acos(Math.cos(i)/Math.abs(Math.cos(o)))*Math.sign(Math.cos(s-a))*r}maxLatitude(t){let e=Number(t).toRadians(),n=this.lat.toRadians();return Math.acos(Math.abs(Math.sin(e)*Math.cos(n))).toDegrees()}static crossingParallels(t,e,n){if(t.equals(e))return null;let r=Number(n).toRadians(),i=t.lat.toRadians(),a=t.lon.toRadians(),s=e.lat.toRadians(),o=e.lon.toRadians()-a,l=Math.sin(i)*Math.cos(s)*Math.cos(r)*Math.sin(o),u=Math.sin(i)*Math.cos(s)*Math.cos(r)*Math.cos(o)-Math.cos(i)*Math.sin(s)*Math.cos(r),h=Math.cos(i)*Math.cos(s)*Math.sin(r)*Math.sin(o);if(h*h>l*l+u*u)return null;let c=Math.atan2(-u,l),d=Math.acos(h/Math.sqrt(l*l+u*u)),p=a+c+d,f=(a+c-d).toDegrees(),g=p.toDegrees();return{lon1:K.wrap180(f),lon2:K.wrap180(g)}}rhumbDistanceTo(t,e=6371e3){t instanceof S||(t=S.parse(t));let n=e,r=this.lat.toRadians(),i=t.lat.toRadians(),a=i-r,s=Math.abs(t.lon-this.lon).toRadians();Math.abs(s)>he&&(s=s>0?-(2*he-s):2*he+s);let o=Math.log(Math.tan(i/2+he/4)/Math.tan(r/2+he/4)),l=Math.abs(o)>1e-11?a/o:Math.cos(r);return Math.sqrt(a*a+l*l*s*s)*n}rhumbBearingTo(t){if(t instanceof S||(t=S.parse(t)),this.equals(t))return NaN;let e=this.lat.toRadians(),n=t.lat.toRadians(),r=(t.lon-this.lon).toRadians();Math.abs(r)>he&&(r=r>0?-(2*he-r):2*he+r);let i=Math.log(Math.tan(n/2+he/4)/Math.tan(e/2+he/4)),a=Math.atan2(r,i).toDegrees();return K.wrap360(a)}rhumbDestinationPoint(t,e,n=6371e3){let r=this.lat.toRadians(),i=this.lon.toRadians(),a=Number(e).toRadians(),s=t/n,o=s*Math.cos(a),l=r+o;Math.abs(l)>he/2&&(l=l>0?he-l:-he-l);let u=Math.log(Math.tan(l/2+he/4)/Math.tan(r/2+he/4)),h=Math.abs(u)>1e-11?o/u:Math.cos(r),c=i+s*Math.sin(a)/h,d=l.toDegrees(),p=c.toDegrees();return new S(d,p)}rhumbMidpointTo(t){t instanceof S||(t=S.parse(t));let e=this.lat.toRadians(),n=this.lon.toRadians(),r=t.lat.toRadians(),i=t.lon.toRadians();Math.abs(i-n)>he&&(n+=2*he);let a=(e+r)/2,s=Math.tan(he/4+e/2),o=Math.tan(he/4+r/2),l=Math.tan(he/4+a/2),u=((i-n)*Math.log(l)+n*Math.log(o)-i*Math.log(s))/Math.log(o/s);isFinite(u)||(u=(n+i)/2);let h=a.toDegrees(),c=u.toDegrees();return new S(h,c)}static areaOf(t,e=6371e3){let n=e,r=t[0].equals(t[t.length-1]);r||t.push(t[0]);let i=t.length-1,a=0;for(let e=0;e<i;e++){let n=t[e].lat.toRadians(),r=t[e+1].lat.toRadians(),i=(t[e+1].lon-t[e].lon).toRadians();a+=2*Math.atan2(Math.tan(i/2)*(Math.tan(n/2)+Math.tan(r/2)),1+Math.tan(n/2)*Math.tan(r/2))}(function(t){let e=0,n=t[0].initialBearingTo(t[1]);for(let r=0;r<t.length-1;r++){let i=t[r].initialBearingTo(t[r+1]),a=t[r].finalBearingTo(t[r+1]);e+=(i-n+540)%360-180,e+=(a-i+540)%360-180,n=a}let r=t[0].initialBearingTo(t[1]);return e+=(r-n+540)%360-180,Math.abs(e)<90})(t)&&(a=Math.abs(a)-2*he);let s=Math.abs(a*n*n);return r||t.pop(),s}equals(t){return t instanceof S||(t=S.parse(t)),!(Math.abs(this.lat-t.lat)>Number.EPSILON||Math.abs(this.lon-t.lon)>Number.EPSILON)}toGeoJSON(){return{type:"Point",coordinates:[this.lon,this.lat]}}toString(t="d",e){if(!["d","dm","dms","n"].includes(t))throw new RangeError(`invalid format ‘${t}’`);if("n"==t)return null==e&&(e=4),`${this.lat.toFixed(e)},${this.lon.toFixed(e)}`;return`${K.toLat(this.lat,t,e)}, ${K.toLon(this.lon,t,e)}`}};w(),w(),w();var dt=class{destinations=[];constructor(t){this.destinations=t}};w();var bt=class{#t;#e;distance=0;path=[];instructions=[];constructor(t,e){this.#e=t,this.#t=e,this.distance=e.distance,this.instructions=e.instructions.map((t=>{let e={...t,action:{...t.action},atLocation:t.atLocation?.id?this.#e?._vortexesById?.[t.atLocation.id]:void 0,node:t.node?.id?this.#e?._nodesById?.[t.node.id]:void 0};return("TakeVortex"===e.action?.type||"ExitVortex"===e.action?.type)&&(e.action.fromMap=this.#e._mapsById?.[e.action?.fromMap.id],e.action.toMap=this.#e._mapsById?.[e.action?.toMap.id]),e})),this.path=e.path.map((t=>this.#e?._nodesById?.[t.id]))}toJSON(){return this.#t}},$e=class{#t;constructor(t){this.#t=t}directionsTo(t,e){if(t instanceof dt){let n=[],r=this;for(let i=0;i<t.destinations.length;i++){let a=t.destinations[i],s=Lt(r),o=Lt(a),l=this.#t.navigator.getDirections({originIds:s,destinationNodeIds:o,accessible:e?.accessible||!1}),u=new bt(this.#t,l);n.push(u),r=a}return n}{let n=Lt(this),r=Lt(t),i=this.#t.navigator.getDirections({originIds:n,destinationNodeIds:r,accessible:e?.accessible||!1});return new bt(this.#t,i)}}distanceTo(t,e){return this.directionsTo(t,e)?.distance||0}},wi=0,ji="9999-12-31T00:00:00.000Z";function xi(t,e,n=new Date){if(!t.states)return;let r=n||new Date,i=t.states.find((t=>{let e=new Date(t.start||wi),n=new Date(t.end||ji);return e<r&&n>r}));return i?e.find((t=>t.value===i.type)):void 0}var Ce=class extends $e{#t;#e;#n={};states;id="";name="";type="";description;sortOrder;logo;phone;social;color;shortName;detailsUrl;tags;externalId;showLabelWhenImagePresent;picture;operationHours;siblingGroups;gallery;constructor(t,e){super(t),this.#t=t,this.#e=e;let n=Object.assign({},e);delete n.categories,Object.assign(this,n)}#r;get polygons(){let t=this.#n.polygons;if(typeof t<"u")return t;let e=[],n=this.#r,r=this.#t._polygonsById;if(Array.isArray(n))for(let t=0,i=n.length;t<i;++t){let i=r[n[t].id];null!=i&&i.geometry.visible&&e.push(i)}return this.#n.polygons=e,e}set polygons(t){this.#r=t}#i=[];get nodes(){let t=this.#n.nodes;if(typeof t<"u")return t;let e=[],n=this.#i,r=this.#t._nodesById;if(n)for(let t=0,i=n.length;t<i;++t){let i=r[n[t].node];null!=i&&e.push(i)}return this.#n.nodes=e,e}set nodes(t){this.#i=t}#a;get parent(){let t=this.#n.parent;if(typeof t<"u")return t;let e,n=this.#t._locationsById,r=this.#a;return void 0!==r&&(e=n[r]),this.#n.parent=e,e}set parent(t){this.#a=t}get categories(){let t=this.#n.categories;if(typeof t<"u")return t;let e=[];return this.#e.categories.forEach((t=>{let n=this.#t.getCollectionItemById("categories",t);n&&e.push(n)})),this.#n.categories=e,e}get state(){return xi(this,this.#t.locationStates)}clone(){return new Ce(this.#t,this.#e)}get nodeOperationHours(){let t=this.#n.nodeOperationHours;if(typeof t<"u")return t;if(null==this.nodes)return{};let e=this.#e.nodes.reduce(((t,e)=>(null!=e.operationHours&&(t[e.node]=e.operationHours),t)),{});return this.#n.nodeOperationHours=e,e}static hydrate(t,e){return t.map((t=>new Ce(e,t)))}static async fetch(t){let e=t.options.things.locations.slice();t.options.things.categories&&fe(e,"categories"),t.options.things.nodes&&fe(e,"nodes"),t.options.things.polygons&&fe(e,"polygons"),t.options.things.locationStates&&fe(e,"states");let n={fields:e,venue:t.options.venue};try{let e=await ye(t.options,"location",n);return t.options.includeHidden||(e=e.filter((t=>!t.hidden))),e.map((e=>new Ce(t,e)))}catch(t){return A.error("Fetch Locations:",t),[]}}toJSON(){let t=this.#e;return delete t.color,t}};w();var Ge=class extends $e{#t;#e;#n={};geometry;perspectives;image;holes;textures;material;label;id="";layer;layerId;name;externalId;vertexes;canvasBounds;constructor(t,e){super(t),this.#t=t,this.#e=e;let n=Object.assign({},e);delete n.map,Object.assign(this,n)}get map(){let t=this.#n.map;if(typeof t<"u")return t;let e=this.#t.getCollectionItemById("maps",this.#e.map);return this.#n.map=e,e}get locations(){let t=this.#n.locations;if(typeof t<"u")return t;let e=[],n=Pe.instances.get(this.#t)?.locationsByMapId.get(this.map.id)??[],{id:r}=this;for(let t=0,i=n.length;t<i;++t){let i=n[t],a=i.polygons;if(Array.isArray(a))for(let t=0,n=a.length;t<n;++t)if(a[t].id===r){e.push(i);break}}return this.#n.locations=e,e}#r;get entrances(){let t=this.#n.entrances;if(typeof t<"u")return t;let e=[],n=this.#r,r=this.#t._nodesById;if(Array.isArray(n)){for(let t=0,i=n.length;t<i;++t){let i=r[n[t].id];null!=i&&e.push(i)}return this.#n.entrances=e,e}return[]}set entrances(t){this.#r=t}get rank(){let t=this.#n.rank;if(typeof t<"u")return t;let{rankings:e}=this.#t;if(!e||!e.polygons)return null;let n=e.polygons.find((t=>t.polygonId===this.id));return n?(this.#n.rank={score:n.score,node:n.entranceNodeId},{score:n.score,node:n.entranceNodeId}):(this.#n.rank=null,null)}static hydrate(t,e){return t.map((t=>new Ge(e,t)))}static async fetch(t){let e=t.options.things.polygons.slice();t.options.things.maps&&fe(e,"map"),t.options.things.nodes&&fe(e,"entrances");let n={fields:e,venue:t.options.venue};try{return(await ye(t.options,"polygon",n)).filter((t=>t.geometry.visible)).map((e=>new Ge(t,e)))}catch(t){return A.error("Fetch Polygons:",t),[]}}toJSON(){return this.#e}};function bn(t){return/^[\da-f]{24}$/i.test(t)}function kn(t,e=!1){let n="";if(null!=t){let r="?",i=e?Object.keys(t).filter((t=>!["slug","venue"].includes(t))):Object.keys(t);for(let e=0,a=i.length;e<a;++e){let a=i[e],s=t[a];null!=s&&(n+=`${r+encodeURIComponent(a)}=${encodeURIComponent(s)}`,r="&")}}return n}function Ti(t,e,n,r=!1){return r?`${t.supplementaryUrl}${e}?venue=${n.venue||n.slug}`:t.baseUrl?.includes("gateway")?`${t.baseUrl}${e}/${n.venue||n.slug}${kn(n,t.baseUrl?.includes("gateway"))}`:t.baseUrl+e+kn(n)}async function ye(t,e,n,r=!1){return xa(t,e,n,r,!0)}async function xa(t,e,n,r=!1,i=!1){let a=Ti(t,e,n,r),s=await Ta(t,a,r);if(!i&&Array.isArray(s)){if(1===s.length)return s[0];throw new Error("Invalid response object")}return s}async function Ta(t,e,n=!1){let r={language:t.language,clientId:t.clientId,clientSecret:t.clientSecret};n&&delete r.language,r.language&&(e+=`&lang=${encodeURIComponent(r.language)}`);let{headers:i}=t;i["Content-Type"]="text/json",t.authorization&&(i.Authorization=t.authorization),r.language&&(i["Accept-Language"]=r.language);let a={method:"GET",headers:i},s=await Rt()(e,a);if(!s.ok)throw new Error(`${s.status} ${s.statusText}`);return s.json()}function fe(t,e){t.indexOf(e)<0&&t.push(e)}function vn([t,e],[n,r]){let i=new S(t,e),a=new S(n,r);return i.distanceTo(a)}function Mn(t){if(t.scale||t.x_scale)return 1/(t.scale||t.x_scale);let e;try{let n=t.georeference[0],r=t.georeference[2],i=new S(n.target.x,n.target.y),a=new S(r.target.x,r.target.y),s=i.distanceTo(a),o=n.control.x-r.control.x,l=n.control.y-r.control.y;e=Math.sqrt(o*o+l*l)/s}catch(n){e=1,A.warn(n),A.warn(`Couldn't georeference ${t.name||t.shortName||t.id}. Probably not enough geocoordinates.`)}return e}function Lt(t){return t instanceof Ge?t.entrances.map((t=>t.id)):t instanceof Ce?t.nodes?.map((t=>t.id))||[]:[t.id]}async function wn(t){let e={},{maps:n,images:r,scenes:i,polygons:a}=t;if(null!=r)try{let t=Object.keys(r).map((t=>fetch(`data:image/png;base64,${r[t]}`).then((t=>t.blob())).then((n=>{e[t]=n})).catch((t=>{A.error(t)}))));await Promise.all(t)}catch(t){A.error(t)}return n.forEach((t=>{(t.scene?.polygons||i[t.id])&&(null!=i&&i[t.id]&&(t.scene||(t.scene={}),Object.defineProperty(t.scene,"polygons",{get:()=>i[t.id]})),null!=r&&(t.scene.images=t.scene.images.map((({filename:t})=>({filename:t,url:e[t]}))),t.scene.polygons.forEach((t=>{if(t?.image?.url&&t?.image?.url){let n=t.image.url.split("/"),r=e[n[n.length-1]];r&&(t.image.url=r)}}))))})),null!=r&&a.forEach((t=>{if(t?.image?.url){let n=t.image.url.split("/"),r=e[n[n.length-1]];r&&(t.image.url=r)}})),null!=t.images&&delete t.images,null!=t.scenes&&delete t.scenes,t}function Ia(t,e,n){let r;return function(){let i=this,a=arguments,s=function(){r=null,n||t.apply(i,a)},o=n&&!r;clearTimeout(r),r=setTimeout(s,e),o&&t.apply(i,a)}}var qe=class{#t;#e={};#n;name;externalId;parents;id;icon;constructor(t,e){this.id=e.id,this.#n=e,this.#t=t,Object.assign(this,e)}get locations(){let t=this.#e.locations;if(typeof t<"u")return t;let e=[],{locations:n}=this.#t,{id:r}=this;for(let t=0,i=n.length;t<i;++t){let i=n[t],a=i.categories;if(Array.isArray(a))for(let t=0,n=a.length;t<n;++t)if(a[t]?.id===r){e.push(i);break}}return this.#e.locations=e,e}static hydrate(t,e){return t.map((t=>new qe(e,t)))}static async fetch(t){let e={fields:t.options.things.categories,venue:t.options.venue};try{return(await ye(t.options,"category",e)).map((e=>new qe(t,e)))}catch(t){return A.error("Fetch Categories:",t),[]}}toJSON(){return this.#n}};w();var tt=class{#t;#e;#n={};id="";type="";name="";description;image;startDate;endDate;showDate;constructor(t,e){this.#e=e,this.#t=t,Object.assign(this,e)}location(){let t=this.#n.location;if(typeof t<"u")return t;let e,n=this.#t._locationsById,r=this.#e.location;if(null!=r){let t=n[r];null!=t&&(e=t)}return this.#n.location=e,e}static hydrate(t,e){return t.map((t=>new tt(e,t)))}static async fetch(t){let e=t.options.things.events.slice();t.options.things.locations&&fe(e,"location");let n={fields:e,venue:t.options.venue,activeAtOrAfter:Date.now()};try{return(await ye(t.options,"event",n)).map((e=>new tt(t,e)))}catch(t){return A.error("Fetch Events:",t),[]}}toJSON(){return this.#e}};w();var pt=class{#t;constructor(t){this.#t=t,Object.assign(this,t)}static hydrate(t){return t.map((t=>new pt(t)))}id="";name="";value="";static async fetch(t){let e={fields:t.options.things.locationStates.slice(),venue:t.options.venue};try{return(await ye(t.options,"location-state",e)).map((t=>new pt(t)))}catch(t){return A.error("Fetch Location States:",t),[]}}toJSON(){return this.#t}};w(),w();var vt=class{map;get x(){return this.#e("x")}get y(){return this.#e("y")}get lat(){return this.#t("lat")}get lon(){return this.#t("lon")}#t(t){if(this.#s&&this.#o)return"lat"===t?this.#s:this.#o;if(null!=this.#l&&null!=this.#u){let[e,n]=this.#a(this.#l,this.#u);return this.#s=e,this.#o=n,"lat"===t?this.#s:this.#o}throw Error("MappedinCoordinate is missing x and y")}#e(t){if(this.#l&&this.#u)return"x"===t?this.#l:this.#u;if(null!=this.#s&&null!=this.#o){let[e,n]=this.#i(this.#s,this.#o);return this.#l=e,this.#u=n,"x"===t?this.#l:this.#u}throw Error("MappedinCoordinate is missing lat and lon")}#n={};#r;#i(t,e){let n=this.map.georeference[0],r=new S(n.target.x,n.target.y),i=new S(t,e),a=r.distanceTo(i),s=(r.finalBearingTo(i)+360)%360*Math.PI/180||0,o=a*(1/this.map.scale),l=s+this.map.getNorth(),u=Math.sin(l)*o,h=Math.cos(l)*o;return[n.control.x+u,n.control.y-h]}#a(t,e){let n,r=this.map.georeference[0],i=new S(r.target.x,r.target.y),a=t-r.control.x,s=r.control.y-e,o=Math.atan2(a,s);n=0===a&&0===s?0:0===a?s:a/Math.sin(o);let l=o-this.map.getNorth(),u=n/this.map._scale,h=i.destinationPoint(u,180*l/Math.PI);return[h.lat,h.lon]}constructor(t){let{map:e,mappedin:n}=t;null!=t.lat&&null!=t.lon&&(this.#s=t.lat,this.#o=t.lon),null!=t.x&&null!=t.y&&(this.#l=t.x,this.#u=t.y),this.map=e,this.#r=n}#s;#o;#l;#u;absoluteDistanceTo(t){return vn([t.lat,t.lon],[this.lat,this.lon])}get nearestNode(){let t=this.#n.nearestNode;if(typeof t<"u")return t;let e=Pe.instances.get(this.#r).findNearestNodeOnMap(this.map.id,this);return this.#n.nearestNode=e,e}toJSON(){return{x:this.x,y:this.y,map:this.map,lat:this.lat,lon:this.lon}}},at=class{#t;#e={};#n;id="";group="";name="";shortName="";elevation=0;scale=0;layers;x_scale;perspectiveId;scene;width=0;height=0;georeference=[];constructor(t,e){this.#t=t,this.#n=e,Object.assign(this,e),this._scale=Mn(this),this.scale=this.x_scale||1/this._scale}_scale=0;get polygons(){return Pe.instances.get(this.#t)?.polygonsByMapId?.get(this.id)??[]}get locations(){return Pe.instances.get(this.#t)?.locationsByMapId?.get(this.id)??[]}get nodes(){return Pe.instances.get(this.#t)?.nodesByMapId?.get(this.id)??[]}get mapGroup(){let t=this.#e.mapGroup;if(typeof t<"u")return t;let e=this.group,n=e&&this.#t._mapGroupsById[e]||null;return this.#e.mapGroup=n,n}createCoordinateByXY(t,e){return new vt({x:t,y:e,map:this,mappedin:this.#t})}createCoordinate(t,e){return new vt({lat:t,lon:e,map:this,mappedin:this.#t})}getNorth(){let t;try{let e=this.georeference[0],n=this.georeference[2],r=new S(e.target.x,e.target.y),i=new S(n.target.x,n.target.y);t=-((r.finalBearingTo(i)+0)*Math.PI/180-Math.atan2(n.control.y-e.control.y,n.control.x-e.control.x)-Math.PI/2)}catch(e){t=0,A.warn(e),A.warn(`Couldn't georeference ${this.name||this.shortName||this.id}. Probably not enough geocoordinates.`)}return t}static hydrate(t,e){return t.map((t=>new at(e,t)))}static async fetch(t){let e=t.options.things.maps.slice();t.options.perspective&&fe(e,"perspectives"),t.options.things.mapGroups&&fe(e,"group"),fe(e,"elevation"),fe(e,"x_scale"),fe(e,"scale"),fe(e,"georeference");let n={fields:e,perspective:t.options.perspective,venue:t.options.venue};try{let i=await ye(t.options,"map",n),a=t=>{let e=r.layers.find((e=>e.id===t));e?e.visible=!0:r.layers.push({id:t,visible:!0})};for(let n=0,s=i.length;n<s;++n){var r=i[n];if(r){let t=r.perspective;null!=t&&(r.perspectiveId=t.id,e.indexOf("scene")>-1&&(r.scene=t.scene),t.layers?(r.layers.forEach((t=>{t.visible=!1})),t.layers.forEach(a)):r.layers.forEach((t=>{t.visible=!0}))),delete r.perspective}i[n]=new at(t,r)}return i}catch(t){return A.error("Fetch Maps:",t),[]}}toJSON(){return this.#n}};w();var nt=class{#t;#e;#n={};id="";name="";constructor(t,e){this.#e=e,this.#t=t,Object.assign(this,e)}get maps(){let t=this.#n.maps;if(typeof t<"u")return t;let e=[],{maps:n}=this.#t,{id:r}=this.#e;for(let t=0,i=n.length;t<i;++t){let i=n[t];i.group===r&&e.push(i)}return this.#n.maps=e,e}static hydrate(t,e){return t.map((t=>new nt(e,t)))}static async fetch(t){let e={fields:t.options.things.mapGroups.slice(),venue:t.options.venue};try{return(await ye(t.options,"map-group",e)).map((e=>new nt(t,e)))}catch(t){return A.error("Fetch Map Groups:",t),[]}}toJSON(){return this.#e}};w();var it=class extends $e{#t;#e;#n={};id="";x=0;y=0;operationHours;externalId;constructor(t,e){super(t),this.#t=t,this.#e=e;let n=Object.assign({},e);delete n.map,Object.assign(this,n)}get map(){let t=this.#n.map;if(typeof t<"u")return t;let e=this.#t.getCollectionItemById("maps",this.#e.map);return this.#n.map=e,e}get lat(){let t=this.#n.cachedLatLon;if(null!=t)return t.lat;let e=this.#t._mapsById?.[this.map.id];if(null==e)throw new Error("Map not found");return this.#n.cachedLatLon=e.createCoordinateByXY(this.x,this.y),this.#n.cachedLatLon.lat}get lon(){let t=this.#n.cachedLatLon;if(null!=t)return t.lon;let e=this.#t._mapsById?.[this.map.id];if(null==e)throw new Error("Map not found");return this.#n.cachedLatLon=e.createCoordinateByXY(this.x,this.y),this.#n.cachedLatLon.lon}#r;get paths(){let t=this.#n.paths;if(typeof t<"u")return t;let e=[],n=this.#t._nodesById,r=this.#r;if(Array.isArray(r))for(let t=0,i=r.length;t<i;++t){let i=n[r[t].node];null!=i&&e.push(i)}return this.#n.paths=e,e}set paths(t){this.#r=t}get locations(){let t=this.#n.locations;if(typeof t<"u")return t;let e=[],n=Pe.instances.get(this.#t)?.locationsByMapId?.get(this.map.id)??[],r=this.id;for(let t=0,i=n.length;t<i;++t){let i=n[t],a=i.nodes;if(Array.isArray(a))for(let t=0,n=a.length;t<n;++t)if(a[t].id===r){e.push(i);break}}return this.#n.locations=e,e}get polygon(){let t=this.#n.polygon;if(typeof t<"u")return t;let e,n=Pe.instances.get(this.#t)?.polygonsByMapId?.get(this.map.id)??[],r=this.id;for(let t=0,i=n.length;t<i;++t){let i=n[t];i.entrances.map((t=>t.id)).includes(r)&&(e=i)}return this.#n.polygon=e,e}static hydrate(t,e){return t.map((t=>new it(e,t)))}static async fetch(t){let e=t.options.things.nodes.slice();t.options.things.maps&&fe(e,"map"),["weight","multiplier","accessible"].forEach((function(t){fe(e,t)}));let n={fields:e,venue:t.options.venue};try{return(await ye(t.options,"node",n)).map((e=>new it(t,e)))}catch(t){return A.error("Fetch Nodes:",t),[]}}toJSON(){return this.#e}};w();var rt=class{#t;constructor(t){this.#t=t,Object.assign(this,t)}polygons=[];static hydrate(t){return new rt(t)}static async fetch(t){try{let e=await xa(t.options,"smart-labels/polygon-label-ranking",{venue:t.options.venue},!0);return new rt(e)}catch(t){return A.error("Fetch Rankings:",t),null}}toJSON(){return this.#t}};w();var ht=class{id="";#t;constructor(t){this.#t=t,Object.assign(this,t)}static hydrate(t){return t.map((t=>new ht(t)))}static async fetch(t){let e={fields:t.options.things.themes.slice(),venue:t.options.venue};try{return(await ye(t.options,"apollo-theme",e)).map((t=>new ht(t)))}catch(t){return A.error("Fetch Theme:",t),[]}}toJSON(){return this.#t}};w();var st=class{#t;#e;#n={};defaultMap="";address="";city="";countrycode="";externalId="";id="";latitude;logo;longitude;metadata;name="";operationHours;postal="";slug="";state="";telephone="";tzid="";tzidOverride="";utcOffset="";website="";constructor(t,e){this.#e=t,this.#t=e,Object.assign(this,e)}static hydrate(t,e){return new st(e,t)}static async fetch(t){let e={fields:t.options.things.venue,slug:t.options.venue,limit:1};try{let n=await ye(t.options,"venue",e);return new st(t,n[0])}catch(t){return A.error("Fetch Venue:",t),{}}}get isMultiBuilding(){if(null==this.#n.isMultiBuilding){let t=this.#e.maps,e=t.reduce(((t,e)=>t.add(e.elevation)),new Set),n=t.length!==e.size;this.#n.isMultiBuilding=n}return this.#n.isMultiBuilding}toJSON(){return this.#t}};w();var ot=class{id="";#t;name;type;weight;multiplier;constructor(t){this.#t=t,Object.assign(this,t)}static hydrate(t){return t.map((t=>new ot(t)))}static async fetch(t){let e=t.options.things.vortexes.slice();["name","type","accessible","weight","multiplier","nodes"].forEach((function(t){fe(e,t)}));let n={fields:e,venue:t.options.venue};try{return(await ye(t.options,"vortex",n)).map((t=>new ot(t)))}catch(t){return A.error("Fetch Vortexes:",t),[]}}toJSON(){return this.#t}};function Ii(t,e){let n=[];return t.features.forEach((t=>{let r=[];t.properties.spaces?.forEach((t=>{if("id"in t){let n;n=e.get(t.id),n&&r.push(...n)}else r?.push({id:t.node,level:""})}));let i=r.map((t=>({node:"n_"+t.id,map:t.level}))),a=t.properties.spaces?.filter((t=>"id"in t)),s=(t.properties.hours||[]).map((t=>({...t,"@type":"OpeningHoursSpecification",dayOfWeek:[t.dayOfWeek.replace("http://schema.org/","")]}))),o={...t.properties,polygons:a||[],nodes:i||[],description:t.properties.description||"",logo:t.properties.logo||{},picture:t.properties.picture||{},phone:t.properties.phone||{},social:t.properties.social||{},externalId:t.properties.externalId||"",states:t.properties.states||[],siblingGroups:t.properties.siblingGroups||[],operationHours:s};delete o.spaces,n.push(o)})),n}function Oi(t){let e=new Set;return t.features.forEach((t=>{t.properties.states?.forEach((t=>{e.add(t.type)}))})),Array.from(e).map((t=>({id:t,name:t,value:t})))}function zi(t){let e=[];return t.features.forEach((t=>{let n={...t.properties,icon:t.properties.picture};delete n.picture,e.push(n)})),e}function Ni(t){let e=1/0,n=1/0,r=-1/0,i=-1/0;return t.features.forEach((t=>{let a;a="MultiPolygon"===t.geometry.type?t.geometry.coordinates[0].flat():t.geometry.coordinates[0],a.forEach((t=>{e=Math.min(e,t[1]),r=Math.max(r,t[1]),n=Math.min(n,t[0]),i=Math.max(i,t[0])}))})),{id:t.features[0].properties.id,minLat:e,minLong:n,maxLat:r,maxLong:i}}function _i(t,e,n){let r=n.createGeoreferences(),i=[];return t.features.forEach((t=>{let a=new Set;e.forEach((t=>{t.layer&&a.add(t.layer)}));let s=[...a].map((t=>({id:t,visible:!0}))),o=1/n.mapScale,l={...t.properties,georeference:r,shortName:t.properties.abbreviation||"",scene:{polygons:e},scale:o,x_scale:o,group:t.properties.building,layers:s,width:n.widthInMapUnits,height:n.heightInMapUnits};i.push(l)})),i}w();var Oa=class{mapExtent;stretchRatio;midLat;midLong;mapUnitRatio=1e6;latDistance;longDistance;mapScale;widthInMapUnits;heightInMapUnits;constructor(t){this.mapExtent=t;let{minLat:e,minLong:n,maxLat:r,maxLong:i}=t,a=(e+r)/2,s=(n+i)/2,o=new S(a,i),l=new S(a,n),u=new S(e,s),h=new S(r,s);this.latDistance=u.distanceTo(h),this.longDistance=o.distanceTo(l);let c=this.latDistance/this.longDistance,d=(r-e)/(i-n);this.stretchRatio=c/d,this.midLat=a,this.midLong=s,this.widthInMapUnits=(i-n)*this.mapUnitRatio,this.heightInMapUnits=(r-e)*this.mapUnitRatio*this.stretchRatio,this.mapScale=this.widthInMapUnits/this.longDistance}convert(t){let e=t[1];return{x:(t[0]-this.midLong)*this.mapUnitRatio,y:(this.midLat-e)*this.mapUnitRatio*this.stretchRatio}}createGeoreferences(){let{minLat:t,minLong:e,maxLat:n,maxLong:r}=this.mapExtent;return[[t,e],[t,r],[n,r],[n,e]].map((t=>({target:{x:t[0],y:t[1]},control:this.convert([t[1],t[0]])})))}};function Ei(t,e){let n=[];return t.features.forEach((t=>{let r=e.convert(t.geometry.coordinates),i=(t.properties.neighbors||[]).map((e=>({node:e,map:t.properties.level}))),a=t.properties.level,s={...t.properties,x:r.x,y:r.y,paths:i,map:a,externalId:t.properties.externalId||""};n.push(s)})),n}var jn=(t,e,n,r,i)=>{let a=[];return t.features.forEach((t=>{if(!t.geometry.coordinates[0].forEach)return;let s=[];"entrances"in t.properties&&(s=t.properties.entrances.map((t=>({id:"n_"+t.id,node:"n_"+t.id,map:t.level}))));let o,l=n[t.properties.id],u=e.find((t=>t.id===l)),h=t.geometry.coordinates[0].map((t=>i.convert(t))),c=r.find((e=>e.polygonId===t.properties.id)),d=Math.max(i.widthInMapUnits,i.heightInMapUnits)/1e3;if(c){let t=i.convert([c.position[0],c.position[1]]),e=c.size.x,n=c.size.y,r=i.mapScale,a=n*r,s=e*r/d/c.viewBox.width,l=a/d/c.viewBox.height;o={url:u?.image,visible:!!u?.image,viewBox:c.viewBox,scale:{x:s,y:l},position:{x:t.x,y:t.y},rotation:c.rotation,useLocalScaling:!1,_isAbsolutelyPositioned:!0}}let p={...t.properties,entrances:s,map:t.properties.level,externalId:t.properties.externalId||"",geometry:{visible:!0,position:{x:0,y:0,z:(u?.altitude||0)*i.mapScale/d},scale:{x:1,y:1,z:(u?.height||1)*i.mapScale/d}},material:{color:u?.color||"#000000"},image:o,vertexes:h};a.push(p)})),a};function Ai(t,e,n,r,i,a){let s=jn(t,n,r,i,a),o=jn(e,n,r,i,a);return s.concat(o)}function Si(t){let e=new Map;return t.forEach((t=>{t.features.forEach((t=>{let{destinations:n}=t.properties;if(0===n.length)return;let r=n[0].split("-")[0],i=e.get(r),a=n.map((t=>t.split("-")[1])).map((t=>"n_"+t));if(i)i.nodes.push(...a);else{let{name:n,type:i,weight:s,multiplier:o,accessible:l}=t.properties,u={id:r,nodes:a,name:n,type:i,weight:s,multiplier:o,accessible:l};e.set(r,u)}}))})),Array.from(e.values())}function Fi(t){let e=[];return t.features.forEach((t=>{let n={...t.properties};e.push(n)})),e}function xn(t){let e=Array.from(t.connection.values()),n=Array.from(t.level.values()),r=t.building,i=t.category,a=t.style,s=t.location,o=t.imageInstance,l=t.polygonStyle,u={},h=[],c=new Map;n.forEach((e=>{let n=e.features[0].properties.id,r=Ni(e),i=new Oa(r);c.set(n,i);let s=t.obstruction.get(n),d=t.space.get(n),p=o.get(n),f=l.get(n);u[n]=Ai(d,s,a,f,p,i);let g=t.node.get(n);h.push(...Ei(g,i))}));let d=Object.values(u).flat(),p=Si(e),f=n.map((t=>{let e=t.features[0].properties.id,n=c.get(e);return _i(t,u[e],n)})).flat(),g=new Map;Array.from(t.space.values()).forEach((t=>{t.features.forEach((t=>{g.set(t.properties.id,t.properties.entrances)}))}));let y=Fi(r),m=Ii(s,g),v=zi(i),_=Oi(s),w=t.manifest.features[0].properties.name,M=t.manifest.features[0].geometry.coordinates[0],b=t.manifest.features[0].geometry.coordinates[1],x=t.imageBinaries;return{locations:m,categories:v,nodes:h,maps:f,polygons:d,vortexes:p,mapGroups:y,locationStates:_,themes:[],venue:{name:w,latitude:b,longitude:M},imageBinaries:x}}w(),w(),w(),w();var mt,Re,Be,za=[0,4,6,8,10],We=()=>{let t=new Array(16).fill(0),e=4294967296*Math.random();for(let n=0;n<t.length;n++)n>0&&!(3&n)&&(e=4294967296*Math.random()),t[n]=e>>>((3&n)<<3)&255;let n=t.map((t=>t.toString(16).padStart(2,"0")));return n[6]="4"+n[6][1],n[8]=["8","9","a","b"].includes(n[7][0])?n[7]:"a"+n[7][1],za.map(((t,e)=>n.slice(t,e===za.length-1?void 0:za[e+1]).join(""))).join("-")},Tn="mi-session-data",In="mi-local-data",Na=class{constructor(){ve(this,Re,void 0),ve(this,Be,void 0);try{let t=sessionStorage.getItem(Tn);ue(this,Re,t?JSON.parse(t):{id:We()})}catch{ue(this,Re,{id:We()})}try{let t=localStorage.getItem(In);ue(this,Be,t?JSON.parse(t):{deviceId:We()})}catch{ue(this,Be,{deviceId:We()})}C(this,Re).id||(C(this,Re).id=We()),C(this,Be).deviceId||(C(this,Be).deviceId=We())}static getInstance(){return C(this,mt)||ue(this,mt,new Na),C(this,mt)}static ___clearInstance(){ue(this,mt,void 0)}saveSessionData(t,e){C(this,Re)[t]=e;try{return sessionStorage.setItem(Tn,JSON.stringify(C(this,Re))),!0}catch{return!1}}loadSessionData(t){let e=C(this,Re)[t];if(null!=e)return e}saveLocalData(t,e){C(this,Be)[t]=e;try{return localStorage.setItem(In,JSON.stringify(C(this,Be))),!0}catch{return!1}}loadLocalData(t){let e=C(this,Be)[t];if(null!=e)return e}},Mt=Na;function On(t){return/^[\da-f]{24}$/i.test(t)}function zn(){return Mt.getInstance().loadLocalData("deviceId")}function Nn(){return Mt.getInstance().loadSessionData("id")}mt=new WeakMap,Re=new WeakMap,Be=new WeakMap,ve(Mt,mt,void 0);var Bt,wt,jt,Dt,xt,Tt,It,gt,Gt,Ot,zt,qt,Jn=Zt(Yn(),1),Ui=_?.env?.npm_package_version,Aa=["websdk","web","webv2"],Sa="websdk",Fa=class{constructor(t){ve(this,Bt,void 0),ve(this,wt,void 0),ve(this,jt,void 0),ve(this,Dt,void 0),ve(this,xt,void 0),ve(this,Tt,void 0),ve(this,It,void 0),ve(this,gt,void 0),ve(this,Gt,void 0),ve(this,Ot,void 0),ve(this,zt,void 0),ve(this,qt,void 0),ue(this,gt,t.clientId),ue(this,Gt,t.clientSecret),ue(this,Ot,t.accessToken),ue(this,It,t.noAuth||!1);let e="https://api-gateway.mappedin.com/track-analytics/a/";!C(this,It)&&C(this,gt)&&!On(C(this,gt))&&(e="https://web-proxy.mappedin.com/a/"),ue(this,jt,e),ue(this,jt,C(this,jt)+(t.venue+"/")),ue(this,wt,!1),ue(this,Bt,"boolean"==typeof t.testMode?t.testMode:"true"===t.testMode?.toLowerCase()),ue(this,Dt,Aa.find((e=>e===t.context))||Aa[0]),ue(this,xt,zn()),ue(this,Tt,Nn()),ue(this,zt,new Set),ue(this,qt,t.platformString||""),this.locationSelected=this.locationSelected.bind(this),this.categorySelected=this.categorySelected.bind(this),this.getDirections=this.getDirections.bind(this)}track(t,e){if(C(this,Bt))return;let n={...e,g:C(this,wt)},r=C(this,jt)+t+"?"+Jn.default.stringify(n),i={"mi-context":Sa||C(this,Dt),"mi-session":C(this,Tt),"mi-device":C(this,xt),"mappedin-sdk-version":Ui,"mappedin-platform-version":C(this,qt)};C(this,Ot)?i.Authorization=`Bearer ${C(this,Ot)}`:C(this,It)||(i.Authorization=`Basic ${btoa(`${C(this,gt)}:${C(this,Gt)}`)}`),Rt()(r,{method:"GET",mode:"cors",headers:i})}locationSelected(t){let e=t.id||t;this.track("select-location",{id:e})}categorySelected(t){let e=t.id||t;this.track("select-category",{id:e})}mapViewLoaded(t,e,n,r){this.track("load-mapview",{type:t,force:e,benchmark:n||-1,reason:r||"success"})}getDirections(t,e){let n={start:t.id,end:e.id,type:"location_to_location"};this.track("query-directions",n)}getSessionID(){return C(this,Tt)}getDeviceID(){return C(this,xt)}setGeolocationMode(t){ue(this,wt,t)}trackBlueDotEvent(t){t&&Object.values(Fa.BLUEDOT_EVENT).includes(t)&&!C(this,zt).has(t)?(this.track(t),C(this,zt).add(t)):A.warn(`Ignored unsupported blue dot event: "${t}".`)}trackSearch(t){null!=t&&this.track("query-search",t)}trackSearchSuggest(t){null!=t&&this.track("query-suggest",t)}static setContext(t){let e=Aa.find((e=>e===t));e&&(Sa=e)}static clearContext(){Sa=void 0}},ia=Fa;Bt=new WeakMap,wt=new WeakMap,jt=new WeakMap,Dt=new WeakMap,xt=new WeakMap,Tt=new WeakMap,It=new WeakMap,gt=new WeakMap,Gt=new WeakMap,Ot=new WeakMap,zt=new WeakMap,qt=new WeakMap,Ee(ia,"BLUEDOT_EVENT",{ATTEMPT_BLUEDOT:"attempt-bluedot",FOUND_POSITION:"found-position",FOUND_FLOOR:"found-floor"});var ra=ia,Xn={supplementaryUrl:"https://api-gateway.mappedin.com/analytics/",headers:{},accessToken:"",clientId:"",noAuth:!1,includeHidden:!0,clientSecret:"",apiGateway:"",authorization:"",perspective:"Website",language:"",things:{},venue:""},Nt={categories:qe,locations:Ce,vortexes:ot,maps:at,nodes:it,polygons:Ge,venue:st,events:tt,mapGroups:nt,themes:ht,locationStates:pt,rankings:rt},lt=class{perspective;things;options;#t;#e="";updatedAt;categories=[];locations=[];vortexes=[];maps=[];nodes=[];polygons=[];venue={};events=[];mapGroups=[];themes=[];locationStates=[];rankings;_categoriesById;_locationsById;_vortexesById;_mapsById;_nodesById;_polygonsById;_eventsById;_mapGroupsById;_locationStatesById;_locationRankingsById;_rankingsById;_categoriesByExternalId;_locationsByExternalId;_vortexesByExternalId;_mapsByExternalId;_nodesByExternalId;_polygonsByExternalId;_eventsByExternalId;_mapGroupsByExternalId;_locationStatesByExternalId;_locationRankingsByExternalId;_rankingsByExternalId;generateGetters(t){try{for(let e=0,n=t.length;e<n;++e){let n=t[e];Array.isArray(this[n])&&(Object.defineProperty(this,`_${n}ByExternalId`,{get(){let t=this.#t[n];if(null!=t)return t;let e={};return this[n].forEach((t=>e[t.externalId]=t)),this.#t[n]=e,e}}),Object.defineProperty(this,`_${n}ById`,{get(){let t=this.#t[n];if(null!=t)return t;let e={};return this[n].forEach((t=>e[t.id]=t)),this.#t[n]=e,e}}))}return this}catch(t){throw new Error("Unable to generate getters, "+t)}}getCollectionItemById(t,e){let n=`_${t}ByExternalId`,r=this[`_${t}ById`];return null!=r&&null!=r[e]||(r=this[n],null!=r&&null!=r[e])?r[e]:null}async hydrateFromMVF(t){let e=xn(t);return this.hydrate(e)}async hydrate(t,e){let n;if("string"==typeof t)try{this.#e=t,n=JSON.parse(t)}catch(t){return void A.error("Unable to parse JSON",t)}else n=t,this.#e=JSON.stringify(n);let r=Object.keys(n);for(let t=0,e=r.length;t<e;++t){let e=r[t],i=n[e];null!=Nt[e]&&"function"==typeof Nt[e].hydrate&&(this[e]=Nt[e].hydrate(i,this))}e&&await wn(n);let{images:i,scenes:a,imageBinaries:s}=n;this.images=i,this.scenes=a,this.imageBinaries=s,this.generateGetters(r),this.initNavigator()}images;imageBinaries;scenes;async fetch(){"vortexes"in this.options.things||(this.options.things.vortexes=["name","type","accessible","weight","multiplier","nodes"]),"locationStates"in this.options.things||(this.options.things.locationStates=["name","id","value"]),bn(this.options.clientId)||this.options.things.rankings&&delete this.options.things.rankings;let{things:t}=this.options,e=[],n=Object.keys(t);for(let t=0,r=n.length;t<r;++t){let r=n[t];Nt[r]&&e.push(Nt[r].fetch(this).then((t=>(this[r]=t,Promise.resolve()))))}return this.generateGetters(n),Promise.all(e).then((()=>{this.initNavigator()}))}constructor(t){this.options=t,this.#t=Pe.create(this);let e=new ra({...t,testMode:!t?.emitAnalyticsEvents});this.analytics={locationSelected:e.locationSelected,categorySelected:e.categorySelected,getDirections:e.getDirections},globalThis.MappedinDebug||(globalThis.MappedinDebug={enable(){globalThis.sessionStorage.setItem(fa,"true")}})}analytics;navigator;initNavigator(){this.navigator=new Ma({locations:this.locations.map((t=>t.toJSON())),nodes:this.nodes.map((t=>t.toJSON())),vortexes:this.vortexes.map((t=>t.toJSON())),maps:this.maps.map((t=>t.toJSON()))})}toJSON(){let t={};for(let e in Nt)Array.isArray(this[e])&&(t[e]=this[e].map((t=>t.toJSON())));let e={...t,venue:this.venue.toJSON()};return null!=this.rankings&&(e.rankings=this.rankings?.toJSON()),delete e.locationRankings,e}toString(){return this.#e||JSON.stringify(this.toJSON())}};w();var Kn={venue:["slug","name","defaultMap","metadata","countrycode","tzid","logo","externalId"],nodes:["externalId","x","y","paths","accessible","operationHours"],vortexes:["externalId","nodes","types","accessible"],polygons:["vertexes","geometry","canvasBounds","layer","externalId","entrances"],locations:["externalId","name","type","picture","description","icon","logo","sortOrder","phone","operationHours","social","color","toMap","tags","shortName","detailsUrl","locationState","metadata","siblingGroups","gallery"],categories:["name","color","sortOrder","parents"],maps:["name","elevation","height","width","layers","shortName","scene","group","x_scale"],mapGroups:["name"],themes:["name","themeData"],rankings:["polygons"]};w();var ft=Zt(Zn(),1);w();var $i=["0","1","2","3","4","5","6","7","8","9"],Wi=["۱","۲","۳","۴","۵","۶","۷","۸","۹","۰"],Hi=["0","1","2","3","4","5","6","7","8","9"],Yi=["၀","၁","၂","၃","၄","၅","၆","၇","၈","၉"],wu=[...$i,...Wi,...Hi,...Yi],Qn=["about","after","all","also","am","an","and","another","any","are","as","at","be","because","been","before","being","between","both","but","by","came","can","come","could","did","do","each","for","from","get","got","has","had","he","have","her","here","him","himself","his","how","if","in","into","is","it","like","make","many","me","might","more","most","much","must","my","never","now","of","on","only","or","other","our","out","over","said","same","should","since","some","still","such","take","than","that","the","their","them","then","there","these","they","this","those","through","to","too","under","up","very","was","way","we","well","were","what","where","which","while","who","with","would","you","your","a","i"];w();var Ji=32,Se=!1,Xi=120,La=0,sa=class{constructor(t){this._callback=t.callback,this._frameCount=null!=t.frameCount?t.frameCount:1,this._ordering=null!=t.ordering?t.ordering:0,this._supersededBy=null!=t.supersededBy?new Set(t.supersededBy):new Set,this.name=t.name,this.userdata=t.userdata,this._remainingFrameCount=this._frameCount,this._lastFrameTime=0,Se&&A.log("update instantiated",this.name)}_callback;_frameCount;_ordering;_supersededBy;name;_remainingFrameCount;_lastFrameTime;userdata;getLastFrameTime(){return this._lastFrameTime}},Ye=class{constructor(t){if(null!=t.group&&null!=t.priority)throw new Error("cannot specify task priority individually within group");if(null!=t.group&&null!=t.postponeOnAdd)throw new Error("cannot specify task postpone individually within group");this._callback=t.callback,this._group=null!=t.group?t.group:null,this._priority=null!=t.priority?t.priority:0,this._postponed=null!=t.postponeOnAdd&&t.postponeOnAdd,this.name=t.name,this.userdata=t.userdata,this._complete=!1,this._scheduled=!1,this._cancelled=!1,this._lastFrameTime=0,Se&&A.log("task instantiated",this.name)}_postponed;userdata;_priority;_group;name;_lastFrameTime;_callback;_complete;_scheduled;_cancelled;isComplete(){return this._complete}getLastFrameTime(){return this._lastFrameTime}},oa=class{constructor(t){this._onComplete=null!=t.onComplete?t.onComplete:()=>{},this._priority=null!=t.priority?t.priority:0,this._postponed=null!=t.postponeOnAdd&&t.postponeOnAdd,this.name=t.name,this.userdata=t.userdata,this._tasks=new Set,this._scheduledTasks=new Set,this._scheduled=!1,this._cancelled=!1,Se&&A.log("task group instantiated",this.name)}_postponed;_onComplete;_priority;userdata;name;_tasks;_scheduledTasks;_scheduled;_cancelled;isComplete(){return 0===this._scheduledTasks.size}getTasks(){return Array.from(this._tasks.values())}clear(){this._tasks.clear(),this._scheduledTasks.clear()}_popTask(){for(let t of this._scheduledTasks)return this._scheduledTasks.delete(t),t}},Ra=class{_maxMillisecondsPerFrame;_time;constructor(t){this._maxMillisecondsPerFrame=null!=t?.maxMillisecondsPerFrame?t.maxMillisecondsPerFrame:Ji,this._time=0}beginFrame(){this._time=performance.now()+this._maxMillisecondsPerFrame}hasTimeRemaining(){return performance.now()<=this._time}},la=class{constructor(t){this._timer=null!=t?.timer?t.timer:new Ra,this._performance=null!=t?.performance&&t.performance,this._scheduledUpdatesByOrdering=new _t,this._scheduledTasksByPriority=new _t,this._postponedTasks=new Set,this._requestAnimationFrameHandle=null,this._updatesToRunThisFrame=[],this._lastFrameTime=0,this._updatesRunLastFrame=new Set,this.update=this.update.bind(this),Se&&A.log("task scheduler instantiated"),globalThis.MappedinDebug?.TEST_IOS&&(this._raf=t=>setTimeout(t,16))}_raf;_timer;_performance;_scheduledUpdatesByOrdering;_scheduledTasksByPriority;_postponedTasks;_requestAnimationFrameHandle;_updatesToRunThisFrame;_lastFrameTime=0;_updatesRunLastFrame;clear(){for(let t of this._scheduledTasksByPriority.values())t._cancelled=!0;for(let t of this._postponedTasks.values())t._cancelled=!0;this._scheduledUpdatesByOrdering=new _t,this._scheduledTasksByPriority=new _t,this._postponedTasks=new Set,this._lastFrameTime=0,this._updatesRunLastFrame.clear(),Se&&A.log("task scheduler cleared")}destroy(){this.clear()}requestAnimationFrame(){null==this._requestAnimationFrameHandle&&(this._requestAnimationFrameHandle="function"==typeof this._raf?this._raf(this.update):requestAnimationFrame(this.update))}update(t){let e;this._timer.beginFrame(),this._performance&&(e=performance.now());let n=!1;Se&&(0===La&&(n=!0),++La,La%=Xi);let r=this._scheduledUpdatesByOrdering.keys();for(let t=r.length-1;t>=0;--t){let e=r[t];for(let t of this._scheduledUpdatesByOrdering.get(e).values())this._updatesToRunThisFrame.push(t),n&&A.log("update scheduled to run this frame",t.name)}for(let t of this._updatesToRunThisFrame){--t._remainingFrameCount,t._remainingFrameCount<=0&&this._scheduledUpdatesByOrdering.delete(t._ordering,t),t._superseded=!1;for(let e of this._updatesToRunThisFrame)t._supersededBy.has(e)&&(t._superseded=!0,n&&A.log("update superseded",t.name,e.name))}for(let t=0;t<this._updatesToRunThisFrame.length;++t)this._updatesToRunThisFrame[t]._superseded&&(this._updatesToRunThisFrame.splice(t,1),--t);for(let e of this._updatesToRunThisFrame){let r;this._performance&&(r=performance.now()),e._callback(t),this._performance&&(e._lastFrameTime=performance.now()-r),n&&A.log("update completed",e.name)}this._updatesRunLastFrame.clear();for(let t of this._updatesToRunThisFrame)this._updatesRunLastFrame.add(t);if(this._updatesToRunThisFrame.splice(0,this._updatesToRunThisFrame.length),this._scheduledTasksByPriority.size>0)do{this._executeOneTask(t)}while(this._timer.hasTimeRemaining()&&this._scheduledTasksByPriority.size>0);this._performance&&(this._lastFrameTime=performance.now()-e),this._requestAnimationFrameHandle=null,(this._scheduledUpdatesByOrdering.size>0||this._scheduledTasksByPriority.size>0)&&this.requestAnimationFrame()}flushTasks(){for(;this._scheduledTasksByPriority.size>0;)this._executeOneTask(performance.now())}getLastFrameTime(){return this._lastFrameTime}getUpdatesRunLastFrame(){return this._updatesRunLastFrame}_executeOneTask(t){let e,n=this._scheduledTasksByPriority.popFromMaxKey(),r=null;A.assert(void 0!==n),Object.getPrototypeOf(n)===oa.prototype&&(r=n,n=r._popTask()),A.assert(void 0!==n),A.assert(Object.getPrototypeOf(n)===Ye.prototype),this._performance&&(e=performance.now()),n._callback(t),n._complete=!0,this._performance&&(n._lastFrameTime=performance.now()-e),Se&&A.log("task completed",n.name),null!=r&&(r.isComplete()?(r.clear(),r._onComplete(),Se&&A.log("group completed",r.name)):this._scheduledTasksByPriority.insert(r._priority,r))}scheduleUpdate(t){t._remainingFrameCount=t._frameCount,this._scheduledUpdatesByOrdering.insert(t._ordering,t),this.requestAnimationFrame()}scheduleTask(t){if(Object.getPrototypeOf(t)===oa)throw new Error("frame task groups are automatically scheduled when a task is added to them and cannot be manually scheduled: "+t.name);if(t._scheduled)throw new Error("cannot schedule already scheduled task: "+t.name);if(t._cancelled)throw new Error("cannot schedule cancelled task: "+t.name);let e=t;"_group"in t&&null!=t._group&&(t._group._tasks.add(t),t._group._scheduledTasks.add(t),e=t._group),e._postponed?this._postponedTasks.add(e):this._scheduledTasksByPriority.insert(e._priority,e),t._scheduled=!0,e._scheduled=!0,Se&&A.log("task scheduled",t.name),this.requestAnimationFrame()}cancelUpdate(t){this._scheduledUpdatesByOrdering.delete(t._ordering,t),Se&&A.log("update cancelled",t.name)}cancelTask(t){if(!t._scheduled)throw new Error("cannot cancel task that has not been scheduled: "+t.name);if(t._cancelled)throw new Error("cannot cancel task that has already been cancelled: "+t.name);if("_group"in t&&null!=t._group){let e=t._group.isComplete();t._group._tasks.delete(t),t._group._scheduledTasks.delete(t),t._group.isComplete()&&(this._scheduledTasksByPriority.delete(t._group._priority,t._group),e||t._group._onComplete())}else this._scheduledTasksByPriority.delete(t._priority,t),this._postponedTasks.delete(t);Object.getPrototypeOf(t)===Ye.prototype?t._cancelled=!0:"clear"in t&&t.clear(),Se&&A.log("task cancelled",t.name)}postponeTask(t){if("_group"in t&&null!=t._group)throw new Error("cannot postpone individual tasks in group: "+t.name);if(t._cancelled)throw new Error("cannot postpone cancelled task: "+t.name);if(!t._postponed){if(Object.getPrototypeOf(t)===Ye.prototype){if("_complete"in t)return;if(!t._scheduled)throw new Error("cannot postpone task that has not been scheduled: "+t.name)}this._scheduledTasksByPriority.delete(t._priority,t),(Object.getPrototypeOf(t)===Ye.prototype||!t.isComplete())&&this._postponedTasks.add(t),t._postponed=!0,Se&&A.log("task postponed",t.name)}}resumeTask(t){if("_group"in t&&null!=t._group)throw new Error("cannot resume individual tasks in groups");if(t._cancelled)throw new Error("cannot resume cancelled task");if(t._postponed){if(Object.getPrototypeOf(t)===Ye.prototype){if("_complete"in t&&t._complete)return;if(!t._scheduled)throw new Error("cannot resume unscheduled task")}this._postponedTasks.delete(t),(Object.getPrototypeOf(t)===Ye.prototype||!t.isComplete())&&this._scheduledTasksByPriority.insert(t._priority,t),t._postponed=!1,this.requestAnimationFrame(),Se&&A.log("task resumed",t.name)}}setTaskPriority(t,e){if(Object.getPrototypeOf(t)===Ye.prototype&&!t._scheduled)throw new Error("task must be scheduled to be reprioritized");this._scheduledTasksByPriority.has(t._priority,t)&&(this._scheduledTasksByPriority.delete(t._priority,t),this._scheduledTasksByPriority.insert(e,t)),t._priority=e,Se&&A.log("task priority changed",t.name,e)}},_t=class{constructor(){this._map=new Map,this._size=0,this._sortedKeys=[]}_map;_size;_sortedKeys;has(t,e){return null!=this._map.get(t)&&this._map.get(t).has(e)}get(t){return this._map.get(t)}insert(t,e){if(A.assert("number"==typeof t&&Number.isFinite(t)),null==this._map.get(t)){this._map.set(t,new Set);for(let e=0;e<=this._sortedKeys.length;++e)if(e===this._sortedKeys.length||t<this._sortedKeys[e]){this._sortedKeys.splice(e,0,t);break}}this._map.get(t).has(e)||(this._map.get(t).add(e),++this._size)}delete(t,e){null!=this._map.get(t)&&this._map.get(t).has(e)&&(this._map.get(t).delete(e),--this._size,0===this._map.get(t).size&&(this._map.delete(t),this._sortedKeys.splice(this._sortedKeys.indexOf(t),1)))}pop(t){if(null!=this._map.get(t)){let e;for(e of this._map.get(t).values()){this._map.get(t).delete(e),--this._size;break}return 0===this._map.get(t).size&&(this._map.delete(t),this._sortedKeys.splice(this._sortedKeys.indexOf(t),1)),e}}popFromMaxKey(){if(this._sortedKeys.length>0)return this.pop(this._sortedKeys[this._sortedKeys.length-1])}values(){let t=this._map.keys(),e=null,n={[Symbol.iterator]:()=>n,next:()=>{if(null==e){let n=t.next();if(n.done)return n;e=this._map.get(n.value).values()}let n=e.next();for(;n.done;){let r=t.next();if(r.done)return r;e=this._map.get(r.value).values(),n=e.next()}return n}};return n}keys(){return this._sortedKeys}get size(){let t=0;for(let e of this._map.values())t+=e.size;return A.assert(t===this._size),t}},Je=t=>t.normalize("NFD").replace(/[\u0300-\u036f|\u2019|\u0027|\']/g,"").toLowerCase(),Et="",Ki=.09,Zi=1,Qi=.025,er=.5,tr=5e-4,ar=5e-4,nr=.01,ir=.05,ei=1,rr=.01,sr=.2,or={MappedinCategory:"categories",MappedinLocation:"locations"},lr={searchDescriptions:!0,searchTags:!0,searchTagsInCategories:!1,searchDescriptionsInCategories:!1,stopWords:Qn,jsonIndex:void 0,useLocationRank:!0,emitAnalyticsEvents:"production"===_.env.NODE_ENV,constants:{PRIMARY_INDEX_FUZZYNESS:Ki,PRIMARY_INDEX_WEIGHT:Zi,SECONDARY_INDEX_WEIGHT:Qi,CATEGORY_NAME_WEIGHT:er,LOCATION_NAME_WEIGHT:ei,CATEGORY_LOCATION_DESCRIPTION_WEIGHT:tr,CATEGORY_LOCATION_TAGS_WEIGHT:ar,CATEGORY_LOCATION_NAME_WEIGHT:nr,PRIMARY_INDEX_TAGS_NAME_WEIGHT:ir,LOCATION_DEFAULT_RANK:ei,RATIO_OF_FUZZY_TO_EXACT:rr,RATIO_OF_PREFIX_TO_EXACT:sr}},Vt=class{#t;#e;#n;#r;#i;#a=new la({performance:!0});#s;#o;#l=new Map;constructor(t,e){this.#o=new ra({...t.options,testMode:!1===e?.emitAnalyticsEvents}),this.#i={...lr,...e},this.#t=t,this.#s=new Set(this.#i?.stopWords);let{PRIMARY_INDEX_FUZZYNESS:n,PRIMARY_INDEX_WEIGHT:r,CATEGORY_NAME_WEIGHT:i,RATIO_OF_FUZZY_TO_EXACT:a,RATIO_OF_PREFIX_TO_EXACT:s,PRIMARY_INDEX_TAGS_NAME_WEIGHT:o}=this.#i.constants,l=["object","query","weight","tag","rank"],u={fields:["query","name","tag"],storeFields:l,searchOptions:{combineWith:"OR",prefix:!0,fuzzy:n},boost:{name:r,query:r,tag:o},weights:{fuzzy:a,prefix:s},boostDocument:t=>t.includes("MappedinLocation")?r:t.includes("MappedinCategory")?i:r},h={fields:["description"],storeFields:l,searchOptions:{combineWith:"AND",prefix:!0,fuzzy:.1},processTerm:(t,e)=>this.#s?.has(t.toLowerCase())?null:t.toLowerCase()},c={fields:["category.locations.description","category.locations.tags","category.locations.name"],storeFields:[...l,"ref","category.locations.tags","category.locations.name","category.locations.description"],searchOptions:{combineWith:"AND",prefix:!0,fuzzy:!1}};if(this.#h=new Promise((t=>{this.#c=t})),this.#i?.jsonIndex){let{primary:t,secondary:e,extra:n}=JSON.parse(this.#i?.jsonIndex);this.#e=ft.default.loadJS(t,u),this.#n=ft.default.loadJS(e,h),this.#r=ft.default.loadJS(n,c)}else this.#e=new ft.default(u),this.#n=new ft.default(h),this.#r=new ft.default(c),this.#t.locations.forEach(this.#d),this.#t.categories.forEach(this.#p);this.#a.update(performance.now()),this.#f=Ia(((t,e)=>{this.#o.trackSearchSuggest({query:t,hits:e})}),300),this.#g=Ia(((t,e)=>{this.#o.trackSearch({query:t,hits:e})}),300)}#u=0;#y=t=>{this.#u++,this.#a.scheduleUpdate(new sa({name:"updateIndex",ordering:0,frameCount:1,callback:()=>{t(),this.#u--,0===this.#u&&this.#c()}}))};#d=t=>{let{SECONDARY_INDEX_WEIGHT:e,LOCATION_DEFAULT_RANK:n,PRIMARY_INDEX_TAGS_NAME_WEIGHT:r}=this.#i.constants,i=n;this.#i?.useLocationRank&&(i=Array.isArray(t.polygons)?Math.max(...t.polygons.map((t=>t.rank?.score?t.rank?.score:n)),n):n),this.#y((()=>{this.#e.add({name:Je(t.name),tags:"",id:"MappedinLocation_"+t.id,weight:n,rank:i})})),this.#i?.searchTags&&Array.isArray(t.tags)&&t.tags.forEach((e=>{this.#e.add({name:"",tag:Je(e),id:"MappedinLocation_"+t.id,weight:r,rank:i})})),this.#i?.searchDescriptions&&this.#y((()=>this.#n.add({description:Je(t.description||""),id:"MappedinLocation_"+t.id,weight:e,rank:i})))};#p=t=>{let{CATEGORY_LOCATION_DESCRIPTION_WEIGHT:e,CATEGORY_LOCATION_TAGS_WEIGHT:n,CATEGORY_LOCATION_NAME_WEIGHT:r,CATEGORY_NAME_WEIGHT:i}=this.#i.constants;this.#y((()=>this.#e.add({name:Je(t.name||""),description:"",id:"MappedinCategory_"+t.id,weight:i})));let a=t.locations.reduce(((t,e)=>t+` ${Et} `+e.name),"")+` ${Et}`;if(this.#i?.searchDescriptionsInCategories&&t.locations.forEach((n=>{null!=n.description&&this.#y((()=>this.#r.add({id:"MappedinCategory_"+t.id,"category.locations.description":Je(n.description),ref:n.name,weight:e})))})),this.#i?.searchTagsInCategories){let e=t.locations.reduce(((t,e)=>t+e.tags?.reduce(((t,e)=>t+` ${Et} `+e),"")+` ${Et}`),"");this.#y((()=>this.#r.add({"category.locations.tags":Je(e),id:"MappedinCategory_"+t.id,weight:n})))}this.#y((()=>this.#r.add({"category.locations.name":Je(a),id:"MappedinCategory_"+t.id,weight:r})))};#h;#c;#m=t=>{let e=t.score,{object:n,id:r,weight:i,rank:a}=t,[s,o]=r.split("_"),l=n||this.#t.getCollectionItemById(or[s],o);return a&&this.#i?.useLocationRank&&(e+=a),i&&(e*=i),{score:e,type:s,object:l}};#v=(t,e)=>{for(let n in t.match)t.match[n].forEach((r=>{let i=t.ref||t[r]||e.object[r];if("category.locations.tags"===r||"category.locations.name"===r){let e=new RegExp(`[^${Et}]* `+n+` [^${Et}]*`,"ig").exec(t[r]);null!=e&&(i=e[0].slice(1,-1))}e.matches.push({term:n,weight:t.weight,matchesOn:r,value:i})}))};#_(t){let e=[],n=Je(t);e=[...this.#e.search(n),...this.#n.search(n),...this.#r.search(n)].sort(((t,e)=>e.score-t.score));let r={};for(let t of e){let e=this.#m(t);r[t.id]?r[t.id].score+=e.score:r[t.id]={...e,matches:[]},this.#v(t,r[t.id])}return Object.keys(r).map((t=>({...r[t],matches:r[t].matches.sort(((t,e)=>e.weight-t.weight))}))).sort(((t,e)=>e.score-t.score))}async suggest(t){await this.#h;let{PRIMARY_INDEX_FUZZYNESS:e,PRIMARY_INDEX_WEIGHT:n,PRIMARY_INDEX_TAGS_NAME_WEIGHT:r,RATIO_OF_FUZZY_TO_EXACT:i,RATIO_OF_PREFIX_TO_EXACT:a}=this.#i.constants,s=this.#e.autoSuggest(t,{fields:["name","tag","query"],combineWith:"AND",prefix:!0,fuzzy:e,boost:{name:n,query:n,tag:r},weights:{fuzzy:i,prefix:a}});return this.#f(t,s.length),{total:s.length,hits:s.map((t=>({text:t.suggestion})))}}async search(t){await this.#h;let e=this.#_(t);return this.#g(t,e.length),e}async toJSON(){return await this.#h,JSON.stringify({primary:this.#e,secondary:this.#n,extra:this.#r})}#f;#g;async addQuery(t){let e,n,{query:r,object:i,weight:a=1}=t;await this.#h,e=i instanceof Ce?"MappedinLocation":i instanceof qe?"MappedinCategory":"Custom","MappedinLocation"===e||"MappedinCategory"===e?n=e+"_"+i.id:"string"==typeof i.id?n="Custom_"+i.id:(n=this.#l.get(i),n||(n="Custom_"+We(),this.#l.set(i,n))),this.#e.add({id:n,weight:a,object:i,query:Je(r)})}};w();var ti=globalThis.fetch;function Rt(){if(null==ti)throw new Error("fetch is not available in your environment. Pass your own function into `setFetch` (node-fetch, etc)");return ti}var ur=_?.env?.npm_package_version;globalThis.btoa||(globalThis.btoa=ai.encode);var cr=["ar"];function Ba(t){let e={...Xn,things:Kn,...t};return e.headers={...e.headers,"mappedin-sdk-version":ur},t.platformString&&(e.headers={...e.headers,"mappedin-platform-version":t.platformString}),e.noAuth||(e.accessToken?e.authorization=`Bearer ${e.accessToken}`:e.clientId&&e.clientSecret&&(e.authorization=`Basic ${globalThis.btoa(`${e.clientId}:${e.clientSecret}`)}`)),e}async function Da(t){let e=Ba({baseUrl:"https://api-gateway.mappedin.com/",...{emitAnalyticsEvents:!0,...t}}),n="public/1/"+(e.useDraftData?"draft/":""),r=new lt({...e,baseUrl:e.baseUrl+n});return await r.fetch(),r}var ni={shouldPopulateBundledImagesAsBlobs:!(typeof globalThis.navigator<"u"&&"ReactNative"==globalThis.navigator.product)};async function Ga(t){let e=Ba({baseUrl:"https://api-gateway.mappedin.com/",...ni,...t}),{url:n,updated_at:r}=await dr(t),i=await Rt()(n,{mode:"cors"}),{data:a,format:s="jsonstring"}=await i.json();if("jsonstring"!==s)throw new Error(`Unrecognized format ${s}`);let o=new lt(e);return await o.hydrate(a,e.shouldPopulateBundledImagesAsBlobs),o.updatedAt=r,o}async function dr(t){let e=Ba({baseUrl:"https://api-gateway.mappedin.com/",...ni,...t}),{version:n,venue:r}=t,i=`${t.bundleBaseUri||e.baseUrl+`exports/legacy${null!=e.language&&cr.includes(e.language)?"-"+e.language:""}/1/bundle`}?venue=${r}&version=1.0.0`;return e.language=void 0,await Ta(e,i)}var pr=!1;function hr(t){t.things=t.things||{},t.things.venue=t.things.venue||[],t.things.venue.push("slug","defaultMap"),t.things.nodes=t.things.nodes||[],t.things.nodes.push("x","y","paths","map"),t.things.polygons=t.things.polygons||[],t.things.locations=t.things.locations||[],t.things.locations.push("sortOrder","parent","showLabelWhenImagePresent","hidden"),t.things.maps=t.things.maps||[],t.things.maps.push("height","width","georeference"),t.perspective=t.perspective3D||t.perspective||void 0,t.things.maps.push("scene","layers"),t.things.polygons.push("canvasBounds","map","image","perspectives","material","holes","label","geometry"),pr&&t.things.polygons.push("layer","geometry","vertexes")}var mr=function(t){return null==t.mapView&&(t.mapView={}),new Promise((function(e,n){function r(r,i){if(r)n(r);else{let r={};try{t.firstMapSelector&&(t.mapView=t.mapView||{},t.mapView.firstMap=t.firstMapSelector(i))}catch(t){A.error("Failure in firstMapSelector! Loading default map instead."),A.error(t),n(t)}r.venue=i,e(r)}}hr(t.venue),t.venue.useVenueBundle?Ga(t.venue).then((t=>r(null,t))).catch((t=>r(t,null))):Da(t.venue).then((t=>r(null,t))).catch((t=>r(t,null)))}))};
|
|
1
|
+
"use strict";var _,oi=Object.create,St=Object.defineProperty,li=Object.getOwnPropertyDescriptor,ui=Object.getOwnPropertyNames,ci=Object.getPrototypeOf,di=Object.prototype.hasOwnProperty,pi=(t,e,n)=>e in t?St(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,hi=(t,e)=>()=>(t&&(e=t(t=0)),e),Qe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),mi=(t,e)=>{for(var n in e)St(t,n,{get:e[n],enumerable:!0})},Wa=(t,e,n,r)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let i of ui(e))!di.call(t,i)&&i!==n&&St(t,i,{get:()=>e[i],enumerable:!(r=li(e,i))||r.enumerable});return t},Zt=(t,e,n)=>(n=null!=t?oi(ci(t)):{},Wa(!e&&t&&t.__esModule?n:St(n,"default",{value:t,enumerable:!0}),t)),gi=t=>Wa(St({},"__esModule",{value:!0}),t),Ee=(t,e,n)=>(pi(t,"symbol"!=typeof e?e+"":e,n),n),Ha=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},C=(t,e,n)=>(Ha(t,e,"read from private field"),n?n.call(t):e.get(t)),ve=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},ue=(t,e,n,r)=>(Ha(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),w=hi((()=>{_={env:{NODE_ENV:"production",npm_package_version:"6.0.0-alpha.6"}}})),Ya=Qe(((t,e)=>{w(),function(n){var r="object"==typeof t&&t,i="object"==typeof e&&e&&e.exports==r&&e,a="object"==typeof global&&global;(a.global===a||a.window===a)&&(n=a);var s=function(t){this.message=t};(s.prototype=new Error).name="InvalidCharacterError";var o=function(t){throw new s(t)},l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=/[\t\n\f\r ]/g,h={encode:function(t){t=String(t),/[^\0-\xFF]/.test(t)&&o("The string to be encoded contains characters outside of the Latin1 range.");for(var e,n,r,i,a=t.length%3,s="",u=-1,h=t.length-a;++u<h;)e=t.charCodeAt(u)<<16,n=t.charCodeAt(++u)<<8,r=t.charCodeAt(++u),s+=l.charAt((i=e+n+r)>>18&63)+l.charAt(i>>12&63)+l.charAt(i>>6&63)+l.charAt(63&i);return 2==a?(e=t.charCodeAt(u)<<8,n=t.charCodeAt(++u),s+=l.charAt((i=e+n)>>10)+l.charAt(i>>4&63)+l.charAt(i<<2&63)+"="):1==a&&(i=t.charCodeAt(u),s+=l.charAt(i>>2)+l.charAt(i<<4&63)+"=="),s},decode:function(t){var e=(t=String(t).replace(u,"")).length;e%4==0&&(e=(t=t.replace(/==?$/,"")).length),(e%4==1||/[^+a-zA-Z0-9/]/.test(t))&&o("Invalid character: the string to be decoded is not correctly encoded.");for(var n,r,i=0,a="",s=-1;++s<e;)r=l.indexOf(t.charAt(s)),n=i%4?64*n+r:r,i++%4&&(a+=String.fromCharCode(255&n>>(-2*i&6)));return a},version:"1.0.0"};if("function"==typeof define&&"object"==typeof define.amd&&define.amd)define((function(){return h}));else if(r&&!r.nodeType)if(i)i.exports=h;else for(var c in h)h.hasOwnProperty(c)&&(r[c]=h[c]);else n.base64=h}(t)})),Ja=Qe(((t,e)=>{var n,r;w(),n=typeof self<"u"?self:t,r=function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e||4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){n.r(e),n.d(e,"computeDestinationPoint",(function(){return B})),n.d(e,"convertArea",(function(){return D})),n.d(e,"convertDistance",(function(){return j})),n.d(e,"convertSpeed",(function(){return R})),n.d(e,"decimalToSexagesimal",(function(){return z})),n.d(e,"findNearest",(function(){return U})),n.d(e,"getAreaOfPolygon",(function(){return q})),n.d(e,"getBounds",(function(){return K})),n.d(e,"getBoundsOfDistance",(function(){return J})),n.d(e,"getCenter",(function(){return Y})),n.d(e,"getCenterOfBounds",(function(){return H})),n.d(e,"getCompassDirection",(function(){return X})),n.d(e,"getCoordinateKey",(function(){return g})),n.d(e,"getCoordinateKeys",(function(){return b})),n.d(e,"getDistance",(function(){return $})),n.d(e,"getDistanceFromLine",(function(){return Z})),n.d(e,"getGreatCircleBearing",(function(){return Q})),n.d(e,"getLatitude",(function(){return F})),n.d(e,"getLongitude",(function(){return T})),n.d(e,"getPathLength",(function(){return et})),n.d(e,"getPreciseDistance",(function(){return nt})),n.d(e,"getRhumbLineBearing",(function(){return V})),n.d(e,"getRoughCompassDirection",(function(){return rt})),n.d(e,"getSpeed",(function(){return it})),n.d(e,"isDecimal",(function(){return y})),n.d(e,"isPointInLine",(function(){return at})),n.d(e,"isPointInPolygon",(function(){return st})),n.d(e,"isPointNearLine",(function(){return ot})),n.d(e,"isPointWithinRadius",(function(){return lt})),n.d(e,"isSexagesimal",(function(){return m})),n.d(e,"isValidCoordinate",(function(){return E})),n.d(e,"isValidLatitude",(function(){return x})),n.d(e,"isValidLongitude",(function(){return I})),n.d(e,"orderByDistance",(function(){return G})),n.d(e,"sexagesimalToDecimal",(function(){return v})),n.d(e,"toDecimal",(function(){return O})),n.d(e,"toRad",(function(){return k})),n.d(e,"toDeg",(function(){return C})),n.d(e,"wktToPolygon",(function(){return ht})),n.d(e,"sexagesimalPattern",(function(){return r})),n.d(e,"earthRadius",(function(){return i})),n.d(e,"MINLAT",(function(){return a})),n.d(e,"MAXLAT",(function(){return s})),n.d(e,"MINLON",(function(){return o})),n.d(e,"MAXLON",(function(){return l})),n.d(e,"longitudeKeys",(function(){return u})),n.d(e,"latitudeKeys",(function(){return h})),n.d(e,"altitudeKeys",(function(){return c})),n.d(e,"distanceConversion",(function(){return d})),n.d(e,"timeConversion",(function(){return p})),n.d(e,"areaConversion",(function(){return f}));var r=/^([0-9]{1,3})°\s*([0-9]{1,3}(?:\.(?:[0-9]{1,}))?)['′]\s*(([0-9]{1,3}(\.([0-9]{1,}))?)["″]\s*)?([NEOSW]?)$/,i=6378137,a=-90,s=90,o=-180,l=180,u=["lng","lon","longitude",0],h=["lat","latitude",1],c=["alt","altitude","elevation","elev",2],d={m:1,km:.001,cm:100,mm:1e3,mi:1/1609.344,sm:1/1852.216,ft:100/30.48,in:100/2.54,yd:1/.9144},p={m:60,h:3600,d:86400},f={m2:1,km2:1e-6,ha:1e-4,a:.01,ft2:10.763911,yd2:1.19599,in2:1550.0031};f.sqm=f.m2,f.sqkm=f.km2,f.sqft=f.ft2,f.sqyd=f.yd2,f.sqin=f.in2;var g=function(t,e){return e.reduce((function(e,n){if(null==t)throw new Error("'".concat(t,"' is no valid coordinate."));return Object.prototype.hasOwnProperty.call(t,n)&&void 0!==n&&void 0===e?(e=n,n):e}),void 0)},y=function(t){var e=t.toString().trim();return!isNaN(parseFloat(e))&&parseFloat(e)===Number(e)},m=function(t){return r.test(t.toString().trim())},v=function(t){var e=new RegExp(r).exec(t);if(null==e)throw new Error("Given value is not in sexagesimal format");var n=Number(e[2])/60||0,i=Number(e[4])/3600||0,a=parseFloat(e[1])+n+i;return["S","W"].includes(e[7])?-a:a};function _(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function w(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?_(Object(n),!0).forEach((function(e){M(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function M(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var b=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{longitude:u,latitude:h,altitude:c},n=g(t,e.longitude),r=g(t,e.latitude),i=g(t,e.altitude);return w({latitude:r,longitude:n},i?{altitude:i}:{})},x=function t(e){return y(e)?!(parseFloat(e)>s||e<a):!!m(e)&&t(v(e))},I=function t(e){return y(e)?!(parseFloat(e)>l||e<o):!!m(e)&&t(v(e))},E=function(t){var e=b(t),n=e.latitude,r=e.longitude;if(Array.isArray(t)&&t.length>=2)return I(t[0])&&x(t[1]);if(void 0===n||void 0===r)return!1;var i=t[r],a=t[n];return void 0!==a&&void 0!==i&&!1!==x(a)&&!1!==I(i)};function S(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function N(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?S(Object(n),!0).forEach((function(e){A(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):S(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function A(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var O=function t(e){if(y(e))return Number(e);if(m(e))return v(e);if(E(e)){var n=b(e);return Array.isArray(e)?e.map((function(e,n){return[0,1].includes(n)?t(e):e})):N(N(N({},e),n.latitude&&A({},n.latitude,t(e[n.latitude]))),n.longitude&&A({},n.longitude,t(e[n.longitude])))}return Array.isArray(e)?e.map((function(e){return E(e)?t(e):e})):e},F=function(t,e){var n=g(t,h);if(null!=n){var r=t[n];return!0===e?r:O(r)}},T=function(t,e){var n=g(t,u);if(null!=n){var r=t[n];return!0===e?r:O(r)}},k=function(t){return t*Math.PI/180},C=function(t){return 180*t/Math.PI},B=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:6371e3,i=F(t),a=T(t),s=e/r,u=k(n),h=k(i),c=k(a),d=Math.asin(Math.sin(h)*Math.cos(s)+Math.cos(h)*Math.sin(s)*Math.cos(u)),p=c+Math.atan2(Math.sin(u)*Math.sin(s)*Math.cos(h),Math.cos(s)-Math.sin(h)*Math.sin(d)),f=C(p);return(f<o||f>l)&&(p=(p+3*Math.PI)%(2*Math.PI)-Math.PI,f=C(p)),{latitude:C(d),longitude:f}},D=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"m",n=f[e];if(n)return t*n;throw new Error("Invalid unit used for area conversion.")},j=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"m",n=d[e];if(n)return t*n;throw new Error("Invalid unit used for distance conversion.")},R=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"kmh";switch(e){case"kmh":return t*p.h*d.km;case"mph":return t*p.h*d.mi;default:return t}};function L(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var P=function(t){var e=Math.pow(10,12);return Math.round(t*e)/e},z=function(t){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(typeof Symbol>"u")&&Symbol.iterator in Object(t)){var n=[],r=!0,i=!1,a=void 0;try{for(var s,o=t[Symbol.iterator]();!(r=(s=o.next()).done)&&(n.push(s.value),!e||n.length!==e);r=!0);}catch(t){i=!0,a=t}finally{try{r||null==o.return||o.return()}finally{if(i)throw a}}return n}}(t,e)||function(t,e){if(t){if("string"==typeof t)return L(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return L(t,e)}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t.toString().split("."),2),n=e[0],r=e[1],i=Math.abs(Number(n)),a=P(60*Number("0."+(r||0))),s=Math.floor(a),o=P(60*(a%s||0));return i+"° "+Number(s.toFixed(6)).toString().split(".").map((function(t,e){return 0===e?t.padStart(2,"0"):t})).join(".")+"' "+Number(o.toFixed(4)).toString().split(".").map((function(t,e){return 0===e?t.padStart(2,"0"):t})).join(".")+'"'},W=function(t){return t>1?1:t<-1?-1:t},$=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;n=void 0===n||isNaN(n)?1:n;var r=F(t),a=T(t),s=F(e),o=T(e),l=Math.acos(W(Math.sin(k(s))*Math.sin(k(r))+Math.cos(k(s))*Math.cos(k(r))*Math.cos(k(a)-k(o))))*i;return Math.round(l/n)*n},G=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$;return n="function"==typeof n?n:$,e.slice().sort((function(e,r){return n(t,e)-n(t,r)}))},U=function(t,e){return G(t,e)[0]},q=function(t){var e=0;if(t.length>2){for(var n,r,a,s=0;s<t.length;s++){s===t.length-2?(n=t.length-2,r=t.length-1,a=0):s===t.length-1?(n=t.length-1,r=0,a=1):(n=s,r=s+1,a=s+2);var o=T(t[n]),l=F(t[r]),u=T(t[a]);e+=(k(u)-k(o))*Math.sin(k(l))}e=e*i*i/2}return Math.abs(e)},K=function(t){if(!1===Array.isArray(t)||0===t.length)throw new Error("No points were given.");return t.reduce((function(t,e){var n=F(e),r=T(e);return{maxLat:Math.max(n,t.maxLat),minLat:Math.min(n,t.minLat),maxLng:Math.max(r,t.maxLng),minLng:Math.min(r,t.minLng)}}),{maxLat:-1/0,minLat:1/0,maxLng:-1/0,minLng:1/0})},J=function(t,e){var n,r,u=F(t),h=T(t),c=k(u),d=k(h),p=e/i,f=c-p,g=c+p,y=k(s),m=k(a),v=k(l),_=k(o);if(f>m&&g<y){var w=Math.asin(Math.sin(p)/Math.cos(c));(n=d-w)<_&&(n+=2*Math.PI),(r=d+w)>v&&(r-=2*Math.PI)}else f=Math.max(f,m),g=Math.min(g,y),n=_,r=v;return[{latitude:C(f),longitude:C(n)},{latitude:C(g),longitude:C(r)}]},Y=function(t){if(!1===Array.isArray(t)||0===t.length)return!1;var e=t.length,n=t.reduce((function(t,e){var n=k(F(e)),r=k(T(e));return{X:t.X+Math.cos(n)*Math.cos(r),Y:t.Y+Math.cos(n)*Math.sin(r),Z:t.Z+Math.sin(n)}}),{X:0,Y:0,Z:0}),r=n.X/e,i=n.Y/e,a=n.Z/e;return{longitude:C(Math.atan2(i,r)),latitude:C(Math.atan2(a,Math.sqrt(r*r+i*i)))}},H=function(t){var e=K(t),n=e.minLat+(e.maxLat-e.minLat)/2,r=e.minLng+(e.maxLng-e.minLng)/2;return{latitude:parseFloat(n.toFixed(6)),longitude:parseFloat(r.toFixed(6))}},V=function(t,e){var n=k(T(e))-k(T(t)),r=Math.log(Math.tan(k(F(e))/2+Math.PI/4)/Math.tan(k(F(t))/2+Math.PI/4));return Math.abs(n)>Math.PI&&(n=n>0?-1*(2*Math.PI-n):2*Math.PI+n),(C(Math.atan2(n,r))+360)%360},X=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:V,r="function"==typeof n?n(t,e):V(t,e);if(isNaN(r))throw new Error("Could not calculate bearing for given points. Check your bearing function");switch(Math.round(r/22.5)){case 1:return"NNE";case 2:return"NE";case 3:return"ENE";case 4:return"E";case 5:return"ESE";case 6:return"SE";case 7:return"SSE";case 8:return"S";case 9:return"SSW";case 10:return"SW";case 11:return"WSW";case 12:return"W";case 13:return"WNW";case 14:return"NW";case 15:return"NNW";default:return"N"}},Z=function(t,e,n){var r=$(e,t),i=$(t,n),a=$(e,n),s=Math.acos(W((r*r+a*a-i*i)/(2*r*a))),o=Math.acos(W((i*i+a*a-r*r)/(2*i*a)));return s>Math.PI/2?r:o>Math.PI/2?i:Math.sin(s)*r},Q=function(t,e){var n=F(e),r=T(e),i=F(t),a=T(t);return(C(Math.atan2(Math.sin(k(r)-k(a))*Math.cos(k(n)),Math.cos(k(i))*Math.sin(k(n))-Math.sin(k(i))*Math.cos(k(n))*Math.cos(k(r)-k(a))))+360)%360};function tt(t){return(tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var et=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$;return t.reduce((function(t,n){return"object"===tt(t)&&null!==t.last&&(t.distance+=e(n,t.last)),t.last=n,t}),{last:null,distance:0}).distance},nt=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;n=void 0===n||isNaN(n)?1:n;var r,a,s,o,l,u,h,c=F(t),d=T(t),p=F(e),f=T(e),g=6356752.314245,y=1/298.257223563,m=k(f-d),v=Math.atan((1-y)*Math.tan(k(parseFloat(c)))),_=Math.atan((1-y)*Math.tan(k(parseFloat(p)))),w=Math.sin(v),M=Math.cos(v),b=Math.sin(_),x=Math.cos(_),I=m,E=100;do{var S=Math.sin(I),N=Math.cos(I);if(0===(u=Math.sqrt(x*S*(x*S)+(M*b-w*x*N)*(M*b-w*x*N))))return 0;r=w*b+M*x*N,a=Math.atan2(u,r),l=r-2*w*b/(o=1-(s=M*x*S/u)*s),isNaN(l)&&(l=0);var A=y/16*o*(4+y*(4-3*o));h=I,I=m+(1-A)*y*s*(a+A*u*(l+A*r*(2*l*l-1)))}while(Math.abs(I-h)>1e-12&&--E>0);if(0===E)return NaN;var O=o*(i*i-g*g)/(g*g),C=1+O/16384*(4096+O*(O*(320-175*O)-768)),B=O/1024*(256+O*(O*(74-47*O)-128)),D=B*u*(l+B/4*(r*(2*l*l-1)-B/6*l*(4*u*u-3)*(4*l*l-3))),j=g*C*(a-D);return Math.round(j/n)*n},rt=function(t){return/^NNE|NE|NNW|N$/.test(t)?"N":/^ENE|E|ESE|SE$/.test(t)?"E":/^SSE|S|SSW|SW$/.test(t)?"S":/^WSW|W|WNW|NW$/.test(t)?"W":void 0},it=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$,r=n(t,e),i=Number(e.time)-Number(t.time),a=r/i*1e3;return a},at=function(t,e,n){return $(e,t)+$(t,n)===$(e,n)},st=function(t,e){for(var n=!1,r=e.length,i=-1,a=r-1;++i<r;a=i)(T(e[i])<=T(t)&&T(t)<T(e[a])||T(e[a])<=T(t)&&T(t)<T(e[i]))&&F(t)<(F(e[a])-F(e[i]))*(T(t)-T(e[i]))/(T(e[a])-T(e[i]))+F(e[i])&&(n=!n);return n},ot=function(t,e,n,r){return Z(t,e,n)<r},lt=function(t,e,n){return $(t,e)<n};function ut(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var ht=function(t){if(!t.startsWith("POLYGON"))throw new Error("Invalid wkt.");return t.slice(t.indexOf("(")+2,t.indexOf(")")).split(", ").map((function(t){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(typeof Symbol>"u")&&Symbol.iterator in Object(t)){var n=[],r=!0,i=!1,a=void 0;try{for(var s,o=t[Symbol.iterator]();!(r=(s=o.next()).done)&&(n.push(s.value),!e||n.length!==e);r=!0);}catch(t){i=!0,a=t}finally{try{r||null==o.return||o.return()}finally{if(i)throw a}}return n}}(t,e)||function(t,e){if(t){if("string"==typeof t)return ut(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ut(t,e)}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t.split(" "),2),n=e[0],r=e[1];return{longitude:parseFloat(n),latitude:parseFloat(r)}}))}}])},"object"==typeof t&&"object"==typeof e?e.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof t?t.geolib=r():n.geolib=r()})),En=Qe(((t,e)=>{w(),e.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,(t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`))})),Cn=Qe(((t,e)=>{w();var n="%[a-f0-9]{2}",r=new RegExp("("+n+")|([^%]+?)","gi"),i=new RegExp("("+n+")+","gi");function a(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(1===t.length)return t;e=e||1;var n=t.slice(0,e),r=t.slice(e);return Array.prototype.concat.call([],a(n),a(r))}function s(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(r)||[],n=1;n<e.length;n++)e=(t=a(e,n).join("")).match(r)||[];return t}}e.exports=function(t){if("string"!=typeof t)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return function(t){for(var e={"%FE%FF":"��","%FF%FE":"��"},n=i.exec(t);n;){try{e[n[0]]=decodeURIComponent(n[0])}catch{var r=s(n[0]);r!==n[0]&&(e[n[0]]=r)}n=i.exec(t)}e["%C2"]="�";for(var a=Object.keys(e),o=0;o<a.length;o++){var l=a[o];t=t.replace(new RegExp(l,"g"),e[l])}return t}(t)}}})),Rn=Qe(((t,e)=>{w(),e.exports=(t,e)=>{if("string"!=typeof t||"string"!=typeof e)throw new TypeError("Expected the arguments to be of type `string`");if(""===e)return[t];let n=t.indexOf(e);return-1===n?[t]:[t.slice(0,n),t.slice(n+e.length)]}})),Dn=Qe(((t,e)=>{w(),e.exports=function(t,e){for(var n={},r=Object.keys(t),i=Array.isArray(e),a=0;a<r.length;a++){var s=r[a],o=t[s];(i?-1!==e.indexOf(s):e(s,o,t))&&(n[s]=o)}return n}})),Yn=Qe((t=>{w();var e=En(),n=Cn(),r=Rn(),i=Dn(),a=Symbol("encodeFragmentIdentifier");function s(t){if("string"!=typeof t||1!==t.length)throw new TypeError("arrayFormatSeparator must be single character string")}function o(t,n){return n.encode?n.strict?e(t):encodeURIComponent(t):t}function l(t,e){return e.decode?n(t):t}function u(t){return Array.isArray(t)?t.sort():"object"==typeof t?u(Object.keys(t)).sort(((t,e)=>Number(t)-Number(e))).map((e=>t[e])):t}function h(t){let e=t.indexOf("#");return-1!==e&&(t=t.slice(0,e)),t}function c(t){let e=(t=h(t)).indexOf("?");return-1===e?"":t.slice(e+1)}function d(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&"string"==typeof t&&""!==t.trim()?t=Number(t):e.parseBooleans&&null!==t&&("true"===t.toLowerCase()||"false"===t.toLowerCase())&&(t="true"===t.toLowerCase()),t}function p(t,e){s((e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e)).arrayFormatSeparator);let n=function(t){let e;switch(t.arrayFormat){case"index":return(t,n,r)=>{e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),e?(void 0===r[t]&&(r[t]={}),r[t][e[1]]=n):r[t]=n};case"bracket":return(t,n,r)=>{e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),e?void 0!==r[t]?r[t]=[].concat(r[t],n):r[t]=[n]:r[t]=n};case"comma":case"separator":return(e,n,r)=>{let i="string"==typeof n&&n.includes(t.arrayFormatSeparator),a="string"==typeof n&&!i&&l(n,t).includes(t.arrayFormatSeparator);n=a?l(n,t):n;let s=i||a?n.split(t.arrayFormatSeparator).map((e=>l(e,t))):null===n?n:l(n,t);r[e]=s};case"bracket-separator":return(e,n,r)=>{let i=/(\[\])$/.test(e);if(e=e.replace(/\[\]$/,""),!i)return void(r[e]=n&&l(n,t));let a=null===n?[]:n.split(t.arrayFormatSeparator).map((e=>l(e,t)));void 0!==r[e]?r[e]=[].concat(r[e],a):r[e]=a};default:return(t,e,n)=>{void 0!==n[t]?n[t]=[].concat(n[t],e):n[t]=e}}}(e),i=Object.create(null);if("string"!=typeof t||!(t=t.trim().replace(/^[?#&]/,"")))return i;for(let a of t.split("&")){if(""===a)continue;let[t,s]=r(e.decode?a.replace(/\+/g," "):a,"=");s=void 0===s?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?s:l(s,e),n(l(t,e),s,i)}for(let t of Object.keys(i)){let n=i[t];if("object"==typeof n&&null!==n)for(let t of Object.keys(n))n[t]=d(n[t],e);else i[t]=d(n,e)}return!1===e.sort?i:(!0===e.sort?Object.keys(i).sort():Object.keys(i).sort(e.sort)).reduce(((t,e)=>{let n=i[e];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?t[e]=u(n):t[e]=n,t}),Object.create(null))}t.extract=c,t.parse=p,t.stringify=(t,e)=>{if(!t)return"";s((e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e)).arrayFormatSeparator);let n=n=>e.skipNull&&(t=>null==t)(t[n])||e.skipEmptyString&&""===t[n],r=function(t){switch(t.arrayFormat){case"index":return e=>(n,r)=>{let i=n.length;return void 0===r||t.skipNull&&null===r||t.skipEmptyString&&""===r?n:null===r?[...n,[o(e,t),"[",i,"]"].join("")]:[...n,[o(e,t),"[",o(i,t),"]=",o(r,t)].join("")]};case"bracket":return e=>(n,r)=>void 0===r||t.skipNull&&null===r||t.skipEmptyString&&""===r?n:null===r?[...n,[o(e,t),"[]"].join("")]:[...n,[o(e,t),"[]=",o(r,t)].join("")];case"comma":case"separator":case"bracket-separator":{let e="bracket-separator"===t.arrayFormat?"[]=":"=";return n=>(r,i)=>void 0===i||t.skipNull&&null===i||t.skipEmptyString&&""===i?r:(i=null===i?"":i,0===r.length?[[o(n,t),e,o(i,t)].join("")]:[[r,o(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(n,r)=>void 0===r||t.skipNull&&null===r||t.skipEmptyString&&""===r?n:null===r?[...n,o(e,t)]:[...n,[o(e,t),"=",o(r,t)].join("")]}}(e),i={};for(let e of Object.keys(t))n(e)||(i[e]=t[e]);let a=Object.keys(i);return!1!==e.sort&&a.sort(e.sort),a.map((n=>{let i=t[n];return void 0===i?"":null===i?o(n,e):Array.isArray(i)?0===i.length&&"bracket-separator"===e.arrayFormat?o(n,e)+"[]":i.reduce(r(n),[]).join("&"):o(n,e)+"="+o(i,e)})).filter((t=>t.length>0)).join("&")},t.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[n,i]=r(t,"#");return Object.assign({url:n.split("?")[0]||"",query:p(c(t),e)},e&&e.parseFragmentIdentifier&&i?{fragmentIdentifier:l(i,e)}:{})},t.stringifyUrl=(e,n)=>{n=Object.assign({encode:!0,strict:!0,[a]:!0},n);let r=h(e.url).split("?")[0]||"",i=t.extract(e.url),s=t.parse(i,{sort:!1}),l=Object.assign(s,e.query),u=t.stringify(l,n);u&&(u=`?${u}`);let c=function(t){let e="",n=t.indexOf("#");return-1!==n&&(e=t.slice(n)),e}(e.url);return e.fragmentIdentifier&&(c=`#${n[a]?o(e.fragmentIdentifier,n):e.fragmentIdentifier}`),`${r}${u}${c}`},t.pick=(e,n,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[a]:!1},r);let{url:s,query:o,fragmentIdentifier:l}=t.parseUrl(e,r);return t.stringifyUrl({url:s,query:i(o,n),fragmentIdentifier:l},r)},t.exclude=(e,n,r)=>{let i=Array.isArray(n)?t=>!n.includes(t):(t,e)=>!n(t,e);return t.pick(e,i,r)}})),Zn=Qe(((t,e)=>{var n,r;w(),n=t,r=function(){var t=function(){return t=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},t.apply(this,arguments)};function e(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function n(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,a=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=a.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return s}var r,i="KEYS",a="VALUES",s="",o=function(){function t(t,e){var n=t._tree,r=Array.from(n.keys());this.set=t,this._type=e,this._path=r.length>0?[{node:n,keys:r}]:[]}return t.prototype.next=function(){var t=this.dive();return this.backtrack(),t},t.prototype.dive=function(){if(0===this._path.length)return{done:!0,value:void 0};var t=l(this._path),e=t.node,n=t.keys;if(l(n)===s)return{done:!1,value:this.result()};var r=e.get(l(n));return this._path.push({node:r,keys:Array.from(r.keys())}),this.dive()},t.prototype.backtrack=function(){if(0!==this._path.length){var t=l(this._path).keys;t.pop(),!(t.length>0)&&(this._path.pop(),this.backtrack())}},t.prototype.key=function(){return this.set._prefix+this._path.map((function(t){var e=t.keys;return l(e)})).filter((function(t){return t!==s})).join("")},t.prototype.value=function(){return l(this._path).node.get(s)},t.prototype.result=function(){switch(this._type){case a:return this.value();case i:return this.key();default:return[this.key(),this.value()]}},t.prototype[Symbol.iterator]=function(){return this},t}(),l=function(t){return t[t.length-1]},u=function(t,n,r,i,a,o,l,h){var c,d,p=o*l;try{t:for(var f=e(t.keys()),g=f.next();!g.done;g=f.next()){var y=g.value;if(y===s){var m=a[p-1];m<=r&&i.set(h,[t.get(y),m])}else{for(var v=o,_=0;_<y.length;++_,++v){for(var w=y[_],M=l*v,b=M-l,x=a[M],I=Math.max(0,v-r-1),E=Math.min(l-1,v+r),S=I;S<E;++S){var N=w!==n[S],A=a[b+S]+ +N,O=a[b+S+1]+1,F=a[M+S]+1,T=a[M+S+1]=Math.min(A,O,F);T<x&&(x=T)}if(x>r)continue t}u(t.get(y),n,r,i,a,v,l,h+y)}}}catch(t){c={error:t}}finally{try{g&&!g.done&&(d=f.return)&&d.call(f)}finally{if(c)throw c.error}}},h=function(){function t(t,e){void 0===t&&(t=new Map),void 0===e&&(e=""),this._size=void 0,this._tree=t,this._prefix=e}return t.prototype.atPrefix=function(r){var i,a;if(!r.startsWith(this._prefix))throw new Error("Mismatched prefix");var o=n(c(this._tree,r.slice(this._prefix.length)),2),l=o[0],u=o[1];if(void 0===l){var h=n(m(u),2),d=h[0],p=h[1];try{for(var f=e(d.keys()),g=f.next();!g.done;g=f.next()){var y=g.value;if(y!==s&&y.startsWith(p)){var v=new Map;return v.set(y.slice(p.length),d.get(y)),new t(v,r)}}}catch(t){i={error:t}}finally{try{g&&!g.done&&(a=f.return)&&a.call(f)}finally{if(i)throw i.error}}}return new t(l,r)},t.prototype.clear=function(){this._size=void 0,this._tree.clear()},t.prototype.delete=function(t){return this._size=void 0,f(this._tree,t)},t.prototype.entries=function(){return new o(this,"ENTRIES")},t.prototype.forEach=function(t){var r,i;try{for(var a=e(this),s=a.next();!s.done;s=a.next()){var o=n(s.value,2);t(o[0],o[1],this)}}catch(t){r={error:t}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}},t.prototype.fuzzyGet=function(t,e){return function(t,e,n){var r=new Map;if(void 0===e)return r;for(var i=e.length+1,a=i+n,s=new Uint8Array(a*i).fill(n+1),o=0;o<i;++o)s[o]=o;for(var l=1;l<a;++l)s[l*i]=l;return u(t,e,n,r,s,1,i,""),r}(this._tree,t,e)},t.prototype.get=function(t){var e=d(this._tree,t);return void 0!==e?e.get(s):void 0},t.prototype.has=function(t){var e=d(this._tree,t);return void 0!==e&&e.has(s)},t.prototype.keys=function(){return new o(this,i)},t.prototype.set=function(t,e){if("string"!=typeof t)throw new Error("key must be a string");return this._size=void 0,p(this._tree,t).set(s,e),this},Object.defineProperty(t.prototype,"size",{get:function(){if(this._size)return this._size;this._size=0;for(var t=this.entries();!t.next().done;)this._size+=1;return this._size},enumerable:!1,configurable:!0}),t.prototype.update=function(t,e){if("string"!=typeof t)throw new Error("key must be a string");this._size=void 0;var n=p(this._tree,t);return n.set(s,e(n.get(s))),this},t.prototype.fetch=function(t,e){if("string"!=typeof t)throw new Error("key must be a string");this._size=void 0;var n=p(this._tree,t),r=n.get(s);return void 0===r&&n.set(s,r=e()),r},t.prototype.values=function(){return new o(this,a)},t.prototype[Symbol.iterator]=function(){return this.entries()},t.from=function(r){var i,a,s=new t;try{for(var o=e(r),l=o.next();!l.done;l=o.next()){var u=n(l.value,2),h=u[0],c=u[1];s.set(h,c)}}catch(t){i={error:t}}finally{try{l&&!l.done&&(a=o.return)&&a.call(o)}finally{if(i)throw i.error}}return s},t.fromObject=function(e){return t.from(Object.entries(e))},t}(),c=function(t,n,r){var i,a;if(void 0===r&&(r=[]),0===n.length||null==t)return[t,r];try{for(var o=e(t.keys()),l=o.next();!l.done;l=o.next()){var u=l.value;if(u!==s&&n.startsWith(u))return r.push([t,u]),c(t.get(u),n.slice(u.length),r)}}catch(t){i={error:t}}finally{try{l&&!l.done&&(a=o.return)&&a.call(o)}finally{if(i)throw i.error}}return r.push([t,n]),c(void 0,"",r)},d=function(t,n){var r,i;if(0===n.length||null==t)return t;try{for(var a=e(t.keys()),o=a.next();!o.done;o=a.next()){var l=o.value;if(l!==s&&n.startsWith(l))return d(t.get(l),n.slice(l.length))}}catch(t){r={error:t}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}},p=function(t,n){var r,i,a=n.length;t:for(var o=0;t&&o<a;){try{for(var l=(r=void 0,e(t.keys())),u=l.next();!u.done;u=l.next()){var h=u.value;if(h!==s&&n[o]===h[0]){for(var c=Math.min(a-o,h.length),d=1;d<c&&n[o+d]===h[d];)++d;var p=t.get(h);if(d===h.length)t=p;else{var f=new Map;f.set(h.slice(d),p),t.set(n.slice(o,o+d),f),t.delete(h),t=f}o+=d;continue t}}}catch(t){r={error:t}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}var g=new Map;return t.set(n.slice(o),g),g}return t},f=function(t,e){var r=n(c(t,e),2),i=r[0],a=r[1];if(void 0!==i)if(i.delete(s),0===i.size)g(a);else if(1===i.size){var o=n(i.entries().next().value,2),l=o[0],u=o[1];y(a,l,u)}},g=function(t){if(0!==t.length){var e=n(m(t),2),r=e[0],i=e[1];if(r.delete(i),0===r.size)g(t.slice(0,-1));else if(1===r.size){var a=n(r.entries().next().value,2),o=a[0],l=a[1];o!==s&&y(t.slice(0,-1),o,l)}}},y=function(t,e,r){if(0!==t.length){var i=n(m(t),2),a=i[0],s=i[1];a.set(s+e,r),a.delete(s)}},m=function(t){return t[t.length-1]},v="or",_=function(){function r(e){if(null==e?.fields)throw new Error('MiniSearch: option "fields" must be provided');this._options=t(t(t({},I),e),{searchOptions:t(t({},E),e.searchOptions||{})}),this._index=new h,this._documentCount=0,this._documentIds=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this.addFields(this._options.fields)}return r.prototype.add=function(t){var n,r,i,a,s=this._options,o=s.extractField,l=s.tokenize,u=s.processTerm,h=s.fields,c=s.idField,d=o(t,c);if(null==d)throw new Error('MiniSearch: document does not have ID field "'.concat(c,'"'));var p=this.addDocumentId(d);this.saveStoredFields(p,t);try{for(var f=e(h),g=f.next();!g.done;g=f.next()){var y=g.value,m=o(t,y);if(null!=m){var v=l(m.toString(),y),_=this._fieldIds[y],w=new Set(v).size;this.addFieldLength(p,_,this._documentCount-1,w);try{for(var M=(i=void 0,e(v)),b=M.next();!b.done;b=M.next()){var x=u(b.value,y);x&&this.addTerm(_,p,x)}}catch(t){i={error:t}}finally{try{b&&!b.done&&(a=M.return)&&a.call(M)}finally{if(i)throw i.error}}}}}catch(t){n={error:t}}finally{try{g&&!g.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}},r.prototype.addAll=function(t){var n,r;try{for(var i=e(t),a=i.next();!a.done;a=i.next()){var s=a.value;this.add(s)}}catch(t){n={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},r.prototype.addAllAsync=function(t,e){var n=this;void 0===e&&(e={});var r=e.chunkSize,i=void 0===r?10:r,a={chunk:[],promise:Promise.resolve()},s=t.reduce((function(t,e,r){var a=t.chunk,s=t.promise;return a.push(e),(r+1)%i==0?{chunk:[],promise:s.then((function(){return new Promise((function(t){return setTimeout(t,0)}))})).then((function(){return n.addAll(a)}))}:{chunk:a,promise:s}}),a),o=s.chunk;return s.promise.then((function(){return n.addAll(o)}))},r.prototype.remove=function(t){var r,i,a,s,o,l,u=this._options,h=u.tokenize,c=u.processTerm,d=u.extractField,p=u.fields,f=u.idField,g=d(t,f);if(null==g)throw new Error('MiniSearch: document does not have ID field "'.concat(f,'"'));try{for(var y=e(this._documentIds),m=y.next();!m.done;m=y.next()){var v=n(m.value,2),_=v[0];if(g===v[1]){try{for(var w=(a=void 0,e(p)),M=w.next();!M.done;M=w.next()){var b=M.value,x=d(t,b);if(null!=x){var I=h(x.toString(),b),E=this._fieldIds[b],S=new Set(I).size;this.removeFieldLength(_,E,this._documentCount,S);try{for(var N=(o=void 0,e(I)),A=N.next();!A.done;A=N.next()){var O=c(A.value,b);O&&this.removeTerm(E,_,O)}}catch(t){o={error:t}}finally{try{A&&!A.done&&(l=N.return)&&l.call(N)}finally{if(o)throw o.error}}}}}catch(t){a={error:t}}finally{try{M&&!M.done&&(s=w.return)&&s.call(w)}finally{if(a)throw a.error}}return this._storedFields.delete(_),this._documentIds.delete(_),this._fieldLength.delete(_),void(this._documentCount-=1)}}}catch(t){r={error:t}}finally{try{m&&!m.done&&(i=y.return)&&i.call(y)}finally{if(r)throw r.error}}throw new Error("MiniSearch: cannot remove document with ID ".concat(g,": it is not in the index"))},r.prototype.removeAll=function(t){var n,r;if(t)try{for(var i=e(t),a=i.next();!a.done;a=i.next()){var s=a.value;this.remove(s)}}catch(t){n={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new h,this._documentCount=0,this._documentIds=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}},r.prototype.search=function(t,r){var i,a;void 0===r&&(r={});var s=this.executeQuery(t,r),o=[];try{for(var l=e(s),u=l.next();!u.done;u=l.next()){var h=n(u.value,2),c=h[0],d=h[1],p=d.score,f=d.terms,g=d.match,y=f.length,m={id:this._documentIds.get(c),score:p*y,terms:Object.keys(g),match:g};Object.assign(m,this._storedFields.get(c)),(null==r.filter||r.filter(m))&&o.push(m)}}catch(t){i={error:t}}finally{try{u&&!u.done&&(a=l.return)&&a.call(l)}finally{if(i)throw i.error}}return o.sort(O),o},r.prototype.autoSuggest=function(r,i){var a,s,o,l;void 0===i&&(i={}),i=t(t({},S),i);var u=new Map;try{for(var h=e(this.search(r,i)),c=h.next();!c.done;c=h.next()){var d=c.value,p=d.score,f=(M=d.terms).join(" ");null!=(_=u.get(f))?(_.score+=p,_.count+=1):u.set(f,{score:p,terms:M,count:1})}}catch(t){a={error:t}}finally{try{c&&!c.done&&(s=h.return)&&s.call(h)}finally{if(a)throw a.error}}var g=[];try{for(var y=e(u),m=y.next();!m.done;m=y.next()){var v=n(m.value,2),_=v[0],w=v[1],M=(p=w.score,w.terms),b=w.count;g.push({suggestion:_,terms:M,score:p/b})}}catch(t){o={error:t}}finally{try{m&&!m.done&&(l=y.return)&&l.call(y)}finally{if(o)throw o.error}}return g.sort(O),g},Object.defineProperty(r.prototype,"documentCount",{get:function(){return this._documentCount},enumerable:!1,configurable:!0}),r.loadJSON=function(t,e){if(null==e)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return r.loadJS(JSON.parse(t),e)},r.getDefault=function(t){if(I.hasOwnProperty(t))return w(I,t);throw new Error('MiniSearch: unknown option "'.concat(t,'"'))},r.loadJS=function(t,i){var a,s,o,l,u=t.index,c=t.documentCount,d=t.nextId,p=t.documentIds,f=t.fieldIds,g=t.fieldLength,y=t.averageFieldLength,m=t.storedFields,v=t.serializationVersion;if(1!==v&&2!==v)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var _=new r(i);_._documentCount=c,_._nextId=d,_._documentIds=T(p),_._fieldIds=f,_._fieldLength=T(g),_._avgFieldLength=y,_._storedFields=T(m),_._index=new h;try{for(var w=e(u),M=w.next();!M.done;M=w.next()){var b=n(M.value,2),x=b[0],I=b[1],E=new Map;try{for(var S=(o=void 0,e(Object.keys(I))),N=S.next();!N.done;N=S.next()){var A=N.value,O=I[A];1===v&&(O=O.ds),E.set(parseInt(A,10),T(O))}}catch(t){o={error:t}}finally{try{N&&!N.done&&(l=S.return)&&l.call(S)}finally{if(o)throw o.error}}_._index.set(x,E)}}catch(t){a={error:t}}finally{try{M&&!M.done&&(s=w.return)&&s.call(w)}finally{if(a)throw a.error}}return _},r.prototype.executeQuery=function(e,n){var r=this;if(void 0===n&&(n={}),"string"!=typeof e){var i=t(t(t({},n),e),{queries:void 0}),a=e.queries.map((function(t){return r.executeQuery(t,i)}));return this.combineResults(a,e.combineWith)}var s=this._options,o=s.tokenize,l=s.processTerm,u=s.searchOptions,h=t(t({tokenize:o,processTerm:l},u),n),c=h.tokenize,d=h.processTerm,p=c(e).map((function(t){return d(t)})).filter((function(t){return!!t})).map(x(h)).map((function(t){return r.executeQuerySpec(t,h)}));return this.combineResults(p,h.combineWith)},r.prototype.executeQuerySpec=function(r,i){var a,s,o,l,u,h,c=t(t({},this._options.searchOptions),i),d=(c.fields||this._options.fields).reduce((function(e,n){var r;return t(t({},e),((r={})[n]=w(e,n)||1,r))}),c.boost||{}),p=c.boostDocument,f=c.weights,g=c.maxFuzzy,y=t(t({},E.weights),f),m=y.fuzzy,v=y.prefix,_=this._index.get(r.term),M=this.termResults(r.term,r.term,1,_,d,p);if(r.prefix&&(u=this._index.atPrefix(r.term)),r.fuzzy){var b=!0===r.fuzzy?.2:r.fuzzy,x=b<1?Math.min(g,Math.round(r.term.length*b)):b;x&&(h=this._index.fuzzyGet(r.term,x))}if(u)try{for(var I=e(u),S=I.next();!S.done;S=I.next()){var N=n(S.value,2),A=N[0],O=N[1];if(C=A.length-r.term.length){h?.delete(A);var F=v*A.length/(A.length+.3*C);this.termResults(r.term,A,F,O,d,p,M)}}}catch(t){a={error:t}}finally{try{S&&!S.done&&(s=I.return)&&s.call(I)}finally{if(a)throw a.error}}if(h)try{for(var T=e(h.keys()),k=T.next();!k.done;k=T.next()){A=k.value;var C,B=n(h.get(A),2),D=B[0];(C=B[1])&&(F=m*A.length/(A.length+C),this.termResults(r.term,A,F,D,d,p,M))}}catch(t){o={error:t}}finally{try{k&&!k.done&&(l=T.return)&&l.call(T)}finally{if(o)throw o.error}}return M},r.prototype.combineResults=function(t,e){if(void 0===e&&(e=v),0===t.length)return new Map;var n=e.toLowerCase();return t.reduce(M[n])||new Map},r.prototype.toJSON=function(){var t,r,i,a,s=[];try{for(var o=e(this._index),l=o.next();!l.done;l=o.next()){var u=n(l.value,2),h=u[0],c=u[1],d={};try{for(var p=(i=void 0,e(c)),f=p.next();!f.done;f=p.next()){var g=n(f.value,2),y=g[0],m=g[1];d[y]=Object.fromEntries(m)}}catch(t){i={error:t}}finally{try{f&&!f.done&&(a=p.return)&&a.call(p)}finally{if(i)throw i.error}}s.push([h,d])}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),index:s,serializationVersion:2}},r.prototype.termResults=function(t,n,r,i,a,s,o){var l,u,h,c,d;if(void 0===o&&(o=new Map),null==i)return o;try{for(var p=e(Object.keys(a)),f=p.next();!f.done;f=p.next()){var g=f.value,y=a[g],m=this._fieldIds[g],v=i.get(m);if(null!=v){var _=v.size,M=this._avgFieldLength[m];try{for(var x=(h=void 0,e(v.keys())),I=x.next();!I.done;I=x.next()){var E=I.value,S=s?s(this._documentIds.get(E),n):1;if(S){var A=v.get(E),O=this._fieldLength.get(E)[m],F=r*y*S*b(A,_,this._documentCount,O,M),T=o.get(E);if(T){T.score+=F,N(T.terms,t);var k=w(T.match,n);k?k.push(g):T.match[n]=[g]}else o.set(E,{score:F,terms:[t],match:(d={},d[n]=[g],d)})}}}catch(t){h={error:t}}finally{try{I&&!I.done&&(c=x.return)&&c.call(x)}finally{if(h)throw h.error}}}}}catch(t){l={error:t}}finally{try{f&&!f.done&&(u=p.return)&&u.call(p)}finally{if(l)throw l.error}}return o},r.prototype.addTerm=function(t,e,n){var r=this._index.fetch(n,F),i=r.get(t);if(null==i)(i=new Map).set(e,1),r.set(t,i);else{var a=i.get(e);i.set(e,(a||0)+1)}},r.prototype.removeTerm=function(t,e,n){if(this._index.has(n)){var r=this._index.fetch(n,F),i=r.get(t);null==i||null==i.get(e)?this.warnDocumentChanged(e,t,n):i.get(e)<=1?i.size<=1?r.delete(t):i.delete(e):i.set(e,i.get(e)-1),0===this._index.get(n).size&&this._index.delete(n)}else this.warnDocumentChanged(e,t,n)},r.prototype.warnDocumentChanged=function(t,n,r){var i,a;if(null!=console&&null!=console.warn)try{for(var s=e(Object.keys(this._fieldIds)),o=s.next();!o.done;o=s.next()){var l=o.value;if(this._fieldIds[l]===n)return void console.warn("MiniSearch: document with ID ".concat(this._documentIds.get(t),' has changed before removal: term "').concat(r,'" was not present in field "').concat(l,'". Removing a document after it has changed can corrupt the index!'))}}catch(t){i={error:t}}finally{try{o&&!o.done&&(a=s.return)&&a.call(s)}finally{if(i)throw i.error}}},r.prototype.addDocumentId=function(t){var e=this._nextId;return this._documentIds.set(e,t),this._documentCount+=1,this._nextId+=1,e},r.prototype.addFields=function(t){for(var e=0;e<t.length;e++)this._fieldIds[t[e]]=e},r.prototype.addFieldLength=function(t,e,n,r){var i=this._fieldLength.get(t);null==i&&this._fieldLength.set(t,i=[]),i[e]=r;var a=(this._avgFieldLength[e]||0)*n+r;this._avgFieldLength[e]=a/(n+1)},r.prototype.removeFieldLength=function(t,e,n,r){var i=this._avgFieldLength[e]*n-r;this._avgFieldLength[e]=i/(n-1)},r.prototype.saveStoredFields=function(t,n){var r,i,a=this._options,s=a.storeFields,o=a.extractField;if(null!=s&&0!==s.length){var l=this._storedFields.get(t);null==l&&this._storedFields.set(t,l={});try{for(var u=e(s),h=u.next();!h.done;h=u.next()){var c=h.value,d=o(n,c);void 0!==d&&(l[c]=d)}}catch(t){r={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}},r}(),w=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0},M=((r={}).or=function(t,n){var r,i;try{for(var a=e(n.keys()),s=a.next();!s.done;s=a.next()){var o=s.value,l=t.get(o);if(null==l)t.set(o,n.get(o));else{var u=n.get(o),h=u.score,c=u.terms,d=u.match;l.score=l.score+h,l.match=Object.assign(l.match,d),A(l.terms,c)}}}catch(t){r={error:t}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return t},r.and=function(t,n){var r,i,a=new Map;try{for(var s=e(n.keys()),o=s.next();!o.done;o=s.next()){var l=o.value,u=t.get(l);if(null!=u){var h=n.get(l),c=h.score,d=h.terms,p=h.match;A(u.terms,d),a.set(l,{score:u.score+c,terms:u.terms,match:Object.assign(u.match,p)})}}}catch(t){r={error:t}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return a},r.and_not=function(t,n){var r,i;try{for(var a=e(n.keys()),s=a.next();!s.done;s=a.next()){var o=s.value;t.delete(o)}}catch(t){r={error:t}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return t},r),b=function(t,e,n,r,i){return Math.log(1+(n-e+.5)/(e+.5))*(.5+2.2*t/(t+1.2*(1-.7+.7*r/i)))},x=function(t){return function(e,n,r){return{term:e,fuzzy:"function"==typeof t.fuzzy?t.fuzzy(e,n,r):t.fuzzy||!1,prefix:"function"==typeof t.prefix?t.prefix(e,n,r):!0===t.prefix}}},I={idField:"id",extractField:function(t,e){return t[e]},tokenize:function(t,e){return t.split(k)},processTerm:function(t,e){return t.toLowerCase()},fields:void 0,searchOptions:void 0,storeFields:[]},E={combineWith:v,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375}},S={prefix:function(t,e,n){return e===n.length-1}},N=function(t,e){t.includes(e)||t.push(e)},A=function(t,n){var r,i;try{for(var a=e(n),s=a.next();!s.done;s=a.next()){var o=s.value;t.includes(o)||t.push(o)}}catch(t){r={error:t}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}},O=function(t,e){var n=t.score;return e.score-n},F=function(){return new Map},T=function(t){var n,r,i=new Map;try{for(var a=e(Object.keys(t)),s=a.next();!s.done;s=a.next()){var o=s.value;i.set(parseInt(o,10),t[o])}}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i},k=/[\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u;return _},"object"==typeof t&&typeof e<"u"?e.exports=r():"function"==typeof define&&define.amd?define(r):(n=typeof globalThis<"u"?globalThis:n||self).MiniSearch=r()})),gr={};mi(gr,{Mappedin:()=>lt,MappedinDestinationSet:()=>dt,OfflineSearch:()=>Vt,getVenue:()=>Da,getVenueBundle:()=>Ga,initialize:()=>mr}),module.exports=gi(gr),w(),w();var ai=Zt(Ya(),1);w(),w(),w();var Xa=Zt(Ja(),1);w();var ga=class{origin;destination;vortex;distance;angle;weight;constructor({origin:t,destination:e,vortex:n,elevationDelta:r=0,distance:i=0,angle:a=0}){let s,o;if(this.origin=t,this.destination=e,this.vortex=n,this.distance=i,this.angle=a,n?(this.distance=0,this.angle=0,s=void 0!==n.weight&&n.weight>0?n.weight:"elevator"===n.type?2e3:1e3,o=n.multiplier&&n.multiplier>=1?n.multiplier:1,this.weight=r*o+s):(s=e.weight&&e.weight>=0?e.weight:0,o=e.multiplier&&e.multiplier>=1?e.multiplier:1,this.weight=this.distance*o+s),isNaN(this.angle))throw new Error("nan angle")}},ea=ga;w();var fa="mi-debug",yi={loggingEnabled:()=>"development"===_.env.NODE_ENV||"dev"===_.env.NODE_ENV||"test"===_.env.NODE_ENV||"true"===globalThis.sessionStorage?.getItem(fa),log(...t){this.loggingEnabled()&&console.log("[MappedInJS]",...t)},warn(...t){this.loggingEnabled()&&console.warn("[MappedInJS]",...t)},error(...t){this.loggingEnabled()&&console.error("[MappedInJS]",...t)},assert(...t){this.loggingEnabled()&&console.assert(...t)},time(t){this.loggingEnabled()&&console.time(t)},timeEnd(t){this.loggingEnabled()&&console.timeEnd(t)}},A=yi;function ki(t){if(t.scale||t.x_scale)return 1/(t.scale||t.x_scale||1);try{if(!t.georeference)throw new Error(`map ${t.name||t.shortName||t.id} does not have a georeference field`);if(t.georeference.length<3)throw new Error(`map ${t.name||t.shortName||t.id} has less than 3 georeference points, we require at least 3 for proper map scaling`);let e=t.georeference[0],n=t.georeference[2],r=(0,Xa.getDistance)({latitude:e.target.x,longitude:e.target.y},{latitude:n.target.x,longitude:n.target.y}),i=e.control.x-n.control.x,a=e.control.y-n.control.y;return Math.sqrt(i*i+a*a)/r}catch(t){return A.error(t),1}}function bi(t,e){let n=t.x-e.x,r=t.y-e.y;return(Math.atan2(r,n)+2.5*Math.PI)%(2*Math.PI)}var ya=class{edges;nodesById;mapsById;constructor({nodes:t,vortexes:e,maps:n,showVortexNames:r=!1}){this.edges={},this.mapsById=n.map((t=>({...t,_scale:ki(t)}))).reduce(((t,e)=>(t[e.id]=e,t)),{});let i=t.filter((t=>!!this.mapsById[t.map])).map((t=>({...t,paths:t.paths?t.paths.filter((({map:e})=>e===t.map)):[]})));this.nodesById=i.reduce(((t,e)=>(t[e.id]=e,t)),{});for(let t in this.nodesById)this.nodesById.hasOwnProperty(t)&&(this.nodesById[t].paths=this.nodesById[t].paths.filter((({node:t})=>!!this.nodesById[t])));let a=e.map((t=>({...t,name:r?t.name:t.type,nodes:t.nodes?t.nodes.filter((t=>!!this.nodesById[t])):[]})));i.forEach((t=>{this.edges[t.id]=t.paths.map((({node:e})=>{let n=this.nodesById[e];return new ea({angle:bi(t,n),destination:n,distance:this.getDistance(t,n),origin:t})}))})),a.forEach((t=>{if(null==t.nodes||0===t.nodes.length)return;let e=0;for(;e<t.nodes.length-1;){let n=this.nodesById[t.nodes[e]];if(e++,null==n)continue;let r=e;for(;r<t.nodes.length;){let e=this.nodesById[t.nodes[r]];if(r++,null==e)continue;let i=this.mapsById[n.map].elevation||0,a=this.mapsById[e.map].elevation||0,s=Math.abs(i-a);this.edges[n.id].push(new ea({destination:e,elevationDelta:s,origin:n,vortex:t})),this.edges[e.id].push(new ea({destination:n,elevationDelta:s,origin:e,vortex:t}))}}}))}aStar(t,e,n){let r=t.map((t=>this.nodesById[t])).filter((t=>t)),i=e.map((t=>this.nodesById[t])).filter((t=>t));if(0===r.length||0===i.length)return[];let a=[],s={},o={};for(r.forEach((t=>{let e=this.getShortestEuclideanDistance(t,i);a.push({origin:t,priority:e}),s[t.id]=null,o[t.id]=0})),a.sort(((t,e)=>t.priority-e.priority));a.length>0;){let t=a[0];if(i.includes(t.origin)){let e=[],n=s[t.origin.id];for(;null!=n;){e.push(n);let t=s[n.origin.id];n=null!=t?t:null}return e.reverse()}for(let e of this.edges[t.origin.id]){let r=e.vortex&&!1===e.vortex.accessible;if(n&&(r||!1===e.origin.accessible||!1===e.destination.accessible))continue;let l=o[t.origin.id]+e.weight;if(null==o[e.destination.id]||l<o[e.destination.id]){o[e.destination.id]=l;let t=l+this.getShortestEuclideanDistance(e.destination,i);a.push({origin:e.destination,priority:t}),s[e.destination.id]=e}}a.splice(0,1),a.sort(((t,e)=>t.priority-e.priority))}return[]}getDistance(t,e){let n,r=t.x-e.x,i=t.y-e.y,a=r*r+i*i;return n=null==this.mapsById[t.map]?1:this.mapsById[t.map]._scale,Math.sqrt(a)/n}getShortestEuclideanDistance(t,e){return e.reduce(((e,n)=>{let r=this.getDistance(t,n);return Math.min(e,r)}),Number.MAX_VALUE)}},ka=ya;function vi(t){switch(t){case"down":case"up":return`${t} `;default:return""}}w(),w();var ba=class{node;instruction;action;atLocation;type;distance=0;constructor({origin:t,action:e,distance:n,atLocation:r,instruction:i}){this.node=t,this.action=e,this.distance=n||0,this.atLocation=r,this.instruction="",i?this.instruction=i:(null!=e&&"Departure"===e.type?this.instruction=null!=r?`Depart from ${r.name}`:"Depart from current location":null!=e&&"Arrival"===e.type?this.instruction=null!=r?`Arrive at ${r.name}`:"Arrive at destination":null!=e&&"TakeVortex"===e.type?this.instruction=`Take ${r&&r.name} ${vi(e.direction)}to ${e.toMap.name}`:null!=e&&"ExitVortex"===e.type?this.instruction=`Exit ${r&&r.name} at ${e.toMap.name}`:null!=e&&"Right"===e.bearing?this.instruction="Turn right":null!=e&&"SlightRight"===e.bearing?this.instruction="Turn slightly right":null!=e&&"Straight"===e.bearing?this.instruction="Head straight":null!=e&&"SlightLeft"===e.bearing?this.instruction="Turn slightly left":null!=e&&"Left"===e.bearing&&(this.instruction="Turn left"),null!=e&&"Turn"===e.type&&r&&(this.instruction+=` at ${r.name}`))}},et=ba,ta=.1*Math.PI;function aa(t,e){return((e-t+Math.PI)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)-Math.PI}var va=class{graph;locationsByNodeId;constructor({locations:t,nodes:e,vortexes:n,maps:r,showVortexNames:i}){this.graph=new ka({maps:r,nodes:e,showVortexNames:i,vortexes:n}),this.locationsByNodeId=t.reduce(((t,e)=>(e.nodes&&e.nodes.forEach((n=>{t[n.node]=e})),e.polygons&&e.polygons.forEach((n=>{n.entrances&&n.entrances.forEach((n=>{t[n]=e}))})),t)),{})}getClosestLocationInRay(t,e=.5*Math.PI,n=10){let r=0,i=0,a=t;for(;Math.abs(r)<e&&i<n;){let t=this.graph.edges[a.destination.id],s=null,o=0;for(let e of t)if(e.distance>0)if(null!=s){let t=-aa(a.angle,e.angle);Math.abs(t)<Math.abs(o)&&(s=e,o=t)}else s=e,o=-aa(a.angle,e.angle);if(null==s)return null;{if(Math.abs(o)>=e||(r+=o,i+=s.distance,Math.abs(r)>=e||i>n))return null;let t=this.locationsByNodeId[s.destination.id];if(null!=t)return t;a=s}}return null}getDirections({originIds:t,destinationNodeIds:e,accessible:n,departFrom:r,arriveAt:i}){let a=this.graph.aStar(t,e,n);if(0===a.length)return{distance:0,instructions:[new et({distance:0,instruction:"No Valid Path Available"})],path:[]};let s=0,o=new Array(a.length+1);for(let t=0;t<a.length;t++)o[t]=a[t].origin;o[a.length]=a[a.length-1].destination;let l=[],u=null,h=null,c=0,d=0;for(let t=0;t<a.length;t++){let e=a[t],n=e.origin,o=e.destination;if(s+=e.distance,c+=h?.distance||0,0===t&&l.push(new et({action:{type:"Departure"},atLocation:r,distance:0,origin:n})),null!=e.vortex){let t=this.graph.mapsById[n.map],r=this.graph.mapsById[o.map],i="none";if(null!=t.elevation&&null!=r.elevation){let e=t.elevation-r.elevation;e>0?i="down":e<0&&(i="up")}l.push(new et({action:{direction:i,fromMap:t,toMap:r,type:"TakeVortex"},atLocation:e.vortex,distance:c,origin:n})),d+=c,c=0}else if(null!=u&&null!=h)if(null!=h.vortex){let t=this.graph.mapsById[u.map],e=this.graph.mapsById[h.destination.map];l.push(new et({action:{fromMap:t,toMap:e,type:"ExitVortex"},atLocation:h.vortex,distance:c,origin:n})),d+=c,c=0}else{let t=this.graph.edges[n.id].filter((t=>t.destination!==u&&t.destination!==e.destination));if(t.length>0){let r=-aa(h.angle,e.angle),i=t.reduce(((t,n)=>{let r=-aa(e.angle,n.angle);return Math.min(t,Math.abs(r))}),Math.PI);if(Math.abs(r)>=ta||Math.abs(i)<=ta){let t;t=r<=-Math.PI/4?"Right":r<=-ta?"SlightRight":r<=ta?"Straight":r<=Math.PI/4?"SlightLeft":"Left";let e=this.locationsByNodeId[n.id];if(e||(e=this.getClosestLocationInRay(h,.5*Math.PI,10)),null!=e){let r=new et({action:{bearing:t,referencePosition:"At",type:"Turn"},atLocation:e,distance:c,origin:n});r.type=t,l.push(r)}else l.push(new et({action:{bearing:t,referencePosition:"At",type:"Turn"},distance:c,origin:n}));d+=c,c=0}}}t===a.length-1&&(l.push(new et({action:{type:"Arrival"},atLocation:i,distance:s-d<0?0:s-d,origin:e.destination})),d+=c,c=0),u=n,h=e}let p=[],f=null;for(let t=l.length-1;t>=0;t--){let e=l[t],{action:n}=e;n&&"TakeVortex"===n.type?(f=e.node,p.unshift(e)):n&&"Turn"===n.type&&null!=f?this.graph.getDistance(e.node,f)>5&&p.unshift(e):p.unshift(e)}return{distance:s,instructions:p,path:o}}},Ma=va;function Za(t){let e=+this._x.call(null,t),n=+this._y.call(null,t);return Qa(this.cover(e,n),e,n,t)}function Qa(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,a,s,o,l,u,h,c,d,p=t._root,f={data:r},g=t._x0,y=t._y0,m=t._x1,v=t._y1;if(!p)return t._root=f,t;for(;p.length;)if((u=e>=(a=(g+m)/2))?g=a:m=a,(h=n>=(s=(y+v)/2))?y=s:v=s,i=p,!(p=p[c=h<<1|u]))return i[c]=f,t;if(o=+t._x.call(null,p.data),l=+t._y.call(null,p.data),e===o&&n===l)return f.next=p,i?i[c]=f:t._root=f,t;do{i=i?i[c]=new Array(4):t._root=new Array(4),(u=e>=(a=(g+m)/2))?g=a:m=a,(h=n>=(s=(y+v)/2))?y=s:v=s}while((c=h<<1|u)==(d=(l>=s)<<1|o>=a));return i[d]=p,i[c]=f,t}function en(t){var e,n,r,i,a=t.length,s=new Array(a),o=new Array(a),l=1/0,u=1/0,h=-1/0,c=-1/0;for(n=0;n<a;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(i=+this._y.call(null,e))||(s[n]=r,o[n]=i,r<l&&(l=r),r>h&&(h=r),i<u&&(u=i),i>c&&(c=i));if(l>h||u>c)return this;for(this.cover(l,u).cover(h,c),n=0;n<a;++n)Qa(this,s[n],o[n],t[n]);return this}function tn(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,a=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,a=(r=Math.floor(e))+1;else{for(var s,o,l=i-n||1,u=this._root;n>t||t>=i||r>e||e>=a;)switch(o=(e<r)<<1|t<n,s=new Array(4),s[o]=u,u=s,l*=2,o){case 0:i=n+l,a=r+l;break;case 1:n=i-l,a=r+l;break;case 2:i=n+l,r=a-l;break;case 3:n=i-l,r=a-l}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=r,this._x1=i,this._y1=a,this}function an(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t}function nn(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function je(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function rn(t,e,n){var r,i,a,s,o,l,u,h=this._x0,c=this._y0,d=this._x1,p=this._y1,f=[],g=this._root;for(g&&f.push(new je(g,h,c,d,p)),null==n?n=1/0:(h=t-n,c=e-n,d=t+n,p=e+n,n*=n);l=f.pop();)if(!(!(g=l.node)||(i=l.x0)>d||(a=l.y0)>p||(s=l.x1)<h||(o=l.y1)<c))if(g.length){var y=(i+s)/2,m=(a+o)/2;f.push(new je(g[3],y,m,s,o),new je(g[2],i,m,y,o),new je(g[1],y,a,s,m),new je(g[0],i,a,y,m)),(u=(e>=m)<<1|t>=y)&&(l=f[f.length-1],f[f.length-1]=f[f.length-1-u],f[f.length-1-u]=l)}else{var v=t-+this._x.call(null,g.data),_=e-+this._y.call(null,g.data),w=v*v+_*_;if(w<n){var M=Math.sqrt(n=w);h=t-M,c=e-M,d=t+M,p=e+M,r=g.data}}return r}function sn(t){if(isNaN(a=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t)))return this;var e,n,r,i,a,s,o,l,u,h,c,d,p=this._root,f=this._x0,g=this._y0,y=this._x1,m=this._y1;if(!p)return this;if(p.length)for(;;){if((u=a>=(o=(f+y)/2))?f=o:y=o,(h=s>=(l=(g+m)/2))?g=l:m=l,e=p,!(p=p[c=h<<1|u]))return this;if(!p.length)break;(e[c+1&3]||e[c+2&3]||e[c+3&3])&&(n=e,d=c)}for(;p.data!==t;)if(r=p,!(p=p.next))return this;return(i=p.next)&&delete p.next,r?(i?r.next=i:delete r.next,this):e?(i?e[c]=i:delete e[c],(p=e[0]||e[1]||e[2]||e[3])&&p===(e[3]||e[2]||e[1]||e[0])&&!p.length&&(n?n[d]=p:this._root=p),this):(this._root=i,this)}function on(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this}function ln(){return this._root}function un(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t}function cn(t){var e,n,r,i,a,s,o=[],l=this._root;for(l&&o.push(new je(l,this._x0,this._y0,this._x1,this._y1));e=o.pop();)if(!t(l=e.node,r=e.x0,i=e.y0,a=e.x1,s=e.y1)&&l.length){var u=(r+a)/2,h=(i+s)/2;(n=l[3])&&o.push(new je(n,u,h,a,s)),(n=l[2])&&o.push(new je(n,r,h,u,s)),(n=l[1])&&o.push(new je(n,u,i,a,h)),(n=l[0])&&o.push(new je(n,r,i,u,h))}return this}function dn(t){var e,n=[],r=[];for(this._root&&n.push(new je(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var i=e.node;if(i.length){var a,s=e.x0,o=e.y0,l=e.x1,u=e.y1,h=(s+l)/2,c=(o+u)/2;(a=i[0])&&n.push(new je(a,s,o,h,c)),(a=i[1])&&n.push(new je(a,h,o,l,c)),(a=i[2])&&n.push(new je(a,s,c,h,u)),(a=i[3])&&n.push(new je(a,h,c,l,u))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this}function pn(t){return t[0]}function hn(t){return arguments.length?(this._x=t,this):this._x}function mn(t){return t[1]}function gn(t){return arguments.length?(this._y=t,this):this._y}function Ct(t,e,n){var r=new wa(e??pn,n??mn,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function wa(t,e,n,r,i,a){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function fn(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}w(),w(),w(),w(),w(),w(),w(),w(),w(),w(),w(),w(),w(),w(),w(),w();var _e=Ct.prototype=wa.prototype;_e.copy=function(){var t,e,n=new wa(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=fn(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=fn(e));return n},_e.add=Za,_e.addAll=en,_e.cover=tn,_e.data=an,_e.extent=nn,_e.find=rn,_e.remove=sn,_e.removeAll=on,_e.root=ln,_e.size=un,_e.visit=cn,_e.visitAfter=dn,_e.x=hn,_e.y=gn;var De,Me,ct=class{constructor(t){ve(this,De,void 0),Ee(this,"categories"),Ee(this,"locations"),Ee(this,"vortexes"),Ee(this,"maps"),Ee(this,"nodes"),Ee(this,"polygons"),Ee(this,"events"),Ee(this,"mapGroups"),Ee(this,"locationStates"),Ee(this,"rankings"),ve(this,Me,{}),ue(this,De,t)}get polygonsByMapId(){if(C(this,Me).polygonsByMapId)return C(this,Me).polygonsByMapId;let t,e={};for(let n=0,r=C(this,De).polygons.length;n<r;++n)t=C(this,De).polygons[n],e[t.map.id]||(e[t.map.id]=[]),e[t.map.id].push(t);let n=Object.entries(e).reduce(((t,[e,n])=>(t.set(e,n),t)),new Map);return C(this,Me).polygonsByMapId=n,C(this,Me).polygonsByMapId}get nodesByMapId(){if(C(this,Me).nodesByMapId)return C(this,Me).nodesByMapId;let t,e={};for(let n=0,r=C(this,De).nodes.length;n<r;++n)t=C(this,De).nodes[n],e[t.map.id]||(e[t.map.id]=[]),e[t.map.id].push(t);let n=Object.entries(e).reduce(((t,[e,n])=>(t.set(e,n),t)),new Map);return C(this,Me).nodesByMapId=n,C(this,Me).nodesByMapId}findNearestNodeOnMap(t,e){if(C(this,Me).nodeTreesByMap||(C(this,Me).nodeTreesByMap=new Map),!C(this,Me).nodeTreesByMap.has(t)){let e=this.nodesByMapId.get(t)??[],n=Ct();n.x((t=>t.x)),n.y((t=>t.y)),n.addAll(e),C(this,Me).nodeTreesByMap.set(t,n)}return C(this,Me).nodeTreesByMap.get(t).find(e.x,e.y)}get locationsByMapId(){if(C(this,Me).locationsByMapId)return C(this,Me).locationsByMapId;let t,e={};for(let n=0,r=C(this,De).locations.length;n<r;++n){t=C(this,De).locations[n];for(let n=0,r=t.polygons.length;n<r;++n)e[t.polygons[n].map.id]||(e[t.polygons[n].map.id]=[]),e[t.polygons[n].map.id].push(t)}let n=Object.entries(e).reduce(((t,[e,n])=>(t.set(e,n),t)),new Map);return C(this,Me).locationsByMapId=n,C(this,Me).locationsByMapId}static create(t){return ct.instances.has(t)||ct.instances.set(t,new ct(t)),ct.instances.get(t)}static clear(){ct.instances.clear()}},na=ct;De=new WeakMap,Me=new WeakMap,Ee(na,"instances",new Map);var Pe=na;w(),w(),w(),w();var yn=" ",Ne=class{static get separator(){return yn}static set separator(t){yn=t}static parse(t){if(!isNaN(parseFloat(t))&&isFinite(t))return Number(t);let e=String(t).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==e[e.length-1]&&e.splice(e.length-1),""==e)return NaN;let n=null;switch(e.length){case 3:n=e[0]/1+e[1]/60+e[2]/3600;break;case 2:n=e[0]/1+e[1]/60;break;case 1:n=e[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(n=-n),Number(n)}static toDms(t,e="d",n){if(isNaN(t)||"string"==typeof t&&""==t.trim()||"boolean"==typeof t||t==1/0||null==t)return null;if(void 0===n)switch(e){case"d":case"deg":n=4;break;case"dm":case"deg+min":n=2;break;case"dms":case"deg+min+sec":n=0;break;default:e="d",n=4}t=Math.abs(t);let r=null,i=null,a=null,s=null;switch(e){default:case"d":case"deg":i=t.toFixed(n),i<100&&(i="0"+i),i<10&&(i="0"+i),r=i+"°";break;case"dm":case"deg+min":i=Math.floor(t),a=(60*t%60).toFixed(n),60==a&&(a=(0).toFixed(n),i++),i=("000"+i).slice(-3),a<10&&(a="0"+a),r=i+"°"+Ne.separator+a+"′";break;case"dms":case"deg+min+sec":i=Math.floor(t),a=Math.floor(3600*t/60)%60,s=(3600*t%60).toFixed(n),60==s&&(s=(0).toFixed(n),a++),60==a&&(a=0,i++),i=("000"+i).slice(-3),a=("00"+a).slice(-2),s<10&&(s="0"+s),r=i+"°"+Ne.separator+a+"′"+Ne.separator+s+"″"}return r}static toLat(t,e,n){let r=Ne.toDms(Ne.wrap90(t),e,n);return null===r?"–":r.slice(1)+Ne.separator+(t<0?"S":"N")}static toLon(t,e,n){let r=Ne.toDms(Ne.wrap180(t),e,n);return null===r?"–":r+Ne.separator+(t<0?"W":"E")}static toBrng(t,e,n){let r=Ne.toDms(Ne.wrap360(t),e,n);return null===r?"–":r.replace("360","0")}static fromLocale(t){let e=123456.789.toLocaleString(),n={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(n.thousands,"⁜").replace(n.decimal,".").replace("⁜",",")}static toLocale(t){let e=123456.789.toLocaleString(),n={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(/,([0-9])/,"⁜$1").replace(".",n.decimal).replace("⁜",n.thousands)}static compassPoint(t,e=3){if(![1,2,3].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);t=Ne.wrap360(t);let n=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*n/360)%n*16/n]}static wrap360(t){return 0<=t&&t<360?t:(t%360+360)%360}static wrap180(t){return-180<t&&t<=180?t:(t+540)%360-180}static wrap90(t){return-90<=t&&t<=90?t:Math.abs((t%360+270)%360-180)-90}};Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};var K=Ne,he=Math.PI,S=class{constructor(t,e){if(isNaN(t))throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e))throw new TypeError(`invalid lon ‘${e}’`);this._lat=K.wrap90(Number(t)),this._lon=K.wrap180(Number(e))}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?K.wrap90(K.parse(t)):K.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?K.wrap90(K.parse(t)):K.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid latitude ‘${t}’`)}get lon(){return this._lon}get lng(){return this._lon}get longitude(){return this._lon}set lon(t){if(this._lon=isNaN(t)?K.wrap180(K.parse(t)):K.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?K.wrap180(K.parse(t)):K.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?K.wrap180(K.parse(t)):K.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${t}’`)}static get metresToKm(){return.001}static get metresToMiles(){return 1/1609.344}static get metresToNauticalMiles(){return 1/1852}static parse(...t){if(0==t.length)throw new TypeError("invalid (empty) point");if(null===t[0]||null===t[1])throw new TypeError("invalid (null) point");let e,n;if(2==t.length&&([e,n]=t,e=K.wrap90(K.parse(e)),n=K.wrap180(K.parse(n)),isNaN(e)||isNaN(n)))throw new TypeError(`invalid point ‘${t.toString()}’`);if(1==t.length&&"string"==typeof t[0]&&([e,n]=t[0].split(","),e=K.wrap90(K.parse(e)),n=K.wrap180(K.parse(n)),isNaN(e)||isNaN(n)))throw new TypeError(`invalid point ‘${t[0]}’`);if(1==t.length&&"object"==typeof t[0]){let r=t[0];if("Point"==r.type&&Array.isArray(r.coordinates)?[n,e]=r.coordinates:(null!=r.latitude&&(e=r.latitude),null!=r.lat&&(e=r.lat),null!=r.longitude&&(n=r.longitude),null!=r.lng&&(n=r.lng),null!=r.lon&&(n=r.lon),e=K.wrap90(K.parse(e)),n=K.wrap180(K.parse(n))),isNaN(e)||isNaN(n))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if(isNaN(e)||isNaN(n))throw new TypeError(`invalid point ‘${t.toString()}’`);return new S(e,n)}distanceTo(t,e=6371e3){if(t instanceof S||(t=S.parse(t)),isNaN(e))throw new TypeError(`invalid radius ‘${e}’`);let n=e,r=this.lat.toRadians(),i=this.lon.toRadians(),a=t.lat.toRadians(),s=a-r,o=t.lon.toRadians()-i,l=Math.sin(s/2)*Math.sin(s/2)+Math.cos(r)*Math.cos(a)*Math.sin(o/2)*Math.sin(o/2);return n*(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)))}initialBearingTo(t){if(t instanceof S||(t=S.parse(t)),this.equals(t))return NaN;let e=this.lat.toRadians(),n=t.lat.toRadians(),r=(t.lon-this.lon).toRadians(),i=Math.cos(e)*Math.sin(n)-Math.sin(e)*Math.cos(n)*Math.cos(r),a=Math.sin(r)*Math.cos(n),s=Math.atan2(a,i).toDegrees();return K.wrap360(s)}finalBearingTo(t){t instanceof S||(t=S.parse(t));let e=t.initialBearingTo(this)+180;return K.wrap360(e)}midpointTo(t){t instanceof S||(t=S.parse(t));let e=this.lat.toRadians(),n=this.lon.toRadians(),r=t.lat.toRadians(),i=(t.lon-this.lon).toRadians(),a=Math.cos(e),s=0,o=Math.sin(e),l={x:a+Math.cos(r)*Math.cos(i),y:s+Math.cos(r)*Math.sin(i),z:o+Math.sin(r)},u=Math.atan2(l.z,Math.sqrt(l.x*l.x+l.y*l.y)),h=n+Math.atan2(l.y,l.x),c=u.toDegrees(),d=h.toDegrees();return new S(c,d)}intermediatePointTo(t,e){if(t instanceof S||(t=S.parse(t)),this.equals(t))return new S(this.lat,this.lon);let n=this.lat.toRadians(),r=this.lon.toRadians(),i=t.lat.toRadians(),a=t.lon.toRadians(),s=i-n,o=a-r,l=Math.sin(s/2)*Math.sin(s/2)+Math.cos(n)*Math.cos(i)*Math.sin(o/2)*Math.sin(o/2),u=2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),h=Math.sin((1-e)*u)/Math.sin(u),c=Math.sin(e*u)/Math.sin(u),d=h*Math.cos(n)*Math.cos(r)+c*Math.cos(i)*Math.cos(a),p=h*Math.cos(n)*Math.sin(r)+c*Math.cos(i)*Math.sin(a),f=h*Math.sin(n)+c*Math.sin(i),g=Math.atan2(f,Math.sqrt(d*d+p*p)),y=Math.atan2(p,d),m=g.toDegrees(),v=y.toDegrees();return new S(m,v)}destinationPoint(t,e,n=6371e3){let r=t/n,i=Number(e).toRadians(),a=this.lat.toRadians(),s=this.lon.toRadians(),o=Math.sin(a)*Math.cos(r)+Math.cos(a)*Math.sin(r)*Math.cos(i),l=Math.asin(o),u=Math.sin(i)*Math.sin(r)*Math.cos(a),h=Math.cos(r)-Math.sin(a)*o,c=s+Math.atan2(u,h),d=l.toDegrees(),p=c.toDegrees();return new S(d,p)}static intersection(t,e,n,r){if(t instanceof S||(t=S.parse(t)),n instanceof S||(n=S.parse(n)),isNaN(e))throw new TypeError(`invalid brng1 ‘${e}’`);if(isNaN(r))throw new TypeError(`invalid brng2 ‘${r}’`);let i=t.lat.toRadians(),a=t.lon.toRadians(),s=n.lat.toRadians(),o=n.lon.toRadians(),l=Number(e).toRadians(),u=Number(r).toRadians(),h=s-i,c=o-a,d=2*Math.asin(Math.sqrt(Math.sin(h/2)*Math.sin(h/2)+Math.cos(i)*Math.cos(s)*Math.sin(c/2)*Math.sin(c/2)));if(Math.abs(d)<Number.EPSILON)return new S(t.lat,t.lon);let p=(Math.sin(s)-Math.sin(i)*Math.cos(d))/(Math.sin(d)*Math.cos(i)),f=(Math.sin(i)-Math.sin(s)*Math.cos(d))/(Math.sin(d)*Math.cos(s)),g=Math.acos(Math.min(Math.max(p,-1),1)),y=Math.acos(Math.min(Math.max(f,-1),1)),m=l-(Math.sin(o-a)>0?g:2*he-g),v=(Math.sin(o-a)>0?2*he-y:y)-u;if(0==Math.sin(m)&&0==Math.sin(v)||Math.sin(m)*Math.sin(v)<0)return null;let _=-Math.cos(m)*Math.cos(v)+Math.sin(m)*Math.sin(v)*Math.cos(d),w=Math.atan2(Math.sin(d)*Math.sin(m)*Math.sin(v),Math.cos(v)+Math.cos(m)*_),M=Math.asin(Math.min(Math.max(Math.sin(i)*Math.cos(w)+Math.cos(i)*Math.sin(w)*Math.cos(l),-1),1)),b=a+Math.atan2(Math.sin(l)*Math.sin(w)*Math.cos(i),Math.cos(w)-Math.sin(i)*Math.sin(M)),x=M.toDegrees(),I=b.toDegrees();return new S(x,I)}crossTrackDistanceTo(t,e,n=6371e3){t instanceof S||(t=S.parse(t)),e instanceof S||(e=S.parse(e));let r=n;if(this.equals(t))return 0;let i=t.distanceTo(this,r)/r,a=t.initialBearingTo(this).toRadians(),s=t.initialBearingTo(e).toRadians();return Math.asin(Math.sin(i)*Math.sin(a-s))*r}alongTrackDistanceTo(t,e,n=6371e3){t instanceof S||(t=S.parse(t)),e instanceof S||(e=S.parse(e));let r=n;if(this.equals(t))return 0;let i=t.distanceTo(this,r)/r,a=t.initialBearingTo(this).toRadians(),s=t.initialBearingTo(e).toRadians(),o=Math.asin(Math.sin(i)*Math.sin(a-s));return Math.acos(Math.cos(i)/Math.abs(Math.cos(o)))*Math.sign(Math.cos(s-a))*r}maxLatitude(t){let e=Number(t).toRadians(),n=this.lat.toRadians();return Math.acos(Math.abs(Math.sin(e)*Math.cos(n))).toDegrees()}static crossingParallels(t,e,n){if(t.equals(e))return null;let r=Number(n).toRadians(),i=t.lat.toRadians(),a=t.lon.toRadians(),s=e.lat.toRadians(),o=e.lon.toRadians()-a,l=Math.sin(i)*Math.cos(s)*Math.cos(r)*Math.sin(o),u=Math.sin(i)*Math.cos(s)*Math.cos(r)*Math.cos(o)-Math.cos(i)*Math.sin(s)*Math.cos(r),h=Math.cos(i)*Math.cos(s)*Math.sin(r)*Math.sin(o);if(h*h>l*l+u*u)return null;let c=Math.atan2(-u,l),d=Math.acos(h/Math.sqrt(l*l+u*u)),p=a+c+d,f=(a+c-d).toDegrees(),g=p.toDegrees();return{lon1:K.wrap180(f),lon2:K.wrap180(g)}}rhumbDistanceTo(t,e=6371e3){t instanceof S||(t=S.parse(t));let n=e,r=this.lat.toRadians(),i=t.lat.toRadians(),a=i-r,s=Math.abs(t.lon-this.lon).toRadians();Math.abs(s)>he&&(s=s>0?-(2*he-s):2*he+s);let o=Math.log(Math.tan(i/2+he/4)/Math.tan(r/2+he/4)),l=Math.abs(o)>1e-11?a/o:Math.cos(r);return Math.sqrt(a*a+l*l*s*s)*n}rhumbBearingTo(t){if(t instanceof S||(t=S.parse(t)),this.equals(t))return NaN;let e=this.lat.toRadians(),n=t.lat.toRadians(),r=(t.lon-this.lon).toRadians();Math.abs(r)>he&&(r=r>0?-(2*he-r):2*he+r);let i=Math.log(Math.tan(n/2+he/4)/Math.tan(e/2+he/4)),a=Math.atan2(r,i).toDegrees();return K.wrap360(a)}rhumbDestinationPoint(t,e,n=6371e3){let r=this.lat.toRadians(),i=this.lon.toRadians(),a=Number(e).toRadians(),s=t/n,o=s*Math.cos(a),l=r+o;Math.abs(l)>he/2&&(l=l>0?he-l:-he-l);let u=Math.log(Math.tan(l/2+he/4)/Math.tan(r/2+he/4)),h=Math.abs(u)>1e-11?o/u:Math.cos(r),c=i+s*Math.sin(a)/h,d=l.toDegrees(),p=c.toDegrees();return new S(d,p)}rhumbMidpointTo(t){t instanceof S||(t=S.parse(t));let e=this.lat.toRadians(),n=this.lon.toRadians(),r=t.lat.toRadians(),i=t.lon.toRadians();Math.abs(i-n)>he&&(n+=2*he);let a=(e+r)/2,s=Math.tan(he/4+e/2),o=Math.tan(he/4+r/2),l=Math.tan(he/4+a/2),u=((i-n)*Math.log(l)+n*Math.log(o)-i*Math.log(s))/Math.log(o/s);isFinite(u)||(u=(n+i)/2);let h=a.toDegrees(),c=u.toDegrees();return new S(h,c)}static areaOf(t,e=6371e3){let n=e,r=t[0].equals(t[t.length-1]);r||t.push(t[0]);let i=t.length-1,a=0;for(let e=0;e<i;e++){let n=t[e].lat.toRadians(),r=t[e+1].lat.toRadians(),i=(t[e+1].lon-t[e].lon).toRadians();a+=2*Math.atan2(Math.tan(i/2)*(Math.tan(n/2)+Math.tan(r/2)),1+Math.tan(n/2)*Math.tan(r/2))}(function(t){let e=0,n=t[0].initialBearingTo(t[1]);for(let r=0;r<t.length-1;r++){let i=t[r].initialBearingTo(t[r+1]),a=t[r].finalBearingTo(t[r+1]);e+=(i-n+540)%360-180,e+=(a-i+540)%360-180,n=a}let r=t[0].initialBearingTo(t[1]);return e+=(r-n+540)%360-180,Math.abs(e)<90})(t)&&(a=Math.abs(a)-2*he);let s=Math.abs(a*n*n);return r||t.pop(),s}equals(t){return t instanceof S||(t=S.parse(t)),!(Math.abs(this.lat-t.lat)>Number.EPSILON||Math.abs(this.lon-t.lon)>Number.EPSILON)}toGeoJSON(){return{type:"Point",coordinates:[this.lon,this.lat]}}toString(t="d",e){if(!["d","dm","dms","n"].includes(t))throw new RangeError(`invalid format ‘${t}’`);if("n"==t)return null==e&&(e=4),`${this.lat.toFixed(e)},${this.lon.toFixed(e)}`;return`${K.toLat(this.lat,t,e)}, ${K.toLon(this.lon,t,e)}`}};w(),w(),w();var dt=class{destinations=[];constructor(t){this.destinations=t}};w();var bt=class{#t;#e;distance=0;path=[];instructions=[];constructor(t,e){this.#e=t,this.#t=e,this.distance=e.distance,this.instructions=e.instructions.map((t=>{let e={...t,action:{...t.action},atLocation:t.atLocation?.id?this.#e?._vortexesById?.[t.atLocation.id]:void 0,node:t.node?.id?this.#e?._nodesById?.[t.node.id]:void 0};return("TakeVortex"===e.action?.type||"ExitVortex"===e.action?.type)&&(e.action.fromMap=this.#e._mapsById?.[e.action?.fromMap.id],e.action.toMap=this.#e._mapsById?.[e.action?.toMap.id]),e})),this.path=e.path.map((t=>this.#e?._nodesById?.[t.id]))}toJSON(){return this.#t}},$e=class{#t;constructor(t){this.#t=t}directionsTo(t,e){if(t instanceof dt){let n=[],r=this;for(let i=0;i<t.destinations.length;i++){let a=t.destinations[i],s=Lt(r),o=Lt(a),l=this.#t.navigator.getDirections({originIds:s,destinationNodeIds:o,accessible:e?.accessible||!1}),u=new bt(this.#t,l);n.push(u),r=a}return n}{let n=Lt(this),r=Lt(t),i=this.#t.navigator.getDirections({originIds:n,destinationNodeIds:r,accessible:e?.accessible||!1});return new bt(this.#t,i)}}distanceTo(t,e){return this.directionsTo(t,e)?.distance||0}},wi=0,ji="9999-12-31T00:00:00.000Z";function xi(t,e,n=new Date){if(!t.states)return;let r=n||new Date,i=t.states.find((t=>{let e=new Date(t.start||wi),n=new Date(t.end||ji);return e<r&&n>r}));return i?e.find((t=>t.value===i.type)):void 0}var Ce=class extends $e{#t;#e;#n={};states;id="";name="";type="";description;sortOrder;logo;phone;social;color;shortName;detailsUrl;tags;externalId;showLabelWhenImagePresent;picture;operationHours;siblingGroups;gallery;constructor(t,e){super(t),this.#t=t,this.#e=e;let n=Object.assign({},e);delete n.categories,Object.assign(this,n)}#r;get polygons(){let t=this.#n.polygons;if(typeof t<"u")return t;let e=[],n=this.#r,r=this.#t._polygonsById;if(Array.isArray(n))for(let t=0,i=n.length;t<i;++t){let i=r[n[t].id];null!=i&&i.geometry.visible&&e.push(i)}return this.#n.polygons=e,e}set polygons(t){this.#r=t}#i=[];get nodes(){let t=this.#n.nodes;if(typeof t<"u")return t;let e=[],n=this.#i,r=this.#t._nodesById;if(n)for(let t=0,i=n.length;t<i;++t){let i=r[n[t].node];null!=i&&e.push(i)}return this.#n.nodes=e,e}set nodes(t){this.#i=t}#a;get parent(){let t=this.#n.parent;if(typeof t<"u")return t;let e,n=this.#t._locationsById,r=this.#a;return void 0!==r&&(e=n[r]),this.#n.parent=e,e}set parent(t){this.#a=t}get categories(){let t=this.#n.categories;if(typeof t<"u")return t;let e=[];return this.#e.categories.forEach((t=>{let n=this.#t.getCollectionItemById("categories",t);n&&e.push(n)})),this.#n.categories=e,e}get state(){return xi(this,this.#t.locationStates)}clone(){return new Ce(this.#t,this.#e)}get nodeOperationHours(){let t=this.#n.nodeOperationHours;if(typeof t<"u")return t;if(null==this.nodes)return{};let e=this.#e.nodes.reduce(((t,e)=>(null!=e.operationHours&&(t[e.node]=e.operationHours),t)),{});return this.#n.nodeOperationHours=e,e}static hydrate(t,e){return t.map((t=>new Ce(e,t)))}static async fetch(t){let e=t.options.things.locations.slice();t.options.things.categories&&fe(e,"categories"),t.options.things.nodes&&fe(e,"nodes"),t.options.things.polygons&&fe(e,"polygons"),t.options.things.locationStates&&fe(e,"states");let n={fields:e,venue:t.options.venue};try{let e=await ye(t.options,"location",n);return t.options.includeHidden||(e=e.filter((t=>!t.hidden))),e.map((e=>new Ce(t,e)))}catch(t){return A.error("Fetch Locations:",t),[]}}toJSON(){let t=this.#e;return delete t.color,t}};w();var Ge=class extends $e{#t;#e;#n={};geometry;perspectives;image;holes;textures;material;label;id="";layer;layerId;name;externalId;vertexes;canvasBounds;constructor(t,e){super(t),this.#t=t,this.#e=e;let n=Object.assign({},e);delete n.map,Object.assign(this,n)}get map(){let t=this.#n.map;if(typeof t<"u")return t;let e=this.#t.getCollectionItemById("maps",this.#e.map);return this.#n.map=e,e}get locations(){let t=this.#n.locations;if(typeof t<"u")return t;let e=[],n=Pe.instances.get(this.#t)?.locationsByMapId.get(this.map.id)??[],{id:r}=this;for(let t=0,i=n.length;t<i;++t){let i=n[t],a=i.polygons;if(Array.isArray(a))for(let t=0,n=a.length;t<n;++t)if(a[t].id===r){e.push(i);break}}return this.#n.locations=e,e}#r;get entrances(){let t=this.#n.entrances;if(typeof t<"u")return t;let e=[],n=this.#r,r=this.#t._nodesById;if(Array.isArray(n)){for(let t=0,i=n.length;t<i;++t){let i=r[n[t].id];null!=i&&e.push(i)}return this.#n.entrances=e,e}return[]}set entrances(t){this.#r=t}get rank(){let t=this.#n.rank;if(typeof t<"u")return t;let{rankings:e}=this.#t;if(!e||!e.polygons)return null;let n=e.polygons.find((t=>t.polygonId===this.id));return n?(this.#n.rank={score:n.score,node:n.entranceNodeId},{score:n.score,node:n.entranceNodeId}):(this.#n.rank=null,null)}static hydrate(t,e){return t.map((t=>new Ge(e,t)))}static async fetch(t){let e=t.options.things.polygons.slice();t.options.things.maps&&fe(e,"map"),t.options.things.nodes&&fe(e,"entrances");let n={fields:e,venue:t.options.venue};try{return(await ye(t.options,"polygon",n)).filter((t=>t.geometry.visible)).map((e=>new Ge(t,e)))}catch(t){return A.error("Fetch Polygons:",t),[]}}toJSON(){return this.#e}};function bn(t){return/^[\da-f]{24}$/i.test(t)}function kn(t,e=!1){let n="";if(null!=t){let r="?",i=e?Object.keys(t).filter((t=>!["slug","venue"].includes(t))):Object.keys(t);for(let e=0,a=i.length;e<a;++e){let a=i[e],s=t[a];null!=s&&(n+=`${r+encodeURIComponent(a)}=${encodeURIComponent(s)}`,r="&")}}return n}function Ti(t,e,n,r=!1){return r?`${t.supplementaryUrl}${e}?venue=${n.venue||n.slug}`:t.baseUrl?.includes("gateway")?`${t.baseUrl}${e}/${n.venue||n.slug}${kn(n,t.baseUrl?.includes("gateway"))}`:t.baseUrl+e+kn(n)}async function ye(t,e,n,r=!1){return xa(t,e,n,r,!0)}async function xa(t,e,n,r=!1,i=!1){let a=Ti(t,e,n,r),s=await Ta(t,a,r);if(!i&&Array.isArray(s)){if(1===s.length)return s[0];throw new Error("Invalid response object")}return s}async function Ta(t,e,n=!1){let r={language:t.language,clientId:t.clientId,clientSecret:t.clientSecret};n&&delete r.language,r.language&&(e+=`&lang=${encodeURIComponent(r.language)}`);let{headers:i}=t;i["Content-Type"]="text/json",t.authorization&&(i.Authorization=t.authorization),r.language&&(i["Accept-Language"]=r.language);let a={method:"GET",headers:i},s=await Rt()(e,a);if(!s.ok)throw new Error(`${s.status} ${s.statusText}`);return s.json()}function fe(t,e){t.indexOf(e)<0&&t.push(e)}function vn([t,e],[n,r]){let i=new S(t,e),a=new S(n,r);return i.distanceTo(a)}function Mn(t){if(t.scale||t.x_scale)return 1/(t.scale||t.x_scale);let e;try{let n=t.georeference[0],r=t.georeference[2],i=new S(n.target.x,n.target.y),a=new S(r.target.x,r.target.y),s=i.distanceTo(a),o=n.control.x-r.control.x,l=n.control.y-r.control.y;e=Math.sqrt(o*o+l*l)/s}catch(n){e=1,A.warn(n),A.warn(`Couldn't georeference ${t.name||t.shortName||t.id}. Probably not enough geocoordinates.`)}return e}function Lt(t){return t instanceof Ge?t.entrances.map((t=>t.id)):t instanceof Ce?t.nodes?.map((t=>t.id))||[]:[t.id]}async function wn(t){let e={},{maps:n,images:r,scenes:i,polygons:a}=t;if(null!=r)try{let t=Object.keys(r).map((t=>fetch(`data:image/png;base64,${r[t]}`).then((t=>t.blob())).then((n=>{e[t]=n})).catch((t=>{A.error(t)}))));await Promise.all(t)}catch(t){A.error(t)}return n.forEach((t=>{(t.scene?.polygons||i[t.id])&&(null!=i&&i[t.id]&&(t.scene||(t.scene={}),Object.defineProperty(t.scene,"polygons",{get:()=>i[t.id]})),null!=r&&(t.scene.images=t.scene.images.map((({filename:t})=>({filename:t,url:e[t]}))),t.scene.polygons.forEach((t=>{if(t?.image?.url&&t?.image?.url){let n=t.image.url.split("/"),r=e[n[n.length-1]];r&&(t.image.url=r)}}))))})),null!=r&&a.forEach((t=>{if(t?.image?.url){let n=t.image.url.split("/"),r=e[n[n.length-1]];r&&(t.image.url=r)}})),null!=t.images&&delete t.images,null!=t.scenes&&delete t.scenes,t}function Ia(t,e,n){let r;return function(){let i=this,a=arguments,s=function(){r=null,n||t.apply(i,a)},o=n&&!r;clearTimeout(r),r=setTimeout(s,e),o&&t.apply(i,a)}}var qe=class{#t;#e={};#n;name;externalId;parents;id;icon;constructor(t,e){this.id=e.id,this.#n=e,this.#t=t,Object.assign(this,e)}get locations(){let t=this.#e.locations;if(typeof t<"u")return t;let e=[],{locations:n}=this.#t,{id:r}=this;for(let t=0,i=n.length;t<i;++t){let i=n[t],a=i.categories;if(Array.isArray(a))for(let t=0,n=a.length;t<n;++t)if(a[t]?.id===r){e.push(i);break}}return this.#e.locations=e,e}static hydrate(t,e){return t.map((t=>new qe(e,t)))}static async fetch(t){let e={fields:t.options.things.categories,venue:t.options.venue};try{return(await ye(t.options,"category",e)).map((e=>new qe(t,e)))}catch(t){return A.error("Fetch Categories:",t),[]}}toJSON(){return this.#n}};w();var tt=class{#t;#e;#n={};id="";type="";name="";description;image;startDate;endDate;showDate;constructor(t,e){this.#e=e,this.#t=t,Object.assign(this,e)}location(){let t=this.#n.location;if(typeof t<"u")return t;let e,n=this.#t._locationsById,r=this.#e.location;if(null!=r){let t=n[r];null!=t&&(e=t)}return this.#n.location=e,e}static hydrate(t,e){return t.map((t=>new tt(e,t)))}static async fetch(t){let e=t.options.things.events.slice();t.options.things.locations&&fe(e,"location");let n={fields:e,venue:t.options.venue,activeAtOrAfter:Date.now()};try{return(await ye(t.options,"event",n)).map((e=>new tt(t,e)))}catch(t){return A.error("Fetch Events:",t),[]}}toJSON(){return this.#e}};w();var pt=class{#t;constructor(t){this.#t=t,Object.assign(this,t)}static hydrate(t){return t.map((t=>new pt(t)))}id="";name="";value="";static async fetch(t){let e={fields:t.options.things.locationStates.slice(),venue:t.options.venue};try{return(await ye(t.options,"location-state",e)).map((t=>new pt(t)))}catch(t){return A.error("Fetch Location States:",t),[]}}toJSON(){return this.#t}};w(),w();var vt=class{map;get x(){return this.#e("x")}get y(){return this.#e("y")}get lat(){return this.#t("lat")}get lon(){return this.#t("lon")}#t(t){if(this.#s&&this.#o)return"lat"===t?this.#s:this.#o;if(null!=this.#l&&null!=this.#u){let[e,n]=this.#a(this.#l,this.#u);return this.#s=e,this.#o=n,"lat"===t?this.#s:this.#o}throw Error("MappedinCoordinate is missing x and y")}#e(t){if(this.#l&&this.#u)return"x"===t?this.#l:this.#u;if(null!=this.#s&&null!=this.#o){let[e,n]=this.#i(this.#s,this.#o);return this.#l=e,this.#u=n,"x"===t?this.#l:this.#u}throw Error("MappedinCoordinate is missing lat and lon")}#n={};#r;#i(t,e){let n=this.map.georeference[0],r=new S(n.target.x,n.target.y),i=new S(t,e),a=r.distanceTo(i),s=(r.finalBearingTo(i)+360)%360*Math.PI/180||0,o=a*(1/this.map.scale),l=s+this.map.getNorth(),u=Math.sin(l)*o,h=Math.cos(l)*o;return[n.control.x+u,n.control.y-h]}#a(t,e){let n,r=this.map.georeference[0],i=new S(r.target.x,r.target.y),a=t-r.control.x,s=r.control.y-e,o=Math.atan2(a,s);n=0===a&&0===s?0:0===a?s:a/Math.sin(o);let l=o-this.map.getNorth(),u=n/this.map._scale,h=i.destinationPoint(u,180*l/Math.PI);return[h.lat,h.lon]}constructor(t){let{map:e,mappedin:n}=t;null!=t.lat&&null!=t.lon&&(this.#s=t.lat,this.#o=t.lon),null!=t.x&&null!=t.y&&(this.#l=t.x,this.#u=t.y),this.map=e,this.#r=n}#s;#o;#l;#u;absoluteDistanceTo(t){return vn([t.lat,t.lon],[this.lat,this.lon])}get nearestNode(){let t=this.#n.nearestNode;if(typeof t<"u")return t;let e=Pe.instances.get(this.#r).findNearestNodeOnMap(this.map.id,this);return this.#n.nearestNode=e,e}toJSON(){return{x:this.x,y:this.y,map:this.map,lat:this.lat,lon:this.lon}}},at=class{#t;#e={};#n;id="";group="";name="";shortName="";elevation=0;scale=0;layers;x_scale;perspectiveId;scene;width=0;height=0;georeference=[];constructor(t,e){this.#t=t,this.#n=e,Object.assign(this,e),this._scale=Mn(this),this.scale=this.x_scale||1/this._scale}_scale=0;get polygons(){return Pe.instances.get(this.#t)?.polygonsByMapId?.get(this.id)??[]}get locations(){return Pe.instances.get(this.#t)?.locationsByMapId?.get(this.id)??[]}get nodes(){return Pe.instances.get(this.#t)?.nodesByMapId?.get(this.id)??[]}get mapGroup(){let t=this.#e.mapGroup;if(typeof t<"u")return t;let e=this.group,n=e&&this.#t._mapGroupsById[e]||null;return this.#e.mapGroup=n,n}createCoordinateByXY(t,e){return new vt({x:t,y:e,map:this,mappedin:this.#t})}createCoordinate(t,e){return new vt({lat:t,lon:e,map:this,mappedin:this.#t})}getNorth(){let t;try{let e=this.georeference[0],n=this.georeference[2],r=new S(e.target.x,e.target.y),i=new S(n.target.x,n.target.y);t=-((r.finalBearingTo(i)+0)*Math.PI/180-Math.atan2(n.control.y-e.control.y,n.control.x-e.control.x)-Math.PI/2)}catch(e){t=0,A.warn(e),A.warn(`Couldn't georeference ${this.name||this.shortName||this.id}. Probably not enough geocoordinates.`)}return t}static hydrate(t,e){return t.map((t=>new at(e,t)))}static async fetch(t){let e=t.options.things.maps.slice();t.options.perspective&&fe(e,"perspectives"),t.options.things.mapGroups&&fe(e,"group"),fe(e,"elevation"),fe(e,"x_scale"),fe(e,"scale"),fe(e,"georeference");let n={fields:e,perspective:t.options.perspective,venue:t.options.venue};try{let i=await ye(t.options,"map",n),a=t=>{let e=r.layers.find((e=>e.id===t));e?e.visible=!0:r.layers.push({id:t,visible:!0})};for(let n=0,s=i.length;n<s;++n){var r=i[n];if(r){let t=r.perspective;null!=t&&(r.perspectiveId=t.id,e.indexOf("scene")>-1&&(r.scene=t.scene),t.layers?(r.layers.forEach((t=>{t.visible=!1})),t.layers.forEach(a)):r.layers.forEach((t=>{t.visible=!0}))),delete r.perspective}i[n]=new at(t,r)}return i}catch(t){return A.error("Fetch Maps:",t),[]}}toJSON(){return this.#n}};w();var nt=class{#t;#e;#n={};id="";name="";constructor(t,e){this.#e=e,this.#t=t,Object.assign(this,e)}get maps(){let t=this.#n.maps;if(typeof t<"u")return t;let e=[],{maps:n}=this.#t,{id:r}=this.#e;for(let t=0,i=n.length;t<i;++t){let i=n[t];i.group===r&&e.push(i)}return this.#n.maps=e,e}static hydrate(t,e){return t.map((t=>new nt(e,t)))}static async fetch(t){let e={fields:t.options.things.mapGroups.slice(),venue:t.options.venue};try{return(await ye(t.options,"map-group",e)).map((e=>new nt(t,e)))}catch(t){return A.error("Fetch Map Groups:",t),[]}}toJSON(){return this.#e}};w();var it=class extends $e{#t;#e;#n={};id="";x=0;y=0;operationHours;externalId;constructor(t,e){super(t),this.#t=t,this.#e=e;let n=Object.assign({},e);delete n.map,Object.assign(this,n)}get map(){let t=this.#n.map;if(typeof t<"u")return t;let e=this.#t.getCollectionItemById("maps",this.#e.map);return this.#n.map=e,e}get lat(){let t=this.#n.cachedLatLon;if(null!=t)return t.lat;let e=this.#t._mapsById?.[this.map.id];if(null==e)throw new Error("Map not found");return this.#n.cachedLatLon=e.createCoordinateByXY(this.x,this.y),this.#n.cachedLatLon.lat}get lon(){let t=this.#n.cachedLatLon;if(null!=t)return t.lon;let e=this.#t._mapsById?.[this.map.id];if(null==e)throw new Error("Map not found");return this.#n.cachedLatLon=e.createCoordinateByXY(this.x,this.y),this.#n.cachedLatLon.lon}#r;get paths(){let t=this.#n.paths;if(typeof t<"u")return t;let e=[],n=this.#t._nodesById,r=this.#r;if(Array.isArray(r))for(let t=0,i=r.length;t<i;++t){let i=n[r[t].node];null!=i&&e.push(i)}return this.#n.paths=e,e}set paths(t){this.#r=t}get locations(){let t=this.#n.locations;if(typeof t<"u")return t;let e=[],n=Pe.instances.get(this.#t)?.locationsByMapId?.get(this.map.id)??[],r=this.id;for(let t=0,i=n.length;t<i;++t){let i=n[t],a=i.nodes;if(Array.isArray(a))for(let t=0,n=a.length;t<n;++t)if(a[t].id===r){e.push(i);break}}return this.#n.locations=e,e}get polygon(){let t=this.#n.polygon;if(typeof t<"u")return t;let e,n=Pe.instances.get(this.#t)?.polygonsByMapId?.get(this.map.id)??[],r=this.id;for(let t=0,i=n.length;t<i;++t){let i=n[t];i.entrances.map((t=>t.id)).includes(r)&&(e=i)}return this.#n.polygon=e,e}static hydrate(t,e){return t.map((t=>new it(e,t)))}static async fetch(t){let e=t.options.things.nodes.slice();t.options.things.maps&&fe(e,"map"),["weight","multiplier","accessible"].forEach((function(t){fe(e,t)}));let n={fields:e,venue:t.options.venue};try{return(await ye(t.options,"node",n)).map((e=>new it(t,e)))}catch(t){return A.error("Fetch Nodes:",t),[]}}toJSON(){return this.#e}};w();var rt=class{#t;constructor(t){this.#t=t,Object.assign(this,t)}polygons=[];static hydrate(t){return new rt(t)}static async fetch(t){try{let e=await xa(t.options,"smart-labels/polygon-label-ranking",{venue:t.options.venue},!0);return new rt(e)}catch(t){return A.error("Fetch Rankings:",t),null}}toJSON(){return this.#t}};w();var ht=class{id="";#t;constructor(t){this.#t=t,Object.assign(this,t)}static hydrate(t){return t.map((t=>new ht(t)))}static async fetch(t){let e={fields:t.options.things.themes.slice(),venue:t.options.venue};try{return(await ye(t.options,"apollo-theme",e)).map((t=>new ht(t)))}catch(t){return A.error("Fetch Theme:",t),[]}}toJSON(){return this.#t}};w();var st=class{#t;#e;#n={};defaultMap="";address="";city="";countrycode="";externalId="";id="";latitude;logo;longitude;metadata;name="";operationHours;postal="";slug="";state="";telephone="";tzid="";tzidOverride="";utcOffset="";website="";constructor(t,e){this.#e=t,this.#t=e,Object.assign(this,e)}static hydrate(t,e){return new st(e,t)}static async fetch(t){let e={fields:t.options.things.venue,slug:t.options.venue,limit:1};try{let n=await ye(t.options,"venue",e);return new st(t,n[0])}catch(t){return A.error("Fetch Venue:",t),{}}}get isMultiBuilding(){if(null==this.#n.isMultiBuilding){let t=this.#e.maps,e=t.reduce(((t,e)=>t.add(e.elevation)),new Set),n=t.length!==e.size;this.#n.isMultiBuilding=n}return this.#n.isMultiBuilding}toJSON(){return this.#t}};w();var ot=class{id="";#t;name;type;weight;multiplier;constructor(t){this.#t=t,Object.assign(this,t)}static hydrate(t){return t.map((t=>new ot(t)))}static async fetch(t){let e=t.options.things.vortexes.slice();["name","type","accessible","weight","multiplier","nodes"].forEach((function(t){fe(e,t)}));let n={fields:e,venue:t.options.venue};try{return(await ye(t.options,"vortex",n)).map((t=>new ot(t)))}catch(t){return A.error("Fetch Vortexes:",t),[]}}toJSON(){return this.#t}};function Ii(t,e){let n=[];return t.features.forEach((t=>{let r=[];t.properties.spaces?.forEach((t=>{if("id"in t){let n;n=e.get(t.id),n&&r.push(...n)}else r?.push({id:t.node,level:""})}));let i=r.map((t=>({node:"n_"+t.id,map:t.level}))),a=t.properties.spaces?.filter((t=>"id"in t)),s=(t.properties.hours||[]).map((t=>({...t,"@type":"OpeningHoursSpecification",dayOfWeek:[t.dayOfWeek.replace("http://schema.org/","")]}))),o={...t.properties,polygons:a||[],nodes:i||[],description:t.properties.description||"",logo:t.properties.logo||{},picture:t.properties.picture||{},phone:t.properties.phone||{},social:t.properties.social||{},externalId:t.properties.externalId||"",states:t.properties.states||[],siblingGroups:t.properties.siblingGroups||[],operationHours:s};delete o.spaces,n.push(o)})),n}function Oi(t){let e=new Set;return t.features.forEach((t=>{t.properties.states?.forEach((t=>{e.add(t.type)}))})),Array.from(e).map((t=>({id:t,name:t,value:t})))}function zi(t){let e=[];return t.features.forEach((t=>{let n={...t.properties,icon:t.properties.picture};delete n.picture,e.push(n)})),e}function Ni(t){let e=1/0,n=1/0,r=-1/0,i=-1/0;return t.features.forEach((t=>{let a;a="MultiPolygon"===t.geometry.type?t.geometry.coordinates[0].flat():t.geometry.coordinates[0],a.forEach((t=>{e=Math.min(e,t[1]),r=Math.max(r,t[1]),n=Math.min(n,t[0]),i=Math.max(i,t[0])}))})),{id:t.features[0].properties.id,minLat:e,minLong:n,maxLat:r,maxLong:i}}function _i(t,e,n){let r=n.createGeoreferences(),i=[];return t.features.forEach((t=>{let a=new Set;e.forEach((t=>{t.layer&&a.add(t.layer)}));let s=[...a].map((t=>({id:t,visible:!0}))),o=1/n.mapScale,l={...t.properties,georeference:r,shortName:t.properties.abbreviation||"",scene:{polygons:e},scale:o,x_scale:o,group:t.properties.building,layers:s,width:n.widthInMapUnits,height:n.heightInMapUnits};i.push(l)})),i}w();var Oa=class{mapExtent;stretchRatio;midLat;midLong;mapUnitRatio=1e6;latDistance;longDistance;mapScale;widthInMapUnits;heightInMapUnits;constructor(t){this.mapExtent=t;let{minLat:e,minLong:n,maxLat:r,maxLong:i}=t,a=(e+r)/2,s=(n+i)/2,o=new S(a,i),l=new S(a,n),u=new S(e,s),h=new S(r,s);this.latDistance=u.distanceTo(h),this.longDistance=o.distanceTo(l);let c=this.latDistance/this.longDistance,d=(r-e)/(i-n);this.stretchRatio=c/d,this.midLat=a,this.midLong=s,this.widthInMapUnits=(i-n)*this.mapUnitRatio,this.heightInMapUnits=(r-e)*this.mapUnitRatio*this.stretchRatio,this.mapScale=this.widthInMapUnits/this.longDistance}convert(t){let e=t[1];return{x:(t[0]-this.midLong)*this.mapUnitRatio,y:(this.midLat-e)*this.mapUnitRatio*this.stretchRatio}}createGeoreferences(){let{minLat:t,minLong:e,maxLat:n,maxLong:r}=this.mapExtent;return[[t,e],[t,r],[n,r],[n,e]].map((t=>({target:{x:t[0],y:t[1]},control:this.convert([t[1],t[0]])})))}};function Ei(t,e){let n=[];return t.features.forEach((t=>{let r=e.convert(t.geometry.coordinates),i=(t.properties.neighbors||[]).map((e=>({node:e,map:t.properties.level}))),a=t.properties.level,s={...t.properties,x:r.x,y:r.y,paths:i,map:a,externalId:t.properties.externalId||""};n.push(s)})),n}var jn=(t,e,n,r,i)=>{let a=[];return t.features.forEach((t=>{if(!t.geometry.coordinates[0].forEach)return;let s=[];"entrances"in t.properties&&(s=t.properties.entrances.map((t=>({id:"n_"+t.id,node:"n_"+t.id,map:t.level}))));let o,l=n[t.properties.id],u=e.find((t=>t.id===l)),h=t.geometry.coordinates[0].map((t=>i.convert(t))),c=r.find((e=>e.polygonId===t.properties.id)),d=Math.max(i.widthInMapUnits,i.heightInMapUnits)/1e3;if(c){let t=i.convert([c.position[0],c.position[1]]),e=c.size.x,n=c.size.y,r=i.mapScale,a=n*r,s=e*r/d/c.viewBox.width,l=a/d/c.viewBox.height;o={url:u?.image,visible:!!u?.image,viewBox:c.viewBox,scale:{x:s,y:l},position:{x:t.x,y:t.y},rotation:c.rotation,useLocalScaling:!1,_isAbsolutelyPositioned:!0}}let p={...t.properties,entrances:s,map:t.properties.level,externalId:t.properties.externalId||"",geometry:{visible:!0,position:{x:0,y:0,z:(u?.altitude||0)*i.mapScale/d},scale:{x:1,y:1,z:(u?.height||1)*i.mapScale/d}},material:{color:u?.color||"#000000"},image:o,vertexes:h};a.push(p)})),a};function Ai(t,e,n,r,i,a){let s=jn(t,n,r,i,a),o=jn(e,n,r,i,a);return s.concat(o)}function Si(t){let e=new Map;return t.forEach((t=>{t.features.forEach((t=>{let{destinations:n}=t.properties;if(0===n.length)return;let r=n[0].split("-")[0],i=e.get(r),a=n.map((t=>t.split("-")[1])).map((t=>"n_"+t));if(i)i.nodes.push(...a);else{let{name:n,type:i,weight:s,multiplier:o,accessible:l}=t.properties,u={id:r,nodes:a,name:n,type:i,weight:s,multiplier:o,accessible:l};e.set(r,u)}}))})),Array.from(e.values())}function Fi(t){let e=[];return t.features.forEach((t=>{let n={...t.properties};e.push(n)})),e}function xn(t){let e=Array.from(t.connection.values()),n=Array.from(t.level.values()),r=t.building,i=t.category,a=t.style,s=t.location,o=t.imageInstance,l=t.polygonStyle,u={},h=[],c=new Map;n.forEach((e=>{let n=e.features[0].properties.id,r=Ni(e),i=new Oa(r);c.set(n,i);let s=t.obstruction.get(n),d=t.space.get(n),p=o.get(n),f=l.get(n);u[n]=Ai(d,s,a,f,p,i);let g=t.node.get(n);h.push(...Ei(g,i))}));let d=Object.values(u).flat(),p=Si(e),f=n.map((t=>{let e=t.features[0].properties.id,n=c.get(e);return _i(t,u[e],n)})).flat(),g=new Map;Array.from(t.space.values()).forEach((t=>{t.features.forEach((t=>{g.set(t.properties.id,t.properties.entrances)}))}));let y=Fi(r),m=Ii(s,g),v=zi(i),_=Oi(s),w=t.manifest.features[0].properties.name,M=t.manifest.features[0].geometry.coordinates[0],b=t.manifest.features[0].geometry.coordinates[1],x=t.imageBinaries;return{locations:m,categories:v,nodes:h,maps:f,polygons:d,vortexes:p,mapGroups:y,locationStates:_,themes:[],venue:{name:w,latitude:b,longitude:M},imageBinaries:x}}w(),w(),w(),w();var mt,Re,Be,za=[0,4,6,8,10],We=()=>{let t=new Array(16).fill(0),e=4294967296*Math.random();for(let n=0;n<t.length;n++)n>0&&!(3&n)&&(e=4294967296*Math.random()),t[n]=e>>>((3&n)<<3)&255;let n=t.map((t=>t.toString(16).padStart(2,"0")));return n[6]="4"+n[6][1],n[8]=["8","9","a","b"].includes(n[7][0])?n[7]:"a"+n[7][1],za.map(((t,e)=>n.slice(t,e===za.length-1?void 0:za[e+1]).join(""))).join("-")},Tn="mi-session-data",In="mi-local-data",Na=class{constructor(){ve(this,Re,void 0),ve(this,Be,void 0);try{let t=sessionStorage.getItem(Tn);ue(this,Re,t?JSON.parse(t):{id:We()})}catch{ue(this,Re,{id:We()})}try{let t=localStorage.getItem(In);ue(this,Be,t?JSON.parse(t):{deviceId:We()})}catch{ue(this,Be,{deviceId:We()})}C(this,Re).id||(C(this,Re).id=We()),C(this,Be).deviceId||(C(this,Be).deviceId=We())}static getInstance(){return C(this,mt)||ue(this,mt,new Na),C(this,mt)}static ___clearInstance(){ue(this,mt,void 0)}saveSessionData(t,e){C(this,Re)[t]=e;try{return sessionStorage.setItem(Tn,JSON.stringify(C(this,Re))),!0}catch{return!1}}loadSessionData(t){let e=C(this,Re)[t];if(null!=e)return e}saveLocalData(t,e){C(this,Be)[t]=e;try{return localStorage.setItem(In,JSON.stringify(C(this,Be))),!0}catch{return!1}}loadLocalData(t){let e=C(this,Be)[t];if(null!=e)return e}},Mt=Na;function On(t){return/^[\da-f]{24}$/i.test(t)}function zn(){return Mt.getInstance().loadLocalData("deviceId")}function Nn(){return Mt.getInstance().loadSessionData("id")}mt=new WeakMap,Re=new WeakMap,Be=new WeakMap,ve(Mt,mt,void 0);var Bt,wt,jt,Dt,xt,Tt,It,gt,Gt,Ot,zt,qt,Jn=Zt(Yn(),1),Ui=_?.env?.npm_package_version,Aa=["websdk","web","webv2"],Sa="websdk",Fa=class{constructor(t){ve(this,Bt,void 0),ve(this,wt,void 0),ve(this,jt,void 0),ve(this,Dt,void 0),ve(this,xt,void 0),ve(this,Tt,void 0),ve(this,It,void 0),ve(this,gt,void 0),ve(this,Gt,void 0),ve(this,Ot,void 0),ve(this,zt,void 0),ve(this,qt,void 0),ue(this,gt,t.clientId),ue(this,Gt,t.clientSecret),ue(this,Ot,t.accessToken),ue(this,It,t.noAuth||!1);let e="https://api-gateway.mappedin.com/track-analytics/a/";!C(this,It)&&C(this,gt)&&!On(C(this,gt))&&(e="https://web-proxy.mappedin.com/a/"),ue(this,jt,e),ue(this,jt,C(this,jt)+(t.venue+"/")),ue(this,wt,!1),ue(this,Bt,"boolean"==typeof t.testMode?t.testMode:"true"===t.testMode?.toLowerCase()),ue(this,Dt,Aa.find((e=>e===t.context))||Aa[0]),ue(this,xt,zn()),ue(this,Tt,Nn()),ue(this,zt,new Set),ue(this,qt,t.platformString||""),this.locationSelected=this.locationSelected.bind(this),this.categorySelected=this.categorySelected.bind(this),this.getDirections=this.getDirections.bind(this)}track(t,e){if(C(this,Bt))return;let n={...e,g:C(this,wt)},r=C(this,jt)+t+"?"+Jn.default.stringify(n),i={"mi-context":Sa||C(this,Dt),"mi-session":C(this,Tt),"mi-device":C(this,xt),"mappedin-sdk-version":Ui,"mappedin-platform-version":C(this,qt)};C(this,Ot)?i.Authorization=`Bearer ${C(this,Ot)}`:C(this,It)||(i.Authorization=`Basic ${btoa(`${C(this,gt)}:${C(this,Gt)}`)}`),Rt()(r,{method:"GET",mode:"cors",headers:i})}locationSelected(t){let e=t.id||t;this.track("select-location",{id:e})}categorySelected(t){let e=t.id||t;this.track("select-category",{id:e})}mapViewLoaded(t,e,n,r){this.track("load-mapview",{type:t,force:e,benchmark:n||-1,reason:r||"success"})}getDirections(t,e){let n={start:t.id,end:e.id,type:"location_to_location"};this.track("query-directions",n)}getSessionID(){return C(this,Tt)}getDeviceID(){return C(this,xt)}setGeolocationMode(t){ue(this,wt,t)}trackBlueDotEvent(t){t&&Object.values(Fa.BLUEDOT_EVENT).includes(t)&&!C(this,zt).has(t)?(this.track(t),C(this,zt).add(t)):A.warn(`Ignored unsupported blue dot event: "${t}".`)}trackSearch(t){null!=t&&this.track("query-search",t)}trackSearchSuggest(t){null!=t&&this.track("query-suggest",t)}static setContext(t){let e=Aa.find((e=>e===t));e&&(Sa=e)}static clearContext(){Sa=void 0}},ia=Fa;Bt=new WeakMap,wt=new WeakMap,jt=new WeakMap,Dt=new WeakMap,xt=new WeakMap,Tt=new WeakMap,It=new WeakMap,gt=new WeakMap,Gt=new WeakMap,Ot=new WeakMap,zt=new WeakMap,qt=new WeakMap,Ee(ia,"BLUEDOT_EVENT",{ATTEMPT_BLUEDOT:"attempt-bluedot",FOUND_POSITION:"found-position",FOUND_FLOOR:"found-floor"});var ra=ia,Xn={supplementaryUrl:"https://api-gateway.mappedin.com/analytics/",headers:{},accessToken:"",clientId:"",noAuth:!1,includeHidden:!0,clientSecret:"",apiGateway:"",authorization:"",perspective:"Website",language:"",things:{},venue:""},Nt={categories:qe,locations:Ce,vortexes:ot,maps:at,nodes:it,polygons:Ge,venue:st,events:tt,mapGroups:nt,themes:ht,locationStates:pt,rankings:rt},lt=class{perspective;things;options;#t;#e="";updatedAt;categories=[];locations=[];vortexes=[];maps=[];nodes=[];polygons=[];venue={};events=[];mapGroups=[];themes=[];locationStates=[];rankings;_categoriesById;_locationsById;_vortexesById;_mapsById;_nodesById;_polygonsById;_eventsById;_mapGroupsById;_locationStatesById;_locationRankingsById;_rankingsById;_categoriesByExternalId;_locationsByExternalId;_vortexesByExternalId;_mapsByExternalId;_nodesByExternalId;_polygonsByExternalId;_eventsByExternalId;_mapGroupsByExternalId;_locationStatesByExternalId;_locationRankingsByExternalId;_rankingsByExternalId;generateGetters(t){try{for(let e=0,n=t.length;e<n;++e){let n=t[e];Array.isArray(this[n])&&(Object.defineProperty(this,`_${n}ByExternalId`,{get(){let t=this.#t[n];if(null!=t)return t;let e={};return this[n].forEach((t=>e[t.externalId]=t)),this.#t[n]=e,e}}),Object.defineProperty(this,`_${n}ById`,{get(){let t=this.#t[n];if(null!=t)return t;let e={};return this[n].forEach((t=>e[t.id]=t)),this.#t[n]=e,e}}))}return this}catch(t){throw new Error("Unable to generate getters, "+t)}}getCollectionItemById(t,e){let n=`_${t}ByExternalId`,r=this[`_${t}ById`];return null!=r&&null!=r[e]||(r=this[n],null!=r&&null!=r[e])?r[e]:null}async hydrateFromMVF(t){let e=xn(t);return this.hydrate(e)}async hydrate(t,e){let n;if("string"==typeof t)try{this.#e=t,n=JSON.parse(t)}catch(t){return void A.error("Unable to parse JSON",t)}else n=t,this.#e=JSON.stringify(n);let r=Object.keys(n);for(let t=0,e=r.length;t<e;++t){let e=r[t],i=n[e];null!=Nt[e]&&"function"==typeof Nt[e].hydrate&&(this[e]=Nt[e].hydrate(i,this))}e&&await wn(n);let{images:i,scenes:a,imageBinaries:s}=n;this.images=i,this.scenes=a,this.imageBinaries=s,this.generateGetters(r),this.initNavigator()}images;imageBinaries;scenes;async fetch(){"vortexes"in this.options.things||(this.options.things.vortexes=["name","type","accessible","weight","multiplier","nodes"]),"locationStates"in this.options.things||(this.options.things.locationStates=["name","id","value"]),bn(this.options.clientId)||this.options.things.rankings&&delete this.options.things.rankings;let{things:t}=this.options,e=[],n=Object.keys(t);for(let t=0,r=n.length;t<r;++t){let r=n[t];Nt[r]&&e.push(Nt[r].fetch(this).then((t=>(this[r]=t,Promise.resolve()))))}return this.generateGetters(n),Promise.all(e).then((()=>{this.initNavigator()}))}constructor(t){this.options=t,this.#t=Pe.create(this);let e=new ra({...t,testMode:!t?.emitAnalyticsEvents});this.analytics={locationSelected:e.locationSelected,categorySelected:e.categorySelected,getDirections:e.getDirections},globalThis.MappedinDebug||(globalThis.MappedinDebug={enable(){globalThis.sessionStorage.setItem(fa,"true")}})}analytics;navigator;initNavigator(){this.navigator=new Ma({locations:this.locations.map((t=>t.toJSON())),nodes:this.nodes.map((t=>t.toJSON())),vortexes:this.vortexes.map((t=>t.toJSON())),maps:this.maps.map((t=>t.toJSON()))})}toJSON(){let t={};for(let e in Nt)Array.isArray(this[e])&&(t[e]=this[e].map((t=>t.toJSON())));let e={...t,venue:this.venue.toJSON()};return null!=this.rankings&&(e.rankings=this.rankings?.toJSON()),delete e.locationRankings,e}toString(){return this.#e||JSON.stringify(this.toJSON())}};w();var Kn={venue:["slug","name","defaultMap","metadata","countrycode","tzid","logo","externalId"],nodes:["externalId","x","y","paths","accessible","operationHours"],vortexes:["externalId","nodes","types","accessible"],polygons:["vertexes","geometry","canvasBounds","layer","externalId","entrances"],locations:["externalId","name","type","picture","description","icon","logo","sortOrder","phone","operationHours","social","color","toMap","tags","shortName","detailsUrl","locationState","metadata","siblingGroups","gallery"],categories:["name","color","sortOrder","parents"],maps:["name","elevation","height","width","layers","shortName","scene","group","x_scale"],mapGroups:["name"],themes:["name","themeData"],rankings:["polygons"]};w();var ft=Zt(Zn(),1);w();var $i=["0","1","2","3","4","5","6","7","8","9"],Wi=["۱","۲","۳","۴","۵","۶","۷","۸","۹","۰"],Hi=["0","1","2","3","4","5","6","7","8","9"],Yi=["၀","၁","၂","၃","၄","၅","၆","၇","၈","၉"],wu=[...$i,...Wi,...Hi,...Yi],Qn=["about","after","all","also","am","an","and","another","any","are","as","at","be","because","been","before","being","between","both","but","by","came","can","come","could","did","do","each","for","from","get","got","has","had","he","have","her","here","him","himself","his","how","if","in","into","is","it","like","make","many","me","might","more","most","much","must","my","never","now","of","on","only","or","other","our","out","over","said","same","should","since","some","still","such","take","than","that","the","their","them","then","there","these","they","this","those","through","to","too","under","up","very","was","way","we","well","were","what","where","which","while","who","with","would","you","your","a","i"];w();var Ji=32,Se=!1,Xi=120,La=0,sa=class{constructor(t){this._callback=t.callback,this._frameCount=null!=t.frameCount?t.frameCount:1,this._ordering=null!=t.ordering?t.ordering:0,this._supersededBy=null!=t.supersededBy?new Set(t.supersededBy):new Set,this.name=t.name,this.userdata=t.userdata,this._remainingFrameCount=this._frameCount,this._lastFrameTime=0,Se&&A.log("update instantiated",this.name)}_callback;_frameCount;_ordering;_supersededBy;name;_remainingFrameCount;_lastFrameTime;userdata;getLastFrameTime(){return this._lastFrameTime}},Ye=class{constructor(t){if(null!=t.group&&null!=t.priority)throw new Error("cannot specify task priority individually within group");if(null!=t.group&&null!=t.postponeOnAdd)throw new Error("cannot specify task postpone individually within group");this._callback=t.callback,this._group=null!=t.group?t.group:null,this._priority=null!=t.priority?t.priority:0,this._postponed=null!=t.postponeOnAdd&&t.postponeOnAdd,this.name=t.name,this.userdata=t.userdata,this._complete=!1,this._scheduled=!1,this._cancelled=!1,this._lastFrameTime=0,Se&&A.log("task instantiated",this.name)}_postponed;userdata;_priority;_group;name;_lastFrameTime;_callback;_complete;_scheduled;_cancelled;isComplete(){return this._complete}getLastFrameTime(){return this._lastFrameTime}},oa=class{constructor(t){this._onComplete=null!=t.onComplete?t.onComplete:()=>{},this._priority=null!=t.priority?t.priority:0,this._postponed=null!=t.postponeOnAdd&&t.postponeOnAdd,this.name=t.name,this.userdata=t.userdata,this._tasks=new Set,this._scheduledTasks=new Set,this._scheduled=!1,this._cancelled=!1,Se&&A.log("task group instantiated",this.name)}_postponed;_onComplete;_priority;userdata;name;_tasks;_scheduledTasks;_scheduled;_cancelled;isComplete(){return 0===this._scheduledTasks.size}getTasks(){return Array.from(this._tasks.values())}clear(){this._tasks.clear(),this._scheduledTasks.clear()}_popTask(){for(let t of this._scheduledTasks)return this._scheduledTasks.delete(t),t}},Ra=class{_maxMillisecondsPerFrame;_time;constructor(t){this._maxMillisecondsPerFrame=null!=t?.maxMillisecondsPerFrame?t.maxMillisecondsPerFrame:Ji,this._time=0}beginFrame(){this._time=performance.now()+this._maxMillisecondsPerFrame}hasTimeRemaining(){return performance.now()<=this._time}},la=class{constructor(t){this._timer=null!=t?.timer?t.timer:new Ra,this._performance=null!=t?.performance&&t.performance,this._scheduledUpdatesByOrdering=new _t,this._scheduledTasksByPriority=new _t,this._postponedTasks=new Set,this._requestAnimationFrameHandle=null,this._updatesToRunThisFrame=[],this._lastFrameTime=0,this._updatesRunLastFrame=new Set,this.update=this.update.bind(this),Se&&A.log("task scheduler instantiated"),globalThis.MappedinDebug?.TEST_IOS&&(this._raf=t=>setTimeout(t,16))}_raf;_timer;_performance;_scheduledUpdatesByOrdering;_scheduledTasksByPriority;_postponedTasks;_requestAnimationFrameHandle;_updatesToRunThisFrame;_lastFrameTime=0;_updatesRunLastFrame;clear(){for(let t of this._scheduledTasksByPriority.values())t._cancelled=!0;for(let t of this._postponedTasks.values())t._cancelled=!0;this._scheduledUpdatesByOrdering=new _t,this._scheduledTasksByPriority=new _t,this._postponedTasks=new Set,this._lastFrameTime=0,this._updatesRunLastFrame.clear(),Se&&A.log("task scheduler cleared")}destroy(){this.clear()}requestAnimationFrame(){null==this._requestAnimationFrameHandle&&(this._requestAnimationFrameHandle="function"==typeof this._raf?this._raf(this.update):requestAnimationFrame(this.update))}update(t){let e;this._timer.beginFrame(),this._performance&&(e=performance.now());let n=!1;Se&&(0===La&&(n=!0),++La,La%=Xi);let r=this._scheduledUpdatesByOrdering.keys();for(let t=r.length-1;t>=0;--t){let e=r[t];for(let t of this._scheduledUpdatesByOrdering.get(e).values())this._updatesToRunThisFrame.push(t),n&&A.log("update scheduled to run this frame",t.name)}for(let t of this._updatesToRunThisFrame){--t._remainingFrameCount,t._remainingFrameCount<=0&&this._scheduledUpdatesByOrdering.delete(t._ordering,t),t._superseded=!1;for(let e of this._updatesToRunThisFrame)t._supersededBy.has(e)&&(t._superseded=!0,n&&A.log("update superseded",t.name,e.name))}for(let t=0;t<this._updatesToRunThisFrame.length;++t)this._updatesToRunThisFrame[t]._superseded&&(this._updatesToRunThisFrame.splice(t,1),--t);for(let e of this._updatesToRunThisFrame){let r;this._performance&&(r=performance.now()),e._callback(t),this._performance&&(e._lastFrameTime=performance.now()-r),n&&A.log("update completed",e.name)}this._updatesRunLastFrame.clear();for(let t of this._updatesToRunThisFrame)this._updatesRunLastFrame.add(t);if(this._updatesToRunThisFrame.splice(0,this._updatesToRunThisFrame.length),this._scheduledTasksByPriority.size>0)do{this._executeOneTask(t)}while(this._timer.hasTimeRemaining()&&this._scheduledTasksByPriority.size>0);this._performance&&(this._lastFrameTime=performance.now()-e),this._requestAnimationFrameHandle=null,(this._scheduledUpdatesByOrdering.size>0||this._scheduledTasksByPriority.size>0)&&this.requestAnimationFrame()}flushTasks(){for(;this._scheduledTasksByPriority.size>0;)this._executeOneTask(performance.now())}getLastFrameTime(){return this._lastFrameTime}getUpdatesRunLastFrame(){return this._updatesRunLastFrame}_executeOneTask(t){let e,n=this._scheduledTasksByPriority.popFromMaxKey(),r=null;A.assert(void 0!==n),Object.getPrototypeOf(n)===oa.prototype&&(r=n,n=r._popTask()),A.assert(void 0!==n),A.assert(Object.getPrototypeOf(n)===Ye.prototype),this._performance&&(e=performance.now()),n._callback(t),n._complete=!0,this._performance&&(n._lastFrameTime=performance.now()-e),Se&&A.log("task completed",n.name),null!=r&&(r.isComplete()?(r.clear(),r._onComplete(),Se&&A.log("group completed",r.name)):this._scheduledTasksByPriority.insert(r._priority,r))}scheduleUpdate(t){t._remainingFrameCount=t._frameCount,this._scheduledUpdatesByOrdering.insert(t._ordering,t),this.requestAnimationFrame()}scheduleTask(t){if(Object.getPrototypeOf(t)===oa)throw new Error("frame task groups are automatically scheduled when a task is added to them and cannot be manually scheduled: "+t.name);if(t._scheduled)throw new Error("cannot schedule already scheduled task: "+t.name);if(t._cancelled)throw new Error("cannot schedule cancelled task: "+t.name);let e=t;"_group"in t&&null!=t._group&&(t._group._tasks.add(t),t._group._scheduledTasks.add(t),e=t._group),e._postponed?this._postponedTasks.add(e):this._scheduledTasksByPriority.insert(e._priority,e),t._scheduled=!0,e._scheduled=!0,Se&&A.log("task scheduled",t.name),this.requestAnimationFrame()}cancelUpdate(t){this._scheduledUpdatesByOrdering.delete(t._ordering,t),Se&&A.log("update cancelled",t.name)}cancelTask(t){if(!t._scheduled)throw new Error("cannot cancel task that has not been scheduled: "+t.name);if(t._cancelled)throw new Error("cannot cancel task that has already been cancelled: "+t.name);if("_group"in t&&null!=t._group){let e=t._group.isComplete();t._group._tasks.delete(t),t._group._scheduledTasks.delete(t),t._group.isComplete()&&(this._scheduledTasksByPriority.delete(t._group._priority,t._group),e||t._group._onComplete())}else this._scheduledTasksByPriority.delete(t._priority,t),this._postponedTasks.delete(t);Object.getPrototypeOf(t)===Ye.prototype?t._cancelled=!0:"clear"in t&&t.clear(),Se&&A.log("task cancelled",t.name)}postponeTask(t){if("_group"in t&&null!=t._group)throw new Error("cannot postpone individual tasks in group: "+t.name);if(t._cancelled)throw new Error("cannot postpone cancelled task: "+t.name);if(!t._postponed){if(Object.getPrototypeOf(t)===Ye.prototype){if("_complete"in t)return;if(!t._scheduled)throw new Error("cannot postpone task that has not been scheduled: "+t.name)}this._scheduledTasksByPriority.delete(t._priority,t),(Object.getPrototypeOf(t)===Ye.prototype||!t.isComplete())&&this._postponedTasks.add(t),t._postponed=!0,Se&&A.log("task postponed",t.name)}}resumeTask(t){if("_group"in t&&null!=t._group)throw new Error("cannot resume individual tasks in groups");if(t._cancelled)throw new Error("cannot resume cancelled task");if(t._postponed){if(Object.getPrototypeOf(t)===Ye.prototype){if("_complete"in t&&t._complete)return;if(!t._scheduled)throw new Error("cannot resume unscheduled task")}this._postponedTasks.delete(t),(Object.getPrototypeOf(t)===Ye.prototype||!t.isComplete())&&this._scheduledTasksByPriority.insert(t._priority,t),t._postponed=!1,this.requestAnimationFrame(),Se&&A.log("task resumed",t.name)}}setTaskPriority(t,e){if(Object.getPrototypeOf(t)===Ye.prototype&&!t._scheduled)throw new Error("task must be scheduled to be reprioritized");this._scheduledTasksByPriority.has(t._priority,t)&&(this._scheduledTasksByPriority.delete(t._priority,t),this._scheduledTasksByPriority.insert(e,t)),t._priority=e,Se&&A.log("task priority changed",t.name,e)}},_t=class{constructor(){this._map=new Map,this._size=0,this._sortedKeys=[]}_map;_size;_sortedKeys;has(t,e){return null!=this._map.get(t)&&this._map.get(t).has(e)}get(t){return this._map.get(t)}insert(t,e){if(A.assert("number"==typeof t&&Number.isFinite(t)),null==this._map.get(t)){this._map.set(t,new Set);for(let e=0;e<=this._sortedKeys.length;++e)if(e===this._sortedKeys.length||t<this._sortedKeys[e]){this._sortedKeys.splice(e,0,t);break}}this._map.get(t).has(e)||(this._map.get(t).add(e),++this._size)}delete(t,e){null!=this._map.get(t)&&this._map.get(t).has(e)&&(this._map.get(t).delete(e),--this._size,0===this._map.get(t).size&&(this._map.delete(t),this._sortedKeys.splice(this._sortedKeys.indexOf(t),1)))}pop(t){if(null!=this._map.get(t)){let e;for(e of this._map.get(t).values()){this._map.get(t).delete(e),--this._size;break}return 0===this._map.get(t).size&&(this._map.delete(t),this._sortedKeys.splice(this._sortedKeys.indexOf(t),1)),e}}popFromMaxKey(){if(this._sortedKeys.length>0)return this.pop(this._sortedKeys[this._sortedKeys.length-1])}values(){let t=this._map.keys(),e=null,n={[Symbol.iterator]:()=>n,next:()=>{if(null==e){let n=t.next();if(n.done)return n;e=this._map.get(n.value).values()}let n=e.next();for(;n.done;){let r=t.next();if(r.done)return r;e=this._map.get(r.value).values(),n=e.next()}return n}};return n}keys(){return this._sortedKeys}get size(){let t=0;for(let e of this._map.values())t+=e.size;return A.assert(t===this._size),t}},Je=t=>t.normalize("NFD").replace(/[\u0300-\u036f|\u2019|\u0027|\']/g,"").toLowerCase(),Et="",Ki=.09,Zi=1,Qi=.025,er=.5,tr=5e-4,ar=5e-4,nr=.01,ir=.05,ei=1,rr=.01,sr=.2,or={MappedinCategory:"categories",MappedinLocation:"locations"},lr={searchDescriptions:!0,searchTags:!0,searchTagsInCategories:!1,searchDescriptionsInCategories:!1,stopWords:Qn,jsonIndex:void 0,useLocationRank:!0,emitAnalyticsEvents:"production"===_.env.NODE_ENV,constants:{PRIMARY_INDEX_FUZZYNESS:Ki,PRIMARY_INDEX_WEIGHT:Zi,SECONDARY_INDEX_WEIGHT:Qi,CATEGORY_NAME_WEIGHT:er,LOCATION_NAME_WEIGHT:ei,CATEGORY_LOCATION_DESCRIPTION_WEIGHT:tr,CATEGORY_LOCATION_TAGS_WEIGHT:ar,CATEGORY_LOCATION_NAME_WEIGHT:nr,PRIMARY_INDEX_TAGS_NAME_WEIGHT:ir,LOCATION_DEFAULT_RANK:ei,RATIO_OF_FUZZY_TO_EXACT:rr,RATIO_OF_PREFIX_TO_EXACT:sr}},Vt=class{#t;#e;#n;#r;#i;#a=new la({performance:!0});#s;#o;#l=new Map;constructor(t,e){this.#o=new ra({...t.options,testMode:!1===e?.emitAnalyticsEvents}),this.#i={...lr,...e},this.#t=t,this.#s=new Set(this.#i?.stopWords);let{PRIMARY_INDEX_FUZZYNESS:n,PRIMARY_INDEX_WEIGHT:r,CATEGORY_NAME_WEIGHT:i,RATIO_OF_FUZZY_TO_EXACT:a,RATIO_OF_PREFIX_TO_EXACT:s,PRIMARY_INDEX_TAGS_NAME_WEIGHT:o}=this.#i.constants,l=["object","query","weight","tag","rank"],u={fields:["query","name","tag"],storeFields:l,searchOptions:{combineWith:"OR",prefix:!0,fuzzy:n},boost:{name:r,query:r,tag:o},weights:{fuzzy:a,prefix:s},boostDocument:t=>t.includes("MappedinLocation")?r:t.includes("MappedinCategory")?i:r},h={fields:["description"],storeFields:l,searchOptions:{combineWith:"AND",prefix:!0,fuzzy:.1},processTerm:(t,e)=>this.#s?.has(t.toLowerCase())?null:t.toLowerCase()},c={fields:["category.locations.description","category.locations.tags","category.locations.name"],storeFields:[...l,"ref","category.locations.tags","category.locations.name","category.locations.description"],searchOptions:{combineWith:"AND",prefix:!0,fuzzy:!1}};if(this.#h=new Promise((t=>{this.#c=t})),this.#i?.jsonIndex){let{primary:t,secondary:e,extra:n}=JSON.parse(this.#i?.jsonIndex);this.#e=ft.default.loadJS(t,u),this.#n=ft.default.loadJS(e,h),this.#r=ft.default.loadJS(n,c)}else this.#e=new ft.default(u),this.#n=new ft.default(h),this.#r=new ft.default(c),this.#t.locations.forEach(this.#d),this.#t.categories.forEach(this.#p);this.#a.update(performance.now()),this.#f=Ia(((t,e)=>{this.#o.trackSearchSuggest({query:t,hits:e})}),300),this.#g=Ia(((t,e)=>{this.#o.trackSearch({query:t,hits:e})}),300)}#u=0;#y=t=>{this.#u++,this.#a.scheduleUpdate(new sa({name:"updateIndex",ordering:0,frameCount:1,callback:()=>{t(),this.#u--,0===this.#u&&this.#c()}}))};#d=t=>{let{SECONDARY_INDEX_WEIGHT:e,LOCATION_DEFAULT_RANK:n,PRIMARY_INDEX_TAGS_NAME_WEIGHT:r}=this.#i.constants,i=n;this.#i?.useLocationRank&&(i=Array.isArray(t.polygons)?Math.max(...t.polygons.map((t=>t.rank?.score?t.rank?.score:n)),n):n),this.#y((()=>{this.#e.add({name:Je(t.name),tags:"",id:"MappedinLocation_"+t.id,weight:n,rank:i})})),this.#i?.searchTags&&Array.isArray(t.tags)&&t.tags.forEach((e=>{this.#e.add({name:"",tag:Je(e),id:"MappedinLocation_"+t.id,weight:r,rank:i})})),this.#i?.searchDescriptions&&this.#y((()=>this.#n.add({description:Je(t.description||""),id:"MappedinLocation_"+t.id,weight:e,rank:i})))};#p=t=>{let{CATEGORY_LOCATION_DESCRIPTION_WEIGHT:e,CATEGORY_LOCATION_TAGS_WEIGHT:n,CATEGORY_LOCATION_NAME_WEIGHT:r,CATEGORY_NAME_WEIGHT:i}=this.#i.constants;this.#y((()=>this.#e.add({name:Je(t.name||""),description:"",id:"MappedinCategory_"+t.id,weight:i})));let a=t.locations.reduce(((t,e)=>t+` ${Et} `+e.name),"")+` ${Et}`;if(this.#i?.searchDescriptionsInCategories&&t.locations.forEach((n=>{null!=n.description&&this.#y((()=>this.#r.add({id:"MappedinCategory_"+t.id,"category.locations.description":Je(n.description),ref:n.name,weight:e})))})),this.#i?.searchTagsInCategories){let e=t.locations.reduce(((t,e)=>t+e.tags?.reduce(((t,e)=>t+` ${Et} `+e),"")+` ${Et}`),"");this.#y((()=>this.#r.add({"category.locations.tags":Je(e),id:"MappedinCategory_"+t.id,weight:n})))}this.#y((()=>this.#r.add({"category.locations.name":Je(a),id:"MappedinCategory_"+t.id,weight:r})))};#h;#c;#m=t=>{let e=t.score,{object:n,id:r,weight:i,rank:a}=t,[s,o]=r.split("_"),l=n||this.#t.getCollectionItemById(or[s],o);return a&&this.#i?.useLocationRank&&(e+=a),i&&(e*=i),{score:e,type:s,object:l}};#v=(t,e)=>{for(let n in t.match)t.match[n].forEach((r=>{let i=t.ref||t[r]||e.object[r];if("category.locations.tags"===r||"category.locations.name"===r){let e=new RegExp(`[^${Et}]* `+n+` [^${Et}]*`,"ig").exec(t[r]);null!=e&&(i=e[0].slice(1,-1))}e.matches.push({term:n,weight:t.weight,matchesOn:r,value:i})}))};#_(t){let e=[],n=Je(t);e=[...this.#e.search(n),...this.#n.search(n),...this.#r.search(n)].sort(((t,e)=>e.score-t.score));let r={};for(let t of e){let e=this.#m(t);r[t.id]?r[t.id].score+=e.score:r[t.id]={...e,matches:[]},this.#v(t,r[t.id])}return Object.keys(r).map((t=>({...r[t],matches:r[t].matches.sort(((t,e)=>e.weight-t.weight))}))).sort(((t,e)=>e.score-t.score))}async suggest(t){await this.#h;let{PRIMARY_INDEX_FUZZYNESS:e,PRIMARY_INDEX_WEIGHT:n,PRIMARY_INDEX_TAGS_NAME_WEIGHT:r,RATIO_OF_FUZZY_TO_EXACT:i,RATIO_OF_PREFIX_TO_EXACT:a}=this.#i.constants,s=this.#e.autoSuggest(t,{fields:["name","tag","query"],combineWith:"AND",prefix:!0,fuzzy:e,boost:{name:n,query:n,tag:r},weights:{fuzzy:i,prefix:a}});return this.#f(t,s.length),{total:s.length,hits:s.map((t=>({text:t.suggestion})))}}async search(t){await this.#h;let e=this.#_(t);return this.#g(t,e.length),e}async toJSON(){return await this.#h,JSON.stringify({primary:this.#e,secondary:this.#n,extra:this.#r})}#f;#g;async addQuery(t){let e,n,{query:r,object:i,weight:a=1}=t;await this.#h,e=i instanceof Ce?"MappedinLocation":i instanceof qe?"MappedinCategory":"Custom","MappedinLocation"===e||"MappedinCategory"===e?n=e+"_"+i.id:"string"==typeof i.id?n="Custom_"+i.id:(n=this.#l.get(i),n||(n="Custom_"+We(),this.#l.set(i,n))),this.#e.add({id:n,weight:a,object:i,query:Je(r)})}};w();var ti=globalThis.fetch;function Rt(){if(null==ti)throw new Error("fetch is not available in your environment. Pass your own function into `setFetch` (node-fetch, etc)");return ti}var ur=_?.env?.npm_package_version;globalThis.btoa||(globalThis.btoa=ai.encode);var cr=["ar"];function Ba(t){let e={...Xn,things:Kn,...t};return e.headers={...e.headers,"mappedin-sdk-version":ur},t.platformString&&(e.headers={...e.headers,"mappedin-platform-version":t.platformString}),e.noAuth||(e.accessToken?e.authorization=`Bearer ${e.accessToken}`:e.clientId&&e.clientSecret&&(e.authorization=`Basic ${globalThis.btoa(`${e.clientId}:${e.clientSecret}`)}`)),e}async function Da(t){let e=Ba({baseUrl:"https://api-gateway.mappedin.com/",...{emitAnalyticsEvents:!0,...t}}),n="public/1/"+(e.useDraftData?"draft/":""),r=new lt({...e,baseUrl:e.baseUrl+n});return await r.fetch(),r}var ni={shouldPopulateBundledImagesAsBlobs:!(typeof globalThis.navigator<"u"&&"ReactNative"==globalThis.navigator.product)};async function Ga(t){let e=Ba({baseUrl:"https://api-gateway.mappedin.com/",...ni,...t}),{url:n,updated_at:r}=await dr(t),i=await Rt()(n,{mode:"cors"}),{data:a,format:s="jsonstring"}=await i.json();if("jsonstring"!==s)throw new Error(`Unrecognized format ${s}`);let o=new lt(e);return await o.hydrate(a,e.shouldPopulateBundledImagesAsBlobs),o.updatedAt=r,o}async function dr(t){let e=Ba({baseUrl:"https://api-gateway.mappedin.com/",...ni,...t}),{version:n,venue:r}=t,i=`${t.bundleBaseUri||e.baseUrl+`exports/legacy${null!=e.language&&cr.includes(e.language)?"-"+e.language:""}/1/bundle`}?venue=${r}&version=1.0.0`;return e.language=void 0,await Ta(e,i)}var pr=!1;function hr(t){t.things=t.things||{},t.things.venue=t.things.venue||[],t.things.venue.push("slug","defaultMap"),t.things.nodes=t.things.nodes||[],t.things.nodes.push("x","y","paths","map"),t.things.polygons=t.things.polygons||[],t.things.locations=t.things.locations||[],t.things.locations.push("sortOrder","parent","showLabelWhenImagePresent","hidden"),t.things.maps=t.things.maps||[],t.things.maps.push("height","width","georeference"),t.perspective=t.perspective3D||t.perspective||void 0,t.things.maps.push("scene","layers"),t.things.polygons.push("canvasBounds","map","image","perspectives","material","holes","label","geometry"),pr&&t.things.polygons.push("layer","geometry","vertexes")}var mr=function(t){return null==t.mapView&&(t.mapView={}),new Promise((function(e,n){function r(r,i){if(r)n(r);else{let r={};try{t.firstMapSelector&&(t.mapView=t.mapView||{},t.mapView.firstMap=t.firstMapSelector(i))}catch(t){A.error("Failure in firstMapSelector! Loading default map instead."),A.error(t),n(t)}r.venue=i,e(r)}}hr(t.venue),t.venue.useVenueBundle?Ga(t.venue).then((t=>r(null,t))).catch((t=>r(t,null))):Da(t.venue).then((t=>r(null,t))).catch((t=>r(t,null)))}))};
|