@mapxus/mapxus-map-jp 10.1.1 → 10.2.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/index.umd.js +2 -2
- package/dist/{mapxus-map-10.1.1-jp.css → mapxus-map-10.2.0-jp.css} +0 -0
- package/dist/mapxus-map-10.2.0-jp.js +0 -0
- package/dist/utils.cjs +1 -1
- package/es/index.d.ts +5 -2
- package/es/index.mjs +675 -675
- package/es/{languages-Bg_kZzv4.mjs → languages-CigHNOt-.mjs} +33 -25
- package/es/utils/index.d.ts +3 -1
- package/es/utils/index.mjs +3 -3
- package/package.json +1 -1
- package/dist/mapxus-map-10.1.1-jp.js +0 -0
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(p,$){typeof exports=="object"&&typeof module<"u"?$(exports,require("@mapxus/mapxus-auth-jp"),require("maplibre-gl")):typeof define=="function"&&define.amd?define(["exports","@mapxus/mapxus-auth-jp","maplibre-gl"],$):(p=typeof globalThis<"u"?globalThis:p||self,$(p.MapxusMap={},p.MapxusAuth,p.maplibregl))})(this,(function(p,$,Nt){"use strict";var Lr={value:()=>{}};function ve(){for(var t=0,e=arguments.length,i={},r;t<e;++t){if(!(r=arguments[t]+"")||r in i||/[\s.]/.test(r))throw new Error("illegal type: "+r);i[r]=[]}return new Te(i)}function Te(t){this._=t}function wr(t,e){return t.trim().split(/^|\s+/).map(function(i){var r="",n=i.indexOf(".");if(n>=0&&(r=i.slice(n+1),i=i.slice(0,n)),i&&!e.hasOwnProperty(i))throw new Error("unknown type: "+i);return{type:i,name:r}})}Te.prototype=ve.prototype={constructor:Te,on:function(t,e){var i=this._,r=wr(t+"",i),n,s=-1,o=r.length;if(arguments.length<2){for(;++s<o;)if((n=(t=r[s]).type)&&(n=Br(i[n],t.name)))return n;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<o;)if(n=(t=r[s]).type)i[n]=Ut(i[n],t.name,e);else if(e==null)for(n in i)i[n]=Ut(i[n],t.name,null);return this},copy:function(){var t={},e=this._;for(var i in e)t[i]=e[i].slice();return new Te(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var i=new Array(n),r=0,n,s;r<n;++r)i[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=this._[t],r=0,n=s.length;r<n;++r)s[r].value.apply(e,i)},apply:function(t,e,i){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],n=0,s=r.length;n<s;++n)r[n].value.apply(e,i)}};function Br(t,e){for(var i=0,r=t.length,n;i<r;++i)if((n=t[i]).name===e)return n.value}function Ut(t,e,i){for(var r=0,n=t.length;r<n;++r)if(t[r].name===e){t[r]=Lr,t=t.slice(0,r).concat(t.slice(r+1));break}return i!=null&&t.push({name:e,value:i}),t}const Ze={version:"10.1.1"}.version,Re="https://map-api.mapxus.co.jp/bms",R=10,k=1,oe="api/v5/venues",ae="api/v5/buildings",j="api/v5/pois",Er="api/v4/route/query",Pr="api/v3/tiles/styles",jt="api/v5/categories/group",Fr="api/v1/categories/tree";class D{static instance;_globalDispatcher;_httpSession;_theme=null;_isSDKInitialized=!1;constructor(){}static getInstance(){return D.instance||(D.instance=new D),D.instance}setGlobalDispatcher(e){this._globalDispatcher=e}getGlobalDispatcher(){return this._globalDispatcher}async getHttpSession(){return this._httpSession||(this.registerSDK(),this._httpSession=await $.HTTPSession.create($.SDKName.MapSDK,$.base64Encode(`version-${Ze}`)),this._httpSession.setBaseURL(Re),this._httpSession.setRetryConfig(3)),this._httpSession}registerSDK(){this._isSDKInitialized||(this._isSDKInitialized=!0,$.reportLog(`${$.SDKName.MapSDK} initialized`))}get theme(){return this._theme}setTheme(e){this._theme=e}clear(){this._httpSession.destroy(),this._globalDispatcher=null,D.instance=null}}const Vt=["unauthorized","initError"],Je=globalThis,et=ve(...Vt);D.getInstance().setGlobalDispatcher(et),Je.MapxusMapEvents=Je.MapxusMapEvents||{},Je.MapxusMapEvents.on=function(t,e){return et.on(t,e),{off:()=>et.on(t,null)}};var ke={exports:{}},qt;function Cr(){if(qt)return ke.exports;qt=1;function t(){}return t.prototype={on:function(e,i,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:i,ctx:r}),this},once:function(e,i,r){var n=this;function s(){n.off(e,s),i.apply(r,arguments)}return s._=i,this.on(e,s,r)},emit:function(e){var i=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,s=r.length;for(n;n<s;n++)r[n].fn.apply(r[n].ctx,i);return this},off:function(e,i){var r=this.e||(this.e={}),n=r[e],s=[];if(n&&i)for(var o=0,a=n.length;o<a;o++)n[o].fn!==i&&n[o].fn._!==i&&s.push(n[o]);return s.length?r[e]=s:delete r[e],this}},ke.exports=t,ke.exports.TinyEmitter=t,ke.exports}var Or=Cr(),De=(t=>(t[t.VENUE=0]="VENUE",t[t.GLOBAL=1]="GLOBAL",t))(De||{});function $r(t){return t.layers.filter(e=>!it(e.source))}function tt(t){return t.layers.filter(e=>it(e.source))}function it(t){return typeof t!="string"?!1:t.startsWith("indoor-")}function zt(t){const{buildingId:e,labelCenter:{lat:i,lon:r},floors:n,name:s,venueId:o,defaultFloor:a}=t,l=Object.entries(s).reduce((h,[f,g])=>{const _=f==="default"?"name":`name:${f}`;return Object.assign(h,{[_]:g})},{}),{codes:d,ids:u,ordinals:c}=n.reduce((h,f)=>{const{id:g,code:_,ordinal:y}=f;return{codes:h.codes?`${h.codes},${_}`:_,ids:h.ids?`${h.ids},${g}`:g,ordinals:`${h.ordinals}`?`${h.ordinals},${y}`:`${y}`}},{codes:"",ids:"",ordinals:""});return{layer:{id:"mapxus-building-line"},properties:{building:"yes",id:e,label_center:`${r},${i}`,level_ids:u,level_names:d,ordinals:c,"ref:venue":o,...l,...a?{default_displayed_floor:a}:{}},source:"indoor-planet",sourceLayer:"mapxus_building"}}function rt(t){const{address:e,buildings:i,id:r,name:n,type:s,labelCenter:{lon:o,lat:a},defaultBuilding:l,sharedFloors:d}=t,u=Object.entries(e).reduce((_,[y,m])=>Object.assign(_,y==="default"?{"addr:street":m.street,"addr:housenumber":m.housenumber}:{[`addr:street:${y}`]:m.street}),{}),c=Object.entries(n).reduce((_,[y,m])=>{const v=y==="default"?"name":`name:${y}`;return Object.assign(_,{[v]:m})},{}),h=l?i.find(_=>_.id===l)?.defaultFloor:null,f=l?{default_displayed_building:l,...h?{default_displayed_ordinal:h}:{}}:{},g=d?.length?{shared_level_ids:d.map(({id:_})=>_).join(","),shared_level_ordinals:d.map(({ordinal:_})=>_).join(",")}:{};return{layer:{id:"mapxus-venue-fill"},properties:{...u,...c,id:r,venue:s,label_center:`${o},${a}`,building_ids:i.map(({id:_})=>_).join(),...f,...g},source:"indoor-planet",sourceLayer:"mapxus_venue"}}function w(t,e=","){return typeof t!="string"||!t.trim()?[]:t.split(e)}const Ie="reserve_mapxus-level-fill",T="reserve_mapxus-shared-level-fill",Le="reserve_mapxus-building-fill";var x=(t=>(t.ENGLISH="en",t.CHINESE_SIMPLIFIED="zh-Hans",t.CHINESE_TRADITIONAL="zh-Hant",t.CHINESE_TRADITIONAL_TW="zh-Hant-TW",t.JAPANESE="ja",t.KOREAN="ko",t.FILIPINO="fil",t.INDONESIAN="id",t.PORTUGUESE="pt",t.THAI="th",t.VIETNAMESE="vi",t.ARABIC="ar",t))(x||{});function Gt(t){let e=null;return Mr(t)?e=x.ENGLISH:Ar(t)?e=x.CHINESE_SIMPLIFIED:xr(t)?e=x.CHINESE_TRADITIONAL:Tr(t)?e=x.CHINESE_TRADITIONAL_TW:Rr(t)?e=x.JAPANESE:kr(t)?e=x.KOREAN:Dr(t)?e=x.FILIPINO:Hr(t)?e=x.INDONESIAN:Nr(t)?e=x.PORTUGUESE:Ur(t)?e=x.THAI:jr(t)?e=x.VIETNAMESE:Vr(t)&&(e=x.ARABIC),e}function Mr(t){return/^en(-(US|GB|AU))?$/.test(t)}function Ar(t){return/^zh(-(Hans|CN))?$/.test(t)}function xr(t){return/^zh-(Hant|HK|MO)$/.test(t)}function Tr(t){return t==="zh-TW"}function Rr(t){return/^ja(-JP)?$/.test(t)}function kr(t){return/^ko(-KR)?$/.test(t)}function Dr(t){return/^(fil|tl)(-PH)?$/.test(t)}function Hr(t){return/^id(-ID)?$/.test(t)}function Nr(t){return/^pt(-(BR|PT))?$/.test(t)}function Ur(t){return/^th(-TH)?$/.test(t)}function jr(t){return/^vi(-VN)?$/.test(t)}function Vr(t){return/^ar(-(DZ|BH|EG|IQ|JO|KW|LB|LY|MA|OM|QA|SA|SY|TN|AE|YE))?$/.test(t)}const He={lineWidth:3,lineColor:"#A5E3FF",lineOpacity:1,lineOffset:-1.5},Kt={fontColor:"#8c8c8c",activeFontColor:"#fff",backgroundColor:"#fff",activeBackgroundColor:"#074769",itemSize:50,itemCount:4,defaultFolded:!1},qr=Gt(window.navigator.language)??x.ENGLISH;class Yt extends Error{status;constructor(e,i){super(e);const{status:r,name:n}=i;r!==void 0&&(this.status=r),n!==void 0&&(this.name=n)}}function zr(t,e=30){let i,r=null;return{promise:new Promise((o,a)=>{r=a;const l=performance.now(),d=()=>{t()?(clearInterval(i),o(!0)):(performance.now()-l)/1e3>e&&(a(new Yt("Timeouts or Feature is not found in the map at current zoom level.",{status:404,name:"NetworkError"})),clearInterval(i))};d(),i=setInterval(d,100)}),abort:()=>{i&&(clearInterval(i),i=null),r&&(r(new Yt("Query was aborted by the user.",{status:400,name:"AbortError"})),r=null)}}}function N(t){if(!t)return null;const i=(Array.isArray(t)?t:[t]).filter(b).map(r=>r.trim());return i.length>0?i.join(","):null}function b(t){return typeof t=="string"&&t.trim().length>0}function J(t){return Array.isArray(t)&&t.length===2&&t.every(e=>typeof e=="number")}function le(t){return Array.isArray(t)&&t.length===2&&t.every(e=>J(e))}function de(t){return typeof t=="number"&&t>0}function Ne(t,e){const i={...t};return e.forEach(r=>{delete i[r]}),i}var Wt=(t=>(t.POINT="Point",t.POLYGON="Polygon",t))(Wt||{}),nt=(t=>(t.POINT="Point",t.POLYGON="Polygon",t.GATE="Gate",t))(nt||{}),Xt=(t=>(t.DEFAULT_NAME="DefaultName",t))(Xt||{}),Qt=(t=>(t.ABSOLUTE_DISTANCE="AbsoluteDistance",t.ACTUAL_DISTANCE="ActualDistance",t))(Qt||{});const st=["specialHours","businessStatus","serviceHours","keywords","siteCode","refPhotoId","totalPhotoCount","photos","icon"],ot=D.getInstance();class Zt{constructor(){}searchByIds(e){const i=N(e);if(!i)throw new Error("Invalid ids parameter. Expected a non-empty string or an array of strings.");const r=`${j}/${i}`;return this._filterPoiProperties(r,W)}searchByDistance(e){const{center:i,distance:r,keywords:n="",offset:s=R,page:o=k}=e;if(!J(i))throw new Error("Invalid center parameter. Expected an array of two numbers.");if(!de(r)||r>1e4)throw new Error("Invalid distance parameter. Expected a positive number and no more than 10000.");const a=new URLSearchParams;a.set("center",i.join(",")),a.set("distance",String(Math.round(r))),a.set("offset",String(s)),a.set("page",String(o)),b(n)&&a.set("keywords",n);const l=`${j}?${a.toString()}`;return this._filterPoiProperties(l,W)}searchByBounds(e){const{bounds:i,offset:r=R,page:n=k,keywords:s,orderBy:o}=e;if(!le(i))throw new Error("'bounds' must be an array of two arrays, each containing two numbers.");const a=new URLSearchParams;a.set("bbox",i.flat().join()),a.set("offset",String(r)),a.set("page",String(n)),b(s)&&a.set("keywords",s),o&&a.set("orderBy",o);const l=`${j}?${a.toString()}`;return this._filterPoiProperties(l,W)}searchByBuilding(e){const{buildingId:i,offset:r=R,page:n=k,keywords:s,orderBy:o}=e;if(!b(i))throw new Error("'buildingId' must be a non-empty string.");const a=new URLSearchParams;a.set("buildingId",i),a.set("offset",String(r)),a.set("page",String(n)),b(s)&&a.set("keywords",s),o&&a.set("orderBy",o);const l=`${j}?${a.toString()}`;return this._filterPoiProperties(l,d=>W(d))}searchByVenue(e){const{venueId:i,offset:r=R,page:n=k,keywords:s,orderBy:o}=e;if(!b(i))throw new Error("'venueId' must be a non-empty string.");const a=new URLSearchParams;a.set("venueId",i),a.set("offset",String(r)),a.set("page",String(n)),b(s)&&a.set("keywords",s),o&&a.set("orderBy",o);const l=`${j}?${a.toString()}`;return this._filterPoiProperties(l,W)}searchByFloors(e){let i=null,r=null;const n="floorIds"in e?N(e.floorIds):null,s="sharedFloorIds"in e?N(e.sharedFloorIds):null;if(n?(i="floorId",r=n):s&&(i="sharedFloorId",r=s),!i||!r)throw new Error("Either 'floorIds' or 'sharedFloorIds' must be a non-empty array.");const{offset:o=R,page:a=k,keywords:l,orderBy:d}=e,u=new URLSearchParams;u.set("offset",String(o)),u.set("page",String(a)),u.set(i,r),b(l)&&u.set("keywords",l),d&&u.set("orderBy",d);const c=`${j}?${u.toString()}`;return this._filterPoiProperties(c,W)}async searchByOrientation(e){const{center:i,angle:r,distance:n,distanceSearchType:s=nt.POINT}=e;if(!J(i))throw new Error("Invalid center parameter. Expected an array of two numbers.");if(!de(n)||n>100)throw new Error("Invalid distance parameter. Expected a positive number and cannot exceed 100.");if(!de(r))throw new Error("Invalid angle parameter. Expected a positive number.");const o=new URLSearchParams;if("ordinal"in e){if(!b(e.ordinal))throw new Error("'ordinal' must be a non-empty string.");o.set("ordinal",e.ordinal)}else if("floorId"in e){if(!b(e.floorId))throw new Error("'floorId' must be a non-empty string.");o.set("floorId",e.floorId)}else if("buildingId"in e){if(!b(e.buildingId))throw new Error("'buildingId' must be a non-empty string.");o.set("buildingId",e.buildingId)}else throw new Error("Either 'ordinal', 'floorId', or 'buildingId' must be provided.");o.set("center",i.join()),o.set("angle",String(Math.round(r))),o.set("distance",String(n)),o.set("distanceSearchType",s);const a=`${j}/orientation?${o.toString()}`;return(await ot.getHttpSession()).request(a)}searchByCategory(e){const{center:i,distance:r,page:n=k,offset:s=R}=e;if(!J(i))throw new Error("Invalid center parameter. Expected an array of two numbers.");if(!de(r)||r>1e4)throw new Error("Invalid distance parameter. Expected a positive number and no more than 10000");const o=new URLSearchParams;if("category"in e&&b(e.category))o.set("category",String(e.category));else if("excludedCategories"in e&&N(e.excludedCategories))o.set("excludeCategories",N(e.excludedCategories));else throw new Error("Either 'category' or 'excludedCategories' must be provided.");o.set("center",i.join(",")),o.set("distance",String(r)),o.set("page",String(n)),o.set("offset",String(s));const a=`${j}?${o.toString()}`;return this._filterPoiProperties(a,W)}async searchCategories(e){const i=new URLSearchParams;if("floorId"in e&&b(e.floorId)?i.set("floorId",e.floorId):"buildingId"in e&&b(e.buildingId)?i.set("buildingId",e.buildingId):"sharedFloorId"in e&&b(e.sharedFloorId)?i.set("sharedFloorId",e.sharedFloorId):"venueId"in e&&b(e.venueId)&&i.set("venueId",e.venueId),"bounds"in e&&le(e.bounds)&&(i.set("bbox",e.bounds.flat().join()),b(e.keywords)&&i.set("keywords",e.keywords)),i.toString().length===0)throw new Error("At least one of 'floorId', 'buildingId', 'sharedFloorId', 'venueId', or 'bounds' must be provided.");const r=`${jt}?${i.toString()}`;return(await ot.getHttpSession()).request(r)}search(e){const i=new URLSearchParams;Object.entries(e).forEach(([n,s])=>{switch(n){case"bounds":le(s)&&i.set("bbox",s.flat().join());break;case"center":J(s)&&i.set("center",s.join());break;case"excludedCategories":const o=N(s);o&&i.set("excludeCategories",o);break;case"floorIds":const a=N(s);a&&i.set("floorId",a);break;case"sharedFloorIds":const l=N(s);l&&i.set("sharedFloorId",l);break;default:i.set(n,String(s))}});const r=`${j}?${i.toString()}`;return this._filterPoiProperties(r,W)}async _filterPoiProperties(e,i){const n=await(await ot.getHttpSession()).request(e),s=n.result.pois.map(i);return{...n,result:{...n.result,pois:s}}}}function W(t){return"sharedFloorId"in t,Ne(t,st)}const Jt=["opening_hours","description","phone","website","email","appURL","icon"],Gr=D.getInstance();class ei{constructor(){}searchByIds(e){const i=N(e);if(!i)throw new Error("Please input venue id at least one.");const r=`${oe}/${i}`;return this._filterVenueProperties(r,ue)}searchByDistance(e){const{center:i,distance:r,keywords:n="",offset:s=R,page:o=k}=e;if(!J(i))throw new Error("Invalid center parameter. Expected an array of two numbers.");if(!de(r)||r>1e4)throw new Error("Invalid distance parameter. Expected a positive number and no more than 10000.");const a=new URLSearchParams;a.set("center",i.join(",")),a.set("distance",String(r)),a.set("offset",String(s)),a.set("page",String(o)),b(n)&&a.set("keywords",n);const l=`${oe}?${a.toString()}`;return this._filterVenueProperties(l,ue)}searchByBounds(e){const{keywords:i,bounds:r,offset:n=R,page:s=k}=e;if(!le(r))throw new Error("'bounds' must be an array of two arrays, each containing two numbers.");const o=new URLSearchParams;o.set("bbox",r.flat().join()),o.set("offset",String(n)),o.set("page",String(s)),b(i)&&o.set("keywords",i);const a=`${oe}?${o.toString()}`;return this._filterVenueProperties(a,ue)}searchByGlobal(e){const{keywords:i,offset:r=R,page:n=k}=e,s=new URLSearchParams;s.set("offset",String(r)),s.set("page",String(n)),b(i)&&s.set("keywords",i);const o=`${oe}?${s.toString()}`;return this._filterVenueProperties(o,ue)}searchBySharedFloorId(e){if(!b(e))throw new Error("Please input correct sharedFloorId.");const i=`${oe}/shared_floors/${e}`;return this._filterVenueProperties(i,ue)}search(e){const i=new URLSearchParams;Object.entries(e).forEach(([n,s])=>{n==="bounds"?i.set("bbox",s.flat().join()):n==="center"?i.set("center",s.join()):i.set(n,String(s))});const r=`${oe}?${i.toString()}`;return this._filterVenueProperties(r,ue)}async _filterVenueProperties(e,i){const n=await(await Gr.getHttpSession()).request(e),s=n.result.venues.map(i);return{...n,result:{...n.result,venues:s}}}}function ue(t){return Ne(t,Jt)}const ti=["specialHours","businessStatus","serviceHours","keywords","siteCode","refPhotoId","totalPhotoCount","photos","description"],Kr=D.getInstance();class ii{constructor(){}searchByIds(e){const i=N(e);if(!i)throw new Error("Please input building id at least one.");const r=`${ae}/${i}`;return this._filterBuildingProperties(r,ce)}searchByDistance(e){const{center:i,distance:r,keywords:n="",offset:s=R,page:o=k}=e;if(!J(i))throw new Error("Invalid center parameter. Expected an array of two numbers.");if(!de(r)||r>1e4)throw new Error("Invalid distance parameter. Expected a positive number and no more than 10000.");const a=new URLSearchParams;a.set("center",i.join(",")),a.set("distance",String(r)),a.set("offset",String(s)),a.set("page",String(o)),b(n)&&a.set("keywords",n);const l=`${ae}?${a.toString()}`;return this._filterBuildingProperties(l,ce)}searchByBounds(e){const{bounds:i,offset:r=R,page:n=k,keywords:s}=e;if(!le(i))throw new Error("'bounds' must be an array of two arrays, each containing two numbers.");const o=new URLSearchParams;o.set("bbox",i.flat().join()),o.set("offset",String(r)),o.set("page",String(n)),b(s)&&o.set("keywords",s);const a=`${ae}?${o.toString()}`;return this._filterBuildingProperties(a,ce)}searchByGlobal(e){const{keywords:i,offset:r=R,page:n=k}=e,s=new URLSearchParams;s.set("searchGlobal",String(!0)),s.set("offset",String(r)),s.set("page",String(n)),b(i)&&s.set("keywords",i);const o=`${ae}?${s.toString()}`;return this._filterBuildingProperties(o,ce)}searchByFloorId(e){if(!b(e))throw new Error("'floorId' cannot be empty.");const i=`${ae}/floors/${e}`;return this._filterBuildingProperties(i,ce)}search(e){const i=new URLSearchParams;Object.entries(e).forEach(([n,s])=>{n==="bounds"?i.set("bbox",s.flat().join()):n==="center"?i.set("center",s.join()):i.set(n,String(s))});const r=`${ae}?${i.toString()}`;return this._filterBuildingProperties(r,ce)}async _filterBuildingProperties(e,i){const n=await(await Kr.getHttpSession()).request(e),s=n.result.buildings.map(i);return{...n,result:{...n.result,buildings:s}}}}function ce(t){return Ne(t,ti)}const ri=new ii,ni=new ei,Yr=new Zt;async function at(t){return(await ri.searchByIds(t)).result.buildings[0]}async function Wr(t){const i=(await ri.searchByFloorId(t)).result.buildings[0].buildingId;return await at(i)}async function lt(t){return(await ni.searchByIds(t)).result.venues[0]}async function si(t){return(await ni.searchBySharedFloorId(t)).result.venues[0]}async function Xr(t){return(await Yr.searchByIds([t])).result.pois[0]}class X{static instance;_visitedBuildingUnits;_historyBuildingUnit;_historyOrdinal;constructor(){this._visitedBuildingUnits=[],this._historyBuildingUnit=new Map,this._historyOrdinal=new Map}static getInstance(){return X.instance||(X.instance=new X),X.instance}getHistoryBuildingUnit(e){return this._historyBuildingUnit.get(e)}setHistoryBuildingUnit(e,i){this._historyBuildingUnit.set(e,i)}getHistoryOrdinal(e){return this._historyOrdinal.get(e)}setHistoryOrdinal(e,i){this._historyOrdinal.set(e,i)}getVisitedBuildingUnits(){return this._visitedBuildingUnits}addVisitedBuildingUnit(e){this._visitedBuildingUnits.push(e),this._visitedBuildingUnits.length>100&&(this._visitedBuildingUnits=this._visitedBuildingUnits.slice(this._visitedBuildingUnits.length-100))}}var oi=typeof global=="object"&&global&&global.Object===Object&&global,Qr=typeof self=="object"&&self&&self.Object===Object&&self,U=oi||Qr||Function("return this")(),Q=U.Symbol,ai=Object.prototype,Zr=ai.hasOwnProperty,Jr=ai.toString,we=Q?Q.toStringTag:void 0;function en(t){var e=Zr.call(t,we),i=t[we];try{t[we]=void 0;var r=!0}catch{}var n=Jr.call(t);return r&&(e?t[we]=i:delete t[we]),n}var tn=Object.prototype,rn=tn.toString;function nn(t){return rn.call(t)}var sn="[object Null]",on="[object Undefined]",li=Q?Q.toStringTag:void 0;function he(t){return t==null?t===void 0?on:sn:li&&li in Object(t)?en(t):nn(t)}function _e(t){return t!=null&&typeof t=="object"}var an="[object Symbol]";function Be(t){return typeof t=="symbol"||_e(t)&&he(t)==an}function ln(t,e,i){for(var r=-1,n=t.length;++r<n;){var s=t[r],o=e(s);if(o!=null&&(a===void 0?o===o&&!Be(o):i(o,a)))var a=o,l=s}return l}function dn(){this.__data__=[],this.size=0}function di(t,e){return t===e||t!==t&&e!==e}function Ue(t,e){for(var i=t.length;i--;)if(di(t[i][0],e))return i;return-1}var un=Array.prototype,cn=un.splice;function hn(t){var e=this.__data__,i=Ue(e,t);if(i<0)return!1;var r=e.length-1;return i==r?e.pop():cn.call(e,i,1),--this.size,!0}function _n(t){var e=this.__data__,i=Ue(e,t);return i<0?void 0:e[i][1]}function fn(t){return Ue(this.__data__,t)>-1}function pn(t,e){var i=this.__data__,r=Ue(i,t);return r<0?(++this.size,i.push([t,e])):i[r][1]=e,this}function V(t){var e=-1,i=t==null?0:t.length;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}V.prototype.clear=dn,V.prototype.delete=hn,V.prototype.get=_n,V.prototype.has=fn,V.prototype.set=pn;function gn(){this.__data__=new V,this.size=0}function yn(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i}function mn(t){return this.__data__.get(t)}function bn(t){return this.__data__.has(t)}function fe(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Sn="[object AsyncFunction]",vn="[object Function]",In="[object GeneratorFunction]",Ln="[object Proxy]";function ui(t){if(!fe(t))return!1;var e=he(t);return e==vn||e==In||e==Sn||e==Ln}var dt=U["__core-js_shared__"],ci=(function(){var t=/[^.]+$/.exec(dt&&dt.keys&&dt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function wn(t){return!!ci&&ci in t}var Bn=Function.prototype,En=Bn.toString;function ee(t){if(t!=null){try{return En.call(t)}catch{}try{return t+""}catch{}}return""}var Pn=/[\\^$.*+?()[\]{}|]/g,Fn=/^\[object .+?Constructor\]$/,Cn=Function.prototype,On=Object.prototype,$n=Cn.toString,Mn=On.hasOwnProperty,An=RegExp("^"+$n.call(Mn).replace(Pn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function xn(t){if(!fe(t)||wn(t))return!1;var e=ui(t)?An:Fn;return e.test(ee(t))}function Tn(t,e){return t?.[e]}function pe(t,e){var i=Tn(t,e);return xn(i)?i:void 0}var Ee=pe(U,"Map"),Pe=pe(Object,"create");function Rn(){this.__data__=Pe?Pe(null):{},this.size=0}function kn(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Dn="__lodash_hash_undefined__",Hn=Object.prototype,Nn=Hn.hasOwnProperty;function Un(t){var e=this.__data__;if(Pe){var i=e[t];return i===Dn?void 0:i}return Nn.call(e,t)?e[t]:void 0}var jn=Object.prototype,Vn=jn.hasOwnProperty;function qn(t){var e=this.__data__;return Pe?e[t]!==void 0:Vn.call(e,t)}var zn="__lodash_hash_undefined__";function Gn(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=Pe&&e===void 0?zn:e,this}function te(t){var e=-1,i=t==null?0:t.length;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}te.prototype.clear=Rn,te.prototype.delete=kn,te.prototype.get=Un,te.prototype.has=qn,te.prototype.set=Gn;function Kn(){this.size=0,this.__data__={hash:new te,map:new(Ee||V),string:new te}}function Yn(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function je(t,e){var i=t.__data__;return Yn(e)?i[typeof e=="string"?"string":"hash"]:i.map}function Wn(t){var e=je(this,t).delete(t);return this.size-=e?1:0,e}function Xn(t){return je(this,t).get(t)}function Qn(t){return je(this,t).has(t)}function Zn(t,e){var i=je(this,t),r=i.size;return i.set(t,e),this.size+=i.size==r?0:1,this}function q(t){var e=-1,i=t==null?0:t.length;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}q.prototype.clear=Kn,q.prototype.delete=Wn,q.prototype.get=Xn,q.prototype.has=Qn,q.prototype.set=Zn;var Jn=200;function es(t,e){var i=this.__data__;if(i instanceof V){var r=i.__data__;if(!Ee||r.length<Jn-1)return r.push([t,e]),this.size=++i.size,this;i=this.__data__=new q(r)}return i.set(t,e),this.size=i.size,this}function z(t){var e=this.__data__=new V(t);this.size=e.size}z.prototype.clear=gn,z.prototype.delete=yn,z.prototype.get=mn,z.prototype.has=bn,z.prototype.set=es;var ts="__lodash_hash_undefined__";function is(t){return this.__data__.set(t,ts),this}function rs(t){return this.__data__.has(t)}function Fe(t){var e=-1,i=t==null?0:t.length;for(this.__data__=new q;++e<i;)this.add(t[e])}Fe.prototype.add=Fe.prototype.push=is,Fe.prototype.has=rs;function ns(t,e){for(var i=-1,r=t==null?0:t.length;++i<r;)if(e(t[i],i,t))return!0;return!1}function hi(t,e){return t.has(e)}var ss=1,os=2;function _i(t,e,i,r,n,s){var o=i&ss,a=t.length,l=e.length;if(a!=l&&!(o&&l>a))return!1;var d=s.get(t),u=s.get(e);if(d&&u)return d==e&&u==t;var c=-1,h=!0,f=i&os?new Fe:void 0;for(s.set(t,e),s.set(e,t);++c<a;){var g=t[c],_=e[c];if(r)var y=o?r(_,g,c,e,t,s):r(g,_,c,t,e,s);if(y!==void 0){if(y)continue;h=!1;break}if(f){if(!ns(e,function(m,v){if(!hi(f,v)&&(g===m||n(g,m,i,r,s)))return f.push(v)})){h=!1;break}}else if(!(g===_||n(g,_,i,r,s))){h=!1;break}}return s.delete(t),s.delete(e),h}var fi=U.Uint8Array;function as(t){var e=-1,i=Array(t.size);return t.forEach(function(r,n){i[++e]=[n,r]}),i}function ut(t){var e=-1,i=Array(t.size);return t.forEach(function(r){i[++e]=r}),i}var ls=1,ds=2,us="[object Boolean]",cs="[object Date]",hs="[object Error]",_s="[object Map]",fs="[object Number]",ps="[object RegExp]",gs="[object Set]",ys="[object String]",ms="[object Symbol]",bs="[object ArrayBuffer]",Ss="[object DataView]",pi=Q?Q.prototype:void 0,ct=pi?pi.valueOf:void 0;function vs(t,e,i,r,n,s,o){switch(i){case Ss:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case bs:return!(t.byteLength!=e.byteLength||!s(new fi(t),new fi(e)));case us:case cs:case fs:return di(+t,+e);case hs:return t.name==e.name&&t.message==e.message;case ps:case ys:return t==e+"";case _s:var a=as;case gs:var l=r&ls;if(a||(a=ut),t.size!=e.size&&!l)return!1;var d=o.get(t);if(d)return d==e;r|=ds,o.set(t,e);var u=_i(a(t),a(e),r,n,s,o);return o.delete(t),u;case ms:if(ct)return ct.call(t)==ct.call(e)}return!1}function Is(t,e){for(var i=-1,r=e.length,n=t.length;++i<r;)t[n+i]=e[i];return t}var G=Array.isArray;function Ls(t,e,i){var r=e(t);return G(t)?r:Is(r,i(t))}function ws(t,e){for(var i=-1,r=t==null?0:t.length,n=0,s=[];++i<r;){var o=t[i];e(o,i,t)&&(s[n++]=o)}return s}function Bs(){return[]}var Es=Object.prototype,Ps=Es.propertyIsEnumerable,gi=Object.getOwnPropertySymbols,Fs=gi?function(t){return t==null?[]:(t=Object(t),ws(gi(t),function(e){return Ps.call(t,e)}))}:Bs;function Cs(t,e){for(var i=-1,r=Array(t);++i<t;)r[i]=e(i);return r}var Os="[object Arguments]";function yi(t){return _e(t)&&he(t)==Os}var mi=Object.prototype,$s=mi.hasOwnProperty,Ms=mi.propertyIsEnumerable,bi=yi((function(){return arguments})())?yi:function(t){return _e(t)&&$s.call(t,"callee")&&!Ms.call(t,"callee")};function As(){return!1}var Si=typeof p=="object"&&p&&!p.nodeType&&p,vi=Si&&typeof module=="object"&&module&&!module.nodeType&&module,xs=vi&&vi.exports===Si,Ii=xs?U.Buffer:void 0,Ts=Ii?Ii.isBuffer:void 0,ht=Ts||As,Rs=9007199254740991,ks=/^(?:0|[1-9]\d*)$/;function Li(t,e){var i=typeof t;return e=e??Rs,!!e&&(i=="number"||i!="symbol"&&ks.test(t))&&t>-1&&t%1==0&&t<e}var Ds=9007199254740991;function _t(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Ds}var Hs="[object Arguments]",Ns="[object Array]",Us="[object Boolean]",js="[object Date]",Vs="[object Error]",qs="[object Function]",zs="[object Map]",Gs="[object Number]",Ks="[object Object]",Ys="[object RegExp]",Ws="[object Set]",Xs="[object String]",Qs="[object WeakMap]",Zs="[object ArrayBuffer]",Js="[object DataView]",eo="[object Float32Array]",to="[object Float64Array]",io="[object Int8Array]",ro="[object Int16Array]",no="[object Int32Array]",so="[object Uint8Array]",oo="[object Uint8ClampedArray]",ao="[object Uint16Array]",lo="[object Uint32Array]",I={};I[eo]=I[to]=I[io]=I[ro]=I[no]=I[so]=I[oo]=I[ao]=I[lo]=!0,I[Hs]=I[Ns]=I[Zs]=I[Us]=I[Js]=I[js]=I[Vs]=I[qs]=I[zs]=I[Gs]=I[Ks]=I[Ys]=I[Ws]=I[Xs]=I[Qs]=!1;function uo(t){return _e(t)&&_t(t.length)&&!!I[he(t)]}function co(t){return function(e){return t(e)}}var wi=typeof p=="object"&&p&&!p.nodeType&&p,Ce=wi&&typeof module=="object"&&module&&!module.nodeType&&module,ho=Ce&&Ce.exports===wi,ft=ho&&oi.process,Bi=(function(){try{var t=Ce&&Ce.require&&Ce.require("util").types;return t||ft&&ft.binding&&ft.binding("util")}catch{}})(),Ei=Bi&&Bi.isTypedArray,Pi=Ei?co(Ei):uo,_o=Object.prototype,fo=_o.hasOwnProperty;function po(t,e){var i=G(t),r=!i&&bi(t),n=!i&&!r&&ht(t),s=!i&&!r&&!n&&Pi(t),o=i||r||n||s,a=o?Cs(t.length,String):[],l=a.length;for(var d in t)fo.call(t,d)&&!(o&&(d=="length"||n&&(d=="offset"||d=="parent")||s&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||Li(d,l)))&&a.push(d);return a}var go=Object.prototype;function yo(t){var e=t&&t.constructor,i=typeof e=="function"&&e.prototype||go;return t===i}function mo(t,e){return function(i){return t(e(i))}}var bo=mo(Object.keys,Object),So=Object.prototype,vo=So.hasOwnProperty;function Io(t){if(!yo(t))return bo(t);var e=[];for(var i in Object(t))vo.call(t,i)&&i!="constructor"&&e.push(i);return e}function Lo(t){return t!=null&&_t(t.length)&&!ui(t)}function Fi(t){return Lo(t)?po(t):Io(t)}function Ci(t){return Ls(t,Fi,Fs)}var wo=1,Bo=Object.prototype,Eo=Bo.hasOwnProperty;function Po(t,e,i,r,n,s){var o=i&wo,a=Ci(t),l=a.length,d=Ci(e),u=d.length;if(l!=u&&!o)return!1;for(var c=l;c--;){var h=a[c];if(!(o?h in e:Eo.call(e,h)))return!1}var f=s.get(t),g=s.get(e);if(f&&g)return f==e&&g==t;var _=!0;s.set(t,e),s.set(e,t);for(var y=o;++c<l;){h=a[c];var m=t[h],v=e[h];if(r)var E=o?r(v,m,h,e,t,s):r(m,v,h,t,e,s);if(!(E===void 0?m===v||n(m,v,i,r,s):E)){_=!1;break}y||(y=h=="constructor")}if(_&&!y){var C=t.constructor,B=e.constructor;C!=B&&"constructor"in t&&"constructor"in e&&!(typeof C=="function"&&C instanceof C&&typeof B=="function"&&B instanceof B)&&(_=!1)}return s.delete(t),s.delete(e),_}var pt=pe(U,"DataView"),gt=pe(U,"Promise"),ge=pe(U,"Set"),yt=pe(U,"WeakMap"),Oi="[object Map]",Fo="[object Object]",$i="[object Promise]",Mi="[object Set]",Ai="[object WeakMap]",xi="[object DataView]",Co=ee(pt),Oo=ee(Ee),$o=ee(gt),Mo=ee(ge),Ao=ee(yt),Z=he;(pt&&Z(new pt(new ArrayBuffer(1)))!=xi||Ee&&Z(new Ee)!=Oi||gt&&Z(gt.resolve())!=$i||ge&&Z(new ge)!=Mi||yt&&Z(new yt)!=Ai)&&(Z=function(t){var e=he(t),i=e==Fo?t.constructor:void 0,r=i?ee(i):"";if(r)switch(r){case Co:return xi;case Oo:return Oi;case $o:return $i;case Mo:return Mi;case Ao:return Ai}return e});var xo=1,Ti="[object Arguments]",Ri="[object Array]",Ve="[object Object]",To=Object.prototype,ki=To.hasOwnProperty;function Ro(t,e,i,r,n,s){var o=G(t),a=G(e),l=o?Ri:Z(t),d=a?Ri:Z(e);l=l==Ti?Ve:l,d=d==Ti?Ve:d;var u=l==Ve,c=d==Ve,h=l==d;if(h&&ht(t)){if(!ht(e))return!1;o=!0,u=!1}if(h&&!u)return s||(s=new z),o||Pi(t)?_i(t,e,i,r,n,s):vs(t,e,l,i,r,n,s);if(!(i&xo)){var f=u&&ki.call(t,"__wrapped__"),g=c&&ki.call(e,"__wrapped__");if(f||g){var _=f?t.value():t,y=g?e.value():e;return s||(s=new z),n(_,y,i,r,s)}}return h?(s||(s=new z),Po(t,e,i,r,n,s)):!1}function mt(t,e,i,r,n){return t===e?!0:t==null||e==null||!_e(t)&&!_e(e)?t!==t&&e!==e:Ro(t,e,i,r,mt,n)}var ko=1,Do=2;function Ho(t,e,i,r){var n=i.length,s=n;if(t==null)return!s;for(t=Object(t);n--;){var o=i[n];if(o[2]?o[1]!==t[o[0]]:!(o[0]in t))return!1}for(;++n<s;){o=i[n];var a=o[0],l=t[a],d=o[1];if(o[2]){if(l===void 0&&!(a in t))return!1}else{var u=new z,c;if(!(c===void 0?mt(d,l,ko|Do,r,u):c))return!1}}return!0}function Di(t){return t===t&&!fe(t)}function No(t){for(var e=Fi(t),i=e.length;i--;){var r=e[i],n=t[r];e[i]=[r,n,Di(n)]}return e}function Hi(t,e){return function(i){return i==null?!1:i[t]===e&&(e!==void 0||t in Object(i))}}function Uo(t){var e=No(t);return e.length==1&&e[0][2]?Hi(e[0][0],e[0][1]):function(i){return i===t||Ho(i,t,e)}}var jo=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Vo=/^\w*$/;function bt(t,e){if(G(t))return!1;var i=typeof t;return i=="number"||i=="symbol"||i=="boolean"||t==null||Be(t)?!0:Vo.test(t)||!jo.test(t)||e!=null&&t in Object(e)}var qo="Expected a function";function St(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(qo);var i=function(){var r=arguments,n=e?e.apply(this,r):r[0],s=i.cache;if(s.has(n))return s.get(n);var o=t.apply(this,r);return i.cache=s.set(n,o)||s,o};return i.cache=new(St.Cache||q),i}St.Cache=q;var zo=500;function Go(t){var e=St(t,function(r){return i.size===zo&&i.clear(),r}),i=e.cache;return e}var Ko=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Yo=/\\(\\)?/g,Wo=Go(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Ko,function(i,r,n,s){e.push(n?s.replace(Yo,"$1"):r||i)}),e});function Xo(t,e){for(var i=-1,r=t==null?0:t.length,n=Array(r);++i<r;)n[i]=e(t[i],i,t);return n}var Ni=Q?Q.prototype:void 0,Ui=Ni?Ni.toString:void 0;function ji(t){if(typeof t=="string")return t;if(G(t))return Xo(t,ji)+"";if(Be(t))return Ui?Ui.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function Vi(t){return t==null?"":ji(t)}function qi(t,e){return G(t)?t:bt(t,e)?[t]:Wo(Vi(t))}function qe(t){if(typeof t=="string"||Be(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function zi(t,e){e=qi(e,t);for(var i=0,r=e.length;t!=null&&i<r;)t=t[qe(e[i++])];return i&&i==r?t:void 0}function Qo(t,e,i){var r=t==null?void 0:zi(t,e);return r===void 0?i:r}function Zo(t,e){return t!=null&&e in Object(t)}function Jo(t,e,i){e=qi(e,t);for(var r=-1,n=e.length,s=!1;++r<n;){var o=qe(e[r]);if(!(s=t!=null&&i(t,o)))break;t=t[o]}return s||++r!=n?s:(n=t==null?0:t.length,!!n&&_t(n)&&Li(o,n)&&(G(t)||bi(t)))}function ea(t,e){return t!=null&&Jo(t,e,Zo)}var ta=1,ia=2;function ra(t,e){return bt(t)&&Di(e)?Hi(qe(t),e):function(i){var r=Qo(i,t);return r===void 0&&r===e?ea(i,t):mt(e,r,ta|ia)}}function na(t){return t}function sa(t){return function(e){return e?.[t]}}function oa(t){return function(e){return zi(e,t)}}function aa(t){return bt(t)?sa(qe(t)):oa(t)}function Gi(t){return typeof t=="function"?t:t==null?na:typeof t=="object"?G(t)?ra(t[0],t[1]):Uo(t):aa(t)}function la(t,e){return t<e}function da(t,e){return t&&t.length?ln(t,Gi(e),la):void 0}class ua{_isMaskMode;_hiddenBuildings;_history;constructor(e){this._isMaskMode=e,this._hiddenBuildings=[],this._history=X.getInstance()}getLayeredData(e){const{selectedVenueId:i,venueMap:r,buildingMap:n,sharedFloorMap:s}=e,o=[],a=[],l=[],d=[],u=[],c=[],h=[...r.values()],f=i?[r.get(i),...h.filter(g=>g.properties.id!==i)]:h;for(const g of f){if(!g||!g.properties)continue;const{id:_,overlap:y,building_ids:m,shared_level_ids:v,default_displayed_ordinal:E,default_displayed_building:C}=g.properties,B=_===i,S=_a(y),O=w(m),M=this._history.getHistoryOrdinal(_);let P=M??E;if(P)M||(this._history.setHistoryOrdinal(_,P),this._history.setHistoryBuildingUnit(_,{id:C,type:"building"}));else{const{ordinal:L,buildingId:H}=ca(O,n);if(!L)continue;P=L,this._history.setHistoryOrdinal(_,P),this._history.setHistoryBuildingUnit(_,{id:H,type:"building"})}O.forEach(L=>{const H=n.get(L),A=ha(H,P);A?this._isMaskMode?B?(a.push(A),o.push({level:A,overlap:S.get(A)??null,venueId:_})):u.push(L):(o.push({level:A,overlap:S.get(A)??null,venueId:_}),B&&a.push(A)):d.push(L)}),w(v).forEach(L=>{const H=s.get(L),{ordinal:A,persistence:Y}=H?.properties||{},se=Y==="true"&&0<=A&&A<=P,Se=A===P,Qe=se||Se,xe={level:L,overlap:S.get(L)??null,venueId:_};Qe?this._isMaskMode?B?(o.push(xe),se&&l.push(L),Se&&a.push(L)):c.push(L):(o.push(xe),B&&Se&&a.push(L),se&&l.push(L)):d.push(L)})}return this._hiddenBuildings=d,{displayedLevels:o,selectedLevelIds:a,alwaysDisplayedSharedLevelIds:l,maskBuildingIds:u,maskSharedFloorIds:c}}getHiddenBuildings(){return this._hiddenBuildings}}function ca(t,e){const i=t.find(s=>e.has(s))??t[0]??null,r=i?e.get(i):null;return{ordinal:r?Ki(r):null,buildingId:i}}function Ki(t){if(!t||!t.properties)return null;const{level_ids:e,ordinals:i,default_displayed_floor:r}=t.properties,n=w(i);let s=null;if(r){const o=w(e).findIndex(a=>a===r);s=n[o]??null}return s||(s=da(n,o=>Math.abs(Number(o)-.1))),s}function ha(t,e){if(!t||!t.properties)return null;const{level_ids:i,ordinals:r}=t.properties,n=w(r).findIndex(s=>s===e);return w(i)[n]??null}function _a(t){const e=new Map;if(!t)return e;for(const i of w(t,"/")){const[r,n]=w(i,":");e.set(r,w(n))}return e}class fa{_maplibre;_isAnimated=!0;_bounds=null;_boundsPadding;_center=null;_fitBoundsTimer=null;constructor(e,i){this._maplibre=e,this._boundsPadding=i}setAnimated(e){this._isAnimated=e}setBounds(e){this._bounds=e}getBounds(){return this._bounds}setCenter(e){this._center=e}async fitBounds(){if(!this._bounds)return;this._fitBoundsTimer&&(clearTimeout(this._fitBoundsTimer),this._fitBoundsTimer=null);const e=this._isAnimated?{animate:!0,duration:500}:{animate:!1},i=this._isAnimated?500:0;return new Promise(r=>{const n=()=>{this._maplibre.off("idle",n),r(!0)};this._maplibre.on("idle",n),this._maplibre.fitBounds(this._bounds,{...e,padding:this._boundsPadding,bearing:this._maplibre.getBearing()}),this._fitBoundsTimer=setTimeout(()=>{this._maplibre.off("idle",n),this._fitBoundsTimer=null,r(!0)},i+200)})}panToCenter(){this._center&&this._maplibre.panTo(this._center,{animate:this._isAnimated})}}var vt=function(){return U.Date.now()},pa=/\s/;function ga(t){for(var e=t.length;e--&&pa.test(t.charAt(e)););return e}var ya=/^\s+/;function ma(t){return t&&t.slice(0,ga(t)+1).replace(ya,"")}var Yi=NaN,ba=/^[-+]0x[0-9a-f]+$/i,Sa=/^0b[01]+$/i,va=/^0o[0-7]+$/i,Ia=parseInt;function ze(t){if(typeof t=="number")return t;if(Be(t))return Yi;if(fe(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=fe(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=ma(t);var i=Sa.test(t);return i||va.test(t)?Ia(t.slice(2),i?2:8):ba.test(t)?Yi:+t}var La="Expected a function",wa=Math.max,Ba=Math.min;function Wi(t,e,i){var r,n,s,o,a,l,d=0,u=!1,c=!1,h=!0;if(typeof t!="function")throw new TypeError(La);e=ze(e)||0,fe(i)&&(u=!!i.leading,c="maxWait"in i,s=c?wa(ze(i.maxWait)||0,e):s,h="trailing"in i?!!i.trailing:h);function f(S){var O=r,M=n;return r=n=void 0,d=S,o=t.apply(M,O),o}function g(S){return d=S,a=setTimeout(m,e),u?f(S):o}function _(S){var O=S-l,M=S-d,P=e-O;return c?Ba(P,s-M):P}function y(S){var O=S-l,M=S-d;return l===void 0||O>=e||O<0||c&&M>=s}function m(){var S=vt();if(y(S))return v(S);a=setTimeout(m,_(S))}function v(S){return a=void 0,h&&r?f(S):(r=n=void 0,o)}function E(){a!==void 0&&clearTimeout(a),d=0,r=l=n=a=void 0}function C(){return a===void 0?o:v(vt())}function B(){var S=vt(),O=y(S);if(r=arguments,n=this,l=S,O){if(a===void 0)return g(l);if(c)return clearTimeout(a),a=setTimeout(m,e),f(l)}return a===void 0&&(a=setTimeout(m,e)),o}return B.cancel=E,B.flush=C,B}function Ea(t,e,i,r){for(var n=t.length,s=i+-1;++s<n;)if(e(t[s],s,t))return s;return-1}function Pa(t){return t!==t}function Fa(t,e,i){for(var r=i-1,n=t.length;++r<n;)if(t[r]===e)return r;return-1}function Ca(t,e,i){return e===e?Fa(t,e,i):Ea(t,Pa,i)}function Oa(t,e){var i=t==null?0:t.length;return!!i&&Ca(t,e,0)>-1}function $a(){}var Ma=1/0,Aa=ge&&1/ut(new ge([,-0]))[1]==Ma?function(t){return new ge(t)}:$a,xa=200;function Ta(t,e,i){var r=-1,n=Oa,s=t.length,o=!0,a=[],l=a;if(s>=xa){var d=e?null:Aa(t);if(d)return ut(d);o=!1,n=hi,l=new Fe}else l=e?[]:a;e:for(;++r<s;){var u=t[r],c=e?e(u):u;if(u=u!==0?u:0,o&&c===c){for(var h=l.length;h--;)if(l[h]===c)continue e;e&&l.push(c),a.push(u)}else n(l,c,i)||(l!==a&&l.push(c),a.push(u))}return a}function Xi(t,e){return t&&t.length?Ta(t,Gi(e)):[]}var Ra=0;function ie(t){var e=++Ra;return Vi(t)+e}const Oe="Indoor_selectedFloorChanged",Ge="Indoor_selectedBuildingChanged",It="Indoor_mapxusMapLoaded",Qi="Indoor_maplibreMapLoaded",Lt="mapxus-venue-fill",ye="mapxus-building-line",Zi="mapxus-level-fill",wt="mapxus-shared-level-fill",Bt="highlight-mapxus_level",Et="highlight-mapxus_shared_level";class Ji extends Or.TinyEmitter{_map;_features=[];_allVenuesMap=new Map;_allBuildingsMap=new Map;_allSharedLevelsMap=new Map;_curBuildingId=null;_curBuildingFeature=null;_curSharedLevelId=null;_floor={code:null,id:null,ordinal:null};_sharedFloor={id:null,ordinal:null,name:null};_outdoorMapShown;_originIndoorLayers=[];_outdoorLayers=[];_curVenueId=null;_curVenueFeature=null;_selectedHighlightStyle;_upperLayers=[];_commonPoiLayers=[];_sectionFillLineLayers=[];_sectionSymbolLayers=[];_middleLayers=[];_lowerLayers=[];_excludedPoisInMiddle=[];_dispatch=ve(Oe);_startWithIndoorView;_indoorMapLoaded=!1;_isSelectSharedFloor=!1;_isMaskMode;_upperLevels=new Set;_middleLevels=new Set;_lowerLevels=new Set;_featureIncomplete=!1;_fitBounds;_dragPan;_history=X.getInstance();_maskBuildings=new Set;_maskSharedFloors=new Set;_enableIndoorClickSelection;_enableOutdoorClickSelection;_zIndexHistory=new Map;_floorSwitchScope;_isDestroyed=!1;_abortQueryFeature;_debounceRendering;layeredHandler;dragPanHandler;constructor(e){super();const{map:i,startWithIndoorView:r,outdoorMapShown:n,selectedHighlightStyle:s,fitBounds:o,boundsPadding:a,maskNonSelectedAreas:l,enableIndoorClickSelection:d,enableOutdoorClickSelection:u,floorSwitchScope:c}=e;this.layeredHandler=new ua(l),this.dragPanHandler=new fa(i,a),this._map=i,this._enableIndoorClickSelection=d,this._enableOutdoorClickSelection=u,this._startWithIndoorView=r,this._outdoorMapShown=n,this._isMaskMode=l,this._fitBounds=o,this._floorSwitchScope=c,this._selectedHighlightStyle=s?Object.assign({},He,s):He,this._bindMaplibreEventListeners()}destroy(){this._isDestroyed||(this._isDestroyed=!0,this._dispatch.on(`.${Oe}`,null),this.off(Ge),this.off(Qi),this.off(It),this._debounceRendering?.cancel(),this._abortQueryFeature&&(this._abortQueryFeature(),this._abortQueryFeature=null))}setAllowOutdoorSwitch(e){return this._enableOutdoorClickSelection=e,this}setAllowBuildingSwitch(e){return this._enableIndoorClickSelection=e,this}setAllowIndoorClickSelect(e){this._enableIndoorClickSelection=e}setAllowOutdoorClickSelect(e){this._enableOutdoorClickSelection=e}setFloorSwitchScope(e){this._floorSwitchScope=e}get floor(){return this._isSelectSharedFloor?this._sharedFloor:this._curBuildingId?this._floor:null}get building(){return this._curBuildingFeature}get venue(){return this._curVenueFeature}get features(){return this._features}getFeaturesById(e,i){const{layerIds:r,filter:n}=i||{},s=this._queryRenderedFeatures(r);if(!s.length)return[];const o=n?a=>a.properties.id===e&&n(a):a=>a.properties.id===e;return s.filter(o)}async switchFloorByOrdinal(e){this._updateFloorState(e),this._dispatch.call(Oe,null,{venue:this.venue,building:this.building,floor:this.floor}),this.venue&&e&&(this._floorSwitchScope===De.GLOBAL&&this._changeOtherVenuesHistory(e),this._dragPan===!0&&(this._fitBounds?await this.dragPanHandler.fitBounds():await this.panToBuildingCenter()),this._dragPan==="restrict"&&await this._checkAndPanToBuilding()),this.updateRendering()}setOutdoorMapShown(e){this._outdoorMapShown=e,this._setOutdoorVisibility(e)}setSelectedHighlightStyle(e){this._selectedHighlightStyle=Object.assign({},this._selectedHighlightStyle,e??{"line-opacity":0});for(const i of[Bt,Et])if(this._map.getLayer(i))if(e){const{lineColor:r,lineOpacity:n,lineWidth:s,lineOffset:o}=this._selectedHighlightStyle,a=er(s,o);this._map.setPaintProperty(i,"line-color",r),this._map.setPaintProperty(i,"line-opacity",n),this._map.setPaintProperty(i,"line-width",s),this._map.setPaintProperty(i,"line-offset",a)}else this._map.setPaintProperty(i,"line-opacity",0)}onMapChange(e){const i=ie(`${Oe}.`);return this._dispatch.on(i,e),{unsubscribe:()=>this._dispatch.on(i,null)}}async selectBuilding(e,i){if(this._isCurrentFeature(e))return;this._isSelectSharedFloor=!1,this._curSharedLevelId=null;let r=null;if(!e||!e.properties)this.dragPanHandler.setCenter(null),this._clear();else{const{floorId:n,featureIncomplete:s}=i||{};this._featureIncomplete=s??this._featureIncomplete;const{id:o,"ref:venue":a,label_center:l}=e.properties,d=w(l).map(u=>parseFloat(u));this._curBuildingFeature=e,this._curBuildingId=o,this._history.addVisitedBuildingUnit({id:o,type:"building"}),this.dragPanHandler.setCenter(d),this._curVenueId!==a&&(this._curVenueId=a,this._curVenueFeature=await this._queryVenueFeature(a)),r=this._getBuildingDisplayedOrdinal(e,n)}await this.switchFloorByOrdinal(r),this.emit(Ge,e?{building:e,ordinal:r,dragPan:this._dragPan}:null),this._dispatchIndoorMapLoaded()}async selectSharedFloor(e,i,r){if(e.id===this._curSharedLevelId)return;const{id:n,ordinal:s}=e;this._isSelectSharedFloor=!0,this._curBuildingId=null,this._curBuildingFeature=null,this._sharedFloor=e,this._curSharedLevelId=n,this._featureIncomplete=r?.featureIncomplete??this._featureIncomplete;const{label_center:o,id:a}=i.properties,l=w(o).map(d=>parseFloat(d));this._curVenueId=a,this._curVenueFeature=i,this.dragPanHandler.setCenter(l),this._history.addVisitedBuildingUnit({id:n,type:"sharedFloor"}),this._history.setHistoryOrdinal(a,s),this._history.setHistoryBuildingUnit(a,{id:n,type:"sharedFloor"}),this._dragPan===!0&&(this._fitBounds?await this.dragPanHandler.fitBounds():await this.panToVenueCenter()),this._dispatch.call(Oe,null,{venue:this.venue,building:this.building,floor:this.floor}),this.emit(Ge,{...e,dragPan:this._dragPan}),this._dispatchIndoorMapLoaded(),this.updateRendering()}updateCustomLayers(){const e=this._map.getStyle();this._originIndoorLayers=tt(e),this._outdoorLayers=$r(e),this._copyOverlapLayers(),this._copySharedFloorBackgroundLayers(),this._addSelectedHighlightLayers(),this._addReserveFloorLayers(),this._isMaskMode&&this._addBuildingMaskLayer(),this._outdoorMapShown||this._setOutdoorVisibility(!1)}updateRendering(){this._updateFeatures(),this._updateSelectedFeatures(),this._layerFloors(),this._calExcludedPoisInMiddle(),this._filterLayers(),this._filterSelectedHighlight(),this._updateUnselectedMask()}async panToBuildingCenter(){if(this.dragPanHandler.panToCenter(),this._featureIncomplete){const e=()=>this.getFeaturesById(this._curBuildingId,{layerIds:[ye]})[0];await this._waitForFeatureLoaded(e)}}async panToVenueCenter(){if(this.dragPanHandler.panToCenter(),this._featureIncomplete){const e=()=>this.getFeaturesById(this._curVenueId,{layerIds:[Lt]})[0];await this._waitForFeatureLoaded(e)}}async _waitForFeatureLoaded(e){const i=()=>this._isDestroyed?(this._abortQueryFeature?.(),!0):!!e(),{promise:r,abort:n}=zr(i);this._abortQueryFeature=n;try{await Promise.race([r,new Promise((s,o)=>{this._abortQueryFeature=()=>{o(new Error("Aborted")),this._abortQueryFeature=null}})])}catch(s){console.warn(s);return}}setDragPan(e){this._dragPan=e}setFitBounds(e){this._fitBounds=e}async selectByClickMap(e){if(!this._enableIndoorClickSelection&&!this._enableOutdoorClickSelection)return;this.setDragPan(!1),this.dragPanHandler.setBounds(null),this._featureIncomplete=!1,!e.venue?this._enableOutdoorClickSelection&&await this.selectBuilding(null):this._enableIndoorClickSelection&&(e.building?await this.selectBuilding(e.building,{floorId:e.floor?.id}):"name"in e.floor&&await this.selectSharedFloor(e.floor,e.venue))}queryIndoorInfoByPoint(e){const i=this._map.unproject(e),r=this._queryVisibleFeature(e),n={coordinate:i,venue:null,building:null,floor:null};if(!r)return n;const{sourceLayer:s}=r;let o=n;if(s==="mapxus_level"){const a=r.properties?.["ref:building"],l=this.getFeaturesById(a)?.[0];if(l){const d=l.properties?.["ref:venue"],u=this.getFeaturesById(d)?.[0];if(u){const{id:c,name:h,ordinal:f}=r.properties;o={coordinate:i,venue:u,building:l,floor:{id:c,code:h,ordinal:f}}}else console.warn("Venue feature not found for building: ",a)}}else if(s==="mapxus_shared_level"){const{id:a,ordinal:l,name:d,"ref:venue":u}=r.properties||{},c=this.getFeaturesById(u)?.[0];c?o={coordinate:i,venue:c,building:null,floor:{id:a,name:typeof d=="string"?{default:d}:d,ordinal:l}}:console.warn("Venue feature not found for sharedFloor: ",a)}else{const a=r?.properties?.["ref:venue"],l=this.getFeaturesById(a)?.[0];l?o={coordinate:i,venue:l,building:r,floor:null}:console.warn("Venue feature not found for building: ",r.properties?.id)}return o}_bindMaplibreEventListeners(){this._map.once("styledata",()=>this.updateCustomLayers()),this._map.once("idle",()=>{this.emit(Qi),(!this._startWithIndoorView||this._map.getZoom()<14)&&this._dispatchIndoorMapLoaded()}),this._map.on("sourcedata",this._debounceRendering=Wi(()=>this.updateRendering(),300))}_clear(){this._curBuildingFeature=null,this._curBuildingId=null,this._floor={code:null,id:null,ordinal:null},this._curVenueId=null,this._curVenueFeature=null,this._curSharedLevelId=null}_getIndoorFeatures(){return this._queryRenderedFeatures().filter(e=>it(e.source))}_getBuildingFloorByOrdinal(e,i){let r=null,n=null;if(e?.properties){const{ordinals:s,level_names:o,level_ids:a}=e.properties,l=w(s).findIndex(d=>d===i);r=w(o)[l]??null,n=w(a)[l]??null}return{code:r,id:n,ordinal:i}}_isCurrentFeature(e){const i=e?.properties?.id??null,r=this._isSelectSharedFloor?this._curSharedLevelId:this._curBuildingId;return i===r}_setOutdoorVisibility(e){for(const{id:i}of this._outdoorLayers)this._map.getLayer(i)&&this._map.setLayoutProperty(i,"visibility",e?"visible":"none")}_addReserveFloorLayers(){for(const e of[Ie,T]){if(this._map.getLayer(e))continue;const i=e.split("_")[1],r=this._map.getLayer(i);if(!r)continue;const{source:n,sourceLayer:s}=r,o=e===Ie?this._middleLayers[0]:this._lowerLayers[0];let a={"fill-opacity":0};if(this._isMaskMode&&e===T){const l=this._originIndoorLayers.find(({id:d})=>d===ye);l&&(a=Object.assign({},l.paint??{},a))}this._map.addLayer({id:e,source:n,"source-layer":s,type:"fill",paint:a},o.id)}}_addBuildingMaskLayer(){if(this._map.getLayer(Le))return;const e=this._originIndoorLayers.find(({id:i})=>i===ye);if(e){const i=Object.assign({},e,{id:Le,layout:Object.assign({},e.layout??{},{visibility:"visible"}),paint:Object.assign({},e.paint??{},{"fill-opacity":0})});this._map.addLayer(i,ye)}}_updateUnselectedMask(){if(!this._isMaskMode)return;const e=[...this._maskBuildings],i=[...this._maskSharedFloors];this._map.getLayer(Le)&&this._map.setPaintProperty(Le,"fill-opacity",["case",["in",["get","id"],["literal",e]],1,0]),this._map.getLayer(T)&&this._map.setPaintProperty(T,"fill-opacity",["case",["in",["get","id"],["literal",i]],1,0])}_addSelectedHighlightLayers(){const e=[{layerId:Bt,sourceLayer:"mapxus_level"},{layerId:Et,sourceLayer:"mapxus_shared_level"}];let i=this._originIndoorLayers.find(({type:r})=>Ct(r));if(!i){const r=this._originIndoorLayers.findIndex(({id:n})=>n===this._upperLayers[this._upperLayers.length-1].id);i=this._originIndoorLayers[r+1]}for(const{layerId:r,sourceLayer:n}of e){if(this._map.getLayer(r))continue;const{lineWidth:s,lineOpacity:o,lineColor:a,lineOffset:l}=this._selectedHighlightStyle,d=er(s,l);this._map.addLayer({id:r,source:"indoor-planet","source-layer":n,type:"line",filter:["==","id",""],paint:{"line-offset":d,"line-width":s,"line-color":a,"line-opacity":o}},i?.id)}}_filterSelectedHighlight(){for(const e of[Bt,Et])this._map.getLayer(e)&&this._map.setFilter(e,["==","id",this._isSelectSharedFloor?this._curSharedLevelId:this._floor.id??""])}_copyOverlapLayers(){const e=this._originIndoorLayers.findIndex(({type:a,"source-layer":l})=>tr(l,a)),i=this._originIndoorLayers.findIndex(({type:a,"source-layer":l})=>Ft(l,a)),r=this._originIndoorLayers.slice(e,i);this._upperLayers=r.filter(({type:a})=>Ha(a));const n=this._originIndoorLayers.slice(i),s=n.findIndex(({type:a,"source-layer":l})=>!Ft(l,a));if(s>-1){this._commonPoiLayers=n.slice(0,s);const a=n.slice(s).filter(({"source-layer":l})=>l==="mapxus_section");this._sectionFillLineLayers=a.filter(({type:l})=>l!=="symbol"),this._sectionSymbolLayers=a.filter(({type:l})=>l==="symbol")}else this._commonPoiLayers=[...n],this._sectionSymbolLayers=r.filter(({type:a,"source-layer":l})=>l==="mapxus_section"&&a==="symbol");const o=this._upperLayers[0];this._middleLayers=this._upperLayers.filter(({type:a})=>!Ct(a)).map(a=>{const l=`${a.id}-overlap-copy`;let d=this._map.getLayer(l);return d||(d=Object.assign({},a,{id:l}),this._map.addLayer(d,o.id)),d})}_copySharedFloorBackgroundLayers(){if(!!!this._upperLayers.find(n=>n.id===T.split("_")[1]))return;const i=this._upperLayers.filter(({"source-layer":n,type:s})=>!Pt(n,s)&&!Ct(s)),r=this._middleLayers[0]||this._upperLayers[0];this._lowerLayers=[...i,...this._commonPoiLayers].map(n=>{const s=`${n.id}-shared-bg`;let o=this._map.getLayer(s);return o||(o=Object.assign({},n,{id:s}),this._map.addLayer(o,r.id)),o})}_updateFeatures(){this._features=this._getIndoorFeatures();const e=Xi(this._features,s=>s.layer.id+":"+s.properties.id),i=[],r=[],n=[];for(const s of e){const o=s.layer.id;o===Lt?i.push(s):o===ye?r.push(s):o===T&&n.push(s)}this._allVenuesMap=new Map(i.map(s=>[s.properties.id,s])),this._allBuildingsMap=new Map(r.map(s=>[s.properties.id,s])),this._allSharedLevelsMap=new Map(n.map(s=>[s.properties.id,s]))}_calExcludedPoisInMiddle(){const e=this._map.querySourceFeatures("indoor-planet",{sourceLayer:"mapxus_place"}),i=n=>n?w(n).some(o=>this._upperLevels.has(o)):!1,r=e.filter(n=>{const s=n.properties["ref:level"]||n.properties["ref:shared_level"];return this._middleLevels.has(s)?i(n.properties.overlap):!1});this._excludedPoisInMiddle=r.map(n=>n.properties["osm:ref"])}_updateSelectedFeatures(){if(this._featureIncomplete){if(this._isSelectSharedFloor){const e=this._features.find(i=>i.properties.id===this._curVenueId);if(!e)return;this._curVenueFeature=e}else{const e=this._allBuildingsMap.get(this._curBuildingId);if(!e)return;this._curBuildingFeature=e}this._featureIncomplete=!1}}_layerFloors(){const{displayedLevels:e,selectedLevelIds:i,alwaysDisplayedSharedLevelIds:r,maskBuildingIds:n,maskSharedFloorIds:s}=this.layeredHandler.getLayeredData({selectedVenueId:this._curVenueId,venueMap:this._allVenuesMap,buildingMap:this._allBuildingsMap,sharedFloorMap:this._allSharedLevelsMap});this._upperLevels.clear(),this._middleLevels.clear(),this._lowerLevels.clear(),this._layerSelectedLevels(e,i),this._layerUnselectedLevels(e,i,r),this._isMaskMode&&(this._maskBuildings.clear(),this._maskSharedFloors.clear(),n.forEach(o=>{this._maskBuildings.add(o)}),s.forEach(o=>{this._maskSharedFloors.add(o)}))}_layerSelectedLevels(e,i){for(const r of i){this._upperLevels.add(r),this._zIndexHistory.set(r,!0);const n=e.find(({level:s,overlap:o})=>s===r&&!!o);if(n)for(const s of n.overlap)this._zIndexHistory.get(s)&&this._zIndexHistory.delete(s)}}_layerUnselectedLevels(e,i,r){for(const n of e){if(i.includes(n.level))continue;const{level:s,overlap:o,venueId:a}=n,l=this._zIndexHistory.get(s),d=!o||!o.some(c=>this._upperLevels.has(c)),u=r.includes(s);if(a===this._curVenueId&&u){this._lowerLevels.add(s),this._zIndexHistory.delete(s);continue}l?this._upperLevels.add(s):l===!1?this._middleLevels.add(s):u?this._lowerLevels.add(s):d?(this._upperLevels.add(s),this._zIndexHistory.set(s,!0)):(this._middleLevels.add(s),this._zIndexHistory.set(s,!1))}}_filterLayers(){this._filterIndoorLayers([...this._upperLevels,...this._middleLevels],this._commonPoiLayers),this._filterIndoorLayers([...this._upperLevels],this._upperLayers),this._filterIndoorLayers([...this._middleLevels],this._middleLayers),this._filterIndoorLayers([...this._lowerLevels],this._lowerLayers),this._sectionSymbolLayers.length!==0&&(this._sectionFillLineLayers.length?(this._filterIndoorLayers([...this._upperLevels],this._sectionFillLineLayers),this._filterIndoorLayers([...this._upperLevels],this._sectionSymbolLayers)):this._filterIndoorLayers([...this._upperLevels,...this._middleLevels,...this._lowerLevels],this._sectionSymbolLayers))}_filterIndoorLayers(e,i){let r;for(const n of i){const{id:s,filter:o,type:a,"source-layer":l}=n,d=o?[o]:[],u=s.includes("-shared-bg"),c=[...this._maskBuildings],h=[...this._maskSharedFloors];tr(l,a)?r=["all",Pt(l,a)?["!in","ref:building",...c]:["!in","id",...h],["in","id",...e],...d]:u?r=["all",["!in","ref:shared_level",...h],["in","ref:shared_level",...e],...d]:(r=["all",["any",["all",["!in","ref:building",...c],["in","ref:level",...e]],["all",["!in","ref:shared_level",...h],["in","ref:shared_level",...e]]],...d],Ft(l,a)&&r.splice(1,0,["any",["!has","overlap"],["any",["in","ref:level",...this._upperLevels],["in","ref:shared_level",...this._upperLevels],["!in","osm:ref",...this._excludedPoisInMiddle]]])),this._map.setFilter(s,r)}}async _queryVenueFeature(e){let i=this.getFeaturesById(e,{layerIds:[Lt]})[0]??null;if(!i)try{const r=await lt(e);i=rt(r)}catch(r){console.error(r)}return i}_getBuildingDisplayedOrdinal(e,i){if(!e||!e.properties)return null;const{"ref:venue":r,level_ids:n,ordinals:s}=e.properties,o=w(n),a=w(s);if(i){const d=o.findIndex(u=>u===i);return a[d]??null}const l=this._history.getHistoryOrdinal(r);return l&&a.includes(l)?l:Ki(e)}_updateFloorState(e){if(!e){this._floor={code:null,id:null,ordinal:null};return}const{code:i,id:r}=this._getBuildingFloorByOrdinal(this._curBuildingFeature,e);(!i||!r)&&console.error(`Floor with ordinal "${e}" not found in building "${this._curBuildingId}".`),this._floor={code:i,id:r,ordinal:e},this._history.setHistoryOrdinal(this._curVenueId,e),this._history.setHistoryBuildingUnit(this._curVenueId,{id:this._curBuildingId,type:"building"})}async _checkAndPanToBuilding(){this.getFeaturesById(this._curBuildingId,{layerIds:[ye]})[0]||(this._fitBounds?this.dragPanHandler.fitBounds():this.dragPanHandler.panToCenter())}_queryVisibleFeature(e){const r=[Zi,wt,`${Zi}-overlap-copy`,`${wt}-overlap-copy`,`${wt}-shared-bg`,...this._isMaskMode?[T,Le]:[]].filter(o=>!!this._map.getLayer(o)),n=this._map.queryRenderedFeatures(e,{layers:r});let s=null;for(const o of r){const a=n.find(l=>l.layer.id===o);if(a){s=a;break}}return s&&ka(s.sourceLayer,s.layer.type)&&(this._maskBuildings.has(s.properties?.id)||(s=null)),s}_queryRenderedFeatures(e){const i=(e||[]).filter(s=>this._map.getLayer(s));if(e&&e.length>0&&i.length===0)return[];const r=i.length?{layers:i}:{},n=this._map.getCanvas().getBoundingClientRect();return this._map.queryRenderedFeatures([[0,0],[n.width,n.height]],r)}_dispatchIndoorMapLoaded(){this._indoorMapLoaded||(this._indoorMapLoaded=!0,this.emit(It))}_changeOtherVenuesHistory(e){const i=[...this._allVenuesMap.values()];for(const r of i){const n=r.properties.id;n!==this._curVenueId&&this._history.setHistoryOrdinal(n,e)}}}function er(t,e){const i=typeof t=="number"&&t===He.lineWidth,r=typeof e=="number"&&e===He.lineOffset;if(!r)return e;if(i&&r)return["interpolate",["linear"],["zoom"],18,-1.5,20.2,-3.75,20.4,-3.8,21.5,-7.5,22,-9.55];if(!i&&r)return typeof t=="number"?-(t/2):e}function ka(t,e){return t==="mapxus_building"&&(e==="fill"||e==="line"||e==="symbol")}function tr(t,e){return Pt(t,e)||Da(t,e)}function Pt(t,e){return t==="mapxus_level"&&(e==="fill"||e==="line")}function Da(t,e){return t==="mapxus_shared_level"&&(e==="fill"||e==="line")}function Ft(t,e){return t==="mapxus_place"&&e==="symbol"}function Ct(t){return t==="fill-extrusion"}function Ha(t){return t==="line"||t==="fill"||t==="fill-extrusion"}const Ke="Poi_poiClick";class ir{_map;_currentStyle=null;_styleLayersLength=0;_layerIds=[];_dispatch=ve(Ke);_listeners=[];constructor(e){this._map=e,this._bindPoiClickEvent()}destroy(){this._dispatch.on(`.${Ke}`,null),this._currentStyle=null,this._map=null,this._dispatch=null,this._listeners=[],this._layerIds=[]}onPoiClick(e){const i=ie(`${Ke}.`);return this._dispatch.on(i,e),this._listeners.push(i),{unsubscribe:()=>this._dispatch.on(i,null)}}_queryPoiLayers(){const e=this._map.getStyle();if(e.name===this._currentStyle&&e.layers.length===this._styleLayersLength)return;const i=tt(e).filter(r=>r["source-layer"]==="mapxus_place"&&r.type==="symbol");this._layerIds=i.map(({id:r})=>r),this._currentStyle=e.name,this._styleLayersLength=e.layers.length}_bindPoiClickEvent(){this._map.on("click",e=>{if(this._listeners.length===0)return;this._queryPoiLayers();const i=this._map.queryRenderedFeatures(e.point,{layers:this._layerIds});if(i.length===0)return;const r=i[0],n=w(r.properties["ref:sections"]),s=!!r.properties["ref:shared_level"],o={coordinate:e.lngLat,poi:r};if(n.length>0){const a=this._map.querySourceFeatures("indoor-planet",{sourceLayer:"mapxus_section"});o.sections=n.map(l=>{const d=a.find(g=>g.properties.id===l),{id:u,section:c="",correlation_id:h}=d?.properties||{},f=rr(d?.properties);return{id:u,category:c,sectionName:f,...h&&{correlationId:h}}})}if(s){const a=r.properties["ref:shared_level"],{floor:l,venue:d}=this._queryIndoorFeaturesBySharedFloor(a);o.floor=l,o.venue=d}else{const a=r.properties["ref:level"],{floor:l,building:d,venue:u}=this._queryIndoorFeaturesByFloor(a);o.floor=l,o.building=d,o.venue=u}this._dispatch.call(Ke,null,o)})}_queryIndoorFeaturesBySharedFloor(e){const i=this._map.queryRenderedFeatures({layers:[T,"mapxus-venue-fill"]}),r=i.find(d=>d.sourceLayer==="mapxus_shared_level"&&d.properties.id===e);if(!r)return{floor:null,venue:null};const n=r.properties["ref:venue"],s=i.find(d=>d.layer.id==="mapxus-venue-fill"&&d.properties.id===n)??null,{id:o,ordinal:a}=r.properties,l=rr(r.properties);return{floor:{id:o,ordinal:a,name:l},venue:s}}_queryIndoorFeaturesByFloor(e){const i=this._map.queryRenderedFeatures({layers:[Ie,"mapxus-building-line","mapxus-venue-fill"]}),r=i.find(u=>u.sourceLayer==="mapxus_level"&&u.properties.id===e);if(!r)return{floor:null,building:null,venue:null};const{id:n,ordinal:s,name:o,"ref:building":a}=r.properties||{},l=i.find(u=>u.layer.id==="mapxus-building-line"&&u.properties.id===a)??null,d=i.find(u=>u.layer.id==="mapxus-venue-fill"&&u.properties.id===l?.properties?.["ref:venue"])??null;return{floor:{id:n,ordinal:s,code:o},building:l,venue:d}}}function rr(t){return t?Object.keys(t).filter(i=>i.includes("name")).reduce((i,r)=>{const[,n]=w(r,":");return n?i[n]=t[r]:i.default=t[r],i},{}):{default:""}}function $e(t){t.parentNode&&t.parentNode.removeChild(t)}function F(t,e,i){const r=document.createElement(t);return e&&(r.className=e),i&&i.appendChild(r),r}class nr{_map;_maplibre;_buildingId;_features;_$container;_$listContainer;_$buildingList;_listHeight;_language;_visible;_position="top-right";_isMobileMode;_isListShown=!1;constructor(e,i){this._map=e,this._language=e.getLanguage(),this._visible=i??!0,this._detectDeviceMode()}onAdd(e){return this._maplibre=e,this._$container=F("div",`maplibregl-ctrl maplibregl-ctrl-building-filter ${this._visible?"":"hide"}`,this._maplibre.getContainer()),this._$container.appendChild(this._buildingFilterIconCreate("div")),this._$container.appendChild(this._buildingNameListCreate("div")),this._bindEvents(),this._$container}onRemove(){$e(this._$container)}get position(){return this._position}get enabled(){return this._visible}getDefaultPosition(){return"top-right"}setVisibility(e){this._visible=e,e?this._$showLayout():this._$hideLayout()}changePosition(e,i,r){const n=document.querySelector(`.maplibregl-ctrl-${e}`),s=n.querySelector(".maplibregl-ctrl-building-filter");if(e!==i){this._position=i;const o=document.querySelector(`.maplibregl-ctrl-${i}`);s&&(n.removeChild(s),Number.isFinite(r)?o.insertBefore(s,o.children[r]):o.append(s),this._updateBuildingListLayout(i))}else Number.isFinite(r)&&n.children[r]!==s&&(n.removeChild(s),n.insertBefore(s,n.children[r]))}_bindEvents(){this._maplibre.on("moveend",()=>this._refresh()),this._map.onMapChangeListener(e=>{const i=e.building?.properties?.id??"";this._buildingId!==i&&(this._buildingId=i,this._refresh())}),this._map.renderComplete(()=>this._init())}_init(){this._load()}_refresh(){this._load()}_load(){this._buildingNameListClean(),this._buildingNameListUpdate()}_buildingFilterIconCreate(e){const i=F(e,"mapxus-building-filter-icon");return this._bindMouseOnEvents(i,!1),this._bindMobileTouchEvents(i),i}_buildingNameListCreate(e){return this._$listContainer=F(e,"mapxus-building-name-layout"),this._$listContainer.style.display="none",this._$listContainer.style.top="20px",this._$buildingList=F(e,"mapxus-building-name-list",this._$listContainer),this._bindMouseOnEvents(this._$listContainer,!0),this._$listContainer}_buildingNameListUpdate(){this._features=[];const e=this._map.getMaplibre(),i=e?e.queryRenderedFeatures({layers:["mapxus-building-line"]}):[];for(const r of i){const{properties:n}=r,{id:s,name:o}=n,a=n?.[`name:${this._language}`]??o;this._features.find(l=>l.properties.id===s)||(this._features.push(r),this._$buildingList.appendChild(this._buildingNameCreate("p",a,s,s===this._map.building?.properties?.id)))}this._setBuildingListHeight(this._features),this._updateBuildingListLayout(this._position)}_buildingNameListClean(){this._$buildingList.replaceChildren()}_setBuildingListHeight(e){const n=e.map(s=>{const o=s?.properties?.[`name:${this._language}`]??s?.properties?.name;return o?Math.ceil(o.length*8/107):0}).reduce((s,o)=>s+o,0);this._listHeight=n*26+e.length*8,this._$buildingList.style.height=this._$listContainer.style.height=`${this._listHeight>=208?208:this._listHeight}px`}_buildingNameCreate(e,i,r,n){const s=F(e,`mapxus-building-name${n?" active":""}`);return s.dataset.id=r,s.innerText=i,this._buildingNameClickEvent(s),s}_toggleList(e){this._isListShown=e,this._$listContainer.style.display=e?"block":"none"}_buildingNameClickEvent(e){e.onclick||(e.onclick=async i=>{const r=i.target;await this._map.selectBuildingById(r.dataset.id)})}_bindMouseOnEvents(e,i){e.onmouseenter=()=>{this._isMobileMode||this._toggleList(!0)},i&&(e.onmouseleave=()=>this._toggleList(!1))}_bindMobileTouchEvents(e){window.addEventListener("resize",()=>this._detectDeviceMode()),e.ontouchend=()=>this._toggleList(!this._isListShown)}_$showLayout(){this._$container.classList.remove("hide")}_$hideLayout(){this._$container.classList.add("hide")}_updateBuildingListLayout(e){e.indexOf("left")>-1?(this._$listContainer.style.right=null,this._$listContainer.style.left="55px"):(this._$listContainer.style.left=null,this._$listContainer.style.right="55px");const i=this._$container.offsetParent?this._$container.offsetParent.clientHeight-(this._$container.offsetTop+this._$container.clientHeight)-25:0;e.includes("bottom")&&this._listHeight-20>i?(this._$listContainer.style.top=null,this._$listContainer.style.bottom="15px"):(this._$listContainer.style.bottom=null,this._$listContainer.style.top="20px")}_detectDeviceMode(){this._isMobileMode=window.matchMedia("(pointer: coarse) and (max-width: 768px)").matches}}var Na=Math.max,Ua=Math.min;function ja(t,e,i){return t>=Ua(e,i)&&t<Na(e,i)}var sr=1/0,Va=17976931348623157e292;function or(t){if(!t)return t===0?t:0;if(t=ze(t),t===sr||t===-sr){var e=t<0?-1:1;return e*Va}return t===t?t:0}function ar(t,e,i){return e=or(e),i===void 0?(i=e,e=0):i=or(i),t=ze(t),ja(t,e,i)}class lr{_container;_indoor;_maplibre;_position="top-right";_buildingId;_floorNames;_ordinals;_ordinal;_style;_$innerFloors;_$activeFloor;_centerSelectorIdx;_lastNormalScrollableIdx;_$arrowBtnUp;_$arrowBtnDown;_maxScrollTop;_$selectorExpanded;_$selectorFolded;_componentDidMount=!1;_visible=!1;_isEnabled;_dragPan;_language;_debounceScroll;_clearScrollEventListener;constructor(e,i){const{style:r,enabled:n=!0,language:s}=i;this._indoor=e,this._language=s,this._style=r?Object.assign({},Kt,r):Kt,this._isEnabled=n,this._addIndoorEventListeners()}onAdd(e){return this._maplibre=e,this._addMapMoveEventListener(),this._container=F("div","maplibregl-ctrl mapxus-ctrl-floors hidden"),this._container}onRemove(){this._debounceScroll&&this._debounceScroll.cancel(),this._clearScrollEventListener&&this._clearScrollEventListener(),$e(this._container)}get position(){return this._position}get enabled(){return this._isEnabled}setEnabled(e){this._isEnabled=e,e&&!this._visible&&this._setVisibility(!0),!e&&this._visible&&this._setVisibility(!1)}getDefaultPosition(){return"top-right"}async switchByOrdinal(e,i){this._ordinal=e,this._dragPan=i??!0,await this._indoor.switchFloorByOrdinal(e),this._updateSelectorStatus(e),this._scrollCenterActiveFloor()}changePosition(e,i,r){const n=document.querySelector(`.maplibregl-ctrl-${e}`),s=n.querySelector(".mapxus-ctrl-floors");if(e!==i){this._position=i;const o=document.querySelector(`.maplibregl-ctrl-${i}`);s&&(n.removeChild(s),Number.isFinite(r)?o.insertBefore(s,o.children[r]):o.append(s),this._show(),this._scrollCenterActiveFloor())}else Number.isFinite(r)&&n.children[r]!==s&&(n.removeChild(s),n.insertBefore(s,n.children[r]),this._show(),this._scrollCenterActiveFloor())}setStyle(e){this._style=Object.assign({},this._style,e),this._componentDidMount&&(this._clearFloors(),this._calcSelectorLayout(),this._render(),this._scrollCenterActiveFloor())}_setVisibility(e){this._componentDidMount?e?(this._show(),this._scrollCenterActiveFloor()):this._hide():(this._visible=e,this._indoor.building&&e&&(this._render(),this._show(),this._scrollCenterActiveFloor()))}_addIndoorEventListeners(){this._indoor.on(Ge,e=>{if(this._updatePrepared(),!e)return;const{ordinal:i,dragPan:r}=e;this._dragPan=r,"building"in e?this._renderBuildingFloors(e.building,i):this._renderSharedLevelFloor(e)})}_updatePrepared(){this._clearState(),this._visible&&this._hide(),this._componentDidMount&&this._clearFloors()}_renderBuildingFloors(e,i){const{level_names:r,ordinals:n,id:s}=e.properties;this._buildingId=s,this._floorNames=r.split(",").reverse(),this._ordinals=n.split(",").reverse(),this._ordinal=i,this._calcSelectorLayout(),this._render();const o=this._indoor.getFeaturesById(s,{filter:a=>a.layer.id==="mapxus-building-line"})[0];this._checkIfShowFloorSelector(o)}_renderSharedLevelFloor(e){const{name:i,ordinal:r,id:n}=e;this._floorNames=[i[this._language]||i.default],this._ordinals=[r],this._ordinal=r,this._calcSelectorLayout(),this._render();const s=this._indoor.getFeaturesById(n,{layerIds:[T]})[0];this._checkIfShowFloorSelector(s)}_checkIfShowFloorSelector(e){this.enabled&&(this._dragPan!==!1||this._dragPan===!1&&e)&&(this._show(),this._scrollCenterActiveFloor())}_addMapMoveEventListener(){this._maplibre.on("moveend",()=>{this.enabled&&this._dragPan===!1&&this._buildingId&&(this._indoor.getFeaturesById(this._buildingId,{layerIds:["mapxus-building-line"]})[0]?this._componentDidMount?this._visible||(this._show(),this._scrollCenterActiveFloor()):(this._render(),this._show(),this._scrollCenterActiveFloor()):this._componentDidMount&&this._visible&&this._hide())})}_clearState(){this._buildingId=null,this._floorNames=[],this._ordinals=[],this._ordinal=null}_calcSelectorLayout(){const{itemCount:e,itemSize:i}=this._style;this._centerSelectorIdx=Math.ceil(e/2)-1,this._maxScrollTop=(this._floorNames.length-e)*i,this._lastNormalScrollableIdx=this._floorNames.length-(e-this._centerSelectorIdx-1)-1}_render(){this._createFloors(),this._componentDidMount=!0}_hide(){this._container.classList.add("hidden"),this._visible=!1}_show(){this._container.classList.remove("hidden"),this._visible=!0}_createFloors(){this._$selectorFolded=this._$foldedSelector(this._container,()=>{this._expandSelector(!0),this._scrollCenterActiveFloor()}),this._$selectorExpanded=this._$expandedSelector(this._container,()=>this._expandSelector(!1))}_$expandedSelector(e,i){const{itemSize:r,itemCount:n,defaultFolded:s,backgroundColor:o}=this._style,a=F("div",`mapxus-ctrl-floors-expanded ${s?"hidden":""}`,e);if(this._floorNames.length>1){const d=F("div","mapxus-ctrl-floors-close",a);d.onclick=i}const l=F("div","mapxus-ctrl-floors-wrapper",a);return l.style.backgroundColor=o,this._floorNames.length>n&&(this._$arrowBtnUp=this._$createScrollButton(l,"up"),this._$arrowBtnUp.onclick=()=>this._handleScroll("up")),this._$innerFloors=F("div","mapxus-ctrl-floors-inner",l),Object.assign(this._$innerFloors.style,{maxHeight:`${r*n}px`,width:`${r}px`}),this._$createFloors(this._$innerFloors),this._floorNames.length>n&&(this._$arrowBtnDown=this._$createScrollButton(l,"down"),this._$arrowBtnDown.onclick=()=>this._handleScroll("down"),this._$innerFloors.addEventListener("scroll",this._debounceScroll=Wi(d=>{d.stopPropagation(),this._resetArrowBtnStatus(this._$innerFloors.scrollTop)},100)),this._clearScrollEventListener=()=>this._$innerFloors.removeEventListener("scroll",this._debounceScroll)),a}_$foldedSelector(e,i){const{itemSize:r,activeFontColor:n,activeBackgroundColor:s,defaultFolded:o}=this._style,a=F("div",`mapxus-ctrl-floors-folded mapxus-ctrl-floors-floor ${o?"":"hidden"}`,e);return a.onclick=i,Object.assign(a.style,{width:`${r}px`,height:`${r}px`,lineHeight:`${r}px`,color:n,backgroundColor:s}),a}_clearFloors(){this._container.replaceChildren(),this._componentDidMount=!1}_$createScrollButton(e,i){return F("div",`mapxus-ctrl-floors-arrow mapxus-ctrl-floors-floor ${i}`,e)}_$createFloors(e){const{fontColor:i,itemSize:r}=this._style;let n;this._floorNames.forEach((s,o)=>{n=F("div","mapxus-ctrl-floors-floor",e),n.dataset.floor=s,n.dataset.ordinal=this._ordinals[o],n.innerText=s,Object.assign(n.style,{color:i,height:`${r}px`,lineHeight:`${r}px`}),n.dataset.ordinal===this._ordinal&&(this._$activeFloor=n,this._resetActiveFloor(!0),this._$selectorFolded.innerText=s),n.onclick=async a=>{this._indoor.setDragPan("restrict"),this._indoor.dragPanHandler.setAnimated(!0),await this.switchByOrdinal(a.target.dataset.ordinal)}})}_updateSelectorStatus(e){const i=this._floorNames[this._ordinals.indexOf(e)];this._$activeFloor&&this._resetActiveFloor(!1);for(const r of this._$innerFloors.children){const n=r;n.dataset.ordinal===e&&(this._$activeFloor=n,this._resetActiveFloor(!0))}this._$selectorFolded.innerText=i}_resetArrowBtnStatus(e){e===0?this._$arrowBtnUp?.classList?.add("hidden"):this._$arrowBtnUp?.classList?.remove("hidden"),e===this._maxScrollTop?this._$arrowBtnDown?.classList?.add("hidden"):this._$arrowBtnDown?.classList?.remove("hidden")}_resetActiveFloor(e){const{activeBackgroundColor:i,backgroundColor:r,activeFontColor:n,fontColor:s}=this._style;Object.assign(this._$activeFloor.style,{color:e?n:s,backgroundColor:e?i:r,fontWeight:e?"bold":"normal",cursor:e?"auto":"pointer"}),this._$activeFloor.disabled=e}_scrollCenterActiveFloor(){if(this._ordinal){const e=this._ordinals.indexOf(this._ordinal);e>-1&&(this._$innerFloors.scrollTop=this._getScrollTop(e),this._$innerFloors.scrollTop||this._resetArrowBtnStatus(0))}}_getScrollTop(e){return ar(this._centerSelectorIdx,this._lastNormalScrollableIdx+1)?(e-this._centerSelectorIdx)*this._style.itemSize:e>this._lastNormalScrollableIdx?this._maxScrollTop:0}_handleScroll(e){const i=this._$innerFloors.scrollTop,{itemSize:r}=this._style;if(e==="up"){const n=i-r*2;this._$innerFloors.scrollTop=n<0?0:n}else if(e==="down"){const n=i+r*2;this._$innerFloors.scrollTop=n>this._maxScrollTop?this._maxScrollTop:n}}_expandSelector(e){e?(this._$selectorExpanded.classList.remove("hidden"),this._$selectorFolded.classList.add("hidden")):(this._$selectorExpanded.classList.add("hidden"),this._$selectorFolded.classList.remove("hidden"))}}const dr=Re.includes("co.jp"),qa=dr?"kawasaki-logo":"mapxus-logo",za=dr?"https://www.khi.co.jp/groupvision2030/mapxus.html":"https://www.mapxus.com/";class Ga{_container;_isEnabled;constructor(e){this._isEnabled=e?.enabled??!0}onAdd(e){if(this._container=F("div","maplibregl-ctrl mapxus-ctrl-logo",e.getContainer()),this._isEnabled){const i=F("a",qa,this._container);i.target="_blank",i.href=za,i.setAttribute("aria-label","Mapxus logo"),i.setAttribute("rel","noopener"),this._container.appendChild(i)}return this._container}onRemove(){$e(this._container)}getDefaultPosition(){return"bottom-left"}}const Ka=Re.includes("co.jp");class Ya{_container;_anchor;_theme;constructor(e){this._theme=e.theme?e.theme:"default"}onAdd(e){return this._container=F("div","maplibregl-ctrl mapxus-ctrl-attribution",e.getContainer()),this._anchor=F("a","mapxus-attribution",this._container),this._anchor.target="_blank",this._setCopyrightInfo(this._theme),this._anchor.setAttribute("aria-label","Mapxus attribution"),this._anchor.setAttribute("rel","noopener"),this._container.appendChild(this._anchor),this._container}onRemove(){$e(this._container)}getDefaultPosition(){return"bottom-right"}changeTheme(e){this._setCopyrightInfo(e)}_setCopyrightInfo(e){this._anchor.innerText=e==="landsD"?"© The Government of the Hong Kong SAR":Ka?"©Mapxus driven by Kawasaki ©OpenStreetMap contributors":"©Mapxus ©OpenStreetMap contributors",e==="landsD"&&(this._anchor.href="https://www.map.gov.hk/gm/")}}class Wa{_container;_$icon;_removeClickEventListener;onAdd(e){return this._container=F("div","maplibregl-ctrl mapxus-ctrl-collapsed-copyright",e.getContainer()),this._container.innerHTML=Xa(),this._bindEvents(),this._container}onRemove(){this._removeClickEventListener(),$e(this._container)}getDefaultPosition(){return"bottom-right"}_bindEvents(){const e=this._container.querySelector(".mapxus-collapsed-copyright-menu");this._$icon=this._container.querySelector(".mapxus-collapsed-copyright-btn");let i=!1;this._$icon.addEventListener("click",r),this._removeClickEventListener=()=>this._$icon.removeEventListener("click",r);function r(){i=!i,n()}function n(){i?e.classList.remove("hidden"):e.classList.add("hidden")}}}function Xa(){return`
|
|
1
|
+
(function(p,A){typeof exports=="object"&&typeof module<"u"?A(exports,require("@mapxus/mapxus-auth-jp"),require("maplibre-gl")):typeof define=="function"&&define.amd?define(["exports","@mapxus/mapxus-auth-jp","maplibre-gl"],A):(p=typeof globalThis<"u"?globalThis:p||self,A(p.MapxusMap={},p.MapxusAuth,p.maplibregl))})(this,(function(p,A,Nt){"use strict";var wr={value:()=>{}};function Se(){for(var t=0,e=arguments.length,i={},r;t<e;++t){if(!(r=arguments[t]+"")||r in i||/[\s.]/.test(r))throw new Error("illegal type: "+r);i[r]=[]}return new Te(i)}function Te(t){this._=t}function Br(t,e){return t.trim().split(/^|\s+/).map(function(i){var r="",n=i.indexOf(".");if(n>=0&&(r=i.slice(n+1),i=i.slice(0,n)),i&&!e.hasOwnProperty(i))throw new Error("unknown type: "+i);return{type:i,name:r}})}Te.prototype=Se.prototype={constructor:Te,on:function(t,e){var i=this._,r=Br(t+"",i),n,s=-1,o=r.length;if(arguments.length<2){for(;++s<o;)if((n=(t=r[s]).type)&&(n=Er(i[n],t.name)))return n;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<o;)if(n=(t=r[s]).type)i[n]=Ut(i[n],t.name,e);else if(e==null)for(n in i)i[n]=Ut(i[n],t.name,null);return this},copy:function(){var t={},e=this._;for(var i in e)t[i]=e[i].slice();return new Te(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var i=new Array(n),r=0,n,s;r<n;++r)i[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=this._[t],r=0,n=s.length;r<n;++r)s[r].value.apply(e,i)},apply:function(t,e,i){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],n=0,s=r.length;n<s;++n)r[n].value.apply(e,i)}};function Er(t,e){for(var i=0,r=t.length,n;i<r;++i)if((n=t[i]).name===e)return n.value}function Ut(t,e,i){for(var r=0,n=t.length;r<n;++r)if(t[r].name===e){t[r]=wr,t=t.slice(0,r).concat(t.slice(r+1));break}return i!=null&&t.push({name:e,value:i}),t}const Ze={version:"10.2.0"}.version,Re="https://map-api.mapxus.co.jp/bms",R=10,k=1,oe="api/v6/venues",Pr="api/v5/buildings",ve="api/v6/buildings",jt="api/v5/pois",Z="api/v6/pois",Fr="api/v4/route/query",Cr="api/v3/tiles/styles",Vt="api/v5/categories/group",Or="api/v1/categories/tree";class D{static instance;_globalDispatcher;_httpSession;_theme=null;_isSDKInitialized=!1;constructor(){}static getInstance(){return D.instance||(D.instance=new D),D.instance}setGlobalDispatcher(e){this._globalDispatcher=e}getGlobalDispatcher(){return this._globalDispatcher}async getHttpSession(){return this._httpSession||(this.registerSDK(),this._httpSession=await A.HTTPSession.create(A.SDKName.MapSDK,A.base64Encode(`version-${Ze}`)),this._httpSession.setBaseURL(Re),this._httpSession.setRetryConfig(3)),this._httpSession}registerSDK(){this._isSDKInitialized||(this._isSDKInitialized=!0,A.reportLog(`${A.SDKName.MapSDK} initialized`))}get theme(){return this._theme}setTheme(e){this._theme=e}clear(){this._httpSession.destroy(),this._globalDispatcher=null,D.instance=null}}const qt=["unauthorized","initError"],Je=globalThis,et=Se(...qt);D.getInstance().setGlobalDispatcher(et),Je.MapxusMapEvents=Je.MapxusMapEvents||{},Je.MapxusMapEvents.on=function(t,e){return et.on(t,e),{off:()=>et.on(t,null)}};var ke={exports:{}},zt;function $r(){if(zt)return ke.exports;zt=1;function t(){}return t.prototype={on:function(e,i,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:i,ctx:r}),this},once:function(e,i,r){var n=this;function s(){n.off(e,s),i.apply(r,arguments)}return s._=i,this.on(e,s,r)},emit:function(e){var i=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,s=r.length;for(n;n<s;n++)r[n].fn.apply(r[n].ctx,i);return this},off:function(e,i){var r=this.e||(this.e={}),n=r[e],s=[];if(n&&i)for(var o=0,a=n.length;o<a;o++)n[o].fn!==i&&n[o].fn._!==i&&s.push(n[o]);return s.length?r[e]=s:delete r[e],this}},ke.exports=t,ke.exports.TinyEmitter=t,ke.exports}var Ar=$r(),De=(t=>(t[t.VENUE=0]="VENUE",t[t.GLOBAL=1]="GLOBAL",t))(De||{});function Mr(t){return t.layers.filter(e=>!it(e.source))}function tt(t){return t.layers.filter(e=>it(e.source))}function it(t){return typeof t!="string"?!1:t.startsWith("indoor-")}function Gt(t){const{buildingId:e,labelCenter:{lat:i,lon:r},floors:n,name:s,venueId:o,defaultFloor:a}=t,l=Object.entries(s).reduce((h,[f,g])=>{const _=f==="default"?"name":`name:${f}`;return Object.assign(h,{[_]:g})},{}),{codes:d,ids:u,ordinals:c}=n.reduce((h,f)=>{const{id:g,code:_,ordinal:y}=f;return{codes:h.codes?`${h.codes},${_}`:_,ids:h.ids?`${h.ids},${g}`:g,ordinals:`${h.ordinals}`?`${h.ordinals},${y}`:`${y}`}},{codes:"",ids:"",ordinals:""});return{layer:{id:"mapxus-building-line"},properties:{building:"yes",id:e,label_center:`${r},${i}`,level_ids:u,level_names:d,ordinals:c,"ref:venue":o,...l,...a?{default_displayed_floor:a}:{}},source:"indoor-planet",sourceLayer:"mapxus_building"}}function rt(t){const{address:e,buildings:i,id:r,name:n,type:s,labelCenter:{lon:o,lat:a},defaultBuilding:l,sharedFloors:d}=t,u=Object.entries(e).reduce((_,[y,m])=>Object.assign(_,y==="default"?{"addr:street":m.street,"addr:housenumber":m.housenumber}:{[`addr:street:${y}`]:m.street}),{}),c=Object.entries(n).reduce((_,[y,m])=>{const v=y==="default"?"name":`name:${y}`;return Object.assign(_,{[v]:m})},{}),h=l?i.find(_=>_.id===l)?.defaultFloor:null,f=l?{default_displayed_building:l,...h?{default_displayed_ordinal:h}:{}}:{},g=d?.length?{shared_level_ids:d.map(({id:_})=>_).join(","),shared_level_ordinals:d.map(({ordinal:_})=>_).join(",")}:{};return{layer:{id:"mapxus-venue-fill"},properties:{...u,...c,id:r,venue:s,label_center:`${o},${a}`,building_ids:i.map(({id:_})=>_).join(),...f,...g},source:"indoor-planet",sourceLayer:"mapxus_venue"}}function w(t,e=","){return typeof t!="string"||!t.trim()?[]:t.split(e)}const Ie="reserve_mapxus-level-fill",T="reserve_mapxus-shared-level-fill",Le="reserve_mapxus-building-fill";var C=(t=>(t.ENGLISH="en",t.CHINESE_SIMPLIFIED="zh-Hans",t.CHINESE_TRADITIONAL="zh-Hant",t.CHINESE_TRADITIONAL_TW="zh-Hant-TW",t.JAPANESE="ja",t.KOREAN="ko",t.FILIPINO="fil",t.INDONESIAN="id",t.PORTUGUESE="pt",t.THAI="th",t.VIETNAMESE="vi",t.ARABIC="ar",t.FRENCH="fr",t.ITALIAN="it",t))(C||{});function Kt(t){let e=null;return xr(t)?e=C.ENGLISH:Tr(t)?e=C.CHINESE_SIMPLIFIED:Rr(t)?e=C.CHINESE_TRADITIONAL:kr(t)?e=C.CHINESE_TRADITIONAL_TW:Dr(t)?e=C.JAPANESE:Hr(t)?e=C.KOREAN:Nr(t)?e=C.FILIPINO:Ur(t)?e=C.INDONESIAN:jr(t)?e=C.PORTUGUESE:Vr(t)?e=C.THAI:qr(t)?e=C.VIETNAMESE:zr(t)?e=C.ARABIC:Gr(t)?e=C.FRENCH:Kr(t)&&(e=C.ITALIAN),e}function xr(t){return/^en(-(US|GB|AU))?$/.test(t)}function Tr(t){return/^zh(-(Hans|CN))?$/.test(t)}function Rr(t){return/^zh-(Hant|HK|MO)$/.test(t)}function kr(t){return t==="zh-TW"}function Dr(t){return/^ja(-JP)?$/.test(t)}function Hr(t){return/^ko(-KR)?$/.test(t)}function Nr(t){return/^(fil|tl)(-PH)?$/.test(t)}function Ur(t){return/^id(-ID)?$/.test(t)}function jr(t){return/^pt(-(BR|PT))?$/.test(t)}function Vr(t){return/^th(-TH)?$/.test(t)}function qr(t){return/^vi(-VN)?$/.test(t)}function zr(t){return/^ar(-(DZ|BH|EG|IQ|JO|KW|LB|LY|MA|OM|QA|SA|SY|TN|AE|YE))?$/.test(t)}function Gr(t){return/^fr(-(FR|CA|CH))?$/.test(t)}function Kr(t){return/^it(-(IT|CH))?$/.test(t)}const He={lineWidth:3,lineColor:"#A5E3FF",lineOpacity:1,lineOffset:-1.5},Yt={fontColor:"#8c8c8c",activeFontColor:"#fff",backgroundColor:"#fff",activeBackgroundColor:"#074769",itemSize:50,itemCount:4,defaultFolded:!1},Yr=Kt(window.navigator.language)??C.ENGLISH;class Wt extends Error{status;constructor(e,i){super(e);const{status:r,name:n}=i;r!==void 0&&(this.status=r),n!==void 0&&(this.name=n)}}function Wr(t,e=30){let i,r=null;return{promise:new Promise((o,a)=>{r=a;const l=performance.now(),d=()=>{t()?(clearInterval(i),o(!0)):(performance.now()-l)/1e3>e&&(a(new Wt("Timeouts or Feature is not found in the map at current zoom level.",{status:404,name:"NetworkError"})),clearInterval(i))};d(),i=setInterval(d,100)}),abort:()=>{i&&(clearInterval(i),i=null),r&&(r(new Wt("Query was aborted by the user.",{status:400,name:"AbortError"})),r=null)}}}function N(t){if(!t)return null;const i=(Array.isArray(t)?t:[t]).filter(b).map(r=>r.trim());return i.length>0?i.join(","):null}function b(t){return typeof t=="string"&&t.trim().length>0}function J(t){return Array.isArray(t)&&t.length===2&&t.every(e=>typeof e=="number")}function ae(t){return Array.isArray(t)&&t.length===2&&t.every(e=>J(e))}function le(t){return typeof t=="number"&&t>0}function Ne(t,e){const i={...t};return e.forEach(r=>{delete i[r]}),i}var Xt=(t=>(t.POINT="Point",t.POLYGON="Polygon",t))(Xt||{}),nt=(t=>(t.POINT="Point",t.POLYGON="Polygon",t.GATE="Gate",t))(nt||{}),Qt=(t=>(t.DEFAULT_NAME="DefaultName",t))(Qt||{}),Zt=(t=>(t.ABSOLUTE_DISTANCE="AbsoluteDistance",t.ACTUAL_DISTANCE="ActualDistance",t))(Zt||{});const st=["specialHours","businessStatus","serviceHours","keywords","siteCode","refPhotoId","totalPhotoCount","photos","icon"],ot=D.getInstance();class Jt{constructor(){}searchByIds(e){const i=N(e);if(!i)throw new Error("Invalid ids parameter. Expected a non-empty string or an array of strings.");const r=`${jt}/${i}`;return this._filterPoiProperties(r,Y)}searchByDistance(e){const{center:i,distance:r,keywords:n="",offset:s=R,page:o=k}=e;if(!J(i))throw new Error("Invalid center parameter. Expected an array of two numbers.");if(!le(r)||r>1e4)throw new Error("Invalid distance parameter. Expected a positive number and no more than 10000.");const a=new URLSearchParams;a.set("center",i.join(",")),a.set("distance",String(Math.round(r))),a.set("offset",String(s)),a.set("page",String(o)),b(n)&&a.set("keywords",n);const l=`${Z}?${a.toString()}`;return this._filterPoiProperties(l,Y)}searchByBounds(e){const{bounds:i,offset:r=R,page:n=k,keywords:s,orderBy:o}=e;if(!ae(i))throw new Error("'bounds' must be an array of two arrays, each containing two numbers.");const a=new URLSearchParams;a.set("bbox",i.flat().join()),a.set("offset",String(r)),a.set("page",String(n)),b(s)&&a.set("keywords",s),o&&a.set("orderBy",o);const l=`${Z}?${a.toString()}`;return this._filterPoiProperties(l,Y)}searchByBuilding(e){const{buildingId:i,offset:r=R,page:n=k,keywords:s,orderBy:o}=e;if(!b(i))throw new Error("'buildingId' must be a non-empty string.");const a=new URLSearchParams;a.set("buildingId",i),a.set("offset",String(r)),a.set("page",String(n)),b(s)&&a.set("keywords",s),o&&a.set("orderBy",o);const l=`${Z}?${a.toString()}`;return this._filterPoiProperties(l,d=>Y(d))}searchByVenue(e){const{venueId:i,offset:r=R,page:n=k,keywords:s,orderBy:o}=e;if(!b(i))throw new Error("'venueId' must be a non-empty string.");const a=new URLSearchParams;a.set("venueId",i),a.set("offset",String(r)),a.set("page",String(n)),b(s)&&a.set("keywords",s),o&&a.set("orderBy",o);const l=`${Z}?${a.toString()}`;return this._filterPoiProperties(l,Y)}searchByFloors(e){let i=null,r=null;const n="floorIds"in e?N(e.floorIds):null,s="sharedFloorIds"in e?N(e.sharedFloorIds):null;if(n?(i="floorId",r=n):s&&(i="sharedFloorId",r=s),!i||!r)throw new Error("Either 'floorIds' or 'sharedFloorIds' must be a non-empty array.");const{offset:o=R,page:a=k,keywords:l,orderBy:d}=e,u=new URLSearchParams;u.set("offset",String(o)),u.set("page",String(a)),u.set(i,r),b(l)&&u.set("keywords",l),d&&u.set("orderBy",d);const c=`${Z}?${u.toString()}`;return this._filterPoiProperties(c,Y)}async searchByOrientation(e){const{center:i,angle:r,distance:n,distanceSearchType:s=nt.POINT}=e;if(!J(i))throw new Error("Invalid center parameter. Expected an array of two numbers.");if(!le(n)||n>100)throw new Error("Invalid distance parameter. Expected a positive number and cannot exceed 100.");if(!le(r))throw new Error("Invalid angle parameter. Expected a positive number.");const o=new URLSearchParams;if("ordinal"in e){if(!b(e.ordinal))throw new Error("'ordinal' must be a non-empty string.");o.set("ordinal",e.ordinal)}else if("floorId"in e){if(!b(e.floorId))throw new Error("'floorId' must be a non-empty string.");o.set("floorId",e.floorId)}else if("buildingId"in e){if(!b(e.buildingId))throw new Error("'buildingId' must be a non-empty string.");o.set("buildingId",e.buildingId)}else throw new Error("Either 'ordinal', 'floorId', or 'buildingId' must be provided.");o.set("center",i.join()),o.set("angle",String(Math.round(r))),o.set("distance",String(n)),o.set("distanceSearchType",s);const a=`${jt}/orientation?${o.toString()}`;return(await ot.getHttpSession()).request(a)}searchByCategory(e){const{center:i,distance:r,page:n=k,offset:s=R}=e;if(!J(i))throw new Error("Invalid center parameter. Expected an array of two numbers.");if(!le(r)||r>1e4)throw new Error("Invalid distance parameter. Expected a positive number and no more than 10000");const o=new URLSearchParams;if("category"in e&&b(e.category))o.set("category",String(e.category));else if("excludedCategories"in e&&N(e.excludedCategories))o.set("excludeCategories",N(e.excludedCategories));else throw new Error("Either 'category' or 'excludedCategories' must be provided.");o.set("center",i.join(",")),o.set("distance",String(r)),o.set("page",String(n)),o.set("offset",String(s));const a=`${Z}?${o.toString()}`;return this._filterPoiProperties(a,Y)}async searchCategories(e){const i=new URLSearchParams;if("floorId"in e&&b(e.floorId)?i.set("floorId",e.floorId):"buildingId"in e&&b(e.buildingId)?i.set("buildingId",e.buildingId):"sharedFloorId"in e&&b(e.sharedFloorId)?i.set("sharedFloorId",e.sharedFloorId):"venueId"in e&&b(e.venueId)&&i.set("venueId",e.venueId),"bounds"in e&&ae(e.bounds)&&(i.set("bbox",e.bounds.flat().join()),b(e.keywords)&&i.set("keywords",e.keywords)),i.toString().length===0)throw new Error("At least one of 'floorId', 'buildingId', 'sharedFloorId', 'venueId', or 'bounds' must be provided.");const r=`${Vt}?${i.toString()}`;return(await ot.getHttpSession()).request(r)}search(e){const i=new URLSearchParams;Object.entries(e).forEach(([n,s])=>{switch(n){case"bounds":ae(s)&&i.set("bbox",s.flat().join());break;case"center":J(s)&&i.set("center",s.join());break;case"excludedCategories":const o=N(s);o&&i.set("excludeCategories",o);break;case"floorIds":const a=N(s);a&&i.set("floorId",a);break;case"sharedFloorIds":const l=N(s);l&&i.set("sharedFloorId",l);break;default:i.set(n,String(s))}});const r=`${Z}?${i.toString()}`;return this._filterPoiProperties(r,Y)}async _filterPoiProperties(e,i){const n=await(await ot.getHttpSession()).request(e),s=n.result.pois.map(i);return{...n,result:{...n.result,pois:s}}}}function Y(t){return"sharedFloorId"in t,Ne(t,st)}const ei=["opening_hours","description","phone","website","email","appURL","icon"],Xr=D.getInstance();class ti{constructor(){}searchByIds(e){const i=N(e);if(!i)throw new Error("Please input venue id at least one.");const r=`${oe}/${i}`;return this._filterVenueProperties(r,de)}searchByDistance(e){const{center:i,distance:r,keywords:n="",offset:s=R,page:o=k}=e;if(!J(i))throw new Error("Invalid center parameter. Expected an array of two numbers.");if(!le(r)||r>1e4)throw new Error("Invalid distance parameter. Expected a positive number and no more than 10000.");const a=new URLSearchParams;a.set("center",i.join(",")),a.set("distance",String(r)),a.set("offset",String(s)),a.set("page",String(o)),b(n)&&a.set("keywords",n);const l=`${oe}?${a.toString()}`;return this._filterVenueProperties(l,de)}searchByBounds(e){const{keywords:i,bounds:r,offset:n=R,page:s=k}=e;if(!ae(r))throw new Error("'bounds' must be an array of two arrays, each containing two numbers.");const o=new URLSearchParams;o.set("bbox",r.flat().join()),o.set("offset",String(n)),o.set("page",String(s)),b(i)&&o.set("keywords",i);const a=`${oe}?${o.toString()}`;return this._filterVenueProperties(a,de)}searchByGlobal(e){const{keywords:i,offset:r=R,page:n=k}=e,s=new URLSearchParams;s.set("offset",String(r)),s.set("page",String(n)),b(i)&&s.set("keywords",i);const o=`${oe}?${s.toString()}`;return this._filterVenueProperties(o,de)}searchBySharedFloorId(e){if(!b(e))throw new Error("Please input correct sharedFloorId.");const i=`${oe}/shared_floors/${e}`;return this._filterVenueProperties(i,de)}search(e){const i=new URLSearchParams;Object.entries(e).forEach(([n,s])=>{n==="bounds"?i.set("bbox",s.flat().join()):n==="center"?i.set("center",s.join()):i.set(n,String(s))});const r=`${oe}?${i.toString()}`;return this._filterVenueProperties(r,de)}async _filterVenueProperties(e,i){const n=await(await Xr.getHttpSession()).request(e),s=n.result.venues.map(i);return{...n,result:{...n.result,venues:s}}}}function de(t){return Ne(t,ei)}const ii=["specialHours","businessStatus","serviceHours","keywords","siteCode","refPhotoId","totalPhotoCount","photos","description"],Qr=D.getInstance();class ri{constructor(){}searchByIds(e){const i=N(e);if(!i)throw new Error("Please input building id at least one.");const r=`${ve}/${i}`;return this._filterBuildingProperties(r,ue)}searchByDistance(e){const{center:i,distance:r,keywords:n="",offset:s=R,page:o=k}=e;if(!J(i))throw new Error("Invalid center parameter. Expected an array of two numbers.");if(!le(r)||r>1e4)throw new Error("Invalid distance parameter. Expected a positive number and no more than 10000.");const a=new URLSearchParams;a.set("center",i.join(",")),a.set("distance",String(r)),a.set("offset",String(s)),a.set("page",String(o)),b(n)&&a.set("keywords",n);const l=`${ve}?${a.toString()}`;return this._filterBuildingProperties(l,ue)}searchByBounds(e){const{bounds:i,offset:r=R,page:n=k,keywords:s}=e;if(!ae(i))throw new Error("'bounds' must be an array of two arrays, each containing two numbers.");const o=new URLSearchParams;o.set("bbox",i.flat().join()),o.set("offset",String(r)),o.set("page",String(n)),b(s)&&o.set("keywords",s);const a=`${ve}?${o.toString()}`;return this._filterBuildingProperties(a,ue)}searchByGlobal(e){const{keywords:i,offset:r=R,page:n=k}=e,s=new URLSearchParams;s.set("searchGlobal",String(!0)),s.set("offset",String(r)),s.set("page",String(n)),b(i)&&s.set("keywords",i);const o=`${ve}?${s.toString()}`;return this._filterBuildingProperties(o,ue)}searchByFloorId(e){if(!b(e))throw new Error("'floorId' cannot be empty.");const i=`${Pr}/floors/${e}`;return this._filterBuildingProperties(i,ue)}search(e){const i=new URLSearchParams;Object.entries(e).forEach(([n,s])=>{n==="bounds"?i.set("bbox",s.flat().join()):n==="center"?i.set("center",s.join()):i.set(n,String(s))});const r=`${ve}?${i.toString()}`;return this._filterBuildingProperties(r,ue)}async _filterBuildingProperties(e,i){const n=await(await Qr.getHttpSession()).request(e),s=n.result.buildings.map(i);return{...n,result:{...n.result,buildings:s}}}}function ue(t){return Ne(t,ii)}const ni=new ri,si=new ti,Zr=new Jt;async function at(t){return(await ni.searchByIds(t)).result.buildings[0]}async function Jr(t){const i=(await ni.searchByFloorId(t)).result.buildings[0].buildingId;return await at(i)}async function lt(t){return(await si.searchByIds(t)).result.venues[0]}async function oi(t){return(await si.searchBySharedFloorId(t)).result.venues[0]}async function en(t){return(await Zr.searchByIds([t])).result.pois[0]}class W{static instance;_visitedBuildingUnits;_historyBuildingUnit;_historyOrdinal;constructor(){this._visitedBuildingUnits=[],this._historyBuildingUnit=new Map,this._historyOrdinal=new Map}static getInstance(){return W.instance||(W.instance=new W),W.instance}getHistoryBuildingUnit(e){return this._historyBuildingUnit.get(e)}setHistoryBuildingUnit(e,i){this._historyBuildingUnit.set(e,i)}getHistoryOrdinal(e){return this._historyOrdinal.get(e)}setHistoryOrdinal(e,i){this._historyOrdinal.set(e,i)}getVisitedBuildingUnits(){return this._visitedBuildingUnits}addVisitedBuildingUnit(e){this._visitedBuildingUnits.push(e),this._visitedBuildingUnits.length>100&&(this._visitedBuildingUnits=this._visitedBuildingUnits.slice(this._visitedBuildingUnits.length-100))}}var ai=typeof global=="object"&&global&&global.Object===Object&&global,tn=typeof self=="object"&&self&&self.Object===Object&&self,U=ai||tn||Function("return this")(),X=U.Symbol,li=Object.prototype,rn=li.hasOwnProperty,nn=li.toString,we=X?X.toStringTag:void 0;function sn(t){var e=rn.call(t,we),i=t[we];try{t[we]=void 0;var r=!0}catch{}var n=nn.call(t);return r&&(e?t[we]=i:delete t[we]),n}var on=Object.prototype,an=on.toString;function ln(t){return an.call(t)}var dn="[object Null]",un="[object Undefined]",di=X?X.toStringTag:void 0;function ce(t){return t==null?t===void 0?un:dn:di&&di in Object(t)?sn(t):ln(t)}function he(t){return t!=null&&typeof t=="object"}var cn="[object Symbol]";function Be(t){return typeof t=="symbol"||he(t)&&ce(t)==cn}function hn(t,e,i){for(var r=-1,n=t.length;++r<n;){var s=t[r],o=e(s);if(o!=null&&(a===void 0?o===o&&!Be(o):i(o,a)))var a=o,l=s}return l}function _n(){this.__data__=[],this.size=0}function ui(t,e){return t===e||t!==t&&e!==e}function Ue(t,e){for(var i=t.length;i--;)if(ui(t[i][0],e))return i;return-1}var fn=Array.prototype,pn=fn.splice;function gn(t){var e=this.__data__,i=Ue(e,t);if(i<0)return!1;var r=e.length-1;return i==r?e.pop():pn.call(e,i,1),--this.size,!0}function yn(t){var e=this.__data__,i=Ue(e,t);return i<0?void 0:e[i][1]}function mn(t){return Ue(this.__data__,t)>-1}function bn(t,e){var i=this.__data__,r=Ue(i,t);return r<0?(++this.size,i.push([t,e])):i[r][1]=e,this}function j(t){var e=-1,i=t==null?0:t.length;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}j.prototype.clear=_n,j.prototype.delete=gn,j.prototype.get=yn,j.prototype.has=mn,j.prototype.set=bn;function Sn(){this.__data__=new j,this.size=0}function vn(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i}function In(t){return this.__data__.get(t)}function Ln(t){return this.__data__.has(t)}function _e(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var wn="[object AsyncFunction]",Bn="[object Function]",En="[object GeneratorFunction]",Pn="[object Proxy]";function ci(t){if(!_e(t))return!1;var e=ce(t);return e==Bn||e==En||e==wn||e==Pn}var dt=U["__core-js_shared__"],hi=(function(){var t=/[^.]+$/.exec(dt&&dt.keys&&dt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function Fn(t){return!!hi&&hi in t}var Cn=Function.prototype,On=Cn.toString;function ee(t){if(t!=null){try{return On.call(t)}catch{}try{return t+""}catch{}}return""}var $n=/[\\^$.*+?()[\]{}|]/g,An=/^\[object .+?Constructor\]$/,Mn=Function.prototype,xn=Object.prototype,Tn=Mn.toString,Rn=xn.hasOwnProperty,kn=RegExp("^"+Tn.call(Rn).replace($n,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Dn(t){if(!_e(t)||Fn(t))return!1;var e=ci(t)?kn:An;return e.test(ee(t))}function Hn(t,e){return t?.[e]}function fe(t,e){var i=Hn(t,e);return Dn(i)?i:void 0}var Ee=fe(U,"Map"),Pe=fe(Object,"create");function Nn(){this.__data__=Pe?Pe(null):{},this.size=0}function Un(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var jn="__lodash_hash_undefined__",Vn=Object.prototype,qn=Vn.hasOwnProperty;function zn(t){var e=this.__data__;if(Pe){var i=e[t];return i===jn?void 0:i}return qn.call(e,t)?e[t]:void 0}var Gn=Object.prototype,Kn=Gn.hasOwnProperty;function Yn(t){var e=this.__data__;return Pe?e[t]!==void 0:Kn.call(e,t)}var Wn="__lodash_hash_undefined__";function Xn(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=Pe&&e===void 0?Wn:e,this}function te(t){var e=-1,i=t==null?0:t.length;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}te.prototype.clear=Nn,te.prototype.delete=Un,te.prototype.get=zn,te.prototype.has=Yn,te.prototype.set=Xn;function Qn(){this.size=0,this.__data__={hash:new te,map:new(Ee||j),string:new te}}function Zn(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function je(t,e){var i=t.__data__;return Zn(e)?i[typeof e=="string"?"string":"hash"]:i.map}function Jn(t){var e=je(this,t).delete(t);return this.size-=e?1:0,e}function es(t){return je(this,t).get(t)}function ts(t){return je(this,t).has(t)}function is(t,e){var i=je(this,t),r=i.size;return i.set(t,e),this.size+=i.size==r?0:1,this}function V(t){var e=-1,i=t==null?0:t.length;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}V.prototype.clear=Qn,V.prototype.delete=Jn,V.prototype.get=es,V.prototype.has=ts,V.prototype.set=is;var rs=200;function ns(t,e){var i=this.__data__;if(i instanceof j){var r=i.__data__;if(!Ee||r.length<rs-1)return r.push([t,e]),this.size=++i.size,this;i=this.__data__=new V(r)}return i.set(t,e),this.size=i.size,this}function q(t){var e=this.__data__=new j(t);this.size=e.size}q.prototype.clear=Sn,q.prototype.delete=vn,q.prototype.get=In,q.prototype.has=Ln,q.prototype.set=ns;var ss="__lodash_hash_undefined__";function os(t){return this.__data__.set(t,ss),this}function as(t){return this.__data__.has(t)}function Fe(t){var e=-1,i=t==null?0:t.length;for(this.__data__=new V;++e<i;)this.add(t[e])}Fe.prototype.add=Fe.prototype.push=os,Fe.prototype.has=as;function ls(t,e){for(var i=-1,r=t==null?0:t.length;++i<r;)if(e(t[i],i,t))return!0;return!1}function _i(t,e){return t.has(e)}var ds=1,us=2;function fi(t,e,i,r,n,s){var o=i&ds,a=t.length,l=e.length;if(a!=l&&!(o&&l>a))return!1;var d=s.get(t),u=s.get(e);if(d&&u)return d==e&&u==t;var c=-1,h=!0,f=i&us?new Fe:void 0;for(s.set(t,e),s.set(e,t);++c<a;){var g=t[c],_=e[c];if(r)var y=o?r(_,g,c,e,t,s):r(g,_,c,t,e,s);if(y!==void 0){if(y)continue;h=!1;break}if(f){if(!ls(e,function(m,v){if(!_i(f,v)&&(g===m||n(g,m,i,r,s)))return f.push(v)})){h=!1;break}}else if(!(g===_||n(g,_,i,r,s))){h=!1;break}}return s.delete(t),s.delete(e),h}var pi=U.Uint8Array;function cs(t){var e=-1,i=Array(t.size);return t.forEach(function(r,n){i[++e]=[n,r]}),i}function ut(t){var e=-1,i=Array(t.size);return t.forEach(function(r){i[++e]=r}),i}var hs=1,_s=2,fs="[object Boolean]",ps="[object Date]",gs="[object Error]",ys="[object Map]",ms="[object Number]",bs="[object RegExp]",Ss="[object Set]",vs="[object String]",Is="[object Symbol]",Ls="[object ArrayBuffer]",ws="[object DataView]",gi=X?X.prototype:void 0,ct=gi?gi.valueOf:void 0;function Bs(t,e,i,r,n,s,o){switch(i){case ws:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Ls:return!(t.byteLength!=e.byteLength||!s(new pi(t),new pi(e)));case fs:case ps:case ms:return ui(+t,+e);case gs:return t.name==e.name&&t.message==e.message;case bs:case vs:return t==e+"";case ys:var a=cs;case Ss:var l=r&hs;if(a||(a=ut),t.size!=e.size&&!l)return!1;var d=o.get(t);if(d)return d==e;r|=_s,o.set(t,e);var u=fi(a(t),a(e),r,n,s,o);return o.delete(t),u;case Is:if(ct)return ct.call(t)==ct.call(e)}return!1}function Es(t,e){for(var i=-1,r=e.length,n=t.length;++i<r;)t[n+i]=e[i];return t}var z=Array.isArray;function Ps(t,e,i){var r=e(t);return z(t)?r:Es(r,i(t))}function Fs(t,e){for(var i=-1,r=t==null?0:t.length,n=0,s=[];++i<r;){var o=t[i];e(o,i,t)&&(s[n++]=o)}return s}function Cs(){return[]}var Os=Object.prototype,$s=Os.propertyIsEnumerable,yi=Object.getOwnPropertySymbols,As=yi?function(t){return t==null?[]:(t=Object(t),Fs(yi(t),function(e){return $s.call(t,e)}))}:Cs;function Ms(t,e){for(var i=-1,r=Array(t);++i<t;)r[i]=e(i);return r}var xs="[object Arguments]";function mi(t){return he(t)&&ce(t)==xs}var bi=Object.prototype,Ts=bi.hasOwnProperty,Rs=bi.propertyIsEnumerable,Si=mi((function(){return arguments})())?mi:function(t){return he(t)&&Ts.call(t,"callee")&&!Rs.call(t,"callee")};function ks(){return!1}var vi=typeof p=="object"&&p&&!p.nodeType&&p,Ii=vi&&typeof module=="object"&&module&&!module.nodeType&&module,Ds=Ii&&Ii.exports===vi,Li=Ds?U.Buffer:void 0,Hs=Li?Li.isBuffer:void 0,ht=Hs||ks,Ns=9007199254740991,Us=/^(?:0|[1-9]\d*)$/;function wi(t,e){var i=typeof t;return e=e??Ns,!!e&&(i=="number"||i!="symbol"&&Us.test(t))&&t>-1&&t%1==0&&t<e}var js=9007199254740991;function _t(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=js}var Vs="[object Arguments]",qs="[object Array]",zs="[object Boolean]",Gs="[object Date]",Ks="[object Error]",Ys="[object Function]",Ws="[object Map]",Xs="[object Number]",Qs="[object Object]",Zs="[object RegExp]",Js="[object Set]",eo="[object String]",to="[object WeakMap]",io="[object ArrayBuffer]",ro="[object DataView]",no="[object Float32Array]",so="[object Float64Array]",oo="[object Int8Array]",ao="[object Int16Array]",lo="[object Int32Array]",uo="[object Uint8Array]",co="[object Uint8ClampedArray]",ho="[object Uint16Array]",_o="[object Uint32Array]",I={};I[no]=I[so]=I[oo]=I[ao]=I[lo]=I[uo]=I[co]=I[ho]=I[_o]=!0,I[Vs]=I[qs]=I[io]=I[zs]=I[ro]=I[Gs]=I[Ks]=I[Ys]=I[Ws]=I[Xs]=I[Qs]=I[Zs]=I[Js]=I[eo]=I[to]=!1;function fo(t){return he(t)&&_t(t.length)&&!!I[ce(t)]}function po(t){return function(e){return t(e)}}var Bi=typeof p=="object"&&p&&!p.nodeType&&p,Ce=Bi&&typeof module=="object"&&module&&!module.nodeType&&module,go=Ce&&Ce.exports===Bi,ft=go&&ai.process,Ei=(function(){try{var t=Ce&&Ce.require&&Ce.require("util").types;return t||ft&&ft.binding&&ft.binding("util")}catch{}})(),Pi=Ei&&Ei.isTypedArray,Fi=Pi?po(Pi):fo,yo=Object.prototype,mo=yo.hasOwnProperty;function bo(t,e){var i=z(t),r=!i&&Si(t),n=!i&&!r&&ht(t),s=!i&&!r&&!n&&Fi(t),o=i||r||n||s,a=o?Ms(t.length,String):[],l=a.length;for(var d in t)mo.call(t,d)&&!(o&&(d=="length"||n&&(d=="offset"||d=="parent")||s&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||wi(d,l)))&&a.push(d);return a}var So=Object.prototype;function vo(t){var e=t&&t.constructor,i=typeof e=="function"&&e.prototype||So;return t===i}function Io(t,e){return function(i){return t(e(i))}}var Lo=Io(Object.keys,Object),wo=Object.prototype,Bo=wo.hasOwnProperty;function Eo(t){if(!vo(t))return Lo(t);var e=[];for(var i in Object(t))Bo.call(t,i)&&i!="constructor"&&e.push(i);return e}function Po(t){return t!=null&&_t(t.length)&&!ci(t)}function Ci(t){return Po(t)?bo(t):Eo(t)}function Oi(t){return Ps(t,Ci,As)}var Fo=1,Co=Object.prototype,Oo=Co.hasOwnProperty;function $o(t,e,i,r,n,s){var o=i&Fo,a=Oi(t),l=a.length,d=Oi(e),u=d.length;if(l!=u&&!o)return!1;for(var c=l;c--;){var h=a[c];if(!(o?h in e:Oo.call(e,h)))return!1}var f=s.get(t),g=s.get(e);if(f&&g)return f==e&&g==t;var _=!0;s.set(t,e),s.set(e,t);for(var y=o;++c<l;){h=a[c];var m=t[h],v=e[h];if(r)var E=o?r(v,m,h,e,t,s):r(m,v,h,t,e,s);if(!(E===void 0?m===v||n(m,v,i,r,s):E)){_=!1;break}y||(y=h=="constructor")}if(_&&!y){var O=t.constructor,B=e.constructor;O!=B&&"constructor"in t&&"constructor"in e&&!(typeof O=="function"&&O instanceof O&&typeof B=="function"&&B instanceof B)&&(_=!1)}return s.delete(t),s.delete(e),_}var pt=fe(U,"DataView"),gt=fe(U,"Promise"),pe=fe(U,"Set"),yt=fe(U,"WeakMap"),$i="[object Map]",Ao="[object Object]",Ai="[object Promise]",Mi="[object Set]",xi="[object WeakMap]",Ti="[object DataView]",Mo=ee(pt),xo=ee(Ee),To=ee(gt),Ro=ee(pe),ko=ee(yt),Q=ce;(pt&&Q(new pt(new ArrayBuffer(1)))!=Ti||Ee&&Q(new Ee)!=$i||gt&&Q(gt.resolve())!=Ai||pe&&Q(new pe)!=Mi||yt&&Q(new yt)!=xi)&&(Q=function(t){var e=ce(t),i=e==Ao?t.constructor:void 0,r=i?ee(i):"";if(r)switch(r){case Mo:return Ti;case xo:return $i;case To:return Ai;case Ro:return Mi;case ko:return xi}return e});var Do=1,Ri="[object Arguments]",ki="[object Array]",Ve="[object Object]",Ho=Object.prototype,Di=Ho.hasOwnProperty;function No(t,e,i,r,n,s){var o=z(t),a=z(e),l=o?ki:Q(t),d=a?ki:Q(e);l=l==Ri?Ve:l,d=d==Ri?Ve:d;var u=l==Ve,c=d==Ve,h=l==d;if(h&&ht(t)){if(!ht(e))return!1;o=!0,u=!1}if(h&&!u)return s||(s=new q),o||Fi(t)?fi(t,e,i,r,n,s):Bs(t,e,l,i,r,n,s);if(!(i&Do)){var f=u&&Di.call(t,"__wrapped__"),g=c&&Di.call(e,"__wrapped__");if(f||g){var _=f?t.value():t,y=g?e.value():e;return s||(s=new q),n(_,y,i,r,s)}}return h?(s||(s=new q),$o(t,e,i,r,n,s)):!1}function mt(t,e,i,r,n){return t===e?!0:t==null||e==null||!he(t)&&!he(e)?t!==t&&e!==e:No(t,e,i,r,mt,n)}var Uo=1,jo=2;function Vo(t,e,i,r){var n=i.length,s=n;if(t==null)return!s;for(t=Object(t);n--;){var o=i[n];if(o[2]?o[1]!==t[o[0]]:!(o[0]in t))return!1}for(;++n<s;){o=i[n];var a=o[0],l=t[a],d=o[1];if(o[2]){if(l===void 0&&!(a in t))return!1}else{var u=new q,c;if(!(c===void 0?mt(d,l,Uo|jo,r,u):c))return!1}}return!0}function Hi(t){return t===t&&!_e(t)}function qo(t){for(var e=Ci(t),i=e.length;i--;){var r=e[i],n=t[r];e[i]=[r,n,Hi(n)]}return e}function Ni(t,e){return function(i){return i==null?!1:i[t]===e&&(e!==void 0||t in Object(i))}}function zo(t){var e=qo(t);return e.length==1&&e[0][2]?Ni(e[0][0],e[0][1]):function(i){return i===t||Vo(i,t,e)}}var Go=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ko=/^\w*$/;function bt(t,e){if(z(t))return!1;var i=typeof t;return i=="number"||i=="symbol"||i=="boolean"||t==null||Be(t)?!0:Ko.test(t)||!Go.test(t)||e!=null&&t in Object(e)}var Yo="Expected a function";function St(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Yo);var i=function(){var r=arguments,n=e?e.apply(this,r):r[0],s=i.cache;if(s.has(n))return s.get(n);var o=t.apply(this,r);return i.cache=s.set(n,o)||s,o};return i.cache=new(St.Cache||V),i}St.Cache=V;var Wo=500;function Xo(t){var e=St(t,function(r){return i.size===Wo&&i.clear(),r}),i=e.cache;return e}var Qo=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Zo=/\\(\\)?/g,Jo=Xo(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Qo,function(i,r,n,s){e.push(n?s.replace(Zo,"$1"):r||i)}),e});function ea(t,e){for(var i=-1,r=t==null?0:t.length,n=Array(r);++i<r;)n[i]=e(t[i],i,t);return n}var Ui=X?X.prototype:void 0,ji=Ui?Ui.toString:void 0;function Vi(t){if(typeof t=="string")return t;if(z(t))return ea(t,Vi)+"";if(Be(t))return ji?ji.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function qi(t){return t==null?"":Vi(t)}function zi(t,e){return z(t)?t:bt(t,e)?[t]:Jo(qi(t))}function qe(t){if(typeof t=="string"||Be(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function Gi(t,e){e=zi(e,t);for(var i=0,r=e.length;t!=null&&i<r;)t=t[qe(e[i++])];return i&&i==r?t:void 0}function ta(t,e,i){var r=t==null?void 0:Gi(t,e);return r===void 0?i:r}function ia(t,e){return t!=null&&e in Object(t)}function ra(t,e,i){e=zi(e,t);for(var r=-1,n=e.length,s=!1;++r<n;){var o=qe(e[r]);if(!(s=t!=null&&i(t,o)))break;t=t[o]}return s||++r!=n?s:(n=t==null?0:t.length,!!n&&_t(n)&&wi(o,n)&&(z(t)||Si(t)))}function na(t,e){return t!=null&&ra(t,e,ia)}var sa=1,oa=2;function aa(t,e){return bt(t)&&Hi(e)?Ni(qe(t),e):function(i){var r=ta(i,t);return r===void 0&&r===e?na(i,t):mt(e,r,sa|oa)}}function la(t){return t}function da(t){return function(e){return e?.[t]}}function ua(t){return function(e){return Gi(e,t)}}function ca(t){return bt(t)?da(qe(t)):ua(t)}function Ki(t){return typeof t=="function"?t:t==null?la:typeof t=="object"?z(t)?aa(t[0],t[1]):zo(t):ca(t)}function ha(t,e){return t<e}function _a(t,e){return t&&t.length?hn(t,Ki(e),ha):void 0}class fa{_isMaskMode;_hiddenBuildings;_history;constructor(e){this._isMaskMode=e,this._hiddenBuildings=[],this._history=W.getInstance()}getLayeredData(e){const{selectedVenueId:i,venueMap:r,buildingMap:n,sharedFloorMap:s}=e,o=[],a=[],l=[],d=[],u=[],c=[],h=[...r.values()],f=i?[r.get(i),...h.filter(g=>g.properties.id!==i)]:h;for(const g of f){if(!g||!g.properties)continue;const{id:_,overlap:y,building_ids:m,shared_level_ids:v,default_displayed_ordinal:E,default_displayed_building:O}=g.properties,B=_===i,S=ya(y),$=w(m),M=this._history.getHistoryOrdinal(_);let P=M??E;if(P)M||(this._history.setHistoryOrdinal(_,P),this._history.setHistoryBuildingUnit(_,{id:O,type:"building"}));else{const{ordinal:L,buildingId:H}=pa($,n);if(!L)continue;P=L,this._history.setHistoryOrdinal(_,P),this._history.setHistoryBuildingUnit(_,{id:H,type:"building"})}$.forEach(L=>{const H=n.get(L),x=ga(H,P);x?this._isMaskMode?B?(a.push(x),o.push({level:x,overlap:S.get(x)??null,venueId:_})):u.push(L):(o.push({level:x,overlap:S.get(x)??null,venueId:_}),B&&a.push(x)):d.push(L)}),w(v).forEach(L=>{const H=s.get(L),{ordinal:x,persistence:K}=H?.properties||{},se=K==="true"&&0<=x&&x<=P,be=x===P,Qe=se||be,xe={level:L,overlap:S.get(L)??null,venueId:_};Qe?this._isMaskMode?B?(o.push(xe),se&&l.push(L),be&&a.push(L)):c.push(L):(o.push(xe),B&&be&&a.push(L),se&&l.push(L)):d.push(L)})}return this._hiddenBuildings=d,{displayedLevels:o,selectedLevelIds:a,alwaysDisplayedSharedLevelIds:l,maskBuildingIds:u,maskSharedFloorIds:c}}getHiddenBuildings(){return this._hiddenBuildings}}function pa(t,e){const i=t.find(s=>e.has(s))??t[0]??null,r=i?e.get(i):null;return{ordinal:r?Yi(r):null,buildingId:i}}function Yi(t){if(!t||!t.properties)return null;const{level_ids:e,ordinals:i,default_displayed_floor:r}=t.properties,n=w(i);let s=null;if(r){const o=w(e).findIndex(a=>a===r);s=n[o]??null}return s||(s=_a(n,o=>Math.abs(Number(o)-.1))),s}function ga(t,e){if(!t||!t.properties)return null;const{level_ids:i,ordinals:r}=t.properties,n=w(r).findIndex(s=>s===e);return w(i)[n]??null}function ya(t){const e=new Map;if(!t)return e;for(const i of w(t,"/")){const[r,n]=w(i,":");e.set(r,w(n))}return e}class ma{_maplibre;_isAnimated=!0;_bounds=null;_boundsPadding;_center=null;_fitBoundsTimer=null;constructor(e,i){this._maplibre=e,this._boundsPadding=i}setAnimated(e){this._isAnimated=e}setBounds(e){this._bounds=e}getBounds(){return this._bounds}setCenter(e){this._center=e}async fitBounds(){if(!this._bounds)return;this._fitBoundsTimer&&(clearTimeout(this._fitBoundsTimer),this._fitBoundsTimer=null);const e=this._isAnimated?{animate:!0,duration:500}:{animate:!1},i=this._isAnimated?500:0;return new Promise(r=>{const n=()=>{this._maplibre.off("idle",n),r(!0)};this._maplibre.on("idle",n),this._maplibre.fitBounds(this._bounds,{...e,padding:this._boundsPadding,bearing:this._maplibre.getBearing()}),this._fitBoundsTimer=setTimeout(()=>{this._maplibre.off("idle",n),this._fitBoundsTimer=null,r(!0)},i+200)})}panToCenter(){this._center&&this._maplibre.panTo(this._center,{animate:this._isAnimated})}}var vt=function(){return U.Date.now()},ba=/\s/;function Sa(t){for(var e=t.length;e--&&ba.test(t.charAt(e)););return e}var va=/^\s+/;function Ia(t){return t&&t.slice(0,Sa(t)+1).replace(va,"")}var Wi=NaN,La=/^[-+]0x[0-9a-f]+$/i,wa=/^0b[01]+$/i,Ba=/^0o[0-7]+$/i,Ea=parseInt;function ze(t){if(typeof t=="number")return t;if(Be(t))return Wi;if(_e(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=_e(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=Ia(t);var i=wa.test(t);return i||Ba.test(t)?Ea(t.slice(2),i?2:8):La.test(t)?Wi:+t}var Pa="Expected a function",Fa=Math.max,Ca=Math.min;function Xi(t,e,i){var r,n,s,o,a,l,d=0,u=!1,c=!1,h=!0;if(typeof t!="function")throw new TypeError(Pa);e=ze(e)||0,_e(i)&&(u=!!i.leading,c="maxWait"in i,s=c?Fa(ze(i.maxWait)||0,e):s,h="trailing"in i?!!i.trailing:h);function f(S){var $=r,M=n;return r=n=void 0,d=S,o=t.apply(M,$),o}function g(S){return d=S,a=setTimeout(m,e),u?f(S):o}function _(S){var $=S-l,M=S-d,P=e-$;return c?Ca(P,s-M):P}function y(S){var $=S-l,M=S-d;return l===void 0||$>=e||$<0||c&&M>=s}function m(){var S=vt();if(y(S))return v(S);a=setTimeout(m,_(S))}function v(S){return a=void 0,h&&r?f(S):(r=n=void 0,o)}function E(){a!==void 0&&clearTimeout(a),d=0,r=l=n=a=void 0}function O(){return a===void 0?o:v(vt())}function B(){var S=vt(),$=y(S);if(r=arguments,n=this,l=S,$){if(a===void 0)return g(l);if(c)return clearTimeout(a),a=setTimeout(m,e),f(l)}return a===void 0&&(a=setTimeout(m,e)),o}return B.cancel=E,B.flush=O,B}function Oa(t,e,i,r){for(var n=t.length,s=i+-1;++s<n;)if(e(t[s],s,t))return s;return-1}function $a(t){return t!==t}function Aa(t,e,i){for(var r=i-1,n=t.length;++r<n;)if(t[r]===e)return r;return-1}function Ma(t,e,i){return e===e?Aa(t,e,i):Oa(t,$a,i)}function xa(t,e){var i=t==null?0:t.length;return!!i&&Ma(t,e,0)>-1}function Ta(){}var Ra=1/0,ka=pe&&1/ut(new pe([,-0]))[1]==Ra?function(t){return new pe(t)}:Ta,Da=200;function Ha(t,e,i){var r=-1,n=xa,s=t.length,o=!0,a=[],l=a;if(s>=Da){var d=e?null:ka(t);if(d)return ut(d);o=!1,n=_i,l=new Fe}else l=e?[]:a;e:for(;++r<s;){var u=t[r],c=e?e(u):u;if(u=u!==0?u:0,o&&c===c){for(var h=l.length;h--;)if(l[h]===c)continue e;e&&l.push(c),a.push(u)}else n(l,c,i)||(l!==a&&l.push(c),a.push(u))}return a}function Qi(t,e){return t&&t.length?Ha(t,Ki(e)):[]}var Na=0;function ie(t){var e=++Na;return qi(t)+e}const Oe="Indoor_selectedFloorChanged",Ge="Indoor_selectedBuildingChanged",It="Indoor_mapxusMapLoaded",Zi="Indoor_maplibreMapLoaded",Lt="mapxus-venue-fill",ge="mapxus-building-line",Ji="mapxus-level-fill",wt="mapxus-shared-level-fill",Bt="highlight-mapxus_level",Et="highlight-mapxus_shared_level";class er extends Ar.TinyEmitter{_map;_features=[];_allVenuesMap=new Map;_allBuildingsMap=new Map;_allSharedLevelsMap=new Map;_curBuildingId=null;_curBuildingFeature=null;_curSharedLevelId=null;_floor={code:null,id:null,ordinal:null};_sharedFloor={id:null,ordinal:null,name:null};_outdoorMapShown;_originIndoorLayers=[];_outdoorLayers=[];_curVenueId=null;_curVenueFeature=null;_selectedHighlightStyle;_upperLayers=[];_commonPoiLayers=[];_sectionFillLineLayers=[];_sectionSymbolLayers=[];_middleLayers=[];_lowerLayers=[];_excludedPoisInMiddle=[];_dispatch=Se(Oe);_startWithIndoorView;_indoorMapLoaded=!1;_isSelectSharedFloor=!1;_isMaskMode;_upperLevels=new Set;_middleLevels=new Set;_lowerLevels=new Set;_featureIncomplete=!1;_fitBounds;_dragPan;_history=W.getInstance();_maskBuildings=new Set;_maskSharedFloors=new Set;_enableIndoorClickSelection;_enableOutdoorClickSelection;_zIndexHistory=new Map;_floorSwitchScope;_isDestroyed=!1;_abortQueryFeature;_debounceRendering;layeredHandler;dragPanHandler;constructor(e){super();const{map:i,startWithIndoorView:r,outdoorMapShown:n,selectedHighlightStyle:s,fitBounds:o,boundsPadding:a,maskNonSelectedAreas:l,enableIndoorClickSelection:d,enableOutdoorClickSelection:u,floorSwitchScope:c}=e;this.layeredHandler=new fa(l),this.dragPanHandler=new ma(i,a),this._map=i,this._enableIndoorClickSelection=d,this._enableOutdoorClickSelection=u,this._startWithIndoorView=r,this._outdoorMapShown=n,this._isMaskMode=l,this._fitBounds=o,this._floorSwitchScope=c,this._selectedHighlightStyle=s?Object.assign({},He,s):He,this._bindMaplibreEventListeners()}destroy(){this._isDestroyed||(this._isDestroyed=!0,this._dispatch.on(`.${Oe}`,null),this.off(Ge),this.off(Zi),this.off(It),this._debounceRendering?.cancel(),this._abortQueryFeature&&(this._abortQueryFeature(),this._abortQueryFeature=null))}setAllowOutdoorSwitch(e){return this._enableOutdoorClickSelection=e,this}setAllowBuildingSwitch(e){return this._enableIndoorClickSelection=e,this}setAllowIndoorClickSelect(e){this._enableIndoorClickSelection=e}setAllowOutdoorClickSelect(e){this._enableOutdoorClickSelection=e}setFloorSwitchScope(e){this._floorSwitchScope=e}get floor(){return this._isSelectSharedFloor?this._sharedFloor:this._curBuildingId?this._floor:null}get building(){return this._curBuildingFeature}get venue(){return this._curVenueFeature}get features(){return this._features}getFeaturesById(e,i){const{layerIds:r,filter:n}=i||{},s=this._queryRenderedFeatures(r);if(!s.length)return[];const o=n?a=>a.properties.id===e&&n(a):a=>a.properties.id===e;return s.filter(o)}async switchFloorByOrdinal(e){this._updateFloorState(e),this._dispatch.call(Oe,null,{venue:this.venue,building:this.building,floor:this.floor}),this.venue&&e&&(this._floorSwitchScope===De.GLOBAL&&this._changeOtherVenuesHistory(e),this._dragPan===!0&&(this._fitBounds?await this.dragPanHandler.fitBounds():await this.panToBuildingCenter()),this._dragPan==="restrict"&&await this._checkAndPanToBuilding()),this.updateRendering()}setOutdoorMapShown(e){this._outdoorMapShown=e,this._setOutdoorVisibility(e)}setSelectedHighlightStyle(e){this._selectedHighlightStyle=Object.assign({},this._selectedHighlightStyle,e??{"line-opacity":0});for(const i of[Bt,Et])if(this._map.getLayer(i))if(e){const{lineColor:r,lineOpacity:n,lineWidth:s,lineOffset:o}=this._selectedHighlightStyle,a=tr(s,o);this._map.setPaintProperty(i,"line-color",r),this._map.setPaintProperty(i,"line-opacity",n),this._map.setPaintProperty(i,"line-width",s),this._map.setPaintProperty(i,"line-offset",a)}else this._map.setPaintProperty(i,"line-opacity",0)}onMapChange(e){const i=ie(`${Oe}.`);return this._dispatch.on(i,e),{unsubscribe:()=>this._dispatch.on(i,null)}}async selectBuilding(e,i){if(this._isCurrentFeature(e))return;this._isSelectSharedFloor=!1,this._curSharedLevelId=null;let r=null;if(!e||!e.properties)this.dragPanHandler.setCenter(null),this._clear();else{const{floorId:n,featureIncomplete:s}=i||{};this._featureIncomplete=s??this._featureIncomplete;const{id:o,"ref:venue":a,label_center:l}=e.properties,d=w(l).map(u=>parseFloat(u));this._curBuildingFeature=e,this._curBuildingId=o,this._history.addVisitedBuildingUnit({id:o,type:"building"}),this.dragPanHandler.setCenter(d),this._curVenueId!==a&&(this._curVenueId=a,this._curVenueFeature=await this._queryVenueFeature(a)),r=this._getBuildingDisplayedOrdinal(e,n)}await this.switchFloorByOrdinal(r),this.emit(Ge,e?{building:e,ordinal:r,dragPan:this._dragPan}:null),this._dispatchIndoorMapLoaded()}async selectSharedFloor(e,i,r){if(e.id===this._curSharedLevelId)return;const{id:n,ordinal:s}=e;this._isSelectSharedFloor=!0,this._curBuildingId=null,this._curBuildingFeature=null,this._sharedFloor=e,this._curSharedLevelId=n,this._featureIncomplete=r?.featureIncomplete??this._featureIncomplete;const{label_center:o,id:a}=i.properties,l=w(o).map(d=>parseFloat(d));this._curVenueId=a,this._curVenueFeature=i,this.dragPanHandler.setCenter(l),this._history.addVisitedBuildingUnit({id:n,type:"sharedFloor"}),this._history.setHistoryOrdinal(a,s),this._history.setHistoryBuildingUnit(a,{id:n,type:"sharedFloor"}),this._dragPan===!0&&(this._fitBounds?await this.dragPanHandler.fitBounds():await this.panToVenueCenter()),this._dispatch.call(Oe,null,{venue:this.venue,building:this.building,floor:this.floor}),this.emit(Ge,{...e,dragPan:this._dragPan}),this._dispatchIndoorMapLoaded(),this.updateRendering()}updateCustomLayers(){const e=this._map.getStyle();this._originIndoorLayers=tt(e),this._outdoorLayers=Mr(e),this._copyOverlapLayers(),this._copySharedFloorBackgroundLayers(),this._addSelectedHighlightLayers(),this._addReserveFloorLayers(),this._isMaskMode&&this._addBuildingMaskLayer(),this._outdoorMapShown||this._setOutdoorVisibility(!1)}updateRendering(){this._updateFeatures(),this._updateSelectedFeatures(),this._layerFloors(),this._calExcludedPoisInMiddle(),this._filterLayers(),this._filterSelectedHighlight(),this._updateUnselectedMask()}async panToBuildingCenter(){if(this.dragPanHandler.panToCenter(),this._featureIncomplete){const e=()=>this.getFeaturesById(this._curBuildingId,{layerIds:[ge]})[0];await this._waitForFeatureLoaded(e)}}async panToVenueCenter(){if(this.dragPanHandler.panToCenter(),this._featureIncomplete){const e=()=>this.getFeaturesById(this._curVenueId,{layerIds:[Lt]})[0];await this._waitForFeatureLoaded(e)}}async _waitForFeatureLoaded(e){const i=()=>this._isDestroyed?(this._abortQueryFeature?.(),!0):!!e(),{promise:r,abort:n}=Wr(i);this._abortQueryFeature=n;try{await Promise.race([r,new Promise((s,o)=>{this._abortQueryFeature=()=>{o(new Error("Aborted")),this._abortQueryFeature=null}})])}catch(s){console.warn(s);return}}setDragPan(e){this._dragPan=e}setFitBounds(e){this._fitBounds=e}async selectByClickMap(e){if(!this._enableIndoorClickSelection&&!this._enableOutdoorClickSelection)return;this.setDragPan(!1),this.dragPanHandler.setBounds(null),this._featureIncomplete=!1,!e.venue?this._enableOutdoorClickSelection&&await this.selectBuilding(null):this._enableIndoorClickSelection&&(e.building?await this.selectBuilding(e.building,{floorId:e.floor?.id}):"name"in e.floor&&await this.selectSharedFloor(e.floor,e.venue))}queryIndoorInfoByPoint(e){const i=this._map.unproject(e),r=this._queryVisibleFeature(e),n={coordinate:i,venue:null,building:null,floor:null};if(!r)return n;const{sourceLayer:s}=r;let o=n;if(s==="mapxus_level"){const a=r.properties?.["ref:building"],l=this.getFeaturesById(a)?.[0];if(l){const d=l.properties?.["ref:venue"],u=this.getFeaturesById(d)?.[0];if(u){const{id:c,name:h,ordinal:f}=r.properties;o={coordinate:i,venue:u,building:l,floor:{id:c,code:h,ordinal:f}}}else console.warn("Venue feature not found for building: ",a)}}else if(s==="mapxus_shared_level"){const{id:a,ordinal:l,name:d,"ref:venue":u}=r.properties||{},c=this.getFeaturesById(u)?.[0];c?o={coordinate:i,venue:c,building:null,floor:{id:a,name:typeof d=="string"?{default:d}:d,ordinal:l}}:console.warn("Venue feature not found for sharedFloor: ",a)}else{const a=r?.properties?.["ref:venue"],l=this.getFeaturesById(a)?.[0];l?o={coordinate:i,venue:l,building:r,floor:null}:console.warn("Venue feature not found for building: ",r.properties?.id)}return o}_bindMaplibreEventListeners(){this._map.once("styledata",()=>this.updateCustomLayers()),this._map.once("idle",()=>{this.emit(Zi),(!this._startWithIndoorView||this._map.getZoom()<14)&&this._dispatchIndoorMapLoaded()}),this._map.on("sourcedata",this._debounceRendering=Xi(()=>this.updateRendering(),300))}_clear(){this._curBuildingFeature=null,this._curBuildingId=null,this._floor={code:null,id:null,ordinal:null},this._curVenueId=null,this._curVenueFeature=null,this._curSharedLevelId=null}_getIndoorFeatures(){return this._queryRenderedFeatures().filter(e=>it(e.source))}_getBuildingFloorByOrdinal(e,i){let r=null,n=null;if(e?.properties){const{ordinals:s,level_names:o,level_ids:a}=e.properties,l=w(s).findIndex(d=>d===i);r=w(o)[l]??null,n=w(a)[l]??null}return{code:r,id:n,ordinal:i}}_isCurrentFeature(e){const i=e?.properties?.id??null,r=this._isSelectSharedFloor?this._curSharedLevelId:this._curBuildingId;return i===r}_setOutdoorVisibility(e){for(const{id:i}of this._outdoorLayers)this._map.getLayer(i)&&this._map.setLayoutProperty(i,"visibility",e?"visible":"none")}_addReserveFloorLayers(){for(const e of[Ie,T]){if(this._map.getLayer(e))continue;const i=e.split("_")[1],r=this._map.getLayer(i);if(!r)continue;const{source:n,sourceLayer:s}=r,o=e===Ie?this._middleLayers[0]:this._lowerLayers[0];let a={"fill-opacity":0};if(this._isMaskMode&&e===T){const l=this._originIndoorLayers.find(({id:d})=>d===ge);l&&(a=Object.assign({},l.paint??{},a))}this._map.addLayer({id:e,source:n,"source-layer":s,type:"fill",paint:a},o.id)}}_addBuildingMaskLayer(){if(this._map.getLayer(Le))return;const e=this._originIndoorLayers.find(({id:i})=>i===ge);if(e){const i=Object.assign({},e,{id:Le,layout:Object.assign({},e.layout??{},{visibility:"visible"}),paint:Object.assign({},e.paint??{},{"fill-opacity":0})});this._map.addLayer(i,ge)}}_updateUnselectedMask(){if(!this._isMaskMode)return;const e=[...this._maskBuildings],i=[...this._maskSharedFloors];this._map.getLayer(Le)&&this._map.setPaintProperty(Le,"fill-opacity",["case",["in",["get","id"],["literal",e]],1,0]),this._map.getLayer(T)&&this._map.setPaintProperty(T,"fill-opacity",["case",["in",["get","id"],["literal",i]],1,0])}_addSelectedHighlightLayers(){const e=[{layerId:Bt,sourceLayer:"mapxus_level"},{layerId:Et,sourceLayer:"mapxus_shared_level"}];let i=this._originIndoorLayers.find(({type:r})=>Ct(r));if(!i){const r=this._originIndoorLayers.findIndex(({id:n})=>n===this._upperLayers[this._upperLayers.length-1].id);i=this._originIndoorLayers[r+1]}for(const{layerId:r,sourceLayer:n}of e){if(this._map.getLayer(r))continue;const{lineWidth:s,lineOpacity:o,lineColor:a,lineOffset:l}=this._selectedHighlightStyle,d=tr(s,l);this._map.addLayer({id:r,source:"indoor-planet","source-layer":n,type:"line",filter:["==","id",""],paint:{"line-offset":d,"line-width":s,"line-color":a,"line-opacity":o}},i?.id)}}_filterSelectedHighlight(){for(const e of[Bt,Et])this._map.getLayer(e)&&this._map.setFilter(e,["==","id",this._isSelectSharedFloor?this._curSharedLevelId:this._floor.id??""])}_copyOverlapLayers(){const e=this._originIndoorLayers.findIndex(({type:a,"source-layer":l})=>ir(l,a)),i=this._originIndoorLayers.findIndex(({type:a,"source-layer":l})=>Ft(l,a)),r=this._originIndoorLayers.slice(e,i);this._upperLayers=r.filter(({type:a})=>Va(a));const n=this._originIndoorLayers.slice(i),s=n.findIndex(({type:a,"source-layer":l})=>!Ft(l,a));if(s>-1){this._commonPoiLayers=n.slice(0,s);const a=n.slice(s).filter(({"source-layer":l})=>l==="mapxus_section");this._sectionFillLineLayers=a.filter(({type:l})=>l!=="symbol"),this._sectionSymbolLayers=a.filter(({type:l})=>l==="symbol")}else this._commonPoiLayers=[...n],this._sectionSymbolLayers=r.filter(({type:a,"source-layer":l})=>l==="mapxus_section"&&a==="symbol");const o=this._upperLayers[0];this._middleLayers=this._upperLayers.filter(({type:a})=>!Ct(a)).map(a=>{const l=`${a.id}-overlap-copy`;let d=this._map.getLayer(l);return d||(d=Object.assign({},a,{id:l}),this._map.addLayer(d,o.id)),d})}_copySharedFloorBackgroundLayers(){if(!!!this._upperLayers.find(n=>n.id===T.split("_")[1]))return;const i=this._upperLayers.filter(({"source-layer":n,type:s})=>!Pt(n,s)&&!Ct(s)),r=this._middleLayers[0]||this._upperLayers[0];this._lowerLayers=[...i,...this._commonPoiLayers].map(n=>{const s=`${n.id}-shared-bg`;let o=this._map.getLayer(s);return o||(o=Object.assign({},n,{id:s}),this._map.addLayer(o,r.id)),o})}_updateFeatures(){this._features=this._getIndoorFeatures();const e=Qi(this._features,s=>s.layer.id+":"+s.properties.id),i=[],r=[],n=[];for(const s of e){const o=s.layer.id;o===Lt?i.push(s):o===ge?r.push(s):o===T&&n.push(s)}this._allVenuesMap=new Map(i.map(s=>[s.properties.id,s])),this._allBuildingsMap=new Map(r.map(s=>[s.properties.id,s])),this._allSharedLevelsMap=new Map(n.map(s=>[s.properties.id,s]))}_calExcludedPoisInMiddle(){const e=this._map.querySourceFeatures("indoor-planet",{sourceLayer:"mapxus_place"}),i=n=>n?w(n).some(o=>this._upperLevels.has(o)):!1,r=e.filter(n=>{const s=n.properties["ref:level"]||n.properties["ref:shared_level"];return this._middleLevels.has(s)?i(n.properties.overlap):!1});this._excludedPoisInMiddle=r.map(n=>n.properties["osm:ref"])}_updateSelectedFeatures(){if(this._featureIncomplete){if(this._isSelectSharedFloor){const e=this._features.find(i=>i.properties.id===this._curVenueId);if(!e)return;this._curVenueFeature=e}else{const e=this._allBuildingsMap.get(this._curBuildingId);if(!e)return;this._curBuildingFeature=e}this._featureIncomplete=!1}}_layerFloors(){const{displayedLevels:e,selectedLevelIds:i,alwaysDisplayedSharedLevelIds:r,maskBuildingIds:n,maskSharedFloorIds:s}=this.layeredHandler.getLayeredData({selectedVenueId:this._curVenueId,venueMap:this._allVenuesMap,buildingMap:this._allBuildingsMap,sharedFloorMap:this._allSharedLevelsMap});this._upperLevels.clear(),this._middleLevels.clear(),this._lowerLevels.clear(),this._layerSelectedLevels(e,i),this._layerUnselectedLevels(e,i,r),this._isMaskMode&&(this._maskBuildings.clear(),this._maskSharedFloors.clear(),n.forEach(o=>{this._maskBuildings.add(o)}),s.forEach(o=>{this._maskSharedFloors.add(o)}))}_layerSelectedLevels(e,i){for(const r of i){this._upperLevels.add(r),this._zIndexHistory.set(r,!0);const n=e.find(({level:s,overlap:o})=>s===r&&!!o);if(n)for(const s of n.overlap)this._zIndexHistory.get(s)&&this._zIndexHistory.delete(s)}}_layerUnselectedLevels(e,i,r){for(const n of e){if(i.includes(n.level))continue;const{level:s,overlap:o,venueId:a}=n,l=this._zIndexHistory.get(s),d=!o||!o.some(c=>this._upperLevels.has(c)),u=r.includes(s);if(a===this._curVenueId&&u){this._lowerLevels.add(s),this._zIndexHistory.delete(s);continue}l?this._upperLevels.add(s):l===!1?this._middleLevels.add(s):u?this._lowerLevels.add(s):d?(this._upperLevels.add(s),this._zIndexHistory.set(s,!0)):(this._middleLevels.add(s),this._zIndexHistory.set(s,!1))}}_filterLayers(){this._filterIndoorLayers([...this._upperLevels,...this._middleLevels],this._commonPoiLayers),this._filterIndoorLayers([...this._upperLevels],this._upperLayers),this._filterIndoorLayers([...this._middleLevels],this._middleLayers),this._filterIndoorLayers([...this._lowerLevels],this._lowerLayers),this._sectionSymbolLayers.length!==0&&(this._sectionFillLineLayers.length?(this._filterIndoorLayers([...this._upperLevels],this._sectionFillLineLayers),this._filterIndoorLayers([...this._upperLevels],this._sectionSymbolLayers)):this._filterIndoorLayers([...this._upperLevels,...this._middleLevels,...this._lowerLevels],this._sectionSymbolLayers))}_filterIndoorLayers(e,i){let r;for(const n of i){const{id:s,filter:o,type:a,"source-layer":l}=n,d=o?[o]:[],u=s.includes("-shared-bg"),c=[...this._maskBuildings],h=[...this._maskSharedFloors];ir(l,a)?r=["all",Pt(l,a)?["!in","ref:building",...c]:["!in","id",...h],["in","id",...e],...d]:u?r=["all",["!in","ref:shared_level",...h],["in","ref:shared_level",...e],...d]:(r=["all",["any",["all",["!in","ref:building",...c],["in","ref:level",...e]],["all",["!in","ref:shared_level",...h],["in","ref:shared_level",...e]]],...d],Ft(l,a)&&r.splice(1,0,["any",["!has","overlap"],["any",["in","ref:level",...this._upperLevels],["in","ref:shared_level",...this._upperLevels],["!in","osm:ref",...this._excludedPoisInMiddle]]])),this._map.setFilter(s,r)}}async _queryVenueFeature(e){let i=this.getFeaturesById(e,{layerIds:[Lt]})[0]??null;if(!i)try{const r=await lt(e);i=rt(r)}catch(r){console.error(r)}return i}_getBuildingDisplayedOrdinal(e,i){if(!e||!e.properties)return null;const{"ref:venue":r,level_ids:n,ordinals:s}=e.properties,o=w(n),a=w(s);if(i){const d=o.findIndex(u=>u===i);return a[d]??null}const l=this._history.getHistoryOrdinal(r);return l&&a.includes(l)?l:Yi(e)}_updateFloorState(e){if(!e){this._floor={code:null,id:null,ordinal:null};return}const{code:i,id:r}=this._getBuildingFloorByOrdinal(this._curBuildingFeature,e);(!i||!r)&&console.error(`Floor with ordinal "${e}" not found in building "${this._curBuildingId}".`),this._floor={code:i,id:r,ordinal:e},this._history.setHistoryOrdinal(this._curVenueId,e),this._history.setHistoryBuildingUnit(this._curVenueId,{id:this._curBuildingId,type:"building"})}async _checkAndPanToBuilding(){this.getFeaturesById(this._curBuildingId,{layerIds:[ge]})[0]||(this._fitBounds?this.dragPanHandler.fitBounds():this.dragPanHandler.panToCenter())}_queryVisibleFeature(e){const r=[Ji,wt,`${Ji}-overlap-copy`,`${wt}-overlap-copy`,`${wt}-shared-bg`,...this._isMaskMode?[T,Le]:[]].filter(o=>!!this._map.getLayer(o)),n=this._map.queryRenderedFeatures(e,{layers:r});let s=null;for(const o of r){const a=n.find(l=>l.layer.id===o);if(a){s=a;break}}return s&&Ua(s.sourceLayer,s.layer.type)&&(this._maskBuildings.has(s.properties?.id)||(s=null)),s}_queryRenderedFeatures(e){const i=(e||[]).filter(s=>this._map.getLayer(s));if(e&&e.length>0&&i.length===0)return[];const r=i.length?{layers:i}:{},n=this._map.getCanvas().getBoundingClientRect();return this._map.queryRenderedFeatures([[0,0],[n.width,n.height]],r)}_dispatchIndoorMapLoaded(){this._indoorMapLoaded||(this._indoorMapLoaded=!0,this.emit(It))}_changeOtherVenuesHistory(e){const i=[...this._allVenuesMap.values()];for(const r of i){const n=r.properties.id;n!==this._curVenueId&&this._history.setHistoryOrdinal(n,e)}}}function tr(t,e){const i=typeof t=="number"&&t===He.lineWidth,r=typeof e=="number"&&e===He.lineOffset;if(!r)return e;if(i&&r)return["interpolate",["linear"],["zoom"],18,-1.5,20.2,-3.75,20.4,-3.8,21.5,-7.5,22,-9.55];if(!i&&r)return typeof t=="number"?-(t/2):e}function Ua(t,e){return t==="mapxus_building"&&(e==="fill"||e==="line"||e==="symbol")}function ir(t,e){return Pt(t,e)||ja(t,e)}function Pt(t,e){return t==="mapxus_level"&&(e==="fill"||e==="line")}function ja(t,e){return t==="mapxus_shared_level"&&(e==="fill"||e==="line")}function Ft(t,e){return t==="mapxus_place"&&e==="symbol"}function Ct(t){return t==="fill-extrusion"}function Va(t){return t==="line"||t==="fill"||t==="fill-extrusion"}const Ke="Poi_poiClick";class rr{_map;_currentStyle=null;_styleLayersLength=0;_layerIds=[];_dispatch=Se(Ke);_listeners=[];constructor(e){this._map=e,this._bindPoiClickEvent()}destroy(){this._dispatch.on(`.${Ke}`,null),this._currentStyle=null,this._map=null,this._dispatch=null,this._listeners=[],this._layerIds=[]}onPoiClick(e){const i=ie(`${Ke}.`);return this._dispatch.on(i,e),this._listeners.push(i),{unsubscribe:()=>this._dispatch.on(i,null)}}_queryPoiLayers(){const e=this._map.getStyle();if(e.name===this._currentStyle&&e.layers.length===this._styleLayersLength)return;const i=tt(e).filter(r=>r["source-layer"]==="mapxus_place"&&r.type==="symbol");this._layerIds=i.map(({id:r})=>r),this._currentStyle=e.name,this._styleLayersLength=e.layers.length}_bindPoiClickEvent(){this._map.on("click",e=>{if(this._listeners.length===0)return;this._queryPoiLayers();const i=this._map.queryRenderedFeatures(e.point,{layers:this._layerIds});if(i.length===0)return;const r=i[0],n=w(r.properties["ref:sections"]),s=!!r.properties["ref:shared_level"],o={coordinate:e.lngLat,poi:r};if(n.length>0){const a=this._map.querySourceFeatures("indoor-planet",{sourceLayer:"mapxus_section"});o.sections=n.map(l=>{const d=a.find(g=>g.properties.id===l),{id:u,section:c="",correlation_id:h}=d?.properties||{},f=nr(d?.properties);return{id:u,category:c,sectionName:f,...h&&{correlationId:h}}})}if(s){const a=r.properties["ref:shared_level"],{floor:l,venue:d}=this._queryIndoorFeaturesBySharedFloor(a);o.floor=l,o.venue=d}else{const a=r.properties["ref:level"],{floor:l,building:d,venue:u}=this._queryIndoorFeaturesByFloor(a);o.floor=l,o.building=d,o.venue=u}this._dispatch.call(Ke,null,o)})}_queryIndoorFeaturesBySharedFloor(e){const i=this._map.queryRenderedFeatures({layers:[T,"mapxus-venue-fill"]}),r=i.find(d=>d.sourceLayer==="mapxus_shared_level"&&d.properties.id===e);if(!r)return{floor:null,venue:null};const n=r.properties["ref:venue"],s=i.find(d=>d.layer.id==="mapxus-venue-fill"&&d.properties.id===n)??null,{id:o,ordinal:a}=r.properties,l=nr(r.properties);return{floor:{id:o,ordinal:a,name:l},venue:s}}_queryIndoorFeaturesByFloor(e){const i=this._map.queryRenderedFeatures({layers:[Ie,"mapxus-building-line","mapxus-venue-fill"]}),r=i.find(u=>u.sourceLayer==="mapxus_level"&&u.properties.id===e);if(!r)return{floor:null,building:null,venue:null};const{id:n,ordinal:s,name:o,"ref:building":a}=r.properties||{},l=i.find(u=>u.layer.id==="mapxus-building-line"&&u.properties.id===a)??null,d=i.find(u=>u.layer.id==="mapxus-venue-fill"&&u.properties.id===l?.properties?.["ref:venue"])??null;return{floor:{id:n,ordinal:s,code:o},building:l,venue:d}}}function nr(t){return t?Object.keys(t).filter(i=>i.includes("name")).reduce((i,r)=>{const[,n]=w(r,":");return n?i[n]=t[r]:i.default=t[r],i},{}):{default:""}}function $e(t){t.parentNode&&t.parentNode.removeChild(t)}function F(t,e,i){const r=document.createElement(t);return e&&(r.className=e),i&&i.appendChild(r),r}class sr{_map;_maplibre;_buildingId;_features;_$container;_$listContainer;_$buildingList;_listHeight;_language;_visible;_position="top-right";_isMobileMode;_isListShown=!1;constructor(e,i){this._map=e,this._language=e.getLanguage(),this._visible=i??!0,this._detectDeviceMode()}onAdd(e){return this._maplibre=e,this._$container=F("div",`maplibregl-ctrl maplibregl-ctrl-building-filter ${this._visible?"":"hide"}`,this._maplibre.getContainer()),this._$container.appendChild(this._buildingFilterIconCreate("div")),this._$container.appendChild(this._buildingNameListCreate("div")),this._bindEvents(),this._$container}onRemove(){$e(this._$container)}get position(){return this._position}get enabled(){return this._visible}getDefaultPosition(){return"top-right"}setVisibility(e){this._visible=e,e?this._$showLayout():this._$hideLayout()}changePosition(e,i,r){const n=document.querySelector(`.maplibregl-ctrl-${e}`),s=n.querySelector(".maplibregl-ctrl-building-filter");if(e!==i){this._position=i;const o=document.querySelector(`.maplibregl-ctrl-${i}`);s&&(n.removeChild(s),Number.isFinite(r)?o.insertBefore(s,o.children[r]):o.append(s),this._updateBuildingListLayout(i))}else Number.isFinite(r)&&n.children[r]!==s&&(n.removeChild(s),n.insertBefore(s,n.children[r]))}_bindEvents(){this._maplibre.on("moveend",()=>this._refresh()),this._map.onMapChangeListener(e=>{const i=e.building?.properties?.id??"";this._buildingId!==i&&(this._buildingId=i,this._refresh())}),this._map.renderComplete(()=>this._init())}_init(){this._load()}_refresh(){this._load()}_load(){this._buildingNameListClean(),this._buildingNameListUpdate()}_buildingFilterIconCreate(e){const i=F(e,"mapxus-building-filter-icon");return this._bindMouseOnEvents(i,!1),this._bindMobileTouchEvents(i),i}_buildingNameListCreate(e){return this._$listContainer=F(e,"mapxus-building-name-layout"),this._$listContainer.style.display="none",this._$listContainer.style.top="20px",this._$buildingList=F(e,"mapxus-building-name-list",this._$listContainer),this._bindMouseOnEvents(this._$listContainer,!0),this._$listContainer}_buildingNameListUpdate(){this._features=[];const e=this._map.getMaplibre(),i=e?e.queryRenderedFeatures({layers:["mapxus-building-line"]}):[];for(const r of i){const{properties:n}=r,{id:s,name:o}=n,a=n?.[`name:${this._language}`]??o;this._features.find(l=>l.properties.id===s)||(this._features.push(r),this._$buildingList.appendChild(this._buildingNameCreate("p",a,s,s===this._map.building?.properties?.id)))}this._setBuildingListHeight(this._features),this._updateBuildingListLayout(this._position)}_buildingNameListClean(){this._$buildingList.replaceChildren()}_setBuildingListHeight(e){const n=e.map(s=>{const o=s?.properties?.[`name:${this._language}`]??s?.properties?.name;return o?Math.ceil(o.length*8/107):0}).reduce((s,o)=>s+o,0);this._listHeight=n*26+e.length*8,this._$buildingList.style.height=this._$listContainer.style.height=`${this._listHeight>=208?208:this._listHeight}px`}_buildingNameCreate(e,i,r,n){const s=F(e,`mapxus-building-name${n?" active":""}`);return s.dataset.id=r,s.innerText=i,this._buildingNameClickEvent(s),s}_toggleList(e){this._isListShown=e,this._$listContainer.style.display=e?"block":"none"}_buildingNameClickEvent(e){e.onclick||(e.onclick=async i=>{const r=i.target;await this._map.selectBuildingById(r.dataset.id)})}_bindMouseOnEvents(e,i){e.onmouseenter=()=>{this._isMobileMode||this._toggleList(!0)},i&&(e.onmouseleave=()=>this._toggleList(!1))}_bindMobileTouchEvents(e){window.addEventListener("resize",()=>this._detectDeviceMode()),e.ontouchend=()=>this._toggleList(!this._isListShown)}_$showLayout(){this._$container.classList.remove("hide")}_$hideLayout(){this._$container.classList.add("hide")}_updateBuildingListLayout(e){e.indexOf("left")>-1?(this._$listContainer.style.right=null,this._$listContainer.style.left="55px"):(this._$listContainer.style.left=null,this._$listContainer.style.right="55px");const i=this._$container.offsetParent?this._$container.offsetParent.clientHeight-(this._$container.offsetTop+this._$container.clientHeight)-25:0;e.includes("bottom")&&this._listHeight-20>i?(this._$listContainer.style.top=null,this._$listContainer.style.bottom="15px"):(this._$listContainer.style.bottom=null,this._$listContainer.style.top="20px")}_detectDeviceMode(){this._isMobileMode=window.matchMedia("(pointer: coarse) and (max-width: 768px)").matches}}var qa=Math.max,za=Math.min;function Ga(t,e,i){return t>=za(e,i)&&t<qa(e,i)}var or=1/0,Ka=17976931348623157e292;function ar(t){if(!t)return t===0?t:0;if(t=ze(t),t===or||t===-or){var e=t<0?-1:1;return e*Ka}return t===t?t:0}function lr(t,e,i){return e=ar(e),i===void 0?(i=e,e=0):i=ar(i),t=ze(t),Ga(t,e,i)}class dr{_container;_indoor;_maplibre;_position="top-right";_buildingId;_floorNames;_ordinals;_ordinal;_style;_$innerFloors;_$activeFloor;_centerSelectorIdx;_lastNormalScrollableIdx;_$arrowBtnUp;_$arrowBtnDown;_maxScrollTop;_$selectorExpanded;_$selectorFolded;_componentDidMount=!1;_visible=!1;_isEnabled;_dragPan;_language;_debounceScroll;_clearScrollEventListener;constructor(e,i){const{style:r,enabled:n=!0,language:s}=i;this._indoor=e,this._language=s,this._style=r?Object.assign({},Yt,r):Yt,this._isEnabled=n,this._addIndoorEventListeners()}onAdd(e){return this._maplibre=e,this._addMapMoveEventListener(),this._container=F("div","maplibregl-ctrl mapxus-ctrl-floors hidden"),this._container}onRemove(){this._debounceScroll&&this._debounceScroll.cancel(),this._clearScrollEventListener&&this._clearScrollEventListener(),$e(this._container)}get position(){return this._position}get enabled(){return this._isEnabled}setEnabled(e){this._isEnabled=e,e&&!this._visible&&this._setVisibility(!0),!e&&this._visible&&this._setVisibility(!1)}getDefaultPosition(){return"top-right"}async switchByOrdinal(e,i){this._ordinal=e,this._dragPan=i??!0,await this._indoor.switchFloorByOrdinal(e),this._updateSelectorStatus(e),this._scrollCenterActiveFloor()}changePosition(e,i,r){const n=document.querySelector(`.maplibregl-ctrl-${e}`),s=n.querySelector(".mapxus-ctrl-floors");if(e!==i){this._position=i;const o=document.querySelector(`.maplibregl-ctrl-${i}`);s&&(n.removeChild(s),Number.isFinite(r)?o.insertBefore(s,o.children[r]):o.append(s),this._show(),this._scrollCenterActiveFloor())}else Number.isFinite(r)&&n.children[r]!==s&&(n.removeChild(s),n.insertBefore(s,n.children[r]),this._show(),this._scrollCenterActiveFloor())}setStyle(e){this._style=Object.assign({},this._style,e),this._componentDidMount&&(this._clearFloors(),this._calcSelectorLayout(),this._render(),this._scrollCenterActiveFloor())}_setVisibility(e){this._componentDidMount?e?(this._show(),this._scrollCenterActiveFloor()):this._hide():(this._visible=e,this._indoor.building&&e&&(this._render(),this._show(),this._scrollCenterActiveFloor()))}_addIndoorEventListeners(){this._indoor.on(Ge,e=>{if(this._updatePrepared(),!e)return;const{ordinal:i,dragPan:r}=e;this._dragPan=r,"building"in e?this._renderBuildingFloors(e.building,i):this._renderSharedLevelFloor(e)})}_updatePrepared(){this._clearState(),this._visible&&this._hide(),this._componentDidMount&&this._clearFloors()}_renderBuildingFloors(e,i){const{level_names:r,ordinals:n,id:s}=e.properties;this._buildingId=s,this._floorNames=r.split(",").reverse(),this._ordinals=n.split(",").reverse(),this._ordinal=i,this._calcSelectorLayout(),this._render();const o=this._indoor.getFeaturesById(s,{filter:a=>a.layer.id==="mapxus-building-line"})[0];this._checkIfShowFloorSelector(o)}_renderSharedLevelFloor(e){const{name:i,ordinal:r,id:n}=e;this._floorNames=[i[this._language]||i.default],this._ordinals=[r],this._ordinal=r,this._calcSelectorLayout(),this._render();const s=this._indoor.getFeaturesById(n,{layerIds:[T]})[0];this._checkIfShowFloorSelector(s)}_checkIfShowFloorSelector(e){this.enabled&&(this._dragPan!==!1||this._dragPan===!1&&e)&&(this._show(),this._scrollCenterActiveFloor())}_addMapMoveEventListener(){this._maplibre.on("moveend",()=>{this.enabled&&this._dragPan===!1&&this._buildingId&&(this._indoor.getFeaturesById(this._buildingId,{layerIds:["mapxus-building-line"]})[0]?this._componentDidMount?this._visible||(this._show(),this._scrollCenterActiveFloor()):(this._render(),this._show(),this._scrollCenterActiveFloor()):this._componentDidMount&&this._visible&&this._hide())})}_clearState(){this._buildingId=null,this._floorNames=[],this._ordinals=[],this._ordinal=null}_calcSelectorLayout(){const{itemCount:e,itemSize:i}=this._style;this._centerSelectorIdx=Math.ceil(e/2)-1,this._maxScrollTop=(this._floorNames.length-e)*i,this._lastNormalScrollableIdx=this._floorNames.length-(e-this._centerSelectorIdx-1)-1}_render(){this._createFloors(),this._componentDidMount=!0}_hide(){this._container.classList.add("hidden"),this._visible=!1}_show(){this._container.classList.remove("hidden"),this._visible=!0}_createFloors(){this._$selectorFolded=this._$foldedSelector(this._container,()=>{this._expandSelector(!0),this._scrollCenterActiveFloor()}),this._$selectorExpanded=this._$expandedSelector(this._container,()=>this._expandSelector(!1))}_$expandedSelector(e,i){const{itemSize:r,itemCount:n,defaultFolded:s,backgroundColor:o}=this._style,a=F("div",`mapxus-ctrl-floors-expanded ${s?"hidden":""}`,e);if(this._floorNames.length>1){const d=F("div","mapxus-ctrl-floors-close",a);d.onclick=i}const l=F("div","mapxus-ctrl-floors-wrapper",a);return l.style.backgroundColor=o,this._floorNames.length>n&&(this._$arrowBtnUp=this._$createScrollButton(l,"up"),this._$arrowBtnUp.onclick=()=>this._handleScroll("up")),this._$innerFloors=F("div","mapxus-ctrl-floors-inner",l),Object.assign(this._$innerFloors.style,{maxHeight:`${r*n}px`,width:`${r}px`}),this._$createFloors(this._$innerFloors),this._floorNames.length>n&&(this._$arrowBtnDown=this._$createScrollButton(l,"down"),this._$arrowBtnDown.onclick=()=>this._handleScroll("down"),this._$innerFloors.addEventListener("scroll",this._debounceScroll=Xi(d=>{d.stopPropagation(),this._resetArrowBtnStatus(this._$innerFloors.scrollTop)},100)),this._clearScrollEventListener=()=>this._$innerFloors.removeEventListener("scroll",this._debounceScroll)),a}_$foldedSelector(e,i){const{itemSize:r,activeFontColor:n,activeBackgroundColor:s,defaultFolded:o}=this._style,a=F("div",`mapxus-ctrl-floors-folded mapxus-ctrl-floors-floor ${o?"":"hidden"}`,e);return a.onclick=i,Object.assign(a.style,{width:`${r}px`,height:`${r}px`,lineHeight:`${r}px`,color:n,backgroundColor:s}),a}_clearFloors(){this._container.replaceChildren(),this._componentDidMount=!1}_$createScrollButton(e,i){return F("div",`mapxus-ctrl-floors-arrow mapxus-ctrl-floors-floor ${i}`,e)}_$createFloors(e){const{fontColor:i,itemSize:r}=this._style;let n;this._floorNames.forEach((s,o)=>{n=F("div","mapxus-ctrl-floors-floor",e),n.dataset.floor=s,n.dataset.ordinal=this._ordinals[o],n.innerText=s,Object.assign(n.style,{color:i,height:`${r}px`,lineHeight:`${r}px`}),n.dataset.ordinal===this._ordinal&&(this._$activeFloor=n,this._resetActiveFloor(!0),this._$selectorFolded.innerText=s),n.onclick=async a=>{this._indoor.setDragPan("restrict"),this._indoor.dragPanHandler.setAnimated(!0),await this.switchByOrdinal(a.target.dataset.ordinal)}})}_updateSelectorStatus(e){const i=this._floorNames[this._ordinals.indexOf(e)];this._$activeFloor&&this._resetActiveFloor(!1);for(const r of this._$innerFloors.children){const n=r;n.dataset.ordinal===e&&(this._$activeFloor=n,this._resetActiveFloor(!0))}this._$selectorFolded.innerText=i}_resetArrowBtnStatus(e){e===0?this._$arrowBtnUp?.classList?.add("hidden"):this._$arrowBtnUp?.classList?.remove("hidden"),e===this._maxScrollTop?this._$arrowBtnDown?.classList?.add("hidden"):this._$arrowBtnDown?.classList?.remove("hidden")}_resetActiveFloor(e){const{activeBackgroundColor:i,backgroundColor:r,activeFontColor:n,fontColor:s}=this._style;Object.assign(this._$activeFloor.style,{color:e?n:s,backgroundColor:e?i:r,fontWeight:e?"bold":"normal",cursor:e?"auto":"pointer"}),this._$activeFloor.disabled=e}_scrollCenterActiveFloor(){if(this._ordinal){const e=this._ordinals.indexOf(this._ordinal);e>-1&&(this._$innerFloors.scrollTop=this._getScrollTop(e),this._$innerFloors.scrollTop||this._resetArrowBtnStatus(0))}}_getScrollTop(e){return lr(this._centerSelectorIdx,this._lastNormalScrollableIdx+1)?(e-this._centerSelectorIdx)*this._style.itemSize:e>this._lastNormalScrollableIdx?this._maxScrollTop:0}_handleScroll(e){const i=this._$innerFloors.scrollTop,{itemSize:r}=this._style;if(e==="up"){const n=i-r*2;this._$innerFloors.scrollTop=n<0?0:n}else if(e==="down"){const n=i+r*2;this._$innerFloors.scrollTop=n>this._maxScrollTop?this._maxScrollTop:n}}_expandSelector(e){e?(this._$selectorExpanded.classList.remove("hidden"),this._$selectorFolded.classList.add("hidden")):(this._$selectorExpanded.classList.add("hidden"),this._$selectorFolded.classList.remove("hidden"))}}const ur=Re.includes("co.jp"),Ya=ur?"kawasaki-logo":"mapxus-logo",Wa=ur?"https://www.khi.co.jp/groupvision2030/mapxus.html":"https://www.mapxus.com/";class Xa{_container;_isEnabled;constructor(e){this._isEnabled=e?.enabled??!0}onAdd(e){if(this._container=F("div","maplibregl-ctrl mapxus-ctrl-logo",e.getContainer()),this._isEnabled){const i=F("a",Ya,this._container);i.target="_blank",i.href=Wa,i.setAttribute("aria-label","Mapxus logo"),i.setAttribute("rel","noopener"),this._container.appendChild(i)}return this._container}onRemove(){$e(this._container)}getDefaultPosition(){return"bottom-left"}}const Qa=Re.includes("co.jp");class Za{_container;_anchor;_theme;constructor(e){this._theme=e.theme?e.theme:"default"}onAdd(e){return this._container=F("div","maplibregl-ctrl mapxus-ctrl-attribution",e.getContainer()),this._anchor=F("a","mapxus-attribution",this._container),this._anchor.target="_blank",this._setCopyrightInfo(this._theme),this._anchor.setAttribute("aria-label","Mapxus attribution"),this._anchor.setAttribute("rel","noopener"),this._container.appendChild(this._anchor),this._container}onRemove(){$e(this._container)}getDefaultPosition(){return"bottom-right"}changeTheme(e){this._setCopyrightInfo(e)}_setCopyrightInfo(e){this._anchor.innerText=e==="landsD"?"© The Government of the Hong Kong SAR":Qa?"©Mapxus driven by Kawasaki ©OpenStreetMap contributors":"©Mapxus ©OpenStreetMap contributors",e==="landsD"&&(this._anchor.href="https://www.map.gov.hk/gm/")}}class Ja{_container;_$icon;_removeClickEventListener;onAdd(e){return this._container=F("div","maplibregl-ctrl mapxus-ctrl-collapsed-copyright",e.getContainer()),this._container.innerHTML=el(),this._bindEvents(),this._container}onRemove(){this._removeClickEventListener(),$e(this._container)}getDefaultPosition(){return"bottom-right"}_bindEvents(){const e=this._container.querySelector(".mapxus-collapsed-copyright-menu");this._$icon=this._container.querySelector(".mapxus-collapsed-copyright-btn");let i=!1;this._$icon.addEventListener("click",r),this._removeClickEventListener=()=>this._$icon.removeEventListener("click",r);function r(){i=!i,n()}function n(){i?e.classList.remove("hidden"):e.classList.add("hidden")}}}function el(){return`
|
|
2
2
|
<div class="mapxus-collapsed-copyright-content">
|
|
3
3
|
<div class="mapxus-collapsed-copyright-menu hidden">
|
|
4
4
|
<div class="mapxus-collapsed-copyright-logo" onclick="window.open('https://www.khi.co.jp/groupvision2030/mapxus.html')"></div>
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
</div>
|
|
8
8
|
<div class="mapxus-collapsed-copyright-btn"></div>
|
|
9
9
|
</div>
|
|
10
|
-
`}function Ot(t){return`${Re}/${Pr}/${t}`}var $t=(t=>(t.CHRISTMAS="christmas_mims2_v1",t.HALLOWEEN="halloween_mims2_v1",t.MAPPY_BEE="mappybee_mims2_v2",t.MAPXUS="mapxus_mims2_v1",t.LANDS_D="lands_d_mims2_v1",t.COMMON="common_mims2_v1",t.MAPXUS_V2="mapxus_v2",t.MAPXUS_DEFAULT="mapxus_v8",t.ROSE_TEA="rose_tea",t.PEAR_SORBET="pear_sorbet",t.CITY_WALK="city_walk",t.MOCHA_MOUSSE="mocha_mousse",t.SECTION_DISPLAY_BY_COLOR="mapxus_v7_with_section_v2",t.SECTION_DISPLAY_BY_CATEGORY="mapxus_v7_with_section_v3",t))($t||{});class ur{_buildingSelector;_isEnabled=!0;_position;constructor(e){this._buildingSelector=e}enable(){this._isEnabled=!0,this._buildingSelector.enabled||this._buildingSelector.setVisibility(!0)}disable(){this._isEnabled=!1,this._buildingSelector.enabled&&this._buildingSelector.setVisibility(!1)}setPosition(e,i){this._position=e,this._buildingSelector.changePosition(this._buildingSelector.position,e,i)}get isEnabled(){return this._isEnabled}get position(){return this._position}}class cr{_floorSelector;_isEnabled;_position;constructor(e){this._floorSelector=e,this._position=e.position,this._isEnabled=this._floorSelector.enabled}enable(){this._isEnabled=!0,this._floorSelector.setEnabled(!0)}disable(){this._isEnabled=!1,this._floorSelector.setEnabled(!1)}setPosition(e,i){this._position=e,this._floorSelector.changePosition(this._floorSelector.position,e,i)}setStyle(e){this._floorSelector.setStyle(e)}get isEnabled(){return this._isEnabled}get position(){return this._position}}class hr{_indoor;_isEnabled=!0;constructor(e){this._indoor=e}enable(){this._isEnabled=!0,this._indoor.setAllowBuildingSwitch(!0)}disable(){this._isEnabled=!1,this._indoor.setAllowBuildingSwitch(!1)}get isEnabled(){return this._isEnabled}}class _r{_indoor;_isEnabled=!0;constructor(e){this._indoor=e}enable(){this._isEnabled=!0,this._indoor.setAllowOutdoorSwitch(!0)}disable(){this._isEnabled=!1,this._indoor.setAllowOutdoorSwitch(!1)}get isEnabled(){return this._isEnabled}}class fr{_indoor;_isEnabled=!0;constructor(e){this._indoor=e}enable(){this._isEnabled=!0,this._indoor.setAllowIndoorClickSelect(!0)}disable(){this._isEnabled=!1,this._indoor.setAllowIndoorClickSelect(!1)}get isEnabled(){return this._isEnabled}}class pr{_indoor;_isEnabled=!0;constructor(e){this._indoor=e}enable(){this._isEnabled=!0,this._indoor.setAllowOutdoorClickSelect(!0)}disable(){this._isEnabled=!1,this._indoor.setAllowOutdoorClickSelect(!1)}get isEnabled(){return this._isEnabled}}const Mt="Map_mapClick",At="Map_pointClick",xt="Map_isRenderComplete",Me="Map_isDestroyed",re=D.getInstance();let Qa=class{_map;_indoor;_poi;_floorsControl;_buildingFilterControl;_attributionControl;_language;_dispatch=ve(Mt,At,xt,Me);_fitBounds;_history=X.getInstance();_transformRequestHandler;isDestroyed=!1;switchOutdoor;outdoorClickSelection;switchBuilding;indoorClickSelection;buildingSelector;floorSelector;constructor(e){if(!e.map)throw new $.AuthSdkError("Parameter 'Map' is required!",{type:"ValidationError"});re.registerSDK(),this._permissionCheck().then(()=>this._setup(e)).catch(i=>{const r=i.cause?i.message+" "+i.cause.message:i.message;console.error(r)})}renderComplete(e){const i=ie(`${xt}.`);this._dispatch.on(i,e)}destroyed(e){const i=ie(`${Me}.`);this._dispatch.on(i,()=>{e(),this._dispatch.on(i,null),this._dispatch._[Me].length===0&&(delete this._dispatch,Object.freeze(this))})}setTransformRequest(e){this._transformRequestHandler=e,this._resourceRequestTransform()}getIndoor(){return this._indoor}getMaplibre(){return this._map}get floor(){return this._indoor?.floor??null}get building(){return this._indoor?.building??null}get venue(){return this._indoor?.venue??null}setLanguage(e){if(this._language===e)return;this._language=e;const i=this._map?.getStyle()?.layers||[];for(const{id:r,type:n}of i){if(!this._map.getLayer(r)||n!=="symbol")continue;const s=this._map.getLayoutProperty(r,"text-field");!s||typeof s=="string"||this._map.setLayoutProperty(r,"text-field",["coalesce",["get",`name:${e}`],["get","name"],""])}}getLanguage(){return this._language}setOutdoorMapShown(e){this._indoor?.setOutdoorMapShown(e)}queryIndoorInfoByPoint(e){return this._indoor?.queryIndoorInfoByPoint(e)}queryIndoorFeaturesByPoint(e){const{x:i,y:r}=e,n=this._map.queryRenderedFeatures([i,r],{layers:["mapxus-venue-fill","mapxus-building-line",Ie,T]}),s=n.find(o=>o.layer.id==="mapxus-venue-fill");if(s){const o=this._history.getHistoryOrdinal(s.properties.id),a=n.find(l=>l.properties?.ordinal===o);if(a){if(a.sourceLayer==="mapxus_shared_level")return{venue:s,sharedLevel:a};const l=n.find(d=>d.properties.id===a.properties["ref:building"]);return{venue:s,building:l,level:a}}}return null}getIndoorFeaturesByCoordinates(e,i){const r=this._map.project(e),n=this._map.queryRenderedFeatures(r,{layers:["mapxus-venue-fill","mapxus-building-line","mapxus-level-fill","mapxus-level-fill-overlap-copy"]});if(n.length===0)return{venue:null,building:null,level:null};const o=n.filter(d=>d.layer.id.includes("mapxus-level-fill")).find(d=>Number.isFinite(i)?d.properties.ordinal===i+"":d.layer.id.startsWith("mapxus-level-fill"));if(!o)return{venue:null,building:null,level:null};const a=n.find(d=>d.properties.id===o.properties["ref:building"]);return{venue:n.find(d=>d.properties.id===a.properties["ref:venue"]),building:a,level:o}}getFeaturesById(e,i){return this._indoor?.getFeaturesById(e,i)||[]}async switchFloorByOrdinal(e){await this._indoor?.switchFloorByOrdinal(e)}async selectFloorById(e,i){const{dragPan:r=!0,animate:n=!0,fitBounds:s}=i||{},o=s??this._fitBounds,a=async()=>{const l=await gr(e),{maxLat:d,maxLon:u,minLat:c,minLon:h}=l?.bbox||{};this._indoor.dragPanHandler.setBounds([h,c,u,d])};if(this._indoor.setDragPan(r),this._indoor.setFitBounds(o),this._indoor.dragPanHandler.setAnimated(n),e===this.floor?.id){if(!r)return;o?(this._indoor.dragPanHandler.getBounds()||await a(),await this._indoor.dragPanHandler.fitBounds()):this._indoor.dragPanHandler.panToCenter()}else{let l=!1,d=(this._map.getLayer("mapxus-building-line")?this._map.queryRenderedFeatures({layers:["mapxus-building-line"]}):[]).find(c=>c.properties?.level_ids?.includes(e))??null;if(d&&d.properties?.id===this.building?.properties?.id){o&&!this._indoor.dragPanHandler.getBounds()&&await a();const{level_ids:c,ordinals:h}=d.properties,f=w(c).indexOf(e),g=w(h)[f]??null;await this._floorsControl.switchByOrdinal(g,r)}else{if(d)o&&await a();else{const c=await gr(e),{maxLat:h,maxLon:f,minLat:g,minLon:_}=c.bbox;l=!0,d=c.feature,this._indoor.dragPanHandler.setBounds([_,g,f,h])}await this._indoor.selectBuilding(d??null,{floorId:e,featureIncomplete:l})}}}async selectSharedFloorById(e,i){const{dragPan:r=!0,animate:n=!0,fitBounds:s}=i||{},o=s??this._fitBounds,a=async()=>{const l=await Za(e),{maxLat:d,maxLon:u,minLat:c,minLon:h}=l?.bbox||{};this._indoor.dragPanHandler.setBounds([h,c,u,d])};if(this._indoor.setDragPan(r),this._indoor.setFitBounds(o),this._indoor.dragPanHandler.setAnimated(n),e===this.floor?.id){if(!r)return;o?(this._indoor.dragPanHandler.getBounds()||await a(),await this._indoor.dragPanHandler.fitBounds()):this._indoor.dragPanHandler.panToCenter()}else{let l=!1,d,u;const c=(this._map.getLayer(T)?this._map.queryRenderedFeatures({layers:[T]}):[]).find(h=>h.properties?.id===e)??null;if(c)o&&await a();else{const h=await si(e);u=rt(h),l=!0;const{maxLat:f,maxLon:g,minLat:_,minLon:y}=h?.bbox||{};this._indoor.dragPanHandler.setBounds([y,_,g,f]);const m=h.sharedFloors.find(({id:B})=>B===e),{id:v,name:E,ordinal:C}=m;d={id:v,name:E,ordinal:C+""}}if(!l){const{id:h,name:f,ordinal:g,"ref:venue":_}=c.properties||{};d={id:h,name:typeof f=="string"?{default:f}:f,ordinal:g},u=(this._map.getLayer("mapxus-venue-fill")?this._map.queryRenderedFeatures({layers:["mapxus-venue-fill"]}):[]).find(y=>y.properties?.id===_)??null}d&&u&&await this._indoor?.selectSharedFloor(d,u,{featureIncomplete:l})}}async selectBuildingById(e,i){const{dragPan:r=!0,animate:n=!0,fitBounds:s}=i||{},o=s??this._fitBounds,a=async()=>{const l=await at(e),{maxLat:d,maxLon:u,minLat:c,minLon:h}=l?.bbox||{};this._indoor.dragPanHandler.setBounds([h,c,u,d])};if(this._indoor.setDragPan(r),this._indoor.setFitBounds(o),this._indoor.dragPanHandler.setAnimated(n),e===this.building?.properties?.id){if(!r)return;o?(this._indoor.dragPanHandler.getBounds()||await a(),await this._indoor.dragPanHandler.fitBounds()):this._indoor.dragPanHandler.panToCenter()}else{let l=!1,d=(this._map.getLayer("mapxus-building-line")?this._map.queryRenderedFeatures({layers:["mapxus-building-line"]}):[]).find(u=>u.properties?.id===e)??null;if(d)o&&await a();else{const u=await at(e),{maxLat:c,maxLon:h,minLat:f,minLon:g}=u?.bbox||{};d=zt(u),l=!0,this._indoor.dragPanHandler.setBounds([g,f,h,c])}await this._indoor?.selectBuilding(d,{featureIncomplete:l})}}async selectVenueById(e,i){if(typeof e=="string"&&e.trim()===""||e===null){await this._indoor?.selectBuilding(null);return}const{dragPan:n=!0,animate:s=!0,fitBounds:o}=i||{},a=o??this._fitBounds,l=async()=>{const d=await lt(e),{maxLat:u,maxLon:c,minLat:h,minLon:f}=d?.bbox||{};this._indoor.dragPanHandler.setBounds([f,h,c,u])};if(this._indoor.setDragPan(n),this._indoor.setFitBounds(a),this._indoor.dragPanHandler.setAnimated(s),e===this.venue?.properties?.id){if(!n)return;a?(this._indoor.dragPanHandler.getBounds()||await l(),await this._indoor.dragPanHandler.fitBounds()):this._indoor.dragPanHandler.panToCenter()}else{const d=this._history.getHistoryBuildingUnit(e);if(d){const{id:u,type:c}=d;c==="building"?await this.selectBuildingById(u,i):await this.selectSharedFloorById(u,i)}else{const u=(this._map.getLayer("mapxus-venue-fill")?this._map.queryRenderedFeatures({layers:["mapxus-venue-fill"]}):[]).find(h=>h.properties?.id===e)??null;let c;if(u){const{default_displayed_building:h,building_ids:f}=u.properties;c=h||w(f)[0]}else{const h=await lt(e);c=h.defaultBuilding||h.buildings[0]?.id}await this.selectBuildingById(c,i)}}}onMapClickListener(e){const i=ie(`${Mt}.`);return this._dispatch.on(i,e),{unsubscribe:()=>this._dispatch.on(i,null)}}onPoiClickListener(e){return this._poi?.onPoiClick(e)}onPointClickListener(e){const i=ie(`${At}.`);return this._dispatch.on(i,e),{unsubscribe:()=>this._dispatch.on(i,null)}}onMapChangeListener(e){return this._indoor?.onMapChange(e)}switchTheme(e){this.setTheme(e)}setTheme(e){e!==re.theme&&(this._setStyle(Ot(e),{diff:!1}),re.setTheme(e),this._map?.once("styledata",()=>{this._indoor.updateCustomLayers(),this._indoor.updateRendering()}),"changeTheme"in this._attributionControl&&this._attributionControl.changeTheme(e))}setSelectedBuildingBorderStyle(e){return this._indoor?.setSelectedHighlightStyle(e),this}setSelectedHighlightStyle(e){return this._indoor?.setSelectedHighlightStyle(e),this}setFloorSwitchScope(e){this._indoor?.setFloorSwitchScope(e)}async _setup(e){const{map:i,poiId:r,sharedFloorId:n,floorId:s,buildingId:o,venueId:a,theme:l=$t.MAPXUS_DEFAULT,floorSelectorEnabled:d,buildingSelectorEnabled:u,outdoorMapShown:c=!0,collapseCopyright:h=!1,maskNonSelectedAreas:f=!1,fitBuildingBounds:g,fitBounds:_,boundsPadding:y=30,selectedHighlightStyle:m,floorSelectorStyle:v,language:E=qr,autoSelectBuilding:C=!1,transformRequest:B=null,mapxusLogoEnabled:S=!0,enableIndoorClickSelection:O=!0,enableOutdoorClickSelection:M=!0,floorSwitchScope:P=De.VENUE}=e;this._map=i,this._fitBounds=_??g??!1,this._indoor=new Ji({map:this._map,startWithIndoorView:!!(a||o||s||r||n),outdoorMapShown:c,fitBounds:this._fitBounds,boundsPadding:y,maskNonSelectedAreas:f,selectedHighlightStyle:m,enableIndoorClickSelection:O,enableOutdoorClickSelection:M,floorSwitchScope:P}),this._poi=new ir(this._map),this._transformRequestHandler=B,this._resourceRequestTransform(),this._installRtlTextPlugin(),this._setStyle(Ot(l)),re.setTheme(l),this._checkMapZoom(),h?this._attributionControl=new Wa:(this._attributionControl=new Ya({theme:l}),this._addControl(new Ga({enabled:S}))),this._addControl(this._attributionControl),this._addControl(this._buildingFilterControl=new nr(this,u)),this._addControl(this._floorsControl=new lr(this._indoor,{language:E,style:v,enabled:d})),r?this._selectPoiById(r):s?this.selectFloorById(s,{animate:!1}):o?this.selectBuildingById(o,{animate:!1}):a?this.selectVenueById(a,{animate:!1}):n&&this.selectSharedFloorById(n,{animate:!1}),this.switchOutdoor=new _r(this._indoor),this.switchBuilding=new hr(this._indoor),this.outdoorClickSelection=new pr(this._indoor),this.indoorClickSelection=new fr(this._indoor),this.buildingSelector=new ur(this._buildingFilterControl),this.floorSelector=new cr(this._floorsControl),this._map.once("styledata",()=>this.setLanguage(E)),this._map.on("remove",()=>this._destroy()),this._map.on("error",L=>this._updatePermission(L)),this._indoor.once(It,()=>{C&&this._map.on("moveend",()=>this._selectCenterBuilding()),this._bindMapClickListener(),this._dispatch.call(xt)})}_setStyle(e,i){this._map?.setStyle(e,{localIdeographFontFamily:!1,...i??{}})}_addControl(e,i){this._map.addControl(e,i)}async _selectPoiById(e){try{const i=await Xr(e),{lon:r,lat:n}=i.location;"floorId"in i?await this.selectFloorById(i.floorId,{animate:!1}):"sharedFloorId"in i&&await this.selectSharedFloorById(i.sharedFloorId,{animate:!1}),this._map.panTo([r,n],{animate:!1})}catch(i){this._dispatchErrorGlobal("initError",i)}}_resourceRequestTransform(){this._map.setTransformRequest((e,i)=>{const{host:r}=new URL(e),n=r.includes("map-api")&&r.includes("mapxus"),s=$.getLatestCredentials();return n?{url:e,headers:{"Content-Type":"application/json",sdkVersion:`web-${$.SDKName.MapSDK}/${Ze}`,identifier:s.identifier,token:s.token}}:this._transformRequestHandler?this._transformRequestHandler(e,i):{url:e}})}_checkMapZoom(){const e=this._map.getZoom();(e<8||e>22)&&e>1&&console.warn("Indoor maps perform better at zoom levels [8, 22].")}async _updatePermission(e){if(e.error?.status!==401)return;await $.getToken(),this._resourceRequestTransform();const i=e.error.url;/^https:\/\/[^/]+\/bms\/api\/v\d+\/tiles\/styles\//.test(i)&&re.theme&&this._setStyle(Ot(re.theme))}_selectCenterBuilding(){const e=this._getCenterBuildingUnitsMap();if(!e.size)return;let i=e.entries().next().value[1];const r=this._history.getVisitedBuildingUnits().reverse();for(const n of r){const{id:s}=n;if(e.get(s)){i=n;break}}i.type==="building"?this.selectBuildingById(i.id,{dragPan:!1}):this.selectSharedFloorById(i.id,{dragPan:!1})}_getCenterBuildingUnitsMap(){const e=this._map.getCanvas().getBoundingClientRect(),i=e.width/4,r=e.height/4,n=[i,r],s=[e.width-i,e.height-r],o=["mapxus-building-line",T].filter(u=>this._map.getLayer(u)),a=this._map.queryRenderedFeatures([n,s],{layers:o}),d=Xi(a,"properties.id").filter(u=>!this._indoor.layeredHandler.getHiddenBuildings().includes(u.properties.id));return new globalThis.Map(d.map(u=>{const{properties:c}=u;return[`${c.id}`,{id:c.id,type:c.building?"building":"sharedFloor"}]}))}_bindMapClickListener(){this._map.on("click",async e=>{const{point:i,lngLat:r}=e,n=this._indoor.queryIndoorInfoByPoint(i);await this._indoor.selectByClickMap(n),this._dispatch.call(At,null,{point:i,coordinate:r}),this._dispatch.call(Mt,null,n)})}_dispatchErrorGlobal(e,i){const r=re.getGlobalDispatcher();if(!r)return;const n=i.response?.status||i.status||"unknown",s=i.response?.data?.message||i.message||"unknown";r.call(e,null,{status:n,message:s})}_installRtlTextPlugin(){Nt.getRTLTextPluginStatus()==="unavailable"&&Nt.setRTLTextPlugin("https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.3.0/dist/mapbox-gl-rtl-text.js",!0)}async _permissionCheck(){try{if(!(await $.md5($.SDKName.MapSDK)==="true"))throw new $.AuthSdkError("Permission invalid!",{status:403,type:"PermissionError"});return Promise.resolve()}catch(e){return this._dispatchErrorGlobal("unauthorized",e),this._dispatchErrorGlobal("initError",e),Promise.reject(e)}}_destroy(){if(this.isDestroyed)return;this.isDestroyed=!0;const e=this._dispatch._;for(const i in e)i!==Me&&e.hasOwnProperty(i)&&e[i].forEach(({name:r})=>{this._dispatch.on(`${i}.${r}`,null)});this._indoor.destroy(),this._poi.destroy(),Object.keys(this).forEach(i=>{i!=="isDestroyed"&&i!=="_dispatch"&&delete this[i]}),this._dispatch.call(Me)}};async function gr(t){const e=await Wr(t);return{feature:zt(e),bbox:e.bbox}}async function Za(t){const e=await si(t);return{feature:rt(e),bbox:e.bbox}}async function Ae(t,e){if(!t.hasImage(e))try{const i=await t.loadImage(e);t.addImage(e,i.data)}catch(i){throw new Error(i)}}class Ja{_maplibreMap;_layerId;_sourceId;_imageName="poi-01";_imageSize=.75;_iconAnchor="bottom";constructor(e){this._maplibreMap=e;const i=ie();this._layerId=`MXMap_preset_marker_layer_${i}`,this._sourceId=`MXMap_preset_marker_source_${i}`}async setIcon(e){if(typeof e!="string"||!e.trim())throw new Error("Icon must be a non-empty string.");await Ae(this._maplibreMap,e.trim()),this._imageName=e}setIconSize(e){this._imageSize=e}setIconAnchor(e){this._iconAnchor=e}get layerId(){return this._layerId}get sourceId(){return this._sourceId}create(e){if(!(Array.isArray(e)&&e.length))return;const i=e.map(r=>this._createIconFeature(r));this._addIconSource(i),this._addIconLayer()}updateData(e){const i=!!(e.remove&&e.remove.length),r=!!(e.add&&e.add.length),n=!!(e.update&&e.update.length),s=this._maplibreMap.getSource(this._sourceId);if(!i&&!r&&!n||!s)return;const o={};i&&(o.remove=e.remove),r&&(o.add=e.add.map(a=>this._createIconFeature(a))),n&&(o.update=e.update.map(a=>{const l=this._createIconFeature(a),{id:d,geometry:u,properties:c}=l;return{id:d,...u&&{newGeometry:u},...c&&{addOrUpdateProperties:Object.entries(c).map(([h,f])=>({key:h,value:f}))},...!u&&!c&&{removeAllProperties:!0}}})),s.updateData(o)}remove(){this._maplibreMap.getLayer(this._layerId)&&this._maplibreMap.removeLayer(this._layerId),this._maplibreMap.getSource(this._sourceId)&&this._maplibreMap.removeSource(this._sourceId)}on(e,i){const r=s=>this._handleEventListener(s,i),{unsubscribe:n}=this._maplibreMap.on(e,this._layerId,r);return{off:n}}setFilter(e){this._maplibreMap.getLayer(this._layerId)&&this._maplibreMap.setFilter(this._layerId,e)}setFilterByVenue(e,i){this._maplibreMap.getLayer(this._layerId)&&this._maplibreMap.setFilter(this._layerId,["any",["all",["==",["get","venueId"],e??""],["==",["get","ordinal"],i??""]],["all",["==",["get","venueId"],""],["==",["get","ordinal"],""]]])}setFilterByBuilding(e,i){this._maplibreMap.getLayer(this._layerId)&&this._maplibreMap.setFilter(this._layerId,["any",["all",["==",["get","buildingId"],e??""],["==",["get","ordinal"],i??""]],["all",["==",["get","buildingId"],""],["==",["get","ordinal"],""]]])}setOpacity(e){this._maplibreMap.getLayer(this._layerId)&&this._maplibreMap.setPaintProperty(this._layerId,"icon-opacity",e)}setOpacityByVenue(e,i,r){if(this._maplibreMap.getLayer(this._layerId)){const n=["case",["all",["==",["get","venueId"],e??""],["==",["get","ordinal"],i??""]],1,["all",["==",["get","venueId"],""],["==",["get","ordinal"],""]],1,r??.5];this._maplibreMap.setPaintProperty(this._layerId,"icon-opacity",n)}}setOpacityByBuilding(e,i,r){if(this._maplibreMap.getLayer(this._layerId)){const n=["case",["all",["==",["get","buildingId"],e??""],["==",["get","ordinal"],i??""]],1,["all",["==",["get","buildingId"],""],["==",["get","ordinal"],""]],1,r??.5];this._maplibreMap.setPaintProperty(this._layerId,"icon-opacity",n)}}_createIconFeature(e){const{lngLat:i,properties:r}=e;return{id:"featureId"in e?e.featureId:void 0,type:"Feature",...i&&{geometry:{type:"Point",coordinates:i}},...r&&{properties:r}}}_addIconSource(e){const i={type:"geojson",data:{type:"FeatureCollection",features:e}};this._maplibreMap.addSource(this._sourceId,i)}_addIconLayer(){this._maplibreMap.addLayer({id:this._layerId,type:"symbol",source:this._sourceId,layout:{"icon-image":this._imageName,"icon-size":this._imageSize,"icon-anchor":this._iconAnchor,"icon-allow-overlap":!0,"icon-ignore-placement":!0}})}_handleEventListener(e,i){const{point:r}=e,n=this._maplibreMap.queryRenderedFeatures(r,{layers:[this._layerId]});i(n[0])}}function Ye(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}const Tt={indoorLineColor:"#45b1cc",outdoorLineColor:"#8183ba",dashedLineColor:"#969696",shuttleBusLineColor:"#fb923c",lineWidth:4,dashedLineWidth:4,disableDashedLine:!1,inactiveRouteOpacity:.5,outdoorLineOpacity:1,markerIconSize:.75,markers:{from:"poi-02",to:"poi-01",stops:["waypoint-01"]},lineSymbol:{image:"east-blue-arrow-01",size:.25,spacing:1}},We="mmws-source-line-solid",me="mmws-layer-line-solid",be="mmws-layer-icon-line-symbol",Rt="mmws-source-line-dashed",ne="mmws-layer-line-dashed",kt="mmws-source-icon-connector",yr="mmws-layer-icon-connector",Xe="mmws-source-icon-marker",Dt="mmws-layer-icon-marker",mr=[me,be,ne,yr,Dt],el=[We,Rt,kt,Xe];class tl{_maplibreMap;_routeStyle=Tt;_styleDiffs={};_filterBy="venue";_curVenue=null;_curBuilding=null;_curOrdinal=null;_renderBoundaryLayer;constructor(e,i){this._maplibreMap=e,i&&(this._updateStyleProperties(i),e.on("load",()=>this._loadMarkerIcons()))}async setStyle(e){this._updateStyleProperties(e),await this._loadMarkerIcons(),await this._updateLayers()}async setMarkerIcons(e){if(Array.isArray(e)&&e.length){const i=e.slice(1,e.length-1);this._routeStyle.markers={from:e[0],to:Ye(e),stops:i.length?i:[e[0]]},this._styleDiffs={markers:this._routeStyle.markers}}else"from"in e&&(this._routeStyle.markers.from=e.from,this._styleDiffs.markers.from=e.from),"to"in e&&(this._routeStyle.markers.to=e.to,this._styleDiffs.markers.to=e.to),"stops"in e&&(this._routeStyle.markers.stops=e.stops??[null],this._styleDiffs.markers.stops=e.stops??[null]);await this._loadMarkerIcons()}setMarkerIconSize(e){return this._routeStyle.markerIconSize=e,this}setIndoorLineColor(e){return this._routeStyle.indoorLineColor=e,this}setOutdoorLineColor(e){return this._routeStyle.outdoorLineColor=e,this}setDashedLineColor(e){return this._routeStyle.dashedLineColor=e,this}setBusLineColor(e){return this._routeStyle.shuttleBusLineColor=e,this}render(e,i){if(!this._renderBoundaryLayer){const d=this._maplibreMap.getStyle(),u=tt(d);let c=u.find(({type:h,id:f})=>!f.includes("-overlap-copy")&&h==="fill-extrusion");c||(c=u.find(h=>h.type==="symbol"&&h?.["source-layer"]==="mapxus_place")),this._renderBoundaryLayer=c?.id}const{instructions:r,points:{coordinates:n}}=e,{lineFeatures:s,connectorFeatures:o,dashedLineFeatures:a,markerFeatures:l}=this._classifyFeatures(r,n,i);this._renderSolidLines(s),this._renderLineSymbols(We,be),this._routeStyle.disableDashedLine!==!0&&this._renderDashedLines(a),this._renderConnectors(o),this._renderMarkers(l)}remove(){mr.forEach(e=>{this._maplibreMap.getLayer(e)&&this._maplibreMap.removeLayer(e)}),el.forEach(e=>{this._maplibreMap.getSource(e)&&this._maplibreMap.removeSource(e)})}setFilterByVenue(e,i){this._filterBy="venue",this._curVenue=e??null,this._curOrdinal=i??null,this._filterRouteOpacity()}setFilterByBuilding(e,i){this._filterBy="building",this._curBuilding=e??null,this._curOrdinal=i??null,this._filterRouteOpacity()}_classifyFeatures(e,i,r){const n=[],s=[],o=[],a=[],l=[];e.forEach((M,P)=>{const{venue_id:L,building_id:H,floor_id:A,ordinal:Y,sign:se,type:Se,interval:[Qe,xe]}=M;if(rl(se))l.push(M);else if(il(se)){P!==0&&P!==e.length-1&&s.push(this._createIconFeature(`connector-${s.length}`,i[Qe],{...K({venue_id:L,building_id:H,floor_id:A,ordinal:Y}),icon:Se}));const Ir=e[P+1];if(Ir){const{venue_id:dl,building_id:ul,floor_id:cl,ordinal:hl}=Ir;s.push(this._createIconFeature(`connector-${s.length}`,i[xe],{...K({venue_id:dl,building_id:ul,floor_id:cl,ordinal:hl}),icon:Se}))}}else n.push(this._createLineFeature(`solid-line-${n.length}`,i.slice(Qe,xe+1),K({venue_id:L,building_id:H,floor_id:A,ordinal:Y,isShuttleBus:nl(se)?1:0})))});const d=e[0],{venue_id:u,building_id:c,floor_id:h,ordinal:f}=d,g=e[e.length-1],{venue_id:_,building_id:y,floor_id:m,ordinal:v}=g,E=i[0],C=i[i.length-1],B=r[0],S=r[r.length-1],O=r.slice(1,r.length-1);return B&&o.push(this._createLineFeature(`dashed-line-${o.length}`,[B,E],K({venue_id:u,building_id:c,floor_id:h,ordinal:f}))),S&&o.push(this._createLineFeature(`dashed-line-${o.length}`,[C,S],K({venue_id:_,building_id:y,floor_id:m,ordinal:v}))),l.length&&O.length&&l.forEach(({venue_id:M,building_id:P,floor_id:L,ordinal:H,interval:[A]},Y)=>{o.push(this._createLineFeature(`dashed-line-${o.length}`,[i[A],O[Y]],K({venue_id:M,building_id:P,floor_id:L,ordinal:H}))),a.push(this._createIconFeature(`marker-${a.length}`,O[Y],{...K({venue_id:M,building_id:P,floor_id:L,ordinal:H,markerType:`stops_${Y}`}),icon:this._routeStyle.markers.stops[Y]??Ye(this._routeStyle.markers.stops),iconSize:this._routeStyle.markerIconSize}))}),a.push(this._createIconFeature(`marker-${a.length}`,B??E,{...K({venue_id:u,building_id:c,floor_id:h,ordinal:f,markerType:"from"}),icon:this._routeStyle.markers.from,iconSize:this._routeStyle.markerIconSize})),a.push(this._createIconFeature(`marker-${a.length}`,S??C,{...K({venue_id:_,building_id:y,floor_id:m,ordinal:v,markerType:"to"}),icon:this._routeStyle.markers.to,iconSize:this._routeStyle.markerIconSize})),{lineFeatures:n,connectorFeatures:s,dashedLineFeatures:o,markerFeatures:a}}_createLineFeature(e,i,r){return{id:e,type:"Feature",geometry:{type:"LineString",coordinates:i},properties:r}}_createIconFeature(e,i,r){return{id:e,type:"Feature",geometry:{type:"Point",coordinates:i},properties:r}}_renderSolidLines(e){this._addCollectionSource(We,e),this._addLineLayer(We,me,{"line-color":["case",["==",["get","isShuttleBus"],"1"],this._routeStyle.shuttleBusLineColor,["==",["get","floor_id"],null],this._routeStyle.outdoorLineColor,this._routeStyle.indoorLineColor],"line-opacity":["case",["==",["get","floor_id"],null],this._routeStyle.outdoorLineOpacity,1],"line-width":this._routeStyle.lineWidth})}_renderDashedLines(e){this._addCollectionSource(Rt,e),this._addLineLayer(Rt,ne,{"line-color":this._routeStyle.dashedLineColor,"line-width":this._routeStyle.dashedLineWidth,"line-dasharray":[.1,1.8]})}_renderConnectors(e){this._addCollectionSource(kt,e),this._addIconLayer(kt,yr)}_renderMarkers(e){this._addCollectionSource(Xe,e),this._addIconLayer(Xe,Dt,{"icon-anchor":"bottom","icon-allow-overlap":!0,"icon-ignore-placement":!0})}_addCollectionSource(e,i){this._maplibreMap.addSource(e,{type:"geojson",data:{type:"FeatureCollection",features:i}})}_addLineLayer(e,i,r){this._maplibreMap.addLayer({id:i,type:"line",source:e,layout:{"line-join":"round","line-cap":"round"},paint:{"line-width":4,...r||{}}},this._renderBoundaryLayer)}_renderLineSymbols(e,i){this._maplibreMap.addLayer({id:i,type:"symbol",source:e,layout:{"symbol-placement":"line","symbol-spacing":this._routeStyle.lineSymbol.spacing,"icon-size":this._routeStyle.lineSymbol.size,"icon-image":this._routeStyle.lineSymbol.image},paint:{"icon-opacity":["case",["==",["get","floor_id"],null],this._routeStyle.outdoorLineOpacity,1]}},this._renderBoundaryLayer)}_addIconLayer(e,i,r){this._maplibreMap.addLayer({id:i,type:"symbol",source:e,layout:{"icon-image":["get","icon"],"icon-size":["case",["has","iconSize"],["get","iconSize"],1],...r||{}}})}_updateStyleProperties(e){if(this._styleDiffs=br(this._routeStyle,e??Tt),!e)this._routeStyle=Tt;else if(Object.keys(this._styleDiffs).length){const i={...this._routeStyle.lineSymbol,...this._styleDiffs.lineSymbol??{}},r=this._styleDiffs.markers;let n=this._routeStyle.markers;const s={outdoorLineOpacity:(this._styleDiffs.outdoorLineOpacity>1?1:this._styleDiffs.outdoorLineOpacity<0?0:this._styleDiffs.outdoorLineOpacity)??this._routeStyle.outdoorLineOpacity},o={inactiveRouteOpacity:(this._styleDiffs.inactiveRouteOpacity>1?1:this._styleDiffs.inactiveRouteOpacity<0?0:this._styleDiffs.inactiveRouteOpacity)??this._routeStyle.inactiveRouteOpacity};r&&Object.keys(r).length&&(n={...n,...r}),this._routeStyle={...this._routeStyle,...this._styleDiffs,...s,...o,markers:n,lineSymbol:i}}}async _loadMarkerIcons(){const{markers:e,lineSymbol:i}=this._styleDiffs;if(i?.image&&await Ae(this._maplibreMap,i.image),e&&Object.keys(e).length){const{from:r,to:n,stops:s}=e;if(r&&await Ae(this._maplibreMap,r),n&&await Ae(this._maplibreMap,n),s&&s.length){const o=s.filter(a=>!!a);o.length&&await Promise.all(o.map(a=>Ae(this._maplibreMap,a)))}}}async _updateLayers(){if(!this._maplibreMap.getLayer(me))return;const{indoorLineColor:e,outdoorLineColor:i,dashedLineColor:r,shuttleBusLineColor:n,lineWidth:s,dashedLineWidth:o,disableDashedLine:a,inactiveRouteOpacity:l,outdoorLineOpacity:d,markerIconSize:u,markers:c,lineSymbol:h}=this._styleDiffs;if((e||i||n)&&this._maplibreMap.setPaintProperty(me,"line-color",["case",["==",["get","isShuttleBus"],"1"],this._routeStyle.shuttleBusLineColor,["==",["get","floor_id"],null],this._routeStyle.outdoorLineColor,this._routeStyle.indoorLineColor]),s!==void 0&&s+""&&this._maplibreMap.setPaintProperty(me,"line-width",s),typeof a=="boolean"?a?this._maplibreMap.setPaintProperty(ne,"line-color","transparent"):(this._maplibreMap.setPaintProperty(ne,"line-color",this._routeStyle.dashedLineColor),this._maplibreMap.setPaintProperty(ne,"line-width",this._routeStyle.dashedLineWidth)):this._routeStyle.disableDashedLine!==!0&&(r&&this._maplibreMap.setPaintProperty(ne,"line-color",r),o!==void 0&&o+""&&this._maplibreMap.setPaintProperty(ne,"line-width",o)),l!==void 0&&l+""&&this._filterRouteOpacity(),u!==void 0&&u+""&&this._maplibreMap.setLayoutProperty(Dt,"icon-size",u),c&&Object.keys(c).length){const{from:f,to:g,stops:_}=c,y=this._maplibreMap.getSource(Xe),m=await y.getData();m.features=m.features.map(v=>{const{markerType:E}=v.properties;if(f!==void 0&&E==="from"&&(v.properties.icon=f),g!==void 0&&E==="to"&&(v.properties.icon=g),_&&E.includes("stops")){const C=parseInt(E.split("_")[1]);v.properties.icon=_[C]??Ye(_)}return v}),y.setData(m)}if(h){const{image:f,size:g,spacing:_}=h;f!==void 0&&this._maplibreMap.setLayoutProperty(be,"icon-image",f),g!==void 0&&g+""&&this._maplibreMap.setLayoutProperty(be,"icon-size",g),_!==void 0&&_+""&&this._maplibreMap.setLayoutProperty(be,"symbol-spacing",_)}d!==void 0&&d+""&&(this._maplibreMap.setPaintProperty(me,"line-opacity",["case",["==",["get","floor_id"],null],d,1]),this._maplibreMap.setPaintProperty(be,"icon-opacity",["case",["==",["get","floor_id"],null],d,1]),this._filterRouteOpacity())}_filterRouteOpacity(){let e;switch(this._filterBy){case"venue":e=["case",["all",["==",["get","ordinal"],this._curOrdinal??""],["==",["get","venue_id"],this._curVenue??""]],1,["==",["get","floor_id"],null],this._routeStyle.outdoorLineOpacity,this._routeStyle.inactiveRouteOpacity];break;case"building":e=["case",["all",["==",["get","ordinal"],this._curOrdinal??""],["==",["get","building_id"],this._curBuilding??""]],1,["==",["get","floor_id"],null],this._routeStyle.outdoorLineOpacity,this._routeStyle.inactiveRouteOpacity];break}mr.forEach(i=>{this._maplibreMap.getLayer(i)&&this._maplibreMap.setPaintProperty(i,i.includes("layer-line")?"line-opacity":"icon-opacity",e)})}}function K(t){return Object.fromEntries(Object.entries(t).map(([e,i])=>[e,Number.isFinite(i)?i+"":i]))}function il(t){return t===100||t===-100}function rl(t){return t===5}function nl(t){return ar(t,104,108)}function br(t,e){const i={};for(const r in e){const n=t[r],s=e[r];if(r==="markers"||r==="lineSymbol")if(Array.isArray(s)){const o=s.slice(1,s.length-1);i[r]={from:s[0],to:Ye(s),stops:o.length?o:[s[0]]}}else{const o=br(n,s);Object.keys(o).length&&(i[r]=o)}else s+""!=n+""&&(i[r]=r==="stops"?s??[null]:s)}return i}var Ht=(t=>(t.FOOT="foot",t.WHEELCHAIR="wheelchair",t.ESCALATOR="escalator",t.EMERGENCY="emergency",t))(Ht||{});const sl=D.getInstance();class ol{constructor(){}async search(e){const{points:i,vehicle:r=Ht.FOOT,locale:n="en"}=e;if(!(i&&i.length>1&&i.length<6))throw new Error("Parameter error. It must be 1 < {points.length} < 6");if(al(i))throw new Error("Parameter error. Points must have lat and lon.");return(await sl.getHttpSession()).request(Er,{method:"POST",body:JSON.stringify({points:i,vehicle:r,locale:n})})}}function al(t){return t.some(e=>!e||typeof e.lat!="number"||typeof e.lon!="number")}const Sr=D.getInstance();class ll{constructor(){}async searchCategories(e){const i=new URLSearchParams;if("floorId"in e&&b(e.floorId)?i.set("floorId",e.floorId):"buildingId"in e&&b(e.buildingId)?i.set("buildingId",e.buildingId):"sharedFloorId"in e&&b(e.sharedFloorId)?i.set("sharedFloorId",e.sharedFloorId):"venueId"in e&&b(e.venueId)&&i.set("venueId",e.venueId),"bounds"in e&&le(e.bounds)&&(i.set("bbox",e.bounds.flat().join()),b(e.keywords)&&i.set("keywords",e.keywords)),i.toString().length===0)throw new Error("At least one of 'floorId', 'buildingId', 'sharedFloorId', 'venueId', or 'bounds' must be provided.");const r=`${jt}?${i.toString()}`;return(await Sr.getHttpSession()).request(r)}async searchCategoryTrees(e){return(await Sr.getHttpSession()).request(`${Fr}?featureType=${e}`)}}var vr=(t=>(t.Poi="POI",t))(vr||{});p.ASSISTANT_LAYER_INDOOR_FLOORS=Ie,p.ASSISTANT_LAYER_SHARED_FLOORS=T,p.BuildingFilterControl=nr,p.BuildingSelectorHandler=ur,p.BuildingsService=ii,p.CategoryService=ll,p.DistanceSearchType=Wt,p.ERRORS=Vt,p.FeatureType=vr,p.FloorSelectorHandler=cr,p.FloorSwitchScope=De,p.FloorsControl=lr,p.Indoor=Ji,p.IndoorClickSelection=fr,p.Map=Qa,p.Marker=Ja,p.OFFSET=R,p.OrientationDistanceSearchType=nt,p.OutdoorClickSelection=pr,p.PAGE=k,p.Poi=ir,p.PoisOrderBy=Xt,p.PoisService=Zt,p.PoisSortBy=Qt,p.PresetLanguage=x,p.RoutePainter=tl,p.RouteService=ol,p.SwitchBuildingHandler=hr,p.SwitchOutdoorHandler=_r,p.ThemeType=$t,p.VERSION=Ze,p.VehicleType=Ht,p.VenuesService=ei,p.convertBrowserLangToPresetLang=Gt,p.omittedBuildingProps=ti,p.omittedPoiProps=st,p.omittedVenueKeys=Jt,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})}));
|
|
10
|
+
`}function Ot(t){return`${Re}/${Cr}/${t}`}var $t=(t=>(t.CHRISTMAS="christmas_mims2_v1",t.HALLOWEEN="halloween_mims2_v1",t.MAPPY_BEE="mappybee_mims2_v2",t.MAPXUS="mapxus_mims2_v1",t.LANDS_D="lands_d_mims2_v1",t.COMMON="common_mims2_v1",t.MAPXUS_V2="mapxus_v2",t.MAPXUS_DEFAULT="mapxus_v8",t.ROSE_TEA="rose_tea",t.PEAR_SORBET="pear_sorbet",t.CITY_WALK="city_walk",t.MOCHA_MOUSSE="mocha_mousse",t.SECTION_DISPLAY_BY_COLOR="mapxus_v7_with_section_v2",t.SECTION_DISPLAY_BY_CATEGORY="mapxus_v7_with_section_v3",t))($t||{});class cr{_buildingSelector;_isEnabled=!0;_position;constructor(e){this._buildingSelector=e}enable(){this._isEnabled=!0,this._buildingSelector.enabled||this._buildingSelector.setVisibility(!0)}disable(){this._isEnabled=!1,this._buildingSelector.enabled&&this._buildingSelector.setVisibility(!1)}setPosition(e,i){this._position=e,this._buildingSelector.changePosition(this._buildingSelector.position,e,i)}get isEnabled(){return this._isEnabled}get position(){return this._position}}class hr{_floorSelector;_isEnabled;_position;constructor(e){this._floorSelector=e,this._position=e.position,this._isEnabled=this._floorSelector.enabled}enable(){this._isEnabled=!0,this._floorSelector.setEnabled(!0)}disable(){this._isEnabled=!1,this._floorSelector.setEnabled(!1)}setPosition(e,i){this._position=e,this._floorSelector.changePosition(this._floorSelector.position,e,i)}setStyle(e){this._floorSelector.setStyle(e)}get isEnabled(){return this._isEnabled}get position(){return this._position}}class _r{_indoor;_isEnabled=!0;constructor(e){this._indoor=e}enable(){this._isEnabled=!0,this._indoor.setAllowBuildingSwitch(!0)}disable(){this._isEnabled=!1,this._indoor.setAllowBuildingSwitch(!1)}get isEnabled(){return this._isEnabled}}class fr{_indoor;_isEnabled=!0;constructor(e){this._indoor=e}enable(){this._isEnabled=!0,this._indoor.setAllowOutdoorSwitch(!0)}disable(){this._isEnabled=!1,this._indoor.setAllowOutdoorSwitch(!1)}get isEnabled(){return this._isEnabled}}class pr{_indoor;_isEnabled=!0;constructor(e){this._indoor=e}enable(){this._isEnabled=!0,this._indoor.setAllowIndoorClickSelect(!0)}disable(){this._isEnabled=!1,this._indoor.setAllowIndoorClickSelect(!1)}get isEnabled(){return this._isEnabled}}class gr{_indoor;_isEnabled=!0;constructor(e){this._indoor=e}enable(){this._isEnabled=!0,this._indoor.setAllowOutdoorClickSelect(!0)}disable(){this._isEnabled=!1,this._indoor.setAllowOutdoorClickSelect(!1)}get isEnabled(){return this._isEnabled}}const At="Map_mapClick",Mt="Map_pointClick",xt="Map_isRenderComplete",Ae="Map_isDestroyed",re=D.getInstance();let tl=class{_map;_indoor;_poi;_floorsControl;_buildingFilterControl;_attributionControl;_language;_dispatch=Se(At,Mt,xt,Ae);_fitBounds;_history=W.getInstance();_transformRequestHandler;isDestroyed=!1;switchOutdoor;outdoorClickSelection;switchBuilding;indoorClickSelection;buildingSelector;floorSelector;constructor(e){if(!e.map)throw new A.AuthSdkError("Parameter 'Map' is required!",{type:"ValidationError"});re.registerSDK(),this._permissionCheck().then(()=>this._setup(e)).catch(i=>{const r=i.cause?i.message+" "+i.cause.message:i.message;console.error(r)})}renderComplete(e){const i=ie(`${xt}.`);this._dispatch.on(i,e)}destroyed(e){const i=ie(`${Ae}.`);this._dispatch.on(i,()=>{e(),this._dispatch.on(i,null),this._dispatch._[Ae].length===0&&(delete this._dispatch,Object.freeze(this))})}setTransformRequest(e){this._transformRequestHandler=e,this._resourceRequestTransform()}getIndoor(){return this._indoor}getMaplibre(){return this._map}get floor(){return this._indoor?.floor??null}get building(){return this._indoor?.building??null}get venue(){return this._indoor?.venue??null}setLanguage(e){if(this._language===e)return;this._language=e;const i=this._map?.getStyle()?.layers||[];for(const{id:r,type:n}of i){if(!this._map.getLayer(r)||n!=="symbol")continue;const s=this._map.getLayoutProperty(r,"text-field");!s||typeof s=="string"||this._map.setLayoutProperty(r,"text-field",["coalesce",["get",`name:${e}`],["get","name"],""])}}getLanguage(){return this._language}setOutdoorMapShown(e){this._indoor?.setOutdoorMapShown(e)}queryIndoorInfoByPoint(e){return this._indoor?.queryIndoorInfoByPoint(e)}queryIndoorFeaturesByPoint(e){const{x:i,y:r}=e,n=this._map.queryRenderedFeatures([i,r],{layers:["mapxus-venue-fill","mapxus-building-line",Ie,T]}),s=n.find(o=>o.layer.id==="mapxus-venue-fill");if(s){const o=this._history.getHistoryOrdinal(s.properties.id),a=n.find(l=>l.properties?.ordinal===o);if(a){if(a.sourceLayer==="mapxus_shared_level")return{venue:s,sharedLevel:a};const l=n.find(d=>d.properties.id===a.properties["ref:building"]);return{venue:s,building:l,level:a}}}return null}getIndoorFeaturesByCoordinates(e,i){const r=this._map.project(e),n=this._map.queryRenderedFeatures(r,{layers:["mapxus-venue-fill","mapxus-building-line","mapxus-level-fill","mapxus-level-fill-overlap-copy"]});if(n.length===0)return{venue:null,building:null,level:null};const o=n.filter(d=>d.layer.id.includes("mapxus-level-fill")).find(d=>Number.isFinite(i)?d.properties.ordinal===i+"":d.layer.id.startsWith("mapxus-level-fill"));if(!o)return{venue:null,building:null,level:null};const a=n.find(d=>d.properties.id===o.properties["ref:building"]);return{venue:n.find(d=>d.properties.id===a.properties["ref:venue"]),building:a,level:o}}getFeaturesById(e,i){return this._indoor?.getFeaturesById(e,i)||[]}async switchFloorByOrdinal(e){await this._indoor?.switchFloorByOrdinal(e)}async selectFloorById(e,i){const{dragPan:r=!0,animate:n=!0,fitBounds:s}=i||{},o=s??this._fitBounds,a=async()=>{const l=await yr(e),{maxLat:d,maxLon:u,minLat:c,minLon:h}=l?.bbox||{};this._indoor.dragPanHandler.setBounds([h,c,u,d])};if(this._indoor.setDragPan(r),this._indoor.setFitBounds(o),this._indoor.dragPanHandler.setAnimated(n),e===this.floor?.id){if(!r)return;o?(this._indoor.dragPanHandler.getBounds()||await a(),await this._indoor.dragPanHandler.fitBounds()):this._indoor.dragPanHandler.panToCenter()}else{let l=!1,d=(this._map.getLayer("mapxus-building-line")?this._map.queryRenderedFeatures({layers:["mapxus-building-line"]}):[]).find(c=>c.properties?.level_ids?.includes(e))??null;if(d&&d.properties?.id===this.building?.properties?.id){o&&!this._indoor.dragPanHandler.getBounds()&&await a();const{level_ids:c,ordinals:h}=d.properties,f=w(c).indexOf(e),g=w(h)[f]??null;await this._floorsControl.switchByOrdinal(g,r)}else{if(d)o&&await a();else{const c=await yr(e),{maxLat:h,maxLon:f,minLat:g,minLon:_}=c.bbox;l=!0,d=c.feature,this._indoor.dragPanHandler.setBounds([_,g,f,h])}await this._indoor.selectBuilding(d??null,{floorId:e,featureIncomplete:l})}}}async selectSharedFloorById(e,i){const{dragPan:r=!0,animate:n=!0,fitBounds:s}=i||{},o=s??this._fitBounds,a=async()=>{const l=await il(e),{maxLat:d,maxLon:u,minLat:c,minLon:h}=l?.bbox||{};this._indoor.dragPanHandler.setBounds([h,c,u,d])};if(this._indoor.setDragPan(r),this._indoor.setFitBounds(o),this._indoor.dragPanHandler.setAnimated(n),e===this.floor?.id){if(!r)return;o?(this._indoor.dragPanHandler.getBounds()||await a(),await this._indoor.dragPanHandler.fitBounds()):this._indoor.dragPanHandler.panToCenter()}else{let l=!1,d,u;const c=(this._map.getLayer(T)?this._map.queryRenderedFeatures({layers:[T]}):[]).find(h=>h.properties?.id===e)??null;if(c)o&&await a();else{const h=await oi(e);u=rt(h),l=!0;const{maxLat:f,maxLon:g,minLat:_,minLon:y}=h?.bbox||{};this._indoor.dragPanHandler.setBounds([y,_,g,f]);const m=h.sharedFloors.find(({id:B})=>B===e),{id:v,name:E,ordinal:O}=m;d={id:v,name:E,ordinal:O+""}}if(!l){const{id:h,name:f,ordinal:g,"ref:venue":_}=c.properties||{};d={id:h,name:typeof f=="string"?{default:f}:f,ordinal:g},u=(this._map.getLayer("mapxus-venue-fill")?this._map.queryRenderedFeatures({layers:["mapxus-venue-fill"]}):[]).find(y=>y.properties?.id===_)??null}d&&u&&await this._indoor?.selectSharedFloor(d,u,{featureIncomplete:l})}}async selectBuildingById(e,i){const{dragPan:r=!0,animate:n=!0,fitBounds:s}=i||{},o=s??this._fitBounds,a=async()=>{const l=await at(e),{maxLat:d,maxLon:u,minLat:c,minLon:h}=l?.bbox||{};this._indoor.dragPanHandler.setBounds([h,c,u,d])};if(this._indoor.setDragPan(r),this._indoor.setFitBounds(o),this._indoor.dragPanHandler.setAnimated(n),e===this.building?.properties?.id){if(!r)return;o?(this._indoor.dragPanHandler.getBounds()||await a(),await this._indoor.dragPanHandler.fitBounds()):this._indoor.dragPanHandler.panToCenter()}else{let l=!1,d=(this._map.getLayer("mapxus-building-line")?this._map.queryRenderedFeatures({layers:["mapxus-building-line"]}):[]).find(u=>u.properties?.id===e)??null;if(d)o&&await a();else{const u=await at(e),{maxLat:c,maxLon:h,minLat:f,minLon:g}=u?.bbox||{};d=Gt(u),l=!0,this._indoor.dragPanHandler.setBounds([g,f,h,c])}await this._indoor?.selectBuilding(d,{featureIncomplete:l})}}async selectVenueById(e,i){if(typeof e=="string"&&e.trim()===""||e===null){await this._indoor?.selectBuilding(null);return}const{dragPan:n=!0,animate:s=!0,fitBounds:o}=i||{},a=o??this._fitBounds,l=async()=>{const d=await lt(e),{maxLat:u,maxLon:c,minLat:h,minLon:f}=d?.bbox||{};this._indoor.dragPanHandler.setBounds([f,h,c,u])};if(this._indoor.setDragPan(n),this._indoor.setFitBounds(a),this._indoor.dragPanHandler.setAnimated(s),e===this.venue?.properties?.id){if(!n)return;a?(this._indoor.dragPanHandler.getBounds()||await l(),await this._indoor.dragPanHandler.fitBounds()):this._indoor.dragPanHandler.panToCenter()}else{const d=this._history.getHistoryBuildingUnit(e);if(d){const{id:u,type:c}=d;c==="building"?await this.selectBuildingById(u,i):await this.selectSharedFloorById(u,i)}else{const u=(this._map.getLayer("mapxus-venue-fill")?this._map.queryRenderedFeatures({layers:["mapxus-venue-fill"]}):[]).find(h=>h.properties?.id===e)??null;let c;if(u){const{default_displayed_building:h,building_ids:f}=u.properties;c=h||w(f)[0]}else{const h=await lt(e);c=h.defaultBuilding||h.buildings[0]?.id}await this.selectBuildingById(c,i)}}}onMapClickListener(e){const i=ie(`${At}.`);return this._dispatch.on(i,e),{unsubscribe:()=>this._dispatch.on(i,null)}}onPoiClickListener(e){return this._poi?.onPoiClick(e)}onPointClickListener(e){const i=ie(`${Mt}.`);return this._dispatch.on(i,e),{unsubscribe:()=>this._dispatch.on(i,null)}}onMapChangeListener(e){return this._indoor?.onMapChange(e)}switchTheme(e){this.setTheme(e)}setTheme(e){e!==re.theme&&(this._setStyle(Ot(e),{diff:!1}),re.setTheme(e),this._map?.once("styledata",()=>{this._indoor.updateCustomLayers(),this._indoor.updateRendering()}),"changeTheme"in this._attributionControl&&this._attributionControl.changeTheme(e))}setSelectedBuildingBorderStyle(e){return this._indoor?.setSelectedHighlightStyle(e),this}setSelectedHighlightStyle(e){return this._indoor?.setSelectedHighlightStyle(e),this}setFloorSwitchScope(e){this._indoor?.setFloorSwitchScope(e)}async _setup(e){const{map:i,poiId:r,sharedFloorId:n,floorId:s,buildingId:o,venueId:a,theme:l=$t.MAPXUS_DEFAULT,floorSelectorEnabled:d,buildingSelectorEnabled:u,outdoorMapShown:c=!0,collapseCopyright:h=!1,maskNonSelectedAreas:f=!1,fitBuildingBounds:g,fitBounds:_,boundsPadding:y=30,selectedHighlightStyle:m,floorSelectorStyle:v,language:E=Yr,autoSelectBuilding:O=!1,transformRequest:B=null,mapxusLogoEnabled:S=!0,enableIndoorClickSelection:$=!0,enableOutdoorClickSelection:M=!0,floorSwitchScope:P=De.VENUE}=e;this._map=i,this._fitBounds=_??g??!1,this._indoor=new er({map:this._map,startWithIndoorView:!!(a||o||s||r||n),outdoorMapShown:c,fitBounds:this._fitBounds,boundsPadding:y,maskNonSelectedAreas:f,selectedHighlightStyle:m,enableIndoorClickSelection:$,enableOutdoorClickSelection:M,floorSwitchScope:P}),this._poi=new rr(this._map),this._transformRequestHandler=B,this._resourceRequestTransform(),this._installRtlTextPlugin(),this._setStyle(Ot(l)),re.setTheme(l),this._checkMapZoom(),h?this._attributionControl=new Ja:(this._attributionControl=new Za({theme:l}),this._addControl(new Xa({enabled:S}))),this._addControl(this._attributionControl),this._addControl(this._buildingFilterControl=new sr(this,u)),this._addControl(this._floorsControl=new dr(this._indoor,{language:E,style:v,enabled:d})),r?this._selectPoiById(r):s?this.selectFloorById(s,{animate:!1}):o?this.selectBuildingById(o,{animate:!1}):a?this.selectVenueById(a,{animate:!1}):n&&this.selectSharedFloorById(n,{animate:!1}),this.switchOutdoor=new fr(this._indoor),this.switchBuilding=new _r(this._indoor),this.outdoorClickSelection=new gr(this._indoor),this.indoorClickSelection=new pr(this._indoor),this.buildingSelector=new cr(this._buildingFilterControl),this.floorSelector=new hr(this._floorsControl),this._map.once("styledata",()=>this.setLanguage(E)),this._map.on("remove",()=>this._destroy()),this._map.on("error",L=>this._updatePermission(L)),this._indoor.once(It,()=>{O&&this._map.on("moveend",()=>this._selectCenterBuilding()),this._bindMapClickListener(),this._dispatch.call(xt)})}_setStyle(e,i){this._map?.setStyle(e,{localIdeographFontFamily:!1,...i??{}})}_addControl(e,i){this._map.addControl(e,i)}async _selectPoiById(e){try{const i=await en(e),{lon:r,lat:n}=i.location;"floorId"in i?await this.selectFloorById(i.floorId,{animate:!1}):"sharedFloorId"in i&&await this.selectSharedFloorById(i.sharedFloorId,{animate:!1}),this._map.panTo([r,n],{animate:!1})}catch(i){this._dispatchErrorGlobal("initError",i)}}_resourceRequestTransform(){this._map.setTransformRequest((e,i)=>{const{host:r}=new URL(e),n=r.includes("map-api")&&r.includes("mapxus"),s=A.getLatestCredentials();return n?{url:e,headers:{"Content-Type":"application/json",sdkVersion:`web-${A.SDKName.MapSDK}/${Ze}`,identifier:s.identifier,token:s.token}}:this._transformRequestHandler?this._transformRequestHandler(e,i):{url:e}})}_checkMapZoom(){const e=this._map.getZoom();(e<8||e>22)&&e>1&&console.warn("Indoor maps perform better at zoom levels [8, 22].")}async _updatePermission(e){if(e.error?.status!==401)return;await A.getToken(),this._resourceRequestTransform();const i=e.error.url;/^https:\/\/[^/]+\/bms\/api\/v\d+\/tiles\/styles\//.test(i)&&re.theme&&this._setStyle(Ot(re.theme))}_selectCenterBuilding(){const e=this._getCenterBuildingUnitsMap();if(!e.size)return;let i=e.entries().next().value[1];const r=this._history.getVisitedBuildingUnits().reverse();for(const n of r){const{id:s}=n;if(e.get(s)){i=n;break}}i.type==="building"?this.selectBuildingById(i.id,{dragPan:!1}):this.selectSharedFloorById(i.id,{dragPan:!1})}_getCenterBuildingUnitsMap(){const e=this._map.getCanvas().getBoundingClientRect(),i=e.width/4,r=e.height/4,n=[i,r],s=[e.width-i,e.height-r],o=["mapxus-building-line",T].filter(u=>this._map.getLayer(u)),a=this._map.queryRenderedFeatures([n,s],{layers:o}),d=Qi(a,"properties.id").filter(u=>!this._indoor.layeredHandler.getHiddenBuildings().includes(u.properties.id));return new globalThis.Map(d.map(u=>{const{properties:c}=u;return[`${c.id}`,{id:c.id,type:c.building?"building":"sharedFloor"}]}))}_bindMapClickListener(){this._map.on("click",async e=>{const{point:i,lngLat:r}=e,n=this._indoor.queryIndoorInfoByPoint(i);await this._indoor.selectByClickMap(n),this._dispatch.call(Mt,null,{point:i,coordinate:r}),this._dispatch.call(At,null,n)})}_dispatchErrorGlobal(e,i){const r=re.getGlobalDispatcher();if(!r)return;const n=i.response?.status||i.status||"unknown",s=i.response?.data?.message||i.message||"unknown";r.call(e,null,{status:n,message:s})}_installRtlTextPlugin(){Nt.getRTLTextPluginStatus()==="unavailable"&&Nt.setRTLTextPlugin("https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.3.0/dist/mapbox-gl-rtl-text.js",!0)}async _permissionCheck(){try{if(!(await A.md5(A.SDKName.MapSDK)==="true"))throw new A.AuthSdkError("Permission invalid!",{status:403,type:"PermissionError"});return Promise.resolve()}catch(e){return this._dispatchErrorGlobal("unauthorized",e),this._dispatchErrorGlobal("initError",e),Promise.reject(e)}}_destroy(){if(this.isDestroyed)return;this.isDestroyed=!0;const e=this._dispatch._;for(const i in e)i!==Ae&&e.hasOwnProperty(i)&&e[i].forEach(({name:r})=>{this._dispatch.on(`${i}.${r}`,null)});this._indoor.destroy(),this._poi.destroy(),Object.keys(this).forEach(i=>{i!=="isDestroyed"&&i!=="_dispatch"&&delete this[i]}),this._dispatch.call(Ae)}};async function yr(t){const e=await Jr(t);return{feature:Gt(e),bbox:e.bbox}}async function il(t){const e=await oi(t);return{feature:rt(e),bbox:e.bbox}}async function Me(t,e){if(!t.hasImage(e))try{const i=await t.loadImage(e);t.addImage(e,i.data)}catch(i){throw new Error(i)}}class rl{_maplibreMap;_layerId;_sourceId;_imageName="poi-01";_imageSize=.75;_iconAnchor="bottom";constructor(e){this._maplibreMap=e;const i=ie();this._layerId=`MXMap_preset_marker_layer_${i}`,this._sourceId=`MXMap_preset_marker_source_${i}`}async setIcon(e){if(typeof e!="string"||!e.trim())throw new Error("Icon must be a non-empty string.");await Me(this._maplibreMap,e.trim()),this._imageName=e}setIconSize(e){this._imageSize=e}setIconAnchor(e){this._iconAnchor=e}get layerId(){return this._layerId}get sourceId(){return this._sourceId}create(e){if(!(Array.isArray(e)&&e.length))return;const i=e.map(r=>this._createIconFeature(r));this._addIconSource(i),this._addIconLayer()}updateData(e){const i=!!(e.remove&&e.remove.length),r=!!(e.add&&e.add.length),n=!!(e.update&&e.update.length),s=this._maplibreMap.getSource(this._sourceId);if(!i&&!r&&!n||!s)return;const o={};i&&(o.remove=e.remove),r&&(o.add=e.add.map(a=>this._createIconFeature(a))),n&&(o.update=e.update.map(a=>{const l=this._createIconFeature(a),{id:d,geometry:u,properties:c}=l;return{id:d,...u&&{newGeometry:u},...c&&{addOrUpdateProperties:Object.entries(c).map(([h,f])=>({key:h,value:f}))},...!u&&!c&&{removeAllProperties:!0}}})),s.updateData(o)}remove(){this._maplibreMap.getLayer(this._layerId)&&this._maplibreMap.removeLayer(this._layerId),this._maplibreMap.getSource(this._sourceId)&&this._maplibreMap.removeSource(this._sourceId)}on(e,i){const r=s=>this._handleEventListener(s,i),{unsubscribe:n}=this._maplibreMap.on(e,this._layerId,r);return{off:n}}setFilter(e){this._maplibreMap.getLayer(this._layerId)&&this._maplibreMap.setFilter(this._layerId,e)}setFilterByVenue(e,i){this._maplibreMap.getLayer(this._layerId)&&this._maplibreMap.setFilter(this._layerId,["any",["all",["==",["get","venueId"],e??""],["==",["get","ordinal"],i??""]],["all",["==",["get","venueId"],""],["==",["get","ordinal"],""]]])}setFilterByBuilding(e,i){this._maplibreMap.getLayer(this._layerId)&&this._maplibreMap.setFilter(this._layerId,["any",["all",["==",["get","buildingId"],e??""],["==",["get","ordinal"],i??""]],["all",["==",["get","buildingId"],""],["==",["get","ordinal"],""]]])}setOpacity(e){this._maplibreMap.getLayer(this._layerId)&&this._maplibreMap.setPaintProperty(this._layerId,"icon-opacity",e)}setOpacityByVenue(e,i,r){if(this._maplibreMap.getLayer(this._layerId)){const n=["case",["all",["==",["get","venueId"],e??""],["==",["get","ordinal"],i??""]],1,["all",["==",["get","venueId"],""],["==",["get","ordinal"],""]],1,r??.5];this._maplibreMap.setPaintProperty(this._layerId,"icon-opacity",n)}}setOpacityByBuilding(e,i,r){if(this._maplibreMap.getLayer(this._layerId)){const n=["case",["all",["==",["get","buildingId"],e??""],["==",["get","ordinal"],i??""]],1,["all",["==",["get","buildingId"],""],["==",["get","ordinal"],""]],1,r??.5];this._maplibreMap.setPaintProperty(this._layerId,"icon-opacity",n)}}_createIconFeature(e){const{lngLat:i,properties:r}=e;return{id:"featureId"in e?e.featureId:void 0,type:"Feature",...i&&{geometry:{type:"Point",coordinates:i}},...r&&{properties:r}}}_addIconSource(e){const i={type:"geojson",data:{type:"FeatureCollection",features:e}};this._maplibreMap.addSource(this._sourceId,i)}_addIconLayer(){this._maplibreMap.addLayer({id:this._layerId,type:"symbol",source:this._sourceId,layout:{"icon-image":this._imageName,"icon-size":this._imageSize,"icon-anchor":this._iconAnchor,"icon-allow-overlap":!0,"icon-ignore-placement":!0}})}_handleEventListener(e,i){const{point:r}=e,n=this._maplibreMap.queryRenderedFeatures(r,{layers:[this._layerId]});i(n[0])}}function Ye(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}const Tt={indoorLineColor:"#45b1cc",outdoorLineColor:"#8183ba",dashedLineColor:"#969696",shuttleBusLineColor:"#fb923c",lineWidth:4,dashedLineWidth:4,disableDashedLine:!1,inactiveRouteOpacity:.5,outdoorLineOpacity:1,markerIconSize:.75,markers:{from:"poi-02",to:"poi-01",stops:["waypoint-01"]},lineSymbol:{image:"east-blue-arrow-01",size:.25,spacing:1}},We="mmws-source-line-solid",ye="mmws-layer-line-solid",me="mmws-layer-icon-line-symbol",Rt="mmws-source-line-dashed",ne="mmws-layer-line-dashed",kt="mmws-source-icon-connector",mr="mmws-layer-icon-connector",Xe="mmws-source-icon-marker",Dt="mmws-layer-icon-marker",br=[ye,me,ne,mr,Dt],nl=[We,Rt,kt,Xe];class sl{_maplibreMap;_routeStyle=Tt;_styleDiffs={};_filterBy="venue";_curVenue=null;_curBuilding=null;_curOrdinal=null;_renderBoundaryLayer;constructor(e,i){this._maplibreMap=e,i&&(this._updateStyleProperties(i),e.on("load",()=>this._loadMarkerIcons()))}async setStyle(e){this._updateStyleProperties(e),await this._loadMarkerIcons(),await this._updateLayers()}async setMarkerIcons(e){if(Array.isArray(e)&&e.length){const i=e.slice(1,e.length-1);this._routeStyle.markers={from:e[0],to:Ye(e),stops:i.length?i:[e[0]]},this._styleDiffs={markers:this._routeStyle.markers}}else"from"in e&&(this._routeStyle.markers.from=e.from,this._styleDiffs.markers.from=e.from),"to"in e&&(this._routeStyle.markers.to=e.to,this._styleDiffs.markers.to=e.to),"stops"in e&&(this._routeStyle.markers.stops=e.stops??[null],this._styleDiffs.markers.stops=e.stops??[null]);await this._loadMarkerIcons()}setMarkerIconSize(e){return this._routeStyle.markerIconSize=e,this}setIndoorLineColor(e){return this._routeStyle.indoorLineColor=e,this}setOutdoorLineColor(e){return this._routeStyle.outdoorLineColor=e,this}setDashedLineColor(e){return this._routeStyle.dashedLineColor=e,this}setBusLineColor(e){return this._routeStyle.shuttleBusLineColor=e,this}render(e,i){if(!this._renderBoundaryLayer){const d=this._maplibreMap.getStyle(),u=tt(d);let c=u.find(({type:h,id:f})=>!f.includes("-overlap-copy")&&h==="fill-extrusion");c||(c=u.find(h=>h.type==="symbol"&&h?.["source-layer"]==="mapxus_place")),this._renderBoundaryLayer=c?.id}const{instructions:r,points:{coordinates:n}}=e,{lineFeatures:s,connectorFeatures:o,dashedLineFeatures:a,markerFeatures:l}=this._classifyFeatures(r,n,i);this._renderSolidLines(s),this._renderLineSymbols(We,me),this._routeStyle.disableDashedLine!==!0&&this._renderDashedLines(a),this._renderConnectors(o),this._renderMarkers(l)}remove(){br.forEach(e=>{this._maplibreMap.getLayer(e)&&this._maplibreMap.removeLayer(e)}),nl.forEach(e=>{this._maplibreMap.getSource(e)&&this._maplibreMap.removeSource(e)})}setFilterByVenue(e,i){this._filterBy="venue",this._curVenue=e??null,this._curOrdinal=i??null,this._filterRouteOpacity()}setFilterByBuilding(e,i){this._filterBy="building",this._curBuilding=e??null,this._curOrdinal=i??null,this._filterRouteOpacity()}_classifyFeatures(e,i,r){const n=[],s=[],o=[],a=[],l=[];e.forEach((M,P)=>{const{venue_id:L,building_id:H,floor_id:x,ordinal:K,sign:se,type:be,interval:[Qe,xe]}=M;if(al(se))l.push(M);else if(ol(se)){P!==0&&P!==e.length-1&&s.push(this._createIconFeature(`connector-${s.length}`,i[Qe],{...G({venue_id:L,building_id:H,floor_id:x,ordinal:K}),icon:be}));const Lr=e[P+1];if(Lr){const{venue_id:_l,building_id:fl,floor_id:pl,ordinal:gl}=Lr;s.push(this._createIconFeature(`connector-${s.length}`,i[xe],{...G({venue_id:_l,building_id:fl,floor_id:pl,ordinal:gl}),icon:be}))}}else n.push(this._createLineFeature(`solid-line-${n.length}`,i.slice(Qe,xe+1),G({venue_id:L,building_id:H,floor_id:x,ordinal:K,isShuttleBus:ll(se)?1:0})))});const d=e[0],{venue_id:u,building_id:c,floor_id:h,ordinal:f}=d,g=e[e.length-1],{venue_id:_,building_id:y,floor_id:m,ordinal:v}=g,E=i[0],O=i[i.length-1],B=r[0],S=r[r.length-1],$=r.slice(1,r.length-1);return B&&o.push(this._createLineFeature(`dashed-line-${o.length}`,[B,E],G({venue_id:u,building_id:c,floor_id:h,ordinal:f}))),S&&o.push(this._createLineFeature(`dashed-line-${o.length}`,[O,S],G({venue_id:_,building_id:y,floor_id:m,ordinal:v}))),l.length&&$.length&&l.forEach(({venue_id:M,building_id:P,floor_id:L,ordinal:H,interval:[x]},K)=>{o.push(this._createLineFeature(`dashed-line-${o.length}`,[i[x],$[K]],G({venue_id:M,building_id:P,floor_id:L,ordinal:H}))),a.push(this._createIconFeature(`marker-${a.length}`,$[K],{...G({venue_id:M,building_id:P,floor_id:L,ordinal:H,markerType:`stops_${K}`}),icon:this._routeStyle.markers.stops[K]??Ye(this._routeStyle.markers.stops),iconSize:this._routeStyle.markerIconSize}))}),a.push(this._createIconFeature(`marker-${a.length}`,B??E,{...G({venue_id:u,building_id:c,floor_id:h,ordinal:f,markerType:"from"}),icon:this._routeStyle.markers.from,iconSize:this._routeStyle.markerIconSize})),a.push(this._createIconFeature(`marker-${a.length}`,S??O,{...G({venue_id:_,building_id:y,floor_id:m,ordinal:v,markerType:"to"}),icon:this._routeStyle.markers.to,iconSize:this._routeStyle.markerIconSize})),{lineFeatures:n,connectorFeatures:s,dashedLineFeatures:o,markerFeatures:a}}_createLineFeature(e,i,r){return{id:e,type:"Feature",geometry:{type:"LineString",coordinates:i},properties:r}}_createIconFeature(e,i,r){return{id:e,type:"Feature",geometry:{type:"Point",coordinates:i},properties:r}}_renderSolidLines(e){this._addCollectionSource(We,e),this._addLineLayer(We,ye,{"line-color":["case",["==",["get","isShuttleBus"],"1"],this._routeStyle.shuttleBusLineColor,["==",["get","floor_id"],null],this._routeStyle.outdoorLineColor,this._routeStyle.indoorLineColor],"line-opacity":["case",["==",["get","floor_id"],null],this._routeStyle.outdoorLineOpacity,1],"line-width":this._routeStyle.lineWidth})}_renderDashedLines(e){this._addCollectionSource(Rt,e),this._addLineLayer(Rt,ne,{"line-color":this._routeStyle.dashedLineColor,"line-width":this._routeStyle.dashedLineWidth,"line-dasharray":[.1,1.8]})}_renderConnectors(e){this._addCollectionSource(kt,e),this._addIconLayer(kt,mr)}_renderMarkers(e){this._addCollectionSource(Xe,e),this._addIconLayer(Xe,Dt,{"icon-anchor":"bottom","icon-allow-overlap":!0,"icon-ignore-placement":!0})}_addCollectionSource(e,i){this._maplibreMap.addSource(e,{type:"geojson",data:{type:"FeatureCollection",features:i}})}_addLineLayer(e,i,r){this._maplibreMap.addLayer({id:i,type:"line",source:e,layout:{"line-join":"round","line-cap":"round"},paint:{"line-width":4,...r||{}}},this._renderBoundaryLayer)}_renderLineSymbols(e,i){this._maplibreMap.addLayer({id:i,type:"symbol",source:e,layout:{"symbol-placement":"line","symbol-spacing":this._routeStyle.lineSymbol.spacing,"icon-size":this._routeStyle.lineSymbol.size,"icon-image":this._routeStyle.lineSymbol.image},paint:{"icon-opacity":["case",["==",["get","floor_id"],null],this._routeStyle.outdoorLineOpacity,1]}},this._renderBoundaryLayer)}_addIconLayer(e,i,r){this._maplibreMap.addLayer({id:i,type:"symbol",source:e,layout:{"icon-image":["get","icon"],"icon-size":["case",["has","iconSize"],["get","iconSize"],1],...r||{}}})}_updateStyleProperties(e){if(this._styleDiffs=Sr(this._routeStyle,e??Tt),!e)this._routeStyle=Tt;else if(Object.keys(this._styleDiffs).length){const i={...this._routeStyle.lineSymbol,...this._styleDiffs.lineSymbol??{}},r=this._styleDiffs.markers;let n=this._routeStyle.markers;const s={outdoorLineOpacity:(this._styleDiffs.outdoorLineOpacity>1?1:this._styleDiffs.outdoorLineOpacity<0?0:this._styleDiffs.outdoorLineOpacity)??this._routeStyle.outdoorLineOpacity},o={inactiveRouteOpacity:(this._styleDiffs.inactiveRouteOpacity>1?1:this._styleDiffs.inactiveRouteOpacity<0?0:this._styleDiffs.inactiveRouteOpacity)??this._routeStyle.inactiveRouteOpacity};r&&Object.keys(r).length&&(n={...n,...r}),this._routeStyle={...this._routeStyle,...this._styleDiffs,...s,...o,markers:n,lineSymbol:i}}}async _loadMarkerIcons(){const{markers:e,lineSymbol:i}=this._styleDiffs;if(i?.image&&await Me(this._maplibreMap,i.image),e&&Object.keys(e).length){const{from:r,to:n,stops:s}=e;if(r&&await Me(this._maplibreMap,r),n&&await Me(this._maplibreMap,n),s&&s.length){const o=s.filter(a=>!!a);o.length&&await Promise.all(o.map(a=>Me(this._maplibreMap,a)))}}}async _updateLayers(){if(!this._maplibreMap.getLayer(ye))return;const{indoorLineColor:e,outdoorLineColor:i,dashedLineColor:r,shuttleBusLineColor:n,lineWidth:s,dashedLineWidth:o,disableDashedLine:a,inactiveRouteOpacity:l,outdoorLineOpacity:d,markerIconSize:u,markers:c,lineSymbol:h}=this._styleDiffs;if((e||i||n)&&this._maplibreMap.setPaintProperty(ye,"line-color",["case",["==",["get","isShuttleBus"],"1"],this._routeStyle.shuttleBusLineColor,["==",["get","floor_id"],null],this._routeStyle.outdoorLineColor,this._routeStyle.indoorLineColor]),s!==void 0&&s+""&&this._maplibreMap.setPaintProperty(ye,"line-width",s),typeof a=="boolean"?a?this._maplibreMap.setPaintProperty(ne,"line-color","transparent"):(this._maplibreMap.setPaintProperty(ne,"line-color",this._routeStyle.dashedLineColor),this._maplibreMap.setPaintProperty(ne,"line-width",this._routeStyle.dashedLineWidth)):this._routeStyle.disableDashedLine!==!0&&(r&&this._maplibreMap.setPaintProperty(ne,"line-color",r),o!==void 0&&o+""&&this._maplibreMap.setPaintProperty(ne,"line-width",o)),l!==void 0&&l+""&&this._filterRouteOpacity(),u!==void 0&&u+""&&this._maplibreMap.setLayoutProperty(Dt,"icon-size",u),c&&Object.keys(c).length){const{from:f,to:g,stops:_}=c,y=this._maplibreMap.getSource(Xe),m=await y.getData();m.features=m.features.map(v=>{const{markerType:E}=v.properties;if(f!==void 0&&E==="from"&&(v.properties.icon=f),g!==void 0&&E==="to"&&(v.properties.icon=g),_&&E.includes("stops")){const O=parseInt(E.split("_")[1]);v.properties.icon=_[O]??Ye(_)}return v}),y.setData(m)}if(h){const{image:f,size:g,spacing:_}=h;f!==void 0&&this._maplibreMap.setLayoutProperty(me,"icon-image",f),g!==void 0&&g+""&&this._maplibreMap.setLayoutProperty(me,"icon-size",g),_!==void 0&&_+""&&this._maplibreMap.setLayoutProperty(me,"symbol-spacing",_)}d!==void 0&&d+""&&(this._maplibreMap.setPaintProperty(ye,"line-opacity",["case",["==",["get","floor_id"],null],d,1]),this._maplibreMap.setPaintProperty(me,"icon-opacity",["case",["==",["get","floor_id"],null],d,1]),this._filterRouteOpacity())}_filterRouteOpacity(){let e;switch(this._filterBy){case"venue":e=["case",["all",["==",["get","ordinal"],this._curOrdinal??""],["==",["get","venue_id"],this._curVenue??""]],1,["==",["get","floor_id"],null],this._routeStyle.outdoorLineOpacity,this._routeStyle.inactiveRouteOpacity];break;case"building":e=["case",["all",["==",["get","ordinal"],this._curOrdinal??""],["==",["get","building_id"],this._curBuilding??""]],1,["==",["get","floor_id"],null],this._routeStyle.outdoorLineOpacity,this._routeStyle.inactiveRouteOpacity];break}br.forEach(i=>{this._maplibreMap.getLayer(i)&&this._maplibreMap.setPaintProperty(i,i.includes("layer-line")?"line-opacity":"icon-opacity",e)})}}function G(t){return Object.fromEntries(Object.entries(t).map(([e,i])=>[e,Number.isFinite(i)?i+"":i]))}function ol(t){return t===100||t===-100}function al(t){return t===5}function ll(t){return lr(t,104,108)}function Sr(t,e){const i={};for(const r in e){const n=t[r],s=e[r];if(r==="markers"||r==="lineSymbol")if(Array.isArray(s)){const o=s.slice(1,s.length-1);i[r]={from:s[0],to:Ye(s),stops:o.length?o:[s[0]]}}else{const o=Sr(n,s);Object.keys(o).length&&(i[r]=o)}else s+""!=n+""&&(i[r]=r==="stops"?s??[null]:s)}return i}var Ht=(t=>(t.FOOT="foot",t.WHEELCHAIR="wheelchair",t.ESCALATOR="escalator",t.EMERGENCY="emergency",t.ELEVATOR="elevator",t))(Ht||{});const dl=D.getInstance();class ul{constructor(){}async search(e){const{points:i,vehicle:r=Ht.FOOT,locale:n="en"}=e;if(!(i&&i.length>1&&i.length<6))throw new Error("Parameter error. It must be 1 < {points.length} < 6");if(cl(i))throw new Error("Parameter error. Points must have lat and lon.");return(await dl.getHttpSession()).request(Fr,{method:"POST",body:JSON.stringify({points:i,vehicle:r,locale:n})})}}function cl(t){return t.some(e=>!e||typeof e.lat!="number"||typeof e.lon!="number")}const vr=D.getInstance();class hl{constructor(){}async searchCategories(e){const i=new URLSearchParams;if("floorId"in e&&b(e.floorId)?i.set("floorId",e.floorId):"buildingId"in e&&b(e.buildingId)?i.set("buildingId",e.buildingId):"sharedFloorId"in e&&b(e.sharedFloorId)?i.set("sharedFloorId",e.sharedFloorId):"venueId"in e&&b(e.venueId)&&i.set("venueId",e.venueId),"bounds"in e&&ae(e.bounds)&&(i.set("bbox",e.bounds.flat().join()),b(e.keywords)&&i.set("keywords",e.keywords)),i.toString().length===0)throw new Error("At least one of 'floorId', 'buildingId', 'sharedFloorId', 'venueId', or 'bounds' must be provided.");const r=`${Vt}?${i.toString()}`;return(await vr.getHttpSession()).request(r)}async searchCategoryTrees(e){return(await vr.getHttpSession()).request(`${Or}?featureType=${e}`)}}var Ir=(t=>(t.Poi="POI",t))(Ir||{});p.ASSISTANT_LAYER_INDOOR_FLOORS=Ie,p.ASSISTANT_LAYER_SHARED_FLOORS=T,p.BuildingFilterControl=sr,p.BuildingSelectorHandler=cr,p.BuildingsService=ri,p.CategoryService=hl,p.DistanceSearchType=Xt,p.ERRORS=qt,p.FeatureType=Ir,p.FloorSelectorHandler=hr,p.FloorSwitchScope=De,p.FloorsControl=dr,p.Indoor=er,p.IndoorClickSelection=pr,p.Map=tl,p.Marker=rl,p.OFFSET=R,p.OrientationDistanceSearchType=nt,p.OutdoorClickSelection=gr,p.PAGE=k,p.Poi=rr,p.PoisOrderBy=Qt,p.PoisService=Jt,p.PoisSortBy=Zt,p.PresetLanguage=C,p.RoutePainter=sl,p.RouteService=ul,p.SwitchBuildingHandler=_r,p.SwitchOutdoorHandler=fr,p.ThemeType=$t,p.VERSION=Ze,p.VehicleType=Ht,p.VenuesService=ti,p.convertBrowserLangToPresetLang=Kt,p.omittedBuildingProps=ii,p.omittedPoiProps=st,p.omittedVenueKeys=ei,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})}));
|
|
Binary file
|
|
Binary file
|