@mapsindoors/map-template 1.93.2 → 1.94.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{GoogleMapsMap-982405ad.mjs → GoogleMapsMap-BqYRaFgc.mjs} +51 -62
- package/dist/MapboxMap-CUYrfLHY.mjs +34732 -0
- package/dist/_commonjsHelpers-ba3f0406.js +21 -0
- package/dist/combo-box-item.entry.js +15 -0
- package/dist/icon-b8d01d6f.js +24 -0
- package/dist/index-7e9696f3.js +1678 -0
- package/dist/index.js +1 -0
- package/dist/loader.js +18 -0
- package/dist/mapsindoors-react.es.js +3 -5
- package/dist/mapsindoors-react.umd.js +197 -582
- package/dist/mapsindoors-webcomponent.es.js +58512 -75790
- package/dist/mi-card_2.entry.js +28 -0
- package/dist/mi-chip.entry.js +22 -0
- package/dist/mi-column.entry.js +28 -0
- package/dist/mi-combo-box.entry.js +416 -0
- package/dist/mi-components.js +18 -0
- package/dist/mi-data-table.entry.js +302 -0
- package/dist/mi-distance_2.entry.js +67 -0
- package/dist/mi-dropdown-item.entry.js +15 -0
- package/dist/mi-dropdown.entry.js +610 -0
- package/dist/mi-floor-selector.entry.js +202 -0
- package/dist/mi-keyboard.entry.js +238 -0
- package/dist/mi-list-item-category.entry.js +48 -0
- package/dist/mi-list-item-location.entry.js +171 -0
- package/dist/mi-list.entry.js +56 -0
- package/dist/mi-location-booking.entry.js +5193 -0
- package/dist/mi-location-info.entry.js +63 -0
- package/dist/mi-map-googlemaps.entry.js +750 -0
- package/dist/mi-map-mapbox.entry.js +467 -0
- package/dist/mi-metric-card.entry.js +48 -0
- package/dist/mi-my-position.entry.js +986 -0
- package/dist/mi-notification.entry.js +127 -0
- package/dist/mi-route-instructions-heading.entry.js +73 -0
- package/dist/mi-route-instructions-maneuver-legacy.entry.js +82 -0
- package/dist/mi-route-instructions-maneuver.entry.js +82 -0
- package/dist/mi-route-instructions-step-legacy.entry.js +308 -0
- package/dist/mi-route-instructions-step.entry.js +321 -0
- package/dist/mi-route-instructions.entry.js +157 -0
- package/dist/mi-scroll-buttons.entry.js +112 -0
- package/dist/mi-search.entry.js +376 -0
- package/dist/mi-share-sms.entry.js +80 -0
- package/dist/mi-step-switcher.entry.js +31 -0
- package/dist/mi-tab-panel.entry.js +25 -0
- package/dist/mi-tab.entry.js +12 -0
- package/dist/mi-tabs.entry.js +47 -0
- package/dist/mi-time.entry.js +57 -0
- package/dist/mi-variables-9a6c8d4d.js +6 -0
- package/dist/polyfills/core-js.js +11 -0
- package/dist/polyfills/css-shim.js +1 -0
- package/dist/polyfills/dom.js +79 -0
- package/dist/polyfills/es5-html-element.js +1 -0
- package/dist/polyfills/index.js +34 -0
- package/dist/polyfills/system.js +6 -0
- package/dist/{reactcomponent-7fbbd9b2.mjs → reactcomponent-DTepe7hB.mjs} +14121 -14626
- package/dist/route-travel-mode.enum-7f4ce9c7.js +9 -0
- package/dist/sort-order.enum-64ce8998.js +552 -0
- package/dist/unit-system.enum-eaefb53e.js +7 -0
- package/dist/utils-ae714467.js +61 -0
- package/package.json +10 -6
- package/dist/MapboxMap-06ef82a3.mjs +0 -37815
- package/dist/_commonjsHelpers-ba3f0406-b96e6d6a.mjs +0 -22
- package/dist/combo-box-item.entry-d35f3d51.mjs +0 -15
- package/dist/icon-b8d01d6f-ddfa2c17.mjs +0 -25
- package/dist/mapsindoors-webcomponent.umd.js +0 -3245
- package/dist/mi-card_2.entry-fc772c35.mjs +0 -26
- package/dist/mi-chip.entry-81c742a1.mjs +0 -19
- package/dist/mi-column.entry-3a083282.mjs +0 -21
- package/dist/mi-combo-box.entry-cae6401a.mjs +0 -263
- package/dist/mi-data-table.entry-d4c3f445.mjs +0 -224
- package/dist/mi-distance_2.entry-a33ed69a.mjs +0 -339
- package/dist/mi-dropdown-item.entry-974d1e4f.mjs +0 -15
- package/dist/mi-dropdown.entry-5317db65.mjs +0 -349
- package/dist/mi-floor-selector.entry-185fbd8b.mjs +0 -115
- package/dist/mi-keyboard.entry-eaf4b9ef.mjs +0 -3103
- package/dist/mi-list-item-category.entry-9c95008c.mjs +0 -39
- package/dist/mi-list-item-location.entry-8b41e8f0.mjs +0 -137
- package/dist/mi-list.entry-1218d29d.mjs +0 -42
- package/dist/mi-location-booking.entry-270aaf5a.mjs +0 -4866
- package/dist/mi-location-info.entry-e4f7fd04.mjs +0 -32
- package/dist/mi-map-googlemaps.entry-81fa28d2.mjs +0 -467
- package/dist/mi-map-mapbox.entry-31821da3.mjs +0 -301
- package/dist/mi-metric-card.entry-40407f04.mjs +0 -29
- package/dist/mi-my-position.entry-bc48fe6e.mjs +0 -703
- package/dist/mi-notification.entry-9a2bc53b.mjs +0 -84
- package/dist/mi-route-instructions-heading.entry-e5b1ff04.mjs +0 -75
- package/dist/mi-route-instructions-maneuver-legacy.entry-2c3d73ab.mjs +0 -76
- package/dist/mi-route-instructions-maneuver.entry-c6f01024.mjs +0 -76
- package/dist/mi-route-instructions-step-legacy.entry-80bcf097.mjs +0 -202
- package/dist/mi-route-instructions-step.entry-db802e13.mjs +0 -231
- package/dist/mi-route-instructions.entry-62416e29.mjs +0 -143
- package/dist/mi-scroll-buttons.entry-92b62b21.mjs +0 -83
- package/dist/mi-search.entry-87f1e64a.mjs +0 -251
- package/dist/mi-share-sms.entry-b6725edb.mjs +0 -56
- package/dist/mi-step-switcher.entry-f8f6c040.mjs +0 -27
- package/dist/mi-tab-panel.entry-a89213c2.mjs +0 -22
- package/dist/mi-tab.entry-a2fb3f8c.mjs +0 -14
- package/dist/mi-tabs.entry-cd638ea7.mjs +0 -37
- package/dist/mi-time.entry-0b02870d.mjs +0 -46
- package/dist/mi-variables-9a6c8d4d-e06eec88.mjs +0 -8
- package/dist/route-travel-mode.enum-7f4ce9c7-a9c95a83.mjs +0 -8
- package/dist/sort-order.enum-64ce8998-b75ac596.mjs +0 -318
- package/dist/unit-system.enum-eaefb53e-0f424da4.mjs +0 -8
- package/dist/utils-ae714467-b07fc3be.mjs +0 -37
|
@@ -0,0 +1,986 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host } from './index-7e9696f3.js';
|
|
2
|
+
import { c as createCommonjsModule, a as commonjsGlobal } from './_commonjsHelpers-ba3f0406.js';
|
|
3
|
+
|
|
4
|
+
var uaParser_pack = createCommonjsModule(function (module, exports) {
|
|
5
|
+
/* UAParser.js v2.0.3
|
|
6
|
+
Copyright © 2012-2025 Faisal Salman <f@faisalman.com>
|
|
7
|
+
AGPLv3 License */
|
|
8
|
+
((i,l)=>{function U(i){for(var e={},t=0;t<i.length;t++)e[i[t].toUpperCase()]=i[t];return e}var E=500,P="user-agent",w="",B="?",R="function",n="undefined",c="object",V="string",u="browser",h="cpu",p="device",m="engine",f="os",g="result",v="name",k="type",x="vendor",y="version",C="architecture",L="major",T="model",G="console",S="mobile",r="tablet",e="smarttv",t="wearable",F="xr",D="embedded",$="inapp",W="brands",_="formFactors",X="fullVersionList",q="platform",Y="platformVersion",K="bitness",o="sec-ch-ua",Q=o+"-full-version-list",Z=o+"-arch",J=o+"-"+K,ii=o+"-form-factors",ei=o+"-"+S,ti=o+"-"+T,oi=o+"-"+q,ri=oi+"-version",ai=[W,X,S,T,q,Y,C,_,K],si="Amazon",a="Apple",ni="ASUS",wi="BlackBerry",s="Google",bi="Huawei",di="Microsoft",li="Motorola",ci="Nvidia",ui="OnePlus",hi="OPPO",pi="Samsung",mi="Sony",fi="Xiaomi",gi="Zebra",vi="Chromium",b="Chromecast",ki="Firefox",d="Opera",xi="Facebook",A="Mobile ",yi=" Browser",Ci="Windows",Ti=typeof i!==n,z=Ti&&i.navigator?i.navigator:l,O=z&&z.userAgentData?z.userAgentData:l,Si=function(i,e){if(typeof i===c&&0<i.length){for(var t in i)if(M(i[t])==M(e))return !0;return !1}return !!H(i)&&-1!==M(e).indexOf(M(i))},_i=function(i,e){for(var t in i)return /^(browser|cpu|device|engine|os)$/.test(t)||!!e&&_i(i[t])},H=function(i){return typeof i===V},qi=function(i){if(!i)return l;for(var e,t=[],o=zi(/\\?\"/g,i).split(","),r=0;r<o.length;r++)-1<o[r].indexOf(";")?(e=Hi(o[r]).split(";v="),t[r]={brand:e[0],version:e[1]}):t[r]=Hi(o[r]);return t},M=function(i){return H(i)?i.toLowerCase():i},Ai=function(i){return H(i)?zi(/[^\d\.]/g,i).split(".")[0]:l},j=function(i){for(var e in i){e=i[e];typeof e==c&&2==e.length?this[e[0]]=e[1]:this[e]=l;}return this},zi=function(i,e){return H(e)?e.replace(i,w):e},Oi=function(i){return zi(/\\?\"/g,i)},Hi=function(i,e){if(H(i))return i=zi(/^\s\s*/,i),typeof e===n?i:i.substring(0,E)},Mi=function(i,e){if(i&&e)for(var t,o,r,a,s,n=0;n<e.length&&!a;){for(var w=e[n],b=e[n+1],d=t=0;d<w.length&&!a&&w[d];)if(a=w[d++].exec(i))for(o=0;o<b.length;o++)s=a[++t],typeof(r=b[o])===c&&0<r.length?2===r.length?typeof r[1]==R?this[r[0]]=r[1].call(this,s):this[r[0]]=r[1]:3===r.length?typeof r[1]!==R||r[1].exec&&r[1].test?this[r[0]]=s?s.replace(r[1],r[2]):l:this[r[0]]=s?r[1].call(this,s,r[2]):l:4===r.length&&(this[r[0]]=s?r[3].call(this,s.replace(r[1],r[2])):l):this[r]=s||l;n+=2;}},N=function(i,e){for(var t in e)if(typeof e[t]===c&&0<e[t].length){for(var o=0;o<e[t].length;o++)if(Si(e[t][o],i))return t===B?l:t}else if(Si(e[t],i))return t===B?l:t;return e.hasOwnProperty("*")?e["*"]:i},ji={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Ni={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":l},Ii={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[y,[v,A+"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[y,[v,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[v,y],[/opios[\/ ]+([\w\.]+)/i],[y,[v,d+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[y,[v,d+" GX"]],[/\bopr\/([\w\.]+)/i],[y,[v,d]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[y,[v,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[y,[v,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i,/(heytap|ovi|115|surf)browser\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[v,y],[/quark(?:pc)?\/([-\w\.]+)/i],[y,[v,"Quark"]],[/\bddg\/([\w\.]+)/i],[y,[v,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[y,[v,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[y,[v,"WeChat"]],[/konqueror\/([\w\.]+)/i],[y,[v,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[y,[v,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[y,[v,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[y,[v,"Smart Lenovo"+yi]],[/(avast|avg)\/([\w\.]+)/i],[[v,/(.+)/,"$1 Secure"+yi],y],[/\bfocus\/([\w\.]+)/i],[y,[v,ki+" Focus"]],[/\bopt\/([\w\.]+)/i],[y,[v,d+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[y,[v,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[y,[v,"Dolphin"]],[/coast\/([\w\.]+)/i],[y,[v,d+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[y,[v,"MIUI"+yi]],[/fxios\/([\w\.-]+)/i],[y,[v,A+ki]],[/\bqihoobrowser\/?([\w\.]*)/i],[y,[v,"360"]],[/\b(qq)\/([\w\.]+)/i],[[v,/(.+)/,"$1Browser"],y],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[v,/(.+)/,"$1"+yi],y],[/samsungbrowser\/([\w\.]+)/i],[y,[v,pi+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[y,[v,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[v,"Sogou Mobile"],y],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[v,y],[/(lbbrowser|rekonq)/i],[v],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[y,v],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[v,xi],y,[k,$]],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat)[\/ ]([-\w\.]+)/i],[v,y,[k,$]],[/\bgsa\/([\w\.]+) .*safari\//i],[y,[v,"GSA"],[k,$]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[y,[v,"TikTok"],[k,$]],[/\[(linkedin)app\]/i],[v,[k,$]],[/(chromium)[\/ ]([-\w\.]+)/i],[v,y],[/headlesschrome(?:\/([\w\.]+)| )/i],[y,[v,"Chrome Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[v,"Chrome WebView"],y],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[y,[v,"Android"+yi]],[/chrome\/([\w\.]+) mobile/i],[y,[v,A+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[v,y],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[y,[v,A+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[v,A+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[y,v],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[v,[y,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[v,y],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[v,A+ki],y],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[v,"Netscape"],y],[/(wolvic|librewolf)\/([\w\.]+)/i],[v,y],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[y,[v,ki+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[v,[y,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[v,[y,/[^\d\.]+./,w]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[C,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[C,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[C,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[C,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[C,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[C,/ower/,w,M]],[/ sun4\w[;\)]/i],[[C,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[C,M]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[T,[x,pi],[k,r]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[T,[x,pi],[k,S]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[T,[x,a],[k,S]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[T,[x,a],[k,r]],[/(macintosh);/i],[T,[x,a]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[T,[x,"Sharp"],[k,S]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[T,[x,"Honor"],[k,r]],[/honor([-\w ]+)[;\)]/i],[T,[x,"Honor"],[k,S]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[T,[x,bi],[k,r]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[T,[x,bi],[k,S]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[T,/_/g," "],[x,fi],[k,r]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[T,/_/g," "],[x,fi],[k,S]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[T,[x,hi],[k,S]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[T,[x,N,{OnePlus:["304","403","203"],"*":hi}],[k,r]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[T,[x,"BLU"],[k,S]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[T,[x,"Vivo"],[k,S]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[T,[x,"Realme"],[k,S]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto(?! 360)[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[T,[x,li],[k,S]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[T,[x,li],[k,r]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[T,[x,"LG"],[k,r]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch))(\w+)/i,/\blg-?([\d\w]+) bui/i],[T,[x,"LG"],[k,S]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[T,[x,"Lenovo"],[k,r]],[/(nokia) (t[12][01])/i],[x,T,[k,r]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[T,/_/g," "],[k,S],[x,"Nokia"]],[/(pixel (c|tablet))\b/i],[T,[x,s],[k,r]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[T,[x,s],[k,S]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[T,[x,mi],[k,S]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[T,"Xperia Tablet"],[x,mi],[k,r]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[T,[x,ui],[k,S]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[T,[x,si],[k,r]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[T,/(.+)/g,"Fire Phone $1"],[x,si],[k,S]],[/(playbook);[-\w\),; ]+(rim)/i],[T,x,[k,r]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[T,[x,wi],[k,S]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[T,[x,ni],[k,r]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[T,[x,ni],[k,S]],[/(nexus 9)/i],[T,[x,"HTC"],[k,r]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[x,[T,/_/g," "],[k,S]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[T,[x,"TCL"],[k,r]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[T,[x,"TCL"],[k,S]],[/(itel) ((\w+))/i],[[x,M],T,[k,N,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[T,[x,"Acer"],[k,r]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[T,[x,"Meizu"],[k,S]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[T,[x,"Ulefone"],[k,S]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[T,[x,"Energizer"],[k,S]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[T,[x,"Cat"],[k,S]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[T,[x,"Smartfren"],[k,S]],[/droid.+; (a(?:015|06[35]|142p?))/i],[T,[x,"Nothing"],[k,S]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[T,[x,"Archos"],[k,r]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[T,[x,"Archos"],[k,S]],[/(imo) (tab \w+)/i,/(infinix) (x1101b?)/i],[x,T,[k,r]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i,/(oppo) ?([\w ]+) bui/i],[x,T,[k,S]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[x,T,[k,r]],[/(surface duo)/i],[T,[x,di],[k,r]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[T,[x,"Fairphone"],[k,S]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[T,[x,ci],[k,r]],[/(sprint) (\w+)/i],[x,T,[k,S]],[/(kin\.[onetw]{3})/i],[[T,/\./g," "],[x,di],[k,S]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[T,[x,gi],[k,r]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[T,[x,gi],[k,S]],[/smart-tv.+(samsung)/i],[x,[k,e]],[/hbbtv.+maple;(\d+)/i],[[T,/^/,"SmartTV"],[x,pi],[k,e]],[/tcast.+(lg)e?. ([-\w]+)/i],[x,T,[k,e]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[x,"LG"],[k,e]],[/(apple) ?tv/i],[x,[T,a+" TV"],[k,e]],[/crkey.*devicetype\/chromecast/i],[[T,b+" Third Generation"],[x,s],[k,e]],[/crkey.*devicetype\/([^/]*)/i],[[T,/^/,"Chromecast "],[x,s],[k,e]],[/fuchsia.*crkey/i],[[T,b+" Nest Hub"],[x,s],[k,e]],[/crkey/i],[[T,b],[x,s],[k,e]],[/(portaltv)/i],[T,[x,xi],[k,e]],[/droid.+aft(\w+)( bui|\))/i],[T,[x,si],[k,e]],[/(shield \w+ tv)/i],[T,[x,ci],[k,e]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[T,[x,"Sharp"],[k,e]],[/(bravia[\w ]+)( bui|\))/i],[T,[x,mi],[k,e]],[/(mi(tv|box)-?\w+) bui/i],[T,[x,fi],[k,e]],[/Hbbtv.*(technisat) (.*);/i],[x,T,[k,e]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[x,Hi],[T,Hi],[k,e]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[T,[k,e]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[k,e]],[/(ouya)/i,/(nintendo) (\w+)/i],[x,T,[k,G]],[/droid.+; (shield)( bui|\))/i],[T,[x,ci],[k,G]],[/(playstation \w+)/i],[T,[x,mi],[k,G]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[T,[x,di],[k,G]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[T,[x,pi],[k,t]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[x,T,[k,t]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[T,[x,hi],[k,t]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[T,[x,a],[k,t]],[/(opwwe\d{3})/i],[T,[x,ui],[k,t]],[/(moto 360)/i],[T,[x,li],[k,t]],[/(smartwatch 3)/i],[T,[x,mi],[k,t]],[/(g watch r)/i],[T,[x,"LG"],[k,t]],[/droid.+; (wt63?0{2,3})\)/i],[T,[x,gi],[k,t]],[/droid.+; (glass) \d/i],[T,[x,s],[k,F]],[/(pico) (4|neo3(?: link|pro)?)/i],[x,T,[k,F]],[/(quest( \d| pro)?s?).+vr/i],[T,[x,xi],[k,F]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[x,[k,D]],[/(aeobc)\b/i],[T,[x,si],[k,D]],[/(homepod).+mac os/i],[T,[x,a],[k,D]],[/windows iot/i],[[k,D]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[T,[k,N,{mobile:"Mobile",xr:"VR","*":r}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[k,r]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[k,S]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[T,[x,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[y,[v,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[v,y],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[y,[v,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[v,y],[/ladybird\//i],[[v,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[y,v]],os:[[/microsoft (windows) (vista|xp)/i],[v,y],[/(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i],[v,[y,N,ji]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[y,N,ji],[v,Ci]],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[y,/_/g,"."],[v,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[v,"macOS"],[y,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[y,[v,b+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[y,[v,b+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[y,[v,b+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[y,[v,b+" Linux"]],[/crkey\/([\d\.]+)/i],[y,[v,b]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[y,v],[/(ubuntu) ([\w\.]+) like android/i],[[v,/(.+)/,"$1 Touch"],y],[/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/\.; ]?([\d\.]*)/i],[v,y],[/\(bb(10);/i],[y,[v,wi]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[y,[v,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[y,[v,ki+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[y,[v,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[y,[v,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[v,"Chrome OS"],y],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux)(?: arm\w*| x86\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[v,y],[/(sunos) ?([\w\.\d]*)/i],[[v,"Solaris"],y],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[v,y]]},Ui=(d={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}},j.call(d.init,[[u,[v,y,L,k]],[h,[C]],[p,[k,T,x]],[m,[v,y]],[f,[v,y]]]),j.call(d.isIgnore,[[u,[y,L]],[m,[y]],[f,[y]]]),j.call(d.isIgnoreRgx,[[u,/ ?browser$/i],[f,/ ?os$/i]]),j.call(d.toString,[[u,[v,y]],[h,[C]],[p,[x,T]],[m,[v,y]],[f,[v,y]]]),d),Ei=function(e,i){var t=Ui.init[i],o=Ui.isIgnore[i]||0,r=Ui.isIgnoreRgx[i]||0,a=Ui.toString[i]||0;function s(){j.call(this,t);}return s.prototype.getItem=function(){return e},s.prototype.withClientHints=function(){return O?O.getHighEntropyValues(ai).then(function(i){return e.setCH(new Pi(i,!1)).parseCH().get()}):e.parseCH().get()},s.prototype.withFeatureCheck=function(){return e.detectFeature().get()},i!=g&&(s.prototype.is=function(i){var e,t=!1;for(e in this)if(this.hasOwnProperty(e)&&!Si(o,e)&&M(r?zi(r,this[e]):this[e])==M(r?zi(r,i):i)){if(t=!0,i!=n)break}else if(i==n&&t){t=!t;break}return t},s.prototype.toString=function(){var i,e=w;for(i in a)typeof this[a[i]]!==n&&(e+=(e?" ":w)+this[a[i]]);return e||n}),O||(s.prototype.then=function(i){function e(){for(var i in t)t.hasOwnProperty(i)&&(this[i]=t[i]);}var t=this,o=(e.prototype={is:s.prototype.is,toString:s.prototype.toString},new e);return i(o),o}),new s};function Pi(i,e){if(i=i||{},j.call(this,ai),e)j.call(this,[[W,qi(i[o])],[X,qi(i[Q])],[S,/\?1/.test(i[ei])],[T,Oi(i[ti])],[q,Oi(i[oi])],[Y,Oi(i[ri])],[C,Oi(i[Z])],[_,qi(i[ii])],[K,Oi(i[J])]]);else for(var t in i)this.hasOwnProperty(t)&&typeof i[t]!==n&&(this[t]=i[t]);}function Bi(i,e,t,o){return this.get=function(i){return i?this.data.hasOwnProperty(i)?this.data[i]:l:this.data},this.set=function(i,e){return this.data[i]=e,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if(z&&z.userAgent==this.ua)switch(this.itemType){case u:z.brave&&typeof z.brave.isBrave==R&&this.set(v,"Brave");break;case p:!this.get(k)&&O&&O[S]&&this.set(k,S),"Macintosh"==this.get(T)&&z&&typeof z.standalone!==n&&z.maxTouchPoints&&2<z.maxTouchPoints&&this.set(T,"iPad").set(k,r);break;case f:!this.get(v)&&O&&O[q]&&this.set(v,O[q]);break;case g:var e=this.data,i=function(i){return e[i].getItem().detectFeature().get()};this.set(u,i(u)).set(h,i(h)).set(p,i(p)).set(m,i(m)).set(f,i(f));}return this},this.parseUA=function(){return this.itemType!=g&&Mi.call(this.data,this.ua,this.rgxMap),this.itemType==u&&this.set(L,Ai(this.get(y))),this},this.parseCH=function(){var i,e=this.uaCH,t=this.rgxMap;switch(this.itemType){case u:case m:var o,r=e[X]||e[W];if(r)for(var a in r){var s=r[a].brand||r[a],a=r[a].version;this.itemType!=u||/not.a.brand/i.test(s)||o&&(!/chrom/i.test(o)||s==vi)||(s=N(s,{Chrome:"Google Chrome",Edge:"Microsoft Edge","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"}),this.set(v,s).set(y,a).set(L,Ai(a)),o=s),this.itemType==m&&s==vi&&this.set(y,a);}break;case h:var n=e[C];n&&("64"==e[K]&&(n+="64"),Mi.call(this.data,n+";",t));break;case p:if(e[S]&&this.set(k,S),e[T]&&(this.set(T,e[T]),this.get(k)&&this.get(x)||(Mi.call(n={},"droid 9; "+e[T]+")",t),!this.get(k)&&n.type&&this.set(k,n.type),!this.get(x)&&n.vendor&&this.set(x,n.vendor))),e[_]){if("string"!=typeof e[_])for(var w=0;!i&&w<e[_].length;)i=N(e[_][w++],Ni);else i=N(e[_],Ni);this.set(k,i);}break;case f:var b,n=e[q];n&&(b=e[Y],n==Ci&&(b=13<=parseInt(Ai(b),10)?"11":"10"),this.set(v,n).set(y,b)),this.get(v)==Ci&&"Xbox"==e[T]&&this.set(v,"Xbox").set(y,l);break;case g:var d=this.data,n=function(i){return d[i].getItem().setCH(e).parseCH().get()};this.set(u,n(u)).set(h,n(h)).set(p,n(p)).set(m,n(m)).set(f,n(f));}return this},j.call(this,[["itemType",i],["ua",e],["uaCH",o],["rgxMap",t],["data",Ei(this,i)]]),this}function I(i,e,t){var o,r,a,s,n;return typeof i===c?(e=_i(i,!0)?(typeof e===c&&(t=e),i):(t=i,l),i=l):typeof i!==V||_i(e,!0)||(t=e,e=l),t&&typeof t.append===R&&(o={},t.forEach(function(i,e){o[e]=i;}),t=o),this instanceof I?(r=typeof i===V?i:t&&t[P]?t[P]:z&&z.userAgent?z.userAgent:w,a=new Pi(t,!0),s=e?((i,e)=>{var t,o={},r=e;if(!_i(e))for(var a in r={},e)for(var s in e[a])r[s]=e[a][s].concat(r[s]||[]);for(t in i)o[t]=r[t]&&r[t].length%2==0?r[t].concat(i[t]):i[t];return o})(Ii,e):Ii,j.call(this,[["getBrowser",(n=function(i){return i==g?function(){return new Bi(i,r,s,a).set("ua",r).set(u,this.getBrowser()).set(h,this.getCPU()).set(p,this.getDevice()).set(m,this.getEngine()).set(f,this.getOS()).get()}:function(){return new Bi(i,r,s[i],a).parseUA().get()}})(u)],["getCPU",n(h)],["getDevice",n(p)],["getEngine",n(m)],["getOS",n(f)],["getResult",n(g)],["getUA",function(){return r}],["setUA",function(i){return H(i)&&(r=i.length>E?Hi(i,E):i),this}]]).setUA(r),this):new I(i,e,t).getResult()}I.VERSION="2.0.3",I.BROWSER=U([v,y,L,k]),I.CPU=U([C]),I.DEVICE=U([T,x,k,G,S,e,r,t,D]),I.ENGINE=I.OS=U([v,y]),(exports=module.exports?module.exports=I:exports).UAParser=I;var Ri,Vi=Ti&&(i.jQuery||i.Zepto);Vi&&!Vi.ua&&(Ri=new I,Vi.ua=Ri.getResult(),Vi.ua.get=function(){return Ri.getUA()},Vi.ua.set=function(i){Ri.setUA(i);var e,t=Ri.getResult();for(e in t)Vi.ua[e]=t[e];});})("object"==typeof window?window:commonjsGlobal);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
var isMergeableObject = function isMergeableObject(value) {
|
|
12
|
+
return isNonNullObject(value)
|
|
13
|
+
&& !isSpecial(value)
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function isNonNullObject(value) {
|
|
17
|
+
return !!value && typeof value === 'object'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function isSpecial(value) {
|
|
21
|
+
var stringValue = Object.prototype.toString.call(value);
|
|
22
|
+
|
|
23
|
+
return stringValue === '[object RegExp]'
|
|
24
|
+
|| stringValue === '[object Date]'
|
|
25
|
+
|| isReactElement(value)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
|
|
29
|
+
var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
30
|
+
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
31
|
+
|
|
32
|
+
function isReactElement(value) {
|
|
33
|
+
return value.$$typeof === REACT_ELEMENT_TYPE
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function emptyTarget(val) {
|
|
37
|
+
return Array.isArray(val) ? [] : {}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
41
|
+
return (options.clone !== false && options.isMergeableObject(value))
|
|
42
|
+
? deepmerge(emptyTarget(value), value, options)
|
|
43
|
+
: value
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function defaultArrayMerge(target, source, options) {
|
|
47
|
+
return target.concat(source).map(function(element) {
|
|
48
|
+
return cloneUnlessOtherwiseSpecified(element, options)
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function getMergeFunction(key, options) {
|
|
53
|
+
if (!options.customMerge) {
|
|
54
|
+
return deepmerge
|
|
55
|
+
}
|
|
56
|
+
var customMerge = options.customMerge(key);
|
|
57
|
+
return typeof customMerge === 'function' ? customMerge : deepmerge
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function getEnumerableOwnPropertySymbols(target) {
|
|
61
|
+
return Object.getOwnPropertySymbols
|
|
62
|
+
? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
63
|
+
return Object.propertyIsEnumerable.call(target, symbol)
|
|
64
|
+
})
|
|
65
|
+
: []
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function getKeys(target) {
|
|
69
|
+
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function propertyIsOnObject(object, property) {
|
|
73
|
+
try {
|
|
74
|
+
return property in object
|
|
75
|
+
} catch(_) {
|
|
76
|
+
return false
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Protects from prototype poisoning and unexpected merging up the prototype chain.
|
|
81
|
+
function propertyIsUnsafe(target, key) {
|
|
82
|
+
return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
|
|
83
|
+
&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
|
|
84
|
+
&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function mergeObject(target, source, options) {
|
|
88
|
+
var destination = {};
|
|
89
|
+
if (options.isMergeableObject(target)) {
|
|
90
|
+
getKeys(target).forEach(function(key) {
|
|
91
|
+
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
getKeys(source).forEach(function(key) {
|
|
95
|
+
if (propertyIsUnsafe(target, key)) {
|
|
96
|
+
return
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
|
100
|
+
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
101
|
+
} else {
|
|
102
|
+
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
return destination
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function deepmerge(target, source, options) {
|
|
109
|
+
options = options || {};
|
|
110
|
+
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
111
|
+
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
112
|
+
// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
|
|
113
|
+
// implementations can use it. The caller may not replace it.
|
|
114
|
+
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
115
|
+
|
|
116
|
+
var sourceIsArray = Array.isArray(source);
|
|
117
|
+
var targetIsArray = Array.isArray(target);
|
|
118
|
+
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
119
|
+
|
|
120
|
+
if (!sourceAndTargetTypesMatch) {
|
|
121
|
+
return cloneUnlessOtherwiseSpecified(source, options)
|
|
122
|
+
} else if (sourceIsArray) {
|
|
123
|
+
return options.arrayMerge(target, source, options)
|
|
124
|
+
} else {
|
|
125
|
+
return mergeObject(target, source, options)
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
deepmerge.all = function deepmergeAll(array, options) {
|
|
130
|
+
if (!Array.isArray(array)) {
|
|
131
|
+
throw new Error('first argument should be an array')
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return array.reduce(function(prev, next) {
|
|
135
|
+
return deepmerge(prev, next, options)
|
|
136
|
+
}, {})
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
var deepmerge_1 = deepmerge;
|
|
140
|
+
|
|
141
|
+
var cjs = deepmerge_1;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* GeoLocationProvider provides methods to access the device's location via the GeoLocation API ({@link https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API GeoLocation API}).
|
|
145
|
+
*/
|
|
146
|
+
class GeoLocationProvider {
|
|
147
|
+
/**
|
|
148
|
+
* Check if it is possible to get the position of the device using the GeoLocation API.
|
|
149
|
+
*
|
|
150
|
+
* @returns {boolean} True if the GeoLocation API is available in the browser, false otherwise.
|
|
151
|
+
*/
|
|
152
|
+
isAvailable() {
|
|
153
|
+
return 'geolocation' in navigator;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Check if the user has already granted permission to access the device's location.
|
|
157
|
+
*
|
|
158
|
+
* @returns {Promise<boolean>} A promise that resolves to true if permission is granted, false otherwise.
|
|
159
|
+
*/
|
|
160
|
+
async isAlreadyGranted() {
|
|
161
|
+
if ('permissions' in navigator === false || 'query' in navigator.permissions === false) {
|
|
162
|
+
return Promise.resolve(false);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
const result = await navigator.permissions.query({ name: 'geolocation' });
|
|
166
|
+
return result.state === 'granted';
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Listen for position updates from the GeoLocation API.
|
|
171
|
+
*
|
|
172
|
+
* @param {number} maxAccuracy - The maximum accuracy of the position to accept.
|
|
173
|
+
* @param {Function} positionError - Callback function to call when an error occurs while getting the position.
|
|
174
|
+
* @param {Function} positionInaccurate - Callback function to call when the position is inaccurate.
|
|
175
|
+
* @param {Function} positionRequesting - Callback function to call when the position is being requested.
|
|
176
|
+
* @param {Function} positionReceived - Callback function to call when a position is received.
|
|
177
|
+
*/
|
|
178
|
+
listenForPosition(maxAccuracy, positionError, positionInaccurate, positionRequesting, positionReceived) {
|
|
179
|
+
if ('permissions' in navigator === false || 'query' in navigator.permissions === false) {
|
|
180
|
+
positionError();
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
positionRequesting();
|
|
184
|
+
const requestTime = Date.now();
|
|
185
|
+
GeoLocationProvider.positionWatchId = navigator.geolocation.watchPosition(position => {
|
|
186
|
+
// If position is the same as before, don't do anything.
|
|
187
|
+
if (GeoLocationProvider.currentPosition
|
|
188
|
+
&& position.coords.accuracy === GeoLocationProvider.currentPosition.coords.accuracy
|
|
189
|
+
&& position.coords.latitude === GeoLocationProvider.currentPosition.coords.latitude
|
|
190
|
+
&& position.coords.longitude === GeoLocationProvider.currentPosition.coords.longitude) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
GeoLocationProvider.currentPosition = position;
|
|
194
|
+
if (!(GeoLocationProvider.currentPosition.coords.accuracy <= maxAccuracy)) {
|
|
195
|
+
positionInaccurate(position.coords.accuracy);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
positionReceived(position);
|
|
199
|
+
}
|
|
200
|
+
}, error => {
|
|
201
|
+
// Firefox may throw both success and a timeout error (https://bugzilla.mozilla.org/show_bug.cgi?id=1283563).
|
|
202
|
+
// We mitigate this by not passing on error if a correct position has been given since asking for it.
|
|
203
|
+
if (error.code !== 3 || !GeoLocationProvider.currentPosition || GeoLocationProvider.currentPosition.timestamp <= requestTime) {
|
|
204
|
+
positionError(error);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Stop listening for position updates from the GeoLocation API.
|
|
210
|
+
* This will clear the watch set by `listenForPosition` and reset the current position.
|
|
211
|
+
*
|
|
212
|
+
* @returns {void}
|
|
213
|
+
*/
|
|
214
|
+
stopListeningForPosition() {
|
|
215
|
+
if (GeoLocationProvider.positionWatchId !== null) {
|
|
216
|
+
navigator.geolocation.clearWatch(GeoLocationProvider.positionWatchId);
|
|
217
|
+
GeoLocationProvider.positionWatchId = null;
|
|
218
|
+
}
|
|
219
|
+
GeoLocationProvider.currentPosition = null;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* The current position of the device if received.
|
|
224
|
+
*
|
|
225
|
+
* @type {GeolocationPosition | null}
|
|
226
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/GeolocationPosition}
|
|
227
|
+
*/
|
|
228
|
+
GeoLocationProvider.currentPosition = null;
|
|
229
|
+
/**
|
|
230
|
+
* The ID of the position watch set by the GeoLocation API.
|
|
231
|
+
* This is used to clear the watch when no longer needed.
|
|
232
|
+
*/
|
|
233
|
+
GeoLocationProvider.positionWatchId = null;
|
|
234
|
+
|
|
235
|
+
const myPositionCss = ".mi-my-position{display:flex;flex-direction:column;pointer-events:auto;gap:16px;right:0}.mi-my-position__position-button,.mi-my-position__compass-button{margin:0;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;width:48px;height:48px;background-repeat:no-repeat;background-position:center;outline:none;border-color:#e5e7eb;border-style:solid;background-color:#fcfcfc}.mi-my-position__position-button{background-size:23px;border-radius:8px}.mi-my-position__position-button--unknown{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0zLjY1NTIzIDEuMjIzNTZDMy4yNjQ3IDAuODMzMDMzIDIuNjMxNTQgMC44MzMwMzMgMi4yNDEwMSAxLjIyMzU2QzEuODUwNDkgMS42MTQwOCAxLjg1MDQ5IDIuMjQ3MjUgMi4yNDEwMSAyLjYzNzc3TDIyLjI2NiAyMi42NjI4QzIyLjY1NjUgMjMuMDUzMyAyMy4yODk3IDIzLjA1MzMgMjMuNjgwMiAyMi42NjI4QzI0LjA3MDcgMjIuMjcyMiAyNC4wNzA3IDIxLjYzOTEgMjMuNjgwMiAyMS4yNDg1TDE3LjcxNTcgMTUuMjg0MUwyMC43NzQ4IDcuMzYzMjVDMjEuNTYyOSA1LjMyMzE1IDE5LjU1NjIgMy4zMTY2NiAxNy41MTYyIDQuMTA0NTVMOS41OTUzNSA3LjE2MzY4TDMuNjU1MjMgMS4yMjM1NlpNMTEuMTQyIDguNzEwMzJMMTYuMTY5MSAxMy43Mzc0TDE4LjkwOTIgNi42NDI2MUMxOS4wNzE4IDYuMjIxNzIgMTguNjU3OCA1LjgwNzY0IDE4LjIzNjggNS45NzAyNEwxMS4xNDIgOC43MTAzMloiIGZpbGw9IiM3MzczNzMiLz4KPHBhdGggZD0iTTEzLjI1MTggMjEuMjkxMkwxNC45OTIxIDE2Ljc4NDlMMTYuNTM4OCAxOC4zMzE1TDE1LjExNzQgMjIuMDExOEMxNC4wNjc3IDI0LjcyOTYgMTAuMTUwOCAyNC41MDY5IDkuNDE1OTMgMjEuNjg3Nkw4LjEyOTA1IDE2Ljc1MDVMMy4xOTE4IDE1LjQ2MzZDMC4zNzI1MSAxNC43Mjg3IDAuMTQ5ODEyIDEwLjgxMTcgMi44Njc2NCA5Ljc2Mkw2LjY0NTEyIDguMzAzMDlMOC4xOTE3NyA5Ljg0OTc0TDMuNTg4MTkgMTEuNjI3N0MyLjY4MjI0IDExLjk3NzYgMi43NTY0OCAxMy4yODMzIDMuNjk2MjUgMTMuNTI4Mkw4LjYzMzUgMTQuODE1MUM5LjMzNDQzIDE0Ljk5NzggOS44ODE3OCAxNS41NDUyIDEwLjA2NDQgMTYuMjQ2TDExLjM1MTMgMjEuMTgzMkMxMS41OTYyIDIyLjEyMjkgMTIuOTAxOSAyMi4xOTcyIDEzLjI1MTggMjEuMjkxMloiIGZpbGw9IiM3MzczNzMiLz4KPC9zdmc+Cg==)}.mi-my-position__position-button--requesting{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkiIGhlaWdodD0iMTkiIHZpZXdCb3g9IjAgMCAxOSAxOSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTYuODkzNDEgMTEuMjgzTDEuOTU2MTYgOS45OTYxMUMwLjA3NjYyOTIgOS41MDYyIC0wLjA3MTg0MTEgNi44OTQ4NSAxLjc0MDA1IDYuMTk1MDdMMTYuMzg4NiAwLjUzNzYxN0MxNy42MTkxIDAuMDYyMzc2NiAxOC44Mjk0IDEuMjcyNjYgMTguMzU0MSAyLjUwMzE2TDEyLjY5NjcgMTcuMTUxN0MxMS45OTY5IDE4Ljk2MzYgOS4zODU2NCAxOC44MTUxIDguODk1NzQgMTYuOTM1Nkw3LjYwODg0IDExLjk5ODRDNy41MTc1NCAxMS42NDggNy4yNDM4NiAxMS4zNzQzIDYuODkzNDEgMTEuMjgzWiIgZmlsbD0iIzczNzM3MyIvPgo8L3N2Zz4K)}.mi-my-position__position-button--known{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkiIGhlaWdodD0iMTkiIHZpZXdCb3g9IjAgMCAxOSAxOSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTYuODkzNDEgMTEuMjgzTDEuOTU2MTYgOS45OTYxMUMwLjA3NjYyOTIgOS41MDYyIC0wLjA3MTg0MTEgNi44OTQ4NSAxLjc0MDA1IDYuMTk1MDdMMTYuMzg4NiAwLjUzNzYxN0MxNy42MTkxIDAuMDYyMzc2NiAxOC44Mjk0IDEuMjcyNjYgMTguMzU0MSAyLjUwMzE2TDEyLjY5NjcgMTcuMTUxN0MxMS45OTY5IDE4Ljk2MzYgOS4zODU2NCAxOC44MTUxIDguODk1NzQgMTYuOTM1Nkw3LjYwODg0IDExLjk5ODRDNy41MTc1NCAxMS42NDggNy4yNDM4NiAxMS4zNzQzIDYuODkzNDEgMTEuMjgzWiIgZmlsbD0iIzczNzM3MyIvPgo8L3N2Zz4K)}.mi-my-position__position-button--centered{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkiIGhlaWdodD0iMTkiIHZpZXdCb3g9IjAgMCAxOSAxOSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTYuODkzNDEgMTEuMjgzTDEuOTU2MTYgOS45OTYxMUMwLjA3NjYyOTIgOS41MDYyIC0wLjA3MTg0MTEgNi44OTQ4NSAxLjc0MDA1IDYuMTk1MDdMMTYuMzg4NiAwLjUzNzYxN0MxNy42MTkxIDAuMDYyMzc2NiAxOC44Mjk0IDEuMjcyNjYgMTguMzU0MSAyLjUwMzE2TDEyLjY5NjcgMTcuMTUxN0MxMS45OTY5IDE4Ljk2MzYgOS4zODU2NCAxOC44MTUxIDguODk1NzQgMTYuOTM1Nkw3LjYwODg0IDExLjk5ODRDNy41MTc1NCAxMS42NDggNy4yNDM4NiAxMS4zNzQzIDYuODkzNDEgMTEuMjgzWiIgZmlsbD0iIzI1NjNFQiIvPgo8L3N2Zz4K)}.mi-my-position__position-button--tracked{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjUiIGhlaWdodD0iMjUiIHZpZXdCb3g9IjAgMCAyNSAyNSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyLjQ2MDQgMTMuNDMwOUMxMy4wMTI3IDEzLjQzMDkgMTMuNDYwNCAxMi45ODMyIDEzLjQ2MDQgMTIuNDMwOUMxMy40NjA0IDExLjg3ODYgMTMuMDEyNyAxMS40MzA5IDEyLjQ2MDQgMTEuNDMwOUMxMS45MDgxIDExLjQzMDkgMTEuNDYwNCAxMS44Nzg2IDExLjQ2MDQgMTIuNDMwOUMxMS40NjA0IDEyLjk4MzIgMTEuOTA4MSAxMy40MzA5IDEyLjQ2MDQgMTMuNDMwOVoiIGZpbGw9IiMyNTYzRUIiLz4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yMi40NjA0IDEyLjQzMDlDMjIuNDYwNCAxNy45NTM3IDE3Ljk4MzIgMjIuNDMwOSAxMi40NjA0IDIyLjQzMDlDNi45Mzc2IDIyLjQzMDkgMi40NjA0NSAxNy45NTM3IDIuNDYwNDUgMTIuNDMwOUMyLjQ2MDQ1IDYuOTA4MDYgNi45Mzc2IDIuNDMwOTEgMTIuNDYwNCAyLjQzMDkxQzE3Ljk4MzIgMi40MzA5MSAyMi40NjA0IDYuOTA4MDYgMjIuNDYwNCAxMi40MzA5Wk0xNS44Mzc5IDguNDQ2MTJMMTAuNTM4OSA5Ljc4NDc4QzEwLjE4MjYgOS44NzQ4IDkuOTA0MzYgMTAuMTUzIDkuODE0MzQgMTAuNTA5NEw4LjQ3NTcyIDE1LjgwODRDOC4zODMgMTYuMTc1NSA4LjcxNTk0IDE2LjUwODQgOS4wODI5NSAxNi40MTU3TDE0LjM4MTkgMTUuMDc3QzE0LjczODMgMTQuOTg3IDE1LjAxNjUgMTQuNzA4OCAxNS4xMDY2IDE0LjM1MjRMMTYuNDQ1MiA5LjA1MzM1QzE2LjUzNzkgOC42ODYzMyAxNi4yMDUgOC4zNTM0IDE1LjgzNzkgOC40NDYxMloiIGZpbGw9IiMyNTYzRUIiLz4KPC9zdmc+Cg==)}.mi-my-position__position-button--untracked{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjUiIGhlaWdodD0iMjUiIHZpZXdCb3g9IjAgMCAyNSAyNSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyLjQ2MDQgMTMuNDMwOUMxMy4wMTI3IDEzLjQzMDkgMTMuNDYwNCAxMi45ODMyIDEzLjQ2MDQgMTIuNDMwOUMxMy40NjA0IDExLjg3ODYgMTMuMDEyNyAxMS40MzA5IDEyLjQ2MDQgMTEuNDMwOUMxMS45MDgxIDExLjQzMDkgMTEuNDYwNCAxMS44Nzg2IDExLjQ2MDQgMTIuNDMwOUMxMS40NjA0IDEyLjk4MzIgMTEuOTA4MSAxMy40MzA5IDEyLjQ2MDQgMTMuNDMwOVoiIGZpbGw9IiMwMDAwMDAiLz4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yMi40NjA0IDEyLjQzMDlDMjIuNDYwNCAxNy45NTM3IDE3Ljk4MzIgMjIuNDMwOSAxMi40NjA0IDIyLjQzMDlDNi45Mzc2IDIyLjQzMDkgMi40NjA0NSAxNy45NTM3IDIuNDYwNDUgMTIuNDMwOUMyLjQ2MDQ1IDYuOTA4MDYgNi45Mzc2IDIuNDMwOTEgMTIuNDYwNCAyLjQzMDkxQzE3Ljk4MzIgMi40MzA5MSAyMi40NjA0IDYuOTA4MDYgMjIuNDYwNCAxMi40MzA5Wk0xNS44Mzc5IDguNDQ2MTJMMTAuNTM4OSA5Ljc4NDc4QzEwLjE4MjYgOS44NzQ4IDkuOTA0MzYgMTAuMTUzIDkuODE0MzQgMTAuNTA5NEw4LjQ3NTcyIDE1LjgwODRDOC4zODMgMTYuMTc1NSA4LjcxNTk0IDE2LjUwODQgOS4wODI5NSAxNi40MTU3TDE0LjM4MTkgMTUuMDc3QzE0LjczODMgMTQuOTg3IDE1LjAxNjUgMTQuNzA4OCAxNS4xMDY2IDE0LjM1MjRMMTYuNDQ1MiA5LjA1MzM1QzE2LjUzNzkgOC42ODYzMyAxNi4yMDUgOC4zNTM0IDE1LjgzNzkgOC40NDYxMloiIGZpbGw9IiMwMDAwMDAiLz4KPC9zdmc+Cg==)}.mi-my-position__position-button--follow{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjUiIGhlaWdodD0iMjUiIHZpZXdCb3g9IjAgMCAyNSAyNSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyLjQ2MDQgMTMuNDMwOUMxMy4wMTI3IDEzLjQzMDkgMTMuNDYwNCAxMi45ODMyIDEzLjQ2MDQgMTIuNDMwOUMxMy40NjA0IDExLjg3ODYgMTMuMDEyNyAxMS40MzA5IDEyLjQ2MDQgMTEuNDMwOUMxMS45MDgxIDExLjQzMDkgMTEuNDYwNCAxMS44Nzg2IDExLjQ2MDQgMTIuNDMwOUMxMS40NjA0IDEyLjk4MzIgMTEuOTA4MSAxMy40MzA5IDEyLjQ2MDQgMTMuNDMwOVoiIGZpbGw9IiMyNTYzRUIiLz4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yMi40NjA0IDEyLjQzMDlDMjIuNDYwNCAxNy45NTM3IDE3Ljk4MzIgMjIuNDMwOSAxMi40NjA0IDIyLjQzMDlDNi45Mzc2IDIyLjQzMDkgMi40NjA0NSAxNy45NTM3IDIuNDYwNDUgMTIuNDMwOUMyLjQ2MDQ1IDYuOTA4MDYgNi45Mzc2IDIuNDMwOTEgMTIuNDYwNCAyLjQzMDkxQzE3Ljk4MzIgMi40MzA5MSAyMi40NjA0IDYuOTA4MDYgMjIuNDYwNCAxMi40MzA5Wk0xNS44Mzc5IDguNDQ2MTJMMTAuNTM4OSA5Ljc4NDc4QzEwLjE4MjYgOS44NzQ4IDkuOTA0MzYgMTAuMTUzIDkuODE0MzQgMTAuNTA5NEw4LjQ3NTcyIDE1LjgwODRDOC4zODMgMTYuMTc1NSA4LjcxNTk0IDE2LjUwODQgOS4wODI5NSAxNi40MTU3TDE0LjM4MTkgMTUuMDc3QzE0LjczODMgMTQuOTg3IDE1LjAxNjUgMTQuNzA4OCAxNS4xMDY2IDE0LjM1MjRMMTYuNDQ1MiA5LjA1MzM1QzE2LjUzNzkgOC42ODYzMyAxNi4yMDUgOC4zNTM0IDE1LjgzNzkgOC40NDYxMloiIGZpbGw9IiMyNTYzRUIiLz4KPC9zdmc+Cg==);border-color:#2563EB}.mi-my-position__compass-button{background-size:12px;background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTMiIGhlaWdodD0iMzAiIHZpZXdCb3g9IjAgMCAxMyAzMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTUuNTQ4MTMgMi45NjI0MUM1LjkwMTU5IDIuMTc1MjcgNy4wMTkxNSAyLjE3NTI3IDcuMzcyNjIgMi45NjI0MUwxMS41OTI5IDEyLjM2MDZDMTEuOTQ5MSAxMy4xNTM4IDExLjE5MzEgMTMuOTkyMyAxMC4zNjczIDEzLjcxOTlMNi43NzM2NyAxMi41MzQzQzYuNTcwMiAxMi40NjcxIDYuMzUwNTQgMTIuNDY3MSA2LjE0NzA3IDEyLjUzNDNMMi41NTM0MyAxMy43MTk5QzEuNzI3NjggMTMuOTkyMyAwLjk3MTY4MyAxMy4xNTM4IDEuMzI3ODggMTIuMzYwNkw1LjU0ODEzIDIuOTYyNDFaIiBmaWxsPSIjREMyNjI2Ii8+CjxwYXRoIGQ9Ik03LjM3MjUzIDI3Ljg5OTRDNy4wMTkwNiAyOC42ODY1IDUuOTAxNSAyOC42ODY1IDUuNTQ4MDQgMjcuODk5NEwxLjMyNzc5IDE4LjUwMTJDMC45NzE1OTcgMTcuNzA4IDEuNzI3NTkgMTYuODY5NSAyLjU1MzM0IDE3LjE0Mkw2LjE0Njk4IDE4LjMyNzVDNi4zNTA0NiAxOC4zOTQ3IDYuNTcwMTEgMTguMzk0NyA2Ljc3MzU5IDE4LjMyNzVMMTAuMzY3MiAxNy4xNDJDMTEuMTkzIDE2Ljg2OTUgMTEuOTQ5IDE3LjcwOCAxMS41OTI4IDE4LjUwMTJMNy4zNzI1MyAyNy44OTk0WiIgZmlsbD0iIzlDQTNBRiIvPgo8L3N2Zz4K);border-radius:50%}";
|
|
236
|
+
|
|
237
|
+
var PositionStateTypes;
|
|
238
|
+
(function (PositionStateTypes) {
|
|
239
|
+
PositionStateTypes["POSITION_UNKNOWN"] = "POSITION_UNKNOWN";
|
|
240
|
+
PositionStateTypes["POSITION_REQUESTING"] = "POSITION_REQUESTING";
|
|
241
|
+
PositionStateTypes["POSITION_INACCURATE"] = "POSITION_INACCURATE";
|
|
242
|
+
PositionStateTypes["POSITION_KNOWN"] = "POSITION_KNOWN";
|
|
243
|
+
PositionStateTypes["POSITION_CENTERED"] = "POSITION_CENTERED";
|
|
244
|
+
PositionStateTypes["POSITION_TRACKED"] = "POSITION_TRACKED";
|
|
245
|
+
PositionStateTypes["POSITION_UNTRACKED"] = "POSITION_UNTRACKED";
|
|
246
|
+
PositionStateTypes["POSITION_FOLLOW"] = "POSITION_FOLLOW";
|
|
247
|
+
})(PositionStateTypes || (PositionStateTypes = {}));
|
|
248
|
+
const MyPositionComponent = class {
|
|
249
|
+
constructor(hostRef) {
|
|
250
|
+
registerInstance(this, hostRef);
|
|
251
|
+
this.position_error = createEvent(this, "position_error", 7);
|
|
252
|
+
this.position_received = createEvent(this, "position_received", 7);
|
|
253
|
+
/**
|
|
254
|
+
* New UAParser instance.
|
|
255
|
+
*/
|
|
256
|
+
this.parser = new uaParser_pack.UAParser();
|
|
257
|
+
/**
|
|
258
|
+
* Reference to the handleDeviceOrientation function.
|
|
259
|
+
*/
|
|
260
|
+
this.handleDeviceOrientationReference = this.handleDeviceOrientation.bind(this);
|
|
261
|
+
/**
|
|
262
|
+
* Cached current building for validation.
|
|
263
|
+
* Cached to avoid repeated lookups on every position update.
|
|
264
|
+
*/
|
|
265
|
+
this.cachedBuilding = null;
|
|
266
|
+
/**
|
|
267
|
+
* Reference to the modern provider's onPositionReceived event handler.
|
|
268
|
+
* Stored to enable proper cleanup when component disconnects or provider changes.
|
|
269
|
+
*/
|
|
270
|
+
this.onPositionReceivedHandler = null;
|
|
271
|
+
/**
|
|
272
|
+
* Reference to the modern provider's onPositionError event handler.
|
|
273
|
+
* Stored to enable proper cleanup when component disconnects or provider changes.
|
|
274
|
+
*/
|
|
275
|
+
this.onPositionErrorHandler = null;
|
|
276
|
+
/**
|
|
277
|
+
* Reference to the floor_changed event handler.
|
|
278
|
+
* Stored to enable proper cleanup when component disconnects.
|
|
279
|
+
*/
|
|
280
|
+
this.floorChangedHandler = null;
|
|
281
|
+
/**
|
|
282
|
+
* Track the last applied fillOpacity to avoid unnecessary refreshes.
|
|
283
|
+
* Only refresh the marker when opacity actually changes (crossing floor boundaries).
|
|
284
|
+
*/
|
|
285
|
+
this.lastAppliedOpacity = 1;
|
|
286
|
+
this.defaultFillOpacity = 1;
|
|
287
|
+
this.reducedFillOpacity = 0.3;
|
|
288
|
+
/**
|
|
289
|
+
* Default options.
|
|
290
|
+
*/
|
|
291
|
+
this.defaultOptions = {
|
|
292
|
+
maxAccuracy: 200,
|
|
293
|
+
positionOptions: {
|
|
294
|
+
timeout: 30000,
|
|
295
|
+
enableHighAccuracy: true,
|
|
296
|
+
maximumAge: 0
|
|
297
|
+
},
|
|
298
|
+
positionMarkerStyles: {
|
|
299
|
+
radius: '12px',
|
|
300
|
+
strokeWeight: '2px',
|
|
301
|
+
strokeColor: 'white',
|
|
302
|
+
fillColor: '#4169E1',
|
|
303
|
+
fillOpacity: this.defaultFillOpacity
|
|
304
|
+
},
|
|
305
|
+
accuracyCircleStyles: {
|
|
306
|
+
fillColor: '#4169E1',
|
|
307
|
+
fillOpacity: 0.16
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
this.mapsindoors = undefined;
|
|
311
|
+
this.myPositionOptions = undefined;
|
|
312
|
+
this.customPositionProvider = undefined;
|
|
313
|
+
this.positionState = PositionStateTypes.POSITION_UNKNOWN;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Cleans up modern position provider event listeners.
|
|
317
|
+
* Removes registered event handlers and nulls the stored references to prevent memory leaks.
|
|
318
|
+
*/
|
|
319
|
+
cleanupModernProviderListeners() {
|
|
320
|
+
if (!this.isModernProvider(this.positionProvider)) {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
const modernProvider = this.positionProvider;
|
|
324
|
+
// Remove event listeners if they exist
|
|
325
|
+
if (this.onPositionReceivedHandler) {
|
|
326
|
+
modernProvider.off('position_received', this.onPositionReceivedHandler);
|
|
327
|
+
this.onPositionReceivedHandler = null;
|
|
328
|
+
}
|
|
329
|
+
if (this.onPositionErrorHandler) {
|
|
330
|
+
modernProvider.off('position_error', this.onPositionErrorHandler);
|
|
331
|
+
this.onPositionErrorHandler = null;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Sets up event listeners for modern position providers.
|
|
336
|
+
* This ensures that position updates are handled immediately when setPosition() is called.
|
|
337
|
+
*
|
|
338
|
+
* Note: We use this.positionProvider (not this.customPositionProvider) because:
|
|
339
|
+
* - this.positionProvider is the resolved, validated provider
|
|
340
|
+
* - It's guaranteed to exist and be valid
|
|
341
|
+
* - It handles both custom and default providers consistently
|
|
342
|
+
* - All other methods in the component use this.positionProvider for consistency.
|
|
343
|
+
*/
|
|
344
|
+
setupModernProviderListeners() {
|
|
345
|
+
if (!this.isModernProvider(this.positionProvider)) {
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
// Clean up any existing listeners first
|
|
349
|
+
this.cleanupModernProviderListeners();
|
|
350
|
+
const modernProvider = this.positionProvider;
|
|
351
|
+
// Create and store event handler references
|
|
352
|
+
this.onPositionReceivedHandler = ({ position }) => {
|
|
353
|
+
this.currentPosition = position;
|
|
354
|
+
this.positionIsAccurate = position.coords.accuracy <= this.options.maxAccuracy;
|
|
355
|
+
// Ensure the position provider is set on the MapView so the dot appears
|
|
356
|
+
this.setPositionProviderOnMapView();
|
|
357
|
+
// Update state based on current position state
|
|
358
|
+
if (this.positionState === PositionStateTypes.POSITION_TRACKED) {
|
|
359
|
+
this.setPositionState(PositionStateTypes.POSITION_UNTRACKED);
|
|
360
|
+
}
|
|
361
|
+
else if (this.positionState === PositionStateTypes.POSITION_UNKNOWN || this.positionState === PositionStateTypes.POSITION_REQUESTING) {
|
|
362
|
+
// Auto-enter FOLLOW mode only on first position (from UNKNOWN or REQUESTING)
|
|
363
|
+
this.setPositionState(PositionStateTypes.POSITION_FOLLOW);
|
|
364
|
+
}
|
|
365
|
+
else if (this.positionState !== PositionStateTypes.POSITION_UNTRACKED && this.positionState !== PositionStateTypes.POSITION_FOLLOW) {
|
|
366
|
+
// For other states, transition to KNOWN
|
|
367
|
+
this.setPositionState(PositionStateTypes.POSITION_KNOWN);
|
|
368
|
+
}
|
|
369
|
+
// Handle mode-specific behavior
|
|
370
|
+
if (this.positionState === PositionStateTypes.POSITION_FOLLOW) {
|
|
371
|
+
// FOLLOW mode: auto-pan and change floors
|
|
372
|
+
this.handleFollowModePosition(position);
|
|
373
|
+
this.applyOpacityForPosition(position);
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
// Non-FOLLOW modes: update opacity based on floor match
|
|
377
|
+
this.applyOpacityForPosition(position);
|
|
378
|
+
}
|
|
379
|
+
window.removeEventListener('deviceorientation', this.handleDeviceOrientationReference);
|
|
380
|
+
this.position_received.emit({
|
|
381
|
+
position: this.currentPosition,
|
|
382
|
+
selfInvoked: false,
|
|
383
|
+
accurate: this.positionIsAccurate
|
|
384
|
+
});
|
|
385
|
+
};
|
|
386
|
+
this.onPositionErrorHandler = (error) => {
|
|
387
|
+
this.setPositionState(PositionStateTypes.POSITION_UNKNOWN);
|
|
388
|
+
this.position_error.emit(error);
|
|
389
|
+
};
|
|
390
|
+
// Register the event listeners
|
|
391
|
+
modernProvider.on('position_received', this.onPositionReceivedHandler);
|
|
392
|
+
modernProvider.on('position_error', this.onPositionErrorHandler);
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Sets a custom position. Works with any provider that implements setPosition.
|
|
396
|
+
* Uses this.positionProvider (the resolved provider) instead of this.customPositionProvider
|
|
397
|
+
* to ensure we're working with the validated, active provider.
|
|
398
|
+
*/
|
|
399
|
+
async setPosition(position) {
|
|
400
|
+
var _a;
|
|
401
|
+
if ((_a = this.positionProvider) === null || _a === void 0 ? void 0 : _a.setPosition) {
|
|
402
|
+
this.positionProvider.setPosition(position);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Removes the event listener for the device's orientation and resets the position button.
|
|
407
|
+
*/
|
|
408
|
+
resetPositionState() {
|
|
409
|
+
window.removeEventListener('deviceorientation', this.handleDeviceOrientationReference);
|
|
410
|
+
if (this.positionState === PositionStateTypes.POSITION_TRACKED) {
|
|
411
|
+
this.setPositionState(PositionStateTypes.POSITION_UNTRACKED);
|
|
412
|
+
}
|
|
413
|
+
else if (this.positionState === PositionStateTypes.POSITION_CENTERED) {
|
|
414
|
+
this.setPositionState(PositionStateTypes.POSITION_KNOWN);
|
|
415
|
+
this.mapView.tilt(0);
|
|
416
|
+
}
|
|
417
|
+
// Don't reset FOLLOW state - it should persist until user clicks to exit
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Returns if position is known and accurate.
|
|
421
|
+
*
|
|
422
|
+
* @returns {boolean}
|
|
423
|
+
*/
|
|
424
|
+
hasValidPosition() {
|
|
425
|
+
return [PositionStateTypes.POSITION_KNOWN, PositionStateTypes.POSITION_CENTERED, PositionStateTypes.POSITION_INACCURATE, PositionStateTypes.POSITION_TRACKED, PositionStateTypes.POSITION_UNTRACKED, PositionStateTypes.POSITION_FOLLOW].includes(this.positionState);
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Sets the PositionControl as PositionProvider on the MapView.
|
|
429
|
+
*/
|
|
430
|
+
setPositionProviderOnMapView() {
|
|
431
|
+
if (this.mapView.isReady) {
|
|
432
|
+
this.mapView.setPositionProvider(this);
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
this.mapView.once('ready', () => {
|
|
436
|
+
this.mapView.setPositionProvider(this);
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Forces the position provider to refresh by removing and re-adding it.
|
|
442
|
+
* This makes the SDK re-read the updated options and redraw the marker.
|
|
443
|
+
*/
|
|
444
|
+
refreshPositionProvider() {
|
|
445
|
+
if (this.mapView.isReady) {
|
|
446
|
+
// Remove the provider
|
|
447
|
+
this.mapView.setPositionProvider(null);
|
|
448
|
+
// Re-add it on next frame to force redraw
|
|
449
|
+
requestAnimationFrame(() => {
|
|
450
|
+
this.mapView.setPositionProvider(this);
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Sets fillOpacity based on floor match and reapplies the provider so SDK re-reads styles.
|
|
456
|
+
* Only refreshes the marker when opacity actually changes to improve performance.
|
|
457
|
+
*/
|
|
458
|
+
applyOpacityForPosition(position) {
|
|
459
|
+
var _a;
|
|
460
|
+
if (!((_a = this.options) === null || _a === void 0 ? void 0 : _a.positionMarkerStyles))
|
|
461
|
+
return;
|
|
462
|
+
const matches = this.isFloorMatching(position);
|
|
463
|
+
const fillOpacity = matches ? this.defaultFillOpacity : this.reducedFillOpacity;
|
|
464
|
+
// Only refresh if opacity actually changed (crossing floor boundary)
|
|
465
|
+
if (fillOpacity === this.lastAppliedOpacity) {
|
|
466
|
+
return; // No change needed, skip expensive refresh
|
|
467
|
+
}
|
|
468
|
+
// Update fillOpacity directly - no need for new objects since we're forcing a refresh
|
|
469
|
+
this.options.positionMarkerStyles.fillOpacity = fillOpacity;
|
|
470
|
+
// Track the new opacity to avoid redundant refreshes
|
|
471
|
+
this.lastAppliedOpacity = fillOpacity;
|
|
472
|
+
// Force refresh to make SDK re-read options and redraw marker
|
|
473
|
+
this.refreshPositionProvider();
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Compares incoming position floor with current map floor and returns the result.
|
|
477
|
+
* Only used for modern providers during position updates.
|
|
478
|
+
*
|
|
479
|
+
* Returns true (full opacity) when:
|
|
480
|
+
* - The incoming floor matches the current map floor
|
|
481
|
+
* - The incoming floor is invalid (doesn't exist in the building) - treated as "no floor data"
|
|
482
|
+
*
|
|
483
|
+
* Returns false (reduced opacity) when:
|
|
484
|
+
* - The incoming floor is valid but different from the current map floor.
|
|
485
|
+
*
|
|
486
|
+
* @param {MapsIndoorsPosition} position - The position to compare.
|
|
487
|
+
* @returns {boolean} - True if the floor matches or is invalid, false otherwise.
|
|
488
|
+
*/
|
|
489
|
+
isFloorMatching(position) {
|
|
490
|
+
if (!this.mapsindoors)
|
|
491
|
+
return false;
|
|
492
|
+
const incomingFloor = position.floorIndex;
|
|
493
|
+
const currentFloor = this.mapsindoors.getFloor();
|
|
494
|
+
if (incomingFloor === undefined || incomingFloor === null || currentFloor === undefined || currentFloor === null) {
|
|
495
|
+
return false;
|
|
496
|
+
}
|
|
497
|
+
const incoming = incomingFloor.toString();
|
|
498
|
+
// If the incoming floor doesn't exist in the building, treat it as "no floor data"
|
|
499
|
+
// and return true to keep full opacity (don't penalize invalid floor data)
|
|
500
|
+
if (!this.isValidFloorForCurrentBuilding(incoming)) {
|
|
501
|
+
return true;
|
|
502
|
+
}
|
|
503
|
+
const matches = incoming === currentFloor;
|
|
504
|
+
return matches;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Pan map to center on the current position.
|
|
508
|
+
*/
|
|
509
|
+
panToCurrentPosition() {
|
|
510
|
+
if (!this.hasValidPosition()) {
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
// Whenever the map viewport changes again, set position state from centered to known.
|
|
514
|
+
// The outer event listener catches idle caused by the panTo.
|
|
515
|
+
// The inner event listeners catch any subsequent viewport changes caused by user interactions.
|
|
516
|
+
this.mapView.once('idle', () => {
|
|
517
|
+
this.mapView.on('user_interaction', () => this.resetPositionState());
|
|
518
|
+
});
|
|
519
|
+
this.mapView.panTo({ lat: this.currentPosition.coords.latitude, lng: this.currentPosition.coords.longitude });
|
|
520
|
+
if (this.positionState !== PositionStateTypes.POSITION_TRACKED && this.positionState !== PositionStateTypes.POSITION_FOLLOW) {
|
|
521
|
+
this.setPositionState(PositionStateTypes.POSITION_CENTERED);
|
|
522
|
+
}
|
|
523
|
+
if (!this.canBeTracked)
|
|
524
|
+
return;
|
|
525
|
+
if (DeviceOrientationEvent.requestPermission) {
|
|
526
|
+
DeviceOrientationEvent.requestPermission()
|
|
527
|
+
.then(permissionStatus => {
|
|
528
|
+
if (permissionStatus === 'granted' && this.positionState === PositionStateTypes.POSITION_TRACKED) {
|
|
529
|
+
window.addEventListener('deviceorientation', this.handleDeviceOrientationReference);
|
|
530
|
+
}
|
|
531
|
+
else {
|
|
532
|
+
window.removeEventListener('deviceorientation', this.handleDeviceOrientationReference);
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
else {
|
|
537
|
+
if (this.positionState === PositionStateTypes.POSITION_TRACKED) {
|
|
538
|
+
window.addEventListener('deviceorientation', this.handleDeviceOrientationReference);
|
|
539
|
+
}
|
|
540
|
+
else {
|
|
541
|
+
window.removeEventListener('deviceorientation', this.handleDeviceOrientationReference);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* Handles position updates in FOLLOW mode.
|
|
547
|
+
* Automatically pans the map and changes floors without user interaction listeners.
|
|
548
|
+
* Device orientation is handled by the existing handleDeviceOrientation method.
|
|
549
|
+
*/
|
|
550
|
+
handleFollowModePosition(position) {
|
|
551
|
+
if (!this.hasValidPosition()) {
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
// Pan to new position - device orientation will be handled by handleDeviceOrientation
|
|
555
|
+
this.mapView.panTo({ lat: position.coords.latitude, lng: position.coords.longitude });
|
|
556
|
+
// Check for floor changes if floorIndex is provided
|
|
557
|
+
if (position.floorIndex !== undefined && position.floorIndex !== null && this.mapsindoors) {
|
|
558
|
+
const currentFloor = this.mapsindoors.getFloor();
|
|
559
|
+
const newFloor = position.floorIndex.toString();
|
|
560
|
+
// Only change floor if it's different and valid for the current building
|
|
561
|
+
if (newFloor !== currentFloor && this.isValidFloorForCurrentBuilding(newFloor)) {
|
|
562
|
+
this.mapsindoors.setFloor(newFloor);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Validates if a floor index exists in the current building.
|
|
568
|
+
* Checks the current building's floors to ensure the floor index is valid.
|
|
569
|
+
* Uses caching to avoid repeated lookups on every position update.
|
|
570
|
+
*
|
|
571
|
+
* @param {string} floorIndex - The floor index to validate.
|
|
572
|
+
* @returns {boolean} - True if the floor exists in the current building.
|
|
573
|
+
*/
|
|
574
|
+
isValidFloorForCurrentBuilding(floorIndex) {
|
|
575
|
+
if (!this.mapsindoors) {
|
|
576
|
+
return false;
|
|
577
|
+
}
|
|
578
|
+
try {
|
|
579
|
+
// Get the current building directly from MapsIndoors SDK
|
|
580
|
+
const currentBuilding = this.mapsindoors.getBuilding();
|
|
581
|
+
if (!currentBuilding || !currentBuilding.floors) {
|
|
582
|
+
// Clear cache if building is invalid
|
|
583
|
+
this.clearBuildingFloorsCache();
|
|
584
|
+
return false;
|
|
585
|
+
}
|
|
586
|
+
// Verify cache is still valid by checking building ID
|
|
587
|
+
// If building changed or cache is empty, refresh cache
|
|
588
|
+
// This avoids repeated property access on every position update
|
|
589
|
+
if (!this.cachedBuilding || this.cachedBuilding.id !== currentBuilding.id) {
|
|
590
|
+
this.cachedBuilding = currentBuilding;
|
|
591
|
+
}
|
|
592
|
+
// Check if the floor index exists in the building's floors
|
|
593
|
+
// Floors object has keys like "0", "10", "20", "30", etc. representing floorIndexes
|
|
594
|
+
// Use 'in' operator which is slightly faster than hasOwnProperty for this use case
|
|
595
|
+
const floorExists = floorIndex in this.cachedBuilding.floors;
|
|
596
|
+
return floorExists;
|
|
597
|
+
}
|
|
598
|
+
catch (error) {
|
|
599
|
+
// If there's an error getting building data, allow the floor change
|
|
600
|
+
// This prevents blocking floor changes due to API issues
|
|
601
|
+
// Clear cache on error
|
|
602
|
+
this.clearBuildingFloorsCache();
|
|
603
|
+
return true;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Clears the cached building.
|
|
608
|
+
* Should be called when the building changes to ensure fresh validation.
|
|
609
|
+
*/
|
|
610
|
+
clearBuildingFloorsCache() {
|
|
611
|
+
this.cachedBuilding = null;
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* Rotates and tilts the map.
|
|
615
|
+
*
|
|
616
|
+
* @param {DeviceOrientationEvent} e
|
|
617
|
+
*/
|
|
618
|
+
handleDeviceOrientation(e) {
|
|
619
|
+
// Only rotate the map if:
|
|
620
|
+
// 1. No rotation has been applied before.
|
|
621
|
+
// 2. The new rotation would differ by more than on degree from the current rotation
|
|
622
|
+
if (!this.orientation || this.orientation - (360 - e.alpha) > 1 || this.orientation - (360 - e.alpha) < -1) {
|
|
623
|
+
this.orientation = 360 - e.alpha;
|
|
624
|
+
this.mapView.easeTo({
|
|
625
|
+
center: [this.currentPosition.coords.longitude, this.currentPosition.coords.latitude],
|
|
626
|
+
rotation: this.orientation,
|
|
627
|
+
tilt: 60,
|
|
628
|
+
easing: (t) => t * (2 - t)
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Rotates the compass button using the transform CSS property.
|
|
634
|
+
*
|
|
635
|
+
* @param {number} bearing
|
|
636
|
+
*/
|
|
637
|
+
setCompassStyle(bearing) {
|
|
638
|
+
if (this.compassButton) {
|
|
639
|
+
this.compassButton.style.transform = `rotate(${bearing}deg)`;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* Method for requesting the current position, emitting events and showing position on map based on result.
|
|
644
|
+
*
|
|
645
|
+
* @param {boolean} [selfInvoked=false] - Used to track if call was invoked by clicking on position control or not.
|
|
646
|
+
*/
|
|
647
|
+
watchPosition(selfInvoked = false) {
|
|
648
|
+
this.setPositionProviderOnMapView();
|
|
649
|
+
if (this.isLegacyProvider(this.positionProvider)) {
|
|
650
|
+
// Use legacy callback-based interface
|
|
651
|
+
this.positionProvider.listenForPosition(this.options.maxAccuracy,
|
|
652
|
+
// Position error callback
|
|
653
|
+
error => {
|
|
654
|
+
this.setPositionState(PositionStateTypes.POSITION_UNKNOWN);
|
|
655
|
+
this.position_error.emit(error);
|
|
656
|
+
},
|
|
657
|
+
// Position inaccurate callback
|
|
658
|
+
accuracy => {
|
|
659
|
+
this.setPositionState(PositionStateTypes.POSITION_INACCURATE);
|
|
660
|
+
this.position_error.emit({ code: 11, message: 'Inaccurate position: ' + accuracy });
|
|
661
|
+
},
|
|
662
|
+
// Position requesting callback
|
|
663
|
+
() => {
|
|
664
|
+
// Don't override FOLLOW state
|
|
665
|
+
if (this.positionState !== PositionStateTypes.POSITION_FOLLOW) {
|
|
666
|
+
this.setPositionState(PositionStateTypes.POSITION_REQUESTING);
|
|
667
|
+
}
|
|
668
|
+
},
|
|
669
|
+
// Position received callback
|
|
670
|
+
position => {
|
|
671
|
+
this.currentPosition = position;
|
|
672
|
+
this.positionIsAccurate = this.currentPosition.coords.accuracy <= this.options.maxAccuracy;
|
|
673
|
+
// Don't override FOLLOW state - let the event handler manage it
|
|
674
|
+
if (this.positionState === PositionStateTypes.POSITION_TRACKED) {
|
|
675
|
+
this.setPositionState(PositionStateTypes.POSITION_UNTRACKED);
|
|
676
|
+
}
|
|
677
|
+
else if (this.positionState !== PositionStateTypes.POSITION_UNTRACKED && this.positionState !== PositionStateTypes.POSITION_FOLLOW) {
|
|
678
|
+
this.setPositionState(PositionStateTypes.POSITION_KNOWN);
|
|
679
|
+
}
|
|
680
|
+
window.removeEventListener('deviceorientation', this.handleDeviceOrientationReference);
|
|
681
|
+
this.position_received.emit({
|
|
682
|
+
position: this.currentPosition,
|
|
683
|
+
selfInvoked,
|
|
684
|
+
accurate: this.positionIsAccurate
|
|
685
|
+
});
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
else {
|
|
689
|
+
// Use modern event-based interface
|
|
690
|
+
const modernProvider = this.positionProvider;
|
|
691
|
+
// Event listeners are already set up in setupModernProviderListeners()
|
|
692
|
+
// Just check if provider already has a valid position
|
|
693
|
+
if (modernProvider.hasValidPosition && modernProvider.hasValidPosition()) {
|
|
694
|
+
// Manually trigger the position received logic
|
|
695
|
+
this.currentPosition = modernProvider.currentPosition;
|
|
696
|
+
this.positionIsAccurate = this.currentPosition.coords.accuracy <= this.options.maxAccuracy;
|
|
697
|
+
// Don't override FOLLOW state - let the event handler manage it
|
|
698
|
+
if (this.positionState === PositionStateTypes.POSITION_TRACKED) {
|
|
699
|
+
this.setPositionState(PositionStateTypes.POSITION_UNTRACKED);
|
|
700
|
+
}
|
|
701
|
+
else if (this.positionState !== PositionStateTypes.POSITION_UNTRACKED && this.positionState !== PositionStateTypes.POSITION_FOLLOW) {
|
|
702
|
+
this.setPositionState(PositionStateTypes.POSITION_KNOWN);
|
|
703
|
+
}
|
|
704
|
+
window.removeEventListener('deviceorientation', this.handleDeviceOrientationReference);
|
|
705
|
+
this.position_received.emit({
|
|
706
|
+
position: this.currentPosition,
|
|
707
|
+
selfInvoked,
|
|
708
|
+
accurate: this.positionIsAccurate
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
else {
|
|
712
|
+
// Check if this is an empty object case vs a provider that lost position
|
|
713
|
+
// If currentPosition is null, it's likely an empty object case - stay unknown
|
|
714
|
+
// If currentPosition exists but is invalid, it's a provider that lost position - request position
|
|
715
|
+
// Don't override FOLLOW state
|
|
716
|
+
if (this.positionState !== PositionStateTypes.POSITION_FOLLOW) {
|
|
717
|
+
if (modernProvider.currentPosition === null) {
|
|
718
|
+
// Provider was never given position data (empty object case) - stay unknown
|
|
719
|
+
this.setPositionState(PositionStateTypes.POSITION_UNKNOWN);
|
|
720
|
+
}
|
|
721
|
+
else {
|
|
722
|
+
// Provider had position data but it's now invalid - request position
|
|
723
|
+
this.setPositionState(PositionStateTypes.POSITION_REQUESTING);
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Sets position button state.
|
|
731
|
+
*
|
|
732
|
+
* @param {PositionStateTypes} state
|
|
733
|
+
*/
|
|
734
|
+
setPositionState(state) {
|
|
735
|
+
this.positionState = state;
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Handle click on the compass button.
|
|
739
|
+
*/
|
|
740
|
+
onCompassButtonClicked() {
|
|
741
|
+
this.setCompassStyle(0);
|
|
742
|
+
this.mapView.rotate(0);
|
|
743
|
+
this.mapView.tilt(0);
|
|
744
|
+
window.removeEventListener('deviceorientation', this.handleDeviceOrientationReference);
|
|
745
|
+
if (this.positionState === PositionStateTypes.POSITION_TRACKED) {
|
|
746
|
+
this.setPositionState(PositionStateTypes.POSITION_CENTERED);
|
|
747
|
+
}
|
|
748
|
+
else if (this.positionState === PositionStateTypes.POSITION_UNTRACKED) {
|
|
749
|
+
this.setPositionState(PositionStateTypes.POSITION_KNOWN);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* Handle click on position button.
|
|
754
|
+
* Stops propagation to avoid any map click listeners to fire.
|
|
755
|
+
*
|
|
756
|
+
* @param {Event} event
|
|
757
|
+
*/
|
|
758
|
+
onPositionButtonClicked(event) {
|
|
759
|
+
event.stopPropagation();
|
|
760
|
+
switch (this.positionState) {
|
|
761
|
+
case PositionStateTypes.POSITION_UNKNOWN:
|
|
762
|
+
this.mapView.tilt(0);
|
|
763
|
+
this.watchPosition(true);
|
|
764
|
+
break;
|
|
765
|
+
case PositionStateTypes.POSITION_KNOWN:
|
|
766
|
+
this.mapView.tilt(0);
|
|
767
|
+
this.panToCurrentPosition();
|
|
768
|
+
break;
|
|
769
|
+
case PositionStateTypes.POSITION_CENTERED:
|
|
770
|
+
// Check if we have a customPositionProvider to enable FOLLOW mode
|
|
771
|
+
if (this.customPositionProvider && this.isValidPositionProvider(this.customPositionProvider)) {
|
|
772
|
+
this.setPositionState(PositionStateTypes.POSITION_FOLLOW);
|
|
773
|
+
}
|
|
774
|
+
else if (this.canBeTracked) {
|
|
775
|
+
this.setPositionState(PositionStateTypes.POSITION_TRACKED);
|
|
776
|
+
}
|
|
777
|
+
this.panToCurrentPosition();
|
|
778
|
+
break;
|
|
779
|
+
case PositionStateTypes.POSITION_FOLLOW:
|
|
780
|
+
// Exit FOLLOW mode and return to KNOWN state
|
|
781
|
+
this.setPositionState(PositionStateTypes.POSITION_KNOWN);
|
|
782
|
+
break;
|
|
783
|
+
case PositionStateTypes.POSITION_TRACKED:
|
|
784
|
+
this.mapView.tilt(0);
|
|
785
|
+
this.mapView.rotate(0);
|
|
786
|
+
this.setCompassStyle(0);
|
|
787
|
+
this.setPositionState(PositionStateTypes.POSITION_CENTERED);
|
|
788
|
+
this.panToCurrentPosition();
|
|
789
|
+
break;
|
|
790
|
+
case PositionStateTypes.POSITION_UNTRACKED:
|
|
791
|
+
this.setPositionState(PositionStateTypes.POSITION_TRACKED);
|
|
792
|
+
this.panToCurrentPosition();
|
|
793
|
+
break;
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Called every time the component has connected to the DOM.
|
|
798
|
+
* 1. Assigning the mapView and options attributes.
|
|
799
|
+
* 2. Checking for the navigator's state.
|
|
800
|
+
* 3. Determining whether the device can be tracked.
|
|
801
|
+
* 4. Asking for permission to track the device.
|
|
802
|
+
* 5. Styling the compass button.
|
|
803
|
+
*/
|
|
804
|
+
connectedCallback() {
|
|
805
|
+
var _a;
|
|
806
|
+
this.mapView = this.mapsindoors.getMapView();
|
|
807
|
+
this.options = cjs(this.defaultOptions, (_a = this.myPositionOptions) !== null && _a !== void 0 ? _a : {});
|
|
808
|
+
// Clean up any existing position provider listeners before assigning a new one
|
|
809
|
+
// Only clean up if there's an existing position provider
|
|
810
|
+
if (this.positionProvider) {
|
|
811
|
+
this.cleanupModernProviderListeners();
|
|
812
|
+
}
|
|
813
|
+
// Provider Resolution Logic:
|
|
814
|
+
// 1. Check if user provided a customPositionProvider and it's valid
|
|
815
|
+
// 2. If yes, use it as this.positionProvider (our internal resolved provider)
|
|
816
|
+
// 3. If no, fallback to default GeoLocationProvider
|
|
817
|
+
// This pattern ensures this.positionProvider is always valid and ready to use
|
|
818
|
+
if (this.customPositionProvider && this.isValidPositionProvider(this.customPositionProvider)) {
|
|
819
|
+
// Use the custom provider - assign it to our internal resolved provider
|
|
820
|
+
this.positionProvider = this.customPositionProvider;
|
|
821
|
+
// If using a modern provider with options, merge them with the component's options
|
|
822
|
+
if (this.isModernProvider(this.positionProvider) && this.positionProvider.options) {
|
|
823
|
+
this.options = cjs(this.options, this.positionProvider.options);
|
|
824
|
+
}
|
|
825
|
+
// Set up event listeners for modern providers immediately
|
|
826
|
+
// This ensures setPosition() calls are handled without requiring user clicks
|
|
827
|
+
this.setupModernProviderListeners();
|
|
828
|
+
}
|
|
829
|
+
else {
|
|
830
|
+
// Fallback to default provider
|
|
831
|
+
this.positionProvider = new GeoLocationProvider();
|
|
832
|
+
}
|
|
833
|
+
// Check availability based on the interface type
|
|
834
|
+
const isAvailable = this.isLegacyProvider(this.positionProvider)
|
|
835
|
+
? this.positionProvider.isAvailable()
|
|
836
|
+
: true; // Modern providers are always considered available
|
|
837
|
+
if (isAvailable === false) {
|
|
838
|
+
this.setPositionState(PositionStateTypes.POSITION_UNKNOWN);
|
|
839
|
+
this.position_error.emit({ code: 10, message: 'Location not available' });
|
|
840
|
+
return;
|
|
841
|
+
}
|
|
842
|
+
const deviceType = this.parser.getDevice().type;
|
|
843
|
+
this.canBeTracked = (typeof window.DeviceOrientationEvent === 'function' &&
|
|
844
|
+
(deviceType === uaParser_pack.UAParser.DEVICE.MOBILE || deviceType === uaParser_pack.UAParser.DEVICE.TABLET) &&
|
|
845
|
+
this.mapView.rotatable &&
|
|
846
|
+
this.mapView.tiltable)
|
|
847
|
+
? true : false;
|
|
848
|
+
// Check if user has already granted permission to use the position.
|
|
849
|
+
// Note that this feature only works in modern browsers due to using the Permissions API (https://caniuse.com/#feat=permissions-api),
|
|
850
|
+
if (this.isLegacyProvider(this.positionProvider)) {
|
|
851
|
+
this.positionProvider.isAlreadyGranted().then(granted => {
|
|
852
|
+
if (granted) {
|
|
853
|
+
this.watchPosition();
|
|
854
|
+
}
|
|
855
|
+
else {
|
|
856
|
+
this.setPositionState(PositionStateTypes.POSITION_UNKNOWN);
|
|
857
|
+
}
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
else {
|
|
861
|
+
// Modern providers: check if they have a valid position immediately
|
|
862
|
+
if (this.positionProvider.hasValidPosition && this.positionProvider.hasValidPosition()) {
|
|
863
|
+
this.currentPosition = this.positionProvider.currentPosition;
|
|
864
|
+
this.setPositionState(PositionStateTypes.POSITION_KNOWN);
|
|
865
|
+
this.position_received.emit({
|
|
866
|
+
position: this.currentPosition,
|
|
867
|
+
selfInvoked: false,
|
|
868
|
+
accurate: true
|
|
869
|
+
});
|
|
870
|
+
// Update marker opacity based on floor match
|
|
871
|
+
// this.applyOpacityForPosition(this.currentPosition);
|
|
872
|
+
}
|
|
873
|
+
else {
|
|
874
|
+
this.setPositionState(PositionStateTypes.POSITION_UNKNOWN);
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
this.mapView.on('rotateend', () => {
|
|
878
|
+
this.setCompassStyle(this.mapView.getBearing());
|
|
879
|
+
});
|
|
880
|
+
// Listen for floor changes to update position marker opacity
|
|
881
|
+
// When user manually changes floor via floor selector, update opacity based on position's floor
|
|
882
|
+
if (this.mapsindoors && this.isModernProvider(this.positionProvider)) {
|
|
883
|
+
this.floorChangedHandler = () => {
|
|
884
|
+
// Only update if we have a current position and not in FOLLOW mode
|
|
885
|
+
// FOLLOW mode auto-changes floors so this isn't needed
|
|
886
|
+
if (this.currentPosition && this.positionState !== PositionStateTypes.POSITION_FOLLOW) {
|
|
887
|
+
this.applyOpacityForPosition(this.currentPosition);
|
|
888
|
+
}
|
|
889
|
+
};
|
|
890
|
+
this.mapsindoors.on('floor_changed', this.floorChangedHandler);
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* Checks if the provider is a valid position provider (either legacy or modern).
|
|
895
|
+
*
|
|
896
|
+
* @param {any} provider - The provider to check.
|
|
897
|
+
* @returns {boolean} True if the provider is valid.
|
|
898
|
+
*/
|
|
899
|
+
isValidPositionProvider(provider) {
|
|
900
|
+
if (!provider) {
|
|
901
|
+
return false;
|
|
902
|
+
}
|
|
903
|
+
// Check for legacy interface
|
|
904
|
+
if (typeof provider.isAvailable === 'function' &&
|
|
905
|
+
typeof provider.listenForPosition === 'function') {
|
|
906
|
+
return provider.isAvailable();
|
|
907
|
+
}
|
|
908
|
+
// Check for modern interface
|
|
909
|
+
if (typeof provider.hasValidPosition === 'function' &&
|
|
910
|
+
typeof provider.on === 'function' &&
|
|
911
|
+
typeof provider.off === 'function') {
|
|
912
|
+
return true;
|
|
913
|
+
}
|
|
914
|
+
return false;
|
|
915
|
+
}
|
|
916
|
+
/**
|
|
917
|
+
* Checks if the provider uses the legacy callback-based interface.
|
|
918
|
+
*
|
|
919
|
+
* @param {IPositionProvider} provider - The provider to check.
|
|
920
|
+
* @returns {boolean} True if the provider uses the legacy interface.
|
|
921
|
+
*/
|
|
922
|
+
isLegacyProvider(provider) {
|
|
923
|
+
return provider &&
|
|
924
|
+
typeof provider.isAvailable === 'function' &&
|
|
925
|
+
typeof provider.listenForPosition === 'function';
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* Checks if the provider uses the modern event-based interface.
|
|
929
|
+
*
|
|
930
|
+
* @param {IPositionProvider} provider - The provider to check.
|
|
931
|
+
* @returns {boolean} True if the provider uses the modern interface.
|
|
932
|
+
*/
|
|
933
|
+
isModernProvider(provider) {
|
|
934
|
+
return provider &&
|
|
935
|
+
typeof provider.hasValidPosition === 'function' &&
|
|
936
|
+
typeof provider.on === 'function' &&
|
|
937
|
+
typeof provider.off === 'function';
|
|
938
|
+
}
|
|
939
|
+
/**
|
|
940
|
+
* Component render callback.
|
|
941
|
+
*/
|
|
942
|
+
componentDidRender() {
|
|
943
|
+
this.setCompassStyle(this.mapView.getBearing());
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* Stops listening for position updates.
|
|
947
|
+
*/
|
|
948
|
+
disconnectedCallback() {
|
|
949
|
+
if (!this.positionProvider) {
|
|
950
|
+
return;
|
|
951
|
+
}
|
|
952
|
+
if (this.isLegacyProvider(this.positionProvider)) {
|
|
953
|
+
// Guard the legacy call with an existence check before invoking stopListeningForPosition
|
|
954
|
+
if (this.positionProvider.stopListeningForPosition) {
|
|
955
|
+
this.positionProvider.stopListeningForPosition();
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
else {
|
|
959
|
+
// Clean up modern provider event listeners
|
|
960
|
+
this.cleanupModernProviderListeners();
|
|
961
|
+
}
|
|
962
|
+
// Clean up floor_changed listener
|
|
963
|
+
if (this.mapsindoors && this.floorChangedHandler) {
|
|
964
|
+
this.mapsindoors.off('floor_changed', this.floorChangedHandler);
|
|
965
|
+
this.floorChangedHandler = null;
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* Renders the floor selector.
|
|
970
|
+
*
|
|
971
|
+
* @returns {JSX.Element}
|
|
972
|
+
*/
|
|
973
|
+
render() {
|
|
974
|
+
return (h(Host, null, h("div", { class: 'mi-my-position' }, h("button", { class: `mi-my-position__position-button
|
|
975
|
+
${this.positionState === PositionStateTypes.POSITION_UNKNOWN || this.positionState === PositionStateTypes.POSITION_INACCURATE ? 'mi-my-position__position-button--unknown' : ''}
|
|
976
|
+
${this.positionState === PositionStateTypes.POSITION_REQUESTING ? 'mi-my-position__position-button--requesting' : ''}
|
|
977
|
+
${this.positionState === PositionStateTypes.POSITION_KNOWN ? 'mi-my-position__position-button--known' : ''}
|
|
978
|
+
${this.positionState === PositionStateTypes.POSITION_CENTERED ? 'mi-my-position__position-button--centered' : ''}
|
|
979
|
+
${this.positionState === PositionStateTypes.POSITION_TRACKED ? 'mi-my-position__position-button--tracked' : ''}
|
|
980
|
+
${this.positionState === PositionStateTypes.POSITION_UNTRACKED ? 'mi-my-position__position-button--untracked' : ''}
|
|
981
|
+
${this.positionState === PositionStateTypes.POSITION_FOLLOW ? 'mi-my-position__position-button--follow' : ''}`, onClick: (event) => this.onPositionButtonClicked(event) }), h("button", { ref: (el) => this.compassButton = el, class: 'mi-my-position__compass-button', onClick: () => this.onCompassButtonClicked() }))));
|
|
982
|
+
}
|
|
983
|
+
};
|
|
984
|
+
MyPositionComponent.style = myPositionCss;
|
|
985
|
+
|
|
986
|
+
export { MyPositionComponent as mi_my_position };
|