@mapxus/mapxus-map-jp 9.3.0 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -12
- package/dist/index.umd.js +2 -19
- package/dist/utils.cjs +1 -13
- package/es/index.d.ts +1110 -1157
- package/es/index.mjs +2297 -4420
- package/es/languages-C5nRc9Ll.mjs +165 -0
- package/es/utils/index.d.ts +0 -53
- package/es/utils/index.mjs +17 -33
- package/package.json +3 -6
- package/es/context-DqAvnxfX.mjs +0 -8301
package/dist/index.umd.js
CHANGED
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
(function(_e,$t){typeof exports=="object"&&typeof module<"u"?$t(exports,require("maplibre-gl")):typeof define=="function"&&define.amd?define(["exports","maplibre-gl"],$t):(_e=typeof globalThis<"u"?globalThis:_e||self,$t(_e.MapxusMap={},_e.maplibregl))})(this,(function(_e,$t){"use strict";var kn={exports:{}},Qi;function el(){if(Qi)return kn.exports;Qi=1;function e(){}return e.prototype={on:function(t,n,r){var i=this.e||(this.e={});return(i[t]||(i[t]=[])).push({fn:n,ctx:r}),this},once:function(t,n,r){var i=this;function o(){i.off(t,o),n.apply(r,arguments)}return o._=n,this.on(t,o,r)},emit:function(t){var n=[].slice.call(arguments,1),r=((this.e||(this.e={}))[t]||[]).slice(),i=0,o=r.length;for(i;i<o;i++)r[i].fn.apply(r[i].ctx,n);return this},off:function(t,n){var r=this.e||(this.e={}),i=r[t],o=[];if(i&&n)for(var s=0,a=i.length;s<a;s++)i[s].fn!==n&&i[s].fn._!==n&&o.push(i[s]);return o.length?r[t]=o:delete r[t],this}},kn.exports=e,kn.exports.TinyEmitter=e,kn.exports}var Er=el(),De=(e=>(e.ENGLISH="en",e.CHINESE_SIMPLIFIED="zh-Hans",e.CHINESE_TRADITIONAL="zh-Hant",e.CHINESE_TRADITIONAL_TW="zh-Hant-TW",e.JAPANESE="ja",e.KOREAN="ko",e.FILIPINO="fil",e.INDONESIAN="id",e.PORTUGUESE="pt",e.THAI="th",e.VIETNAMESE="vi",e.ARABIC="ar",e))(De||{}),Sr=(e=>(e.CHRISTMAS="christmas_mims2_v1",e.HALLOWEEN="halloween_mims2_v1",e.MAPPY_BEE="mappybee_mims2_v2",e.MAPXUS="mapxus_mims2_v1",e.LANDS_D="lands_d_mims2_v1",e.COMMON="common_mims2_v1",e.MAPXUS_V2="mapxus_v2",e.MAPXUS_DEFAULT="mapxus_v8",e.ROSE_TEA="rose_tea",e.PEAR_SORBET="pear_sorbet",e.CITY_WALK="city_walk",e.MOCHA_MOUSSE="mocha_mousse",e.SECTION_DISPLAY_BY_COLOR="mapxus_v7_with_section_v2",e.SECTION_DISPLAY_BY_CATEGORY="mapxus_v7_with_section_v3",e))(Sr||{}),Mn=(e=>(e[e.VENUE=0]="VENUE",e[e.GLOBAL=1]="GLOBAL",e))(Mn||{}),It=(e=>(e.Access="access_control",e.Map="map",e))(It||{}),Br=(e=>(e.FOOT="foot",e.WHEELCHAIR="wheelchair",e.ESCALATOR="escalator",e.EMERGENCY="emergency",e))(Br||{}),eo=(e=>(e.POINT="Point",e.POLYGON="Polygon",e))(eo||{}),Ir=(e=>(e.POINT="Point",e.POLYGON="Polygon",e.GATE="Gate",e))(Ir||{}),to=(e=>(e.DEFAULT_NAME="DefaultName",e))(to||{}),no=(e=>(e.ABSOLUTE_DISTANCE="AbsoluteDistance",e.ACTUAL_DISTANCE="ActualDistance",e))(no||{});function tl(e){return e.layers.filter(t=>!xr(t.source))}function Lr(e){return e.layers.filter(t=>xr(t.source))}function xr(e){return typeof e!="string"?!1:e.startsWith("indoor-")}function Ar(e){const{buildingId:t,labelCenter:{lat:n,lon:r},floors:i,name:o,venueId:s,defaultFloor:a}=e,u=Object.entries(o).reduce((I,[v,h])=>{const b=v==="default"?"name":`name:${v}`;return Object.assign(I,{[b]:h})},{}),{codes:d,ids:g,ordinals:p}=i.reduce((I,v)=>{const{id:h,code:b,ordinal:B}=v;return{codes:I.codes?`${I.codes},${b}`:b,ids:I.ids?`${I.ids},${h}`:h,ordinals:`${I.ordinals}`?`${I.ordinals},${B}`:`${B}`}},{codes:"",ids:"",ordinals:""});return{layer:{id:"mapxus-building-line"},properties:{building:"yes",id:t,label_center:`${r},${n}`,level_ids:g,level_names:d,ordinals:p,"ref:venue":s,...u,...a?{default_displayed_floor:a}:{}},source:"indoor-planet",sourceLayer:"mapxus_building"}}function Hn(e){const{address:t,buildings:n,id:r,name:i,type:o,labelCenter:{lon:s,lat:a},defaultBuilding:u,sharedFloors:d}=e,g=Object.entries(t).reduce((b,[B,T])=>Object.assign(b,B==="default"?{"addr:street":T.street,"addr:housenumber":T.housenumber}:{[`addr:street:${B}`]:T.street}),{}),p=Object.entries(i).reduce((b,[B,T])=>{const H=B==="default"?"name":`name:${B}`;return Object.assign(b,{[H]:T})},{}),I=u?n.find(b=>b.id===u)?.defaultFloor:null,v=u?{default_displayed_building:u,...I?{default_displayed_ordinal:I}:{}}:{},h=d?.length?{shared_level_ids:d.map(({id:b})=>b).join(","),shared_level_ordinals:d.map(({ordinal:b})=>b).join(",")}:{};return{layer:{id:"mapxus-venue-fill"},properties:{...g,...p,id:r,venue:o,label_center:`${s},${a}`,building_ids:n.map(({id:b})=>b).join(),...v,...h},source:"indoor-planet",sourceLayer:"mapxus_venue"}}function Oe(e,t=","){return typeof e!="string"||!e.trim()?[]:e.split(t)}const nn="reserve_mapxus-level-fill",je="reserve_mapxus-shared-level-fill",rn="reserve_mapxus-building-fill";function ro(e){let t=null;return nl(e)?t=De.ENGLISH:rl(e)?t=De.CHINESE_SIMPLIFIED:il(e)?t=De.CHINESE_TRADITIONAL:ol(e)?t=De.CHINESE_TRADITIONAL_TW:sl(e)?t=De.JAPANESE:al(e)?t=De.KOREAN:cl(e)?t=De.FILIPINO:ll(e)?t=De.INDONESIAN:ul(e)?t=De.PORTUGUESE:dl(e)?t=De.THAI:fl(e)?t=De.VIETNAMESE:hl(e)&&(t=De.ARABIC),t}function nl(e){return/^en(-(US|GB|AU))?$/.test(e)}function rl(e){return/^zh(-(Hans|CN))?$/.test(e)}function il(e){return/^zh-(Hant|HK|MO)$/.test(e)}function ol(e){return e==="zh-TW"}function sl(e){return/^ja(-JP)?$/.test(e)}function al(e){return/^ko(-KR)?$/.test(e)}function cl(e){return/^(fil|tl)(-PH)?$/.test(e)}function ll(e){return/^id(-ID)?$/.test(e)}function ul(e){return/^pt(-(BR|PT))?$/.test(e)}function dl(e){return/^th(-TH)?$/.test(e)}function fl(e){return/^vi(-VN)?$/.test(e)}function hl(e){return/^ar(-(DZ|BH|EG|IQ|JO|KW|LB|LY|MA|OM|QA|SA|SY|TN|AE|YE))?$/.test(e)}const Un={lineWidth:3,lineColor:"#A5E3FF",lineOpacity:1,lineOffset:-1.5},io={fontColor:"#8c8c8c",activeFontColor:"#fff",backgroundColor:"#fff",activeBackgroundColor:"#074769",itemSize:50,itemCount:4,defaultFolded:!1},pl=ro(window.navigator.language)??De.ENGLISH;function oo(e,t){return function(){return e.apply(t,arguments)}}const{toString:yl}=Object.prototype,{getPrototypeOf:Cr}=Object,{iterator:Nn,toStringTag:so}=Symbol,Dn=(e=>t=>{const n=yl.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Qe=e=>(e=e.toLowerCase(),t=>Dn(t)===e),$n=e=>t=>typeof t===e,{isArray:Vt}=Array,jt=$n("undefined");function on(e){return e!==null&&!jt(e)&&e.constructor!==null&&!jt(e.constructor)&&qe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ao=Qe("ArrayBuffer");function gl(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&ao(e.buffer),t}const ml=$n("string"),qe=$n("function"),co=$n("number"),sn=e=>e!==null&&typeof e=="object",_l=e=>e===!0||e===!1,Vn=e=>{if(Dn(e)!=="object")return!1;const t=Cr(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(so in e)&&!(Nn in e)},bl=e=>{if(!sn(e)||on(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},wl=Qe("Date"),vl=Qe("File"),El=Qe("Blob"),Sl=Qe("FileList"),Bl=e=>sn(e)&&qe(e.pipe),Il=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||qe(e.append)&&((t=Dn(e))==="formdata"||t==="object"&&qe(e.toString)&&e.toString()==="[object FormData]"))},Ll=Qe("URLSearchParams"),[xl,Al,Cl,Tl]=["ReadableStream","Request","Response","Headers"].map(Qe),Ol=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function an(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,i;if(typeof e!="object"&&(e=[e]),Vt(e))for(r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else{if(on(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;let a;for(r=0;r<s;r++)a=o[r],t.call(null,e[a],a,e)}}function lo(e,t){if(on(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,i;for(;r-- >0;)if(i=n[r],t===i.toLowerCase())return i;return null}const Lt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,uo=e=>!jt(e)&&e!==Lt;function Tr(){const{caseless:e,skipUndefined:t}=uo(this)&&this||{},n={},r=(i,o)=>{const s=e&&lo(n,o)||o;Vn(n[s])&&Vn(i)?n[s]=Tr(n[s],i):Vn(i)?n[s]=Tr({},i):Vt(i)?n[s]=i.slice():(!t||!jt(i))&&(n[s]=i)};for(let i=0,o=arguments.length;i<o;i++)arguments[i]&&an(arguments[i],r);return n}const Rl=(e,t,n,{allOwnKeys:r}={})=>(an(t,(i,o)=>{n&&qe(i)?e[o]=oo(i,n):e[o]=i},{allOwnKeys:r}),e),Pl=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Fl=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},kl=(e,t,n,r)=>{let i,o,s;const a={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],(!r||r(s,e,t))&&!a[s]&&(t[s]=e[s],a[s]=!0);e=n!==!1&&Cr(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Ml=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},Hl=e=>{if(!e)return null;if(Vt(e))return e;let t=e.length;if(!co(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Ul=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Cr(Uint8Array)),Nl=(e,t)=>{const r=(e&&e[Nn]).call(e);let i;for(;(i=r.next())&&!i.done;){const o=i.value;t.call(e,o[0],o[1])}},Dl=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},$l=Qe("HTMLFormElement"),Vl=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),fo=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),jl=Qe("RegExp"),ho=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};an(n,(i,o)=>{let s;(s=t(i,o,e))!==!1&&(r[o]=s||i)}),Object.defineProperties(e,r)},ql=e=>{ho(e,(t,n)=>{if(qe(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(qe(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Kl=(e,t)=>{const n={},r=i=>{i.forEach(o=>{n[o]=!0})};return Vt(e)?r(e):r(String(e).split(t)),n},Gl=()=>{},zl=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Zl(e){return!!(e&&qe(e.append)&&e[so]==="FormData"&&e[Nn])}const Wl=e=>{const t=new Array(10),n=(r,i)=>{if(sn(r)){if(t.indexOf(r)>=0)return;if(on(r))return r;if(!("toJSON"in r)){t[i]=r;const o=Vt(r)?[]:{};return an(r,(s,a)=>{const u=n(s,i+1);!jt(u)&&(o[a]=u)}),t[i]=void 0,o}}return r};return n(e,0)},Yl=Qe("AsyncFunction"),Xl=e=>e&&(sn(e)||qe(e))&&qe(e.then)&&qe(e.catch),po=((e,t)=>e?setImmediate:t?((n,r)=>(Lt.addEventListener("message",({source:i,data:o})=>{i===Lt&&o===n&&r.length&&r.shift()()},!1),i=>{r.push(i),Lt.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",qe(Lt.postMessage)),Jl=typeof queueMicrotask<"u"?queueMicrotask.bind(Lt):typeof process<"u"&&process.nextTick||po,ie={isArray:Vt,isArrayBuffer:ao,isBuffer:on,isFormData:Il,isArrayBufferView:gl,isString:ml,isNumber:co,isBoolean:_l,isObject:sn,isPlainObject:Vn,isEmptyObject:bl,isReadableStream:xl,isRequest:Al,isResponse:Cl,isHeaders:Tl,isUndefined:jt,isDate:wl,isFile:vl,isBlob:El,isRegExp:jl,isFunction:qe,isStream:Bl,isURLSearchParams:Ll,isTypedArray:Ul,isFileList:Sl,forEach:an,merge:Tr,extend:Rl,trim:Ol,stripBOM:Pl,inherits:Fl,toFlatObject:kl,kindOf:Dn,kindOfTest:Qe,endsWith:Ml,toArray:Hl,forEachEntry:Nl,matchAll:Dl,isHTMLForm:$l,hasOwnProperty:fo,hasOwnProp:fo,reduceDescriptors:ho,freezeMethods:ql,toObjectSet:Kl,toCamelCase:Vl,noop:Gl,toFiniteNumber:zl,findKey:lo,global:Lt,isContextDefined:uo,isSpecCompliantForm:Zl,toJSONObject:Wl,isAsyncFn:Yl,isThenable:Xl,setImmediate:po,asap:Jl,isIterable:e=>e!=null&&qe(e[Nn])};function Be(e,t,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}ie.inherits(Be,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ie.toJSONObject(this.config),code:this.code,status:this.status}}});const yo=Be.prototype,go={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{go[e]={value:e}}),Object.defineProperties(Be,go),Object.defineProperty(yo,"isAxiosError",{value:!0}),Be.from=(e,t,n,r,i,o)=>{const s=Object.create(yo);ie.toFlatObject(e,s,function(g){return g!==Error.prototype},d=>d!=="isAxiosError");const a=e&&e.message?e.message:"Error",u=t==null&&e?e.code:t;return Be.call(s,a,u,n,r,i),e&&s.cause==null&&Object.defineProperty(s,"cause",{value:e,configurable:!0}),s.name=e&&e.name||"Error",o&&Object.assign(s,o),s};const Ql=null;function Or(e){return ie.isPlainObject(e)||ie.isArray(e)}function mo(e){return ie.endsWith(e,"[]")?e.slice(0,-2):e}function _o(e,t,n){return e?e.concat(t).map(function(i,o){return i=mo(i),!n&&o?"["+i+"]":i}).join(n?".":""):t}function eu(e){return ie.isArray(e)&&!e.some(Or)}const tu=ie.toFlatObject(ie,{},null,function(t){return/^is[A-Z]/.test(t)});function jn(e,t,n){if(!ie.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=ie.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,B){return!ie.isUndefined(B[b])});const r=n.metaTokens,i=n.visitor||g,o=n.dots,s=n.indexes,u=(n.Blob||typeof Blob<"u"&&Blob)&&ie.isSpecCompliantForm(t);if(!ie.isFunction(i))throw new TypeError("visitor must be a function");function d(h){if(h===null)return"";if(ie.isDate(h))return h.toISOString();if(ie.isBoolean(h))return h.toString();if(!u&&ie.isBlob(h))throw new Be("Blob is not supported. Use a Buffer instead.");return ie.isArrayBuffer(h)||ie.isTypedArray(h)?u&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function g(h,b,B){let T=h;if(h&&!B&&typeof h=="object"){if(ie.endsWith(b,"{}"))b=r?b:b.slice(0,-2),h=JSON.stringify(h);else if(ie.isArray(h)&&eu(h)||(ie.isFileList(h)||ie.endsWith(b,"[]"))&&(T=ie.toArray(h)))return b=mo(b),T.forEach(function($,Q){!(ie.isUndefined($)||$===null)&&t.append(s===!0?_o([b],Q,o):s===null?b:b+"[]",d($))}),!1}return Or(h)?!0:(t.append(_o(B,b,o),d(h)),!1)}const p=[],I=Object.assign(tu,{defaultVisitor:g,convertValue:d,isVisitable:Or});function v(h,b){if(!ie.isUndefined(h)){if(p.indexOf(h)!==-1)throw Error("Circular reference detected in "+b.join("."));p.push(h),ie.forEach(h,function(T,H){(!(ie.isUndefined(T)||T===null)&&i.call(t,T,ie.isString(H)?H.trim():H,b,I))===!0&&v(T,b?b.concat(H):[H])}),p.pop()}}if(!ie.isObject(e))throw new TypeError("data must be an object");return v(e),t}function bo(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Rr(e,t){this._pairs=[],e&&jn(e,this,t)}const wo=Rr.prototype;wo.append=function(t,n){this._pairs.push([t,n])},wo.toString=function(t){const n=t?function(r){return t.call(this,r,bo)}:bo;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function nu(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function vo(e,t,n){if(!t)return e;const r=n&&n.encode||nu;ie.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let o;if(i?o=i(t,n):o=ie.isURLSearchParams(t)?t.toString():new Rr(t,n).toString(r),o){const s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Eo{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){ie.forEach(this.handlers,function(r){r!==null&&t(r)})}}const So={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ru={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Rr,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Pr=typeof window<"u"&&typeof document<"u",Fr=typeof navigator=="object"&&navigator||void 0,iu=Pr&&(!Fr||["ReactNative","NativeScript","NS"].indexOf(Fr.product)<0),ou=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",su=Pr&&window.location.href||"http://localhost",He={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Pr,hasStandardBrowserEnv:iu,hasStandardBrowserWebWorkerEnv:ou,navigator:Fr,origin:su},Symbol.toStringTag,{value:"Module"})),...ru};function au(e,t){return jn(e,new He.classes.URLSearchParams,{visitor:function(n,r,i,o){return He.isNode&&ie.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function cu(e){return ie.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function lu(e){const t={},n=Object.keys(e);let r;const i=n.length;let o;for(r=0;r<i;r++)o=n[r],t[o]=e[o];return t}function Bo(e){function t(n,r,i,o){let s=n[o++];if(s==="__proto__")return!0;const a=Number.isFinite(+s),u=o>=n.length;return s=!s&&ie.isArray(i)?i.length:s,u?(ie.hasOwnProp(i,s)?i[s]=[i[s],r]:i[s]=r,!a):((!i[s]||!ie.isObject(i[s]))&&(i[s]=[]),t(n,r,i[s],o)&&ie.isArray(i[s])&&(i[s]=lu(i[s])),!a)}if(ie.isFormData(e)&&ie.isFunction(e.entries)){const n={};return ie.forEachEntry(e,(r,i)=>{t(cu(r),i,n,0)}),n}return null}function uu(e,t,n){if(ie.isString(e))try{return(t||JSON.parse)(e),ie.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const cn={transitional:So,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,o=ie.isObject(t);if(o&&ie.isHTMLForm(t)&&(t=new FormData(t)),ie.isFormData(t))return i?JSON.stringify(Bo(t)):t;if(ie.isArrayBuffer(t)||ie.isBuffer(t)||ie.isStream(t)||ie.isFile(t)||ie.isBlob(t)||ie.isReadableStream(t))return t;if(ie.isArrayBufferView(t))return t.buffer;if(ie.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return au(t,this.formSerializer).toString();if((a=ie.isFileList(t))||r.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return jn(a?{"files[]":t}:t,u&&new u,this.formSerializer)}}return o||i?(n.setContentType("application/json",!1),uu(t)):t}],transformResponse:[function(t){const n=this.transitional||cn.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(ie.isResponse(t)||ie.isReadableStream(t))return t;if(t&&ie.isString(t)&&(r&&!this.responseType||i)){const s=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(a){if(s)throw a.name==="SyntaxError"?Be.from(a,Be.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:He.classes.FormData,Blob:He.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ie.forEach(["delete","get","head","post","put","patch"],e=>{cn.headers[e]={}});const du=ie.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),fu=e=>{const t={};let n,r,i;return e&&e.split(`
|
|
2
|
-
`).forEach(function(s){i=s.indexOf(":"),n=s.substring(0,i).trim().toLowerCase(),r=s.substring(i+1).trim(),!(!n||t[n]&&du[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Io=Symbol("internals");function ln(e){return e&&String(e).trim().toLowerCase()}function qn(e){return e===!1||e==null?e:ie.isArray(e)?e.map(qn):String(e)}function hu(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const pu=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function kr(e,t,n,r,i){if(ie.isFunction(r))return r.call(this,t,n);if(i&&(t=n),!!ie.isString(t)){if(ie.isString(r))return t.indexOf(r)!==-1;if(ie.isRegExp(r))return r.test(t)}}function yu(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function gu(e,t){const n=ie.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(i,o,s){return this[r].call(this,t,i,o,s)},configurable:!0})})}let Ke=class{constructor(t){t&&this.set(t)}set(t,n,r){const i=this;function o(a,u,d){const g=ln(u);if(!g)throw new Error("header name must be a non-empty string");const p=ie.findKey(i,g);(!p||i[p]===void 0||d===!0||d===void 0&&i[p]!==!1)&&(i[p||u]=qn(a))}const s=(a,u)=>ie.forEach(a,(d,g)=>o(d,g,u));if(ie.isPlainObject(t)||t instanceof this.constructor)s(t,n);else if(ie.isString(t)&&(t=t.trim())&&!pu(t))s(fu(t),n);else if(ie.isObject(t)&&ie.isIterable(t)){let a={},u,d;for(const g of t){if(!ie.isArray(g))throw TypeError("Object iterator must return a key-value pair");a[d=g[0]]=(u=a[d])?ie.isArray(u)?[...u,g[1]]:[u,g[1]]:g[1]}s(a,n)}else t!=null&&o(n,t,r);return this}get(t,n){if(t=ln(t),t){const r=ie.findKey(this,t);if(r){const i=this[r];if(!n)return i;if(n===!0)return hu(i);if(ie.isFunction(n))return n.call(this,i,r);if(ie.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=ln(t),t){const r=ie.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||kr(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let i=!1;function o(s){if(s=ln(s),s){const a=ie.findKey(r,s);a&&(!n||kr(r,r[a],a,n))&&(delete r[a],i=!0)}}return ie.isArray(t)?t.forEach(o):o(t),i}clear(t){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const o=n[r];(!t||kr(this,this[o],o,t,!0))&&(delete this[o],i=!0)}return i}normalize(t){const n=this,r={};return ie.forEach(this,(i,o)=>{const s=ie.findKey(r,o);if(s){n[s]=qn(i),delete n[o];return}const a=t?yu(o):String(o).trim();a!==o&&delete n[o],n[a]=qn(i),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return ie.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=t&&ie.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
|
3
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(i=>r.set(i)),r}static accessor(t){const r=(this[Io]=this[Io]={accessors:{}}).accessors,i=this.prototype;function o(s){const a=ln(s);r[a]||(gu(i,s),r[a]=!0)}return ie.isArray(t)?t.forEach(o):o(t),this}};Ke.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ie.reduceDescriptors(Ke.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),ie.freezeMethods(Ke);function Mr(e,t){const n=this||cn,r=t||n,i=Ke.from(r.headers);let o=r.data;return ie.forEach(e,function(a){o=a.call(n,o,i.normalize(),t?t.status:void 0)}),i.normalize(),o}function Lo(e){return!!(e&&e.__CANCEL__)}function qt(e,t,n){Be.call(this,e??"canceled",Be.ERR_CANCELED,t,n),this.name="CanceledError"}ie.inherits(qt,Be,{__CANCEL__:!0});function xo(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Be("Request failed with status code "+n.status,[Be.ERR_BAD_REQUEST,Be.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function mu(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function _u(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i=0,o=0,s;return t=t!==void 0?t:1e3,function(u){const d=Date.now(),g=r[o];s||(s=d),n[i]=u,r[i]=d;let p=o,I=0;for(;p!==i;)I+=n[p++],p=p%e;if(i=(i+1)%e,i===o&&(o=(o+1)%e),d-s<t)return;const v=g&&d-g;return v?Math.round(I*1e3/v):void 0}}function bu(e,t){let n=0,r=1e3/t,i,o;const s=(d,g=Date.now())=>{n=g,i=null,o&&(clearTimeout(o),o=null),e(...d)};return[(...d)=>{const g=Date.now(),p=g-n;p>=r?s(d,g):(i=d,o||(o=setTimeout(()=>{o=null,s(i)},r-p)))},()=>i&&s(i)]}const Kn=(e,t,n=3)=>{let r=0;const i=_u(50,250);return bu(o=>{const s=o.loaded,a=o.lengthComputable?o.total:void 0,u=s-r,d=i(u),g=s<=a;r=s;const p={loaded:s,total:a,progress:a?s/a:void 0,bytes:u,rate:d||void 0,estimated:d&&a&&g?(a-s)/d:void 0,event:o,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(p)},n)},Ao=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Co=e=>(...t)=>ie.asap(()=>e(...t)),wu=He.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,He.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(He.origin),He.navigator&&/(msie|trident)/i.test(He.navigator.userAgent)):()=>!0,vu=He.hasStandardBrowserEnv?{write(e,t,n,r,i,o){const s=[e+"="+encodeURIComponent(t)];ie.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),ie.isString(r)&&s.push("path="+r),ie.isString(i)&&s.push("domain="+i),o===!0&&s.push("secure"),document.cookie=s.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Eu(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Su(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function To(e,t,n){let r=!Eu(t);return e&&(r||n==!1)?Su(e,t):t}const Oo=e=>e instanceof Ke?{...e}:e;function xt(e,t){t=t||{};const n={};function r(d,g,p,I){return ie.isPlainObject(d)&&ie.isPlainObject(g)?ie.merge.call({caseless:I},d,g):ie.isPlainObject(g)?ie.merge({},g):ie.isArray(g)?g.slice():g}function i(d,g,p,I){if(ie.isUndefined(g)){if(!ie.isUndefined(d))return r(void 0,d,p,I)}else return r(d,g,p,I)}function o(d,g){if(!ie.isUndefined(g))return r(void 0,g)}function s(d,g){if(ie.isUndefined(g)){if(!ie.isUndefined(d))return r(void 0,d)}else return r(void 0,g)}function a(d,g,p){if(p in t)return r(d,g);if(p in e)return r(void 0,d)}const u={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(d,g,p)=>i(Oo(d),Oo(g),p,!0)};return ie.forEach(Object.keys({...e,...t}),function(g){const p=u[g]||i,I=p(e[g],t[g],g);ie.isUndefined(I)&&p!==a||(n[g]=I)}),n}const Ro=e=>{const t=xt({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:a}=t;if(t.headers=s=Ke.from(s),t.url=vo(To(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),ie.isFormData(n)){if(He.hasStandardBrowserEnv||He.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(ie.isFunction(n.getHeaders)){const u=n.getHeaders(),d=["content-type","content-length"];Object.entries(u).forEach(([g,p])=>{d.includes(g.toLowerCase())&&s.set(g,p)})}}if(He.hasStandardBrowserEnv&&(r&&ie.isFunction(r)&&(r=r(t)),r||r!==!1&&wu(t.url))){const u=i&&o&&vu.read(o);u&&s.set(i,u)}return t},Bu=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){const i=Ro(e);let o=i.data;const s=Ke.from(i.headers).normalize();let{responseType:a,onUploadProgress:u,onDownloadProgress:d}=i,g,p,I,v,h;function b(){v&&v(),h&&h(),i.cancelToken&&i.cancelToken.unsubscribe(g),i.signal&&i.signal.removeEventListener("abort",g)}let B=new XMLHttpRequest;B.open(i.method.toUpperCase(),i.url,!0),B.timeout=i.timeout;function T(){if(!B)return;const $=Ke.from("getAllResponseHeaders"in B&&B.getAllResponseHeaders()),U={data:!a||a==="text"||a==="json"?B.responseText:B.response,status:B.status,statusText:B.statusText,headers:$,config:e,request:B};xo(function(K){n(K),b()},function(K){r(K),b()},U),B=null}"onloadend"in B?B.onloadend=T:B.onreadystatechange=function(){!B||B.readyState!==4||B.status===0&&!(B.responseURL&&B.responseURL.indexOf("file:")===0)||setTimeout(T)},B.onabort=function(){B&&(r(new Be("Request aborted",Be.ECONNABORTED,e,B)),B=null)},B.onerror=function(Q){const U=Q&&Q.message?Q.message:"Network Error",P=new Be(U,Be.ERR_NETWORK,e,B);P.event=Q||null,r(P),B=null},B.ontimeout=function(){let Q=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const U=i.transitional||So;i.timeoutErrorMessage&&(Q=i.timeoutErrorMessage),r(new Be(Q,U.clarifyTimeoutError?Be.ETIMEDOUT:Be.ECONNABORTED,e,B)),B=null},o===void 0&&s.setContentType(null),"setRequestHeader"in B&&ie.forEach(s.toJSON(),function(Q,U){B.setRequestHeader(U,Q)}),ie.isUndefined(i.withCredentials)||(B.withCredentials=!!i.withCredentials),a&&a!=="json"&&(B.responseType=i.responseType),d&&([I,h]=Kn(d,!0),B.addEventListener("progress",I)),u&&B.upload&&([p,v]=Kn(u),B.upload.addEventListener("progress",p),B.upload.addEventListener("loadend",v)),(i.cancelToken||i.signal)&&(g=$=>{B&&(r(!$||$.type?new qt(null,e,B):$),B.abort(),B=null)},i.cancelToken&&i.cancelToken.subscribe(g),i.signal&&(i.signal.aborted?g():i.signal.addEventListener("abort",g)));const H=mu(i.url);if(H&&He.protocols.indexOf(H)===-1){r(new Be("Unsupported protocol "+H+":",Be.ERR_BAD_REQUEST,e));return}B.send(o||null)})},Iu=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,i;const o=function(d){if(!i){i=!0,a();const g=d instanceof Error?d:this.reason;r.abort(g instanceof Be?g:new qt(g instanceof Error?g.message:g))}};let s=t&&setTimeout(()=>{s=null,o(new Be(`timeout ${t} of ms exceeded`,Be.ETIMEDOUT))},t);const a=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(d=>{d.unsubscribe?d.unsubscribe(o):d.removeEventListener("abort",o)}),e=null)};e.forEach(d=>d.addEventListener("abort",o));const{signal:u}=r;return u.unsubscribe=()=>ie.asap(a),u}},Lu=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,i;for(;r<n;)i=r+t,yield e.slice(r,i),r=i},xu=async function*(e,t){for await(const n of Au(e))yield*Lu(n,t)},Au=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},Po=(e,t,n,r)=>{const i=xu(e,t);let o=0,s,a=u=>{s||(s=!0,r&&r(u))};return new ReadableStream({async pull(u){try{const{done:d,value:g}=await i.next();if(d){a(),u.close();return}let p=g.byteLength;if(n){let I=o+=p;n(I)}u.enqueue(new Uint8Array(g))}catch(d){throw a(d),d}},cancel(u){return a(u),i.return()}},{highWaterMark:2})},Fo=64*1024,{isFunction:Gn}=ie,Cu=(({Request:e,Response:t})=>({Request:e,Response:t}))(ie.global),{ReadableStream:ko,TextEncoder:Mo}=ie.global,Ho=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Tu=e=>{e=ie.merge.call({skipUndefined:!0},Cu,e);const{fetch:t,Request:n,Response:r}=e,i=t?Gn(t):typeof fetch=="function",o=Gn(n),s=Gn(r);if(!i)return!1;const a=i&&Gn(ko),u=i&&(typeof Mo=="function"?(h=>b=>h.encode(b))(new Mo):async h=>new Uint8Array(await new n(h).arrayBuffer())),d=o&&a&&Ho(()=>{let h=!1;const b=new n(He.origin,{body:new ko,method:"POST",get duplex(){return h=!0,"half"}}).headers.has("Content-Type");return h&&!b}),g=s&&a&&Ho(()=>ie.isReadableStream(new r("").body)),p={stream:g&&(h=>h.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(h=>{!p[h]&&(p[h]=(b,B)=>{let T=b&&b[h];if(T)return T.call(b);throw new Be(`Response type '${h}' is not supported`,Be.ERR_NOT_SUPPORT,B)})});const I=async h=>{if(h==null)return 0;if(ie.isBlob(h))return h.size;if(ie.isSpecCompliantForm(h))return(await new n(He.origin,{method:"POST",body:h}).arrayBuffer()).byteLength;if(ie.isArrayBufferView(h)||ie.isArrayBuffer(h))return h.byteLength;if(ie.isURLSearchParams(h)&&(h=h+""),ie.isString(h))return(await u(h)).byteLength},v=async(h,b)=>{const B=ie.toFiniteNumber(h.getContentLength());return B??I(b)};return async h=>{let{url:b,method:B,data:T,signal:H,cancelToken:$,timeout:Q,onDownloadProgress:U,onUploadProgress:P,responseType:K,headers:J,withCredentials:q="same-origin",fetchOptions:Z}=Ro(h),te=t||fetch;K=K?(K+"").toLowerCase():"text";let ne=Iu([H,$&&$.toAbortSignal()],Q),Y=null;const W=ne&&ne.unsubscribe&&(()=>{ne.unsubscribe()});let w;try{if(P&&d&&B!=="get"&&B!=="head"&&(w=await v(J,T))!==0){let f=new n(b,{method:"POST",body:T,duplex:"half"}),y;if(ie.isFormData(T)&&(y=f.headers.get("content-type"))&&J.setContentType(y),f.body){const[m,S]=Ao(w,Kn(Co(P)));T=Po(f.body,Fo,m,S)}}ie.isString(q)||(q=q?"include":"omit");const N=o&&"credentials"in n.prototype,L={...Z,signal:ne,method:B.toUpperCase(),headers:J.normalize().toJSON(),body:T,duplex:"half",credentials:N?q:void 0};Y=o&&new n(b,L);let E=await(o?te(Y,Z):te(b,L));const C=g&&(K==="stream"||K==="response");if(g&&(U||C&&W)){const f={};["status","statusText","headers"].forEach(x=>{f[x]=E[x]});const y=ie.toFiniteNumber(E.headers.get("content-length")),[m,S]=U&&Ao(y,Kn(Co(U),!0))||[];E=new r(Po(E.body,Fo,m,()=>{S&&S(),W&&W()}),f)}K=K||"text";let D=await p[ie.findKey(p,K)||"text"](E,h);return!C&&W&&W(),await new Promise((f,y)=>{xo(f,y,{data:D,headers:Ke.from(E.headers),status:E.status,statusText:E.statusText,config:h,request:Y})})}catch(N){throw W&&W(),N&&N.name==="TypeError"&&/Load failed|fetch/i.test(N.message)?Object.assign(new Be("Network Error",Be.ERR_NETWORK,h,Y),{cause:N.cause||N}):Be.from(N,N&&N.code,h,Y)}}},Ou=new Map,Uo=e=>{let t=e?e.env:{};const{fetch:n,Request:r,Response:i}=t,o=[r,i,n];let s=o.length,a=s,u,d,g=Ou;for(;a--;)u=o[a],d=g.get(u),d===void 0&&g.set(u,d=a?new Map:Tu(t)),g=d;return d};Uo();const Hr={http:Ql,xhr:Bu,fetch:{get:Uo}};ie.forEach(Hr,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const No=e=>`- ${e}`,Ru=e=>ie.isFunction(e)||e===null||e===!1,Do={getAdapter:(e,t)=>{e=ie.isArray(e)?e:[e];const{length:n}=e;let r,i;const o={};for(let s=0;s<n;s++){r=e[s];let a;if(i=r,!Ru(r)&&(i=Hr[(a=String(r)).toLowerCase()],i===void 0))throw new Be(`Unknown adapter '${a}'`);if(i&&(ie.isFunction(i)||(i=i.get(t))))break;o[a||"#"+s]=i}if(!i){const s=Object.entries(o).map(([u,d])=>`adapter ${u} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=n?s.length>1?`since :
|
|
4
|
-
`+s.map(No).join(`
|
|
5
|
-
`):" "+No(s[0]):"as no adapter specified";throw new Be("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return i},adapters:Hr};function Ur(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new qt(null,e)}function $o(e){return Ur(e),e.headers=Ke.from(e.headers),e.data=Mr.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Do.getAdapter(e.adapter||cn.adapter,e)(e).then(function(r){return Ur(e),r.data=Mr.call(e,e.transformResponse,r),r.headers=Ke.from(r.headers),r},function(r){return Lo(r)||(Ur(e),r&&r.response&&(r.response.data=Mr.call(e,e.transformResponse,r.response),r.response.headers=Ke.from(r.response.headers))),Promise.reject(r)})}const Vo="1.12.2",zn={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{zn[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const jo={};zn.transitional=function(t,n,r){function i(o,s){return"[Axios v"+Vo+"] Transitional option '"+o+"'"+s+(r?". "+r:"")}return(o,s,a)=>{if(t===!1)throw new Be(i(s," has been removed"+(n?" in "+n:"")),Be.ERR_DEPRECATED);return n&&!jo[s]&&(jo[s]=!0,console.warn(i(s," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,s,a):!0}},zn.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function Pu(e,t,n){if(typeof e!="object")throw new Be("options must be an object",Be.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const o=r[i],s=t[o];if(s){const a=e[o],u=a===void 0||s(a,o,e);if(u!==!0)throw new Be("option "+o+" must be "+u,Be.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Be("Unknown option "+o,Be.ERR_BAD_OPTION)}}const Zn={assertOptions:Pu,validators:zn},rt=Zn.validators;let At=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Eo,response:new Eo}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const o=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
6
|
-
`+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=xt(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:o}=n;r!==void 0&&Zn.assertOptions(r,{silentJSONParsing:rt.transitional(rt.boolean),forcedJSONParsing:rt.transitional(rt.boolean),clarifyTimeoutError:rt.transitional(rt.boolean)},!1),i!=null&&(ie.isFunction(i)?n.paramsSerializer={serialize:i}:Zn.assertOptions(i,{encode:rt.function,serialize:rt.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Zn.assertOptions(n,{baseUrl:rt.spelling("baseURL"),withXsrfToken:rt.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s=o&&ie.merge(o.common,o[n.method]);o&&ie.forEach(["delete","get","head","post","put","patch","common"],h=>{delete o[h]}),n.headers=Ke.concat(s,o);const a=[];let u=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(n)===!1||(u=u&&b.synchronous,a.unshift(b.fulfilled,b.rejected))});const d=[];this.interceptors.response.forEach(function(b){d.push(b.fulfilled,b.rejected)});let g,p=0,I;if(!u){const h=[$o.bind(this),void 0];for(h.unshift(...a),h.push(...d),I=h.length,g=Promise.resolve(n);p<I;)g=g.then(h[p++],h[p++]);return g}I=a.length;let v=n;for(;p<I;){const h=a[p++],b=a[p++];try{v=h(v)}catch(B){b.call(this,B);break}}try{g=$o.call(this,v)}catch(h){return Promise.reject(h)}for(p=0,I=d.length;p<I;)g=g.then(d[p++],d[p++]);return g}getUri(t){t=xt(this.defaults,t);const n=To(t.baseURL,t.url,t.allowAbsoluteUrls);return vo(n,t.params,t.paramsSerializer)}};ie.forEach(["delete","get","head","options"],function(t){At.prototype[t]=function(n,r){return this.request(xt(r||{},{method:t,url:n,data:(r||{}).data}))}}),ie.forEach(["post","put","patch"],function(t){function n(r){return function(o,s,a){return this.request(xt(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:s}))}}At.prototype[t]=n(),At.prototype[t+"Form"]=n(!0)});let Fu=class Qc{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(i=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](i);r._listeners=null}),this.promise.then=i=>{let o;const s=new Promise(a=>{r.subscribe(a),o=a}).then(i);return s.cancel=function(){r.unsubscribe(o)},s},t(function(o,s,a){r.reason||(r.reason=new qt(o,s,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Qc(function(i){t=i}),cancel:t}}};function ku(e){return function(n){return e.apply(null,n)}}function Mu(e){return ie.isObject(e)&&e.isAxiosError===!0}const Nr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Nr).forEach(([e,t])=>{Nr[t]=e});function qo(e){const t=new At(e),n=oo(At.prototype.request,t);return ie.extend(n,At.prototype,t,{allOwnKeys:!0}),ie.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return qo(xt(e,i))},n}const Pe=qo(cn);Pe.Axios=At,Pe.CanceledError=qt,Pe.CancelToken=Fu,Pe.isCancel=Lo,Pe.VERSION=Vo,Pe.toFormData=jn,Pe.AxiosError=Be,Pe.Cancel=Pe.CanceledError,Pe.all=function(t){return Promise.all(t)},Pe.spread=ku,Pe.isAxiosError=Mu,Pe.mergeConfig=xt,Pe.AxiosHeaders=Ke,Pe.formToJSON=e=>Bo(ie.isHTMLForm(e)?new FormData(e):e),Pe.getAdapter=Do.getAdapter,Pe.HttpStatusCode=Nr,Pe.default=Pe;const{Axios:gm,AxiosError:mm,CanceledError:_m,isCancel:bm,CancelToken:wm,VERSION:vm,all:Em,Cancel:Sm,isAxiosError:Bm,spread:Im,toFormData:Lm,AxiosHeaders:xm,HttpStatusCode:Am,formToJSON:Cm,getAdapter:Tm,mergeConfig:Om}=Pe,Ko="https://map-api.mapxus.co.jp/accounts/v1/auth/secure-token",Go="https://map-api.mapxus.co.jp/bms",Hu="https://map-sdk.mapxus.co.jp/prod/static/resources/manifest-z6frc5.dat",Ge=10,ze=1;var Dr=function(){return Dr=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Dr.apply(this,arguments)};function it(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function a(g){try{d(r.next(g))}catch(p){s(p)}}function u(g){try{d(r.throw(g))}catch(p){s(p)}}function d(g){g.done?o(g.value):i(g.value).then(a,u)}d((r=r.apply(e,t||[])).next())})}function ot(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(d){return function(g){return u([d,g])}}function u(d){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,d[0]&&(n=0)),n;)try{if(r=1,i&&(o=d[0]&2?i.return:d[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,d[1])).done)return o;switch(i=0,o&&(d=[d[0]&2,o.value]),d[0]){case 0:case 1:o=d;break;case 4:return n.label++,{value:d[1],done:!1};case 5:n.label++,i=d[1],d=[0];continue;case 7:d=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(d[0]===6||d[0]===2)){n=0;continue}if(d[0]===3&&(!o||d[1]>o[0]&&d[1]<o[3])){n.label=d[1];break}if(d[0]===6&&n.label<o[1]){n.label=o[1],o=d;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(d);break}o[2]&&n.ops.pop(),n.trys.pop();continue}d=t.call(e,n)}catch(g){d=[6,g],i=0}finally{r=o=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function zo(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var Zo="4.6.2";function Wn(e,t){return new Promise(function(n){return setTimeout(n,e,t)})}function Uu(){return new Promise(function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})}function Nu(e,t){t===void 0&&(t=1/0);var n=window.requestIdleCallback;return n?new Promise(function(r){return n.call(window,function(){return r()},{timeout:t})}):Wn(Math.min(e,t))}function Wo(e){return!!e&&typeof e.then=="function"}function Yo(e,t){try{var n=e();Wo(n)?n.then(function(r){return t(!0,r)},function(r){return t(!1,r)}):t(!0,n)}catch(r){t(!1,r)}}function Xo(e,t,n){return n===void 0&&(n=16),it(this,void 0,void 0,function(){var r,i,o,s;return ot(this,function(a){switch(a.label){case 0:r=Array(e.length),i=Date.now(),o=0,a.label=1;case 1:return o<e.length?(r[o]=t(e[o],o),s=Date.now(),s>=i+n?(i=s,[4,Uu()]):[3,3]):[3,4];case 2:a.sent(),a.label=3;case 3:return++o,[3,1];case 4:return[2,r]}})})}function un(e){return e.then(void 0,function(){}),e}function Du(e,t){for(var n=0,r=e.length;n<r;++n)if(e[n]===t)return!0;return!1}function $u(e,t){return!Du(e,t)}function $r(e){return parseInt(e)}function et(e){return parseFloat(e)}function ut(e,t){return typeof e=="number"&&isNaN(e)?t:e}function $e(e){return e.reduce(function(t,n){return t+(n?1:0)},0)}function Jo(e,t){if(t===void 0&&(t=1),Math.abs(t)>=1)return Math.round(e/t)*t;var n=1/t;return Math.round(e*n)/n}function Vu(e){for(var t,n,r="Unexpected syntax '".concat(e,"'"),i=/^\s*([a-z-]*)(.*)$/i.exec(e),o=i[1]||void 0,s={},a=/([.:#][\w-]+|\[.+?\])/gi,u=function(I,v){s[I]=s[I]||[],s[I].push(v)};;){var d=a.exec(i[2]);if(!d)break;var g=d[0];switch(g[0]){case".":u("class",g.slice(1));break;case"#":u("id",g.slice(1));break;case"[":{var p=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(g);if(p)u(p[1],(n=(t=p[4])!==null&&t!==void 0?t:p[5])!==null&&n!==void 0?n:"");else throw new Error(r);break}default:throw new Error(r)}}return[o,s]}function ju(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r>127)return new TextEncoder().encode(e);t[n]=r}return t}function _t(e,t){var n=e[0]>>>16,r=e[0]&65535,i=e[1]>>>16,o=e[1]&65535,s=t[0]>>>16,a=t[0]&65535,u=t[1]>>>16,d=t[1]&65535,g=0,p=0,I=0,v=0;v+=o+d,I+=v>>>16,v&=65535,I+=i+u,p+=I>>>16,I&=65535,p+=r+a,g+=p>>>16,p&=65535,g+=n+s,g&=65535,e[0]=g<<16|p,e[1]=I<<16|v}function Ye(e,t){var n=e[0]>>>16,r=e[0]&65535,i=e[1]>>>16,o=e[1]&65535,s=t[0]>>>16,a=t[0]&65535,u=t[1]>>>16,d=t[1]&65535,g=0,p=0,I=0,v=0;v+=o*d,I+=v>>>16,v&=65535,I+=i*d,p+=I>>>16,I&=65535,I+=o*u,p+=I>>>16,I&=65535,p+=r*d,g+=p>>>16,p&=65535,p+=i*u,g+=p>>>16,p&=65535,p+=o*a,g+=p>>>16,p&=65535,g+=n*d+r*u+i*a+o*s,g&=65535,e[0]=g<<16|p,e[1]=I<<16|v}function Kt(e,t){var n=e[0];t%=64,t===32?(e[0]=e[1],e[1]=n):t<32?(e[0]=n<<t|e[1]>>>32-t,e[1]=e[1]<<t|n>>>32-t):(t-=32,e[0]=e[1]<<t|n>>>32-t,e[1]=n<<t|e[1]>>>32-t)}function We(e,t){t%=64,t!==0&&(t<32?(e[0]=e[1]>>>32-t,e[1]=e[1]<<t):(e[0]=e[1]<<t-32,e[1]=0))}function Te(e,t){e[0]^=t[0],e[1]^=t[1]}var qu=[4283543511,3981806797],Ku=[3301882366,444984403];function Qo(e){var t=[0,e[0]>>>1];Te(e,t),Ye(e,qu),t[1]=e[0]>>>1,Te(e,t),Ye(e,Ku),t[1]=e[0]>>>1,Te(e,t)}var Yn=[2277735313,289559509],Xn=[1291169091,658871167],es=[0,5],Gu=[0,1390208809],zu=[0,944331445];function Zu(e,t){var n=ju(e);t=t||0;var r=[0,n.length],i=r[1]%16,o=r[1]-i,s=[0,t],a=[0,t],u=[0,0],d=[0,0],g;for(g=0;g<o;g=g+16)u[0]=n[g+4]|n[g+5]<<8|n[g+6]<<16|n[g+7]<<24,u[1]=n[g]|n[g+1]<<8|n[g+2]<<16|n[g+3]<<24,d[0]=n[g+12]|n[g+13]<<8|n[g+14]<<16|n[g+15]<<24,d[1]=n[g+8]|n[g+9]<<8|n[g+10]<<16|n[g+11]<<24,Ye(u,Yn),Kt(u,31),Ye(u,Xn),Te(s,u),Kt(s,27),_t(s,a),Ye(s,es),_t(s,Gu),Ye(d,Xn),Kt(d,33),Ye(d,Yn),Te(a,d),Kt(a,31),_t(a,s),Ye(a,es),_t(a,zu);u[0]=0,u[1]=0,d[0]=0,d[1]=0;var p=[0,0];switch(i){case 15:p[1]=n[g+14],We(p,48),Te(d,p);case 14:p[1]=n[g+13],We(p,40),Te(d,p);case 13:p[1]=n[g+12],We(p,32),Te(d,p);case 12:p[1]=n[g+11],We(p,24),Te(d,p);case 11:p[1]=n[g+10],We(p,16),Te(d,p);case 10:p[1]=n[g+9],We(p,8),Te(d,p);case 9:p[1]=n[g+8],Te(d,p),Ye(d,Xn),Kt(d,33),Ye(d,Yn),Te(a,d);case 8:p[1]=n[g+7],We(p,56),Te(u,p);case 7:p[1]=n[g+6],We(p,48),Te(u,p);case 6:p[1]=n[g+5],We(p,40),Te(u,p);case 5:p[1]=n[g+4],We(p,32),Te(u,p);case 4:p[1]=n[g+3],We(p,24),Te(u,p);case 3:p[1]=n[g+2],We(p,16),Te(u,p);case 2:p[1]=n[g+1],We(p,8),Te(u,p);case 1:p[1]=n[g],Te(u,p),Ye(u,Yn),Kt(u,31),Ye(u,Xn),Te(s,u)}return Te(s,r),Te(a,r),_t(s,a),_t(a,s),Qo(s),Qo(a),_t(s,a),_t(a,s),("00000000"+(s[0]>>>0).toString(16)).slice(-8)+("00000000"+(s[1]>>>0).toString(16)).slice(-8)+("00000000"+(a[0]>>>0).toString(16)).slice(-8)+("00000000"+(a[1]>>>0).toString(16)).slice(-8)}function Wu(e){var t;return Dr({name:e.name,message:e.message,stack:(t=e.stack)===null||t===void 0?void 0:t.split(`
|
|
7
|
-
`)},e)}function Yu(e){return/^function\s.*?\{\s*\[native code]\s*}$/.test(String(e))}function Xu(e){return typeof e!="function"}function Ju(e,t){var n=un(new Promise(function(r){var i=Date.now();Yo(e.bind(null,t),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var a=Date.now()-i;if(!o[0])return r(function(){return{error:o[1],duration:a}});var u=o[1];if(Xu(u))return r(function(){return{value:u,duration:a}});r(function(){return new Promise(function(d){var g=Date.now();Yo(u,function(){for(var p=[],I=0;I<arguments.length;I++)p[I]=arguments[I];var v=a+Date.now()-g;if(!p[0])return d({error:p[1],duration:v});d({value:p[1],duration:v})})})})})}));return function(){return n.then(function(i){return i()})}}function Qu(e,t,n,r){var i=Object.keys(e).filter(function(s){return $u(n,s)}),o=un(Xo(i,function(s){return Ju(e[s],t)},r));return function(){return it(this,void 0,void 0,function(){var a,u,d,g,p;return ot(this,function(I){switch(I.label){case 0:return[4,o];case 1:return a=I.sent(),[4,Xo(a,function(v){return un(v())},r)];case 2:return u=I.sent(),[4,Promise.all(u)];case 3:for(d=I.sent(),g={},p=0;p<i.length;++p)g[i[p]]=d[p];return[2,g]}})})}}function ts(){var e=window,t=navigator;return $e(["MSCSSMatrix"in e,"msSetImmediate"in e,"msIndexedDB"in e,"msMaxTouchPoints"in t,"msPointerEnabled"in t])>=4}function ed(){var e=window,t=navigator;return $e(["msWriteProfilerMark"in e,"MSStream"in e,"msLaunchUri"in t,"msSaveBlob"in t])>=3&&!ts()}function dn(){var e=window,t=navigator;return $e(["webkitPersistentStorage"in t,"webkitTemporaryStorage"in t,(t.vendor||"").indexOf("Google")===0,"webkitResolveLocalFileSystemURL"in e,"BatteryManager"in e,"webkitMediaStream"in e,"webkitSpeechGrammar"in e])>=5}function tt(){var e=window,t=navigator;return $e(["ApplePayError"in e,"CSSPrimitiveValue"in e,"Counter"in e,t.vendor.indexOf("Apple")===0,"RGBColor"in e,"WebKitMediaKeys"in e])>=4}function Vr(){var e=window,t=e.HTMLElement,n=e.Document;return $e(["safari"in e,!("ongestureend"in e),!("TouchEvent"in e),!("orientation"in e),t&&!("autocapitalize"in t.prototype),n&&"pointerLockElement"in n.prototype])>=4}function fn(){var e=window;return Yu(e.print)&&String(e.browser)==="[object WebPageNamespace]"}function ns(){var e,t,n=window;return $e(["buildID"in navigator,"MozAppearance"in((t=(e=document.documentElement)===null||e===void 0?void 0:e.style)!==null&&t!==void 0?t:{}),"onmozfullscreenchange"in n,"mozInnerScreenX"in n,"CSSMozDocumentRule"in n,"CanvasCaptureMediaStream"in n])>=4}function td(){var e=window;return $e([!("MediaSettingsRange"in e),"RTCEncodedAudioFrame"in e,""+e.Intl=="[object Intl]",""+e.Reflect=="[object Reflect]"])>=3}function nd(){var e=window,t=e.URLPattern;return $e(["union"in Set.prototype,"Iterator"in e,t&&"hasRegExpGroups"in t.prototype,"RGB8"in WebGLRenderingContext.prototype])>=3}function rd(){var e=window;return $e(["DOMRectList"in e,"RTCPeerConnectionIceEvent"in e,"SVGGeometryElement"in e,"ontransitioncancel"in e])>=3}function hn(){var e=window,t=navigator,n=e.CSS,r=e.HTMLButtonElement;return $e([!("getStorageUpdates"in t),r&&"popover"in r.prototype,"CSSCounterStyleRule"in e,n.supports("font-size-adjust: ex-height 0.5"),n.supports("text-transform: full-width")])>=4}function id(){if(navigator.platform==="iPad")return!0;var e=screen,t=e.width/e.height;return $e(["MediaSource"in window,!!Element.prototype.webkitRequestFullscreen,t>.65&&t<1.53])>=2}function od(){var e=document;return e.fullscreenElement||e.msFullscreenElement||e.mozFullScreenElement||e.webkitFullscreenElement||null}function sd(){var e=document;return(e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen).call(e)}function jr(){var e=dn(),t=ns(),n=window,r=navigator,i="connection";return e?$e([!("SharedWorker"in n),r[i]&&"ontypechange"in r[i],!("sinkId"in new Audio)])>=2:t?$e(["onorientationchange"in n,"orientation"in n,/android/i.test(r.appVersion)])>=2:!1}function ad(){var e=navigator,t=window,n=Audio.prototype,r=t.visualViewport;return $e(["srLatency"in n,"srChannelCount"in n,"devicePosture"in e,r&&"segments"in r,"getTextInformation"in Image.prototype])>=3}function cd(){return dd()?-4:ld()}function ld(){var e=window,t=e.OfflineAudioContext||e.webkitOfflineAudioContext;if(!t)return-2;if(ud())return-1;var n=4500,r=5e3,i=new t(1,r,44100),o=i.createOscillator();o.type="triangle",o.frequency.value=1e4;var s=i.createDynamicsCompressor();s.threshold.value=-50,s.knee.value=40,s.ratio.value=12,s.attack.value=0,s.release.value=.25,o.connect(s),s.connect(i.destination),o.start(0);var a=fd(i),u=a[0],d=a[1],g=un(u.then(function(p){return hd(p.getChannelData(0).subarray(n))},function(p){if(p.name==="timeout"||p.name==="suspended")return-3;throw p}));return function(){return d(),g}}function ud(){return tt()&&!Vr()&&!rd()}function dd(){return tt()&&hn()&&fn()||dn()&&ad()&&nd()}function fd(e){var t=3,n=500,r=500,i=5e3,o=function(){},s=new Promise(function(a,u){var d=!1,g=0,p=0;e.oncomplete=function(h){return a(h.renderedBuffer)};var I=function(){setTimeout(function(){return u(rs("timeout"))},Math.min(r,p+i-Date.now()))},v=function(){try{var h=e.startRendering();switch(Wo(h)&&un(h),e.state){case"running":p=Date.now(),d&&I();break;case"suspended":document.hidden||g++,d&&g>=t?u(rs("suspended")):setTimeout(v,n);break}}catch(b){u(b)}};v(),o=function(){d||(d=!0,p>0&&I())}});return[s,o]}function hd(e){for(var t=0,n=0;n<e.length;++n)t+=Math.abs(e[n]);return t}function rs(e){var t=new Error(e);return t.name=e,t}function is(e,t,n){var r,i,o;return n===void 0&&(n=50),it(this,void 0,void 0,function(){var s,a;return ot(this,function(u){switch(u.label){case 0:s=document,u.label=1;case 1:return s.body?[3,3]:[4,Wn(n)];case 2:return u.sent(),[3,1];case 3:a=s.createElement("iframe"),u.label=4;case 4:return u.trys.push([4,,10,11]),[4,new Promise(function(d,g){var p=!1,I=function(){p=!0,d()},v=function(B){p=!0,g(B)};a.onload=I,a.onerror=v;var h=a.style;h.setProperty("display","block","important"),h.position="absolute",h.top="0",h.left="0",h.visibility="hidden",t&&"srcdoc"in a?a.srcdoc=t:a.src="about:blank",s.body.appendChild(a);var b=function(){var B,T;p||(((T=(B=a.contentWindow)===null||B===void 0?void 0:B.document)===null||T===void 0?void 0:T.readyState)==="complete"?I():setTimeout(b,10))};b()})];case 5:u.sent(),u.label=6;case 6:return!((i=(r=a.contentWindow)===null||r===void 0?void 0:r.document)===null||i===void 0)&&i.body?[3,8]:[4,Wn(n)];case 7:return u.sent(),[3,6];case 8:return[4,e(a,a.contentWindow)];case 9:return[2,u.sent()];case 10:return(o=a.parentNode)===null||o===void 0||o.removeChild(a),[7];case 11:return[2]}})})}function pd(e){for(var t=Vu(e),n=t[0],r=t[1],i=document.createElement(n??"div"),o=0,s=Object.keys(r);o<s.length;o++){var a=s[o],u=r[a].join(" ");a==="style"?yd(i.style,u):i.setAttribute(a,u)}return i}function yd(e,t){for(var n=0,r=t.split(";");n<r.length;n++){var i=r[n],o=/^\s*([\w-]+)\s*:\s*(.+?)(\s*!([\w-]+))?\s*$/.exec(i);if(o){var s=o[1],a=o[2],u=o[4];e.setProperty(s,a,u||"")}}}function gd(){for(var e=window;;){var t=e.parent;if(!t||t===e)return!1;try{if(t.location.origin!==e.location.origin)return!0}catch(n){if(n instanceof Error&&n.name==="SecurityError")return!0;throw n}e=t}}var md="mmMwWLliI0O&1",_d="48px",Gt=["monospace","sans-serif","serif"],os=["sans-serif-thin","ARNO PRO","Agency FB","Arabic Typesetting","Arial Unicode MS","AvantGarde Bk BT","BankGothic Md BT","Batang","Bitstream Vera Sans Mono","Calibri","Century","Century Gothic","Clarendon","EUROSTILE","Franklin Gothic","Futura Bk BT","Futura Md BT","GOTHAM","Gill Sans","HELV","Haettenschweiler","Helvetica Neue","Humanst521 BT","Leelawadee","Letter Gothic","Levenim MT","Lucida Bright","Lucida Sans","Menlo","MS Mincho","MS Outlook","MS Reference Specialty","MS UI Gothic","MT Extra","MYRIAD PRO","Marlett","Meiryo UI","Microsoft Uighur","Minion Pro","Monotype Corsiva","PMingLiU","Pristina","SCRIPTINA","Segoe UI Light","Serifa","SimHei","Small Fonts","Staccato222 BT","TRAJAN PRO","Univers CE 55 Medium","Vrinda","ZWAdobeF"];function bd(){var e=this;return is(function(t,n){var r=n.document;return it(e,void 0,void 0,function(){var i,o,s,a,u,d,g,p,I,v,h,b;return ot(this,function(B){for(i=r.body,i.style.fontSize=_d,o=r.createElement("div"),o.style.setProperty("visibility","hidden","important"),s={},a={},u=function(T){var H=r.createElement("span"),$=H.style;return $.position="absolute",$.top="0",$.left="0",$.fontFamily=T,H.textContent=md,o.appendChild(H),H},d=function(T,H){return u("'".concat(T,"',").concat(H))},g=function(){return Gt.map(u)},p=function(){for(var T={},H=function(P){T[P]=Gt.map(function(K){return d(P,K)})},$=0,Q=os;$<Q.length;$++){var U=Q[$];H(U)}return T},I=function(T){return Gt.some(function(H,$){return T[$].offsetWidth!==s[H]||T[$].offsetHeight!==a[H]})},v=g(),h=p(),i.appendChild(o),b=0;b<Gt.length;b++)s[Gt[b]]=v[b].offsetWidth,a[Gt[b]]=v[b].offsetHeight;return[2,os.filter(function(T){return I(h[T])})]})})})}function wd(){var e=navigator.plugins;if(e){for(var t=[],n=0;n<e.length;++n){var r=e[n];if(r){for(var i=[],o=0;o<r.length;++o){var s=r[o];i.push({type:s.type,suffixes:s.suffixes})}t.push({name:r.name,description:r.description,mimeTypes:i})}}return t}}function vd(){return Ed(Cd())}function Ed(e){var t,n=!1,r,i,o=Sd(),s=o[0],a=o[1];return Bd(s,a)?(n=Id(a),e?r=i="skipped":(t=Ld(s,a),r=t[0],i=t[1])):r=i="unsupported",{winding:n,geometry:r,text:i}}function Sd(){var e=document.createElement("canvas");return e.width=1,e.height=1,[e,e.getContext("2d")]}function Bd(e,t){return!!(t&&e.toDataURL)}function Id(e){return e.rect(0,0,10,10),e.rect(2,2,6,6),!e.isPointInPath(5,5,"evenodd")}function Ld(e,t){xd(e,t);var n=qr(e),r=qr(e);if(n!==r)return["unstable","unstable"];Ad(e,t);var i=qr(e);return[i,n]}function xd(e,t){e.width=240,e.height=60,t.textBaseline="alphabetic",t.fillStyle="#f60",t.fillRect(100,1,62,20),t.fillStyle="#069",t.font='11pt "Times New Roman"';var n="Cwm fjordbank gly ".concat("😃");t.fillText(n,2,15),t.fillStyle="rgba(102, 204, 0, 0.2)",t.font="18pt Arial",t.fillText(n,4,45)}function Ad(e,t){e.width=122,e.height=110,t.globalCompositeOperation="multiply";for(var n=0,r=[["#f2f",40,40],["#2ff",80,40],["#ff2",60,80]];n<r.length;n++){var i=r[n],o=i[0],s=i[1],a=i[2];t.fillStyle=o,t.beginPath(),t.arc(s,a,40,0,Math.PI*2,!0),t.closePath(),t.fill()}t.fillStyle="#f9c",t.arc(60,60,60,0,Math.PI*2,!0),t.arc(60,60,20,0,Math.PI*2,!0),t.fill("evenodd")}function qr(e){return e.toDataURL()}function Cd(){return tt()&&hn()&&fn()}function Td(){var e=navigator,t=0,n;e.maxTouchPoints!==void 0?t=$r(e.maxTouchPoints):e.msMaxTouchPoints!==void 0&&(t=e.msMaxTouchPoints);try{document.createEvent("TouchEvent"),n=!0}catch{n=!1}var r="ontouchstart"in window;return{maxTouchPoints:t,touchEvent:n,touchStart:r}}function Od(){return navigator.oscpu}function Rd(){var e=navigator,t=[],n=e.language||e.userLanguage||e.browserLanguage||e.systemLanguage;if(n!==void 0&&t.push([n]),Array.isArray(e.languages))dn()&&td()||t.push(e.languages);else if(typeof e.languages=="string"){var r=e.languages;r&&t.push(r.split(","))}return t}function Pd(){return window.screen.colorDepth}function Fd(){return ut(et(navigator.deviceMemory),void 0)}function kd(){if(!(tt()&&hn()&&fn()))return Md()}function Md(){var e=screen,t=function(r){return ut($r(r),null)},n=[t(e.width),t(e.height)];return n.sort().reverse(),n}var Hd=2500,Ud=10,Jn,Kr;function Nd(){if(Kr===void 0){var e=function(){var t=Gr();zr(t)?Kr=setTimeout(e,Hd):(Jn=t,Kr=void 0)};e()}}function Dd(){var e=this;return Nd(),function(){return it(e,void 0,void 0,function(){var t;return ot(this,function(n){switch(n.label){case 0:return t=Gr(),zr(t)?Jn?[2,zo([],Jn,!0)]:od()?[4,sd()]:[3,2]:[3,2];case 1:n.sent(),t=Gr(),n.label=2;case 2:return zr(t)||(Jn=t),[2,t]}})})}}function $d(){var e=this;if(tt()&&hn()&&fn())return function(){return Promise.resolve(void 0)};var t=Dd();return function(){return it(e,void 0,void 0,function(){var n,r;return ot(this,function(i){switch(i.label){case 0:return[4,t()];case 1:return n=i.sent(),r=function(o){return o===null?null:Jo(o,Ud)},[2,[r(n[0]),r(n[1]),r(n[2]),r(n[3])]]}})})}}function Gr(){var e=screen;return[ut(et(e.availTop),null),ut(et(e.width)-et(e.availWidth)-ut(et(e.availLeft),0),null),ut(et(e.height)-et(e.availHeight)-ut(et(e.availTop),0),null),ut(et(e.availLeft),null)]}function zr(e){for(var t=0;t<4;++t)if(e[t])return!1;return!0}function Vd(){return ut($r(navigator.hardwareConcurrency),void 0)}function jd(){var e,t=(e=window.Intl)===null||e===void 0?void 0:e.DateTimeFormat;if(t){var n=new t().resolvedOptions().timeZone;if(n)return n}var r=-qd();return"UTC".concat(r>=0?"+":"").concat(r)}function qd(){var e=new Date().getFullYear();return Math.max(et(new Date(e,0,1).getTimezoneOffset()),et(new Date(e,6,1).getTimezoneOffset()))}function Kd(){try{return!!window.sessionStorage}catch{return!0}}function Gd(){try{return!!window.localStorage}catch{return!0}}function zd(){if(!(ts()||ed()))try{return!!window.indexedDB}catch{return!0}}function Zd(){return!!window.openDatabase}function Wd(){return navigator.cpuClass}function Yd(){var e=navigator.platform;return e==="MacIntel"&&tt()&&!Vr()?id()?"iPad":"iPhone":e}function Xd(){return navigator.vendor||""}function Jd(){for(var e=[],t=0,n=["chrome","safari","__crWeb","__gCrWeb","yandex","__yb","__ybro","__firefox__","__edgeTrackingPreventionStatistics","webkit","oprt","samsungAr","ucweb","UCShellJava","puffinDevice"];t<n.length;t++){var r=n[t],i=window[r];i&&typeof i=="object"&&e.push(r)}return e.sort()}function Qd(){var e=document;try{e.cookie="cookietest=1; SameSite=Strict;";var t=e.cookie.indexOf("cookietest=")!==-1;return e.cookie="cookietest=1; SameSite=Strict; expires=Thu, 01-Jan-1970 00:00:01 GMT",t}catch{return!1}}function ef(){var e=atob;return{abpIndo:["#Iklan-Melayang","#Kolom-Iklan-728","#SidebarIklan-wrapper",'[title="ALIENBOLA" i]',e("I0JveC1CYW5uZXItYWRz")],abpvn:[".quangcao","#mobileCatfish",e("LmNsb3NlLWFkcw=="),'[id^="bn_bottom_fixed_"]',"#pmadv"],adBlockFinland:[".mainostila",e("LnNwb25zb3JpdA=="),".ylamainos",e("YVtocmVmKj0iL2NsaWNrdGhyZ2guYXNwPyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hcHAucmVhZHBlYWsuY29tL2FkcyJd")],adBlockPersian:["#navbar_notice_50",".kadr",'TABLE[width="140px"]',"#divAgahi",e("YVtocmVmXj0iaHR0cDovL2cxLnYuZndtcm0ubmV0L2FkLyJd")],adBlockWarningRemoval:["#adblock-honeypot",".adblocker-root",".wp_adblock_detect",e("LmhlYWRlci1ibG9ja2VkLWFk"),e("I2FkX2Jsb2NrZXI=")],adGuardAnnoyances:[".hs-sosyal","#cookieconsentdiv",'div[class^="app_gdpr"]',".as-oil",'[data-cypress="soft-push-notification-modal"]'],adGuardBase:[".BetterJsPopOverlay",e("I2FkXzMwMFgyNTA="),e("I2Jhbm5lcmZsb2F0MjI="),e("I2NhbXBhaWduLWJhbm5lcg=="),e("I0FkLUNvbnRlbnQ=")],adGuardChinese:[e("LlppX2FkX2FfSA=="),e("YVtocmVmKj0iLmh0aGJldDM0LmNvbSJd"),"#widget-quan",e("YVtocmVmKj0iLzg0OTkyMDIwLnh5eiJd"),e("YVtocmVmKj0iLjE5NTZobC5jb20vIl0=")],adGuardFrench:["#pavePub",e("LmFkLWRlc2t0b3AtcmVjdGFuZ2xl"),".mobile_adhesion",".widgetadv",e("LmFkc19iYW4=")],adGuardGerman:['aside[data-portal-id="leaderboard"]'],adGuardJapanese:["#kauli_yad_1",e("YVtocmVmXj0iaHR0cDovL2FkMi50cmFmZmljZ2F0ZS5uZXQvIl0="),e("Ll9wb3BJbl9pbmZpbml0ZV9hZA=="),e("LmFkZ29vZ2xl"),e("Ll9faXNib29zdFJldHVybkFk")],adGuardMobile:[e("YW1wLWF1dG8tYWRz"),e("LmFtcF9hZA=="),'amp-embed[type="24smi"]',"#mgid_iframe1",e("I2FkX2ludmlld19hcmVh")],adGuardRussian:[e("YVtocmVmXj0iaHR0cHM6Ly9hZC5sZXRtZWFkcy5jb20vIl0="),e("LnJlY2xhbWE="),'div[id^="smi2adblock"]',e("ZGl2W2lkXj0iQWRGb3hfYmFubmVyXyJd"),"#psyduckpockeball"],adGuardSocial:[e("YVtocmVmXj0iLy93d3cuc3R1bWJsZXVwb24uY29tL3N1Ym1pdD91cmw9Il0="),e("YVtocmVmXj0iLy90ZWxlZ3JhbS5tZS9zaGFyZS91cmw/Il0="),".etsy-tweet","#inlineShare",".popup-social"],adGuardSpanishPortuguese:["#barraPublicidade","#Publicidade","#publiEspecial","#queTooltip",".cnt-publi"],adGuardTrackingProtection:["#qoo-counter",e("YVtocmVmXj0iaHR0cDovL2NsaWNrLmhvdGxvZy5ydS8iXQ=="),e("YVtocmVmXj0iaHR0cDovL2hpdGNvdW50ZXIucnUvdG9wL3N0YXQucGhwIl0="),e("YVtocmVmXj0iaHR0cDovL3RvcC5tYWlsLnJ1L2p1bXAiXQ=="),"#top100counter"],adGuardTurkish:["#backkapat",e("I3Jla2xhbWk="),e("YVtocmVmXj0iaHR0cDovL2Fkc2Vydi5vbnRlay5jb20udHIvIl0="),e("YVtocmVmXj0iaHR0cDovL2l6bGVuemkuY29tL2NhbXBhaWduLyJd"),e("YVtocmVmXj0iaHR0cDovL3d3dy5pbnN0YWxsYWRzLm5ldC8iXQ==")],bulgarian:[e("dGQjZnJlZW5ldF90YWJsZV9hZHM="),"#ea_intext_div",".lapni-pop-over","#xenium_hot_offers"],easyList:[".yb-floorad",e("LndpZGdldF9wb19hZHNfd2lkZ2V0"),e("LnRyYWZmaWNqdW5reS1hZA=="),".textad_headline",e("LnNwb25zb3JlZC10ZXh0LWxpbmtz")],easyListChina:[e("LmFwcGd1aWRlLXdyYXBbb25jbGljayo9ImJjZWJvcy5jb20iXQ=="),e("LmZyb250cGFnZUFkdk0="),"#taotaole","#aafoot.top_box",".cfa_popup"],easyListCookie:[".ezmob-footer",".cc-CookieWarning","[data-cookie-number]",e("LmF3LWNvb2tpZS1iYW5uZXI="),".sygnal24-gdpr-modal-wrap"],easyListCzechSlovak:["#onlajny-stickers",e("I3Jla2xhbW5pLWJveA=="),e("LnJla2xhbWEtbWVnYWJvYXJk"),".sklik",e("W2lkXj0ic2tsaWtSZWtsYW1hIl0=")],easyListDutch:[e("I2FkdmVydGVudGll"),e("I3ZpcEFkbWFya3RCYW5uZXJCbG9jaw=="),".adstekst",e("YVtocmVmXj0iaHR0cHM6Ly94bHR1YmUubmwvY2xpY2svIl0="),"#semilo-lrectangle"],easyListGermany:["#SSpotIMPopSlider",e("LnNwb25zb3JsaW5rZ3J1ZW4="),e("I3dlcmJ1bmdza3k="),e("I3Jla2xhbWUtcmVjaHRzLW1pdHRl"),e("YVtocmVmXj0iaHR0cHM6Ly9iZDc0Mi5jb20vIl0=")],easyListItaly:[e("LmJveF9hZHZfYW5udW5jaQ=="),".sb-box-pubbliredazionale",e("YVtocmVmXj0iaHR0cDovL2FmZmlsaWF6aW9uaWFkcy5zbmFpLml0LyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hZHNlcnZlci5odG1sLml0LyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hZmZpbGlhemlvbmlhZHMuc25haS5pdC8iXQ==")],easyListLithuania:[e("LnJla2xhbW9zX3RhcnBhcw=="),e("LnJla2xhbW9zX251b3JvZG9z"),e("aW1nW2FsdD0iUmVrbGFtaW5pcyBza3lkZWxpcyJd"),e("aW1nW2FsdD0iRGVkaWt1b3RpLmx0IHNlcnZlcmlhaSJd"),e("aW1nW2FsdD0iSG9zdGluZ2FzIFNlcnZlcmlhaS5sdCJd")],estonian:[e("QVtocmVmKj0iaHR0cDovL3BheTRyZXN1bHRzMjQuZXUiXQ==")],fanboyAnnoyances:["#ac-lre-player",".navigate-to-top","#subscribe_popup",".newsletter_holder","#back-top"],fanboyAntiFacebook:[".util-bar-module-firefly-visible"],fanboyEnhancedTrackers:[".open.pushModal","#issuem-leaky-paywall-articles-zero-remaining-nag","#sovrn_container",'div[class$="-hide"][zoompage-fontsize][style="display: block;"]',".BlockNag__Card"],fanboySocial:["#FollowUs","#meteored_share","#social_follow",".article-sharer",".community__social-desc"],frellwitSwedish:[e("YVtocmVmKj0iY2FzaW5vcHJvLnNlIl1bdGFyZ2V0PSJfYmxhbmsiXQ=="),e("YVtocmVmKj0iZG9rdG9yLXNlLm9uZWxpbmsubWUiXQ=="),"article.category-samarbete",e("ZGl2LmhvbGlkQWRz"),"ul.adsmodern"],greekAdBlock:[e("QVtocmVmKj0iYWRtYW4ub3RlbmV0LmdyL2NsaWNrPyJd"),e("QVtocmVmKj0iaHR0cDovL2F4aWFiYW5uZXJzLmV4b2R1cy5nci8iXQ=="),e("QVtocmVmKj0iaHR0cDovL2ludGVyYWN0aXZlLmZvcnRobmV0LmdyL2NsaWNrPyJd"),"DIV.agores300","TABLE.advright"],hungarian:["#cemp_doboz",".optimonk-iframe-container",e("LmFkX19tYWlu"),e("W2NsYXNzKj0iR29vZ2xlQWRzIl0="),"#hirdetesek_box"],iDontCareAboutCookies:['.alert-info[data-block-track*="CookieNotice"]',".ModuleTemplateCookieIndicator",".o--cookies--container","#cookies-policy-sticky","#stickyCookieBar"],icelandicAbp:[e("QVtocmVmXj0iL2ZyYW1ld29yay9yZXNvdXJjZXMvZm9ybXMvYWRzLmFzcHgiXQ==")],latvian:[e("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiAxMjBweDsgaGVpZ2h0OiA0MHB4OyBvdmVyZmxvdzogaGlkZGVuOyBwb3NpdGlvbjogcmVsYXRpdmU7Il0="),e("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiA4OHB4OyBoZWlnaHQ6IDMxcHg7IG92ZXJmbG93OiBoaWRkZW47IHBvc2l0aW9uOiByZWxhdGl2ZTsiXQ==")],listKr:[e("YVtocmVmKj0iLy9hZC5wbGFuYnBsdXMuY28ua3IvIl0="),e("I2xpdmVyZUFkV3JhcHBlcg=="),e("YVtocmVmKj0iLy9hZHYuaW1hZHJlcC5jby5rci8iXQ=="),e("aW5zLmZhc3R2aWV3LWFk"),".revenue_unit_item.dable"],listeAr:[e("LmdlbWluaUxCMUFk"),".right-and-left-sponsers",e("YVtocmVmKj0iLmFmbGFtLmluZm8iXQ=="),e("YVtocmVmKj0iYm9vcmFxLm9yZyJd"),e("YVtocmVmKj0iZHViaXp6bGUuY29tL2FyLz91dG1fc291cmNlPSJd")],listeFr:[e("YVtocmVmXj0iaHR0cDovL3Byb21vLnZhZG9yLmNvbS8iXQ=="),e("I2FkY29udGFpbmVyX3JlY2hlcmNoZQ=="),e("YVtocmVmKj0id2Vib3JhbWEuZnIvZmNnaS1iaW4vIl0="),".site-pub-interstitiel",'div[id^="crt-"][data-criteo-id]'],officialPolish:["#ceneo-placeholder-ceneo-12",e("W2hyZWZePSJodHRwczovL2FmZi5zZW5kaHViLnBsLyJd"),e("YVtocmVmXj0iaHR0cDovL2Fkdm1hbmFnZXIudGVjaGZ1bi5wbC9yZWRpcmVjdC8iXQ=="),e("YVtocmVmXj0iaHR0cDovL3d3dy50cml6ZXIucGwvP3V0bV9zb3VyY2UiXQ=="),e("ZGl2I3NrYXBpZWNfYWQ=")],ro:[e("YVtocmVmXj0iLy9hZmZ0cmsuYWx0ZXgucm8vQ291bnRlci9DbGljayJd"),e("YVtocmVmXj0iaHR0cHM6Ly9ibGFja2ZyaWRheXNhbGVzLnJvL3Ryay9zaG9wLyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9ldmVudC4ycGVyZm9ybWFudC5jb20vZXZlbnRzL2NsaWNrIl0="),e("YVtocmVmXj0iaHR0cHM6Ly9sLnByb2ZpdHNoYXJlLnJvLyJd"),'a[href^="/url/"]'],ruAd:[e("YVtocmVmKj0iLy9mZWJyYXJlLnJ1LyJd"),e("YVtocmVmKj0iLy91dGltZy5ydS8iXQ=="),e("YVtocmVmKj0iOi8vY2hpa2lkaWtpLnJ1Il0="),"#pgeldiz",".yandex-rtb-block"],thaiAds:["a[href*=macau-uta-popup]",e("I2Fkcy1nb29nbGUtbWlkZGxlX3JlY3RhbmdsZS1ncm91cA=="),e("LmFkczMwMHM="),".bumq",".img-kosana"],webAnnoyancesUltralist:["#mod-social-share-2","#social-tools",e("LmN0cGwtZnVsbGJhbm5lcg=="),".zergnet-recommend",".yt.btn-link.btn-md.btn"]}}function tf(e){var t=e===void 0?{}:e,n=t.debug;return it(this,void 0,void 0,function(){var r,i,o,s,a,u;return ot(this,function(d){switch(d.label){case 0:return nf()?(r=ef(),i=Object.keys(r),o=(u=[]).concat.apply(u,i.map(function(g){return r[g]})),[4,rf(o)]):[2,void 0];case 1:return s=d.sent(),n&&of(r,s),a=i.filter(function(g){var p=r[g],I=$e(p.map(function(v){return s[v]}));return I>p.length*.6}),a.sort(),[2,a]}})})}function nf(){return tt()||jr()}function rf(e){var t;return it(this,void 0,void 0,function(){var n,r,i,o,u,s,a,u;return ot(this,function(d){switch(d.label){case 0:for(n=document,r=n.createElement("div"),i=new Array(e.length),o={},ss(r),u=0;u<e.length;++u)s=pd(e[u]),s.tagName==="DIALOG"&&s.show(),a=n.createElement("div"),ss(a),a.appendChild(s),r.appendChild(a),i[u]=s;d.label=1;case 1:return n.body?[3,3]:[4,Wn(50)];case 2:return d.sent(),[3,1];case 3:n.body.appendChild(r);try{for(u=0;u<e.length;++u)i[u].offsetParent||(o[e[u]]=!0)}finally{(t=r.parentNode)===null||t===void 0||t.removeChild(r)}return[2,o]}})})}function ss(e){e.style.setProperty("visibility","hidden","important"),e.style.setProperty("display","block","important")}function of(e,t){for(var n="DOM blockers debug:\n```",r=0,i=Object.keys(e);r<i.length;r++){var o=i[r];n+=`
|
|
8
|
-
`.concat(o,":");for(var s=0,a=e[o];s<a.length;s++){var u=a[s];n+=`
|
|
9
|
-
`.concat(t[u]?"🚫":"➡️"," ").concat(u)}}console.log("".concat(n,"\n```"))}function sf(){for(var e=0,t=["rec2020","p3","srgb"];e<t.length;e++){var n=t[e];if(matchMedia("(color-gamut: ".concat(n,")")).matches)return n}}function af(){if(as("inverted"))return!0;if(as("none"))return!1}function as(e){return matchMedia("(inverted-colors: ".concat(e,")")).matches}function cf(){if(cs("active"))return!0;if(cs("none"))return!1}function cs(e){return matchMedia("(forced-colors: ".concat(e,")")).matches}var lf=100;function uf(){if(matchMedia("(min-monochrome: 0)").matches){for(var e=0;e<=lf;++e)if(matchMedia("(max-monochrome: ".concat(e,")")).matches)return e;throw new Error("Too high value")}}function df(){if(zt("no-preference"))return 0;if(zt("high")||zt("more"))return 1;if(zt("low")||zt("less"))return-1;if(zt("forced"))return 10}function zt(e){return matchMedia("(prefers-contrast: ".concat(e,")")).matches}function ff(){if(ls("reduce"))return!0;if(ls("no-preference"))return!1}function ls(e){return matchMedia("(prefers-reduced-motion: ".concat(e,")")).matches}function hf(){if(us("reduce"))return!0;if(us("no-preference"))return!1}function us(e){return matchMedia("(prefers-reduced-transparency: ".concat(e,")")).matches}function pf(){if(ds("high"))return!0;if(ds("standard"))return!1}function ds(e){return matchMedia("(dynamic-range: ".concat(e,")")).matches}var Ie=Math,Ve=function(){return 0};function yf(){var e=Ie.acos||Ve,t=Ie.acosh||Ve,n=Ie.asin||Ve,r=Ie.asinh||Ve,i=Ie.atanh||Ve,o=Ie.atan||Ve,s=Ie.sin||Ve,a=Ie.sinh||Ve,u=Ie.cos||Ve,d=Ie.cosh||Ve,g=Ie.tan||Ve,p=Ie.tanh||Ve,I=Ie.exp||Ve,v=Ie.expm1||Ve,h=Ie.log1p||Ve,b=function(J){return Ie.pow(Ie.PI,J)},B=function(J){return Ie.log(J+Ie.sqrt(J*J-1))},T=function(J){return Ie.log(J+Ie.sqrt(J*J+1))},H=function(J){return Ie.log((1+J)/(1-J))/2},$=function(J){return Ie.exp(J)-1/Ie.exp(J)/2},Q=function(J){return(Ie.exp(J)+1/Ie.exp(J))/2},U=function(J){return Ie.exp(J)-1},P=function(J){return(Ie.exp(2*J)-1)/(Ie.exp(2*J)+1)},K=function(J){return Ie.log(1+J)};return{acos:e(.12312423423423424),acosh:t(1e308),acoshPf:B(1e154),asin:n(.12312423423423424),asinh:r(1),asinhPf:T(1),atanh:i(.5),atanhPf:H(.5),atan:o(.5),sin:s(-1e300),sinh:a(1),sinhPf:$(1),cos:u(10.000000000123),cosh:d(1),coshPf:Q(1),tan:g(-1e300),tanh:p(1),tanhPf:P(1),exp:I(1),expm1:v(1),expm1Pf:U(1),log1p:h(10),log1pPf:K(10),powPI:b(-100)}}var gf="mmMwWLliI0fiflO&1",Zr={default:[],apple:[{font:"-apple-system-body"}],serif:[{fontFamily:"serif"}],sans:[{fontFamily:"sans-serif"}],mono:[{fontFamily:"monospace"}],min:[{fontSize:"1px"}],system:[{fontFamily:"system-ui"}]};function mf(){return _f(function(e,t){for(var n={},r={},i=0,o=Object.keys(Zr);i<o.length;i++){var s=o[i],a=Zr[s],u=a[0],d=u===void 0?{}:u,g=a[1],p=g===void 0?gf:g,I=e.createElement("span");I.textContent=p,I.style.whiteSpace="nowrap";for(var v=0,h=Object.keys(d);v<h.length;v++){var b=h[v],B=d[b];B!==void 0&&(I.style[b]=B)}n[s]=I,t.append(e.createElement("br"),I)}for(var T=0,H=Object.keys(Zr);T<H.length;T++){var s=H[T];r[s]=n[s].getBoundingClientRect().width}return r})}function _f(e,t){return t===void 0&&(t=4e3),is(function(n,r){var i=r.document,o=i.body,s=o.style;s.width="".concat(t,"px"),s.webkitTextSizeAdjust=s.textSizeAdjust="none",dn()?o.style.zoom="".concat(1/r.devicePixelRatio):tt()&&(o.style.zoom="reset");var a=i.createElement("div");return a.textContent=zo([],Array(t/20<<0),!0).map(function(){return"word"}).join(" "),o.appendChild(a),e(i,o)},'<!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1">')}function bf(){return navigator.pdfViewerEnabled}function wf(){var e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]=e[0]-e[0],t[3]}function vf(){var e=window.ApplePaySession;if(typeof e?.canMakePayments!="function")return-1;if(Ef())return-3;try{return e.canMakePayments()?1:0}catch(t){return Sf(t)}}var Ef=gd;function Sf(e){if(e instanceof Error&&e.name==="InvalidAccessError"&&/\bfrom\b.*\binsecure\b/i.test(e.message))return-2;throw e}function Bf(){var e,t=document.createElement("a"),n=(e=t.attributionSourceId)!==null&&e!==void 0?e:t.attributionsourceid;return n===void 0?void 0:String(n)}var fs=-1,hs=-2,If=new Set([10752,2849,2884,2885,2886,2928,2929,2930,2931,2932,2960,2961,2962,2963,2964,2965,2966,2967,2968,2978,3024,3042,3088,3089,3106,3107,32773,32777,32777,32823,32824,32936,32937,32938,32939,32968,32969,32970,32971,3317,33170,3333,3379,3386,33901,33902,34016,34024,34076,3408,3410,3411,3412,3413,3414,3415,34467,34816,34817,34818,34819,34877,34921,34930,35660,35661,35724,35738,35739,36003,36004,36005,36347,36348,36349,37440,37441,37443,7936,7937,7938]),Lf=new Set([34047,35723,36063,34852,34853,34854,34229,36392,36795,38449]),xf=["FRAGMENT_SHADER","VERTEX_SHADER"],Af=["LOW_FLOAT","MEDIUM_FLOAT","HIGH_FLOAT","LOW_INT","MEDIUM_INT","HIGH_INT"],ps="WEBGL_debug_renderer_info",Cf="WEBGL_polygon_mode";function Tf(e){var t,n,r,i,o,s,a=e.cache,u=ys(a);if(!u)return fs;if(!_s(u))return hs;var d=ms()?null:u.getExtension(ps);return{version:((t=u.getParameter(u.VERSION))===null||t===void 0?void 0:t.toString())||"",vendor:((n=u.getParameter(u.VENDOR))===null||n===void 0?void 0:n.toString())||"",vendorUnmasked:d?(r=u.getParameter(d.UNMASKED_VENDOR_WEBGL))===null||r===void 0?void 0:r.toString():"",renderer:((i=u.getParameter(u.RENDERER))===null||i===void 0?void 0:i.toString())||"",rendererUnmasked:d?(o=u.getParameter(d.UNMASKED_RENDERER_WEBGL))===null||o===void 0?void 0:o.toString():"",shadingLanguageVersion:((s=u.getParameter(u.SHADING_LANGUAGE_VERSION))===null||s===void 0?void 0:s.toString())||""}}function Of(e){var t=e.cache,n=ys(t);if(!n)return fs;if(!_s(n))return hs;var r=n.getSupportedExtensions(),i=n.getContextAttributes(),o=[],s=[],a=[],u=[],d=[];if(i)for(var g=0,p=Object.keys(i);g<p.length;g++){var I=p[g];s.push("".concat(I,"=").concat(i[I]))}for(var v=gs(n),h=0,b=v;h<b.length;h++){var B=b[h],T=n[B];a.push("".concat(B,"=").concat(T).concat(If.has(T)?"=".concat(n.getParameter(T)):""))}if(r)for(var H=0,$=r;H<$.length;H++){var Q=$[H];if(!(Q===ps&&ms()||Q===Cf&&Ff())){var U=n.getExtension(Q);if(!U){o.push(Q);continue}for(var P=0,K=gs(U);P<K.length;P++){var B=K[P],T=U[B];u.push("".concat(B,"=").concat(T).concat(Lf.has(T)?"=".concat(n.getParameter(T)):""))}}}for(var J=0,q=xf;J<q.length;J++)for(var Z=q[J],te=0,ne=Af;te<ne.length;te++){var Y=ne[te],W=Rf(n,Z,Y);d.push("".concat(Z,".").concat(Y,"=").concat(W.join(",")))}return u.sort(),a.sort(),{contextAttributes:s,parameters:a,shaderPrecisions:d,extensions:r,extensionParameters:u,unsupportedExtensions:o}}function ys(e){if(e.webgl)return e.webgl.context;var t=document.createElement("canvas"),n;t.addEventListener("webglCreateContextError",function(){return n=void 0});for(var r=0,i=["webgl","experimental-webgl"];r<i.length;r++){var o=i[r];try{n=t.getContext(o)}catch{}if(n)break}return e.webgl={context:n},n}function Rf(e,t,n){var r=e.getShaderPrecisionFormat(e[t],e[n]);return r?[r.rangeMin,r.rangeMax,r.precision]:[]}function gs(e){var t=Object.keys(e.__proto__);return t.filter(Pf)}function Pf(e){return typeof e=="string"&&!e.match(/[^A-Z0-9_x]/)}function ms(){return ns()}function Ff(){return dn()||tt()}function _s(e){return typeof e.getParameter=="function"}function kf(){var e=jr()||tt();if(!e)return-2;if(!window.AudioContext)return-1;var t=new AudioContext().baseLatency;return t==null?-1:isFinite(t)?t:-3}function Mf(){if(!window.Intl)return-1;var e=window.Intl.DateTimeFormat;if(!e)return-2;var t=e().resolvedOptions().locale;return!t&&t!==""?-3:t}var Hf={fonts:bd,domBlockers:tf,fontPreferences:mf,audio:cd,screenFrame:$d,canvas:vd,osCpu:Od,languages:Rd,colorDepth:Pd,deviceMemory:Fd,screenResolution:kd,hardwareConcurrency:Vd,timezone:jd,sessionStorage:Kd,localStorage:Gd,indexedDB:zd,openDatabase:Zd,cpuClass:Wd,platform:Yd,plugins:wd,touchSupport:Td,vendor:Xd,vendorFlavors:Jd,cookiesEnabled:Qd,colorGamut:sf,invertedColors:af,forcedColors:cf,monochrome:uf,contrast:df,reducedMotion:ff,reducedTransparency:hf,hdr:pf,math:yf,pdfViewerEnabled:bf,architecture:wf,applePay:vf,privateClickMeasurement:Bf,audioBaseLatency:kf,dateTimeLocale:Mf,webGlBasics:Tf,webGlExtensions:Of};function Uf(e){return Qu(Hf,e,[])}var Nf="$ if upgrade to Pro: https://fpjs.dev/pro";function Df(e){var t=$f(e),n=Vf(t);return{score:t,comment:Nf.replace(/\$/g,"".concat(n))}}function $f(e){if(jr())return .4;if(tt())return Vr()&&!(hn()&&fn())?.5:.3;var t="value"in e.platform?e.platform.value:"";return/^Win/.test(t)?.6:/^Mac/.test(t)?.5:.7}function Vf(e){return Jo(.99+.01*e,1e-4)}function jf(e){for(var t="",n=0,r=Object.keys(e).sort();n<r.length;n++){var i=r[n],o=e[i],s="error"in o?"error":JSON.stringify(o.value);t+="".concat(t?"|":"").concat(i.replace(/([:|\\])/g,"\\$1"),":").concat(s)}return t}function bs(e){return JSON.stringify(e,function(t,n){return n instanceof Error?Wu(n):n},2)}function ws(e){return Zu(jf(e))}function qf(e){var t,n=Df(e);return{get visitorId(){return t===void 0&&(t=ws(this.components)),t},set visitorId(r){t=r},confidence:n,components:e,version:Zo}}function Kf(e){return e===void 0&&(e=50),Nu(e,e*2)}function Gf(e,t){var n=Date.now();return{get:function(r){return it(this,void 0,void 0,function(){var i,o,s;return ot(this,function(a){switch(a.label){case 0:return i=Date.now(),[4,e()];case 1:return o=a.sent(),s=qf(o),(t||r?.debug)&&console.log("Copy the text below to get the debug data:\n\n```\nversion: ".concat(s.version,`
|
|
10
|
-
userAgent: `).concat(navigator.userAgent,`
|
|
11
|
-
timeBetweenLoadAndGet: `).concat(i-n,`
|
|
12
|
-
visitorId: `).concat(s.visitorId,`
|
|
13
|
-
components: `).concat(bs(o),"\n```")),[2,s]}})})}}}function zf(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var e=new XMLHttpRequest;e.open("get","https://m1.openfpcdn.io/fingerprintjs/v".concat(Zo,"/npm-monitoring"),!0),e.send()}catch(t){console.error(t)}}function Zf(e){var t;return e===void 0&&(e={}),it(this,void 0,void 0,function(){var n,r,i;return ot(this,function(o){switch(o.label){case 0:return(!((t=e.monitoring)!==null&&t!==void 0)||t)&&zf(),n=e.delayFallback,r=e.debug,[4,Kf(n)];case 1:return o.sent(),i=Uf({cache:{},debug:r}),[2,Gf(i,r)]}})})}var vs={load:Zf,hashComponents:ws,componentsToDebugString:bs};const pn={version:"9.3.0"};let Es=[];const Wf={[Symbol.for("mapxus/callers-register")]:e=>{Es=e}};function Yf(){return Es}const Qn="-webkit-extension-67d8e3e8-";let er=null;async function Xf(){let e=sessionStorage.getItem(Qn);if(!e)try{Ss(),await Bs(Date.now()),e=sessionStorage.getItem(Qn)}catch(t){throw new Error("Failed to fetch public key: "+t)}return e}function Ss(){sessionStorage.removeItem(Qn),er&&(clearTimeout(er),er=null)}function Jf(e){sessionStorage.setItem(Qn,e)}async function Bs(e){try{const t=await fetch(`${Hu}?timestamp=${e}`,{method:"GET",headers:{"Content-Type":"text/plain"}}),{headers:n}=t,r=parseInt(n.get("x-retry-in"));er=setTimeout(async()=>{await Bs(e)},r*1e3),Jf(await t.text())}catch(t){throw t}}function Is(){return nt.getInstance().getIdentifier()}function Qf(e){nt.getInstance().setTokenGetter(e)}function eh(){return nt.getInstance().setupTokenManager()}var Wr={},yn={},Ls;function th(){if(Ls)return yn;Ls=1,yn.byteLength=a,yn.toByteArray=d,yn.fromByteArray=I;for(var e=[],t=[],n=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=r.length;i<o;++i)e[i]=r[i],t[r.charCodeAt(i)]=i;t[45]=62,t[95]=63;function s(v){var h=v.length;if(h%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var b=v.indexOf("=");b===-1&&(b=h);var B=b===h?0:4-b%4;return[b,B]}function a(v){var h=s(v),b=h[0],B=h[1];return(b+B)*3/4-B}function u(v,h,b){return(h+b)*3/4-b}function d(v){var h,b=s(v),B=b[0],T=b[1],H=new n(u(v,B,T)),$=0,Q=T>0?B-4:B,U;for(U=0;U<Q;U+=4)h=t[v.charCodeAt(U)]<<18|t[v.charCodeAt(U+1)]<<12|t[v.charCodeAt(U+2)]<<6|t[v.charCodeAt(U+3)],H[$++]=h>>16&255,H[$++]=h>>8&255,H[$++]=h&255;return T===2&&(h=t[v.charCodeAt(U)]<<2|t[v.charCodeAt(U+1)]>>4,H[$++]=h&255),T===1&&(h=t[v.charCodeAt(U)]<<10|t[v.charCodeAt(U+1)]<<4|t[v.charCodeAt(U+2)]>>2,H[$++]=h>>8&255,H[$++]=h&255),H}function g(v){return e[v>>18&63]+e[v>>12&63]+e[v>>6&63]+e[v&63]}function p(v,h,b){for(var B,T=[],H=h;H<b;H+=3)B=(v[H]<<16&16711680)+(v[H+1]<<8&65280)+(v[H+2]&255),T.push(g(B));return T.join("")}function I(v){for(var h,b=v.length,B=b%3,T=[],H=16383,$=0,Q=b-B;$<Q;$+=H)T.push(p(v,$,$+H>Q?Q:$+H));return B===1?(h=v[b-1],T.push(e[h>>2]+e[h<<4&63]+"==")):B===2&&(h=(v[b-2]<<8)+v[b-1],T.push(e[h>>10]+e[h>>4&63]+e[h<<2&63]+"=")),T.join("")}return yn}var tr={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var xs;function nh(){return xs||(xs=1,tr.read=function(e,t,n,r,i){var o,s,a=i*8-r-1,u=(1<<a)-1,d=u>>1,g=-7,p=n?i-1:0,I=n?-1:1,v=e[t+p];for(p+=I,o=v&(1<<-g)-1,v>>=-g,g+=a;g>0;o=o*256+e[t+p],p+=I,g-=8);for(s=o&(1<<-g)-1,o>>=-g,g+=r;g>0;s=s*256+e[t+p],p+=I,g-=8);if(o===0)o=1-d;else{if(o===u)return s?NaN:(v?-1:1)*(1/0);s=s+Math.pow(2,r),o=o-d}return(v?-1:1)*s*Math.pow(2,o-r)},tr.write=function(e,t,n,r,i,o){var s,a,u,d=o*8-i-1,g=(1<<d)-1,p=g>>1,I=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=r?0:o-1,h=r?1:-1,b=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=g):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+p>=1?t+=I/u:t+=I*Math.pow(2,1-p),t*u>=2&&(s++,u/=2),s+p>=g?(a=0,s=g):s+p>=1?(a=(t*u-1)*Math.pow(2,i),s=s+p):(a=t*Math.pow(2,p-1)*Math.pow(2,i),s=0));i>=8;e[n+v]=a&255,v+=h,a/=256,i-=8);for(s=s<<i|a,d+=i;d>0;e[n+v]=s&255,v+=h,s/=256,d-=8);e[n+v-h]|=b*128}),tr}/*!
|
|
14
|
-
* The buffer module from node.js, for the browser.
|
|
15
|
-
*
|
|
16
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
|
17
|
-
* @license MIT
|
|
18
|
-
*/var As;function rh(){return As||(As=1,(function(e){const t=th(),n=nh(),r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=a,e.SlowBuffer=H,e.INSPECT_MAX_BYTES=50;const i=2147483647;e.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=o(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function o(){try{const _=new Uint8Array(1),c={foo:function(){return 42}};return Object.setPrototypeOf(c,Uint8Array.prototype),Object.setPrototypeOf(_,c),_.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function s(_){if(_>i)throw new RangeError('The value "'+_+'" is invalid for option "size"');const c=new Uint8Array(_);return Object.setPrototypeOf(c,a.prototype),c}function a(_,c,l){if(typeof _=="number"){if(typeof c=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return p(_)}return u(_,c,l)}a.poolSize=8192;function u(_,c,l){if(typeof _=="string")return I(_,c);if(ArrayBuffer.isView(_))return h(_);if(_==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof _);if(ye(_,ArrayBuffer)||_&&ye(_.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ye(_,SharedArrayBuffer)||_&&ye(_.buffer,SharedArrayBuffer)))return b(_,c,l);if(typeof _=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const A=_.valueOf&&_.valueOf();if(A!=null&&A!==_)return a.from(A,c,l);const V=B(_);if(V)return V;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof _[Symbol.toPrimitive]=="function")return a.from(_[Symbol.toPrimitive]("string"),c,l);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof _)}a.from=function(_,c,l){return u(_,c,l)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function d(_){if(typeof _!="number")throw new TypeError('"size" argument must be of type number');if(_<0)throw new RangeError('The value "'+_+'" is invalid for option "size"')}function g(_,c,l){return d(_),_<=0?s(_):c!==void 0?typeof l=="string"?s(_).fill(c,l):s(_).fill(c):s(_)}a.alloc=function(_,c,l){return g(_,c,l)};function p(_){return d(_),s(_<0?0:T(_)|0)}a.allocUnsafe=function(_){return p(_)},a.allocUnsafeSlow=function(_){return p(_)};function I(_,c){if((typeof c!="string"||c==="")&&(c="utf8"),!a.isEncoding(c))throw new TypeError("Unknown encoding: "+c);const l=$(_,c)|0;let A=s(l);const V=A.write(_,c);return V!==l&&(A=A.slice(0,V)),A}function v(_){const c=_.length<0?0:T(_.length)|0,l=s(c);for(let A=0;A<c;A+=1)l[A]=_[A]&255;return l}function h(_){if(ye(_,Uint8Array)){const c=new Uint8Array(_);return b(c.buffer,c.byteOffset,c.byteLength)}return v(_)}function b(_,c,l){if(c<0||_.byteLength<c)throw new RangeError('"offset" is outside of buffer bounds');if(_.byteLength<c+(l||0))throw new RangeError('"length" is outside of buffer bounds');let A;return c===void 0&&l===void 0?A=new Uint8Array(_):l===void 0?A=new Uint8Array(_,c):A=new Uint8Array(_,c,l),Object.setPrototypeOf(A,a.prototype),A}function B(_){if(a.isBuffer(_)){const c=T(_.length)|0,l=s(c);return l.length===0||_.copy(l,0,0,c),l}if(_.length!==void 0)return typeof _.length!="number"||pe(_.length)?s(0):v(_);if(_.type==="Buffer"&&Array.isArray(_.data))return v(_.data)}function T(_){if(_>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return _|0}function H(_){return+_!=_&&(_=0),a.alloc(+_)}a.isBuffer=function(c){return c!=null&&c._isBuffer===!0&&c!==a.prototype},a.compare=function(c,l){if(ye(c,Uint8Array)&&(c=a.from(c,c.offset,c.byteLength)),ye(l,Uint8Array)&&(l=a.from(l,l.offset,l.byteLength)),!a.isBuffer(c)||!a.isBuffer(l))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(c===l)return 0;let A=c.length,V=l.length;for(let ee=0,re=Math.min(A,V);ee<re;++ee)if(c[ee]!==l[ee]){A=c[ee],V=l[ee];break}return A<V?-1:V<A?1:0},a.isEncoding=function(c){switch(String(c).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(c,l){if(!Array.isArray(c))throw new TypeError('"list" argument must be an Array of Buffers');if(c.length===0)return a.alloc(0);let A;if(l===void 0)for(l=0,A=0;A<c.length;++A)l+=c[A].length;const V=a.allocUnsafe(l);let ee=0;for(A=0;A<c.length;++A){let re=c[A];if(ye(re,Uint8Array))ee+re.length>V.length?(a.isBuffer(re)||(re=a.from(re)),re.copy(V,ee)):Uint8Array.prototype.set.call(V,re,ee);else if(a.isBuffer(re))re.copy(V,ee);else throw new TypeError('"list" argument must be an Array of Buffers');ee+=re.length}return V};function $(_,c){if(a.isBuffer(_))return _.length;if(ArrayBuffer.isView(_)||ye(_,ArrayBuffer))return _.byteLength;if(typeof _!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof _);const l=_.length,A=arguments.length>2&&arguments[2]===!0;if(!A&&l===0)return 0;let V=!1;for(;;)switch(c){case"ascii":case"latin1":case"binary":return l;case"utf8":case"utf-8":return ue(_).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return l*2;case"hex":return l>>>1;case"base64":return fe(_).length;default:if(V)return A?-1:ue(_).length;c=(""+c).toLowerCase(),V=!0}}a.byteLength=$;function Q(_,c,l){let A=!1;if((c===void 0||c<0)&&(c=0),c>this.length||((l===void 0||l>this.length)&&(l=this.length),l<=0)||(l>>>=0,c>>>=0,l<=c))return"";for(_||(_="utf8");;)switch(_){case"hex":return C(this,c,l);case"utf8":case"utf-8":return W(this,c,l);case"ascii":return L(this,c,l);case"latin1":case"binary":return E(this,c,l);case"base64":return Y(this,c,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,c,l);default:if(A)throw new TypeError("Unknown encoding: "+_);_=(_+"").toLowerCase(),A=!0}}a.prototype._isBuffer=!0;function U(_,c,l){const A=_[c];_[c]=_[l],_[l]=A}a.prototype.swap16=function(){const c=this.length;if(c%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let l=0;l<c;l+=2)U(this,l,l+1);return this},a.prototype.swap32=function(){const c=this.length;if(c%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let l=0;l<c;l+=4)U(this,l,l+3),U(this,l+1,l+2);return this},a.prototype.swap64=function(){const c=this.length;if(c%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let l=0;l<c;l+=8)U(this,l,l+7),U(this,l+1,l+6),U(this,l+2,l+5),U(this,l+3,l+4);return this},a.prototype.toString=function(){const c=this.length;return c===0?"":arguments.length===0?W(this,0,c):Q.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(c){if(!a.isBuffer(c))throw new TypeError("Argument must be a Buffer");return this===c?!0:a.compare(this,c)===0},a.prototype.inspect=function(){let c="";const l=e.INSPECT_MAX_BYTES;return c=this.toString("hex",0,l).replace(/(.{2})/g,"$1 ").trim(),this.length>l&&(c+=" ... "),"<Buffer "+c+">"},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(c,l,A,V,ee){if(ye(c,Uint8Array)&&(c=a.from(c,c.offset,c.byteLength)),!a.isBuffer(c))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof c);if(l===void 0&&(l=0),A===void 0&&(A=c?c.length:0),V===void 0&&(V=0),ee===void 0&&(ee=this.length),l<0||A>c.length||V<0||ee>this.length)throw new RangeError("out of range index");if(V>=ee&&l>=A)return 0;if(V>=ee)return-1;if(l>=A)return 1;if(l>>>=0,A>>>=0,V>>>=0,ee>>>=0,this===c)return 0;let re=ee-V,ge=A-l;const be=Math.min(re,ge),me=this.slice(V,ee),Se=c.slice(l,A);for(let we=0;we<be;++we)if(me[we]!==Se[we]){re=me[we],ge=Se[we];break}return re<ge?-1:ge<re?1:0};function P(_,c,l,A,V){if(_.length===0)return-1;if(typeof l=="string"?(A=l,l=0):l>2147483647?l=2147483647:l<-2147483648&&(l=-2147483648),l=+l,pe(l)&&(l=V?0:_.length-1),l<0&&(l=_.length+l),l>=_.length){if(V)return-1;l=_.length-1}else if(l<0)if(V)l=0;else return-1;if(typeof c=="string"&&(c=a.from(c,A)),a.isBuffer(c))return c.length===0?-1:K(_,c,l,A,V);if(typeof c=="number")return c=c&255,typeof Uint8Array.prototype.indexOf=="function"?V?Uint8Array.prototype.indexOf.call(_,c,l):Uint8Array.prototype.lastIndexOf.call(_,c,l):K(_,[c],l,A,V);throw new TypeError("val must be string, number or Buffer")}function K(_,c,l,A,V){let ee=1,re=_.length,ge=c.length;if(A!==void 0&&(A=String(A).toLowerCase(),A==="ucs2"||A==="ucs-2"||A==="utf16le"||A==="utf-16le")){if(_.length<2||c.length<2)return-1;ee=2,re/=2,ge/=2,l/=2}function be(Se,we){return ee===1?Se[we]:Se.readUInt16BE(we*ee)}let me;if(V){let Se=-1;for(me=l;me<re;me++)if(be(_,me)===be(c,Se===-1?0:me-Se)){if(Se===-1&&(Se=me),me-Se+1===ge)return Se*ee}else Se!==-1&&(me-=me-Se),Se=-1}else for(l+ge>re&&(l=re-ge),me=l;me>=0;me--){let Se=!0;for(let we=0;we<ge;we++)if(be(_,me+we)!==be(c,we)){Se=!1;break}if(Se)return me}return-1}a.prototype.includes=function(c,l,A){return this.indexOf(c,l,A)!==-1},a.prototype.indexOf=function(c,l,A){return P(this,c,l,A,!0)},a.prototype.lastIndexOf=function(c,l,A){return P(this,c,l,A,!1)};function J(_,c,l,A){l=Number(l)||0;const V=_.length-l;A?(A=Number(A),A>V&&(A=V)):A=V;const ee=c.length;A>ee/2&&(A=ee/2);let re;for(re=0;re<A;++re){const ge=parseInt(c.substr(re*2,2),16);if(pe(ge))return re;_[l+re]=ge}return re}function q(_,c,l,A){return Ee(ue(c,_.length-l),_,l,A)}function Z(_,c,l,A){return Ee(de(c),_,l,A)}function te(_,c,l,A){return Ee(fe(c),_,l,A)}function ne(_,c,l,A){return Ee(he(c,_.length-l),_,l,A)}a.prototype.write=function(c,l,A,V){if(l===void 0)V="utf8",A=this.length,l=0;else if(A===void 0&&typeof l=="string")V=l,A=this.length,l=0;else if(isFinite(l))l=l>>>0,isFinite(A)?(A=A>>>0,V===void 0&&(V="utf8")):(V=A,A=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const ee=this.length-l;if((A===void 0||A>ee)&&(A=ee),c.length>0&&(A<0||l<0)||l>this.length)throw new RangeError("Attempt to write outside buffer bounds");V||(V="utf8");let re=!1;for(;;)switch(V){case"hex":return J(this,c,l,A);case"utf8":case"utf-8":return q(this,c,l,A);case"ascii":case"latin1":case"binary":return Z(this,c,l,A);case"base64":return te(this,c,l,A);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ne(this,c,l,A);default:if(re)throw new TypeError("Unknown encoding: "+V);V=(""+V).toLowerCase(),re=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Y(_,c,l){return c===0&&l===_.length?t.fromByteArray(_):t.fromByteArray(_.slice(c,l))}function W(_,c,l){l=Math.min(_.length,l);const A=[];let V=c;for(;V<l;){const ee=_[V];let re=null,ge=ee>239?4:ee>223?3:ee>191?2:1;if(V+ge<=l){let be,me,Se,we;switch(ge){case 1:ee<128&&(re=ee);break;case 2:be=_[V+1],(be&192)===128&&(we=(ee&31)<<6|be&63,we>127&&(re=we));break;case 3:be=_[V+1],me=_[V+2],(be&192)===128&&(me&192)===128&&(we=(ee&15)<<12|(be&63)<<6|me&63,we>2047&&(we<55296||we>57343)&&(re=we));break;case 4:be=_[V+1],me=_[V+2],Se=_[V+3],(be&192)===128&&(me&192)===128&&(Se&192)===128&&(we=(ee&15)<<18|(be&63)<<12|(me&63)<<6|Se&63,we>65535&&we<1114112&&(re=we))}}re===null?(re=65533,ge=1):re>65535&&(re-=65536,A.push(re>>>10&1023|55296),re=56320|re&1023),A.push(re),V+=ge}return N(A)}const w=4096;function N(_){const c=_.length;if(c<=w)return String.fromCharCode.apply(String,_);let l="",A=0;for(;A<c;)l+=String.fromCharCode.apply(String,_.slice(A,A+=w));return l}function L(_,c,l){let A="";l=Math.min(_.length,l);for(let V=c;V<l;++V)A+=String.fromCharCode(_[V]&127);return A}function E(_,c,l){let A="";l=Math.min(_.length,l);for(let V=c;V<l;++V)A+=String.fromCharCode(_[V]);return A}function C(_,c,l){const A=_.length;(!c||c<0)&&(c=0),(!l||l<0||l>A)&&(l=A);let V="";for(let ee=c;ee<l;++ee)V+=le[_[ee]];return V}function D(_,c,l){const A=_.slice(c,l);let V="";for(let ee=0;ee<A.length-1;ee+=2)V+=String.fromCharCode(A[ee]+A[ee+1]*256);return V}a.prototype.slice=function(c,l){const A=this.length;c=~~c,l=l===void 0?A:~~l,c<0?(c+=A,c<0&&(c=0)):c>A&&(c=A),l<0?(l+=A,l<0&&(l=0)):l>A&&(l=A),l<c&&(l=c);const V=this.subarray(c,l);return Object.setPrototypeOf(V,a.prototype),V};function f(_,c,l){if(_%1!==0||_<0)throw new RangeError("offset is not uint");if(_+c>l)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(c,l,A){c=c>>>0,l=l>>>0,A||f(c,l,this.length);let V=this[c],ee=1,re=0;for(;++re<l&&(ee*=256);)V+=this[c+re]*ee;return V},a.prototype.readUintBE=a.prototype.readUIntBE=function(c,l,A){c=c>>>0,l=l>>>0,A||f(c,l,this.length);let V=this[c+--l],ee=1;for(;l>0&&(ee*=256);)V+=this[c+--l]*ee;return V},a.prototype.readUint8=a.prototype.readUInt8=function(c,l){return c=c>>>0,l||f(c,1,this.length),this[c]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(c,l){return c=c>>>0,l||f(c,2,this.length),this[c]|this[c+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(c,l){return c=c>>>0,l||f(c,2,this.length),this[c]<<8|this[c+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(c,l){return c=c>>>0,l||f(c,4,this.length),(this[c]|this[c+1]<<8|this[c+2]<<16)+this[c+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(c,l){return c=c>>>0,l||f(c,4,this.length),this[c]*16777216+(this[c+1]<<16|this[c+2]<<8|this[c+3])},a.prototype.readBigUInt64LE=ae(function(c){c=c>>>0,R(c,"offset");const l=this[c],A=this[c+7];(l===void 0||A===void 0)&&G(c,this.length-8);const V=l+this[++c]*2**8+this[++c]*2**16+this[++c]*2**24,ee=this[++c]+this[++c]*2**8+this[++c]*2**16+A*2**24;return BigInt(V)+(BigInt(ee)<<BigInt(32))}),a.prototype.readBigUInt64BE=ae(function(c){c=c>>>0,R(c,"offset");const l=this[c],A=this[c+7];(l===void 0||A===void 0)&&G(c,this.length-8);const V=l*2**24+this[++c]*2**16+this[++c]*2**8+this[++c],ee=this[++c]*2**24+this[++c]*2**16+this[++c]*2**8+A;return(BigInt(V)<<BigInt(32))+BigInt(ee)}),a.prototype.readIntLE=function(c,l,A){c=c>>>0,l=l>>>0,A||f(c,l,this.length);let V=this[c],ee=1,re=0;for(;++re<l&&(ee*=256);)V+=this[c+re]*ee;return ee*=128,V>=ee&&(V-=Math.pow(2,8*l)),V},a.prototype.readIntBE=function(c,l,A){c=c>>>0,l=l>>>0,A||f(c,l,this.length);let V=l,ee=1,re=this[c+--V];for(;V>0&&(ee*=256);)re+=this[c+--V]*ee;return ee*=128,re>=ee&&(re-=Math.pow(2,8*l)),re},a.prototype.readInt8=function(c,l){return c=c>>>0,l||f(c,1,this.length),this[c]&128?(255-this[c]+1)*-1:this[c]},a.prototype.readInt16LE=function(c,l){c=c>>>0,l||f(c,2,this.length);const A=this[c]|this[c+1]<<8;return A&32768?A|4294901760:A},a.prototype.readInt16BE=function(c,l){c=c>>>0,l||f(c,2,this.length);const A=this[c+1]|this[c]<<8;return A&32768?A|4294901760:A},a.prototype.readInt32LE=function(c,l){return c=c>>>0,l||f(c,4,this.length),this[c]|this[c+1]<<8|this[c+2]<<16|this[c+3]<<24},a.prototype.readInt32BE=function(c,l){return c=c>>>0,l||f(c,4,this.length),this[c]<<24|this[c+1]<<16|this[c+2]<<8|this[c+3]},a.prototype.readBigInt64LE=ae(function(c){c=c>>>0,R(c,"offset");const l=this[c],A=this[c+7];(l===void 0||A===void 0)&&G(c,this.length-8);const V=this[c+4]+this[c+5]*2**8+this[c+6]*2**16+(A<<24);return(BigInt(V)<<BigInt(32))+BigInt(l+this[++c]*2**8+this[++c]*2**16+this[++c]*2**24)}),a.prototype.readBigInt64BE=ae(function(c){c=c>>>0,R(c,"offset");const l=this[c],A=this[c+7];(l===void 0||A===void 0)&&G(c,this.length-8);const V=(l<<24)+this[++c]*2**16+this[++c]*2**8+this[++c];return(BigInt(V)<<BigInt(32))+BigInt(this[++c]*2**24+this[++c]*2**16+this[++c]*2**8+A)}),a.prototype.readFloatLE=function(c,l){return c=c>>>0,l||f(c,4,this.length),n.read(this,c,!0,23,4)},a.prototype.readFloatBE=function(c,l){return c=c>>>0,l||f(c,4,this.length),n.read(this,c,!1,23,4)},a.prototype.readDoubleLE=function(c,l){return c=c>>>0,l||f(c,8,this.length),n.read(this,c,!0,52,8)},a.prototype.readDoubleBE=function(c,l){return c=c>>>0,l||f(c,8,this.length),n.read(this,c,!1,52,8)};function y(_,c,l,A,V,ee){if(!a.isBuffer(_))throw new TypeError('"buffer" argument must be a Buffer instance');if(c>V||c<ee)throw new RangeError('"value" argument is out of bounds');if(l+A>_.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(c,l,A,V){if(c=+c,l=l>>>0,A=A>>>0,!V){const ge=Math.pow(2,8*A)-1;y(this,c,l,A,ge,0)}let ee=1,re=0;for(this[l]=c&255;++re<A&&(ee*=256);)this[l+re]=c/ee&255;return l+A},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(c,l,A,V){if(c=+c,l=l>>>0,A=A>>>0,!V){const ge=Math.pow(2,8*A)-1;y(this,c,l,A,ge,0)}let ee=A-1,re=1;for(this[l+ee]=c&255;--ee>=0&&(re*=256);)this[l+ee]=c/re&255;return l+A},a.prototype.writeUint8=a.prototype.writeUInt8=function(c,l,A){return c=+c,l=l>>>0,A||y(this,c,l,1,255,0),this[l]=c&255,l+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(c,l,A){return c=+c,l=l>>>0,A||y(this,c,l,2,65535,0),this[l]=c&255,this[l+1]=c>>>8,l+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(c,l,A){return c=+c,l=l>>>0,A||y(this,c,l,2,65535,0),this[l]=c>>>8,this[l+1]=c&255,l+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(c,l,A){return c=+c,l=l>>>0,A||y(this,c,l,4,4294967295,0),this[l+3]=c>>>24,this[l+2]=c>>>16,this[l+1]=c>>>8,this[l]=c&255,l+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(c,l,A){return c=+c,l=l>>>0,A||y(this,c,l,4,4294967295,0),this[l]=c>>>24,this[l+1]=c>>>16,this[l+2]=c>>>8,this[l+3]=c&255,l+4};function m(_,c,l,A,V){X(c,A,V,_,l,7);let ee=Number(c&BigInt(4294967295));_[l++]=ee,ee=ee>>8,_[l++]=ee,ee=ee>>8,_[l++]=ee,ee=ee>>8,_[l++]=ee;let re=Number(c>>BigInt(32)&BigInt(4294967295));return _[l++]=re,re=re>>8,_[l++]=re,re=re>>8,_[l++]=re,re=re>>8,_[l++]=re,l}function S(_,c,l,A,V){X(c,A,V,_,l,7);let ee=Number(c&BigInt(4294967295));_[l+7]=ee,ee=ee>>8,_[l+6]=ee,ee=ee>>8,_[l+5]=ee,ee=ee>>8,_[l+4]=ee;let re=Number(c>>BigInt(32)&BigInt(4294967295));return _[l+3]=re,re=re>>8,_[l+2]=re,re=re>>8,_[l+1]=re,re=re>>8,_[l]=re,l+8}a.prototype.writeBigUInt64LE=ae(function(c,l=0){return m(this,c,l,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=ae(function(c,l=0){return S(this,c,l,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(c,l,A,V){if(c=+c,l=l>>>0,!V){const be=Math.pow(2,8*A-1);y(this,c,l,A,be-1,-be)}let ee=0,re=1,ge=0;for(this[l]=c&255;++ee<A&&(re*=256);)c<0&&ge===0&&this[l+ee-1]!==0&&(ge=1),this[l+ee]=(c/re>>0)-ge&255;return l+A},a.prototype.writeIntBE=function(c,l,A,V){if(c=+c,l=l>>>0,!V){const be=Math.pow(2,8*A-1);y(this,c,l,A,be-1,-be)}let ee=A-1,re=1,ge=0;for(this[l+ee]=c&255;--ee>=0&&(re*=256);)c<0&&ge===0&&this[l+ee+1]!==0&&(ge=1),this[l+ee]=(c/re>>0)-ge&255;return l+A},a.prototype.writeInt8=function(c,l,A){return c=+c,l=l>>>0,A||y(this,c,l,1,127,-128),c<0&&(c=255+c+1),this[l]=c&255,l+1},a.prototype.writeInt16LE=function(c,l,A){return c=+c,l=l>>>0,A||y(this,c,l,2,32767,-32768),this[l]=c&255,this[l+1]=c>>>8,l+2},a.prototype.writeInt16BE=function(c,l,A){return c=+c,l=l>>>0,A||y(this,c,l,2,32767,-32768),this[l]=c>>>8,this[l+1]=c&255,l+2},a.prototype.writeInt32LE=function(c,l,A){return c=+c,l=l>>>0,A||y(this,c,l,4,2147483647,-2147483648),this[l]=c&255,this[l+1]=c>>>8,this[l+2]=c>>>16,this[l+3]=c>>>24,l+4},a.prototype.writeInt32BE=function(c,l,A){return c=+c,l=l>>>0,A||y(this,c,l,4,2147483647,-2147483648),c<0&&(c=4294967295+c+1),this[l]=c>>>24,this[l+1]=c>>>16,this[l+2]=c>>>8,this[l+3]=c&255,l+4},a.prototype.writeBigInt64LE=ae(function(c,l=0){return m(this,c,l,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=ae(function(c,l=0){return S(this,c,l,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function x(_,c,l,A,V,ee){if(l+A>_.length)throw new RangeError("Index out of range");if(l<0)throw new RangeError("Index out of range")}function k(_,c,l,A,V){return c=+c,l=l>>>0,V||x(_,c,l,4),n.write(_,c,l,A,23,4),l+4}a.prototype.writeFloatLE=function(c,l,A){return k(this,c,l,!0,A)},a.prototype.writeFloatBE=function(c,l,A){return k(this,c,l,!1,A)};function z(_,c,l,A,V){return c=+c,l=l>>>0,V||x(_,c,l,8),n.write(_,c,l,A,52,8),l+8}a.prototype.writeDoubleLE=function(c,l,A){return z(this,c,l,!0,A)},a.prototype.writeDoubleBE=function(c,l,A){return z(this,c,l,!1,A)},a.prototype.copy=function(c,l,A,V){if(!a.isBuffer(c))throw new TypeError("argument should be a Buffer");if(A||(A=0),!V&&V!==0&&(V=this.length),l>=c.length&&(l=c.length),l||(l=0),V>0&&V<A&&(V=A),V===A||c.length===0||this.length===0)return 0;if(l<0)throw new RangeError("targetStart out of bounds");if(A<0||A>=this.length)throw new RangeError("Index out of range");if(V<0)throw new RangeError("sourceEnd out of bounds");V>this.length&&(V=this.length),c.length-l<V-A&&(V=c.length-l+A);const ee=V-A;return this===c&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(l,A,V):Uint8Array.prototype.set.call(c,this.subarray(A,V),l),ee},a.prototype.fill=function(c,l,A,V){if(typeof c=="string"){if(typeof l=="string"?(V=l,l=0,A=this.length):typeof A=="string"&&(V=A,A=this.length),V!==void 0&&typeof V!="string")throw new TypeError("encoding must be a string");if(typeof V=="string"&&!a.isEncoding(V))throw new TypeError("Unknown encoding: "+V);if(c.length===1){const re=c.charCodeAt(0);(V==="utf8"&&re<128||V==="latin1")&&(c=re)}}else typeof c=="number"?c=c&255:typeof c=="boolean"&&(c=Number(c));if(l<0||this.length<l||this.length<A)throw new RangeError("Out of range index");if(A<=l)return this;l=l>>>0,A=A===void 0?this.length:A>>>0,c||(c=0);let ee;if(typeof c=="number")for(ee=l;ee<A;++ee)this[ee]=c;else{const re=a.isBuffer(c)?c:a.from(c,V),ge=re.length;if(ge===0)throw new TypeError('The value "'+c+'" is invalid for argument "value"');for(ee=0;ee<A-l;++ee)this[ee+l]=re[ee%ge]}return this};const O={};function F(_,c,l){O[_]=class extends l{constructor(){super(),Object.defineProperty(this,"message",{value:c.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${_}]`,this.stack,delete this.name}get code(){return _}set code(V){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:V,writable:!0})}toString(){return`${this.name} [${_}]: ${this.message}`}}}F("ERR_BUFFER_OUT_OF_BOUNDS",function(_){return _?`${_} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),F("ERR_INVALID_ARG_TYPE",function(_,c){return`The "${_}" argument must be of type number. Received type ${typeof c}`},TypeError),F("ERR_OUT_OF_RANGE",function(_,c,l){let A=`The value of "${_}" is out of range.`,V=l;return Number.isInteger(l)&&Math.abs(l)>2**32?V=M(String(l)):typeof l=="bigint"&&(V=String(l),(l>BigInt(2)**BigInt(32)||l<-(BigInt(2)**BigInt(32)))&&(V=M(V)),V+="n"),A+=` It must be ${c}. Received ${V}`,A},RangeError);function M(_){let c="",l=_.length;const A=_[0]==="-"?1:0;for(;l>=A+4;l-=3)c=`_${_.slice(l-3,l)}${c}`;return`${_.slice(0,l)}${c}`}function j(_,c,l){R(c,"offset"),(_[c]===void 0||_[c+l]===void 0)&&G(c,_.length-(l+1))}function X(_,c,l,A,V,ee){if(_>l||_<c){const re=typeof c=="bigint"?"n":"";let ge;throw c===0||c===BigInt(0)?ge=`>= 0${re} and < 2${re} ** ${(ee+1)*8}${re}`:ge=`>= -(2${re} ** ${(ee+1)*8-1}${re}) and < 2 ** ${(ee+1)*8-1}${re}`,new O.ERR_OUT_OF_RANGE("value",ge,_)}j(A,V,ee)}function R(_,c){if(typeof _!="number")throw new O.ERR_INVALID_ARG_TYPE(c,"number",_)}function G(_,c,l){throw Math.floor(_)!==_?(R(_,l),new O.ERR_OUT_OF_RANGE("offset","an integer",_)):c<0?new O.ERR_BUFFER_OUT_OF_BOUNDS:new O.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${c}`,_)}const oe=/[^+/0-9A-Za-z-_]/g;function se(_){if(_=_.split("=")[0],_=_.trim().replace(oe,""),_.length<2)return"";for(;_.length%4!==0;)_=_+"=";return _}function ue(_,c){c=c||1/0;let l;const A=_.length;let V=null;const ee=[];for(let re=0;re<A;++re){if(l=_.charCodeAt(re),l>55295&&l<57344){if(!V){if(l>56319){(c-=3)>-1&&ee.push(239,191,189);continue}else if(re+1===A){(c-=3)>-1&&ee.push(239,191,189);continue}V=l;continue}if(l<56320){(c-=3)>-1&&ee.push(239,191,189),V=l;continue}l=(V-55296<<10|l-56320)+65536}else V&&(c-=3)>-1&&ee.push(239,191,189);if(V=null,l<128){if((c-=1)<0)break;ee.push(l)}else if(l<2048){if((c-=2)<0)break;ee.push(l>>6|192,l&63|128)}else if(l<65536){if((c-=3)<0)break;ee.push(l>>12|224,l>>6&63|128,l&63|128)}else if(l<1114112){if((c-=4)<0)break;ee.push(l>>18|240,l>>12&63|128,l>>6&63|128,l&63|128)}else throw new Error("Invalid code point")}return ee}function de(_){const c=[];for(let l=0;l<_.length;++l)c.push(_.charCodeAt(l)&255);return c}function he(_,c){let l,A,V;const ee=[];for(let re=0;re<_.length&&!((c-=2)<0);++re)l=_.charCodeAt(re),A=l>>8,V=l%256,ee.push(V),ee.push(A);return ee}function fe(_){return t.toByteArray(se(_))}function Ee(_,c,l,A){let V;for(V=0;V<A&&!(V+l>=c.length||V>=_.length);++V)c[V+l]=_[V];return V}function ye(_,c){return _ instanceof c||_!=null&&_.constructor!=null&&_.constructor.name!=null&&_.constructor.name===c.name}function pe(_){return _!==_}const le=(function(){const _="0123456789abcdef",c=new Array(256);for(let l=0;l<16;++l){const A=l*16;for(let V=0;V<16;++V)c[A+V]=_[l]+_[V]}return c})();function ae(_){return typeof BigInt>"u"?ce:_}function ce(){throw new Error("BigInt not supported")}})(Wr)),Wr}var ih=rh(),Yr={},Xr={},Cs;function Xe(){return Cs||(Cs=1,(function(e){/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.wrapCipher=e.Hash=e.nextTick=e.isLE=void 0,e.isBytes=t,e.abool=n,e.anumber=r,e.abytes=i,e.ahash=o,e.aexists=s,e.aoutput=a,e.u8=u,e.u32=d,e.clean=g,e.createView=p,e.bytesToHex=h,e.hexToBytes=T,e.hexToNumber=H,e.bytesToNumberBE=$,e.numberToBytesBE=Q,e.utf8ToBytes=P,e.bytesToUtf8=K,e.toBytes=J,e.overlapBytes=q,e.complexOverlapBytes=Z,e.concatBytes=te,e.checkOpts=ne,e.equalBytes=Y,e.getOutput=N,e.setBigUint64=L,e.u64Lengths=E,e.isAligned32=C,e.copyBytes=D;function t(f){return f instanceof Uint8Array||ArrayBuffer.isView(f)&&f.constructor.name==="Uint8Array"}function n(f){if(typeof f!="boolean")throw new Error(`boolean expected, not ${f}`)}function r(f){if(!Number.isSafeInteger(f)||f<0)throw new Error("positive integer expected, got "+f)}function i(f,...y){if(!t(f))throw new Error("Uint8Array expected");if(y.length>0&&!y.includes(f.length))throw new Error("Uint8Array expected of length "+y+", got length="+f.length)}function o(f){if(typeof f!="function"||typeof f.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");r(f.outputLen),r(f.blockLen)}function s(f,y=!0){if(f.destroyed)throw new Error("Hash instance has been destroyed");if(y&&f.finished)throw new Error("Hash#digest() has already been called")}function a(f,y){i(f);const m=y.outputLen;if(f.length<m)throw new Error("digestInto() expects output buffer of length at least "+m)}function u(f){return new Uint8Array(f.buffer,f.byteOffset,f.byteLength)}function d(f){return new Uint32Array(f.buffer,f.byteOffset,Math.floor(f.byteLength/4))}function g(...f){for(let y=0;y<f.length;y++)f[y].fill(0)}function p(f){return new DataView(f.buffer,f.byteOffset,f.byteLength)}e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;const I=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",v=Array.from({length:256},(f,y)=>y.toString(16).padStart(2,"0"));function h(f){if(i(f),I)return f.toHex();let y="";for(let m=0;m<f.length;m++)y+=v[f[m]];return y}const b={_0:48,_9:57,A:65,F:70,a:97,f:102};function B(f){if(f>=b._0&&f<=b._9)return f-b._0;if(f>=b.A&&f<=b.F)return f-(b.A-10);if(f>=b.a&&f<=b.f)return f-(b.a-10)}function T(f){if(typeof f!="string")throw new Error("hex string expected, got "+typeof f);if(I)return Uint8Array.fromHex(f);const y=f.length,m=y/2;if(y%2)throw new Error("hex string expected, got unpadded hex of length "+y);const S=new Uint8Array(m);for(let x=0,k=0;x<m;x++,k+=2){const z=B(f.charCodeAt(k)),O=B(f.charCodeAt(k+1));if(z===void 0||O===void 0){const F=f[k]+f[k+1];throw new Error('hex string expected, got non-hex character "'+F+'" at index '+k)}S[x]=z*16+O}return S}function H(f){if(typeof f!="string")throw new Error("hex string expected, got "+typeof f);return BigInt(f===""?"0":"0x"+f)}function $(f){return H(h(f))}function Q(f,y){return T(f.toString(16).padStart(y*2,"0"))}const U=async()=>{};e.nextTick=U;function P(f){if(typeof f!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(f))}function K(f){return new TextDecoder().decode(f)}function J(f){if(typeof f=="string")f=P(f);else if(t(f))f=D(f);else throw new Error("Uint8Array expected, got "+typeof f);return f}function q(f,y){return f.buffer===y.buffer&&f.byteOffset<y.byteOffset+y.byteLength&&y.byteOffset<f.byteOffset+f.byteLength}function Z(f,y){if(q(f,y)&&f.byteOffset<y.byteOffset)throw new Error("complex overlap of input and output is not supported")}function te(...f){let y=0;for(let S=0;S<f.length;S++){const x=f[S];i(x),y+=x.length}const m=new Uint8Array(y);for(let S=0,x=0;S<f.length;S++){const k=f[S];m.set(k,x),x+=k.length}return m}function ne(f,y){if(y==null||typeof y!="object")throw new Error("options must be defined");return Object.assign(f,y)}function Y(f,y){if(f.length!==y.length)return!1;let m=0;for(let S=0;S<f.length;S++)m|=f[S]^y[S];return m===0}class W{}e.Hash=W;const w=(f,y)=>{function m(S,...x){if(i(S),!e.isLE)throw new Error("Non little-endian hardware is not yet supported");if(f.nonceLength!==void 0){const j=x[0];if(!j)throw new Error("nonce / iv required");f.varSizeNonce?i(j):i(j,f.nonceLength)}const k=f.tagLength;k&&x[1]!==void 0&&i(x[1]);const z=y(S,...x),O=(j,X)=>{if(X!==void 0){if(j!==2)throw new Error("cipher output not supported");i(X)}};let F=!1;return{encrypt(j,X){if(F)throw new Error("cannot encrypt() twice with same key + nonce");return F=!0,i(j),O(z.encrypt.length,X),z.encrypt(j,X)},decrypt(j,X){if(i(j),k&&j.length<k)throw new Error("invalid ciphertext length: smaller than tagLength="+k);return O(z.decrypt.length,X),z.decrypt(j,X)}}}return Object.assign(m,f),m};e.wrapCipher=w;function N(f,y,m=!0){if(y===void 0)return new Uint8Array(f);if(y.length!==f)throw new Error("invalid output length, expected "+f+", got: "+y.length);if(m&&!C(y))throw new Error("invalid output, must be aligned");return y}function L(f,y,m,S){if(typeof f.setBigUint64=="function")return f.setBigUint64(y,m,S);const x=BigInt(32),k=BigInt(4294967295),z=Number(m>>x&k),O=Number(m&k),F=S?4:0,M=S?0:4;f.setUint32(y+F,z,S),f.setUint32(y+M,O,S)}function E(f,y,m){n(m);const S=new Uint8Array(16),x=p(S);return L(x,0,BigInt(y),m),L(x,8,BigInt(f),m),S}function C(f){return f.byteOffset%4===0}function D(f){return Uint8Array.from(f)}})(Xr)),Xr}var Jr={},Me={},Ts;function Qr(){return Ts||(Ts=1,Object.defineProperty(Me,"__esModule",{value:!0}),Me.AEAD_TAG_LENGTH=Me.XCHACHA20_NONCE_LENGTH=Me.CURVE25519_PUBLIC_KEY_SIZE=Me.ETH_PUBLIC_KEY_SIZE=Me.UNCOMPRESSED_PUBLIC_KEY_SIZE=Me.COMPRESSED_PUBLIC_KEY_SIZE=Me.SECRET_KEY_LENGTH=void 0,Me.SECRET_KEY_LENGTH=32,Me.COMPRESSED_PUBLIC_KEY_SIZE=33,Me.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,Me.ETH_PUBLIC_KEY_SIZE=64,Me.CURVE25519_PUBLIC_KEY_SIZE=32,Me.XCHACHA20_NONCE_LENGTH=24,Me.AEAD_TAG_LENGTH=16),Me}var Os;function nr(){return Os||(Os=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ephemeralKeySize=e.symmetricNonceLength=e.symmetricAlgorithm=e.isHkdfKeyCompressed=e.isEphemeralKeyCompressed=e.ellipticCurve=e.ECIES_CONFIG=void 0;var t=Qr(),n=(function(){function d(){this.ellipticCurve="secp256k1",this.isEphemeralKeyCompressed=!1,this.isHkdfKeyCompressed=!1,this.symmetricAlgorithm="aes-256-gcm",this.symmetricNonceLength=16}return d})();e.ECIES_CONFIG=new n;var r=function(){return e.ECIES_CONFIG.ellipticCurve};e.ellipticCurve=r;var i=function(){return e.ECIES_CONFIG.isEphemeralKeyCompressed};e.isEphemeralKeyCompressed=i;var o=function(){return e.ECIES_CONFIG.isHkdfKeyCompressed};e.isHkdfKeyCompressed=o;var s=function(){return e.ECIES_CONFIG.symmetricAlgorithm};e.symmetricAlgorithm=s;var a=function(){return e.ECIES_CONFIG.symmetricNonceLength};e.symmetricNonceLength=a;var u=function(){var d={secp256k1:e.ECIES_CONFIG.isEphemeralKeyCompressed?t.COMPRESSED_PUBLIC_KEY_SIZE:t.UNCOMPRESSED_PUBLIC_KEY_SIZE,x25519:t.CURVE25519_PUBLIC_KEY_SIZE,ed25519:t.CURVE25519_PUBLIC_KEY_SIZE};if(e.ECIES_CONFIG.ellipticCurve in d)return d[e.ECIES_CONFIG.ellipticCurve];throw new Error("Not implemented")};e.ephemeralKeySize=u})(Jr)),Jr}var ei={},gn={},Ct={},ti={},ni={},mn={},Rs;function oh(){return Rs||(Rs=1,Object.defineProperty(mn,"__esModule",{value:!0}),mn.crypto=void 0,mn.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),mn}var Ps;function Fs(){return Ps||(Ps=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.gcm=e.ctr=e.cbc=e.utils=void 0,e.randomBytes=r,e.getWebcryptoSubtle=i,e.managedNonce=o;const t=oh(),n=Xe();function r(d=32){if(t.crypto&&typeof t.crypto.getRandomValues=="function")return t.crypto.getRandomValues(new Uint8Array(d));if(t.crypto&&typeof t.crypto.randomBytes=="function")return Uint8Array.from(t.crypto.randomBytes(d));throw new Error("crypto.getRandomValues must be defined")}function i(){if(t.crypto&&typeof t.crypto.subtle=="object"&&t.crypto.subtle!=null)return t.crypto.subtle;throw new Error("crypto.subtle must be defined")}function o(d){const{nonceLength:g}=d;return(0,n.anumber)(g),((p,...I)=>({encrypt(v,...h){const b=r(g),B=d(p,b,...I).encrypt(v,...h),T=(0,n.concatBytes)(b,B);return B.fill(0),T},decrypt(v,...h){const b=v.subarray(0,g),B=v.subarray(g);return d(p,b,...I).decrypt(B,...h)}}))}e.utils={async encrypt(d,g,p,I){const v=i(),h=await v.importKey("raw",d,g,!0,["encrypt"]),b=await v.encrypt(p,h,I);return new Uint8Array(b)},async decrypt(d,g,p,I){const v=i(),h=await v.importKey("raw",d,g,!0,["decrypt"]),b=await v.decrypt(p,h,I);return new Uint8Array(b)}};const s={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function a(d,g,p){if(d===s.CBC)return{name:s.CBC,iv:g};if(d===s.CTR)return{name:s.CTR,counter:g,length:64};if(d===s.GCM)return p?{name:s.GCM,iv:g,additionalData:p}:{name:s.GCM,iv:g};throw new Error("unknown aes block mode")}function u(d){return(g,p,I)=>{(0,n.abytes)(g),(0,n.abytes)(p);const v={name:d,length:g.length*8},h=a(d,p,I);let b=!1;return{encrypt(B){if((0,n.abytes)(B),b)throw new Error("Cannot encrypt() twice with same key / nonce");return b=!0,e.utils.encrypt(g,v,h,B)},decrypt(B){return(0,n.abytes)(B),e.utils.decrypt(g,v,h,B)}}}}e.cbc=u(s.CBC),e.ctr=u(s.CTR),e.gcm=u(s.GCM)})(ni)),ni}var ri={},xe={},Ue={},ii={},_n={},ks;function sh(){return ks||(ks=1,Object.defineProperty(_n,"__esModule",{value:!0}),_n.crypto=void 0,_n.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),_n}var Ms;function dt(){return Ms||(Ms=1,(function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.Hash=e.nextTick=e.swap32IfBE=e.byteSwapIfBE=e.swap8IfBE=e.isLE=void 0,e.isBytes=n,e.anumber=r,e.abytes=i,e.ahash=o,e.aexists=s,e.aoutput=a,e.u8=u,e.u32=d,e.clean=g,e.createView=p,e.rotr=I,e.rotl=v,e.byteSwap=h,e.byteSwap32=b,e.bytesToHex=H,e.hexToBytes=U,e.asyncLoop=K,e.utf8ToBytes=J,e.bytesToUtf8=q,e.toBytes=Z,e.kdfInputToBytes=te,e.concatBytes=ne,e.checkOpts=Y,e.createHasher=w,e.createOptHasher=N,e.createXOFer=L,e.randomBytes=E;const t=sh();function n(C){return C instanceof Uint8Array||ArrayBuffer.isView(C)&&C.constructor.name==="Uint8Array"}function r(C){if(!Number.isSafeInteger(C)||C<0)throw new Error("positive integer expected, got "+C)}function i(C,...D){if(!n(C))throw new Error("Uint8Array expected");if(D.length>0&&!D.includes(C.length))throw new Error("Uint8Array expected of length "+D+", got length="+C.length)}function o(C){if(typeof C!="function"||typeof C.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");r(C.outputLen),r(C.blockLen)}function s(C,D=!0){if(C.destroyed)throw new Error("Hash instance has been destroyed");if(D&&C.finished)throw new Error("Hash#digest() has already been called")}function a(C,D){i(C);const f=D.outputLen;if(C.length<f)throw new Error("digestInto() expects output buffer of length at least "+f)}function u(C){return new Uint8Array(C.buffer,C.byteOffset,C.byteLength)}function d(C){return new Uint32Array(C.buffer,C.byteOffset,Math.floor(C.byteLength/4))}function g(...C){for(let D=0;D<C.length;D++)C[D].fill(0)}function p(C){return new DataView(C.buffer,C.byteOffset,C.byteLength)}function I(C,D){return C<<32-D|C>>>D}function v(C,D){return C<<D|C>>>32-D>>>0}e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function h(C){return C<<24&4278190080|C<<8&16711680|C>>>8&65280|C>>>24&255}e.swap8IfBE=e.isLE?C=>C:C=>h(C),e.byteSwapIfBE=e.swap8IfBE;function b(C){for(let D=0;D<C.length;D++)C[D]=h(C[D]);return C}e.swap32IfBE=e.isLE?C=>C:b;const B=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",T=Array.from({length:256},(C,D)=>D.toString(16).padStart(2,"0"));function H(C){if(i(C),B)return C.toHex();let D="";for(let f=0;f<C.length;f++)D+=T[C[f]];return D}const $={_0:48,_9:57,A:65,F:70,a:97,f:102};function Q(C){if(C>=$._0&&C<=$._9)return C-$._0;if(C>=$.A&&C<=$.F)return C-($.A-10);if(C>=$.a&&C<=$.f)return C-($.a-10)}function U(C){if(typeof C!="string")throw new Error("hex string expected, got "+typeof C);if(B)return Uint8Array.fromHex(C);const D=C.length,f=D/2;if(D%2)throw new Error("hex string expected, got unpadded hex of length "+D);const y=new Uint8Array(f);for(let m=0,S=0;m<f;m++,S+=2){const x=Q(C.charCodeAt(S)),k=Q(C.charCodeAt(S+1));if(x===void 0||k===void 0){const z=C[S]+C[S+1];throw new Error('hex string expected, got non-hex character "'+z+'" at index '+S)}y[m]=x*16+k}return y}const P=async()=>{};e.nextTick=P;async function K(C,D,f){let y=Date.now();for(let m=0;m<C;m++){f(m);const S=Date.now()-y;S>=0&&S<D||(await(0,e.nextTick)(),y+=S)}}function J(C){if(typeof C!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(C))}function q(C){return new TextDecoder().decode(C)}function Z(C){return typeof C=="string"&&(C=J(C)),i(C),C}function te(C){return typeof C=="string"&&(C=J(C)),i(C),C}function ne(...C){let D=0;for(let y=0;y<C.length;y++){const m=C[y];i(m),D+=m.length}const f=new Uint8Array(D);for(let y=0,m=0;y<C.length;y++){const S=C[y];f.set(S,m),m+=S.length}return f}function Y(C,D){if(D!==void 0&&{}.toString.call(D)!=="[object Object]")throw new Error("options should be object or undefined");return Object.assign(C,D)}class W{}e.Hash=W;function w(C){const D=y=>C().update(Z(y)).digest(),f=C();return D.outputLen=f.outputLen,D.blockLen=f.blockLen,D.create=()=>C(),D}function N(C){const D=(y,m)=>C(m).update(Z(y)).digest(),f=C({});return D.outputLen=f.outputLen,D.blockLen=f.blockLen,D.create=y=>C(y),D}function L(C){const D=(y,m)=>C(m).update(Z(y)).digest(),f=C({});return D.outputLen=f.outputLen,D.blockLen=f.blockLen,D.create=y=>C(y),D}e.wrapConstructor=w,e.wrapConstructorWithOpts=N,e.wrapXOFConstructorWithOpts=L;function E(C=32){if(t.crypto&&typeof t.crypto.getRandomValues=="function")return t.crypto.getRandomValues(new Uint8Array(C));if(t.crypto&&typeof t.crypto.randomBytes=="function")return Uint8Array.from(t.crypto.randomBytes(C));throw new Error("crypto.getRandomValues must be defined")}})(ii)),ii}var Hs;function ah(){if(Hs)return Ue;Hs=1,Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.SHA512_IV=Ue.SHA384_IV=Ue.SHA224_IV=Ue.SHA256_IV=Ue.HashMD=void 0,Ue.setBigUint64=t,Ue.Chi=n,Ue.Maj=r;const e=dt();function t(o,s,a,u){if(typeof o.setBigUint64=="function")return o.setBigUint64(s,a,u);const d=BigInt(32),g=BigInt(4294967295),p=Number(a>>d&g),I=Number(a&g),v=u?4:0,h=u?0:4;o.setUint32(s+v,p,u),o.setUint32(s+h,I,u)}function n(o,s,a){return o&s^~o&a}function r(o,s,a){return o&s^o&a^s&a}class i extends e.Hash{constructor(s,a,u,d){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=s,this.outputLen=a,this.padOffset=u,this.isLE=d,this.buffer=new Uint8Array(s),this.view=(0,e.createView)(this.buffer)}update(s){(0,e.aexists)(this),s=(0,e.toBytes)(s),(0,e.abytes)(s);const{view:a,buffer:u,blockLen:d}=this,g=s.length;for(let p=0;p<g;){const I=Math.min(d-this.pos,g-p);if(I===d){const v=(0,e.createView)(s);for(;d<=g-p;p+=d)this.process(v,p);continue}u.set(s.subarray(p,p+I),this.pos),this.pos+=I,p+=I,this.pos===d&&(this.process(a,0),this.pos=0)}return this.length+=s.length,this.roundClean(),this}digestInto(s){(0,e.aexists)(this),(0,e.aoutput)(s,this),this.finished=!0;const{buffer:a,view:u,blockLen:d,isLE:g}=this;let{pos:p}=this;a[p++]=128,(0,e.clean)(this.buffer.subarray(p)),this.padOffset>d-p&&(this.process(u,0),p=0);for(let B=p;B<d;B++)a[B]=0;t(u,d-8,BigInt(this.length*8),g),this.process(u,0);const I=(0,e.createView)(s),v=this.outputLen;if(v%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const h=v/4,b=this.get();if(h>b.length)throw new Error("_sha2: outputLen bigger than state");for(let B=0;B<h;B++)I.setUint32(4*B,b[B],g)}digest(){const{buffer:s,outputLen:a}=this;this.digestInto(s);const u=s.slice(0,a);return this.destroy(),u}_cloneInto(s){s||(s=new this.constructor),s.set(...this.get());const{blockLen:a,buffer:u,length:d,finished:g,destroyed:p,pos:I}=this;return s.destroyed=p,s.finished=g,s.length=d,s.pos=I,d%a&&s.buffer.set(u),s}clone(){return this._cloneInto()}}return Ue.HashMD=i,Ue.SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ue.SHA224_IV=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),Ue.SHA384_IV=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Ue.SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),Ue}var ve={},Us;function ch(){if(Us)return ve;Us=1,Object.defineProperty(ve,"__esModule",{value:!0}),ve.toBig=ve.shrSL=ve.shrSH=ve.rotrSL=ve.rotrSH=ve.rotrBL=ve.rotrBH=ve.rotr32L=ve.rotr32H=ve.rotlSL=ve.rotlSH=ve.rotlBL=ve.rotlBH=ve.add5L=ve.add5H=ve.add4L=ve.add4H=ve.add3L=ve.add3H=void 0,ve.add=T,ve.fromBig=n,ve.split=r;const e=BigInt(2**32-1),t=BigInt(32);function n(q,Z=!1){return Z?{h:Number(q&e),l:Number(q>>t&e)}:{h:Number(q>>t&e)|0,l:Number(q&e)|0}}function r(q,Z=!1){const te=q.length;let ne=new Uint32Array(te),Y=new Uint32Array(te);for(let W=0;W<te;W++){const{h:w,l:N}=n(q[W],Z);[ne[W],Y[W]]=[w,N]}return[ne,Y]}const i=(q,Z)=>BigInt(q>>>0)<<t|BigInt(Z>>>0);ve.toBig=i;const o=(q,Z,te)=>q>>>te;ve.shrSH=o;const s=(q,Z,te)=>q<<32-te|Z>>>te;ve.shrSL=s;const a=(q,Z,te)=>q>>>te|Z<<32-te;ve.rotrSH=a;const u=(q,Z,te)=>q<<32-te|Z>>>te;ve.rotrSL=u;const d=(q,Z,te)=>q<<64-te|Z>>>te-32;ve.rotrBH=d;const g=(q,Z,te)=>q>>>te-32|Z<<64-te;ve.rotrBL=g;const p=(q,Z)=>Z;ve.rotr32H=p;const I=(q,Z)=>q;ve.rotr32L=I;const v=(q,Z,te)=>q<<te|Z>>>32-te;ve.rotlSH=v;const h=(q,Z,te)=>Z<<te|q>>>32-te;ve.rotlSL=h;const b=(q,Z,te)=>Z<<te-32|q>>>64-te;ve.rotlBH=b;const B=(q,Z,te)=>q<<te-32|Z>>>64-te;ve.rotlBL=B;function T(q,Z,te,ne){const Y=(Z>>>0)+(ne>>>0);return{h:q+te+(Y/2**32|0)|0,l:Y|0}}const H=(q,Z,te)=>(q>>>0)+(Z>>>0)+(te>>>0);ve.add3L=H;const $=(q,Z,te,ne)=>Z+te+ne+(q/2**32|0)|0;ve.add3H=$;const Q=(q,Z,te,ne)=>(q>>>0)+(Z>>>0)+(te>>>0)+(ne>>>0);ve.add4L=Q;const U=(q,Z,te,ne,Y)=>Z+te+ne+Y+(q/2**32|0)|0;ve.add4H=U;const P=(q,Z,te,ne,Y)=>(q>>>0)+(Z>>>0)+(te>>>0)+(ne>>>0)+(Y>>>0);ve.add5L=P;const K=(q,Z,te,ne,Y,W)=>Z+te+ne+Y+W+(q/2**32|0)|0;ve.add5H=K;const J={fromBig:n,split:r,toBig:i,shrSH:o,shrSL:s,rotrSH:a,rotrSL:u,rotrBH:d,rotrBL:g,rotr32H:p,rotr32L:I,rotlSH:v,rotlSL:h,rotlBH:b,rotlBL:B,add:T,add3L:H,add3H:$,add4L:Q,add4H:U,add5H:K,add5L:P};return ve.default=J,ve}var Ns;function oi(){if(Ns)return xe;Ns=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.sha512_224=xe.sha512_256=xe.sha384=xe.sha512=xe.sha224=xe.sha256=xe.SHA512_256=xe.SHA512_224=xe.SHA384=xe.SHA512=xe.SHA224=xe.SHA256=void 0;const e=ah(),t=ch(),n=dt(),r=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),i=new Uint32Array(64);class o extends e.HashMD{constructor($=32){super(64,$,8,!1),this.A=e.SHA256_IV[0]|0,this.B=e.SHA256_IV[1]|0,this.C=e.SHA256_IV[2]|0,this.D=e.SHA256_IV[3]|0,this.E=e.SHA256_IV[4]|0,this.F=e.SHA256_IV[5]|0,this.G=e.SHA256_IV[6]|0,this.H=e.SHA256_IV[7]|0}get(){const{A:$,B:Q,C:U,D:P,E:K,F:J,G:q,H:Z}=this;return[$,Q,U,P,K,J,q,Z]}set($,Q,U,P,K,J,q,Z){this.A=$|0,this.B=Q|0,this.C=U|0,this.D=P|0,this.E=K|0,this.F=J|0,this.G=q|0,this.H=Z|0}process($,Q){for(let Y=0;Y<16;Y++,Q+=4)i[Y]=$.getUint32(Q,!1);for(let Y=16;Y<64;Y++){const W=i[Y-15],w=i[Y-2],N=(0,n.rotr)(W,7)^(0,n.rotr)(W,18)^W>>>3,L=(0,n.rotr)(w,17)^(0,n.rotr)(w,19)^w>>>10;i[Y]=L+i[Y-7]+N+i[Y-16]|0}let{A:U,B:P,C:K,D:J,E:q,F:Z,G:te,H:ne}=this;for(let Y=0;Y<64;Y++){const W=(0,n.rotr)(q,6)^(0,n.rotr)(q,11)^(0,n.rotr)(q,25),w=ne+W+(0,e.Chi)(q,Z,te)+r[Y]+i[Y]|0,L=((0,n.rotr)(U,2)^(0,n.rotr)(U,13)^(0,n.rotr)(U,22))+(0,e.Maj)(U,P,K)|0;ne=te,te=Z,Z=q,q=J+w|0,J=K,K=P,P=U,U=w+L|0}U=U+this.A|0,P=P+this.B|0,K=K+this.C|0,J=J+this.D|0,q=q+this.E|0,Z=Z+this.F|0,te=te+this.G|0,ne=ne+this.H|0,this.set(U,P,K,J,q,Z,te,ne)}roundClean(){(0,n.clean)(i)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,n.clean)(this.buffer)}}xe.SHA256=o;class s extends o{constructor(){super(28),this.A=e.SHA224_IV[0]|0,this.B=e.SHA224_IV[1]|0,this.C=e.SHA224_IV[2]|0,this.D=e.SHA224_IV[3]|0,this.E=e.SHA224_IV[4]|0,this.F=e.SHA224_IV[5]|0,this.G=e.SHA224_IV[6]|0,this.H=e.SHA224_IV[7]|0}}xe.SHA224=s;const a=t.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(H=>BigInt(H))),u=a[0],d=a[1],g=new Uint32Array(80),p=new Uint32Array(80);class I extends e.HashMD{constructor($=64){super(128,$,16,!1),this.Ah=e.SHA512_IV[0]|0,this.Al=e.SHA512_IV[1]|0,this.Bh=e.SHA512_IV[2]|0,this.Bl=e.SHA512_IV[3]|0,this.Ch=e.SHA512_IV[4]|0,this.Cl=e.SHA512_IV[5]|0,this.Dh=e.SHA512_IV[6]|0,this.Dl=e.SHA512_IV[7]|0,this.Eh=e.SHA512_IV[8]|0,this.El=e.SHA512_IV[9]|0,this.Fh=e.SHA512_IV[10]|0,this.Fl=e.SHA512_IV[11]|0,this.Gh=e.SHA512_IV[12]|0,this.Gl=e.SHA512_IV[13]|0,this.Hh=e.SHA512_IV[14]|0,this.Hl=e.SHA512_IV[15]|0}get(){const{Ah:$,Al:Q,Bh:U,Bl:P,Ch:K,Cl:J,Dh:q,Dl:Z,Eh:te,El:ne,Fh:Y,Fl:W,Gh:w,Gl:N,Hh:L,Hl:E}=this;return[$,Q,U,P,K,J,q,Z,te,ne,Y,W,w,N,L,E]}set($,Q,U,P,K,J,q,Z,te,ne,Y,W,w,N,L,E){this.Ah=$|0,this.Al=Q|0,this.Bh=U|0,this.Bl=P|0,this.Ch=K|0,this.Cl=J|0,this.Dh=q|0,this.Dl=Z|0,this.Eh=te|0,this.El=ne|0,this.Fh=Y|0,this.Fl=W|0,this.Gh=w|0,this.Gl=N|0,this.Hh=L|0,this.Hl=E|0}process($,Q){for(let f=0;f<16;f++,Q+=4)g[f]=$.getUint32(Q),p[f]=$.getUint32(Q+=4);for(let f=16;f<80;f++){const y=g[f-15]|0,m=p[f-15]|0,S=t.rotrSH(y,m,1)^t.rotrSH(y,m,8)^t.shrSH(y,m,7),x=t.rotrSL(y,m,1)^t.rotrSL(y,m,8)^t.shrSL(y,m,7),k=g[f-2]|0,z=p[f-2]|0,O=t.rotrSH(k,z,19)^t.rotrBH(k,z,61)^t.shrSH(k,z,6),F=t.rotrSL(k,z,19)^t.rotrBL(k,z,61)^t.shrSL(k,z,6),M=t.add4L(x,F,p[f-7],p[f-16]),j=t.add4H(M,S,O,g[f-7],g[f-16]);g[f]=j|0,p[f]=M|0}let{Ah:U,Al:P,Bh:K,Bl:J,Ch:q,Cl:Z,Dh:te,Dl:ne,Eh:Y,El:W,Fh:w,Fl:N,Gh:L,Gl:E,Hh:C,Hl:D}=this;for(let f=0;f<80;f++){const y=t.rotrSH(Y,W,14)^t.rotrSH(Y,W,18)^t.rotrBH(Y,W,41),m=t.rotrSL(Y,W,14)^t.rotrSL(Y,W,18)^t.rotrBL(Y,W,41),S=Y&w^~Y&L,x=W&N^~W&E,k=t.add5L(D,m,x,d[f],p[f]),z=t.add5H(k,C,y,S,u[f],g[f]),O=k|0,F=t.rotrSH(U,P,28)^t.rotrBH(U,P,34)^t.rotrBH(U,P,39),M=t.rotrSL(U,P,28)^t.rotrBL(U,P,34)^t.rotrBL(U,P,39),j=U&K^U&q^K&q,X=P&J^P&Z^J&Z;C=L|0,D=E|0,L=w|0,E=N|0,w=Y|0,N=W|0,{h:Y,l:W}=t.add(te|0,ne|0,z|0,O|0),te=q|0,ne=Z|0,q=K|0,Z=J|0,K=U|0,J=P|0;const R=t.add3L(O,M,X);U=t.add3H(R,z,F,j),P=R|0}({h:U,l:P}=t.add(this.Ah|0,this.Al|0,U|0,P|0)),{h:K,l:J}=t.add(this.Bh|0,this.Bl|0,K|0,J|0),{h:q,l:Z}=t.add(this.Ch|0,this.Cl|0,q|0,Z|0),{h:te,l:ne}=t.add(this.Dh|0,this.Dl|0,te|0,ne|0),{h:Y,l:W}=t.add(this.Eh|0,this.El|0,Y|0,W|0),{h:w,l:N}=t.add(this.Fh|0,this.Fl|0,w|0,N|0),{h:L,l:E}=t.add(this.Gh|0,this.Gl|0,L|0,E|0),{h:C,l:D}=t.add(this.Hh|0,this.Hl|0,C|0,D|0),this.set(U,P,K,J,q,Z,te,ne,Y,W,w,N,L,E,C,D)}roundClean(){(0,n.clean)(g,p)}destroy(){(0,n.clean)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}xe.SHA512=I;class v extends I{constructor(){super(48),this.Ah=e.SHA384_IV[0]|0,this.Al=e.SHA384_IV[1]|0,this.Bh=e.SHA384_IV[2]|0,this.Bl=e.SHA384_IV[3]|0,this.Ch=e.SHA384_IV[4]|0,this.Cl=e.SHA384_IV[5]|0,this.Dh=e.SHA384_IV[6]|0,this.Dl=e.SHA384_IV[7]|0,this.Eh=e.SHA384_IV[8]|0,this.El=e.SHA384_IV[9]|0,this.Fh=e.SHA384_IV[10]|0,this.Fl=e.SHA384_IV[11]|0,this.Gh=e.SHA384_IV[12]|0,this.Gl=e.SHA384_IV[13]|0,this.Hh=e.SHA384_IV[14]|0,this.Hl=e.SHA384_IV[15]|0}}xe.SHA384=v;const h=Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),b=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class B extends I{constructor(){super(28),this.Ah=h[0]|0,this.Al=h[1]|0,this.Bh=h[2]|0,this.Bl=h[3]|0,this.Ch=h[4]|0,this.Cl=h[5]|0,this.Dh=h[6]|0,this.Dl=h[7]|0,this.Eh=h[8]|0,this.El=h[9]|0,this.Fh=h[10]|0,this.Fl=h[11]|0,this.Gh=h[12]|0,this.Gl=h[13]|0,this.Hh=h[14]|0,this.Hl=h[15]|0}}xe.SHA512_224=B;class T extends I{constructor(){super(32),this.Ah=b[0]|0,this.Al=b[1]|0,this.Bh=b[2]|0,this.Bl=b[3]|0,this.Ch=b[4]|0,this.Cl=b[5]|0,this.Dh=b[6]|0,this.Dl=b[7]|0,this.Eh=b[8]|0,this.El=b[9]|0,this.Fh=b[10]|0,this.Fl=b[11]|0,this.Gh=b[12]|0,this.Gl=b[13]|0,this.Hh=b[14]|0,this.Hl=b[15]|0}}return xe.SHA512_256=T,xe.sha256=(0,n.createHasher)(()=>new o),xe.sha224=(0,n.createHasher)(()=>new s),xe.sha512=(0,n.createHasher)(()=>new I),xe.sha384=(0,n.createHasher)(()=>new v),xe.sha512_256=(0,n.createHasher)(()=>new T),xe.sha512_224=(0,n.createHasher)(()=>new B),xe}var Je={},si={},Ds;function bt(){return Ds||(Ds=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.notImplemented=e.bitMask=e.utf8ToBytes=e.randomBytes=e.isBytes=e.hexToBytes=e.concatBytes=e.bytesToUtf8=e.bytesToHex=e.anumber=e.abytes=void 0,e.abool=o,e._abool2=s,e._abytes2=a,e.numberToHexUnpadded=u,e.hexToNumber=d,e.bytesToNumberBE=g,e.bytesToNumberLE=p,e.numberToBytesBE=I,e.numberToBytesLE=v,e.numberToVarBytesBE=h,e.ensureBytes=b,e.equalBytes=B,e.copyBytes=T,e.asciiToBytes=H,e.inRange=Q,e.aInRange=U,e.bitLen=P,e.bitGet=K,e.bitSet=J,e.createHmacDrbg=Z,e.validateObject=ne,e.isHash=Y,e._validateObject=W,e.memoized=N;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=dt();var n=dt();Object.defineProperty(e,"abytes",{enumerable:!0,get:function(){return n.abytes}}),Object.defineProperty(e,"anumber",{enumerable:!0,get:function(){return n.anumber}}),Object.defineProperty(e,"bytesToHex",{enumerable:!0,get:function(){return n.bytesToHex}}),Object.defineProperty(e,"bytesToUtf8",{enumerable:!0,get:function(){return n.bytesToUtf8}}),Object.defineProperty(e,"concatBytes",{enumerable:!0,get:function(){return n.concatBytes}}),Object.defineProperty(e,"hexToBytes",{enumerable:!0,get:function(){return n.hexToBytes}}),Object.defineProperty(e,"isBytes",{enumerable:!0,get:function(){return n.isBytes}}),Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return n.randomBytes}}),Object.defineProperty(e,"utf8ToBytes",{enumerable:!0,get:function(){return n.utf8ToBytes}});const r=BigInt(0),i=BigInt(1);function o(L,E){if(typeof E!="boolean")throw new Error(L+" boolean expected, got "+E)}function s(L,E=""){if(typeof L!="boolean"){const C=E&&`"${E}"`;throw new Error(C+"expected boolean, got type="+typeof L)}return L}function a(L,E,C=""){const D=(0,t.isBytes)(L),f=L?.length,y=E!==void 0;if(!D||y&&f!==E){const m=C&&`"${C}" `,S=y?` of length ${E}`:"",x=D?`length=${f}`:`type=${typeof L}`;throw new Error(m+"expected Uint8Array"+S+", got "+x)}return L}function u(L){const E=L.toString(16);return E.length&1?"0"+E:E}function d(L){if(typeof L!="string")throw new Error("hex string expected, got "+typeof L);return L===""?r:BigInt("0x"+L)}function g(L){return d((0,t.bytesToHex)(L))}function p(L){return(0,t.abytes)(L),d((0,t.bytesToHex)(Uint8Array.from(L).reverse()))}function I(L,E){return(0,t.hexToBytes)(L.toString(16).padStart(E*2,"0"))}function v(L,E){return I(L,E).reverse()}function h(L){return(0,t.hexToBytes)(u(L))}function b(L,E,C){let D;if(typeof E=="string")try{D=(0,t.hexToBytes)(E)}catch(y){throw new Error(L+" must be hex string or Uint8Array, cause: "+y)}else if((0,t.isBytes)(E))D=Uint8Array.from(E);else throw new Error(L+" must be hex string or Uint8Array");const f=D.length;if(typeof C=="number"&&f!==C)throw new Error(L+" of length "+C+" expected, got "+f);return D}function B(L,E){if(L.length!==E.length)return!1;let C=0;for(let D=0;D<L.length;D++)C|=L[D]^E[D];return C===0}function T(L){return Uint8Array.from(L)}function H(L){return Uint8Array.from(L,(E,C)=>{const D=E.charCodeAt(0);if(E.length!==1||D>127)throw new Error(`string contains non-ASCII character "${L[C]}" with code ${D} at position ${C}`);return D})}const $=L=>typeof L=="bigint"&&r<=L;function Q(L,E,C){return $(L)&&$(E)&&$(C)&&E<=L&&L<C}function U(L,E,C,D){if(!Q(E,C,D))throw new Error("expected valid "+L+": "+C+" <= n < "+D+", got "+E)}function P(L){let E;for(E=0;L>r;L>>=i,E+=1);return E}function K(L,E){return L>>BigInt(E)&i}function J(L,E,C){return L|(C?i:r)<<BigInt(E)}const q=L=>(i<<BigInt(L))-i;e.bitMask=q;function Z(L,E,C){if(typeof L!="number"||L<2)throw new Error("hashLen must be a number");if(typeof E!="number"||E<2)throw new Error("qByteLen must be a number");if(typeof C!="function")throw new Error("hmacFn must be a function");const D=M=>new Uint8Array(M),f=M=>Uint8Array.of(M);let y=D(L),m=D(L),S=0;const x=()=>{y.fill(1),m.fill(0),S=0},k=(...M)=>C(m,y,...M),z=(M=D(0))=>{m=k(f(0),M),y=k(),M.length!==0&&(m=k(f(1),M),y=k())},O=()=>{if(S++>=1e3)throw new Error("drbg: tried 1000 values");let M=0;const j=[];for(;M<E;){y=k();const X=y.slice();j.push(X),M+=y.length}return(0,t.concatBytes)(...j)};return(M,j)=>{x(),z(M);let X;for(;!(X=j(O()));)z();return x(),X}}const te={bigint:L=>typeof L=="bigint",function:L=>typeof L=="function",boolean:L=>typeof L=="boolean",string:L=>typeof L=="string",stringOrUint8Array:L=>typeof L=="string"||(0,t.isBytes)(L),isSafeInteger:L=>Number.isSafeInteger(L),array:L=>Array.isArray(L),field:(L,E)=>E.Fp.isValid(L),hash:L=>typeof L=="function"&&Number.isSafeInteger(L.outputLen)};function ne(L,E,C={}){const D=(f,y,m)=>{const S=te[y];if(typeof S!="function")throw new Error("invalid validator function");const x=L[f];if(!(m&&x===void 0)&&!S(x,L))throw new Error("param "+String(f)+" is invalid. Expected "+y+", got "+x)};for(const[f,y]of Object.entries(E))D(f,y,!1);for(const[f,y]of Object.entries(C))D(f,y,!0);return L}function Y(L){return typeof L=="function"&&Number.isSafeInteger(L.outputLen)}function W(L,E,C={}){if(!L||typeof L!="object")throw new Error("expected valid options object");function D(f,y,m){const S=L[f];if(m&&S===void 0)return;const x=typeof S;if(x!==y||S===null)throw new Error(`param "${f}" is invalid: expected ${y}, got ${x}`)}Object.entries(E).forEach(([f,y])=>D(f,y,!1)),Object.entries(C).forEach(([f,y])=>D(f,y,!0))}const w=()=>{throw new Error("not implemented")};e.notImplemented=w;function N(L){const E=new WeakMap;return(C,...D)=>{const f=E.get(C);if(f!==void 0)return f;const y=L(C,...D);return E.set(C,y),y}}})(si)),si}var Ae={},$s;function Tt(){if($s)return Ae;$s=1,Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.isNegativeLE=void 0,Ae.mod=p,Ae.pow=I,Ae.pow2=v,Ae.invert=h,Ae.tonelliShanks=$,Ae.FpSqrt=Q,Ae.validateField=K,Ae.FpPow=J,Ae.FpInvertBatch=q,Ae.FpDiv=Z,Ae.FpLegendre=te,Ae.FpIsSquare=ne,Ae.nLength=Y,Ae.Field=W,Ae.FpSqrtOdd=w,Ae.FpSqrtEven=N,Ae.hashToPrivateScalar=L,Ae.getFieldBytesLength=E,Ae.getMinHashLength=C,Ae.mapHashToField=D;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=bt(),t=BigInt(0),n=BigInt(1),r=BigInt(2),i=BigInt(3),o=BigInt(4),s=BigInt(5),a=BigInt(7),u=BigInt(8),d=BigInt(9),g=BigInt(16);function p(f,y){const m=f%y;return m>=t?m:y+m}function I(f,y,m){return J(W(m),f,y)}function v(f,y,m){let S=f;for(;y-- >t;)S*=S,S%=m;return S}function h(f,y){if(f===t)throw new Error("invert: expected non-zero number");if(y<=t)throw new Error("invert: expected positive modulus, got "+y);let m=p(f,y),S=y,x=t,k=n;for(;m!==t;){const O=S/m,F=S%m,M=x-k*O;S=m,m=F,x=k,k=M}if(S!==n)throw new Error("invert: does not exist");return p(x,y)}function b(f,y,m){if(!f.eql(f.sqr(y),m))throw new Error("Cannot find square root")}function B(f,y){const m=(f.ORDER+n)/o,S=f.pow(y,m);return b(f,S,y),S}function T(f,y){const m=(f.ORDER-s)/u,S=f.mul(y,r),x=f.pow(S,m),k=f.mul(y,x),z=f.mul(f.mul(k,r),x),O=f.mul(k,f.sub(z,f.ONE));return b(f,O,y),O}function H(f){const y=W(f),m=$(f),S=m(y,y.neg(y.ONE)),x=m(y,S),k=m(y,y.neg(S)),z=(f+a)/g;return(O,F)=>{let M=O.pow(F,z),j=O.mul(M,S);const X=O.mul(M,x),R=O.mul(M,k),G=O.eql(O.sqr(j),F),oe=O.eql(O.sqr(X),F);M=O.cmov(M,j,G),j=O.cmov(R,X,oe);const se=O.eql(O.sqr(j),F),ue=O.cmov(M,j,se);return b(O,ue,F),ue}}function $(f){if(f<i)throw new Error("sqrt is not defined for small field");let y=f-n,m=0;for(;y%r===t;)y/=r,m++;let S=r;const x=W(f);for(;te(x,S)===1;)if(S++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(m===1)return B;let k=x.pow(S,y);const z=(y+n)/r;return function(F,M){if(F.is0(M))return M;if(te(F,M)!==1)throw new Error("Cannot find square root");let j=m,X=F.mul(F.ONE,k),R=F.pow(M,y),G=F.pow(M,z);for(;!F.eql(R,F.ONE);){if(F.is0(R))return F.ZERO;let oe=1,se=F.sqr(R);for(;!F.eql(se,F.ONE);)if(oe++,se=F.sqr(se),oe===j)throw new Error("Cannot find square root");const ue=n<<BigInt(j-oe-1),de=F.pow(X,ue);j=oe,X=F.sqr(de),R=F.mul(R,X),G=F.mul(G,de)}return G}}function Q(f){return f%o===i?B:f%u===s?T:f%g===d?H(f):$(f)}const U=(f,y)=>(p(f,y)&n)===n;Ae.isNegativeLE=U;const P=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function K(f){const y={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},m=P.reduce((S,x)=>(S[x]="function",S),y);return(0,e._validateObject)(f,m),f}function J(f,y,m){if(m<t)throw new Error("invalid exponent, negatives unsupported");if(m===t)return f.ONE;if(m===n)return y;let S=f.ONE,x=y;for(;m>t;)m&n&&(S=f.mul(S,x)),x=f.sqr(x),m>>=n;return S}function q(f,y,m=!1){const S=new Array(y.length).fill(m?f.ZERO:void 0),x=y.reduce((z,O,F)=>f.is0(O)?z:(S[F]=z,f.mul(z,O)),f.ONE),k=f.inv(x);return y.reduceRight((z,O,F)=>f.is0(O)?z:(S[F]=f.mul(z,S[F]),f.mul(z,O)),k),S}function Z(f,y,m){return f.mul(y,typeof m=="bigint"?h(m,f.ORDER):f.inv(m))}function te(f,y){const m=(f.ORDER-n)/r,S=f.pow(y,m),x=f.eql(S,f.ONE),k=f.eql(S,f.ZERO),z=f.eql(S,f.neg(f.ONE));if(!x&&!k&&!z)throw new Error("invalid Legendre symbol result");return x?1:k?0:-1}function ne(f,y){return te(f,y)===1}function Y(f,y){y!==void 0&&(0,e.anumber)(y);const m=y!==void 0?y:f.toString(2).length,S=Math.ceil(m/8);return{nBitLength:m,nByteLength:S}}function W(f,y,m=!1,S={}){if(f<=t)throw new Error("invalid field: expected ORDER > 0, got "+f);let x,k,z=!1,O;if(typeof y=="object"&&y!=null){if(S.sqrt||m)throw new Error("cannot specify opts in two arguments");const R=y;R.BITS&&(x=R.BITS),R.sqrt&&(k=R.sqrt),typeof R.isLE=="boolean"&&(m=R.isLE),typeof R.modFromBytes=="boolean"&&(z=R.modFromBytes),O=R.allowedLengths}else typeof y=="number"&&(x=y),S.sqrt&&(k=S.sqrt);const{nBitLength:F,nByteLength:M}=Y(f,x);if(M>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let j;const X=Object.freeze({ORDER:f,isLE:m,BITS:F,BYTES:M,MASK:(0,e.bitMask)(F),ZERO:t,ONE:n,allowedLengths:O,create:R=>p(R,f),isValid:R=>{if(typeof R!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof R);return t<=R&&R<f},is0:R=>R===t,isValidNot0:R=>!X.is0(R)&&X.isValid(R),isOdd:R=>(R&n)===n,neg:R=>p(-R,f),eql:(R,G)=>R===G,sqr:R=>p(R*R,f),add:(R,G)=>p(R+G,f),sub:(R,G)=>p(R-G,f),mul:(R,G)=>p(R*G,f),pow:(R,G)=>J(X,R,G),div:(R,G)=>p(R*h(G,f),f),sqrN:R=>R*R,addN:(R,G)=>R+G,subN:(R,G)=>R-G,mulN:(R,G)=>R*G,inv:R=>h(R,f),sqrt:k||(R=>(j||(j=Q(f)),j(X,R))),toBytes:R=>m?(0,e.numberToBytesLE)(R,M):(0,e.numberToBytesBE)(R,M),fromBytes:(R,G=!0)=>{if(O){if(!O.includes(R.length)||R.length>M)throw new Error("Field.fromBytes: expected "+O+" bytes, got "+R.length);const se=new Uint8Array(M);se.set(R,m?0:se.length-R.length),R=se}if(R.length!==M)throw new Error("Field.fromBytes: expected "+M+" bytes, got "+R.length);let oe=m?(0,e.bytesToNumberLE)(R):(0,e.bytesToNumberBE)(R);if(z&&(oe=p(oe,f)),!G&&!X.isValid(oe))throw new Error("invalid field element: outside of range 0..ORDER");return oe},invertBatch:R=>q(X,R),cmov:(R,G,oe)=>oe?G:R});return Object.freeze(X)}function w(f,y){if(!f.isOdd)throw new Error("Field doesn't have isOdd");const m=f.sqrt(y);return f.isOdd(m)?m:f.neg(m)}function N(f,y){if(!f.isOdd)throw new Error("Field doesn't have isOdd");const m=f.sqrt(y);return f.isOdd(m)?f.neg(m):m}function L(f,y,m=!1){f=(0,e.ensureBytes)("privateHash",f);const S=f.length,x=Y(y).nByteLength+8;if(x<24||S<x||S>1024)throw new Error("hashToPrivateScalar: expected "+x+"-1024 bytes of input, got "+S);const k=m?(0,e.bytesToNumberLE)(f):(0,e.bytesToNumberBE)(f);return p(k,y-n)+n}function E(f){if(typeof f!="bigint")throw new Error("field order must be bigint");const y=f.toString(2).length;return Math.ceil(y/8)}function C(f){const y=E(f);return y+Math.ceil(y/2)}function D(f,y,m=!1){const S=f.length,x=E(y),k=C(y);if(S<16||S<k||S>1024)throw new Error("expected "+k+"-1024 bytes of input, got "+S);const z=m?(0,e.bytesToNumberLE)(f):(0,e.bytesToNumberBE)(f),O=p(z,y-n)+n;return m?(0,e.numberToBytesLE)(O,x):(0,e.numberToBytesBE)(O,x)}return Ae}var Vs;function ai(){if(Vs)return Je;Vs=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.wNAF=void 0,Je.negateCt=i,Je.normalizeZ=o,Je.mulEndoUnsafe=B,Je.pippenger=T,Je.precomputeMSMUnsafe=H,Je.validateBasic=$,Je._createCurveFields=U;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=bt(),t=Tt(),n=BigInt(0),r=BigInt(1);function i(P,K){const J=K.negate();return P?J:K}function o(P,K){const J=(0,t.FpInvertBatch)(P.Fp,K.map(q=>q.Z));return K.map((q,Z)=>P.fromAffine(q.toAffine(J[Z])))}function s(P,K){if(!Number.isSafeInteger(P)||P<=0||P>K)throw new Error("invalid window size, expected [1.."+K+"], got W="+P)}function a(P,K){s(P,K);const J=Math.ceil(K/P)+1,q=2**(P-1),Z=2**P,te=(0,e.bitMask)(P),ne=BigInt(P);return{windows:J,windowSize:q,mask:te,maxNumber:Z,shiftBy:ne}}function u(P,K,J){const{windowSize:q,mask:Z,maxNumber:te,shiftBy:ne}=J;let Y=Number(P&Z),W=P>>ne;Y>q&&(Y-=te,W+=r);const w=K*q,N=w+Math.abs(Y)-1,L=Y===0,E=Y<0,C=K%2!==0;return{nextN:W,offset:N,isZero:L,isNeg:E,isNegF:C,offsetF:w}}function d(P,K){if(!Array.isArray(P))throw new Error("array expected");P.forEach((J,q)=>{if(!(J instanceof K))throw new Error("invalid point at index "+q)})}function g(P,K){if(!Array.isArray(P))throw new Error("array of scalars expected");P.forEach((J,q)=>{if(!K.isValid(J))throw new Error("invalid scalar at index "+q)})}const p=new WeakMap,I=new WeakMap;function v(P){return I.get(P)||1}function h(P){if(P!==n)throw new Error("invalid wNAF")}class b{constructor(K,J){this.BASE=K.BASE,this.ZERO=K.ZERO,this.Fn=K.Fn,this.bits=J}_unsafeLadder(K,J,q=this.ZERO){let Z=K;for(;J>n;)J&r&&(q=q.add(Z)),Z=Z.double(),J>>=r;return q}precomputeWindow(K,J){const{windows:q,windowSize:Z}=a(J,this.bits),te=[];let ne=K,Y=ne;for(let W=0;W<q;W++){Y=ne,te.push(Y);for(let w=1;w<Z;w++)Y=Y.add(ne),te.push(Y);ne=Y.double()}return te}wNAF(K,J,q){if(!this.Fn.isValid(q))throw new Error("invalid scalar");let Z=this.ZERO,te=this.BASE;const ne=a(K,this.bits);for(let Y=0;Y<ne.windows;Y++){const{nextN:W,offset:w,isZero:N,isNeg:L,isNegF:E,offsetF:C}=u(q,Y,ne);q=W,N?te=te.add(i(E,J[C])):Z=Z.add(i(L,J[w]))}return h(q),{p:Z,f:te}}wNAFUnsafe(K,J,q,Z=this.ZERO){const te=a(K,this.bits);for(let ne=0;ne<te.windows&&q!==n;ne++){const{nextN:Y,offset:W,isZero:w,isNeg:N}=u(q,ne,te);if(q=Y,!w){const L=J[W];Z=Z.add(N?L.negate():L)}}return h(q),Z}getPrecomputes(K,J,q){let Z=p.get(J);return Z||(Z=this.precomputeWindow(J,K),K!==1&&(typeof q=="function"&&(Z=q(Z)),p.set(J,Z))),Z}cached(K,J,q){const Z=v(K);return this.wNAF(Z,this.getPrecomputes(Z,K,q),J)}unsafe(K,J,q,Z){const te=v(K);return te===1?this._unsafeLadder(K,J,Z):this.wNAFUnsafe(te,this.getPrecomputes(te,K,q),J,Z)}createCache(K,J){s(J,this.bits),I.set(K,J),p.delete(K)}hasCache(K){return v(K)!==1}}Je.wNAF=b;function B(P,K,J,q){let Z=K,te=P.ZERO,ne=P.ZERO;for(;J>n||q>n;)J&r&&(te=te.add(Z)),q&r&&(ne=ne.add(Z)),Z=Z.double(),J>>=r,q>>=r;return{p1:te,p2:ne}}function T(P,K,J,q){d(J,P),g(q,K);const Z=J.length,te=q.length;if(Z!==te)throw new Error("arrays of points and scalars must have equal length");const ne=P.ZERO,Y=(0,e.bitLen)(BigInt(Z));let W=1;Y>12?W=Y-3:Y>4?W=Y-2:Y>0&&(W=2);const w=(0,e.bitMask)(W),N=new Array(Number(w)+1).fill(ne),L=Math.floor((K.BITS-1)/W)*W;let E=ne;for(let C=L;C>=0;C-=W){N.fill(ne);for(let f=0;f<te;f++){const y=q[f],m=Number(y>>BigInt(C)&w);N[m]=N[m].add(J[f])}let D=ne;for(let f=N.length-1,y=ne;f>0;f--)y=y.add(N[f]),D=D.add(y);if(E=E.add(D),C!==0)for(let f=0;f<W;f++)E=E.double()}return E}function H(P,K,J,q){s(q,K.BITS),d(J,P);const Z=P.ZERO,te=2**q-1,ne=Math.ceil(K.BITS/q),Y=(0,e.bitMask)(q),W=J.map(w=>{const N=[];for(let L=0,E=w;L<te;L++)N.push(E),E=E.add(w);return N});return w=>{if(g(w,K),w.length>J.length)throw new Error("array of scalars must be smaller than array of points");let N=Z;for(let L=0;L<ne;L++){if(N!==Z)for(let C=0;C<q;C++)N=N.double();const E=BigInt(ne*q-(L+1)*q);for(let C=0;C<w.length;C++){const D=w[C],f=Number(D>>E&Y);f&&(N=N.add(W[C][f-1]))}}return N}}function $(P){return(0,t.validateField)(P.Fp),(0,e.validateObject)(P,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,t.nLength)(P.n,P.nBitLength),...P,p:P.Fp.ORDER})}function Q(P,K,J){if(K){if(K.ORDER!==P)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return(0,t.validateField)(K),K}else return(0,t.Field)(P,{isLE:J})}function U(P,K,J={},q){if(q===void 0&&(q=P==="edwards"),!K||typeof K!="object")throw new Error(`expected valid ${P} CURVE object`);for(const W of["p","n","h"]){const w=K[W];if(!(typeof w=="bigint"&&w>n))throw new Error(`CURVE.${W} must be positive bigint`)}const Z=Q(K.p,J.Fp,q),te=Q(K.n,J.Fn,q),Y=["Gx","Gy","a",P==="weierstrass"?"b":"d"];for(const W of Y)if(!Z.isValid(K[W]))throw new Error(`CURVE.${W} must be valid field element of CURVE.Fp`);return K=Object.freeze(Object.assign({},K)),{CURVE:K,Fp:Z,Fn:te}}return Je}var wt={},js;function lh(){if(js)return wt;js=1,Object.defineProperty(wt,"__esModule",{value:!0}),wt.PrimeEdwardsPoint=void 0,wt.edwards=u,wt.eddsa=g,wt.twistedEdwards=v;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=bt(),t=ai(),n=Tt(),r=BigInt(0),i=BigInt(1),o=BigInt(2),s=BigInt(8);function a(h,b,B,T){const H=h.sqr(B),$=h.sqr(T),Q=h.add(h.mul(b.a,H),$),U=h.add(h.ONE,h.mul(b.d,h.mul(H,$)));return h.eql(Q,U)}function u(h,b={}){const B=(0,t._createCurveFields)("edwards",h,b,b.FpFnLE),{Fp:T,Fn:H}=B;let $=B.CURVE;const{h:Q}=$;(0,e._validateObject)(b,{},{uvRatio:"function"});const U=o<<BigInt(H.BYTES*8)-i,P=W=>T.create(W),K=b.uvRatio||((W,w)=>{try{return{isValid:!0,value:T.sqrt(T.div(W,w))}}catch{return{isValid:!1,value:r}}});if(!a(T,$,$.Gx,$.Gy))throw new Error("bad curve params: generator point");function J(W,w,N=!1){const L=N?i:r;return(0,e.aInRange)("coordinate "+W,w,L,U),w}function q(W){if(!(W instanceof ne))throw new Error("ExtendedPoint expected")}const Z=(0,e.memoized)((W,w)=>{const{X:N,Y:L,Z:E}=W,C=W.is0();w==null&&(w=C?s:T.inv(E));const D=P(N*w),f=P(L*w),y=T.mul(E,w);if(C)return{x:r,y:i};if(y!==i)throw new Error("invZ was invalid");return{x:D,y:f}}),te=(0,e.memoized)(W=>{const{a:w,d:N}=$;if(W.is0())throw new Error("bad point: ZERO");const{X:L,Y:E,Z:C,T:D}=W,f=P(L*L),y=P(E*E),m=P(C*C),S=P(m*m),x=P(f*w),k=P(m*P(x+y)),z=P(S+P(N*P(f*y)));if(k!==z)throw new Error("bad point: equation left != right (1)");const O=P(L*E),F=P(C*D);if(O!==F)throw new Error("bad point: equation left != right (2)");return!0});class ne{constructor(w,N,L,E){this.X=J("x",w),this.Y=J("y",N),this.Z=J("z",L,!0),this.T=J("t",E),Object.freeze(this)}static CURVE(){return $}static fromAffine(w){if(w instanceof ne)throw new Error("extended point not allowed");const{x:N,y:L}=w||{};return J("x",N),J("y",L),new ne(N,L,i,P(N*L))}static fromBytes(w,N=!1){const L=T.BYTES,{a:E,d:C}=$;w=(0,e.copyBytes)((0,e._abytes2)(w,L,"point")),(0,e._abool2)(N,"zip215");const D=(0,e.copyBytes)(w),f=w[L-1];D[L-1]=f&-129;const y=(0,e.bytesToNumberLE)(D),m=N?U:T.ORDER;(0,e.aInRange)("point.y",y,r,m);const S=P(y*y),x=P(S-i),k=P(C*S-E);let{isValid:z,value:O}=K(x,k);if(!z)throw new Error("bad point: invalid y coordinate");const F=(O&i)===i,M=(f&128)!==0;if(!N&&O===r&&M)throw new Error("bad point: x=0 and x_0=1");return M!==F&&(O=P(-O)),ne.fromAffine({x:O,y})}static fromHex(w,N=!1){return ne.fromBytes((0,e.ensureBytes)("point",w),N)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(w=8,N=!0){return Y.createCache(this,w),N||this.multiply(o),this}assertValidity(){te(this)}equals(w){q(w);const{X:N,Y:L,Z:E}=this,{X:C,Y:D,Z:f}=w,y=P(N*f),m=P(C*E),S=P(L*f),x=P(D*E);return y===m&&S===x}is0(){return this.equals(ne.ZERO)}negate(){return new ne(P(-this.X),this.Y,this.Z,P(-this.T))}double(){const{a:w}=$,{X:N,Y:L,Z:E}=this,C=P(N*N),D=P(L*L),f=P(o*P(E*E)),y=P(w*C),m=N+L,S=P(P(m*m)-C-D),x=y+D,k=x-f,z=y-D,O=P(S*k),F=P(x*z),M=P(S*z),j=P(k*x);return new ne(O,F,j,M)}add(w){q(w);const{a:N,d:L}=$,{X:E,Y:C,Z:D,T:f}=this,{X:y,Y:m,Z:S,T:x}=w,k=P(E*y),z=P(C*m),O=P(f*L*x),F=P(D*S),M=P((E+C)*(y+m)-k-z),j=F-O,X=F+O,R=P(z-N*k),G=P(M*j),oe=P(X*R),se=P(M*R),ue=P(j*X);return new ne(G,oe,ue,se)}subtract(w){return this.add(w.negate())}multiply(w){if(!H.isValidNot0(w))throw new Error("invalid scalar: expected 1 <= sc < curve.n");const{p:N,f:L}=Y.cached(this,w,E=>(0,t.normalizeZ)(ne,E));return(0,t.normalizeZ)(ne,[N,L])[0]}multiplyUnsafe(w,N=ne.ZERO){if(!H.isValid(w))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return w===r?ne.ZERO:this.is0()||w===i?this:Y.unsafe(this,w,L=>(0,t.normalizeZ)(ne,L),N)}isSmallOrder(){return this.multiplyUnsafe(Q).is0()}isTorsionFree(){return Y.unsafe(this,$.n).is0()}toAffine(w){return Z(this,w)}clearCofactor(){return Q===i?this:this.multiplyUnsafe(Q)}toBytes(){const{x:w,y:N}=this.toAffine(),L=T.toBytes(N);return L[L.length-1]|=w&i?128:0,L}toHex(){return(0,e.bytesToHex)(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(w){return(0,t.normalizeZ)(ne,w)}static msm(w,N){return(0,t.pippenger)(ne,H,w,N)}_setWindowSize(w){this.precompute(w)}toRawBytes(){return this.toBytes()}}ne.BASE=new ne($.Gx,$.Gy,i,P($.Gx*$.Gy)),ne.ZERO=new ne(r,i,i,r),ne.Fp=T,ne.Fn=H;const Y=new t.wNAF(ne,H.BITS);return ne.BASE.precompute(8),ne}class d{constructor(b){this.ep=b}static fromBytes(b){(0,e.notImplemented)()}static fromHex(b){(0,e.notImplemented)()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(b){return this.ep.toAffine(b)}toHex(){return(0,e.bytesToHex)(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(b){return this.assertSame(b),this.init(this.ep.add(b.ep))}subtract(b){return this.assertSame(b),this.init(this.ep.subtract(b.ep))}multiply(b){return this.init(this.ep.multiply(b))}multiplyUnsafe(b){return this.init(this.ep.multiplyUnsafe(b))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(b,B){return this.init(this.ep.precompute(b,B))}toRawBytes(){return this.toBytes()}}wt.PrimeEdwardsPoint=d;function g(h,b,B={}){if(typeof b!="function")throw new Error('"hash" function param is required');(0,e._validateObject)(B,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});const{prehash:T}=B,{BASE:H,Fp:$,Fn:Q}=h,U=B.randomBytes||e.randomBytes,P=B.adjustScalarBytes||(m=>m),K=B.domain||((m,S,x)=>{if((0,e._abool2)(x,"phflag"),S.length||x)throw new Error("Contexts/pre-hash are not supported");return m});function J(m){return Q.create((0,e.bytesToNumberLE)(m))}function q(m){const S=L.secretKey;m=(0,e.ensureBytes)("private key",m,S);const x=(0,e.ensureBytes)("hashed private key",b(m),2*S),k=P(x.slice(0,S)),z=x.slice(S,2*S),O=J(k);return{head:k,prefix:z,scalar:O}}function Z(m){const{head:S,prefix:x,scalar:k}=q(m),z=H.multiply(k),O=z.toBytes();return{head:S,prefix:x,scalar:k,point:z,pointBytes:O}}function te(m){return Z(m).pointBytes}function ne(m=Uint8Array.of(),...S){const x=(0,e.concatBytes)(...S);return J(b(K(x,(0,e.ensureBytes)("context",m),!!T)))}function Y(m,S,x={}){m=(0,e.ensureBytes)("message",m),T&&(m=T(m));const{prefix:k,scalar:z,pointBytes:O}=Z(S),F=ne(x.context,k,m),M=H.multiply(F).toBytes(),j=ne(x.context,M,O,m),X=Q.create(F+j*z);if(!Q.isValid(X))throw new Error("sign failed: invalid s");const R=(0,e.concatBytes)(M,Q.toBytes(X));return(0,e._abytes2)(R,L.signature,"result")}const W={zip215:!0};function w(m,S,x,k=W){const{context:z,zip215:O}=k,F=L.signature;m=(0,e.ensureBytes)("signature",m,F),S=(0,e.ensureBytes)("message",S),x=(0,e.ensureBytes)("publicKey",x,L.publicKey),O!==void 0&&(0,e._abool2)(O,"zip215"),T&&(S=T(S));const M=F/2,j=m.subarray(0,M),X=(0,e.bytesToNumberLE)(m.subarray(M,F));let R,G,oe;try{R=h.fromBytes(x,O),G=h.fromBytes(j,O),oe=H.multiplyUnsafe(X)}catch{return!1}if(!O&&R.isSmallOrder())return!1;const se=ne(z,G.toBytes(),R.toBytes(),S);return G.add(R.multiplyUnsafe(se)).subtract(oe).clearCofactor().is0()}const N=$.BYTES,L={secretKey:N,publicKey:N,signature:2*N,seed:N};function E(m=U(L.seed)){return(0,e._abytes2)(m,L.seed,"seed")}function C(m){const S=y.randomSecretKey(m);return{secretKey:S,publicKey:te(S)}}function D(m){return(0,e.isBytes)(m)&&m.length===Q.BYTES}function f(m,S){try{return!!h.fromBytes(m,S)}catch{return!1}}const y={getExtendedPublicKey:Z,randomSecretKey:E,isValidSecretKey:D,isValidPublicKey:f,toMontgomery(m){const{y:S}=h.fromBytes(m),x=L.publicKey,k=x===32;if(!k&&x!==57)throw new Error("only defined for 25519 and 448");const z=k?$.div(i+S,i-S):$.div(S-i,S+i);return $.toBytes(z)},toMontgomerySecret(m){const S=L.secretKey;(0,e._abytes2)(m,S);const x=b(m.subarray(0,S));return P(x).subarray(0,S)},randomPrivateKey:E,precompute(m=8,S=h.BASE){return S.precompute(m,!1)}};return Object.freeze({keygen:C,getPublicKey:te,sign:Y,verify:w,utils:y,Point:h,lengths:L})}function p(h){const b={a:h.a,d:h.d,p:h.Fp.ORDER,n:h.n,h:h.h,Gx:h.Gx,Gy:h.Gy},B=h.Fp,T=(0,n.Field)(b.n,h.nBitLength,!0),H={Fp:B,Fn:T,uvRatio:h.uvRatio},$={randomBytes:h.randomBytes,adjustScalarBytes:h.adjustScalarBytes,domain:h.domain,prehash:h.prehash,mapToCurve:h.mapToCurve};return{CURVE:b,curveOpts:H,hash:h.hash,eddsaOpts:$}}function I(h,b){const B=b.Point;return Object.assign({},b,{ExtendedPoint:B,CURVE:h,nBitLength:B.Fn.BITS,nByteLength:B.Fn.BYTES})}function v(h){const{CURVE:b,curveOpts:B,hash:T,eddsaOpts:H}=p(h),$=u(b,B),Q=g($,T,H);return I(h,Q)}return wt}var ci={},qs;function Ks(){return qs||(qs=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e._DST_scalar=void 0,e.expand_message_xmd=u,e.expand_message_xof=d,e.hash_to_field=g,e.isogenyMap=p,e.createHasher=I;const t=bt(),n=Tt(),r=t.bytesToNumberBE;function i(v,h){if(s(v),s(h),v<0||v>=1<<8*h)throw new Error("invalid I2OSP input: "+v);const b=Array.from({length:h}).fill(0);for(let B=h-1;B>=0;B--)b[B]=v&255,v>>>=8;return new Uint8Array(b)}function o(v,h){const b=new Uint8Array(v.length);for(let B=0;B<v.length;B++)b[B]=v[B]^h[B];return b}function s(v){if(!Number.isSafeInteger(v))throw new Error("number expected")}function a(v){if(!(0,t.isBytes)(v)&&typeof v!="string")throw new Error("DST must be Uint8Array or string");return typeof v=="string"?(0,t.utf8ToBytes)(v):v}function u(v,h,b,B){(0,t.abytes)(v),s(b),h=a(h),h.length>255&&(h=B((0,t.concatBytes)((0,t.utf8ToBytes)("H2C-OVERSIZE-DST-"),h)));const{outputLen:T,blockLen:H}=B,$=Math.ceil(b/T);if(b>65535||$>255)throw new Error("expand_message_xmd: invalid lenInBytes");const Q=(0,t.concatBytes)(h,i(h.length,1)),U=i(0,H),P=i(b,2),K=new Array($),J=B((0,t.concatBytes)(U,v,P,i(0,1),Q));K[0]=B((0,t.concatBytes)(J,i(1,1),Q));for(let Z=1;Z<=$;Z++){const te=[o(J,K[Z-1]),i(Z+1,1),Q];K[Z]=B((0,t.concatBytes)(...te))}return(0,t.concatBytes)(...K).slice(0,b)}function d(v,h,b,B,T){if((0,t.abytes)(v),s(b),h=a(h),h.length>255){const H=Math.ceil(2*B/8);h=T.create({dkLen:H}).update((0,t.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(h).digest()}if(b>65535||h.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return T.create({dkLen:b}).update(v).update(i(b,2)).update(h).update(i(h.length,1)).digest()}function g(v,h,b){(0,t._validateObject)(b,{p:"bigint",m:"number",k:"number",hash:"function"});const{p:B,k:T,m:H,hash:$,expand:Q,DST:U}=b;if(!(0,t.isHash)(b.hash))throw new Error("expected valid hash");(0,t.abytes)(v),s(h);const P=B.toString(2).length,K=Math.ceil((P+T)/8),J=h*H*K;let q;if(Q==="xmd")q=u(v,U,J,$);else if(Q==="xof")q=d(v,U,J,T,$);else if(Q==="_internal_pass")q=v;else throw new Error('expand must be "xmd" or "xof"');const Z=new Array(h);for(let te=0;te<h;te++){const ne=new Array(H);for(let Y=0;Y<H;Y++){const W=K*(Y+te*H),w=q.subarray(W,W+K);ne[Y]=(0,n.mod)(r(w),B)}Z[te]=ne}return Z}function p(v,h){const b=h.map(B=>Array.from(B).reverse());return(B,T)=>{const[H,$,Q,U]=b.map(J=>J.reduce((q,Z)=>v.add(v.mul(q,B),Z))),[P,K]=(0,n.FpInvertBatch)(v,[$,U],!0);return B=v.mul(H,P),T=v.mul(T,v.mul(Q,K)),{x:B,y:T}}}e._DST_scalar=(0,t.utf8ToBytes)("HashToScalar-");function I(v,h,b){if(typeof h!="function")throw new Error("mapToCurve() must be defined");function B(H){return v.fromAffine(h(H))}function T(H){const $=H.clearCofactor();return $.equals(v.ZERO)?v.ZERO:($.assertValidity(),$)}return{defaults:b,hashToCurve(H,$){const Q=Object.assign({},b,$),U=g(H,2,Q),P=B(U[0]),K=B(U[1]);return T(P.add(K))},encodeToCurve(H,$){const Q=b.encodeDST?{DST:b.encodeDST}:{},U=Object.assign({},b,Q,$),P=g(H,1,U),K=B(P[0]);return T(K)},mapToCurve(H){if(!Array.isArray(H))throw new Error("expected array of bigints");for(const $ of H)if(typeof $!="bigint")throw new Error("expected array of bigints");return T(B(H))},hashToScalar(H,$){const Q=v.Fn.ORDER,U=Object.assign({},b,{p:Q,m:1,DST:e._DST_scalar},$);return g(H,1,U)[0][0]}}}})(ci)),ci}var rr={},Gs;function uh(){if(Gs)return rr;Gs=1,Object.defineProperty(rr,"__esModule",{value:!0}),rr.montgomery=s;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=bt(),t=Tt(),n=BigInt(0),r=BigInt(1),i=BigInt(2);function o(a){return(0,e._validateObject)(a,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...a})}function s(a){const u=o(a),{P:d,type:g,adjustScalarBytes:p,powPminus2:I,randomBytes:v}=u,h=g==="x25519";if(!h&&g!=="x448")throw new Error("invalid type");const b=v||e.randomBytes,B=h?255:448,T=h?32:56,H=BigInt(h?9:5),$=BigInt(h?121665:39081),Q=h?i**BigInt(254):i**BigInt(447),U=h?BigInt(8)*i**BigInt(251)-r:BigInt(4)*i**BigInt(445)-r,P=Q+U+r,K=D=>(0,t.mod)(D,d),J=q(H);function q(D){return(0,e.numberToBytesLE)(K(D),T)}function Z(D){const f=(0,e.ensureBytes)("u coordinate",D,T);return h&&(f[31]&=127),K((0,e.bytesToNumberLE)(f))}function te(D){return(0,e.bytesToNumberLE)(p((0,e.ensureBytes)("scalar",D,T)))}function ne(D,f){const y=w(Z(f),te(D));if(y===n)throw new Error("invalid private or public key received");return q(y)}function Y(D){return ne(D,J)}function W(D,f,y){const m=K(D*(f-y));return f=K(f-m),y=K(y+m),{x_2:f,x_3:y}}function w(D,f){(0,e.aInRange)("u",D,n,d),(0,e.aInRange)("scalar",f,Q,P);const y=f,m=D;let S=r,x=n,k=D,z=r,O=n;for(let M=BigInt(B-1);M>=n;M--){const j=y>>M&r;O^=j,{x_2:S,x_3:k}=W(O,S,k),{x_2:x,x_3:z}=W(O,x,z),O=j;const X=S+x,R=K(X*X),G=S-x,oe=K(G*G),se=R-oe,ue=k+z,de=k-z,he=K(de*X),fe=K(ue*G),Ee=he+fe,ye=he-fe;k=K(Ee*Ee),z=K(m*K(ye*ye)),S=K(R*oe),x=K(se*(R+K($*se)))}({x_2:S,x_3:k}=W(O,S,k)),{x_2:x,x_3:z}=W(O,x,z);const F=I(x);return K(S*F)}const N={secretKey:T,publicKey:T,seed:T},L=(D=b(T))=>((0,e.abytes)(D,N.seed),D);function E(D){const f=L(D);return{secretKey:f,publicKey:Y(f)}}return{keygen:E,getSharedSecret:(D,f)=>ne(D,f),getPublicKey:D=>Y(D),scalarMult:ne,scalarMultBase:Y,utils:{randomSecretKey:L,randomPrivateKey:L},GuBytes:J.slice(),lengths:N}}return rr}var zs;function dh(){return zs||(zs=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hash_to_ristretto255=e.hashToRistretto255=e.encodeToCurve=e.hashToCurve=e.RistrettoPoint=e.edwardsToMontgomery=e.ED25519_TORSION_SUBGROUP=e.ristretto255_hasher=e.ristretto255=e.ed25519_hasher=e.x25519=e.ed25519ph=e.ed25519ctx=e.ed25519=void 0,e.edwardsToMontgomeryPub=k,e.edwardsToMontgomeryPriv=z;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=oi(),n=dt(),r=ai(),i=lh(),o=Ks(),s=Tt(),a=uh(),u=bt(),d=BigInt(0),g=BigInt(1),p=BigInt(2),I=BigInt(3),v=BigInt(5),h=BigInt(8),b=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),B={p:b,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function T(O){const F=BigInt(10),M=BigInt(20),j=BigInt(40),X=BigInt(80),R=b,oe=O*O%R*O%R,se=(0,s.pow2)(oe,p,R)*oe%R,ue=(0,s.pow2)(se,g,R)*O%R,de=(0,s.pow2)(ue,v,R)*ue%R,he=(0,s.pow2)(de,F,R)*de%R,fe=(0,s.pow2)(he,M,R)*he%R,Ee=(0,s.pow2)(fe,j,R)*fe%R,ye=(0,s.pow2)(Ee,X,R)*Ee%R,pe=(0,s.pow2)(ye,X,R)*Ee%R,le=(0,s.pow2)(pe,F,R)*de%R;return{pow_p_5_8:(0,s.pow2)(le,p,R)*O%R,b2:oe}}function H(O){return O[0]&=248,O[31]&=127,O[31]|=64,O}const $=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function Q(O,F){const M=b,j=(0,s.mod)(F*F*F,M),X=(0,s.mod)(j*j*F,M),R=T(O*X).pow_p_5_8;let G=(0,s.mod)(O*j*R,M);const oe=(0,s.mod)(F*G*G,M),se=G,ue=(0,s.mod)(G*$,M),de=oe===O,he=oe===(0,s.mod)(-O,M),fe=oe===(0,s.mod)(-O*$,M);return de&&(G=se),(he||fe)&&(G=ue),(0,s.isNegativeLE)(G,M)&&(G=(0,s.mod)(-G,M)),{isValid:de||he,value:G}}const U=(0,s.Field)(B.p,{isLE:!0}),P=(0,s.Field)(B.n,{isLE:!0}),K={...B,Fp:U,hash:t.sha512,adjustScalarBytes:H,uvRatio:Q};e.ed25519=(0,i.twistedEdwards)(K);function J(O,F,M){if(F.length>255)throw new Error("Context is too big");return(0,n.concatBytes)((0,n.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([M?1:0,F.length]),F,O)}e.ed25519ctx=(0,i.twistedEdwards)({...K,domain:J}),e.ed25519ph=(0,i.twistedEdwards)(Object.assign({},K,{domain:J,prehash:t.sha512})),e.x25519=(()=>{const O=U.ORDER;return(0,a.montgomery)({P:O,type:"x25519",powPminus2:F=>{const{pow_p_5_8:M,b2:j}=T(F);return(0,s.mod)((0,s.pow2)(M,I,O)*j,O)},adjustScalarBytes:H})})();const q=(b+I)/h,Z=U.pow(p,q),te=U.sqrt(U.neg(U.ONE));function ne(O){const F=(b-v)/h,M=BigInt(486662);let j=U.sqr(O);j=U.mul(j,p);let X=U.add(j,U.ONE),R=U.neg(M),G=U.sqr(X),oe=U.mul(G,X),se=U.mul(j,M);se=U.mul(se,R),se=U.add(se,G),se=U.mul(se,R);let ue=U.sqr(oe);G=U.sqr(ue),ue=U.mul(ue,oe),ue=U.mul(ue,se),G=U.mul(G,ue);let de=U.pow(G,F);de=U.mul(de,ue);let he=U.mul(de,te);G=U.sqr(de),G=U.mul(G,oe);let fe=U.eql(G,se),Ee=U.cmov(he,de,fe),ye=U.mul(R,j),pe=U.mul(de,O);pe=U.mul(pe,Z);let le=U.mul(pe,te),ae=U.mul(se,j);G=U.sqr(pe),G=U.mul(G,oe);let ce=U.eql(G,ae),_=U.cmov(le,pe,ce);G=U.sqr(Ee),G=U.mul(G,oe);let c=U.eql(G,se),l=U.cmov(ye,R,c),A=U.cmov(_,Ee,c),V=U.isOdd(A);return A=U.cmov(A,U.neg(A),c!==V),{xMn:l,xMd:X,yMn:A,yMd:g}}const Y=(0,s.FpSqrtEven)(U,U.neg(BigInt(486664)));function W(O){const{xMn:F,xMd:M,yMn:j,yMd:X}=ne(O);let R=U.mul(F,X);R=U.mul(R,Y);let G=U.mul(M,j),oe=U.sub(F,M),se=U.add(F,M),ue=U.mul(G,se),de=U.eql(ue,U.ZERO);R=U.cmov(R,U.ZERO,de),G=U.cmov(G,U.ONE,de),oe=U.cmov(oe,U.ONE,de),se=U.cmov(se,U.ONE,de);const[he,fe]=(0,s.FpInvertBatch)(U,[G,se],!0);return{x:U.mul(R,he),y:U.mul(oe,fe)}}e.ed25519_hasher=(0,o.createHasher)(e.ed25519.Point,O=>W(O[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:b,m:1,k:128,expand:"xmd",hash:t.sha512});const w=$,N=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),L=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),E=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),C=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),D=O=>Q(g,O),f=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),y=O=>e.ed25519.Point.Fp.create((0,u.bytesToNumberLE)(O)&f);function m(O){const{d:F}=B,M=b,j=ae=>U.create(ae),X=j(w*O*O),R=j((X+g)*E);let G=BigInt(-1);const oe=j((G-F*X)*j(X+F));let{isValid:se,value:ue}=Q(R,oe),de=j(ue*O);(0,s.isNegativeLE)(de,M)||(de=j(-de)),se||(ue=de),se||(G=X);const he=j(G*(X-g)*C-oe),fe=ue*ue,Ee=j((ue+ue)*oe),ye=j(he*N),pe=j(g-fe),le=j(g+fe);return new e.ed25519.Point(j(Ee*le),j(pe*ye),j(ye*le),j(Ee*pe))}function S(O){(0,n.abytes)(O,64);const F=y(O.subarray(0,32)),M=m(F),j=y(O.subarray(32,64)),X=m(j);return new x(M.add(X))}class x extends i.PrimeEdwardsPoint{constructor(F){super(F)}static fromAffine(F){return new x(e.ed25519.Point.fromAffine(F))}assertSame(F){if(!(F instanceof x))throw new Error("RistrettoPoint expected")}init(F){return new x(F)}static hashToCurve(F){return S((0,u.ensureBytes)("ristrettoHash",F,64))}static fromBytes(F){(0,n.abytes)(F,32);const{a:M,d:j}=B,X=b,R=c=>U.create(c),G=y(F);if(!(0,u.equalBytes)(U.toBytes(G),F)||(0,s.isNegativeLE)(G,X))throw new Error("invalid ristretto255 encoding 1");const oe=R(G*G),se=R(g+M*oe),ue=R(g-M*oe),de=R(se*se),he=R(ue*ue),fe=R(M*j*de-he),{isValid:Ee,value:ye}=D(R(fe*he)),pe=R(ye*ue),le=R(ye*pe*fe);let ae=R((G+G)*pe);(0,s.isNegativeLE)(ae,X)&&(ae=R(-ae));const ce=R(se*le),_=R(ae*ce);if(!Ee||(0,s.isNegativeLE)(_,X)||ce===d)throw new Error("invalid ristretto255 encoding 2");return new x(new e.ed25519.Point(ae,ce,g,_))}static fromHex(F){return x.fromBytes((0,u.ensureBytes)("ristrettoHex",F,32))}static msm(F,M){return(0,r.pippenger)(x,e.ed25519.Point.Fn,F,M)}toBytes(){let{X:F,Y:M,Z:j,T:X}=this.ep;const R=b,G=le=>U.create(le),oe=G(G(j+M)*G(j-M)),se=G(F*M),ue=G(se*se),{value:de}=D(G(oe*ue)),he=G(de*oe),fe=G(de*se),Ee=G(he*fe*X);let ye;if((0,s.isNegativeLE)(X*Ee,R)){let le=G(M*w),ae=G(F*w);F=le,M=ae,ye=G(he*L)}else ye=fe;(0,s.isNegativeLE)(F*Ee,R)&&(M=G(-M));let pe=G((j-M)*ye);return(0,s.isNegativeLE)(pe,R)&&(pe=G(-pe)),U.toBytes(pe)}equals(F){this.assertSame(F);const{X:M,Y:j}=this.ep,{X,Y:R}=F.ep,G=ue=>U.create(ue),oe=G(M*R)===G(j*X),se=G(j*R)===G(M*X);return oe||se}is0(){return this.equals(x.ZERO)}}x.BASE=new x(e.ed25519.Point.BASE),x.ZERO=new x(e.ed25519.Point.ZERO),x.Fp=U,x.Fn=P,e.ristretto255={Point:x},e.ristretto255_hasher={hashToCurve(O,F){const M=F?.DST||"ristretto255_XMD:SHA-512_R255MAP_RO_",j=(0,o.expand_message_xmd)(O,M,64,t.sha512);return S(j)},hashToScalar(O,F={DST:o._DST_scalar}){const M=(0,o.expand_message_xmd)(O,F.DST,64,t.sha512);return P.create((0,u.bytesToNumberLE)(M))}},e.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];function k(O){return e.ed25519.utils.toMontgomery((0,u.ensureBytes)("pub",O))}e.edwardsToMontgomery=k;function z(O){return e.ed25519.utils.toMontgomerySecret((0,u.ensureBytes)("pub",O))}e.RistrettoPoint=x,e.hashToCurve=e.ed25519_hasher.hashToCurve,e.encodeToCurve=e.ed25519_hasher.encodeToCurve,e.hashToRistretto255=e.ristretto255_hasher.hashToCurve,e.hash_to_ristretto255=e.ristretto255_hasher.hashToCurve})(ri)),ri}var li={},bn={},ui={},di={},Zs;function Ws(){return Zs||(Zs=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const t=dt();class n extends t.Hash{constructor(o,s){super(),this.finished=!1,this.destroyed=!1,(0,t.ahash)(o);const a=(0,t.toBytes)(s);if(this.iHash=o.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const u=this.blockLen,d=new Uint8Array(u);d.set(a.length>u?o.create().update(a).digest():a);for(let g=0;g<d.length;g++)d[g]^=54;this.iHash.update(d),this.oHash=o.create();for(let g=0;g<d.length;g++)d[g]^=106;this.oHash.update(d),(0,t.clean)(d)}update(o){return(0,t.aexists)(this),this.iHash.update(o),this}digestInto(o){(0,t.aexists)(this),(0,t.abytes)(o,this.outputLen),this.finished=!0,this.iHash.digestInto(o),this.oHash.update(o),this.oHash.digestInto(o),this.destroy()}digest(){const o=new Uint8Array(this.oHash.outputLen);return this.digestInto(o),o}_cloneInto(o){o||(o=Object.create(Object.getPrototypeOf(this),{}));const{oHash:s,iHash:a,finished:u,destroyed:d,blockLen:g,outputLen:p}=this;return o=o,o.finished=u,o.destroyed=d,o.blockLen=g,o.outputLen=p,o.oHash=s._cloneInto(o.oHash),o.iHash=a._cloneInto(o.iHash),o}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.HMAC=n;const r=(i,o,s)=>new n(i,o).update(s).digest();e.hmac=r,e.hmac.create=(i,o)=>new n(i,o)})(di)),di}var Ys;function Xs(){return Ys||(Ys=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DER=e.DERErr=void 0,e._splitEndoScalar=a,e._normFnElement=B,e.weierstrassN=T,e.SWUFpSqrtRatio=$,e.mapToCurveSimpleSWU=Q,e.ecdh=P,e.ecdsa=K,e.weierstrassPoints=J,e._legacyHelperEquat=te,e.weierstrass=W;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=Ws(),n=dt(),r=bt(),i=ai(),o=Tt(),s=(w,N)=>(w+(w>=0?N:-N)/v)/N;function a(w,N,L){const[[E,C],[D,f]]=N,y=s(f*w,L),m=s(-C*w,L);let S=w-y*E-m*D,x=-y*C-m*f;const k=S<p,z=x<p;k&&(S=-S),z&&(x=-x);const O=(0,r.bitMask)(Math.ceil((0,r.bitLen)(L)/2))+I;if(S<p||S>=O||x<p||x>=O)throw new Error("splitScalar (endomorphism): failed, k="+w);return{k1neg:k,k1:S,k2neg:z,k2:x}}function u(w){if(!["compact","recovered","der"].includes(w))throw new Error('Signature format must be "compact", "recovered", or "der"');return w}function d(w,N){const L={};for(let E of Object.keys(N))L[E]=w[E]===void 0?N[E]:w[E];return(0,r._abool2)(L.lowS,"lowS"),(0,r._abool2)(L.prehash,"prehash"),L.format!==void 0&&u(L.format),L}class g extends Error{constructor(N=""){super(N)}}e.DERErr=g,e.DER={Err:g,_tlv:{encode:(w,N)=>{const{Err:L}=e.DER;if(w<0||w>256)throw new L("tlv.encode: wrong tag");if(N.length&1)throw new L("tlv.encode: unpadded data");const E=N.length/2,C=(0,r.numberToHexUnpadded)(E);if(C.length/2&128)throw new L("tlv.encode: long form length too big");const D=E>127?(0,r.numberToHexUnpadded)(C.length/2|128):"";return(0,r.numberToHexUnpadded)(w)+D+C+N},decode(w,N){const{Err:L}=e.DER;let E=0;if(w<0||w>256)throw new L("tlv.encode: wrong tag");if(N.length<2||N[E++]!==w)throw new L("tlv.decode: wrong tlv");const C=N[E++],D=!!(C&128);let f=0;if(!D)f=C;else{const m=C&127;if(!m)throw new L("tlv.decode(long): indefinite length not supported");if(m>4)throw new L("tlv.decode(long): byte length is too big");const S=N.subarray(E,E+m);if(S.length!==m)throw new L("tlv.decode: length bytes not complete");if(S[0]===0)throw new L("tlv.decode(long): zero leftmost byte");for(const x of S)f=f<<8|x;if(E+=m,f<128)throw new L("tlv.decode(long): not minimal encoding")}const y=N.subarray(E,E+f);if(y.length!==f)throw new L("tlv.decode: wrong value length");return{v:y,l:N.subarray(E+f)}}},_int:{encode(w){const{Err:N}=e.DER;if(w<p)throw new N("integer: negative integers are not allowed");let L=(0,r.numberToHexUnpadded)(w);if(Number.parseInt(L[0],16)&8&&(L="00"+L),L.length&1)throw new N("unexpected DER parsing assertion: unpadded hex");return L},decode(w){const{Err:N}=e.DER;if(w[0]&128)throw new N("invalid signature integer: negative");if(w[0]===0&&!(w[1]&128))throw new N("invalid signature integer: unnecessary leading zero");return(0,r.bytesToNumberBE)(w)}},toSig(w){const{Err:N,_int:L,_tlv:E}=e.DER,C=(0,r.ensureBytes)("signature",w),{v:D,l:f}=E.decode(48,C);if(f.length)throw new N("invalid signature: left bytes after parsing");const{v:y,l:m}=E.decode(2,D),{v:S,l:x}=E.decode(2,m);if(x.length)throw new N("invalid signature: left bytes after parsing");return{r:L.decode(y),s:L.decode(S)}},hexFromSig(w){const{_tlv:N,_int:L}=e.DER,E=N.encode(2,L.encode(w.r)),C=N.encode(2,L.encode(w.s)),D=E+C;return N.encode(48,D)}};const p=BigInt(0),I=BigInt(1),v=BigInt(2),h=BigInt(3),b=BigInt(4);function B(w,N){const{BYTES:L}=w;let E;if(typeof N=="bigint")E=N;else{let C=(0,r.ensureBytes)("private key",N);try{E=w.fromBytes(C)}catch{throw new Error(`invalid private key: expected ui8a of size ${L}, got ${typeof N}`)}}if(!w.isValidNot0(E))throw new Error("invalid private key: out of range [1..N-1]");return E}function T(w,N={}){const L=(0,i._createCurveFields)("weierstrass",w,N),{Fp:E,Fn:C}=L;let D=L.CURVE;const{h:f,n:y}=D;(0,r._validateObject)(N,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:m}=N;if(m&&(!E.is0(D.a)||typeof m.beta!="bigint"||!Array.isArray(m.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const S=U(E,C);function x(){if(!E.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function k(pe,le,ae){const{x:ce,y:_}=le.toAffine(),c=E.toBytes(ce);if((0,r._abool2)(ae,"isCompressed"),ae){x();const l=!E.isOdd(_);return(0,r.concatBytes)(H(l),c)}else return(0,r.concatBytes)(Uint8Array.of(4),c,E.toBytes(_))}function z(pe){(0,r._abytes2)(pe,void 0,"Point");const{publicKey:le,publicKeyUncompressed:ae}=S,ce=pe.length,_=pe[0],c=pe.subarray(1);if(ce===le&&(_===2||_===3)){const l=E.fromBytes(c);if(!E.isValid(l))throw new Error("bad point: is not on curve, wrong x");const A=M(l);let V;try{V=E.sqrt(A)}catch(ge){const be=ge instanceof Error?": "+ge.message:"";throw new Error("bad point: is not on curve, sqrt error"+be)}x();const ee=E.isOdd(V);return(_&1)===1!==ee&&(V=E.neg(V)),{x:l,y:V}}else if(ce===ae&&_===4){const l=E.BYTES,A=E.fromBytes(c.subarray(0,l)),V=E.fromBytes(c.subarray(l,l*2));if(!j(A,V))throw new Error("bad point: is not on curve");return{x:A,y:V}}else throw new Error(`bad point: got length ${ce}, expected compressed=${le} or uncompressed=${ae}`)}const O=N.toBytes||k,F=N.fromBytes||z;function M(pe){const le=E.sqr(pe),ae=E.mul(le,pe);return E.add(E.add(ae,E.mul(pe,D.a)),D.b)}function j(pe,le){const ae=E.sqr(le),ce=M(pe);return E.eql(ae,ce)}if(!j(D.Gx,D.Gy))throw new Error("bad curve params: generator point");const X=E.mul(E.pow(D.a,h),b),R=E.mul(E.sqr(D.b),BigInt(27));if(E.is0(E.add(X,R)))throw new Error("bad curve params: a or b");function G(pe,le,ae=!1){if(!E.isValid(le)||ae&&E.is0(le))throw new Error(`bad point coordinate ${pe}`);return le}function oe(pe){if(!(pe instanceof fe))throw new Error("ProjectivePoint expected")}function se(pe){if(!m||!m.basises)throw new Error("no endo");return a(pe,m.basises,C.ORDER)}const ue=(0,r.memoized)((pe,le)=>{const{X:ae,Y:ce,Z:_}=pe;if(E.eql(_,E.ONE))return{x:ae,y:ce};const c=pe.is0();le==null&&(le=c?E.ONE:E.inv(_));const l=E.mul(ae,le),A=E.mul(ce,le),V=E.mul(_,le);if(c)return{x:E.ZERO,y:E.ZERO};if(!E.eql(V,E.ONE))throw new Error("invZ was invalid");return{x:l,y:A}}),de=(0,r.memoized)(pe=>{if(pe.is0()){if(N.allowInfinityPoint&&!E.is0(pe.Y))return;throw new Error("bad point: ZERO")}const{x:le,y:ae}=pe.toAffine();if(!E.isValid(le)||!E.isValid(ae))throw new Error("bad point: x or y not field elements");if(!j(le,ae))throw new Error("bad point: equation left != right");if(!pe.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function he(pe,le,ae,ce,_){return ae=new fe(E.mul(ae.X,pe),ae.Y,ae.Z),le=(0,i.negateCt)(ce,le),ae=(0,i.negateCt)(_,ae),le.add(ae)}class fe{constructor(le,ae,ce){this.X=G("x",le),this.Y=G("y",ae,!0),this.Z=G("z",ce),Object.freeze(this)}static CURVE(){return D}static fromAffine(le){const{x:ae,y:ce}=le||{};if(!le||!E.isValid(ae)||!E.isValid(ce))throw new Error("invalid affine point");if(le instanceof fe)throw new Error("projective point not allowed");return E.is0(ae)&&E.is0(ce)?fe.ZERO:new fe(ae,ce,E.ONE)}static fromBytes(le){const ae=fe.fromAffine(F((0,r._abytes2)(le,void 0,"point")));return ae.assertValidity(),ae}static fromHex(le){return fe.fromBytes((0,r.ensureBytes)("pointHex",le))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(le=8,ae=!0){return ye.createCache(this,le),ae||this.multiply(h),this}assertValidity(){de(this)}hasEvenY(){const{y:le}=this.toAffine();if(!E.isOdd)throw new Error("Field doesn't support isOdd");return!E.isOdd(le)}equals(le){oe(le);const{X:ae,Y:ce,Z:_}=this,{X:c,Y:l,Z:A}=le,V=E.eql(E.mul(ae,A),E.mul(c,_)),ee=E.eql(E.mul(ce,A),E.mul(l,_));return V&&ee}negate(){return new fe(this.X,E.neg(this.Y),this.Z)}double(){const{a:le,b:ae}=D,ce=E.mul(ae,h),{X:_,Y:c,Z:l}=this;let A=E.ZERO,V=E.ZERO,ee=E.ZERO,re=E.mul(_,_),ge=E.mul(c,c),be=E.mul(l,l),me=E.mul(_,c);return me=E.add(me,me),ee=E.mul(_,l),ee=E.add(ee,ee),A=E.mul(le,ee),V=E.mul(ce,be),V=E.add(A,V),A=E.sub(ge,V),V=E.add(ge,V),V=E.mul(A,V),A=E.mul(me,A),ee=E.mul(ce,ee),be=E.mul(le,be),me=E.sub(re,be),me=E.mul(le,me),me=E.add(me,ee),ee=E.add(re,re),re=E.add(ee,re),re=E.add(re,be),re=E.mul(re,me),V=E.add(V,re),be=E.mul(c,l),be=E.add(be,be),re=E.mul(be,me),A=E.sub(A,re),ee=E.mul(be,ge),ee=E.add(ee,ee),ee=E.add(ee,ee),new fe(A,V,ee)}add(le){oe(le);const{X:ae,Y:ce,Z:_}=this,{X:c,Y:l,Z:A}=le;let V=E.ZERO,ee=E.ZERO,re=E.ZERO;const ge=D.a,be=E.mul(D.b,h);let me=E.mul(ae,c),Se=E.mul(ce,l),we=E.mul(_,A),Ze=E.add(ae,ce),Re=E.add(c,l);Ze=E.mul(Ze,Re),Re=E.add(me,Se),Ze=E.sub(Ze,Re),Re=E.add(ae,_);let Ne=E.add(c,A);return Re=E.mul(Re,Ne),Ne=E.add(me,we),Re=E.sub(Re,Ne),Ne=E.add(ce,_),V=E.add(l,A),Ne=E.mul(Ne,V),V=E.add(Se,we),Ne=E.sub(Ne,V),re=E.mul(ge,Re),V=E.mul(be,we),re=E.add(V,re),V=E.sub(Se,re),re=E.add(Se,re),ee=E.mul(V,re),Se=E.add(me,me),Se=E.add(Se,me),we=E.mul(ge,we),Re=E.mul(be,Re),Se=E.add(Se,we),we=E.sub(me,we),we=E.mul(ge,we),Re=E.add(Re,we),me=E.mul(Se,Re),ee=E.add(ee,me),me=E.mul(Ne,Re),V=E.mul(Ze,V),V=E.sub(V,me),me=E.mul(Ze,Se),re=E.mul(Ne,re),re=E.add(re,me),new fe(V,ee,re)}subtract(le){return this.add(le.negate())}is0(){return this.equals(fe.ZERO)}multiply(le){const{endo:ae}=N;if(!C.isValidNot0(le))throw new Error("invalid scalar: out of range");let ce,_;const c=l=>ye.cached(this,l,A=>(0,i.normalizeZ)(fe,A));if(ae){const{k1neg:l,k1:A,k2neg:V,k2:ee}=se(le),{p:re,f:ge}=c(A),{p:be,f:me}=c(ee);_=ge.add(me),ce=he(ae.beta,re,be,l,V)}else{const{p:l,f:A}=c(le);ce=l,_=A}return(0,i.normalizeZ)(fe,[ce,_])[0]}multiplyUnsafe(le){const{endo:ae}=N,ce=this;if(!C.isValid(le))throw new Error("invalid scalar: out of range");if(le===p||ce.is0())return fe.ZERO;if(le===I)return ce;if(ye.hasCache(this))return this.multiply(le);if(ae){const{k1neg:_,k1:c,k2neg:l,k2:A}=se(le),{p1:V,p2:ee}=(0,i.mulEndoUnsafe)(fe,ce,c,A);return he(ae.beta,V,ee,_,l)}else return ye.unsafe(ce,le)}multiplyAndAddUnsafe(le,ae,ce){const _=this.multiplyUnsafe(ae).add(le.multiplyUnsafe(ce));return _.is0()?void 0:_}toAffine(le){return ue(this,le)}isTorsionFree(){const{isTorsionFree:le}=N;return f===I?!0:le?le(fe,this):ye.unsafe(this,y).is0()}clearCofactor(){const{clearCofactor:le}=N;return f===I?this:le?le(fe,this):this.multiplyUnsafe(f)}isSmallOrder(){return this.multiplyUnsafe(f).is0()}toBytes(le=!0){return(0,r._abool2)(le,"isCompressed"),this.assertValidity(),O(fe,this,le)}toHex(le=!0){return(0,r.bytesToHex)(this.toBytes(le))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(le=!0){return this.toBytes(le)}_setWindowSize(le){this.precompute(le)}static normalizeZ(le){return(0,i.normalizeZ)(fe,le)}static msm(le,ae){return(0,i.pippenger)(fe,C,le,ae)}static fromPrivateKey(le){return fe.BASE.multiply(B(C,le))}}fe.BASE=new fe(D.Gx,D.Gy,E.ONE),fe.ZERO=new fe(E.ZERO,E.ONE,E.ZERO),fe.Fp=E,fe.Fn=C;const Ee=C.BITS,ye=new i.wNAF(fe,N.endo?Math.ceil(Ee/2):Ee);return fe.BASE.precompute(8),fe}function H(w){return Uint8Array.of(w?2:3)}function $(w,N){const L=w.ORDER;let E=p;for(let F=L-I;F%v===p;F/=v)E+=I;const C=E,D=v<<C-I-I,f=D*v,y=(L-I)/f,m=(y-I)/v,S=f-I,x=D,k=w.pow(N,y),z=w.pow(N,(y+I)/v);let O=(F,M)=>{let j=k,X=w.pow(M,S),R=w.sqr(X);R=w.mul(R,M);let G=w.mul(F,R);G=w.pow(G,m),G=w.mul(G,X),X=w.mul(G,M),R=w.mul(G,F);let oe=w.mul(R,X);G=w.pow(oe,x);let se=w.eql(G,w.ONE);X=w.mul(R,z),G=w.mul(oe,j),R=w.cmov(X,R,se),oe=w.cmov(G,oe,se);for(let ue=C;ue>I;ue--){let de=ue-v;de=v<<de-I;let he=w.pow(oe,de);const fe=w.eql(he,w.ONE);X=w.mul(R,j),j=w.mul(j,j),he=w.mul(oe,j),R=w.cmov(X,R,fe),oe=w.cmov(he,oe,fe)}return{isValid:se,value:R}};if(w.ORDER%b===h){const F=(w.ORDER-h)/b,M=w.sqrt(w.neg(N));O=(j,X)=>{let R=w.sqr(X);const G=w.mul(j,X);R=w.mul(R,G);let oe=w.pow(R,F);oe=w.mul(oe,G);const se=w.mul(oe,M),ue=w.mul(w.sqr(oe),X),de=w.eql(ue,j);let he=w.cmov(se,oe,de);return{isValid:de,value:he}}}return O}function Q(w,N){(0,o.validateField)(w);const{A:L,B:E,Z:C}=N;if(!w.isValid(L)||!w.isValid(E)||!w.isValid(C))throw new Error("mapToCurveSimpleSWU: invalid opts");const D=$(w,C);if(!w.isOdd)throw new Error("Field does not have .isOdd()");return f=>{let y,m,S,x,k,z,O,F;y=w.sqr(f),y=w.mul(y,C),m=w.sqr(y),m=w.add(m,y),S=w.add(m,w.ONE),S=w.mul(S,E),x=w.cmov(C,w.neg(m),!w.eql(m,w.ZERO)),x=w.mul(x,L),m=w.sqr(S),z=w.sqr(x),k=w.mul(z,L),m=w.add(m,k),m=w.mul(m,S),z=w.mul(z,x),k=w.mul(z,E),m=w.add(m,k),O=w.mul(y,S);const{isValid:M,value:j}=D(m,z);F=w.mul(y,f),F=w.mul(F,j),O=w.cmov(O,S,M),F=w.cmov(F,j,M);const X=w.isOdd(f)===w.isOdd(F);F=w.cmov(w.neg(F),F,X);const R=(0,o.FpInvertBatch)(w,[x],!0)[0];return O=w.mul(O,R),{x:O,y:F}}}function U(w,N){return{secretKey:N.BYTES,publicKey:1+w.BYTES,publicKeyUncompressed:1+2*w.BYTES,publicKeyHasPrefix:!0,signature:2*N.BYTES}}function P(w,N={}){const{Fn:L}=w,E=N.randomBytes||r.randomBytes,C=Object.assign(U(w.Fp,L),{seed:(0,o.getMinHashLength)(L.ORDER)});function D(O){try{return!!B(L,O)}catch{return!1}}function f(O,F){const{publicKey:M,publicKeyUncompressed:j}=C;try{const X=O.length;return F===!0&&X!==M||F===!1&&X!==j?!1:!!w.fromBytes(O)}catch{return!1}}function y(O=E(C.seed)){return(0,o.mapHashToField)((0,r._abytes2)(O,C.seed,"seed"),L.ORDER)}function m(O,F=!0){return w.BASE.multiply(B(L,O)).toBytes(F)}function S(O){const F=y(O);return{secretKey:F,publicKey:m(F)}}function x(O){if(typeof O=="bigint")return!1;if(O instanceof w)return!0;const{secretKey:F,publicKey:M,publicKeyUncompressed:j}=C;if(L.allowedLengths||F===M)return;const X=(0,r.ensureBytes)("key",O).length;return X===M||X===j}function k(O,F,M=!0){if(x(O)===!0)throw new Error("first arg must be private key");if(x(F)===!1)throw new Error("second arg must be public key");const j=B(L,O);return w.fromHex(F).multiply(j).toBytes(M)}return Object.freeze({getPublicKey:m,getSharedSecret:k,keygen:S,Point:w,utils:{isValidSecretKey:D,isValidPublicKey:f,randomSecretKey:y,isValidPrivateKey:D,randomPrivateKey:y,normPrivateKeyToScalar:O=>B(L,O),precompute(O=8,F=w.BASE){return F.precompute(O,!1)}},lengths:C})}function K(w,N,L={}){(0,n.ahash)(N),(0,r._validateObject)(L,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const E=L.randomBytes||r.randomBytes,C=L.hmac||((ae,...ce)=>(0,t.hmac)(N,ae,(0,r.concatBytes)(...ce))),{Fp:D,Fn:f}=w,{ORDER:y,BITS:m}=f,{keygen:S,getPublicKey:x,getSharedSecret:k,utils:z,lengths:O}=P(w,L),F={prehash:!1,lowS:typeof L.lowS=="boolean"?L.lowS:!1,format:void 0,extraEntropy:!1},M="compact";function j(ae){const ce=y>>I;return ae>ce}function X(ae,ce){if(!f.isValidNot0(ce))throw new Error(`invalid signature ${ae}: out of range 1..Point.Fn.ORDER`);return ce}function R(ae,ce){u(ce);const _=O.signature,c=ce==="compact"?_:ce==="recovered"?_+1:void 0;return(0,r._abytes2)(ae,c,`${ce} signature`)}class G{constructor(ce,_,c){this.r=X("r",ce),this.s=X("s",_),c!=null&&(this.recovery=c),Object.freeze(this)}static fromBytes(ce,_=M){R(ce,_);let c;if(_==="der"){const{r:ee,s:re}=e.DER.toSig((0,r._abytes2)(ce));return new G(ee,re)}_==="recovered"&&(c=ce[0],_="compact",ce=ce.subarray(1));const l=f.BYTES,A=ce.subarray(0,l),V=ce.subarray(l,l*2);return new G(f.fromBytes(A),f.fromBytes(V),c)}static fromHex(ce,_){return this.fromBytes((0,r.hexToBytes)(ce),_)}addRecoveryBit(ce){return new G(this.r,this.s,ce)}recoverPublicKey(ce){const _=D.ORDER,{r:c,s:l,recovery:A}=this;if(A==null||![0,1,2,3].includes(A))throw new Error("recovery id invalid");if(y*v<_&&A>1)throw new Error("recovery id is ambiguous for h>1 curve");const ee=A===2||A===3?c+y:c;if(!D.isValid(ee))throw new Error("recovery id 2 or 3 invalid");const re=D.toBytes(ee),ge=w.fromBytes((0,r.concatBytes)(H((A&1)===0),re)),be=f.inv(ee),me=se((0,r.ensureBytes)("msgHash",ce)),Se=f.create(-me*be),we=f.create(l*be),Ze=w.BASE.multiplyUnsafe(Se).add(ge.multiplyUnsafe(we));if(Ze.is0())throw new Error("point at infinify");return Ze.assertValidity(),Ze}hasHighS(){return j(this.s)}toBytes(ce=M){if(u(ce),ce==="der")return(0,r.hexToBytes)(e.DER.hexFromSig(this));const _=f.toBytes(this.r),c=f.toBytes(this.s);if(ce==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return(0,r.concatBytes)(Uint8Array.of(this.recovery),_,c)}return(0,r.concatBytes)(_,c)}toHex(ce){return(0,r.bytesToHex)(this.toBytes(ce))}assertValidity(){}static fromCompact(ce){return G.fromBytes((0,r.ensureBytes)("sig",ce),"compact")}static fromDER(ce){return G.fromBytes((0,r.ensureBytes)("sig",ce),"der")}normalizeS(){return this.hasHighS()?new G(this.r,f.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return(0,r.bytesToHex)(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return(0,r.bytesToHex)(this.toBytes("compact"))}}const oe=L.bits2int||function(ce){if(ce.length>8192)throw new Error("input is too large");const _=(0,r.bytesToNumberBE)(ce),c=ce.length*8-m;return c>0?_>>BigInt(c):_},se=L.bits2int_modN||function(ce){return f.create(oe(ce))},ue=(0,r.bitMask)(m);function de(ae){return(0,r.aInRange)("num < 2^"+m,ae,p,ue),f.toBytes(ae)}function he(ae,ce){return(0,r._abytes2)(ae,void 0,"message"),ce?(0,r._abytes2)(N(ae),void 0,"prehashed message"):ae}function fe(ae,ce,_){if(["recovered","canonical"].some(Se=>Se in _))throw new Error("sign() legacy options not supported");const{lowS:c,prehash:l,extraEntropy:A}=d(_,F);ae=he(ae,l);const V=se(ae),ee=B(f,ce),re=[de(ee),de(V)];if(A!=null&&A!==!1){const Se=A===!0?E(O.secretKey):A;re.push((0,r.ensureBytes)("extraEntropy",Se))}const ge=(0,r.concatBytes)(...re),be=V;function me(Se){const we=oe(Se);if(!f.isValidNot0(we))return;const Ze=f.inv(we),Re=w.BASE.multiply(we).toAffine(),Ne=f.create(Re.x);if(Ne===p)return;const vr=f.create(Ze*f.create(be+Ne*ee));if(vr===p)return;let Xc=(Re.x===Ne?0:2)|Number(Re.y&I),Jc=vr;return c&&j(vr)&&(Jc=f.neg(vr),Xc^=1),new G(Ne,Jc,Xc)}return{seed:ge,k2sig:me}}function Ee(ae,ce,_={}){ae=(0,r.ensureBytes)("message",ae);const{seed:c,k2sig:l}=fe(ae,ce,_);return(0,r.createHmacDrbg)(N.outputLen,f.BYTES,C)(c,l)}function ye(ae){let ce;const _=typeof ae=="string"||(0,r.isBytes)(ae),c=!_&&ae!==null&&typeof ae=="object"&&typeof ae.r=="bigint"&&typeof ae.s=="bigint";if(!_&&!c)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(c)ce=new G(ae.r,ae.s);else if(_){try{ce=G.fromBytes((0,r.ensureBytes)("sig",ae),"der")}catch(l){if(!(l instanceof e.DER.Err))throw l}if(!ce)try{ce=G.fromBytes((0,r.ensureBytes)("sig",ae),"compact")}catch{return!1}}return ce||!1}function pe(ae,ce,_,c={}){const{lowS:l,prehash:A,format:V}=d(c,F);if(_=(0,r.ensureBytes)("publicKey",_),ce=he((0,r.ensureBytes)("message",ce),A),"strict"in c)throw new Error("options.strict was renamed to lowS");const ee=V===void 0?ye(ae):G.fromBytes((0,r.ensureBytes)("sig",ae),V);if(ee===!1)return!1;try{const re=w.fromBytes(_);if(l&&ee.hasHighS())return!1;const{r:ge,s:be}=ee,me=se(ce),Se=f.inv(be),we=f.create(me*Se),Ze=f.create(ge*Se),Re=w.BASE.multiplyUnsafe(we).add(re.multiplyUnsafe(Ze));return Re.is0()?!1:f.create(Re.x)===ge}catch{return!1}}function le(ae,ce,_={}){const{prehash:c}=d(_,F);return ce=he(ce,c),G.fromBytes(ae,"recovered").recoverPublicKey(ce).toBytes()}return Object.freeze({keygen:S,getPublicKey:x,getSharedSecret:k,utils:z,lengths:O,Point:w,sign:Ee,verify:pe,recoverPublicKey:le,Signature:G,hash:N})}function J(w){const{CURVE:N,curveOpts:L}=q(w),E=T(N,L);return ne(w,E)}function q(w){const N={a:w.a,b:w.b,p:w.Fp.ORDER,n:w.n,h:w.h,Gx:w.Gx,Gy:w.Gy},L=w.Fp;let E=w.allowedPrivateKeyLengths?Array.from(new Set(w.allowedPrivateKeyLengths.map(f=>Math.ceil(f/2)))):void 0;const C=(0,o.Field)(N.n,{BITS:w.nBitLength,allowedLengths:E,modFromBytes:w.wrapPrivateKey}),D={Fp:L,Fn:C,allowInfinityPoint:w.allowInfinityPoint,endo:w.endo,isTorsionFree:w.isTorsionFree,clearCofactor:w.clearCofactor,fromBytes:w.fromBytes,toBytes:w.toBytes};return{CURVE:N,curveOpts:D}}function Z(w){const{CURVE:N,curveOpts:L}=q(w),E={hmac:w.hmac,randomBytes:w.randomBytes,lowS:w.lowS,bits2int:w.bits2int,bits2int_modN:w.bits2int_modN};return{CURVE:N,curveOpts:L,hash:w.hash,ecdsaOpts:E}}function te(w,N,L){function E(C){const D=w.sqr(C),f=w.mul(D,C);return w.add(w.add(f,w.mul(C,N)),L)}return E}function ne(w,N){const{Fp:L,Fn:E}=N;function C(f){return(0,r.inRange)(f,I,E.ORDER)}const D=te(L,w.a,w.b);return Object.assign({},{CURVE:w,Point:N,ProjectivePoint:N,normPrivateKeyToScalar:f=>B(E,f),weierstrassEquation:D,isWithinCurveOrder:C})}function Y(w,N){const L=N.Point;return Object.assign({},N,{ProjectivePoint:L,CURVE:Object.assign({},w,(0,o.nLength)(L.Fn.ORDER,L.Fn.BITS))})}function W(w){const{CURVE:N,curveOpts:L,hash:E,ecdsaOpts:C}=Z(w),D=T(N,L),f=K(D,E,C);return Y(w,f)}})(ui)),ui}var Js;function fh(){if(Js)return bn;Js=1,Object.defineProperty(bn,"__esModule",{value:!0}),bn.getHash=t,bn.createCurve=n;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=Xs();function t(r){return{hash:r}}function n(r,i){const o=s=>(0,e.weierstrass)({...r,hash:s});return{...o(i),create:o}}return bn}var Qs;function hh(){return Qs||(Qs=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.encodeToCurve=e.hashToCurve=e.secp256k1_hasher=e.schnorr=e.secp256k1=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=oi(),n=dt(),r=fh(),i=Ks(),o=Tt(),s=Xs(),a=bt(),u={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},d={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},g=BigInt(0),p=BigInt(1),I=BigInt(2);function v(Y){const W=u.p,w=BigInt(3),N=BigInt(6),L=BigInt(11),E=BigInt(22),C=BigInt(23),D=BigInt(44),f=BigInt(88),y=Y*Y*Y%W,m=y*y*Y%W,S=(0,o.pow2)(m,w,W)*m%W,x=(0,o.pow2)(S,w,W)*m%W,k=(0,o.pow2)(x,I,W)*y%W,z=(0,o.pow2)(k,L,W)*k%W,O=(0,o.pow2)(z,E,W)*z%W,F=(0,o.pow2)(O,D,W)*O%W,M=(0,o.pow2)(F,f,W)*F%W,j=(0,o.pow2)(M,D,W)*O%W,X=(0,o.pow2)(j,w,W)*m%W,R=(0,o.pow2)(X,C,W)*z%W,G=(0,o.pow2)(R,N,W)*y%W,oe=(0,o.pow2)(G,I,W);if(!h.eql(h.sqr(oe),Y))throw new Error("Cannot find square root");return oe}const h=(0,o.Field)(u.p,{sqrt:v});e.secp256k1=(0,r.createCurve)({...u,Fp:h,lowS:!0,endo:d},t.sha256);const b={};function B(Y,...W){let w=b[Y];if(w===void 0){const N=(0,t.sha256)((0,a.utf8ToBytes)(Y));w=(0,a.concatBytes)(N,N),b[Y]=w}return(0,t.sha256)((0,a.concatBytes)(w,...W))}const T=Y=>Y.toBytes(!0).slice(1),H=e.secp256k1.Point,$=Y=>Y%I===g;function Q(Y){const{Fn:W,BASE:w}=H,N=(0,s._normFnElement)(W,Y),L=w.multiply(N);return{scalar:$(L.y)?N:W.neg(N),bytes:T(L)}}function U(Y){const W=h;if(!W.isValidNot0(Y))throw new Error("invalid x: Fail if x ≥ p");const w=W.create(Y*Y),N=W.create(w*Y+BigInt(7));let L=W.sqrt(N);$(L)||(L=W.neg(L));const E=H.fromAffine({x:Y,y:L});return E.assertValidity(),E}const P=a.bytesToNumberBE;function K(...Y){return H.Fn.create(P(B("BIP0340/challenge",...Y)))}function J(Y){return Q(Y).bytes}function q(Y,W,w=(0,n.randomBytes)(32)){const{Fn:N}=H,L=(0,a.ensureBytes)("message",Y),{bytes:E,scalar:C}=Q(W),D=(0,a.ensureBytes)("auxRand",w,32),f=N.toBytes(C^P(B("BIP0340/aux",D))),y=B("BIP0340/nonce",f,E,L),{bytes:m,scalar:S}=Q(y),x=K(m,E,L),k=new Uint8Array(64);if(k.set(m,0),k.set(N.toBytes(N.create(S+x*C)),32),!Z(k,L,E))throw new Error("sign: Invalid signature produced");return k}function Z(Y,W,w){const{Fn:N,BASE:L}=H,E=(0,a.ensureBytes)("signature",Y,64),C=(0,a.ensureBytes)("message",W),D=(0,a.ensureBytes)("publicKey",w,32);try{const f=U(P(D)),y=P(E.subarray(0,32));if(!(0,a.inRange)(y,p,u.p))return!1;const m=P(E.subarray(32,64));if(!(0,a.inRange)(m,p,u.n))return!1;const S=K(N.toBytes(y),T(f),C),x=L.multiplyUnsafe(m).add(f.multiplyUnsafe(N.neg(S))),{x:k,y:z}=x.toAffine();return!(x.is0()||!$(z)||k!==y)}catch{return!1}}e.schnorr=(()=>{const w=(L=(0,n.randomBytes)(48))=>(0,o.mapHashToField)(L,u.n);e.secp256k1.utils.randomSecretKey;function N(L){const E=w(L);return{secretKey:E,publicKey:J(E)}}return{keygen:N,getPublicKey:J,sign:q,verify:Z,Point:H,utils:{randomSecretKey:w,randomPrivateKey:w,taggedHash:B,lift_x:U,pointToBytes:T,numberToBytesBE:a.numberToBytesBE,bytesToNumberBE:a.bytesToNumberBE,mod:o.mod},lengths:{secretKey:32,publicKey:32,publicKeyHasPrefix:!1,signature:64,seed:48}}})();const te=(0,i.isogenyMap)(h,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(Y=>Y.map(W=>BigInt(W)))),ne=(0,s.mapToCurveSimpleSWU)(h,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:h.create(BigInt("-11"))});e.secp256k1_hasher=(0,i.createHasher)(e.secp256k1.Point,Y=>{const{x:W,y:w}=ne(h.create(Y[0]));return te(W,w)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:h.ORDER,m:1,k:128,expand:"xmd",hash:t.sha256}),e.hashToCurve=e.secp256k1_hasher.hashToCurve,e.encodeToCurve=e.secp256k1_hasher.encodeToCurve})(li)),li}var fi={},ea;function ta(){return ea||(ea=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodeHex=e.remove0x=void 0;var t=Xe(),n=function(i){return i.startsWith("0x")||i.startsWith("0X")?i.slice(2):i};e.remove0x=n;var r=function(i){return(0,t.hexToBytes)((0,e.remove0x)(i))};e.decodeHex=r})(fi)),fi}var na;function ph(){return na||(na=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hexToPublicKey=e.convertPublicKeyFormat=e.getSharedPoint=e.getPublicKey=e.isValidPrivateKey=e.getValidSecret=void 0;var t=Fs(),n=dh(),r=hh(),i=nr(),o=Qr(),s=ta(),a=function(B){var T;do T=(0,t.randomBytes)(o.SECRET_KEY_LENGTH);while(!(0,e.isValidPrivateKey)(T,B));return T};e.getValidSecret=a;var u=function(B,T){return v(T||(0,i.ellipticCurve)(),function(H){return H.utils.isValidPrivateKey(B)},function(){return!0},function(){return!0})};e.isValidPrivateKey=u;var d=function(B,T){return v(T||(0,i.ellipticCurve)(),function(H){return H.getPublicKey(B)},function(H){return H.getPublicKey(B)},function(H){return H.getPublicKey(B)})};e.getPublicKey=d;var g=function(B,T,H,$){return v($||(0,i.ellipticCurve)(),function(Q){return Q.getSharedSecret(B,T,H)},function(Q){return Q.getSharedSecret(B,T)},function(Q){return b(Q,B,T)})};e.getSharedPoint=g;var p=function(B,T,H){return v(H||(0,i.ellipticCurve)(),function($){return $.getSharedSecret(BigInt(1),B,T)},function(){return B},function(){return B})};e.convertPublicKeyFormat=p;var I=function(B,T){var H=(0,s.decodeHex)(B);return v(T||(0,i.ellipticCurve)(),function(){return h(H)},function(){return H},function(){return H})};e.hexToPublicKey=I;function v(B,T,H,$){if(B==="secp256k1")return T(r.secp256k1);if(B==="x25519")return H(n.x25519);if(B==="ed25519")return $(n.ed25519);throw new Error("Not implemented")}var h=function(B){if(B.length===o.ETH_PUBLIC_KEY_SIZE){var T=new Uint8Array(1+B.length);return T.set([4]),T.set(B,1),T}return B},b=function(B,T,H){var $=B.utils.getExtendedPublicKey(T).scalar,Q=B.ExtendedPoint.fromHex(H).multiply($);return Q.toRawBytes()}})(ti)),ti}var hi={},Ot={},ra;function yh(){if(ra)return Ot;ra=1,Object.defineProperty(Ot,"__esModule",{value:!0}),Ot.hkdf=void 0,Ot.extract=n,Ot.expand=o;const e=Ws(),t=dt();function n(a,u,d){return(0,t.ahash)(a),d===void 0&&(d=new Uint8Array(a.outputLen)),(0,e.hmac)(a,(0,t.toBytes)(d),(0,t.toBytes)(u))}const r=Uint8Array.from([0]),i=Uint8Array.of();function o(a,u,d,g=32){(0,t.ahash)(a),(0,t.anumber)(g);const p=a.outputLen;if(g>255*p)throw new Error("Length should be <= 255*HashLen");const I=Math.ceil(g/p);d===void 0&&(d=i);const v=new Uint8Array(I*p),h=e.hmac.create(a,u),b=h._cloneInto(),B=new Uint8Array(h.outputLen);for(let T=0;T<I;T++)r[0]=T+1,b.update(T===0?i:B).update(d).update(r).digestInto(B),v.set(B,p*T),h._cloneInto(b);return h.destroy(),b.destroy(),(0,t.clean)(B,r),v.slice(0,g)}const s=(a,u,d,g,p)=>o(a,n(a,u,d),g,p);return Ot.hkdf=s,Ot}var ia;function gh(){return ia||(ia=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getSharedKey=e.deriveKey=void 0;var t=Xe(),n=yh(),r=oi(),i=function(s,a,u){return(0,n.hkdf)(r.sha256,s,a,u,32)};e.deriveKey=i;var o=function(){for(var s=[],a=0;a<arguments.length;a++)s[a]=arguments[a];return(0,e.deriveKey)(t.concatBytes.apply(void 0,s))};e.getSharedKey=o})(hi)),hi}var pi={},Rt={},yi={},vt={},oa;function mh(){if(oa)return vt;oa=1,Object.defineProperty(vt,"__esModule",{value:!0}),vt.polyval=vt.ghash=void 0,vt._toGHASHKey=a;const e=Xe(),t=16,n=new Uint8Array(16),r=(0,e.u32)(n),i=225,o=(I,v,h,b)=>{const B=b&1;return{s3:h<<31|b>>>1,s2:v<<31|h>>>1,s1:I<<31|v>>>1,s0:I>>>1^i<<24&-(B&1)}},s=I=>(I>>>0&255)<<24|(I>>>8&255)<<16|(I>>>16&255)<<8|I>>>24&255|0;function a(I){I.reverse();const v=I[15]&1;let h=0;for(let b=0;b<I.length;b++){const B=I[b];I[b]=B>>>1|h,h=(B&1)<<7}return I[0]^=-v&225,I}const u=I=>I>64*1024?8:I>1024?4:2;class d{constructor(v,h){this.blockLen=t,this.outputLen=t,this.s0=0,this.s1=0,this.s2=0,this.s3=0,this.finished=!1,v=(0,e.toBytes)(v),(0,e.abytes)(v,16);const b=(0,e.createView)(v);let B=b.getUint32(0,!1),T=b.getUint32(4,!1),H=b.getUint32(8,!1),$=b.getUint32(12,!1);const Q=[];for(let Z=0;Z<128;Z++)Q.push({s0:s(B),s1:s(T),s2:s(H),s3:s($)}),{s0:B,s1:T,s2:H,s3:$}=o(B,T,H,$);const U=u(h||1024);if(![1,2,4,8].includes(U))throw new Error("ghash: invalid window size, expected 2, 4 or 8");this.W=U;const K=128/U,J=this.windowSize=2**U,q=[];for(let Z=0;Z<K;Z++)for(let te=0;te<J;te++){let ne=0,Y=0,W=0,w=0;for(let N=0;N<U;N++){if(!(te>>>U-N-1&1))continue;const{s0:E,s1:C,s2:D,s3:f}=Q[U*Z+N];ne^=E,Y^=C,W^=D,w^=f}q.push({s0:ne,s1:Y,s2:W,s3:w})}this.t=q}_updateBlock(v,h,b,B){v^=this.s0,h^=this.s1,b^=this.s2,B^=this.s3;const{W:T,t:H,windowSize:$}=this;let Q=0,U=0,P=0,K=0;const J=(1<<T)-1;let q=0;for(const Z of[v,h,b,B])for(let te=0;te<4;te++){const ne=Z>>>8*te&255;for(let Y=8/T-1;Y>=0;Y--){const W=ne>>>T*Y&J,{s0:w,s1:N,s2:L,s3:E}=H[q*$+W];Q^=w,U^=N,P^=L,K^=E,q+=1}}this.s0=Q,this.s1=U,this.s2=P,this.s3=K}update(v){(0,e.aexists)(this),v=(0,e.toBytes)(v),(0,e.abytes)(v);const h=(0,e.u32)(v),b=Math.floor(v.length/t),B=v.length%t;for(let T=0;T<b;T++)this._updateBlock(h[T*4+0],h[T*4+1],h[T*4+2],h[T*4+3]);return B&&(n.set(v.subarray(b*t)),this._updateBlock(r[0],r[1],r[2],r[3]),(0,e.clean)(r)),this}destroy(){const{t:v}=this;for(const h of v)h.s0=0,h.s1=0,h.s2=0,h.s3=0}digestInto(v){(0,e.aexists)(this),(0,e.aoutput)(v,this),this.finished=!0;const{s0:h,s1:b,s2:B,s3:T}=this,H=(0,e.u32)(v);return H[0]=h,H[1]=b,H[2]=B,H[3]=T,v}digest(){const v=new Uint8Array(t);return this.digestInto(v),this.destroy(),v}}class g extends d{constructor(v,h){v=(0,e.toBytes)(v),(0,e.abytes)(v);const b=a((0,e.copyBytes)(v));super(b,h),(0,e.clean)(b)}update(v){v=(0,e.toBytes)(v),(0,e.aexists)(this);const h=(0,e.u32)(v),b=v.length%t,B=Math.floor(v.length/t);for(let T=0;T<B;T++)this._updateBlock(s(h[T*4+3]),s(h[T*4+2]),s(h[T*4+1]),s(h[T*4+0]));return b&&(n.set(v.subarray(B*t)),this._updateBlock(s(r[3]),s(r[2]),s(r[1]),s(r[0])),(0,e.clean)(r)),this}digestInto(v){(0,e.aexists)(this),(0,e.aoutput)(v,this),this.finished=!0;const{s0:h,s1:b,s2:B,s3:T}=this,H=(0,e.u32)(v);return H[0]=h,H[1]=b,H[2]=B,H[3]=T,v.reverse()}}function p(I){const v=(b,B)=>I(B,b.length).update((0,e.toBytes)(b)).digest(),h=I(new Uint8Array(16),0);return v.outputLen=h.outputLen,v.blockLen=h.blockLen,v.create=(b,B)=>I(b,B),v}return vt.ghash=p((I,v)=>new d(I,v)),vt.polyval=p((I,v)=>new g(I,v)),vt}var sa;function _h(){return sa||(sa=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.unsafe=e.aeskwp=e.aeskw=e.siv=e.gcmsiv=e.gcm=e.cfb=e.cbc=e.ecb=e.ctr=void 0;const t=mh(),n=Xe(),r=16,i=4,o=new Uint8Array(r),s=283;function a(y){return y<<1^s&-(y>>7)}function u(y,m){let S=0;for(;m>0;m>>=1)S^=y&-(m&1),y=a(y);return S}const d=(()=>{const y=new Uint8Array(256);for(let S=0,x=1;S<256;S++,x^=a(x))y[S]=x;const m=new Uint8Array(256);m[0]=99;for(let S=0;S<255;S++){let x=y[255-S];x|=x<<8,m[y[S]]=(x^x>>4^x>>5^x>>6^x>>7^99)&255}return(0,n.clean)(y),m})(),g=d.map((y,m)=>d.indexOf(m)),p=y=>y<<24|y>>>8,I=y=>y<<8|y>>>24,v=y=>y<<24&4278190080|y<<8&16711680|y>>>8&65280|y>>>24&255;function h(y,m){if(y.length!==256)throw new Error("Wrong sbox length");const S=new Uint32Array(256).map((j,X)=>m(y[X])),x=S.map(I),k=x.map(I),z=k.map(I),O=new Uint32Array(256*256),F=new Uint32Array(256*256),M=new Uint16Array(256*256);for(let j=0;j<256;j++)for(let X=0;X<256;X++){const R=j*256+X;O[R]=S[j]^x[X],F[R]=k[j]^z[X],M[R]=y[j]<<8|y[X]}return{sbox:y,sbox2:M,T0:S,T1:x,T2:k,T3:z,T01:O,T23:F}}const b=h(d,y=>u(y,3)<<24|y<<16|y<<8|u(y,2)),B=h(g,y=>u(y,11)<<24|u(y,13)<<16|u(y,9)<<8|u(y,14)),T=(()=>{const y=new Uint8Array(16);for(let m=0,S=1;m<16;m++,S=a(S))y[m]=S;return y})();function H(y){(0,n.abytes)(y);const m=y.length;if(![16,24,32].includes(m))throw new Error("aes: invalid key size, should be 16, 24 or 32, got "+m);const{sbox2:S}=b,x=[];(0,n.isAligned32)(y)||x.push(y=(0,n.copyBytes)(y));const k=(0,n.u32)(y),z=k.length,O=M=>U(S,M,M,M,M),F=new Uint32Array(m+28);F.set(k);for(let M=z;M<F.length;M++){let j=F[M-1];M%z===0?j=O(p(j))^T[M/z-1]:z>6&&M%z===4&&(j=O(j)),F[M]=F[M-z]^j}return(0,n.clean)(...x),F}function $(y){const m=H(y),S=m.slice(),x=m.length,{sbox2:k}=b,{T0:z,T1:O,T2:F,T3:M}=B;for(let j=0;j<x;j+=4)for(let X=0;X<4;X++)S[j+X]=m[x-j-4+X];(0,n.clean)(m);for(let j=4;j<x-4;j++){const X=S[j],R=U(k,X,X,X,X);S[j]=z[R&255]^O[R>>>8&255]^F[R>>>16&255]^M[R>>>24]}return S}function Q(y,m,S,x,k,z){return y[S<<8&65280|x>>>8&255]^m[k>>>8&65280|z>>>24&255]}function U(y,m,S,x,k){return y[m&255|S&65280]|y[x>>>16&255|k>>>16&65280]<<16}function P(y,m,S,x,k){const{sbox2:z,T01:O,T23:F}=b;let M=0;m^=y[M++],S^=y[M++],x^=y[M++],k^=y[M++];const j=y.length/4-2;for(let se=0;se<j;se++){const ue=y[M++]^Q(O,F,m,S,x,k),de=y[M++]^Q(O,F,S,x,k,m),he=y[M++]^Q(O,F,x,k,m,S),fe=y[M++]^Q(O,F,k,m,S,x);m=ue,S=de,x=he,k=fe}const X=y[M++]^U(z,m,S,x,k),R=y[M++]^U(z,S,x,k,m),G=y[M++]^U(z,x,k,m,S),oe=y[M++]^U(z,k,m,S,x);return{s0:X,s1:R,s2:G,s3:oe}}function K(y,m,S,x,k){const{sbox2:z,T01:O,T23:F}=B;let M=0;m^=y[M++],S^=y[M++],x^=y[M++],k^=y[M++];const j=y.length/4-2;for(let se=0;se<j;se++){const ue=y[M++]^Q(O,F,m,k,x,S),de=y[M++]^Q(O,F,S,m,k,x),he=y[M++]^Q(O,F,x,S,m,k),fe=y[M++]^Q(O,F,k,x,S,m);m=ue,S=de,x=he,k=fe}const X=y[M++]^U(z,m,k,x,S),R=y[M++]^U(z,S,m,k,x),G=y[M++]^U(z,x,S,m,k),oe=y[M++]^U(z,k,x,S,m);return{s0:X,s1:R,s2:G,s3:oe}}function J(y,m,S,x){(0,n.abytes)(m,r),(0,n.abytes)(S);const k=S.length;x=(0,n.getOutput)(k,x),(0,n.complexOverlapBytes)(S,x);const z=m,O=(0,n.u32)(z);let{s0:F,s1:M,s2:j,s3:X}=P(y,O[0],O[1],O[2],O[3]);const R=(0,n.u32)(S),G=(0,n.u32)(x);for(let se=0;se+4<=R.length;se+=4){G[se+0]=R[se+0]^F,G[se+1]=R[se+1]^M,G[se+2]=R[se+2]^j,G[se+3]=R[se+3]^X;let ue=1;for(let de=z.length-1;de>=0;de--)ue=ue+(z[de]&255)|0,z[de]=ue&255,ue>>>=8;({s0:F,s1:M,s2:j,s3:X}=P(y,O[0],O[1],O[2],O[3]))}const oe=r*Math.floor(R.length/i);if(oe<k){const se=new Uint32Array([F,M,j,X]),ue=(0,n.u8)(se);for(let de=oe,he=0;de<k;de++,he++)x[de]=S[de]^ue[he];(0,n.clean)(se)}return x}function q(y,m,S,x,k){(0,n.abytes)(S,r),(0,n.abytes)(x),k=(0,n.getOutput)(x.length,k);const z=S,O=(0,n.u32)(z),F=(0,n.createView)(z),M=(0,n.u32)(x),j=(0,n.u32)(k),X=m?0:12,R=x.length;let G=F.getUint32(X,m),{s0:oe,s1:se,s2:ue,s3:de}=P(y,O[0],O[1],O[2],O[3]);for(let fe=0;fe+4<=M.length;fe+=4)j[fe+0]=M[fe+0]^oe,j[fe+1]=M[fe+1]^se,j[fe+2]=M[fe+2]^ue,j[fe+3]=M[fe+3]^de,G=G+1>>>0,F.setUint32(X,G,m),{s0:oe,s1:se,s2:ue,s3:de}=P(y,O[0],O[1],O[2],O[3]);const he=r*Math.floor(M.length/i);if(he<R){const fe=new Uint32Array([oe,se,ue,de]),Ee=(0,n.u8)(fe);for(let ye=he,pe=0;ye<R;ye++,pe++)k[ye]=x[ye]^Ee[pe];(0,n.clean)(fe)}return k}e.ctr=(0,n.wrapCipher)({blockSize:16,nonceLength:16},function(m,S){function x(k,z){if((0,n.abytes)(k),z!==void 0&&((0,n.abytes)(z),!(0,n.isAligned32)(z)))throw new Error("unaligned destination");const O=H(m),F=(0,n.copyBytes)(S),M=[O,F];(0,n.isAligned32)(k)||M.push(k=(0,n.copyBytes)(k));const j=J(O,F,k,z);return(0,n.clean)(...M),j}return{encrypt:(k,z)=>x(k,z),decrypt:(k,z)=>x(k,z)}});function Z(y){if((0,n.abytes)(y),y.length%r!==0)throw new Error("aes-(cbc/ecb).decrypt ciphertext should consist of blocks with size "+r)}function te(y,m,S){(0,n.abytes)(y);let x=y.length;const k=x%r;if(!m&&k!==0)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");(0,n.isAligned32)(y)||(y=(0,n.copyBytes)(y));const z=(0,n.u32)(y);if(m){let F=r-k;F||(F=r),x=x+F}S=(0,n.getOutput)(x,S),(0,n.complexOverlapBytes)(y,S);const O=(0,n.u32)(S);return{b:z,o:O,out:S}}function ne(y,m){if(!m)return y;const S=y.length;if(!S)throw new Error("aes/pcks5: empty ciphertext not allowed");const x=y[S-1];if(x<=0||x>16)throw new Error("aes/pcks5: wrong padding");const k=y.subarray(0,-x);for(let z=0;z<x;z++)if(y[S-z-1]!==x)throw new Error("aes/pcks5: wrong padding");return k}function Y(y){const m=new Uint8Array(16),S=(0,n.u32)(m);m.set(y);const x=r-y.length;for(let k=r-x;k<r;k++)m[k]=x;return S}e.ecb=(0,n.wrapCipher)({blockSize:16},function(m,S={}){const x=!S.disablePadding;return{encrypt(k,z){const{b:O,o:F,out:M}=te(k,x,z),j=H(m);let X=0;for(;X+4<=O.length;){const{s0:R,s1:G,s2:oe,s3:se}=P(j,O[X+0],O[X+1],O[X+2],O[X+3]);F[X++]=R,F[X++]=G,F[X++]=oe,F[X++]=se}if(x){const R=Y(k.subarray(X*4)),{s0:G,s1:oe,s2:se,s3:ue}=P(j,R[0],R[1],R[2],R[3]);F[X++]=G,F[X++]=oe,F[X++]=se,F[X++]=ue}return(0,n.clean)(j),M},decrypt(k,z){Z(k);const O=$(m);z=(0,n.getOutput)(k.length,z);const F=[O];(0,n.isAligned32)(k)||F.push(k=(0,n.copyBytes)(k)),(0,n.complexOverlapBytes)(k,z);const M=(0,n.u32)(k),j=(0,n.u32)(z);for(let X=0;X+4<=M.length;){const{s0:R,s1:G,s2:oe,s3:se}=K(O,M[X+0],M[X+1],M[X+2],M[X+3]);j[X++]=R,j[X++]=G,j[X++]=oe,j[X++]=se}return(0,n.clean)(...F),ne(z,x)}}}),e.cbc=(0,n.wrapCipher)({blockSize:16,nonceLength:16},function(m,S,x={}){const k=!x.disablePadding;return{encrypt(z,O){const F=H(m),{b:M,o:j,out:X}=te(z,k,O);let R=S;const G=[F];(0,n.isAligned32)(R)||G.push(R=(0,n.copyBytes)(R));const oe=(0,n.u32)(R);let se=oe[0],ue=oe[1],de=oe[2],he=oe[3],fe=0;for(;fe+4<=M.length;)se^=M[fe+0],ue^=M[fe+1],de^=M[fe+2],he^=M[fe+3],{s0:se,s1:ue,s2:de,s3:he}=P(F,se,ue,de,he),j[fe++]=se,j[fe++]=ue,j[fe++]=de,j[fe++]=he;if(k){const Ee=Y(z.subarray(fe*4));se^=Ee[0],ue^=Ee[1],de^=Ee[2],he^=Ee[3],{s0:se,s1:ue,s2:de,s3:he}=P(F,se,ue,de,he),j[fe++]=se,j[fe++]=ue,j[fe++]=de,j[fe++]=he}return(0,n.clean)(...G),X},decrypt(z,O){Z(z);const F=$(m);let M=S;const j=[F];(0,n.isAligned32)(M)||j.push(M=(0,n.copyBytes)(M));const X=(0,n.u32)(M);O=(0,n.getOutput)(z.length,O),(0,n.isAligned32)(z)||j.push(z=(0,n.copyBytes)(z)),(0,n.complexOverlapBytes)(z,O);const R=(0,n.u32)(z),G=(0,n.u32)(O);let oe=X[0],se=X[1],ue=X[2],de=X[3];for(let he=0;he+4<=R.length;){const fe=oe,Ee=se,ye=ue,pe=de;oe=R[he+0],se=R[he+1],ue=R[he+2],de=R[he+3];const{s0:le,s1:ae,s2:ce,s3:_}=K(F,oe,se,ue,de);G[he++]=le^fe,G[he++]=ae^Ee,G[he++]=ce^ye,G[he++]=_^pe}return(0,n.clean)(...j),ne(O,k)}}}),e.cfb=(0,n.wrapCipher)({blockSize:16,nonceLength:16},function(m,S){function x(k,z,O){(0,n.abytes)(k);const F=k.length;if(O=(0,n.getOutput)(F,O),(0,n.overlapBytes)(k,O))throw new Error("overlapping src and dst not supported.");const M=H(m);let j=S;const X=[M];(0,n.isAligned32)(j)||X.push(j=(0,n.copyBytes)(j)),(0,n.isAligned32)(k)||X.push(k=(0,n.copyBytes)(k));const R=(0,n.u32)(k),G=(0,n.u32)(O),oe=z?G:R,se=(0,n.u32)(j);let ue=se[0],de=se[1],he=se[2],fe=se[3];for(let ye=0;ye+4<=R.length;){const{s0:pe,s1:le,s2:ae,s3:ce}=P(M,ue,de,he,fe);G[ye+0]=R[ye+0]^pe,G[ye+1]=R[ye+1]^le,G[ye+2]=R[ye+2]^ae,G[ye+3]=R[ye+3]^ce,ue=oe[ye++],de=oe[ye++],he=oe[ye++],fe=oe[ye++]}const Ee=r*Math.floor(R.length/i);if(Ee<F){({s0:ue,s1:de,s2:he,s3:fe}=P(M,ue,de,he,fe));const ye=(0,n.u8)(new Uint32Array([ue,de,he,fe]));for(let pe=Ee,le=0;pe<F;pe++,le++)O[pe]=k[pe]^ye[le];(0,n.clean)(ye)}return(0,n.clean)(...X),O}return{encrypt:(k,z)=>x(k,!0,z),decrypt:(k,z)=>x(k,!1,z)}});function W(y,m,S,x,k){const z=k?k.length:0,O=y.create(S,x.length+z);k&&O.update(k);const F=(0,n.u64Lengths)(8*x.length,8*z,m);O.update(x),O.update(F);const M=O.digest();return(0,n.clean)(F),M}e.gcm=(0,n.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16,varSizeNonce:!0},function(m,S,x){if(S.length<8)throw new Error("aes/gcm: invalid nonce length");const k=16;function z(F,M,j){const X=W(t.ghash,!1,F,j,x);for(let R=0;R<M.length;R++)X[R]^=M[R];return X}function O(){const F=H(m),M=o.slice(),j=o.slice();if(q(F,!1,j,j,M),S.length===12)j.set(S);else{const R=o.slice(),G=(0,n.createView)(R);(0,n.setBigUint64)(G,8,BigInt(S.length*8),!1);const oe=t.ghash.create(M).update(S).update(R);oe.digestInto(j),oe.destroy()}const X=q(F,!1,j,o);return{xk:F,authKey:M,counter:j,tagMask:X}}return{encrypt(F){const{xk:M,authKey:j,counter:X,tagMask:R}=O(),G=new Uint8Array(F.length+k),oe=[M,j,X,R];(0,n.isAligned32)(F)||oe.push(F=(0,n.copyBytes)(F)),q(M,!1,X,F,G.subarray(0,F.length));const se=z(j,R,G.subarray(0,G.length-k));return oe.push(se),G.set(se,F.length),(0,n.clean)(...oe),G},decrypt(F){const{xk:M,authKey:j,counter:X,tagMask:R}=O(),G=[M,j,R,X];(0,n.isAligned32)(F)||G.push(F=(0,n.copyBytes)(F));const oe=F.subarray(0,-k),se=F.subarray(-k),ue=z(j,R,oe);if(G.push(ue),!(0,n.equalBytes)(ue,se))throw new Error("aes/gcm: invalid ghash tag");const de=q(M,!1,X,oe);return(0,n.clean)(...G),de}}});const w=(y,m,S)=>x=>{if(!Number.isSafeInteger(x)||m>x||x>S){const k="["+m+".."+S+"]";throw new Error(""+y+": expected value in range "+k+", got "+x)}};e.gcmsiv=(0,n.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16,varSizeNonce:!0},function(m,S,x){const z=w("AAD",0,68719476736),O=w("plaintext",0,2**36),F=w("nonce",12,12),M=w("ciphertext",16,2**36+16);(0,n.abytes)(m,16,24,32),F(S.length),x!==void 0&&z(x.length);function j(){const G=H(m),oe=new Uint8Array(m.length),se=new Uint8Array(16),ue=[G,oe];let de=S;(0,n.isAligned32)(de)||ue.push(de=(0,n.copyBytes)(de));const he=(0,n.u32)(de);let fe=0,Ee=he[0],ye=he[1],pe=he[2],le=0;for(const ce of[se,oe].map(n.u32)){const _=(0,n.u32)(ce);for(let c=0;c<_.length;c+=2){const{s0:l,s1:A}=P(G,fe,Ee,ye,pe);_[c+0]=l,_[c+1]=A,fe=++le}}const ae={authKey:se,encKey:H(oe)};return(0,n.clean)(...ue),ae}function X(G,oe,se){const ue=W(t.polyval,!0,oe,se,x);for(let pe=0;pe<12;pe++)ue[pe]^=S[pe];ue[15]&=127;const de=(0,n.u32)(ue);let he=de[0],fe=de[1],Ee=de[2],ye=de[3];return{s0:he,s1:fe,s2:Ee,s3:ye}=P(G,he,fe,Ee,ye),de[0]=he,de[1]=fe,de[2]=Ee,de[3]=ye,ue}function R(G,oe,se){let ue=(0,n.copyBytes)(oe);ue[15]|=128;const de=q(G,!0,ue,se);return(0,n.clean)(ue),de}return{encrypt(G){O(G.length);const{encKey:oe,authKey:se}=j(),ue=X(oe,se,G),de=[oe,se,ue];(0,n.isAligned32)(G)||de.push(G=(0,n.copyBytes)(G));const he=new Uint8Array(G.length+16);return he.set(ue,G.length),he.set(R(oe,ue,G)),(0,n.clean)(...de),he},decrypt(G){M(G.length);const oe=G.subarray(-16),{encKey:se,authKey:ue}=j(),de=[se,ue];(0,n.isAligned32)(G)||de.push(G=(0,n.copyBytes)(G));const he=R(se,oe,G.subarray(0,-16)),fe=X(se,ue,he);if(de.push(fe),!(0,n.equalBytes)(oe,fe))throw(0,n.clean)(...de),new Error("invalid polyval tag");return(0,n.clean)(...de),he}}}),e.siv=e.gcmsiv;function N(y){return y instanceof Uint32Array||ArrayBuffer.isView(y)&&y.constructor.name==="Uint32Array"}function L(y,m){if((0,n.abytes)(m,16),!N(y))throw new Error("_encryptBlock accepts result of expandKeyLE");const S=(0,n.u32)(m);let{s0:x,s1:k,s2:z,s3:O}=P(y,S[0],S[1],S[2],S[3]);return S[0]=x,S[1]=k,S[2]=z,S[3]=O,m}function E(y,m){if((0,n.abytes)(m,16),!N(y))throw new Error("_decryptBlock accepts result of expandKeyLE");const S=(0,n.u32)(m);let{s0:x,s1:k,s2:z,s3:O}=K(y,S[0],S[1],S[2],S[3]);return S[0]=x,S[1]=k,S[2]=z,S[3]=O,m}const C={encrypt(y,m){if(m.length>=2**32)throw new Error("plaintext should be less than 4gb");const S=H(y);if(m.length===16)L(S,m);else{const x=(0,n.u32)(m);let k=x[0],z=x[1];for(let O=0,F=1;O<6;O++)for(let M=2;M<x.length;M+=2,F++){const{s0:j,s1:X,s2:R,s3:G}=P(S,k,z,x[M],x[M+1]);k=j,z=X^v(F),x[M]=R,x[M+1]=G}x[0]=k,x[1]=z}S.fill(0)},decrypt(y,m){if(m.length-8>=2**32)throw new Error("ciphertext should be less than 4gb");const S=$(y),x=m.length/8-1;if(x===1)E(S,m);else{const k=(0,n.u32)(m);let z=k[0],O=k[1];for(let F=0,M=x*6;F<6;F++)for(let j=x*2;j>=1;j-=2,M--){O^=v(M);const{s0:X,s1:R,s2:G,s3:oe}=K(S,z,O,k[j],k[j+1]);z=X,O=R,k[j]=G,k[j+1]=oe}k[0]=z,k[1]=O}S.fill(0)}},D=new Uint8Array(8).fill(166);e.aeskw=(0,n.wrapCipher)({blockSize:8},y=>({encrypt(m){if(!m.length||m.length%8!==0)throw new Error("invalid plaintext length");if(m.length===8)throw new Error("8-byte keys not allowed in AESKW, use AESKWP instead");const S=(0,n.concatBytes)(D,m);return C.encrypt(y,S),S},decrypt(m){if(m.length%8!==0||m.length<24)throw new Error("invalid ciphertext length");const S=(0,n.copyBytes)(m);if(C.decrypt(y,S),!(0,n.equalBytes)(S.subarray(0,8),D))throw new Error("integrity check failed");return S.subarray(0,8).fill(0),S.subarray(8)}}));const f=2790873510;e.aeskwp=(0,n.wrapCipher)({blockSize:8},y=>({encrypt(m){if(!m.length)throw new Error("invalid plaintext length");const S=Math.ceil(m.length/8)*8,x=new Uint8Array(8+S);x.set(m,8);const k=(0,n.u32)(x);return k[0]=f,k[1]=v(m.length),C.encrypt(y,x),x},decrypt(m){if(m.length<16)throw new Error("invalid ciphertext length");const S=(0,n.copyBytes)(m),x=(0,n.u32)(S);C.decrypt(y,S);const k=v(x[1])>>>0,z=Math.ceil(k/8)*8;if(x[0]!==f||S.length-8!==z)throw new Error("integrity check failed");for(let O=k;O<z;O++)if(S[8+O]!==0)throw new Error("integrity check failed");return S.subarray(0,8).fill(0),S.subarray(8,8+k)}})),e.unsafe={expandKeyLE:H,expandKeyDecLE:$,encrypt:P,decrypt:K,encryptBlock:L,decryptBlock:E,ctrCounter:J,ctr32:q}})(yi)),yi}var aa;function bh(){if(aa)return Rt;aa=1,Object.defineProperty(Rt,"__esModule",{value:!0}),Rt.aes256cbc=Rt.aes256gcm=void 0;var e=_h(),t=function(r,i,o){return(0,e.gcm)(r,i,o)};Rt.aes256gcm=t;var n=function(r,i,o){return(0,e.cbc)(r,i)};return Rt.aes256cbc=n,Rt}var Pt={},gi={},wn={},ca;function wh(){if(ca)return wn;ca=1,Object.defineProperty(wn,"__esModule",{value:!0}),wn.rotl=s,wn.createCipher=v;const e=Xe(),t=h=>Uint8Array.from(h.split("").map(b=>b.charCodeAt(0))),n=t("expand 16-byte k"),r=t("expand 32-byte k"),i=(0,e.u32)(n),o=(0,e.u32)(r);function s(h,b){return h<<b|h>>>32-b}function a(h){return h.byteOffset%4===0}const u=64,d=16,g=2**32-1,p=new Uint32Array;function I(h,b,B,T,H,$,Q,U){const P=H.length,K=new Uint8Array(u),J=(0,e.u32)(K),q=a(H)&&a($),Z=q?(0,e.u32)(H):p,te=q?(0,e.u32)($):p;for(let ne=0;ne<P;Q++){if(h(b,B,T,J,Q,U),Q>=g)throw new Error("arx: counter overflow");const Y=Math.min(u,P-ne);if(q&&Y===u){const W=ne/4;if(ne%4!==0)throw new Error("arx: invalid block position");for(let w=0,N;w<d;w++)N=W+w,te[N]=Z[N]^J[w];ne+=u;continue}for(let W=0,w;W<Y;W++)w=ne+W,$[w]=H[w]^K[W];ne+=Y}}function v(h,b){const{allowShortKeys:B,extendNonceFn:T,counterLength:H,counterRight:$,rounds:Q}=(0,e.checkOpts)({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},b);if(typeof h!="function")throw new Error("core must be a function");return(0,e.anumber)(H),(0,e.anumber)(Q),(0,e.abool)($),(0,e.abool)(B),(U,P,K,J,q=0)=>{(0,e.abytes)(U),(0,e.abytes)(P),(0,e.abytes)(K);const Z=K.length;if(J===void 0&&(J=new Uint8Array(Z)),(0,e.abytes)(J),(0,e.anumber)(q),q<0||q>=g)throw new Error("arx: counter overflow");if(J.length<Z)throw new Error(`arx: output (${J.length}) is shorter than data (${Z})`);const te=[];let ne=U.length,Y,W;if(ne===32)te.push(Y=(0,e.copyBytes)(U)),W=o;else if(ne===16&&B)Y=new Uint8Array(32),Y.set(U),Y.set(U,16),W=i,te.push(Y);else throw new Error(`arx: invalid 32-byte key, got length=${ne}`);a(P)||te.push(P=(0,e.copyBytes)(P));const w=(0,e.u32)(Y);if(T){if(P.length!==24)throw new Error("arx: extended nonce must be 24 bytes");T(W,w,(0,e.u32)(P.subarray(0,16)),w),P=P.subarray(16)}const N=16-H;if(N!==P.length)throw new Error(`arx: nonce must be ${N} or 16 bytes`);if(N!==12){const E=new Uint8Array(12);E.set(P,$?0:12-P.length),P=E,te.push(P)}const L=(0,e.u32)(P);return I(h,W,w,L,K,J,q,Q),(0,e.clean)(...te),J}}return wn}var Zt={},la;function vh(){if(la)return Zt;la=1,Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.poly1305=void 0,Zt.wrapConstructorWithKey=r;const e=Xe(),t=(i,o)=>i[o++]&255|(i[o++]&255)<<8;class n{constructor(o){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,o=(0,e.toBytes)(o),(0,e.abytes)(o,32);const s=t(o,0),a=t(o,2),u=t(o,4),d=t(o,6),g=t(o,8),p=t(o,10),I=t(o,12),v=t(o,14);this.r[0]=s&8191,this.r[1]=(s>>>13|a<<3)&8191,this.r[2]=(a>>>10|u<<6)&7939,this.r[3]=(u>>>7|d<<9)&8191,this.r[4]=(d>>>4|g<<12)&255,this.r[5]=g>>>1&8190,this.r[6]=(g>>>14|p<<2)&8191,this.r[7]=(p>>>11|I<<5)&8065,this.r[8]=(I>>>8|v<<8)&8191,this.r[9]=v>>>5&127;for(let h=0;h<8;h++)this.pad[h]=t(o,16+2*h)}process(o,s,a=!1){const u=a?0:2048,{h:d,r:g}=this,p=g[0],I=g[1],v=g[2],h=g[3],b=g[4],B=g[5],T=g[6],H=g[7],$=g[8],Q=g[9],U=t(o,s+0),P=t(o,s+2),K=t(o,s+4),J=t(o,s+6),q=t(o,s+8),Z=t(o,s+10),te=t(o,s+12),ne=t(o,s+14);let Y=d[0]+(U&8191),W=d[1]+((U>>>13|P<<3)&8191),w=d[2]+((P>>>10|K<<6)&8191),N=d[3]+((K>>>7|J<<9)&8191),L=d[4]+((J>>>4|q<<12)&8191),E=d[5]+(q>>>1&8191),C=d[6]+((q>>>14|Z<<2)&8191),D=d[7]+((Z>>>11|te<<5)&8191),f=d[8]+((te>>>8|ne<<8)&8191),y=d[9]+(ne>>>5|u),m=0,S=m+Y*p+W*(5*Q)+w*(5*$)+N*(5*H)+L*(5*T);m=S>>>13,S&=8191,S+=E*(5*B)+C*(5*b)+D*(5*h)+f*(5*v)+y*(5*I),m+=S>>>13,S&=8191;let x=m+Y*I+W*p+w*(5*Q)+N*(5*$)+L*(5*H);m=x>>>13,x&=8191,x+=E*(5*T)+C*(5*B)+D*(5*b)+f*(5*h)+y*(5*v),m+=x>>>13,x&=8191;let k=m+Y*v+W*I+w*p+N*(5*Q)+L*(5*$);m=k>>>13,k&=8191,k+=E*(5*H)+C*(5*T)+D*(5*B)+f*(5*b)+y*(5*h),m+=k>>>13,k&=8191;let z=m+Y*h+W*v+w*I+N*p+L*(5*Q);m=z>>>13,z&=8191,z+=E*(5*$)+C*(5*H)+D*(5*T)+f*(5*B)+y*(5*b),m+=z>>>13,z&=8191;let O=m+Y*b+W*h+w*v+N*I+L*p;m=O>>>13,O&=8191,O+=E*(5*Q)+C*(5*$)+D*(5*H)+f*(5*T)+y*(5*B),m+=O>>>13,O&=8191;let F=m+Y*B+W*b+w*h+N*v+L*I;m=F>>>13,F&=8191,F+=E*p+C*(5*Q)+D*(5*$)+f*(5*H)+y*(5*T),m+=F>>>13,F&=8191;let M=m+Y*T+W*B+w*b+N*h+L*v;m=M>>>13,M&=8191,M+=E*I+C*p+D*(5*Q)+f*(5*$)+y*(5*H),m+=M>>>13,M&=8191;let j=m+Y*H+W*T+w*B+N*b+L*h;m=j>>>13,j&=8191,j+=E*v+C*I+D*p+f*(5*Q)+y*(5*$),m+=j>>>13,j&=8191;let X=m+Y*$+W*H+w*T+N*B+L*b;m=X>>>13,X&=8191,X+=E*h+C*v+D*I+f*p+y*(5*Q),m+=X>>>13,X&=8191;let R=m+Y*Q+W*$+w*H+N*T+L*B;m=R>>>13,R&=8191,R+=E*b+C*h+D*v+f*I+y*p,m+=R>>>13,R&=8191,m=(m<<2)+m|0,m=m+S|0,S=m&8191,m=m>>>13,x+=m,d[0]=S,d[1]=x,d[2]=k,d[3]=z,d[4]=O,d[5]=F,d[6]=M,d[7]=j,d[8]=X,d[9]=R}finalize(){const{h:o,pad:s}=this,a=new Uint16Array(10);let u=o[1]>>>13;o[1]&=8191;for(let p=2;p<10;p++)o[p]+=u,u=o[p]>>>13,o[p]&=8191;o[0]+=u*5,u=o[0]>>>13,o[0]&=8191,o[1]+=u,u=o[1]>>>13,o[1]&=8191,o[2]+=u,a[0]=o[0]+5,u=a[0]>>>13,a[0]&=8191;for(let p=1;p<10;p++)a[p]=o[p]+u,u=a[p]>>>13,a[p]&=8191;a[9]-=8192;let d=(u^1)-1;for(let p=0;p<10;p++)a[p]&=d;d=~d;for(let p=0;p<10;p++)o[p]=o[p]&d|a[p];o[0]=(o[0]|o[1]<<13)&65535,o[1]=(o[1]>>>3|o[2]<<10)&65535,o[2]=(o[2]>>>6|o[3]<<7)&65535,o[3]=(o[3]>>>9|o[4]<<4)&65535,o[4]=(o[4]>>>12|o[5]<<1|o[6]<<14)&65535,o[5]=(o[6]>>>2|o[7]<<11)&65535,o[6]=(o[7]>>>5|o[8]<<8)&65535,o[7]=(o[8]>>>8|o[9]<<5)&65535;let g=o[0]+s[0];o[0]=g&65535;for(let p=1;p<8;p++)g=(o[p]+s[p]|0)+(g>>>16)|0,o[p]=g&65535;(0,e.clean)(a)}update(o){(0,e.aexists)(this),o=(0,e.toBytes)(o),(0,e.abytes)(o);const{buffer:s,blockLen:a}=this,u=o.length;for(let d=0;d<u;){const g=Math.min(a-this.pos,u-d);if(g===a){for(;a<=u-d;d+=a)this.process(o,d);continue}s.set(o.subarray(d,d+g),this.pos),this.pos+=g,d+=g,this.pos===a&&(this.process(s,0,!1),this.pos=0)}return this}destroy(){(0,e.clean)(this.h,this.r,this.buffer,this.pad)}digestInto(o){(0,e.aexists)(this),(0,e.aoutput)(o,this),this.finished=!0;const{buffer:s,h:a}=this;let{pos:u}=this;if(u){for(s[u++]=1;u<16;u++)s[u]=0;this.process(s,0,!0)}this.finalize();let d=0;for(let g=0;g<8;g++)o[d++]=a[g]>>>0,o[d++]=a[g]>>>8;return o}digest(){const{buffer:o,outputLen:s}=this;this.digestInto(o);const a=o.slice(0,s);return this.destroy(),a}}function r(i){const o=(a,u)=>i(u).update((0,e.toBytes)(a)).digest(),s=i(new Uint8Array(32));return o.outputLen=s.outputLen,o.blockLen=s.blockLen,o.create=a=>i(a),o}return Zt.poly1305=r(i=>new n(i)),Zt}var ua;function Eh(){return ua||(ua=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.xchacha20poly1305=e.chacha20poly1305=e._poly1305_aead=e.chacha12=e.chacha8=e.xchacha20=e.chacha20=e.chacha20orig=void 0,e.hchacha=o;const t=wh(),n=vh(),r=Xe();function i(p,I,v,h,b,B=20){let T=p[0],H=p[1],$=p[2],Q=p[3],U=I[0],P=I[1],K=I[2],J=I[3],q=I[4],Z=I[5],te=I[6],ne=I[7],Y=b,W=v[0],w=v[1],N=v[2],L=T,E=H,C=$,D=Q,f=U,y=P,m=K,S=J,x=q,k=Z,z=te,O=ne,F=Y,M=W,j=w,X=N;for(let G=0;G<B;G+=2)L=L+f|0,F=(0,t.rotl)(F^L,16),x=x+F|0,f=(0,t.rotl)(f^x,12),L=L+f|0,F=(0,t.rotl)(F^L,8),x=x+F|0,f=(0,t.rotl)(f^x,7),E=E+y|0,M=(0,t.rotl)(M^E,16),k=k+M|0,y=(0,t.rotl)(y^k,12),E=E+y|0,M=(0,t.rotl)(M^E,8),k=k+M|0,y=(0,t.rotl)(y^k,7),C=C+m|0,j=(0,t.rotl)(j^C,16),z=z+j|0,m=(0,t.rotl)(m^z,12),C=C+m|0,j=(0,t.rotl)(j^C,8),z=z+j|0,m=(0,t.rotl)(m^z,7),D=D+S|0,X=(0,t.rotl)(X^D,16),O=O+X|0,S=(0,t.rotl)(S^O,12),D=D+S|0,X=(0,t.rotl)(X^D,8),O=O+X|0,S=(0,t.rotl)(S^O,7),L=L+y|0,X=(0,t.rotl)(X^L,16),z=z+X|0,y=(0,t.rotl)(y^z,12),L=L+y|0,X=(0,t.rotl)(X^L,8),z=z+X|0,y=(0,t.rotl)(y^z,7),E=E+m|0,F=(0,t.rotl)(F^E,16),O=O+F|0,m=(0,t.rotl)(m^O,12),E=E+m|0,F=(0,t.rotl)(F^E,8),O=O+F|0,m=(0,t.rotl)(m^O,7),C=C+S|0,M=(0,t.rotl)(M^C,16),x=x+M|0,S=(0,t.rotl)(S^x,12),C=C+S|0,M=(0,t.rotl)(M^C,8),x=x+M|0,S=(0,t.rotl)(S^x,7),D=D+f|0,j=(0,t.rotl)(j^D,16),k=k+j|0,f=(0,t.rotl)(f^k,12),D=D+f|0,j=(0,t.rotl)(j^D,8),k=k+j|0,f=(0,t.rotl)(f^k,7);let R=0;h[R++]=T+L|0,h[R++]=H+E|0,h[R++]=$+C|0,h[R++]=Q+D|0,h[R++]=U+f|0,h[R++]=P+y|0,h[R++]=K+m|0,h[R++]=J+S|0,h[R++]=q+x|0,h[R++]=Z+k|0,h[R++]=te+z|0,h[R++]=ne+O|0,h[R++]=Y+F|0,h[R++]=W+M|0,h[R++]=w+j|0,h[R++]=N+X|0}function o(p,I,v,h){let b=p[0],B=p[1],T=p[2],H=p[3],$=I[0],Q=I[1],U=I[2],P=I[3],K=I[4],J=I[5],q=I[6],Z=I[7],te=v[0],ne=v[1],Y=v[2],W=v[3];for(let N=0;N<20;N+=2)b=b+$|0,te=(0,t.rotl)(te^b,16),K=K+te|0,$=(0,t.rotl)($^K,12),b=b+$|0,te=(0,t.rotl)(te^b,8),K=K+te|0,$=(0,t.rotl)($^K,7),B=B+Q|0,ne=(0,t.rotl)(ne^B,16),J=J+ne|0,Q=(0,t.rotl)(Q^J,12),B=B+Q|0,ne=(0,t.rotl)(ne^B,8),J=J+ne|0,Q=(0,t.rotl)(Q^J,7),T=T+U|0,Y=(0,t.rotl)(Y^T,16),q=q+Y|0,U=(0,t.rotl)(U^q,12),T=T+U|0,Y=(0,t.rotl)(Y^T,8),q=q+Y|0,U=(0,t.rotl)(U^q,7),H=H+P|0,W=(0,t.rotl)(W^H,16),Z=Z+W|0,P=(0,t.rotl)(P^Z,12),H=H+P|0,W=(0,t.rotl)(W^H,8),Z=Z+W|0,P=(0,t.rotl)(P^Z,7),b=b+Q|0,W=(0,t.rotl)(W^b,16),q=q+W|0,Q=(0,t.rotl)(Q^q,12),b=b+Q|0,W=(0,t.rotl)(W^b,8),q=q+W|0,Q=(0,t.rotl)(Q^q,7),B=B+U|0,te=(0,t.rotl)(te^B,16),Z=Z+te|0,U=(0,t.rotl)(U^Z,12),B=B+U|0,te=(0,t.rotl)(te^B,8),Z=Z+te|0,U=(0,t.rotl)(U^Z,7),T=T+P|0,ne=(0,t.rotl)(ne^T,16),K=K+ne|0,P=(0,t.rotl)(P^K,12),T=T+P|0,ne=(0,t.rotl)(ne^T,8),K=K+ne|0,P=(0,t.rotl)(P^K,7),H=H+$|0,Y=(0,t.rotl)(Y^H,16),J=J+Y|0,$=(0,t.rotl)($^J,12),H=H+$|0,Y=(0,t.rotl)(Y^H,8),J=J+Y|0,$=(0,t.rotl)($^J,7);let w=0;h[w++]=b,h[w++]=B,h[w++]=T,h[w++]=H,h[w++]=te,h[w++]=ne,h[w++]=Y,h[w++]=W}e.chacha20orig=(0,t.createCipher)(i,{counterRight:!1,counterLength:8,allowShortKeys:!0}),e.chacha20=(0,t.createCipher)(i,{counterRight:!1,counterLength:4,allowShortKeys:!1}),e.xchacha20=(0,t.createCipher)(i,{counterRight:!1,counterLength:8,extendNonceFn:o,allowShortKeys:!1}),e.chacha8=(0,t.createCipher)(i,{counterRight:!1,counterLength:4,rounds:8}),e.chacha12=(0,t.createCipher)(i,{counterRight:!1,counterLength:4,rounds:12});const s=new Uint8Array(16),a=(p,I)=>{p.update(I);const v=I.length%16;v&&p.update(s.subarray(v))},u=new Uint8Array(32);function d(p,I,v,h,b){const B=p(I,v,u),T=n.poly1305.create(B);b&&a(T,b),a(T,h);const H=(0,r.u64Lengths)(h.length,b?b.length:0,!0);T.update(H);const $=T.digest();return(0,r.clean)(B,H),$}const g=p=>(I,v,h)=>({encrypt(B,T){const H=B.length;T=(0,r.getOutput)(H+16,T,!1),T.set(B);const $=T.subarray(0,-16);p(I,v,$,$,1);const Q=d(p,I,v,$,h);return T.set(Q,H),(0,r.clean)(Q),T},decrypt(B,T){T=(0,r.getOutput)(B.length-16,T,!1);const H=B.subarray(0,-16),$=B.subarray(-16),Q=d(p,I,v,H,h);if(!(0,r.equalBytes)($,Q))throw new Error("invalid tag");return T.set(B.subarray(0,-16)),p(I,v,T,T,1),(0,r.clean)(Q),T}});e._poly1305_aead=g,e.chacha20poly1305=(0,r.wrapCipher)({blockSize:64,nonceLength:12,tagLength:16},(0,e._poly1305_aead)(e.chacha20)),e.xchacha20poly1305=(0,r.wrapCipher)({blockSize:64,nonceLength:24,tagLength:16},(0,e._poly1305_aead)(e.xchacha20))})(gi)),gi}var da;function Sh(){if(da)return Pt;da=1,Object.defineProperty(Pt,"__esModule",{value:!0}),Pt.chacha20=Pt.xchacha20=void 0;var e=Eh(),t=function(r,i,o){return(0,e.xchacha20poly1305)(r,i,o)};Pt.xchacha20=t;var n=function(r,i,o){return(0,e.chacha20poly1305)(r,i,o)};return Pt.chacha20=n,Pt}var fa;function Bh(){return fa||(fa=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.aesDecrypt=e.aesEncrypt=e.symDecrypt=e.symEncrypt=void 0;var t=Xe(),n=Fs(),r=bh(),i=Sh(),o=nr(),s=Qr(),a=function(I,v,h){return d(g,I,v,h)};e.symEncrypt=a;var u=function(I,v,h){return d(p,I,v,h)};e.symDecrypt=u,e.aesEncrypt=e.symEncrypt,e.aesDecrypt=e.symDecrypt;function d(I,v,h,b){var B=(0,o.symmetricAlgorithm)();if(B==="aes-256-gcm")return I(r.aes256gcm,v,h,(0,o.symmetricNonceLength)(),s.AEAD_TAG_LENGTH,b);if(B==="xchacha20")return I(i.xchacha20,v,h,s.XCHACHA20_NONCE_LENGTH,s.AEAD_TAG_LENGTH,b);if(B==="aes-256-cbc")return I(r.aes256cbc,v,h,16,0);throw new Error("Not implemented")}function g(I,v,h,b,B,T){var H=(0,n.randomBytes)(b),$=I(v,H,T),Q=$.encrypt(h);if(B===0)return(0,t.concatBytes)(H,Q);var U=Q.length-B,P=Q.subarray(0,U),K=Q.subarray(U);return(0,t.concatBytes)(H,K,P)}function p(I,v,h,b,B,T){var H=h.subarray(0,b),$=I(v,Uint8Array.from(H),T),Q=h.subarray(b);if(B===0)return $.decrypt(Q);var U=Q.subarray(0,B),P=Q.subarray(B);return $.decrypt((0,t.concatBytes)(P,U))}})(pi)),pi}var ha;function mi(){return ha||(ha=1,(function(e){var t=Ct&&Ct.__createBinding||(Object.create?(function(r,i,o,s){s===void 0&&(s=o);var a=Object.getOwnPropertyDescriptor(i,o);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(r,s,a)}):(function(r,i,o,s){s===void 0&&(s=o),r[s]=i[o]})),n=Ct&&Ct.__exportStar||function(r,i){for(var o in r)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,r,o)};Object.defineProperty(e,"__esModule",{value:!0}),n(ph(),e),n(gh(),e),n(ta(),e),n(Bh(),e)})(Ct)),Ct}var vn={},pa;function ya(){if(pa)return vn;pa=1,Object.defineProperty(vn,"__esModule",{value:!0}),vn.PublicKey=void 0;var e=Xe(),t=mi(),n=(function(){function r(i,o){var s=(0,t.convertPublicKeyFormat)(i,!0,o),a=(0,t.convertPublicKeyFormat)(i,!1,o);this.data=s,this.dataUncompressed=s.length!==a.length?a:null}return r.fromHex=function(i,o){return new r((0,t.hexToPublicKey)(i,o),o)},Object.defineProperty(r.prototype,"_uncompressed",{get:function(){return this.dataUncompressed!==null?this.dataUncompressed:this.data},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"uncompressed",{get:function(){return Buffer.from(this._uncompressed)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"compressed",{get:function(){return Buffer.from(this.data)},enumerable:!1,configurable:!0}),r.prototype.toBytes=function(i){return i===void 0&&(i=!0),i?this.data:this._uncompressed},r.prototype.toHex=function(i){return i===void 0&&(i=!0),(0,e.bytesToHex)(this.toBytes(i))},r.prototype.decapsulate=function(i,o){o===void 0&&(o=!1);var s=this.toBytes(o),a=i.multiply(this,o);return(0,t.getSharedKey)(s,a)},r.prototype.equals=function(i){return(0,e.equalBytes)(this.data,i.data)},r})();return vn.PublicKey=n,vn}var ga;function Ih(){if(ga)return gn;ga=1,Object.defineProperty(gn,"__esModule",{value:!0}),gn.PrivateKey=void 0;var e=Xe(),t=mi(),n=ya(),r=(function(){function i(o,s){if(this.curve=s,o===void 0)this.data=(0,t.getValidSecret)(s);else if((0,t.isValidPrivateKey)(o,s))this.data=o;else throw new Error("Invalid private key");this.publicKey=new n.PublicKey((0,t.getPublicKey)(this.data,s),s)}return i.fromHex=function(o,s){return new i((0,t.decodeHex)(o),s)},Object.defineProperty(i.prototype,"secret",{get:function(){return Buffer.from(this.data)},enumerable:!1,configurable:!0}),i.prototype.toHex=function(){return(0,e.bytesToHex)(this.data)},i.prototype.encapsulate=function(o,s){s===void 0&&(s=!1);var a=this.publicKey.toBytes(s),u=this.multiply(o,s);return(0,t.getSharedKey)(a,u)},i.prototype.multiply=function(o,s){return s===void 0&&(s=!1),(0,t.getSharedPoint)(this.data,o.toBytes(!0),s,this.curve)},i.prototype.equals=function(o){return(0,e.equalBytes)(this.data,o.data)},i})();return gn.PrivateKey=r,gn}var ma;function _a(){return ma||(ma=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PublicKey=e.PrivateKey=void 0;var t=Ih();Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return t.PrivateKey}});var n=ya();Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return n.PublicKey}})})(ei)),ei}var ba;function Lh(){return ba||(ba=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.PublicKey=e.PrivateKey=e.ECIES_CONFIG=void 0,e.encrypt=o,e.decrypt=a;var t=Xe(),n=nr(),r=_a(),i=mi();function o(p,I){return Buffer.from(s(p,I))}function s(p,I){var v=(0,n.ellipticCurve)(),h=new r.PrivateKey(void 0,v),b=p instanceof Uint8Array?new r.PublicKey(p,v):r.PublicKey.fromHex(p,v),B=h.encapsulate(b,(0,n.isHkdfKeyCompressed)()),T=h.publicKey.toBytes((0,n.isEphemeralKeyCompressed)()),H=(0,i.symEncrypt)(B,I);return(0,t.concatBytes)(T,H)}function a(p,I){return Buffer.from(u(p,I))}function u(p,I){var v=(0,n.ellipticCurve)(),h=p instanceof Uint8Array?new r.PrivateKey(p,v):r.PrivateKey.fromHex(p,v),b=(0,n.ephemeralKeySize)(),B=new r.PublicKey(I.subarray(0,b),v),T=I.subarray(b),H=B.decapsulate(h,(0,n.isHkdfKeyCompressed)());return(0,i.symDecrypt)(H,T)}var d=nr();Object.defineProperty(e,"ECIES_CONFIG",{enumerable:!0,get:function(){return d.ECIES_CONFIG}});var g=_a();Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return g.PrivateKey}}),Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return g.PublicKey}}),e.utils={aesEncrypt:i.aesEncrypt,aesDecrypt:i.aesDecrypt,symEncrypt:i.symEncrypt,symDecrypt:i.symDecrypt,decodeHex:i.decodeHex,getValidSecret:i.getValidSecret,remove0x:i.remove0x}})(Yr)),Yr}var _i=Lh();typeof globalThis.Buffer>"u"&&(globalThis.Buffer=ih.Buffer),_i.ECIES_CONFIG.ellipticCurve="secp256k1",_i.ECIES_CONFIG.symmetricAlgorithm="aes-256-gcm";const xh=new TextEncoder;function Ah(e,t){return _i.encrypt(e,xh.encode(t)).toString("hex")}const Ch=["CORE_SDK",...Yf()];async function wa(e,t,n,r){if(!e||!t)throw new Error("appId and secret are required");try{const i=await Xf(),o=await Oh(n,r),{identifier:s,sdkVersion:a,...u}=o,d={"Content-Type":"text/plain",sdkVersion:a},g=Ph(i,{appId:e,secret:t,identifier:s,timestamp:Date.now(),products:Ch,...u}),p=await fetch(Ko,{method:"POST",body:g,headers:d});if(!p.ok){const B=await p.json(),{code:T,message:H}=B;throw p.status===401&&T===7001005?(Ss(),new Error(H)):new Error(H||`HTTP error! status: ${p.status}`)}const I=await p.json(),{accessToken:v,expiresIn:h}=I,b=Date.now()+(h-90)*1e3;return{accessToken:v,expiredTime:b}}catch(i){throw i instanceof Error?new Error(`Failed to get access token: ${i.message}`,{cause:i}):new Error(`Failed to get access token: ${String(i)}`)}}const Th=typeof window<"u"&&window.location?.hostname?window.location.hostname:"restriction.test.example.com";async function Oh(e,t=Th){return e??Rh(t)}async function Rh(e){return{identifier:await Is(),origin:e,keyPlatform:"WEB",sdkVersion:pn.version}}function Ph(e,t){return Ah(e,JSON.stringify(t))}var Fh={value:()=>{}};function Wt(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new ir(n)}function ir(e){this._=e}function kh(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}ir.prototype=Wt.prototype={constructor:ir,on:function(e,t){var n=this._,r=kh(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(e=r[o]).type)&&(i=Mh(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<s;)if(i=(e=r[o]).type)n[i]=va(n[i],e.name,t);else if(t==null)for(i in n)n[i]=va(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new ir(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,o=r.length;i<o;++i)r[i].value.apply(t,n)}};function Mh(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function va(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=Fh,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}const bi="tokenUpdated",Hh={maxRetries:3,initialDelay:500};class nt{static instance;_appId="";_secret="";_platform;_accessToken="";_expiredTime=0;_version="";_identifier="";_webIdentifier="";_tokenGetter;_tokenPending=null;_dispatch=Wt(bi);_globalDispatcher;_theme=null;constructor(){}static getInstance(){return nt.instance||(nt.instance=new nt),nt.instance}async setAccessByAppKey(t){this._tokenGetter=this._fetchToken.bind(this);const{appId:n,secret:r,platform:i}=t;this._appId=n,this._secret=r,this._platform=i,this._version=i?.sdkVersion||pn.version,this._identifier=i?.identifier||await this.getWebIdentifier()}setTokenGetter(t){this._tokenGetter=t}async setupTokenManager(){if(!this._tokenGetter)throw new Error("getTokenAsync() is not set!");const{maxRetries:t,initialDelay:n}=Hh;let r=0;for(;r<=t;)try{const i=await this._tokenGetter();if(i){this._updateContext(i);return}}catch(i){if(r++,r>t)throw this._globalDispatcher.call("unauthorized"),i;await this._retryDelay(r,n)}}getSdkVersion(){return this._version||pn.version}async getIdentifier(){return this._identifier||await this.getWebIdentifier()}async getAccessToken(){if(this._accessToken&&!this._isTokenExpired)return this._accessToken;if(this._tokenPending)return this._tokenPending;if(!this._tokenGetter)throw new Error("Token getter not configured. Call setGetTokenAsync() first.");return this._tokenPending=this._tokenGetter().then(t=>(this._updateContext(t),this._dispatch.call(bi,null,t.accessToken),t.accessToken)).catch(t=>{throw this._tokenPending=null,t}).finally(()=>{this._tokenPending=null}),this._tokenPending}async getWebIdentifier(){if(!this._webIdentifier){const n=await(await vs.load()).get();this._webIdentifier=n.visitorId}return this._webIdentifier}on(t,n){return this._dispatch.on(t,n),{off:()=>this._dispatch.on(t,null)}}setGlobalDispatcher(t){this._globalDispatcher=t}getGlobalDispatcher(){return this._globalDispatcher}get theme(){return this._theme}setTheme(t){this._theme=t}clearState(){this._appId="",this._secret="",this._platform=void 0,this._webIdentifier="",this._tokenPending=null,this._tokenGetter=void 0,this._accessToken="",this._expiredTime=0,this._version="",this._identifier=""}get _isTokenExpired(){return this._expiredTime<=Date.now()}_updateContext(t){const{accessToken:n,expiredTime:r,identifier:i,sdkVersion:o}=t;this._accessToken=n,this._expiredTime=r,i!==void 0&&(this._identifier=i),o!==void 0&&(this._version=o)}_fetchToken(){return wa(this._appId,this._secret,this._platform)}async _retryDelay(t,n){const r=n*Math.pow(2,t-1);return console.warn(`Retrying in ${r} ms... (Attempt ${t})`),new Promise(i=>setTimeout(i,r))}}const or=nt.getInstance();class st{static instance;_axios;_isRefreshingToken=!1;_retryCount=0;constructor(){this._axios=Pe.create({baseURL:Go}),this._setupInterceptors()}static getInstance(){return st.instance||(st.instance=new st),st.instance}async get(t){return this._axios.get(t)}async post(t,n){return this._axios.post(t,n)}async getRequestHeaders(){return{"Content-Type":"application/json",sdkVersion:or.getSdkVersion(),identifier:await or.getIdentifier(),token:await or.getAccessToken()}}_setupInterceptors(){this._axios.interceptors.request.use(async t=>{const n=await this.getRequestHeaders();return t.headers=Object.assign({},t.headers,n),t},t=>{throw t}),this._axios.interceptors.response.use(null,async t=>{if(t.response?.status!==401||this._retryCount>=3)throw this._retryCount=0,t;if(this._isRefreshingToken)throw t;or.getGlobalDispatcher().call("unauthorized"),this._isRefreshingToken=!0,this._retryCount++;try{const n=await this.getRequestHeaders(),r=t.config;return r.headers=Object.assign({},r.headers,n),this._axios.request(r)}catch(n){throw n}finally{this._isRefreshingToken=!1}})}}function at(e){if(!e)return null;const n=(Array.isArray(e)?e:[e]).filter(Le).map(r=>r.trim());return n.length>0?n.join(","):null}function Le(e){return typeof e=="string"&&e.trim().length>0}function Ft(e){return Array.isArray(e)&&e.length===2&&e.every(t=>typeof t=="number")}function En(e){return Array.isArray(e)&&e.length===2&&e.every(t=>Ft(t))}function Yt(e){return typeof e=="number"&&e>0}function Uh(){this.__data__=[],this.size=0}function wi(e,t){return e===t||e!==e&&t!==t}function sr(e,t){for(var n=e.length;n--;)if(wi(e[n][0],t))return n;return-1}var Nh=Array.prototype,Dh=Nh.splice;function $h(e){var t=this.__data__,n=sr(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Dh.call(t,n,1),--this.size,!0}function Vh(e){var t=this.__data__,n=sr(t,e);return n<0?void 0:t[n][1]}function jh(e){return sr(this.__data__,e)>-1}function qh(e,t){var n=this.__data__,r=sr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function ft(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}ft.prototype.clear=Uh,ft.prototype.delete=$h,ft.prototype.get=Vh,ft.prototype.has=jh,ft.prototype.set=qh;function Kh(){this.__data__=new ft,this.size=0}function Gh(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function zh(e){return this.__data__.get(e)}function Zh(e){return this.__data__.has(e)}var Ea=typeof global=="object"&&global&&global.Object===Object&&global,Wh=typeof self=="object"&&self&&self.Object===Object&&self,ct=Ea||Wh||Function("return this")(),Et=ct.Symbol,Sa=Object.prototype,Yh=Sa.hasOwnProperty,Xh=Sa.toString,Sn=Et?Et.toStringTag:void 0;function Jh(e){var t=Yh.call(e,Sn),n=e[Sn];try{e[Sn]=void 0;var r=!0}catch{}var i=Xh.call(e);return r&&(t?e[Sn]=n:delete e[Sn]),i}var Qh=Object.prototype,e0=Qh.toString;function t0(e){return e0.call(e)}var n0="[object Null]",r0="[object Undefined]",Ba=Et?Et.toStringTag:void 0;function Xt(e){return e==null?e===void 0?r0:n0:Ba&&Ba in Object(e)?Jh(e):t0(e)}function ht(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var i0="[object AsyncFunction]",o0="[object Function]",s0="[object GeneratorFunction]",a0="[object Proxy]";function Ia(e){if(!ht(e))return!1;var t=Xt(e);return t==o0||t==s0||t==i0||t==a0}var vi=ct["__core-js_shared__"],La=(function(){var e=/[^.]+$/.exec(vi&&vi.keys&&vi.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function c0(e){return!!La&&La in e}var l0=Function.prototype,u0=l0.toString;function kt(e){if(e!=null){try{return u0.call(e)}catch{}try{return e+""}catch{}}return""}var d0=/[\\^$.*+?()[\]{}|]/g,f0=/^\[object .+?Constructor\]$/,h0=Function.prototype,p0=Object.prototype,y0=h0.toString,g0=p0.hasOwnProperty,m0=RegExp("^"+y0.call(g0).replace(d0,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function _0(e){if(!ht(e)||c0(e))return!1;var t=Ia(e)?m0:f0;return t.test(kt(e))}function b0(e,t){return e?.[t]}function Mt(e,t){var n=b0(e,t);return _0(n)?n:void 0}var Bn=Mt(ct,"Map"),In=Mt(Object,"create");function w0(){this.__data__=In?In(null):{},this.size=0}function v0(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var E0="__lodash_hash_undefined__",S0=Object.prototype,B0=S0.hasOwnProperty;function I0(e){var t=this.__data__;if(In){var n=t[e];return n===E0?void 0:n}return B0.call(t,e)?t[e]:void 0}var L0=Object.prototype,x0=L0.hasOwnProperty;function A0(e){var t=this.__data__;return In?t[e]!==void 0:x0.call(t,e)}var C0="__lodash_hash_undefined__";function T0(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=In&&t===void 0?C0:t,this}function Ht(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ht.prototype.clear=w0,Ht.prototype.delete=v0,Ht.prototype.get=I0,Ht.prototype.has=A0,Ht.prototype.set=T0;function O0(){this.size=0,this.__data__={hash:new Ht,map:new(Bn||ft),string:new Ht}}function R0(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function ar(e,t){var n=e.__data__;return R0(t)?n[typeof t=="string"?"string":"hash"]:n.map}function P0(e){var t=ar(this,e).delete(e);return this.size-=t?1:0,t}function F0(e){return ar(this,e).get(e)}function k0(e){return ar(this,e).has(e)}function M0(e,t){var n=ar(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function pt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}pt.prototype.clear=O0,pt.prototype.delete=P0,pt.prototype.get=F0,pt.prototype.has=k0,pt.prototype.set=M0;var H0=200;function U0(e,t){var n=this.__data__;if(n instanceof ft){var r=n.__data__;if(!Bn||r.length<H0-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new pt(r)}return n.set(e,t),this.size=n.size,this}function yt(e){var t=this.__data__=new ft(e);this.size=t.size}yt.prototype.clear=Kh,yt.prototype.delete=Gh,yt.prototype.get=zh,yt.prototype.has=Zh,yt.prototype.set=U0;var N0="__lodash_hash_undefined__";function D0(e){return this.__data__.set(e,N0),this}function $0(e){return this.__data__.has(e)}function Ln(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new pt;++t<n;)this.add(e[t])}Ln.prototype.add=Ln.prototype.push=D0,Ln.prototype.has=$0;function V0(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function xa(e,t){return e.has(t)}var j0=1,q0=2;function Aa(e,t,n,r,i,o){var s=n&j0,a=e.length,u=t.length;if(a!=u&&!(s&&u>a))return!1;var d=o.get(e),g=o.get(t);if(d&&g)return d==t&&g==e;var p=-1,I=!0,v=n&q0?new Ln:void 0;for(o.set(e,t),o.set(t,e);++p<a;){var h=e[p],b=t[p];if(r)var B=s?r(b,h,p,t,e,o):r(h,b,p,e,t,o);if(B!==void 0){if(B)continue;I=!1;break}if(v){if(!V0(t,function(T,H){if(!xa(v,H)&&(h===T||i(h,T,n,r,o)))return v.push(H)})){I=!1;break}}else if(!(h===b||i(h,b,n,r,o))){I=!1;break}}return o.delete(e),o.delete(t),I}var Ca=ct.Uint8Array;function K0(e){var t=-1,n=Array(e.size);return e.forEach(function(r,i){n[++t]=[i,r]}),n}function Ei(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var G0=1,z0=2,Z0="[object Boolean]",W0="[object Date]",Y0="[object Error]",X0="[object Map]",J0="[object Number]",Q0="[object RegExp]",ep="[object Set]",tp="[object String]",np="[object Symbol]",rp="[object ArrayBuffer]",ip="[object DataView]",Ta=Et?Et.prototype:void 0,Si=Ta?Ta.valueOf:void 0;function op(e,t,n,r,i,o,s){switch(n){case ip:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case rp:return!(e.byteLength!=t.byteLength||!o(new Ca(e),new Ca(t)));case Z0:case W0:case J0:return wi(+e,+t);case Y0:return e.name==t.name&&e.message==t.message;case Q0:case tp:return e==t+"";case X0:var a=K0;case ep:var u=r&G0;if(a||(a=Ei),e.size!=t.size&&!u)return!1;var d=s.get(e);if(d)return d==t;r|=z0,s.set(e,t);var g=Aa(a(e),a(t),r,i,o,s);return s.delete(e),g;case np:if(Si)return Si.call(e)==Si.call(t)}return!1}function Oa(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var gt=Array.isArray;function Ra(e,t,n){var r=t(e);return gt(e)?r:Oa(r,n(e))}function sp(e,t){for(var n=-1,r=e==null?0:e.length,i=0,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o}function Pa(){return[]}var ap=Object.prototype,cp=ap.propertyIsEnumerable,Fa=Object.getOwnPropertySymbols,ka=Fa?function(e){return e==null?[]:(e=Object(e),sp(Fa(e),function(t){return cp.call(e,t)}))}:Pa;function lp(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Jt(e){return e!=null&&typeof e=="object"}var up="[object Arguments]";function Ma(e){return Jt(e)&&Xt(e)==up}var Ha=Object.prototype,dp=Ha.hasOwnProperty,fp=Ha.propertyIsEnumerable,Ua=Ma((function(){return arguments})())?Ma:function(e){return Jt(e)&&dp.call(e,"callee")&&!fp.call(e,"callee")};function hp(){return!1}var Na=typeof _e=="object"&&_e&&!_e.nodeType&&_e,Da=Na&&typeof module=="object"&&module&&!module.nodeType&&module,pp=Da&&Da.exports===Na,$a=pp?ct.Buffer:void 0,yp=$a?$a.isBuffer:void 0,Bi=yp||hp,gp=9007199254740991,mp=/^(?:0|[1-9]\d*)$/;function Ii(e,t){var n=typeof e;return t=t??gp,!!t&&(n=="number"||n!="symbol"&&mp.test(e))&&e>-1&&e%1==0&&e<t}var _p=9007199254740991;function Li(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=_p}var bp="[object Arguments]",wp="[object Array]",vp="[object Boolean]",Ep="[object Date]",Sp="[object Error]",Bp="[object Function]",Ip="[object Map]",Lp="[object Number]",xp="[object Object]",Ap="[object RegExp]",Cp="[object Set]",Tp="[object String]",Op="[object WeakMap]",Rp="[object ArrayBuffer]",Pp="[object DataView]",Fp="[object Float32Array]",kp="[object Float64Array]",Mp="[object Int8Array]",Hp="[object Int16Array]",Up="[object Int32Array]",Np="[object Uint8Array]",Dp="[object Uint8ClampedArray]",$p="[object Uint16Array]",Vp="[object Uint32Array]",Ce={};Ce[Fp]=Ce[kp]=Ce[Mp]=Ce[Hp]=Ce[Up]=Ce[Np]=Ce[Dp]=Ce[$p]=Ce[Vp]=!0,Ce[bp]=Ce[wp]=Ce[Rp]=Ce[vp]=Ce[Pp]=Ce[Ep]=Ce[Sp]=Ce[Bp]=Ce[Ip]=Ce[Lp]=Ce[xp]=Ce[Ap]=Ce[Cp]=Ce[Tp]=Ce[Op]=!1;function jp(e){return Jt(e)&&Li(e.length)&&!!Ce[Xt(e)]}function qp(e){return function(t){return e(t)}}var Va=typeof _e=="object"&&_e&&!_e.nodeType&&_e,xn=Va&&typeof module=="object"&&module&&!module.nodeType&&module,Kp=xn&&xn.exports===Va,xi=Kp&&Ea.process,ja=(function(){try{var e=xn&&xn.require&&xn.require("util").types;return e||xi&&xi.binding&&xi.binding("util")}catch{}})(),qa=ja&&ja.isTypedArray,Ka=qa?qp(qa):jp,Gp=Object.prototype,zp=Gp.hasOwnProperty;function Ga(e,t){var n=gt(e),r=!n&&Ua(e),i=!n&&!r&&Bi(e),o=!n&&!r&&!i&&Ka(e),s=n||r||i||o,a=s?lp(e.length,String):[],u=a.length;for(var d in e)(t||zp.call(e,d))&&!(s&&(d=="length"||i&&(d=="offset"||d=="parent")||o&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||Ii(d,u)))&&a.push(d);return a}var Zp=Object.prototype;function za(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Zp;return e===n}function Za(e,t){return function(n){return e(t(n))}}var Wp=Za(Object.keys,Object),Yp=Object.prototype,Xp=Yp.hasOwnProperty;function Jp(e){if(!za(e))return Wp(e);var t=[];for(var n in Object(e))Xp.call(e,n)&&n!="constructor"&&t.push(n);return t}function Wa(e){return e!=null&&Li(e.length)&&!Ia(e)}function Ya(e){return Wa(e)?Ga(e):Jp(e)}function Xa(e){return Ra(e,Ya,ka)}var Qp=1,ey=Object.prototype,ty=ey.hasOwnProperty;function ny(e,t,n,r,i,o){var s=n&Qp,a=Xa(e),u=a.length,d=Xa(t),g=d.length;if(u!=g&&!s)return!1;for(var p=u;p--;){var I=a[p];if(!(s?I in t:ty.call(t,I)))return!1}var v=o.get(e),h=o.get(t);if(v&&h)return v==t&&h==e;var b=!0;o.set(e,t),o.set(t,e);for(var B=s;++p<u;){I=a[p];var T=e[I],H=t[I];if(r)var $=s?r(H,T,I,t,e,o):r(T,H,I,e,t,o);if(!($===void 0?T===H||i(T,H,n,r,o):$)){b=!1;break}B||(B=I=="constructor")}if(b&&!B){var Q=e.constructor,U=t.constructor;Q!=U&&"constructor"in e&&"constructor"in t&&!(typeof Q=="function"&&Q instanceof Q&&typeof U=="function"&&U instanceof U)&&(b=!1)}return o.delete(e),o.delete(t),b}var Ai=Mt(ct,"DataView"),Ci=Mt(ct,"Promise"),Qt=Mt(ct,"Set"),Ti=Mt(ct,"WeakMap"),Ja="[object Map]",ry="[object Object]",Qa="[object Promise]",ec="[object Set]",tc="[object WeakMap]",nc="[object DataView]",iy=kt(Ai),oy=kt(Bn),sy=kt(Ci),ay=kt(Qt),cy=kt(Ti),St=Xt;(Ai&&St(new Ai(new ArrayBuffer(1)))!=nc||Bn&&St(new Bn)!=Ja||Ci&&St(Ci.resolve())!=Qa||Qt&&St(new Qt)!=ec||Ti&&St(new Ti)!=tc)&&(St=function(e){var t=Xt(e),n=t==ry?e.constructor:void 0,r=n?kt(n):"";if(r)switch(r){case iy:return nc;case oy:return Ja;case sy:return Qa;case ay:return ec;case cy:return tc}return t});var ly=1,rc="[object Arguments]",ic="[object Array]",cr="[object Object]",uy=Object.prototype,oc=uy.hasOwnProperty;function dy(e,t,n,r,i,o){var s=gt(e),a=gt(t),u=s?ic:St(e),d=a?ic:St(t);u=u==rc?cr:u,d=d==rc?cr:d;var g=u==cr,p=d==cr,I=u==d;if(I&&Bi(e)){if(!Bi(t))return!1;s=!0,g=!1}if(I&&!g)return o||(o=new yt),s||Ka(e)?Aa(e,t,n,r,i,o):op(e,t,u,n,r,i,o);if(!(n&ly)){var v=g&&oc.call(e,"__wrapped__"),h=p&&oc.call(t,"__wrapped__");if(v||h){var b=v?e.value():e,B=h?t.value():t;return o||(o=new yt),i(b,B,n,r,o)}}return I?(o||(o=new yt),ny(e,t,n,r,i,o)):!1}function Oi(e,t,n,r,i){return e===t?!0:e==null||t==null||!Jt(e)&&!Jt(t)?e!==e&&t!==t:dy(e,t,n,r,Oi,i)}var fy=1,hy=2;function py(e,t,n,r){var i=n.length,o=i;if(e==null)return!o;for(e=Object(e);i--;){var s=n[i];if(s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<o;){s=n[i];var a=s[0],u=e[a],d=s[1];if(s[2]){if(u===void 0&&!(a in e))return!1}else{var g=new yt,p;if(!(p===void 0?Oi(d,u,fy|hy,r,g):p))return!1}}return!0}function sc(e){return e===e&&!ht(e)}function yy(e){for(var t=Ya(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,sc(i)]}return t}function ac(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function gy(e){var t=yy(e);return t.length==1&&t[0][2]?ac(t[0][0],t[0][1]):function(n){return n===e||py(n,e,t)}}var my="[object Symbol]";function An(e){return typeof e=="symbol"||Jt(e)&&Xt(e)==my}var _y=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,by=/^\w*$/;function Ri(e,t){if(gt(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||An(e)?!0:by.test(e)||!_y.test(e)||t!=null&&e in Object(t)}var wy="Expected a function";function Pi(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(wy);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Pi.Cache||pt),n}Pi.Cache=pt;var vy=500;function Ey(e){var t=Pi(e,function(r){return n.size===vy&&n.clear(),r}),n=t.cache;return t}var Sy=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,By=/\\(\\)?/g,Iy=Ey(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Sy,function(n,r,i,o){t.push(i?o.replace(By,"$1"):r||n)}),t});function cc(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var lc=Et?Et.prototype:void 0,uc=lc?lc.toString:void 0;function dc(e){if(typeof e=="string")return e;if(gt(e))return cc(e,dc)+"";if(An(e))return uc?uc.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function fc(e){return e==null?"":dc(e)}function lr(e,t){return gt(e)?e:Ri(e,t)?[e]:Iy(fc(e))}function Cn(e){if(typeof e=="string"||An(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Fi(e,t){t=lr(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Cn(t[n++])];return n&&n==r?e:void 0}function Ly(e,t,n){var r=e==null?void 0:Fi(e,t);return r===void 0?n:r}function xy(e,t){return e!=null&&t in Object(e)}function Ay(e,t,n){t=lr(t,e);for(var r=-1,i=t.length,o=!1;++r<i;){var s=Cn(t[r]);if(!(o=e!=null&&n(e,s)))break;e=e[s]}return o||++r!=i?o:(i=e==null?0:e.length,!!i&&Li(i)&&Ii(s,i)&&(gt(e)||Ua(e)))}function Cy(e,t){return e!=null&&Ay(e,t,xy)}var Ty=1,Oy=2;function Ry(e,t){return Ri(e)&&sc(t)?ac(Cn(e),t):function(n){var r=Ly(n,e);return r===void 0&&r===t?Cy(n,e):Oi(t,r,Ty|Oy)}}function Py(e){return e}function Fy(e){return function(t){return t?.[e]}}function ky(e){return function(t){return Fi(t,e)}}function My(e){return Ri(e)?Fy(Cn(e)):ky(e)}function ur(e){return typeof e=="function"?e:e==null?Py:typeof e=="object"?gt(e)?Ry(e[0],e[1]):gy(e):My(e)}var Hy="Expected a function";function Uy(e){if(typeof e!="function")throw new TypeError(Hy);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}var hc=(function(){try{var e=Mt(Object,"defineProperty");return e({},"",{}),e}catch{}})();function Ny(e,t,n){t=="__proto__"&&hc?hc(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var Dy=Object.prototype,$y=Dy.hasOwnProperty;function Vy(e,t,n){var r=e[t];(!($y.call(e,t)&&wi(r,n))||n===void 0&&!(t in e))&&Ny(e,t,n)}function jy(e,t,n,r){if(!ht(e))return e;t=lr(t,e);for(var i=-1,o=t.length,s=o-1,a=e;a!=null&&++i<o;){var u=Cn(t[i]),d=n;if(u==="__proto__"||u==="constructor"||u==="prototype")return e;if(i!=s){var g=a[u];d=void 0,d===void 0&&(d=ht(g)?g:Ii(t[i+1])?[]:{})}Vy(a,u,d),a=a[u]}return e}function qy(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var s=t[r],a=Fi(e,s);n(a,s)&&jy(o,lr(s,e),a)}return o}var Ky=Za(Object.getPrototypeOf,Object),Gy=Object.getOwnPropertySymbols,zy=Gy?function(e){for(var t=[];e;)Oa(t,ka(e)),e=Ky(e);return t}:Pa;function Zy(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Wy=Object.prototype,Yy=Wy.hasOwnProperty;function Xy(e){if(!ht(e))return Zy(e);var t=za(e),n=[];for(var r in e)r=="constructor"&&(t||!Yy.call(e,r))||n.push(r);return n}function Jy(e){return Wa(e)?Ga(e,!0):Xy(e)}function Qy(e){return Ra(e,Jy,zy)}function eg(e,t){if(e==null)return{};var n=cc(Qy(e),function(r){return[r]});return t=ur(t),qy(e,n,function(r,i){return t(r,i[0])})}function ki(e,t){return eg(e,Uy(ur(t)))}const tg=["opening_hours","description","phone","website","email","appURL","icon"];class pc{_api="/api/v5/venues";_request=st.getInstance();constructor(){}searchByIds(t){const n=at(t);if(!n)throw new Error("Please input venue id at least one.");const r=`${this._api}/${n}`;return this._changedRes(r)}searchByDistance(t){const{center:n,distance:r,keywords:i="",offset:o=Ge,page:s=ze}=t;if(!Ft(n))throw new Error("Invalid center parameter. Expected an array of two numbers.");if(!Yt(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",n.join(",")),a.set("distance",String(r)),a.set("offset",String(o)),a.set("page",String(s)),Le(i)&&a.set("keywords",i);const u=`${this._api}?${a.toString()}`;return this._changedRes(u)}searchByBounds(t){const{keywords:n,bounds:r,offset:i=Ge,page:o=ze}=t;if(!En(r))throw new Error("'bounds' must be an array of two arrays, each containing two numbers.");const s=new URLSearchParams;s.set("bbox",r.flat().join()),s.set("offset",String(i)),s.set("page",String(o)),Le(n)&&s.set("keywords",n);const a=`${this._api}?${s.toString()}`;return this._changedRes(a)}searchByGlobal(t){const{keywords:n,offset:r=Ge,page:i=ze}=t,o=new URLSearchParams;o.set("offset",String(r)),o.set("page",String(i)),Le(n)&&o.set("keywords",n);const s=`${this._api}?${o.toString()}`;return this._changedRes(s)}searchBySharedFloorId(t){if(!Le(t))throw new Error("Please input correct sharedFloorId.");const n=`${this._api}/shared_floors/${t}`;return this._changedRes(n)}search(t){const n=new URLSearchParams;return Object.entries(t).forEach(([r,i])=>{r==="bounds"?n.set("bbox",i.flat().join()):r==="center"?n.set("center",i.join()):n.set(r,String(i))}),this._changedRes(`${this._api}?${n.toString()}`)}async _changedRes(t){return this._request.get(t).then(n=>{if(n.data?.result?.venues){const r=n.data.result.venues.map(i=>ki(i,(o,s)=>tg.includes(s)));return{...n,data:{...n.data,result:{...n.data.result,venues:r}}}}return n})}}const ng=["specialHours","businessStatus","serviceHours","keywords","siteCode","refPhotoId","totalPhotoCount","photos","description"];class yc{_api="/api/v5/buildings";_request=st.getInstance();constructor(){}searchByIds(t){const n=at(t);if(!n)throw new Error("Please input building id at least one.");const r=`${this._api}/${n}`;return this._changedRes(r)}searchByDistance(t){const{center:n,distance:r,keywords:i="",offset:o=Ge,page:s=ze}=t;if(!Ft(n))throw new Error("Invalid center parameter. Expected an array of two numbers.");if(!Yt(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",n.join(",")),a.set("distance",String(r)),a.set("offset",String(o)),a.set("page",String(s)),Le(i)&&a.set("keywords",i);const u=`${this._api}?${a.toString()}`;return this._changedRes(u)}searchByBounds(t){const{bounds:n,offset:r=Ge,page:i=ze,keywords:o}=t;if(!En(n))throw new Error("'bounds' must be an array of two arrays, each containing two numbers.");const s=new URLSearchParams;s.set("bbox",n.flat().join()),s.set("offset",String(r)),s.set("page",String(i)),Le(o)&&s.set("keywords",o);const a=`${this._api}?${s.toString()}`;return this._changedRes(a)}searchByGlobal(t){const{keywords:n,offset:r=Ge,page:i=ze}=t,o=new URLSearchParams;o.set("searchGlobal",String(!0)),o.set("offset",String(r)),o.set("page",String(i)),Le(n)&&o.set("keywords",n);const s=`${this._api}?${o.toString()}`;return this._changedRes(s)}searchByFloorId(t){if(!Le(t))throw new Error("'floorId' cannot be empty.");return this._changedRes(`${this._api}/floors/${t}`)}search(t){const n=new URLSearchParams;return Object.entries(t).forEach(([r,i])=>{r==="bounds"?n.set("bbox",i.flat().join()):r==="center"?n.set("center",i.join()):n.set(r,String(i))}),this._changedRes(`${this._api}?${n.toString()}`)}async _changedRes(t){return this._request.get(t).then(n=>{if(n.data?.result?.buildings){const r=n.data.result.buildings.map(i=>ki(i,(o,s)=>ng.includes(s)));return{...n,data:{...n.data,result:{...n.data.result,buildings:r}}}}return n})}}const rg=["specialHours","businessStatus","serviceHours","keywords","siteCode","refPhotoId","totalPhotoCount","photos","icon"];class gc{_poisApi="/api/v5/pois";_categoriesGroupApi="/api/v5/categories/group";_request=st.getInstance();constructor(){}searchByIds(t){const n=at(t);if(!n)throw new Error("Invalid ids parameter. Expected a non-empty string or an array of strings.");const r=`${this._poisApi}/${n}`;return this._changedRes(r)}searchByDistance(t){const{center:n,distance:r,keywords:i="",offset:o=Ge,page:s=ze}=t;if(!Ft(n))throw new Error("Invalid center parameter. Expected an array of two numbers.");if(!Yt(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",n.join(",")),a.set("distance",String(Math.round(r))),a.set("offset",String(o)),a.set("page",String(s)),Le(i)&&a.set("keywords",i);const u=`${this._poisApi}?${a.toString()}`;return this._changedRes(u)}searchByBounds(t){const{bounds:n,offset:r=Ge,page:i=ze,keywords:o,orderBy:s}=t;if(!En(n))throw new Error("'bounds' must be an array of two arrays, each containing two numbers.");const a=new URLSearchParams;a.set("bbox",n.flat().join()),a.set("offset",String(r)),a.set("page",String(i)),Le(o)&&a.set("keywords",o),s&&a.set("orderBy",s);const u=`${this._poisApi}?${a.toString()}`;return this._changedRes(u)}searchByBuilding(t){const{buildingId:n,offset:r=Ge,page:i=ze,keywords:o,orderBy:s}=t;if(!Le(n))throw new Error("'buildingId' must be a non-empty string.");const a=new URLSearchParams;a.set("buildingId",n),a.set("offset",String(r)),a.set("page",String(i)),Le(o)&&a.set("keywords",o),s&&a.set("orderBy",s);const u=`${this._poisApi}?${a.toString()}`;return this._changedRes(u)}searchByVenue(t){const{venueId:n,offset:r=Ge,page:i=ze,keywords:o,orderBy:s}=t;if(!Le(n))throw new Error("'venueId' must be a non-empty string.");const a=new URLSearchParams;a.set("venueId",n),a.set("offset",String(r)),a.set("page",String(i)),Le(o)&&a.set("keywords",o),s&&a.set("orderBy",s);const u=`${this._poisApi}?${a.toString()}`;return this._changedRes(u)}searchByFloor(t){let n=null,r=null;if("floorId"in t&&Le(t.floorId)?(n="floorId",r=t.floorId):"sharedFloorId"in t&&Le(t.sharedFloorId)&&(n="sharedFloorId",r=t.sharedFloorId),!n||!r)throw new Error("Either 'floorId' or 'sharedFloorId' must be a non-empty string.");const{offset:i=Ge,page:o=ze,keywords:s,orderBy:a}=t,u=new URLSearchParams;u.set("offset",String(i)),u.set("page",String(o)),u.set(n,r),Le(s)&&u.set("keywords",s),a&&u.set("orderBy",a);const d=`${this._poisApi}?${u.toString()}`;return this._changedRes(d)}searchByFloors(t){let n=null,r=null;const i="floorIds"in t?at(t.floorIds):null,o="sharedFloorIds"in t?at(t.sharedFloorIds):null;if(i?(n="floorId",r=i):o&&(n="sharedFloorId",r=o),!n||!r)throw new Error("Either 'floorIds' or 'sharedFloorIds' must be a non-empty array.");const{offset:s=Ge,page:a=ze,keywords:u,orderBy:d}=t,g=new URLSearchParams;g.set("offset",String(s)),g.set("page",String(a)),g.set(n,r),Le(u)&&g.set("keywords",u),d&&g.set("orderBy",d);const p=`${this._poisApi}?${g.toString()}`;return this._changedRes(p)}searchByOrientation(t){const{center:n,angle:r,distance:i,distanceSearchType:o=Ir.POINT}=t;if(!Ft(n))throw new Error("Invalid center parameter. Expected an array of two numbers.");if(!Yt(i)||i>100)throw new Error("Invalid distance parameter. Expected a positive number and no more than 100.");if(!Yt(r))throw new Error("Invalid angle parameter. Expected a positive number.");const s=new URLSearchParams;if("ordinal"in t){if(!Le(t.ordinal))throw new Error("'ordinal' must be a non-empty string.");s.set("ordinal",t.ordinal)}else if("floorId"in t){if(!Le(t.floorId))throw new Error("'floorId' must be a non-empty string.");s.set("floorId",t.floorId)}else if("buildingId"in t){if(!Le(t.buildingId))throw new Error("'buildingId' must be a non-empty string.");s.set("buildingId",t.buildingId)}else throw new Error("Either 'ordinal', 'floorId', or 'buildingId' must be provided.");s.set("center",n.join()),s.set("angle",String(Math.round(r))),s.set("distance",String(i)),s.set("distanceSearchType",o);const a=`${this._poisApi}/orientation?${s.toString()}`;return this._request.get(a)}searchByCategory(t){const{center:n,distance:r,page:i=ze,offset:o=Ge}=t;if(!Ft(n))throw new Error("Invalid center parameter. Expected an array of two numbers.");if(!Yt(r)||r>1e4)throw new Error("Invalid distance parameter. Expected a positive number and no more than 10000");const s=new URLSearchParams;if("category"in t&&Le(t.category))s.set("category",String(t.category));else if("excludedCategories"in t&&at(t.excludedCategories))s.set("excludeCategories",at(t.excludedCategories));else throw new Error("Either 'category' or 'excludedCategories' must be provided.");s.set("center",n.join(",")),s.set("distance",String(r)),s.set("page",String(i)),s.set("offset",String(o));const a=`${this._poisApi}?${s.toString()}`;return this._changedRes(a)}searchCategories(t){const n=new URLSearchParams;if("floorId"in t&&Le(t.floorId)?n.set("floorId",t.floorId):"buildingId"in t&&Le(t.buildingId)?n.set("buildingId",t.buildingId):"sharedFloorId"in t&&Le(t.sharedFloorId)?n.set("sharedFloorId",t.sharedFloorId):"venueId"in t&&Le(t.venueId)&&n.set("venueId",t.venueId),"bounds"in t&&En(t.bounds)&&(n.set("bbox",t.bounds.flat().join()),Le(t.keywords)&&n.set("keywords",t.keywords)),n.toString().length===0)throw new Error("At least one of 'floorId', 'buildingId', 'sharedFloorId', 'venueId', or 'bounds' must be provided.");const r=`${this._categoriesGroupApi}?${n.toString()}`;return this._request.get(r)}search(t){const n=new URLSearchParams;Object.entries(t).forEach(([i,o])=>{switch(i){case"bounds":En(o)&&n.set("bbox",o.flat().join());break;case"center":Ft(o)&&n.set("center",o.join());break;case"excludedCategories":const s=at(o);s&&n.set("excludeCategories",s);break;case"floorIds":const a=at(o);a&&n.set("floorId",a);break;case"sharedFloorIds":const u=at(o);u&&n.set("sharedFloorId",u);break;default:n.set(i,String(o))}});const r=`${this._poisApi}?${n.toString()}`;return this._request.get(r)}async _changedRes(t){return this._request.get(t).then(n=>{if(n.data?.result?.pois){const r=n.data.result.pois.map(i=>ki(i,(o,s)=>rg.includes(s)));return{...n,data:{...n.data,result:{...n.data.result,pois:r}}}}return n})}}class ig{_api="/api/v4/route/query";_request=st.getInstance();constructor(){}search(t){const{points:n,vehicle:r=Br.FOOT,locale:i="en"}=t;if(!(n&&n.length>1&&n.length<6))throw new Error("Parameter error. It must be 1 < {points.length} < 6");if(og(n))throw new Error("Parameter error. Points must have lat and lon.");const o={points:n,vehicle:r,locale:i};return this._request.post(this._api,JSON.stringify(o))}}function og(e){return e.some(t=>!t||typeof t.lat!="number"||typeof t.lon!="number")}const mc=new yc,_c=new pc,sg=new gc;async function dr(e){try{return(await mc.searchByIds(e)).data.result.buildings[0]}catch(t){throw t}}async function ag(e){try{const n=(await mc.searchByFloorId(e)).data.result.buildings[0].buildingId;return await dr(n)}catch(t){throw t}}async function fr(e){try{return(await _c.searchByIds(e)).data.result.venues[0]}catch(t){throw t}}async function bc(e){try{return(await _c.searchBySharedFloorId(e)).data.result.venues[0]}catch(t){throw t}}async function cg(e){try{return(await sg.searchByIds([e])).data.result.pois[0]}catch(t){throw t}}class wc extends Error{status;constructor(t,n){super(t);const{status:r,name:i}=n;r!==void 0&&(this.status=r),i!==void 0&&(this.name=i)}}function lg(e,t=30){let n,r=null;return{promise:new Promise((s,a)=>{r=a;const u=performance.now(),d=()=>{e()?(clearInterval(n),s(!0)):(performance.now()-u)/1e3>t&&(a(new wc("Timeouts or Feature is not found in the map at current zoom level.",{status:404,name:"NetworkError"})),clearInterval(n))};d(),n=setInterval(d,100)}),abort:()=>{n&&(clearInterval(n),n=null),r&&(r(new wc("Query was aborted by the user.",{status:400,name:"AbortError"})),r=null)}}}class Bt{static instance;_visitedBuildingUnits;_historyBuildingUnit;_historyOrdinal;constructor(){this._visitedBuildingUnits=[],this._historyBuildingUnit=new Map,this._historyOrdinal=new Map}static getInstance(){return Bt.instance||(Bt.instance=new Bt),Bt.instance}getHistoryBuildingUnit(t){return this._historyBuildingUnit.get(t)}setHistoryBuildingUnit(t,n){this._historyBuildingUnit.set(t,n)}getHistoryOrdinal(t){return this._historyOrdinal.get(t)}setHistoryOrdinal(t,n){this._historyOrdinal.set(t,n)}getVisitedBuildingUnits(){return this._visitedBuildingUnits}addVisitedBuildingUnit(t){this._visitedBuildingUnits.push(t),this._visitedBuildingUnits.length>100&&(this._visitedBuildingUnits=this._visitedBuildingUnits.slice(this._visitedBuildingUnits.length-100))}}function ug(e,t,n){for(var r=-1,i=e.length;++r<i;){var o=e[r],s=t(o);if(s!=null&&(a===void 0?s===s&&!An(s):n(s,a)))var a=s,u=o}return u}function dg(e,t){return e<t}function fg(e,t){return e&&e.length?ug(e,ur(t),dg):void 0}class hg{_isMaskMode;_hiddenBuildings;_history;constructor(t){this._isMaskMode=t,this._hiddenBuildings=[],this._history=Bt.getInstance()}getLayeredData(t){const{selectedVenueId:n,venueMap:r,buildingMap:i,sharedFloorMap:o}=t,s=[],a=[],u=[],d=[],g=[],p=[],I=[...r.values()],v=n?[r.get(n),...I.filter(h=>h.properties.id!==n)]:I;for(const h of v){if(!h||!h.properties)continue;const{id:b,overlap:B,building_ids:T,shared_level_ids:H,default_displayed_ordinal:$,default_displayed_building:Q}=h.properties,U=b===n,P=gg(B),K=Oe(T),J=this._history.getHistoryOrdinal(b);let q=J??$;if(q)J||(this._history.setHistoryOrdinal(b,q),this._history.setHistoryBuildingUnit(b,{id:Q,type:"building"}));else{const{ordinal:Z,buildingId:te}=pg(K,i);if(!Z)continue;q=Z,this._history.setHistoryOrdinal(b,q),this._history.setHistoryBuildingUnit(b,{id:te,type:"building"})}K.forEach(Z=>{const te=i.get(Z),ne=yg(te,q);ne?this._isMaskMode?U?(a.push(ne),s.push({level:ne,overlap:P.get(ne)??null,venueId:b})):g.push(Z):(s.push({level:ne,overlap:P.get(ne)??null,venueId:b}),U&&a.push(ne)):d.push(Z)}),Oe(H).forEach(Z=>{const te=o.get(Z),{ordinal:ne,persistence:Y=!1}=te?.properties||{},W=!!Y&&0<=ne&&ne<=q,w=ne===q,N=W||w,L={level:Z,overlap:P.get(Z)??null,venueId:b};N?this._isMaskMode?U?(s.push(L),W&&u.push(Z),w&&a.push(Z)):p.push(Z):(s.push(L),U&&w&&a.push(Z),W&&u.push(Z)):d.push(Z)})}return this._hiddenBuildings=d,{displayedLevels:s,selectedLevelIds:a,alwaysDisplayedSharedLevelIds:u,maskBuildingIds:g,maskSharedFloorIds:p}}getHiddenBuildings(){return this._hiddenBuildings}}function pg(e,t){const n=e.find(o=>t.has(o))??e[0]??null,r=n?t.get(n):null;return{ordinal:r?vc(r):null,buildingId:n}}function vc(e){if(!e||!e.properties)return null;const{level_ids:t,ordinals:n,default_displayed_floor:r}=e.properties,i=Oe(n);let o=null;if(r){const s=Oe(t).findIndex(a=>a===r);o=i[s]??null}return o||(o=fg(i,s=>Math.abs(Number(s)-.1))),o}function yg(e,t){if(!e||!e.properties)return null;const{level_ids:n,ordinals:r}=e.properties,i=Oe(r).findIndex(o=>o===t);return Oe(n)[i]??null}function gg(e){const t=new Map;if(!e)return t;for(const n of Oe(e,"/")){const[r,i]=Oe(n,":");t.set(r,Oe(i))}return t}class mg{_maplibre;_isAnimated=!0;_bounds=null;_boundsPadding;_center=null;_fitBoundsTimer=null;constructor(t,n){this._maplibre=t,this._boundsPadding=n}setAnimated(t){this._isAnimated=t}setBounds(t){this._bounds=t}getBounds(){return this._bounds}setCenter(t){this._center=t}async fitBounds(){if(!this._bounds)return;this._fitBoundsTimer&&(clearTimeout(this._fitBoundsTimer),this._fitBoundsTimer=null);const t=this._isAnimated?{animate:!0,duration:500}:{animate:!1},n=this._isAnimated?500:0;return new Promise(r=>{const i=()=>{this._maplibre.off("idle",i),r(!0)};this._maplibre.on("idle",i),this._maplibre.fitBounds(this._bounds,{...t,padding:this._boundsPadding,bearing:this._maplibre.getBearing()}),this._fitBoundsTimer=setTimeout(()=>{this._maplibre.off("idle",i),this._fitBoundsTimer=null,r(!0)},n+200)})}panToCenter(){this._center&&this._maplibre.panTo(this._center,{animate:this._isAnimated})}}var Mi=function(){return ct.Date.now()},_g=/\s/;function bg(e){for(var t=e.length;t--&&_g.test(e.charAt(t)););return t}var wg=/^\s+/;function vg(e){return e&&e.slice(0,bg(e)+1).replace(wg,"")}var Ec=NaN,Eg=/^[-+]0x[0-9a-f]+$/i,Sg=/^0b[01]+$/i,Bg=/^0o[0-7]+$/i,Ig=parseInt;function hr(e){if(typeof e=="number")return e;if(An(e))return Ec;if(ht(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ht(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=vg(e);var n=Sg.test(e);return n||Bg.test(e)?Ig(e.slice(2),n?2:8):Eg.test(e)?Ec:+e}var Lg="Expected a function",xg=Math.max,Ag=Math.min;function Hi(e,t,n){var r,i,o,s,a,u,d=0,g=!1,p=!1,I=!0;if(typeof e!="function")throw new TypeError(Lg);t=hr(t)||0,ht(n)&&(g=!!n.leading,p="maxWait"in n,o=p?xg(hr(n.maxWait)||0,t):o,I="trailing"in n?!!n.trailing:I);function v(P){var K=r,J=i;return r=i=void 0,d=P,s=e.apply(J,K),s}function h(P){return d=P,a=setTimeout(T,t),g?v(P):s}function b(P){var K=P-u,J=P-d,q=t-K;return p?Ag(q,o-J):q}function B(P){var K=P-u,J=P-d;return u===void 0||K>=t||K<0||p&&J>=o}function T(){var P=Mi();if(B(P))return H(P);a=setTimeout(T,b(P))}function H(P){return a=void 0,I&&r?v(P):(r=i=void 0,s)}function $(){a!==void 0&&clearTimeout(a),d=0,r=u=i=a=void 0}function Q(){return a===void 0?s:H(Mi())}function U(){var P=Mi(),K=B(P);if(r=arguments,i=this,u=P,K){if(a===void 0)return h(u);if(p)return clearTimeout(a),a=setTimeout(T,t),v(u)}return a===void 0&&(a=setTimeout(T,t)),s}return U.cancel=$,U.flush=Q,U}function Cg(e,t,n,r){for(var i=e.length,o=n+-1;++o<i;)if(t(e[o],o,e))return o;return-1}function Tg(e){return e!==e}function Og(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function Rg(e,t,n){return t===t?Og(e,t,n):Cg(e,Tg,n)}function Pg(e,t){var n=e==null?0:e.length;return!!n&&Rg(e,t,0)>-1}function Fg(){}var kg=1/0,Mg=Qt&&1/Ei(new Qt([,-0]))[1]==kg?function(e){return new Qt(e)}:Fg,Hg=200;function Ug(e,t,n){var r=-1,i=Pg,o=e.length,s=!0,a=[],u=a;if(o>=Hg){var d=t?null:Mg(e);if(d)return Ei(d);s=!1,i=xa,u=new Ln}else u=t?[]:a;e:for(;++r<o;){var g=e[r],p=t?t(g):g;if(g=g!==0?g:0,s&&p===p){for(var I=u.length;I--;)if(u[I]===p)continue e;t&&u.push(p),a.push(g)}else i(u,p,n)||(u!==a&&u.push(p),a.push(g))}return a}function Sc(e,t){return e&&e.length?Ug(e,ur(t)):[]}var Ng=0;function Ut(e){var t=++Ng;return fc(e)+t}const Tn="Indoor_selectedFloorChanged",pr="Indoor_selectedBuildingChanged",Ui="Indoor_mapxusMapLoaded",Bc="Indoor_maplibreMapLoaded",yr="mapxus-venue-fill",Nt="mapxus-building-line",Ic="mapxus-level-fill",Ni="mapxus-shared-level-fill",Di="highlight-mapxus_level",$i="highlight-mapxus_shared_level";class Lc extends Er.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=Wt(Tn);_startWithIndoorView;_indoorMapLoaded=!1;_isSelectSharedFloor=!1;_isMaskMode;_upperLevels=new Set;_middleLevels=new Set;_lowerLevels=new Set;_featureIncomplete=!1;_fitBounds;_dragPan;_history=Bt.getInstance();_maskBuildings=new Set;_maskSharedFloors=new Set;_enableIndoorClickSelection;_enableOutdoorClickSelection;_zIndexHistory=new Map;_floorSwitchScope;_isDestroyed=!1;_abortQueryFeature;_debounceRendering;layeredHandler;dragPanHandler;constructor(t){super();const{map:n,startWithIndoorView:r,outdoorMapShown:i,selectedHighlightStyle:o,fitBounds:s,boundsPadding:a,maskNonSelectedAreas:u,enableIndoorClickSelection:d,enableOutdoorClickSelection:g,floorSwitchScope:p}=t;this.layeredHandler=new hg(u),this.dragPanHandler=new mg(n,a),this._map=n,this._enableIndoorClickSelection=d,this._enableOutdoorClickSelection=g,this._startWithIndoorView=r,this._outdoorMapShown=i,this._isMaskMode=u,this._fitBounds=s,this._floorSwitchScope=p,this._selectedHighlightStyle=o?Object.assign({},Un,o):Un,this._bindMaplibreEventListeners()}destroy(){this._isDestroyed||(this._isDestroyed=!0,this._dispatch.on(`.${Tn}`,null),this.off(pr),this.off(Bc),this.off(Ui),this._debounceRendering?.cancel(),this._abortQueryFeature&&(this._abortQueryFeature(),this._abortQueryFeature=null))}setAllowOutdoorSwitch(t){return this._enableOutdoorClickSelection=t,this}setAllowBuildingSwitch(t){return this._enableIndoorClickSelection=t,this}setAllowIndoorClickSelect(t){this._enableIndoorClickSelection=t}setAllowOutdoorClickSelect(t){this._enableOutdoorClickSelection=t}setFloorSwitchScope(t){this._floorSwitchScope=t}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(t,n){const{layerIds:r,filter:i}=n||{},o=this._queryRenderedFeatures(r);if(!o.length)return[];const s=i?a=>a.properties.id===t&&i(a):a=>a.properties.id===t;return o.filter(s)}async switchFloorByOrdinal(t){this._updateFloorState(t),this._dispatch.call(Tn,null,{venue:this.venue,building:this.building,floor:this.floor}),this.venue&&t&&(this._floorSwitchScope===Mn.GLOBAL&&this._changeOtherVenuesHistory(t),this._dragPan===!0&&(this._fitBounds?await this.dragPanHandler.fitBounds():await this.panToBuildingCenter()),this._dragPan==="restrict"&&await this._checkAndPanToBuilding()),this.updateRendering()}setOutdoorMapShown(t){this._outdoorMapShown=t,this._setOutdoorVisibility(t)}setSelectedHighlightStyle(t){this._selectedHighlightStyle=Object.assign({},this._selectedHighlightStyle,t??{"line-opacity":0});for(const n of[Di,$i])if(this._map.getLayer(n))if(t){const{lineColor:r,lineOpacity:i,lineWidth:o,lineOffset:s}=this._selectedHighlightStyle,a=xc(o,s);this._map.setPaintProperty(n,"line-color",r),this._map.setPaintProperty(n,"line-opacity",i),this._map.setPaintProperty(n,"line-width",o),this._map.setPaintProperty(n,"line-offset",a)}else this._map.setPaintProperty(n,"line-opacity",0)}onMapChange(t){const n=Ut(`${Tn}.`);return this._dispatch.on(n,t),{unsubscribe:()=>this._dispatch.on(n,null)}}async selectBuilding(t,n){if(this._isCurrentFeature(t))return;this._isSelectSharedFloor=!1,this._curSharedLevelId=null;let r=null;if(!t||!t.properties)this.dragPanHandler.setCenter(null),this._clear();else{const{floorId:i,featureIncomplete:o}=n||{};this._featureIncomplete=o??this._featureIncomplete;const{id:s,"ref:venue":a,label_center:u}=t.properties,d=Oe(u).map(g=>parseFloat(g));this._curBuildingFeature=t,this._curBuildingId=s,this._history.addVisitedBuildingUnit({id:s,type:"building"}),this.dragPanHandler.setCenter(d),this._curVenueId!==a&&(this._curVenueId=a,this._curVenueFeature=await this._queryVenueFeature(a)),r=this._getBuildingDisplayedOrdinal(t,i)}await this.switchFloorByOrdinal(r),this.emit(pr,t?{building:t,ordinal:r,dragPan:this._dragPan}:null),this._dispatchIndoorMapLoaded()}async selectSharedFloor(t,n,r){if(t.id===this._curSharedLevelId)return;const{id:i,ordinal:o}=t;this._isSelectSharedFloor=!0,this._curBuildingId=null,this._curBuildingFeature=null,this._sharedFloor=t,this._curSharedLevelId=i,this._featureIncomplete=r?.featureIncomplete??this._featureIncomplete;const{label_center:s,id:a}=n.properties,u=Oe(s).map(d=>parseFloat(d));this._curVenueId=a,this._curVenueFeature=n,this.dragPanHandler.setCenter(u),this._history.addVisitedBuildingUnit({id:i,type:"sharedFloor"}),this._history.setHistoryOrdinal(a,o),this._history.setHistoryBuildingUnit(a,{id:i,type:"sharedFloor"}),this._dragPan===!0&&(this._fitBounds?await this.dragPanHandler.fitBounds():await this.panToVenueCenter()),this._dispatch.call(Tn,null,{venue:this.venue,building:this.building,floor:this.floor}),this.emit(pr,{...t,dragPan:this._dragPan}),this._dispatchIndoorMapLoaded(),this.updateRendering()}updateCustomLayers(){const t=this._map.getStyle();this._originIndoorLayers=Lr(t),this._outdoorLayers=tl(t),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 t=()=>this.getFeaturesById(this._curBuildingId,{layerIds:[Nt]})[0];await this._waitForFeatureLoaded(t)}}async panToVenueCenter(){if(this.dragPanHandler.panToCenter(),this._featureIncomplete){const t=()=>this.getFeaturesById(this._curVenueId,{layerIds:[yr]})[0];await this._waitForFeatureLoaded(t)}}async _waitForFeatureLoaded(t){const n=()=>this._isDestroyed?(this._abortQueryFeature?.(),!0):!!t(),{promise:r,abort:i}=lg(n);this._abortQueryFeature=i;try{await Promise.race([r,new Promise((o,s)=>{this._abortQueryFeature=()=>{s(new Error("Aborted")),this._abortQueryFeature=null}})])}catch(o){console.warn(o);return}}setDragPan(t){this._dragPan=t}setFitBounds(t){this._fitBounds=t}async queryIndoorFeaturesByClickPoint(t){const n=this._queryVisibleFeature(t);if(!n)return null;const r=async o=>{let s=this.getFeaturesById(o,{layerIds:[yr]})[0];if(!s){const a=await fr(o);s=Hn(a),this._featureIncomplete=!0}return s??null},i=async o=>{let s=this.getFeaturesById(o,{layerIds:[Nt]})[0];if(!s){const a=await dr(o);s=Ar(a),this._featureIncomplete=!0}return s??null};if(gr(n.sourceLayer,n.layer.type)){const{id:o,"ref:building":s,name:a,ordinal:u}=n.properties,d=await i(s);if(d){const g=d.properties["ref:venue"];return{venue:await r(g),building:d,floor:{id:o,code:a,ordinal:u}}}}else if(Cc(n.sourceLayer,n.layer.type)){const{id:o,ordinal:s,name:a,"ref:venue":u}=n.properties;return{sharedFloor:{id:o,ordinal:s,name:typeof a=="string"?{default:a}:a},venue:await r(u)}}else{const o=n?.properties?.["ref:venue"];return n?{building:n,venue:await r(o)}:null}}async selectByClickMap(t){!this._enableIndoorClickSelection&&!this._enableOutdoorClickSelection||(this.setDragPan(!1),this.dragPanHandler.setBounds(null),this._featureIncomplete=!1,t?this._enableIndoorClickSelection&&("building"in t?await this.selectBuilding(t.building,{floorId:t?.floor?.id}):"sharedFloor"in t&&await this.selectSharedFloor(t.sharedFloor,t.venue)):this._enableOutdoorClickSelection&&await this.selectBuilding(null))}_bindMaplibreEventListeners(){this._map.once("styledata",()=>this.updateCustomLayers()),this._map.once("idle",()=>{this.emit(Bc),(!this._startWithIndoorView||this._map.getZoom()<14)&&this._dispatchIndoorMapLoaded()}),this._map.on("sourcedata",this._debounceRendering=Hi(()=>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(t=>xr(t.source))}_getBuildingFloorByOrdinal(t,n){let r=null,i=null;if(t?.properties){const{ordinals:o,level_names:s,level_ids:a}=t.properties,u=Oe(o).findIndex(d=>d===n);r=Oe(s)[u]??null,i=Oe(a)[u]??null}return{code:r,id:i,ordinal:n}}_isCurrentFeature(t){const n=t?.properties?.id??null,r=this._isSelectSharedFloor?this._curSharedLevelId:this._curBuildingId;return n===r}_setOutdoorVisibility(t){for(const{id:n}of this._outdoorLayers)this._map.getLayer(n)&&this._map.setLayoutProperty(n,"visibility",t?"visible":"none")}_addReserveFloorLayers(){for(const t of[nn,je]){if(this._map.getLayer(t))continue;const n=t.split("_")[1],r=this._map.getLayer(n);if(!r)continue;const{source:i,sourceLayer:o}=r,s=t===nn?this._middleLayers[0]:this._lowerLayers[0];let a={"fill-opacity":0};if(this._isMaskMode&&t===je){const u=this._originIndoorLayers.find(({id:d})=>d===Nt);u&&(a=Object.assign({},u.paint??{},a))}this._map.addLayer({id:t,source:i,"source-layer":o,type:"fill",paint:a},s.id)}}_addBuildingMaskLayer(){if(this._map.getLayer(rn))return;const t=this._originIndoorLayers.find(({id:n})=>n===Nt);if(t){const n=Object.assign({},t,{id:rn,layout:Object.assign({},t.layout??{},{visibility:"visible"}),paint:Object.assign({},t.paint??{},{"fill-opacity":0})});this._map.addLayer(n,Nt)}}_updateUnselectedMask(){if(!this._isMaskMode)return;const t=[...this._maskBuildings],n=[...this._maskSharedFloors];this._map.getLayer(rn)&&this._map.setPaintProperty(rn,"fill-opacity",["case",["in",["get","id"],["literal",t]],1,0]),this._map.getLayer(je)&&this._map.setPaintProperty(je,"fill-opacity",["case",["in",["get","id"],["literal",n]],1,0])}_addSelectedHighlightLayers(){const t=[{layerId:Di,sourceLayer:"mapxus_level"},{layerId:$i,sourceLayer:"mapxus_shared_level"}];let n=this._originIndoorLayers.find(({type:r})=>ji(r));if(!n){const r=this._originIndoorLayers.findIndex(({id:i})=>i===this._upperLayers[this._upperLayers.length-1].id);n=this._originIndoorLayers[r+1]}for(const{layerId:r,sourceLayer:i}of t){if(this._map.getLayer(r))continue;const{lineWidth:o,lineOpacity:s,lineColor:a,lineOffset:u}=this._selectedHighlightStyle,d=xc(o,u);this._map.addLayer({id:r,source:"indoor-planet","source-layer":i,type:"line",filter:["==","id",""],paint:{"line-offset":d,"line-width":o,"line-color":a,"line-opacity":s}},n?.id)}}_filterSelectedHighlight(){for(const t of[Di,$i])this._map.getLayer(t)&&this._map.setFilter(t,["==","id",this._isSelectSharedFloor?this._curSharedLevelId:this._floor.id??""])}_copyOverlapLayers(){const t=this._originIndoorLayers.findIndex(({type:a,"source-layer":u})=>Ac(u,a)),n=this._originIndoorLayers.findIndex(({type:a,"source-layer":u})=>Vi(u,a)),r=this._originIndoorLayers.slice(t,n);this._upperLayers=r.filter(({type:a})=>$g(a));const i=this._originIndoorLayers.slice(n),o=i.findIndex(({type:a,"source-layer":u})=>!Vi(u,a));if(o>-1){this._commonPoiLayers=i.slice(0,o);const a=i.slice(o).filter(({"source-layer":u})=>u==="mapxus_section");this._sectionFillLineLayers=a.filter(({type:u})=>u!=="symbol"),this._sectionSymbolLayers=a.filter(({type:u})=>u==="symbol")}else this._commonPoiLayers=[...i],this._sectionSymbolLayers=r.filter(({type:a,"source-layer":u})=>u==="mapxus_section"&&a==="symbol");const s=this._upperLayers[0];this._middleLayers=this._upperLayers.filter(({type:a})=>!ji(a)).map(a=>{const u=`${a.id}-overlap-copy`;let d=this._map.getLayer(u);return d||(d=Object.assign({},a,{id:u}),this._map.addLayer(d,s.id)),d})}_copySharedFloorBackgroundLayers(){if(!!!this._upperLayers.find(i=>i.id===je.split("_")[1]))return;const n=this._upperLayers.filter(({"source-layer":i,type:o})=>!gr(i,o)&&!ji(o)),r=this._middleLayers[0]||this._upperLayers[0];this._lowerLayers=[...n,...this._commonPoiLayers].map(i=>{const o=`${i.id}-shared-bg`;let s=this._map.getLayer(o);return s||(s=Object.assign({},i,{id:o}),this._map.addLayer(s,r.id)),s})}_updateFeatures(){this._features=this._getIndoorFeatures();const t=Sc(this._features,o=>o.layer.id+":"+o.properties.id),n=[],r=[],i=[];for(const o of t){const s=o.layer.id;s===yr?n.push(o):s===Nt?r.push(o):s===je&&i.push(o)}this._allVenuesMap=new Map(n.map(o=>[o.properties.id,o])),this._allBuildingsMap=new Map(r.map(o=>[o.properties.id,o])),this._allSharedLevelsMap=new Map(i.map(o=>[o.properties.id,o]))}_calExcludedPoisInMiddle(){const t=this._map.querySourceFeatures("indoor-planet",{sourceLayer:"mapxus_place"}),n=i=>i?Oe(i).some(s=>this._upperLevels.has(s)):!1,r=t.filter(i=>{const o=i.properties["ref:level"]||i.properties["ref:shared_level"];return this._middleLevels.has(o)?n(i.properties.overlap):!1});this._excludedPoisInMiddle=r.map(i=>i.properties["osm:ref"])}_updateSelectedFeatures(){if(this._featureIncomplete){if(this._isSelectSharedFloor){const t=this._features.find(n=>n.properties.id===this._curVenueId);if(!t)return;this._curVenueFeature=t}else{const t=this._allBuildingsMap.get(this._curBuildingId);if(!t)return;this._curBuildingFeature=t}this._featureIncomplete=!1}}_layerFloors(){const{displayedLevels:t,selectedLevelIds:n,alwaysDisplayedSharedLevelIds:r,maskBuildingIds:i,maskSharedFloorIds:o}=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(t,n),this._layerUnselectedLevels(t,n,r),this._isMaskMode&&(this._maskBuildings.clear(),this._maskSharedFloors.clear(),i.forEach(s=>{this._maskBuildings.add(s)}),o.forEach(s=>{this._maskSharedFloors.add(s)}))}_layerSelectedLevels(t,n){for(const r of n){this._upperLevels.add(r),this._zIndexHistory.set(r,!0);const i=t.find(({level:o,overlap:s})=>o===r&&!!s);if(i)for(const o of i.overlap)this._zIndexHistory.get(o)&&this._zIndexHistory.delete(o)}}_layerUnselectedLevels(t,n,r){for(const i of t){if(n.includes(i.level))continue;const{level:o,overlap:s,venueId:a}=i,u=this._zIndexHistory.get(o),d=!s||!s.some(p=>this._upperLevels.has(p)),g=r.includes(o);if(a===this._curVenueId&&g){this._lowerLevels.add(o),this._zIndexHistory.delete(o);continue}u?this._upperLevels.add(o):u===!1?this._middleLevels.add(o):g?this._lowerLevels.add(o):d?(this._upperLevels.add(o),this._zIndexHistory.set(o,!0)):(this._middleLevels.add(o),this._zIndexHistory.set(o,!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(t,n){let r;for(const i of n){const{id:o,filter:s,type:a,"source-layer":u}=i,d=s?[s]:[],g=o.includes("-shared-bg"),p=[...this._maskBuildings],I=[...this._maskSharedFloors];Ac(u,a)?r=["all",gr(u,a)?["!in","ref:building",...p]:["!in","id",...I],["in","id",...t],...d]:g?r=["all",["!in","ref:shared_level",...I],["in","ref:shared_level",...t],...d]:(r=["all",["any",["all",["!in","ref:building",...p],["in","ref:level",...t]],["all",["!in","ref:shared_level",...I],["in","ref:shared_level",...t]]],...d],Vi(u,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(o,r)}}async _queryVenueFeature(t){let n=this.getFeaturesById(t,{layerIds:[yr]})[0]??null;if(!n)try{const r=await fr(t);n=Hn(r)}catch(r){console.error(r)}return n}_getBuildingDisplayedOrdinal(t,n){if(!t||!t.properties)return null;const{"ref:venue":r,level_ids:i,ordinals:o}=t.properties,s=Oe(i),a=Oe(o);if(n){const d=s.findIndex(g=>g===n);return a[d]??null}const u=this._history.getHistoryOrdinal(r);return u&&a.includes(u)?u:vc(t)}_updateFloorState(t){if(!t){this._floor={code:null,id:null,ordinal:null};return}const{code:n,id:r}=this._getBuildingFloorByOrdinal(this._curBuildingFeature,t);(!n||!r)&&console.error(`Floor with ordinal "${t}" not found in building "${this._curBuildingId}".`),this._floor={code:n,id:r,ordinal:t},this._history.setHistoryOrdinal(this._curVenueId,t),this._history.setHistoryBuildingUnit(this._curVenueId,{id:this._curBuildingId,type:"building"})}async _checkAndPanToBuilding(){this.getFeaturesById(this._curBuildingId,{layerIds:[Nt]})[0]||(this._fitBounds?this.dragPanHandler.fitBounds():this.dragPanHandler.panToCenter())}_queryVisibleFeature(t){const r=[Ic,Ni,`${Ic}-overlap-copy`,`${Ni}-overlap-copy`,`${Ni}-shared-bg`,...this._isMaskMode?[je,rn]:[]].filter(s=>!!this._map.getLayer(s)),i=this._map.queryRenderedFeatures(t,{layers:r});let o=null;for(const s of r){const a=i.find(u=>u.layer.id===s);if(a){o=a;break}}return o&&Dg(o.sourceLayer,o.layer.type)&&(this._maskBuildings.has(o.properties?.id)||(o=null)),o}_queryRenderedFeatures(t){const n=(t||[]).filter(o=>this._map.getLayer(o));if(t&&t.length>0&&n.length===0)return[];const r=n.length?{layers:n}:{},i=this._map.getCanvas().getBoundingClientRect();return this._map.queryRenderedFeatures([[0,0],[i.width,i.height]],r)}_dispatchIndoorMapLoaded(){this._indoorMapLoaded||(this._indoorMapLoaded=!0,this.emit(Ui))}_changeOtherVenuesHistory(t){const n=[...this._allVenuesMap.values()];for(const r of n){const i=r.properties.id;i!==this._curVenueId&&this._history.setHistoryOrdinal(i,t)}}}function xc(e,t){const n=typeof e=="number"&&e===Un.lineWidth,r=typeof t=="number"&&t===Un.lineOffset;if(!r)return t;if(n&&r)return["interpolate",["linear"],["zoom"],18,-1.5,20.2,-3.75,20.4,-3.8,21.5,-7.5,22,-9.55];if(!n&&r)return typeof e=="number"?-(e/2):t}function Dg(e,t){return e==="mapxus_building"&&(t==="fill"||t==="line"||t==="symbol")}function Ac(e,t){return gr(e,t)||Cc(e,t)}function gr(e,t){return e==="mapxus_level"&&(t==="fill"||t==="line")}function Cc(e,t){return e==="mapxus_shared_level"&&(t==="fill"||t==="line")}function Vi(e,t){return e==="mapxus_place"&&t==="symbol"}function ji(e){return e==="fill-extrusion"}function $g(e){return e==="line"||e==="fill"||e==="fill-extrusion"}const mr="Poi_poiClick";class Tc{_map;_currentStyle=null;_styleLayersLength=0;_layerIds=[];_dispatch=Wt(mr);_listeners=[];constructor(t){this._map=t,this._bindPoiClickEvent()}destroy(){this._dispatch.on(`.${mr}`,null),this._currentStyle=null,this._map=null,this._dispatch=null,this._listeners=[],this._layerIds=[]}onPoiClick(t){const n=Ut(`${mr}.`);return this._dispatch.on(n,t),this._listeners.push(n),{unsubscribe:()=>this._dispatch.on(n,null)}}_queryPoiLayers(){const t=this._map.getStyle();if(t.name===this._currentStyle&&t.layers.length===this._styleLayersLength)return;const n=Lr(t).filter(r=>r["source-layer"]==="mapxus_place"&&r.type==="symbol");this._layerIds=n.map(({id:r})=>r),this._currentStyle=t.name,this._styleLayersLength=t.layers.length}_bindPoiClickEvent(){this._map.on("click",t=>{if(this._listeners.length===0)return;this._queryPoiLayers();const n=this._map.queryRenderedFeatures(t.point,{layers:this._layerIds});if(n.length===0)return;const r=n[0],i=Oe(r.properties["ref:sections"]),o=!!r.properties["ref:shared_level"],s={coordinate:t.lngLat,poi:r};if(i.length>0){const a=this._map.querySourceFeatures("indoor-planet",{sourceLayer:"mapxus_section"});s.sections=i.map(u=>{const d=a.find(h=>h.properties.id===u),{id:g,section:p="",correlation_id:I}=d?.properties||{},v=Oc(d?.properties);return{id:g,category:p,sectionName:v,...I&&{correlationId:I}}})}if(o){const a=r.properties["ref:shared_level"],{floor:u,venue:d}=this._queryIndoorFeaturesBySharedFloor(a);s.floor=u,s.venue=d}else{const a=r.properties["ref:level"],{floor:u,building:d,venue:g}=this._queryIndoorFeaturesByFloor(a);s.floor=u,s.building=d,s.venue=g}this._dispatch.call(mr,null,s)})}_queryIndoorFeaturesBySharedFloor(t){const n=this._map.queryRenderedFeatures({layers:[je,"mapxus-venue-fill"]}),r=n.find(d=>d.sourceLayer==="mapxus_shared_level"&&d.properties.id===t);if(!r)return{floor:null,venue:null};const i=r.properties["ref:venue"],o=n.find(d=>d.layer.id==="mapxus-venue-fill"&&d.properties.id===i)??null,{id:s,ordinal:a}=r.properties,u=Oc(r.properties);return{floor:{id:s,ordinal:a,name:u},venue:o}}_queryIndoorFeaturesByFloor(t){const n=this._map.queryRenderedFeatures({layers:[nn,"mapxus-building-line","mapxus-venue-fill"]}),r=n.find(g=>g.sourceLayer==="mapxus_level"&&g.properties.id===t);if(!r)return{floor:null,building:null,venue:null};const{id:i,ordinal:o,name:s,"ref:building":a}=r.properties||{},u=n.find(g=>g.layer.id==="mapxus-building-line"&&g.properties.id===a)??null,d=n.find(g=>g.layer.id==="mapxus-venue-fill"&&g.properties.id===u?.properties?.["ref:venue"])??null;return{floor:{id:i,ordinal:o,code:s},building:u,venue:d}}}function Oc(e){return e?Object.keys(e).filter(n=>n.includes("name")).reduce((n,r)=>{const[,i]=Oe(r,":");return i?n[i]=e[r]:n.default=e[r],n},{}):{default:""}}function On(e){e.parentNode&&e.parentNode.removeChild(e)}function Fe(e,t,n){const r=document.createElement(e);return t&&(r.className=t),n&&n.appendChild(r),r}class Rc{_map;_maplibre;_buildingId;_features;_$container;_$listContainer;_$buildingList;_listHeight;_language;_visible;_position="top-right";_isMobileMode;_isListShown=!1;constructor(t,n){this._map=t,this._language=t.getLanguage(),this._visible=n??!0,this._detectDeviceMode()}onAdd(t){return this._maplibre=t,this._$container=Fe("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(){On(this._$container)}get position(){return this._position}get enabled(){return this._visible}getDefaultPosition(){return"top-right"}setVisibility(t){this._visible=t,t?this._$showLayout():this._$hideLayout()}changePosition(t,n,r){const i=document.querySelector(`.maplibregl-ctrl-${t}`),o=i.querySelector(".maplibregl-ctrl-building-filter");if(t!==n){this._position=n;const s=document.querySelector(`.maplibregl-ctrl-${n}`);o&&(i.removeChild(o),Number.isFinite(r)?s.insertBefore(o,s.children[r]):s.append(o),this._updateBuildingListLayout(n))}else Number.isFinite(r)&&i.children[r]!==o&&(i.removeChild(o),i.insertBefore(o,i.children[r]))}_bindEvents(){this._maplibre.on("moveend",()=>this._refresh()),this._map.onMapChangeListener(t=>{const n=t.building?.properties?.id??"";this._buildingId!==n&&(this._buildingId=n,this._refresh())}),this._map.renderComplete(()=>this._init())}_init(){this._load()}_refresh(){this._load()}_load(){this._buildingNameListClean(),this._buildingNameListUpdate()}_buildingFilterIconCreate(t){const n=Fe(t,"mapxus-building-filter-icon");return this._bindMouseOnEvents(n,!1),this._bindMobileTouchEvents(n),n}_buildingNameListCreate(t){return this._$listContainer=Fe(t,"mapxus-building-name-layout"),this._$listContainer.style.display="none",this._$listContainer.style.top="20px",this._$buildingList=Fe(t,"mapxus-building-name-list",this._$listContainer),this._bindMouseOnEvents(this._$listContainer,!0),this._$listContainer}_buildingNameListUpdate(){this._features=[];const t=this._map.getMaplibre(),n=t?t.queryRenderedFeatures({layers:["mapxus-building-line"]}):[];for(const r of n){const{properties:i}=r,{id:o,name:s}=i,a=i?.[`name:${this._language}`]??s;this._features.find(u=>u.properties.id===o)||(this._features.push(r),this._$buildingList.appendChild(this._buildingNameCreate("p",a,o,o===this._map.building?.properties?.id)))}this._setBuildingListHeight(this._features),this._updateBuildingListLayout(this._position)}_buildingNameListClean(){this._$buildingList.replaceChildren()}_setBuildingListHeight(t){const i=t.map(o=>{const s=o?.properties?.[`name:${this._language}`]??o?.properties?.name;return s?Math.ceil(s.length*8/107):0}).reduce((o,s)=>o+s,0);this._listHeight=i*26+t.length*8,this._$buildingList.style.height=this._$listContainer.style.height=`${this._listHeight>=208?208:this._listHeight}px`}_buildingNameCreate(t,n,r,i){const o=Fe(t,`mapxus-building-name${i?" active":""}`);return o.dataset.id=r,o.innerText=n,this._buildingNameClickEvent(o),o}_toggleList(t){this._isListShown=t,this._$listContainer.style.display=t?"block":"none"}_buildingNameClickEvent(t){t.onclick||(t.onclick=async n=>{const r=n.target;await this._map.selectBuildingById(r.dataset.id)})}_bindMouseOnEvents(t,n){t.onmouseenter=()=>{this._isMobileMode||this._toggleList(!0)},n&&(t.onmouseleave=()=>this._toggleList(!1))}_bindMobileTouchEvents(t){window.addEventListener("resize",()=>this._detectDeviceMode()),t.ontouchend=()=>this._toggleList(!this._isListShown)}_$showLayout(){this._$container.classList.remove("hide")}_$hideLayout(){this._$container.classList.add("hide")}_updateBuildingListLayout(t){t.indexOf("left")>-1?(this._$listContainer.style.right=null,this._$listContainer.style.left="55px"):(this._$listContainer.style.left=null,this._$listContainer.style.right="55px");const n=this._$container.offsetParent?this._$container.offsetParent.clientHeight-(this._$container.offsetTop+this._$container.clientHeight)-25:0;t.includes("bottom")&&this._listHeight-20>n?(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 Vg=Math.max,jg=Math.min;function qg(e,t,n){return e>=jg(t,n)&&e<Vg(t,n)}var Pc=1/0,Kg=17976931348623157e292;function Fc(e){if(!e)return e===0?e:0;if(e=hr(e),e===Pc||e===-Pc){var t=e<0?-1:1;return t*Kg}return e===e?e:0}function kc(e,t,n){return t=Fc(t),n===void 0?(n=t,t=0):n=Fc(n),e=hr(e),qg(e,t,n)}class Mc{_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(t,n){const{style:r,enabled:i=!0,language:o}=n;this._indoor=t,this._language=o,this._style=r?Object.assign({},io,r):io,this._isEnabled=i,this._addIndoorEventListeners()}onAdd(t){return this._maplibre=t,this._addMapMoveEventListener(),this._container=Fe("div","maplibregl-ctrl mapxus-ctrl-floors hidden"),this._container}onRemove(){this._debounceScroll&&this._debounceScroll.cancel(),this._clearScrollEventListener&&this._clearScrollEventListener(),On(this._container)}get position(){return this._position}get enabled(){return this._isEnabled}setEnabled(t){this._isEnabled=t,t&&!this._visible&&this._setVisibility(!0),!t&&this._visible&&this._setVisibility(!1)}getDefaultPosition(){return"top-right"}async switchByOrdinal(t,n){this._ordinal=t,this._dragPan=n??!0,await this._indoor.switchFloorByOrdinal(t),this._updateSelectorStatus(t),this._scrollCenterActiveFloor()}changePosition(t,n,r){const i=document.querySelector(`.maplibregl-ctrl-${t}`),o=i.querySelector(".mapxus-ctrl-floors");if(t!==n){this._position=n;const s=document.querySelector(`.maplibregl-ctrl-${n}`);o&&(i.removeChild(o),Number.isFinite(r)?s.insertBefore(o,s.children[r]):s.append(o),this._show(),this._scrollCenterActiveFloor())}else Number.isFinite(r)&&i.children[r]!==o&&(i.removeChild(o),i.insertBefore(o,i.children[r]),this._show(),this._scrollCenterActiveFloor())}setStyle(t){this._style=Object.assign({},this._style,t),this._componentDidMount&&(this._clearFloors(),this._calcSelectorLayout(),this._render(),this._scrollCenterActiveFloor())}_setVisibility(t){this._componentDidMount?t?(this._show(),this._scrollCenterActiveFloor()):this._hide():(this._visible=t,this._indoor.building&&t&&(this._render(),this._show(),this._scrollCenterActiveFloor()))}_addIndoorEventListeners(){this._indoor.on(pr,t=>{if(this._updatePrepared(),!t)return;const{ordinal:n,dragPan:r}=t;this._dragPan=r,"building"in t?this._renderBuildingFloors(t.building,n):this._renderSharedLevelFloor(t)})}_updatePrepared(){this._clearState(),this._visible&&this._hide(),this._componentDidMount&&this._clearFloors()}_renderBuildingFloors(t,n){const{level_names:r,ordinals:i,id:o}=t.properties;this._buildingId=o,this._floorNames=r.split(",").reverse(),this._ordinals=i.split(",").reverse(),this._ordinal=n,this._calcSelectorLayout(),this._render();const s=this._indoor.getFeaturesById(o,{filter:a=>a.layer.id==="mapxus-building-line"})[0];this._checkIfShowFloorSelector(s)}_renderSharedLevelFloor(t){const{name:n,ordinal:r,id:i}=t;this._floorNames=[n[this._language]||n.default],this._ordinals=[r],this._ordinal=r,this._calcSelectorLayout(),this._render();const o=this._indoor.getFeaturesById(i,{layerIds:[je]})[0];this._checkIfShowFloorSelector(o)}_checkIfShowFloorSelector(t){this.enabled&&(this._dragPan!==!1||this._dragPan===!1&&t)&&(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:t,itemSize:n}=this._style;this._centerSelectorIdx=Math.ceil(t/2)-1,this._maxScrollTop=(this._floorNames.length-t)*n,this._lastNormalScrollableIdx=this._floorNames.length-(t-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(t,n){const{itemSize:r,itemCount:i,defaultFolded:o,backgroundColor:s}=this._style,a=Fe("div",`mapxus-ctrl-floors-expanded ${o?"hidden":""}`,t);if(this._floorNames.length>1){const d=Fe("div","mapxus-ctrl-floors-close",a);d.onclick=n}const u=Fe("div","mapxus-ctrl-floors-wrapper",a);return u.style.backgroundColor=s,this._floorNames.length>i&&(this._$arrowBtnUp=this._$createScrollButton(u,"up"),this._$arrowBtnUp.onclick=()=>this._handleScroll("up")),this._$innerFloors=Fe("div","mapxus-ctrl-floors-inner",u),Object.assign(this._$innerFloors.style,{maxHeight:`${r*i}px`,width:`${r}px`}),this._$createFloors(this._$innerFloors),this._floorNames.length>i&&(this._$arrowBtnDown=this._$createScrollButton(u,"down"),this._$arrowBtnDown.onclick=()=>this._handleScroll("down"),this._$innerFloors.addEventListener("scroll",this._debounceScroll=Hi(d=>{d.stopPropagation(),this._resetArrowBtnStatus(this._$innerFloors.scrollTop)},100)),this._clearScrollEventListener=()=>this._$innerFloors.removeEventListener("scroll",this._debounceScroll)),a}_$foldedSelector(t,n){const{itemSize:r,activeFontColor:i,activeBackgroundColor:o,defaultFolded:s}=this._style,a=Fe("div",`mapxus-ctrl-floors-folded mapxus-ctrl-floors-floor ${s?"":"hidden"}`,t);return a.onclick=n,Object.assign(a.style,{width:`${r}px`,height:`${r}px`,lineHeight:`${r}px`,color:i,backgroundColor:o}),a}_clearFloors(){this._container.replaceChildren(),this._componentDidMount=!1}_$createScrollButton(t,n){return Fe("div",`mapxus-ctrl-floors-arrow mapxus-ctrl-floors-floor ${n}`,t)}_$createFloors(t){const{fontColor:n,itemSize:r}=this._style;let i;this._floorNames.forEach((o,s)=>{i=Fe("div","mapxus-ctrl-floors-floor",t),i.dataset.floor=o,i.dataset.ordinal=this._ordinals[s],i.innerText=o,Object.assign(i.style,{color:n,height:`${r}px`,lineHeight:`${r}px`}),i.dataset.ordinal===this._ordinal&&(this._$activeFloor=i,this._resetActiveFloor(!0),this._$selectorFolded.innerText=o),i.onclick=async a=>{this._indoor.setDragPan("restrict"),this._indoor.dragPanHandler.setAnimated(!0),await this.switchByOrdinal(a.target.dataset.ordinal)}})}_updateSelectorStatus(t){const n=this._floorNames[this._ordinals.indexOf(t)];this._$activeFloor&&this._resetActiveFloor(!1);for(const r of this._$innerFloors.children){const i=r;i.dataset.ordinal===t&&(this._$activeFloor=i,this._resetActiveFloor(!0))}this._$selectorFolded.innerText=n}_resetArrowBtnStatus(t){t===0?this._$arrowBtnUp?.classList?.add("hidden"):this._$arrowBtnUp?.classList?.remove("hidden"),t===this._maxScrollTop?this._$arrowBtnDown?.classList?.add("hidden"):this._$arrowBtnDown?.classList?.remove("hidden")}_resetActiveFloor(t){const{activeBackgroundColor:n,backgroundColor:r,activeFontColor:i,fontColor:o}=this._style;Object.assign(this._$activeFloor.style,{color:t?i:o,backgroundColor:t?n:r,fontWeight:t?"bold":"normal",cursor:t?"auto":"pointer"}),this._$activeFloor.disabled=t}_scrollCenterActiveFloor(){if(this._ordinal){const t=this._ordinals.indexOf(this._ordinal);t>-1&&(this._$innerFloors.scrollTop=this._getScrollTop(t),this._$innerFloors.scrollTop||this._resetArrowBtnStatus(0))}}_getScrollTop(t){return kc(this._centerSelectorIdx,this._lastNormalScrollableIdx+1)?(t-this._centerSelectorIdx)*this._style.itemSize:t>this._lastNormalScrollableIdx?this._maxScrollTop:0}_handleScroll(t){const n=this._$innerFloors.scrollTop,{itemSize:r}=this._style;if(t==="up"){const i=n-r*2;this._$innerFloors.scrollTop=i<0?0:i}else if(t==="down"){const i=n+r*2;this._$innerFloors.scrollTop=i>this._maxScrollTop?this._maxScrollTop:i}}_expandSelector(t){t?(this._$selectorExpanded.classList.remove("hidden"),this._$selectorFolded.classList.add("hidden")):(this._$selectorExpanded.classList.add("hidden"),this._$selectorFolded.classList.remove("hidden"))}}class Gg{_container;_isEnabled;constructor(t){this._isEnabled=t?.enabled??!0}onAdd(t){if(this._container=Fe("div","maplibregl-ctrl mapxus-ctrl-logo",t.getContainer()),this._isEnabled){const n=Fe("a","mapxus-logo",this._container);n.target="_blank",n.href="https://www.khi.co.jp/groupvision2030/mapxus.html",n.setAttribute("aria-label","Mapxus logo"),n.setAttribute("rel","noopener"),this._container.appendChild(n)}return this._container}onRemove(){On(this._container)}getDefaultPosition(){return"bottom-left"}}class zg{_container;_anchor;_theme;constructor(t){this._theme=t.theme?t.theme:"default"}onAdd(t){return this._container=Fe("div","maplibregl-ctrl mapxus-ctrl-attribution",t.getContainer()),this._anchor=Fe("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(){On(this._container)}getDefaultPosition(){return"bottom-right"}changeTheme(t){this._setCopyrightInfo(t)}_setCopyrightInfo(t){this._anchor.innerText=t==="landsD"?"© The Government of the Hong Kong SAR":"©Mapxus driven by Kawasaki ©OpenStreetMap contributors",t==="landsD"&&(this._anchor.href="https://www.map.gov.hk/gm/")}}class Zg{_container;_$icon;_removeClickEventListener;onAdd(t){return this._container=Fe("div","maplibregl-ctrl mapxus-ctrl-collapsed-copyright",t.getContainer()),this._container.innerHTML=Wg(),this._bindEvents(),this._container}onRemove(){this._removeClickEventListener(),On(this._container)}getDefaultPosition(){return"bottom-right"}_bindEvents(){const t=this._container.querySelector(".mapxus-collapsed-copyright-menu");this._$icon=this._container.querySelector(".mapxus-collapsed-copyright-btn");let n=!1;this._$icon.addEventListener("click",r),this._removeClickEventListener=()=>this._$icon.removeEventListener("click",r);function r(){n=!n,i()}function i(){n?t.classList.remove("hidden"):t.classList.add("hidden")}}}function Wg(){return`
|
|
1
|
+
(function(p,T){typeof exports=="object"&&typeof module<"u"?T(exports,require("@mapxus/mapxus-auth-jp"),require("maplibre-gl")):typeof define=="function"&&define.amd?define(["exports","@mapxus/mapxus-auth-jp","maplibre-gl"],T):(p=typeof globalThis<"u"?globalThis:p||self,T(p.MapxusMap={},p.MapxusAuth,p.maplibregl))})(this,(function(p,T,kt){"use strict";var mr={value:()=>{}};function ye(){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 Ae(i)}function Ae(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}})}Ae.prototype=ye.prototype={constructor:Ae,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=Sr(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]=Dt(i[n],t.name,e);else if(e==null)for(n in i)i[n]=Dt(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 Ae(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 Sr(t,e){for(var i=0,r=t.length,n;i<r;++i)if((n=t[i]).name===e)return n.value}function Dt(t,e,i){for(var r=0,n=t.length;r<n;++r)if(t[r].name===e){t[r]=mr,t=t.slice(0,r).concat(t.slice(r+1));break}return i!=null&&t.push({name:e,value:i}),t}const Je={version:"10.0.0"}.version,Ht="https://map-api.mapxus.co.jp/bms",R=10,k=1;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 T.HTTPSession.create(T.SDKName.MapSDK,T.base64Encode(`version-${Je}`)),this._httpSession.setBaseURL(Ht),this._httpSession.setRetryConfig(3)),this._httpSession}registerSDK(){this._isSDKInitialized||(this._isSDKInitialized=!0,T.reportLog(`${T.SDKName.MapSDK} initialized`))}get theme(){return this._theme}setTheme(e){this._theme=e}clear(){this._httpSession.destroy(),this._globalDispatcher=null,D.instance=null}}const Nt=["unauthorized","initError"],et=globalThis,tt=ye(...Nt);D.getInstance().setGlobalDispatcher(tt),et.MapxusMapEvents=et.MapxusMapEvents||{},et.MapxusMapEvents.on=function(t,e){return tt.on(t,e),{off:()=>tt.on(t,null)}};var Me={exports:{}},Ut;function vr(){if(Ut)return Me.exports;Ut=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}},Me.exports=t,Me.exports.TinyEmitter=t,Me.exports}var Ir=vr(),xe=(t=>(t[t.VENUE=0]="VENUE",t[t.GLOBAL=1]="GLOBAL",t))(xe||{});function Lr(t){return t.layers.filter(e=>!rt(e.source))}function it(t){return t.layers.filter(e=>rt(e.source))}function rt(t){return typeof t!="string"?!1:t.startsWith("indoor-")}function nt(t){const{buildingId:e,labelCenter:{lat:i,lon:r},floors:n,name:s,venueId:o,defaultFloor:a}=t,l=Object.entries(s).reduce((c,[f,g])=>{const _=f==="default"?"name":`name:${f}`;return Object.assign(c,{[_]:g})},{}),{codes:d,ids:u,ordinals:h}=n.reduce((c,f)=>{const{id:g,code:_,ordinal:y}=f;return{codes:c.codes?`${c.codes},${_}`:_,ids:c.ids?`${c.ids},${g}`:g,ordinals:`${c.ordinals}`?`${c.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:h,"ref:venue":o,...l,...a?{default_displayed_floor:a}:{}},source:"indoor-planet",sourceLayer:"mapxus_building"}}function Te(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}),{}),h=Object.entries(n).reduce((_,[y,m])=>{const S=y==="default"?"name":`name:${y}`;return Object.assign(_,{[S]:m})},{}),c=l?i.find(_=>_.id===l)?.defaultFloor:null,f=l?{default_displayed_building:l,...c?{default_displayed_ordinal:c}:{}}:{},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,...h,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 me="reserve_mapxus-level-fill",x="reserve_mapxus-shared-level-fill",be="reserve_mapxus-building-fill";var M=(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))(M||{});function jt(t){let e=null;return wr(t)?e=M.ENGLISH:Br(t)?e=M.CHINESE_SIMPLIFIED:Er(t)?e=M.CHINESE_TRADITIONAL:Pr(t)?e=M.CHINESE_TRADITIONAL_TW:Fr(t)?e=M.JAPANESE:Cr(t)?e=M.KOREAN:Or(t)?e=M.FILIPINO:$r(t)?e=M.INDONESIAN:Ar(t)?e=M.PORTUGUESE:Mr(t)?e=M.THAI:xr(t)?e=M.VIETNAMESE:Tr(t)&&(e=M.ARABIC),e}function wr(t){return/^en(-(US|GB|AU))?$/.test(t)}function Br(t){return/^zh(-(Hans|CN))?$/.test(t)}function Er(t){return/^zh-(Hant|HK|MO)$/.test(t)}function Pr(t){return t==="zh-TW"}function Fr(t){return/^ja(-JP)?$/.test(t)}function Cr(t){return/^ko(-KR)?$/.test(t)}function Or(t){return/^(fil|tl)(-PH)?$/.test(t)}function $r(t){return/^id(-ID)?$/.test(t)}function Ar(t){return/^pt(-(BR|PT))?$/.test(t)}function Mr(t){return/^th(-TH)?$/.test(t)}function xr(t){return/^vi(-VN)?$/.test(t)}function Tr(t){return/^ar(-(DZ|BH|EG|IQ|JO|KW|LB|LY|MA|OM|QA|SA|SY|TN|AE|YE))?$/.test(t)}const Re={lineWidth:3,lineColor:"#A5E3FF",lineOpacity:1,lineOffset:-1.5},Vt={fontColor:"#8c8c8c",activeFontColor:"#fff",backgroundColor:"#fff",activeBackgroundColor:"#074769",itemSize:50,itemCount:4,defaultFolded:!1},Rr=jt(window.navigator.language)??M.ENGLISH;let zt=class 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 kr(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 zt("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 zt("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(v).map(r=>r.trim());return i.length>0?i.join(","):null}function v(t){return typeof t=="string"&&t.trim().length>0}function Z(t){return Array.isArray(t)&&t.length===2&&t.every(e=>typeof e=="number")}function Se(t){return Array.isArray(t)&&t.length===2&&t.every(e=>Z(e))}function se(t){return typeof t=="number"&&t>0}function ke(t,e){const i={...t};return e.forEach(r=>{delete i[r]}),i}var qt=(t=>(t.POINT="Point",t.POLYGON="Polygon",t))(qt||{}),st=(t=>(t.POINT="Point",t.POLYGON="Polygon",t.GATE="Gate",t))(st||{}),Gt=(t=>(t.DEFAULT_NAME="DefaultName",t))(Gt||{}),Kt=(t=>(t.ABSOLUTE_DISTANCE="AbsoluteDistance",t.ACTUAL_DISTANCE="ActualDistance",t))(Kt||{});const ot=["specialHours","businessStatus","serviceHours","keywords","siteCode","refPhotoId","totalPhotoCount","photos","icon"],at=D.getInstance();class Wt{_poisApi="api/v5/pois";_categoriesGroupApi="api/v5/categories/group";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=`${this._poisApi}/${i}`;return this._filterPoiProperties(r,W)}searchByDistance(e){const{center:i,distance:r,keywords:n="",offset:s=R,page:o=k}=e;if(!Z(i))throw new Error("Invalid center parameter. Expected an array of two numbers.");if(!se(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)),v(n)&&a.set("keywords",n);const l=`${this._poisApi}?${a.toString()}`;return this._filterPoiProperties(l,W)}searchByBounds(e){const{bounds:i,offset:r=R,page:n=k,keywords:s,orderBy:o}=e;if(!Se(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)),v(s)&&a.set("keywords",s),o&&a.set("orderBy",o);const l=`${this._poisApi}?${a.toString()}`;return this._filterPoiProperties(l,W)}searchByBuilding(e){const{buildingId:i,offset:r=R,page:n=k,keywords:s,orderBy:o}=e;if(!v(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)),v(s)&&a.set("keywords",s),o&&a.set("orderBy",o);const l=`${this._poisApi}?${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(!v(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)),v(s)&&a.set("keywords",s),o&&a.set("orderBy",o);const l=`${this._poisApi}?${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),v(l)&&u.set("keywords",l),d&&u.set("orderBy",d);const h=`${this._poisApi}?${u.toString()}`;return this._filterPoiProperties(h,W)}async searchByOrientation(e){const{center:i,angle:r,distance:n,distanceSearchType:s=st.POINT}=e;if(!Z(i))throw new Error("Invalid center parameter. Expected an array of two numbers.");if(!se(n)||n>100)throw new Error("Invalid distance parameter. Expected a positive number and no more than 100.");if(!se(r))throw new Error("Invalid angle parameter. Expected a positive number.");const o=new URLSearchParams;if("ordinal"in e){if(!v(e.ordinal))throw new Error("'ordinal' must be a non-empty string.");o.set("ordinal",e.ordinal)}else if("floorId"in e){if(!v(e.floorId))throw new Error("'floorId' must be a non-empty string.");o.set("floorId",e.floorId)}else if("buildingId"in e){if(!v(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=`${this._poisApi}/orientation?${o.toString()}`;return(await at.getHttpSession()).request(a)}searchByCategory(e){const{center:i,distance:r,page:n=k,offset:s=R}=e;if(!Z(i))throw new Error("Invalid center parameter. Expected an array of two numbers.");if(!se(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&&v(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=`${this._poisApi}?${o.toString()}`;return this._filterPoiProperties(a,W)}async searchCategories(e){const i=new URLSearchParams;if("floorId"in e&&v(e.floorId)?i.set("floorId",e.floorId):"buildingId"in e&&v(e.buildingId)?i.set("buildingId",e.buildingId):"sharedFloorId"in e&&v(e.sharedFloorId)?i.set("sharedFloorId",e.sharedFloorId):"venueId"in e&&v(e.venueId)&&i.set("venueId",e.venueId),"bounds"in e&&Se(e.bounds)&&(i.set("bbox",e.bounds.flat().join()),v(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=`${this._categoriesGroupApi}?${i.toString()}`;return(await at.getHttpSession()).request(r)}search(e){const i=new URLSearchParams;Object.entries(e).forEach(([n,s])=>{switch(n){case"bounds":Se(s)&&i.set("bbox",s.flat().join());break;case"center":Z(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=`${this._poisApi}?${i.toString()}`;return this._filterPoiProperties(r,W)}async _filterPoiProperties(e,i){const n=await(await at.getHttpSession()).request(e),s=n.result.pois.map(i);return{...n,result:{...n.result,pois:s}}}}function W(t){return"sharedFloorId"in t,ke(t,ot)}const Yt=["opening_hours","description","phone","website","email","appURL","icon"],Dr=D.getInstance();class Xt{_api="api/v5/venues";constructor(){}searchByIds(e){const i=N(e);if(!i)throw new Error("Please input venue id at least one.");const r=`${this._api}/${i}`;return this._filterVenueProperties(r,oe)}searchByDistance(e){const{center:i,distance:r,keywords:n="",offset:s=R,page:o=k}=e;if(!Z(i))throw new Error("Invalid center parameter. Expected an array of two numbers.");if(!se(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)),v(n)&&a.set("keywords",n);const l=`${this._api}?${a.toString()}`;return this._filterVenueProperties(l,oe)}searchByBounds(e){const{keywords:i,bounds:r,offset:n=R,page:s=k}=e;if(!Se(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)),v(i)&&o.set("keywords",i);const a=`${this._api}?${o.toString()}`;return this._filterVenueProperties(a,oe)}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)),v(i)&&s.set("keywords",i);const o=`${this._api}?${s.toString()}`;return this._filterVenueProperties(o,oe)}searchBySharedFloorId(e){if(!v(e))throw new Error("Please input correct sharedFloorId.");const i=`${this._api}/shared_floors/${e}`;return this._filterVenueProperties(i,oe)}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=`${this._api}?${i.toString()}`;return this._filterVenueProperties(r,oe)}async _filterVenueProperties(e,i){const n=await(await Dr.getHttpSession()).request(e),s=n.result.venues.map(i);return{...n,result:{...n.result,venues:s}}}}function oe(t){return ke(t,Yt)}const Qt=["specialHours","businessStatus","serviceHours","keywords","siteCode","refPhotoId","totalPhotoCount","photos","description"],Hr=D.getInstance();class Zt{_api="api/v5/buildings";constructor(){}searchByIds(e){const i=N(e);if(!i)throw new Error("Please input building id at least one.");const r=`${this._api}/${i}`;return this._filterBuildingProperties(r,ae)}searchByDistance(e){const{center:i,distance:r,keywords:n="",offset:s=R,page:o=k}=e;if(!Z(i))throw new Error("Invalid center parameter. Expected an array of two numbers.");if(!se(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)),v(n)&&a.set("keywords",n);const l=`${this._api}?${a.toString()}`;return this._filterBuildingProperties(l,ae)}searchByBounds(e){const{bounds:i,offset:r=R,page:n=k,keywords:s}=e;if(!Se(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)),v(s)&&o.set("keywords",s);const a=`${this._api}?${o.toString()}`;return this._filterBuildingProperties(a,ae)}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)),v(i)&&s.set("keywords",i);const o=`${this._api}?${s.toString()}`;return this._filterBuildingProperties(o,ae)}searchByFloorId(e){if(!v(e))throw new Error("'floorId' cannot be empty.");const i=`${this._api}/floors/${e}`;return this._filterBuildingProperties(i,ae)}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=`${this._api}?${i.toString()}`;return this._filterBuildingProperties(r,ae)}async _filterBuildingProperties(e,i){const n=await(await Hr.getHttpSession()).request(e),s=n.result.buildings.map(i);return{...n,result:{...n.result,buildings:s}}}}function ae(t){return ke(t,Qt)}const Jt=new Zt,ei=new Xt,Nr=new Wt;async function De(t){return(await Jt.searchByIds(t)).result.buildings[0]}async function Ur(t){const i=(await Jt.searchByFloorId(t)).result.buildings[0].buildingId;return await De(i)}async function He(t){return(await ei.searchByIds(t)).result.venues[0]}async function ti(t){return(await ei.searchBySharedFloorId(t)).result.venues[0]}async function jr(t){return(await Nr.searchByIds([t])).result.pois[0]}class Y{static instance;_visitedBuildingUnits;_historyBuildingUnit;_historyOrdinal;constructor(){this._visitedBuildingUnits=[],this._historyBuildingUnit=new Map,this._historyOrdinal=new Map}static getInstance(){return Y.instance||(Y.instance=new Y),Y.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 ii=typeof global=="object"&&global&&global.Object===Object&&global,Vr=typeof self=="object"&&self&&self.Object===Object&&self,U=ii||Vr||Function("return this")(),X=U.Symbol,ri=Object.prototype,zr=ri.hasOwnProperty,qr=ri.toString,ve=X?X.toStringTag:void 0;function Gr(t){var e=zr.call(t,ve),i=t[ve];try{t[ve]=void 0;var r=!0}catch{}var n=qr.call(t);return r&&(e?t[ve]=i:delete t[ve]),n}var Kr=Object.prototype,Wr=Kr.toString;function Yr(t){return Wr.call(t)}var Xr="[object Null]",Qr="[object Undefined]",ni=X?X.toStringTag:void 0;function le(t){return t==null?t===void 0?Qr:Xr:ni&&ni in Object(t)?Gr(t):Yr(t)}function de(t){return t!=null&&typeof t=="object"}var Zr="[object Symbol]";function Ie(t){return typeof t=="symbol"||de(t)&&le(t)==Zr}function Jr(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&&!Ie(o):i(o,a)))var a=o,l=s}return l}function en(){this.__data__=[],this.size=0}function si(t,e){return t===e||t!==t&&e!==e}function Ne(t,e){for(var i=t.length;i--;)if(si(t[i][0],e))return i;return-1}var tn=Array.prototype,rn=tn.splice;function nn(t){var e=this.__data__,i=Ne(e,t);if(i<0)return!1;var r=e.length-1;return i==r?e.pop():rn.call(e,i,1),--this.size,!0}function sn(t){var e=this.__data__,i=Ne(e,t);return i<0?void 0:e[i][1]}function on(t){return Ne(this.__data__,t)>-1}function an(t,e){var i=this.__data__,r=Ne(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=en,j.prototype.delete=nn,j.prototype.get=sn,j.prototype.has=on,j.prototype.set=an;function ln(){this.__data__=new j,this.size=0}function dn(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i}function un(t){return this.__data__.get(t)}function cn(t){return this.__data__.has(t)}function ue(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var hn="[object AsyncFunction]",_n="[object Function]",fn="[object GeneratorFunction]",pn="[object Proxy]";function oi(t){if(!ue(t))return!1;var e=le(t);return e==_n||e==fn||e==hn||e==pn}var lt=U["__core-js_shared__"],ai=(function(){var t=/[^.]+$/.exec(lt&<.keys&<.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function gn(t){return!!ai&&ai in t}var yn=Function.prototype,mn=yn.toString;function J(t){if(t!=null){try{return mn.call(t)}catch{}try{return t+""}catch{}}return""}var bn=/[\\^$.*+?()[\]{}|]/g,Sn=/^\[object .+?Constructor\]$/,vn=Function.prototype,In=Object.prototype,Ln=vn.toString,wn=In.hasOwnProperty,Bn=RegExp("^"+Ln.call(wn).replace(bn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function En(t){if(!ue(t)||gn(t))return!1;var e=oi(t)?Bn:Sn;return e.test(J(t))}function Pn(t,e){return t?.[e]}function ce(t,e){var i=Pn(t,e);return En(i)?i:void 0}var Le=ce(U,"Map"),we=ce(Object,"create");function Fn(){this.__data__=we?we(null):{},this.size=0}function Cn(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var On="__lodash_hash_undefined__",$n=Object.prototype,An=$n.hasOwnProperty;function Mn(t){var e=this.__data__;if(we){var i=e[t];return i===On?void 0:i}return An.call(e,t)?e[t]:void 0}var xn=Object.prototype,Tn=xn.hasOwnProperty;function Rn(t){var e=this.__data__;return we?e[t]!==void 0:Tn.call(e,t)}var kn="__lodash_hash_undefined__";function Dn(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=we&&e===void 0?kn:e,this}function ee(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])}}ee.prototype.clear=Fn,ee.prototype.delete=Cn,ee.prototype.get=Mn,ee.prototype.has=Rn,ee.prototype.set=Dn;function Hn(){this.size=0,this.__data__={hash:new ee,map:new(Le||j),string:new ee}}function Nn(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function Ue(t,e){var i=t.__data__;return Nn(e)?i[typeof e=="string"?"string":"hash"]:i.map}function Un(t){var e=Ue(this,t).delete(t);return this.size-=e?1:0,e}function jn(t){return Ue(this,t).get(t)}function Vn(t){return Ue(this,t).has(t)}function zn(t,e){var i=Ue(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=Hn,V.prototype.delete=Un,V.prototype.get=jn,V.prototype.has=Vn,V.prototype.set=zn;var qn=200;function Gn(t,e){var i=this.__data__;if(i instanceof j){var r=i.__data__;if(!Le||r.length<qn-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 z(t){var e=this.__data__=new j(t);this.size=e.size}z.prototype.clear=ln,z.prototype.delete=dn,z.prototype.get=un,z.prototype.has=cn,z.prototype.set=Gn;var Kn="__lodash_hash_undefined__";function Wn(t){return this.__data__.set(t,Kn),this}function Yn(t){return this.__data__.has(t)}function Be(t){var e=-1,i=t==null?0:t.length;for(this.__data__=new V;++e<i;)this.add(t[e])}Be.prototype.add=Be.prototype.push=Wn,Be.prototype.has=Yn;function Xn(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 li(t,e){return t.has(e)}var Qn=1,Zn=2;function di(t,e,i,r,n,s){var o=i&Qn,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 h=-1,c=!0,f=i&Zn?new Be:void 0;for(s.set(t,e),s.set(e,t);++h<a;){var g=t[h],_=e[h];if(r)var y=o?r(_,g,h,e,t,s):r(g,_,h,t,e,s);if(y!==void 0){if(y)continue;c=!1;break}if(f){if(!Xn(e,function(m,S){if(!li(f,S)&&(g===m||n(g,m,i,r,s)))return f.push(S)})){c=!1;break}}else if(!(g===_||n(g,_,i,r,s))){c=!1;break}}return s.delete(t),s.delete(e),c}var ui=U.Uint8Array;function Jn(t){var e=-1,i=Array(t.size);return t.forEach(function(r,n){i[++e]=[n,r]}),i}function dt(t){var e=-1,i=Array(t.size);return t.forEach(function(r){i[++e]=r}),i}var es=1,ts=2,is="[object Boolean]",rs="[object Date]",ns="[object Error]",ss="[object Map]",os="[object Number]",as="[object RegExp]",ls="[object Set]",ds="[object String]",us="[object Symbol]",cs="[object ArrayBuffer]",hs="[object DataView]",ci=X?X.prototype:void 0,ut=ci?ci.valueOf:void 0;function _s(t,e,i,r,n,s,o){switch(i){case hs:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case cs:return!(t.byteLength!=e.byteLength||!s(new ui(t),new ui(e)));case is:case rs:case os:return si(+t,+e);case ns:return t.name==e.name&&t.message==e.message;case as:case ds:return t==e+"";case ss:var a=Jn;case ls:var l=r&es;if(a||(a=dt),t.size!=e.size&&!l)return!1;var d=o.get(t);if(d)return d==e;r|=ts,o.set(t,e);var u=di(a(t),a(e),r,n,s,o);return o.delete(t),u;case us:if(ut)return ut.call(t)==ut.call(e)}return!1}function fs(t,e){for(var i=-1,r=e.length,n=t.length;++i<r;)t[n+i]=e[i];return t}var q=Array.isArray;function ps(t,e,i){var r=e(t);return q(t)?r:fs(r,i(t))}function gs(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 ys(){return[]}var ms=Object.prototype,bs=ms.propertyIsEnumerable,hi=Object.getOwnPropertySymbols,Ss=hi?function(t){return t==null?[]:(t=Object(t),gs(hi(t),function(e){return bs.call(t,e)}))}:ys;function vs(t,e){for(var i=-1,r=Array(t);++i<t;)r[i]=e(i);return r}var Is="[object Arguments]";function _i(t){return de(t)&&le(t)==Is}var fi=Object.prototype,Ls=fi.hasOwnProperty,ws=fi.propertyIsEnumerable,pi=_i((function(){return arguments})())?_i:function(t){return de(t)&&Ls.call(t,"callee")&&!ws.call(t,"callee")};function Bs(){return!1}var gi=typeof p=="object"&&p&&!p.nodeType&&p,yi=gi&&typeof module=="object"&&module&&!module.nodeType&&module,Es=yi&&yi.exports===gi,mi=Es?U.Buffer:void 0,Ps=mi?mi.isBuffer:void 0,ct=Ps||Bs,Fs=9007199254740991,Cs=/^(?:0|[1-9]\d*)$/;function bi(t,e){var i=typeof t;return e=e??Fs,!!e&&(i=="number"||i!="symbol"&&Cs.test(t))&&t>-1&&t%1==0&&t<e}var Os=9007199254740991;function ht(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Os}var $s="[object Arguments]",As="[object Array]",Ms="[object Boolean]",xs="[object Date]",Ts="[object Error]",Rs="[object Function]",ks="[object Map]",Ds="[object Number]",Hs="[object Object]",Ns="[object RegExp]",Us="[object Set]",js="[object String]",Vs="[object WeakMap]",zs="[object ArrayBuffer]",qs="[object DataView]",Gs="[object Float32Array]",Ks="[object Float64Array]",Ws="[object Int8Array]",Ys="[object Int16Array]",Xs="[object Int32Array]",Qs="[object Uint8Array]",Zs="[object Uint8ClampedArray]",Js="[object Uint16Array]",eo="[object Uint32Array]",I={};I[Gs]=I[Ks]=I[Ws]=I[Ys]=I[Xs]=I[Qs]=I[Zs]=I[Js]=I[eo]=!0,I[$s]=I[As]=I[zs]=I[Ms]=I[qs]=I[xs]=I[Ts]=I[Rs]=I[ks]=I[Ds]=I[Hs]=I[Ns]=I[Us]=I[js]=I[Vs]=!1;function to(t){return de(t)&&ht(t.length)&&!!I[le(t)]}function io(t){return function(e){return t(e)}}var Si=typeof p=="object"&&p&&!p.nodeType&&p,Ee=Si&&typeof module=="object"&&module&&!module.nodeType&&module,ro=Ee&&Ee.exports===Si,_t=ro&&ii.process,vi=(function(){try{var t=Ee&&Ee.require&&Ee.require("util").types;return t||_t&&_t.binding&&_t.binding("util")}catch{}})(),Ii=vi&&vi.isTypedArray,Li=Ii?io(Ii):to,no=Object.prototype,so=no.hasOwnProperty;function oo(t,e){var i=q(t),r=!i&&pi(t),n=!i&&!r&&ct(t),s=!i&&!r&&!n&&Li(t),o=i||r||n||s,a=o?vs(t.length,String):[],l=a.length;for(var d in t)so.call(t,d)&&!(o&&(d=="length"||n&&(d=="offset"||d=="parent")||s&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||bi(d,l)))&&a.push(d);return a}var ao=Object.prototype;function lo(t){var e=t&&t.constructor,i=typeof e=="function"&&e.prototype||ao;return t===i}function uo(t,e){return function(i){return t(e(i))}}var co=uo(Object.keys,Object),ho=Object.prototype,_o=ho.hasOwnProperty;function fo(t){if(!lo(t))return co(t);var e=[];for(var i in Object(t))_o.call(t,i)&&i!="constructor"&&e.push(i);return e}function po(t){return t!=null&&ht(t.length)&&!oi(t)}function wi(t){return po(t)?oo(t):fo(t)}function Bi(t){return ps(t,wi,Ss)}var go=1,yo=Object.prototype,mo=yo.hasOwnProperty;function bo(t,e,i,r,n,s){var o=i&go,a=Bi(t),l=a.length,d=Bi(e),u=d.length;if(l!=u&&!o)return!1;for(var h=l;h--;){var c=a[h];if(!(o?c in e:mo.call(e,c)))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;++h<l;){c=a[h];var m=t[c],S=e[c];if(r)var E=o?r(S,m,c,e,t,s):r(m,S,c,t,e,s);if(!(E===void 0?m===S||n(m,S,i,r,s):E)){_=!1;break}y||(y=c=="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 ft=ce(U,"DataView"),pt=ce(U,"Promise"),he=ce(U,"Set"),gt=ce(U,"WeakMap"),Ei="[object Map]",So="[object Object]",Pi="[object Promise]",Fi="[object Set]",Ci="[object WeakMap]",Oi="[object DataView]",vo=J(ft),Io=J(Le),Lo=J(pt),wo=J(he),Bo=J(gt),Q=le;(ft&&Q(new ft(new ArrayBuffer(1)))!=Oi||Le&&Q(new Le)!=Ei||pt&&Q(pt.resolve())!=Pi||he&&Q(new he)!=Fi||gt&&Q(new gt)!=Ci)&&(Q=function(t){var e=le(t),i=e==So?t.constructor:void 0,r=i?J(i):"";if(r)switch(r){case vo:return Oi;case Io:return Ei;case Lo:return Pi;case wo:return Fi;case Bo:return Ci}return e});var Eo=1,$i="[object Arguments]",Ai="[object Array]",je="[object Object]",Po=Object.prototype,Mi=Po.hasOwnProperty;function Fo(t,e,i,r,n,s){var o=q(t),a=q(e),l=o?Ai:Q(t),d=a?Ai:Q(e);l=l==$i?je:l,d=d==$i?je:d;var u=l==je,h=d==je,c=l==d;if(c&&ct(t)){if(!ct(e))return!1;o=!0,u=!1}if(c&&!u)return s||(s=new z),o||Li(t)?di(t,e,i,r,n,s):_s(t,e,l,i,r,n,s);if(!(i&Eo)){var f=u&&Mi.call(t,"__wrapped__"),g=h&&Mi.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 c?(s||(s=new z),bo(t,e,i,r,n,s)):!1}function yt(t,e,i,r,n){return t===e?!0:t==null||e==null||!de(t)&&!de(e)?t!==t&&e!==e:Fo(t,e,i,r,yt,n)}var Co=1,Oo=2;function $o(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,h;if(!(h===void 0?yt(d,l,Co|Oo,r,u):h))return!1}}return!0}function xi(t){return t===t&&!ue(t)}function Ao(t){for(var e=wi(t),i=e.length;i--;){var r=e[i],n=t[r];e[i]=[r,n,xi(n)]}return e}function Ti(t,e){return function(i){return i==null?!1:i[t]===e&&(e!==void 0||t in Object(i))}}function Mo(t){var e=Ao(t);return e.length==1&&e[0][2]?Ti(e[0][0],e[0][1]):function(i){return i===t||$o(i,t,e)}}var xo=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,To=/^\w*$/;function mt(t,e){if(q(t))return!1;var i=typeof t;return i=="number"||i=="symbol"||i=="boolean"||t==null||Ie(t)?!0:To.test(t)||!xo.test(t)||e!=null&&t in Object(e)}var Ro="Expected a function";function bt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Ro);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(bt.Cache||V),i}bt.Cache=V;var ko=500;function Do(t){var e=bt(t,function(r){return i.size===ko&&i.clear(),r}),i=e.cache;return e}var Ho=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,No=/\\(\\)?/g,Uo=Do(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Ho,function(i,r,n,s){e.push(n?s.replace(No,"$1"):r||i)}),e});function jo(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 Ri=X?X.prototype:void 0,ki=Ri?Ri.toString:void 0;function Di(t){if(typeof t=="string")return t;if(q(t))return jo(t,Di)+"";if(Ie(t))return ki?ki.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function Hi(t){return t==null?"":Di(t)}function Ni(t,e){return q(t)?t:mt(t,e)?[t]:Uo(Hi(t))}function Ve(t){if(typeof t=="string"||Ie(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function Ui(t,e){e=Ni(e,t);for(var i=0,r=e.length;t!=null&&i<r;)t=t[Ve(e[i++])];return i&&i==r?t:void 0}function Vo(t,e,i){var r=t==null?void 0:Ui(t,e);return r===void 0?i:r}function zo(t,e){return t!=null&&e in Object(t)}function qo(t,e,i){e=Ni(e,t);for(var r=-1,n=e.length,s=!1;++r<n;){var o=Ve(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&&ht(n)&&bi(o,n)&&(q(t)||pi(t)))}function Go(t,e){return t!=null&&qo(t,e,zo)}var Ko=1,Wo=2;function Yo(t,e){return mt(t)&&xi(e)?Ti(Ve(t),e):function(i){var r=Vo(i,t);return r===void 0&&r===e?Go(i,t):yt(e,r,Ko|Wo)}}function Xo(t){return t}function Qo(t){return function(e){return e?.[t]}}function Zo(t){return function(e){return Ui(e,t)}}function Jo(t){return mt(t)?Qo(Ve(t)):Zo(t)}function ji(t){return typeof t=="function"?t:t==null?Xo:typeof t=="object"?q(t)?Yo(t[0],t[1]):Mo(t):Jo(t)}function ea(t,e){return t<e}function ta(t,e){return t&&t.length?Jr(t,ji(e),ea):void 0}class ia{_isMaskMode;_hiddenBuildings;_history;constructor(e){this._isMaskMode=e,this._hiddenBuildings=[],this._history=Y.getInstance()}getLayeredData(e){const{selectedVenueId:i,venueMap:r,buildingMap:n,sharedFloorMap:s}=e,o=[],a=[],l=[],d=[],u=[],h=[],c=[...r.values()],f=i?[r.get(i),...c.filter(g=>g.properties.id!==i)]:c;for(const g of f){if(!g||!g.properties)continue;const{id:_,overlap:y,building_ids:m,shared_level_ids:S,default_displayed_ordinal:E,default_displayed_building:C}=g.properties,B=_===i,b=sa(y),O=w(m),$=this._history.getHistoryOrdinal(_);let P=$??E;if(P)$||(this._history.setHistoryOrdinal(_,P),this._history.setHistoryBuildingUnit(_,{id:C,type:"building"}));else{const{ordinal:L,buildingId:H}=ra(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=na(H,P);A?this._isMaskMode?B?(a.push(A),o.push({level:A,overlap:b.get(A)??null,venueId:_})):u.push(L):(o.push({level:A,overlap:b.get(A)??null,venueId:_}),B&&a.push(A)):d.push(L)}),w(S).forEach(L=>{const H=s.get(L),{ordinal:A,persistence:K}=H?.properties||{},ne=K==="true"&&0<=A&&A<=P,ge=A===P,Ze=ne||ge,$e={level:L,overlap:b.get(L)??null,venueId:_};Ze?this._isMaskMode?B?(o.push($e),ne&&l.push(L),ge&&a.push(L)):h.push(L):(o.push($e),B&&ge&&a.push(L),ne&&l.push(L)):d.push(L)})}return this._hiddenBuildings=d,{displayedLevels:o,selectedLevelIds:a,alwaysDisplayedSharedLevelIds:l,maskBuildingIds:u,maskSharedFloorIds:h}}getHiddenBuildings(){return this._hiddenBuildings}}function ra(t,e){const i=t.find(s=>e.has(s))??t[0]??null,r=i?e.get(i):null;return{ordinal:r?Vi(r):null,buildingId:i}}function Vi(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=ta(n,o=>Math.abs(Number(o)-.1))),s}function na(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 sa(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 oa{_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 St=function(){return U.Date.now()},aa=/\s/;function la(t){for(var e=t.length;e--&&aa.test(t.charAt(e)););return e}var da=/^\s+/;function ua(t){return t&&t.slice(0,la(t)+1).replace(da,"")}var zi=NaN,ca=/^[-+]0x[0-9a-f]+$/i,ha=/^0b[01]+$/i,_a=/^0o[0-7]+$/i,fa=parseInt;function ze(t){if(typeof t=="number")return t;if(Ie(t))return zi;if(ue(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=ue(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=ua(t);var i=ha.test(t);return i||_a.test(t)?fa(t.slice(2),i?2:8):ca.test(t)?zi:+t}var pa="Expected a function",ga=Math.max,ya=Math.min;function vt(t,e,i){var r,n,s,o,a,l,d=0,u=!1,h=!1,c=!0;if(typeof t!="function")throw new TypeError(pa);e=ze(e)||0,ue(i)&&(u=!!i.leading,h="maxWait"in i,s=h?ga(ze(i.maxWait)||0,e):s,c="trailing"in i?!!i.trailing:c);function f(b){var O=r,$=n;return r=n=void 0,d=b,o=t.apply($,O),o}function g(b){return d=b,a=setTimeout(m,e),u?f(b):o}function _(b){var O=b-l,$=b-d,P=e-O;return h?ya(P,s-$):P}function y(b){var O=b-l,$=b-d;return l===void 0||O>=e||O<0||h&&$>=s}function m(){var b=St();if(y(b))return S(b);a=setTimeout(m,_(b))}function S(b){return a=void 0,c&&r?f(b):(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:S(St())}function B(){var b=St(),O=y(b);if(r=arguments,n=this,l=b,O){if(a===void 0)return g(l);if(h)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 ma(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 ba(t){return t!==t}function Sa(t,e,i){for(var r=i-1,n=t.length;++r<n;)if(t[r]===e)return r;return-1}function va(t,e,i){return e===e?Sa(t,e,i):ma(t,ba,i)}function Ia(t,e){var i=t==null?0:t.length;return!!i&&va(t,e,0)>-1}function La(){}var wa=1/0,Ba=he&&1/dt(new he([,-0]))[1]==wa?function(t){return new he(t)}:La,Ea=200;function Pa(t,e,i){var r=-1,n=Ia,s=t.length,o=!0,a=[],l=a;if(s>=Ea){var d=e?null:Ba(t);if(d)return dt(d);o=!1,n=li,l=new Be}else l=e?[]:a;e:for(;++r<s;){var u=t[r],h=e?e(u):u;if(u=u!==0?u:0,o&&h===h){for(var c=l.length;c--;)if(l[c]===h)continue e;e&&l.push(h),a.push(u)}else n(l,h,i)||(l!==a&&l.push(h),a.push(u))}return a}function qi(t,e){return t&&t.length?Pa(t,ji(e)):[]}var Fa=0;function te(t){var e=++Fa;return Hi(t)+e}const Pe="Indoor_selectedFloorChanged",qe="Indoor_selectedBuildingChanged",It="Indoor_mapxusMapLoaded",Gi="Indoor_maplibreMapLoaded",Ge="mapxus-venue-fill",ie="mapxus-building-line",Ki="mapxus-level-fill",Lt="mapxus-shared-level-fill",wt="highlight-mapxus_level",Bt="highlight-mapxus_shared_level";class Wi extends Ir.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=ye(Pe);_startWithIndoorView;_indoorMapLoaded=!1;_isSelectSharedFloor=!1;_isMaskMode;_upperLevels=new Set;_middleLevels=new Set;_lowerLevels=new Set;_featureIncomplete=!1;_fitBounds;_dragPan;_history=Y.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:h}=e;this.layeredHandler=new ia(l),this.dragPanHandler=new oa(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=h,this._selectedHighlightStyle=s?Object.assign({},Re,s):Re,this._bindMaplibreEventListeners()}destroy(){this._isDestroyed||(this._isDestroyed=!0,this._dispatch.on(`.${Pe}`,null),this.off(qe),this.off(Gi),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(Pe,null,{venue:this.venue,building:this.building,floor:this.floor}),this.venue&&e&&(this._floorSwitchScope===xe.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[wt,Bt])if(this._map.getLayer(i))if(e){const{lineColor:r,lineOpacity:n,lineWidth:s,lineOffset:o}=this._selectedHighlightStyle,a=Yi(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=te(`${Pe}.`);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(qe,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(Pe,null,{venue:this.venue,building:this.building,floor:this.floor}),this.emit(qe,{...e,dragPan:this._dragPan}),this._dispatchIndoorMapLoaded(),this.updateRendering()}updateCustomLayers(){const e=this._map.getStyle();this._originIndoorLayers=it(e),this._outdoorLayers=Lr(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:[ie]})[0];await this._waitForFeatureLoaded(e)}}async panToVenueCenter(){if(this.dragPanHandler.panToCenter(),this._featureIncomplete){const e=()=>this.getFeaturesById(this._curVenueId,{layerIds:[Ge]})[0];await this._waitForFeatureLoaded(e)}}async _waitForFeatureLoaded(e){const i=()=>this._isDestroyed?(this._abortQueryFeature?.(),!0):!!e(),{promise:r,abort:n}=kr(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 queryIndoorFeaturesByClickPoint(e){const i=this._queryVisibleFeature(e);if(!i)return null;const r=async s=>{let o=this.getFeaturesById(s,{layerIds:[Ge]})[0];if(!o){const a=await He(s);o=Te(a),this._featureIncomplete=!0}return o??null},n=async s=>{let o=this.getFeaturesById(s,{layerIds:[ie]})[0];if(!o){const a=await De(s);o=nt(a),this._featureIncomplete=!0}return o??null};if(Ke(i.sourceLayer,i.layer.type)){const{id:s,"ref:building":o,name:a,ordinal:l}=i.properties,d=await n(o);if(d){const u=d.properties["ref:venue"];return{venue:await r(u),building:d,floor:{id:s,code:a,ordinal:l}}}}else if(Qi(i.sourceLayer,i.layer.type)){const{id:s,ordinal:o,name:a,"ref:venue":l}=i.properties;return{sharedFloor:{id:s,ordinal:o,name:typeof a=="string"?{default:a}:a},venue:await r(l)}}else{const s=i?.properties?.["ref:venue"];return i?{building:i,venue:await r(s)}:null}}async selectByClickMap(e){!this._enableIndoorClickSelection&&!this._enableOutdoorClickSelection||(this.setDragPan(!1),this.dragPanHandler.setBounds(null),this._featureIncomplete=!1,e?this._enableIndoorClickSelection&&("building"in e?await this.selectBuilding(e.building,{floorId:e?.floor?.id}):"sharedFloor"in e&&await this.selectSharedFloor(e.sharedFloor,e.venue)):this._enableOutdoorClickSelection&&await this.selectBuilding(null))}_bindMaplibreEventListeners(){this._map.once("styledata",()=>this.updateCustomLayers()),this._map.once("idle",()=>{this.emit(Gi),(!this._startWithIndoorView||this._map.getZoom()<14)&&this._dispatchIndoorMapLoaded()}),this._map.on("sourcedata",this._debounceRendering=vt(()=>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=>rt(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[me,x]){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===me?this._middleLayers[0]:this._lowerLayers[0];let a={"fill-opacity":0};if(this._isMaskMode&&e===x){const l=this._originIndoorLayers.find(({id:d})=>d===ie);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(be))return;const e=this._originIndoorLayers.find(({id:i})=>i===ie);if(e){const i=Object.assign({},e,{id:be,layout:Object.assign({},e.layout??{},{visibility:"visible"}),paint:Object.assign({},e.paint??{},{"fill-opacity":0})});this._map.addLayer(i,ie)}}_updateUnselectedMask(){if(!this._isMaskMode)return;const e=[...this._maskBuildings],i=[...this._maskSharedFloors];this._map.getLayer(be)&&this._map.setPaintProperty(be,"fill-opacity",["case",["in",["get","id"],["literal",e]],1,0]),this._map.getLayer(x)&&this._map.setPaintProperty(x,"fill-opacity",["case",["in",["get","id"],["literal",i]],1,0])}_addSelectedHighlightLayers(){const e=[{layerId:wt,sourceLayer:"mapxus_level"},{layerId:Bt,sourceLayer:"mapxus_shared_level"}];let i=this._originIndoorLayers.find(({type:r})=>Pt(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=Yi(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[wt,Bt])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})=>Xi(l,a)),i=this._originIndoorLayers.findIndex(({type:a,"source-layer":l})=>Et(l,a)),r=this._originIndoorLayers.slice(e,i);this._upperLayers=r.filter(({type:a})=>Oa(a));const n=this._originIndoorLayers.slice(i),s=n.findIndex(({type:a,"source-layer":l})=>!Et(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})=>!Pt(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===x.split("_")[1]))return;const i=this._upperLayers.filter(({"source-layer":n,type:s})=>!Ke(n,s)&&!Pt(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===Ge?i.push(s):o===ie?r.push(s):o===x&&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(h=>this._upperLevels.has(h)),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"),h=[...this._maskBuildings],c=[...this._maskSharedFloors];Xi(l,a)?r=["all",Ke(l,a)?["!in","ref:building",...h]:["!in","id",...c],["in","id",...e],...d]:u?r=["all",["!in","ref:shared_level",...c],["in","ref:shared_level",...e],...d]:(r=["all",["any",["all",["!in","ref:building",...h],["in","ref:level",...e]],["all",["!in","ref:shared_level",...c],["in","ref:shared_level",...e]]],...d],Et(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:[Ge]})[0]??null;if(!i)try{const r=await He(e);i=Te(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:Vi(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:[ie]})[0]||(this._fitBounds?this.dragPanHandler.fitBounds():this.dragPanHandler.panToCenter())}_queryVisibleFeature(e){const r=[Ki,Lt,`${Ki}-overlap-copy`,`${Lt}-overlap-copy`,`${Lt}-shared-bg`,...this._isMaskMode?[x,be]:[]].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&&Ca(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 Yi(t,e){const i=typeof t=="number"&&t===Re.lineWidth,r=typeof e=="number"&&e===Re.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 Ca(t,e){return t==="mapxus_building"&&(e==="fill"||e==="line"||e==="symbol")}function Xi(t,e){return Ke(t,e)||Qi(t,e)}function Ke(t,e){return t==="mapxus_level"&&(e==="fill"||e==="line")}function Qi(t,e){return t==="mapxus_shared_level"&&(e==="fill"||e==="line")}function Et(t,e){return t==="mapxus_place"&&e==="symbol"}function Pt(t){return t==="fill-extrusion"}function Oa(t){return t==="line"||t==="fill"||t==="fill-extrusion"}const We="Poi_poiClick";class Zi{_map;_currentStyle=null;_styleLayersLength=0;_layerIds=[];_dispatch=ye(We);_listeners=[];constructor(e){this._map=e,this._bindPoiClickEvent()}destroy(){this._dispatch.on(`.${We}`,null),this._currentStyle=null,this._map=null,this._dispatch=null,this._listeners=[],this._layerIds=[]}onPoiClick(e){const i=te(`${We}.`);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=it(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:h="",correlation_id:c}=d?.properties||{},f=Ji(d?.properties);return{id:u,category:h,sectionName:f,...c&&{correlationId:c}}})}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(We,null,o)})}_queryIndoorFeaturesBySharedFloor(e){const i=this._map.queryRenderedFeatures({layers:[x,"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=Ji(r.properties);return{floor:{id:o,ordinal:a,name:l},venue:s}}_queryIndoorFeaturesByFloor(e){const i=this._map.queryRenderedFeatures({layers:[me,"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 Ji(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 Fe(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 er{_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(){Fe(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 $a=Math.max,Aa=Math.min;function Ma(t,e,i){return t>=Aa(e,i)&&t<$a(e,i)}var tr=1/0,xa=17976931348623157e292;function ir(t){if(!t)return t===0?t:0;if(t=ze(t),t===tr||t===-tr){var e=t<0?-1:1;return e*xa}return t===t?t:0}function rr(t,e,i){return e=ir(e),i===void 0?(i=e,e=0):i=ir(i),t=ze(t),Ma(t,e,i)}class nr{_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({},Vt,r):Vt,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(),Fe(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(qe,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:[x]})[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=vt(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 rr(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"))}}class Ta{_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","mapxus-logo",this._container);i.target="_blank",i.href="https://www.khi.co.jp/groupvision2030/mapxus.html",i.setAttribute("aria-label","Mapxus logo"),i.setAttribute("rel","noopener"),this._container.appendChild(i)}return this._container}onRemove(){Fe(this._container)}getDefaultPosition(){return"bottom-left"}}class Ra{_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(){Fe(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":"©Mapxus driven by Kawasaki ©OpenStreetMap contributors",e==="landsD"&&(this._anchor.href="https://www.map.gov.hk/gm/")}}class ka{_container;_$icon;_removeClickEventListener;onAdd(e){return this._container=F("div","maplibregl-ctrl mapxus-ctrl-collapsed-copyright",e.getContainer()),this._container.innerHTML=Da(),this._bindEvents(),this._container}onRemove(){this._removeClickEventListener(),Fe(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 Da(){return`
|
|
19
2
|
<div class="mapxus-collapsed-copyright-content">
|
|
20
3
|
<div class="mapxus-collapsed-copyright-menu hidden">
|
|
21
4
|
<div class="mapxus-collapsed-copyright-logo" onclick="window.open('https://www.khi.co.jp/groupvision2030/mapxus.html')"></div>
|
|
@@ -24,4 +7,4 @@ components: `).concat(bs(o),"\n```")),[2,s]}})})}}}function zf(){if(!(window.__f
|
|
|
24
7
|
</div>
|
|
25
8
|
<div class="mapxus-collapsed-copyright-btn"></div>
|
|
26
9
|
</div>
|
|
27
|
-
`}function Hc(e){return`${Go}/api/v3/tiles/styles/${e}`}class Uc{_buildingSelector;_isEnabled=!0;_position;constructor(t){this._buildingSelector=t}enable(){this._isEnabled=!0,this._buildingSelector.enabled||this._buildingSelector.setVisibility(!0)}disable(){this._isEnabled=!1,this._buildingSelector.enabled&&this._buildingSelector.setVisibility(!1)}setPosition(t,n){this._position=t,this._buildingSelector.changePosition(this._buildingSelector.position,t,n)}get isEnabled(){return this._isEnabled}get position(){return this._position}}class Nc{_floorSelector;_isEnabled;_position;constructor(t){this._floorSelector=t,this._position=t.position,this._isEnabled=this._floorSelector.enabled}enable(){this._isEnabled=!0,this._floorSelector.setEnabled(!0)}disable(){this._isEnabled=!1,this._floorSelector.setEnabled(!1)}setPosition(t,n){this._position=t,this._floorSelector.changePosition(this._floorSelector.position,t,n)}setStyle(t){this._floorSelector.setStyle(t)}get isEnabled(){return this._isEnabled}get position(){return this._position}}class Dc{_indoor;_isEnabled=!0;constructor(t){this._indoor=t}enable(){this._isEnabled=!0,this._indoor.setAllowBuildingSwitch(!0)}disable(){this._isEnabled=!1,this._indoor.setAllowBuildingSwitch(!1)}get isEnabled(){return this._isEnabled}}class $c{_indoor;_isEnabled=!0;constructor(t){this._indoor=t}enable(){this._isEnabled=!0,this._indoor.setAllowOutdoorSwitch(!0)}disable(){this._isEnabled=!1,this._indoor.setAllowOutdoorSwitch(!1)}get isEnabled(){return this._isEnabled}}class Vc{_indoor;_isEnabled=!0;constructor(t){this._indoor=t}enable(){this._isEnabled=!0,this._indoor.setAllowIndoorClickSelect(!0)}disable(){this._isEnabled=!1,this._indoor.setAllowIndoorClickSelect(!1)}get isEnabled(){return this._isEnabled}}class jc{_indoor;_isEnabled=!0;constructor(t){this._indoor=t}enable(){this._isEnabled=!0,this._indoor.setAllowOutdoorClickSelect(!0)}disable(){this._isEnabled=!1,this._indoor.setAllowOutdoorClickSelect(!1)}get isEnabled(){return this._isEnabled}}const qi="Map_mapClick",Ki="Map_pointClick",Gi="Map_isRenderComplete",Rn="Map_isDestroyed",lt=nt.getInstance();let Yg=class{_map;_indoor;_poi;_floorsControl;_buildingFilterControl;_attributionControl;_language;_dispatch=Wt(qi,Ki,Gi,Rn);_fitBounds;_history=Bt.getInstance();_debounceHTTPErrorHandler;_transformRequestHandler;_tokenRefreshingPromise=null;_request=st.getInstance();_cancelTokenChangedListener;isDestroyed=!1;switchOutdoor;outdoorClickSelection;switchBuilding;indoorClickSelection;buildingSelector;floorSelector;constructor(t){if(!t.map)throw new Error("Map is required.");if(!Kc(t)&&!qc(t))throw new Error("Access params are required.");Kc(t)?lt.setAccessByAppKey({appId:t.appId,secret:t.secret,platform:t.platform}).then(async()=>{await lt.setupTokenManager(),this._setup(t)}):qc(t)&&(lt.setTokenGetter(t.getTokenAsync),lt.setupTokenManager().then(()=>{this._setup(t)}))}renderComplete(t){const n=Ut(`${Gi}.`);this._dispatch.on(n,t)}destroyed(t){const n=Ut(`${Rn}.`);this._dispatch.on(n,()=>{t(),this._dispatch.on(n,null),this._dispatch._[Rn].length===0&&(delete this._dispatch,Object.freeze(this))})}setTransformRequest(t){this._transformRequestHandler=t}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(t){this._language!==t&&(this._language=t);const i=(this._map?.getStyle()?.layers||[]).filter(({type:o})=>o==="symbol");for(const{id:o}of i){const s=this._map.getLayer(o),a=typeof this._map.getLayoutProperty(o,"text-field")=="string";s&&!a&&this._map.setLayoutProperty(o,"text-field",["coalesce",["get",`name:${t}`],["get","name"]])}}getLanguage(){return this._language}setOutdoorMapShown(t){this._indoor?.setOutdoorMapShown(t)}queryIndoorFeaturesByPoint(t){const{x:n,y:r}=t,i=this._map.queryRenderedFeatures([n,r],{layers:["mapxus-venue-fill","mapxus-building-line",nn,je]}),o=i.find(u=>u.layer.id==="mapxus-venue-fill");if(!o)return null;const s=this._history.getHistoryOrdinal(o.properties.id),a=i.find(u=>u.properties?.ordinal===s);if(a){if(a.sourceLayer==="mapxus_shared_level")return{venue:o,sharedLevel:a};const u=i.find(d=>d.properties.id===a.properties["ref:building"]);return{venue:o,building:u,level:a}}}getIndoorFeaturesByCoordinates(t,n){const r=this._map.project(t),i=this._map.queryRenderedFeatures(r,{layers:["mapxus-venue-fill","mapxus-building-line","mapxus-level-fill","mapxus-level-fill-overlap-copy"]});if(i.length===0)return{venue:null,building:null,level:null};const s=i.filter(d=>d.layer.id.includes("mapxus-level-fill")).find(d=>Number.isFinite(n)?d.properties.ordinal===n+"":d.layer.id.startsWith("mapxus-level-fill"));if(!s)return{venue:null,building:null,level:null};const a=i.find(d=>d.properties.id===s.properties["ref:building"]);return{venue:i.find(d=>d.properties.id===a.properties["ref:venue"]),building:a,level:s}}getFeaturesById(t,n){return this._indoor?.getFeaturesById(t,n)||[]}async switchFloorByOrdinal(t){await this._indoor?.switchFloorByOrdinal(t)}async selectFloorById(t,n){const{dragPan:r=!0,animate:i=!0,fitBounds:o}=n||{},s=o??this._fitBounds,a=async()=>{const u=await Gc(t),{maxLat:d,maxLon:g,minLat:p,minLon:I}=u?.bbox||{};this._indoor.dragPanHandler.setBounds([I,p,g,d])};if(this._indoor.setDragPan(r),this._indoor.setFitBounds(s),this._indoor.dragPanHandler.setAnimated(i),t===this.floor?.id){if(!r)return;s?(this._indoor.dragPanHandler.getBounds()||await a(),await this._indoor.dragPanHandler.fitBounds()):this._indoor.dragPanHandler.panToCenter()}else{let u=!1,d=(this._map.getLayer("mapxus-building-line")?this._map.queryRenderedFeatures({layers:["mapxus-building-line"]}):[]).find(p=>p.properties?.level_ids?.includes(t))??null;if(d&&d.properties?.id===this.building?.properties?.id){s&&!this._indoor.dragPanHandler.getBounds()&&await a();const{level_ids:p,ordinals:I}=d.properties,v=Oe(p).indexOf(t),h=Oe(I)[v]??null;await this._floorsControl.switchByOrdinal(h,r)}else{if(d)s&&await a();else{const p=await Gc(t),{maxLat:I,maxLon:v,minLat:h,minLon:b}=p.bbox;u=!0,d=p.feature,this._indoor.dragPanHandler.setBounds([b,h,v,I])}await this._indoor.selectBuilding(d??null,{floorId:t,featureIncomplete:u})}}}async selectSharedFloorById(t,n){const{dragPan:r=!0,animate:i=!0,fitBounds:o}=n||{},s=o??this._fitBounds,a=async()=>{const u=await Xg(t),{maxLat:d,maxLon:g,minLat:p,minLon:I}=u?.bbox||{};this._indoor.dragPanHandler.setBounds([I,p,g,d])};if(this._indoor.setDragPan(r),this._indoor.setFitBounds(s),this._indoor.dragPanHandler.setAnimated(i),t===this.floor?.id){if(!r)return;s?(this._indoor.dragPanHandler.getBounds()||await a(),await this._indoor.dragPanHandler.fitBounds()):this._indoor.dragPanHandler.panToCenter()}else{let u=!1,d,g;const p=(this._map.getLayer(je)?this._map.queryRenderedFeatures({layers:[je]}):[]).find(I=>I.properties?.id===t)??null;if(p)s&&await a();else{const I=await bc(t);g=Hn(I),u=!0;const{maxLat:v,maxLon:h,minLat:b,minLon:B}=I?.bbox||{};this._indoor.dragPanHandler.setBounds([B,b,h,v]);const T=I.sharedFloors.find(({id:U})=>U===t),{id:H,name:$,ordinal:Q}=T;d={id:H,name:$,ordinal:Q+""}}if(!u){const{id:I,name:v,ordinal:h,"ref:venue":b}=p.properties||{};d={id:I,name:typeof v=="string"?{default:v}:v,ordinal:h},g=(this._map.getLayer("mapxus-venue-fill")?this._map.queryRenderedFeatures({layers:["mapxus-venue-fill"]}):[]).find(B=>B.properties?.id===b)??null}d&&g&&await this._indoor?.selectSharedFloor(d,g,{featureIncomplete:u})}}async selectBuildingById(t,n){const{dragPan:r=!0,animate:i=!0,fitBounds:o}=n||{},s=o??this._fitBounds,a=async()=>{const u=await dr(t),{maxLat:d,maxLon:g,minLat:p,minLon:I}=u?.bbox||{};this._indoor.dragPanHandler.setBounds([I,p,g,d])};if(this._indoor.setDragPan(r),this._indoor.setFitBounds(s),this._indoor.dragPanHandler.setAnimated(i),t===this.building?.properties?.id){if(!r)return;s?(this._indoor.dragPanHandler.getBounds()||await a(),await this._indoor.dragPanHandler.fitBounds()):this._indoor.dragPanHandler.panToCenter()}else{let u=!1,d=(this._map.getLayer("mapxus-building-line")?this._map.queryRenderedFeatures({layers:["mapxus-building-line"]}):[]).find(g=>g.properties?.id===t)??null;if(d)s&&await a();else{const g=await dr(t),{maxLat:p,maxLon:I,minLat:v,minLon:h}=g?.bbox||{};d=Ar(g),u=!0,this._indoor.dragPanHandler.setBounds([h,v,I,p])}await this._indoor?.selectBuilding(d,{featureIncomplete:u})}}async selectVenueById(t,n){if(typeof t=="string"&&t.trim()===""||t===null){await this._indoor?.selectBuilding(null);return}const{dragPan:i=!0,animate:o=!0,fitBounds:s}=n||{},a=s??this._fitBounds,u=async()=>{const d=await fr(t),{maxLat:g,maxLon:p,minLat:I,minLon:v}=d?.bbox||{};this._indoor.dragPanHandler.setBounds([v,I,p,g])};if(this._indoor.setDragPan(i),this._indoor.setFitBounds(a),this._indoor.dragPanHandler.setAnimated(o),t===this.venue?.properties?.id){if(!i)return;a?(this._indoor.dragPanHandler.getBounds()||await u(),await this._indoor.dragPanHandler.fitBounds()):this._indoor.dragPanHandler.panToCenter()}else{const d=this._history.getHistoryBuildingUnit(t);if(d){const{id:g,type:p}=d;p==="building"?await this.selectBuildingById(g,n):await this.selectSharedFloorById(g,n)}else{const g=(this._map.getLayer("mapxus-venue-fill")?this._map.queryRenderedFeatures({layers:["mapxus-venue-fill"]}):[]).find(I=>I.properties?.id===t)??null;let p;if(g){const{default_displayed_building:I,building_ids:v}=g.properties;p=I||Oe(v)[0]}else{const I=await fr(t);p=I.defaultBuilding||I.buildings[0]?.id}await this.selectBuildingById(p,n)}}}onMapClickListener(t){const n=Ut(`${qi}.`);return this._dispatch.on(n,t),{unsubscribe:()=>this._dispatch.on(n,null)}}onPoiClickListener(t){return this._poi?.onPoiClick(t)}onPointClickListener(t){const n=Ut(`${Ki}.`);return this._dispatch.on(n,t),{unsubscribe:()=>this._dispatch.on(n,null)}}onMapChangeListener(t){return this._indoor?.onMapChange(t)}switchTheme(t){this.setTheme(t)}setTheme(t){t!==lt.theme&&(this._setStyle(Hc(t),{diff:!1}),lt.setTheme(t),this._map?.once("styledata",()=>{this._indoor.updateCustomLayers(),this._indoor.updateRendering()}),"changeTheme"in this._attributionControl&&this._attributionControl.changeTheme(t))}setSelectedBuildingBorderStyle(t){return this._indoor?.setSelectedHighlightStyle(t),this}setSelectedHighlightStyle(t){return this._indoor?.setSelectedHighlightStyle(t),this}setFloorSwitchScope(t){this._indoor?.setFloorSwitchScope(t)}async _setup(t){const{map:n,poiId:r,sharedFloorId:i,floorId:o,buildingId:s,venueId:a,theme:u=Sr.MAPXUS_DEFAULT,floorSelectorEnabled:d,buildingSelectorEnabled:g,outdoorMapShown:p=!0,collapseCopyright:I=!1,maskNonSelectedAreas:v=!1,fitBuildingBounds:h,fitBounds:b,boundsPadding:B=30,selectedHighlightStyle:T,floorSelectorStyle:H,language:$=pl,autoSelectBuilding:Q=!1,transformRequest:U=null,mapxusLogoEnabled:P=!0,enableIndoorClickSelection:K=!0,enableOutdoorClickSelection:J=!0,floorSwitchScope:q=Mn.VENUE}=t;this._map=n,this._language=$,this._fitBounds=b??h??!1,this._indoor=new Lc({map:this._map,startWithIndoorView:!!(a||s||o||r||i),outdoorMapShown:p,fitBounds:this._fitBounds,boundsPadding:B,maskNonSelectedAreas:v,selectedHighlightStyle:T,enableIndoorClickSelection:K,enableOutdoorClickSelection:J,floorSwitchScope:q}),this._poi=new Tc(this._map),this._transformRequestHandler=U,await this._resourceRequestTransform(),this._installRtlTextPlugin(),this._setStyle(Hc(u)),lt.setTheme(u),this._checkMapZoom(),I?this._attributionControl=new Zg:(this._attributionControl=new zg({theme:u}),this._addControl(new Gg({enabled:P}))),this._addControl(this._attributionControl),this._addControl(this._buildingFilterControl=new Rc(this,g)),this._addControl(this._floorsControl=new Mc(this._indoor,{language:$,style:H,enabled:d})),r?this._selectPoiById(r):o?this.selectFloorById(o,{animate:!1}):s?this.selectBuildingById(s,{animate:!1}):a?this.selectVenueById(a,{animate:!1}):i&&this.selectSharedFloorById(i,{animate:!1}),this.switchOutdoor=new $c(this._indoor),this.switchBuilding=new Dc(this._indoor),this.outdoorClickSelection=new jc(this._indoor),this.indoorClickSelection=new Vc(this._indoor),this.buildingSelector=new Uc(this._buildingFilterControl),this.floorSelector=new Nc(this._floorsControl),this._map.once("styledata",()=>this.setLanguage(this._language)),this._map.on("remove",()=>this._destroy()),this._map.on("error",this._debounceHTTPErrorHandler=Hi(Z=>this._updatePermission(Z),300)),this._indoor.once(Ui,()=>{Q&&this._map.on("moveend",()=>this._selectCenterBuilding()),this._bindMapClickListener(),this._bindTokenChangedListener(),this._dispatch.call(Gi)})}_setStyle(t,n){this._map?.setStyle(t,{localIdeographFontFamily:!1,...n??{}})}_addControl(t,n){this._map.addControl(t,n)}async _selectPoiById(t){try{const n=await cg(t),{lon:r,lat:i}=n.location;"floorId"in n?await this.selectFloorById(n.floorId,{animate:!1}):"sharedFloorId"in n&&await this.selectSharedFloorById(n.sharedFloorId,{animate:!1}),this._map.panTo([r,i],{animate:!1})}catch(n){this._handleSearchError(n)}}async _resourceRequestTransform(){const t=await this._request.getRequestHeaders();this._map.setTransformRequest((n,r)=>{const{host:i}=new URL(n);return i.includes("map-api")&&i.includes("mapxus")?{url:n,headers:t}:this._transformRequestHandler?this._transformRequestHandler(n,r):{url:n}})}_checkMapZoom(){const t=this._map.getZoom();(t<8||t>22)&&t>1&&console.warn("Indoor maps perform better at zoom levels [8, 22].")}async _updatePermission(t){if(t.error?.status===401)return this._tokenRefreshingPromise?this._tokenRefreshingPromise:(this._tokenRefreshingPromise=this._resourceRequestTransform().finally(()=>this._tokenRefreshingPromise=null),this._tokenRefreshingPromise)}_selectCenterBuilding(){const t=this._getCenterBuildingUnitsMap();if(!t.size)return;let n=t.entries().next().value[1];const r=this._history.getVisitedBuildingUnits().reverse();for(const i of r){const{id:o}=i;if(t.get(o)){n=i;break}}n.type==="building"?this.selectBuildingById(n.id,{dragPan:!1}):this.selectSharedFloorById(n.id,{dragPan:!1})}_getCenterBuildingUnitsMap(){const t=this._map.getCanvas().getBoundingClientRect(),n=t.width/4,r=t.height/4,i=[n,r],o=[t.width-n,t.height-r],s=["mapxus-building-line",je].filter(g=>this._map.getLayer(g)),a=this._map.queryRenderedFeatures([i,o],{layers:s}),d=Sc(a,"properties.id").filter(g=>!this._indoor.layeredHandler.getHiddenBuildings().includes(g.properties.id));return new globalThis.Map(d.map(({properties:g})=>[`${g.id}`,{id:g.id,type:g.building?"building":"sharedFloor"}]))}_bindMapClickListener(){this._map.on("click",async t=>{const{point:n,lngLat:r}=t,i=await this._indoor.queryIndoorFeaturesByClickPoint(n);await this._indoor.selectByClickMap(i),this._dispatch.call(Ki,null,{point:n,coordinate:r}),this._dispatch.call(qi,null,{coordinate:r,venue:i?.venue??null,building:i&&"building"in i?i.building:null,floor:i?"sharedFloor"in i?i.sharedFloor:i.floor??null:null})})}_bindTokenChangedListener(){const{off:t}=lt.on(bi,async()=>{await this._resourceRequestTransform()});this._cancelTokenChangedListener=t}_handleSearchError(t){const n=t?.response?.status||"unknown",r=t?.response?.data?.message||"unknown";lt.getGlobalDispatcher().call("initError",null,{status:n,message:r})}_installRtlTextPlugin(){$t.getRTLTextPluginStatus()==="unavailable"&&$t.setRTLTextPlugin("https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.3.0/dist/mapbox-gl-rtl-text.js",!0)}_destroy(){if(this.isDestroyed)return;this.isDestroyed=!0,this._debounceHTTPErrorHandler?.cancel();const t=this._dispatch._;for(const n in t)n!==Rn&&t.hasOwnProperty(n)&&t[n].forEach(({name:r})=>{this._dispatch.on(`${n}.${r}`,null)});this._indoor.destroy(),this._poi.destroy(),Object.keys(this).forEach(n=>{n!=="isDestroyed"&&n!=="_dispatch"&&delete this[n]}),this._cancelTokenChangedListener&&this._cancelTokenChangedListener(),lt.clearState(),this._dispatch.call(Rn)}};function qc(e){return"getTokenAsync"in e&&typeof e.getTokenAsync=="function"}function Kc(e){return"appId"in e&&e.appId.trim()!==""&&"secret"in e&&e.secret.trim()!==""}async function Gc(e){const t=await ag(e);return{feature:Ar(t),bbox:t.bbox}}async function Xg(e){const t=await bc(e);return{feature:Hn(t),bbox:t.bbox}}async function Pn(e,t){if(!e.hasImage(t))try{const n=await e.loadImage(t);e.addImage(t,n.data)}catch(n){throw new Error(n)}}class Jg{_maplibreMap;_layerId;_sourceId;_imageName="poi-01";_imageSize=.75;_iconAnchor="bottom";constructor(t){this._maplibreMap=t;const n=Ut();this._layerId=`MXMap_preset_marker_layer_${n}`,this._sourceId=`MXMap_preset_marker_source_${n}`}async setIcon(t){if(typeof t!="string"||!t.trim())throw new Error("Icon must be a non-empty string.");await Pn(this._maplibreMap,t.trim()),this._imageName=t}setIconSize(t){this._imageSize=t}setIconAnchor(t){this._iconAnchor=t}get layerId(){return this._layerId}get sourceId(){return this._sourceId}create(t){if(!(Array.isArray(t)&&t.length))return;const n=t.map(r=>this._createIconFeature(r));this._addIconSource(n),this._addIconLayer()}updateData(t){const n=!!(t.remove&&t.remove.length),r=!!(t.add&&t.add.length),i=!!(t.update&&t.update.length),o=this._maplibreMap.getSource(this._sourceId);if(!n&&!r&&!i||!o)return;const s={};n&&(s.remove=t.remove),r&&(s.add=t.add.map(a=>this._createIconFeature(a))),i&&(s.update=t.update.map(a=>{const u=this._createIconFeature(a),{id:d,geometry:g,properties:p}=u;return{id:d,...g&&{newGeometry:g},...p&&{addOrUpdateProperties:Object.entries(p).map(([I,v])=>({key:I,value:v}))},...!g&&!p&&{removeAllProperties:!0}}})),o.updateData(s)}remove(){this._maplibreMap.getLayer(this._layerId)&&this._maplibreMap.removeLayer(this._layerId),this._maplibreMap.getSource(this._sourceId)&&this._maplibreMap.removeSource(this._sourceId)}on(t,n){const r=o=>this._handleEventListener(o,n),{unsubscribe:i}=this._maplibreMap.on(t,this._layerId,r);return{off:i}}setFilter(t){this._maplibreMap.getLayer(this._layerId)&&this._maplibreMap.setFilter(this._layerId,t)}setFilterByVenue(t,n){this._maplibreMap.getLayer(this._layerId)&&this._maplibreMap.setFilter(this._layerId,["any",["all",["==",["get","venueId"],t??""],["==",["get","ordinal"],n??""]],["all",["==",["get","venueId"],""],["==",["get","ordinal"],""]]])}setFilterByBuilding(t,n){this._maplibreMap.getLayer(this._layerId)&&this._maplibreMap.setFilter(this._layerId,["any",["all",["==",["get","buildingId"],t??""],["==",["get","ordinal"],n??""]],["all",["==",["get","buildingId"],""],["==",["get","ordinal"],""]]])}setOpacity(t){this._maplibreMap.getLayer(this._layerId)&&this._maplibreMap.setPaintProperty(this._layerId,"icon-opacity",t)}setOpacityByVenue(t,n,r){if(this._maplibreMap.getLayer(this._layerId)){const i=["case",["all",["==",["get","venueId"],t??""],["==",["get","ordinal"],n??""]],1,["all",["==",["get","venueId"],""],["==",["get","ordinal"],""]],1,r??.5];this._maplibreMap.setPaintProperty(this._layerId,"icon-opacity",i)}}setOpacityByBuilding(t,n,r){if(this._maplibreMap.getLayer(this._layerId)){const i=["case",["all",["==",["get","buildingId"],t??""],["==",["get","ordinal"],n??""]],1,["all",["==",["get","buildingId"],""],["==",["get","ordinal"],""]],1,r??.5];this._maplibreMap.setPaintProperty(this._layerId,"icon-opacity",i)}}_createIconFeature(t){const{lngLat:n,properties:r}=t;return{id:"featureId"in t?t.featureId:void 0,type:"Feature",...n&&{geometry:{type:"Point",coordinates:n}},...r&&{properties:r}}}_addIconSource(t){const n={type:"geojson",data:{type:"FeatureCollection",features:t}};this._maplibreMap.addSource(this._sourceId,n)}_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(t,n){const{point:r}=t,i=this._maplibreMap.queryRenderedFeatures(r,{layers:[this._layerId]});n(i[0])}}function _r(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}const zi={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}},br="mmws-source-line-solid",en="mmws-layer-line-solid",tn="mmws-layer-icon-line-symbol",Zi="mmws-source-line-dashed",Dt="mmws-layer-line-dashed",Wi="mmws-source-icon-connector",zc="mmws-layer-icon-connector",wr="mmws-source-icon-marker",Yi="mmws-layer-icon-marker",Zc=[en,tn,Dt,zc,Yi],Qg=[br,Zi,Wi,wr];class em{_maplibreMap;_routeStyle=zi;_styleDiffs={};_filterBy="venue";_curVenue=null;_curBuilding=null;_curOrdinal=null;_renderBoundaryLayer;constructor(t,n){this._maplibreMap=t,n&&(this._updateStyleProperties(n),t.on("load",()=>this._loadMarkerIcons()))}async setStyle(t){this._updateStyleProperties(t),await this._loadMarkerIcons(),await this._updateLayers()}async setMarkerIcons(t){if(Array.isArray(t)&&t.length){const n=t.slice(1,t.length-1);this._routeStyle.markers={from:t[0],to:_r(t),stops:n.length?n:[t[0]]},this._styleDiffs={markers:this._routeStyle.markers}}else"from"in t&&(this._routeStyle.markers.from=t.from,this._styleDiffs.markers.from=t.from),"to"in t&&(this._routeStyle.markers.to=t.to,this._styleDiffs.markers.to=t.to),"stops"in t&&(this._routeStyle.markers.stops=t.stops??[null],this._styleDiffs.markers.stops=t.stops??[null]);await this._loadMarkerIcons()}setMarkerIconSize(t){return this._routeStyle.markerIconSize=t,this}setIndoorLineColor(t){return this._routeStyle.indoorLineColor=t,this}setOutdoorLineColor(t){return this._routeStyle.outdoorLineColor=t,this}setDashedLineColor(t){return this._routeStyle.dashedLineColor=t,this}setBusLineColor(t){return this._routeStyle.shuttleBusLineColor=t,this}render(t,n){if(!this._renderBoundaryLayer){const d=this._maplibreMap.getStyle(),g=Lr(d);let p=g.find(({type:I,id:v})=>!v.includes("-overlap-copy")&&I==="fill-extrusion");p||(p=g.find(I=>I.type==="symbol"&&I?.["source-layer"]==="mapxus_place")),this._renderBoundaryLayer=p?.id}const{instructions:r,points:{coordinates:i}}=t,{lineFeatures:o,connectorFeatures:s,dashedLineFeatures:a,markerFeatures:u}=this._classifyFeatures(r,i,n);this._renderSolidLines(o),this._renderLineSymbols(br,tn),this._routeStyle.disableDashedLine!==!0&&this._renderDashedLines(a),this._renderConnectors(s),this._renderMarkers(u)}remove(){Zc.forEach(t=>{this._maplibreMap.getLayer(t)&&this._maplibreMap.removeLayer(t)}),Qg.forEach(t=>{this._maplibreMap.getSource(t)&&this._maplibreMap.removeSource(t)})}setFilterByVenue(t,n){this._filterBy="venue",this._curVenue=t??null,this._curOrdinal=n??null,this._filterRouteOpacity()}setFilterByBuilding(t,n){this._filterBy="building",this._curBuilding=t??null,this._curOrdinal=n??null,this._filterRouteOpacity()}_classifyFeatures(t,n,r){const i=[],o=[],s=[],a=[],u=[];t.forEach((J,q)=>{const{venue_id:Z,building_id:te,floor_id:ne,ordinal:Y,sign:W,type:w,interval:[N,L]}=J;if(nm(W))u.push(J);else if(tm(W)){q!==0&&q!==t.length-1&&o.push(this._createIconFeature(`connector-${o.length}`,n[N],{...mt({venue_id:Z,building_id:te,floor_id:ne,ordinal:Y}),icon:w}));const E=t[q+1];if(E){const{venue_id:C,building_id:D,floor_id:f,ordinal:y}=E;o.push(this._createIconFeature(`connector-${o.length}`,n[L],{...mt({venue_id:C,building_id:D,floor_id:f,ordinal:y}),icon:w}))}}else i.push(this._createLineFeature(`solid-line-${i.length}`,n.slice(N,L+1),mt({venue_id:Z,building_id:te,floor_id:ne,ordinal:Y,isShuttleBus:rm(W)?1:0})))});const d=t[0],{venue_id:g,building_id:p,floor_id:I,ordinal:v}=d,h=t[t.length-1],{venue_id:b,building_id:B,floor_id:T,ordinal:H}=h,$=n[0],Q=n[n.length-1],U=r[0],P=r[r.length-1],K=r.slice(1,r.length-1);return U&&s.push(this._createLineFeature(`dashed-line-${s.length}`,[U,$],mt({venue_id:g,building_id:p,floor_id:I,ordinal:v}))),P&&s.push(this._createLineFeature(`dashed-line-${s.length}`,[Q,P],mt({venue_id:b,building_id:B,floor_id:T,ordinal:H}))),u.length&&K.length&&u.forEach(({venue_id:J,building_id:q,floor_id:Z,ordinal:te,interval:[ne]},Y)=>{s.push(this._createLineFeature(`dashed-line-${s.length}`,[n[ne],K[Y]],mt({venue_id:J,building_id:q,floor_id:Z,ordinal:te}))),a.push(this._createIconFeature(`marker-${a.length}`,K[Y],{...mt({venue_id:J,building_id:q,floor_id:Z,ordinal:te,markerType:`stops_${Y}`}),icon:this._routeStyle.markers.stops[Y]??_r(this._routeStyle.markers.stops),iconSize:this._routeStyle.markerIconSize}))}),a.push(this._createIconFeature(`marker-${a.length}`,U??$,{...mt({venue_id:g,building_id:p,floor_id:I,ordinal:v,markerType:"from"}),icon:this._routeStyle.markers.from,iconSize:this._routeStyle.markerIconSize})),a.push(this._createIconFeature(`marker-${a.length}`,P??Q,{...mt({venue_id:b,building_id:B,floor_id:T,ordinal:H,markerType:"to"}),icon:this._routeStyle.markers.to,iconSize:this._routeStyle.markerIconSize})),{lineFeatures:i,connectorFeatures:o,dashedLineFeatures:s,markerFeatures:a}}_createLineFeature(t,n,r){return{id:t,type:"Feature",geometry:{type:"LineString",coordinates:n},properties:r}}_createIconFeature(t,n,r){return{id:t,type:"Feature",geometry:{type:"Point",coordinates:n},properties:r}}_renderSolidLines(t){this._addCollectionSource(br,t),this._addLineLayer(br,en,{"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(t){this._addCollectionSource(Zi,t),this._addLineLayer(Zi,Dt,{"line-color":this._routeStyle.dashedLineColor,"line-width":this._routeStyle.dashedLineWidth,"line-dasharray":[.1,1.8]})}_renderConnectors(t){this._addCollectionSource(Wi,t),this._addIconLayer(Wi,zc)}_renderMarkers(t){this._addCollectionSource(wr,t),this._addIconLayer(wr,Yi,{"icon-anchor":"bottom","icon-allow-overlap":!0,"icon-ignore-placement":!0})}_addCollectionSource(t,n){this._maplibreMap.addSource(t,{type:"geojson",data:{type:"FeatureCollection",features:n}})}_addLineLayer(t,n,r){this._maplibreMap.addLayer({id:n,type:"line",source:t,layout:{"line-join":"round","line-cap":"round"},paint:{"line-width":4,...r||{}}},this._renderBoundaryLayer)}_renderLineSymbols(t,n){this._maplibreMap.addLayer({id:n,type:"symbol",source:t,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(t,n,r){this._maplibreMap.addLayer({id:n,type:"symbol",source:t,layout:{"icon-image":["get","icon"],"icon-size":["case",["has","iconSize"],["get","iconSize"],1],...r||{}}})}_updateStyleProperties(t){if(this._styleDiffs=Wc(this._routeStyle,t??zi),!t)this._routeStyle=zi;else if(Object.keys(this._styleDiffs).length){const n={...this._routeStyle.lineSymbol,...this._styleDiffs.lineSymbol??{}},r=this._styleDiffs.markers;let i=this._routeStyle.markers;const o={outdoorLineOpacity:(this._styleDiffs.outdoorLineOpacity>1?1:this._styleDiffs.outdoorLineOpacity<0?0:this._styleDiffs.outdoorLineOpacity)??this._routeStyle.outdoorLineOpacity},s={inactiveRouteOpacity:(this._styleDiffs.inactiveRouteOpacity>1?1:this._styleDiffs.inactiveRouteOpacity<0?0:this._styleDiffs.inactiveRouteOpacity)??this._routeStyle.inactiveRouteOpacity};r&&Object.keys(r).length&&(i={...i,...r}),this._routeStyle={...this._routeStyle,...this._styleDiffs,...o,...s,markers:i,lineSymbol:n}}}async _loadMarkerIcons(){const{markers:t,lineSymbol:n}=this._styleDiffs;if(n?.image&&await Pn(this._maplibreMap,n.image),t&&Object.keys(t).length){const{from:r,to:i,stops:o}=t;if(r&&await Pn(this._maplibreMap,r),i&&await Pn(this._maplibreMap,i),o&&o.length){const s=o.filter(a=>!!a);s.length&&await Promise.all(s.map(a=>Pn(this._maplibreMap,a)))}}}async _updateLayers(){if(!this._maplibreMap.getLayer(en))return;const{indoorLineColor:t,outdoorLineColor:n,dashedLineColor:r,shuttleBusLineColor:i,lineWidth:o,dashedLineWidth:s,disableDashedLine:a,inactiveRouteOpacity:u,outdoorLineOpacity:d,markerIconSize:g,markers:p,lineSymbol:I}=this._styleDiffs;if((t||n||i)&&this._maplibreMap.setPaintProperty(en,"line-color",["case",["==",["get","isShuttleBus"],"1"],this._routeStyle.shuttleBusLineColor,["==",["get","floor_id"],null],this._routeStyle.outdoorLineColor,this._routeStyle.indoorLineColor]),o!==void 0&&o+""&&this._maplibreMap.setPaintProperty(en,"line-width",o),typeof a=="boolean"?a?this._maplibreMap.setPaintProperty(Dt,"line-color","transparent"):(this._maplibreMap.setPaintProperty(Dt,"line-color",this._routeStyle.dashedLineColor),this._maplibreMap.setPaintProperty(Dt,"line-width",this._routeStyle.dashedLineWidth)):this._routeStyle.disableDashedLine!==!0&&(r&&this._maplibreMap.setPaintProperty(Dt,"line-color",r),s!==void 0&&s+""&&this._maplibreMap.setPaintProperty(Dt,"line-width",s)),u!==void 0&&u+""&&this._filterRouteOpacity(),g!==void 0&&g+""&&this._maplibreMap.setLayoutProperty(Yi,"icon-size",g),p&&Object.keys(p).length){const{from:v,to:h,stops:b}=p,B=this._maplibreMap.getSource(wr),T=await B.getData();T.features=T.features.map(H=>{const{markerType:$}=H.properties;if(v!==void 0&&$==="from"&&(H.properties.icon=v),h!==void 0&&$==="to"&&(H.properties.icon=h),b&&$.includes("stops")){const Q=parseInt($.split("_")[1]);H.properties.icon=b[Q]??_r(b)}return H}),B.setData(T)}if(I){const{image:v,size:h,spacing:b}=I;v!==void 0&&this._maplibreMap.setLayoutProperty(tn,"icon-image",v),h!==void 0&&h+""&&this._maplibreMap.setLayoutProperty(tn,"icon-size",h),b!==void 0&&b+""&&this._maplibreMap.setLayoutProperty(tn,"symbol-spacing",b)}d!==void 0&&d+""&&(this._maplibreMap.setPaintProperty(en,"line-opacity",["case",["==",["get","floor_id"],null],d,1]),this._maplibreMap.setPaintProperty(tn,"icon-opacity",["case",["==",["get","floor_id"],null],d,1]),this._filterRouteOpacity())}_filterRouteOpacity(){let t;switch(this._filterBy){case"venue":t=["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":t=["case",["all",["==",["get","ordinal"],this._curOrdinal??""],["==",["get","building_id"],this._curBuilding??""]],1,["==",["get","floor_id"],null],this._routeStyle.outdoorLineOpacity,this._routeStyle.inactiveRouteOpacity];break}Zc.forEach(n=>{this._maplibreMap.getLayer(n)&&this._maplibreMap.setPaintProperty(n,n.includes("layer-line")?"line-opacity":"icon-opacity",t)})}}function mt(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,Number.isFinite(n)?n+"":n]))}function tm(e){return e===100||e===-100}function nm(e){return e===5}function rm(e){return kc(e,104,108)}function Wc(e,t){const n={};for(const r in t){const i=e[r],o=t[r];if(r==="markers"||r==="lineSymbol")if(Array.isArray(o)){const s=o.slice(1,o.length-1);n[r]={from:o[0],to:_r(o),stops:s.length?s:[o[0]]}}else{const s=Wc(i,o);Object.keys(s).length&&(n[r]=s)}else o+""!=i+""&&(n[r]=r==="stops"?o??[null]:o)}return n}class Fn extends Error{}Fn.prototype.name="InvalidTokenError";function im(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let r=n.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}function om(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return im(t)}catch{return atob(t)}}function sm(e,t){if(typeof e!="string")throw new Fn("Invalid token specified: must be a string");t||(t={});const n=t.header===!0?0:1,r=e.split(".")[n];if(typeof r!="string")throw new Fn(`Invalid token specified: missing part #${n+1}`);let i;try{i=om(r)}catch(o){throw new Fn(`Invalid token specified: invalid base64 for part #${n+1} (${o.message})`)}try{return JSON.parse(i)}catch(o){throw new Fn(`Invalid token specified: invalid json for part #${n+1} (${o.message})`)}}const am="permission-disconnected";class ke extends Er.TinyEmitter{static instance;static platform={sdkVersion:pn.version,identifier:""};_appIds=new Map([[It.Access,{}],[It.Map,{}]]);_tokenStorage={};_appIdsHistory=[];static getInstance(){return ke.instance||(ke.instance=new ke),ke.instance}static setPlatform(t){ke.platform=t}updateToken(t){const{appId:n,secret:r,token:i,from:o}=t;this._tokenStorage[n]=i,this._appIds.get(o)[n]=r,this._appIdsHistory.push(n)}deleteToken(t,n){delete this._tokenStorage[t],n&&(delete this._appIds.get(n)[t],this.emit(am,{appId:t,from:n}))}getVersion(){return ke.platform.sdkVersion}getToken(t){return this._tokenStorage[t]}async getIdentifier(){if(!ke.platform.identifier){const n=await(await vs.load()).get();ke.platform.identifier=n.visitorId}return ke.platform.identifier}getAppId(t){const n=t?Object.keys(this._appIds.get(t)):[...Object.keys(this._appIds.get(It.Access)),...Object.keys(this._appIds.get(It.Map))];return this._appIdsHistory.reverse().find(r=>n.includes(r))}async fetchToken(t,n,r=0){try{const i={appId:t,secret:n,..."bundleId"in ke.platform?{bundleId:ke.platform.bundleId}:"sha1"in ke.platform?{sha1:ke.platform.sha1,packageName:ke.platform.packageName}:{origin:window.location.hostname||"restriction.test.example.com",keyPlatform:"WEB"}},o={"Content-Type":"application/json",sdkVersion:ke.platform.sdkVersion,identifier:ke.platform.identifier??await this.getIdentifier()};return(await(await fetch(Ko,{method:"POST",body:JSON.stringify(i),headers:o})).json()).result.idToken}catch(i){if(r<3){const o=500*Math.pow(2,r);return console.warn(`Retrying to fetch token in ${o} ms...`,++r),await new Promise(s=>setTimeout(s,o)),this.fetchToken(t,n,r)}else throw i}}}class cm extends Er.TinyEmitter{_appId=null;_secret=null;isClosed=!1;_timeoutId;_isInitialized=!1;_initializationPromise;_tokenManager=ke.getInstance();_from;constructor(t,n,r=It.Access){super(),this._from=r,this._appId=t,this._secret=n,this._initializationPromise=this._initToken()}async ready(){await this._initializationPromise}get appId(){return this._appId}get token(){if(!this._isInitialized)throw new Error("Token is not initialized yet. Use the 'ready' method to wait for initialization.");return this._tokenManager.getToken(this._appId)}close(){this.isClosed||(this._timeoutId&&clearTimeout(this._timeoutId),this._tokenManager.deleteToken(this._appId,this._from),this.emit("updated",{appId:this._appId,token:null}),Object.keys(this).forEach(t=>{t!=="isClosed"&&t!=="_events"&&delete this[t]}),this.isClosed=!0,this.emit("closed"),delete this._events,Object.freeze(this))}forceUpdateToken(){this._timeoutId&&(clearTimeout(this._timeoutId),this._timeoutId=null),this._isInitialized=!1,this._initializationPromise=this._initToken()}async _initToken(){try{const t=await this._tokenManager.fetchToken(this._appId,this._secret);this._isInitialized=!0,this._tokenManager.updateToken({appId:this._appId,secret:this._secret,token:t,from:this._from});const n=sm(t),r=(n.exp-n.iat-60)*1e3;this._loopUpdateToken(r)}catch(t){throw this.emit("error",new Error("Failed to initialize token.",{cause:t})),t}}_loopUpdateToken(t){this.isClosed||(this._timeoutId=setTimeout(async()=>{try{const n=await this._tokenManager.fetchToken(this._appId,this._secret);this._tokenManager.updateToken({appId:this._appId,secret:this._secret,token:n,from:this._from}),this.emit("updated",{appId:this._appId,token:n}),this._loopUpdateToken(t)}catch(n){this.emit("error",new Error("Failed to update token.",{cause:n}))}},t))}}const lm=pn.version,Yc=["unauthorized","initError"],Xi=globalThis,Ji=Wt(...Yc);nt.getInstance().setGlobalDispatcher(Ji),Xi.MapxusMapEvents=Xi.MapxusMapEvents||{},Xi.MapxusMapEvents.on=function(e,t){return Ji.on(e,t),{off:()=>Ji.on(e,null)}},_e.ASSISTANT_LAYER_INDOOR_FLOORS=nn,_e.ASSISTANT_LAYER_SHARED_FLOORS=je,_e.AccessControl=cm,_e.AccessControlOrigin=It,_e.BuildingFilterControl=Rc,_e.BuildingSelectorHandler=Uc,_e.BuildingsService=yc,_e.DistanceSearchType=eo,_e.ERRORS=Yc,_e.FloorSelectorHandler=Nc,_e.FloorSwitchScope=Mn,_e.FloorsControl=Mc,_e.Indoor=Lc,_e.IndoorClickSelection=Vc,_e.Map=Yg,_e.Marker=Jg,_e.OFFSET=Ge,_e.OrientationDistanceSearchType=Ir,_e.OutdoorClickSelection=jc,_e.PAGE=ze,_e.Poi=Tc,_e.PoisOrderBy=to,_e.PoisService=gc,_e.PoisSortBy=no,_e.PresetLanguage=De,_e.RoutePainter=em,_e.RouteService=ig,_e.SwitchBuildingHandler=Dc,_e.SwitchOutdoorHandler=$c,_e.ThemeType=Sr,_e.VERSION=lm,_e.VehicleType=Br,_e.VenuesService=pc,_e.__internal=Wf,_e.convertBrowserLangToPresetLang=ro,_e.getAccessToken=wa,_e.getIdentifier=Is,_e.setGetTokenAsync=Qf,_e.setupTokenManager=eh,Object.defineProperty(_e,Symbol.toStringTag,{value:"Module"})}));
|
|
10
|
+
`}function sr(t){return`${Ht}/api/v3/tiles/styles/${t}`}class or extends Error{_status;constructor(e,i){super(e);const{cause:r,status:n,type:s}=i??{};this.name=typeof s=="string"?s:"CustomError",r!==void 0&&(this.cause=r),n!==void 0&&(this._status=n)}get status(){return this._status}}var Ft=(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))(Ft||{});class ar{_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 lr{_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 dr{_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 ur{_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 cr{_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 hr{_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 Ct="Map_mapClick",Ot="Map_pointClick",$t="Map_isRenderComplete",Ce="Map_isDestroyed",_e=D.getInstance();let Ha=class{_map;_indoor;_poi;_floorsControl;_buildingFilterControl;_attributionControl;_language;_dispatch=ye(Ct,Ot,$t,Ce);_fitBounds;_history=Y.getInstance();_debounceHTTPErrorHandler;_transformRequestHandler;_tokenRefreshingPromise=null;_cancelTokenChangedListener;isDestroyed=!1;switchOutdoor;outdoorClickSelection;switchBuilding;indoorClickSelection;buildingSelector;floorSelector;constructor(e){if(!e.map)throw new or("Parameter 'Map' is required!",{type:"TypeError"});_e.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=te(`${$t}.`);this._dispatch.on(i,e)}destroyed(e){const i=te(`${Ce}.`);this._dispatch.on(i,()=>{e(),this._dispatch.on(i,null),this._dispatch._[Ce].length===0&&(delete this._dispatch,Object.freeze(this))})}setTransformRequest(e){this._transformRequestHandler=e}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){this._language!==e&&(this._language=e);const n=(this._map?.getStyle()?.layers||[]).filter(({type:s})=>s==="symbol");for(const{id:s}of n){const o=this._map.getLayer(s),a=typeof this._map.getLayoutProperty(s,"text-field")=="string";o&&!a&&this._map.setLayoutProperty(s,"text-field",["coalesce",["get",`name:${e}`],["get","name"]])}}getLanguage(){return this._language}setOutdoorMapShown(e){this._indoor?.setOutdoorMapShown(e)}queryIndoorFeaturesByPoint(e){const{x:i,y:r}=e,n=this._map.queryRenderedFeatures([i,r],{layers:["mapxus-venue-fill","mapxus-building-line",me,x]}),s=n.find(l=>l.layer.id==="mapxus-venue-fill");if(!s)return null;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}}}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 _r(e),{maxLat:d,maxLon:u,minLat:h,minLon:c}=l?.bbox||{};this._indoor.dragPanHandler.setBounds([c,h,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(h=>h.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:h,ordinals:c}=d.properties,f=w(h).indexOf(e),g=w(c)[f]??null;await this._floorsControl.switchByOrdinal(g,r)}else{if(d)o&&await a();else{const h=await _r(e),{maxLat:c,maxLon:f,minLat:g,minLon:_}=h.bbox;l=!0,d=h.feature,this._indoor.dragPanHandler.setBounds([_,g,f,c])}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 Na(e),{maxLat:d,maxLon:u,minLat:h,minLon:c}=l?.bbox||{};this._indoor.dragPanHandler.setBounds([c,h,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 h=(this._map.getLayer(x)?this._map.queryRenderedFeatures({layers:[x]}):[]).find(c=>c.properties?.id===e)??null;if(h)o&&await a();else{const c=await ti(e);u=Te(c),l=!0;const{maxLat:f,maxLon:g,minLat:_,minLon:y}=c?.bbox||{};this._indoor.dragPanHandler.setBounds([y,_,g,f]);const m=c.sharedFloors.find(({id:B})=>B===e),{id:S,name:E,ordinal:C}=m;d={id:S,name:E,ordinal:C+""}}if(!l){const{id:c,name:f,ordinal:g,"ref:venue":_}=h.properties||{};d={id:c,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 De(e),{maxLat:d,maxLon:u,minLat:h,minLon:c}=l?.bbox||{};this._indoor.dragPanHandler.setBounds([c,h,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 De(e),{maxLat:h,maxLon:c,minLat:f,minLon:g}=u?.bbox||{};d=nt(u),l=!0,this._indoor.dragPanHandler.setBounds([g,f,c,h])}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 He(e),{maxLat:u,maxLon:h,minLat:c,minLon:f}=d?.bbox||{};this._indoor.dragPanHandler.setBounds([f,c,h,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:h}=d;h==="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(c=>c.properties?.id===e)??null;let h;if(u){const{default_displayed_building:c,building_ids:f}=u.properties;h=c||w(f)[0]}else{const c=await He(e);h=c.defaultBuilding||c.buildings[0]?.id}await this.selectBuildingById(h,i)}}}onMapClickListener(e){const i=te(`${Ct}.`);return this._dispatch.on(i,e),{unsubscribe:()=>this._dispatch.on(i,null)}}onPoiClickListener(e){return this._poi?.onPoiClick(e)}onPointClickListener(e){const i=te(`${Ot}.`);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!==_e.theme&&(this._setStyle(sr(e),{diff:!1}),_e.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=Ft.MAPXUS_DEFAULT,floorSelectorEnabled:d,buildingSelectorEnabled:u,outdoorMapShown:h=!0,collapseCopyright:c=!1,maskNonSelectedAreas:f=!1,fitBuildingBounds:g,fitBounds:_,boundsPadding:y=30,selectedHighlightStyle:m,floorSelectorStyle:S,language:E=Rr,autoSelectBuilding:C=!1,transformRequest:B=null,mapxusLogoEnabled:b=!0,enableIndoorClickSelection:O=!0,enableOutdoorClickSelection:$=!0,floorSwitchScope:P=xe.VENUE}=e;this._map=i,this._language=E,this._fitBounds=_??g??!1,this._indoor=new Wi({map:this._map,startWithIndoorView:!!(a||o||s||r||n),outdoorMapShown:h,fitBounds:this._fitBounds,boundsPadding:y,maskNonSelectedAreas:f,selectedHighlightStyle:m,enableIndoorClickSelection:O,enableOutdoorClickSelection:$,floorSwitchScope:P}),this._poi=new Zi(this._map),this._transformRequestHandler=B,await this._resourceRequestTransform(),this._installRtlTextPlugin(),this._setStyle(sr(l)),_e.setTheme(l),this._checkMapZoom(),c?this._attributionControl=new ka:(this._attributionControl=new Ra({theme:l}),this._addControl(new Ta({enabled:b}))),this._addControl(this._attributionControl),this._addControl(this._buildingFilterControl=new er(this,u)),this._addControl(this._floorsControl=new nr(this._indoor,{language:E,style:S,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 ur(this._indoor),this.switchBuilding=new dr(this._indoor),this.outdoorClickSelection=new hr(this._indoor),this.indoorClickSelection=new cr(this._indoor),this.buildingSelector=new ar(this._buildingFilterControl),this.floorSelector=new lr(this._floorsControl),this._map.once("styledata",()=>this.setLanguage(this._language)),this._map.on("remove",()=>this._destroy()),this._map.on("error",this._debounceHTTPErrorHandler=vt(L=>this._updatePermission(L),300)),this._indoor.once(It,()=>{C&&this._map.on("moveend",()=>this._selectCenterBuilding()),this._bindMapClickListener(),this._dispatch.call($t)})}_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 jr(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)}}async _resourceRequestTransform(){const e={"Content-Type":"application/json",sdkVersion:Je,identifier:await T.getIdentifier(),token:await T.getToken()};this._map.setTransformRequest((i,r)=>{const{host:n}=new URL(i);return n.includes("map-api")&&n.includes("mapxus")?{url:i,headers:e}:this._transformRequestHandler?this._transformRequestHandler(i,r):{url:i}})}_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 this._tokenRefreshingPromise?this._tokenRefreshingPromise:(this._tokenRefreshingPromise=this._resourceRequestTransform().finally(()=>this._tokenRefreshingPromise=null),this._tokenRefreshingPromise)}_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",x].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(({properties:u})=>[`${u.id}`,{id:u.id,type:u.building?"building":"sharedFloor"}]))}_bindMapClickListener(){this._map.on("click",async e=>{const{point:i,lngLat:r}=e,n=await this._indoor.queryIndoorFeaturesByClickPoint(i);await this._indoor.selectByClickMap(n),this._dispatch.call(Ot,null,{point:i,coordinate:r}),this._dispatch.call(Ct,null,{coordinate:r,venue:n?.venue??null,building:n&&"building"in n?n.building:null,floor:n?"sharedFloor"in n?n.sharedFloor:n.floor??null:null})})}_dispatchErrorGlobal(e,i){const r=_e.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(){kt.getRTLTextPluginStatus()==="unavailable"&&kt.setRTLTextPlugin("https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.3.0/dist/mapbox-gl-rtl-text.js",!0)}async _permissionCheck(){try{if(!(await T.md5(T.SDKName.MapSDK)==="true"))throw new or("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,this._debounceHTTPErrorHandler?.cancel();const e=this._dispatch._;for(const i in e)i!==Ce&&e.hasOwnProperty(i)&&e[i].forEach(({name:r})=>{this._dispatch.on(`${i}.${r}`,null)});this._indoor.destroy(),this._poi.destroy(),_e.clear(),Object.keys(this).forEach(i=>{i!=="isDestroyed"&&i!=="_dispatch"&&delete this[i]}),this._cancelTokenChangedListener&&this._cancelTokenChangedListener(),this._dispatch.call(Ce)}};async function _r(t){const e=await Ur(t);return{feature:nt(e),bbox:e.bbox}}async function Na(t){const e=await ti(t);return{feature:Te(e),bbox:e.bbox}}async function Oe(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 Ua{_maplibreMap;_layerId;_sourceId;_imageName="poi-01";_imageSize=.75;_iconAnchor="bottom";constructor(e){this._maplibreMap=e;const i=te();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 Oe(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:h}=l;return{id:d,...u&&{newGeometry:u},...h&&{addOrUpdateProperties:Object.entries(h).map(([c,f])=>({key:c,value:f}))},...!u&&!h&&{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 At={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}},Xe="mmws-source-line-solid",fe="mmws-layer-line-solid",pe="mmws-layer-icon-line-symbol",Mt="mmws-source-line-dashed",re="mmws-layer-line-dashed",xt="mmws-source-icon-connector",fr="mmws-layer-icon-connector",Qe="mmws-source-icon-marker",Tt="mmws-layer-icon-marker",pr=[fe,pe,re,fr,Tt],ja=[Xe,Mt,xt,Qe];class Va{_maplibreMap;_routeStyle=At;_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=it(d);let h=u.find(({type:c,id:f})=>!f.includes("-overlap-copy")&&c==="fill-extrusion");h||(h=u.find(c=>c.type==="symbol"&&c?.["source-layer"]==="mapxus_place")),this._renderBoundaryLayer=h?.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(Xe,pe),this._routeStyle.disableDashedLine!==!0&&this._renderDashedLines(a),this._renderConnectors(o),this._renderMarkers(l)}remove(){pr.forEach(e=>{this._maplibreMap.getLayer(e)&&this._maplibreMap.removeLayer(e)}),ja.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(($,P)=>{const{venue_id:L,building_id:H,floor_id:A,ordinal:K,sign:ne,type:ge,interval:[Ze,$e]}=$;if(qa(ne))l.push($);else if(za(ne)){P!==0&&P!==e.length-1&&s.push(this._createIconFeature(`connector-${s.length}`,i[Ze],{...G({venue_id:L,building_id:H,floor_id:A,ordinal:K}),icon:ge}));const yr=e[P+1];if(yr){const{venue_id:Xa,building_id:Qa,floor_id:Za,ordinal:Ja}=yr;s.push(this._createIconFeature(`connector-${s.length}`,i[$e],{...G({venue_id:Xa,building_id:Qa,floor_id:Za,ordinal:Ja}),icon:ge}))}}else n.push(this._createLineFeature(`solid-line-${n.length}`,i.slice(Ze,$e+1),G({venue_id:L,building_id:H,floor_id:A,ordinal:K,isShuttleBus:Ga(ne)?1:0})))});const d=e[0],{venue_id:u,building_id:h,floor_id:c,ordinal:f}=d,g=e[e.length-1],{venue_id:_,building_id:y,floor_id:m,ordinal:S}=g,E=i[0],C=i[i.length-1],B=r[0],b=r[r.length-1],O=r.slice(1,r.length-1);return B&&o.push(this._createLineFeature(`dashed-line-${o.length}`,[B,E],G({venue_id:u,building_id:h,floor_id:c,ordinal:f}))),b&&o.push(this._createLineFeature(`dashed-line-${o.length}`,[C,b],G({venue_id:_,building_id:y,floor_id:m,ordinal:S}))),l.length&&O.length&&l.forEach(({venue_id:$,building_id:P,floor_id:L,ordinal:H,interval:[A]},K)=>{o.push(this._createLineFeature(`dashed-line-${o.length}`,[i[A],O[K]],G({venue_id:$,building_id:P,floor_id:L,ordinal:H}))),a.push(this._createIconFeature(`marker-${a.length}`,O[K],{...G({venue_id:$,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:h,floor_id:c,ordinal:f,markerType:"from"}),icon:this._routeStyle.markers.from,iconSize:this._routeStyle.markerIconSize})),a.push(this._createIconFeature(`marker-${a.length}`,b??C,{...G({venue_id:_,building_id:y,floor_id:m,ordinal:S,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(Xe,e),this._addLineLayer(Xe,fe,{"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(Mt,e),this._addLineLayer(Mt,re,{"line-color":this._routeStyle.dashedLineColor,"line-width":this._routeStyle.dashedLineWidth,"line-dasharray":[.1,1.8]})}_renderConnectors(e){this._addCollectionSource(xt,e),this._addIconLayer(xt,fr)}_renderMarkers(e){this._addCollectionSource(Qe,e),this._addIconLayer(Qe,Tt,{"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=gr(this._routeStyle,e??At),!e)this._routeStyle=At;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 Oe(this._maplibreMap,i.image),e&&Object.keys(e).length){const{from:r,to:n,stops:s}=e;if(r&&await Oe(this._maplibreMap,r),n&&await Oe(this._maplibreMap,n),s&&s.length){const o=s.filter(a=>!!a);o.length&&await Promise.all(o.map(a=>Oe(this._maplibreMap,a)))}}}async _updateLayers(){if(!this._maplibreMap.getLayer(fe))return;const{indoorLineColor:e,outdoorLineColor:i,dashedLineColor:r,shuttleBusLineColor:n,lineWidth:s,dashedLineWidth:o,disableDashedLine:a,inactiveRouteOpacity:l,outdoorLineOpacity:d,markerIconSize:u,markers:h,lineSymbol:c}=this._styleDiffs;if((e||i||n)&&this._maplibreMap.setPaintProperty(fe,"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(fe,"line-width",s),typeof a=="boolean"?a?this._maplibreMap.setPaintProperty(re,"line-color","transparent"):(this._maplibreMap.setPaintProperty(re,"line-color",this._routeStyle.dashedLineColor),this._maplibreMap.setPaintProperty(re,"line-width",this._routeStyle.dashedLineWidth)):this._routeStyle.disableDashedLine!==!0&&(r&&this._maplibreMap.setPaintProperty(re,"line-color",r),o!==void 0&&o+""&&this._maplibreMap.setPaintProperty(re,"line-width",o)),l!==void 0&&l+""&&this._filterRouteOpacity(),u!==void 0&&u+""&&this._maplibreMap.setLayoutProperty(Tt,"icon-size",u),h&&Object.keys(h).length){const{from:f,to:g,stops:_}=h,y=this._maplibreMap.getSource(Qe),m=await y.getData();m.features=m.features.map(S=>{const{markerType:E}=S.properties;if(f!==void 0&&E==="from"&&(S.properties.icon=f),g!==void 0&&E==="to"&&(S.properties.icon=g),_&&E.includes("stops")){const C=parseInt(E.split("_")[1]);S.properties.icon=_[C]??Ye(_)}return S}),y.setData(m)}if(c){const{image:f,size:g,spacing:_}=c;f!==void 0&&this._maplibreMap.setLayoutProperty(pe,"icon-image",f),g!==void 0&&g+""&&this._maplibreMap.setLayoutProperty(pe,"icon-size",g),_!==void 0&&_+""&&this._maplibreMap.setLayoutProperty(pe,"symbol-spacing",_)}d!==void 0&&d+""&&(this._maplibreMap.setPaintProperty(fe,"line-opacity",["case",["==",["get","floor_id"],null],d,1]),this._maplibreMap.setPaintProperty(pe,"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}pr.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 za(t){return t===100||t===-100}function qa(t){return t===5}function Ga(t){return rr(t,104,108)}function gr(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=gr(n,s);Object.keys(o).length&&(i[r]=o)}else s+""!=n+""&&(i[r]=r==="stops"?s??[null]:s)}return i}var Rt=(t=>(t.FOOT="foot",t.WHEELCHAIR="wheelchair",t.ESCALATOR="escalator",t.EMERGENCY="emergency",t))(Rt||{});const Ka=D.getInstance();class Wa{_api="api/v4/route/query";constructor(){}async search(e){const{points:i,vehicle:r=Rt.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(Ya(i))throw new Error("Parameter error. Points must have lat and lon.");return(await Ka.getHttpSession()).request(this._api,{method:"POST",body:JSON.stringify({points:i,vehicle:r,locale:n})})}}function Ya(t){return t.some(e=>!e||typeof e.lat!="number"||typeof e.lon!="number")}p.ASSISTANT_LAYER_INDOOR_FLOORS=me,p.ASSISTANT_LAYER_SHARED_FLOORS=x,p.BuildingFilterControl=er,p.BuildingSelectorHandler=ar,p.BuildingsService=Zt,p.DistanceSearchType=qt,p.ERRORS=Nt,p.FloorSelectorHandler=lr,p.FloorSwitchScope=xe,p.FloorsControl=nr,p.Indoor=Wi,p.IndoorClickSelection=cr,p.Map=Ha,p.Marker=Ua,p.OFFSET=R,p.OrientationDistanceSearchType=st,p.OutdoorClickSelection=hr,p.PAGE=k,p.Poi=Zi,p.PoisOrderBy=Gt,p.PoisService=Wt,p.PoisSortBy=Kt,p.PresetLanguage=M,p.RoutePainter=Va,p.RouteService=Wa,p.SwitchBuildingHandler=dr,p.SwitchOutdoorHandler=ur,p.ThemeType=Ft,p.VERSION=Je,p.VehicleType=Rt,p.VenuesService=Xt,p.convertBrowserLangToPresetLang=jt,p.omittedBuildingProps=Qt,p.omittedPoiProps=ot,p.omittedVenueKeys=Yt,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})}));
|