@versatiles/map-editor 4.0.0 → 4.1.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.
@@ -1,2 +1,2 @@
1
1
  import{payload as e}from"../entry/payload.DSmR2FwN.js";import{A as t,E as n,H as r,L as i,M as a,N as o,O as s,P as c,Q as l,U as u,W as d,Z as f,b as p,et as m,gt as h,i as g,j as _,k as v,lt as y,mt as ee,nt as b,ot as x,q as te,rt as S,t as ne,ut as re,w as ie}from"./C1qWpZZK.js";import{a as ae,c as oe,i as se,p as ce,s as C}from"./Dams4V9V.js";import{i as le,n as w,r as T,t as ue}from"./BFhkrCgt.js";var de=class{constructor(e){this.status=e.status,this.body=e}toString(){return JSON.stringify(this.body)}},fe=class extends de{},pe=class{constructor(e,t){try{new Headers({location:t})}catch{throw Error(`Invalid redirect location ${JSON.stringify(t)}: this string contains characters that cannot be used in HTTP headers`)}this.status=e,this.location=t}},me=class extends Error{constructor(e,t,n){super(n),this.status=e,this.text=t}};new URL(`a://`);function he(e,t){return e===`/`||t===`ignore`?e:t===`never`?e.endsWith(`/`)?e.slice(0,-1):e:t===`always`&&!e.endsWith(`/`)?e+`/`:e}function ge(e){return e.split(`%25`).map(decodeURI).join(`%25`)}function _e({href:e}){return e.split(`#`)[0]}function ve(...e){let t=5381;for(let n of e)if(typeof n==`string`){let e=n.length;for(;e;)t=t*33^n.charCodeAt(--e)}else if(ArrayBuffer.isView(n)){let e=new Uint8Array(n.buffer,n.byteOffset,n.byteLength),r=e.length;for(;r;)t=t*33^e[--r]}else throw TypeError(`value must be a string or TypedArray`);return(t>>>0).toString(36)}function ye(e,t){let n=[];return e&&n.push([...new Headers(e)].join(`,`)),t&&n.push(t),ve(...n)}new TextEncoder,new TextDecoder;function be(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var xe=2**32-1,Se=xe-1,E=class extends Error{constructor(e,t,n,r){super(e),this.name=`DevalueError`,this.path=t.join(``),this.value=n,this.root=r}},Ce=Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function we(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getPrototypeOf(t)===null||Object.getOwnPropertyNames(t).sort().join(`\0`)===Ce}function Te(e){return Object.prototype.toString.call(e).slice(8,-1)}function Ee(e){return typeof Buffer<`u`&&Buffer.isBuffer(e)}function De(e){switch(e){case`"`:return`\\"`;case`<`:return`\\u003C`;case`\\`:return`\\\\`;case`
2
- `:return`\\n`;case`\r`:return`\\r`;case` `:return`\\t`;case`\b`:return`\\b`;case`\f`:return`\\f`;case`\u2028`:return`\\u2028`;case`\u2029`:return`\\u2029`;default:return e<` `?`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`:``}}function D(e){let t=``,n=0,r=e.length;for(let i=0;i<r;i+=1){let r=e[i],a=De(r);a&&(t+=e.slice(n,i)+a,n=i+1)}return`"${n===0?e:t+e.slice(n)}"`}function Oe(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.getOwnPropertyDescriptor(e,t).enumerable)}var ke=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function Ae(e){return ke.test(e)?`.`+e:`[`+JSON.stringify(e)+`]`}function je(e){return!(!Number.isInteger(e)||e<0||e>Se)}function Me(e){return!(!Number.isInteger(e)||e<0||e>xe)}function Ne(e){if(e.length===0||e.length>1&&e.charCodeAt(0)===48)return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<48||n>57)return!1}return je(+e)}function Pe(e){for(var t=e.length-1;t>=0&&!Ne(e[t]);t--);return t+1}function Fe(e){let t=Object.keys(e);return t.length=Pe(t),t}function Ie(e){return new Uint8Array(e).toBase64()}function Le(e){return Uint8Array.fromBase64(e).buffer}function Re(e){return Buffer.from(e).toString(`base64`)}function ze(e){return Uint8Array.from(Buffer.from(e,`base64`)).buffer}function Be(e){let t=new Uint8Array(e),n=``,r=32768;for(let e=0;e<t.length;e+=r){let i=t.subarray(e,e+r);n+=String.fromCharCode.apply(null,i)}return btoa(n)}function Ve(e){let t=atob(e),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.charCodeAt(e);return r.buffer}var He=typeof Uint8Array.fromBase64==`function`,Ue=typeof process==`object`&&process.versions?.node!==void 0,We=He?Ie:Ue?Re:Be,Ge=He?Le:Ue?ze:Ve;function Ke(e,t){if(!t)return e;let n={};for(let r of Object.keys(e))n[r]=t[r]??e[r];return n}var qe=Object.freeze({kind:`not-plain`}),Je=Object.freeze({kind:`symbol-keys`}),Ye=Object.freeze({identify:e=>e,typeOf:e=>e===null?`null`:typeof e,toPrimitive:e=>e,tagOf:e=>Te(e),isThenable:e=>typeof e.then==`function`,toPromise:e=>Promise.resolve(e),unbox:e=>e.valueOf(),toISOString:e=>isNaN(e.getDate())?``:e.toISOString(),toStringValue:e=>e.toString(),regExpInfo:e=>({source:e.source,flags:e.flags}),valuesOf:e=>e,entriesOf:e=>e,viewInfo:e=>(Ee(e)&&(e=new Uint8Array(e)),{buffer:e.buffer,byteOffset:e.byteOffset,byteLength:e.byteLength,length:e.length,bufferByteLength:e.buffer.byteLength}),toArrayBuffer:e=>e,lengthOf:e=>e.length,hasOwn:(e,t)=>Object.hasOwn(e,t),indicesOf:e=>Fe(e),shapeOf:e=>we(e)?Oe(e).length>0?Je:{kind:Object.getPrototypeOf(e)===null?`null-proto`:`plain`,keys:Object.keys(e)}:qe,get:(e,t)=>e[t]}),Xe=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,`byteLength`).get,Ze=typeof SharedArrayBuffer>`u`?void 0:Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype,`byteLength`).get,Qe=Object.freeze({fromPrimitive:e=>e,fromISOString:e=>new Date(e),fromStringValue:(e,t)=>e===`URL`?new URL(t):e===`URLSearchParams`?new URLSearchParams(t):Temporal[e.slice(9)].from(t),fromArrayBuffer:e=>e,fromRegExpInfo:(e,t)=>new RegExp(e,t),fromViewInfo:(e,t,n,r)=>{try{Xe.call(t)}catch(e){if(!Ze)throw e;Ze.call(t)}let i=globalThis[e];return n===void 0?new i(t):new i(t,n,r)},box:e=>Object(e),createArray:e=>Array(e),createSparseArray:e=>{let t=[];return t[Se]=void 0,delete t[Se],t.length=e,t},createObject:()=>({}),createNullPrototypeObject:()=>Object.create(null),createSet:()=>new Set,createMap:()=>new Map,set:(e,t,n)=>{e[t]=n},addValue:(e,t)=>{e.add(t)},addEntry:(e,t,n)=>{e.set(t,n)}});function $e(e,t,n){return et(JSON.parse(e),t,n)}function et(e,t,n){let r=Ke(Qe,n?.operations);if(typeof e==`number`)return s(e,!0);if(!Array.isArray(e)||e.length===0)throw Error(`Invalid input`);let i=e,a=Array(i.length),o=null;function s(e,n=!1){if(e===-1)return r.fromPrimitive(void 0);if(e===-3)return r.fromPrimitive(NaN);if(e===-4)return r.fromPrimitive(1/0);if(e===-5)return r.fromPrimitive(-1/0);if(e===-6)return r.fromPrimitive(-0);if(n||typeof e!=`number`)throw Error(`Invalid input`);if(e in a)return a[e];if(e>=i.length)throw Error(`Invalid input`);let c=i[e];if(!c||typeof c!=`object`)a[e]=r.fromPrimitive(c);else if(Array.isArray(c)){if(typeof c[0]==`string`){let n=c[0],l=t&&Object.hasOwn(t,n)?t[n]:void 0;if(l){let t=c[1];if(typeof t!=`number`&&(t=i.push(c[1])-1),Object.hasOwn(a,t))return a[e]=l(a[t]);if(o??=new Set,o.has(t))throw Error(`Invalid circular reference`);return o.add(t),a[e]=l(s(t)),o.delete(t),a[e]}switch(n){case`Date`:a[e]=r.fromISOString(c[1]);break;case`Set`:let t=r.createSet();a[e]=t;for(let e=1;e<c.length;e+=1)r.addValue(t,s(c[e]));break;case`Map`:let o=r.createMap();a[e]=o;for(let e=1;e<c.length;e+=2)r.addEntry(o,s(c[e]),s(c[e+1]));break;case`RegExp`:a[e]=r.fromRegExpInfo(c[1],c[2]);break;case`Object`:{let t=c[1];if(typeof i[t]==`object`&&i[t][0]!==`BigInt`)throw Error(`Invalid input`);a[e]=r.box(s(t));break}case`BigInt`:a[e]=r.fromPrimitive(BigInt(c[1]));break;case`null`:let l=r.createNullPrototypeObject();a[e]=l;for(let e=1;e<c.length;e+=2){let t=c[e];if(typeof t!=`string`)throw Error(`Cannot parse an object with a non-string key`);if(t===`__proto__`)throw Error("Cannot parse an object with a `__proto__` property");r.set(l,t,s(c[e+1]))}break;case`Int8Array`:case`Uint8Array`:case`Uint8ClampedArray`:case`Int16Array`:case`Uint16Array`:case`Float16Array`:case`Int32Array`:case`Uint32Array`:case`Float32Array`:case`Float64Array`:case`BigInt64Array`:case`BigUint64Array`:case`DataView`:{if(i[c[1]][0]!==`ArrayBuffer`)throw Error(`Invalid data`);let t=s(c[1]);a[e]=r.fromViewInfo(n,t,c[2],c[3]);break}case`ArrayBuffer`:{let t=c[1];if(typeof t!=`string`)throw Error(`Invalid ArrayBuffer encoding`);a[e]=r.fromArrayBuffer(Ge(t));break}case`URL`:case`URLSearchParams`:case`Temporal.Duration`:case`Temporal.Instant`:case`Temporal.PlainDate`:case`Temporal.PlainTime`:case`Temporal.PlainDateTime`:case`Temporal.PlainMonthDay`:case`Temporal.PlainYearMonth`:case`Temporal.ZonedDateTime`:a[e]=r.fromStringValue(n,c[1]);break;default:throw Error(`Unknown type ${n}`)}}else if(c[0]===-7){let t=c[1];if(!Me(t))throw Error(`Invalid input`);let n=r.createSparseArray(t);a[e]=n;for(let e=2;e<c.length;e+=2){let i=c[e];if(!je(i)||i>=t)throw Error(`Invalid input`);r.set(n,i,s(c[e+1]))}}else{let t=r.createArray(c.length);a[e]=t;for(let e=0;e<c.length;e+=1){let n=c[e];n!==-2&&r.set(t,e,s(n))}}}else{let t=r.createObject();a[e]=t;for(let e of Object.keys(c)){if(e===`__proto__`)throw Error("Cannot parse an object with a `__proto__` property");r.set(t,e,s(c[e]))}}return a[e]}return s(0)}function tt(e,t,n){let r=nt(!1,e,t,n);return typeof r==`string`?r:`[${r.join(`,`)}]`}function nt(e,t,n,r){let i=Ke(Ye,r?.operations),a=[],o=new Map,s=[];if(n)for(let e of Object.getOwnPropertyNames(n))s.push({key:e,fn:n[e]});let c=[],l=0;function u(n,r){let d=i.typeOf(n);if(d===`undefined`)return-1;let f;if(d===`number`){if(f=i.toPrimitive(n),Number.isNaN(f))return-3;if(f===1/0)return-4;if(f===-1/0)return-5;if(f===0&&1/f<0)return-6}let p=i.identify(n);if(o.has(p))return o.get(p);r??=l++,o.set(p,r);for(let{key:e,fn:t}of s){let i=t(n);if(i)return a[r]=`["${e}",${u(i)}]`,r}if(d===`function`)throw new E(`Cannot stringify a function`,c,n,t);if(d===`symbol`)throw new E(`Cannot stringify a Symbol primitive`,c,n,t);let m=``;if(d!==`object`)m=rt(d===`number`?f:i.toPrimitive(n));else if(i.isThenable(n)){if(!e)throw new E(`Cannot stringify a Promise or thenable — use stringifyAsync instead`,c,n,t);m=i.toPromise(n).then(e=>{let t=u(e,r);t<0&&(a[r]=t)}),m.catch(()=>{})}else{let e=i.tagOf(n);switch(e){case`Number`:case`String`:case`Boolean`:case`BigInt`:m=`["Object",${u(i.unbox(n))}]`;break;case`Date`:m=`["Date","${i.toISOString(n)}"]`;break;case`URL`:m=`["URL",${D(i.toStringValue(n))}]`;break;case`URLSearchParams`:m=`["URLSearchParams",${D(i.toStringValue(n))}]`;break;case`RegExp`:let{source:r,flags:a}=i.regExpInfo(n);m=a?`["RegExp",${D(r)},"${a}"]`:`["RegExp",${D(r)}]`;break;case`Array`:{let e=!1,t=i.lengthOf(n);m=`[`;for(let r=0;r<t;r+=1)if(r>0&&(m+=`,`),i.hasOwn(n,r))c.push(`[${r}]`),m+=u(i.get(n,r)),c.pop();else if(e)m+=-2;else{let r=i.indicesOf(n),a=r.length,o=String(t).length;if((t-a)*3>4+o+a*(o+1)){m=`[-7,`+t;for(let e=0;e<r.length;e++){let t=r[e];c.push(`[${t}]`),m+=`,`+t+`,`+u(i.get(n,t)),c.pop()}break}e=!0,m+=-2}m+=`]`;break}case`Set`:m=`["Set"`;for(let e of i.valuesOf(n))m+=`,${u(e)}`;m+=`]`;break;case`Map`:m=`["Map"`;for(let[e,t]of i.entriesOf(n)){let n=i.typeOf(e),r=n!==`object`&&n!==`function`&&n!==`symbol`;c.push(`.get(${r?rt(i.toPrimitive(e)):`...`})`),m+=`,${u(e)},${u(t)}`,c.pop()}m+=`]`;break;case`Int8Array`:case`Uint8Array`:case`Uint8ClampedArray`:case`Int16Array`:case`Uint16Array`:case`Float16Array`:case`Int32Array`:case`Uint32Array`:case`Float32Array`:case`Float64Array`:case`BigInt64Array`:case`BigUint64Array`:{let t=i.viewInfo(n);m=`["`+e+`",`+u(t.buffer),t.byteLength!==t.bufferByteLength&&(m+=`,${t.byteOffset},${t.length}`),m+=`]`;break}case`DataView`:{let t=i.viewInfo(n);m=`["`+e+`",`+u(t.buffer),t.byteLength!==t.bufferByteLength&&(m+=`,${t.byteOffset},${t.byteLength}`),m+=`]`;break}case`ArrayBuffer`:m=`["ArrayBuffer","${We(i.toArrayBuffer(n))}"]`;break;case`Temporal.Duration`:case`Temporal.Instant`:case`Temporal.PlainDate`:case`Temporal.PlainTime`:case`Temporal.PlainDateTime`:case`Temporal.PlainMonthDay`:case`Temporal.PlainYearMonth`:case`Temporal.ZonedDateTime`:m=`["${e}",${D(i.toStringValue(n))}]`;break;default:{let e=i.shapeOf(n);if(e.kind===`not-plain`)throw new E(`Cannot stringify arbitrary non-POJOs`,c,n,t);if(e.kind===`symbol-keys`)throw new E(`Cannot stringify POJOs with symbolic keys`,c,n,t);if(e.kind===`null-proto`){m=`["null"`;for(let r of e.keys){if(r===`__proto__`)throw new E(`Cannot stringify objects with __proto__ keys`,c,n,t);c.push(Ae(r)),m+=`,${D(r)},${u(i.get(n,r))}`,c.pop()}m+=`]`}else{m=`{`;let r=!1;for(let a of e.keys){if(a===`__proto__`)throw new E(`Cannot stringify objects with __proto__ keys`,c,n,t);r&&(m+=`,`),r=!0,c.push(Ae(a)),m+=`${D(a)}:${u(i.get(n,a))}`,c.pop()}m+=`}`}}}}return a[r]=m,r}let d=u(t);return d<0?`${d}`:a}function rt(e){let t=typeof e;return t===`string`?D(e):e===void 0?`-1`:e===0&&1/e<0?`-6`:t===`bigint`?`["BigInt","${e}"]`:String(e)}var it=()=>{throw Error(``)},O=()=>{throw Error(``)},at={},ot={};function st(e){let t=Object.entries(e);t.length,at=Object.fromEntries(t.map(([e,t])=>[e,t.encode])),ot=Object.fromEntries(t.map(([e,t])=>[e,t.decode])),it=e=>tt(e,at),O=e=>$e(e,ot)}function ct(e,t){return e.origin===t.origin?e.href.slice(t.origin.length):e.href}function lt(e,t){return e+`/`+t}var ut=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:t?.method||`GET`)!==`GET`&&pt(e),ut(e,t));var k=new Map;function dt(e,t){let n=ht(e,t);if(n){let e=document.querySelector(n);if(e?.textContent){e.remove();let{body:t,...r}=JSON.parse(e.textContent);e.getAttribute(`data-b64`)!==null&&(t=be(t));let i=e.getAttribute(`data-ttl`);return i&&k.set(n,{body:t,init:r,ttl:1e3*Number(i)}),Promise.resolve(new Response(t,r))}}return window.fetch(e,t)}function ft(e,t,n){if(k.size>0){let t=ht(e,n),r=t&&k.get(t);if(r){if(performance.now()<r.ttl&&[`default`,`force-cache`,`only-if-cached`,void 0].includes(n?.cache))return new Response(r.body,r.init);k.delete(t)}}return window.fetch(t,n)}function pt(e){let t=ht(mt(e));for(let e of k.keys())e.startsWith(t)&&k.delete(e)}function mt(e){return ct(new URL(e instanceof Request?e.url:e,location.href),location)}function ht(e,t){let n=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t?.headers||t?.body){let e=t.body;if(e&&typeof e!=`string`&&!ArrayBuffer.isView(e))return null;n+=`[data-hash="${ye(t.headers,e)}"]`}return n}function gt({nodes:e,server_loads:t,dictionary:n,matchers:r}){let i=new Set(t);return Object.entries(n).map(([t,[n,i,s]])=>{let{pattern:c,params:l}=ae(t),u={id:t,exec:e=>{let t=c.exec(e);if(t)return se(t,l,r)},errors:[1,...s||[]].map(t=>e[t]),layouts:[0,...i||[]].map(o),leaf:a(n)};return u.errors.length=u.layouts.length=Math.max(u.errors.length,u.layouts.length),u});function a(t){let n=t<0;return n&&(t=~t),[n,e[t]]}function o(t){return t===void 0?t:[i.has(t),e[t]]}}function _t(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function vt(e,t,n=JSON.stringify){let r=n(t);try{sessionStorage[e]=r}catch{}}var yt=`sveltekit:snapshot`,bt=`sveltekit:navigation-snapshot`,xt=`sveltekit:history-info`,A=`sveltekit:metadata`,j={tap:1,hover:2,viewport:3,eager:4,false:-1},St=location.origin;function Ct(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){let e=document.getElementsByTagName(`base`);t=e.length?e[0].href:document.URL}return new URL(e,t)}function wt(){return{x:pageXOffset,y:pageYOffset}}function Tt(e,t){return e.getAttribute(`data-sveltekit-${t}`)}var Et={...j,"":j.hover};function Dt(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function Ot(e,t){for(;e&&e!==t;){if((e instanceof HTMLAnchorElement||e instanceof SVGAElement)&&e.hasAttribute(`href`))return e;e=Dt(e)}}function kt(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){let e=location.hash.split(`#`)[1]||`/`;r.hash=`#${e}${r.hash}`}}catch{}let i=e instanceof SVGAElement?e.target.baseVal:e.target,a=!r||!!i||jt(r,t,n)||(e.getAttribute(`rel`)||``).split(/\s+/).includes(`external`),o=r?.origin===St&&e.hasAttribute(`download`);return{url:r,external:a,target:i,download:o}}function At(e){let t=null,n=null,r=null,i=null,a=null,o=e;for(;o&&o!==document.documentElement;)t===null&&(t=Tt(o,`preload-code`)),n===null&&(n=Tt(o,`preload-data`)),r===null&&(r=Tt(o,`reload`)),i===null&&(i=Tt(o,`replacestate`)),a===null&&(a=Tt(o,`reset`)),o=Dt(o);function s(e){switch(e){case``:case`true`:return!0;case`false`:return!1;default:return}}return{preload_code:Et[t??`false`],preload_data:Et[n??`false`],reload:s(r),replace_state:s(i),reset:s(a)??!0}}function jt(e,t,n){return e.origin!==St||!e.pathname.startsWith(t)?!0:n?e.pathname!==location.pathname:!1}function Mt(e,t){let n=t?e.hash.split(`#`,3)[2]??``:e.hash.slice(1);return n?document.getElementById(decodeURIComponent(n)):null}function Nt(e){}function Pt(e){let t=document.activeElement;e&&(t instanceof HTMLElement||t instanceof SVGElement)&&t!==document.body&&t.blur()}function Ft(e){let t=e.getAttribute(`tabindex`);e.setAttribute(`tabindex`,`-1`),e.focus({preventScroll:!0,focusVisible:!1}),t===null?e.removeAttribute(`tabindex`):e.setAttribute(`tabindex`,t)}function It(e){let t=document.querySelector(`[autofocus]`);if(t)t.focus();else{Ft(Mt(e,!1)??document.body);let t=getSelection();if(t&&t.type!==`None`){let e=[];for(let n=0;n<t.rangeCount;n+=1)e.push(t.getRangeAt(n));setTimeout(()=>{if(t.rangeCount===e.length){for(let n=0;n<t.rangeCount;n+=1){let r=e[n],i=t.getRangeAt(n);if(r.commonAncestorContainer!==i.commonAncestorContainer||r.startContainer!==i.startContainer||r.endContainer!==i.endContainer||r.startOffset!==i.startOffset||r.endOffset!==i.endOffset)return}t.removeAllRanges()}})}}}var Lt=!0;function Rt(e,t,n){if(t&&Lt){if(n)scrollTo(n.x,n.y);else{let t=Mt(e,!1);t?t.scrollIntoView():scrollTo(0,0)}}Lt=!0}function zt(e){throw Error(`https://svelte.dev/e/kit/navigation_external_url`)}function Bt(e){throw Error(`https://svelte.dev/e/kit/navigation_route_missing`)}function Vt(e){throw Error(`https://svelte.dev/e/kit/redirect_loop`)}var Ht=_t(`sveltekit:navigation-snapshot`)??{},Ut=new Set;function Wt(){return new Set(Ut)}function Gt(e){Ut.size===0?delete Ht[e]:Ht[e]=Object.fromEntries(Array.from(Ut,({id:e,capture:t})=>[e,it(t())]))}function Kt(e,t){let n=Ht[e];for(let e of Ut)n&&Object.hasOwn(n,e.id)?e.restore(O(n[e.id])):t?.has(e)&&e.reset?.()}function qt(e){delete Ht[e]}function Jt(e){Gt(e),vt(bt,Ht)}var Yt=new Set([`load`,`prerender`,`csr`,`ssr`,`trailingSlash`,`config`]);[...Yt],[...new Set([...Yt])];function M(){}var Xt=c(`<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>`),Zt=c(`<!> <!>`,1);function Qt(e,n){re(n,!0);let s=(e,t=h,i=h)=>{let u=(e,t=h)=>{var n=o(),i=l(n);p(i,()=>r(f),(e,n)=>{n(e,{get error(){return t()}})}),a(e,n)},d=x(()=>t().component),f=x(()=>t().error),m=x(()=>t().data);var v=o(),y=l(v);_(y,{get failed(){return r(f)?u:void 0},get onerror(){return r(f)?n.onerror:void 0}},e=>{var u=o(),f=l(u),h=e=>{var u=o(),f=l(u);p(f,()=>r(d),(e,a)=>{g(a(e,{get data(){return r(m)},get form(){return n.form},get params(){return n.page.params},children:(e,n)=>{s(e,()=>t().child,()=>i()+1)},$$slots:{default:!0}}),e=>c()[i()]=e,()=>c()?.[i()])}),a(e,u)},_=e=>{var t=o(),s=l(t);p(s,()=>r(d),(e,t)=>{g(t(e,{get data(){return r(m)},get form(){return n.form},get params(){return n.page.params},get error(){return n.error}}),e=>c()[i()]=e,()=>c()?.[i()])}),a(e,t)};ie(f,e=>{t().child?e(h):e(_,-1)}),a(e,u)}),a(e,v)},c=ne(n,`components`,7),u=S(!1),d=S(!1),v=S(``);ar(()=>{r(u)?(b(d,!0),b(v,document.title||`untitled page`,!0)):b(u,!0)});var ae=Zt(),oe=l(ae);s(oe,()=>n.tree,()=>0);var se=m(oe,2),ce=e=>{var n=Xt(),o=f(n),s=e=>{var n=i();te(()=>t(n,r(v))),a(e,n)};ie(o,e=>{r(d)&&e(s)}),ee(n),a(e,n)};ie(se,e=>{r(u)&&e(ce)}),a(e,ae),y()}var $t=class{#e;get form(){return r(this.#e)}set form(e){b(this.#e,e)}#t;get error(){return r(this.#t)}set error(e){b(this.#t,e)}page;components=[];tree;onerror;constructor({page:e,tree:t,form:n,error:r,onerror:i=M}){this.page=e,this.tree=t,this.onerror=i,this.#e=S(n),this.#t=S(r)}},en=class{component;error;#e=S({});get data(){return r(this.#e)}set data(e){b(this.#e,e)}#t=S();get child(){return r(this.#t)}set child(e){b(this.#t,e)}constructor(e,t){this.component=e,this.error=t}};function tn(e,t,n){let r=[void 0],i=-1;for(let a=1;a<e.length;a+=1){if(!e[a])continue;let o=a-1;for(;o>i+1&&t[o]==null;)--o;i=o;let s=t[o];r.push(s==null?void 0:n(s)?.catch(()=>void 0))}return Promise.all(r)}function*nn(e,t,n){for(;e--;){let r=n[e];if(r!=null){let n=e;for(;!t[n];)--n;yield{error:r,idx:n+1}}}}var rn=new Set([`icon`,`shortcut icon`,`apple-touch-icon`]),N=new Set,P=_t(`sveltekit:history-info`)??{},F=_t(`sveltekit:snapshot`)??{},I;function L(e){P[e].scroll=wt()}function an(e,t){P[e]={...P[e],resetIndex:t.resetIndex}}function on(e,t){qt(e);let n=e+1;for(;P[n];)delete P[n],qt(n),n+=1;for(n=t+1;F[n];)delete F[n],n+=1}function R(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(M)}async function sn(){if(`serviceWorker`in navigator){let e=await navigator.serviceWorker.getRegistration(C||`/`);e&&await e.update()}}var cn,ln,un,z,dn,B,fn={},pn={},mn=[],V=null;function hn(){V?.fork?.then(e=>e?.discard()),V=null,Q={element:void 0,href:void 0}}var gn=new Map,_n=new Set,vn=new Set,H=new Set,U={branch:[],error:null,url:null,nav:null},yn=!1,bn=!1,W=!1,G=null,xn=!1,Sn=!1,K,q,J;function Cn(e=history.state){return e?.[A]}var Y,X,wn=new Set,Tn=new Map,En=new Map;oe(async e=>{typeof e==`string`&&(e=new URL(e,location.href));let t=await Z(e,!1);return t?{id:t.route.id,params:t.params}:null}),Promise.resolve();function Dn(e,t,n){return kn(e,t,n)}function*On(e){for(let[t,n]of e)for(let[e,r]of n)yield[lt(t,e),r]}async function kn(t,n,r){if(e.data){let{q:t={},p:n={},l:r={},f:i={}}=e.data;for(let e in t)fn[e]=t[e];for(let e in r)fn[e]=r[e];for(let e in i)fn[e]=i[e];for(let e in n)pn[e]=n[e]}document.URL!==location.href&&(location.href=location.href),B=t,st(B.hooks.transport??{}),await t.hooks.init?.(),cn=gt(t),z=document.documentElement,dn=n,ln=t.nodes[0],un=t.nodes[1];let[i]=await Promise.all([ln(),un()]),a=new en(i.component,void 0);I=new $t({page:ue,tree:a,form:void 0,error:void 0,onerror:(e,t)=>N.add(t)});let o=Cn();K=o?.historyIndex??0,q=o?.navigationIndex??0,J=o?.resetIndex??0,K||(K=q=J=Date.now(),history.replaceState({...history.state,[A]:{historyIndex:K,navigationIndex:q,state:it({}),persistState:!1,resetIndex:K}},``)),an(K,Cn());let s=P[K]?.scroll;function c(){s&&(history.scrollRestoration=`manual`,scrollTo(s.x,s.y))}r?(c(),await dr(dn,r)):(await $n({type:`enter`,url:Ct(B.hash?mr(new URL(location.href)):location.href),replace_state:!0,state:o?.persistState?O(o.state):{},persist_state:o?.persistState??!1}),c()),ur()}function An(){mn.length=0,Sn=!1}function jn(e){I.components.some(e=>e?.snapshot)&&(F[e]=I.components.map(e=>e?.snapshot?.capture()))}function Mn(e){F[e]?.forEach((e,t)=>{I.components[t]?.snapshot?.restore(e)})}function Nn(){L(K),vt(xt,P),jn(q),vt(yt,F),Jt(K)}async function Pn(e,t={},n=0,r={},i){let a,o;t.refreshAll&&hn(),await $n({type:t.type??`goto`,url:Ct(e),reset:t.reset,replace_state:t.replace,state:t.state,persist_state:t.persistState,event:t.event,action_result:t.action_result,redirect_count:n,nav_token:r,intent:i,accept:()=>{if(t.refreshAll){Sn=!0,a=new Set;for(let[e,t]of On(Tn))t.resource?.reset(),a.add(e);o=new Set;for(let[e]of On(En))o.add(e)}t.invalidate&&t.invalidate.forEach(sr)}}),t.refreshAll&&d().then(d).then(()=>{for(let[e,{resource:t}]of On(Tn))a?.has(e)&&t.start();for(let[e,{resource:t}]of On(En))o?.has(e)&&t.reconnect()})}async function Fn(e){if(e.id!==V?.id){hn();let t={};wn.add(t),V={id:e.id,token:t,promise:Gn({...e,preload:t}).finally(()=>{wn.delete(t)}),fork:null},V.promise.catch(hn)}return V.promise}async function In(e){await Promise.all([...e.layouts,e.leaf].filter(Boolean).map(([,e])=>e()))}async function Ln(e){let t=(await Z(e,!1))?.route;t&&await In(t)}async function Rn(e,t,n){let r={params:U.params,route:{id:U.route?.id??null},url:new URL(location.href)};if(U={...e.state,nav:r},hr(e),(n?s:v)(Qt,{target:t,props:I,transformError:async e=>{let t=await $(e,U.nav);return T({error:t,status:t.status}),t}}),await Promise.resolve(),n){let e={from:null,to:{...r,scroll:P[K]?.scroll??wt()},willUnload:!1,type:`enter`,shallow:!1,complete:Promise.resolve()};H.forEach(t=>t(e))}Mn(q),Kt(K),bn=!0}async function zn({url:e,params:t,branch:n,errors:r,status:i,error:a,route:o,form:s}){let c=`never`;if(C&&(e.pathname===C||e.pathname===C+`/`))c=`always`;else for(let e of n)e?.slash!==void 0&&(c=e.slash);e.pathname=he(e.pathname,c),e.search=e.search;let l={type:`loaded`,state:{url:e,params:t,branch:n,error:a,route:o},props:{page:{...ue},tree:{}}};a&&(l.props.error=a),s!==void 0&&(l.props.form=s);let u={},d=!ue,f=r&&await tn(n,r,e=>e().then(e=>e.component)),p=l.props.tree,m=1,h=I.tree;for(let e=0;e<n.length;e+=1){let t=n[e],r=U.branch[e];if(t&&(d||!h||t?.data!==r?.data?(p.data={...u,...t.data},d=!0):p.data=h.data,u=p.data,e<n.length-1)){let t=e+1;for(;t<n.length&&!n[t];)t+=1;let r=n[t];r&&(p=p.child=new en(r.node.component,f?.[m++]),h=h?.child)}}return(!U.url||e.href!==U.url.href||U.error!==a||s!==void 0&&s!==ue.form||d)&&(l.props.page={error:a,params:t,route:{id:o?.id??null},state:{},shallow:null,status:i??a?.status??200,url:new URL(e),form:s??null,data:u}),l}async function Bn({loader:e,parent:t,url:n,params:r,route:i,server_data_node:a}){let o={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},s=await e();return{node:s,loader:e,server:a,universal:s.universal?.load?{type:`data`,data:null,uses:o}:null,data:a?.data??null,slash:s.universal?.trailingSlash??a?.slash}}function Vn(e,t,n){let r=new URL(e instanceof Request?e.url:e,n),i=ct(r,n);return{resolved:r,promise:bn?ft(i,r.href,t):dt(i,t)}}function Hn(e,t,n,r,i,a){if(Sn)return!0;if(!i)return!1;if(i.parent&&e||i.route&&t||i.url&&n)return!0;for(let e of i.search_params)if(r.has(e))return!0;for(let e of i.params)if(a[e]!==U.params[e])return!0;for(let e of i.dependencies)if(mn.some(t=>t(new URL(e))))return!0;return!1}function Un(e,t){return e?.type===`data`?e:e?.type===`skip`?t??null:null}function Wn(e,t){if(!e)return new Set(t.searchParams.keys());let n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(let r of n){let i=e.searchParams.getAll(r).sort(),a=t.searchParams.getAll(r).sort();i.length===a.length&&i.every((e,t)=>e===a[t])&&n.delete(r)}return n}async function Gn({id:e,invalidating:t,url:n,params:r,route:i,preload:a,action_result:o}){if(!o&&V?.id===e)return wn.delete(V.token),V.promise;let{errors:s,layouts:c,leaf:l}=i,u=[...c,l],d=u.length-1,f=o?.type===`error`;s.forEach(e=>e?.().catch(M)),u.forEach(e=>e?.[1]().catch(M));let p=U.url?e!==Zn(U.url):!1,m=!U.route||i.id!==U.route.id,h=Wn(U.url,n),g=!1,_=u.map(async(e,t)=>{if(!e||f&&t===d)return;let a=U.branch[t];return e[1]===a?.loader&&!Hn(g,m,p,h,a.universal?.uses,r)?a:(g=!0,Bn({loader:e[1],url:n,params:r,route:i,parent:async()=>{let e={};for(let n=0;n<t;n+=1)Object.assign(e,(await _[n])?.data);return e},server_data_node:Un(e[0]?{type:`skip`}:null,e[0]?a?.server:void 0)}))});for(let e of _)e.catch(M);let v=[];for(let e=0;e<u.length;e+=1)if(u[e])try{v.push(await _[e])}catch(t){if(t instanceof pe)return{type:`redirect`,status:t.status,location:t.location};if(a&&wn.has(a))throw await $(t,{params:r,url:n,route:{id:i.id}});let o;if(t instanceof de)o=await $(t,{params:r,url:n,route:{id:i.id}});else{if(await le.check())return await sn(),await R(n);o=await $(t,{params:r,url:n,route:{id:i.id}})}return qn({i:e,branch:v,errors:s,error:o,url:n,params:r,route:i})}else v.push(void 0);return o?.type===`error`?qn({i:u.length,branch:v,errors:s,error:o.error,status:o.status,url:n,params:r,route:i}):zn({url:n,params:r,branch:v,errors:s,error:null,route:i,status:o?.status,form:o?.type===`success`||o?.type===`failure`?o.data??null:t?void 0:null})}async function Kn(e,t,n){for(let{error:r,idx:i}of nn(e,t,n))try{return t.slice(0,i).concat({node:await r(),loader:r,data:{},server:null,universal:null})}catch{continue}}async function qn({i:e,branch:t,errors:n,error:r,status:i,url:a,params:o,route:s}){let c=await Kn(e,t,n);return c?zn({url:a,params:o,branch:c,errors:n,error:r,status:i,route:s}):nr(a,{id:s.id},r)}async function Jn({error:e,url:t,route:n}){let r={};try{return zn({url:t,params:r,branch:[await Bn({loader:ln,url:t,params:r,route:n,parent:()=>Promise.resolve({}),server_data_node:Un(null)}),{node:await un(),loader:un,universal:null,server:null,data:null}],error:e,errors:[],route:null})}catch(e){if(e instanceof pe){await Pn(new URL(e.location,location.href));return}let i=await B.get_error_template(),a=await $(e,{url:t,params:r,route:n}),o=String(a?.message??``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),s=i({status:a.status,message:o}),c=new DOMParser().parseFromString(s,`text/html`);throw document.documentElement.replaceChild(document.adoptNode(c.head),document.head),document.documentElement.replaceChild(document.adoptNode(c.body),document.body),e}}async function Yn(e){let t=e.href;if(gn.has(t))return gn.get(t);let n;try{let r=(async()=>{let t=await B.hooks.reroute({url:new URL(e),fetch:async(t,n)=>Vn(t,n,e).promise})??e;if(typeof t==`string`){let n=new URL(e);B.hash?n.hash=t:n.pathname=t,t=n}return t})();gn.set(t,r),n=await r}catch{gn.delete(t);return}return n}async function Z(e,t){if(e&&!jt(e,C,B.hash)){let n=await Yn(e);if(!n)return;let r=Xn(n);for(let n of cn){let i=n.exec(r);if(i)return{id:Zn(e),invalidating:t,route:n,params:i,url:e}}}}function Xn(e){return ge(B.hash?e.hash.replace(/^#/,``).replace(/[?#].+/,``):e.pathname.slice(C.length))||`/`}function Zn(e){return(B.hash?e.hash.replace(/^#/,``):e.pathname)+e.search}function Qn({url:e,type:t,intent:n,delta:r,event:i,scroll:a,shallow:o=!1,target:s}){let c=!1,l=pr(U,n,e,t,a??null,o,s);l.navigation.type===`popstate`&&r!==void 0&&(l.navigation.delta=r),i!==void 0&&(l.navigation.event=i);let u={...l.navigation,cancel:()=>{c=!0,l.reject(Error(`navigation cancelled`))}};return W||_n.forEach(e=>e(u)),c?null:l}async function $n({type:e,url:t,popped:n,reset:r=!0,replace_state:i,state:a={},persist_state:o=!1,redirect_count:s=0,nav_token:c={},accept:l=M,block:d=M,event:f,intent:p,action_result:m}){let h=Y,g=X;Y=X=c,p??=await Z(t,!1);let _=e===`enter`?pr(U,p,t,e):Qn({url:t,type:e,delta:n?.delta,intent:p,scroll:n?.scroll,shallow:!!n?.shallow,target:n?.shallow??void 0,event:f});if(!_){d(),Y===c&&(Y=h),X===c&&(X=g);return}let v=K,y=q,ee=Wt();l(),W=!0,bn&&_.navigation.type!==`enter`&&w(_.navigation);let b=p&&await Gn({...p,action_result:m});if(!b){let e=jt(t,C,B.hash),n=e&&!1;if(e&&!n)return await R(t,i);b=await nr(t,{id:null},await $(new me(404,`Not Found`,`Not found: ${t.pathname}${n?` (did you forget the hash?)`:``}`),{url:t,params:{},route:{id:null}}),i)}if(t=p?.url||t,Y!==c){_.reject(Error(`navigation aborted`));return}if(!b)return;if(b.type===`redirect`){if(s<20){V?.id===p?.id&&hn(),await $n({type:e,url:new URL(b.location,t),popped:n,reset:r,replace_state:i,state:a,persist_state:o,redirect_count:s+1,nav_token:c}),_.fulfil(void 0);return}if(b=await Jn({error:await $(ce(()=>Vt({url:t.href})),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}}),!b)return}else if(b.props.page.status>=400&&await le.check())return await sn(),await R(t,i);if(An(),n||(L(v),jn(y),i?qt(v):Gt(v)),b.props.page.url.pathname!==t.pathname&&(t.pathname=b.props.page.url.pathname),n)a=n.state;else{let n=it(a);a=O(n);let s=+!i;e!==`enter`&&r&&(J+=1);let c={[A]:{historyIndex:K+=s,navigationIndex:q+=s,state:n,persistState:o,resetIndex:J}};(i?history.replaceState:history.pushState).call(history,c,``,t),an(K,c[A]),i||on(K,q)}let x=p&&V?.id===p.id?V.fork:null;V?.fork&&!x?hn():(V=null,Q={element:void 0,href:void 0}),b.props.page.state=a,b.props.page.shallow=n?.shallow??null;let te;if(bn){await er(_.navigation);let e=n?.shallow?{params:b.state.params,route:{id:b.state.route?.id??null},url:b.state.url}:_.navigation.to;U={...b.state,nav:{params:e.params,route:e.route,url:e.url}},b.props.page&&(b.props.page.url=t),Pt(r);let i=x&&await x;if(i){te=i.commit();for(let e of N)e();N.clear()}else hr(b),te=u().then(()=>{for(let e of N)e();N.clear()});xn=!0}else await Rn(b,dn,!1);await tr(_,c,t,n?.scroll,r,te)&&(e===`popstate`&&Mn(q),Kt(K,ee),w(null))}async function er(e){let t=(await Promise.all(Array.from(vn,t=>t(e)))).filter(e=>typeof e==`function`);if(t.length>0){function e(){t.forEach(e=>H.delete(e))}t.push(e),t.forEach(e=>H.add(e))}}async function tr(e,t,n,r,i,a){return await a,Y===t?(Rt(n,i,r),i&&document.activeElement===document.body&&It(n),W=!1,e.fulfil(void 0),e.navigation.to&&(e.navigation.to.scroll=wt()),H.forEach(t=>t(e.navigation)),!0):(e.reject(Error(`navigation aborted`)),!1)}async function nr(e,t,n,r){return e.origin===St&&e.pathname===location.pathname&&!yn?await Jn({error:n,url:e,route:t}):await R(e,r)}var Q={element:void 0,href:void 0};function rr(){let e,t,n;function r(){clearTimeout(e),t?.removeEventListener(`mousemove`,i),t?.removeEventListener(`mouseleave`,r),t=void 0}function i(){clearTimeout(e),e=setTimeout(()=>{t&&s(t,j.hover)},20)}z.addEventListener(`mouseover`,e=>{if(!(e.target instanceof Element))return;let n=Ot(e.target,z);if(!n||n===t)return;r(),t=n;let a=At(n);a.preload_code<j.hover&&a.preload_data<j.hover||(n.addEventListener(`mousemove`,i),n.addEventListener(`mouseleave`,r,{once:!0}),i())});function a(e){if(e.defaultPrevented)return;let t=Ot(e.composedPath()[0],z);t&&s(t,j.tap)}z.addEventListener(`mousedown`,a),z.addEventListener(`touchstart`,a,{passive:!0});let o=new IntersectionObserver(e=>{for(let t of e)t.isIntersecting&&(Ln(new URL(t.target.href)),o.unobserve(t.target))},{threshold:0});async function s(e,t){let r=e===Q.element&&e?.href===Q.href&&t>=n;if(!e||r)return;let{url:i,external:a,download:o}=kt(e,C,B.hash);if(a||o)return;let s=At(e),c=i&&Zn(U.url)===Zn(i);if(!(s.reload||c)){if(t<=s.preload_data){Q={element:e,href:e.href},n=j.tap;let t=await Z(i,!1);if(!t)return;Fn(t).catch(M)}else t<=s.preload_code&&(Q={element:e,href:e.href},n=t,Ln(i))}}function c(){o.disconnect();for(let e of z.querySelectorAll(`a`)){let{url:t,external:n,download:r}=kt(e,C,B.hash);if(n||r)continue;let i=At(e);i.reload||(i.preload_code===j.viewport&&o.observe(e),i.preload_code===j.eager&&Ln(t))}}H.add(c),c()}async function $(e,t){if(e instanceof fe)return e.body;let n;n=e instanceof de?{kind:`app`,error:e.body}:e instanceof me?{kind:`framework`,error:{status:e.status,message:e.text}}:{kind:`unknown`,error:e};let r=n.kind===`unknown`?{status:500,message:`Internal Error`}:n.error,i={...n,event:t},a=await B.hooks.handleError(i);return{...r,...a}}function ir(e,t){n(()=>(e.add(t),()=>{e.delete(t)}))}function ar(e){ir(H,e)}async function or(e,t){let n=new URL(Ct(e));n.origin!==St&&zt({caller:t,url:String(e)});let r=await Z(n,!1);return r||Bt({caller:t,url:String(e)}),r}function sr(e){if(typeof e==`function`)mn.push(e);else{let{href:t}=new URL(e,location.href);mn.push(e=>e.href===t)}}async function cr(e,t){await lr(await or(e,`replaceState`),t,{replace:!0,persist_state:!1,reset:!1},`replaceState`)}async function lr(e,t,{replace:n,persist_state:r,reset:i},a){let o=e.url,s=Wt(),c=a===`goto`?Qn({url:o,type:`goto`,intent:e,shallow:!0}):void 0;if(!c&&a===`goto`)return;let l={};c&&(Y=X=l,W=!0,w(c.navigation)),n?qt(K):(L(K),Gt(K)),i&&(J+=1);let d=it(t);t=O(d);let f={[A]:{historyIndex:K+=+!n,navigationIndex:q,pageUrl:ue.url.href,state:d,persistState:r,resetIndex:J}};(n?history.replaceState:history.pushState).call(history,f,``,o),an(K,f[A]),n||(xn=!0,on(K,q)),c&&await er(c.navigation),Pt(i),T({state:t,shallow:{params:e?.params??null,route:e?{id:e.route.id}:null,url:o}}),(!c||await tr(c,l,o,null,i,u()))&&(Kt(K,s),c&&w(null))}function ur(){history.scrollRestoration=`manual`,addEventListener(`beforeunload`,e=>{let t=!1;if(Nn(),!W){let e=pr(U,void 0,null,`leave`),n={...e.navigation,cancel:()=>{t=!0,e.reject(Error(`navigation cancelled`))}};_n.forEach(e=>e(n))}t&&(e.preventDefault(),e.returnValue=``)}),addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`?Nn():le.check()}),addEventListener(`focus`,()=>{le.check()}),navigator.connection?.saveData||rr(),z.addEventListener(`click`,async t=>{if(t.button||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;let n=Ot(t.composedPath()[0],z);if(!n)return;let{url:r,external:i,target:a,download:o}=kt(n,C,B.hash);if(!r)return;if(a===`_parent`||a===`_top`){if(window.parent!==window)return}else if(a&&a!==`_self`)return;let s=At(n);if(!(n instanceof SVGAElement)&&r.protocol!==location.protocol&&r.protocol!==`https:`&&r.protocol!==`http:`||o)return;let[c,l]=(B.hash?r.hash.replace(/^#/,``):r.href).split(`#`),u=c===_e(location);if(i||s.reload&&(!u||!l)){Qn({url:r,type:`link`,event:t})?W=!0:t.preventDefault();return}if(l!==void 0&&u){let[,i]=U.url.href.split(`#`);if(i===l){if(t.preventDefault(),l===``||l===`top`&&n.ownerDocument.getElementById(`top`)===null)scrollTo({top:0});else{let e=n.ownerDocument.getElementById(decodeURIComponent(l));e&&(e.scrollIntoView(),e.focus())}return}if(G={...Cn(),resetIndex:J+ +!!s.reset},L(K),e(r),!s.replace_state)return;G=null}t.preventDefault(),await new Promise(e=>{requestAnimationFrame(()=>{setTimeout(e,0)}),setTimeout(e,100)});let d=r.href!==location.href;await Pn(r,{type:`link`,reset:s.reset,replace:s.replace_state??!d,refreshAll:!d,event:t})}),z.addEventListener(`submit`,e=>{if(e.defaultPrevented)return;let t=HTMLFormElement.prototype.cloneNode.call(e.target),n=e.submitter;if((n?.formTarget||t.target)===`_blank`||(n?.formMethod||t.method)!==`get`)return;let r=new URL(n?.hasAttribute(`formaction`)&&n?.formAction||t.action);if(jt(r,C,!1))return;let i=e.target,a=At(i);if(a.reload)return;e.preventDefault(),e.stopPropagation();let o=new FormData(i,n);r.search=new URLSearchParams(o).toString(),$n({type:`form`,url:r,reset:a.reset,replace_state:a.replace_state??r.href===location.href,event:e})}),addEventListener(`popstate`,async t=>{let n=Cn(t.state);if(n?.historyIndex){let r=n.historyIndex,i=P[K];if(r===K)return;Y=X={};let a=r-K,o=n.resetIndex,s=o!==(i?.resetIndex??J),c=P[r]?.scroll,l=O(n.state),u=new URL(n.pageUrl??location.href),d=n.navigationIndex,f=U.url&&(location.href+U.url.href).includes(`#`)?_e(location)===_e(U.url):!1,p=d===q&&(xn&&(n.pageUrl===void 0||n.pageUrl===location.href)||f),m=n.pageUrl?new URL(location.href):null,h=K,g=q,_=J;L(h),p||jn(g),Gt(h),K=r,q=d,J=o;let v=Y,y=m?await Z(m,!1):void 0;if(Y!==v)return;let ee=m?{params:y?.params??null,route:y?{id:y.route.id}:null,url:m}:null;if(p){Pt(s),T({state:l,shallow:ee}),e(u),s&&c&&scrollTo(c.x,c.y),Kt(K,Wt()),W=!1,w(null);return}await $n({type:`popstate`,url:u,reset:s,popped:{state:l,scroll:c,delta:a,shallow:ee},block:()=>{K=h,q=g,J=_,history.go(-a)},nav_token:v,event:t})}else G||(e(new URL(location.href)),B.hash&&location.reload())}),addEventListener(`hashchange`,()=>{if(G){let e=G;G=null,J=e.resetIndex,history.replaceState({...history.state,[A]:{...e,historyIndex:++K,navigationIndex:q}},``,location.href),an(K,e)}});for(let e of document.querySelectorAll(`link`))rn.has(e.rel)&&(e.href=e.href);addEventListener(`pageshow`,e=>{if(e.persisted){w(null);let e=P[K]?.scroll;e&&scrollTo(e.x,e.y)}});function e(e){U.url=e,T({url:e})}}async function dr(e,{status:t,error:n,node_ids:r,params:i,route:a,server_route:o,data:s,form:c}){yn=!0;let l=new URL(location.href),u;({params:i={},route:a={id:null}}=await Z(l,!1)||{}),u=cn.find(({id:e})=>e===a.id);let d,f=!0;try{let e=r.map(async(t,n)=>{let r=s[n];return r?.uses&&(r.uses=fr(r.uses)),Bn({loader:B.nodes[t],url:l,params:i,route:a,parent:async()=>{let t={};for(let r=0;r<n;r+=1)Object.assign(t,(await e[r]).data);return t},server_data_node:Un(r)})}),o=await Promise.all(e);if(u){let e=u.layouts;for(let t=0;t<e.length;t++)e[t]||o.splice(t,0,void 0)}d=await zn({url:l,params:i,branch:o,status:t,error:n,errors:u?.errors,form:c,route:u??null})}catch(t){if(t instanceof pe)return await R(new URL(t.location,location.href));d=await Jn({error:await $(t,{url:l,params:i,route:a}),url:l,route:a}),e.textContent=``,f=!1}if(d){if(d.props.page){let e=Cn();d.props.page.state=e?.persistState?O(e.state):{}}await Rn(d,e,f)}}function fr(e){return{dependencies:new Set(e?.dependencies??[]),params:new Set(e?.params??[]),parent:!!e?.parent,route:!!e?.route,url:!!e?.url,search_params:new Set(e?.search_params??[])}}function pr(e,t,n,r,i=null,a=!1,o){let s,c,l=new Promise((e,t)=>{s=e,c=t});return l.catch(M),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url,scroll:wt()},to:n&&{params:o?o.params:t?.params??null,route:{id:o?o.route?.id??null:t?.route?.id??null},url:o?.url??n,scroll:i},willUnload:!a&&!t,type:r,shallow:a,complete:l},fulfil:s,reject:c}}function mr(e){let t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function hr(e){T(e.props.page),I.tree.data=e.props.tree.data,I.tree.child=e.props.tree.child,`form`in e.props&&(I.form=e.props.form),`error`in e.props&&(I.error=e.props.error)}export{Dn as n,Nt as r,cr as t};
2
+ `:return`\\n`;case`\r`:return`\\r`;case` `:return`\\t`;case`\b`:return`\\b`;case`\f`:return`\\f`;case`\u2028`:return`\\u2028`;case`\u2029`:return`\\u2029`;default:return e<` `?`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`:``}}function D(e){let t=``,n=0,r=e.length;for(let i=0;i<r;i+=1){let r=e[i],a=De(r);a&&(t+=e.slice(n,i)+a,n=i+1)}return`"${n===0?e:t+e.slice(n)}"`}function Oe(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.getOwnPropertyDescriptor(e,t).enumerable)}var ke=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function Ae(e){return ke.test(e)?`.`+e:`[`+JSON.stringify(e)+`]`}function je(e){return!(!Number.isInteger(e)||e<0||e>Se)}function Me(e){return!(!Number.isInteger(e)||e<0||e>xe)}function Ne(e){if(e.length===0||e.length>1&&e.charCodeAt(0)===48)return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<48||n>57)return!1}return je(+e)}function Pe(e){for(var t=e.length-1;t>=0&&!Ne(e[t]);t--);return t+1}function Fe(e){let t=Object.keys(e);return t.length=Pe(t),t}function Ie(e){return new Uint8Array(e).toBase64()}function Le(e){return Uint8Array.fromBase64(e).buffer}function Re(e){return Buffer.from(e).toString(`base64`)}function ze(e){return Uint8Array.from(Buffer.from(e,`base64`)).buffer}function Be(e){let t=new Uint8Array(e),n=``,r=32768;for(let e=0;e<t.length;e+=r){let i=t.subarray(e,e+r);n+=String.fromCharCode.apply(null,i)}return btoa(n)}function Ve(e){let t=atob(e),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.charCodeAt(e);return r.buffer}var He=typeof Uint8Array.fromBase64==`function`,Ue=typeof process==`object`&&process.versions?.node!==void 0,We=He?Ie:Ue?Re:Be,Ge=He?Le:Ue?ze:Ve;function Ke(e,t){if(!t)return e;let n={};for(let r of Object.keys(e))n[r]=t[r]??e[r];return n}var qe=Object.freeze({kind:`not-plain`}),Je=Object.freeze({kind:`symbol-keys`}),Ye=Object.freeze({identify:e=>e,typeOf:e=>e===null?`null`:typeof e,toPrimitive:e=>e,tagOf:e=>Te(e),isThenable:e=>typeof e.then==`function`,toPromise:e=>Promise.resolve(e),unbox:e=>e.valueOf(),toISOString:e=>isNaN(e.getDate())?``:e.toISOString(),toStringValue:e=>e.toString(),regExpInfo:e=>({source:e.source,flags:e.flags}),valuesOf:e=>e,entriesOf:e=>e,viewInfo:e=>(Ee(e)&&(e=new Uint8Array(e)),{buffer:e.buffer,byteOffset:e.byteOffset,byteLength:e.byteLength,length:e.length,bufferByteLength:e.buffer.byteLength}),toArrayBuffer:e=>e,lengthOf:e=>e.length,hasOwn:(e,t)=>Object.hasOwn(e,t),indicesOf:e=>Fe(e),shapeOf:e=>we(e)?Oe(e).length>0?Je:{kind:Object.getPrototypeOf(e)===null?`null-proto`:`plain`,keys:Object.keys(e)}:qe,get:(e,t)=>e[t]}),Xe=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,`byteLength`).get,Ze=typeof SharedArrayBuffer>`u`?void 0:Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype,`byteLength`).get,Qe=Object.freeze({fromPrimitive:e=>e,fromISOString:e=>new Date(e),fromStringValue:(e,t)=>e===`URL`?new URL(t):e===`URLSearchParams`?new URLSearchParams(t):Temporal[e.slice(9)].from(t),fromArrayBuffer:e=>e,fromRegExpInfo:(e,t)=>new RegExp(e,t),fromViewInfo:(e,t,n,r)=>{try{Xe.call(t)}catch(e){if(!Ze)throw e;Ze.call(t)}let i=globalThis[e];return n===void 0?new i(t):new i(t,n,r)},box:e=>Object(e),createArray:e=>Array(e),createSparseArray:e=>{let t=[];return t[Se]=void 0,delete t[Se],t.length=e,t},createObject:()=>({}),createNullPrototypeObject:()=>Object.create(null),createSet:()=>new Set,createMap:()=>new Map,set:(e,t,n)=>{e[t]=n},addValue:(e,t)=>{e.add(t)},addEntry:(e,t,n)=>{e.set(t,n)}});function $e(e,t,n){return et(JSON.parse(e),t,n)}function et(e,t,n){let r=Ke(Qe,n?.operations);if(typeof e==`number`)return s(e,!0);if(!Array.isArray(e)||e.length===0)throw Error(`Invalid input`);let i=e,a=Array(i.length),o=null;function s(e,n=!1){if(e===-1)return r.fromPrimitive(void 0);if(e===-3)return r.fromPrimitive(NaN);if(e===-4)return r.fromPrimitive(1/0);if(e===-5)return r.fromPrimitive(-1/0);if(e===-6)return r.fromPrimitive(-0);if(n||typeof e!=`number`)throw Error(`Invalid input`);if(e in a)return a[e];if(e>=i.length)throw Error(`Invalid input`);let c=i[e];if(!c||typeof c!=`object`)a[e]=r.fromPrimitive(c);else if(Array.isArray(c)){if(typeof c[0]==`string`){let n=c[0],l=t&&Object.hasOwn(t,n)?t[n]:void 0;if(l){let t=c[1];if(typeof t!=`number`&&(t=i.push(c[1])-1),Object.hasOwn(a,t))return a[e]=l(a[t]);if(o??=new Set,o.has(t))throw Error(`Invalid circular reference`);return o.add(t),a[e]=l(s(t)),o.delete(t),a[e]}switch(n){case`Date`:a[e]=r.fromISOString(c[1]);break;case`Set`:let t=r.createSet();a[e]=t;for(let e=1;e<c.length;e+=1)r.addValue(t,s(c[e]));break;case`Map`:let o=r.createMap();a[e]=o;for(let e=1;e<c.length;e+=2)r.addEntry(o,s(c[e]),s(c[e+1]));break;case`RegExp`:a[e]=r.fromRegExpInfo(c[1],c[2]);break;case`Object`:{let t=c[1];if(typeof i[t]==`object`&&i[t][0]!==`BigInt`)throw Error(`Invalid input`);a[e]=r.box(s(t));break}case`BigInt`:a[e]=r.fromPrimitive(BigInt(c[1]));break;case`null`:let l=r.createNullPrototypeObject();a[e]=l;for(let e=1;e<c.length;e+=2){let t=c[e];if(typeof t!=`string`)throw Error(`Cannot parse an object with a non-string key`);if(t===`__proto__`)throw Error("Cannot parse an object with a `__proto__` property");r.set(l,t,s(c[e+1]))}break;case`Int8Array`:case`Uint8Array`:case`Uint8ClampedArray`:case`Int16Array`:case`Uint16Array`:case`Float16Array`:case`Int32Array`:case`Uint32Array`:case`Float32Array`:case`Float64Array`:case`BigInt64Array`:case`BigUint64Array`:case`DataView`:{if(i[c[1]][0]!==`ArrayBuffer`)throw Error(`Invalid data`);let t=s(c[1]);a[e]=r.fromViewInfo(n,t,c[2],c[3]);break}case`ArrayBuffer`:{let t=c[1];if(typeof t!=`string`)throw Error(`Invalid ArrayBuffer encoding`);a[e]=r.fromArrayBuffer(Ge(t));break}case`URL`:case`URLSearchParams`:case`Temporal.Duration`:case`Temporal.Instant`:case`Temporal.PlainDate`:case`Temporal.PlainTime`:case`Temporal.PlainDateTime`:case`Temporal.PlainMonthDay`:case`Temporal.PlainYearMonth`:case`Temporal.ZonedDateTime`:a[e]=r.fromStringValue(n,c[1]);break;default:throw Error(`Unknown type ${n}`)}}else if(c[0]===-7){let t=c[1];if(!Me(t))throw Error(`Invalid input`);let n=r.createSparseArray(t);a[e]=n;for(let e=2;e<c.length;e+=2){let i=c[e];if(!je(i)||i>=t)throw Error(`Invalid input`);r.set(n,i,s(c[e+1]))}}else{let t=r.createArray(c.length);a[e]=t;for(let e=0;e<c.length;e+=1){let n=c[e];n!==-2&&r.set(t,e,s(n))}}}else{let t=r.createObject();a[e]=t;for(let e of Object.keys(c)){if(e===`__proto__`)throw Error("Cannot parse an object with a `__proto__` property");r.set(t,e,s(c[e]))}}return a[e]}return s(0)}function tt(e,t,n){let r=nt(!1,e,t,n);return typeof r==`string`?r:`[${r.join(`,`)}]`}function nt(e,t,n,r){let i=Ke(Ye,r?.operations),a=[],o=new Map,s=[];if(n)for(let e of Object.getOwnPropertyNames(n))s.push({key:e,fn:n[e]});let c=[],l=0;function u(n,r){let d=i.typeOf(n);if(d===`undefined`)return-1;let f;if(d===`number`){if(f=i.toPrimitive(n),Number.isNaN(f))return-3;if(f===1/0)return-4;if(f===-1/0)return-5;if(f===0&&1/f<0)return-6}let p=i.identify(n);if(o.has(p))return o.get(p);r??=l++,o.set(p,r);for(let{key:e,fn:t}of s){let i=t(n);if(i)return a[r]=`["${e}",${u(i)}]`,r}if(d===`function`)throw new E(`Cannot stringify a function`,c,n,t);if(d===`symbol`)throw new E(`Cannot stringify a Symbol primitive`,c,n,t);let m=``;if(d!==`object`)m=rt(d===`number`?f:i.toPrimitive(n));else if(i.isThenable(n)){if(!e)throw new E(`Cannot stringify a Promise or thenable — use stringifyAsync instead`,c,n,t);m=i.toPromise(n).then(e=>{let t=u(e,r);t<0&&(a[r]=t)}),m.catch(()=>{})}else{let e=i.tagOf(n);switch(e){case`Number`:case`String`:case`Boolean`:case`BigInt`:m=`["Object",${u(i.unbox(n))}]`;break;case`Date`:m=`["Date","${i.toISOString(n)}"]`;break;case`URL`:m=`["URL",${D(i.toStringValue(n))}]`;break;case`URLSearchParams`:m=`["URLSearchParams",${D(i.toStringValue(n))}]`;break;case`RegExp`:let{source:r,flags:a}=i.regExpInfo(n);m=a?`["RegExp",${D(r)},"${a}"]`:`["RegExp",${D(r)}]`;break;case`Array`:{let e=!1,t=i.lengthOf(n);m=`[`;for(let r=0;r<t;r+=1)if(r>0&&(m+=`,`),i.hasOwn(n,r))c.push(`[${r}]`),m+=u(i.get(n,r)),c.pop();else if(e)m+=-2;else{let r=i.indicesOf(n),a=r.length,o=String(t).length;if((t-a)*3>4+o+a*(o+1)){m=`[-7,`+t;for(let e=0;e<r.length;e++){let t=r[e];c.push(`[${t}]`),m+=`,`+t+`,`+u(i.get(n,t)),c.pop()}break}e=!0,m+=-2}m+=`]`;break}case`Set`:m=`["Set"`;for(let e of i.valuesOf(n))m+=`,${u(e)}`;m+=`]`;break;case`Map`:m=`["Map"`;for(let[e,t]of i.entriesOf(n)){let n=i.typeOf(e),r=n!==`object`&&n!==`function`&&n!==`symbol`;c.push(`.get(${r?rt(i.toPrimitive(e)):`...`})`),m+=`,${u(e)},${u(t)}`,c.pop()}m+=`]`;break;case`Int8Array`:case`Uint8Array`:case`Uint8ClampedArray`:case`Int16Array`:case`Uint16Array`:case`Float16Array`:case`Int32Array`:case`Uint32Array`:case`Float32Array`:case`Float64Array`:case`BigInt64Array`:case`BigUint64Array`:{let t=i.viewInfo(n);m=`["`+e+`",`+u(t.buffer),t.byteLength!==t.bufferByteLength&&(m+=`,${t.byteOffset},${t.length}`),m+=`]`;break}case`DataView`:{let t=i.viewInfo(n);m=`["`+e+`",`+u(t.buffer),t.byteLength!==t.bufferByteLength&&(m+=`,${t.byteOffset},${t.byteLength}`),m+=`]`;break}case`ArrayBuffer`:m=`["ArrayBuffer","${We(i.toArrayBuffer(n))}"]`;break;case`Temporal.Duration`:case`Temporal.Instant`:case`Temporal.PlainDate`:case`Temporal.PlainTime`:case`Temporal.PlainDateTime`:case`Temporal.PlainMonthDay`:case`Temporal.PlainYearMonth`:case`Temporal.ZonedDateTime`:m=`["${e}",${D(i.toStringValue(n))}]`;break;default:{let e=i.shapeOf(n);if(e.kind===`not-plain`)throw new E(`Cannot stringify arbitrary non-POJOs`,c,n,t);if(e.kind===`symbol-keys`)throw new E(`Cannot stringify POJOs with symbolic keys`,c,n,t);if(e.kind===`null-proto`){m=`["null"`;for(let r of e.keys){if(r===`__proto__`)throw new E(`Cannot stringify objects with __proto__ keys`,c,n,t);c.push(Ae(r)),m+=`,${D(r)},${u(i.get(n,r))}`,c.pop()}m+=`]`}else{m=`{`;let r=!1;for(let a of e.keys){if(a===`__proto__`)throw new E(`Cannot stringify objects with __proto__ keys`,c,n,t);r&&(m+=`,`),r=!0,c.push(Ae(a)),m+=`${D(a)}:${u(i.get(n,a))}`,c.pop()}m+=`}`}}}}return a[r]=m,r}let d=u(t);return d<0?`${d}`:a}function rt(e){let t=typeof e;return t===`string`?D(e):e===void 0?`-1`:e===0&&1/e<0?`-6`:t===`bigint`?`["BigInt","${e}"]`:String(e)}var it=()=>{throw Error(``)},O=()=>{throw Error(``)},at={},ot={};function st(e){let t=Object.entries(e);t.length,at=Object.fromEntries(t.map(([e,t])=>[e,t.encode])),ot=Object.fromEntries(t.map(([e,t])=>[e,t.decode])),it=e=>tt(e,at),O=e=>$e(e,ot)}function ct(e,t){return e.origin===t.origin?e.href.slice(t.origin.length):e.href}function lt(e,t){return e+`/`+t}var ut=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:t?.method||`GET`)!==`GET`&&pt(e),ut(e,t));var k=new Map;function dt(e,t){let n=ht(e,t);if(n){let e=document.querySelector(n);if(e?.textContent){e.remove();let{body:t,...r}=JSON.parse(e.textContent);e.getAttribute(`data-b64`)!==null&&(t=be(t));let i=e.getAttribute(`data-ttl`);return i&&k.set(n,{body:t,init:r,ttl:1e3*Number(i)}),Promise.resolve(new Response(t,r))}}return window.fetch(e,t)}function ft(e,t,n){if(k.size>0){let t=ht(e,n),r=t&&k.get(t);if(r){if(performance.now()<r.ttl&&[`default`,`force-cache`,`only-if-cached`,void 0].includes(n?.cache))return new Response(r.body,r.init);k.delete(t)}}return window.fetch(t,n)}function pt(e){let t=ht(mt(e));for(let e of k.keys())e.startsWith(t)&&k.delete(e)}function mt(e){return ct(new URL(e instanceof Request?e.url:e,location.href),location)}function ht(e,t){let n=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t?.headers||t?.body){let e=t.body;if(e&&typeof e!=`string`&&!ArrayBuffer.isView(e))return null;n+=`[data-hash="${ye(t.headers,e)}"]`}return n}function gt({nodes:e,server_loads:t,dictionary:n,matchers:r}){let i=new Set(t);return Object.entries(n).map(([t,[n,i,s]])=>{let{pattern:c,params:l}=ae(t),u={id:t,exec:e=>{let t=c.exec(e);if(t)return se(t,l,r)},errors:[1,...s||[]].map(t=>e[t]),layouts:[0,...i||[]].map(o),leaf:a(n)};return u.errors.length=u.layouts.length=Math.max(u.errors.length,u.layouts.length),u});function a(t){let n=t<0;return n&&(t=~t),[n,e[t]]}function o(t){return t===void 0?t:[i.has(t),e[t]]}}function _t(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function vt(e,t,n=JSON.stringify){let r=n(t);try{sessionStorage[e]=r}catch{}}var yt=`sveltekit:snapshot`,bt=`sveltekit:navigation-snapshot`,xt=`sveltekit:history-info`,A=`sveltekit:metadata`,j={tap:1,hover:2,viewport:3,eager:4,false:-1},St=location.origin;function Ct(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){let e=document.getElementsByTagName(`base`);t=e.length?e[0].href:document.URL}return new URL(e,t)}function wt(){return{x:pageXOffset,y:pageYOffset}}function Tt(e,t){return e.getAttribute(`data-sveltekit-${t}`)}var Et={...j,"":j.hover};function Dt(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function Ot(e,t){for(;e&&e!==t;){if((e instanceof HTMLAnchorElement||e instanceof SVGAElement)&&e.hasAttribute(`href`))return e;e=Dt(e)}}function kt(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){let e=location.hash.split(`#`)[1]||`/`;r.hash=`#${e}${r.hash}`}}catch{}let i=e instanceof SVGAElement?e.target.baseVal:e.target,a=!r||!!i||jt(r,t,n)||(e.getAttribute(`rel`)||``).split(/\s+/).includes(`external`),o=r?.origin===St&&e.hasAttribute(`download`);return{url:r,external:a,target:i,download:o}}function At(e){let t=null,n=null,r=null,i=null,a=null,o=e;for(;o&&o!==document.documentElement;)t===null&&(t=Tt(o,`preload-code`)),n===null&&(n=Tt(o,`preload-data`)),r===null&&(r=Tt(o,`reload`)),i===null&&(i=Tt(o,`replacestate`)),a===null&&(a=Tt(o,`reset`)),o=Dt(o);function s(e){switch(e){case``:case`true`:return!0;case`false`:return!1;default:return}}return{preload_code:Et[t??`false`],preload_data:Et[n??`false`],reload:s(r),replace_state:s(i),reset:s(a)??!0}}function jt(e,t,n){return e.origin!==St||!e.pathname.startsWith(t)?!0:n?e.pathname!==location.pathname:!1}function Mt(e,t){let n=t?e.hash.split(`#`,3)[2]??``:e.hash.slice(1);return n?document.getElementById(decodeURIComponent(n)):null}function Nt(e){}function Pt(e){let t=document.activeElement;e&&(t instanceof HTMLElement||t instanceof SVGElement)&&t!==document.body&&t.blur()}function Ft(e){let t=e.getAttribute(`tabindex`);e.setAttribute(`tabindex`,`-1`),e.focus({preventScroll:!0,focusVisible:!1}),t===null?e.removeAttribute(`tabindex`):e.setAttribute(`tabindex`,t)}function It(e){let t=window.parent===window||document.hasFocus(),n=document.querySelector(`[autofocus]`);if(n)t&&n.focus();else{t&&Ft(Mt(e,!1)??document.body);let n=getSelection();if(n&&n.type!==`None`){let e=[];for(let t=0;t<n.rangeCount;t+=1)e.push(n.getRangeAt(t));setTimeout(()=>{if(n.rangeCount===e.length){for(let t=0;t<n.rangeCount;t+=1){let r=e[t],i=n.getRangeAt(t);if(r.commonAncestorContainer!==i.commonAncestorContainer||r.startContainer!==i.startContainer||r.endContainer!==i.endContainer||r.startOffset!==i.startOffset||r.endOffset!==i.endOffset)return}n.removeAllRanges()}})}}}var Lt=!0;function Rt(e,t,n){if(t&&Lt){if(n)scrollTo(n.x,n.y);else{let t=Mt(e,!1);t?t.scrollIntoView():scrollTo(0,0)}}Lt=!0}function zt(e){throw Error(`https://svelte.dev/e/kit/navigation_external_url`)}function Bt(e){throw Error(`https://svelte.dev/e/kit/navigation_route_missing`)}function Vt(e){throw Error(`https://svelte.dev/e/kit/redirect_loop`)}var Ht=_t(`sveltekit:navigation-snapshot`)??{},Ut=new Set;function Wt(){return new Set(Ut)}function Gt(e){Ut.size===0?delete Ht[e]:Ht[e]=Object.fromEntries(Array.from(Ut,({id:e,capture:t})=>[e,it(t())]))}function Kt(e,t){let n=Ht[e];for(let e of Ut)n&&Object.hasOwn(n,e.id)?e.restore(O(n[e.id])):t?.has(e)&&e.reset?.()}function qt(e){delete Ht[e]}function Jt(e){Gt(e),vt(bt,Ht)}var Yt=new Set([`load`,`prerender`,`csr`,`ssr`,`trailingSlash`,`config`]);[...Yt],[...new Set([...Yt])];function M(){}var Xt=c(`<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>`),Zt=c(`<!> <!>`,1);function Qt(e,n){re(n,!0);let s=(e,t=h,i=h)=>{let u=(e,t=h)=>{var n=o(),i=l(n);p(i,()=>r(f),(e,n)=>{n(e,{get error(){return t()}})}),a(e,n)},d=x(()=>t().component),f=x(()=>t().error),m=x(()=>t().data);var v=o(),y=l(v);_(y,{get failed(){return r(f)?u:void 0},get onerror(){return r(f)?n.onerror:void 0}},e=>{var u=o(),f=l(u),h=e=>{var u=o(),f=l(u);p(f,()=>r(d),(e,a)=>{g(a(e,{get data(){return r(m)},get form(){return n.form},get params(){return n.page.params},children:(e,n)=>{s(e,()=>t().child,()=>i()+1)},$$slots:{default:!0}}),e=>c()[i()]=e,()=>c()?.[i()])}),a(e,u)},_=e=>{var t=o(),s=l(t);p(s,()=>r(d),(e,t)=>{g(t(e,{get data(){return r(m)},get form(){return n.form},get params(){return n.page.params},get error(){return n.error}}),e=>c()[i()]=e,()=>c()?.[i()])}),a(e,t)};ie(f,e=>{t().child?e(h):e(_,-1)}),a(e,u)}),a(e,v)},c=ne(n,`components`,7),u=S(!1),d=S(!1),v=S(``);ar(()=>{r(u)?(b(d,!0),b(v,document.title||`untitled page`,!0)):b(u,!0)});var ae=Zt(),oe=l(ae);s(oe,()=>n.tree,()=>0);var se=m(oe,2),ce=e=>{var n=Xt(),o=f(n),s=e=>{var n=i();te(()=>t(n,r(v))),a(e,n)};ie(o,e=>{r(d)&&e(s)}),ee(n),a(e,n)};ie(se,e=>{r(u)&&e(ce)}),a(e,ae),y()}var $t=class{#e;get form(){return r(this.#e)}set form(e){b(this.#e,e)}#t;get error(){return r(this.#t)}set error(e){b(this.#t,e)}page;components=[];tree;onerror;constructor({page:e,tree:t,form:n,error:r,onerror:i=M}){this.page=e,this.tree=t,this.onerror=i,this.#e=S(n),this.#t=S(r)}},en=class{component;error;#e=S({});get data(){return r(this.#e)}set data(e){b(this.#e,e)}#t=S();get child(){return r(this.#t)}set child(e){b(this.#t,e)}constructor(e,t){this.component=e,this.error=t}};function tn(e,t,n){let r=[void 0],i=-1;for(let a=1;a<e.length;a+=1){if(!e[a])continue;let o=a-1;for(;o>i+1&&t[o]==null;)--o;i=o;let s=t[o];r.push(s==null?void 0:n(s)?.catch(()=>void 0))}return Promise.all(r)}function*nn(e,t,n){for(;e--;){let r=n[e];if(r!=null){let n=e;for(;!t[n];)--n;yield{error:r,idx:n+1}}}}var rn=new Set([`icon`,`shortcut icon`,`apple-touch-icon`]),N=new Set,P=_t(`sveltekit:history-info`)??{},F=_t(`sveltekit:snapshot`)??{},I;function L(e){P[e].scroll=wt()}function an(e,t){P[e]={...P[e],resetIndex:t.resetIndex}}function on(e,t){qt(e);let n=e+1;for(;P[n];)delete P[n],qt(n),n+=1;for(n=t+1;F[n];)delete F[n],n+=1}function R(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(M)}async function sn(){try{if(`serviceWorker`in navigator){let e=await navigator.serviceWorker.getRegistration(C||`/`);e&&await e.update()}}catch{}}var cn,ln,un,z,dn,B,fn={},pn={},mn=[],V=null;function hn(){V?.fork?.then(e=>e?.discard()),V=null,Q={element:void 0,href:void 0}}var gn=new Map,_n=new Set,vn=new Set,H=new Set,U={branch:[],error:null,url:null,nav:null},yn=!1,bn=!1,W=!1,G=null,xn=!1,Sn=!1,K,q,J;function Cn(e=history.state){return e?.[A]}var Y,X,wn=new Set,Tn=new Map,En=new Map;oe(async e=>{typeof e==`string`&&(e=new URL(e,location.href));let t=await Z(e,!1);return t?{id:t.route.id,params:t.params}:null}),Promise.resolve();function Dn(e,t,n){return kn(e,t,n)}function*On(e){for(let[t,n]of e)for(let[e,r]of n)yield[lt(t,e),r]}async function kn(t,n,r){if(e.data){let{q:t={},p:n={},l:r={},f:i={}}=e.data;for(let e in t)fn[e]=t[e];for(let e in r)fn[e]=r[e];for(let e in i)fn[e]=i[e];for(let e in n)pn[e]=n[e]}document.URL!==location.href&&(location.href=location.href),B=t,st(B.hooks.transport??{}),await t.hooks.init?.(),cn=gt(t),z=document.documentElement,dn=n,ln=t.nodes[0],un=t.nodes[1];let[i]=await Promise.all([ln(),un()]),a=new en(i.component,void 0);I=new $t({page:ue,tree:a,form:void 0,error:void 0,onerror:(e,t)=>N.add(t)});let o=Cn();K=o?.historyIndex??0,q=o?.navigationIndex??0,J=o?.resetIndex??0,K||(K=q=J=Date.now(),history.replaceState({...history.state,[A]:{historyIndex:K,navigationIndex:q,state:it({}),persistState:!1,resetIndex:K}},``)),an(K,Cn());let s=P[K]?.scroll;function c(){s&&(history.scrollRestoration=`manual`,scrollTo(s.x,s.y))}r?(c(),await dr(dn,r)):(await $n({type:`enter`,url:Ct(B.hash?mr(new URL(location.href)):location.href),replace_state:!0,state:o?.persistState?O(o.state):{},persist_state:o?.persistState??!1}),c()),ur()}function An(){mn.length=0,Sn=!1}function jn(e){I.components.some(e=>e?.snapshot)&&(F[e]=I.components.map(e=>e?.snapshot?.capture()))}function Mn(e){F[e]?.forEach((e,t)=>{I.components[t]?.snapshot?.restore(e)})}function Nn(){L(K),vt(xt,P),jn(q),vt(yt,F),Jt(K)}async function Pn(e,t={},n=0,r={},i){let a,o;t.refreshAll&&hn(),await $n({type:t.type??`goto`,url:Ct(e),reset:t.reset,replace_state:t.replace,state:t.state,persist_state:t.persistState,event:t.event,action_result:t.action_result,redirect_count:n,nav_token:r,intent:i,accept:()=>{if(t.refreshAll){Sn=!0,a=new Set;for(let[e,t]of On(Tn))t.resource?.reset(),a.add(e);o=new Set;for(let[e]of On(En))o.add(e)}t.invalidate&&t.invalidate.forEach(sr)}}),t.refreshAll&&d().then(d).then(()=>{for(let[e,{resource:t}]of On(Tn))a?.has(e)&&t.start();for(let[e,{resource:t}]of On(En))o?.has(e)&&t.reconnect()})}async function Fn(e){if(e.id!==V?.id){hn();let t={};wn.add(t),V={id:e.id,token:t,promise:Gn({...e,preload:t}).finally(()=>{wn.delete(t)}),fork:null},V.promise.catch(hn)}return V.promise}async function In(e){await Promise.all([...e.layouts,e.leaf].filter(Boolean).map(([,e])=>e()))}async function Ln(e){let t=(await Z(e,!1))?.route;t&&await In(t)}async function Rn(e,t,n){let r={params:U.params,route:{id:U.route?.id??null},url:new URL(location.href)};if(U={...e.state,nav:r},hr(e),(n?s:v)(Qt,{target:t,props:I,transformError:async e=>{let t=await $(e,U.nav);return T({error:t,status:t.status}),t}}),await Promise.resolve(),n){let e={from:null,to:{...r,scroll:P[K]?.scroll??wt()},willUnload:!1,type:`enter`,shallow:!1,complete:Promise.resolve()};H.forEach(t=>t(e))}Mn(q),Kt(K),bn=!0}async function zn({url:e,params:t,branch:n,errors:r,status:i,error:a,route:o,form:s}){let c=`never`;if(C&&(e.pathname===C||e.pathname===C+`/`))c=`always`;else for(let e of n)e?.slash!==void 0&&(c=e.slash);e.pathname=he(e.pathname,c),e.search=e.search;let l={type:`loaded`,state:{url:e,params:t,branch:n,error:a,route:o},props:{page:{...ue},tree:{}}};a&&(l.props.error=a),s!==void 0&&(l.props.form=s);let u={},d=!ue,f=r&&await tn(n,r,e=>e().then(e=>e.component)),p=l.props.tree,m=1,h=I.tree;for(let e=0;e<n.length;e+=1){let t=n[e],r=U.branch[e];if(t&&(d||!h||t?.data!==r?.data?(p.data={...u,...t.data},d=!0):p.data=h.data,u=p.data,e<n.length-1)){let t=e+1;for(;t<n.length&&!n[t];)t+=1;let r=n[t];r&&(p=p.child=new en(r.node.component,f?.[m++]),h=h?.child)}}return(!U.url||e.href!==U.url.href||U.error!==a||s!==void 0&&s!==ue.form||d)&&(l.props.page={error:a,params:t,route:{id:o?.id??null},state:{},shallow:null,status:i??a?.status??200,url:new URL(e),form:s??null,data:u}),l}async function Bn({loader:e,parent:t,url:n,params:r,route:i,server_data_node:a}){let o={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},s=await e();return{node:s,loader:e,server:a,universal:s.universal?.load?{type:`data`,data:null,uses:o}:null,data:a?.data??null,slash:s.universal?.trailingSlash??a?.slash}}function Vn(e,t,n){let r=new URL(e instanceof Request?e.url:e,n),i=ct(r,n);return{resolved:r,promise:bn?ft(i,r.href,t):dt(i,t)}}function Hn(e,t,n,r,i,a){if(Sn)return!0;if(!i)return!1;if(i.parent&&e||i.route&&t||i.url&&n)return!0;for(let e of i.search_params)if(r.has(e))return!0;for(let e of i.params)if(a[e]!==U.params[e])return!0;for(let e of i.dependencies)if(mn.some(t=>t(new URL(e))))return!0;return!1}function Un(e,t){return e?.type===`data`?e:e?.type===`skip`?t??null:null}function Wn(e,t){if(!e)return new Set(t.searchParams.keys());let n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(let r of n){let i=e.searchParams.getAll(r).sort(),a=t.searchParams.getAll(r).sort();i.length===a.length&&i.every((e,t)=>e===a[t])&&n.delete(r)}return n}async function Gn({id:e,invalidating:t,url:n,params:r,route:i,preload:a,action_result:o}){if(!o&&V?.id===e)return wn.delete(V.token),V.promise;let{errors:s,layouts:c,leaf:l}=i,u=[...c,l],d=u.length-1,f=o?.type===`error`;s.forEach(e=>e?.().catch(M)),u.forEach(e=>e?.[1]().catch(M));let p=U.url?e!==Zn(U.url):!1,m=!U.route||i.id!==U.route.id,h=Wn(U.url,n),g=!1,_=u.map(async(e,t)=>{if(!e||f&&t===d)return;let a=U.branch[t];return e[1]===a?.loader&&!Hn(g,m,p,h,a.universal?.uses,r)?a:(g=!0,Bn({loader:e[1],url:n,params:r,route:i,parent:async()=>{let e={};for(let n=0;n<t;n+=1)Object.assign(e,(await _[n])?.data);return e},server_data_node:Un(e[0]?{type:`skip`}:null,e[0]?a?.server:void 0)}))});for(let e of _)e.catch(M);let v=[];for(let e=0;e<u.length;e+=1)if(u[e])try{v.push(await _[e])}catch(t){if(t instanceof pe)return{type:`redirect`,status:t.status,location:t.location};if(a&&wn.has(a))throw await $(t,{params:r,url:n,route:{id:i.id}});let o;if(t instanceof de)o=await $(t,{params:r,url:n,route:{id:i.id}});else{if(await le.check())return await sn(),await R(n);o=await $(t,{params:r,url:n,route:{id:i.id}})}return qn({i:e,branch:v,errors:s,error:o,url:n,params:r,route:i})}else v.push(void 0);return o?.type===`error`?qn({i:u.length,branch:v,errors:s,error:o.error,status:o.status,url:n,params:r,route:i}):zn({url:n,params:r,branch:v,errors:s,error:null,route:i,status:o?.status,form:o?.type===`success`||o?.type===`failure`?o.data??null:t?void 0:null})}async function Kn(e,t,n){for(let{error:r,idx:i}of nn(e,t,n))try{return t.slice(0,i).concat({node:await r(),loader:r,data:{},server:null,universal:null})}catch{continue}}async function qn({i:e,branch:t,errors:n,error:r,status:i,url:a,params:o,route:s}){let c=await Kn(e,t,n);return c?zn({url:a,params:o,branch:c,errors:n,error:r,status:i,route:s}):nr(a,{id:s.id},r)}async function Jn({error:e,url:t,route:n}){let r={};try{return zn({url:t,params:r,branch:[await Bn({loader:ln,url:t,params:r,route:n,parent:()=>Promise.resolve({}),server_data_node:Un(null)}),{node:await un(),loader:un,universal:null,server:null,data:null}],error:e,errors:[],route:null})}catch(e){if(e instanceof pe){await Pn(new URL(e.location,location.href));return}let i=await B.get_error_template(),a=await $(e,{url:t,params:r,route:n}),o=String(a?.message??``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),s=i({status:a.status,message:o}),c=new DOMParser().parseFromString(s,`text/html`);throw document.documentElement.replaceChild(document.adoptNode(c.head),document.head),document.documentElement.replaceChild(document.adoptNode(c.body),document.body),e}}async function Yn(e){let t=e.href;if(gn.has(t))return gn.get(t);let n;try{let r=(async()=>{let t=await B.hooks.reroute({url:new URL(e),fetch:async(t,n)=>Vn(t,n,e).promise})??e;if(typeof t==`string`){let n=new URL(e);B.hash?n.hash=t:n.pathname=t,t=n}return t})();gn.set(t,r),n=await r}catch{gn.delete(t);return}return n}async function Z(e,t){if(e&&!jt(e,C,B.hash)){let n=await Yn(e);if(!n)return;let r=Xn(n);for(let n of cn){let i=n.exec(r);if(i)return{id:Zn(e),invalidating:t,route:n,params:i,url:e}}}}function Xn(e){return ge(B.hash?e.hash.replace(/^#/,``).replace(/[?#].+/,``):e.pathname.slice(C.length))||`/`}function Zn(e){return(B.hash?e.hash.replace(/^#/,``):e.pathname)+e.search}function Qn({url:e,type:t,intent:n,delta:r,event:i,scroll:a,shallow:o=!1,target:s}){let c=!1,l=pr(U,n,e,t,a??null,o,s);l.navigation.type===`popstate`&&r!==void 0&&(l.navigation.delta=r),i!==void 0&&(l.navigation.event=i);let u={...l.navigation,cancel:()=>{c=!0,l.reject(Error(`navigation cancelled`))}};return W||_n.forEach(e=>e(u)),c?null:l}async function $n({type:e,url:t,popped:n,reset:r=!0,replace_state:i,state:a={},persist_state:o=!1,redirect_count:s=0,nav_token:c={},accept:l=M,block:d=M,event:f,intent:p,action_result:m}){let h=Y,g=X;Y=X=c,p??=await Z(t,!1);let _=e===`enter`?pr(U,p,t,e):Qn({url:t,type:e,delta:n?.delta,intent:p,scroll:n?.scroll,shallow:!!n?.shallow,target:n?.shallow??void 0,event:f});if(!_){d(),Y===c&&(Y=h),X===c&&(X=g);return}let v=K,y=q,ee=Wt();l(),W=!0,bn&&_.navigation.type!==`enter`&&w(_.navigation);let b=p&&await Gn({...p,action_result:m});if(!b){let e=jt(t,C,B.hash),n=e&&!1;if(e&&!n)return await R(t,i);b=await nr(t,{id:null},await $(new me(404,`Not Found`,`Not found: ${t.pathname}${n?` (did you forget the hash?)`:``}`),{url:t,params:{},route:{id:null}}),i)}if(t=p?.url||t,Y!==c){_.reject(Error(`navigation aborted`));return}if(!b)return;if(b.type===`redirect`){if(s<20){V?.id===p?.id&&hn(),await $n({type:e,url:new URL(b.location,t),popped:n,reset:r,replace_state:i,state:a,persist_state:o,redirect_count:s+1,nav_token:c}),_.fulfil(void 0);return}if(b=await Jn({error:await $(ce(()=>Vt({url:t.href})),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}}),!b)return}else if(b.props.page.status>=400&&await le.check())return await sn(),await R(t,i);if(An(),n||(L(v),jn(y),i?qt(v):Gt(v)),b.props.page.url.pathname!==t.pathname&&(t.pathname=b.props.page.url.pathname),n)a=n.state;else{let n=it(a);a=O(n);let s=+!i;e!==`enter`&&r&&(J+=1);let c={[A]:{historyIndex:K+=s,navigationIndex:q+=s,state:n,persistState:o,resetIndex:J}};(i?history.replaceState:history.pushState).call(history,c,``,t),an(K,c[A]),i||on(K,q)}let x=p&&V?.id===p.id?V.fork:null;V?.fork&&!x?hn():(V=null,Q={element:void 0,href:void 0}),b.props.page.state=a,b.props.page.shallow=n?.shallow??null;let te;if(bn){await er(_.navigation);let e=n?.shallow?{params:b.state.params,route:{id:b.state.route?.id??null},url:b.state.url}:_.navigation.to;U={...b.state,nav:{params:e.params,route:e.route,url:e.url}},b.props.page&&(b.props.page.url=t),Pt(r);let i=x&&await x;if(i){te=i.commit();for(let e of N)e();N.clear()}else hr(b),te=u().then(()=>{for(let e of N)e();N.clear()});xn=!0}else await Rn(b,dn,!1);await tr(_,c,t,n?.scroll,r,te)&&(e===`popstate`&&Mn(q),Kt(K,ee),w(null))}async function er(e){let t=(await Promise.all(Array.from(vn,t=>t(e)))).filter(e=>typeof e==`function`);if(t.length>0){function e(){t.forEach(e=>H.delete(e))}t.push(e),t.forEach(e=>H.add(e))}}async function tr(e,t,n,r,i,a){return await a,Y===t?(Rt(n,i,r),i&&document.activeElement===document.body&&It(n),W=!1,e.fulfil(void 0),e.navigation.to&&(e.navigation.to.scroll=wt()),H.forEach(t=>t(e.navigation)),!0):(e.reject(Error(`navigation aborted`)),!1)}async function nr(e,t,n,r){return e.origin===St&&e.pathname===location.pathname&&!yn?await Jn({error:n,url:e,route:t}):await R(e,r)}var Q={element:void 0,href:void 0};function rr(){let e,t,n;function r(){clearTimeout(e),t?.removeEventListener(`mousemove`,i),t?.removeEventListener(`mouseleave`,r),t=void 0}function i(){clearTimeout(e),e=setTimeout(()=>{t&&s(t,j.hover)},20)}z.addEventListener(`mouseover`,e=>{if(!(e.target instanceof Element))return;let n=Ot(e.target,z);if(!n||n===t)return;r(),t=n;let a=At(n);a.preload_code<j.hover&&a.preload_data<j.hover||(n.addEventListener(`mousemove`,i),n.addEventListener(`mouseleave`,r,{once:!0}),i())});function a(e){if(e.defaultPrevented)return;let t=Ot(e.composedPath()[0],z);t&&s(t,j.tap)}z.addEventListener(`mousedown`,a),z.addEventListener(`touchstart`,a,{passive:!0});let o=new IntersectionObserver(e=>{for(let t of e)t.isIntersecting&&(Ln(new URL(t.target.href)),o.unobserve(t.target))},{threshold:0});async function s(e,t){let r=e===Q.element&&e?.href===Q.href&&t>=n;if(!e||r)return;let{url:i,external:a,download:o}=kt(e,C,B.hash);if(a||o)return;let s=At(e),c=i&&Zn(U.url)===Zn(i);if(!(s.reload||c)){if(t<=s.preload_data){Q={element:e,href:e.href},n=j.tap;let t=await Z(i,!1);if(!t)return;Fn(t).catch(M)}else t<=s.preload_code&&(Q={element:e,href:e.href},n=t,Ln(i))}}function c(){o.disconnect();for(let e of z.querySelectorAll(`a`)){let{url:t,external:n,download:r}=kt(e,C,B.hash);if(n||r)continue;let i=At(e);i.reload||(i.preload_code===j.viewport&&o.observe(e),i.preload_code===j.eager&&Ln(t))}}H.add(c),c()}async function $(e,t){if(e instanceof fe)return e.body;let n;n=e instanceof de?{kind:`app`,error:e.body}:e instanceof me?{kind:`framework`,error:{status:e.status,message:e.text}}:{kind:`unknown`,error:e};let r=n.kind===`unknown`?{status:500,message:`Internal Error`}:n.error,i={...n,event:t},a=await B.hooks.handleError(i);return{...r,...a}}function ir(e,t){n(()=>(e.add(t),()=>{e.delete(t)}))}function ar(e){ir(H,e)}async function or(e,t){let n=new URL(Ct(e));n.origin!==St&&zt({caller:t,url:String(e)});let r=await Z(n,!1);return r||Bt({caller:t,url:String(e)}),r}function sr(e){if(typeof e==`function`)mn.push(e);else{let{href:t}=new URL(e,location.href);mn.push(e=>e.href===t)}}async function cr(e,t){await lr(await or(e,`replaceState`),t,{replace:!0,persist_state:!1,reset:!1},`replaceState`)}async function lr(e,t,{replace:n,persist_state:r,reset:i},a){let o=e.url,s=Wt(),c=a===`goto`?Qn({url:o,type:`goto`,intent:e,shallow:!0}):void 0;if(!c&&a===`goto`)return;let l={};c&&(Y=X=l,W=!0,w(c.navigation)),n?qt(K):(L(K),Gt(K)),i&&(J+=1);let d=it(t);t=O(d);let f={[A]:{historyIndex:K+=+!n,navigationIndex:q,pageUrl:ue.url.href,state:d,persistState:r,resetIndex:J}};(n?history.replaceState:history.pushState).call(history,f,``,o),an(K,f[A]),n||(xn=!0,on(K,q)),c&&await er(c.navigation),Pt(i),T({state:t,shallow:{params:e?.params??null,route:e?{id:e.route.id}:null,url:o}}),(!c||await tr(c,l,o,null,i,u()))&&(Kt(K,s),c&&w(null))}function ur(){history.scrollRestoration=`manual`,addEventListener(`beforeunload`,e=>{let t=!1;if(Nn(),!W){let e=pr(U,void 0,null,`leave`),n={...e.navigation,cancel:()=>{t=!0,e.reject(Error(`navigation cancelled`))}};_n.forEach(e=>e(n))}t&&(e.preventDefault(),e.returnValue=``)}),addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`?Nn():le.check()}),addEventListener(`focus`,()=>{le.check()}),navigator.connection?.saveData||rr(),z.addEventListener(`click`,async t=>{if(t.button||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;let n=Ot(t.composedPath()[0],z);if(!n)return;let{url:r,external:i,target:a,download:o}=kt(n,C,B.hash);if(!r)return;if(a===`_parent`||a===`_top`){if(window.parent!==window)return}else if(a&&a!==`_self`)return;let s=At(n);if(!(n instanceof SVGAElement)&&r.protocol!==location.protocol&&r.protocol!==`https:`&&r.protocol!==`http:`||o)return;let[c,l]=(B.hash?r.hash.replace(/^#/,``):r.href).split(`#`),u=c===_e(location);if(i||s.reload&&(!u||!l)){Qn({url:r,type:`link`,event:t})?W=!0:t.preventDefault();return}if(l!==void 0&&u){let[,i]=U.url.href.split(`#`);if(i===l){if(t.preventDefault(),l===``||l===`top`&&n.ownerDocument.getElementById(`top`)===null)scrollTo({top:0});else{let e=n.ownerDocument.getElementById(decodeURIComponent(l));e&&(e.scrollIntoView(),e.focus())}return}if(G={...Cn(),resetIndex:J+ +!!s.reset},L(K),e(r),!s.replace_state)return;G=null}t.preventDefault(),await new Promise(e=>{requestAnimationFrame(()=>{setTimeout(e,0)}),setTimeout(e,100)});let d=r.href!==location.href;await Pn(r,{type:`link`,reset:s.reset,replace:s.replace_state??!d,refreshAll:!d,event:t})}),z.addEventListener(`submit`,e=>{if(e.defaultPrevented)return;let t=HTMLFormElement.prototype.cloneNode.call(e.target),n=e.submitter;if((n?.formTarget||t.target)===`_blank`||(n?.formMethod||t.method)!==`get`)return;let r=new URL(n?.hasAttribute(`formaction`)&&n?.formAction||t.action);if(jt(r,C,!1))return;let i=e.target,a=At(i);if(a.reload)return;e.preventDefault(),e.stopPropagation();let o=new FormData(i,n);r.search=new URLSearchParams(o).toString(),$n({type:`form`,url:r,reset:a.reset,replace_state:a.replace_state??r.href===location.href,event:e})}),addEventListener(`popstate`,async t=>{let n=Cn(t.state);if(n?.historyIndex){let r=n.historyIndex,i=P[K];if(r===K)return;Y=X={};let a=r-K,o=n.resetIndex,s=o!==(i?.resetIndex??J),c=P[r]?.scroll,l=O(n.state),u=new URL(n.pageUrl??location.href),d=n.navigationIndex,f=U.url&&(location.href+U.url.href).includes(`#`)?_e(location)===_e(U.url):!1,p=d===q&&(xn&&(n.pageUrl===void 0||n.pageUrl===location.href)||f),m=n.pageUrl?new URL(location.href):null,h=K,g=q,_=J;L(h),p||jn(g),Gt(h),K=r,q=d,J=o;let v=Y,y=m?await Z(m,!1):void 0;if(Y!==v)return;let ee=m?{params:y?.params??null,route:y?{id:y.route.id}:null,url:m}:null;if(p){Pt(s),T({state:l,shallow:ee}),e(u),s&&c&&scrollTo(c.x,c.y),Kt(K,Wt()),W=!1,w(null);return}await $n({type:`popstate`,url:u,reset:s,popped:{state:l,scroll:c,delta:a,shallow:ee},block:()=>{K=h,q=g,J=_,history.go(-a)},nav_token:v,event:t})}else G||(e(new URL(location.href)),B.hash&&location.reload())}),addEventListener(`hashchange`,()=>{if(G){let e=G;G=null,J=e.resetIndex,history.replaceState({...history.state,[A]:{...e,historyIndex:++K,navigationIndex:q}},``,location.href),an(K,e)}});for(let e of document.querySelectorAll(`link`))rn.has(e.rel)&&(e.href=e.href);addEventListener(`pageshow`,e=>{if(e.persisted){w(null);let e=P[K]?.scroll;e&&scrollTo(e.x,e.y)}});function e(e){U.url=e,T({url:e})}}async function dr(e,{status:t,error:n,node_ids:r,params:i,route:a,server_route:o,data:s,form:c}){yn=!0;let l=new URL(location.href),u;({params:i={},route:a={id:null}}=await Z(l,!1)||{}),u=cn.find(({id:e})=>e===a.id);let d,f=!0;try{let e=r.map(async(t,n)=>{let r=s[n];return r?.uses&&(r.uses=fr(r.uses)),Bn({loader:B.nodes[t],url:l,params:i,route:a,parent:async()=>{let t={};for(let r=0;r<n;r+=1)Object.assign(t,(await e[r]).data);return t},server_data_node:Un(r)})}),o=await Promise.all(e);if(u){let e=u.layouts;for(let t=0;t<e.length;t++)e[t]||o.splice(t,0,void 0)}d=await zn({url:l,params:i,branch:o,status:t,error:n,errors:u?.errors,form:c,route:u??null})}catch(t){if(t instanceof pe)return await R(new URL(t.location,location.href));d=await Jn({error:await $(t,{url:l,params:i,route:a}),url:l,route:a}),e.textContent=``,f=!1}if(d){if(d.props.page){let e=Cn();d.props.page.state=e?.persistState?O(e.state):{}}await Rn(d,e,f)}}function fr(e){return{dependencies:new Set(e?.dependencies??[]),params:new Set(e?.params??[]),parent:!!e?.parent,route:!!e?.route,url:!!e?.url,search_params:new Set(e?.search_params??[])}}function pr(e,t,n,r,i=null,a=!1,o){let s,c,l=new Promise((e,t)=>{s=e,c=t});return l.catch(M),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url,scroll:wt()},to:n&&{params:o?o.params:t?.params??null,route:{id:o?o.route?.id??null:t?.route?.id??null},url:o?.url??n,scroll:i},willUnload:!a&&!t,type:r,shallow:a,complete:l},fulfil:s,reject:c}}function mr(e){let t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function hr(e){T(e.props.page),I.tree.data=e.props.tree.data,I.tree.child=e.props.tree.child,`form`in e.props&&(I.form=e.props.form),`error`in e.props&&(I.error=e.props.error)}export{Dn as n,Nt as r,cr as t};
@@ -1,4 +1,4 @@
1
1
  import{ft as e}from"./C1qWpZZK.js";e();function t(e){let t=e.trim().toLowerCase();if(t===`transparent`)return{r:0,g:0,b:0,alpha:0};let a=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.exec(t);if(a){let e=a[1];e.length<=4&&(e=e.replace(/./g,e=>e+e));let t=t=>parseInt(e.slice(t,t+2),16);return{r:t(0),g:t(2),b:t(4),alpha:e.length===8?t(6)/255:1}}let o=/^(rgba?|hsla?)\((.*)\)$/.exec(t);if(!o)return;let s=o[2].replace(/[,/]/g,` `).trim().split(/\s+/).filter(Boolean);if(s.length!==3&&s.length!==4)return;let c=s.length===4?n(s[3],1):1;if(c===void 0)return;if(o[1].startsWith(`rgb`)){let[e,t,i]=s.slice(0,3).map(e=>n(e,255));return e===void 0||t===void 0||i===void 0?void 0:{r:r(e,255),g:r(t,255),b:r(i,255),alpha:r(c,1)}}let l=parseFloat(s[0]),u=n(s[1],1),d=n(s[2],1);if(!Number.isFinite(l)||u===void 0||d===void 0)return;let[f,p,m]=i(l,r(u,1),r(d,1));return{r:f,g:p,b:m,alpha:r(c,1)}}function n(e,t){let n=e.endsWith(`%`),r=Number(n?e.slice(0,-1):e);if(Number.isFinite(r))return n?r/100*t:r}function r(e,t){return Math.min(t,Math.max(0,e))}function i(e,t,n){let r=r=>{let i=(r+e/30)%12;return(n-t*Math.min(n,1-n)*Math.max(-1,Math.min(i-3,9-i,1)))*255};return[r(0),r(8),r(4)]}function a({r:e,g:t,b:n,alpha:i}){let a=e=>Math.round(r(e,255)).toString(16).padStart(2,`0`),o=Math.round(r(i,1)*255);return`#`+a(e)+a(t)+a(n)+(o<255?a(o):``)}var o=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`,s=[];for(let e=0;e<64;e++)s[o.charCodeAt(e)]=[(e&32)>0,(e&16)>0,(e&8)>0,(e&4)>0,(e&2)>0,(e&1)>0];function c(e){let t=[];for(let n=0;n<e.length;n+=6){let r=0;for(let t=n;t<n+6;t++)r=2*r+ +!!e[t];t.push(o[r])}return t.join(``)}var l={version:2,element:0,metadata:1,background:1,frame:0,viewer:0,legend:0,legendEntry:1,elementFields:0},u={marker:0,line:1,polygon:3,circle:4},d={background:1,legend:2,viewer:3,labelOverlap:4,labelMinZoom:5,title:6,colorScheme:7},f={theme:1,satellite:2,labels:3,language:4,colors:5,haloWidth:6,labelSize:7,font:8,labelsOnTop:9,noStreets:10,noBorders:11,hillshade:12,terrain:13,extruded:14,options:15},p={labelSize:20,haloWidth:4,colors:20},m={entries:1,theme:2,layout:3,font:4,bold:5,italic:6},h={type:1,style:2,label:3,outlineStyle:4},ee={bearing:1,pitch:2},g={legend:1,search:2,navigation:3,rotate:4,noZoomButtons:5,scale:6,tilt:7,reset:8,fullscreen:9,confine:10,scrollFree:11,locate:12,maxZoom:13,noZoom:14,noPan:15,minZoom:16},te={popupText:1},ne=111320;function re(e){let t=1/0,n=1/0,r=-1/0,i=-1/0,a=([e,a],o=0,s=0)=>{t=Math.min(t,e-o),r=Math.max(r,e+o),n=Math.min(n,a-s),i=Math.max(i,a+s)};for(let t of e)switch(t.type){case`marker`:a(t.point);break;case`line`:case`polygon`:t.points.forEach(e=>a(e));break;case`circle`:{let e=t.radius/ne,n=e/Math.max(Math.cos(t.point[1]*Math.PI/180),1e-6);a(t.point,n,e);break}}if(Number.isFinite(t))return[t,Math.max(-90,n),r,Math.min(90,i)]}function ie([e,t,n,r]){return[(e+n)/2,(t+r)/2]}var _={size:100,width:1e3,radius:2e7,longitude:3600},v=[`none`,`triangle`,`chevron`,`circle`],y=[`auto`,`right`,`left`,`top`,`bottom`,`top-right`,`top-left`,`bottom-right`,`bottom-left`],b=[`solid`,`diagonal-up`,`diagonal-down`,`horizontal`,`vertical`,`cross`,`diagonal-cross`,`dots`,`diagonal-dots`],x=[`solid`,`dashed`,`dotted`,`long-dash`,`dash-dot`],ae=[`bottom-left`,`bottom`,`bottom-right`,`right`,`top-right`,`top`,`top-left`,`left`],oe=[`vertical`,`horizontal`,`inline`],se=[`light`,`dark`,`glass`],ce=[`sans-serif`,`serif`,`monospace`],le=[`top-left`,`top-right`],ue=[`top-left`,`top-right`,`bottom-left`,`bottom-right`],de=[`bottom-left`,`bottom-right`],S=[`marker`,`line`,`area`],fe=[`vector`,`satellite`],pe=[`colorful`,`colorful-dark`,`natural`,`natural-dark`,`muted`,`muted-dark`,`gray`,`gray-dark`,`toner`,`toner-dark`,`positrino`,`positrino-dark`,`fnord`,`protocol`,`protocol-dark`,`protostar`,`protostar-dark`,`protozoa`,`classic`,`googol`,`freedom`,`macbob`,`mactaylor`,`bingo`],me=[`normal`,`fewer`,`none`],he=[`user`,`local`,`ar`,`de`,`el`,`en`,`es`,`fr`,`it`,`nl`,`pl`,`pt`,`uk`],ge=[`flat`,`extruded`],_e={marker:[`symbol`,`color`,`size`,`rotation`,`haloWidth`,`haloColor`,`labelColor`,`labelSize`,`labelFont`,`labelPosition`,`flat`],line:[`color`,`width`,`dash`,`arrowStart`,`arrowEnd`,`arrowSize`],area:[`color`,`pattern`,`patternScale`,`patternCoverage`],outline:[`visible`,`color`,`width`,`dash`]},C={color:`#ff000040`,pattern:`solid`,patternScale:1,patternCoverage:.5},w=[.5,4],T=[.05,.95],E={color:`#ff0000`,dash:`solid`,width:2,arrowStart:`none`,arrowEnd:`none`,arrowSize:3},D={color:E.color,dash:E.dash,visible:!0,width:E.width},O={color:`#ff0000`,rotation:0,size:1,labelSize:1,haloWidth:1,symbol:`extras:pin-teardrop`,labelPosition:`auto`,labelColor:`#000000`,labelFont:``,haloColor:`#ffffff`,flat:!1},ve={marker:O,line:E,area:C,outline:D};function k(e,t){return e.includes(t)?t:void 0}function A(e,t=-1/0,n=1/0){return typeof e==`number`?N(e,t,n):void 0}function ye(e){return typeof e==`number`?Se(e):void 0}function j(e){return typeof e==`string`?e:void 0}function M(e){return typeof e==`boolean`?e:void 0}function be(e){return typeof e==`string`&&/^#([0-9a-f]{6}|[0-9a-f]{8})$/i.test(e)?P(e):void 0}function xe(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t;try{t=JSON.parse(JSON.stringify(e))}catch{return}if(typeof t==`object`&&t&&!Array.isArray(t))return Object.keys(t).length>0?t:void 0}function N(e,t=-1/0,n=1/0){if(typeof e==`string`&&e.trim()!==``&&(e=Number(e)),typeof e==`number`&&Number.isFinite(e))return Math.min(n,Math.max(t,e))}function Se(e){let t=N(e);if(t===void 0)return;let n=(Math.round(t)%360+360)%360;return(n>180?n-360:n)+0}function P(e){if(typeof e!=`string`)return;let n=t(e);return n&&a(n).toLowerCase()}function Ce(e){if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`)return String(e)}function we(e){return typeof e==`string`&&(e===``||e.includes(`:`))?e:void 0}function Te(e){if(typeof e==`boolean`)return e;if(e===`true`)return!0;if(e===`false`)return!1}function F(e,t){if(typeof t!=`object`||!t)return;let n=t,r={};L(r,`color`,be(n.color)),L(r,`labelColor`,be(n.labelColor)),L(r,`haloColor`,be(n.haloColor)),L(r,`haloWidth`,A(n.haloWidth,0,_.width)),L(r,`pattern`,k(b,n.pattern)),L(r,`patternScale`,A(n.patternScale,...w)),L(r,`patternCoverage`,A(n.patternCoverage,...T)),L(r,`dash`,k(x,n.dash)),L(r,`rotation`,ye(n.rotation));let i=A(n.size,0,_.size);i&&(r.size=i);let a=A(n.labelSize,0,_.size);a&&(r.labelSize=a),L(r,`width`,A(n.width,0,_.width)),L(r,`labelPosition`,k(y,n.labelPosition)),L(r,`visible`,M(n.visible)),L(r,`flat`,M(n.flat)),L(r,`arrowStart`,k(v,n.arrowStart)),L(r,`arrowEnd`,k(v,n.arrowEnd));let o=A(n.arrowSize,0,_.size);o&&(r.arrowSize=o),L(r,`symbol`,we(n.symbol)),L(r,`labelFont`,j(n.labelFont));let s=_e[e];return R(I(Object.fromEntries(Object.entries(r).filter(([e])=>s.includes(e)))),ve[e])}function Ee(e){return(e?.arrowStart??`none`)!==`none`||(e?.arrowEnd??`none`)!==`none`}function De(e){return(e?.pattern??`solid`)!==`solid`}function I(e){let t=e;if(t.arrowSize!==void 0&&!Ee(t)){let{arrowSize:e,...n}=t;t=n}if((t.patternScale!==void 0||t.patternCoverage!==void 0)&&!De(t)){let{patternScale:e,patternCoverage:n,...r}=t;t=r}return t}function L(e,t,n){n!==void 0&&(e[t]=n)}function R(e,t){let n=Object.entries(e).filter(([e,n])=>n!==void 0&&n!==t[e]);if(n.length!==0)return Object.fromEntries(n)}function Oe(e){let n={...C,...e},{r,g:i,b:o,alpha:s}=t(n.color)??{r:0,g:0,b:0,alpha:1};return{"fill-color":a({r,g:i,b:o,alpha:1}),"fill-opacity":Math.round(s*1e3)/1e3,"fill-pattern":n.pattern,"fill-pattern-scale":De(n)?n.patternScale:void 0,"fill-pattern-coverage":De(n)?n.patternCoverage:void 0}}function ke(e){let n={...C};if(e){L(n,`color`,P(e[`fill-color`]));let r=N(e[`fill-opacity`],0,1);if(r!==void 0&&r<1){let e=t(n.color??C.color);n.color=a({...e,alpha:e.alpha*r})}L(n,`pattern`,k(b,e[`fill-pattern`])),L(n,`patternScale`,N(e[`fill-pattern-scale`],...w)),L(n,`patternCoverage`,N(e[`fill-pattern-coverage`],...T))}return R(I(n),C)}function Ae(e){return{"stroke-color":e.color,"stroke-style":e.dash,"stroke-width":e.width}}function je(e,t){t&&(L(e,`color`,P(t[`stroke-color`])),L(e,`dash`,k(x,t[`stroke-style`])),L(e,`width`,N(t[`stroke-width`],0)))}function Me(e){let t={...D,...e};return{...Ae(t),"stroke-visibility":t.visible}}function Ne(e){let t={...D};return je(t,e),e&&L(t,`visible`,Te(e[`stroke-visibility`])),R(t,D)}function Pe(e){let t={...E,...e};return{...Ae(t),"stroke-arrow-start":t.arrowStart,"stroke-arrow-end":t.arrowEnd,"stroke-arrow-size":Ee(t)?t.arrowSize:void 0}}function Fe(e){let t={...E};if(je(t,e),e){L(t,`arrowStart`,k(v,e[`stroke-arrow-start`])),L(t,`arrowEnd`,k(v,e[`stroke-arrow-end`]));let n=N(e[`stroke-arrow-size`],0);n&&(t.arrowSize=n)}return R(I(t),E)}function Ie(e){let t=j(e)?.replace(/\r\n?/g,`
2
2
  `);return t?.trim()?{label:t}:{}}function Le(e){let t={...O,...e};return{"symbol-color":t.color,"symbol-halo-width":t.haloWidth,"symbol-rotation":t.rotation,"symbol-size":t.size,"symbol-pattern":t.symbol,"symbol-label-position":t.labelPosition,"symbol-label-color":t.labelColor,"symbol-label-size":t.labelSize,"symbol-label-font":t.labelFont||void 0,"symbol-halo-color":t.haloColor,"symbol-flat":t.flat||void 0}}function Re(e){let t={...O};if(e){L(t,`color`,P(e[`symbol-color`])),L(t,`haloWidth`,N(e[`symbol-halo-width`],0)),L(t,`rotation`,Se(e[`symbol-rotation`])),L(t,`size`,N(e[`symbol-size`],0)),L(t,`labelPosition`,k(y,e[`symbol-label-position`])),L(t,`labelColor`,P(e[`symbol-label-color`]));let n=N(e[`symbol-label-size`],0);n&&(t.labelSize=n),L(t,`haloColor`,P(e[`symbol-halo-color`])),L(t,`symbol`,we(e[`symbol-pattern`])),L(t,`labelFont`,Ce(e[`symbol-label-font`])),L(t,`flat`,Te(e[`symbol-flat`]))}return R(t,O)}function ze(e){let t=Ce(e?.description);return t?.trim()?{text:t}:void 0}var Be=10**5,Ve=90;function He(e){return Math.round(e*Be)/Be+0}function Ue(e){if(!Array.isArray(e)||e.length!==4||!e.every(e=>typeof e==`number`&&Number.isFinite(e)))return;let[t,n,r,i]=e.map(He);if(t<r&&n<i&&n>=-90&&i<=90&&t>=-180&&r<=180)return[t,n,r,i]}function We(e){let t=A(e);if(t===void 0)return;if(t>-180&&t<=180)return t;let n=(t%360+360)%360;return n>180?n-360:n}function z(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e,n={},r=Ue(t.bounds);r&&(n.bounds=r);let i=We(t.bearing);i&&(n.bearing=i);let a=A(t.pitch,0,60);return a&&(n.pitch=a),Object.keys(n).length>0?n:void 0}var Ge={vector:2,satellite:1},Ke={base:`vector`,theme:`colorful`,streets:!0,borders:!0,labels:`normal`,language:`user`,font:`noto_sans_regular`,labelSize:1,hillshade:!1,terrain:!1,buildings:`flat`},qe={saturation:0,black:0,white:1};function B(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e,n={},r=Ke,i=k(fe,t.base)??r.base;i!==r.base&&(n.base=i);let a=j(t.theme);a&&a!==r.theme&&(n.theme=a),M(t.streets)===!1&&(n.streets=!1),M(t.borders)===!1&&(n.borders=!1);let o=k(me,t.labels);o&&o!==r.labels&&(n.labels=o);let s=j(t.language);s&&s!==r.language&&(n.language=s);let c=j(t.font);c&&c!==r.font&&(n.font=c);let l=A(t.labelSize,0,_.size);l&&l!==r.labelSize&&(n.labelSize=l);let u=A(t.haloWidth,0,_.width);if(u!==void 0&&u!==Ge[i]&&(n.haloWidth=u),M(t.labelsOnTop)&&(n.labelsOnTop=!0),typeof t.colors==`object`&&t.colors!==null){let e=t.colors,r={},i=A(e.saturation,-1,1);i&&(r.saturation=i);let a=A(e.black,-1,1);a&&(r.black=a);let o=A(e.white,0,2);o!==void 0&&o!==qe.white&&(r.white=o),Object.keys(r).length>0&&(n.colors=r)}M(t.hillshade)&&(n.hillshade=!0),M(t.terrain)&&(n.terrain=!0),k(ge,t.buildings)===`extruded`&&(n.buildings=`extruded`);let d=xe(t.options);return d&&(n.options=d),Object.keys(n).length>0?n:void 0}function Je(e,t,n,r){let i=(e,t)=>{let n=F(t,e);return n?{[t===`outline`?`outlineStyle`:`style`]:n}:{}};switch(e){case`marker`:return{type:e,...i(t,`marker`),label:r};case`line`:return{type:e,...i(t,`line`),label:r};case`area`:return{type:e,...i(t,`area`),...i(n,`outline`),label:r}}}var V={layout:`vertical`,font:`sans-serif`,bold:!1,italic:!1,theme:`light`};function Ye(e){let t={...e};for(let e of Object.keys(V))t[e]===V[e]&&delete t[e];return t}function Xe(e){if(typeof e!=`object`||!e)return;let{layout:t,font:n,bold:r,italic:i,theme:a,entries:o}=e;if(!Array.isArray(o))return;let s={entries:[]};oe.includes(t)&&(s.layout=t),ce.includes(n)&&(s.font=n),r===!0&&(s.bold=!0),i===!0&&(s.italic=!0),se.includes(a)&&(s.theme=a);for(let e of o){if(typeof e!=`object`||!e)continue;let t=e,n=j(t.label)?.replace(/\r\n?/g,`
3
3
  `)??``,r=S.find(e=>e===t.type);r&&s.entries.push(Je(r,t.style,t.outlineStyle,n))}return Ye(s)}function Ze(e){if(typeof e!=`number`||!Number.isFinite(e))return;let t=Math.round(e*10)/10;return t>0&&t<=22?t:void 0}function H(e){if(typeof e!=`object`||!e)return;let t=e,n={};t.overlap===`hide`&&(n.overlap=`hide`);let r=Ze(t.minZoom);return r!==void 0&&(n.minZoom=r),Object.keys(n).length>0?n:void 0}var Qe={search:`none`,navigation:`top-right`,zoomButtons:!0,legend:`bottom-left`,scale:`none`,reset:!1,fullscreen:!1,locate:!1,canPan:!0,canZoom:!0,canRotate:!1,canTilt:!1,confine:!1,scrollZoom:`protected`},$e=[`reset`,`fullscreen`,`locate`],et={search:[`none`,...le],navigation:[...ue],legend:[`none`,...ae],scale:[`none`,...de]};function tt(e){if(!e)return;let t={...e};for(let e of Object.keys(Qe))(t[e]===void 0||t[e]===Qe[e])&&delete t[e];return Object.keys(t).length>0?t:void 0}function U(e){if(typeof e!=`object`||!e)return;let t=e,n={};for(let[e,r]of Object.entries(et)){let i=t[e];r.includes(i)&&(n[e]=i)}for(let e of $e)t[e]===!0&&(n[e]=!0);t.zoomButtons===!1&&(n.zoomButtons=!1),t.canPan===!1&&(n.canPan=!1),t.canZoom===!1&&(n.canZoom=!1),M(t.canRotate)&&(n.canRotate=!0),M(t.canTilt)&&(n.canTilt=!0),M(t.confine)&&(n.confine=!0);let r=e=>{let t=A(e,0,22);return t===void 0?void 0:Math.round(t*2)/2},i=r(t.maxZoom),a=r(t.minZoom);return a!==void 0&&(n.minZoom=i===void 0?a:Math.min(a,i)),i!==void 0&&(n.maxZoom=i),t.scrollZoom===`free`&&(n.scrollZoom=`free`),tt(n)}function nt(e){if(!Array.isArray(e)||e.length<2)return;let[t,n]=e;if(typeof t!=`number`||typeof n!=`number`||!Number.isFinite(t)||!Number.isFinite(n))return;let r=(e,t)=>Math.min(t,Math.max(-t,e));return[He(r(t,_.longitude)),He(r(n,Ve))]}function rt(e){if(!Array.isArray(e))return;let t=[];for(let n of e){let e=nt(n);if(!e)return;t.push(e)}return t}function it(e){let t={elements:e.elements.map(st).filter(e=>e!==void 0)},n=z(e.frame);n&&(t.frame=n);let r=at(e.meta);return r&&(t.meta=r),t}function at(e){if(typeof e!=`object`||!e)return;let t=e,n={},r=B(t.background);r&&(n.background=r);let i=Xe(t.legend);i&&(n.legend=i);let a=j(t.colorScheme);a&&(n.colorScheme=a);let o=U(t.viewer);o&&(n.viewer=o);let s=H(t.labels);s&&(n.labels=s);let c=j(t.title);return c?.trim()&&(n.title=c),Object.keys(n).length>0?n:void 0}function ot(e){if(typeof e!=`object`||!e)return;let t=j(e.text)?.replace(/\r\n?/g,`
4
- `);return t?.trim()?{text:t}:void 0}function st(e){if(typeof e!=`object`||!e)return;let t=e,n;switch(t.type){case`marker`:{let e=nt(t.point);if(!e)return;n={type:`marker`,point:e,...Ie(t.label),style:F(`marker`,t.style)};break}case`line`:{let e=rt(t.points);if(!e||e.length<2)return;n={type:`line`,points:e,style:F(`line`,t.style)},M(t.smooth)&&(n.smooth=!0);break}case`polygon`:{let e=rt(t.points);if(!e||e.length<3)return;n={type:`polygon`,points:e,style:F(`area`,t.style),outlineStyle:F(`outline`,t.outlineStyle)},M(t.smooth)&&(n.smooth=!0);break}case`circle`:{let e=nt(t.point),r=A(t.radius,-1/0,_.radius);if(!e||r===void 0||r<=0)return;n={type:`circle`,point:e,radius:r,style:F(`area`,t.style),outlineStyle:F(`outline`,t.outlineStyle)};break}default:return}n.popup=ot(t.popup);for(let e of Object.keys(n))n[e]===void 0&&delete n[e];return n}var ct=[`{"features":{"terrain":{"exaggeration":2},"hillshade":{"exaggeration":0.5,"shadowColor":"#000000","highlightColor":"#ffffff"},"landcover":true},"sky":false,"sun":{"azimuth":315,"altitude":45},"text":{"pitchAlignment":"viewport","spacing":2,"places":{"haloWidth":2},"boundaries":{"haloWidth":2},"streets":{"names":{"haloWidth":2}},"water":{"haloWidth":2},"pois":{"transit":{"haloWidth":2}}},"layers":{"labels":false,"buildings":0.5},"recolor":{"saturate":0,"brightness":0,"contrast":1,"rotateHue":90},"osmOverlay":{"theme":"gray","text":{"spacing":2},"layers":{"roads":false}},"raster":{"saturation":0,"contrast":0,"hueRotate":90,"opacity":1}}`,`noto_sans_regular`,`noto_sans_bold`,`noto_sans_italic`,`noto_sans_bold_italic`,`fira_sans_regular`,`lato_regular`,`libre_baskerville_regular`,`merriweather_sans_regular`,`nunito_regular`,`open_sans_regular`,`pt_sans_regular`,`roboto_regular`,`source_sans_3_regular`,`base:icon-`,`icons:`,`extras:`],W=-1,lt=4,ut=2**16,dt=2**22,G=[0,7,11,16,21],ft=2**32-1,K=2**31,q=2**30,J=e=>2*e-1,pt=class{symbols=[];counts=[];total=0;index=new Map;tree=[0];indexOf(e){return this.index.get(e)??-1}get sum(){return 2*this.total-this.symbols.length}prefix(e){let t=0;for(;e>0;e-=e&-e)t+=this.tree[e];return t}find(e){let t=0,n=1;for(;n*2<this.tree.length;)n*=2;for(;n>0;n>>=1){let r=t+n;r<this.tree.length&&this.tree[r]<=e&&(t=r,e-=this.tree[r])}return t}add(e){let t=this.index.get(e);if(t===void 0){let t=this.symbols.length+1;this.index.set(e,t-1),this.symbols.push(e),this.counts.push(1),this.tree.push(J(1)+this.prefix(t-1)-this.prefix(t-(t&-t)))}else{this.counts[t]++;for(let e=t+1;e<this.tree.length;e+=e&-e)this.tree[e]+=2}if(this.total++,this.total+this.symbols.length>ut){this.total=0;for(let e=0;e<this.counts.length;e++)this.counts[e]=Math.ceil(this.counts[e]/2),this.total+=this.counts[e];this.tree=[0,...this.counts.map(J)];for(let e=1;e<this.tree.length;e++){let t=e+(e&-e);t<this.tree.length&&(this.tree[t]+=this.tree[e])}}}},mt=class{byOrder=Array.from({length:5},()=>new Map);constructor(e=[]){for(let t of e){let e=ht();for(let n of t){let t=n.codePointAt(0);this.update(e,t,0),gt(e,t)}this.update(e,W,0)}}contexts(e){let t=[];for(let n=lt;n>=0;n--){let r=this.byOrder[n].get(_t(e,n));r&&t.push({order:n,context:r})}return t}update(e,t,n){for(let r=n;r<=lt;r++){let n=_t(e,r),i=this.byOrder[r].get(n);i||this.byOrder[r].set(n,i=new pt),i.add(t)}}};function ht(){return Array(lt).fill(W)}function gt(e,t){e.shift(),e.push(t)}function _t(e,t){return e.slice(lt-t).join(`,`)}function vt(e,t){let n=[],r=e.sum;for(let i of t){let t=e.indexOf(i);if(t<0)continue;let a=J(e.counts[t]);n.push([t,a]),r-=a}let i=e.symbols.length-n.length;if(i!==0)return n.sort((e,t)=>e[0]-t[0]),{sum:r,escape:i,left:n}}function yt(e,t,n){if(n!==0)for(let n of t.symbols)e.add(n)}function bt(e){return e===W?0:e<128?1:e<2048?2:e<2**16?3:4}var xt=class{bits=[];low=0;high=ft;pending=0;encode(e,t,n){let r=this.high-this.low+1;for(this.high=this.low+Math.floor(r*t/n)-1,this.low+=Math.floor(r*e/n);;){if(this.high<K)this.output(!1);else if(this.low>=K)this.output(!0),this.low-=K,this.high-=K;else if(this.low>=q&&this.high<3*q)this.pending++,this.low-=q,this.high-=q;else break;this.low=2*this.low,this.high=2*this.high+1}}output(e){for(this.bits.push(e);this.pending>0;this.pending--)this.bits.push(!e)}finish(){return this.pending++,this.output(this.low>=q),this.bits}},St=class{bits;low=0;high=ft;value=0;offset=0;shifts=0;constructor(e){this.bits=e;for(let e=0;e<32;e++)this.value=2*this.value+this.nextBit()}nextBit(){if(this.offset>this.bits.length+64)throw Error(`The strings go beyond their block`);return+!!this.bits[this.offset++]}target(e){let t=this.high-this.low+1;return Math.floor(((this.value-this.low+1)*e-1)/t)}decode(e,t,n){let r=this.high-this.low+1;for(this.high=this.low+Math.floor(r*t/n)-1,this.low+=Math.floor(r*e/n);;){if(!(this.high<K)){if(this.low>=K)this.low-=K,this.high-=K,this.value-=K;else if(this.low>=q&&this.high<3*q)this.low-=q,this.high-=q,this.value-=q;else break}this.low=2*this.low,this.high=2*this.high+1,this.value=2*this.value+this.nextBit(),this.shifts++}}get length(){return this.shifts+2}get shiftCount(){return this.shifts}};function Ct(e,t=0){let n=new mt(t>0?ct:[]),r=new xt,i=0;for(let[a,o]of e.entries()){a===t&&a>0&&(n=new mt);let e=[...o].map(e=>e.codePointAt(0));if(e.push(W),i+=e.length,i>dt)throw Error(`The texts of the map are too long: more than ${dt} characters`);let s=ht();for(let t of e){let e=new Set,i;for(let{order:a,context:o}of n.contexts(s)){let n=vt(o,e);if(!n)continue;let s=n.sum+n.escape,c=o.indexOf(t);if(c>=0&&!e.has(t)){let e=o.prefix(c);for(let[t,r]of n.left)t<c&&(e-=r);r.encode(e,e+J(o.counts[c]),s),i=a;break}r.encode(n.sum,s,s),yt(e,o,a)}if(i===void 0){let e=bt(t);r.encode(e,e+1,G.length);for(let n=G[e]-1;n>=0;n--){let e=Math.floor(t/2**n)%2;r.encode(e,e+1,2)}}n.update(s,t,i??0),gt(s,t)}}return r.finish()}function wt(e,t,n=0){let r=new mt(n>0?ct:[]),i=new St(e),a=[],o=[],s=0,c=0,l=new Set;for(let e=0;e<t;e++){e===n&&e>0&&(r=new mt,l=new Set);let t=[],u=ht();for(;;){if(++c>dt)throw Error(`More than ${dt} symbols in the strings`);let e=new Set,n,a;for(let{order:t,context:o}of r.contexts(u)){let r=vt(o,e);if(!r)continue;let s=r.sum+r.escape,c=i.target(s);if(c<r.sum){let e=0;for(let[t,n]of r.left){if(c<o.prefix(t)-e)break;e+=n}let l=o.find(c+e),u=o.prefix(l)-e;n=o.symbols[l],i.decode(u,u+J(o.counts[l]),s),a=t;break}i.decode(r.sum,s,s),yt(e,o,t)}if(n===void 0){let e=Math.min(i.target(G.length),G.length-1);i.decode(e,e+1,G.length),n=e===0?W:0;for(let t=0;t<G[e];t++){let e=+(i.target(2)>0);i.decode(e,e+1,2),n=2*n+e}if(n>1114111)throw Error(`Invalid code point: ${n}`)}if(r.update(u,n,a??0),n===W)break;t.push(n),gt(u,n)}let d=``;for(let e=0;e<t.length;e+=8192)d+=String.fromCodePoint(...t.slice(e,e+8192));if(l.has(d))throw Error(`A string twice in its section: ${JSON.stringify(d.slice(0,50))}`);l.add(d),a.push(d),o.push(i.shiftCount-s),s=i.shiftCount}return o.length>0&&(o[o.length-1]+=2),{strings:a,length:i.length,bits:o}}var Tt=111320,Et=1e-5,Dt=1e5,Ot=90,kt=180;function At(e){let t=Math.round(Math.log2(e/Pt(0)));return Math.min(15,Math.max(0,t))}function jt([e,t,n,r]){let i=(n-e)*Tt*Math.cos((t+r)/2*Math.PI/180);return Math.max(i,(r-t)*Tt)}function Mt(e){return jt(e)/1e3}function Nt(e){return jt(e)/100}function Pt(e){return Et*2**e*Tt}var Ft=class{factor;origin;constructor(e,t){this.factor=2**t,this.origin=[this.steps(e[0],_.longitude),this.steps(e[1],Ot)]}steps(e,t=1/0){let n=Math.round(e*Dt/this.factor),r=Math.floor(t*Dt/this.factor);return Math.min(r,Math.max(-r,n))}toGrid([e,t],n=!1){return[this.steps(e,n?kt:_.longitude)-this.origin[0],this.steps(t,Ot)-this.origin[1]]}fromGrid([e,t]){return[(e+this.origin[0])*this.factor/Dt,(t+this.origin[1])*this.factor/Dt]}};function Y(e){return Math.max(1,Math.round(e*10))}var It={color:e=>Q(e),symbol:e=>e,labelColor:e=>Q(e),labelFont:e=>e,size:Y,labelSize:Y,labelPosition:e=>e,width:e=>Math.round(e*10),dash:e=>e,arrowStart:e=>e,arrowEnd:e=>e,arrowSize:Y,haloWidth:e=>Math.round(e*10),haloColor:e=>Q(e),rotation:e=>Math.round(e),visible:e=>e!==!1&&void 0,flat:e=>e===!0||void 0,pattern:e=>e,patternScale:e=>Math.round(e*10),patternCoverage:e=>Math.round(e*100)},X=`remove`,Lt={marker:[`color`,`symbol`,`labelFont`,`labelColor`,`labelSize`,`size`,`labelPosition`,`haloWidth`,`haloColor`,X,`rotation`,`flat`],line:[`color`,`width`,`dash`,`arrowStart`,`arrowEnd`,`arrowSize`,X],area:[`color`,`pattern`,`patternScale`,`patternCoverage`,X],outline:[`color`,`width`,`visible`,`dash`,X]};function Z(e){return e===`marker`||e===`line`?e:`area`}function Rt(e){return Lt[e].flatMap((e,t)=>e===`remove`?[]:[{key:t+1,name:e,encoded:It[e]}])}function zt(e){return Lt[e].indexOf(X)+1}function Q(e){let n=t(e);if(!n)throw Error(`Invalid color: ${e}`);let{r,g:i,b:a,alpha:o}=n;return[r,i,a,o*255].map(Math.round).join(`,`)}function Bt(e,t){let n=e[t.name];return n==null?void 0:t.encoded(n)}function Vt(e,t){let n=I(t);return e+JSON.stringify(Rt(e).map(e=>Bt(n,e)))}var Ht=class{styles=new Map;get(e,t){let n=this.styles.get(t)??[];return e>=1?n[n.length-e]?.style:void 0}count(e){return this.styles.get(e)?.length??0}remember(e,t){let n=Vt(e,t),r=this.styles.get(e)??[];r=r.filter(e=>e.key!==n),r.push({style:t,key:n}),r.length>32&&r.shift(),this.styles.set(e,r)}},Ut=class e{bits=[];palette=new Map;strings=[new Map,new Map];nextString=[0,0];styleHistory=new Ht;hasFields=!0;grid;coordinateParameters=[0,0];relativePoints=!1;lastPoint=[0,0];resolution;constructor({resolution:e=1}={}){if(!(e>0)||!Number.isFinite(e))throw Error(`Invalid resolution: ${e}`);this.resolution=e}asBase64(){return c(this.bits)}asBitString(){return this.bits.map(e=>e?`1`:`0`).join(``)}writeBit(e){this.bits.push(e)}writeInteger(e,t){if(e%1!=0)throw Error(`value must be an integer`);if(e<0||e>=2**t)throw Error(`${e} does not fit ${t} bits`);for(let n=t-1;n>=0;n--)this.bits.push((e&1<<n)>0);return e}writeVarint(e,t){if(!Number.isSafeInteger(e))throw Error(`value must be a safe integer: ${e}`);if(t){if(e=e<0?-2*e-1:2*e,!Number.isSafeInteger(e))throw Error(`value too large: ${e}`)}else if(e<0)throw Error(`Unsigned varint cannot be negative`);for(;this.writeInteger(e%32,5),e=Math.floor(e/32),this.writeBit(e>=1),!(e<1););}writeArray(e,t){let n=e.length;this.writeVarint(n);for(let r=0;r<n;r++)t(e[r])}writePoint(e,t=1){(!t||t<1)&&(t=1);let n=Math.round(1e5/t);this.writeVarint(Math.round(e[0]*n),!0),this.writeVarint(Math.round(e[1]*n),!0)}writeRoot(e){let t=it(e);this.writeKey(1,l.version),this.writePalette(en(t)),this.writeStringTable(Jt(t),qt(t)),this.styleHistory=new Ht;let n=z(t.frame&&{...t.frame,bearing:Math.round(t.frame.bearing??0),pitch:Math.round(t.frame.pitch??0)});this.writeGrid(t,n?.bounds),this.writeFrame(n),this.writeMetadata(t.meta),this.hasFields=t.elements.some(e=>!!e.popup?.text),this.writeBit(this.hasFields);let r;t.elements.forEach((e,t)=>{let n=$t(e),i=n===r;switch(r=n,this.writeElementType(e,i,t===0),e.type){case`marker`:this.writeElementMarker(e,i);break;case`line`:this.writeElementLine(e,i);break;case`polygon`:this.writeElementPolygon(e,i);break;case`circle`:this.writeElementCircle(e,i)}}),t.elements.length>0&&this.writeBit(!1),this.writeKey(2,l.element)}writeGrid(e,t){let n=At(this.resolution);this.writeInteger(n,4);let r=(t&&ie(t))??ie(re(e.elements)??[0,0,0,0]),i=[Math.round(r[0]*100),Math.round(r[1]*100)];this.writeVarint(i[0],!0),this.writeVarint(i[1],!0),this.grid=new Ft([i[0]/100,i[1]/100],n);let a=[!1,!0].flatMap(t=>{let n=this.coordinateSteps(e.elements,t),r=Qt(n),i=[0,1].map(e=>n.filter((t,n)=>n%2===e)),a=i.map(Qt);return[{relative:t,perAxis:!1,parameters:[r,r],bits:$(n,r)},{relative:t,perAxis:!0,parameters:a,bits:$(i[0],a[0])+$(i[1],a[1])+5}]}).reduce((e,t)=>t.bits<e.bits?t:e);this.coordinateParameters=a.parameters,this.relativePoints=a.relative,this.lastPoint=[0,0],this.writeBit(a.perAxis),this.writeInteger(this.coordinateParameters[0],5),a.perAxis&&this.writeInteger(this.coordinateParameters[1],5),this.writeBit(this.relativePoints)}writeElementType(e,t,n){n||this.writeBit(t),t||this.writeKey(u[e.type],l.element)}writeElementStyles(e,t){t||(this.writeOptionalStyle(Z(e.type),e.style),(e.type===`polygon`||e.type===`circle`)&&this.writeOptionalStyle(`outline`,e.outlineStyle))}writeOptionalStyle(e,t){this.writeBit(t!==void 0),t&&this.writeStyle(e,t)}writeMarkerLabel(e){this.writeBit(!!e.label),e.label&&this.writeStringRef(e.label)}writeFrame(e){if(!e)return this.writeBit(!1);this.writeBit(!0);let t=e.bounds;if(this.writeBit(!!t),t){let[e,n]=this.elementGrid.toGrid([t[0],t[1]],!0),[r,i]=this.elementGrid.toGrid([t[2],t[3]],!0),[a,o]=this.elementGrid.toGrid([180,90],!0);r===e&&e===a&&e--,i===n&&n===o&&n--,this.writeVarint(e,!0),this.writeVarint(n,!0),this.writeVarint(Math.max(1,r-e)),this.writeVarint(Math.max(1,i-n))}let n=e=>this.writeKey(ee[e],l.frame);e.bearing&&(n(`bearing`),this.writeInteger((e.bearing%360+360)%360,9)),e.pitch&&(n(`pitch`),this.writeInteger(e.pitch,7)),this.writeKey(0,l.frame)}get elementGrid(){if(!this.grid)throw Error(`Element points need the grid of the map`);return this.grid}writeElementPoint(e){let[t,n]=this.elementGrid.toGrid(e),[r,i]=this.relativePoints?this.lastPoint:[0,0];this.writeExpGolomb(t-r,this.coordinateParameters[0],!0),this.writeExpGolomb(n-i,this.coordinateParameters[1],!0),this.lastPoint=[t,n]}writeElementPoints(e){this.writeVarint(e.length),Yt(this.elementGrid,e).forEach((e,t)=>this.writeExpGolomb(e,this.coordinateParameters[t%2],!0))}coordinateSteps(e,t){let n=this.elementGrid,r=[0,0];return e.flatMap(e=>{if(!(`point`in e))return Yt(n,e.points);let[i,a]=n.toGrid(e.point),o=t?[i-r[0],a-r[1]]:[i,a];return r=[i,a],o}).map(Xt)}writeKey(e,t){this.writeExpGolomb(e,t)}writeExpGolomb(e,t,n){if(!Number.isSafeInteger(e))throw Error(`value must be a safe integer: ${e}`);if(n)e=Xt(e);else if(e<0)throw Error(`Unsigned Exp-Golomb code cannot be negative`);let r=e+2**t,i=Zt(r);for(let e=i-t-1;e>0;e--)this.writeBit(!1);for(let e=i-1;e>=0;e--)this.writeBit(Math.floor(r/2**e)%2==1)}writeMetadata(e){if(!(e&&(Gt(e.background)||e.legend||e.colorScheme||U(e.viewer)||H(e.labels)||e.title)))return this.writeBit(!1);this.writeBit(!0);let t=Gt(e.background);t&&(this.writeKey(d.background,l.metadata),this.writeBackground(t)),e.colorScheme&&(this.writeKey(d.colorScheme,l.metadata),this.writeStringRef(e.colorScheme,!0)),e.legend&&(this.writeKey(d.legend,l.metadata),this.writeLegend(e.legend)),e.title&&(this.writeKey(d.title,l.metadata),this.writeStringRef(e.title));let n=H(e.labels);n?.overlap===`hide`&&this.writeKey(d.labelOverlap,l.metadata),n?.minZoom!==void 0&&(this.writeKey(d.labelMinZoom,l.metadata),this.writeVarint(Math.round(n.minZoom*10)));let r=U(e.viewer);r&&(this.writeKey(d.viewer,l.metadata),this.writeViewer(r)),this.writeKey(0,l.metadata)}writeBackground(e){let t=e=>this.writeKey(f[e],l.background),n=(e,t,n,r)=>{let i=e.indexOf(t);this.writeInteger(i>=0&&i<r?i:r,n),(i<0||i>=r)&&this.writeStringRef(t,!0)},{labelSize:r,haloWidth:i,colors:a}=p;if(e.base===`satellite`&&t(`satellite`),e.theme!==void 0&&(t(`theme`),n(pe,e.theme,5,31)),e.streets===!1&&t(`noStreets`),e.borders===!1&&t(`noBorders`),e.labels!==void 0&&(t(`labels`),this.writeVarint(me.indexOf(e.labels))),e.language!==void 0&&(t(`language`),n(he,e.language,4,15)),e.font!==void 0&&(t(`font`),this.writeStringRef(e.font,!0)),e.labelSize!==void 0&&(t(`labelSize`),this.writeVarint(Math.max(1,Math.round(e.labelSize*r)))),e.haloWidth!==void 0&&(t(`haloWidth`),this.writeVarint(Math.round(e.haloWidth*i))),e.labelsOnTop&&t(`labelsOnTop`),e.colors){t(`colors`);let{saturation:n,black:r,white:i}=e.colors;for(let[e,t]of[[n,-1],[r,-1],[i,0]])this.writeBit(e!==void 0),e!==void 0&&this.writeInteger(Math.round((e-t)*a),6)}e.hillshade&&t(`hillshade`),e.terrain&&t(`terrain`),e.buildings===`extruded`&&t(`extruded`),e.options&&(t(`options`),this.writeStringRef(JSON.stringify(e.options),!0)),this.writeKey(0,l.background)}writeElementMarker(e,t=!1){this.writeElementPoint(e.point),this.writeElementStyles(e,t),this.writeMarkerLabel(e),this.writeElementFields(e)}writeElementLine(e,t=!1){this.writeElementPoints(e.points),this.writeBit(e.smooth===!0),this.writeElementStyles(e,t),this.writeElementFields(e)}writeElementPolygon(e,t=!1){this.writeElementPoints(e.points),this.writeBit(e.smooth===!0),this.writeElementStyles(e,t),this.writeElementFields(e)}writeElementCircle(e,t=!1){this.writeElementPoint(e.point),this.writeVarint(Math.max(1,Math.round(e.radius))),this.writeElementStyles(e,t),this.writeElementFields(e)}writeViewer(e){for(let[t,n]of Object.entries(et)){let r=e[t];r!==void 0&&(this.writeKey(g[t],l.viewer),this.writeVarint(n.indexOf(r)))}for(let t of $e)e[t]&&this.writeKey(g[t],l.viewer);let t=e=>this.writeKey(g[e],l.viewer);e.zoomButtons===!1&&t(`noZoomButtons`),e.canPan===!1&&t(`noPan`),e.canZoom===!1&&t(`noZoom`),e.canRotate===!0&&t(`rotate`),e.canTilt===!0&&t(`tilt`),e.confine===!0&&t(`confine`),e.minZoom!==void 0&&(t(`minZoom`),this.writeInteger(Math.round(e.minZoom*2),6)),e.maxZoom!==void 0&&(t(`maxZoom`),this.writeInteger(Math.round(e.maxZoom*2),6)),e.scrollZoom===`free`&&t(`scrollFree`),this.writeKey(0,l.viewer)}writeLegend(e){e.layout&&e.layout!==V.layout&&(this.writeKey(m.layout,l.legend),this.writeVarint(oe.indexOf(e.layout))),e.font&&e.font!==V.font&&(this.writeKey(m.font,l.legend),this.writeVarint(ce.indexOf(e.font))),e.bold&&this.writeKey(m.bold,l.legend),e.italic&&this.writeKey(m.italic,l.legend),e.theme&&e.theme!==V.theme&&(this.writeKey(m.theme,l.legend),this.writeVarint(se.indexOf(e.theme))),this.writeKey(m.entries,l.legend),this.writeArray(e.entries,e=>{let t=S.indexOf(e.type);if(t<0)throw Error(`Invalid legend entry type: ${e.type}`);this.writeKey(h.type,l.legendEntry),this.writeVarint(t),e.style&&(this.writeKey(h.style,l.legendEntry),this.writeStyle(Z(e.type),e.style)),`outlineStyle`in e&&e.outlineStyle&&(this.writeKey(h.outlineStyle,l.legendEntry),this.writeStyle(`outline`,e.outlineStyle)),e.label&&(this.writeKey(h.label,l.legendEntry),this.writeStringRef(e.label)),this.writeKey(0,l.legendEntry)}),this.writeKey(0,l.legend)}writeElementFields(e){this.hasFields&&(e.popup?.text&&(this.writeKey(te.popupText,l.elementFields),this.writeStringRef(e.popup.text)),this.writeKey(0,l.elementFields))}writeStyle(e,t){t=I(t);let n;for(let r=0;r<=this.styleHistory.count(e);r++){let i=this.fork();i.writeStyleReference(r),i.writeStylePatch(e,this.styleHistory.get(r,e)??{},t),(!n||i.bits.length<n.bits.length)&&(n=i)}for(let e of n.bits)this.bits.push(e);this.nextString=[...n.nextString],this.styleHistory.remember(e,t)}writeStyleReference(e){this.writeExpGolomb(e,0)}writeStylePatch(e,t,n){for(let r of Rt(e)){let i=Bt(n,r);i!==Bt(t,r)&&(i===void 0?(this.writeStyleKey(zt(e)),this.writeStyleKey(r.key)):(this.writeStyleKey(r.key),this.writeStyleValue(r.name,n)))}this.writeStyleKey(0)}writeName(e,t){let n=e.indexOf(t);if(n<0)throw Error(`Invalid name: ${t}`);this.writeVarint(n)}writeStyleKey(e){this.writeExpGolomb(e,0)}writeStyleValue(e,t){switch(e){case`haloWidth`:return this.writeVarint(Math.round(t.haloWidth*10));case`pattern`:return this.writeName(b,t.pattern);case`dash`:return this.writeName(x,t.dash);case`rotation`:return this.writeVarint(Math.round(t.rotation),!0);case`size`:return this.writeVarint(Y(t.size));case`labelSize`:return this.writeVarint(Y(t.labelSize));case`width`:return this.writeVarint(Math.round(t.width*10));case`labelPosition`:return this.writeName(y,t.labelPosition);case`arrowStart`:case`arrowEnd`:return this.writeName(v,t[e]);case`arrowSize`:return this.writeVarint(Y(t.arrowSize));case`patternScale`:return this.writeVarint(Math.round(t.patternScale*10));case`patternCoverage`:return this.writeVarint(Math.round(t.patternCoverage*100));case`color`:case`labelColor`:case`haloColor`:return this.writeColorValue(t[e]);case`symbol`:return this.writeStringRef(t.symbol,!0);case`labelFont`:return this.writeStringRef(t.labelFont,!0);case`visible`:return;case`flat`:return}}fork(){let t=new e({resolution:this.resolution});return t.palette=this.palette,t.strings=this.strings,t.nextString=[...this.nextString],t}writePalette(e){this.writeArray(e,e=>this.writePaletteColor(e)),this.palette=new Map(e.map((e,t)=>[Q(e),t]))}writeColorValue(e){let t=this.palette.get(Q(e));if(t===void 0)throw Error(`Color not in the palette: ${e}`);this.writeExpGolomb(t,0)}writeStringTable(e,t=[]){let n=[[...new Set(t)],[...new Set(e)]],r=[...n[0],...n[1]];if(this.writeVarint(r.length),r.length>0){this.writeVarint(n[0].length);let e=Ct(r,n[0].length);for(let t of e)this.bits.push(t)}this.strings=[new Map(n[0].map((e,t)=>[e,t])),new Map(n[1].map((e,t)=>[e,t]))],this.nextString=[0,0]}writeStringRef(e,t=!1){let n=+!t,r=this.strings[n].get(e);if(r===void 0)throw Error(`String not in the table: ${e}`);r===this.nextString[n]?this.writeBit(!0):(this.writeBit(!1),this.writeExpGolomb(r,2)),this.nextString[n]=Math.max(this.nextString[n],r+1)}writePaletteColor(e){let n=t(e);if(!n)throw Error(`Invalid color: ${e}`);let[r,i,a]=[n.r,n.g,n.b].map(Math.round),o=r===i&&i===a&&(r===0||r===255);if(this.writeBit(o),!o)return this.writeColor(e);this.writeBit(r===255),this.writeAlpha(e)}writeColor(e){let n=t(e);if(!n)throw Error(`Invalid color: ${e}`);this.writeInteger(Math.round(n.r),8),this.writeInteger(Math.round(n.g),8),this.writeInteger(Math.round(n.b),8),this.writeAlpha(e)}writeAlpha(e){let n=t(e).alpha;this.writeBit(n!=1),n!=1&&this.writeInteger(Math.round(n*255),8)}};function Wt(e){return[...e.elements,...e.meta?.legend?.entries??[]].flatMap(e=>[...e.style?[e.style]:[],...`outlineStyle`in e&&e.outlineStyle?[e.outlineStyle]:[]])}function Gt(e){let t=B(e);if(!t)return;let n=(e,t)=>e===void 0?void 0:Math.round(Math.round(e*t)/t*1e4)/1e4,{labelSize:r,haloWidth:i,colors:a}=p;return B({...t,labelSize:n(t.labelSize,r),haloWidth:n(t.haloWidth,i),colors:t.colors&&{saturation:n(t.colors.saturation,a),black:n(t.colors.black,a),white:n(t.colors.white,a)}})}function Kt(e){let t=Gt(e?.background);if(!t)return[];let n=(e,t,n)=>{let r=t===void 0?0:e.indexOf(t);return r<0||r>=n?t:void 0};return[n(pe,t.theme,31),n(he,t.language,15),t.font,t.options&&JSON.stringify(t.options)].filter(e=>e!==void 0)}function qt(e){let t=e.meta,n=[...Kt(t),...t?.colorScheme?[t.colorScheme]:[]];for(let r of[...t?.legend?.entries??[],...e.elements]){let e=[r.style,`outlineStyle`in r?r.outlineStyle:void 0];for(let t of e)t?.symbol!=null&&n.push(t.symbol),t?.labelFont!=null&&n.push(t.labelFont)}return n}function Jt(e){let t=[],n=e.meta;for(let e of n?.legend?.entries??[])e.label&&t.push(e.label);n?.title&&t.push(n.title);for(let n of e.elements)n.type===`marker`&&n.label&&t.push(n.label),n.popup?.text&&t.push(n.popup.text);return t}function Yt(e,t){let n=[],r=0,i=0;for(let a of t){let[t,o]=e.toGrid(a);n.push(t-r,o-i),r=t,i=o}return n}function Xt(e){let t=e<0?-2*e-1:2*e;if(!Number.isSafeInteger(t))throw Error(`value too large: ${e}`);return t}function Zt(e){let t=0;for(;e>=1;e=Math.floor(e/2))t++;return t}function $(e,t){let n=0;for(let r of e)n+=2*Zt(r+2**t)-t-1;return n}function Qt(e){let t=0,n=1/0;for(let r=0;r<32;r++){let i=$(e,r);i<n&&(t=r,n=i)}return t}function $t(e){let t=(e,t)=>t?Vt(e,t):`-`,n=`outlineStyle`in e?e.outlineStyle:void 0;return[e.type,t(Z(e.type),e.style),t(`outline`,n)].join(`|`)}function en(e){let t=[];for(let n of Wt(e))for(let e of[n.color,n.labelColor,n.haloColor])e&&t.push(e);let n=new Map;return t.forEach((e,t)=>{let r=Q(e),i=n.get(r);i?i.count++:n.set(r,{color:e,count:1,first:t})}),[...n.values()].sort((e,t)=>t.count-e.count||e.first-t.first).map(e=>e.color)}var tn=class extends Error{version;constructor(e){super(`The link is of version ${e} of the format; this version reads up to 1.`),this.version=e,this.name=`LinkVersionError`}},nn=class e{bits;offset=0;palette=[];strings=[[],[]];nextString=[0,0];styleHistory=new Ht;hasFields=!0;grid;coordinateParameters=[0,0];relativePoints=!1;lastPoint=[0,0];constructor(e){this.bits=e}static fromBase64(t){let n=[];for(let e=0;e<t.length;e++){let r=s[t.charCodeAt(e)];if(!r)throw Error(`Invalid character in base64 string: ${t[e]}`);n.push(...r)}return new e(n)}static fromBitString(t){return new e(t.split(``).map(e=>e===`1`))}ended(){return this.offset>=this.bits.length}readBit(){if(this.ended())throw Error(`End of bits`);return this.bits[this.offset++]}readInteger(e){try{let t=0;for(let n=0;n<e;n++)t<<=1,this.readBit()&&(t+=1);return t}catch(e){throw Error(`Error reading integer`,{cause:e})}}readVarint(e){try{let t=0,n=1,r;do{if(n>2**53-1)throw Error(`Varint too long`);r=this.readInteger(5),t+=r*n,n*=32}while(this.readBit());if(r===0&&n>32)throw Error(`Varint with a needless group`);if(!Number.isSafeInteger(t))throw Error(`Varint beyond the safe integers`);return e?t%2==1?-(t+1)/2:t/2:t}catch(e){throw Error(`Error reading readVarint`,{cause:e})}}readExpGolomb(e,t){try{let n=0;for(;!this.readBit();)n++;if(n+e>52)throw Error(`Exp-Golomb code too long`);let r=1;for(let t=0;t<n+e;t++)r=2*r+ +!!this.readBit();let i=r-2**e;return t?i%2==1?-(i+1)/2:i/2:i}catch(e){throw Error(`Error reading Exp-Golomb code`,{cause:e})}}readArray(e){try{let t=this.readVarint(),n=[];for(let r=0;r<t;r++)n.push(e());return n}catch(e){throw Error(`Error reading array`,{cause:e})}}readPoint(e=1){(!e||e<1)&&(e=1);try{let t=Math.round(1e5/e);return[this.readVarint(!0)/t,this.readVarint(!0)/t]}catch(e){throw Error(`Error reading point`,{cause:e})}}get elementGrid(){if(!this.grid)throw Error(`Element points need the grid of the map`);return this.grid}readElementPoint(){let[e,t]=this.relativePoints?this.lastPoint:[0,0],n=e+this.readExpGolomb(this.coordinateParameters[0],!0),r=t+this.readExpGolomb(this.coordinateParameters[1],!0);return this.lastPoint=[n,r],rn(this.elementGrid.fromGrid([n,r]))}readElementPoints(){let e=this.elementGrid,t=this.readVarint(),n=[],r=0,i=0;for(let a=0;a<t;a++)r+=this.readExpGolomb(this.coordinateParameters[0],!0),i+=this.readExpGolomb(this.coordinateParameters[1],!0),n.push(rn(e.fromGrid([r,i])));return n}readRoot(){try{let e={elements:[]};this.readVersion(),this.readPalette(),this.readStringTable(),this.styleHistory=new Ht,this.readGrid();let t=this.readFrame();t&&(e.frame=t),e.meta=this.readMetadata(),e.meta||delete e.meta,this.hasFields=this.readBit();let n;for(;;){let{key:t,repeat:r}=this.readElementType(n),i=r?n:void 0;switch(t){case 2:return this.readEnd(),it(e);case u.marker:n=this.readElementMarker(i);break;case u.line:n=this.readElementLine(i);break;case u.polygon:n=this.readElementPolygon(i);break;case u.circle:n=this.readElementCircle(i);break;default:throw Error(`Unknown element key: ${t}`)}e.elements.push(n)}}catch(e){throw e instanceof tn?e:Error(`Error reading root`,{cause:e})}}readVersion(){let e=this.readKey(l.version);if(e>1)throw new tn(e);if(e!==1)throw Error(`Unsupported version: ${e}`)}readGrid(){let e=this.readInteger(4),t=[this.readVarint(!0)/100,this.readVarint(!0)/100];if(Math.abs(t[1])>90)throw Error(`Invalid latitude of the origin: ${t[1]}`);if(Math.abs(t[0])>_.longitude)throw Error(`Invalid longitude of the origin: ${t[0]}`);this.grid=new Ft(t,e);let n=this.readBit(),r=this.readInteger(5);this.coordinateParameters=[r,n?this.readInteger(5):r],this.relativePoints=this.readBit(),this.lastPoint=[0,0]}readElementType(e){let t=e?this.readBit():!1;return{key:t?u[e.type]:this.readKey(l.element),repeat:t}}readEnd(){let e=this.bits.slice(this.offset);if(e.length>=6||e.some(e=>e))throw Error(`Data after the end of the map`)}keysOnce(e){let t=new Set;return n=>{if(t.has(n))throw Error(`The key ${n} twice in ${e}`);return t.add(n),n}}readKey(e){return this.readExpGolomb(e)}readFrame(){try{if(!this.readBit())return;let e={};if(this.readBit()){let t=this.readVarint(!0),n=this.readVarint(!0),r=this.readVarint(),i=this.readVarint();if(r<1||i<1)throw Error(`Invalid size of the frame`);let[a,o]=this.elementGrid.fromGrid([t,n]),[s,c]=this.elementGrid.fromGrid([t+r,n+i]),l=Ue([a,o,s,c]);if(!l)throw Error(`Frame beyond the map`);e.bounds=l}let t=this.keysOnce(`the frame`);for(;;){let n=t(this.readKey(l.frame));if(n===0)break;switch(n){case ee.bearing:if(e.bearing=this.readInteger(9),e.bearing>=360)throw Error(`Invalid rotation of the frame: ${e.bearing}`);break;case ee.pitch:if(e.pitch=this.readInteger(7),e.pitch>60)throw Error(`Invalid tilt of the frame: ${e.pitch}`);break;default:throw Error(`Unknown key of the frame: ${n}`)}}if(Object.keys(e).length===0)throw Error(`A frame without anything`);return z(e)}catch(e){throw Error(`Error reading frame`,{cause:e})}}readBackground(){try{let e={},t=(e,t,n)=>{let r=this.readInteger(t);if(r===n)return this.readStringRef(!0);if(r>=e.length)throw Error(`Invalid index: ${r} of ${e.length}`);return e[r]},{labelSize:n,haloWidth:r,colors:i}=p,a=(e,t)=>Math.round(e/t*1e4)/1e4,o=this.keysOnce(`the background`);for(;;){let s=o(this.readKey(l.background));switch(s){case 0:{let t=B(e);if(!t)throw Error(`A background without settings`);return t}case f.satellite:e.base=`satellite`;break;case f.theme:e.theme=t(pe,5,31);break;case f.noStreets:e.streets=!1;break;case f.noBorders:e.borders=!1;break;case f.labels:{let t=me[this.readVarint()];if(!t)throw Error(`Invalid labels of the background`);e.labels=t;break}case f.language:e.language=t(he,4,15);break;case f.font:e.font=this.readStringRef(!0);break;case f.labelSize:if(e.labelSize=a(this.readVarint(),n),e.labelSize>_.size)throw Error(`A size of the labels beyond the largest one`);break;case f.haloWidth:if(e.haloWidth=a(this.readVarint(),r),e.haloWidth>_.width)throw Error(`A halo beyond the largest width`);break;case f.labelsOnTop:e.labelsOnTop=!0;break;case f.colors:{let t=(e,t)=>{if(!this.readBit())return;let n=a(this.readInteger(6)+e*i,i);if(n>t)throw Error(`Invalid change of the colors: ${n}`);return n},[n,r,o]=[t(-1,1),t(-1,1),t(0,2)];if(n===void 0&&r===void 0&&o===void 0)throw Error(`Colors of the background without a change`);e.colors={...n===void 0?{}:{saturation:n},...r===void 0?{}:{black:r},...o===void 0?{}:{white:o}};break}case f.hillshade:e.hillshade=!0;break;case f.terrain:e.terrain=!0;break;case f.extruded:e.buildings=`extruded`;break;case f.options:{let t=JSON.parse(this.readStringRef(!0));if(typeof t!=`object`||!t||Array.isArray(t))throw Error(`Invalid options of the background`);e.options=t;break}default:throw Error(`Invalid background key: ${s}`)}}}catch(e){throw Error(`Error reading background`,{cause:e})}}readMetadata(){try{if(!this.readBit())return;let e={},t=this.keysOnce(`the metadata`);for(;;){let n=t(this.readKey(l.metadata));switch(n){case 0:if(Object.keys(e).length===0)throw Error(`Metadata without anything`);return e;case d.background:e.background=this.readBackground();break;case d.legend:e.legend=this.readLegend();break;case d.colorScheme:e.colorScheme=this.readStringRef(!0);break;case d.title:e.title=this.readText(`title`);break;case d.viewer:e.viewer=this.readViewer();break;case d.labelOverlap:e.labels={...e.labels,overlap:`hide`};break;case d.labelMinZoom:{let t=Ze(this.readVarint()/10);if(t===void 0)throw Error(`Invalid zoom level of labels`);e.labels={...e.labels,minZoom:t};break}default:throw Error(`Invalid state key: ${n}`)}}}catch(e){throw Error(`Error reading metadata`,{cause:e})}}readElementMarker(e){try{let t={type:`marker`,point:this.readElementPoint()};return this.readElementStyles(t,e),this.readBit()&&(t.label=this.readText(`label`)),this.readElementFields(t),t}catch(e){throw Error(`Error reading marker element`,{cause:e})}}readElementLine(e){try{let t={type:`line`,points:this.readElementPoints()};if(t.points.length<2)throw Error(`A line of fewer than 2 points`);return this.readBit()&&(t.smooth=!0),this.readElementStyles(t,e),this.readElementFields(t),t}catch(e){throw Error(`Error reading line element`,{cause:e})}}readElementPolygon(e){try{let t={type:`polygon`,points:this.readElementPoints()};if(t.points.length<3)throw Error(`An area of fewer than 3 points`);return this.readBit()&&(t.smooth=!0),this.readElementStyles(t,e),this.readElementFields(t),t}catch(e){throw Error(`Error reading polygon element`,{cause:e})}}readElementCircle(e){try{let t=this.readElementPoint(),n=this.readVarint();if(n<1)throw Error(`A circle without a radius`);if(n>_.radius)throw Error(`A radius beyond the largest one: ${n}`);let r={type:`circle`,point:t,radius:n};return this.readElementStyles(r,e),this.readElementFields(r),r}catch(e){throw Error(`Error reading circle element`,{cause:e})}}readElementStyles(e,t){let n=e.type===`polygon`||e.type===`circle`;t?(t.style&&(e.style={...t.style}),n&&`outlineStyle`in t&&t.outlineStyle&&(e.outlineStyle={...t.outlineStyle})):(this.readBit()&&(e.style={...this.readStyle(Z(e.type))}),n&&this.readBit()&&(e.outlineStyle={...this.readStyle(`outline`)}))}readLegend(){try{let e={entries:[]},t=this.keysOnce(`the legend`),n=!1;for(;;){let r=t(this.readKey(l.legend));switch(r){case 0:if(!n)throw Error(`A legend without its entries`);return e;case m.layout:if(e.layout=oe[this.readVarint()],!e.layout)throw Error(`Invalid legend layout`);break;case m.entries:e.entries=this.readArray(()=>this.readLegendEntry()),n=!0;break;case m.font:if(e.font=ce[this.readVarint()],!e.font)throw Error(`Invalid legend font`);break;case m.bold:e.bold=!0;break;case m.italic:e.italic=!0;break;case m.theme:if(e.theme=se[this.readVarint()],!e.theme)throw Error(`Invalid legend theme`);break;default:throw Error(`Invalid legend key: ${r}`)}}}catch(e){throw Error(`Error reading legend`,{cause:e})}}readViewer(){try{let e={},t=Object.keys(et),n=this.keysOnce(`the viewer`);for(;;){let r=n(this.readKey(l.viewer));if(r===0){if(Object.keys(e).length===0)throw Error(`A viewer without settings`);let{minZoom:t,maxZoom:n}=e;if(t!==void 0&&n!==void 0&&t>n)throw Error(`A least zoom above the largest one`);return U(e)??{}}let i=$e.find(e=>g[e]===r);if(i){e[i]=!0;continue}switch(r){case g.noZoomButtons:e.zoomButtons=!1;continue;case g.noPan:e.canPan=!1;continue;case g.noZoom:e.canZoom=!1;continue;case g.rotate:e.canRotate=!0;continue;case g.tilt:e.canTilt=!0;continue;case g.confine:e.confine=!0;continue;case g.minZoom:e.minZoom=this.readZoomLimit();continue;case g.maxZoom:e.maxZoom=this.readZoomLimit();continue;case g.scrollFree:e.scrollZoom=`free`;continue}let a=t.find(e=>g[e]===r);if(!a)throw Error(`Invalid viewer key: ${r}`);let o=et[a][this.readVarint()];if(!o)throw Error(`Invalid viewer ${a}`);e[a]=o}}catch(e){throw Error(`Error reading viewer`,{cause:e})}}readLegendEntry(){let e,t,n,r=``,i=this.keysOnce(`a legend entry`);for(;;){let a=i(this.readKey(l.legendEntry));switch(a){case 0:if(!e)throw Error(`Legend entry without type`);return{type:e,...t&&{style:t},...n&&{outlineStyle:n},label:r};case h.label:r=this.readStringRef();break;case h.type:if(e=S[this.readVarint()],!e)throw Error(`Invalid legend entry type`);break;case h.style:if(!e)throw Error(`A style of a legend entry before its type`);t=this.readStyle(Z(e));break;case h.outlineStyle:if(e!==`area`)throw Error(`An outline of a legend entry that is no area`);n=this.readStyle(`outline`);break;default:throw Error(`Invalid legend entry key: ${a}`)}}}readElementFields(e){if(this.hasFields)try{let t=this.keysOnce(`the fields of an element`);for(;;){let n=t(this.readKey(l.elementFields));switch(n){case 0:return;case te.popupText:e.popup={text:this.readText(`popup`)};break;default:throw Error(`Unknown field of an element: ${n}`)}}}catch(e){throw Error(`Error reading the fields of an element`,{cause:e})}}readText(e){let t=this.readStringRef();if(t.trim()===``)throw Error(`An empty ${e}`);return t}readZoomLimit(){let e=this.readInteger(6)/2;if(e>22)throw Error(`Invalid zoom level: ${e}`);return e}readWidth(){let e=this.readVarint()/10;if(e>_.width)throw Error(`A width beyond the largest one: ${e}`);return e}readSize(){let e=this.readVarint();if(e<1)throw Error(`A size of 0`);if(e>_.size*10)throw Error(`A size beyond the largest one: ${e/10}`);return e/10}readStyle(e){try{let t=this.readExpGolomb(0);if(t>this.styleHistory.count(e))throw Error(`Invalid style reference: ${t}`);let n=this.readStylePatch(e,{...this.styleHistory.get(t,e)});if(t===0&&Object.keys(n).length===0)throw Error(`A style without fields`);if(n.arrowSize!==void 0&&!Ee(n))throw Error(`Arrow size without an arrowhead`);if((n.patternScale!==void 0||n.patternCoverage!==void 0)&&!De(n))throw Error(`Pattern size or coverage without a pattern`);return this.styleHistory.remember(e,n),n}catch(e){throw Error(`Error reading style`,{cause:e})}}readIndex(e){let t=this.readVarint();if(t>=e)throw Error(`Invalid index: ${t} of ${e}`);return t}readName(e){return e[this.readIndex(e.length)]}readStylePatch(e,t){let n=Rt(e),r=zt(e),i=this.keysOnce(`a style`);for(;;){let e=this.readStyleKey();if(e===0)return t;if(e===r){let e=i(this.readStyleKey()),r=n.find(t=>t.key===e);if(!r)throw Error(`Invalid state key: ${e}`);if(!(r.name in t))throw Error(`A field removed that the style has not: ${r.name}`);delete t[r.name];continue}i(e);let a=n.find(t=>t.key===e);if(!a)throw Error(`Invalid state key: ${e}`);switch(a.name){case`haloWidth`:t.haloWidth=this.readWidth();break;case`pattern`:t.pattern=this.readName(b);break;case`dash`:t.dash=this.readName(x);break;case`rotation`:if(t.rotation=this.readVarint(!0),t.rotation<=-180||t.rotation>180)throw Error(`Invalid rotation: ${t.rotation}`);break;case`size`:t.size=this.readSize();break;case`width`:t.width=this.readWidth();break;case`labelPosition`:t.labelPosition=this.readName(y);break;case`arrowStart`:case`arrowEnd`:t[a.name]=this.readName(v);break;case`arrowSize`:t.arrowSize=this.readSize();break;case`patternScale`:if(t.patternScale=this.readVarint()/10,t.patternScale<w[0]||t.patternScale>w[1])throw Error(`Invalid pattern scale: ${t.patternScale}`);break;case`patternCoverage`:if(t.patternCoverage=this.readVarint()/100,t.patternCoverage<T[0]||t.patternCoverage>T[1])throw Error(`Invalid pattern coverage: ${t.patternCoverage}`);break;case`color`:case`labelColor`:case`haloColor`:t[a.name]=this.readColorValue();break;case`visible`:t.visible=!1;break;case`flat`:t.flat=!0;break;case`symbol`:if(t.symbol=this.readStringRef(!0),t.symbol!==``&&!t.symbol.includes(`:`))throw Error(`Invalid symbol: ${t.symbol}`);break;case`labelSize`:t.labelSize=this.readSize();break;case`labelFont`:t.labelFont=this.readStringRef(!0)}}}readStyleKey(){return this.readExpGolomb(0)}readPalette(){this.palette=this.readArray(()=>this.readPaletteColor())}readPaletteColor(){if(!this.readBit())return this.readColor();let e=this.readBit()?255:0;return a({r:e,g:e,b:e,alpha:this.readAlpha()})}readStringTable(){try{let e=this.readVarint(),t=[],n=0;if(e>0){if(n=this.readVarint(),n>e)throw Error(`Invalid number of words of the format: ${n}`);let r=wt(this.bits.slice(this.offset),e,n);t=r.strings,this.readBlock(r.length)}return this.strings=[t.slice(0,n),t.slice(n)],this.nextString=[0,0],t}catch(e){throw Error(`Error reading string table`,{cause:e})}}readBlock(e){if(this.offset+e>this.bits.length)throw Error(`Block beyond the end of bits`);let t=this.bits.slice(this.offset,this.offset+e);return this.offset+=e,t}readStringRef(e=!1){let t=+!e,n=this.readBit()?this.nextString[t]:this.readExpGolomb(2),r=this.strings[t][n];if(r===void 0)throw Error(`Invalid string index: ${n}`);return this.nextString[t]=Math.max(this.nextString[t],n+1),r}readColorValue(){let e=this.readExpGolomb(0),t=this.palette[e];if(t===void 0)throw Error(`Invalid palette index: ${e}`);return t}readAlpha(){return this.readBit()?this.readInteger(8)/255:1}readColor(){try{return a({r:this.readInteger(8),g:this.readInteger(8),b:this.readInteger(8),alpha:this.readAlpha()})}catch(e){throw Error(`Error reading color`,{cause:e})}}};function rn(e){if(!(Math.abs(e[1])<=90))throw Error(`Invalid latitude: ${e[1]}`);if(!(Math.abs(e[0])<=_.longitude))throw Error(`Invalid longitude: ${e[0]}`);return e}function an(e,t={}){let n=new Ut(t);return n.writeRoot(e),n.asBase64()}function on(e){return nn.fromBase64(e).readRoot()}export{y as $,He as A,nt as B,Ee as C,Me as D,Fe as E,z as F,U as G,it as H,H as I,_e as J,Le as K,Xe as L,Te as M,Ue as N,Ne as O,st as P,b as Q,at as R,ke as S,Pe as T,Ce as U,rt as V,F as W,he as X,v as Y,x as Z,T as _,Nt as a,Qe as b,Pt as c,Ke as d,S as et,Ge as f,D as g,O as h,nn as i,t as it,B as j,ze as k,C as l,E as m,an as n,re as nt,At as o,V as p,Re as q,tn as r,a as rt,Mt as s,on as t,_ as tt,qe as u,w as v,Ie as w,Oe as x,ve as y,N as z};
4
+ `);return t?.trim()?{text:t}:void 0}function st(e){if(typeof e!=`object`||!e)return;let t=e,n;switch(t.type){case`marker`:{let e=nt(t.point);if(!e)return;n={type:`marker`,point:e,...Ie(t.label),style:F(`marker`,t.style)};break}case`line`:{let e=rt(t.points);if(!e||e.length<2)return;n={type:`line`,points:e,style:F(`line`,t.style)},M(t.smooth)&&(n.smooth=!0);break}case`polygon`:{let e=rt(t.points);if(!e||e.length<3)return;n={type:`polygon`,points:e,style:F(`area`,t.style),outlineStyle:F(`outline`,t.outlineStyle)},M(t.smooth)&&(n.smooth=!0);break}case`circle`:{let e=nt(t.point),r=A(t.radius,-1/0,_.radius);if(!e||r===void 0||r<=0)return;n={type:`circle`,point:e,radius:r,style:F(`area`,t.style),outlineStyle:F(`outline`,t.outlineStyle)};break}default:return}n.popup=ot(t.popup);for(let e of Object.keys(n))n[e]===void 0&&delete n[e];return n}var ct=[`{"features":{"terrain":{"exaggeration":2},"hillshade":{"exaggeration":0.5,"shadowColor":"#000000","highlightColor":"#ffffff"},"landcover":true},"sky":false,"sun":{"azimuth":315,"altitude":45},"text":{"pitchAlignment":"viewport","spacing":2,"places":{"haloWidth":2},"boundaries":{"haloWidth":2},"streets":{"names":{"haloWidth":2}},"water":{"haloWidth":2},"pois":{"transit":{"haloWidth":2}}},"layers":{"labels":false,"buildings":0.5},"recolor":{"saturate":0,"brightness":0,"contrast":1,"rotateHue":90},"osmOverlay":{"theme":"gray","text":{"spacing":2},"layers":{"roads":false}},"raster":{"saturation":0,"contrast":0,"hueRotate":90,"opacity":1}}`,`noto_sans_regular`,`noto_sans_bold`,`noto_sans_italic`,`noto_sans_bold_italic`,`fira_sans_regular`,`lato_regular`,`libre_baskerville_regular`,`merriweather_sans_regular`,`nunito_regular`,`open_sans_regular`,`pt_sans_regular`,`roboto_regular`,`source_sans_3_regular`,`base:icon-`,`icons:`,`extras:`],W=-1,lt=4,ut=2**16,dt=2**22,G=[0,7,11,16,21],ft=2**32-1,K=2**31,q=2**30,J=e=>2*e-1,pt=class{symbols=[];counts=[];total=0;index=new Map;tree=[0];indexOf(e){return this.index.get(e)??-1}get sum(){return 2*this.total-this.symbols.length}prefix(e){let t=0;for(;e>0;e-=e&-e)t+=this.tree[e];return t}find(e){let t=0,n=1;for(;n*2<this.tree.length;)n*=2;for(;n>0;n>>=1){let r=t+n;r<this.tree.length&&this.tree[r]<=e&&(t=r,e-=this.tree[r])}return t}add(e){let t=this.index.get(e);if(t===void 0){let t=this.symbols.length+1;this.index.set(e,t-1),this.symbols.push(e),this.counts.push(1),this.tree.push(J(1)+this.prefix(t-1)-this.prefix(t-(t&-t)))}else{this.counts[t]++;for(let e=t+1;e<this.tree.length;e+=e&-e)this.tree[e]+=2}if(this.total++,this.total+this.symbols.length>ut){this.total=0;for(let e=0;e<this.counts.length;e++)this.counts[e]=Math.ceil(this.counts[e]/2),this.total+=this.counts[e];this.tree=[0,...this.counts.map(J)];for(let e=1;e<this.tree.length;e++){let t=e+(e&-e);t<this.tree.length&&(this.tree[t]+=this.tree[e])}}}},mt=class{byOrder=Array.from({length:5},()=>new Map);constructor(e=[]){for(let t of e){let e=ht();for(let n of t){let t=n.codePointAt(0);this.update(e,t,0),gt(e,t)}this.update(e,W,0)}}contexts(e){let t=[];for(let n=lt;n>=0;n--){let r=this.byOrder[n].get(_t(e,n));r&&t.push({order:n,context:r})}return t}update(e,t,n){for(let r=n;r<=lt;r++){let n=_t(e,r),i=this.byOrder[r].get(n);i||this.byOrder[r].set(n,i=new pt),i.add(t)}}};function ht(){return Array(lt).fill(W)}function gt(e,t){e.shift(),e.push(t)}function _t(e,t){return e.slice(lt-t).join(`,`)}function vt(e,t){let n=[],r=e.sum;for(let i of t){let t=e.indexOf(i);if(t<0)continue;let a=J(e.counts[t]);n.push([t,a]),r-=a}let i=e.symbols.length-n.length;if(i!==0)return n.sort((e,t)=>e[0]-t[0]),{sum:r,escape:i,left:n}}function yt(e,t,n){if(n!==0)for(let n of t.symbols)e.add(n)}function bt(e){return e===W?0:e<128?1:e<2048?2:e<2**16?3:4}var xt=class{bits=[];low=0;high=ft;pending=0;encode(e,t,n){let r=this.high-this.low+1;for(this.high=this.low+Math.floor(r*t/n)-1,this.low+=Math.floor(r*e/n);;){if(this.high<K)this.output(!1);else if(this.low>=K)this.output(!0),this.low-=K,this.high-=K;else if(this.low>=q&&this.high<3*q)this.pending++,this.low-=q,this.high-=q;else break;this.low=2*this.low,this.high=2*this.high+1}}output(e){for(this.bits.push(e);this.pending>0;this.pending--)this.bits.push(!e)}finish(){return this.pending++,this.output(this.low>=q),this.bits}},St=class{bits;low=0;high=ft;value=0;offset=0;shifts=0;constructor(e){this.bits=e;for(let e=0;e<32;e++)this.value=2*this.value+this.nextBit()}nextBit(){if(this.offset>this.bits.length+64)throw Error(`The strings go beyond their block`);return+!!this.bits[this.offset++]}target(e){let t=this.high-this.low+1;return Math.floor(((this.value-this.low+1)*e-1)/t)}decode(e,t,n){let r=this.high-this.low+1;for(this.high=this.low+Math.floor(r*t/n)-1,this.low+=Math.floor(r*e/n);;){if(!(this.high<K)){if(this.low>=K)this.low-=K,this.high-=K,this.value-=K;else if(this.low>=q&&this.high<3*q)this.low-=q,this.high-=q,this.value-=q;else break}this.low=2*this.low,this.high=2*this.high+1,this.value=2*this.value+this.nextBit(),this.shifts++}}get length(){return this.shifts+2}get shiftCount(){return this.shifts}};function Ct(e,t=0){let n=new mt(t>0?ct:[]),r=new xt,i=0;for(let[a,o]of e.entries()){a===t&&a>0&&(n=new mt);let e=[...o].map(e=>e.codePointAt(0));if(e.push(W),i+=e.length,i>dt)throw Error(`The texts of the map are too long: more than ${dt} characters`);let s=ht();for(let t of e){let e=new Set,i;for(let{order:a,context:o}of n.contexts(s)){let n=vt(o,e);if(!n)continue;let s=n.sum+n.escape,c=o.indexOf(t);if(c>=0&&!e.has(t)){let e=o.prefix(c);for(let[t,r]of n.left)t<c&&(e-=r);r.encode(e,e+J(o.counts[c]),s),i=a;break}r.encode(n.sum,s,s),yt(e,o,a)}if(i===void 0){let e=bt(t);r.encode(e,e+1,G.length);for(let n=G[e]-1;n>=0;n--){let e=Math.floor(t/2**n)%2;r.encode(e,e+1,2)}}n.update(s,t,i??0),gt(s,t)}}return r.finish()}function wt(e,t,n=0){let r=new mt(n>0?ct:[]),i=new St(e),a=[],o=[],s=0,c=0,l=new Set;for(let e=0;e<t;e++){e===n&&e>0&&(r=new mt,l=new Set);let t=[],u=ht();for(;;){if(++c>dt)throw Error(`More than ${dt} symbols in the strings`);let e=new Set,n,a;for(let{order:t,context:o}of r.contexts(u)){let r=vt(o,e);if(!r)continue;let s=r.sum+r.escape,c=i.target(s);if(c<r.sum){let e=0;for(let[t,n]of r.left){if(c<o.prefix(t)-e)break;e+=n}let l=o.find(c+e),u=o.prefix(l)-e;n=o.symbols[l],i.decode(u,u+J(o.counts[l]),s),a=t;break}i.decode(r.sum,s,s),yt(e,o,t)}if(n===void 0){let e=Math.min(i.target(G.length),G.length-1);i.decode(e,e+1,G.length),n=e===0?W:0;for(let t=0;t<G[e];t++){let e=+(i.target(2)>0);i.decode(e,e+1,2),n=2*n+e}if(n>1114111)throw Error(`Invalid code point: ${n}`)}if(r.update(u,n,a??0),n===W)break;t.push(n),gt(u,n)}let d=``;for(let e=0;e<t.length;e+=8192)d+=String.fromCodePoint(...t.slice(e,e+8192));if(l.has(d))throw Error(`A string twice in its section: ${JSON.stringify(d.slice(0,50))}`);l.add(d),a.push(d),o.push(i.shiftCount-s),s=i.shiftCount}return o.length>0&&(o[o.length-1]+=2),{strings:a,length:i.length,bits:o}}var Tt=111320,Et=1e-5,Dt=1e5,Ot=90,kt=180;function At(e){let t=Math.round(Math.log2(e/Pt(0)));return Math.min(15,Math.max(0,t))}function jt([e,t,n,r]){let i=(n-e)*Tt*Math.cos((t+r)/2*Math.PI/180);return Math.max(i,(r-t)*Tt)}function Mt(e){return jt(e)/1e3}function Nt(e){return jt(e)/100}function Pt(e){return Et*2**e*Tt}var Ft=class{factor;origin;constructor(e,t){this.factor=2**t,this.origin=[this.steps(e[0],_.longitude),this.steps(e[1],Ot)]}steps(e,t=1/0){let n=Math.round(e*Dt/this.factor),r=Math.floor(t*Dt/this.factor);return Math.min(r,Math.max(-r,n))}toGrid([e,t],n=!1){return[this.steps(e,n?kt:_.longitude)-this.origin[0],this.steps(t,Ot)-this.origin[1]]}fromGrid([e,t]){return[(e+this.origin[0])*this.factor/Dt,(t+this.origin[1])*this.factor/Dt]}};function Y(e){return Math.max(1,Math.round(e*10))}var It={color:e=>Q(e),symbol:e=>e,labelColor:e=>Q(e),labelFont:e=>e,size:Y,labelSize:Y,labelPosition:e=>e,width:e=>Math.round(e*10),dash:e=>e,arrowStart:e=>e,arrowEnd:e=>e,arrowSize:Y,haloWidth:e=>Math.round(e*10),haloColor:e=>Q(e),rotation:e=>Math.round(e),visible:e=>e!==!1&&void 0,flat:e=>e===!0||void 0,pattern:e=>e,patternScale:e=>Math.round(e*10),patternCoverage:e=>Math.round(e*100)},X=`remove`,Lt={marker:[`color`,`symbol`,`labelFont`,`labelColor`,`labelSize`,`size`,`labelPosition`,`haloWidth`,`haloColor`,X,`rotation`,`flat`],line:[`color`,`width`,`dash`,`arrowStart`,`arrowEnd`,`arrowSize`,X],area:[`color`,`pattern`,`patternScale`,`patternCoverage`,X],outline:[`color`,`width`,`visible`,`dash`,X]};function Z(e){return e===`marker`||e===`line`?e:`area`}function Rt(e){return Lt[e].flatMap((e,t)=>e===`remove`?[]:[{key:t+1,name:e,encoded:It[e]}])}function zt(e){return Lt[e].indexOf(X)+1}function Q(e){let n=t(e);if(!n)throw Error(`Invalid color: ${e}`);let{r,g:i,b:a,alpha:o}=n;return[r,i,a,o*255].map(Math.round).join(`,`)}function Bt(e,t){let n=e[t.name];return n==null?void 0:t.encoded(n)}function Vt(e,t){let n=I(t);return e+JSON.stringify(Rt(e).map(e=>Bt(n,e)))}var Ht=class{styles=new Map;get(e,t){let n=this.styles.get(t)??[];return e>=1?n[n.length-e]?.style:void 0}count(e){return this.styles.get(e)?.length??0}remember(e,t){let n=Vt(e,t),r=this.styles.get(e)??[];r=r.filter(e=>e.key!==n),r.push({style:t,key:n}),r.length>32&&r.shift(),this.styles.set(e,r)}},Ut=class e{bits=[];palette=new Map;strings=[new Map,new Map];nextString=[0,0];styleHistory=new Ht;hasFields=!0;grid;coordinateParameters=[0,0];relativePoints=!1;lastPoint=[0,0];resolution;constructor({resolution:e=1}={}){if(!(e>0)||!Number.isFinite(e))throw Error(`Invalid resolution: ${e}`);this.resolution=e}asBase64(){return c(this.bits)}asBitString(){return this.bits.map(e=>e?`1`:`0`).join(``)}writeBit(e){this.bits.push(e)}writeInteger(e,t){if(e%1!=0)throw Error(`value must be an integer`);if(e<0||e>=2**t)throw Error(`${e} does not fit ${t} bits`);for(let n=t-1;n>=0;n--)this.bits.push((e&1<<n)>0);return e}writeVarint(e,t){if(!Number.isSafeInteger(e))throw Error(`value must be a safe integer: ${e}`);if(t){if(e=e<0?-2*e-1:2*e,!Number.isSafeInteger(e))throw Error(`value too large: ${e}`)}else if(e<0)throw Error(`Unsigned varint cannot be negative`);for(;this.writeInteger(e%32,5),e=Math.floor(e/32),this.writeBit(e>=1),!(e<1););}writeArray(e,t){let n=e.length;this.writeVarint(n);for(let r=0;r<n;r++)t(e[r])}writePoint(e,t=1){(!t||t<1)&&(t=1);let n=Math.round(1e5/t);this.writeVarint(Math.round(e[0]*n),!0),this.writeVarint(Math.round(e[1]*n),!0)}writeRoot(e){let t=it(e);this.writeKey(1,l.version),this.writePalette(en(t)),this.writeStringTable(Jt(t),qt(t)),this.styleHistory=new Ht;let n=z(t.frame&&{...t.frame,bearing:Math.round(t.frame.bearing??0),pitch:Math.round(t.frame.pitch??0)});this.writeGrid(t,n?.bounds),this.writeFrame(n),this.writeMetadata(t.meta),this.hasFields=t.elements.some(e=>!!e.popup?.text),this.writeBit(this.hasFields);let r;t.elements.forEach((e,t)=>{let n=$t(e),i=n===r;switch(r=n,this.writeElementType(e,i,t===0),e.type){case`marker`:this.writeElementMarker(e,i);break;case`line`:this.writeElementLine(e,i);break;case`polygon`:this.writeElementPolygon(e,i);break;case`circle`:this.writeElementCircle(e,i)}}),t.elements.length>0&&this.writeBit(!1),this.writeKey(2,l.element)}writeGrid(e,t){let n=At(this.resolution);this.writeInteger(n,4);let r=(t&&ie(t))??ie(re(e.elements)??[0,0,0,0]),i=[Math.round(r[0]*100),Math.round(r[1]*100)];this.writeVarint(i[0],!0),this.writeVarint(i[1],!0),this.grid=new Ft([i[0]/100,i[1]/100],n);let a=[!1,!0].flatMap(t=>{let n=this.coordinateSteps(e.elements,t),r=Qt(n),i=[0,1].map(e=>n.filter((t,n)=>n%2===e)),a=i.map(Qt);return[{relative:t,perAxis:!1,parameters:[r,r],bits:$(n,r)},{relative:t,perAxis:!0,parameters:a,bits:$(i[0],a[0])+$(i[1],a[1])+5}]}).reduce((e,t)=>t.bits<e.bits?t:e);this.coordinateParameters=a.parameters,this.relativePoints=a.relative,this.lastPoint=[0,0],this.writeBit(a.perAxis),this.writeInteger(this.coordinateParameters[0],5),a.perAxis&&this.writeInteger(this.coordinateParameters[1],5),this.writeBit(this.relativePoints)}writeElementType(e,t,n){n||this.writeBit(t),t||this.writeKey(u[e.type],l.element)}writeElementStyles(e,t){t||(this.writeOptionalStyle(Z(e.type),e.style),(e.type===`polygon`||e.type===`circle`)&&this.writeOptionalStyle(`outline`,e.outlineStyle))}writeOptionalStyle(e,t){this.writeBit(t!==void 0),t&&this.writeStyle(e,t)}writeMarkerLabel(e){this.writeBit(!!e.label),e.label&&this.writeStringRef(e.label)}writeFrame(e){if(!e)return this.writeBit(!1);this.writeBit(!0);let t=e.bounds;if(this.writeBit(!!t),t){let[e,n]=this.elementGrid.toGrid([t[0],t[1]],!0),[r,i]=this.elementGrid.toGrid([t[2],t[3]],!0),[a,o]=this.elementGrid.toGrid([180,90],!0);r===e&&e===a&&e--,i===n&&n===o&&n--,this.writeVarint(e,!0),this.writeVarint(n,!0),this.writeVarint(Math.max(1,r-e)),this.writeVarint(Math.max(1,i-n))}let n=e=>this.writeKey(ee[e],l.frame);e.bearing&&(n(`bearing`),this.writeInteger((e.bearing%360+360)%360,9)),e.pitch&&(n(`pitch`),this.writeInteger(e.pitch,7)),this.writeKey(0,l.frame)}get elementGrid(){if(!this.grid)throw Error(`Element points need the grid of the map`);return this.grid}writeElementPoint(e){let[t,n]=this.elementGrid.toGrid(e),[r,i]=this.relativePoints?this.lastPoint:[0,0];this.writeExpGolomb(t-r,this.coordinateParameters[0],!0),this.writeExpGolomb(n-i,this.coordinateParameters[1],!0),this.lastPoint=[t,n]}writeElementPoints(e){this.writeVarint(e.length),Yt(this.elementGrid,e).forEach((e,t)=>this.writeExpGolomb(e,this.coordinateParameters[t%2],!0))}coordinateSteps(e,t){let n=this.elementGrid,r=[0,0];return e.flatMap(e=>{if(!(`point`in e))return Yt(n,e.points);let[i,a]=n.toGrid(e.point),o=t?[i-r[0],a-r[1]]:[i,a];return r=[i,a],o}).map(Xt)}writeKey(e,t){this.writeExpGolomb(e,t)}writeExpGolomb(e,t,n){if(!Number.isSafeInteger(e))throw Error(`value must be a safe integer: ${e}`);if(n)e=Xt(e);else if(e<0)throw Error(`Unsigned Exp-Golomb code cannot be negative`);let r=e+2**t,i=Zt(r);for(let e=i-t-1;e>0;e--)this.writeBit(!1);for(let e=i-1;e>=0;e--)this.writeBit(Math.floor(r/2**e)%2==1)}writeMetadata(e){if(!(e&&(Gt(e.background)||e.legend||e.colorScheme||U(e.viewer)||H(e.labels)||e.title)))return this.writeBit(!1);this.writeBit(!0);let t=Gt(e.background);t&&(this.writeKey(d.background,l.metadata),this.writeBackground(t)),e.colorScheme&&(this.writeKey(d.colorScheme,l.metadata),this.writeStringRef(e.colorScheme,!0)),e.legend&&(this.writeKey(d.legend,l.metadata),this.writeLegend(e.legend)),e.title&&(this.writeKey(d.title,l.metadata),this.writeStringRef(e.title));let n=H(e.labels);n?.overlap===`hide`&&this.writeKey(d.labelOverlap,l.metadata),n?.minZoom!==void 0&&(this.writeKey(d.labelMinZoom,l.metadata),this.writeVarint(Math.round(n.minZoom*10)));let r=U(e.viewer);r&&(this.writeKey(d.viewer,l.metadata),this.writeViewer(r)),this.writeKey(0,l.metadata)}writeBackground(e){let t=e=>this.writeKey(f[e],l.background),n=(e,t,n,r)=>{let i=e.indexOf(t);this.writeInteger(i>=0&&i<r?i:r,n),(i<0||i>=r)&&this.writeStringRef(t,!0)},{labelSize:r,haloWidth:i,colors:a}=p;if(e.base===`satellite`&&t(`satellite`),e.theme!==void 0&&(t(`theme`),n(pe,e.theme,5,31)),e.streets===!1&&t(`noStreets`),e.borders===!1&&t(`noBorders`),e.labels!==void 0&&(t(`labels`),this.writeVarint(me.indexOf(e.labels))),e.language!==void 0&&(t(`language`),n(he,e.language,4,15)),e.font!==void 0&&(t(`font`),this.writeStringRef(e.font,!0)),e.labelSize!==void 0&&(t(`labelSize`),this.writeVarint(Math.max(1,Math.round(e.labelSize*r)))),e.haloWidth!==void 0&&(t(`haloWidth`),this.writeVarint(Math.round(e.haloWidth*i))),e.labelsOnTop&&t(`labelsOnTop`),e.colors){t(`colors`);let{saturation:n,black:r,white:i}=e.colors;for(let[e,t]of[[n,-1],[r,-1],[i,0]])this.writeBit(e!==void 0),e!==void 0&&this.writeInteger(Math.round((e-t)*a),6)}e.hillshade&&t(`hillshade`),e.terrain&&t(`terrain`),e.buildings===`extruded`&&t(`extruded`),e.options&&(t(`options`),this.writeStringRef(JSON.stringify(e.options),!0)),this.writeKey(0,l.background)}writeElementMarker(e,t=!1){this.writeElementPoint(e.point),this.writeElementStyles(e,t),this.writeMarkerLabel(e),this.writeElementFields(e)}writeElementLine(e,t=!1){this.writeElementPoints(e.points),this.writeBit(e.smooth===!0),this.writeElementStyles(e,t),this.writeElementFields(e)}writeElementPolygon(e,t=!1){this.writeElementPoints(e.points),this.writeBit(e.smooth===!0),this.writeElementStyles(e,t),this.writeElementFields(e)}writeElementCircle(e,t=!1){this.writeElementPoint(e.point),this.writeVarint(Math.max(1,Math.round(e.radius))),this.writeElementStyles(e,t),this.writeElementFields(e)}writeViewer(e){for(let[t,n]of Object.entries(et)){let r=e[t];r!==void 0&&(this.writeKey(g[t],l.viewer),this.writeVarint(n.indexOf(r)))}for(let t of $e)e[t]&&this.writeKey(g[t],l.viewer);let t=e=>this.writeKey(g[e],l.viewer);e.zoomButtons===!1&&t(`noZoomButtons`),e.canPan===!1&&t(`noPan`),e.canZoom===!1&&t(`noZoom`),e.canRotate===!0&&t(`rotate`),e.canTilt===!0&&t(`tilt`),e.confine===!0&&t(`confine`),e.minZoom!==void 0&&(t(`minZoom`),this.writeInteger(Math.round(e.minZoom*2),6)),e.maxZoom!==void 0&&(t(`maxZoom`),this.writeInteger(Math.round(e.maxZoom*2),6)),e.scrollZoom===`free`&&t(`scrollFree`),this.writeKey(0,l.viewer)}writeLegend(e){e.layout&&e.layout!==V.layout&&(this.writeKey(m.layout,l.legend),this.writeVarint(oe.indexOf(e.layout))),e.font&&e.font!==V.font&&(this.writeKey(m.font,l.legend),this.writeVarint(ce.indexOf(e.font))),e.bold&&this.writeKey(m.bold,l.legend),e.italic&&this.writeKey(m.italic,l.legend),e.theme&&e.theme!==V.theme&&(this.writeKey(m.theme,l.legend),this.writeVarint(se.indexOf(e.theme))),this.writeKey(m.entries,l.legend),this.writeArray(e.entries,e=>{let t=S.indexOf(e.type);if(t<0)throw Error(`Invalid legend entry type: ${e.type}`);this.writeKey(h.type,l.legendEntry),this.writeVarint(t),e.style&&(this.writeKey(h.style,l.legendEntry),this.writeStyle(Z(e.type),e.style)),`outlineStyle`in e&&e.outlineStyle&&(this.writeKey(h.outlineStyle,l.legendEntry),this.writeStyle(`outline`,e.outlineStyle)),e.label&&(this.writeKey(h.label,l.legendEntry),this.writeStringRef(e.label)),this.writeKey(0,l.legendEntry)}),this.writeKey(0,l.legend)}writeElementFields(e){this.hasFields&&(e.popup?.text&&(this.writeKey(te.popupText,l.elementFields),this.writeStringRef(e.popup.text)),this.writeKey(0,l.elementFields))}writeStyle(e,t){t=I(t);let n;for(let r=0;r<=this.styleHistory.count(e);r++){let i=this.fork();i.writeStyleReference(r),i.writeStylePatch(e,this.styleHistory.get(r,e)??{},t),(!n||i.bits.length<n.bits.length)&&(n=i)}for(let e of n.bits)this.bits.push(e);this.nextString=[...n.nextString],this.styleHistory.remember(e,t)}writeStyleReference(e){this.writeExpGolomb(e,0)}writeStylePatch(e,t,n){for(let r of Rt(e)){let i=Bt(n,r);i!==Bt(t,r)&&(i===void 0?(this.writeStyleKey(zt(e)),this.writeStyleKey(r.key)):(this.writeStyleKey(r.key),this.writeStyleValue(r.name,n)))}this.writeStyleKey(0)}writeName(e,t){let n=e.indexOf(t);if(n<0)throw Error(`Invalid name: ${t}`);this.writeVarint(n)}writeStyleKey(e){this.writeExpGolomb(e,0)}writeStyleValue(e,t){switch(e){case`haloWidth`:return this.writeVarint(Math.round(t.haloWidth*10));case`pattern`:return this.writeName(b,t.pattern);case`dash`:return this.writeName(x,t.dash);case`rotation`:return this.writeVarint(Math.round(t.rotation),!0);case`size`:return this.writeVarint(Y(t.size));case`labelSize`:return this.writeVarint(Y(t.labelSize));case`width`:return this.writeVarint(Math.round(t.width*10));case`labelPosition`:return this.writeName(y,t.labelPosition);case`arrowStart`:case`arrowEnd`:return this.writeName(v,t[e]);case`arrowSize`:return this.writeVarint(Y(t.arrowSize));case`patternScale`:return this.writeVarint(Math.round(t.patternScale*10));case`patternCoverage`:return this.writeVarint(Math.round(t.patternCoverage*100));case`color`:case`labelColor`:case`haloColor`:return this.writeColorValue(t[e]);case`symbol`:return this.writeStringRef(t.symbol,!0);case`labelFont`:return this.writeStringRef(t.labelFont,!0);case`visible`:return;case`flat`:return}}fork(){let t=new e({resolution:this.resolution});return t.palette=this.palette,t.strings=this.strings,t.nextString=[...this.nextString],t}writePalette(e){this.writeArray(e,e=>this.writePaletteColor(e)),this.palette=new Map(e.map((e,t)=>[Q(e),t]))}writeColorValue(e){let t=this.palette.get(Q(e));if(t===void 0)throw Error(`Color not in the palette: ${e}`);this.writeExpGolomb(t,0)}writeStringTable(e,t=[]){let n=[[...new Set(t)],[...new Set(e)]],r=[...n[0],...n[1]];if(this.writeVarint(r.length),r.length>0){this.writeVarint(n[0].length);let e=Ct(r,n[0].length);for(let t of e)this.bits.push(t)}this.strings=[new Map(n[0].map((e,t)=>[e,t])),new Map(n[1].map((e,t)=>[e,t]))],this.nextString=[0,0]}writeStringRef(e,t=!1){let n=+!t,r=this.strings[n].get(e);if(r===void 0)throw Error(`String not in the table: ${e}`);r===this.nextString[n]?this.writeBit(!0):(this.writeBit(!1),this.writeExpGolomb(r,2)),this.nextString[n]=Math.max(this.nextString[n],r+1)}writePaletteColor(e){let n=t(e);if(!n)throw Error(`Invalid color: ${e}`);let[r,i,a]=[n.r,n.g,n.b].map(Math.round),o=r===i&&i===a&&(r===0||r===255);if(this.writeBit(o),!o)return this.writeColor(e);this.writeBit(r===255),this.writeAlpha(e)}writeColor(e){let n=t(e);if(!n)throw Error(`Invalid color: ${e}`);this.writeInteger(Math.round(n.r),8),this.writeInteger(Math.round(n.g),8),this.writeInteger(Math.round(n.b),8),this.writeAlpha(e)}writeAlpha(e){let n=t(e).alpha;this.writeBit(n!=1),n!=1&&this.writeInteger(Math.round(n*255),8)}};function Wt(e){return[...e.elements,...e.meta?.legend?.entries??[]].flatMap(e=>[...e.style?[e.style]:[],...`outlineStyle`in e&&e.outlineStyle?[e.outlineStyle]:[]])}function Gt(e){let t=B(e);if(!t)return;let n=(e,t)=>e===void 0?void 0:Math.round(Math.round(e*t)/t*1e4)/1e4,{labelSize:r,haloWidth:i,colors:a}=p;return B({...t,labelSize:n(t.labelSize,r),haloWidth:n(t.haloWidth,i),colors:t.colors&&{saturation:n(t.colors.saturation,a),black:n(t.colors.black,a),white:n(t.colors.white,a)}})}function Kt(e){let t=Gt(e?.background);if(!t)return[];let n=(e,t,n)=>{let r=t===void 0?0:e.indexOf(t);return r<0||r>=n?t:void 0};return[n(pe,t.theme,31),n(he,t.language,15),t.font,t.options&&JSON.stringify(t.options)].filter(e=>e!==void 0)}function qt(e){let t=e.meta,n=[...Kt(t),...t?.colorScheme?[t.colorScheme]:[]];for(let r of[...t?.legend?.entries??[],...e.elements]){let e=[r.style,`outlineStyle`in r?r.outlineStyle:void 0];for(let t of e)t?.symbol!=null&&n.push(t.symbol),t?.labelFont!=null&&n.push(t.labelFont)}return n}function Jt(e){let t=[],n=e.meta;for(let e of n?.legend?.entries??[])e.label&&t.push(e.label);n?.title&&t.push(n.title);for(let n of e.elements)n.type===`marker`&&n.label&&t.push(n.label),n.popup?.text&&t.push(n.popup.text);return t}function Yt(e,t){let n=[],r=0,i=0;for(let a of t){let[t,o]=e.toGrid(a);n.push(t-r,o-i),r=t,i=o}return n}function Xt(e){let t=e<0?-2*e-1:2*e;if(!Number.isSafeInteger(t))throw Error(`value too large: ${e}`);return t}function Zt(e){let t=0;for(;e>=1;e=Math.floor(e/2))t++;return t}function $(e,t){let n=0;for(let r of e)n+=2*Zt(r+2**t)-t-1;return n}function Qt(e){let t=0,n=1/0;for(let r=0;r<32;r++){let i=$(e,r);i<n&&(t=r,n=i)}return t}function $t(e){let t=(e,t)=>t?Vt(e,t):`-`,n=`outlineStyle`in e?e.outlineStyle:void 0;return[e.type,t(Z(e.type),e.style),t(`outline`,n)].join(`|`)}function en(e){let t=[];for(let n of Wt(e))for(let e of[n.color,n.labelColor,n.haloColor])e&&t.push(e);let n=new Map;return t.forEach((e,t)=>{let r=Q(e),i=n.get(r);i?i.count++:n.set(r,{color:e,count:1,first:t})}),[...n.values()].sort((e,t)=>t.count-e.count||e.first-t.first).map(e=>e.color)}var tn=class extends Error{version;constructor(e){super(`The link is of version ${e} of the format; this version reads up to 1.`),this.version=e,this.name=`LinkVersionError`}},nn=class e{bits;offset=0;palette=[];strings=[[],[]];nextString=[0,0];styleHistory=new Ht;hasFields=!0;grid;coordinateParameters=[0,0];relativePoints=!1;lastPoint=[0,0];constructor(e){this.bits=e}static fromBase64(t){let n=[];for(let e=0;e<t.length;e++){let r=s[t.charCodeAt(e)];if(!r)throw Error(`Invalid character in base64 string: ${t[e]}`);n.push(...r)}return new e(n)}static fromBitString(t){return new e(t.split(``).map(e=>e===`1`))}ended(){return this.offset>=this.bits.length}readBit(){if(this.ended())throw Error(`End of bits`);return this.bits[this.offset++]}readInteger(e){try{let t=0;for(let n=0;n<e;n++)t<<=1,this.readBit()&&(t+=1);return t}catch(e){throw Error(`Error reading integer`,{cause:e})}}readVarint(e){try{let t=0,n=1,r;do{if(n>2**53-1)throw Error(`Varint too long`);r=this.readInteger(5),t+=r*n,n*=32}while(this.readBit());if(r===0&&n>32)throw Error(`Varint with a needless group`);if(!Number.isSafeInteger(t))throw Error(`Varint beyond the safe integers`);return e?t%2==1?-(t+1)/2:t/2:t}catch(e){throw Error(`Error reading readVarint`,{cause:e})}}readExpGolomb(e,t){try{let n=0;for(;!this.readBit();)n++;if(n+e>52)throw Error(`Exp-Golomb code too long`);let r=1;for(let t=0;t<n+e;t++)r=2*r+ +!!this.readBit();let i=r-2**e;return t?i%2==1?-(i+1)/2:i/2:i}catch(e){throw Error(`Error reading Exp-Golomb code`,{cause:e})}}readArray(e){try{let t=this.readVarint(),n=[];for(let r=0;r<t;r++)n.push(e());return n}catch(e){throw Error(`Error reading array`,{cause:e})}}readPoint(e=1){(!e||e<1)&&(e=1);try{let t=Math.round(1e5/e);return[this.readVarint(!0)/t,this.readVarint(!0)/t]}catch(e){throw Error(`Error reading point`,{cause:e})}}get elementGrid(){if(!this.grid)throw Error(`Element points need the grid of the map`);return this.grid}readElementPoint(){let[e,t]=this.relativePoints?this.lastPoint:[0,0],n=e+this.readExpGolomb(this.coordinateParameters[0],!0),r=t+this.readExpGolomb(this.coordinateParameters[1],!0);return this.lastPoint=[n,r],rn(this.elementGrid.fromGrid([n,r]))}readElementPoints(){let e=this.elementGrid,t=this.readVarint(),n=[],r=0,i=0;for(let a=0;a<t;a++)r+=this.readExpGolomb(this.coordinateParameters[0],!0),i+=this.readExpGolomb(this.coordinateParameters[1],!0),n.push(rn(e.fromGrid([r,i])));return n}readRoot(){try{let e={elements:[]};this.readVersion(),this.readPalette(),this.readStringTable(),this.styleHistory=new Ht,this.readGrid();let t=this.readFrame();t&&(e.frame=t),e.meta=this.readMetadata(),e.meta||delete e.meta,this.hasFields=this.readBit();let n;for(;;){let{key:t,repeat:r}=this.readElementType(n),i=r?n:void 0;switch(t){case 2:return this.readEnd(),it(e);case u.marker:n=this.readElementMarker(i);break;case u.line:n=this.readElementLine(i);break;case u.polygon:n=this.readElementPolygon(i);break;case u.circle:n=this.readElementCircle(i);break;default:throw Error(`Unknown element key: ${t}`)}e.elements.push(n)}}catch(e){throw e instanceof tn?e:Error(`Error reading root`,{cause:e})}}readVersion(){let e=this.readKey(l.version);if(e>1)throw new tn(e);if(e!==1)throw Error(`Unsupported version: ${e}`)}readGrid(){let e=this.readInteger(4),t=[this.readVarint(!0)/100,this.readVarint(!0)/100];if(Math.abs(t[1])>90)throw Error(`Invalid latitude of the origin: ${t[1]}`);if(Math.abs(t[0])>_.longitude)throw Error(`Invalid longitude of the origin: ${t[0]}`);this.grid=new Ft(t,e);let n=this.readBit(),r=this.readInteger(5);this.coordinateParameters=[r,n?this.readInteger(5):r],this.relativePoints=this.readBit(),this.lastPoint=[0,0]}readElementType(e){let t=e?this.readBit():!1;return{key:t?u[e.type]:this.readKey(l.element),repeat:t}}readEnd(){let e=this.bits.slice(this.offset);if(e.length>=6||e.some(e=>e))throw Error(`Data after the end of the map`)}keysOnce(e){let t=new Set;return n=>{if(t.has(n))throw Error(`The key ${n} twice in ${e}`);return t.add(n),n}}readKey(e){return this.readExpGolomb(e)}readFrame(){try{if(!this.readBit())return;let e={};if(this.readBit()){let t=this.readVarint(!0),n=this.readVarint(!0),r=this.readVarint(),i=this.readVarint();if(r<1||i<1)throw Error(`Invalid size of the frame`);let[a,o]=this.elementGrid.fromGrid([t,n]),[s,c]=this.elementGrid.fromGrid([t+r,n+i]),l=Ue([a,o,s,c]);if(!l)throw Error(`Frame beyond the map`);e.bounds=l}let t=this.keysOnce(`the frame`);for(;;){let n=t(this.readKey(l.frame));if(n===0)break;switch(n){case ee.bearing:if(e.bearing=this.readInteger(9),e.bearing>=360)throw Error(`Invalid rotation of the frame: ${e.bearing}`);break;case ee.pitch:if(e.pitch=this.readInteger(7),e.pitch>60)throw Error(`Invalid tilt of the frame: ${e.pitch}`);break;default:throw Error(`Unknown key of the frame: ${n}`)}}if(Object.keys(e).length===0)throw Error(`A frame without anything`);return z(e)}catch(e){throw Error(`Error reading frame`,{cause:e})}}readBackground(){try{let e={},t=(e,t,n)=>{let r=this.readInteger(t);if(r===n)return this.readStringRef(!0);if(r>=e.length)throw Error(`Invalid index: ${r} of ${e.length}`);return e[r]},{labelSize:n,haloWidth:r,colors:i}=p,a=(e,t)=>Math.round(e/t*1e4)/1e4,o=this.keysOnce(`the background`);for(;;){let s=o(this.readKey(l.background));switch(s){case 0:{let t=B(e);if(!t)throw Error(`A background without settings`);return t}case f.satellite:e.base=`satellite`;break;case f.theme:e.theme=t(pe,5,31);break;case f.noStreets:e.streets=!1;break;case f.noBorders:e.borders=!1;break;case f.labels:{let t=me[this.readVarint()];if(!t)throw Error(`Invalid labels of the background`);e.labels=t;break}case f.language:e.language=t(he,4,15);break;case f.font:e.font=this.readStringRef(!0);break;case f.labelSize:if(e.labelSize=a(this.readVarint(),n),e.labelSize>_.size)throw Error(`A size of the labels beyond the largest one`);break;case f.haloWidth:if(e.haloWidth=a(this.readVarint(),r),e.haloWidth>_.width)throw Error(`A halo beyond the largest width`);break;case f.labelsOnTop:e.labelsOnTop=!0;break;case f.colors:{let t=(e,t)=>{if(!this.readBit())return;let n=a(this.readInteger(6)+e*i,i);if(n>t)throw Error(`Invalid change of the colors: ${n}`);return n},[n,r,o]=[t(-1,1),t(-1,1),t(0,2)];if(n===void 0&&r===void 0&&o===void 0)throw Error(`Colors of the background without a change`);e.colors={...n===void 0?{}:{saturation:n},...r===void 0?{}:{black:r},...o===void 0?{}:{white:o}};break}case f.hillshade:e.hillshade=!0;break;case f.terrain:e.terrain=!0;break;case f.extruded:e.buildings=`extruded`;break;case f.options:{let t=JSON.parse(this.readStringRef(!0));if(typeof t!=`object`||!t||Array.isArray(t))throw Error(`Invalid options of the background`);e.options=t;break}default:throw Error(`Invalid background key: ${s}`)}}}catch(e){throw Error(`Error reading background`,{cause:e})}}readMetadata(){try{if(!this.readBit())return;let e={},t=this.keysOnce(`the metadata`);for(;;){let n=t(this.readKey(l.metadata));switch(n){case 0:if(Object.keys(e).length===0)throw Error(`Metadata without anything`);return e;case d.background:e.background=this.readBackground();break;case d.legend:e.legend=this.readLegend();break;case d.colorScheme:e.colorScheme=this.readStringRef(!0);break;case d.title:e.title=this.readText(`title`);break;case d.viewer:e.viewer=this.readViewer();break;case d.labelOverlap:e.labels={...e.labels,overlap:`hide`};break;case d.labelMinZoom:{let t=Ze(this.readVarint()/10);if(t===void 0)throw Error(`Invalid zoom level of labels`);e.labels={...e.labels,minZoom:t};break}default:throw Error(`Invalid state key: ${n}`)}}}catch(e){throw Error(`Error reading metadata`,{cause:e})}}readElementMarker(e){try{let t={type:`marker`,point:this.readElementPoint()};return this.readElementStyles(t,e),this.readBit()&&(t.label=this.readText(`label`)),this.readElementFields(t),t}catch(e){throw Error(`Error reading marker element`,{cause:e})}}readElementLine(e){try{let t={type:`line`,points:this.readElementPoints()};if(t.points.length<2)throw Error(`A line of fewer than 2 points`);return this.readBit()&&(t.smooth=!0),this.readElementStyles(t,e),this.readElementFields(t),t}catch(e){throw Error(`Error reading line element`,{cause:e})}}readElementPolygon(e){try{let t={type:`polygon`,points:this.readElementPoints()};if(t.points.length<3)throw Error(`An area of fewer than 3 points`);return this.readBit()&&(t.smooth=!0),this.readElementStyles(t,e),this.readElementFields(t),t}catch(e){throw Error(`Error reading polygon element`,{cause:e})}}readElementCircle(e){try{let t=this.readElementPoint(),n=this.readVarint();if(n<1)throw Error(`A circle without a radius`);if(n>_.radius)throw Error(`A radius beyond the largest one: ${n}`);let r={type:`circle`,point:t,radius:n};return this.readElementStyles(r,e),this.readElementFields(r),r}catch(e){throw Error(`Error reading circle element`,{cause:e})}}readElementStyles(e,t){let n=e.type===`polygon`||e.type===`circle`;t?(t.style&&(e.style={...t.style}),n&&`outlineStyle`in t&&t.outlineStyle&&(e.outlineStyle={...t.outlineStyle})):(this.readBit()&&(e.style={...this.readStyle(Z(e.type))}),n&&this.readBit()&&(e.outlineStyle={...this.readStyle(`outline`)}))}readLegend(){try{let e={entries:[]},t=this.keysOnce(`the legend`),n=!1;for(;;){let r=t(this.readKey(l.legend));switch(r){case 0:if(!n)throw Error(`A legend without its entries`);return e;case m.layout:if(e.layout=oe[this.readVarint()],!e.layout)throw Error(`Invalid legend layout`);break;case m.entries:e.entries=this.readArray(()=>this.readLegendEntry()),n=!0;break;case m.font:if(e.font=ce[this.readVarint()],!e.font)throw Error(`Invalid legend font`);break;case m.bold:e.bold=!0;break;case m.italic:e.italic=!0;break;case m.theme:if(e.theme=se[this.readVarint()],!e.theme)throw Error(`Invalid legend theme`);break;default:throw Error(`Invalid legend key: ${r}`)}}}catch(e){throw Error(`Error reading legend`,{cause:e})}}readViewer(){try{let e={},t=Object.keys(et),n=this.keysOnce(`the viewer`);for(;;){let r=n(this.readKey(l.viewer));if(r===0){if(Object.keys(e).length===0)throw Error(`A viewer without settings`);let{minZoom:t,maxZoom:n}=e;if(t!==void 0&&n!==void 0&&t>n)throw Error(`A least zoom above the largest one`);return U(e)??{}}let i=$e.find(e=>g[e]===r);if(i){e[i]=!0;continue}switch(r){case g.noZoomButtons:e.zoomButtons=!1;continue;case g.noPan:e.canPan=!1;continue;case g.noZoom:e.canZoom=!1;continue;case g.rotate:e.canRotate=!0;continue;case g.tilt:e.canTilt=!0;continue;case g.confine:e.confine=!0;continue;case g.minZoom:e.minZoom=this.readZoomLimit();continue;case g.maxZoom:e.maxZoom=this.readZoomLimit();continue;case g.scrollFree:e.scrollZoom=`free`;continue}let a=t.find(e=>g[e]===r);if(!a)throw Error(`Invalid viewer key: ${r}`);let o=et[a][this.readVarint()];if(!o)throw Error(`Invalid viewer ${a}`);e[a]=o}}catch(e){throw Error(`Error reading viewer`,{cause:e})}}readLegendEntry(){let e,t,n,r=``,i=this.keysOnce(`a legend entry`);for(;;){let a=i(this.readKey(l.legendEntry));switch(a){case 0:if(!e)throw Error(`Legend entry without type`);return{type:e,...t&&{style:t},...n&&{outlineStyle:n},label:r};case h.label:r=this.readStringRef();break;case h.type:if(e=S[this.readVarint()],!e)throw Error(`Invalid legend entry type`);break;case h.style:if(!e)throw Error(`A style of a legend entry before its type`);t=this.readStyle(Z(e));break;case h.outlineStyle:if(e!==`area`)throw Error(`An outline of a legend entry that is no area`);n=this.readStyle(`outline`);break;default:throw Error(`Invalid legend entry key: ${a}`)}}}readElementFields(e){if(this.hasFields)try{let t=this.keysOnce(`the fields of an element`);for(;;){let n=t(this.readKey(l.elementFields));switch(n){case 0:return;case te.popupText:e.popup={text:this.readText(`popup`)};break;default:throw Error(`Unknown field of an element: ${n}`)}}}catch(e){throw Error(`Error reading the fields of an element`,{cause:e})}}readText(e){let t=this.readStringRef();if(t.trim()===``)throw Error(`An empty ${e}`);return t}readZoomLimit(){let e=this.readInteger(6)/2;if(e>22)throw Error(`Invalid zoom level: ${e}`);return e}readWidth(){let e=this.readVarint()/10;if(e>_.width)throw Error(`A width beyond the largest one: ${e}`);return e}readSize(){let e=this.readVarint();if(e<1)throw Error(`A size of 0`);if(e>_.size*10)throw Error(`A size beyond the largest one: ${e/10}`);return e/10}readStyle(e){try{let t=this.readExpGolomb(0);if(t>this.styleHistory.count(e))throw Error(`Invalid style reference: ${t}`);let n=this.readStylePatch(e,{...this.styleHistory.get(t,e)});if(t===0&&Object.keys(n).length===0)throw Error(`A style without fields`);if(n.arrowSize!==void 0&&!Ee(n))throw Error(`Arrow size without an arrowhead`);if((n.patternScale!==void 0||n.patternCoverage!==void 0)&&!De(n))throw Error(`Pattern size or coverage without a pattern`);return this.styleHistory.remember(e,n),n}catch(e){throw Error(`Error reading style`,{cause:e})}}readIndex(e){let t=this.readVarint();if(t>=e)throw Error(`Invalid index: ${t} of ${e}`);return t}readName(e){return e[this.readIndex(e.length)]}readStylePatch(e,t){let n=Rt(e),r=zt(e),i=this.keysOnce(`a style`);for(;;){let e=this.readStyleKey();if(e===0)return t;if(e===r){let e=i(this.readStyleKey()),r=n.find(t=>t.key===e);if(!r)throw Error(`Invalid state key: ${e}`);if(!(r.name in t))throw Error(`A field removed that the style has not: ${r.name}`);delete t[r.name];continue}i(e);let a=n.find(t=>t.key===e);if(!a)throw Error(`Invalid state key: ${e}`);switch(a.name){case`haloWidth`:t.haloWidth=this.readWidth();break;case`pattern`:t.pattern=this.readName(b);break;case`dash`:t.dash=this.readName(x);break;case`rotation`:if(t.rotation=this.readVarint(!0),t.rotation<=-180||t.rotation>180)throw Error(`Invalid rotation: ${t.rotation}`);break;case`size`:t.size=this.readSize();break;case`width`:t.width=this.readWidth();break;case`labelPosition`:t.labelPosition=this.readName(y);break;case`arrowStart`:case`arrowEnd`:t[a.name]=this.readName(v);break;case`arrowSize`:t.arrowSize=this.readSize();break;case`patternScale`:if(t.patternScale=this.readVarint()/10,t.patternScale<w[0]||t.patternScale>w[1])throw Error(`Invalid pattern scale: ${t.patternScale}`);break;case`patternCoverage`:if(t.patternCoverage=this.readVarint()/100,t.patternCoverage<T[0]||t.patternCoverage>T[1])throw Error(`Invalid pattern coverage: ${t.patternCoverage}`);break;case`color`:case`labelColor`:case`haloColor`:t[a.name]=this.readColorValue();break;case`visible`:t.visible=!1;break;case`flat`:t.flat=!0;break;case`symbol`:if(t.symbol=this.readStringRef(!0),t.symbol!==``&&!t.symbol.includes(`:`))throw Error(`Invalid symbol: ${t.symbol}`);break;case`labelSize`:t.labelSize=this.readSize();break;case`labelFont`:t.labelFont=this.readStringRef(!0)}}}readStyleKey(){return this.readExpGolomb(0)}readPalette(){this.palette=this.readArray(()=>this.readPaletteColor())}readPaletteColor(){if(!this.readBit())return this.readColor();let e=this.readBit()?255:0;return a({r:e,g:e,b:e,alpha:this.readAlpha()})}readStringTable(){try{let e=this.readVarint(),t=[],n=0;if(e>0){if(n=this.readVarint(),n>e)throw Error(`Invalid number of words of the format: ${n}`);let r=wt(this.bits.slice(this.offset),e,n);t=r.strings,this.readBlock(r.length)}return this.strings=[t.slice(0,n),t.slice(n)],this.nextString=[0,0],t}catch(e){throw Error(`Error reading string table`,{cause:e})}}readBlock(e){if(this.offset+e>this.bits.length)throw Error(`Block beyond the end of bits`);let t=this.bits.slice(this.offset,this.offset+e);return this.offset+=e,t}readStringRef(e=!1){let t=+!e,n=this.readBit()?this.nextString[t]:this.readExpGolomb(2),r=this.strings[t][n];if(r===void 0)throw Error(`Invalid string index: ${n}`);return this.nextString[t]=Math.max(this.nextString[t],n+1),r}readColorValue(){let e=this.readExpGolomb(0),t=this.palette[e];if(t===void 0)throw Error(`Invalid palette index: ${e}`);return t}readAlpha(){return this.readBit()?this.readInteger(8)/255:1}readColor(){try{return a({r:this.readInteger(8),g:this.readInteger(8),b:this.readInteger(8),alpha:this.readAlpha()})}catch(e){throw Error(`Error reading color`,{cause:e})}}};function rn(e){if(!(Math.abs(e[1])<=90))throw Error(`Invalid latitude: ${e[1]}`);if(!(Math.abs(e[0])<=_.longitude))throw Error(`Invalid longitude: ${e[0]}`);return e}function an(e,t={}){let n=new Ut(t);return n.writeRoot(e),n.asBase64()}function on(e){return nn.fromBase64(e).readRoot()}export{b as $,ze as A,N as B,ke as C,Fe as D,Pe as E,st as F,F as G,rt as H,z as I,Re as J,U as K,H as L,B as M,Te as N,Me as O,Ue as P,x as Q,Xe as R,Oe as S,Ie as T,it as U,nt as V,Ce as W,v as X,_e as Y,he as Z,D as _,Nt as a,t as at,ve as b,Pt as c,qe as d,y as et,Ke as f,O as g,E as h,nn as i,a as it,He as j,Ne as k,Ct as l,V as m,an as n,_ as nt,At as o,Ge as p,Le as q,tn as r,re as rt,Mt as s,on as t,S as tt,C as u,T as v,Ee as w,Qe as x,w as y,at as z};
@@ -0,0 +1 @@
1
+ export{r as load_css,n as start}from"./DW2jyAZk.js";
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.DDz1Dk-W.js","../chunks/DK3Fl9T5.js","../chunks/C1qWpZZK.js","../nodes/1.DCMJt1lg.js","../chunks/BFhkrCgt.js","./payload.DSmR2FwN.js","../chunks/Dams4V9V.js","../nodes/2.B3OUzcrd.js","../chunks/CRzLMJPS.js","../chunks/DU0zVETU.js","../chunks/nsn6-zdH.js","../assets/MapViewer.BtMysvtR.css","../chunks/CDI9yWJf.js","../assets/2.vrWZYRVE.css","../nodes/3.ttq6Z4rF.js","../assets/3.BLA0AxgC.css","../nodes/4.Dmkqn01Q.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"../chunks/CRzLMJPS.js";var t={},n=[()=>e(()=>import(`../nodes/0.DDz1Dk-W.js`),__vite__mapDeps([0,1,2]),import.meta.url),()=>e(()=>import(`../nodes/1.DCMJt1lg.js`),__vite__mapDeps([3,2,4,5,6]),import.meta.url),()=>e(()=>import(`../nodes/2.B3OUzcrd.js`),__vite__mapDeps([7,8,2,9,10,1,6,5,11,12,4,13]),import.meta.url),()=>e(()=>import(`../nodes/3.ttq6Z4rF.js`),__vite__mapDeps([14,2,9,15]),import.meta.url),()=>e(()=>import(`../nodes/4.Dmkqn01Q.js`),__vite__mapDeps([16,2,9,10,1,8,6,5,11]),import.meta.url)],r=[],i={"/":[2],"/iframe-test":[3],"/view":[4]},a={handleError:(({kind:e,error:t})=>{e===`unknown`&&console.error(t)}),reroute:(()=>{}),transport:{}},o=Object.fromEntries(Object.entries(a.transport).map(([e,t])=>[e,t.decode])),s=Object.fromEntries(Object.entries(a.transport).map(([e,t])=>[e,t.encode])),c=!1,l=(e,t)=>o[e](t),u=()=>e(()=>import(`../chunks/Bjy-W4x2.js`).then(e=>e.default),[],import.meta.url);export{l as decode,o as decoders,i as dictionary,s as encoders,u as get_error_template,c as hash,a as hooks,t as matchers,n as nodes,r as server_loads};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.DDz1Dk-W.js","../chunks/DK3Fl9T5.js","../chunks/C1qWpZZK.js","../nodes/1.DCMJt1lg.js","../chunks/BFhkrCgt.js","./payload.DSmR2FwN.js","../chunks/Dams4V9V.js","../nodes/2.NakMxGT9.js","../chunks/CRzLMJPS.js","../chunks/R7VNWRco.js","../chunks/D4hdjuw5.js","../assets/MapViewer.CCKeYdyr.css","../chunks/DW2jyAZk.js","../assets/2.D1eolrny.css","../nodes/3.DTTz6_38.js","../assets/3.BLA0AxgC.css","../nodes/4.CZ3k1uI8.js"])))=>i.map(i=>d[i]);
2
+ import{t as e}from"../chunks/CRzLMJPS.js";var t={},n=[()=>e(()=>import(`../nodes/0.DDz1Dk-W.js`),__vite__mapDeps([0,1,2]),import.meta.url),()=>e(()=>import(`../nodes/1.DCMJt1lg.js`),__vite__mapDeps([3,2,4,5,6]),import.meta.url),()=>e(()=>import(`../nodes/2.NakMxGT9.js`),__vite__mapDeps([7,8,2,9,10,1,6,5,11,12,4,13]),import.meta.url),()=>e(()=>import(`../nodes/3.DTTz6_38.js`),__vite__mapDeps([14,2,9,15]),import.meta.url),()=>e(()=>import(`../nodes/4.CZ3k1uI8.js`),__vite__mapDeps([16,2,9,10,1,8,6,5,11]),import.meta.url)],r=[],i={"/":[2],"/iframe-test":[3],"/view":[4]},a={handleError:(({kind:e,error:t})=>{e===`unknown`&&console.error(t)}),reroute:(()=>{}),transport:{}},o=Object.fromEntries(Object.entries(a.transport).map(([e,t])=>[e,t.decode])),s=Object.fromEntries(Object.entries(a.transport).map(([e,t])=>[e,t.encode])),c=!1,l=(e,t)=>o[e](t),u=()=>e(()=>import(`../chunks/Bjy-W4x2.js`).then(e=>e.default),[],import.meta.url);export{l as decode,o as decoders,i as dictionary,s as encoders,u as get_error_template,c as hash,a as hooks,t as matchers,n as nodes,r as server_loads};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../chunks/B16QPxTL.js","../chunks/CDI9yWJf.js","./payload.DSmR2FwN.js","../chunks/C1qWpZZK.js","../chunks/Dams4V9V.js","../chunks/BFhkrCgt.js"])))=>i.map(i=>d[i]);
2
- import{set_payload as e}from"./payload.DSmR2FwN.js";import{t}from"../chunks/CRzLMJPS.js";var n;function r(r){e(r),n??=t(()=>import(`../chunks/B16QPxTL.js`),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)}async function i(...e){return(await n).start(...e)}async function a(...e){return(await n).load_css(...e)}export{r as init,a as load_css,i as start};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../chunks/wNJYh7cu.js","../chunks/DW2jyAZk.js","./payload.DSmR2FwN.js","../chunks/C1qWpZZK.js","../chunks/Dams4V9V.js","../chunks/BFhkrCgt.js"])))=>i.map(i=>d[i]);
2
+ import{set_payload as e}from"./payload.DSmR2FwN.js";import{t}from"../chunks/CRzLMJPS.js";var n;function r(r){e(r),n??=t(()=>import(`../chunks/wNJYh7cu.js`),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)}async function i(...e){return(await n).start(...e)}async function a(...e){return(await n).load_css(...e)}export{r as init,a as load_css,i as start};