@delta10/atlas-sdk 0.1.3 → 0.1.4

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.
Files changed (42) hide show
  1. package/dist/Example.vue.d.ts +3 -0
  2. package/dist/{assets/index-CRiJOLan.css → atlas-sdk.css} +1 -1
  3. package/dist/atlas-sdk.js +5 -0
  4. package/dist/atlas-sdk.umd.cjs +816 -0
  5. package/dist/basedecoder-PoXbLGBV.js +88 -0
  6. package/dist/components/Map.vue.d.ts +96 -0
  7. package/dist/components/index.d.ts +1 -0
  8. package/dist/components/panels/BaseLayers.vue.d.ts +23 -0
  9. package/dist/components/panels/Layers.vue.d.ts +23 -0
  10. package/dist/data/demo-data.d.ts +15 -0
  11. package/dist/decoder-CLokFc0V.js +8 -0
  12. package/dist/deflate-DbhbvOaP.js +10 -0
  13. package/dist/html2canvas.esm-C17pzFXx-LAKgTrxK.js +4852 -0
  14. package/dist/index-B8ywHuC8.js +62579 -0
  15. package/dist/index.d.ts +8 -0
  16. package/dist/index.es-Di2I6Ukg-D4fShinS.js +6622 -0
  17. package/dist/jpeg-CqPRbuRp.js +533 -0
  18. package/dist/lerc-OTtaxyqU.js +1032 -0
  19. package/dist/lzw-DQ6ibF74.js +84 -0
  20. package/dist/main.d.ts +1 -0
  21. package/dist/packbits-BuzK6gM3.js +24 -0
  22. package/dist/pako.esm-Bx5X36Wo.js +1074 -0
  23. package/dist/purify.es-DaUpxO-q-DMHqskJ-.js +552 -0
  24. package/dist/raw-CaSL8pVO.js +9 -0
  25. package/dist/utils/projections.d.ts +5 -0
  26. package/dist/webimage--SJddlky.js +19 -0
  27. package/package.json +2 -3
  28. package/dist/assets/basedecoder-B2c5_Eok.js +0 -1
  29. package/dist/assets/decoder-tqM1uIvc.js +0 -1
  30. package/dist/assets/deflate-B9JhHpvg.js +0 -1
  31. package/dist/assets/html2canvas.esm-C17pzFXx-Bnh1DqN7.js +0 -5
  32. package/dist/assets/index-Bb71PZF_.js +0 -808
  33. package/dist/assets/index.es-Di2I6Ukg-BWbYOQQ8.js +0 -5
  34. package/dist/assets/jpeg-vtRboCKw.js +0 -1
  35. package/dist/assets/lerc-CGvMh4cA.js +0 -1
  36. package/dist/assets/lzw-_aCqfs4w.js +0 -1
  37. package/dist/assets/packbits-DDWKfGV_.js +0 -1
  38. package/dist/assets/pako.esm-Cram60i4.js +0 -1
  39. package/dist/assets/purify.es-DaUpxO-q-B6zaa5rw.js +0 -2
  40. package/dist/assets/raw-in9isEBO.js +0 -1
  41. package/dist/assets/webimage-DBgUwIbt.js +0 -1
  42. package/dist/index.html +0 -14
@@ -1,808 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/raw-in9isEBO.js","assets/basedecoder-B2c5_Eok.js","assets/lzw-_aCqfs4w.js","assets/jpeg-vtRboCKw.js","assets/deflate-B9JhHpvg.js","assets/pako.esm-Cram60i4.js","assets/packbits-DDWKfGV_.js","assets/lerc-CGvMh4cA.js","assets/webimage-DBgUwIbt.js"])))=>i.map(i=>d[i]);
2
- (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();function mv(i){const e=Object.create(null);for(const t of i.split(","))e[t]=1;return t=>t in e}const Ii={},eu=[],Go=()=>{},_S=()=>!1,sm=i=>i.charCodeAt(0)===111&&i.charCodeAt(1)===110&&(i.charCodeAt(2)>122||i.charCodeAt(2)<97),_v=i=>i.startsWith("onUpdate:"),Jn=Object.assign,yv=(i,e)=>{const t=i.indexOf(e);t>-1&&i.splice(t,1)},cR=Object.prototype.hasOwnProperty,pi=(i,e)=>cR.call(i,e),_t=Array.isArray,tu=i=>$d(i)==="[object Map]",om=i=>$d(i)==="[object Set]",uw=i=>$d(i)==="[object Date]",Rt=i=>typeof i=="function",wn=i=>typeof i=="string",to=i=>typeof i=="symbol",Ci=i=>i!==null&&typeof i=="object",yS=i=>(Ci(i)||Rt(i))&&Rt(i.then)&&Rt(i.catch),vS=Object.prototype.toString,$d=i=>vS.call(i),hR=i=>$d(i).slice(8,-1),xS=i=>$d(i)==="[object Object]",vv=i=>wn(i)&&i!=="NaN"&&i[0]!=="-"&&""+parseInt(i,10)===i,qf=mv(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),am=i=>{const e=Object.create(null);return(t=>e[t]||(e[t]=i(t)))},uR=/-\w/g,Nl=am(i=>i.replace(uR,e=>e.slice(1).toUpperCase())),fR=/\B([A-Z])/g,qc=am(i=>i.replace(fR,"-$1").toLowerCase()),wS=am(i=>i.charAt(0).toUpperCase()+i.slice(1)),R1=am(i=>i?`on${wS(i)}`:""),Ml=(i,e)=>!Object.is(i,e),Up=(i,...e)=>{for(let t=0;t<i.length;t++)i[t](...e)},bS=(i,e,t,n=!1)=>{Object.defineProperty(i,e,{configurable:!0,enumerable:!1,writable:n,value:t})},ES=i=>{const e=parseFloat(i);return isNaN(e)?i:e},dR=i=>{const e=wn(i)?Number(i):NaN;return isNaN(e)?i:e};let fw;const lm=()=>fw||(fw=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function ud(i){if(_t(i)){const e={};for(let t=0;t<i.length;t++){const n=i[t],r=wn(n)?_R(n):ud(n);if(r)for(const s in r)e[s]=r[s]}return e}else if(wn(i)||Ci(i))return i}const gR=/;(?![^(]*\))/g,pR=/:([^]+)/,mR=/\/\*[^]*?\*\//g;function _R(i){const e={};return i.replace(mR,"").split(gR).forEach(t=>{if(t){const n=t.split(pR);n.length>1&&(e[n[0].trim()]=n[1].trim())}}),e}function fd(i){let e="";if(wn(i))e=i;else if(_t(i))for(let t=0;t<i.length;t++){const n=fd(i[t]);n&&(e+=n+" ")}else if(Ci(i))for(const t in i)i[t]&&(e+=t+" ");return e.trim()}const yR="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",vR=mv(yR);function SS(i){return!!i||i===""}function xR(i,e){if(i.length!==e.length)return!1;let t=!0;for(let n=0;t&&n<i.length;n++)t=cm(i[n],e[n]);return t}function cm(i,e){if(i===e)return!0;let t=uw(i),n=uw(e);if(t||n)return t&&n?i.getTime()===e.getTime():!1;if(t=to(i),n=to(e),t||n)return i===e;if(t=_t(i),n=_t(e),t||n)return t&&n?xR(i,e):!1;if(t=Ci(i),n=Ci(e),t||n){if(!t||!n)return!1;const r=Object.keys(i).length,s=Object.keys(e).length;if(r!==s)return!1;for(const o in i){const a=i.hasOwnProperty(o),l=e.hasOwnProperty(o);if(a&&!l||!a&&l||!cm(i[o],e[o]))return!1}}return String(i)===String(e)}function wR(i,e){return i.findIndex(t=>cm(t,e))}const TS=i=>!!(i&&i.__v_isRef===!0),hm=i=>wn(i)?i:i==null?"":_t(i)||Ci(i)&&(i.toString===vS||!Rt(i.toString))?TS(i)?hm(i.value):JSON.stringify(i,LS,2):String(i),LS=(i,e)=>TS(e)?LS(i,e.value):tu(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((t,[n,r],s)=>(t[I1(n,s)+" =>"]=r,t),{})}:om(e)?{[`Set(${e.size})`]:[...e.values()].map(t=>I1(t))}:to(e)?I1(e):Ci(e)&&!_t(e)&&!xS(e)?String(e):e,I1=(i,e="")=>{var t;return to(i)?`Symbol(${(t=i.description)!=null?t:e})`:i};let zr;class bR{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=zr,!e&&zr&&(this.index=(zr.scopes||(zr.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){const t=zr;try{return zr=this,e()}finally{zr=t}}}on(){++this._on===1&&(this.prevScope=zr,zr=this)}off(){this._on>0&&--this._on===0&&(zr=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0}}}function ER(){return zr}let ki;const N1=new WeakSet;class CS{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,zr&&zr.active&&zr.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,N1.has(this)&&(N1.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||PS(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,dw(this),MS(this);const e=ki,t=Ks;ki=this,Ks=!0;try{return this.fn()}finally{RS(this),ki=e,Ks=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)bv(e);this.deps=this.depsTail=void 0,dw(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?N1.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){sy(this)&&this.run()}get dirty(){return sy(this)}}let AS=0,Vf,$f;function PS(i,e=!1){if(i.flags|=8,e){i.next=$f,$f=i;return}i.next=Vf,Vf=i}function xv(){AS++}function wv(){if(--AS>0)return;if($f){let e=$f;for($f=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let i;for(;Vf;){let e=Vf;for(Vf=void 0;e;){const t=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(n){i||(i=n)}e=t}}if(i)throw i}function MS(i){for(let e=i.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function RS(i){let e,t=i.depsTail,n=t;for(;n;){const r=n.prevDep;n.version===-1?(n===t&&(t=r),bv(n),SR(n)):e=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=r}i.deps=e,i.depsTail=t}function sy(i){for(let e=i.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(IS(e.dep.computed)||e.dep.version!==e.version))return!0;return!!i._dirty}function IS(i){if(i.flags&4&&!(i.flags&16)||(i.flags&=-17,i.globalVersion===dd)||(i.globalVersion=dd,!i.isSSR&&i.flags&128&&(!i.deps&&!i._dirty||!sy(i))))return;i.flags|=2;const e=i.dep,t=ki,n=Ks;ki=i,Ks=!0;try{MS(i);const r=i.fn(i._value);(e.version===0||Ml(r,i._value))&&(i.flags|=128,i._value=r,e.version++)}catch(r){throw e.version++,r}finally{ki=t,Ks=n,RS(i),i.flags&=-3}}function bv(i,e=!1){const{dep:t,prevSub:n,nextSub:r}=i;if(n&&(n.nextSub=r,i.prevSub=void 0),r&&(r.prevSub=n,i.nextSub=void 0),t.subs===i&&(t.subs=n,!n&&t.computed)){t.computed.flags&=-5;for(let s=t.computed.deps;s;s=s.nextDep)bv(s,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function SR(i){const{prevDep:e,nextDep:t}=i;e&&(e.nextDep=t,i.prevDep=void 0),t&&(t.prevDep=e,i.nextDep=void 0)}let Ks=!0;const NS=[];function Da(){NS.push(Ks),Ks=!1}function ka(){const i=NS.pop();Ks=i===void 0?!0:i}function dw(i){const{cleanup:e}=i;if(i.cleanup=void 0,e){const t=ki;ki=void 0;try{e()}finally{ki=t}}}let dd=0,TR=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}};class Ev{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!ki||!Ks||ki===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==ki)t=this.activeLink=new TR(ki,this),ki.deps?(t.prevDep=ki.depsTail,ki.depsTail.nextDep=t,ki.depsTail=t):ki.deps=ki.depsTail=t,FS(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){const n=t.nextDep;n.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=n),t.prevDep=ki.depsTail,t.nextDep=void 0,ki.depsTail.nextDep=t,ki.depsTail=t,ki.deps===t&&(ki.deps=n)}return t}trigger(e){this.version++,dd++,this.notify(e)}notify(e){xv();try{for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{wv()}}}function FS(i){if(i.dep.sc++,i.sub.flags&4){const e=i.dep.computed;if(e&&!i.dep.subs){e.flags|=20;for(let n=e.deps;n;n=n.nextDep)FS(n)}const t=i.dep.subs;t!==i&&(i.prevSub=t,t&&(t.nextSub=i)),i.dep.subs=i}}const o0=new WeakMap,Ac=Symbol(""),oy=Symbol(""),gd=Symbol("");function xr(i,e,t){if(Ks&&ki){let n=o0.get(i);n||o0.set(i,n=new Map);let r=n.get(t);r||(n.set(t,r=new Ev),r.map=n,r.key=t),r.track()}}function Ma(i,e,t,n,r,s){const o=o0.get(i);if(!o){dd++;return}const a=l=>{l&&l.trigger()};if(xv(),e==="clear")o.forEach(a);else{const l=_t(i),c=l&&vv(t);if(l&&t==="length"){const h=Number(n);o.forEach((u,f)=>{(f==="length"||f===gd||!to(f)&&f>=h)&&a(u)})}else switch((t!==void 0||o.has(void 0))&&a(o.get(t)),c&&a(o.get(gd)),e){case"add":l?c&&a(o.get("length")):(a(o.get(Ac)),tu(i)&&a(o.get(oy)));break;case"delete":l||(a(o.get(Ac)),tu(i)&&a(o.get(oy)));break;case"set":tu(i)&&a(o.get(Ac));break}}wv()}function LR(i,e){const t=o0.get(i);return t&&t.get(e)}function mh(i){const e=li(i);return e===i?e:(xr(e,"iterate",gd),Is(i)?e:e.map(or))}function um(i){return xr(i=li(i),"iterate",gd),i}const CR={__proto__:null,[Symbol.iterator](){return F1(this,Symbol.iterator,or)},concat(...i){return mh(this).concat(...i.map(e=>_t(e)?mh(e):e))},entries(){return F1(this,"entries",i=>(i[1]=or(i[1]),i))},every(i,e){return ga(this,"every",i,e,void 0,arguments)},filter(i,e){return ga(this,"filter",i,e,t=>t.map(or),arguments)},find(i,e){return ga(this,"find",i,e,or,arguments)},findIndex(i,e){return ga(this,"findIndex",i,e,void 0,arguments)},findLast(i,e){return ga(this,"findLast",i,e,or,arguments)},findLastIndex(i,e){return ga(this,"findLastIndex",i,e,void 0,arguments)},forEach(i,e){return ga(this,"forEach",i,e,void 0,arguments)},includes(...i){return O1(this,"includes",i)},indexOf(...i){return O1(this,"indexOf",i)},join(i){return mh(this).join(i)},lastIndexOf(...i){return O1(this,"lastIndexOf",i)},map(i,e){return ga(this,"map",i,e,void 0,arguments)},pop(){return wf(this,"pop")},push(...i){return wf(this,"push",i)},reduce(i,...e){return gw(this,"reduce",i,e)},reduceRight(i,...e){return gw(this,"reduceRight",i,e)},shift(){return wf(this,"shift")},some(i,e){return ga(this,"some",i,e,void 0,arguments)},splice(...i){return wf(this,"splice",i)},toReversed(){return mh(this).toReversed()},toSorted(i){return mh(this).toSorted(i)},toSpliced(...i){return mh(this).toSpliced(...i)},unshift(...i){return wf(this,"unshift",i)},values(){return F1(this,"values",or)}};function F1(i,e,t){const n=um(i),r=n[e]();return n!==i&&!Is(i)&&(r._next=r.next,r.next=()=>{const s=r._next();return s.done||(s.value=t(s.value)),s}),r}const AR=Array.prototype;function ga(i,e,t,n,r,s){const o=um(i),a=o!==i&&!Is(i),l=o[e];if(l!==AR[e]){const u=l.apply(i,s);return a?or(u):u}let c=t;o!==i&&(a?c=function(u,f){return t.call(this,or(u),f,i)}:t.length>2&&(c=function(u,f){return t.call(this,u,f,i)}));const h=l.call(o,c,n);return a&&r?r(h):h}function gw(i,e,t,n){const r=um(i);let s=t;return r!==i&&(Is(i)?t.length>3&&(s=function(o,a,l){return t.call(this,o,a,l,i)}):s=function(o,a,l){return t.call(this,o,or(a),l,i)}),r[e](s,...n)}function O1(i,e,t){const n=li(i);xr(n,"iterate",gd);const r=n[e](...t);return(r===-1||r===!1)&&Lv(t[0])?(t[0]=li(t[0]),n[e](...t)):r}function wf(i,e,t=[]){Da(),xv();const n=li(i)[e].apply(i,t);return wv(),ka(),n}const PR=mv("__proto__,__v_isRef,__isVue"),OS=new Set(Object.getOwnPropertyNames(Symbol).filter(i=>i!=="arguments"&&i!=="caller").map(i=>Symbol[i]).filter(to));function MR(i){to(i)||(i=String(i));const e=li(this);return xr(e,"has",i),e.hasOwnProperty(i)}class DS{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t==="__v_skip")return e.__v_skip;const r=this._isReadonly,s=this._isShallow;if(t==="__v_isReactive")return!r;if(t==="__v_isReadonly")return r;if(t==="__v_isShallow")return s;if(t==="__v_raw")return n===(r?s?jR:jS:s?BS:GS).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const o=_t(e);if(!r){let l;if(o&&(l=CR[t]))return l;if(t==="hasOwnProperty")return MR}const a=Reflect.get(e,t,Yn(e)?e:n);if((to(t)?OS.has(t):PR(t))||(r||xr(e,"get",t),s))return a;if(Yn(a)){const l=o&&vv(t)?a:a.value;return r&&Ci(l)?ly(l):l}return Ci(a)?r?ly(a):Wd(a):a}}class kS extends DS{constructor(e=!1){super(!1,e)}set(e,t,n,r){let s=e[t];if(!this._isShallow){const l=Fl(s);if(!Is(n)&&!Fl(n)&&(s=li(s),n=li(n)),!_t(e)&&Yn(s)&&!Yn(n))return l||(s.value=n),!0}const o=_t(e)&&vv(t)?Number(t)<e.length:pi(e,t),a=Reflect.set(e,t,n,Yn(e)?e:r);return e===li(r)&&(o?Ml(n,s)&&Ma(e,"set",t,n):Ma(e,"add",t,n)),a}deleteProperty(e,t){const n=pi(e,t);e[t];const r=Reflect.deleteProperty(e,t);return r&&n&&Ma(e,"delete",t,void 0),r}has(e,t){const n=Reflect.has(e,t);return(!to(t)||!OS.has(t))&&xr(e,"has",t),n}ownKeys(e){return xr(e,"iterate",_t(e)?"length":Ac),Reflect.ownKeys(e)}}class RR extends DS{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}}const IR=new kS,NR=new RR,FR=new kS(!0);const ay=i=>i,Kg=i=>Reflect.getPrototypeOf(i);function OR(i,e,t){return function(...n){const r=this.__v_raw,s=li(r),o=tu(s),a=i==="entries"||i===Symbol.iterator&&o,l=i==="keys"&&o,c=r[i](...n),h=t?ay:e?a0:or;return!e&&xr(s,"iterate",l?oy:Ac),{next(){const{value:u,done:f}=c.next();return f?{value:u,done:f}:{value:a?[h(u[0]),h(u[1])]:h(u),done:f}},[Symbol.iterator](){return this}}}}function Yg(i){return function(...e){return i==="delete"?!1:i==="clear"?void 0:this}}function DR(i,e){const t={get(r){const s=this.__v_raw,o=li(s),a=li(r);i||(Ml(r,a)&&xr(o,"get",r),xr(o,"get",a));const{has:l}=Kg(o),c=e?ay:i?a0:or;if(l.call(o,r))return c(s.get(r));if(l.call(o,a))return c(s.get(a));s!==o&&s.get(r)},get size(){const r=this.__v_raw;return!i&&xr(li(r),"iterate",Ac),r.size},has(r){const s=this.__v_raw,o=li(s),a=li(r);return i||(Ml(r,a)&&xr(o,"has",r),xr(o,"has",a)),r===a?s.has(r):s.has(r)||s.has(a)},forEach(r,s){const o=this,a=o.__v_raw,l=li(a),c=e?ay:i?a0:or;return!i&&xr(l,"iterate",Ac),a.forEach((h,u)=>r.call(s,c(h),c(u),o))}};return Jn(t,i?{add:Yg("add"),set:Yg("set"),delete:Yg("delete"),clear:Yg("clear")}:{add(r){!e&&!Is(r)&&!Fl(r)&&(r=li(r));const s=li(this);return Kg(s).has.call(s,r)||(s.add(r),Ma(s,"add",r,r)),this},set(r,s){!e&&!Is(s)&&!Fl(s)&&(s=li(s));const o=li(this),{has:a,get:l}=Kg(o);let c=a.call(o,r);c||(r=li(r),c=a.call(o,r));const h=l.call(o,r);return o.set(r,s),c?Ml(s,h)&&Ma(o,"set",r,s):Ma(o,"add",r,s),this},delete(r){const s=li(this),{has:o,get:a}=Kg(s);let l=o.call(s,r);l||(r=li(r),l=o.call(s,r)),a&&a.call(s,r);const c=s.delete(r);return l&&Ma(s,"delete",r,void 0),c},clear(){const r=li(this),s=r.size!==0,o=r.clear();return s&&Ma(r,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(r=>{t[r]=OR(r,i,e)}),t}function Sv(i,e){const t=DR(i,e);return(n,r,s)=>r==="__v_isReactive"?!i:r==="__v_isReadonly"?i:r==="__v_raw"?n:Reflect.get(pi(t,r)&&r in n?t:n,r,s)}const kR={get:Sv(!1,!1)},GR={get:Sv(!1,!0)},BR={get:Sv(!0,!1)};const GS=new WeakMap,BS=new WeakMap,jS=new WeakMap,jR=new WeakMap;function UR(i){switch(i){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function zR(i){return i.__v_skip||!Object.isExtensible(i)?0:UR(hR(i))}function Wd(i){return Fl(i)?i:Tv(i,!1,IR,kR,GS)}function qR(i){return Tv(i,!1,FR,GR,BS)}function ly(i){return Tv(i,!0,NR,BR,jS)}function Tv(i,e,t,n,r){if(!Ci(i)||i.__v_raw&&!(e&&i.__v_isReactive))return i;const s=zR(i);if(s===0)return i;const o=r.get(i);if(o)return o;const a=new Proxy(i,s===2?n:t);return r.set(i,a),a}function iu(i){return Fl(i)?iu(i.__v_raw):!!(i&&i.__v_isReactive)}function Fl(i){return!!(i&&i.__v_isReadonly)}function Is(i){return!!(i&&i.__v_isShallow)}function Lv(i){return i?!!i.__v_raw:!1}function li(i){const e=i&&i.__v_raw;return e?li(e):i}function VR(i){return!pi(i,"__v_skip")&&Object.isExtensible(i)&&bS(i,"__v_skip",!0),i}const or=i=>Ci(i)?Wd(i):i,a0=i=>Ci(i)?ly(i):i;function Yn(i){return i?i.__v_isRef===!0:!1}function Zi(i){return US(i,!1)}function za(i){return US(i,!0)}function US(i,e){return Yn(i)?i:new $R(i,e)}class $R{constructor(e,t){this.dep=new Ev,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:li(e),this._value=t?e:or(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,n=this.__v_isShallow||Is(e)||Fl(e);e=n?e:li(e),Ml(e,t)&&(this._rawValue=e,this._value=n?e:or(e),this.dep.trigger())}}function ji(i){return Yn(i)?i.value:i}const WR={get:(i,e,t)=>e==="__v_raw"?i:ji(Reflect.get(i,e,t)),set:(i,e,t,n)=>{const r=i[e];return Yn(r)&&!Yn(t)?(r.value=t,!0):Reflect.set(i,e,t,n)}};function zS(i){return iu(i)?i:new Proxy(i,WR)}function Hd(i){const e=_t(i)?new Array(i.length):{};for(const t in i)e[t]=XR(i,t);return e}class HR{constructor(e,t,n){this._object=e,this._key=t,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0}get value(){const e=this._object[this._key];return this._value=e===void 0?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return LR(li(this._object),this._key)}}function XR(i,e,t){const n=i[e];return Yn(n)?n:new HR(i,e,t)}class KR{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new Ev(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=dd-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&ki!==this)return PS(this,!0),!0}get value(){const e=this.dep.track();return IS(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function YR(i,e,t=!1){let n,r;return Rt(i)?n=i:(n=i.get,r=i.set),new KR(n,r,t)}const Zg={},l0=new WeakMap;let _c;function ZR(i,e=!1,t=_c){if(t){let n=l0.get(t);n||l0.set(t,n=[]),n.push(i)}}function JR(i,e,t=Ii){const{immediate:n,deep:r,once:s,scheduler:o,augmentJob:a,call:l}=t,c=b=>r?b:Is(b)||r===!1||r===0?Ra(b,1):Ra(b);let h,u,f,d,g=!1,m=!1;if(Yn(i)?(u=()=>i.value,g=Is(i)):iu(i)?(u=()=>c(i),g=!0):_t(i)?(m=!0,g=i.some(b=>iu(b)||Is(b)),u=()=>i.map(b=>{if(Yn(b))return b.value;if(iu(b))return c(b);if(Rt(b))return l?l(b,2):b()})):Rt(i)?e?u=l?()=>l(i,2):i:u=()=>{if(f){Da();try{f()}finally{ka()}}const b=_c;_c=h;try{return l?l(i,3,[d]):i(d)}finally{_c=b}}:u=Go,e&&r){const b=u,A=r===!0?1/0:r;u=()=>Ra(b(),A)}const _=ER(),v=()=>{h.stop(),_&&_.active&&yv(_.effects,h)};if(s&&e){const b=e;e=(...A)=>{b(...A),v()}}let x=m?new Array(i.length).fill(Zg):Zg;const S=b=>{if(!(!(h.flags&1)||!h.dirty&&!b))if(e){const A=h.run();if(r||g||(m?A.some((F,N)=>Ml(F,x[N])):Ml(A,x))){f&&f();const F=_c;_c=h;try{const N=[A,x===Zg?void 0:m&&x[0]===Zg?[]:x,d];x=A,l?l(e,3,N):e(...N)}finally{_c=F}}}else h.run()};return a&&a(S),h=new CS(u),h.scheduler=o?()=>o(S,!1):S,d=b=>ZR(b,!1,h),f=h.onStop=()=>{const b=l0.get(h);if(b){if(l)l(b,4);else for(const A of b)A();l0.delete(h)}},e?n?S(!0):x=h.run():o?o(S.bind(null,!0),!0):h.run(),v.pause=h.pause.bind(h),v.resume=h.resume.bind(h),v.stop=v,v}function Ra(i,e=1/0,t){if(e<=0||!Ci(i)||i.__v_skip||(t=t||new Map,(t.get(i)||0)>=e))return i;if(t.set(i,e),e--,Yn(i))Ra(i.value,e,t);else if(_t(i))for(let n=0;n<i.length;n++)Ra(i[n],e,t);else if(om(i)||tu(i))i.forEach(n=>{Ra(n,e,t)});else if(xS(i)){for(const n in i)Ra(i[n],e,t);for(const n of Object.getOwnPropertySymbols(i))Object.prototype.propertyIsEnumerable.call(i,n)&&Ra(i[n],e,t)}return i}function Xd(i,e,t,n){try{return n?i(...n):i()}catch(r){fm(r,e,t)}}function io(i,e,t,n){if(Rt(i)){const r=Xd(i,e,t,n);return r&&yS(r)&&r.catch(s=>{fm(s,e,t)}),r}if(_t(i)){const r=[];for(let s=0;s<i.length;s++)r.push(io(i[s],e,t,n));return r}}function fm(i,e,t,n=!0){const r=e?e.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||Ii;if(e){let a=e.parent;const l=e.proxy,c=`https://vuejs.org/error-reference/#runtime-${t}`;for(;a;){const h=a.ec;if(h){for(let u=0;u<h.length;u++)if(h[u](i,l,c)===!1)return}a=a.parent}if(s){Da(),Xd(s,null,10,[i,l,c]),ka();return}}QR(i,t,r,n,o)}function QR(i,e,t,n=!0,r=!1){if(r)throw i;console.error(i)}const Nr=[];let Po=-1;const nu=[];let yl=null,Nh=0;const qS=Promise.resolve();let c0=null;function pd(i){const e=c0||qS;return i?e.then(this?i.bind(this):i):e}function eI(i){let e=Po+1,t=Nr.length;for(;e<t;){const n=e+t>>>1,r=Nr[n],s=md(r);s<i||s===i&&r.flags&2?e=n+1:t=n}return e}function Cv(i){if(!(i.flags&1)){const e=md(i),t=Nr[Nr.length-1];!t||!(i.flags&2)&&e>=md(t)?Nr.push(i):Nr.splice(eI(e),0,i),i.flags|=1,VS()}}function VS(){c0||(c0=qS.then(WS))}function tI(i){_t(i)?nu.push(...i):yl&&i.id===-1?yl.splice(Nh+1,0,i):i.flags&1||(nu.push(i),i.flags|=1),VS()}function pw(i,e,t=Po+1){for(;t<Nr.length;t++){const n=Nr[t];if(n&&n.flags&2){if(i&&n.id!==i.uid)continue;Nr.splice(t,1),t--,n.flags&4&&(n.flags&=-2),n(),n.flags&4||(n.flags&=-2)}}}function $S(i){if(nu.length){const e=[...new Set(nu)].sort((t,n)=>md(t)-md(n));if(nu.length=0,yl){yl.push(...e);return}for(yl=e,Nh=0;Nh<yl.length;Nh++){const t=yl[Nh];t.flags&4&&(t.flags&=-2),t.flags&8||t(),t.flags&=-2}yl=null,Nh=0}}const md=i=>i.id==null?i.flags&2?-1:1/0:i.id;function WS(i){try{for(Po=0;Po<Nr.length;Po++){const e=Nr[Po];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Xd(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Po<Nr.length;Po++){const e=Nr[Po];e&&(e.flags&=-2)}Po=-1,Nr.length=0,$S(),c0=null,(Nr.length||nu.length)&&WS()}}let br=null,HS=null;function h0(i){const e=br;return br=i,HS=i&&i.type.__scopeId||null,e}function ba(i,e=br,t){if(!e||i._n)return i;const n=(...r)=>{n._d&&g0(-1);const s=h0(e);let o;try{o=i(...r)}finally{h0(s),n._d&&g0(1)}return o};return n._n=!0,n._c=!0,n._d=!0,n}function iI(i,e){if(br===null)return i;const t=ym(br),n=i.dirs||(i.dirs=[]);for(let r=0;r<e.length;r++){let[s,o,a,l=Ii]=e[r];s&&(Rt(s)&&(s={mounted:s,updated:s}),s.deep&&Ra(o),n.push({dir:s,instance:t,value:o,oldValue:void 0,arg:a,modifiers:l}))}return i}function uc(i,e,t,n){const r=i.dirs,s=e&&e.dirs;for(let o=0;o<r.length;o++){const a=r[o];s&&(a.oldValue=s[o].value);let l=a.dir[n];l&&(Da(),io(l,t,8,[i.el,a,i,e]),ka())}}const nI=Symbol("_vte"),XS=i=>i.__isTeleport,La=Symbol("_leaveCb"),Jg=Symbol("_enterCb");function rI(){const i={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Ji(()=>{i.isMounted=!0}),Av(()=>{i.isUnmounting=!0}),i}const Ts=[Function,Array],KS={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Ts,onEnter:Ts,onAfterEnter:Ts,onEnterCancelled:Ts,onBeforeLeave:Ts,onLeave:Ts,onAfterLeave:Ts,onLeaveCancelled:Ts,onBeforeAppear:Ts,onAppear:Ts,onAfterAppear:Ts,onAppearCancelled:Ts},YS=i=>{const e=i.subTree;return e.component?YS(e.component):e},sI={name:"BaseTransition",props:KS,setup(i,{slots:e}){const t=_m(),n=rI();return()=>{const r=e.default&&QS(e.default(),!0);if(!r||!r.length)return;const s=ZS(r),o=li(i),{mode:a}=o;if(n.isLeaving)return D1(s);const l=mw(s);if(!l)return D1(s);let c=cy(l,o,n,t,u=>c=u);l.type!==wr&&_d(l,c);let h=t.subTree&&mw(t.subTree);if(h&&h.type!==wr&&!wc(h,l)&&YS(t).type!==wr){let u=cy(h,o,n,t);if(_d(h,u),a==="out-in"&&l.type!==wr)return n.isLeaving=!0,u.afterLeave=()=>{n.isLeaving=!1,t.job.flags&8||t.update(),delete u.afterLeave,h=void 0},D1(s);a==="in-out"&&l.type!==wr?u.delayLeave=(f,d,g)=>{const m=JS(n,h);m[String(h.key)]=h,f[La]=()=>{d(),f[La]=void 0,delete c.delayedLeave,h=void 0},c.delayedLeave=()=>{g(),delete c.delayedLeave,h=void 0}}:h=void 0}else h&&(h=void 0);return s}}};function ZS(i){let e=i[0];if(i.length>1){for(const t of i)if(t.type!==wr){e=t;break}}return e}const oI=sI;function JS(i,e){const{leavingVNodes:t}=i;let n=t.get(e.type);return n||(n=Object.create(null),t.set(e.type,n)),n}function cy(i,e,t,n,r){const{appear:s,mode:o,persisted:a=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:h,onEnterCancelled:u,onBeforeLeave:f,onLeave:d,onAfterLeave:g,onLeaveCancelled:m,onBeforeAppear:_,onAppear:v,onAfterAppear:x,onAppearCancelled:S}=e,b=String(i.key),A=JS(t,i),F=(P,O)=>{P&&io(P,n,9,O)},N=(P,O)=>{const L=O[1];F(P,O),_t(P)?P.every(T=>T.length<=1)&&L():P.length<=1&&L()},R={mode:o,persisted:a,beforeEnter(P){let O=l;if(!t.isMounted)if(s)O=_||l;else return;P[La]&&P[La](!0);const L=A[b];L&&wc(i,L)&&L.el[La]&&L.el[La](),F(O,[P])},enter(P){let O=c,L=h,T=u;if(!t.isMounted)if(s)O=v||c,L=x||h,T=S||u;else return;let C=!1;const D=P[Jg]=W=>{C||(C=!0,W?F(T,[P]):F(L,[P]),R.delayedLeave&&R.delayedLeave(),P[Jg]=void 0)};O?N(O,[P,D]):D()},leave(P,O){const L=String(i.key);if(P[Jg]&&P[Jg](!0),t.isUnmounting)return O();F(f,[P]);let T=!1;const C=P[La]=D=>{T||(T=!0,O(),D?F(m,[P]):F(g,[P]),P[La]=void 0,A[L]===i&&delete A[L])};A[L]=i,d?N(d,[P,C]):C()},clone(P){const O=cy(P,e,t,n,r);return r&&r(O),O}};return R}function D1(i){if(dm(i))return i=Ol(i),i.children=null,i}function mw(i){if(!dm(i))return XS(i.type)&&i.children?ZS(i.children):i;if(i.component)return i.component.subTree;const{shapeFlag:e,children:t}=i;if(t){if(e&16)return t[0];if(e&32&&Rt(t.default))return t.default()}}function _d(i,e){i.shapeFlag&6&&i.component?(i.transition=e,_d(i.component.subTree,e)):i.shapeFlag&128?(i.ssContent.transition=e.clone(i.ssContent),i.ssFallback.transition=e.clone(i.ssFallback)):i.transition=e}function QS(i,e=!1,t){let n=[],r=0;for(let s=0;s<i.length;s++){let o=i[s];const a=t==null?o.key:String(t)+String(o.key!=null?o.key:s);o.type===Xn?(o.patchFlag&128&&r++,n=n.concat(QS(o.children,e,a))):(e||o.type!==wr)&&n.push(a!=null?Ol(o,{key:a}):o)}if(r>1)for(let s=0;s<n.length;s++)n[s].patchFlag=-2;return n}function et(i,e){return Rt(i)?Jn({name:i.name},e,{setup:i}):i}function eT(i){i.ids=[i.ids[0]+i.ids[2]+++"-",0,0]}const u0=new WeakMap;function Wf(i,e,t,n,r=!1){if(_t(i)){i.forEach((g,m)=>Wf(g,e&&(_t(e)?e[m]:e),t,n,r));return}if(ru(n)&&!r){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&Wf(i,e,t,n.component.subTree);return}const s=n.shapeFlag&4?ym(n.component):n.el,o=r?null:s,{i:a,r:l}=i,c=e&&e.r,h=a.refs===Ii?a.refs={}:a.refs,u=a.setupState,f=li(u),d=u===Ii?_S:g=>pi(f,g);if(c!=null&&c!==l){if(_w(e),wn(c))h[c]=null,d(c)&&(u[c]=null);else if(Yn(c)){c.value=null;const g=e;g.k&&(h[g.k]=null)}}if(Rt(l))Xd(l,a,12,[o,h]);else{const g=wn(l),m=Yn(l);if(g||m){const _=()=>{if(i.f){const v=g?d(l)?u[l]:h[l]:l.value;if(r)_t(v)&&yv(v,s);else if(_t(v))v.includes(s)||v.push(s);else if(g)h[l]=[s],d(l)&&(u[l]=h[l]);else{const x=[s];l.value=x,i.k&&(h[i.k]=x)}}else g?(h[l]=o,d(l)&&(u[l]=o)):m&&(l.value=o,i.k&&(h[i.k]=o))};if(o){const v=()=>{_(),u0.delete(i)};v.id=-1,u0.set(i,v),hs(v,t)}else _w(i),_()}}}function _w(i){const e=u0.get(i);e&&(e.flags|=8,u0.delete(i))}lm().requestIdleCallback;lm().cancelIdleCallback;const ru=i=>!!i.type.__asyncLoader,dm=i=>i.type.__isKeepAlive;function aI(i,e){tT(i,"a",e)}function lI(i,e){tT(i,"da",e)}function tT(i,e,t=Fr){const n=i.__wdc||(i.__wdc=()=>{let r=t;for(;r;){if(r.isDeactivated)return;r=r.parent}return i()});if(gm(e,n,t),t){let r=t.parent;for(;r&&r.parent;)dm(r.parent.vnode)&&cI(n,e,t,r),r=r.parent}}function cI(i,e,t,n){const r=gm(e,i,n,!0);cn(()=>{yv(n[e],r)},t)}function gm(i,e,t=Fr,n=!1){if(t){const r=t[i]||(t[i]=[]),s=e.__weh||(e.__weh=(...o)=>{Da();const a=Kd(t),l=io(e,t,i,o);return a(),ka(),l});return n?r.unshift(s):r.push(s),s}}const qa=i=>(e,t=Fr)=>{(!xd||i==="sp")&&gm(i,(...n)=>e(...n),t)},hI=qa("bm"),Ji=qa("m"),uI=qa("bu"),fI=qa("u"),Av=qa("bum"),cn=qa("um"),dI=qa("sp"),gI=qa("rtg"),pI=qa("rtc");function mI(i,e=Fr){gm("ec",i,e)}const _I=Symbol.for("v-ndc");function f0(i,e,t,n){let r;const s=t,o=_t(i);if(o||wn(i)){const a=o&&iu(i);let l=!1,c=!1;a&&(l=!Is(i),c=Fl(i),i=um(i)),r=new Array(i.length);for(let h=0,u=i.length;h<u;h++)r[h]=e(l?c?a0(or(i[h])):or(i[h]):i[h],h,void 0,s)}else if(typeof i=="number"){r=new Array(i);for(let a=0;a<i;a++)r[a]=e(a+1,a,void 0,s)}else if(Ci(i))if(i[Symbol.iterator])r=Array.from(i,(a,l)=>e(a,l,void 0,s));else{const a=Object.keys(i);r=new Array(a.length);for(let l=0,c=a.length;l<c;l++){const h=a[l];r[l]=e(i[h],h,l,s)}}else r=[];return r}function qt(i,e,t={},n,r){if(br.ce||br.parent&&ru(br.parent)&&br.parent.ce){const c=Object.keys(t).length>0;return vt(),Mr(Xn,null,[Ri("slot",t,n)],c?-2:64)}let s=i[e];s&&s._c&&(s._d=!1),vt();const o=s&&iT(s(t)),a=t.key||o&&o.key,l=Mr(Xn,{key:(a&&!to(a)?a:`_${e}`)+(!o&&n?"_fb":"")},o||[],o&&i._===1?64:-2);return l.scopeId&&(l.slotScopeIds=[l.scopeId+"-s"]),s&&s._c&&(s._d=!0),l}function iT(i){return i.some(e=>vd(e)?!(e.type===wr||e.type===Xn&&!iT(e.children)):!0)?i:null}const hy=i=>i?bT(i)?ym(i):hy(i.parent):null,Hf=Jn(Object.create(null),{$:i=>i,$el:i=>i.vnode.el,$data:i=>i.data,$props:i=>i.props,$attrs:i=>i.attrs,$slots:i=>i.slots,$refs:i=>i.refs,$parent:i=>hy(i.parent),$root:i=>hy(i.root),$host:i=>i.ce,$emit:i=>i.emit,$options:i=>rT(i),$forceUpdate:i=>i.f||(i.f=()=>{Cv(i.update)}),$nextTick:i=>i.n||(i.n=pd.bind(i.proxy)),$watch:i=>BI.bind(i)}),k1=(i,e)=>i!==Ii&&!i.__isScriptSetup&&pi(i,e),yI={get({_:i},e){if(e==="__v_skip")return!0;const{ctx:t,setupState:n,data:r,props:s,accessCache:o,type:a,appContext:l}=i;let c;if(e[0]!=="$"){const d=o[e];if(d!==void 0)switch(d){case 1:return n[e];case 2:return r[e];case 4:return t[e];case 3:return s[e]}else{if(k1(n,e))return o[e]=1,n[e];if(r!==Ii&&pi(r,e))return o[e]=2,r[e];if((c=i.propsOptions[0])&&pi(c,e))return o[e]=3,s[e];if(t!==Ii&&pi(t,e))return o[e]=4,t[e];fy&&(o[e]=0)}}const h=Hf[e];let u,f;if(h)return e==="$attrs"&&xr(i.attrs,"get",""),h(i);if((u=a.__cssModules)&&(u=u[e]))return u;if(t!==Ii&&pi(t,e))return o[e]=4,t[e];if(f=l.config.globalProperties,pi(f,e))return f[e]},set({_:i},e,t){const{data:n,setupState:r,ctx:s}=i;return k1(r,e)?(r[e]=t,!0):n!==Ii&&pi(n,e)?(n[e]=t,!0):pi(i.props,e)||e[0]==="$"&&e.slice(1)in i?!1:(s[e]=t,!0)},has({_:{data:i,setupState:e,accessCache:t,ctx:n,appContext:r,propsOptions:s,type:o}},a){let l,c;return!!(t[a]||i!==Ii&&a[0]!=="$"&&pi(i,a)||k1(e,a)||(l=s[0])&&pi(l,a)||pi(n,a)||pi(Hf,a)||pi(r.config.globalProperties,a)||(c=o.__cssModules)&&c[a])},defineProperty(i,e,t){return t.get!=null?i._.accessCache[e]=0:pi(t,"value")&&this.set(i,e,t.value,null),Reflect.defineProperty(i,e,t)}};function uy(i){return _t(i)?i.reduce((e,t)=>(e[t]=null,e),{}):i}function hr(i,e){const t=uy(i);for(const n in e){if(n.startsWith("__skip"))continue;let r=t[n];r?_t(r)||Rt(r)?r=t[n]={type:r,default:e[n]}:r.default=e[n]:r===null&&(r=t[n]={default:e[n]}),r&&e[`__skip_${n}`]&&(r.skipFactory=!0)}return t}let fy=!0;function vI(i){const e=rT(i),t=i.proxy,n=i.ctx;fy=!1,e.beforeCreate&&yw(e.beforeCreate,i,"bc");const{data:r,computed:s,methods:o,watch:a,provide:l,inject:c,created:h,beforeMount:u,mounted:f,beforeUpdate:d,updated:g,activated:m,deactivated:_,beforeDestroy:v,beforeUnmount:x,destroyed:S,unmounted:b,render:A,renderTracked:F,renderTriggered:N,errorCaptured:R,serverPrefetch:P,expose:O,inheritAttrs:L,components:T,directives:C,filters:D}=e;if(c&&xI(c,n,null),o)for(const B in o){const V=o[B];Rt(V)&&(n[B]=V.bind(t))}if(r){const B=r.call(t,t);Ci(B)&&(i.data=Wd(B))}if(fy=!0,s)for(const B in s){const V=s[B],te=Rt(V)?V.bind(t,t):Rt(V.get)?V.get.bind(t,t):Go,ne=!Rt(V)&&Rt(V.set)?V.set.bind(t):Go,ae=qi({get:te,set:ne});Object.defineProperty(n,B,{enumerable:!0,configurable:!0,get:()=>ae.value,set:I=>ae.value=I})}if(a)for(const B in a)nT(a[B],n,t,B);if(l){const B=Rt(l)?l.call(t):l;Reflect.ownKeys(B).forEach(V=>{fi(V,B[V])})}h&&yw(h,i,"c");function $(B,V){_t(V)?V.forEach(te=>B(te.bind(t))):V&&B(V.bind(t))}if($(hI,u),$(Ji,f),$(uI,d),$(fI,g),$(aI,m),$(lI,_),$(mI,R),$(pI,F),$(gI,N),$(Av,x),$(cn,b),$(dI,P),_t(O))if(O.length){const B=i.exposed||(i.exposed={});O.forEach(V=>{Object.defineProperty(B,V,{get:()=>t[V],set:te=>t[V]=te,enumerable:!0})})}else i.exposed||(i.exposed={});A&&i.render===Go&&(i.render=A),L!=null&&(i.inheritAttrs=L),T&&(i.components=T),C&&(i.directives=C),P&&eT(i)}function xI(i,e,t=Go){_t(i)&&(i=dy(i));for(const n in i){const r=i[n];let s;Ci(r)?"default"in r?s=ft(r.from||n,r.default,!0):s=ft(r.from||n):s=ft(r),Yn(s)?Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:()=>s.value,set:o=>s.value=o}):e[n]=s}}function yw(i,e,t){io(_t(i)?i.map(n=>n.bind(e.proxy)):i.bind(e.proxy),e,t)}function nT(i,e,t,n){let r=n.includes(".")?mT(t,n):()=>t[n];if(wn(i)){const s=e[i];Rt(s)&&ti(r,s)}else if(Rt(i))ti(r,i.bind(t));else if(Ci(i))if(_t(i))i.forEach(s=>nT(s,e,t,n));else{const s=Rt(i.handler)?i.handler.bind(t):e[i.handler];Rt(s)&&ti(r,s,i)}}function rT(i){const e=i.type,{mixins:t,extends:n}=e,{mixins:r,optionsCache:s,config:{optionMergeStrategies:o}}=i.appContext,a=s.get(e);let l;return a?l=a:!r.length&&!t&&!n?l=e:(l={},r.length&&r.forEach(c=>d0(l,c,o,!0)),d0(l,e,o)),Ci(e)&&s.set(e,l),l}function d0(i,e,t,n=!1){const{mixins:r,extends:s}=e;s&&d0(i,s,t,!0),r&&r.forEach(o=>d0(i,o,t,!0));for(const o in e)if(!(n&&o==="expose")){const a=wI[o]||t&&t[o];i[o]=a?a(i[o],e[o]):e[o]}return i}const wI={data:vw,props:xw,emits:xw,methods:Rf,computed:Rf,beforeCreate:Pr,created:Pr,beforeMount:Pr,mounted:Pr,beforeUpdate:Pr,updated:Pr,beforeDestroy:Pr,beforeUnmount:Pr,destroyed:Pr,unmounted:Pr,activated:Pr,deactivated:Pr,errorCaptured:Pr,serverPrefetch:Pr,components:Rf,directives:Rf,watch:EI,provide:vw,inject:bI};function vw(i,e){return e?i?function(){return Jn(Rt(i)?i.call(this,this):i,Rt(e)?e.call(this,this):e)}:e:i}function bI(i,e){return Rf(dy(i),dy(e))}function dy(i){if(_t(i)){const e={};for(let t=0;t<i.length;t++)e[i[t]]=i[t];return e}return i}function Pr(i,e){return i?[...new Set([].concat(i,e))]:e}function Rf(i,e){return i?Jn(Object.create(null),i,e):e}function xw(i,e){return i?_t(i)&&_t(e)?[...new Set([...i,...e])]:Jn(Object.create(null),uy(i),uy(e??{})):e}function EI(i,e){if(!i)return e;if(!e)return i;const t=Jn(Object.create(null),i);for(const n in e)t[n]=Pr(i[n],e[n]);return t}function sT(){return{app:null,config:{isNativeTag:_S,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let SI=0;function TI(i,e){return function(n,r=null){Rt(n)||(n=Jn({},n)),r!=null&&!Ci(r)&&(r=null);const s=sT(),o=new WeakSet,a=[];let l=!1;const c=s.app={_uid:SI++,_component:n,_props:r,_container:null,_context:s,_instance:null,version:a8,get config(){return s.config},set config(h){},use(h,...u){return o.has(h)||(h&&Rt(h.install)?(o.add(h),h.install(c,...u)):Rt(h)&&(o.add(h),h(c,...u))),c},mixin(h){return s.mixins.includes(h)||s.mixins.push(h),c},component(h,u){return u?(s.components[h]=u,c):s.components[h]},directive(h,u){return u?(s.directives[h]=u,c):s.directives[h]},mount(h,u,f){if(!l){const d=c._ceVNode||Ri(n,r);return d.appContext=s,f===!0?f="svg":f===!1&&(f=void 0),i(d,h,f),l=!0,c._container=h,h.__vue_app__=c,ym(d.component)}},onUnmount(h){a.push(h)},unmount(){l&&(io(a,c._instance,16),i(null,c._container),delete c._container.__vue_app__)},provide(h,u){return s.provides[h]=u,c},runWithContext(h){const u=su;su=c;try{return h()}finally{su=u}}};return c}}let su=null;function fi(i,e){if(Fr){let t=Fr.provides;const n=Fr.parent&&Fr.parent.provides;n===t&&(t=Fr.provides=Object.create(n)),t[i]=e}}function ft(i,e,t=!1){const n=_m();if(n||su){let r=su?su._context.provides:n?n.parent==null||n.ce?n.vnode.appContext&&n.vnode.appContext.provides:n.parent.provides:void 0;if(r&&i in r)return r[i];if(arguments.length>1)return t&&Rt(e)?e.call(n&&n.proxy):e}}const oT={},aT=()=>Object.create(oT),lT=i=>Object.getPrototypeOf(i)===oT;function LI(i,e,t,n=!1){const r={},s=aT();i.propsDefaults=Object.create(null),cT(i,e,r,s);for(const o in i.propsOptions[0])o in r||(r[o]=void 0);t?i.props=n?r:qR(r):i.type.props?i.props=r:i.props=s,i.attrs=s}function CI(i,e,t,n){const{props:r,attrs:s,vnode:{patchFlag:o}}=i,a=li(r),[l]=i.propsOptions;let c=!1;if((n||o>0)&&!(o&16)){if(o&8){const h=i.vnode.dynamicProps;for(let u=0;u<h.length;u++){let f=h[u];if(pm(i.emitsOptions,f))continue;const d=e[f];if(l)if(pi(s,f))d!==s[f]&&(s[f]=d,c=!0);else{const g=Nl(f);r[g]=gy(l,a,g,d,i,!1)}else d!==s[f]&&(s[f]=d,c=!0)}}}else{cT(i,e,r,s)&&(c=!0);let h;for(const u in a)(!e||!pi(e,u)&&((h=qc(u))===u||!pi(e,h)))&&(l?t&&(t[u]!==void 0||t[h]!==void 0)&&(r[u]=gy(l,a,u,void 0,i,!0)):delete r[u]);if(s!==a)for(const u in s)(!e||!pi(e,u))&&(delete s[u],c=!0)}c&&Ma(i.attrs,"set","")}function cT(i,e,t,n){const[r,s]=i.propsOptions;let o=!1,a;if(e)for(let l in e){if(qf(l))continue;const c=e[l];let h;r&&pi(r,h=Nl(l))?!s||!s.includes(h)?t[h]=c:(a||(a={}))[h]=c:pm(i.emitsOptions,l)||(!(l in n)||c!==n[l])&&(n[l]=c,o=!0)}if(s){const l=li(t),c=a||Ii;for(let h=0;h<s.length;h++){const u=s[h];t[u]=gy(r,l,u,c[u],i,!pi(c,u))}}return o}function gy(i,e,t,n,r,s){const o=i[t];if(o!=null){const a=pi(o,"default");if(a&&n===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&Rt(l)){const{propsDefaults:c}=r;if(t in c)n=c[t];else{const h=Kd(r);n=c[t]=l.call(null,e),h()}}else n=l;r.ce&&r.ce._setProp(t,n)}o[0]&&(s&&!a?n=!1:o[1]&&(n===""||n===qc(t))&&(n=!0))}return n}const AI=new WeakMap;function hT(i,e,t=!1){const n=t?AI:e.propsCache,r=n.get(i);if(r)return r;const s=i.props,o={},a=[];let l=!1;if(!Rt(i)){const h=u=>{l=!0;const[f,d]=hT(u,e,!0);Jn(o,f),d&&a.push(...d)};!t&&e.mixins.length&&e.mixins.forEach(h),i.extends&&h(i.extends),i.mixins&&i.mixins.forEach(h)}if(!s&&!l)return Ci(i)&&n.set(i,eu),eu;if(_t(s))for(let h=0;h<s.length;h++){const u=Nl(s[h]);ww(u)&&(o[u]=Ii)}else if(s)for(const h in s){const u=Nl(h);if(ww(u)){const f=s[h],d=o[u]=_t(f)||Rt(f)?{type:f}:Jn({},f),g=d.type;let m=!1,_=!0;if(_t(g))for(let v=0;v<g.length;++v){const x=g[v],S=Rt(x)&&x.name;if(S==="Boolean"){m=!0;break}else S==="String"&&(_=!1)}else m=Rt(g)&&g.name==="Boolean";d[0]=m,d[1]=_,(m||pi(d,"default"))&&a.push(u)}}const c=[o,a];return Ci(i)&&n.set(i,c),c}function ww(i){return i[0]!=="$"&&!qf(i)}const Pv=i=>i==="_"||i==="_ctx"||i==="$stable",Mv=i=>_t(i)?i.map(Io):[Io(i)],PI=(i,e,t)=>{if(e._n)return e;const n=ba((...r)=>Mv(e(...r)),t);return n._c=!1,n},uT=(i,e,t)=>{const n=i._ctx;for(const r in i){if(Pv(r))continue;const s=i[r];if(Rt(s))e[r]=PI(r,s,n);else if(s!=null){const o=Mv(s);e[r]=()=>o}}},fT=(i,e)=>{const t=Mv(e);i.slots.default=()=>t},dT=(i,e,t)=>{for(const n in e)(t||!Pv(n))&&(i[n]=e[n])},MI=(i,e,t)=>{const n=i.slots=aT();if(i.vnode.shapeFlag&32){const r=e._;r?(dT(n,e,t),t&&bS(n,"_",r,!0)):uT(e,n)}else e&&fT(i,e)},RI=(i,e,t)=>{const{vnode:n,slots:r}=i;let s=!0,o=Ii;if(n.shapeFlag&32){const a=e._;a?t&&a===1?s=!1:dT(r,e,t):(s=!e.$stable,uT(e,r)),o=e}else e&&(fT(i,e),o={default:1});if(s)for(const a in r)!Pv(a)&&o[a]==null&&delete r[a]},hs=HI;function II(i){return NI(i)}function NI(i,e){const t=lm();t.__VUE__=!0;const{insert:n,remove:r,patchProp:s,createElement:o,createText:a,createComment:l,setText:c,setElementText:h,parentNode:u,nextSibling:f,setScopeId:d=Go,insertStaticContent:g}=i,m=(H,Z,he,j=null,fe=null,Ee=null,Le=void 0,ge=null,Te=!!Z.dynamicChildren)=>{if(H===Z)return;H&&!wc(H,Z)&&(j=ce(H),I(H,fe,Ee,!0),H=null),Z.patchFlag===-2&&(Te=!1,Z.dynamicChildren=null);const{type:_e,ref:Ie,shapeFlag:Se}=Z;switch(_e){case mm:_(H,Z,he,j);break;case wr:v(H,Z,he,j);break;case B1:H==null&&x(Z,he,j,Le);break;case Xn:T(H,Z,he,j,fe,Ee,Le,ge,Te);break;default:Se&1?A(H,Z,he,j,fe,Ee,Le,ge,Te):Se&6?C(H,Z,he,j,fe,Ee,Le,ge,Te):(Se&64||Se&128)&&_e.process(H,Z,he,j,fe,Ee,Le,ge,Te,le)}Ie!=null&&fe?Wf(Ie,H&&H.ref,Ee,Z||H,!Z):Ie==null&&H&&H.ref!=null&&Wf(H.ref,null,Ee,H,!0)},_=(H,Z,he,j)=>{if(H==null)n(Z.el=a(Z.children),he,j);else{const fe=Z.el=H.el;Z.children!==H.children&&c(fe,Z.children)}},v=(H,Z,he,j)=>{H==null?n(Z.el=l(Z.children||""),he,j):Z.el=H.el},x=(H,Z,he,j)=>{[H.el,H.anchor]=g(H.children,Z,he,j,H.el,H.anchor)},S=({el:H,anchor:Z},he,j)=>{let fe;for(;H&&H!==Z;)fe=f(H),n(H,he,j),H=fe;n(Z,he,j)},b=({el:H,anchor:Z})=>{let he;for(;H&&H!==Z;)he=f(H),r(H),H=he;r(Z)},A=(H,Z,he,j,fe,Ee,Le,ge,Te)=>{if(Z.type==="svg"?Le="svg":Z.type==="math"&&(Le="mathml"),H==null)F(Z,he,j,fe,Ee,Le,ge,Te);else{const _e=H.el&&H.el._isVueCE?H.el:null;try{_e&&_e._beginPatch(),P(H,Z,fe,Ee,Le,ge,Te)}finally{_e&&_e._endPatch()}}},F=(H,Z,he,j,fe,Ee,Le,ge)=>{let Te,_e;const{props:Ie,shapeFlag:Se,transition:Ge,dirs:Be}=H;if(Te=H.el=o(H.type,Ee,Ie&&Ie.is,Ie),Se&8?h(Te,H.children):Se&16&&R(H.children,Te,null,j,fe,G1(H,Ee),Le,ge),Be&&uc(H,null,j,"created"),N(Te,H,H.scopeId,Le,j),Ie){for(const Ke in Ie)Ke!=="value"&&!qf(Ke)&&s(Te,Ke,null,Ie[Ke],Ee,j);"value"in Ie&&s(Te,"value",null,Ie.value,Ee),(_e=Ie.onVnodeBeforeMount)&&bo(_e,j,H)}Be&&uc(H,null,j,"beforeMount");const je=FI(fe,Ge);je&&Ge.beforeEnter(Te),n(Te,Z,he),((_e=Ie&&Ie.onVnodeMounted)||je||Be)&&hs(()=>{_e&&bo(_e,j,H),je&&Ge.enter(Te),Be&&uc(H,null,j,"mounted")},fe)},N=(H,Z,he,j,fe)=>{if(he&&d(H,he),j)for(let Ee=0;Ee<j.length;Ee++)d(H,j[Ee]);if(fe){let Ee=fe.subTree;if(Z===Ee||yT(Ee.type)&&(Ee.ssContent===Z||Ee.ssFallback===Z)){const Le=fe.vnode;N(H,Le,Le.scopeId,Le.slotScopeIds,fe.parent)}}},R=(H,Z,he,j,fe,Ee,Le,ge,Te=0)=>{for(let _e=Te;_e<H.length;_e++){const Ie=H[_e]=ge?vl(H[_e]):Io(H[_e]);m(null,Ie,Z,he,j,fe,Ee,Le,ge)}},P=(H,Z,he,j,fe,Ee,Le)=>{const ge=Z.el=H.el;let{patchFlag:Te,dynamicChildren:_e,dirs:Ie}=Z;Te|=H.patchFlag&16;const Se=H.props||Ii,Ge=Z.props||Ii;let Be;if(he&&fc(he,!1),(Be=Ge.onVnodeBeforeUpdate)&&bo(Be,he,Z,H),Ie&&uc(Z,H,he,"beforeUpdate"),he&&fc(he,!0),(Se.innerHTML&&Ge.innerHTML==null||Se.textContent&&Ge.textContent==null)&&h(ge,""),_e?O(H.dynamicChildren,_e,ge,he,j,G1(Z,fe),Ee):Le||V(H,Z,ge,null,he,j,G1(Z,fe),Ee,!1),Te>0){if(Te&16)L(ge,Se,Ge,he,fe);else if(Te&2&&Se.class!==Ge.class&&s(ge,"class",null,Ge.class,fe),Te&4&&s(ge,"style",Se.style,Ge.style,fe),Te&8){const je=Z.dynamicProps;for(let Ke=0;Ke<je.length;Ke++){const Xe=je[Ke],qe=Se[Xe],st=Ge[Xe];(st!==qe||Xe==="value")&&s(ge,Xe,qe,st,fe,he)}}Te&1&&H.children!==Z.children&&h(ge,Z.children)}else!Le&&_e==null&&L(ge,Se,Ge,he,fe);((Be=Ge.onVnodeUpdated)||Ie)&&hs(()=>{Be&&bo(Be,he,Z,H),Ie&&uc(Z,H,he,"updated")},j)},O=(H,Z,he,j,fe,Ee,Le)=>{for(let ge=0;ge<Z.length;ge++){const Te=H[ge],_e=Z[ge],Ie=Te.el&&(Te.type===Xn||!wc(Te,_e)||Te.shapeFlag&198)?u(Te.el):he;m(Te,_e,Ie,null,j,fe,Ee,Le,!0)}},L=(H,Z,he,j,fe)=>{if(Z!==he){if(Z!==Ii)for(const Ee in Z)!qf(Ee)&&!(Ee in he)&&s(H,Ee,Z[Ee],null,fe,j);for(const Ee in he){if(qf(Ee))continue;const Le=he[Ee],ge=Z[Ee];Le!==ge&&Ee!=="value"&&s(H,Ee,ge,Le,fe,j)}"value"in he&&s(H,"value",Z.value,he.value,fe)}},T=(H,Z,he,j,fe,Ee,Le,ge,Te)=>{const _e=Z.el=H?H.el:a(""),Ie=Z.anchor=H?H.anchor:a("");let{patchFlag:Se,dynamicChildren:Ge,slotScopeIds:Be}=Z;Be&&(ge=ge?ge.concat(Be):Be),H==null?(n(_e,he,j),n(Ie,he,j),R(Z.children||[],he,Ie,fe,Ee,Le,ge,Te)):Se>0&&Se&64&&Ge&&H.dynamicChildren?(O(H.dynamicChildren,Ge,he,fe,Ee,Le,ge),(Z.key!=null||fe&&Z===fe.subTree)&&gT(H,Z,!0)):V(H,Z,he,Ie,fe,Ee,Le,ge,Te)},C=(H,Z,he,j,fe,Ee,Le,ge,Te)=>{Z.slotScopeIds=ge,H==null?Z.shapeFlag&512?fe.ctx.activate(Z,he,j,Le,Te):D(Z,he,j,fe,Ee,Le,Te):W(H,Z,Te)},D=(H,Z,he,j,fe,Ee,Le)=>{const ge=H.component=e8(H,j,fe);if(dm(H)&&(ge.ctx.renderer=le),t8(ge,!1,Le),ge.asyncDep){if(fe&&fe.registerDep(ge,$,Le),!H.el){const Te=ge.subTree=Ri(wr);v(null,Te,Z,he),H.placeholder=Te.el}}else $(ge,H,Z,he,fe,Ee,Le)},W=(H,Z,he)=>{const j=Z.component=H.component;if($I(H,Z,he))if(j.asyncDep&&!j.asyncResolved){B(j,Z,he);return}else j.next=Z,j.update();else Z.el=H.el,j.vnode=Z},$=(H,Z,he,j,fe,Ee,Le)=>{const ge=()=>{if(H.isMounted){let{next:Se,bu:Ge,u:Be,parent:je,vnode:Ke}=H;{const Jt=pT(H);if(Jt){Se&&(Se.el=Ke.el,B(H,Se,Le)),Jt.asyncDep.then(()=>{H.isUnmounted||ge()});return}}let Xe=Se,qe;fc(H,!1),Se?(Se.el=Ke.el,B(H,Se,Le)):Se=Ke,Ge&&Up(Ge),(qe=Se.props&&Se.props.onVnodeBeforeUpdate)&&bo(qe,je,Se,Ke),fc(H,!0);const st=Ew(H),$e=H.subTree;H.subTree=st,m($e,st,u($e.el),ce($e),H,fe,Ee),Se.el=st.el,Xe===null&&WI(H,st.el),Be&&hs(Be,fe),(qe=Se.props&&Se.props.onVnodeUpdated)&&hs(()=>bo(qe,je,Se,Ke),fe)}else{let Se;const{el:Ge,props:Be}=Z,{bm:je,m:Ke,parent:Xe,root:qe,type:st}=H,$e=ru(Z);fc(H,!1),je&&Up(je),!$e&&(Se=Be&&Be.onVnodeBeforeMount)&&bo(Se,Xe,Z),fc(H,!0);{qe.ce&&qe.ce._def.shadowRoot!==!1&&qe.ce._injectChildStyle(st);const Jt=H.subTree=Ew(H);m(null,Jt,he,j,H,fe,Ee),Z.el=Jt.el}if(Ke&&hs(Ke,fe),!$e&&(Se=Be&&Be.onVnodeMounted)){const Jt=Z;hs(()=>bo(Se,Xe,Jt),fe)}(Z.shapeFlag&256||Xe&&ru(Xe.vnode)&&Xe.vnode.shapeFlag&256)&&H.a&&hs(H.a,fe),H.isMounted=!0,Z=he=j=null}};H.scope.on();const Te=H.effect=new CS(ge);H.scope.off();const _e=H.update=Te.run.bind(Te),Ie=H.job=Te.runIfDirty.bind(Te);Ie.i=H,Ie.id=H.uid,Te.scheduler=()=>Cv(Ie),fc(H,!0),_e()},B=(H,Z,he)=>{Z.component=H;const j=H.vnode.props;H.vnode=Z,H.next=null,CI(H,Z.props,j,he),RI(H,Z.children,he),Da(),pw(H),ka()},V=(H,Z,he,j,fe,Ee,Le,ge,Te=!1)=>{const _e=H&&H.children,Ie=H?H.shapeFlag:0,Se=Z.children,{patchFlag:Ge,shapeFlag:Be}=Z;if(Ge>0){if(Ge&128){ne(_e,Se,he,j,fe,Ee,Le,ge,Te);return}else if(Ge&256){te(_e,Se,he,j,fe,Ee,Le,ge,Te);return}}Be&8?(Ie&16&&re(_e,fe,Ee),Se!==_e&&h(he,Se)):Ie&16?Be&16?ne(_e,Se,he,j,fe,Ee,Le,ge,Te):re(_e,fe,Ee,!0):(Ie&8&&h(he,""),Be&16&&R(Se,he,j,fe,Ee,Le,ge,Te))},te=(H,Z,he,j,fe,Ee,Le,ge,Te)=>{H=H||eu,Z=Z||eu;const _e=H.length,Ie=Z.length,Se=Math.min(_e,Ie);let Ge;for(Ge=0;Ge<Se;Ge++){const Be=Z[Ge]=Te?vl(Z[Ge]):Io(Z[Ge]);m(H[Ge],Be,he,null,fe,Ee,Le,ge,Te)}_e>Ie?re(H,fe,Ee,!0,!1,Se):R(Z,he,j,fe,Ee,Le,ge,Te,Se)},ne=(H,Z,he,j,fe,Ee,Le,ge,Te)=>{let _e=0;const Ie=Z.length;let Se=H.length-1,Ge=Ie-1;for(;_e<=Se&&_e<=Ge;){const Be=H[_e],je=Z[_e]=Te?vl(Z[_e]):Io(Z[_e]);if(wc(Be,je))m(Be,je,he,null,fe,Ee,Le,ge,Te);else break;_e++}for(;_e<=Se&&_e<=Ge;){const Be=H[Se],je=Z[Ge]=Te?vl(Z[Ge]):Io(Z[Ge]);if(wc(Be,je))m(Be,je,he,null,fe,Ee,Le,ge,Te);else break;Se--,Ge--}if(_e>Se){if(_e<=Ge){const Be=Ge+1,je=Be<Ie?Z[Be].el:j;for(;_e<=Ge;)m(null,Z[_e]=Te?vl(Z[_e]):Io(Z[_e]),he,je,fe,Ee,Le,ge,Te),_e++}}else if(_e>Ge)for(;_e<=Se;)I(H[_e],fe,Ee,!0),_e++;else{const Be=_e,je=_e,Ke=new Map;for(_e=je;_e<=Ge;_e++){const ht=Z[_e]=Te?vl(Z[_e]):Io(Z[_e]);ht.key!=null&&Ke.set(ht.key,_e)}let Xe,qe=0;const st=Ge-je+1;let $e=!1,Jt=0;const Ot=new Array(st);for(_e=0;_e<st;_e++)Ot[_e]=0;for(_e=Be;_e<=Se;_e++){const ht=H[_e];if(qe>=st){I(ht,fe,Ee,!0);continue}let Ut;if(ht.key!=null)Ut=Ke.get(ht.key);else for(Xe=je;Xe<=Ge;Xe++)if(Ot[Xe-je]===0&&wc(ht,Z[Xe])){Ut=Xe;break}Ut===void 0?I(ht,fe,Ee,!0):(Ot[Ut-je]=_e+1,Ut>=Jt?Jt=Ut:$e=!0,m(ht,Z[Ut],he,null,fe,Ee,Le,ge,Te),qe++)}const Lt=$e?OI(Ot):eu;for(Xe=Lt.length-1,_e=st-1;_e>=0;_e--){const ht=je+_e,Ut=Z[ht],ot=Z[ht+1],hi=ht+1<Ie?ot.el||ot.placeholder:j;Ot[_e]===0?m(null,Ut,he,hi,fe,Ee,Le,ge,Te):$e&&(Xe<0||_e!==Lt[Xe]?ae(Ut,he,hi,2):Xe--)}}},ae=(H,Z,he,j,fe=null)=>{const{el:Ee,type:Le,transition:ge,children:Te,shapeFlag:_e}=H;if(_e&6){ae(H.component.subTree,Z,he,j);return}if(_e&128){H.suspense.move(Z,he,j);return}if(_e&64){Le.move(H,Z,he,le);return}if(Le===Xn){n(Ee,Z,he);for(let Se=0;Se<Te.length;Se++)ae(Te[Se],Z,he,j);n(H.anchor,Z,he);return}if(Le===B1){S(H,Z,he);return}if(j!==2&&_e&1&&ge)if(j===0)ge.beforeEnter(Ee),n(Ee,Z,he),hs(()=>ge.enter(Ee),fe);else{const{leave:Se,delayLeave:Ge,afterLeave:Be}=ge,je=()=>{H.ctx.isUnmounted?r(Ee):n(Ee,Z,he)},Ke=()=>{Ee._isLeaving&&Ee[La](!0),Se(Ee,()=>{je(),Be&&Be()})};Ge?Ge(Ee,je,Ke):Ke()}else n(Ee,Z,he)},I=(H,Z,he,j=!1,fe=!1)=>{const{type:Ee,props:Le,ref:ge,children:Te,dynamicChildren:_e,shapeFlag:Ie,patchFlag:Se,dirs:Ge,cacheIndex:Be}=H;if(Se===-2&&(fe=!1),ge!=null&&(Da(),Wf(ge,null,he,H,!0),ka()),Be!=null&&(Z.renderCache[Be]=void 0),Ie&256){Z.ctx.deactivate(H);return}const je=Ie&1&&Ge,Ke=!ru(H);let Xe;if(Ke&&(Xe=Le&&Le.onVnodeBeforeUnmount)&&bo(Xe,Z,H),Ie&6)ie(H.component,he,j);else{if(Ie&128){H.suspense.unmount(he,j);return}je&&uc(H,null,Z,"beforeUnmount"),Ie&64?H.type.remove(H,Z,he,le,j):_e&&!_e.hasOnce&&(Ee!==Xn||Se>0&&Se&64)?re(_e,Z,he,!1,!0):(Ee===Xn&&Se&384||!fe&&Ie&16)&&re(Te,Z,he),j&&U(H)}(Ke&&(Xe=Le&&Le.onVnodeUnmounted)||je)&&hs(()=>{Xe&&bo(Xe,Z,H),je&&uc(H,null,Z,"unmounted")},he)},U=H=>{const{type:Z,el:he,anchor:j,transition:fe}=H;if(Z===Xn){K(he,j);return}if(Z===B1){b(H);return}const Ee=()=>{r(he),fe&&!fe.persisted&&fe.afterLeave&&fe.afterLeave()};if(H.shapeFlag&1&&fe&&!fe.persisted){const{leave:Le,delayLeave:ge}=fe,Te=()=>Le(he,Ee);ge?ge(H.el,Ee,Te):Te()}else Ee()},K=(H,Z)=>{let he;for(;H!==Z;)he=f(H),r(H),H=he;r(Z)},ie=(H,Z,he)=>{const{bum:j,scope:fe,job:Ee,subTree:Le,um:ge,m:Te,a:_e}=H;bw(Te),bw(_e),j&&Up(j),fe.stop(),Ee&&(Ee.flags|=8,I(Le,H,Z,he)),ge&&hs(ge,Z),hs(()=>{H.isUnmounted=!0},Z)},re=(H,Z,he,j=!1,fe=!1,Ee=0)=>{for(let Le=Ee;Le<H.length;Le++)I(H[Le],Z,he,j,fe)},ce=H=>{if(H.shapeFlag&6)return ce(H.component.subTree);if(H.shapeFlag&128)return H.suspense.next();const Z=f(H.anchor||H.el),he=Z&&Z[nI];return he?f(he):Z};let ve=!1;const pe=(H,Z,he)=>{H==null?Z._vnode&&I(Z._vnode,null,null,!0):m(Z._vnode||null,H,Z,null,null,null,he),Z._vnode=H,ve||(ve=!0,pw(),$S(),ve=!1)},le={p:m,um:I,m:ae,r:U,mt:D,mc:R,pc:V,pbc:O,n:ce,o:i};return{render:pe,hydrate:void 0,createApp:TI(pe)}}function G1({type:i,props:e},t){return t==="svg"&&i==="foreignObject"||t==="mathml"&&i==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:t}function fc({effect:i,job:e},t){t?(i.flags|=32,e.flags|=4):(i.flags&=-33,e.flags&=-5)}function FI(i,e){return(!i||i&&!i.pendingBranch)&&e&&!e.persisted}function gT(i,e,t=!1){const n=i.children,r=e.children;if(_t(n)&&_t(r))for(let s=0;s<n.length;s++){const o=n[s];let a=r[s];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=r[s]=vl(r[s]),a.el=o.el),!t&&a.patchFlag!==-2&&gT(o,a)),a.type===mm&&a.patchFlag!==-1&&(a.el=o.el),a.type===wr&&!a.el&&(a.el=o.el)}}function OI(i){const e=i.slice(),t=[0];let n,r,s,o,a;const l=i.length;for(n=0;n<l;n++){const c=i[n];if(c!==0){if(r=t[t.length-1],i[r]<c){e[n]=r,t.push(n);continue}for(s=0,o=t.length-1;s<o;)a=s+o>>1,i[t[a]]<c?s=a+1:o=a;c<i[t[s]]&&(s>0&&(e[n]=t[s-1]),t[s]=n)}}for(s=t.length,o=t[s-1];s-- >0;)t[s]=o,o=e[o];return t}function pT(i){const e=i.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:pT(e)}function bw(i){if(i)for(let e=0;e<i.length;e++)i[e].flags|=8}const DI=Symbol.for("v-scx"),kI=()=>ft(DI);function GI(i,e){return Rv(i,null,e)}function ti(i,e,t){return Rv(i,e,t)}function Rv(i,e,t=Ii){const{immediate:n,deep:r,flush:s,once:o}=t,a=Jn({},t),l=e&&n||!e&&s!=="post";let c;if(xd){if(s==="sync"){const d=kI();c=d.__watcherHandles||(d.__watcherHandles=[])}else if(!l){const d=()=>{};return d.stop=Go,d.resume=Go,d.pause=Go,d}}const h=Fr;a.call=(d,g,m)=>io(d,h,g,m);let u=!1;s==="post"?a.scheduler=d=>{hs(d,h&&h.suspense)}:s!=="sync"&&(u=!0,a.scheduler=(d,g)=>{g?d():Cv(d)}),a.augmentJob=d=>{e&&(d.flags|=4),u&&(d.flags|=2,h&&(d.id=h.uid,d.i=h))};const f=JR(i,e,a);return xd&&(c?c.push(f):l&&f()),f}function BI(i,e,t){const n=this.proxy,r=wn(i)?i.includes(".")?mT(n,i):()=>n[i]:i.bind(n,n);let s;Rt(e)?s=e:(s=e.handler,t=e);const o=Kd(this),a=Rv(r,s.bind(n),t);return o(),a}function mT(i,e){const t=e.split(".");return()=>{let n=i;for(let r=0;r<t.length&&n;r++)n=n[t[r]];return n}}const jI=(i,e)=>e==="modelValue"||e==="model-value"?i.modelModifiers:i[`${e}Modifiers`]||i[`${Nl(e)}Modifiers`]||i[`${qc(e)}Modifiers`];function UI(i,e,...t){if(i.isUnmounted)return;const n=i.vnode.props||Ii;let r=t;const s=e.startsWith("update:"),o=s&&jI(n,e.slice(7));o&&(o.trim&&(r=t.map(h=>wn(h)?h.trim():h)),o.number&&(r=t.map(ES)));let a,l=n[a=R1(e)]||n[a=R1(Nl(e))];!l&&s&&(l=n[a=R1(qc(e))]),l&&io(l,i,6,r);const c=n[a+"Once"];if(c){if(!i.emitted)i.emitted={};else if(i.emitted[a])return;i.emitted[a]=!0,io(c,i,6,r)}}const zI=new WeakMap;function _T(i,e,t=!1){const n=t?zI:e.emitsCache,r=n.get(i);if(r!==void 0)return r;const s=i.emits;let o={},a=!1;if(!Rt(i)){const l=c=>{const h=_T(c,e,!0);h&&(a=!0,Jn(o,h))};!t&&e.mixins.length&&e.mixins.forEach(l),i.extends&&l(i.extends),i.mixins&&i.mixins.forEach(l)}return!s&&!a?(Ci(i)&&n.set(i,null),null):(_t(s)?s.forEach(l=>o[l]=null):Jn(o,s),Ci(i)&&n.set(i,o),o)}function pm(i,e){return!i||!sm(e)?!1:(e=e.slice(2).replace(/Once$/,""),pi(i,e[0].toLowerCase()+e.slice(1))||pi(i,qc(e))||pi(i,e))}function Ew(i){const{type:e,vnode:t,proxy:n,withProxy:r,propsOptions:[s],slots:o,attrs:a,emit:l,render:c,renderCache:h,props:u,data:f,setupState:d,ctx:g,inheritAttrs:m}=i,_=h0(i);let v,x;try{if(t.shapeFlag&4){const b=r||n,A=b;v=Io(c.call(A,b,h,u,d,f,g)),x=a}else{const b=e;v=Io(b.length>1?b(u,{attrs:a,slots:o,emit:l}):b(u,null)),x=e.props?a:qI(a)}}catch(b){Xf.length=0,fm(b,i,1),v=Ri(wr)}let S=v;if(x&&m!==!1){const b=Object.keys(x),{shapeFlag:A}=S;b.length&&A&7&&(s&&b.some(_v)&&(x=VI(x,s)),S=Ol(S,x,!1,!0))}return t.dirs&&(S=Ol(S,null,!1,!0),S.dirs=S.dirs?S.dirs.concat(t.dirs):t.dirs),t.transition&&_d(S,t.transition),v=S,h0(_),v}const qI=i=>{let e;for(const t in i)(t==="class"||t==="style"||sm(t))&&((e||(e={}))[t]=i[t]);return e},VI=(i,e)=>{const t={};for(const n in i)(!_v(n)||!(n.slice(9)in e))&&(t[n]=i[n]);return t};function $I(i,e,t){const{props:n,children:r,component:s}=i,{props:o,children:a,patchFlag:l}=e,c=s.emitsOptions;if(e.dirs||e.transition)return!0;if(t&&l>=0){if(l&1024)return!0;if(l&16)return n?Sw(n,o,c):!!o;if(l&8){const h=e.dynamicProps;for(let u=0;u<h.length;u++){const f=h[u];if(o[f]!==n[f]&&!pm(c,f))return!0}}}else return(r||a)&&(!a||!a.$stable)?!0:n===o?!1:n?o?Sw(n,o,c):!0:!!o;return!1}function Sw(i,e,t){const n=Object.keys(e);if(n.length!==Object.keys(i).length)return!0;for(let r=0;r<n.length;r++){const s=n[r];if(e[s]!==i[s]&&!pm(t,s))return!0}return!1}function WI({vnode:i,parent:e},t){for(;e;){const n=e.subTree;if(n.suspense&&n.suspense.activeBranch===i&&(n.el=i.el),n===i)(i=e.vnode).el=t,e=e.parent;else break}}const yT=i=>i.__isSuspense;function HI(i,e){e&&e.pendingBranch?_t(i)?e.effects.push(...i):e.effects.push(i):tI(i)}const Xn=Symbol.for("v-fgt"),mm=Symbol.for("v-txt"),wr=Symbol.for("v-cmt"),B1=Symbol.for("v-stc"),Xf=[];let ds=null;function vt(i=!1){Xf.push(ds=i?null:[])}function XI(){Xf.pop(),ds=Xf[Xf.length-1]||null}let yd=1;function g0(i,e=!1){yd+=i,i<0&&ds&&e&&(ds.hasOnce=!0)}function vT(i){return i.dynamicChildren=yd>0?ds||eu:null,XI(),yd>0&&ds&&ds.push(i),i}function Yt(i,e,t,n,r,s){return vT(ci(i,e,t,n,r,s,!0))}function Mr(i,e,t,n,r){return vT(Ri(i,e,t,n,r,!0))}function vd(i){return i?i.__v_isVNode===!0:!1}function wc(i,e){return i.type===e.type&&i.key===e.key}const xT=({key:i})=>i??null,zp=({ref:i,ref_key:e,ref_for:t})=>(typeof i=="number"&&(i=""+i),i!=null?wn(i)||Yn(i)||Rt(i)?{i:br,r:i,k:e,f:!!t}:i:null);function ci(i,e=null,t=null,n=0,r=null,s=i===Xn?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:i,props:e,key:e&&xT(e),ref:e&&zp(e),scopeId:HS,slotScopeIds:null,children:t,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:s,patchFlag:n,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:br};return a?(Iv(l,t),s&128&&i.normalize(l)):t&&(l.shapeFlag|=wn(t)?8:16),yd>0&&!o&&ds&&(l.patchFlag>0||s&6)&&l.patchFlag!==32&&ds.push(l),l}const Ri=KI;function KI(i,e=null,t=null,n=0,r=null,s=!1){if((!i||i===_I)&&(i=wr),vd(i)){const a=Ol(i,e,!0);return t&&Iv(a,t),yd>0&&!s&&ds&&(a.shapeFlag&6?ds[ds.indexOf(i)]=a:ds.push(a)),a.patchFlag=-2,a}if(s8(i)&&(i=i.__vccOpts),e){e=YI(e);let{class:a,style:l}=e;a&&!wn(a)&&(e.class=fd(a)),Ci(l)&&(Lv(l)&&!_t(l)&&(l=Jn({},l)),e.style=ud(l))}const o=wn(i)?1:yT(i)?128:XS(i)?64:Ci(i)?4:Rt(i)?2:0;return ci(i,e,t,n,r,o,s,!0)}function YI(i){return i?Lv(i)||lT(i)?Jn({},i):i:null}function Ol(i,e,t=!1,n=!1){const{props:r,ref:s,patchFlag:o,children:a,transition:l}=i,c=e?wT(r||{},e):r,h={__v_isVNode:!0,__v_skip:!0,type:i.type,props:c,key:c&&xT(c),ref:e&&e.ref?t&&s?_t(s)?s.concat(zp(e)):[s,zp(e)]:zp(e):s,scopeId:i.scopeId,slotScopeIds:i.slotScopeIds,children:a,target:i.target,targetStart:i.targetStart,targetAnchor:i.targetAnchor,staticCount:i.staticCount,shapeFlag:i.shapeFlag,patchFlag:e&&i.type!==Xn?o===-1?16:o|16:o,dynamicProps:i.dynamicProps,dynamicChildren:i.dynamicChildren,appContext:i.appContext,dirs:i.dirs,transition:l,component:i.component,suspense:i.suspense,ssContent:i.ssContent&&Ol(i.ssContent),ssFallback:i.ssFallback&&Ol(i.ssFallback),placeholder:i.placeholder,el:i.el,anchor:i.anchor,ctx:i.ctx,ce:i.ce};return l&&n&&_d(h,l.clone(h)),h}function ZI(i=" ",e=0){return Ri(mm,null,i,e)}function Xt(i="",e=!1){return e?(vt(),Mr(wr,null,i)):Ri(wr,null,i)}function Io(i){return i==null||typeof i=="boolean"?Ri(wr):_t(i)?Ri(Xn,null,i.slice()):vd(i)?vl(i):Ri(mm,null,String(i))}function vl(i){return i.el===null&&i.patchFlag!==-1||i.memo?i:Ol(i)}function Iv(i,e){let t=0;const{shapeFlag:n}=i;if(e==null)e=null;else if(_t(e))t=16;else if(typeof e=="object")if(n&65){const r=e.default;r&&(r._c&&(r._d=!1),Iv(i,r()),r._c&&(r._d=!0));return}else{t=32;const r=e._;!r&&!lT(e)?e._ctx=br:r===3&&br&&(br.slots._===1?e._=1:(e._=2,i.patchFlag|=1024))}else Rt(e)?(e={default:e,_ctx:br},t=32):(e=String(e),n&64?(t=16,e=[ZI(e)]):t=8);i.children=e,i.shapeFlag|=t}function wT(...i){const e={};for(let t=0;t<i.length;t++){const n=i[t];for(const r in n)if(r==="class")e.class!==n.class&&(e.class=fd([e.class,n.class]));else if(r==="style")e.style=ud([e.style,n.style]);else if(sm(r)){const s=e[r],o=n[r];o&&s!==o&&!(_t(s)&&s.includes(o))&&(e[r]=s?[].concat(s,o):o)}else r!==""&&(e[r]=n[r])}return e}function bo(i,e,t,n=null){io(i,e,7,[t,n])}const JI=sT();let QI=0;function e8(i,e,t){const n=i.type,r=(e?e.appContext:i.appContext)||JI,s={uid:QI++,vnode:i,type:n,parent:e,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new bR(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(r.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:hT(n,r),emitsOptions:_T(n,r),emit:null,emitted:null,propsDefaults:Ii,inheritAttrs:n.inheritAttrs,ctx:Ii,data:Ii,props:Ii,attrs:Ii,slots:Ii,refs:Ii,setupState:Ii,setupContext:null,suspense:t,suspenseId:t?t.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return s.ctx={_:s},s.root=e?e.root:s,s.emit=UI.bind(null,s),i.ce&&i.ce(s),s}let Fr=null;const _m=()=>Fr||br;let p0,py;{const i=lm(),e=(t,n)=>{let r;return(r=i[t])||(r=i[t]=[]),r.push(n),s=>{r.length>1?r.forEach(o=>o(s)):r[0](s)}};p0=e("__VUE_INSTANCE_SETTERS__",t=>Fr=t),py=e("__VUE_SSR_SETTERS__",t=>xd=t)}const Kd=i=>{const e=Fr;return p0(i),i.scope.on(),()=>{i.scope.off(),p0(e)}},Tw=()=>{Fr&&Fr.scope.off(),p0(null)};function bT(i){return i.vnode.shapeFlag&4}let xd=!1;function t8(i,e=!1,t=!1){e&&py(e);const{props:n,children:r}=i.vnode,s=bT(i);LI(i,n,s,e),MI(i,r,t||e);const o=s?i8(i,e):void 0;return e&&py(!1),o}function i8(i,e){const t=i.type;i.accessCache=Object.create(null),i.proxy=new Proxy(i.ctx,yI);const{setup:n}=t;if(n){Da();const r=i.setupContext=n.length>1?r8(i):null,s=Kd(i),o=Xd(n,i,0,[i.props,r]),a=yS(o);if(ka(),s(),(a||i.sp)&&!ru(i)&&eT(i),a){if(o.then(Tw,Tw),e)return o.then(l=>{Lw(i,l)}).catch(l=>{fm(l,i,0)});i.asyncDep=o}else Lw(i,o)}else ET(i)}function Lw(i,e,t){Rt(e)?i.type.__ssrInlineRender?i.ssrRender=e:i.render=e:Ci(e)&&(i.setupState=zS(e)),ET(i)}function ET(i,e,t){const n=i.type;i.render||(i.render=n.render||Go);{const r=Kd(i);Da();try{vI(i)}finally{ka(),r()}}}const n8={get(i,e){return xr(i,"get",""),i[e]}};function r8(i){const e=t=>{i.exposed=t||{}};return{attrs:new Proxy(i.attrs,n8),slots:i.slots,emit:i.emit,expose:e}}function ym(i){return i.exposed?i.exposeProxy||(i.exposeProxy=new Proxy(zS(VR(i.exposed)),{get(e,t){if(t in e)return e[t];if(t in Hf)return Hf[t](i)},has(e,t){return t in e||t in Hf}})):i.proxy}function s8(i){return Rt(i)&&"__vccOpts"in i}const qi=(i,e)=>YR(i,e,xd);function o8(i,e,t){try{g0(-1);const n=arguments.length;return n===2?Ci(e)&&!_t(e)?vd(e)?Ri(i,null,[e]):Ri(i,e):Ri(i,null,e):(n>3?t=Array.prototype.slice.call(arguments,2):n===3&&vd(t)&&(t=[t]),Ri(i,e,t))}finally{g0(1)}}const a8="3.5.24";let my;const Cw=typeof window<"u"&&window.trustedTypes;if(Cw)try{my=Cw.createPolicy("vue",{createHTML:i=>i})}catch{}const ST=my?i=>my.createHTML(i):i=>i,l8="http://www.w3.org/2000/svg",c8="http://www.w3.org/1998/Math/MathML",Sa=typeof document<"u"?document:null,Aw=Sa&&Sa.createElement("template"),h8={insert:(i,e,t)=>{e.insertBefore(i,t||null)},remove:i=>{const e=i.parentNode;e&&e.removeChild(i)},createElement:(i,e,t,n)=>{const r=e==="svg"?Sa.createElementNS(l8,i):e==="mathml"?Sa.createElementNS(c8,i):t?Sa.createElement(i,{is:t}):Sa.createElement(i);return i==="select"&&n&&n.multiple!=null&&r.setAttribute("multiple",n.multiple),r},createText:i=>Sa.createTextNode(i),createComment:i=>Sa.createComment(i),setText:(i,e)=>{i.nodeValue=e},setElementText:(i,e)=>{i.textContent=e},parentNode:i=>i.parentNode,nextSibling:i=>i.nextSibling,querySelector:i=>Sa.querySelector(i),setScopeId(i,e){i.setAttribute(e,"")},insertStaticContent(i,e,t,n,r,s){const o=t?t.previousSibling:e.lastChild;if(r&&(r===s||r.nextSibling))for(;e.insertBefore(r.cloneNode(!0),t),!(r===s||!(r=r.nextSibling)););else{Aw.innerHTML=ST(n==="svg"?`<svg>${i}</svg>`:n==="mathml"?`<math>${i}</math>`:i);const a=Aw.content;if(n==="svg"||n==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,t)}return[o?o.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}},hl="transition",bf="animation",wd=Symbol("_vtc"),TT={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},u8=Jn({},KS,TT),f8=i=>(i.displayName="Transition",i.props=u8,i),Pw=f8((i,{slots:e})=>o8(oI,d8(i),e)),dc=(i,e=[])=>{_t(i)?i.forEach(t=>t(...e)):i&&i(...e)},Mw=i=>i?_t(i)?i.some(e=>e.length>1):i.length>1:!1;function d8(i){const e={};for(const T in i)T in TT||(e[T]=i[T]);if(i.css===!1)return e;const{name:t="v",type:n,duration:r,enterFromClass:s=`${t}-enter-from`,enterActiveClass:o=`${t}-enter-active`,enterToClass:a=`${t}-enter-to`,appearFromClass:l=s,appearActiveClass:c=o,appearToClass:h=a,leaveFromClass:u=`${t}-leave-from`,leaveActiveClass:f=`${t}-leave-active`,leaveToClass:d=`${t}-leave-to`}=i,g=g8(r),m=g&&g[0],_=g&&g[1],{onBeforeEnter:v,onEnter:x,onEnterCancelled:S,onLeave:b,onLeaveCancelled:A,onBeforeAppear:F=v,onAppear:N=x,onAppearCancelled:R=S}=e,P=(T,C,D,W)=>{T._enterCancelled=W,gc(T,C?h:a),gc(T,C?c:o),D&&D()},O=(T,C)=>{T._isLeaving=!1,gc(T,u),gc(T,d),gc(T,f),C&&C()},L=T=>(C,D)=>{const W=T?N:x,$=()=>P(C,T,D);dc(W,[C,$]),Rw(()=>{gc(C,T?l:s),pa(C,T?h:a),Mw(W)||Iw(C,n,m,$)})};return Jn(e,{onBeforeEnter(T){dc(v,[T]),pa(T,s),pa(T,o)},onBeforeAppear(T){dc(F,[T]),pa(T,l),pa(T,c)},onEnter:L(!1),onAppear:L(!0),onLeave(T,C){T._isLeaving=!0;const D=()=>O(T,C);pa(T,u),T._enterCancelled?(pa(T,f),Ow(T)):(Ow(T),pa(T,f)),Rw(()=>{T._isLeaving&&(gc(T,u),pa(T,d),Mw(b)||Iw(T,n,_,D))}),dc(b,[T,D])},onEnterCancelled(T){P(T,!1,void 0,!0),dc(S,[T])},onAppearCancelled(T){P(T,!0,void 0,!0),dc(R,[T])},onLeaveCancelled(T){O(T),dc(A,[T])}})}function g8(i){if(i==null)return null;if(Ci(i))return[j1(i.enter),j1(i.leave)];{const e=j1(i);return[e,e]}}function j1(i){return dR(i)}function pa(i,e){e.split(/\s+/).forEach(t=>t&&i.classList.add(t)),(i[wd]||(i[wd]=new Set)).add(e)}function gc(i,e){e.split(/\s+/).forEach(n=>n&&i.classList.remove(n));const t=i[wd];t&&(t.delete(e),t.size||(i[wd]=void 0))}function Rw(i){requestAnimationFrame(()=>{requestAnimationFrame(i)})}let p8=0;function Iw(i,e,t,n){const r=i._endId=++p8,s=()=>{r===i._endId&&n()};if(t!=null)return setTimeout(s,t);const{type:o,timeout:a,propCount:l}=m8(i,e);if(!o)return n();const c=o+"end";let h=0;const u=()=>{i.removeEventListener(c,f),s()},f=d=>{d.target===i&&++h>=l&&u()};setTimeout(()=>{h<l&&u()},a+1),i.addEventListener(c,f)}function m8(i,e){const t=window.getComputedStyle(i),n=g=>(t[g]||"").split(", "),r=n(`${hl}Delay`),s=n(`${hl}Duration`),o=Nw(r,s),a=n(`${bf}Delay`),l=n(`${bf}Duration`),c=Nw(a,l);let h=null,u=0,f=0;e===hl?o>0&&(h=hl,u=o,f=s.length):e===bf?c>0&&(h=bf,u=c,f=l.length):(u=Math.max(o,c),h=u>0?o>c?hl:bf:null,f=h?h===hl?s.length:l.length:0);const d=h===hl&&/\b(?:transform|all)(?:,|$)/.test(n(`${hl}Property`).toString());return{type:h,timeout:u,propCount:f,hasTransform:d}}function Nw(i,e){for(;i.length<e.length;)i=i.concat(i);return Math.max(...e.map((t,n)=>Fw(t)+Fw(i[n])))}function Fw(i){return i==="auto"?0:Number(i.slice(0,-1).replace(",","."))*1e3}function Ow(i){return(i?i.ownerDocument:document).body.offsetHeight}function _8(i,e,t){const n=i[wd];n&&(e=(e?[e,...n]:[...n]).join(" ")),e==null?i.removeAttribute("class"):t?i.setAttribute("class",e):i.className=e}const Dw=Symbol("_vod"),y8=Symbol("_vsh"),v8=Symbol(""),x8=/(?:^|;)\s*display\s*:/;function w8(i,e,t){const n=i.style,r=wn(t);let s=!1;if(t&&!r){if(e)if(wn(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();t[a]==null&&qp(n,a,"")}else for(const o in e)t[o]==null&&qp(n,o,"");for(const o in t)o==="display"&&(s=!0),qp(n,o,t[o])}else if(r){if(e!==t){const o=n[v8];o&&(t+=";"+o),n.cssText=t,s=x8.test(t)}}else e&&i.removeAttribute("style");Dw in i&&(i[Dw]=s?n.display:"",i[y8]&&(n.display="none"))}const kw=/\s*!important$/;function qp(i,e,t){if(_t(t))t.forEach(n=>qp(i,e,n));else if(t==null&&(t=""),e.startsWith("--"))i.setProperty(e,t);else{const n=b8(i,e);kw.test(t)?i.setProperty(qc(n),t.replace(kw,""),"important"):i[n]=t}}const Gw=["Webkit","Moz","ms"],U1={};function b8(i,e){const t=U1[e];if(t)return t;let n=Nl(e);if(n!=="filter"&&n in i)return U1[e]=n;n=wS(n);for(let r=0;r<Gw.length;r++){const s=Gw[r]+n;if(s in i)return U1[e]=s}return e}const Bw="http://www.w3.org/1999/xlink";function jw(i,e,t,n,r,s=vR(e)){n&&e.startsWith("xlink:")?t==null?i.removeAttributeNS(Bw,e.slice(6,e.length)):i.setAttributeNS(Bw,e,t):t==null||s&&!SS(t)?i.removeAttribute(e):i.setAttribute(e,s?"":to(t)?String(t):t)}function Uw(i,e,t,n,r){if(e==="innerHTML"||e==="textContent"){t!=null&&(i[e]=e==="innerHTML"?ST(t):t);return}const s=i.tagName;if(e==="value"&&s!=="PROGRESS"&&!s.includes("-")){const a=s==="OPTION"?i.getAttribute("value")||"":i.value,l=t==null?i.type==="checkbox"?"on":"":String(t);(a!==l||!("_value"in i))&&(i.value=l),t==null&&i.removeAttribute(e),i._value=t;return}let o=!1;if(t===""||t==null){const a=typeof i[e];a==="boolean"?t=SS(t):t==null&&a==="string"?(t="",o=!0):a==="number"&&(t=0,o=!0)}try{i[e]=t}catch{}o&&i.removeAttribute(r||e)}function LT(i,e,t,n){i.addEventListener(e,t,n)}function E8(i,e,t,n){i.removeEventListener(e,t,n)}const zw=Symbol("_vei");function S8(i,e,t,n,r=null){const s=i[zw]||(i[zw]={}),o=s[e];if(n&&o)o.value=n;else{const[a,l]=T8(e);if(n){const c=s[e]=A8(n,r);LT(i,a,c,l)}else o&&(E8(i,a,o,l),s[e]=void 0)}}const qw=/(?:Once|Passive|Capture)$/;function T8(i){let e;if(qw.test(i)){e={};let n;for(;n=i.match(qw);)i=i.slice(0,i.length-n[0].length),e[n[0].toLowerCase()]=!0}return[i[2]===":"?i.slice(3):qc(i.slice(2)),e]}let z1=0;const L8=Promise.resolve(),C8=()=>z1||(L8.then(()=>z1=0),z1=Date.now());function A8(i,e){const t=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=t.attached)return;io(P8(n,t.value),e,5,[n])};return t.value=i,t.attached=C8(),t}function P8(i,e){if(_t(e)){const t=i.stopImmediatePropagation;return i.stopImmediatePropagation=()=>{t.call(i),i._stopped=!0},e.map(n=>r=>!r._stopped&&n&&n(r))}else return e}const Vw=i=>i.charCodeAt(0)===111&&i.charCodeAt(1)===110&&i.charCodeAt(2)>96&&i.charCodeAt(2)<123,M8=(i,e,t,n,r,s)=>{const o=r==="svg";e==="class"?_8(i,n,o):e==="style"?w8(i,t,n):sm(e)?_v(e)||S8(i,e,t,n,s):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):R8(i,e,n,o))?(Uw(i,e,n),!i.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&jw(i,e,n,o,s,e!=="value")):i._isVueCE&&(/[A-Z]/.test(e)||!wn(n))?Uw(i,Nl(e),n,s,e):(e==="true-value"?i._trueValue=n:e==="false-value"&&(i._falseValue=n),jw(i,e,n,o))};function R8(i,e,t,n){if(n)return!!(e==="innerHTML"||e==="textContent"||e in i&&Vw(e)&&Rt(t));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&i.tagName==="IFRAME"||e==="form"||e==="list"&&i.tagName==="INPUT"||e==="type"&&i.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const r=i.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return Vw(e)&&wn(t)?!1:e in i}const $w=i=>{const e=i.props["onUpdate:modelValue"]||!1;return _t(e)?t=>Up(e,t):e},q1=Symbol("_assign"),I8={deep:!0,created(i,{value:e,modifiers:{number:t}},n){const r=om(e);LT(i,"change",()=>{const s=Array.prototype.filter.call(i.options,o=>o.selected).map(o=>t?ES(m0(o)):m0(o));i[q1](i.multiple?r?new Set(s):s:s[0]),i._assigning=!0,pd(()=>{i._assigning=!1})}),i[q1]=$w(n)},mounted(i,{value:e}){Ww(i,e)},beforeUpdate(i,e,t){i[q1]=$w(t)},updated(i,{value:e}){i._assigning||Ww(i,e)}};function Ww(i,e){const t=i.multiple,n=_t(e);if(!(t&&!n&&!om(e))){for(let r=0,s=i.options.length;r<s;r++){const o=i.options[r],a=m0(o);if(t)if(n){const l=typeof a;l==="string"||l==="number"?o.selected=e.some(c=>String(c)===String(a)):o.selected=wR(e,a)>-1}else o.selected=e.has(a);else if(cm(m0(o),e)){i.selectedIndex!==r&&(i.selectedIndex=r);return}}!t&&i.selectedIndex!==-1&&(i.selectedIndex=-1)}}function m0(i){return"_value"in i?i._value:i.value}const N8=Jn({patchProp:M8},h8);let Hw;function F8(){return Hw||(Hw=II(N8))}const O8=((...i)=>{const e=F8().createApp(...i),{mount:t}=e;return e.mount=n=>{const r=k8(n);if(!r)return;const s=e._component;!Rt(s)&&!s.render&&!s.template&&(s.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const o=t(r,!1,D8(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),o},e});function D8(i){if(i instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&i instanceof MathMLElement)return"mathml"}function k8(i){return wn(i)?document.querySelector(i):i}const G8="modulepreload",B8=function(i){return"/"+i},Xw={},Ys=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let l=function(c){return Promise.all(c.map(h=>Promise.resolve(h).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=o?.nonce||o?.getAttribute("nonce");r=l(t.map(c=>{if(c=B8(c),c in Xw)return;Xw[c]=!0;const h=c.endsWith(".css"),u=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const f=document.createElement("link");if(f.rel=h?"stylesheet":G8,h||(f.as="script"),f.crossOrigin="",f.href=c,a&&f.setAttribute("nonce",a),document.head.appendChild(f),h)return new Promise((d,g)=>{f.addEventListener("load",d),f.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return r.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})},wu={PROPERTYCHANGE:"propertychange"},Qe={CHANGE:"change",ERROR:"error",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",TOUCHMOVE:"touchmove",WHEEL:"wheel"};class Yd{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function j8(i,e,t){let n,r;t=t||Bo;let s=0,o=i.length,a=!1;for(;s<o;)n=s+(o-s>>1),r=+t(i[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}function Bo(i,e){return i>e?1:i<e?-1:0}function CT(i,e){return i<e?1:i>e?-1:0}function vm(i,e,t){if(i[0]<=e)return 0;const n=i.length;if(e<=i[n-1])return n-1;if(typeof t=="function"){for(let r=1;r<n;++r){const s=i[r];if(s===e)return r;if(s<e)return t(e,i[r-1],s)>0?r-1:r}return n-1}if(t>0){for(let r=1;r<n;++r)if(i[r]<e)return r-1;return n-1}if(t<0){for(let r=1;r<n;++r)if(i[r]<=e)return r;return n-1}for(let r=1;r<n;++r){if(i[r]==e)return r;if(i[r]<e)return i[r-1]-e<e-i[r]?r-1:r}return n-1}function U8(i,e,t){for(;e<t;){const n=i[e];i[e]=i[t],i[t]=n,++e,--t}}function ms(i,e){const t=Array.isArray(e)?e:[e],n=t.length;for(let r=0;r<n;r++)i[i.length]=t[r]}function Ho(i,e){const t=i.length;if(t!==e.length)return!1;for(let n=0;n<t;n++)if(i[n]!==e[n])return!1;return!0}function z8(i,e,t){const n=e||Bo;return i.every(function(r,s){if(s===0)return!0;const o=n(i[s-1],r);return!(o>0||o===0)})}function zo(){return!0}function Vc(){return!1}function bd(){}function AT(i){let e,t,n;return function(){const r=Array.prototype.slice.call(arguments);return(!t||this!==n||!Ho(r,t))&&(n=this,t=r,e=i.apply(this,arguments)),e}}function Nv(i){function e(){let t;try{t=i()}catch(n){return Promise.reject(n)}return t instanceof Promise?t:Promise.resolve(t)}return e()}function jl(i){for(const e in i)delete i[e]}function Fc(i){let e;for(e in i)return!1;return!e}class Dr{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class Nu extends Yd{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;const n=this.listeners_||(this.listeners_={}),r=n[e]||(n[e]=[]);r.includes(t)||r.push(t)}dispatchEvent(e){const t=typeof e=="string",n=t?e:e.type,r=this.listeners_&&this.listeners_[n];if(!r)return;const s=t?new Dr(e):e;s.target||(s.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});n in o||(o[n]=0,a[n]=0),++o[n];let l;for(let c=0,h=r.length;c<h;++c)if("handleEvent"in r[c]?l=r[c].handleEvent(s):l=r[c].call(this,s),l===!1||s.propagationStopped){l=!1;break}if(--o[n]===0){let c=a[n];for(delete a[n];c--;)this.removeEventListener(n,bd);delete o[n]}return l}disposeInternal(){this.listeners_&&jl(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){if(!this.listeners_)return;const n=this.listeners_[e];if(!n)return;const r=n.indexOf(t);r!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[r]=bd,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}}function wt(i,e,t,n,r){if(r){const o=t;t=function(a){return i.removeEventListener(e,t),o.call(n??this,a)}}else n&&n!==i&&(t=t.bind(n));const s={target:i,type:e,listener:t};return i.addEventListener(e,t),s}function _0(i,e,t,n){return wt(i,e,t,n,!0)}function Zt(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),jl(i))}class Zd extends Nu{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(Qe.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){const n=e.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=wt(this,e[s],t);return r}return wt(this,e,t)}onceInternal(e,t){let n;if(Array.isArray(e)){const r=e.length;n=new Array(r);for(let s=0;s<r;++s)n[s]=_0(this,e[s],t)}else n=_0(this,e,t);return t.ol_key=n,n}unInternal(e,t){const n=t.ol_key;if(n)Er(n);else if(Array.isArray(e))for(let r=0,s=e.length;r<s;++r)this.removeEventListener(e[r],t);else this.removeEventListener(e,t)}}Zd.prototype.on;Zd.prototype.once;Zd.prototype.un;function Er(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)Zt(i[e]);else Zt(i)}function Kt(){throw new Error("Unimplemented abstract method.")}let q8=0;function Ue(i){return i.ol_uid||(i.ol_uid=String(++q8))}const V8="10.7.0";class Kw extends Dr{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}}class Yr extends Zd{constructor(e){super(),this.on,this.once,this.un,Ue(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(e,t){let n;n=`change:${e}`,this.hasListener(n)&&this.dispatchEvent(new Kw(n,e,t)),n=wu.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new Kw(n,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,n){const r=this.values_||(this.values_={});if(n)r[e]=t;else{const s=r[e];r[e]=t,s!==t&&this.notify(e,s)}}setProperties(e,t){for(const n in e)this.set(n,e[n],t)}applyProperties(e){e.values_&&Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){const n=this.values_[e];delete this.values_[e],Fc(this.values_)&&(this.values_=null),t||this.notify(e,n)}}}function Vt(i,e){if(!i)throw new Error(e)}class wi extends Yr{constructor(e){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),e)if(typeof e.getSimplifiedGeometry=="function"){const t=e;this.setGeometry(t)}else{const t=e;this.setProperties(t)}}clone(){const e=new wi(this.hasProperties()?this.getProperties():null);e.setGeometryName(this.getGeometryName());const t=this.getGeometry();t&&e.setGeometry(t.clone());const n=this.getStyle();return n&&e.setStyle(n),e}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(Zt(this.geometryChangeKey_),this.geometryChangeKey_=null);const e=this.getGeometry();e&&(this.geometryChangeKey_=wt(e,Qe.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?$8(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function $8(i){if(typeof i=="function")return i;let e;return Array.isArray(i)?e=i:(Vt(typeof i.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[i]),function(){return e}}const Wn={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Ui(i){const e=bn();for(let t=0,n=i.length;t<n;++t)Kf(e,i[t]);return e}function W8(i,e,t){const n=Math.min.apply(null,i),r=Math.min.apply(null,e),s=Math.max.apply(null,i),o=Math.max.apply(null,e);return qo(n,r,s,o,t)}function Zn(i,e,t){return t?(t[0]=i[0]-e,t[1]=i[1]-e,t[2]=i[2]+e,t[3]=i[3]+e,t):[i[0]-e,i[1]-e,i[2]+e,i[3]+e]}function PT(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i.slice()}function $c(i,e,t){let n,r;return e<i[0]?n=i[0]-e:i[2]<e?n=e-i[2]:n=0,t<i[1]?r=i[1]-t:i[3]<t?r=t-i[3]:r=0,n*n+r*r}function Hr(i,e){return Fv(i,e[0],e[1])}function gs(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function Fv(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function _y(i,e){const t=i[0],n=i[1],r=i[2],s=i[3],o=e[0],a=e[1];let l=Wn.UNKNOWN;return o<t?l=l|Wn.LEFT:o>r&&(l=l|Wn.RIGHT),a<n?l=l|Wn.BELOW:a>s&&(l=l|Wn.ABOVE),l===Wn.UNKNOWN&&(l=Wn.INTERSECTING),l}function bn(){return[1/0,1/0,-1/0,-1/0]}function qo(i,e,t,n,r){return r?(r[0]=i,r[1]=e,r[2]=t,r[3]=n,r):[i,e,t,n]}function Fu(i){return qo(1/0,1/0,-1/0,-1/0,i)}function ou(i,e){const t=i[0],n=i[1];return qo(t,n,t,n,e)}function Ov(i,e,t,n,r){const s=Fu(r);return MT(s,i,e,t,n)}function Ga(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function H8(i,e,t){return Math.abs(i[0]-e[0])<t&&Math.abs(i[2]-e[2])<t&&Math.abs(i[1]-e[1])<t&&Math.abs(i[3]-e[3])<t}function Pc(i,e){return e[0]<i[0]&&(i[0]=e[0]),e[2]>i[2]&&(i[2]=e[2]),e[1]<i[1]&&(i[1]=e[1]),e[3]>i[3]&&(i[3]=e[3]),i}function Kf(i,e){e[0]<i[0]&&(i[0]=e[0]),e[0]>i[2]&&(i[2]=e[0]),e[1]<i[1]&&(i[1]=e[1]),e[1]>i[3]&&(i[3]=e[1])}function MT(i,e,t,n,r){for(;t<n;t+=r)X8(i,e[t],e[t+1]);return i}function X8(i,e,t){i[0]=Math.min(i[0],e),i[1]=Math.min(i[1],t),i[2]=Math.max(i[2],e),i[3]=Math.max(i[3],t)}function Dv(i,e){let t;return t=e(xm(i)),t||(t=e(wm(i)),t)||(t=e(bm(i)),t)||(t=e(no(i)),t)?t:!1}function Ed(i){let e=0;return Xo(i)||(e=St(i)*Wi(i)),e}function xm(i){return[i[0],i[1]]}function wm(i){return[i[2],i[1]]}function In(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function K8(i,e){let t;if(e==="bottom-left")t=xm(i);else if(e==="bottom-right")t=wm(i);else if(e==="top-left")t=no(i);else if(e==="top-right")t=bm(i);else throw new Error("Invalid corner");return t}function Sd(i,e,t,n,r){const[s,o,a,l,c,h,u,f]=kv(i,e,t,n);return qo(Math.min(s,a,c,u),Math.min(o,l,h,f),Math.max(s,a,c,u),Math.max(o,l,h,f),r)}function kv(i,e,t,n){const r=e*n[0]/2,s=e*n[1]/2,o=Math.cos(t),a=Math.sin(t),l=r*o,c=r*a,h=s*o,u=s*a,f=i[0],d=i[1];return[f-l+u,d-c-h,f-l-u,d-c+h,f+l-u,d+c+h,f+l+u,d+c-h,f-l+u,d-c-h]}function Wi(i){return i[3]-i[1]}function Mn(i,e,t){const n=t||bn();return Ei(i,e)?(i[0]>e[0]?n[0]=i[0]:n[0]=e[0],i[1]>e[1]?n[1]=i[1]:n[1]=e[1],i[2]<e[2]?n[2]=i[2]:n[2]=e[2],i[3]<e[3]?n[3]=i[3]:n[3]=e[3]):Fu(n),n}function no(i){return[i[0],i[3]]}function bm(i){return[i[2],i[3]]}function St(i){return i[2]-i[0]}function Ei(i,e){return i[0]<=e[2]&&i[2]>=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function Xo(i){return i[2]<i[0]||i[3]<i[1]}function Y8(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function Z8(i,e){const t=(i[2]-i[0])/2*(e-1),n=(i[3]-i[1])/2*(e-1);i[0]-=t,i[2]+=t,i[1]-=n,i[3]+=n}function J8(i,e,t){let n=!1;const r=_y(i,e),s=_y(i,t);if(r===Wn.INTERSECTING||s===Wn.INTERSECTING)n=!0;else{const o=i[0],a=i[1],l=i[2],c=i[3],h=e[0],u=e[1],f=t[0],d=t[1],g=(d-u)/(f-h);let m,_;s&Wn.ABOVE&&!(r&Wn.ABOVE)&&(m=f-(d-c)/g,n=m>=o&&m<=l),!n&&s&Wn.RIGHT&&!(r&Wn.RIGHT)&&(_=d-(f-l)*g,n=_>=a&&_<=c),!n&&s&Wn.BELOW&&!(r&Wn.BELOW)&&(m=f-(d-a)/g,n=m>=o&&m<=l),!n&&s&Wn.LEFT&&!(r&Wn.LEFT)&&(_=d-(f-o)*g,n=_>=a&&_<=c)}return n}function bu(i,e,t,n){if(Xo(i))return Fu(t);let r=[];if(n>1){const a=i[2]-i[0],l=i[3]-i[1];for(let c=0;c<n;++c)r.push(i[0]+a*c/n,i[1],i[2],i[1]+l*c/n,i[2]-a*c/n,i[3],i[0],i[3]-l*c/n)}else r=[i[0],i[1],i[2],i[1],i[2],i[3],i[0],i[3]];e(r,r,2);const s=[],o=[];for(let a=0,l=r.length;a<l;a+=2)s.push(r[a]),o.push(r[a+1]);return W8(s,o,t)}function Gv(i,e){const t=e.getExtent(),n=In(i);if(e.canWrapX()&&(n[0]<t[0]||n[0]>=t[2])){const r=St(t),o=Math.floor((n[0]-t[0])/r)*r;i[0]-=o,i[2]-=o}return i}function Bv(i,e,t){if(e.canWrapX()){const n=e.getExtent();if(!isFinite(i[0])||!isFinite(i[2]))return[[n[0],i[1],n[2],i[3]]];Gv(i,e);const r=St(n);if(St(i)>r&&!t)return[[n[0],i[1],n[2],i[3]]];if(i[0]<n[0])return[[i[0]+r,i[1],n[2],i[3]],[n[0],i[1],i[2],i[3]]];if(i[2]>n[2])return[[i[0],i[1],n[2],i[3]],[n[0],i[1],i[2]-r,i[3]]]}return[i]}function RT(...i){console.warn(...i)}function Yw(...i){console.error(...i)}function yt(i,e,t){return Math.min(Math.max(i,e),t)}function IT(i,e,t,n,r,s){const o=r-t,a=s-n;if(o!==0||a!==0){const l=((i-t)*o+(e-n)*a)/(o*o+a*a);l>1?(t=r,n=s):l>0&&(t+=o*l,n+=a*l)}return Ia(i,e,t,n)}function Ia(i,e,t,n){const r=t-i,s=n-e;return r*r+s*s}function Q8(i){const e=i.length;for(let n=0;n<e;n++){let r=n,s=Math.abs(i[n][n]);for(let a=n+1;a<e;a++){const l=Math.abs(i[a][n]);l>s&&(s=l,r=a)}if(s===0)return null;const o=i[r];i[r]=i[n],i[n]=o;for(let a=n+1;a<e;a++){const l=-i[a][n]/i[n][n];for(let c=n;c<e+1;c++)n==c?i[a][c]=0:i[a][c]+=l*i[n][c]}}const t=new Array(e);for(let n=e-1;n>=0;n--){t[n]=i[n][e]/i[n][n];for(let r=n-1;r>=0;r--)i[r][e]-=i[r][n]*t[n]}return t}function y0(i){return i*180/Math.PI}function Zs(i){return i*Math.PI/180}function Js(i,e){const t=i%e;return t*e<0?t+e:t}function us(i,e,t){return i+t*(e-i)}function Ul(i,e){const t=Math.pow(10,e);return Math.round(i*t)/t}function v0(i,e){return Math.round(Ul(i,e))}function qh(i,e){return Math.floor(Ul(i,e))}function wl(i,e){return Math.ceil(Ul(i,e))}function yy(i,e,t){if(i>=e&&i<t)return i;const n=t-e;return((i-e)%n+n)%n+e}function Zw(i,e,t){const n=t!==void 0?i.toFixed(t):""+i;let r=n.indexOf(".");return r=r===-1?n.length:r,r>e?n:new Array(1+e-r).join("0")+n}function jv(i,e){const t=(""+i).split("."),n=(""+e).split(".");for(let r=0;r<Math.max(t.length,n.length);r++){const s=parseInt(t[r]||"0",10),o=parseInt(n[r]||"0",10);if(s>o)return 1;if(o>s)return-1}return 0}function NT(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function e6(i,e){const t=e.getRadius(),n=e.getCenter(),r=n[0],s=n[1],o=i[0],a=i[1];let l=o-r;const c=a-s;l===0&&c===0&&(l=1);const h=Math.sqrt(l*l+c*c),u=r+t*l/h,f=s+t*c/h;return[u,f]}function Em(i,e){const t=i[0],n=i[1],r=e[0],s=e[1],o=r[0],a=r[1],l=s[0],c=s[1],h=l-o,u=c-a,f=h===0&&u===0?0:(h*(t-o)+u*(n-a))/(h*h+u*u||0);let d,g;return f<=0?(d=o,g=a):f>=1?(d=l,g=c):(d=o+f*h,g=a+f*u),[d,g]}function Jw(i,e,t){const n=Js(e+180,360)-180,r=Math.abs(3600*n),s=t||0;let o=Math.floor(r/3600),a=Math.floor((r-o*3600)/60),l=Ul(r-o*3600-a*60,s);l>=60&&(l=0,a+=1),a>=60&&(a=0,o+=1);let c=o+"°";return(a!==0||l!==0)&&(c+=" "+Zw(a,2)+"′"),l!==0&&(c+=" "+Zw(l,2,s)+"″"),n!==0&&(c+=" "+i.charAt(n<0?1:0)),c}function Rr(i,e){let t=!0;for(let n=i.length-1;n>=0;--n)if(i[n]!=e[n]){t=!1;break}return t}function Uv(i,e){const t=Math.cos(e),n=Math.sin(e),r=i[0]*t-i[1]*n,s=i[1]*t+i[0]*n;return i[0]=r,i[1]=s,i}function FT(i,e){return i[0]*=e,i[1]*=e,i}function Na(i,e){const t=i[0]-e[0],n=i[1]-e[1];return t*t+n*n}function Vh(i,e){return Math.sqrt(Na(i,e))}function t6(i,e){return Na(i,Em(i,e))}function zv(i,e){if(e.canWrapX()){const t=St(e.getExtent()),n=OT(i,e,t);n&&(i[0]-=n*t)}return i}function OT(i,e,t){const n=e.getExtent();let r=0;return e.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(t=t||St(n),r=Math.floor((i[0]-n[0])/t)),r}const i6={9001:"m",9002:"ft",9003:"us-ft",9101:"radians",9102:"degrees"};function Qw(i){return i6[i]}const qv={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};let Ba=class{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent!==void 0?e.extent:null,this.worldExtent_=e.worldExtent!==void 0?e.worldExtent:null,this.axisOrientation_=e.axisOrientation!==void 0?e.axisOrientation:"enu",this.global_=e.global!==void 0?e.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||qv[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}};const Jd=6378137,$h=Math.PI*Jd,n6=[-$h,-$h,$h,$h],r6=[-180,-85,180,85],Qg=Jd*Math.log(Math.tan(Math.PI/2));class _h extends Ba{constructor(e){super({code:e,units:"m",extent:n6,global:!0,worldExtent:r6,getPointResolution:function(t,n){return t/Math.cosh(n[1]/Jd)}})}}const eb=[new _h("EPSG:3857"),new _h("EPSG:102100"),new _h("EPSG:102113"),new _h("EPSG:900913"),new _h("http://www.opengis.net/def/crs/EPSG/0/3857"),new _h("http://www.opengis.net/gml/srs/epsg.xml#3857")];function s6(i,e,t,n){const r=i.length;t=t>1?t:2,n=n??t,e===void 0&&(t>2?e=i.slice():e=new Array(r));for(let s=0;s<r;s+=n){e[s]=$h*i[s]/180;let o=Jd*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>Qg?o=Qg:o<-Qg&&(o=-Qg),e[s+1]=o}return e}function o6(i,e,t,n){const r=i.length;t=t>1?t:2,n=n??t,e===void 0&&(t>2?e=i.slice():e=new Array(r));for(let s=0;s<r;s+=n)e[s]=180*i[s]/$h,e[s+1]=360*Math.atan(Math.exp(i[s+1]/Jd))/Math.PI-90;return e}const a6=6378137,tb=[-180,-90,180,90],l6=Math.PI*a6/180;class pc extends Ba{constructor(e,t){super({code:e,units:"degrees",extent:tb,axisOrientation:t,global:!0,metersPerUnit:l6,worldExtent:tb})}}const ib=[new pc("CRS:84"),new pc("EPSG:4326","neu"),new pc("urn:ogc:def:crs:OGC:1.3:CRS84"),new pc("urn:ogc:def:crs:OGC:2:84"),new pc("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new pc("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new pc("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let vy={};function Vp(i){return vy[i]||vy[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function c6(i,e){vy[i]=e}let au={};function Oc(i,e,t){const n=i.getCode(),r=e.getCode();n in au||(au[n]={}),au[n][r]=t}function $p(i,e){return i in au&&e in au[i]?au[i][e]:null}const x0=.9996,Ns=.00669438,Sm=Ns*Ns,Tm=Sm*Ns,Sc=Ns/(1-Ns),nb=Math.sqrt(1-Ns),Eu=(1-nb)/(1+nb),DT=Eu*Eu,Vv=DT*Eu,$v=Vv*Eu,kT=$v*Eu,GT=1-Ns/4-3*Sm/64-5*Tm/256,h6=3*Ns/8+3*Sm/32+45*Tm/1024,u6=15*Sm/256+45*Tm/1024,f6=35*Tm/3072,d6=3/2*Eu-27/32*Vv+269/512*kT,g6=21/16*DT-55/32*$v,p6=151/96*Vv-417/128*kT,m6=1097/512*$v,w0=6378137;function _6(i,e,t){const n=i-5e5,o=(t.north?e:e-1e7)/x0/(w0*GT),a=o+d6*Math.sin(2*o)+g6*Math.sin(4*o)+p6*Math.sin(6*o)+m6*Math.sin(8*o),l=Math.sin(a),c=l*l,h=Math.cos(a),u=l/h,f=u*u,d=f*f,g=1-Ns*c,m=Math.sqrt(1-Ns*c),_=w0/m,v=(1-Ns)/g,x=Sc*h**2,S=x*x,b=n/(_*x0),A=b*b,F=A*b,N=F*b,R=N*b,P=R*b,O=a-u/v*(A/2-N/24*(5+3*f+10*x-4*S-9*Sc))+P/720*(61+90*f+298*x+45*d-252*Sc-3*S);let L=(b-F/6*(1+2*f+x)+R/120*(5-2*x+28*f-3*S+8*Sc+24*d))/h;return L=yy(L+Zs(BT(t.number)),-Math.PI,Math.PI),[y0(L),y0(O)]}const rb=-80,sb=84,y6=-180,v6=180;function x6(i,e,t){i=yy(i,y6,v6),e<rb?e=rb:e>sb&&(e=sb);const n=Zs(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,c=Zs(i),h=BT(t.number),u=Zs(h),f=w0/Math.sqrt(1-Ns*r**2),d=Sc*s**2,g=s*yy(c-u,-Math.PI,Math.PI),m=g*g,_=m*g,v=_*g,x=v*g,S=x*g,b=w0*(GT*n-h6*Math.sin(2*n)+u6*Math.sin(4*n)-f6*Math.sin(6*n)),A=x0*f*(g+_/6*(1-a+d)+x/120*(5-18*a+l+72*d-58*Sc))+5e5;let F=x0*(b+f*o*(m/2+v/24*(5-a+9*d+4*d**2)+S/720*(61-58*a+l+600*d-330*Sc)));return t.north||(F+=1e7),[A,F]}function BT(i){return(i-1)*6-180+3}const w6=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function jT(i){let e=0;for(const r of w6){const s=i.match(r);if(s){e=parseInt(s[1]);break}}if(!e)return null;let t=0,n=!1;return e>32700&&e<32761?t=e-32700:e>32600&&e<32661&&(n=!0,t=e-32600),t?{number:t,north:n}:null}function ob(i,e){return function(t,n,r,s){const o=t.length;r=r>1?r:2,s=s??r,n||(r>2?n=t.slice():n=new Array(o));for(let a=0;a<o;a+=s){const l=t[a],c=t[a+1],h=i(l,c,e);n[a]=h[0],n[a+1]=h[1]}return n}}function b6(i){return jT(i)?new Ba({code:i,units:"m"}):null}function E6(i){const e=jT(i.getCode());return e?{forward:ob(x6,e),inverse:ob(_6,e)}:null}const UT=63710088e-1;function Td(i,e,t){t=t||UT;const n=Zs(i[1]),r=Zs(e[1]),s=(r-n)/2,o=Zs(e[0]-i[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(r);return 2*t*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function S6(i,e,t,n){n=n||UT;const r=Zs(i[1]),s=Zs(i[0]),o=e/n,a=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(t)),l=s+Math.atan2(Math.sin(t)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(a));return[y0(l),y0(a)]}const T6=[E6],L6=[b6];let xy=!0;function C6(i){xy=!1}function Wv(i,e){if(e!==void 0){for(let t=0,n=i.length;t<n;++t)e[t]=i[t];e=e}else e=i.slice();return e}function A6(i,e){if(e!==void 0&&i!==e){for(let t=0,n=i.length;t<n;++t)e[t]=i[t];i=e}return i}function b0(i){c6(i.getCode(),i),Oc(i,i,Wv)}function P6(i){i.forEach(b0)}function Mt(i){if(typeof i!="string")return i;const e=Vp(i);if(e)return e;for(const t of L6){const n=t(i);if(n)return n}return null}function ab(i,e,t,n){i=Mt(i);let r;const s=i.getPointResolutionFunc();if(s)r=s(e,t);else{const o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")r=e;else{const a=Wc(i,Mt("EPSG:4326"));if(!a&&o!=="degrees")r=e*i.getMetersPerUnit();else{let c=[t[0]-e/2,t[1],t[0]+e/2,t[1],t[0],t[1]-e/2,t[0],t[1]+e/2];c=a(c,c,2);const h=Td(c.slice(0,2),c.slice(2,4)),u=Td(c.slice(4,6),c.slice(6,8));r=(h+u)/2}const l=i.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function wy(i){P6(i),i.forEach(function(e){i.forEach(function(t){e!==t&&Oc(e,t,Wv)})})}function M6(i,e,t,n){i.forEach(function(r){e.forEach(function(s){Oc(r,s,t),Oc(s,r,n)})})}function Hv(i,e){return i?typeof i=="string"?Mt(i):i:Mt(e)}function E0(i){return(function(e,t,n,r){const s=e.length;n=n!==void 0?n:2,r=r??n,t=t!==void 0?t:new Array(s);for(let o=0;o<s;o+=r){const a=i(e.slice(o,o+n)),l=a.length;for(let c=0,h=r;c<h;++c)t[o+c]=c>=l?e[o+c]:a[c]}return t})}function R6(i,e,t,n){const r=Mt(i),s=Mt(e);Oc(r,s,E0(t)),Oc(s,r,E0(n))}function mn(i,e){if(i===e)return!0;const t=i.getUnits()===e.getUnits();return(i.getCode()===e.getCode()||Wc(i,e)===Wv)&&t}function Wc(i,e){const t=i.getCode(),n=e.getCode();let r=$p(t,n);if(r)return r;let s=null,o=null;for(const l of T6)s||(s=l(i)),o||(o=l(e));if(!s&&!o)return null;const a="EPSG:4326";if(o)if(s)r=V1(s.inverse,o.forward);else{const l=$p(t,a);l&&(r=V1(l,o.forward))}else{const l=$p(a,n);l&&(r=V1(s.inverse,l))}return r&&(b0(i),b0(e),Oc(i,e,r)),r}function V1(i,e){return function(t,n,r,s){return n=i(t,n,r,s),e(n,n,r,s)}}function Vo(i,e){const t=Mt(i),n=Mt(e);return Wc(t,n)}function ro(i,e,t){const n=Vo(e,t);if(!n){const r=Mt(e).getCode(),s=Mt(t).getCode();throw new Error(`No transform available between ${r} and ${s}`)}return n(i,void 0,i.length)}function Mc(i,e,t,n){const r=Vo(e,t);return bu(i,r,void 0,n)}let I6=null;function N6(){return I6}function ja(i,e){return i}function Ni(i,e){return xy&&!Rr(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(xy=!1,RT("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i}function Ou(i,e){return i}function ps(i,e){return i}function lb(i,e,t){return function(n){let r,s;if(i.canWrapX()){const o=i.getExtent(),a=St(o);n=n.slice(0),s=OT(n,i,a),s&&(n[0]=n[0]-s*a),n[0]=yt(n[0],o[0],o[2]),n[1]=yt(n[1],o[1],o[3]),r=t(n)}else r=t(n);return s&&e.canWrapX()&&(r[0]+=s*St(e.getExtent())),r}}function F6(){wy(eb),wy(ib),M6(ib,eb,s6,o6)}F6();const Xv=new Array(6);function nn(){return[1,0,0,1,0,0]}function by(i){return Lm(i,1,0,0,1,0,0)}function Ua(i,e){const t=i[0],n=i[1],r=i[2],s=i[3],o=i[4],a=i[5],l=e[0],c=e[1],h=e[2],u=e[3],f=e[4],d=e[5];return i[0]=t*l+r*c,i[1]=n*l+s*c,i[2]=t*h+r*u,i[3]=n*h+s*u,i[4]=t*f+r*d+o,i[5]=n*f+s*d+a,i}function Lm(i,e,t,n,r,s,o){return i[0]=e,i[1]=t,i[2]=n,i[3]=r,i[4]=s,i[5]=o,i}function zT(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i}function Fi(i,e){const t=e[0],n=e[1];return e[0]=i[0]*t+i[2]*n+i[4],e[1]=i[1]*t+i[3]*n+i[5],e}function O6(i,e){const t=Math.cos(e),n=Math.sin(e);return Ua(i,Lm(Xv,t,n,-n,t,0,0))}function Yf(i,e,t){return Ua(i,Lm(Xv,e,0,0,t,0,0))}function Kv(i,e,t){return Ua(i,Lm(Xv,1,0,0,1,e,t))}function _s(i,e,t,n,r,s,o,a){const l=Math.sin(s),c=Math.cos(s);return i[0]=n*c,i[1]=r*l,i[2]=-n*l,i[3]=r*c,i[4]=o*n*c-a*n*l+e,i[5]=o*r*l+a*r*c+t,i}function Su(i,e){const t=D6(e);Vt(t!==0,"Transformation matrix cannot be inverted");const n=e[0],r=e[1],s=e[2],o=e[3],a=e[4],l=e[5];return i[0]=o/t,i[1]=-r/t,i[2]=-s/t,i[3]=n/t,i[4]=(s*l-o*a)/t,i[5]=-(n*l-r*a)/t,i}function D6(i){return i[0]*i[3]-i[1]*i[2]}const k6=[1e5,1e5,1e5,1e5,2,2];function G6(i){return"matrix("+i.join(", ")+")"}function Ey(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function B6(i,e){const t=Ey(i),n=Ey(e);for(let r=0;r<6;++r)if(Math.round((t[r]-n[r])*k6[r])!==0)return!1;return!0}function jo(i,e,t,n,r,s,o){s=s||[],o=o||2;let a=0;for(let l=e;l<t;l+=n){const c=i[l],h=i[l+1];s[a++]=r[0]*c+r[2]*h+r[4],s[a++]=r[1]*c+r[3]*h+r[5];for(let u=2;u<o;u++)s[a++]=i[l+u]}return s&&s.length!=a&&(s.length=a),s}function Yv(i,e,t,n,r,s,o){o=o||[];const a=Math.cos(r),l=Math.sin(r),c=s[0],h=s[1];let u=0;for(let f=e;f<t;f+=n){const d=i[f]-c,g=i[f+1]-h;o[u++]=c+d*a-g*l,o[u++]=h+d*l+g*a;for(let m=f+2;m<f+n;++m)o[u++]=i[m]}return o&&o.length!=u&&(o.length=u),o}function j6(i,e,t,n,r,s,o,a){a=a||[];const l=o[0],c=o[1];let h=0;for(let u=e;u<t;u+=n){const f=i[u]-l,d=i[u+1]-c;a[h++]=l+r*f,a[h++]=c+s*d;for(let g=u+2;g<u+n;++g)a[h++]=i[g]}return a&&a.length!=h&&(a.length=h),a}function U6(i,e,t,n,r,s,o){o=o||[];let a=0;for(let l=e;l<t;l+=n){o[a++]=i[l]+r,o[a++]=i[l+1]+s;for(let c=l+2;c<l+n;++c)o[a++]=i[c]}return o&&o.length!=a&&(o.length=a),o}const cb=nn(),z6=[NaN,NaN];class Zv extends Yr{constructor(){super(),this.extent_=bn(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=AT((e,t,n)=>{if(!n)return this.getSimplifiedGeometry(t);const r=this.clone();return r.applyTransform(n),r.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return Kt()}closestPointXY(e,t,n,r){return Kt()}containsXY(e,t){return this.closestPointXY(e,t,z6,Number.MIN_VALUE)===0}getClosestPoint(e,t){return t=t||[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return Kt()}getExtent(e){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&Fu(t),this.extentRevision_=this.getRevision()}return Y8(this.extent_,e)}rotate(e,t){Kt()}scale(e,t,n){Kt()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return Kt()}getType(){return Kt()}applyTransform(e){Kt()}intersectsExtent(e){return Kt()}translate(e,t){Kt()}transform(e,t){const n=Mt(e),r=n.getUnits()=="tile-pixels"?function(s,o,a){const l=n.getExtent(),c=n.getWorldExtent(),h=Wi(c)/Wi(l);_s(cb,c[0],c[3],h,-h,0,0,0);const u=jo(s,0,s.length,a,cb,o),f=Vo(n,t);return f?f(u,u,a):u}:Vo(n,t);return this.applyTransform(r),this}}class zl extends Zv{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return Ov(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return Kt()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=S0(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){Kt()}setLayout(e,t,n){let r;if(e)r=S0(e);else{for(let s=0;s<n;++s){if(t.length===0){this.layout="XY",this.stride=2;return}t=t[0]}r=t.length,e=q6(r)}this.layout=e,this.stride=r}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(e,t){const n=this.getFlatCoordinates();if(n){const r=this.getStride();Yv(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||(n=In(this.getExtent()));const r=this.getFlatCoordinates();if(r){const s=this.getStride();j6(r,0,r.length,s,e,t,n,r),this.changed()}}translate(e,t){const n=this.getFlatCoordinates();if(n){const r=this.getStride();U6(n,0,n.length,r,e,t,n),this.changed()}}}function q6(i){let e;return i==2?e="XY":i==3?e="XYZ":i==4&&(e="XYZM"),e}function S0(i){let e;return i=="XY"?e=2:i=="XYZ"||i=="XYM"?e=3:i=="XYZM"&&(e=4),e}function V6(i,e,t){const n=i.getFlatCoordinates();if(!n)return null;const r=i.getStride();return jo(n,0,n.length,r,e,t)}function qT(i,e,t,n){let r=0;const s=i[t-n],o=i[t-n+1];let a=0,l=0;for(;e<t;e+=n){const c=i[e]-s,h=i[e+1]-o;r+=l*c-a*h,a=c,l=h}return r/2}function VT(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){const a=t[s];r+=qT(i,e,a,n),e=a}return r}function $6(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){const a=t[s];r+=VT(i,e,a,n),e=a[a.length-1]}return r}function hb(i,e,t,n,r,s,o){const a=i[e],l=i[e+1],c=i[t]-a,h=i[t+1]-l;let u;if(c===0&&h===0)u=e;else{const f=((r-a)*c+(s-l)*h)/(c*c+h*h);if(f>1)u=t;else if(f>0){for(let d=0;d<n;++d)o[d]=us(i[e+d],i[t+d],f);o.length=n;return}else u=e}for(let f=0;f<n;++f)o[f]=i[u+f];o.length=n}function Jv(i,e,t,n,r){let s=i[e],o=i[e+1];for(e+=n;e<t;e+=n){const a=i[e],l=i[e+1],c=Ia(s,o,a,l);c>r&&(r=c),s=a,o=l}return r}function Qv(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){const a=t[s];r=Jv(i,e,a,n,r),e=a}return r}function W6(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){const a=t[s];r=Qv(i,e,a,n,r),e=a[a.length-1]}return r}function ex(i,e,t,n,r,s,o,a,l,c,h){if(e==t)return c;let u,f;if(r===0){if(f=Ia(o,a,i[e],i[e+1]),f<c){for(u=0;u<n;++u)l[u]=i[e+u];return l.length=n,f}return c}h=h||[NaN,NaN];let d=e+n;for(;d<t;)if(hb(i,d-n,d,n,o,a,h),f=Ia(o,a,h[0],h[1]),f<c){for(c=f,u=0;u<n;++u)l[u]=h[u];l.length=n,d+=n}else d+=n*Math.max((Math.sqrt(f)-Math.sqrt(c))/r|0,1);if(s&&(hb(i,t-n,e,n,o,a,h),f=Ia(o,a,h[0],h[1]),f<c)){for(c=f,u=0;u<n;++u)l[u]=h[u];l.length=n}return c}function tx(i,e,t,n,r,s,o,a,l,c,h){h=h||[NaN,NaN];for(let u=0,f=t.length;u<f;++u){const d=t[u];c=ex(i,e,d,n,r,s,o,a,l,c,h),e=d}return c}function H6(i,e,t,n,r,s,o,a,l,c,h){h=h||[NaN,NaN];for(let u=0,f=t.length;u<f;++u){const d=t[u];c=tx(i,e,d,n,r,s,o,a,l,c,h),e=d[d.length-1]}return c}function $T(i,e,t,n){for(let r=0,s=t.length;r<s;++r)i[e++]=t[r];return e}function Cm(i,e,t,n){for(let r=0,s=t.length;r<s;++r){const o=t[r];for(let a=0;a<n;++a)i[e++]=o[a]}return e}function ix(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){const l=Cm(i,e,t[o],n);r[s++]=l,e=l}return r.length=s,r}function X6(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){const l=ix(i,e,t[o],n,r[s]);l.length===0&&(l[0]=e),r[s++]=l,e=l[l.length-1]}return r.length=s,r}function bl(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=e;o<t;o+=n)r[s++]=i.slice(o,o+n);return r.length=s,r}function Ld(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=t.length;o<a;++o){const l=t[o];r[s++]=bl(i,e,l,n,r[s]),e=l}return r.length=s,r}function Sy(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=t.length;o<a;++o){const l=t[o];r[s++]=l.length===1&&l[0]===e?[]:Ld(i,e,l,n,r[s]),e=l[l.length-1]}return r.length=s,r}function Am(i,e,t,n,r,s,o){const a=(t-e)/n;if(a<3){for(;e<t;e+=n)s[o++]=i[e],s[o++]=i[e+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const c=[e,t-n];let h=0;for(;c.length>0;){const u=c.pop(),f=c.pop();let d=0;const g=i[f],m=i[f+1],_=i[u],v=i[u+1];for(let x=f+n;x<u;x+=n){const S=i[x],b=i[x+1],A=IT(S,b,g,m,_,v);A>d&&(h=x,d=A)}d>r&&(l[(h-e)/n]=1,f+n<h&&c.push(f,h),h+n<u&&c.push(h,u))}for(let u=0;u<a;++u)l[u]&&(s[o++]=i[e+u*n],s[o++]=i[e+u*n+1]);return o}function WT(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){const h=t[l];o=Am(i,e,h,n,r,s,o),a.push(o),e=h}return o}function yc(i,e){return e*Math.round(i/e)}function K6(i,e,t,n,r,s,o){if(e==t)return o;let a=yc(i[e],r),l=yc(i[e+1],r);e+=n,s[o++]=a,s[o++]=l;let c,h;do if(c=yc(i[e],r),h=yc(i[e+1],r),e+=n,e==t)return s[o++]=c,s[o++]=h,o;while(c==a&&h==l);for(;e<t;){const u=yc(i[e],r),f=yc(i[e+1],r);if(e+=n,u==c&&f==h)continue;const d=c-a,g=h-l,m=u-a,_=f-l;if(d*_==g*m&&(d<0&&m<d||d==m||d>0&&m>d)&&(g<0&&_<g||g==_||g>0&&_>g)){c=u,h=f;continue}s[o++]=c,s[o++]=h,a=c,l=h,c=u,h=f}return s[o++]=c,s[o++]=h,o}function nx(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){const h=t[l];o=K6(i,e,h,n,r,s,o),a.push(o),e=h}return o}function Y6(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){const h=t[l],u=[];o=nx(i,e,h,n,r,s,o,u),a.push(u),e=h[h.length-1]}return o}class Cd extends zl{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}clone(){return new Cd(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,n,r){return r<$c(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Jv(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ex(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return qT(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return bl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){const t=[];return t.length=Am(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new Cd(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Cm(this.flatCoordinates,0,e,this.stride),this.changed()}}let zi=class HT extends zl{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){const e=new HT(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){const s=this.flatCoordinates,o=Ia(e,t,s[0],s[1]);if(o<r){const a=this.stride;for(let l=0;l<a;++l)n[l]=s[l];return n.length=a,o}return r}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(e){return ou(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return Fv(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=$T(this.flatCoordinates,0,e,this.stride),this.changed()}};function Z6(i,e,t,n,r){return!Dv(r,function(o){return!Tc(i,e,t,n,o[0],o[1])})}function Tc(i,e,t,n,r,s){let o=0,a=i[t-n],l=i[t-n+1];for(;e<t;e+=n){const c=i[e],h=i[e+1];l<=s?h>s&&(c-a)*(s-l)-(r-a)*(h-l)>0&&o++:h<=s&&(c-a)*(s-l)-(r-a)*(h-l)<0&&o--,a=c,l=h}return o!==0}function rx(i,e,t,n,r,s){if(t.length===0||!Tc(i,e,t[0],n,r,s))return!1;for(let o=1,a=t.length;o<a;++o)if(Tc(i,t[o-1],t[o],n,r,s))return!1;return!0}function J6(i,e,t,n,r,s){if(t.length===0)return!1;for(let o=0,a=t.length;o<a;++o){const l=t[o];if(rx(i,e,l,n,r,s))return!0;e=l[l.length-1]}return!1}function sx(i,e,t,n,r,s,o){let a,l,c,h,u,f,d;const g=r[s+1],m=[];for(let x=0,S=t.length;x<S;++x){const b=t[x];for(h=i[b-n],f=i[b-n+1],a=e;a<b;a+=n)u=i[a],d=i[a+1],(g<=f&&d<=g||f<=g&&g<=d)&&(c=(g-f)/(d-f)*(u-h)+h,m.push(c)),h=u,f=d}let _=NaN,v=-1/0;for(m.sort(Bo),h=m[0],a=1,l=m.length;a<l;++a){u=m[a];const x=Math.abs(u-h);x>v&&(c=(h+u)/2,rx(i,e,t,n,c,g)&&(_=c,v=x)),h=u}return isNaN(_)&&(_=r[s]),o?(o.push(_,g,v),o):[_,g,v]}function XT(i,e,t,n,r){let s=[];for(let o=0,a=t.length;o<a;++o){const l=t[o];s=sx(i,e,l,n,r,2*o,s),e=l[l.length-1]}return s}function KT(i,e,t,n,r){let s;for(e+=n;e<t;e+=n)if(s=r(i.slice(e-n,e),i.slice(e,e+n)),s)return s;return!1}function ub(i,e){const[t,n]=i,[r,s]=e,o=((t[0]-r[0])*(r[1]-s[1])-(t[1]-r[1])*(r[0]-s[0]))/((t[0]-n[0])*(r[1]-s[1])-(t[1]-n[1])*(r[0]-s[0])),a=((t[0]-r[0])*(t[1]-n[1])-(t[1]-r[1])*(t[0]-n[0]))/((t[0]-n[0])*(r[1]-s[1])-(t[1]-n[1])*(r[0]-s[0]));if(0<=o&&o<=1&&0<=a&&a<=1)return[t[0]+o*(n[0]-t[0]),t[1]+o*(n[1]-t[1])]}function Pm(i,e,t,n,r,s){return s=s??MT(bn(),i,e,t,n),Ei(r,s)?s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:KT(i,e,t,n,function(o,a){return J8(r,o,a)}):!1}function Q6(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){if(Pm(i,e,t[s],n,r))return!0;e=t[s]}return!1}function YT(i,e,t,n,r){return!!(Pm(i,e,t,n,r)||Tc(i,e,t,n,r[0],r[1])||Tc(i,e,t,n,r[0],r[3])||Tc(i,e,t,n,r[2],r[1])||Tc(i,e,t,n,r[2],r[3]))}function ZT(i,e,t,n,r){if(!YT(i,e,t[0],n,r))return!1;if(t.length===1)return!0;for(let s=1,o=t.length;s<o;++s)if(Z6(i,t[s-1],t[s],n,r)&&!Pm(i,t[s-1],t[s],n,r))return!1;return!0}function eN(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){const a=t[s];if(ZT(i,e,a,n,r))return!0;e=a[a.length-1]}return!1}function tN(i,e,t,n){for(;e<t-n;){for(let r=0;r<n;++r){const s=i[e+r];i[e+r]=i[t-n+r],i[t-n+r]=s}e+=n,t-=n}}function ox(i,e,t,n){let r=0,s=i[t-n],o=i[t-n+1];for(;e<t;e+=n){const a=i[e],l=i[e+1];r+=(a-s)*(l+o),s=a,o=l}return r===0?void 0:r>0}function JT(i,e,t,n,r){r=r!==void 0?r:!1;for(let s=0,o=t.length;s<o;++s){const a=t[s],l=ox(i,e,a,n);if(s===0){if(r&&l||!r&&!l)return!1}else if(r&&!l||!r&&l)return!1;e=a}return!0}function iN(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){const a=t[s];if(!JT(i,e,a,n,r))return!1;a.length&&(e=a[a.length-1])}return!0}function Ty(i,e,t,n,r){r=r!==void 0?r:!1;for(let s=0,o=t.length;s<o;++s){const a=t[s],l=ox(i,e,a,n);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&tN(i,e,a,n),e=a}return e}function fb(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s)e=Ty(i,e,t[s],n,r);return e}function QT(i,e){const t=[];let n=0,r=0,s;for(let o=0,a=e.length;o<a;++o){const l=e[o],c=ox(i,n,l,2);if(s===void 0&&(s=c),c===s)t.push(e.slice(r,o+1));else{if(t.length===0)continue;t[t.length-1].push(e[r])}r=o+1,n=l}return t}class lr extends zl{constructor(e,t,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&n?(this.setFlatCoordinates(t,e),this.ends_=n):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?ms(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const e=new lr(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<$c(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Qv(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),tx(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return rx(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return VT(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),Ty(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,Ld(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const e=In(this.getExtent());this.flatInteriorPoint_=sx(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new zi(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new Cd(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){const e=this.layout,t=this.flatCoordinates,n=this.ends_,r=[];let s=0;for(let o=0,a=n.length;o<a;++o){const l=n[o],c=new Cd(t.slice(s,l),e);r.push(c),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const e=this.flatCoordinates;JT(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=Ty(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){const t=[],n=[];return t.length=nx(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,n),new lr(t,"XY",n)}getType(){return"Polygon"}intersectsExtent(e){return ZT(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);const n=ix(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}}function nN(i,e,t,n){t=t||32;const r=[];for(let s=0;s<t;++s)ms(r,S6(i,e,2*Math.PI*s/t,n));return r.push(r[0],r[1]),new lr(r,"XY",[r.length])}function Wh(i){if(Xo(i))throw new Error("Cannot create polygon from empty extent");const e=i[0],t=i[1],n=i[2],r=i[3],s=[e,t,e,r,n,r,n,t,e,t];return new lr(s,"XY",[s.length])}function rN(i,e,t){e=e||32;const n=i.getStride(),r=i.getLayout(),s=i.getCenter(),o=n*(e+1),a=new Array(o);for(let h=0;h<o;h+=n){a[h]=0,a[h+1]=0;for(let u=2;u<n;u++)a[h+u]=s[u]}const l=[a.length],c=new lr(a,r,l);return sN(c,s,i.getRadius()),c}function sN(i,e,t,n){const r=i.getFlatCoordinates(),s=i.getStride(),o=r.length/s-1,a=0;for(let l=0;l<=o;++l){const c=l*s,h=a+Js(l,o)*2*Math.PI/o;r[c]=e[0]+t*Math.cos(h),r[c+1]=e[1]+t*Math.sin(h)}i.changed()}const en={ACCURACY:"accuracy",ACCURACY_GEOMETRY:"accuracyGeometry",ALTITUDE:"altitude",ALTITUDE_ACCURACY:"altitudeAccuracy",HEADING:"heading",POSITION:"position",PROJECTION:"projection",SPEED:"speed",TRACKING:"tracking",TRACKING_OPTIONS:"trackingOptions"},oN={ERROR:"error"};class aN extends Dr{constructor(e){super(oN.ERROR),this.code=e.code,this.message=e.message}}class lN extends Yr{constructor(e){super(),this.on,this.once,this.un,e=e||{},this.position_=null,this.transform_=A6,this.watchId_=void 0,this.addChangeListener(en.PROJECTION,this.handleProjectionChanged_),this.addChangeListener(en.TRACKING,this.handleTrackingChanged_),e.projection!==void 0&&this.setProjection(e.projection),e.trackingOptions!==void 0&&this.setTrackingOptions(e.trackingOptions),this.setTracking(e.tracking!==void 0?e.tracking:!1)}disposeInternal(){this.setTracking(!1),super.disposeInternal()}handleProjectionChanged_(){const e=this.getProjection();e&&(this.transform_=Wc(Mt("EPSG:4326"),e),this.position_&&this.set(en.POSITION,this.transform_(this.position_)))}handleTrackingChanged_(){if("geolocation"in navigator){const e=this.getTracking();e&&this.watchId_===void 0?this.watchId_=navigator.geolocation.watchPosition(this.positionChange_.bind(this),this.positionError_.bind(this),this.getTrackingOptions()):!e&&this.watchId_!==void 0&&(navigator.geolocation.clearWatch(this.watchId_),this.watchId_=void 0)}}positionChange_(e){const t=e.coords;this.set(en.ACCURACY,t.accuracy),this.set(en.ALTITUDE,t.altitude===null?void 0:t.altitude),this.set(en.ALTITUDE_ACCURACY,t.altitudeAccuracy===null?void 0:t.altitudeAccuracy),this.set(en.HEADING,t.heading===null?void 0:Zs(t.heading)),this.position_?(this.position_[0]=t.longitude,this.position_[1]=t.latitude):this.position_=[t.longitude,t.latitude];const n=this.transform_(this.position_);this.set(en.POSITION,n.slice()),this.set(en.SPEED,t.speed===null?void 0:t.speed);const r=nN(this.position_,t.accuracy);r.applyTransform(this.transform_),this.set(en.ACCURACY_GEOMETRY,r),this.changed()}positionError_(e){this.dispatchEvent(new aN(e))}getAccuracy(){return this.get(en.ACCURACY)}getAccuracyGeometry(){return this.get(en.ACCURACY_GEOMETRY)||null}getAltitude(){return this.get(en.ALTITUDE)}getAltitudeAccuracy(){return this.get(en.ALTITUDE_ACCURACY)}getHeading(){return this.get(en.HEADING)}getPosition(){return this.get(en.POSITION)}getProjection(){return this.get(en.PROJECTION)}getSpeed(){return this.get(en.SPEED)}getTracking(){return this.get(en.TRACKING)}getTrackingOptions(){return this.get(en.TRACKING_OPTIONS)}setProjection(e){this.set(en.PROJECTION,Mt(e))}setTracking(e){this.set(en.TRACKING,e)}setTrackingOptions(e){this.set(en.TRACKING_OPTIONS,e)}}const ln={ADD:"add",REMOVE:"remove"},db={LENGTH:"length"};class ep extends Dr{constructor(e,t,n){super(e),this.element=t,this.index=n}}class Rn extends Yr{constructor(e,t){if(super(),this.on,this.once,this.un,t=t||{},this.unique_=!!t.unique,this.array_=e??[],this.unique_)for(let n=1,r=this.array_.length;n<r;++n)this.assertUnique_(this.array_[n],n);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,n=e.length;t<n;++t)this.push(e[t]);return this}forEach(e){const t=this.array_;for(let n=0,r=t.length;n<r;++n)e(t[n],n,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(db.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new ep(ln.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){const t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){const t=this.array_;for(let n=0,r=t.length;n<r;++n)if(t[n]===e)return this.removeAt(n)}removeAt(e){if(e<0||e>=this.getLength())return;const t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new ep(ln.REMOVE,t,e)),t}setAt(e,t){const n=this.getLength();if(e>=n){this.insertAt(e,t);return}if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);const r=this.array_[e];this.array_[e]=t,this.dispatchEvent(new ep(ln.REMOVE,r,e)),this.dispatchEvent(new ep(ln.ADD,t,e))}updateLength_(){this.set(db.LENGTH,this.array_.length)}assertUnique_(e,t){const n=this.array_;for(let r=0,s=n.length;r<s;++r)if(n[r]===e&&r!==t)throw new Error("Duplicate item added to a unique collection")}}class Fh extends Dr{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}}class Ta extends Fh{constructor(e,t,n,r,s,o){super(e,t,s),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=r!==void 0?r:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}const Ht={SINGLECLICK:"singleclick",CLICK:Qe.CLICK,DBLCLICK:Qe.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Dc=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",cN=Dc.includes("safari")&&!Dc.includes("chrom"),hN=cN&&(Dc.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(Dc)),uN=Dc.includes("webkit")&&!Dc.includes("edge"),eL=Dc.includes("macintosh"),fN=typeof devicePixelRatio<"u"?devicePixelRatio:1,Xr=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,ax=typeof Image<"u"&&Image.prototype.decode,tL=typeof createImageBitmap=="function",iL=(function(){let i=!1;try{const e=Object.defineProperty({},"passive",{get:function(){i=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return i})(),Ly={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown"};class dN extends Nu{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;const n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=wt(n,Ly.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=wt(n,Ly.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(Qe.TOUCHMOVE,this.boundHandleTouchMove_,iL?{passive:!1}:!1)}emulateClick_(e){let t=new Ta(Ht.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new Ta(Ht.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const n=new Ta(Ht.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){const t=e,n=t.pointerId;if(t.type==Ht.POINTERUP||t.type==Ht.POINTERCANCEL){delete this.trackedTouches_[n];for(const r in this.trackedTouches_)if(this.trackedTouches_[r].target!==t.target){delete this.trackedTouches_[r];break}}else(t.type==Ht.POINTERDOWN||t.type==Ht.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);const t=new Ta(Ht.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(Zt),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);const t=new Ta(Ht.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){const n=this.map_.getOwnerDocument();this.dragListenerKeys_.push(wt(n,Ht.POINTERMOVE,this.handlePointerMove_,this),wt(n,Ht.POINTERUP,this.handlePointerUp_,this),wt(this.element_,Ht.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(wt(this.element_.getRootNode(),Ht.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;const t=new Ta(Ht.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;const t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new Ta(Ht.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){const t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!="boolean"||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(Zt(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(Qe.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(Zt(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(Zt),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const Ro={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},yr={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},Oe={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4},T0=1/0;class gN{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,jl(this.queuedElements_)}dequeue(){const e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));const r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(e){Vt(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const t=this.priorityFunction_(e);return t!=T0?(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){const t=this.elements_,n=this.priorities_,r=t.length,s=t[e],o=n[e],a=e;for(;e<r>>1;){const l=this.getLeftChildIndex_(e),c=this.getRightChildIndex_(e),h=c<r&&n[c]<n[l]?c:l;t[e]=t[h],n[e]=n[h],e=h}t[e]=s,n[e]=o,this.siftDown_(a,e)}siftDown_(e,t){const n=this.elements_,r=this.priorities_,s=n[t],o=r[t];for(;t>e;){const a=this.getParentIndex_(t);if(r[a]>o)n[t]=n[a],r[t]=r[a],t=a;else break}n[t]=s,r[t]=o}reprioritize(){const e=this.priorityFunction_,t=this.elements_,n=this.priorities_;let r=0;const s=t.length;let o,a,l;for(a=0;a<s;++a)o=t[a],l=e(o),l==T0?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}}class pN extends gN{constructor(e,t){super(n=>e.apply(null,n),n=>n[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){const t=super.enqueue(e);return t&&e[0].addEventListener(Qe.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){const t=e.target,n=t.getState();if(n===Oe.LOADED||n===Oe.ERROR||n===Oe.EMPTY){n!==Oe.ERROR&&t.removeEventListener(Qe.CHANGE,this.boundHandleTileChange_);const r=t.getKey();r in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[r],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let n=0;for(;this.tilesLoading_<e&&n<t&&this.getCount()>0;){const r=this.dequeue()[0],s=r.getKey();r.getState()===Oe.IDLE&&!(s in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++n,r.load())}}}function mN(i,e,t,n,r){if(!i||!(t in i.wantedTiles)||!i.wantedTiles[t][e.getKey()])return T0;const s=i.viewState.center,o=n[0]-s[0],a=n[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}const Ti={ANIMATING:0,INTERACTING:1},Vs={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function gb(i,e,t){return(function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;const l=e?0:s[0]*r,c=e?0:s[1]*r,h=a?a[0]:0,u=a?a[1]:0;let f=i[0]+l/2+h,d=i[2]-l/2+h,g=i[1]+c/2+u,m=i[3]-c/2+u;f>d&&(f=(d+f)/2,d=f),g>m&&(g=(m+g)/2,m=g);let _=yt(n[0],f,d),v=yt(n[1],g,m);if(o&&t&&r){const x=30*r;_+=-x*Math.log(1+Math.max(0,f-n[0])/x)+x*Math.log(1+Math.max(0,n[0]-d)/x),v+=-x*Math.log(1+Math.max(0,g-n[1])/x)+x*Math.log(1+Math.max(0,n[1]-m)/x)}return[_,v]})}function _N(i){return i}function nL(i){return Math.pow(i,3)}function Va(i){return 1-nL(1-i)}function yN(i){return 3*i*i-2*i*i*i}function rL(i){return i}function lx(i,e,t,n){const r=St(e)/t[0],s=Wi(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function cx(i,e,t){let n=Math.min(i,e);const r=50;return n*=Math.log(1+r*Math.max(0,i/e-1))/r+1,t&&(n=Math.max(n,t),n/=Math.log(1+r*Math.max(0,t/i-1))/r+1),yt(n,t/2,e*2)}function vN(i,e,t,n){return e=e!==void 0?e:!0,(function(r,s,o,a){if(r!==void 0){const l=i[0],c=i[i.length-1],h=t?lx(l,t,o,n):l;if(a)return e?cx(r,h,c):yt(r,c,h);const u=Math.min(h,r),f=Math.floor(vm(i,u,s));return i[f]>h&&f<i.length-1?i[f+1]:i[f]}})}function xN(i,e,t,n,r,s){return n=n!==void 0?n:!0,t=t!==void 0?t:0,(function(o,a,l,c){if(o!==void 0){const h=r?lx(e,r,l,s):e;if(c)return n?cx(o,h,t):yt(o,t,h);const u=1e-9,f=Math.ceil(Math.log(e/h)/Math.log(i)-u),d=-a*(.5-u)+.5,g=Math.min(h,o),m=Math.floor(Math.log(e/g)/Math.log(i)+d),_=Math.max(f,m),v=e/Math.pow(i,_);return yt(v,t,h)}})}function pb(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){const c=n?lx(i,n,a,r):i;return!t||!l?yt(s,e,c):cx(s,c,e)}})}function hx(i){if(i!==void 0)return 0}function mb(i){if(i!==void 0)return i}function wN(i){const e=2*Math.PI/i;return(function(t,n){if(n)return t;if(t!==void 0)return t=Math.floor(t/e+.5)*e,t})}function bN(i){const e=Zs(5);return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}const sL=42,ux=256,$1=0;class Xs extends Yr{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Hv(e.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,e.projection&&C6(),e.center&&(e.center=Ni(e.center,this.projection_)),e.extent&&(e.extent=ps(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){const t=Object.assign({},e);for(const a in Vs)delete t[a];this.setProperties(t,!0);const n=SN(e);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=n.minZoom;const r=EN(e),s=n.constraint,o=TN(e);this.constraints_={center:r,resolution:s,rotation:o},this.setRotation(e.rotation!==void 0?e.rotation:0),this.setCenterInternal(e.center!==void 0?e.center:null),e.resolution!==void 0?this.setResolution(e.resolution):e.zoom!==void 0&&this.setZoom(e.zoom)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;const n=this.getCenterInternal();if(n){const r=e||[0,0,0,0];t=t||[0,0,0,0];const s=this.getResolution(),o=s/2*(r[3]-t[3]+t[1]-r[1]),a=s/2*(r[0]-t[0]+t[2]-r[2]);this.setCenterInternal([n[0]+o,n[1]-a])}}getUpdatedOptions_(e){const t=this.getProperties();return t.resolution!==void 0?t.resolution=this.getResolution():t.zoom=this.getZoom(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const t=new Array(arguments.length);for(let n=0;n<t.length;++n){let r=arguments[n];r.center&&(r=Object.assign({},r),r.center=Ni(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=Ni(r.anchor,this.getProjection())),t[n]=r}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,n;t>1&&typeof arguments[t-1]=="function"&&(n=arguments[t-1],--t);let r=0;for(;r<t&&!this.isDef();++r){const h=arguments[r];h.center&&this.setCenterInternal(h.center),h.zoom!==void 0?this.setZoom(h.zoom):h.resolution&&this.setResolution(h.resolution),h.rotation!==void 0&&this.setRotation(h.rotation)}if(r===t){n&&tp(n,!0);return}let s=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const c=[];for(;r<t;++r){const h=arguments[r],u={start:s,complete:!1,anchor:h.anchor,duration:h.duration!==void 0?h.duration:1e3,easing:h.easing||yN,callback:n};if(h.center&&(u.sourceCenter=o,u.targetCenter=h.center.slice(),o=u.targetCenter),h.zoom!==void 0?(u.sourceResolution=a,u.targetResolution=this.getResolutionForZoom(h.zoom),a=u.targetResolution):h.resolution&&(u.sourceResolution=a,u.targetResolution=h.resolution,a=u.targetResolution),h.rotation!==void 0){u.sourceRotation=l;const f=Js(h.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+f,l=u.targetRotation}LN(u)?u.complete=!0:s+=u.duration,c.push(u)}this.animations_.push(c),this.setHint(Ti.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Ti.ANIMATING]>0}getInteracting(){return this.hints_[Ti.INTERACTING]>0}cancelAnimations(){this.setHint(Ti.ANIMATING,-this.hints_[Ti.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){const r=this.animations_[t];if(r[0].callback&&tp(r[0].callback,!1),!e)for(let s=0,o=r.length;s<o;++s){const a=r[s];if(!a.complete){e=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const e=Date.now();let t=!1;for(let n=this.animations_.length-1;n>=0;--n){const r=this.animations_[n];let s=!0;for(let o=0,a=r.length;o<a;++o){const l=r[o];if(l.complete)continue;const c=e-l.start;let h=l.duration>0?c/l.duration:1;h>=1?(l.complete=!0,h=1):s=!1;const u=l.easing(h);if(l.sourceCenter){const f=l.sourceCenter[0],d=l.sourceCenter[1],g=l.targetCenter[0],m=l.targetCenter[1];this.nextCenter_=l.targetCenter;const _=f+u*(g-f),v=d+u*(m-d);this.targetCenter_=[_,v]}if(l.sourceResolution&&l.targetResolution){const f=u===1?l.targetResolution:l.sourceResolution+u*(l.targetResolution-l.sourceResolution);if(l.anchor){const d=this.getViewportSize_(this.getRotation()),g=this.constraints_.resolution(f,0,d,!0);this.targetCenter_=this.calculateCenterZoom(g,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=f,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const f=u===1?Js(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+u*(l.targetRotation-l.sourceRotation);if(l.anchor){const d=this.constraints_.rotation(f,!0);this.targetCenter_=this.calculateCenterRotate(d,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=f}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(s){this.animations_[n]=null,this.setHint(Ti.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=r[0].callback;o&&tp(o,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n;const r=this.getCenterInternal();return r!==void 0&&(n=[r[0]-t[0],r[1]-t[1]],Uv(n,e-this.getRotation()),NT(n,t)),n}calculateCenterZoom(e,t){let n;const r=this.getCenterInternal(),s=this.getResolution();if(r!==void 0&&s!==void 0){const o=t[0]-e*(t[0]-r[0])/s,a=t[1]-e*(t[1]-r[1])/s;n=[o,a]}return n}getViewportSize_(e){const t=this.viewportSize_;if(e){const n=t[0],r=t[1];return[Math.abs(n*Math.cos(e))+Math.abs(r*Math.sin(e)),Math.abs(n*Math.sin(e))+Math.abs(r*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const e=this.getCenterInternal();return e&&ja(e,this.getProjection())}getCenterInternal(){return this.get(Vs.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return e!==void 0?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){const t=this.calculateExtentInternal(e);return Ou(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();const t=this.getCenterInternal();Vt(t,"The view center is not defined");const n=this.getResolution();Vt(n!==void 0,"The view resolution is not defined");const r=this.getRotation();return Vt(r!==void 0,"The view rotation is not defined"),Sd(t,n,r,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(Vs.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(ps(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();const n=St(e)/t[0],r=Wi(e)/t[1];return Math.max(n,r)}getResolutionForValueFunction(e){e=e||2;const t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(t/n)/Math.log(e);return(function(s){return t/Math.pow(e,s*r)})}getRotation(){return this.get(Vs.ROTATION)}getValueForResolutionFunction(e){const t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,s=Math.log(n/r)/t;return(function(o){return Math.log(n/o)/t/s})}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e);const n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){const e=this.getProjection(),t=this.getResolution(),n=this.getRotation();let r=this.getCenterInternal();const s=this.padding_;if(s){const o=this.getViewportSizeMinusPadding_();r=W1(r,this.getViewportSize_(),[o[0]/2+s[3],o[1]/2+s[0]],t,n)}return{center:r.slice(0),projection:e!==void 0?e:null,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e;const t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,n,r;if(this.resolutions_){const s=vm(this.resolutions_,e,1);t=s,n=this.resolutions_[s],s==this.resolutions_.length-1?r=2:r=n/this.resolutions_[s+1]}else n=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(n/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];const t=yt(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,yt(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(Vt(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){Vt(!Xo(e),"Cannot fit empty extent provided as `geometry`");const r=ps(e,this.getProjection());n=Wh(r)}else if(e.getType()==="Circle"){const r=ps(e.getExtent(),this.getProjection());n=Wh(r),n.rotate(this.getRotation(),In(r))}else n=e;this.fitInternal(n,t)}rotatedExtentForGeometry(e){const t=this.getRotation(),n=Math.cos(t),r=Math.sin(-t),s=e.getFlatCoordinates(),o=e.getStride();let a=1/0,l=1/0,c=-1/0,h=-1/0;for(let u=0,f=s.length;u<f;u+=o){const d=s[u]*n-s[u+1]*r,g=s[u]*r+s[u+1]*n;a=Math.min(a,d),l=Math.min(l,g),c=Math.max(c,d),h=Math.max(h,g)}return[a,l,c,h]}fitInternal(e,t){t=t||{};let n=t.size;n||(n=this.getViewportSizeMinusPadding_());const r=t.padding!==void 0?t.padding:[0,0,0,0],s=t.nearest!==void 0?t.nearest:!1;let o;t.minResolution!==void 0?o=t.minResolution:t.maxZoom!==void 0?o=this.getResolutionForZoom(t.maxZoom):o=0;const a=this.rotatedExtentForGeometry(e);let l=this.getResolutionForExtentInternal(a,[n[0]-r[1]-r[3],n[1]-r[0]-r[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,s?0:1);const c=this.getRotation(),h=Math.sin(c),u=Math.cos(c),f=In(a);f[0]+=(r[1]-r[3])/2*l,f[1]+=(r[0]-r[2])/2*l;const d=f[0]*u-f[1]*h,g=f[1]*u+f[0]*h,m=this.getConstrainedCenter([d,g],l),_=t.callback?t.callback:bd;t.duration!==void 0?this.animateInternal({resolution:l,center:m,duration:t.duration,easing:t.easing},_):(this.targetResolution_=l,this.targetCenter_=m,this.applyTargetState_(!1,!0),tp(_,!0))}centerOn(e,t,n){this.centerOnInternal(Ni(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(W1(e,t,n,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,n,r){let s;const o=this.padding_;if(o&&e){const a=this.getViewportSizeMinusPadding_(-n),l=W1(e,r,[a[0]/2+o[3],a[1]/2+o[0]],t,n);s=[e[0]-l[0],e[1]-l[1]]}return s}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(e){const t=ja(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){const t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t=t&&Ni(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){const n=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*e,0,r,n);t&&(this.targetCenter_=this.calculateCenterZoom(s,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(Math.pow(this.zoomFactor_,-e),t)}adjustRotation(e,t){t&&(t=Ni(t,this.getProjection())),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){const n=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+e,n);t&&(this.targetCenter_=this.calculateCenterRotate(r,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&Ni(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){const n=this.getAnimating()||this.getInteracting()||t,r=this.constraints_.rotation(this.targetRotation_,n),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,0,s,n),a=this.constraints_.center(this.targetCenter_,o,s,n,this.calculateCenterShift(this.targetCenter_,o,r,s));this.get(Vs.ROTATION)!==r&&this.set(Vs.ROTATION,r),this.get(Vs.RESOLUTION)!==o&&(this.set(Vs.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Vs.CENTER)||!Rr(this.get(Vs.CENTER),a))&&this.set(Vs.CENTER,a),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,n){e=e!==void 0?e:200;const r=t||0,s=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(s),a=this.constraints_.resolution(this.targetResolution_,r,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,s,o));if(e===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=s,this.targetCenter_=l,this.applyTargetState_();return}n=n||(e===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==s||!this.getCenterInternal()||!Rr(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:Va,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Ti.INTERACTING,1)}endInteraction(e,t,n){n=n&&Ni(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(Ti.INTERACTING,-1),this.resolveConstraints(e,t,n))}getConstrainedCenter(e,t){const n=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),n)}getConstrainedZoom(e,t){const n=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(n,t))}getConstrainedResolution(e,t){t=t||0;const n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,n)}}function tp(i,e){setTimeout(function(){i(e)},0)}function EN(i){if(i.extent!==void 0){const t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return gb(i.extent,i.constrainOnlyCenter,t)}const e=Hv(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,gb(t,!1,!1)}return _N}function SN(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:$1,a=i.maxZoom!==void 0?i.maxZoom:28;const l=i.zoomFactor!==void 0?i.zoomFactor:2,c=i.multiWorld!==void 0?i.multiWorld:!1,h=i.smoothResolutionConstraint!==void 0?i.smoothResolutionConstraint:!0,u=i.showFullExtent!==void 0?i.showFullExtent:!1,f=Hv(i.projection,"EPSG:3857"),d=f.getExtent();let g=i.constrainOnlyCenter,m=i.extent;if(!c&&!m&&f.isGlobal()&&(g=!1,m=d),i.resolutions!==void 0){const _=i.resolutions;t=_[o],n=_[a]!==void 0?_[a]:_[_.length-1],i.constrainResolution?e=vN(_,h,!g&&m,u):e=pb(t,n,h,!g&&m,u)}else{const v=(d?Math.max(St(d),Wi(d)):360*qv.degrees/f.getMetersPerUnit())/ux/Math.pow(2,$1),x=v/Math.pow(2,28-$1);t=i.maxResolution,t!==void 0?o=0:t=v/Math.pow(l,o),n=i.minResolution,n===void 0&&(i.maxZoom!==void 0?i.maxResolution!==void 0?n=t/Math.pow(l,a):n=v/Math.pow(l,a):n=x),a=o+Math.floor(Math.log(t/n)/Math.log(l)),n=t/Math.pow(l,a-o),i.constrainResolution?e=xN(l,t,n,h,!g&&m,u):e=pb(t,n,h,!g&&m,u)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function TN(i){if(i.enableRotation!==void 0?i.enableRotation:!0){const t=i.constrainRotation;return t===void 0||t===!0?bN():t===!1?mb:typeof t=="number"?wN(t):mb}return hx}function LN(i){return!(i.sourceCenter&&i.targetCenter&&!Rr(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function W1(i,e,t,n,r){const s=Math.cos(-r);let o=Math.sin(-r),a=i[0]*s-i[1]*o,l=i[1]*s+i[0]*o;a+=(e[0]/2-t[0])*n,l+=(t[1]-e[1]/2)*n,o=-o;const c=a*s-l*o,h=l*s+a*o;return[c,h]}const ip="ol-hidden",CN="ol-selectable",Mm="ol-unselectable",fx="ol-control",_b="ol-collapsed",AN=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(""),"i"),yb=["style","variant","weight","size","lineHeight","family"],Cy={normal:400,bold:700},Ay=function(i){const e=i.match(AN);if(!e)return null;const t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,r=yb.length;n<r;++n){const s=e[n+1];s!==void 0&&(t[yb[n]]=typeof s=="string"?s.trim():s)}return isNaN(Number(t.weight))&&t.weight in Cy&&(t.weight=Cy[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t};function Xi(i,e,t,n){let r;return t&&t.length?r=t.shift():Xr?r=new class extends OffscreenCanvas{style={}}(i??300,e??150):r=document.createElement("canvas"),i&&(r.width=i),e&&(r.height=e),r.getContext("2d",n)}let H1;function L0(){return H1||(H1=Xi(1,1)),H1}function Qd(i){const e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function PN(i){let e=i.offsetWidth;const t=getComputedStyle(i);return e+=parseInt(t.marginLeft,10)+parseInt(t.marginRight,10),e}function MN(i){let e=i.offsetHeight;const t=getComputedStyle(i);return e+=parseInt(t.marginTop,10)+parseInt(t.marginBottom,10),e}function vb(i,e){const t=e.parentNode;t&&t.replaceChild(i,e)}function oL(i){for(;i.lastChild;)i.lastChild.remove()}function RN(i,e){const t=i.childNodes;for(let n=0;;++n){const r=t[n],s=e[n];if(!r&&!s)break;if(r!==s){if(!r){i.appendChild(s);continue}if(!s){i.removeChild(r),--n;continue}i.insertBefore(s,r)}}}function aL(){return new Proxy({childNodes:[],appendChild:function(e){return this.childNodes.push(e),e},remove:function(){},removeChild:function(e){const t=this.childNodes.indexOf(e);if(t===-1)throw new Error("Node to remove was not found");return this.childNodes.splice(t,1),e},insertBefore:function(e,t){const n=this.childNodes.indexOf(t);if(n===-1)throw new Error("Reference node not found");return this.childNodes.splice(n,0,e),e},style:{}},{get(e,t,n){return t==="firstElementChild"?e.childNodes.length>0?e.childNodes[0]:null:Reflect.get(e,t,n)}})}function El(i){return typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas}class Os extends Yr{constructor(e){super();const t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&this.element?.remove();for(let t=0,n=this.listenerKeys.length;t<n;++t)Zt(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=e,e){const t=this.target_??e.getOverlayContainerStopEvent();this.element&&t.appendChild(this.element),this.render!==bd&&this.listenerKeys.push(wt(e,Ro.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}}class IN extends Os{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=e.collapsed!==void 0?e.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible!==void 0?e.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;const t=e.className!==void 0?e.className:"ol-attribution",n=e.tipLabel!==void 0?e.tipLabel:"Attributions",r=e.expandClassName!==void 0?e.expandClassName:t+"-expand",s=e.collapseLabel!==void 0?e.collapseLabel:"›",o=e.collapseClassName!==void 0?e.collapseClassName:t+"-collapse";typeof s=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=s,this.collapseLabel_.className=o):this.collapseLabel_=s;const a=e.label!==void 0?e.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=r):this.label_=a;const l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=n,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(Qe.CLICK,this.handleClick_.bind(this),!1);const c=t+" "+Mm+" "+fx+(this.collapsed_&&this.collapsible_?" "+_b:"")+(this.collapsible_?"":" ol-uncollapsible"),h=this.element;h.className=c,h.appendChild(this.toggleButton_),h.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){const t=this.getMap().getAllLayers(),n=new Set(t.flatMap(r=>r.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(r=>n.add(r)):n.add(this.attributions_)),!this.overrideCollapsible_){const r=!t.some(s=>s.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(r)}return Array.from(n)}async updateElement_(e){if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const t=await Promise.all(this.collectSourceAttributions_(e).map(r=>Nv(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!Ho(t,this.renderedAttributions_)){oL(this.ulElement_);for(let r=0,s=t.length;r<s;++r){const o=document.createElement("li");o.innerHTML=t[r],this.ulElement_.appendChild(o)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(_b),this.collapsed_?vb(this.collapseLabel_,this.label_):vb(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(e){this.userCollapsed_=e,!(!this.collapsible_||this.collapsed_===e)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(e){this.updateElement_(e.frameState)}}class NN extends Os{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target});const t=e.className!==void 0?e.className:"ol-rotate",n=e.label!==void 0?e.label:"⇧",r=e.compassClassName!==void 0?e.compassClassName:"ol-compass";this.label_=null,typeof n=="string"?(this.label_=document.createElement("span"),this.label_.className=r,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(r));const s=e.tipLabel?e.tipLabel:"Reset rotation",o=document.createElement("button");o.className=t+"-reset",o.setAttribute("type","button"),o.title=s,o.appendChild(this.label_),o.addEventListener(Qe.CLICK,this.handleClick_.bind(this),!1);const a=t+" "+Mm+" "+fx,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=e.duration!==void 0?e.duration:250,this.autoHide_=e.autoHide!==void 0?e.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(ip)}handleClick_(e){e.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const t=this.getMap().getView();if(!t)return;const n=t.getRotation();n!==void 0&&(this.duration_>0&&n%(2*Math.PI)!==0?t.animate({rotation:0,duration:this.duration_,easing:Va}):t.setRotation(0))}render(e){const t=e.frameState;if(!t)return;const n=t.viewState.rotation;if(n!=this.rotation_){const r="rotate("+n+"rad)";if(this.autoHide_){const s=this.element.classList.contains(ip);!s&&n===0?this.element.classList.add(ip):s&&n!==0&&this.element.classList.remove(ip)}this.label_.style.transform=r}this.rotation_=n}}class FN extends Os{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target});const t=e.className!==void 0?e.className:"ol-zoom",n=e.delta!==void 0?e.delta:1,r=e.zoomInClassName!==void 0?e.zoomInClassName:t+"-in",s=e.zoomOutClassName!==void 0?e.zoomOutClassName:t+"-out",o=e.zoomInLabel!==void 0?e.zoomInLabel:"+",a=e.zoomOutLabel!==void 0?e.zoomOutLabel:"–",l=e.zoomInTipLabel!==void 0?e.zoomInTipLabel:"Zoom in",c=e.zoomOutTipLabel!==void 0?e.zoomOutTipLabel:"Zoom out",h=document.createElement("button");h.className=r,h.setAttribute("type","button"),h.title=l,h.appendChild(typeof o=="string"?document.createTextNode(o):o),h.addEventListener(Qe.CLICK,this.handleClick_.bind(this,n),!1);const u=document.createElement("button");u.className=s,u.setAttribute("type","button"),u.title=c,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(Qe.CLICK,this.handleClick_.bind(this,-n),!1);const f=t+" "+Mm+" "+fx,d=this.element;d.className=f,d.appendChild(h),d.appendChild(u),this.duration_=e.duration!==void 0?e.duration:250}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){const n=this.getMap().getView();if(!n)return;const r=n.getZoom();if(r!==void 0){const s=n.getConstrainedZoom(r+e);this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:s,duration:this.duration_,easing:Va})):n.setZoom(s)}}}function ON(i){i=i||{};const e=new Rn;return(i.zoom!==void 0?i.zoom:!0)&&e.push(new FN(i.zoomOptions)),(i.rotate!==void 0?i.rotate:!0)&&e.push(new NN(i.rotateOptions)),(i.attribution!==void 0?i.attribution:!0)&&e.push(new IN(i.attributionOptions)),e}class DN{constructor(e,t,n){this.decay_=e,this.minVelocity_=t,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;const e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]<e)return!1;let n=t-3;for(;n>0&&this.points_[n+2]>e;)n-=3;const r=this.points_[t+2]-this.points_[n+2];if(r<1e3/60)return!1;const s=this.points_[t]-this.points_[n],o=this.points_[t+1]-this.points_[n+1];return this.angle_=Math.atan2(o,s),this.initialVelocity_=Math.sqrt(s*s+o*o)/r,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}const Py={ACTIVE:"active"};class ql extends Yr{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(Py.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(Py.ACTIVE,e)}setMap(e){this.map_=e}}function kN(i,e,t){const n=i.getCenterInternal();if(n){const r=[n[0]+e[0],n[1]+e[1]];i.animateInternal({duration:t!==void 0?t:250,easing:rL,center:i.getConstrainedCenter(r)})}}function dx(i,e,t,n){const r=i.getZoom();if(r===void 0)return;const s=i.getConstrainedZoom(r+e),o=i.getResolutionForZoom(s);i.getAnimating()&&i.cancelAnimations(),i.animate({resolution:o,anchor:t,duration:n!==void 0?n:250,easing:Va})}class GN extends ql{constructor(e){super(),e=e||{},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:250}handleEvent(e){let t=!1;if(e.type==Ht.DBLCLICK){const n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();dx(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}}function My(i){const e=arguments;return function(t){let n=!0;for(let r=0,s=e.length;r<s&&(n=n&&e[r](t),!!n);++r);return n}}const BN=function(i){const e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},jN=function(i){const e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},UN=function(i){const e=i.map.getTargetElement(),t=e.getRootNode(),n=i.map.getOwnerDocument().activeElement;return t instanceof ShadowRoot?t.host.contains(n):e.contains(n)},lL=function(i){const e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?UN(i):!0},Rc=zo,cL=function(i){const e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(uN&&eL&&e.ctrlKey)},C0=Vc,gx=function(i){return i.type==Ht.SINGLECLICK},px=function(i){const e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},zN=function(i){const e=i.originalEvent;return eL?e.metaKey:e.ctrlKey},Ad=function(i){const e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},hL=function(i){const e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},lu=function(i){const e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"},uL=function(i){const e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};class co extends ql{constructor(e){e=e||{},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==Ht.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==Ht.POINTERUP){const n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==Ht.POINTERDOWN){const n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==Ht.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}}function mx(i){const e=i.length;let t=0,n=0;for(let r=0;r<e;r++)t+=i[r].clientX,n+=i[r].clientY;return{clientX:t/e,clientY:n/e}}class qN extends co{constructor(e){super({stopDown:Vc}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const t=e.condition?e.condition:My(px,uL);this.condition_=e.onFocusOnly?My(lL,t):t,this.noKinetic_=!1}handleDragEvent(e){const t=e.map;this.panning_||(this.panning_=!0,t.getView().beginInteraction());const n=this.targetPointers,r=t.getEventPixel(mx(n));if(n.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){const s=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],a=e.map.getView();FT(s,a.getResolution()),Uv(s,a.getRotation()),a.adjustCenterInternal(s)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=n.length,e.originalEvent.preventDefault()}handleUpEvent(e){const t=e.map,n=t.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const r=this.kinetic_.getDistance(),s=this.kinetic_.getAngle(),o=n.getCenterInternal(),a=t.getPixelFromCoordinateInternal(o),l=t.getCoordinateFromPixelInternal([a[0]-r*Math.cos(s),a[1]-r*Math.sin(s)]);n.animateInternal({center:n.getConstrainedCenter(l),duration:500,easing:Va})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){const n=e.map.getView();return this.lastCentroid=null,n.getAnimating()&&n.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}class fL extends co{constructor(e){e=e||{},super({stopDown:Vc}),this.condition_=e.condition?e.condition:jN,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!lu(e))return;const t=e.map,n=t.getView();if(n.getConstraints().rotation===hx)return;const r=t.getSize(),s=e.pixel,o=Math.atan2(r[1]/2-s[1],s[0]-r[0]/2);if(this.lastAngle_!==void 0){const a=o-this.lastAngle_;n.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(e){return lu(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return lu(e)&&cL(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}class VN extends Yd{constructor(e){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const e=this.startPixel_,t=this.endPixel_,n="px",r=this.element_.style;r.left=Math.min(e[0],t[0])+n,r.top=Math.min(e[1],t[1])+n,r.width=Math.abs(t[0]-e[0])+n,r.height=Math.abs(t[1]-e[1])+n}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const e=this.startPixel_,t=this.endPixel_,r=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new lr([r])}getGeometry(){return this.geometry_}}const yh={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class Ef extends Dr{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}}class dL extends co{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new VN(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??cL,this.boxEndCondition_=e.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,n){const r=n[0]-t[0],s=n[1]-t[1];return r*r+s*s>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.startPixel_&&(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new Ef(yh.BOXDRAG,e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;const t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new Ef(t?yh.BOXEND:yh.BOXCANCEL,e.coordinate,e)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Ef(yh.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Ef(yh.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Ef(yh.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}}class $N extends dL{constructor(e){e=e||{};const t=e.condition?e.condition:Ad;super({condition:t,className:e.className||"ol-dragzoom",minArea:e.minArea}),this.duration_=e.duration!==void 0?e.duration:200,this.out_=e.out!==void 0?e.out:!1}onBoxEnd(e){const n=this.getMap().getView();let r=this.getGeometry();if(this.out_){const s=n.rotatedExtentForGeometry(r),o=n.getResolutionForExtentInternal(s),a=n.getResolution()/o;r=r.clone(),r.scale(a*a)}n.fitInternal(r,{duration:this.duration_,easing:Va})}}const mc={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class WN extends ql{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return px(t)&&hL(t)},this.condition_=e.condition!==void 0?e.condition:this.defaultCondition_,this.duration_=e.duration!==void 0?e.duration:100,this.pixelDelta_=e.pixelDelta!==void 0?e.pixelDelta:128}handleEvent(e){let t=!1;if(e.type==Qe.KEYDOWN){const n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==mc.DOWN||r==mc.LEFT||r==mc.RIGHT||r==mc.UP)){const o=e.map.getView(),a=o.getResolution()*this.pixelDelta_;let l=0,c=0;r==mc.DOWN?c=-a:r==mc.LEFT?l=-a:r==mc.RIGHT?l=a:c=a;const h=[l,c];Uv(h,o.getRotation()),kN(o,h,this.duration_),n.preventDefault(),t=!0}}return!t}}class HN extends ql{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!zN(t)&&hL(t)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:100}handleEvent(e){let t=!1;if(e.type==Qe.KEYDOWN||e.type==Qe.KEYPRESS){const n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==="+"||r==="-")){const s=e.map,o=r==="+"?this.delta_:-this.delta_,a=s.getView();dx(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}}const XN=40,KN=300;class Ry extends ql{constructor(e){e=e||{},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta!==void 0?e.maxDelta:1,this.duration_=e.duration!==void 0?e.duration:250,this.timeout_=e.timeout!==void 0?e.timeout:80,this.useAnchor_=e.useAnchor!==void 0?e.useAnchor:!0,this.constrainResolution_=e.constrainResolution!==void 0?e.constrainResolution:!1;const t=e.condition?e.condition:Rc;this.condition_=e.onFocusOnly?My(lL,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const e=this.getMap();if(!e)return;e.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e)||e.type!==Qe.WHEEL)return!0;const n=e.map,r=e.originalEvent;r.preventDefault(),this.useAnchor_&&(this.lastAnchor_=e.pixel);let s=r.deltaY;switch(r.deltaMode){case WheelEvent.DOM_DELTA_LINE:s*=XN;break;case WheelEvent.DOM_DELTA_PAGE:s*=KN;break}if(s===0)return!1;this.lastDelta_=s;const o=Date.now();this.startTime_===void 0&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(s)<4?"trackpad":"wheel");const a=n.getView();if(this.mode_==="trackpad"&&!(a.getConstrainResolution()||this.constrainResolution_))return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(a.getAnimating()&&a.cancelAnimations(),a.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),a.adjustZoom(-s/this.deltaPerZoom_,this.lastAnchor_?n.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=o,!1;this.totalDelta_+=s;const l=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),l),!1}handleWheelZoom_(e){const t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-yt(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),dx(t,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}}class YN extends co{constructor(e){e=e||{};const t=e;t.stopDown||(t.stopDown=Vc),super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold!==void 0?e.threshold:.3,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){let t=0;const n=this.targetPointers[0],r=this.targetPointers[1],s=Math.atan2(r.clientY-n.clientY,r.clientX-n.clientX);if(this.lastAngle_!==void 0){const l=s-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=l}this.lastAngle_=s;const o=e.map,a=o.getView();a.getConstraints().rotation!==hx&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(mx(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){const t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}}class ZN extends co{constructor(e){e=e||{};const t=e;t.stopDown||(t.stopDown=Vc),super(t),this.anchor_=null,this.duration_=e.duration!==void 0?e.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1;const n=this.targetPointers[0],r=this.targetPointers[1],s=n.clientX-r.clientX,o=n.clientY-r.clientY,a=Math.sqrt(s*s+o*o);this.lastDistance_!==void 0&&(t=this.lastDistance_/a),this.lastDistance_=a;const l=e.map,c=l.getView();t!=1&&(this.lastScaleDelta_=t),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(mx(this.targetPointers))),l.render(),c.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){const n=e.map.getView(),r=this.lastScaleDelta_>1?1:-1;return n.endInteraction(this.duration_,r),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){const t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}}function JN(i){i=i||{};const e=new Rn,t=new DN(-.005,.05,100);return(i.altShiftDragRotate!==void 0?i.altShiftDragRotate:!0)&&e.push(new fL),(i.doubleClickZoom!==void 0?i.doubleClickZoom:!0)&&e.push(new GN({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan!==void 0?i.dragPan:!0)&&e.push(new qN({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate!==void 0?i.pinchRotate:!0)&&e.push(new YN),(i.pinchZoom!==void 0?i.pinchZoom:!0)&&e.push(new ZN({duration:i.zoomDuration})),(i.keyboard!==void 0?i.keyboard:!0)&&(e.push(new WN),e.push(new HN({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom!==void 0?i.mouseWheelZoom:!0)&&e.push(new Ry({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom!==void 0?i.shiftDragZoom:!0)&&e.push(new $N({duration:i.zoomDuration})),e}const ai={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};class _x extends Yr{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;const t=Object.assign({},e);typeof e.properties=="object"&&(delete t.properties,Object.assign(t,e.properties)),t[ai.OPACITY]=e.opacity!==void 0?e.opacity:1,Vt(typeof t[ai.OPACITY]=="number","Layer opacity must be a number"),t[ai.VISIBLE]=e.visible!==void 0?e.visible:!0,t[ai.Z_INDEX]=e.zIndex,t[ai.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[ai.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[ai.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[ai.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){const t=this.state_||{layer:this,managed:e===void 0?!0:e},n=this.getZIndex();return t.opacity=yt(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return Kt()}getLayerStatesArray(e){return Kt()}getExtent(){return this.get(ai.EXTENT)}getMaxResolution(){return this.get(ai.MAX_RESOLUTION)}getMinResolution(){return this.get(ai.MIN_RESOLUTION)}getMinZoom(){return this.get(ai.MIN_ZOOM)}getMaxZoom(){return this.get(ai.MAX_ZOOM)}getOpacity(){return this.get(ai.OPACITY)}getSourceState(){return Kt()}getVisible(){return this.get(ai.VISIBLE)}getZIndex(){return this.get(ai.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(ai.EXTENT,e)}setMaxResolution(e){this.set(ai.MAX_RESOLUTION,e)}setMinResolution(e){this.set(ai.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(ai.MAX_ZOOM,e)}setMinZoom(e){this.set(ai.MIN_ZOOM,e)}setOpacity(e){Vt(typeof e=="number","Layer opacity must be a number"),this.set(ai.OPACITY,e)}setVisible(e){this.set(ai.VISIBLE,e)}setZIndex(e){this.set(ai.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}const ul={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"};class xl extends Dr{constructor(e,t){super(e),this.layer=t}}const X1={LAYERS:"layers"};class Vl extends _x{constructor(e){e=e||{};const t=Object.assign({},e);delete t.layers;let n=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(X1.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new Rn(n.slice(),{unique:!0}):Vt(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new Rn(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(Zt),this.layersListenerKeys_.length=0;const e=this.getLayers();this.layersListenerKeys_.push(wt(e,ln.ADD,this.handleLayersAdd_,this),wt(e,ln.REMOVE,this.handleLayersRemove_,this));for(const n in this.listenerKeys_)this.listenerKeys_[n].forEach(Zt);jl(this.listenerKeys_);const t=e.getArray();for(let n=0,r=t.length;n<r;n++){const s=t[n];this.registerLayerListeners_(s),this.dispatchEvent(new xl(ul.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){const t=[wt(e,wu.PROPERTYCHANGE,this.handleLayerChange_,this),wt(e,Qe.CHANGE,this.handleLayerChange_,this)];e instanceof Vl&&t.push(wt(e,ul.ADDLAYER,this.handleLayerGroupAdd_,this),wt(e,ul.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Ue(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new xl(ul.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new xl(ul.REMOVELAYER,e.layer))}handleLayersAdd_(e){const t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new xl(ul.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){const t=e.element,n=Ue(t);this.listenerKeys_[n].forEach(Zt),delete this.listenerKeys_[n],this.dispatchEvent(new xl(ul.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(X1.LAYERS)}setLayers(e){const t=this.getLayers();if(t){const n=t.getArray();for(let r=0,s=n.length;r<s;++r)this.dispatchEvent(new xl(ul.REMOVELAYER,n[r]))}this.set(X1.LAYERS,e)}getLayersArray(e){return e=e!==void 0?e:[],this.getLayers().forEach(function(t){t.getLayersArray(e)}),e}getLayerStatesArray(e){const t=e!==void 0?e:[],n=t.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(t)});const r=this.getLayerState();let s=r.zIndex;!e&&r.zIndex===void 0&&(s=0);for(let o=n,a=t.length;o<a;o++){const l=t[o];l.opacity*=r.opacity,l.visible=l.visible&&r.visible,l.maxResolution=Math.min(l.maxResolution,r.maxResolution),l.minResolution=Math.max(l.minResolution,r.minResolution),l.minZoom=Math.max(l.minZoom,r.minZoom),l.maxZoom=Math.min(l.maxZoom,r.maxZoom),r.extent!==void 0&&(l.extent!==void 0?l.extent=Mn(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}}const qn={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};class Hc extends _x{constructor(e){const t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(ai.SOURCE,this.handleSourcePropertyChange_);const n=e.source?e.source:null;this.setSource(n)}getLayersArray(e){return e=e||[],e.push(this),e}getLayerStatesArray(e){return e=e||[],e.push(this.getLayerState()),e}getSource(){return this.get(ai.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(Zt(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const e=this.getSource();e&&(this.sourceChangeKey_=wt(e,Qe.CHANGE,this.handleSourceChange_,this),e.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t;const n=this.getMapInternal();!e&&n&&(e=n.getView()),e instanceof Xs?t={viewState:e.getState(),extent:e.calculateExtent()}:t=e,!t.layerStatesArray&&n&&(t.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let r;if(t.layerStatesArray){if(r=t.layerStatesArray.find(o=>o.layer===this),!r)return!1}else r=this.getLayerState();const s=this.getExtent();return yx(r,t.viewState)&&(!s||Ei(s,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];const t=this.getSource()?.getAttributions();if(!t)return[];const n=e instanceof Xs?e.getViewStateAndExtent():e;let r=t(n);return Array.isArray(r)||(r=[r]),r}render(e,t){const n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){const t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(ai.MAP,e)}getMapInternal(){return this.get(ai.MAP)}setMap(e){this.mapPrecomposeKey_&&(Zt(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(Zt(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=wt(e,qn.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=wt(this,Qe.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){const t=e.frameState.layerStatesArray,n=this.getLayerState(!1);Vt(!t.some(r=>r.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set(ai.SOURCE,e)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}}function yx(i,e){if(!i.visible)return!1;const t=e.resolution;if(t<i.minResolution||t>=i.maxResolution)return!1;const n=e.zoom;return n>i.minZoom&&n<=i.maxZoom}function gL(i,e,t=0,n=i.length-1,r=QN){for(;n>t;){if(n-t>600){const l=n-t+1,c=e-t+1,h=Math.log(l),u=.5*Math.exp(2*h/3),f=.5*Math.sqrt(h*u*(l-u)/l)*(c-l/2<0?-1:1),d=Math.max(t,Math.floor(e-c*u/l+f)),g=Math.min(n,Math.floor(e+(l-c)*u/l+f));gL(i,e,d,g,r)}const s=i[e];let o=t,a=n;for(Sf(i,t,e),r(i[n],s)>0&&Sf(i,t,n);o<a;){for(Sf(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?Sf(i,t,a):(a++,Sf(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function Sf(i,e,t){const n=i[e];i[e]=i[t],i[t]=n}function QN(i,e){return i<e?-1:i>e?1:0}let vx=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data;const n=[];if(!rp(e,t))return n;const r=this.toBBox,s=[];for(;t;){for(let o=0;o<t.children.length;o++){const a=t.children[o],l=t.leaf?r(a):a;rp(e,l)&&(t.leaf?n.push(a):Y1(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!rp(e,t))return!1;const n=[];for(;t;){for(let r=0;r<t.children.length;r++){const s=t.children[r],o=t.leaf?this.toBBox(s):s;if(rp(e,o)){if(t.leaf||Y1(e,o))return!0;n.push(s)}}t=n.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let n=0;n<e.length;n++)this.insert(e[n]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){const n=this.data;this.data=t,t=n}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=Oh([]),this}remove(e,t){if(!e)return this;let n=this.data;const r=this.toBBox(e),s=[],o=[];let a,l,c;for(;n||s.length;){if(n||(n=s.pop(),l=s[s.length-1],a=o.pop(),c=!0),n.leaf){const h=eF(e,n.children,t);if(h!==-1)return n.children.splice(h,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&Y1(n,r)?(s.push(n),o.push(a),a=0,l=n,n=n.children[0]):l?(a++,n=l.children[a],c=!1):n=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){const n=[];for(;e;)e.leaf?t.push(...e.children):n.push(...e.children),e=n.pop();return t}_build(e,t,n,r){const s=n-t+1;let o=this._maxEntries,a;if(s<=o)return a=Oh(e.slice(t,n+1)),vh(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=Oh([]),a.leaf=!1,a.height=r;const l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));xb(e,t,n,c,this.compareMinX);for(let h=t;h<=n;h+=c){const u=Math.min(h+c-1,n);xb(e,h,u,l,this.compareMinY);for(let f=h;f<=u;f+=l){const d=Math.min(f+l-1,u);a.children.push(this._build(e,f,d,r-1))}}return vh(a,this.toBBox),a}_chooseSubtree(e,t,n,r){for(;r.push(t),!(t.leaf||r.length-1===n);){let s=1/0,o=1/0,a;for(let l=0;l<t.children.length;l++){const c=t.children[l],h=K1(c),u=nF(e,c)-h;u<o?(o=u,s=h<s?h:s,a=c):u===o&&h<s&&(s=h,a=c)}t=a||t.children[0]}return t}_insert(e,t,n){const r=n?e:this.toBBox(e),s=[],o=this._chooseSubtree(r,this.data,t,s);for(o.children.push(e),Nf(o,r);t>=0&&s[t].children.length>this._maxEntries;)this._split(s,t),t--;this._adjustParentBBoxes(r,s,t)}_split(e,t){const n=e[t],r=n.children.length,s=this._minEntries;this._chooseSplitAxis(n,s,r);const o=this._chooseSplitIndex(n,s,r),a=Oh(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,vh(n,this.toBBox),vh(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=Oh([e,t]),this.data.height=e.height+1,this.data.leaf=!1,vh(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,s=1/0,o=1/0;for(let a=t;a<=n-t;a++){const l=If(e,0,a,this.toBBox),c=If(e,a,n,this.toBBox),h=rF(l,c),u=K1(l)+K1(c);h<s?(s=h,r=a,o=u<o?u:o):h===s&&u<o&&(o=u,r=a)}return r||n-t}_chooseSplitAxis(e,t,n){const r=e.leaf?this.compareMinX:tF,s=e.leaf?this.compareMinY:iF,o=this._allDistMargin(e,t,n,r),a=this._allDistMargin(e,t,n,s);o<a&&e.children.sort(r)}_allDistMargin(e,t,n,r){e.children.sort(r);const s=this.toBBox,o=If(e,0,t,s),a=If(e,n-t,n,s);let l=np(o)+np(a);for(let c=t;c<n-t;c++){const h=e.children[c];Nf(o,e.leaf?s(h):h),l+=np(o)}for(let c=n-t-1;c>=t;c--){const h=e.children[c];Nf(a,e.leaf?s(h):h),l+=np(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)Nf(t[r],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():vh(e[t],this.toBBox)}};function eF(i,e,t){if(!t)return e.indexOf(i);for(let n=0;n<e.length;n++)if(t(i,e[n]))return n;return-1}function vh(i,e){If(i,0,i.children.length,e,i)}function If(i,e,t,n,r){r||(r=Oh(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=e;s<t;s++){const o=i.children[s];Nf(r,i.leaf?n(o):o)}return r}function Nf(i,e){return i.minX=Math.min(i.minX,e.minX),i.minY=Math.min(i.minY,e.minY),i.maxX=Math.max(i.maxX,e.maxX),i.maxY=Math.max(i.maxY,e.maxY),i}function tF(i,e){return i.minX-e.minX}function iF(i,e){return i.minY-e.minY}function K1(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function np(i){return i.maxX-i.minX+(i.maxY-i.minY)}function nF(i,e){return(Math.max(e.maxX,i.maxX)-Math.min(e.minX,i.minX))*(Math.max(e.maxY,i.maxY)-Math.min(e.minY,i.minY))}function rF(i,e){const t=Math.max(i.minX,e.minX),n=Math.max(i.minY,e.minY),r=Math.min(i.maxX,e.maxX),s=Math.min(i.maxY,e.maxY);return Math.max(0,r-t)*Math.max(0,s-n)}function Y1(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function rp(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function Oh(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function xb(i,e,t,n,r){const s=[e,t];for(;s.length;){if(t=s.pop(),e=s.pop(),t-e<=n)continue;const o=e+Math.ceil((t-e)/n/2)*n;gL(i,o,e,t,r),s.push(e,o,o,t)}}const xx=[NaN,NaN,NaN,0];let Z1;function sF(){return Z1||(Z1=Xi(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),Z1}const oF=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,aF=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,lF=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,cF=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function sp(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function Zf(i){throw new Error('failed to parse "'+i+'" as color')}function pL(i){if(i.toLowerCase().startsWith("rgb")){const s=i.match(aF)||i.match(oF)||i.match(lF);if(s){const o=s[4],a=100/255;return[yt(sp(s[1],a)+.5|0,0,255),yt(sp(s[2],a)+.5|0,0,255),yt(sp(s[3],a)+.5|0,0,255),o!==void 0?yt(sp(o,100),0,1):1]}Zf(i)}if(i.startsWith("#")){if(cF.test(i)){const s=i.substring(1),o=s.length<=4?1:2,a=[0,0,0,255];for(let l=0,c=s.length;l<c;l+=o){let h=parseInt(s.substring(l,l+o),16);o===1&&(h+=h<<4),a[l/o]=h}return a[3]=a[3]/255,a}Zf(i)}const e=sF();e.fillStyle="#abcdef";let t=e.fillStyle;e.fillStyle=i,e.fillStyle===t&&(e.fillStyle="#fedcba",t=e.fillStyle,e.fillStyle=i,e.fillStyle===t&&Zf(i));const n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return pL(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);const r=Array.from(e.getImageData(0,0,1,1).data);return r[3]=Ul(r[3]/255,3),r}function No(i){return typeof i=="string"?i:bx(i)}const hF=1024,Tf={};let J1=0;function uF(i){if(i.length===4)return i;const e=i.slice();return e[3]=1,e}function Q1(i){return i>.0031308?Math.pow(i,1/2.4)*269.025-14.025:i*3294.6}function e_(i){return i>.2068965?Math.pow(i,3):(i-4/29)*(108/841)}function t_(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function i_(i){return i>.0088564?Math.pow(i,1/3):i/(108/841)+4/29}function wb(i){const e=t_(i[0]),t=t_(i[1]),n=t_(i[2]),r=i_(e*.222488403+t*.716873169+n*.06060791),s=500*(i_(e*.452247074+t*.399439023+n*.148375274)-r),o=200*(r-i_(e*.016863605+t*.117638439+n*.865350722)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,i[3]]}function fF(i){const e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,r=e_(e),s=e_(e+t/500*Math.cos(n)),o=e_(e-t/200*Math.sin(n)),a=Q1(s*3.021973625-r*1.617392459-o*.404875592),l=Q1(s*-.943766287+r*1.916279586+o*.027607165),c=Q1(s*.069407491-r*.22898585+o*1.159737864);return[yt(a+.5|0,0,255),yt(l+.5|0,0,255),yt(c+.5|0,0,255),i[3]]}function wx(i){if(i==="none")return xx;if(Tf.hasOwnProperty(i))return Tf[i];if(J1>=hF){let t=0;for(const n in Tf)(t++&3)===0&&(delete Tf[n],--J1)}const e=pL(i);e.length!==4&&Zf(i);for(const t of e)isNaN(t)&&Zf(i);return Tf[i]=e,++J1,e}function so(i){return Array.isArray(i)?i:wx(i)}function bx(i){let e=i[0];e!=(e|0)&&(e=e+.5|0);let t=i[1];t!=(t|0)&&(t=t+.5|0);let n=i[2];n!=(n|0)&&(n=n+.5|0);const r=i[3]===void 0?1:Math.round(i[3]*1e3)/1e3;return"rgba("+e+","+t+","+n+","+r+")"}function bb(i){return i[0]>0&&i[1]>0}function mL(i,e,t){return t===void 0&&(t=[0,0]),t[0]=i[0]*e+.5|0,t[1]=i[1]*e+.5|0,t}function Hi(i,e){return Array.isArray(i)?i:(e===void 0?e=[i,i]:(e[0]=i,e[1]=i),e)}let Xc=0;const Pn=1<<Xc++,He=1<<Xc++,Vn=1<<Xc++,Vi=1<<Xc++,Kr=1<<Xc++,Ps=1<<Xc++,op=Math.pow(2,Xc)-1,Ex={[Pn]:"boolean",[He]:"number",[Vn]:"string",[Vi]:"color",[Kr]:"number[]",[Ps]:"size"},dF=Object.keys(Ex).map(Number).sort(Bo);function gF(i){return i in Ex}function Hh(i){const e=[];for(const t of dF)Ff(i,t)&&e.push(Ex[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function Ff(i,e){return(i&e)===e}function Mo(i,e){return i===e}class zn{constructor(e,t){if(!gF(e))throw new Error(`literal expressions must have a specific type, got ${Hh(e)}`);this.type=e,this.value=t}}class _L{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}}function Sx(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mapState:!1}}function Kn(i,e,t){switch(typeof i){case"boolean":{if(Mo(e,Vn))return new zn(Vn,i?"true":"false");if(!Ff(e,Pn))throw new Error(`got a boolean, but expected ${Hh(e)}`);return new zn(Pn,i)}case"number":{if(Mo(e,Ps))return new zn(Ps,Hi(i));if(Mo(e,Pn))return new zn(Pn,!!i);if(Mo(e,Vn))return new zn(Vn,i.toString());if(!Ff(e,He))throw new Error(`got a number, but expected ${Hh(e)}`);return new zn(He,i)}case"string":{if(Mo(e,Vi))return new zn(Vi,wx(i));if(Mo(e,Pn))return new zn(Pn,!!i);if(!Ff(e,Vn))throw new Error(`got a string, but expected ${Hh(e)}`);return new zn(Vn,i)}}if(!Array.isArray(i))throw new Error("expression must be an array or a primitive value");if(i.length===0)throw new Error("empty expression");if(typeof i[0]=="string")return TF(i,e,t);for(const n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(Mo(e,Ps)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new zn(Ps,i)}if(Mo(e,Vi)){if(i.length===3)return new zn(Vi,[...i,1]);if(i.length===4)return new zn(Vi,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!Ff(e,Kr))throw new Error(`got an array of numbers, but expected ${Hh(e)}`);return new zn(Kr,i)}const xe={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},pF={[xe.Get]:bt(Gt(1,1/0),Eb),[xe.Var]:bt(Gt(1,1),mF),[xe.Has]:bt(Gt(1,1/0),Eb),[xe.Id]:bt(_F,xh),[xe.Concat]:bt(Gt(2,1/0),ui(Vn)),[xe.GeometryType]:bt(yF,xh),[xe.LineMetric]:bt(xh),[xe.Resolution]:bt(n_,xh),[xe.Zoom]:bt(n_,xh),[xe.Time]:bt(n_,xh),[xe.Any]:bt(Gt(2,1/0),ui(Pn)),[xe.All]:bt(Gt(2,1/0),ui(Pn)),[xe.Not]:bt(Gt(1,1),ui(Pn)),[xe.Equal]:bt(Gt(2,2),ui(op)),[xe.NotEqual]:bt(Gt(2,2),ui(op)),[xe.GreaterThan]:bt(Gt(2,2),ui(He)),[xe.GreaterThanOrEqualTo]:bt(Gt(2,2),ui(He)),[xe.LessThan]:bt(Gt(2,2),ui(He)),[xe.LessThanOrEqualTo]:bt(Gt(2,2),ui(He)),[xe.Multiply]:bt(Gt(2,1/0),Sb),[xe.Coalesce]:bt(Gt(2,1/0),Sb),[xe.Divide]:bt(Gt(2,2),ui(He)),[xe.Add]:bt(Gt(2,1/0),ui(He)),[xe.Subtract]:bt(Gt(2,2),ui(He)),[xe.Clamp]:bt(Gt(3,3),ui(He)),[xe.Mod]:bt(Gt(2,2),ui(He)),[xe.Pow]:bt(Gt(2,2),ui(He)),[xe.Abs]:bt(Gt(1,1),ui(He)),[xe.Floor]:bt(Gt(1,1),ui(He)),[xe.Ceil]:bt(Gt(1,1),ui(He)),[xe.Round]:bt(Gt(1,1),ui(He)),[xe.Sin]:bt(Gt(1,1),ui(He)),[xe.Cos]:bt(Gt(1,1),ui(He)),[xe.Atan]:bt(Gt(1,2),ui(He)),[xe.Sqrt]:bt(Gt(1,1),ui(He)),[xe.Match]:bt(Gt(4,1/0),Tb,xF),[xe.Between]:bt(Gt(3,3),ui(He)),[xe.Interpolate]:bt(Gt(6,1/0),Tb,wF),[xe.Case]:bt(Gt(3,1/0),vF,bF),[xe.In]:bt(Gt(2,2),EF),[xe.Number]:bt(Gt(1,1/0),ui(op)),[xe.String]:bt(Gt(1,1/0),ui(op)),[xe.Array]:bt(Gt(1,1/0),ui(He)),[xe.Color]:bt(Gt(1,4),ui(He)),[xe.Band]:bt(Gt(1,3),ui(He)),[xe.Palette]:bt(Gt(2,2),SF),[xe.ToString]:bt(Gt(1,1),ui(Pn|He|Vn|Vi))};function Eb(i,e,t){const n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){const o=i[s+1];switch(typeof o){case"number":{r[s]=new zn(He,o);break}case"string":{r[s]=new zn(Vn,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}s===0&&t.properties.add(String(o))}return r}function mF(i,e,t){const n=i[1];if(typeof n!="string")throw new Error("expected a string argument for var operation");return t.variables.add(n),[new zn(Vn,n)]}function _F(i,e,t){t.featureId=!0}function yF(i,e,t){t.geometryType=!0}function n_(i,e,t){t.mapState=!0}function xh(i,e,t){const n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function Gt(i,e){return function(t,n,r){const s=t[0],o=t.length-1;if(i===e){if(o!==i){const a=i===1?"":"s";throw new Error(`expected ${i} argument${a} for ${s}, got ${o}`)}}else if(o<i||o>e){const a=e===1/0?`${i} or more`:`${i} to ${e}`;throw new Error(`expected ${a} arguments for ${s}, got ${o}`)}}}function Sb(i,e,t){const n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){const o=Kn(i[s+1],e,t);r[s]=o}return r}function ui(i){return function(e,t,n){const r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){const a=Kn(e[o+1],i,n);s[o]=a}return s}}function vF(i,e,t){const n=i[0],r=i.length-1;if(r%2===0)throw new Error(`expected an odd number of arguments for ${n}, got ${r} instead`)}function Tb(i,e,t){const n=i[0],r=i.length-1;if(r%2===1)throw new Error(`expected an even number of arguments for operation ${n}, got ${r} instead`)}function xF(i,e,t){const n=i.length-1,r=Vn|He|Pn,s=Kn(i[1],r,t),o=Kn(i[i.length-1],e,t),a=new Array(n-2);for(let l=0;l<n-2;l+=2){try{const c=Kn(i[l+2],s.type,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}try{const c=Kn(i[l+3],o.type,t);a[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+2} of match expression: ${c.message}`)}}return[s,...a,o]}function wF(i,e,t){const n=i[1];let r;switch(n[0]){case"linear":r=1;break;case"exponential":const l=n[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);r=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}const s=new zn(He,r);let o;try{o=Kn(i[2],He,t)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}const a=new Array(i.length-3);for(let l=0;l<a.length;l+=2){try{const c=Kn(i[l+3],He,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{const c=Kn(i[l+4],e,t);a[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${c.message}`)}}return[s,o,...a]}function bF(i,e,t){const n=Kn(i[i.length-1],e,t),r=new Array(i.length-1);for(let s=0;s<r.length-1;s+=2){try{const o=Kn(i[s+1],Pn,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{const o=Kn(i[s+2],n.type,t);r[s+1]=o}catch(o){throw new Error(`failed to parse argument ${s+1} of case expression: ${o.message}`)}}return r[r.length-1]=n,r}function EF(i,e,t){let n=i[2];if(!Array.isArray(n))throw new Error('the second argument for the "in" operator must be an array');let r;if(typeof n[0]=="string"){if(n[0]!=="literal")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');if(!Array.isArray(n[1]))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array');n=n[1],r=Vn}else r=He;const s=new Array(n.length);for(let a=0;a<s.length;a++)try{const l=Kn(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[Kn(i[1],r,t),...s]}function SF(i,e,t){let n;try{n=Kn(i[1],He,t)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}const r=i[2];if(!Array.isArray(r))throw new Error("the second argument of palette must be an array");const s=new Array(r.length);for(let o=0;o<s.length;o++){let a;try{a=Kn(r[o],Vi,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof zn))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[n,...s]}function bt(...i){return function(e,t,n){const r=e[0];let s;for(let o=0;o<i.length;o++){const a=i[o](e,t,n);if(o==i.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");s=a}}return new _L(t,r,...s)}}function TF(i,e,t){const n=i[0],r=pF[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function Tx(i){if(!i)return"";const e=i.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return Tx(i.getGeometries()[0]);default:return""}}function yL(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function $a(i,e,t){const n=Kn(i,e,t);return oo(n)}function oo(i,e){if(i instanceof zn){if(i.type===Vi&&typeof i.value=="string"){const n=wx(i.value);return function(){return n}}return function(){return i.value}}const t=i.operator;switch(t){case xe.Number:case xe.String:case xe.Coalesce:return LF(i);case xe.Get:case xe.Var:case xe.Has:return CF(i);case xe.Id:return n=>n.featureId;case xe.GeometryType:return n=>n.geometryType;case xe.Concat:{const n=i.args.map(r=>oo(r));return r=>"".concat(...n.map(s=>s(r).toString()))}case xe.Resolution:return n=>n.resolution;case xe.Any:case xe.All:case xe.Between:case xe.In:case xe.Not:return PF(i);case xe.Equal:case xe.NotEqual:case xe.LessThan:case xe.LessThanOrEqualTo:case xe.GreaterThan:case xe.GreaterThanOrEqualTo:return AF(i);case xe.Multiply:case xe.Divide:case xe.Add:case xe.Subtract:case xe.Clamp:case xe.Mod:case xe.Pow:case xe.Abs:case xe.Floor:case xe.Ceil:case xe.Round:case xe.Sin:case xe.Cos:case xe.Atan:case xe.Sqrt:return MF(i);case xe.Case:return RF(i);case xe.Match:return IF(i);case xe.Interpolate:return NF(i);case xe.ToString:return FF(i);default:throw new Error(`Unsupported operator ${t}`)}}function LF(i,e){const t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=oo(i.args[s]);switch(t){case xe.Coalesce:return s=>{for(let o=0;o<n;++o){const a=r[o](s);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case xe.Number:case xe.String:return s=>{for(let o=0;o<n;++o){const a=r[o](s);if(typeof a===t)return a}throw new Error(`Expected one of the values to be a ${t}`)};default:throw new Error(`Unsupported assertion operator ${t}`)}}function CF(i,e){const n=i.args[0].value;switch(i.operator){case xe.Get:return r=>{const s=i.args;let o=r.properties[n];for(let a=1,l=s.length;a<l;++a){const h=s[a].value;o=o[h]}return o};case xe.Var:return r=>r.variables[n];case xe.Has:return r=>{const s=i.args;if(!(n in r.properties))return!1;let o=r.properties[n];for(let a=1,l=s.length;a<l;++a){const h=s[a].value;if(!o||!Object.hasOwn(o,h))return!1;o=o[h]}return!0};default:throw new Error(`Unsupported accessor operator ${i.operator}`)}}function AF(i,e){const t=i.operator,n=oo(i.args[0]),r=oo(i.args[1]);switch(t){case xe.Equal:return s=>n(s)===r(s);case xe.NotEqual:return s=>n(s)!==r(s);case xe.LessThan:return s=>n(s)<r(s);case xe.LessThanOrEqualTo:return s=>n(s)<=r(s);case xe.GreaterThan:return s=>n(s)>r(s);case xe.GreaterThanOrEqualTo:return s=>n(s)>=r(s);default:throw new Error(`Unsupported comparison operator ${t}`)}}function PF(i,e){const t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=oo(i.args[s]);switch(t){case xe.Any:return s=>{for(let o=0;o<n;++o)if(r[o](s))return!0;return!1};case xe.All:return s=>{for(let o=0;o<n;++o)if(!r[o](s))return!1;return!0};case xe.Between:return s=>{const o=r[0](s),a=r[1](s),l=r[2](s);return o>=a&&o<=l};case xe.In:return s=>{const o=r[0](s);for(let a=1;a<n;++a)if(o===r[a](s))return!0;return!1};case xe.Not:return s=>!r[0](s);default:throw new Error(`Unsupported logical operator ${t}`)}}function MF(i,e){const t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=oo(i.args[s]);switch(t){case xe.Multiply:return s=>{let o=1;for(let a=0;a<n;++a)o*=r[a](s);return o};case xe.Divide:return s=>r[0](s)/r[1](s);case xe.Add:return s=>{let o=0;for(let a=0;a<n;++a)o+=r[a](s);return o};case xe.Subtract:return s=>r[0](s)-r[1](s);case xe.Clamp:return s=>{const o=r[0](s),a=r[1](s);if(o<a)return a;const l=r[2](s);return o>l?l:o};case xe.Mod:return s=>r[0](s)%r[1](s);case xe.Pow:return s=>Math.pow(r[0](s),r[1](s));case xe.Abs:return s=>Math.abs(r[0](s));case xe.Floor:return s=>Math.floor(r[0](s));case xe.Ceil:return s=>Math.ceil(r[0](s));case xe.Round:return s=>Math.round(r[0](s));case xe.Sin:return s=>Math.sin(r[0](s));case xe.Cos:return s=>Math.cos(r[0](s));case xe.Atan:return n===2?s=>Math.atan2(r[0](s),r[1](s)):s=>Math.atan(r[0](s));case xe.Sqrt:return s=>Math.sqrt(r[0](s));default:throw new Error(`Unsupported numeric operator ${t}`)}}function RF(i,e){const t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=oo(i.args[r]);return r=>{for(let s=0;s<t-1;s+=2)if(n[s](r))return n[s+1](r);return n[t-1](r)}}function IF(i,e){const t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=oo(i.args[r]);return r=>{const s=n[0](r);for(let o=1;o<t-1;o+=2)if(s===n[o](r))return n[o+1](r);return n[t-1](r)}}function NF(i,e){const t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=oo(i.args[r]);return r=>{const s=n[0](r),o=n[1](r);let a,l;for(let c=2;c<t;c+=2){const h=n[c](r);let u=n[c+1](r);const f=Array.isArray(u);if(f&&(u=uF(u)),h>=o)return c===2?u:f?OF(s,o,a,l,h,u):Of(s,o,a,l,h,u);a=h,l=u}return l}}function FF(i,e){const t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=oo(i.args[s]);switch(t){case xe.ToString:return s=>{const o=r[0](s);return i.args[0].type===Vi?bx(o):o.toString()};default:throw new Error(`Unsupported convert operator ${t}`)}}function Of(i,e,t,n,r,s){const o=r-t;if(o===0)return n;const a=e-t,l=i===1?a/o:(Math.pow(i,a)-1)/(Math.pow(i,o)-1);return n+l*(s-n)}function OF(i,e,t,n,r,s){if(r-t===0)return n;const a=wb(n),l=wb(s);let c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);const h=[Of(i,e,t,a[0],r,l[0]),Of(i,e,t,a[1],r,l[1]),a[2]+Of(i,e,t,0,r,c),Of(i,e,t,n[3],r,s[3])];return fF(h)}const Ye={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class Rm extends Nu{constructor(e,t,n,r){super(),this.extent=e,this.pixelRatio_=n,this.resolution=t,this.state=typeof r=="function"?Ye.IDLE:r,this.image_=null,this.loader=typeof r=="function"?r:null}changed(){this.dispatchEvent(Qe.CHANGE)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(this.state==Ye.IDLE&&this.loader){this.state=Ye.LOADING,this.changed();const e=this.getResolution(),t=Array.isArray(e)?e[0]:e;Nv(()=>this.loader(this.getExtent(),t,this.getPixelRatio())).then(n=>{"image"in n&&(this.image_=n.image),"extent"in n&&(this.extent=n.extent),"resolution"in n&&(this.resolution=n.resolution),"pixelRatio"in n&&(this.pixelRatio_=n.pixelRatio),(n instanceof HTMLImageElement||tL&&n instanceof ImageBitmap||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement)&&(this.image_=n),this.state=Ye.LOADED}).catch(n=>{this.state=Ye.ERROR,console.error(n)}).finally(()=>this.changed())}}setImage(e){this.image_=e}setResolution(e){this.resolution=e}}function DF(i,e,t){const n=i;let r=!0,s=!1,o=!1;const a=[_0(n,Qe.LOAD,function(){o=!0,s||e()})];return n.src&&ax?(s=!0,n.decode().then(function(){r&&e()}).catch(function(l){r&&(o?e():t())})):a.push(_0(n,Qe.ERROR,t)),function(){r=!1,a.forEach(Zt)}}function kF(i,e){return new Promise((t,n)=>{function r(){o(),t(i)}function s(){o(),n(new Error("Image load error"))}function o(){i.removeEventListener("load",r),i.removeEventListener("error",s)}i.addEventListener("load",r),i.addEventListener("error",s)})}function vL(i,e){return e&&(i.src=e),i.src&&ax?new Promise((t,n)=>i.decode().then(()=>t(i)).catch(r=>i.complete&&i.width?t(i):n(r))):kF(i)}function Im(i,e){return e&&(i.src=e),i.src&&ax&&tL?i.decode().then(()=>createImageBitmap(i)).catch(t=>{if(i.complete&&i.width)return i;throw t}):vL(i)}class GF{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let e=0;for(const t in this.cache_){const n=this.cache_[t];(e++&3)===0&&!n.hasListener()&&(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t,n){const r=r_(e,t,n);return r in this.cache_?this.cache_[r]:null}getPattern(e,t,n){const r=r_(e,t,n);return r in this.patternCache_?this.patternCache_[r]:null}set(e,t,n,r,s){const o=r_(e,t,n),a=o in this.cache_;this.cache_[o]=r,s&&(r.getImageState()===Ye.IDLE&&r.load(),r.getImageState()===Ye.LOADING?r.ready().then(()=>{this.patternCache_[o]=L0().createPattern(r.getImage(1),"repeat")}):this.patternCache_[o]=L0().createPattern(r.getImage(1),"repeat")),a||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}}function r_(i,e,t){const n=t?so(t):"null";return e+":"+i+":"+n}const Ms=new GF;let Lf=null;class xL extends Nu{constructor(e,t,n,r,s){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n,this.canvas_={},this.color_=s,this.imageState_=r===void 0?Ye.IDLE:r,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===Ye.LOADED){Lf||(Lf=Xi(1,1,void 0,{willReadFrequently:!0})),Lf.drawImage(this.image_,0,0);try{Lf.getImageData(0,0,1,1),this.tainted_=!1}catch{Lf=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(Qe.CHANGE)}handleImageError_(){this.imageState_=Ye.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Ye.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const e=this.size_[0],t=this.size_[1],n=Xi(e,t);n.fillRect(0,0,e,t),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Ye.IDLE){this.image_||this.initializeImage_(),this.imageState_=Ye.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&vL(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==Ye.LOADED)return;const t=this.image_,n=Xi(Math.ceil(t.width*e),Math.ceil(t.height*e)),r=n.canvas;n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation="multiply",n.fillStyle=No(this.color_),n.fillRect(0,0,r.width/e,r.height/e),n.globalCompositeOperation="destination-in",n.drawImage(t,0,0),this.canvas_[e]=r}ready(){return this.ready_||(this.ready_=new Promise(e=>{if(this.imageState_===Ye.LOADED||this.imageState_===Ye.ERROR)e();else{const t=()=>{(this.imageState_===Ye.LOADED||this.imageState_===Ye.ERROR)&&(this.removeEventListener(Qe.CHANGE,t),e())};this.addEventListener(Qe.CHANGE,t)}})),this.ready_}}function A0(i,e,t,n,r,s){let o=e===void 0?void 0:Ms.get(e,t,r);return o||(o=new xL(i,i&&"src"in i?i.src||void 0:e,t,n,r),Ms.set(e,t,r,o,s)),s&&o&&!Ms.getPattern(e,t,r)&&Ms.set(e,t,r,o,s),o}function Fo(i){return i?Array.isArray(i)?bx(i):typeof i=="object"&&"src"in i?BF(i):i:null}function BF(i){if(!i.offset||!i.size)return Ms.getPattern(i.src,"anonymous",i.color);const e=i.src+":"+i.offset,t=Ms.getPattern(e,void 0,i.color);if(t)return t;const n=Ms.get(i.src,"anonymous",null);if(n.getImageState()!==Ye.LOADED)return null;const r=Xi(i.size[0],i.size[1]);return r.drawImage(n.getImage(1),i.offset[0],i.offset[1],i.size[0],i.size[1],0,0,i.size[0],i.size[1]),A0(r.canvas,e,void 0,Ye.LOADED,i.color,!0),Ms.getPattern(e,void 0,i.color)}const wL="10px sans-serif",qr="#000",Tu="round",Fa=[],Oa=0,Lu="round",Pd=10,Md="#000",Rd="center",P0="middle",Lc=[0,0,0,0],Id=1,Dh=new Yr;let Cf=null,Lb;const Iy={},jF=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function UF(i,e,t){return`${i} ${e} 16px "${t}"`}const zF=(function(){let e,t;async function n(s){await t.ready;const o=await t.load(s);if(o.length===0)return!1;const a=Ay(s),l=a.families[0].toLowerCase(),c=a.weight;return o.some(h=>{const u=h.family.replace(/^['"]|['"]$/g,"").toLowerCase(),f=Cy[h.weight]||h.weight;return u===l&&h.style===a.style&&f==c})}async function r(){await t.ready;let s=!0;const o=Dh.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){const c=a[l];let h=o[c];h<100&&(await n(c)?(jl(Iy),Dh.set(c,100)):(h+=10,Dh.set(c,h,!0),h<100&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(s){t||(t=Xr?self.fonts:document.fonts);const o=Ay(s);if(!o)return;const a=o.families;let l=!1;for(const c of a){if(jF.has(c))continue;const h=UF(o.style,o.weight,c);Dh.get(h)===void 0&&(Dh.set(h,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(r,100))}})(),qF=(function(){let i;return function(e){let t=Iy[e];if(t==null){if(Xr){const n=Ay(e),r=bL(e,"Žg");t=(isNaN(Number(n.lineHeight))?1.2:Number(n.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else i||(i=document.createElement("div"),i.innerHTML="M",i.style.minHeight="0",i.style.maxHeight="none",i.style.height="auto",i.style.padding="0",i.style.border="none",i.style.position="absolute",i.style.display="block",i.style.left="-99999px"),i.style.font=e,document.body.appendChild(i),t=i.offsetHeight,document.body.removeChild(i);Iy[e]=t}return t}})();function bL(i,e){return Cf||(Cf=Xi(1,1)),i!=Lb&&(Cf.font=i,Lb=Cf.font),Cf.measureText(e)}function EL(i,e){return bL(i,e).width}function Cb(i,e,t){if(e in t)return t[e];const n=e.split(`
3
- `).reduce((r,s)=>Math.max(r,EL(i,s)),0);return t[e]=n,n}function VF(i,e){const t=[],n=[],r=[];let s=0,o=0,a=0,l=0;for(let c=0,h=e.length;c<=h;c+=2){const u=e[c];if(u===`
4
- `||c===h){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}const f=e[c+1]||i.font,d=EL(f,u);t.push(d),o+=d;const g=qF(f);n.push(g),l=Math.max(l,g)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function $F(i,e,t,n,r,s,o,a,l,c,h){i.save(),t!==1&&(i.globalAlpha===void 0?i.globalAlpha=u=>u.globalAlpha*=t:i.globalAlpha*=t),e&&i.transform.apply(i,e),n.contextInstructions?(i.translate(l,c),i.scale(h[0],h[1]),WF(n,i)):h[0]<0||h[1]<0?(i.translate(l,c),i.scale(h[0],h[1]),i.drawImage(n,r,s,o,a,0,0,o,a)):i.drawImage(n,r,s,o,a,l,c,o*h[0],a*h[1]),i.restore()}function WF(i,e){const t=i.contextInstructions;for(let n=0,r=t.length;n<r;n+=2)Array.isArray(t[n+1])?e[t[n]].apply(e,t[n+1]):e[t[n]]=t[n+1]}class Nm{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=Hi(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){const e=this.getScale();return new Nm({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return Kt()}getImage(e){return Kt()}getHitDetectionImage(){return Kt()}getPixelRatio(e){return 1}getImageState(){return Kt()}getImageSize(){return Kt()}getOrigin(){return Kt()}getSize(){return Kt()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=Hi(e)}listenImageChange(e){Kt()}load(){Kt()}unlistenImageChange(e){Kt()}ready(){return Promise.resolve()}}class Ic extends Nm{constructor(e){super({opacity:1,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,rotation:e.rotation!==void 0?e.rotation:0,scale:e.scale!==void 0?e.scale:1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=e.fill!==void 0?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius=e.radius,this.radius2_=e.radius2,this.angle_=e.angle!==void 0?e.angle:0,this.stroke_=e.stroke!==void 0?e.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?Ye.LOADING:Ye.LOADED,this.imageState_===Ye.LOADING&&this.ready().then(()=>this.imageState_=Ye.LOADED),this.render()}clone(){const e=this.getScale(),t=new Ic({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}getAnchor(){const e=this.size_,t=this.getDisplacement(),n=this.getScaleArray();return[e[0]/2-t[0]/n[0],e[1]/2+t[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(e){const t=this.fill_?.getKey(),n=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(",");let r=Ms.get(n,null,null)?.getImage(1);if(!r){const s=this.renderOptions_,o=Math.ceil(s.size*e),a=Xi(o,o);this.draw_(s,a,e),r=a.canvas,Ms.set(n,null,null,new xL(r,void 0,null,Ye.LOADED,null))}return r}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,n){if(t===0||this.points_===1/0||e!=="bevel"&&e!=="miter")return t;let r=this.radius,s=this.radius2_===void 0?r:this.radius2_;if(r<s){const F=r;r=s,s=F}const o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=s*Math.sin(a),c=Math.sqrt(s*s-l*l),h=r-c,u=Math.sqrt(l*l+h*h),f=u/l;if(e==="miter"&&f<=n)return f*t;const d=t/2/f,g=t/2*(h/u),_=Math.sqrt((r+d)*(r+d)+g*g)-r;if(this.radius2_===void 0||e==="bevel")return _*2;const v=r*Math.sin(a),x=Math.sqrt(r*r-v*v),S=s-x,A=Math.sqrt(v*v+S*S)/v;if(A<=n){const F=A*t/2-s-r;return 2*Math.max(_,F)}return _*2}createRenderOptions(){let e=Tu,t=Lu,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=Fo(this.stroke_.getColor()??Md),a=this.stroke_.getWidth()??Id,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??Lu,e=this.stroke_.getLineCap()??Tu,n=this.stroke_.getMiterLimit()??Pd);const l=this.calculateLineJoinSize_(t,a,n),c=Math.max(this.radius,this.radius2_||0),h=Math.ceil(2*c+l);return{strokeStyle:o,strokeWidth:a,size:h,lineCap:e,lineDash:r,lineDashOffset:s,lineJoin:t,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();const e=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[e,e]}draw_(e,t,n){if(t.scale(n,n),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let r=this.fill_.getColor();r===null&&(r=qr),t.fillStyle=Fo(r),t.fill()}e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){let t;if(this.fill_){let n=this.fill_.getColor(),r=0;typeof n=="string"&&(n=so(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Xi(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_;const n=this.radius;if(t===1/0)e.arc(0,0,n,0,2*Math.PI);else{const r=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(t*=2);const s=this.angle_-Math.PI/2,o=2*Math.PI/t;for(let a=0;a<t;a++){const l=s+a*o,c=a%2===0?n:r;e.lineTo(c*Math.cos(l),c*Math.sin(l))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=qr,t.fill(),e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}class $l extends Ic{constructor(e){e=e||{radius:5},super({points:1/0,fill:e.fill,radius:e.radius,stroke:e.stroke,scale:e.scale!==void 0?e.scale:1,rotation:e.rotation!==void 0?e.rotation:0,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode})}clone(){const e=this.getScale(),t=new $l({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}setRadius(e){this.radius=e,this.render()}}class cr{constructor(e){e=e||{},this.patternImage_=null,this.color_=null,e.color!==void 0&&this.setColor(e.color)}clone(){const e=this.getColor();return new cr({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){if(e!==null&&typeof e=="object"&&"src"in e){const t=A0(null,e.src,"anonymous",void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===Ye.IDLE&&t.load(),t.getImageState()===Ye.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){const e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?Ue(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:so(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}function Ab(i,e,t,n){return t!==void 0&&n!==void 0?[t/i,n/e]:t!==void 0?t/i:n!==void 0?n/e:1}class eg extends Nm{constructor(e){e=e||{};const t=e.opacity!==void 0?e.opacity:1,n=e.rotation!==void 0?e.rotation:0,r=e.scale!==void 0?e.scale:1,s=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:n,scale:r,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:s,declutterMode:e.declutterMode}),this.anchor_=e.anchor!==void 0?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin!==void 0?e.anchorOrigin:"top-left",this.anchorXUnits_=e.anchorXUnits!==void 0?e.anchorXUnits:"fraction",this.anchorYUnits_=e.anchorYUnits!==void 0?e.anchorYUnits:"fraction",this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null;const o=e.img!==void 0?e.img:null;let a=e.src;Vt(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||Ue(o)),Vt(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),Vt(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(e.src!==void 0?l=Ye.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?Ye.LOADED:Ye.IDLE:l=Ye.LOADING:l=Ye.LOADED),this.color_=e.color!==void 0?so(e.color):null,this.iconImage_=A0(o,a,this.crossOrigin_,l,this.color_),this.offset_=e.offset!==void 0?e.offset:[0,0],this.offsetOrigin_=e.offsetOrigin!==void 0?e.offsetOrigin:"top-left",this.origin_=null,this.size_=e.size!==void 0?e.size:null,this.initialOptions_,e.width!==void 0||e.height!==void 0){let c,h;if(e.size)[c,h]=e.size;else{const u=this.getImage(1);if(u.width&&u.height)c=u.width,h=u.height;else if(u instanceof HTMLImageElement){this.initialOptions_=e;const f=()=>{if(this.unlistenImageChange(f),!this.initialOptions_)return;const d=this.iconImage_.getSize();this.setScale(Ab(d[0],d[1],e.width,e.height))};this.listenImageChange(f);return}}c!==void 0&&this.setScale(Ab(c,h,e.width,e.height))}}clone(){let e,t,n;return this.initialOptions_?(t=this.initialOptions_.width,n=this.initialOptions_.height):(e=this.getScale(),e=Array.isArray(e)?e.slice():e),new eg({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:e,width:t,height:n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;const r=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!r)return null;e=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(e[0]*=r[0]),this.anchorYUnits_=="fraction"&&(e[1]*=r[1])}if(this.anchorOrigin_!="top-left"){if(!r)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(e[0]=-e[0]+r[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(e[1]=-e[1]+r[1])}this.normalizedAnchor_=e}const t=this.getDisplacement(),n=this.getScaleArray();return[e[0]-t[0]/n[0],e[1]+t[1]/n[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!="top-left"){const t=this.getSize(),n=this.iconImage_.getSize();if(!t||!n)return null;e=e.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(e[0]=n[0]-t[0]-e[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(e[1]=n[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=A0(null,e,this.crossOrigin_,Ye.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==Ye.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){const e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==Ye.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(Qe.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(Qe.CHANGE,e)}ready(){return this.iconImage_.ready()}}class xn{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash!==void 0?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.width_=e.width}clone(){const e=this.getColor();return new xn({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setWidth(e){this.width_=e}}class Li{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=Pb,e.geometry!==void 0&&this.setGeometry(e.geometry),this.fill_=e.fill!==void 0?e.fill:null,this.image_=e.image!==void 0?e.image:null,this.renderer_=e.renderer!==void 0?e.renderer:null,this.hitDetectionRenderer_=e.hitDetectionRenderer!==void 0?e.hitDetectionRenderer:null,this.stroke_=e.stroke!==void 0?e.stroke:null,this.text_=e.text!==void 0?e.text:null,this.zIndex_=e.zIndex}clone(){let e=this.getGeometry();return e&&typeof e=="object"&&(e=e.clone()),new Li({geometry:e??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){typeof e=="function"?this.geometryFunction_=e:typeof e=="string"?this.geometryFunction_=function(t){return t.get(e)}:e?e!==void 0&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=Pb,this.geometry_=e}setZIndex(e){this.zIndex_=e}}function HF(i){let e;if(typeof i=="function")e=i;else{let t;Array.isArray(i)?t=i:(Vt(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[i]),e=function(){return t}}return e}let s_=null;function SL(i,e){if(!s_){const t=new cr({color:"rgba(255,255,255,0.4)"}),n=new xn({color:"#3399CC",width:1.25});s_=[new Li({image:new $l({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return s_}function Lx(){const i={},e=[255,255,255,1],t=[0,153,255,1],n=3;return i.Polygon=[new Li({fill:new cr({color:[255,255,255,.5]})})],i.MultiPolygon=i.Polygon,i.LineString=[new Li({stroke:new xn({color:e,width:n+2})}),new Li({stroke:new xn({color:t,width:n})})],i.MultiLineString=i.LineString,i.Circle=i.Polygon.concat(i.LineString),i.Point=[new Li({image:new $l({radius:n*2,fill:new cr({color:t}),stroke:new xn({color:e,width:n/2})}),zIndex:1/0})],i.MultiPoint=i.Point,i.GeometryCollection=i.Polygon.concat(i.LineString,i.Point),i}function Pb(i){return i.getGeometry()}const XF="#333";class Uo{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.keepUpright_=e.keepUpright,this.scale_=e.scale,this.scaleArray_=Hi(e.scale!==void 0?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=e.fill!==void 0?e.fill:new cr({color:XF}),this.maxAngle_=e.maxAngle!==void 0?e.maxAngle:Math.PI/4,this.placement_=e.placement!==void 0?e.placement:"point",this.overflow_=!!e.overflow,this.stroke_=e.stroke!==void 0?e.stroke:null,this.offsetX_=e.offsetX!==void 0?e.offsetX:0,this.offsetY_=e.offsetY!==void 0?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=e.padding===void 0?null:e.padding,this.declutterMode_=e.declutterMode}clone(){const e=this.getScale();return new Uo({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof cr?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setKeepUpright(e){this.keepUpright_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=Hi(e!==void 0?e:1)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}}function KF(i){return!0}function YF(i){const e=Sx(),t=ZF(i,e),n=yL();return function(r,s){if(n.properties=r.getPropertiesInternal(),n.resolution=s,e.featureId){const o=r.getId();o!==void 0?n.featureId=o:n.featureId=null}return e.geometryType&&(n.geometryType=Tx(r.getGeometry())),t(n)}}function Mb(i){const e=Sx(),t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=Ny(i[o],e);const r=yL(),s=new Array(t);return function(o,a){if(r.properties=o.getPropertiesInternal(),r.resolution=a,e.featureId){const c=o.getId();c!==void 0?r.featureId=c:r.featureId=null}let l=0;for(let c=0;c<t;++c){const h=n[c](r);h&&(s[l]=h,l+=1)}return s.length=l,s}}function ZF(i,e){const t=i.length,n=new Array(t);for(let r=0;r<t;++r){const s=i[r],o="filter"in s?$a(s.filter,Pn,e):KF;let a;if(Array.isArray(s.style)){const l=s.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=Ny(s.style[c],e)}else a=[Ny(s.style,e)];n[r]={filter:o,styles:a}}return function(r){const s=[];let o=!1;for(let a=0;a<t;++a){const l=n[a].filter;if(l(r)&&!(i[a].else&&o)){o=!0;for(const c of n[a].styles){const h=c(r);h&&s.push(h)}}}return s}}function Ny(i,e){const t=Nd(i,"",e),n=Fd(i,"",e),r=JF(i,e),s=QF(i,e),o=$r(i,"z-index",e);if(!t&&!n&&!r&&!s&&!Fc(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));const a=new Li;return function(l){let c=!0;if(t){const h=t(l);h&&(c=!1),a.setFill(h)}if(n){const h=n(l);h&&(c=!1),a.setStroke(h)}if(r){const h=r(l);h&&(c=!1),a.setText(h)}if(s){const h=s(l);h&&(c=!1),a.setImage(h)}return o&&a.setZIndex(o(l)),c?null:a}}function Nd(i,e,t){let n;if(e+"fill-pattern-src"in i)n=nO(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=Cx(i,e+"fill-color",t)}if(!n)return null;const r=new cr;return function(s){const o=n(s);return o===xx?null:(r.setColor(o),r)}}function Fd(i,e,t){const n=$r(i,e+"stroke-width",t),r=Cx(i,e+"stroke-color",t);if(!n&&!r)return null;const s=Ca(i,e+"stroke-line-cap",t),o=Ca(i,e+"stroke-line-join",t),a=TL(i,e+"stroke-line-dash",t),l=$r(i,e+"stroke-line-dash-offset",t),c=$r(i,e+"stroke-miter-limit",t),h=new xn;return function(u){if(r){const f=r(u);if(f===xx)return null;h.setColor(f)}if(n&&h.setWidth(n(u)),s){const f=s(u);if(f!=="butt"&&f!=="round"&&f!=="square")throw new Error("Expected butt, round, or square line cap");h.setLineCap(f)}if(o){const f=o(u);if(f!=="bevel"&&f!=="round"&&f!=="miter")throw new Error("Expected bevel, round, or miter line join");h.setLineJoin(f)}return a&&h.setLineDash(a(u)),l&&h.setLineDashOffset(l(u)),c&&h.setMiterLimit(c(u)),h}}function JF(i,e){const t="text-",n=Ca(i,t+"value",e);if(!n)return null;const r=Nd(i,t,e),s=Nd(i,t+"background-",e),o=Fd(i,t,e),a=Fd(i,t+"background-",e),l=Ca(i,t+"font",e),c=$r(i,t+"max-angle",e),h=$r(i,t+"offset-x",e),u=$r(i,t+"offset-y",e),f=cu(i,t+"overflow",e),d=Ca(i,t+"placement",e),g=$r(i,t+"repeat",e),m=Fm(i,t+"scale",e),_=cu(i,t+"rotate-with-view",e),v=$r(i,t+"rotation",e),x=Ca(i,t+"align",e),S=Ca(i,t+"justify",e),b=Ca(i,t+"baseline",e),A=cu(i,t+"keep-upright",e),F=TL(i,t+"padding",e),N=Om(i,t+"declutter-mode"),R=new Uo({declutterMode:N});return function(P){if(R.setText(n(P)),r&&R.setFill(r(P)),s&&R.setBackgroundFill(s(P)),o&&R.setStroke(o(P)),a&&R.setBackgroundStroke(a(P)),l&&R.setFont(l(P)),c&&R.setMaxAngle(c(P)),h&&R.setOffsetX(h(P)),u&&R.setOffsetY(u(P)),f&&R.setOverflow(f(P)),d){const O=d(P);if(O!=="point"&&O!=="line")throw new Error("Expected point or line for text-placement");R.setPlacement(O)}if(g&&R.setRepeat(g(P)),m&&R.setScale(m(P)),_&&R.setRotateWithView(_(P)),v&&R.setRotation(v(P)),x){const O=x(P);if(O!=="left"&&O!=="center"&&O!=="right"&&O!=="end"&&O!=="start")throw new Error("Expected left, right, center, start, or end for text-align");R.setTextAlign(O)}if(S){const O=S(P);if(O!=="left"&&O!=="right"&&O!=="center")throw new Error("Expected left, right, or center for text-justify");R.setJustify(O)}if(b){const O=b(P);if(O!=="bottom"&&O!=="top"&&O!=="middle"&&O!=="alphabetic"&&O!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");R.setTextBaseline(O)}return F&&R.setPadding(F(P)),A&&R.setKeepUpright(A(P)),R}}function QF(i,e){return"icon-src"in i?eO(i,e):"shape-points"in i?tO(i,e):"circle-radius"in i?iO(i,e):null}function eO(i,e){const t="icon-",n=t+"src",r=LL(i[n],n),s=M0(i,t+"anchor",e),o=Fm(i,t+"scale",e),a=$r(i,t+"opacity",e),l=M0(i,t+"displacement",e),c=$r(i,t+"rotation",e),h=cu(i,t+"rotate-with-view",e),u=Ib(i,t+"anchor-origin"),f=Nb(i,t+"anchor-x-units"),d=Nb(i,t+"anchor-y-units"),g=aO(i,t+"color"),m=sO(i,t+"cross-origin"),_=oO(i,t+"offset"),v=Ib(i,t+"offset-origin"),x=R0(i,t+"width"),S=R0(i,t+"height"),b=rO(i,t+"size"),A=Om(i,t+"declutter-mode"),F=new eg({src:r,anchorOrigin:u,anchorXUnits:f,anchorYUnits:d,color:g,crossOrigin:m,offset:_,offsetOrigin:v,height:S,width:x,size:b,declutterMode:A});return function(N){return a&&F.setOpacity(a(N)),l&&F.setDisplacement(l(N)),c&&F.setRotation(c(N)),h&&F.setRotateWithView(h(N)),o&&F.setScale(o(N)),s&&F.setAnchor(s(N)),F}}function tO(i,e){const t="shape-",n=t+"points",r=t+"radius",s=Fy(i[n],n),o=Fy(i[r],r),a=Nd(i,t,e),l=Fd(i,t,e),c=Fm(i,t+"scale",e),h=M0(i,t+"displacement",e),u=$r(i,t+"rotation",e),f=cu(i,t+"rotate-with-view",e),d=R0(i,t+"radius2"),g=R0(i,t+"angle"),m=Om(i,t+"declutter-mode"),_=new Ic({points:s,radius:o,radius2:d,angle:g,declutterMode:m});return function(v){return a&&_.setFill(a(v)),l&&_.setStroke(l(v)),h&&_.setDisplacement(h(v)),u&&_.setRotation(u(v)),f&&_.setRotateWithView(f(v)),c&&_.setScale(c(v)),_}}function iO(i,e){const t="circle-",n=Nd(i,t,e),r=Fd(i,t,e),s=$r(i,t+"radius",e),o=Fm(i,t+"scale",e),a=M0(i,t+"displacement",e),l=$r(i,t+"rotation",e),c=cu(i,t+"rotate-with-view",e),h=Om(i,t+"declutter-mode"),u=new $l({radius:5,declutterMode:h});return function(f){return s&&u.setRadius(s(f)),n&&u.setFill(n(f)),r&&u.setStroke(r(f)),a&&u.setDisplacement(a(f)),l&&u.setRotation(l(f)),c&&u.setRotateWithView(c(f)),o&&u.setScale(o(f)),u}}function $r(i,e,t){if(!(e in i))return;const n=$a(i[e],He,t);return function(r){return Fy(n(r),e)}}function Ca(i,e,t){if(!(e in i))return null;const n=$a(i[e],Vn,t);return function(r){return LL(n(r),e)}}function nO(i,e,t){const n=Ca(i,e+"pattern-src",t),r=Rb(i,e+"pattern-offset",t),s=Rb(i,e+"pattern-size",t),o=Cx(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function cu(i,e,t){if(!(e in i))return null;const n=$a(i[e],Pn,t);return function(r){const s=n(r);if(typeof s!="boolean")throw new Error(`Expected a boolean for ${e}`);return s}}function Cx(i,e,t){if(!(e in i))return null;const n=$a(i[e],Vi,t);return function(r){return CL(n(r),e)}}function TL(i,e,t){if(!(e in i))return null;const n=$a(i[e],Kr,t);return function(r){return tg(n(r),e)}}function M0(i,e,t){if(!(e in i))return null;const n=$a(i[e],Kr,t);return function(r){const s=tg(n(r),e);if(s.length!==2)throw new Error(`Expected two numbers for ${e}`);return s}}function Rb(i,e,t){if(!(e in i))return null;const n=$a(i[e],Kr,t);return function(r){return AL(n(r),e)}}function Fm(i,e,t){if(!(e in i))return null;const n=$a(i[e],Kr|He,t);return function(r){return lO(n(r),e)}}function R0(i,e){const t=i[e];if(t!==void 0){if(typeof t!="number")throw new Error(`Expected a number for ${e}`);return t}}function rO(i,e){const t=i[e];if(t!==void 0){if(typeof t=="number")return Hi(t);if(!Array.isArray(t))throw new Error(`Expected a number or size array for ${e}`);if(t.length!==2||typeof t[0]!="number"||typeof t[1]!="number")throw new Error(`Expected a number or size array for ${e}`);return t}}function sO(i,e){const t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);return t}}function Ib(i,e){const t=i[e];if(t!==void 0){if(t!=="bottom-left"&&t!=="bottom-right"&&t!=="top-left"&&t!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return t}}function Nb(i,e){const t=i[e];if(t!==void 0){if(t!=="pixels"&&t!=="fraction")throw new Error(`Expected pixels or fraction for ${e}`);return t}}function oO(i,e){const t=i[e];if(t!==void 0)return tg(t,e)}function Om(i,e){const t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);if(t!=="declutter"&&t!=="obstacle"&&t!=="none")throw new Error(`Expected declutter, obstacle, or none for ${e}`);return t}}function aO(i,e){const t=i[e];if(t!==void 0)return CL(t,e)}function tg(i,e){if(!Array.isArray(i))throw new Error(`Expected an array for ${e}`);const t=i.length;for(let n=0;n<t;++n)if(typeof i[n]!="number")throw new Error(`Expected an array of numbers for ${e}`);return i}function LL(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function Fy(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function CL(i,e){if(typeof i=="string")return i;const t=tg(i,e),n=t.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return t}function AL(i,e){const t=tg(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function lO(i,e){return typeof i=="number"?i:AL(i,e)}const Fb={RENDER_ORDER:"renderOrder"};class Du extends Hc{constructor(e){e=e||{};const t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=e.renderBuffer!==void 0?e.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating!==void 0?e.updateWhileAnimating:!1,this.updateWhileInteracting_=e.updateWhileInteracting!==void 0?e.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Fb.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){const n=this.getDeclutter();n in e.declutter||(e.declutter[n]=new vx(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(Fb.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?SL:e;const t=cO(e);this.styleFunction_=e===null?void 0:HF(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}}function cO(i){if(i===void 0)return SL;if(!i)return null;if(typeof i=="function"||i instanceof Li)return i;if(!Array.isArray(i))return Mb([i]);if(i.length===0)return[];const e=i.length,t=i[0];if(t instanceof Li){const r=new Array(e);for(let s=0;s<e;++s){const o=i[s];if(!(o instanceof Li))throw new Error("Expected a list of style instances");r[s]=o}return r}if("style"in t){const r=new Array(e);for(let s=0;s<e;++s){const o=i[s];if(!("style"in o))throw new Error("Expected a list of rules with a style property");r[s]=o}return YF(r)}return Mb(i)}class Jf extends Dr{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}}class hO extends Yd{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){Kt()}calculateMatrices2D(e){const t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;_s(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),Su(r,n)}forEachFeatureAtCoordinate(e,t,n,r,s,o,a,l){let c;const h=t.viewState;function u(b,A,F,N){return s.call(o,A,b?F:null,N)}const f=h.projection,d=zv(e.slice(),f),g=[[0,0]];if(f.canWrapX()&&r){const b=f.getExtent(),A=St(b);g.push([-A,0],[A,0])}const m=t.layerStatesArray,_=m.length,v=[],x=[];for(let b=0;b<g.length;b++)for(let A=_-1;A>=0;--A){const F=m[A],N=F.layer;if(N.hasRenderer()&&yx(F,h)&&a.call(l,N)){const R=N.getRenderer(),P=N.getSource();if(R&&P){const O=P.getWrapX()?d:e,L=u.bind(null,F.managed);x[0]=O[0]+g[b][0],x[1]=O[1]+g[b][1],c=R.forEachFeatureAtCoordinate(x,t,n,L,v)}if(c)return c}}if(v.length===0)return;const S=1/v.length;return v.forEach((b,A)=>b.distanceSq+=A*S),v.sort((b,A)=>b.distanceSq-A.distanceSq),v.some(b=>c=b.callback(b.feature,b.layer,b.geometry)),c}hasFeatureAtCoordinate(e,t,n,r,s,o){return this.forEachFeatureAtCoordinate(e,t,n,r,zo,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){Kt()}scheduleExpireIconCache(e){Ms.canExpireCache()&&e.postRenderFunctions.push(uO)}}function uO(i,e){Ms.expire()}class fO extends hO{constructor(e){super(e),this.fontChangeListenerKey_=wt(Dh,wu.PROPERTYCHANGE,e.redrawText,e),this.element_=Xr?aL():document.createElement("div");const t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Mm+" ol-layers";const n=e.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){const n=this.getMap();if(n.hasListener(e)){const r=new Jf(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){Zt(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(qn.PRECOMPOSE,e);const t=e.layerStatesArray.sort((c,h)=>c.zIndex-h.zIndex);t.some(c=>c.layer instanceof Du&&c.layer.getDeclutter())&&(e.declutter={});const r=e.viewState;this.children_.length=0;const s=[];let o=null;for(let c=0,h=t.length;c<h;++c){const u=t[c];e.layerIndex=c;const f=u.layer,d=f.getSourceState();if(!yx(u,r)||d!="ready"&&d!="undefined"){f.unrender();continue}const g=f.render(e,o);g&&(g!==o&&(this.children_.push(g),o=g),s.push(u))}this.declutter(e,s),RN(this.element_,this.children_);const l=this.getMap().getTargetElement();if(El(l)){const c=l.getContext("2d");for(const h of this.children_){const u=h.firstElementChild||h,f=h.style.backgroundColor;if(f&&(!El(u)||u.width>0)&&(c.fillStyle=f,c.fillRect(0,0,l.width,l.height)),El(u)&&u.width>0){const d=h.style.opacity||u.style.opacity;c.globalAlpha=d===""?1:Number(d);const g=u.style.transform;if(g)c.setTransform(...Ey(g));else{const m=parseFloat(u.style.width)/u.width,_=parseFloat(u.style.height)/u.height;c.setTransform(m,0,0,_,0,0)}c.drawImage(u,0,0)}}c.globalAlpha=1,c.setTransform(1,0,0,1,0,0)}this.dispatchRenderEvent(qn.POSTCOMPOSE,e),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(e)}declutter(e,t){if(e.declutter){for(let n=t.length-1;n>=0;--n){const r=t[n],s=r.layer;s.getDeclutter()&&s.renderDeclutter(e,r)}t.forEach(n=>n.layer.renderDeferred(e))}}}function PL(i){if(i instanceof Hc){i.setMapInternal(null);return}i instanceof Vl&&i.getLayers().forEach(PL)}function ML(i,e){if(i instanceof Hc){i.setMapInternal(e);return}if(i instanceof Vl){const t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)ML(t[n],e)}}let Kc=class extends Yr{constructor(e){super(),e=e||{},this.on,this.once,this.un;const t=dO(e);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=e.maxTilesLoading!==void 0?e.maxTilesLoading:16,this.pixelRatio_=e.pixelRatio!==void 0?e.pixelRatio:fN,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=nn(),this.pixelToCoordinateTransform_=nn(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,Xr||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=e.moveTolerance,this.keyboardEventTarget_=t.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,Xr||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(Xr?new Rn:ON()),this.interactions=t.interactions||(Xr?new Rn:JN({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new pN(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(yr.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(yr.VIEW,this.handleViewChanged_),this.addChangeListener(yr.SIZE,this.handleSizeChanged_),this.addChangeListener(yr.TARGET,this.handleTargetChanged_),this.setProperties(t.values);const n=this;e.view&&!(e.view instanceof Xs)&&e.view.then(function(r){n.setView(new Xs(r))}),this.controls.addEventListener(ln.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(ln.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(ln.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(ln.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(ln.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(ln.REMOVE,r=>{const s=r.element.getId();s!==void 0&&delete this.overlayIdIndex_[s.toString()],r.element.setMap(null)}),this.controls.forEach(r=>{r.setMap(this)}),this.interactions.forEach(r=>{r.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){ML(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){const t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,n){if(!this.frameState_||!this.renderer_)return;const r=this.getCoordinateFromPixelInternal(e);n=n!==void 0?n:{};const s=n.hitTolerance!==void 0?n.hitTolerance:0,o=n.layerFilter!==void 0?n.layerFilter:zo,a=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,s,a,t,null,o,null)}getFeaturesAtPixel(e,t){const n=[];return this.forEachFeatureAtPixel(e,function(r){n.push(r)},t),n}getAllLayers(){const e=[];function t(n){n.forEach(function(r){r instanceof Vl?t(r.getLayers()):e.push(r)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;const n=this.getCoordinateFromPixelInternal(e);t=t!==void 0?t:{};const r=t.layerFilter!==void 0?t.layerFilter:zo,s=t.hitTolerance!==void 0?t.hitTolerance:0,o=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,s,o,r,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){const n=this.viewport_.getBoundingClientRect(),r=this.getSize(),s=n.width/r[0],o=n.height/r[1],a="changedTouches"in e?e.changedTouches[0]:e;return[(a.clientX-n.left)/s,(a.clientY-n.top)/o]}getTarget(){return this.get(yr.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return ja(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){const t=this.frameState_;return t?Fi(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){const t=this.overlayIdIndex_[e.toString()];return t!==void 0?t:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(yr.LAYERGROUP)}setLayers(e){const t=this.getLayerGroup();if(e instanceof Rn){t.setLayers(e);return}const n=t.getLayers();n.clear(),n.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const e=this.getLayerGroup().getLayerStatesArray();for(let t=0,n=e.length;t<n;++t){const r=e[t];if(!r.visible)continue;const s=r.layer.getRenderer();if(s&&!s.ready)return!0;const o=r.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(e){const t=Ni(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){const t=this.frameState_;return t?Fi(t.coordinateToPixelTransform,e.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(yr.SIZE)}getView(){return this.get(yr.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const e=this.getTargetElement();return e?e.ownerDocument:document}getTilePriority(e,t,n,r){return mN(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;const n=new Ta(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;const t=e.originalEvent,n=t.type;if(n===Ly.POINTERDOWN||n===Qe.WHEEL||n===Qe.KEYDOWN){const r=this.getOwnerDocument(),s=this.viewport_.getRootNode?this.viewport_.getRootNode():r,o=t.target,a=s instanceof ShadowRoot?s.host===o?s.host.ownerDocument:s:s===r?r.documentElement:s;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(e.frameState=this.frameState_,this.dispatchEvent(e)!==!1){const r=this.getInteractions().getArray().slice();for(let s=r.length-1;s>=0;s--){const o=r[s];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(e)||e.propagationStopped)break}}}handlePostRender(){const e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let r=this.maxTilesLoading_,s=r;if(e){const o=e.viewHints;if(o[Ti.ANIMATING]||o[Ti.INTERACTING]){const a=Date.now()-e.time>8;r=a?0:8,s=a?0:2}}t.getTilesLoading()<r&&(t.reprioritize(),t.loadMoreTiles(r,s))}e&&this.renderer_&&!e.animate&&(this.renderComplete_?(this.hasListener(qn.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(qn.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Fh(Ro.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Fh(Ro.LOADSTART,this,e))));const n=this.postRenderFunctions_;if(e)for(let r=0,s=n.length;r<s;++r)n[r](this,e);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let n=0,r=this.targetChangeHandlerKeys_.length;n<r;++n)Zt(this.targetChangeHandlerKeys_[n]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(Qe.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(Qe.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!El(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);const n=this.targetElement_.getRootNode();n instanceof ShadowRoot&&this.resizeObserver_.unobserve(n.host),this.setSize(void 0)}const e=this.getTarget(),t=typeof e=="string"?document.getElementById(e):e;if(this.targetElement_=t,!t)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{if(El(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new fO(this)),!El(t)){this.mapBrowserEventHandler_=new dN(this,this.moveTolerance_);for(const r in Ht)this.mapBrowserEventHandler_.addEventListener(Ht[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(Qe.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(Qe.WHEEL,this.boundHandleBrowserEvent_,iL?{passive:!1}:!1);let n;if(this.keyboardEventTarget_)n=this.keyboardEventTarget_;else{const r=t.getRootNode();n=r instanceof ShadowRoot?r.host:t}if(this.targetChangeHandlerKeys_=[wt(n,Qe.KEYDOWN,this.handleBrowserEvent,this),wt(n,Qe.KEYPRESS,this.handleBrowserEvent,this)],t instanceof HTMLElement){const r=t.getRootNode();r instanceof ShadowRoot&&this.resizeObserver_.observe(r.host),this.resizeObserver_?.observe(t)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(Zt(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(Zt(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=wt(e,wu.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=wt(e,Qe.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(Zt),this.layerGroupPropertyListenerKeys_=null);const e=this.getLayerGroup();e&&(this.handleLayerAdd_(new xl("addlayer",e)),this.layerGroupPropertyListenerKeys_=[wt(e,wu.PROPERTYCHANGE,this.render,this),wt(e,Qe.CHANGE,this.render,this),wt(e,"addlayer",this.handleLayerAdd_,this),wt(e,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;const e=this.frameState_.layerStatesArray;for(let t=0,n=e.length;t<n;++t){const r=e[t].layer;r.hasRenderer()&&r.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){PL(e.layer)}removeOverlay(e){return this.getOverlays().remove(e)}renderFrame_(e){const t=this.getSize(),n=this.getView(),r=this.frameState_;let s=null;if(t!==void 0&&bb(t)&&n&&n.isDef()){const o=n.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=n.getState();if(s={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Sd(a.center,a.resolution,a.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:Ue(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=Sd(a.nextCenter,a.nextResolution,l,t)}}this.frameState_=s,this.renderer_.renderFrame(s),s&&(s.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,s.postRenderFunctions),r&&(!this.previousExtent_||!Xo(this.previousExtent_)&&!Ga(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Fh(Ro.MOVESTART,this,r)),this.previousExtent_=Fu(this.previousExtent_)),this.previousExtent_&&!s.viewHints[Ti.ANIMATING]&&!s.viewHints[Ti.INTERACTING]&&!Ga(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Fh(Ro.MOVEEND,this,s)),PT(s.extent,this.previousExtent_))),this.dispatchEvent(new Fh(Ro.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(Ro.LOADSTART)||this.hasListener(Ro.LOADEND)||this.hasListener(qn.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(e){const t=this.getLayerGroup();t&&this.handleLayerRemove_(new xl("removelayer",t)),this.set(yr.LAYERGROUP,e)}setSize(e){this.set(yr.SIZE,e)}setTarget(e){this.set(yr.TARGET,e)}setView(e){if(!e||e instanceof Xs){this.set(yr.VIEW,e);return}this.set(yr.VIEW,new Xs);const t=this;e.then(function(n){t.setView(new Xs(n))})}updateSize(){const e=this.getTargetElement();let t;if(e){let r,s;if(El(e))r=e.width,s=e.height;else{const o=getComputedStyle(e);r=e.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),s=e.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(r)&&!isNaN(s)&&(t=[Math.max(0,r),Math.max(0,s)],!bb(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&RT("No map visible because the map container's width or height are 0."))}const n=this.getSize();t&&(!n||!Ho(t,n))&&(this.setSize(t),this.updateViewportSize_(t))}updateViewportSize_(e){const t=this.getView();t&&t.setViewportSize(e)}};function dO(i){let e=null;i.keyboardEventTarget!==void 0&&(e=typeof i.keyboardEventTarget=="string"?document.getElementById(i.keyboardEventTarget):i.keyboardEventTarget);const t={},n=i.layers&&typeof i.layers.getLayers=="function"?i.layers:new Vl({layers:i.layers});t[yr.LAYERGROUP]=n,t[yr.TARGET]=i.target,t[yr.VIEW]=i.view instanceof Xs?i.view:new Xs;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new Rn(i.controls.slice()):(Vt(typeof i.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),r=i.controls));let s;i.interactions!==void 0&&(Array.isArray(i.interactions)?s=new Rn(i.interactions.slice()):(Vt(typeof i.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),s=i.interactions));let o;return i.overlays!==void 0?Array.isArray(i.overlays)?o=new Rn(i.overlays.slice()):(Vt(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=i.overlays):o=new Rn,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}const dr={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class RL extends Yr{constructor(e){super(),this.on,this.once,this.un,this.options=e,this.id=e.id,this.insertFirst=e.insertFirst!==void 0?e.insertFirst:!0,this.stopEvent=e.stopEvent!==void 0?e.stopEvent:!0,this.element=document.createElement("div"),this.element.className=e.className!==void 0?e.className:"ol-overlay-container "+CN,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=e.autoPan===!0?{}:e.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(dr.ELEMENT,this.handleElementChanged),this.addChangeListener(dr.MAP,this.handleMapChanged),this.addChangeListener(dr.OFFSET,this.handleOffsetChanged),this.addChangeListener(dr.POSITION,this.handlePositionChanged),this.addChangeListener(dr.POSITIONING,this.handlePositioningChanged),e.element!==void 0&&this.setElement(e.element),this.setOffset(e.offset!==void 0?e.offset:[0,0]),this.setPositioning(e.positioning||"top-left"),e.position!==void 0&&this.setPosition(e.position)}getElement(){return this.get(dr.ELEMENT)}getId(){return this.id}getMap(){return this.get(dr.MAP)||null}getOffset(){return this.get(dr.OFFSET)}getPosition(){return this.get(dr.POSITION)}getPositioning(){return this.get(dr.POSITIONING)}handleElementChanged(){oL(this.element);const e=this.getElement();e&&this.element.appendChild(e)}handleMapChanged(){this.mapPostrenderListenerKey&&(this.element?.remove(),Zt(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const e=this.getMap();if(e){this.mapPostrenderListenerKey=wt(e,Ro.POSTRENDER,this.render,this),this.updatePixelPosition();const t=this.stopEvent?e.getOverlayContainerStopEvent():e.getOverlayContainer();this.insertFirst?t.insertBefore(this.element,t.childNodes[0]||null):t.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(e){this.set(dr.ELEMENT,e)}setMap(e){this.set(dr.MAP,e)}setOffset(e){this.set(dr.OFFSET,e)}setPosition(e){this.set(dr.POSITION,e)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(e){const t=this.getMap();if(!t||!t.getTargetElement()||!this.get(dr.POSITION))return;const n=this.getRect(t.getTargetElement(),t.getSize()),r=this.getElement(),s=this.getRect(r,[PN(r),MN(r)]);e=e||{};const o=e.margin===void 0?20:e.margin;if(!gs(n,s)){const a=s[0]-n[0],l=n[2]-s[2],c=s[1]-n[1],h=n[3]-s[3],u=[0,0];if(a<0?u[0]=a-o:l<0&&(u[0]=Math.abs(l)+o),c<0?u[1]=c-o:h<0&&(u[1]=Math.abs(h)+o),u[0]!==0||u[1]!==0){const f=t.getView().getCenterInternal(),d=t.getPixelFromCoordinateInternal(f);if(!d)return;const g=[d[0]+u[0],d[1]+u[1]],m=e.animation||{};t.getView().animateInternal({center:t.getCoordinateFromPixelInternal(g),duration:m.duration,easing:m.easing})}}}getRect(e,t){const n=e.getBoundingClientRect(),r=n.left+window.pageXOffset,s=n.top+window.pageYOffset;return[r,s,r+t[0],s+t[1]]}setPositioning(e){this.set(dr.POSITIONING,e)}setVisible(e){this.rendered.visible!==e&&(this.element.style.display=e?"":"none",this.rendered.visible=e)}updatePixelPosition(){const e=this.getMap(),t=this.getPosition();if(!e||!e.isRendered()||!t){this.setVisible(!1);return}const n=e.getPixelFromCoordinate(t),r=e.getSize();this.updateRenderedPosition(n,r)}updateRenderedPosition(e,t){const n=this.element.style,r=this.getOffset(),s=this.getPositioning();this.setVisible(!0);const o=`${e[0]+r[0]}px`,a=`${e[1]+r[1]}px`;let l="0%",c="0%";s=="bottom-right"||s=="center-right"||s=="top-right"?l="-100%":(s=="bottom-center"||s=="center-center"||s=="top-center")&&(l="-50%"),s=="bottom-left"||s=="bottom-center"||s=="bottom-right"?c="-100%":(s=="center-left"||s=="center-center"||s=="center-right")&&(c="-50%");const h=`translate(${l}, ${c}) translate(${o}, ${a})`;this.rendered.transform_!=h&&(this.rendered.transform_=h,n.transform=h)}getOptions(){return this.options}}function gO(i){const e=Object.keys(i.defs),t=e.length;let n,r;for(n=0;n<t;++n){const s=e[n];if(!Vp(s)){const o=i.defs(s);let a=o.units;!a&&o.projName==="longlat"&&(a="degrees"),b0(new Ba({code:s,axisOrientation:o.axis,metersPerUnit:o.to_meter,units:a}))}}for(n=0;n<t;++n){const s=e[n],o=Vp(s);for(r=0;r<t;++r){const a=e[r],l=Vp(a);if(!$p(s,a))if(i.defs[s]===i.defs[a])wy([o,l]);else{const c=i(s,a);R6(o,l,lb(o,l,c.forward),lb(l,o,c.inverse))}}}}class Oy{constructor(e){this.highWaterMark=e!==void 0?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const e=this.pop();e instanceof Yd&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){const n=this.entries_[e];return Vt(n!==void 0,"Tried to get a value for a key that does not exist in the cache"),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(e){const t=this.entries_[e];return Vt(t!==void 0,"Tried to get a value for a key that does not exist in the cache"),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){const e=new Array(this.count_);let t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){const e=new Array(this.count_);let t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){return this.entries_[e]?.value_}pop(){const e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){Vt(!(e in this.entries_),"Tried to set a value for a key that is used already");const n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}}function kc(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function IL(i,e,t){return i+"/"+e+"/"+t}function kh(i){return IL(i[0],i[1],i[2])}function Qf(i,e,t,n,r){return`${Ue(i)},${e},${IL(t,n,r)}`}function Ax(i){return NL(i[0],i[1],i[2])}function NL(i,e,t){return(e<<i)+t}function pO(i,e){const t=i[0],n=i[1],r=i[2];if(e.getMinZoom()>t||t>e.getMaxZoom())return!1;const s=e.getFullTileRange(t);return s?s.containsXY(n,r):!0}class Dm{constructor(e,t,n,r){this.minX=e,this.maxX=t,this.minY=n,this.maxY=r}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minX<this.minX&&(this.minX=e.minX),e.maxX>this.maxX&&(this.maxX=e.maxX),e.minY<this.minY&&(this.minY=e.minY),e.maxY>this.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}}function wh(i,e,t,n,r){return r!==void 0?(r.minX=i,r.maxX=e,r.minY=t,r.maxY=n,r):new Dm(i,e,t,n)}const bh=[0,0,0],fl=5;class ig{constructor(e){this.minZoom=e.minZoom!==void 0?e.minZoom:0,this.resolutions_=e.resolutions,Vt(z8(this.resolutions_,(r,s)=>s-r),"`resolutions` must be sorted in descending order");let t;if(!e.origins){for(let r=0,s=this.resolutions_.length-1;r<s;++r)if(!t)t=this.resolutions_[r]/this.resolutions_[r+1];else if(this.resolutions_[r]/this.resolutions_[r+1]!==t){t=void 0;break}}this.zoomFactor_=t,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin!==void 0?e.origin:null,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,Vt(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const n=e.extent;n!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=no(n)),Vt(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,Vt(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:ux,Vt(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=n!==void 0?n:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.sizes!==void 0?this.fullTileRanges_=e.sizes.map((r,s)=>{const o=new Dm(Math.min(0,r[0]),Math.max(r[0]-1,-1),Math.min(0,r[1]),Math.max(r[1]-1,-1));if(n){const a=this.getTileRangeForExtentAndZ(n,s);o.minX=Math.max(a.minX,o.minX),o.maxX=Math.min(a.maxX,o.maxX),o.minY=Math.max(a.minY,o.minY),o.maxY=Math.min(a.maxY,o.maxY)}return o}):n&&this.calculateTileRanges_(n)}forEachTileCoord(e,t,n){const r=this.getTileRangeForExtentAndZ(e,t);for(let s=r.minX,o=r.maxX;s<=o;++s)for(let a=r.minY,l=r.maxY;a<=l;++a)n([t,s,a])}forEachTileCoordParentTileRange(e,t,n,r){let s,o,a,l=null,c=e[0]-1;for(this.zoomFactor_===2?(o=e[1],a=e[2]):l=this.getTileCoordExtent(e,r);c>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),s=wh(o,o,a,a,n)):s=this.getTileRangeForExtentAndZ(l,c,n),t(c,s))return!0;--c}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,n){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){const s=e[1]*2,o=e[2]*2;return wh(s,s+1,o,o+1,t)}const r=this.getTileCoordExtent(e,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(r,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,n){if(t>this.maxZoom||t<this.minZoom)return null;const r=e[0],s=e[1],o=e[2];if(t===r)return wh(s,o,s,o,n);if(this.zoomFactor_){const l=Math.pow(this.zoomFactor_,t-r),c=Math.floor(s*l),h=Math.floor(o*l);if(t<r)return wh(c,c,h,h,n);const u=Math.floor(l*(s+1))-1,f=Math.floor(l*(o+1))-1;return wh(c,u,h,f,n)}const a=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,t,n)}getTileRangeForExtentAndZ(e,t,n){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,bh);const r=bh[1],s=bh[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,bh);const o=bh[1],a=bh[2];return wh(r,o,s,a,n)}getTileCoordCenter(e){const t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=Hi(this.getTileSize(e[0]),this.tmpSize_);return[t[0]+(e[1]+.5)*r[0]*n,t[1]-(e[2]+.5)*r[1]*n]}getTileCoordExtent(e,t){const n=this.getOrigin(e[0]),r=this.getResolution(e[0]),s=Hi(this.getTileSize(e[0]),this.tmpSize_),o=n[0]+e[1]*s[0]*r,a=n[1]-(e[2]+1)*s[1]*r,l=o+s[0]*r,c=a+s[1]*r;return qo(o,a,l,c,t)}getTileCoordForCoordAndResolution(e,t,n){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,n)}getTileCoordForXYAndResolution_(e,t,n,r,s){const o=this.getZForResolution(n),a=n/this.getResolution(o),l=this.getOrigin(o),c=Hi(this.getTileSize(o),this.tmpSize_);let h=a*(e-l[0])/n/c[0],u=a*(l[1]-t)/n/c[1];return r?(h=wl(h,fl)-1,u=wl(u,fl)-1):(h=qh(h,fl),u=qh(u,fl)),kc(o,h,u,s)}getTileCoordForXYAndZ_(e,t,n,r,s){const o=this.getOrigin(n),a=this.getResolution(n),l=Hi(this.getTileSize(n),this.tmpSize_);let c=(e-o[0])/a/l[0],h=(o[1]-t)/a/l[1];return r?(c=wl(c,fl)-1,h=wl(h,fl)-1):(c=qh(c,fl),h=qh(h,fl)),kc(n,c,h,s)}getTileCoordForCoordAndZ(e,t,n){return this.getTileCoordForXYAndZ_(e[0],e[1],t,!1,n)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,t){const n=vm(this.resolutions_,e,t||0);return yt(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return YT(t,0,t.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){const t=this.resolutions_.length,n=new Array(t);for(let r=this.minZoom;r<t;++r)n[r]=this.getTileRangeForExtentAndZ(e,r);this.fullTileRanges_=n}}class I0 extends ig{constructor(e){super({extent:e.extent,origin:e.origin,origins:e.origins,resolutions:e.resolutions,tileSize:e.tileSize,tileSizes:e.tileSizes,sizes:e.sizes}),this.matrixIds_=e.matrixIds}getMatrixId(e){return this.matrixIds_[e]}getMatrixIds(){return this.matrixIds_}}function mO(i,e,t){const n=[],r=[],s=[],o=[],a=[];t=t!==void 0?t:[];const l="SupportedCRS",c="TileMatrix",h="Identifier",u="ScaleDenominator",f="TopLeftCorner",d="TileWidth",g="TileHeight",m=i[l],_=Mt(m),v=_.getMetersPerUnit(),x=_.getAxisOrientation().startsWith("ne");return i[c].sort(function(S,b){return b[u]-S[u]}),i[c].forEach(function(S){let b;if(t.length>0?b=t.find(function(A){return S[h]==A[c]?!0:S[h].includes(":")?!1:i[h]+":"+S[h]===A[c]}):b=!0,b){r.push(S[h]);const A=S[u]*28e-5/v,F=S[d],N=S[g];x?s.push([S[f][1],S[f][0]]):s.push(S[f]),n.push(A),o.push(F==N?F:[F,N]),a.push([S.MatrixWidth,S.MatrixHeight])}}),new I0({extent:e,origins:s,resolutions:n,matrixIds:r,tileSizes:o,sizes:a})}function km(i){let e=i.getDefaultTileGrid();return e||(e=vO(i),i.setDefaultTileGrid(e)),e}function _O(i,e,t){const n=e[0],r=i.getTileCoordCenter(e),s=Yc(t);if(!Hr(s,r)){const o=St(s),a=Math.ceil((s[0]-r[0])/o);return r[0]+=o*a,i.getTileCoordForCoordAndZ(r,n)}return e}function yO(i,e,t,n){n=n!==void 0?n:"top-left";const r=FL(i,e,t);return new ig({extent:i,origin:K8(i,n),resolutions:r,tileSize:t})}function ku(i){const e=i||{},t=e.extent||Mt("EPSG:3857").getExtent(),n={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:FL(t,e.maxZoom,e.tileSize,e.maxResolution)};return new ig(n)}function FL(i,e,t,n){e=e!==void 0?e:sL,t=Hi(t!==void 0?t:ux);const r=Wi(i),s=St(i);n=n>0?n:Math.max(s/t[0],r/t[1]);const o=e+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=n/Math.pow(2,l);return a}function vO(i,e,t,n){const r=Yc(i);return yO(r,e,t,n)}function Yc(i){i=Mt(i);let e=i.getExtent();if(!e){const t=180*qv.degrees/i.getMetersPerUnit();e=qo(-t,-t,t,t)}return e}function Cu(i,e){const t=[];Object.keys(e).forEach(function(r){e[r]!==null&&e[r]!==void 0&&t.push(r+"="+encodeURIComponent(e[r]))});const n=t.join("&");return i=i.replace(/[?&]$/,""),i+=i.includes("?")?"&":"?",i+n}const xO=/\{z\}/g,wO=/\{x\}/g,bO=/\{y\}/g,EO=/\{-y\}/g;function Px(i,e,t,n,r){return i.replace(xO,e.toString()).replace(wO,t.toString()).replace(bO,n.toString()).replace(EO,function(){if(r===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(r-n).toString()})}function SO(i,e,t,n){const r=NL(e,t,n),s=Js(r,i.length);return i[s]}function Mx(i){const e=[];let t=/\{([a-z])-([a-z])\}/.exec(i);if(t){const n=t[1].charCodeAt(0),r=t[2].charCodeAt(0);let s;for(s=n;s<=r;++s)e.push(i.replace(t[0],String.fromCharCode(s)));return e}if(t=/\{(\d+)-(\d+)\}/.exec(i),t){const n=parseInt(t[2],10);for(let r=parseInt(t[1],10);r<=n;r++)e.push(i.replace(t[0],r.toString()));return e}return e.push(i),e}function TO(i,e){return(function(t,n,r){if(!t)return;let s;const o=t[0];if(e){const a=e.getFullTileRange(o);a&&(s=a.getHeight()-1)}return Px(i,o,t[1],t[2],s)})}function OL(i,e){const t=i.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=TO(i[r],e);return N0(n)}function N0(i){return i.length===1?i[0]:(function(e,t,n){if(!e)return;const r=Ax(e),s=Js(r,i.length);return i[s](e,t,n)})}class ng extends Nu{constructor(e,t,n){super(),n=n||{},this.tileCoord=e,this.state=t,this.key="",this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(Qe.CHANGE)}release(){this.setState(Oe.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==Oe.EMPTY){if(this.state!==Oe.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}}load(){Kt()}getAlpha(e,t){if(!this.transition_)return 1;let n=this.transitionStarts_[e];if(!n)n=t,this.transitionStarts_[e]=n;else if(n===-1)return 1;const r=t-n+1e3/60;return r>=this.transition_?1:nL(r/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}disposeInternal(){this.release(),super.disposeInternal()}}class Gm extends ng{constructor(e,t,n,r,s,o){super(e,t,o),this.crossOrigin_=r,this.src_=n,this.key=n,this.image_,Xr?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,r!==null&&(this.image_.crossOrigin=r)),this.unlisten_=null,this.tileLoadFunction_=s}getImage(){return this.image_}setImage(e){this.image_=e,this.state=Oe.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}handleImageError_(){this.state=Oe.ERROR,this.unlistenImage_(),this.image_=LO(),this.changed()}handleImageLoad_(){if(Xr)this.state=Oe.LOADED;else{const e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=Oe.LOADED:this.state=Oe.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==Oe.ERROR&&(this.state=Oe.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==Oe.IDLE&&(this.state=Oe.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=DF(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}function LO(){const i=Xi(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}let o_;const hu=[];function Ob(i,e,t,n,r){i.beginPath(),i.moveTo(0,0),i.lineTo(e,t),i.lineTo(n,r),i.closePath(),i.save(),i.clip(),i.fillRect(0,0,Math.max(e,n)+1,Math.max(t,r)),i.restore()}function a_(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-.75*255)>2}function CO(){if(o_===void 0){const i=Xi(6,6,hu);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",Ob(i,4,5,4,0),Ob(i,4,5,0,5);const e=i.getImageData(0,0,3,3).data;o_=a_(e,0)||a_(e,4)||a_(e,8),Qd(i),hu.push(i.canvas)}return o_}function Od(i,e,t,n){const r=ro(t,e,i);let s=ab(e,n,t);const o=e.getMetersPerUnit();o!==void 0&&(s*=o);const a=i.getMetersPerUnit();a!==void 0&&(s/=a);const l=i.getExtent();if(!l||Hr(l,r)){const c=ab(i,s,r)/s;isFinite(c)&&c>0&&(s/=c)}return s}function DL(i,e,t,n){const r=In(t);let s=Od(i,e,r,n);return(!isFinite(s)||s<=0)&&Dv(t,function(o){return s=Od(i,e,o,n),isFinite(s)&&s>0}),s}function kL(i,e,t,n,r,s,o,a,l,c,h,u,f,d){const g=Xi(Math.round(t*i),Math.round(t*e),hu);if(u||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(t,t);function m(A){return Math.round(A*t)/t}g.globalCompositeOperation="lighter";const _=bn();l.forEach(function(A,F,N){Pc(_,A.extent)});let v;const x=t/n,S=(u?1:1+Math.pow(2,-24))/x;(!f||l.length!==1||c!==0)&&(v=Xi(Math.round(St(_)*x),Math.round(Wi(_)*x),hu),u||(v.imageSmoothingEnabled=!1),l.forEach(function(A,F,N){if(A.image.width>0&&A.image.height>0){if(A.clipExtent){v.save();const T=(A.clipExtent[0]-_[0])*x,C=-(A.clipExtent[3]-_[3])*x,D=St(A.clipExtent)*x,W=Wi(A.clipExtent)*x;v.rect(u?T:Math.round(T),u?C:Math.round(C),u?D:Math.round(T+D)-Math.round(T),u?W:Math.round(C+W)-Math.round(C)),v.clip()}const R=(A.extent[0]-_[0])*x,P=-(A.extent[3]-_[3])*x,O=St(A.extent)*x,L=Wi(A.extent)*x;v.drawImage(A.image,c,c,A.image.width-2*c,A.image.height-2*c,u?R:Math.round(R),u?P:Math.round(P),u?O:Math.round(R+O)-Math.round(R),u?L:Math.round(P+L)-Math.round(P)),A.clipExtent&&v.restore()}}));const b=no(o);return a.getTriangles().forEach(function(A,F,N){const R=A.source,P=A.target;let O=R[0][0],L=R[0][1],T=R[1][0],C=R[1][1],D=R[2][0],W=R[2][1];const $=m((P[0][0]-b[0])/s),B=m(-(P[0][1]-b[1])/s),V=m((P[1][0]-b[0])/s),te=m(-(P[1][1]-b[1])/s),ne=m((P[2][0]-b[0])/s),ae=m(-(P[2][1]-b[1])/s),I=O,U=L;O=0,L=0,T-=I,C-=U,D-=I,W-=U;const K=[[T,C,0,0,V-$],[D,W,0,0,ne-$],[0,0,T,C,te-B],[0,0,D,W,ae-B]],ie=Q8(K);if(!ie)return;if(g.save(),g.beginPath(),CO()||!u){g.moveTo(V,te);const ce=4,ve=$-V,pe=B-te;for(let le=0;le<ce;le++)g.lineTo(V+m((le+1)*ve/ce),te+m(le*pe/(ce-1))),le!=ce-1&&g.lineTo(V+m((le+1)*ve/ce),te+m((le+1)*pe/(ce-1)));g.lineTo(ne,ae)}else g.moveTo(V,te),g.lineTo($,B),g.lineTo(ne,ae);g.clip(),g.transform(ie[0],ie[2],ie[1],ie[3],$,B),g.translate(_[0]-I,_[3]-U);let re;if(v)re=v.canvas,g.scale(S,-S);else{const ce=l[0],ve=ce.extent;re=ce.image,g.scale(St(ve)/re.width,-Wi(ve)/re.height)}g.drawImage(re,0,0),g.restore()}),v&&(Qd(v),hu.push(v.canvas)),h&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEach(function(A,F,N){const R=A.target,P=(R[0][0]-b[0])/s,O=-(R[0][1]-b[1])/s,L=(R[1][0]-b[0])/s,T=-(R[1][1]-b[1])/s,C=(R[2][0]-b[0])/s,D=-(R[2][1]-b[1])/s;g.beginPath(),g.moveTo(L,T),g.lineTo(P,O),g.lineTo(C,D),g.closePath(),g.stroke()}),g.restore()),g.canvas}const AO=10,Db=.25;class Rx{constructor(e,t,n,r,s,o,a){this.sourceProj_=e,this.targetProj_=t;let l={};const c=a?E0(S=>Fi(a,ro(S,this.targetProj_,this.sourceProj_))):Vo(this.targetProj_,this.sourceProj_);this.transformInv_=function(S){const b=S[0]+"/"+S[1];return l[b]||(l[b]=c(S)),l[b]},this.maxSourceExtent_=r,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&St(r)>=St(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?St(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?St(this.targetProj_.getExtent()):null;const h=no(n),u=bm(n),f=wm(n),d=xm(n),g=this.transformInv_(h),m=this.transformInv_(u),_=this.transformInv_(f),v=this.transformInv_(d),x=AO+(o?Math.max(0,Math.ceil(Math.log2(Ed(n)/(o*o*256*256)))):0);if(this.addQuad_(h,u,f,d,g,m,_,v,x),this.wrapsXInSource_){let S=1/0;this.triangles_.forEach(function(b,A,F){S=Math.min(S,b.source[0][0],b.source[1][0],b.source[2][0])}),this.triangles_.forEach(b=>{if(Math.max(b.source[0][0],b.source[1][0],b.source[2][0])-S>this.sourceWorldWidth_/2){const A=[[b.source[0][0],b.source[0][1]],[b.source[1][0],b.source[1][1]],[b.source[2][0],b.source[2][1]]];A[0][0]-S>this.sourceWorldWidth_/2&&(A[0][0]-=this.sourceWorldWidth_),A[1][0]-S>this.sourceWorldWidth_/2&&(A[1][0]-=this.sourceWorldWidth_),A[2][0]-S>this.sourceWorldWidth_/2&&(A[2][0]-=this.sourceWorldWidth_);const F=Math.min(A[0][0],A[1][0],A[2][0]);Math.max(A[0][0],A[1][0],A[2][0])-F<this.sourceWorldWidth_/2&&(b.source=A)}})}l={}}addTriangle_(e,t,n,r,s,o){this.triangles_.push({source:[r,s,o],target:[e,t,n]})}addQuad_(e,t,n,r,s,o,a,l,c){const h=Ui([s,o,a,l]),u=this.sourceWorldWidth_?St(h)/this.sourceWorldWidth_:null,f=this.sourceWorldWidth_,d=this.sourceProj_.canWrapX()&&u>.5&&u<1;let g=!1;if(c>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const _=Ui([e,t,n,r]);g=St(_)/this.targetWorldWidth_>Db||g}!d&&this.sourceProj_.isGlobal()&&u&&(g=u>Db||g)}if(!g&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!Ei(h,this.maxSourceExtent_))return;let m=0;if(!g&&(!isFinite(s[0])||!isFinite(s[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(c>0)g=!0;else if(m=(!isFinite(s[0])||!isFinite(s[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),m!=1&&m!=2&&m!=4&&m!=8)return}if(c>0){if(!g){const _=[(e[0]+n[0])/2,(e[1]+n[1])/2],v=this.transformInv_(_);let x;d?x=(Js(s[0],f)+Js(a[0],f))/2-Js(v[0],f):x=(s[0]+a[0])/2-v[0];const S=(s[1]+a[1])/2-v[1];g=x*x+S*S>this.errorThresholdSquared_}if(g){if(Math.abs(e[0]-n[0])<=Math.abs(e[1]-n[1])){const _=[(t[0]+n[0])/2,(t[1]+n[1])/2],v=this.transformInv_(_),x=[(r[0]+e[0])/2,(r[1]+e[1])/2],S=this.transformInv_(x);this.addQuad_(e,t,_,x,s,o,v,S,c-1),this.addQuad_(x,_,n,r,S,v,a,l,c-1)}else{const _=[(e[0]+t[0])/2,(e[1]+t[1])/2],v=this.transformInv_(_),x=[(n[0]+r[0])/2,(n[1]+r[1])/2],S=this.transformInv_(x);this.addQuad_(e,_,x,r,s,v,S,l,c-1),this.addQuad_(_,t,n,x,v,o,a,S,c-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(m&11)==0&&this.addTriangle_(e,n,r,s,a,l),(m&14)==0&&this.addTriangle_(e,n,t,s,a,o),m&&((m&13)==0&&this.addTriangle_(t,r,e,o,l,s),(m&7)==0&&this.addTriangle_(t,r,n,o,l,a))}calculateSourceExtent(){const e=bn();return this.triangles_.forEach(function(t,n,r){const s=t.source;Kf(e,s[0]),Kf(e,s[1]),Kf(e,s[2])}),e}getTriangles(){return this.triangles_}}const Ix=.5;class Nx extends ng{constructor(e,t,n,r,s,o,a,l,c,h,u,f){super(s,Oe.IDLE,f),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=r,this.wrappedTileCoord_=o||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()?e.getExtent():void 0;const d=r.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let m=this.sourceTileGrid_.getExtent();const _=g?Mn(d,g):d;if(Ed(_)===0){this.state=Oe.EMPTY;return}const v=e.getExtent();v&&(m?m=Mn(m,v):m=v);const x=r.getResolution(this.wrappedTileCoord_[0]),S=DL(e,n,_,x);if(!isFinite(S)||S<=0){this.state=Oe.EMPTY;return}const b=h!==void 0?h:Ix;if(this.triangulation_=new Rx(e,n,_,m,S*b,x),this.triangulation_.getTriangles().length===0){this.state=Oe.EMPTY;return}this.sourceZ_=t.getZForResolution(S);let A=this.triangulation_.calculateSourceExtent();if(m&&(e.canWrapX()?(A[1]=yt(A[1],m[1],m[3]),A[3]=yt(A[3],m[1],m[3])):A=Mn(A,m)),!Ed(A))this.state=Oe.EMPTY;else{let F=0,N=0;e.canWrapX()&&(F=St(v),N=Math.floor((A[0]-v[0])/F)),Bv(A.slice(),e,!0).forEach(P=>{const O=t.getTileRangeForExtentAndZ(P,this.sourceZ_);for(let L=O.minX;L<=O.maxX;L++)for(let T=O.minY;T<=O.maxY;T++){const C=c(this.sourceZ_,L,T,a);if(C){const D=N*F;this.sourceTiles_.push({tile:C,offset:D})}}++N}),this.sourceTiles_.length===0&&(this.state=Oe.EMPTY)}}getImage(){return this.canvas_}reproject_(){const e=[];if(this.sourceTiles_.forEach(t=>{const n=t.tile;if(n&&n.getState()==Oe.LOADED){const r=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);r[0]+=t.offset,r[2]+=t.offset;const s=this.clipExtent_?.slice();s&&(s[0]+=t.offset,s[2]+=t.offset),e.push({extent:r,clipExtent:s,image:n.getImage()})}}),this.sourceTiles_.length=0,e.length===0)this.state=Oe.ERROR;else{const t=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(t),r=typeof n=="number"?n:n[0],s=typeof n=="number"?n:n[1],o=this.targetTileGrid_.getResolution(t),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=kL(r,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=Oe.LOADED}this.changed()}load(){if(this.state==Oe.IDLE){this.state=Oe.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{const n=t.getState();if(n==Oe.IDLE||n==Oe.LOADING){e++;const r=wt(t,Qe.CHANGE,s=>{const o=t.getState();(o==Oe.LOADED||o==Oe.ERROR||o==Oe.EMPTY)&&(Zt(r),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(r)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t},n,r){t.getState()==Oe.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(Zt),this.sourcesListenerKeys_=null}release(){this.canvas_&&(Qd(this.canvas_.getContext("2d")),hu.push(this.canvas_),this.canvas_=null),super.release()}}class Bm extends Yr{constructor(e){super(),this.projection=Mt(e.projection),this.attributions_=kb(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible??!0,this.loading=!1,this.state_=e.state!==void 0?e.state:"ready",this.wrapX_=e.wrapX!==void 0?e.wrapX:!1,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;const t=this;this.viewPromise_=new Promise(function(n,r){t.viewResolver=n,t.viewRejector=r})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=kb(e),this.changed()}setState(e){this.state_=e,this.changed()}}function kb(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),e=>i):null}class jm extends Bm{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=e.tilePixelRatio!==void 0?e.tilePixelRatio:1,this.tileGrid=e.tileGrid!==void 0?e.tileGrid:null;const t=[256,256];this.tileGrid&&Hi(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tmpSize=[0,0],this.key_=e.key||Ue(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){const t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,n,r,s,o){return Kt()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:km(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){const r=this.getTileGridForProjection(n),s=this.getTilePixelRatio(t),o=Hi(r.getTileSize(e),this.tmpSize);return s==1?o:mL(o,s,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){const n=t!==void 0?t:this.getProjection(),r=t!==void 0?this.getTileGridForProjection(n):this.tileGrid||this.getTileGridForProjection(n);return this.getWrapX()&&n.isGlobal()&&(e=_O(r,e,n)),pO(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}}class GL extends Dr{constructor(e,t){super(e),this.tile=t}}const uu={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};class Um extends jm{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===Um.prototype.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,e.tileUrlFunction&&(this.tileUrlFunction=e.tileUrlFunction),this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(e){const t=e.target,n=Ue(t),r=t.getState();let s;r==Oe.LOADING?(this.tileLoadingKeys_[n]=!0,s=uu.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],s=r==Oe.ERROR?uu.TILELOADERROR:r==Oe.LOADED?uu.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new GL(s,t))}setTileLoadFunction(e){this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,t){this.tileUrlFunction=e,typeof t<"u"?this.setKey(t):this.changed()}setUrl(e){const t=Mx(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;const t=e.join(`
5
- `);this.generateTileUrlFunction_?this.setTileUrlFunction(OL(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}}class Gu extends Um{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:BL,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate!==void 0?e.interpolate:!0,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=e.crossOrigin!==void 0?e.crossOrigin:null,this.tileClass=e.tileClass!==void 0?e.tileClass:Gm,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!mn(this.getProjection(),e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=":disable-interpolation"),e}getTileGridForProjection(e){const t=this.getProjection();if(this.tileGrid&&(!t||mn(t,e)))return this.tileGrid;const n=Ue(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=km(e)),this.tileGridForProjection[n]}createTile_(e,t,n,r,s,o){const a=[e,t,n],l=this.getTileCoordForTileUrlFunction(a,s),c=l?this.tileUrlFunction(l,r,s):void 0,h=new this.tileClass(a,c!==void 0?Oe.IDLE:Oe.EMPTY,c!==void 0?c:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return h.key=o,h.addEventListener(Qe.CHANGE,this.handleTileChange.bind(this)),h}getTile(e,t,n,r,s,o){const a=this.getProjection();if(!a||!s||mn(a,s))return this.getTileInternal(e,t,n,r,a||s);const l=[e,t,n],c=this.getKey(),h=this.getTileGridForProjection(a),u=this.getTileGridForProjection(s),f=this.getTileCoordForTileUrlFunction(l,s),d=new Nx(a,h,s,u,l,f,this.getTilePixelRatio(r),this.getGutter(),(g,m,_,v)=>this.getTileInternal(g,m,_,v,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return d.key=c,d}getTileInternal(e,t,n,r,s,o){const a=this.getKey(),l=Qf(this,a,e,t,n);if(o&&o.containsKey(l))return o.get(l);const c=this.createTile_(e,t,n,r,s,a);return o?.set(l,c),c}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,t){const n=Mt(e);if(n){const r=Ue(n);r in this.tileGridForProjection||(this.tileGridForProjection[r]=t)}}}function BL(i,e){if(Xr){const t=i.getCrossOrigin();let n="same-origin",r="same-origin";t==="anonymous"||t===""?(n="cors",r="omit"):t==="use-credentials"&&(n="cors",r="include"),fetch(e,{mode:n,credentials:r}).then(s=>{if(!s.ok)throw new Error(`HTTP ${s.status}`);return s.blob()}).then(s=>createImageBitmap(s)).then(s=>{const o=i.getImage();o.width=s.width,o.height=s.height,o.getContext("2d").drawImage(s,0,0),s.close?.(),o.dispatchEvent(new Event("load"))}).catch(()=>{i.getImage().dispatchEvent(new Event("error"))});return}i.getImage().src=e}function PO(i){const e=i[0],t=new Array(e);let n=1<<e-1,r,s;for(r=0;r<e;++r)s=48,i[1]&n&&(s+=1),i[2]&n&&(s+=2),t[r]=String.fromCharCode(s),n>>=1;return t.join("")}const MO='<a class="ol-attribution-bing-tos" href="https://www.microsoft.com/maps/product/terms.html" target="_blank">Terms of Use</a>';class RO extends Gu{constructor(e){const t=e.hidpi!==void 0?e.hidpi:!1;super({cacheSize:e.cacheSize,crossOrigin:"anonymous",interpolate:e.interpolate,projection:Mt("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:"loading",tileLoadFunction:e.tileLoadFunction,tilePixelRatio:t?2:1,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,zDirection:e.zDirection}),this.hidpi_=t,this.culture_=e.culture!==void 0?e.culture:"en-us",this.maxZoom_=e.maxZoom!==void 0?e.maxZoom:-1,this.apiKey_=e.key,this.imagerySet_=e.imagerySet,this.placeholderTiles_=e.placeholderTiles;const n=(e.url||"https://dev.virtualearth.net/REST/v1/Imagery/Metadata/")+this.imagerySet_+"?uriScheme=https&include=ImageryProviders&key="+this.apiKey_+"&c="+this.culture_;fetch(n).then(r=>r.json()).then(r=>this.handleImageryMetadataResponse(r))}getApiKey(){return this.apiKey_}getImagerySet(){return this.imagerySet_}handleImageryMetadataResponse(e){if(e.statusCode!=200||e.statusDescription!="OK"||e.authenticationResultCode!="ValidCredentials"||e.resourceSets.length!=1||e.resourceSets[0].resources.length!=1){this.setState("error");return}const t=e.resourceSets[0].resources[0],n=this.maxZoom_==-1?t.zoomMax:this.maxZoom_,r=this.getProjection(),s=Yc(r),o=this.hidpi_?2:1,a=t.imageWidth==t.imageHeight?t.imageWidth/o:[t.imageWidth/o,t.imageHeight/o],l=ku({extent:s,minZoom:t.zoomMin,maxZoom:n,tileSize:a});this.tileGrid=l;const c=this.culture_,h=this.hidpi_,u=this.placeholderTiles_;if(this.tileUrlFunction=N0(t.imageUrlSubdomains.map(function(f){const d=[0,0,0],g=t.imageUrl.replace("{subdomain}",f).replace("{culture}",c);return(function(m,_,v){if(!m)return;kc(m[0],m[1],m[2],d);const x=new URL(g.replace("{quadkey}",PO(d))),S=x.searchParams;return h&&(S.set("dpi","d1"),S.set("device","mobile")),u===!0?S.delete("n"):u===!1&&S.set("n","z"),x.toString()})})),t.imageryProviders){const f=Wc(Mt("EPSG:4326"),this.getProjection());this.setAttributions(d=>{const g=[],m=d.viewState,_=this.getTileGrid(),v=_.getZForResolution(m.resolution,this.zDirection),S=_.getTileCoordForCoordAndZ(m.center,v)[0];return t.imageryProviders.map(function(b){let A=!1;const F=b.coverageAreas;for(let N=0,R=F.length;N<R;++N){const P=F[N];if(S>=P.zoomMin&&S<=P.zoomMax){const O=P.bbox,L=[O[1],O[0],O[3],O[2]],T=bu(L,f);if(Ei(T,d.extent)){A=!0;break}}}A&&g.push(b.attribution)}),g.push(MO),g})}this.setState("ready")}}class Fx extends Gu{constructor(e){e=e||{};const t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:ku({extent:Yc(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize});super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0}getGutter(){return this.gutter_}}let IO=!1;function jL(i,e,t,n,r,s,o){const a=new XMLHttpRequest;a.open("GET",typeof i=="function"?i(t,n,r):i,!0),e.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=IO,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){const c=e.getType();try{let h;c=="text"||c=="json"?h=a.responseText:c=="xml"?h=a.responseXML||a.responseText:c=="arraybuffer"&&(h=a.response),h?s(e.readFeatures(h,{extent:t,featureProjection:r}),e.readProjection(h)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function Gb(i,e){return function(t,n,r,s,o){jL(i,e,t,n,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function NO(i,e){return[[-1/0,-1/0,1/0,1/0]]}function UL(i,e,t,n){const r=[];let s=bn();for(let o=0,a=t.length;o<a;++o){const l=t[o];s=Ov(i,e,l[0],n),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),e=l[l.length-1]}return r}function F0(i,e,t,n,r,s,o){let a,l;const c=(t-e)/n;if(c===1)a=e;else if(c===2)a=e,l=r;else if(c!==0){let h=i[e],u=i[e+1],f=0;const d=[0];for(let _=e+n;_<t;_+=n){const v=i[_],x=i[_+1];f+=Math.sqrt((v-h)*(v-h)+(x-u)*(x-u)),d.push(f),h=v,u=x}const g=r*f,m=j8(d,g);m<0?(l=(g-d[-m-2])/(d[-m-1]-d[-m-2]),a=e+(-m-2)*n):a=e+m*n}o=o>1?o:2,s=s||new Array(o);for(let h=0;h<o;++h)s[h]=a===void 0?NaN:l===void 0?i[a+h]:us(i[a+h],i[a+n+h],l);return s}function Dy(i,e,t,n,r,s){if(t==e)return null;let o;if(r<i[e+n-1])return s?(o=i.slice(e,e+n),o[n-1]=r,o):null;if(i[t-1]<r)return s?(o=i.slice(t-n,t),o[n-1]=r,o):null;if(r==i[e+n-1])return i.slice(e,e+n);let a=e/n,l=t/n;for(;a<l;){const f=a+l>>1;r<i[(f+1)*n-1]?l=f:a=f+1}const c=i[a*n-1];if(r==c)return i.slice((a-1)*n,(a-1)*n+n);const h=i[(a+1)*n-1],u=(r-c)/(h-c);o=[];for(let f=0;f<n-1;++f)o.push(us(i[(a-1)*n+f],i[a*n+f],u));return o.push(r),o}function FO(i,e,t,n,r,s,o){if(o)return Dy(i,e,t[t.length-1],n,r,s);let a;if(r<i[n-1])return s?(a=i.slice(0,n),a[n-1]=r,a):null;if(i[i.length-1]<r)return s?(a=i.slice(i.length-n),a[n-1]=r,a):null;for(let l=0,c=t.length;l<c;++l){const h=t[l];if(e!=h){if(r<i[e+n-1])return null;if(r<=i[h-1])return Dy(i,e,h,n,r,!1);e=h}}return null}class Bu extends zl{constructor(e,t,n){super(),n!==void 0&&t===void 0?this.setFlatCoordinates(n,e):(t=t||0,this.setCenterAndRadius(e,t,n))}clone(){const e=new Bu(this.flatCoordinates.slice(),void 0,this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){const s=this.flatCoordinates,o=e-s[0],a=t-s[1],l=o*o+a*a;if(l<r){if(l===0)for(let c=0;c<this.stride;++c)n[c]=s[c];else{const c=this.getRadius()/Math.sqrt(l);n[0]=s[0]+c*o,n[1]=s[1]+c*a;for(let h=2;h<this.stride;++h)n[h]=s[h]}return n.length=this.stride,l}return r}containsXY(e,t){const n=this.flatCoordinates,r=e-n[0],s=t-n[1];return r*r+s*s<=this.getRadiusSquared_()}getCenter(){return this.flatCoordinates.slice(0,this.stride)}computeExtent(e){const t=this.flatCoordinates,n=t[this.stride]-t[0];return qo(t[0]-n,t[1]-n,t[0]+n,t[1]+n,e)}getRadius(){return Math.sqrt(this.getRadiusSquared_())}getRadiusSquared_(){const e=this.flatCoordinates[this.stride]-this.flatCoordinates[0],t=this.flatCoordinates[this.stride+1]-this.flatCoordinates[1];return e*e+t*t}getType(){return"Circle"}intersectsExtent(e){const t=this.getExtent();if(Ei(e,t)){const n=this.getCenter();return e[0]<=n[0]&&e[2]>=n[0]||e[1]<=n[1]&&e[3]>=n[1]?!0:Dv(e,this.intersectsCoordinate.bind(this))}return!1}setCenter(e){const t=this.stride,n=this.flatCoordinates[t]-this.flatCoordinates[0],r=e.slice();r[t]=r[0]+n;for(let s=1;s<t;++s)r[t+s]=e[s];this.setFlatCoordinates(this.layout,r),this.changed()}setCenterAndRadius(e,t,n){this.setLayout(n,e,0),this.flatCoordinates||(this.flatCoordinates=[]);const r=this.flatCoordinates;let s=$T(r,0,e,this.stride);r[s++]=r[0]+t;for(let o=1,a=this.stride;o<a;++o)r[s++]=r[o];r.length=s,this.changed()}getCoordinates(){return null}setCoordinates(e,t){}setRadius(e){this.flatCoordinates[this.stride]=this.flatCoordinates[0]+e,this.changed()}rotate(e,t){const n=this.getCenter(),r=this.getStride();this.setCenter(Yv(n,0,n.length,r,e,t,n)),this.changed()}}Bu.prototype.transform;class O0 extends Zv{constructor(e){super(),this.geometries_=e,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(Zt),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const e=this.geometries_;for(let t=0,n=e.length;t<n;++t)this.changeEventsKeys_.push(wt(e[t],Qe.CHANGE,this.changed,this))}clone(){const e=new O0(l_(this.geometries_));return e.applyProperties(this),e}closestPointXY(e,t,n,r){if(r<$c(this.getExtent(),e,t))return r;const s=this.geometries_;for(let o=0,a=s.length;o<a;++o)r=s[o].closestPointXY(e,t,n,r);return r}containsXY(e,t){const n=this.geometries_;for(let r=0,s=n.length;r<s;++r)if(n[r].containsXY(e,t))return!0;return!1}computeExtent(e){Fu(e);const t=this.geometries_;for(let n=0,r=t.length;n<r;++n)Pc(e,t[n].getExtent());return e}getGeometries(){return l_(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let e=[];const t=this.geometries_;for(let n=0,r=t.length;n<r;++n)t[n].getType()===this.getType()?e=e.concat(t[n].getGeometriesArrayRecursive()):e.push(t[n]);return e}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const t=[],n=this.geometries_;let r=!1;for(let s=0,o=n.length;s<o;++s){const a=n[s],l=a.getSimplifiedGeometry(e);t.push(l),l!==a&&(r=!0)}return r?new O0(t):(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getType(){return"GeometryCollection"}intersectsExtent(e){const t=this.geometries_;for(let n=0,r=t.length;n<r;++n)if(t[n].intersectsExtent(e))return!0;return!1}isEmpty(){return this.geometries_.length===0}rotate(e,t){const n=this.geometries_;for(let r=0,s=n.length;r<s;++r)n[r].rotate(e,t);this.changed()}scale(e,t,n){n||(n=In(this.getExtent()));const r=this.geometries_;for(let s=0,o=r.length;s<o;++s)r[s].scale(e,t,n);this.changed()}setGeometries(e){this.setGeometriesArray(l_(e))}setGeometriesArray(e){this.unlistenGeometriesChange_(),this.geometries_=e,this.listenGeometriesChange_(),this.changed()}applyTransform(e){const t=this.geometries_;for(let n=0,r=t.length;n<r;++n)t[n].applyTransform(e);this.changed()}translate(e,t){const n=this.geometries_;for(let r=0,s=n.length;r<s;++r)n[r].translate(e,t);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function l_(i){return i.map(e=>e.clone())}function Ox(i,e,t,n){let r=i[e],s=i[e+1],o=0;for(let a=e+n;a<t;a+=n){const l=i[a],c=i[a+1];o+=Math.sqrt((l-r)*(l-r)+(c-s)*(c-s)),r=l,s=c}return o}class ar extends zl{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendCoordinate(e){ms(this.flatCoordinates,e),this.changed()}clone(){const e=new ar(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<$c(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Jv(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ex(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,n,r))}forEachSegment(e){return KT(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return this.layout!="XYM"&&this.layout!="XYZM"?null:(t=t!==void 0?t:!1,Dy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return bl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return F0(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return Ox(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(e){const t=[];return t.length=Am(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new ar(t,"XY")}getType(){return"LineString"}intersectsExtent(e){return Pm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,this.getExtent())}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Cm(this.flatCoordinates,0,e,this.stride),this.changed()}}class Dl extends zl{constructor(e,t,n){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(t!==void 0&&n)this.setFlatCoordinates(t,e),this.ends_=n;else{const r=e,s=[],o=[];for(let l=0,c=r.length;l<c;++l){const h=r[l];ms(s,h.getFlatCoordinates()),o.push(s.length)}const a=r.length===0?this.getLayout():r[0].getLayout();this.setFlatCoordinates(a,s),this.ends_=o}}appendLineString(e){ms(this.flatCoordinates,e.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const e=new Dl(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<$c(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Qv(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),tx(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,n,r))}getCoordinateAtM(e,t,n){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(t=t!==void 0?t:!1,n=n!==void 0?n:!1,FO(this.flatCoordinates,0,this.ends_,this.stride,e,t,n))}getCoordinates(){return Ld(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new ar(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){const e=this.flatCoordinates,t=this.ends_,n=this.layout,r=[];let s=0;for(let o=0,a=t.length;o<a;++o){const l=t[o],c=new ar(e.slice(s,l),n);r.push(c),s=l}return r}getLength(){const e=this.ends_;let t=0,n=0;for(let r=0,s=e.length;r<s;++r)n+=Ox(this.flatCoordinates,t,e[r],this.stride),t=e[r];return n}getFlatMidpoints(){const e=[],t=this.flatCoordinates;let n=0;const r=this.ends_,s=this.stride;for(let o=0,a=r.length;o<a;++o){const l=r[o],c=F0(t,n,l,s,.5);ms(e,c),n=l}return e}getSimplifiedGeometryInternal(e){const t=[],n=[];return t.length=WT(this.flatCoordinates,0,this.ends_,this.stride,e,t,0,n),new Dl(t,"XY",n)}getType(){return"MultiLineString"}intersectsExtent(e){return Q6(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);const n=ix(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}}class rg extends zl{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){ms(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){const e=new rg(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){if(r<$c(this.getExtent(),e,t))return r;const s=this.flatCoordinates,o=this.stride;for(let a=0,l=s.length;a<l;a+=o){const c=Ia(e,t,s[a],s[a+1]);if(c<r){r=c;for(let h=0;h<o;++h)n[h]=s[a+h];n.length=o}}return r}getCoordinates(){return bl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){const t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new zi(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){const e=this.flatCoordinates,t=this.layout,n=this.stride,r=[];for(let s=0,o=e.length;s<o;s+=n){const a=new zi(e.slice(s,s+n),t);r.push(a)}return r}getType(){return"MultiPoint"}intersectsExtent(e){const t=this.flatCoordinates,n=this.stride;for(let r=0,s=t.length;r<s;r+=n){const o=t[r],a=t[r+1];if(Fv(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Cm(this.flatCoordinates,0,e,this.stride),this.changed()}}class $o extends zl{constructor(e,t,n){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!n&&!Array.isArray(e[0])){const r=e,s=[],o=[];for(let a=0,l=r.length;a<l;++a){const c=r[a],h=s.length,u=c.getEnds();for(let f=0,d=u.length;f<d;++f)u[f]+=h;ms(s,c.getFlatCoordinates()),o.push(u)}t=r.length===0?this.getLayout():r[0].getLayout(),e=s,n=o}t!==void 0&&n?(this.setFlatCoordinates(t,e),this.endss_=n):this.setCoordinates(e,t)}appendPolygon(e){let t;if(!this.flatCoordinates)this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();else{const n=this.flatCoordinates.length;ms(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let r=0,s=t.length;r<s;++r)t[r]+=n}this.endss_.push(t),this.changed()}clone(){const e=this.endss_.length,t=new Array(e);for(let r=0;r<e;++r)t[r]=this.endss_[r].slice();const n=new $o(this.flatCoordinates.slice(),this.layout,t);return n.applyProperties(this),n}closestPointXY(e,t,n,r){return r<$c(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(W6(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),H6(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return J6(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return $6(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),fb(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,Sy(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const e=UL(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=XT(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new rg(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const e=this.flatCoordinates;iN(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=fb(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){const t=[],n=[];return t.length=Y6(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(e),t,0,n),new $o(t,"XY",n)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(e===0)t=0;else{const s=this.endss_[e-1];t=s[s.length-1]}const n=this.endss_[e].slice(),r=n[n.length-1];if(t!==0)for(let s=0,o=n.length;s<o;++s)n[s]-=t;return new lr(this.flatCoordinates.slice(t,r),this.layout,n)}getPolygons(){const e=this.layout,t=this.flatCoordinates,n=this.endss_,r=[];let s=0;for(let o=0,a=n.length;o<a;++o){const l=n[o].slice(),c=l[l.length-1];if(s!==0)for(let u=0,f=l.length;u<f;++u)l[u]-=s;const h=new lr(t.slice(s,c),e,l);r.push(h),s=c}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return eN(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);const n=X6(this.flatCoordinates,0,e,this.stride,this.endss_);if(n.length===0)this.flatCoordinates.length=0;else{const r=n[n.length-1];this.flatCoordinates.length=r.length===0?0:r[r.length-1]}this.changed()}}const Bb=nn();class As{constructor(e,t,n,r,s,o){this.styleFunction,this.extent_,this.id_=o,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=n||null,this.properties_=s,this.squaredTolerance_,this.stride_=r,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?ou(this.flatCoordinates_):Ov(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const e=In(this.getExtent());this.flatInteriorPoints_=sx(this.flatCoordinates_,0,this.ends_,2,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const e=QT(this.flatCoordinates_,this.ends_),t=UL(this.flatCoordinates_,0,e,2);this.flatInteriorPoints_=XT(this.flatCoordinates_,0,e,2,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=F0(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const e=this.flatCoordinates_;let t=0;const n=this.ends_;for(let r=0,s=n.length;r<s;++r){const o=n[r],a=F0(e,t,o,2,.5);ms(this.flatMidpoints_,a),t=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){e=Mt(e);const t=e.getExtent(),n=e.getWorldExtent();if(t&&n){const r=Wi(n)/Wi(t);_s(Bb,n[0],n[3],r,-r,0,0,0),jo(this.flatCoordinates_,0,this.flatCoordinates_.length,2,Bb,this.flatCoordinates_)}}applyTransform(e){e(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new As(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=AT((e,t)=>{if(e===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),t&&this.simplifiedGeometry_.applyTransform(t);const n=this.simplifiedGeometry_.getFlatCoordinates();let r;switch(this.type_){case"LineString":n.length=Am(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),r=[n.length];break;case"MultiLineString":r=[],n.length=WT(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,r);break;case"Polygon":r=[],n.length=nx(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(e),n,0,r);break}return r&&(this.simplifiedGeometry_=new As(this.type_,n,r,2,this.properties_,this.id_)),this.squaredTolerance_=e,this.simplifiedGeometry_}),this}}As.prototype.getFlatCoordinates=As.prototype.getOrientedFlatCoordinates;class D0{constructor(e){this.rbush_=new vx(e),this.items_={}}insert(e,t){const n={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(n),this.items_[Ue(t)]=n}load(e,t){const n=new Array(t.length);for(let r=0,s=t.length;r<s;r++){const o=e[r],a=t[r],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};n[r]=l,this.items_[Ue(a)]=l}this.rbush_.load(n)}remove(e){const t=Ue(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){const n=this.items_[Ue(t)],r=[n.minX,n.minY,n.maxX,n.maxY];Ga(r,e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(e){const t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(r){return r.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let n;for(let r=0,s=e.length;r<s;r++)if(n=t(e[r]),n)return n;return n}isEmpty(){return Fc(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){const t=this.rbush_.toJSON();return qo(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(const t in e.items_)this.items_[t]=e.items_[t]}}const An={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};class dl extends Dr{constructor(e,t,n){super(e),this.feature=t,this.features=n}}class Ko extends Bm{constructor(e){e=e||{},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:e.wrapX!==void 0?e.wrapX:!0}),this.on,this.once,this.un,this.loader_=bd,this.format_=e.format||null,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader!==void 0?this.loader_=e.loader:this.url_!==void 0&&(Vt(this.format_,"`format` must be set when `url` is set"),this.loader_=Gb(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:NO;const t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new D0:null,this.loadedExtentsRtree_=new D0,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let n,r;Array.isArray(e.features)?r=e.features:e.features&&(n=e.features,r=n.getArray()),!t&&n===void 0&&(n=new Rn(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){const t=Ue(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);const n=e.getGeometry();if(n){const r=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(r,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new dl(An.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof As||(this.featureChangeKeys_[e]=[wt(t,Qe.CHANGE,this.handleFeatureChange_,this),wt(t,wu.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let n=!0;if(t.getId()!==void 0){const r=String(t.getId());if(!(r in this.idIndex_))this.idIndex_[r]=t;else if(t instanceof As){const s=this.idIndex_[r];s instanceof As?Array.isArray(s)?s.push(t):this.idIndex_[r]=[s,t]:n=!1}else n=!1}return n&&(Vt(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),n}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){const t=[],n=[],r=[];for(let s=0,o=e.length;s<o;s++){const a=e[s],l=Ue(a);this.addToIndex_(l,a)&&n.push(a)}for(let s=0,o=n.length;s<o;s++){const a=n[s],l=Ue(a);this.setupChangeEvents_(l,a);const c=a.getGeometry();if(c){const h=c.getExtent();t.push(h),r.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(t,r),this.hasListener(An.ADDFEATURE))for(let s=0,o=n.length;s<o;s++)this.dispatchEvent(new dl(An.ADDFEATURE,n[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(An.ADDFEATURE,function(n){t||(t=!0,e.push(n.feature),t=!1)}),this.addEventListener(An.REMOVEFEATURE,function(n){t||(t=!0,e.remove(n.feature),t=!1)}),e.addEventListener(ln.ADD,n=>{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(ln.REMOVE,n=>{t||(t=!0,this.removeFeature(n.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(const n in this.featureChangeKeys_)this.featureChangeKeys_[n].forEach(Zt);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(n=>{this.removeFeatureInternal(n)});for(const n in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[n])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const t=new dl(An.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){const n=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(n,function(r){const s=r.getGeometry();if(s instanceof As||s.intersectsCoordinate(e))return t(r)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(n){const r=n.getGeometry();if(r instanceof As||r.intersectsExtent(e)){const s=t(n);if(s)return s}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),Fc(this.nullGeometryFeatures_)||ms(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){const t=[];return this.forEachFeatureAtCoordinateDirect(e,function(n){t.push(n)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);const r=Bv(e,t);return[].concat(...r.map(s=>this.featuresRtree_.getInExtent(s)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){const n=e[0],r=e[1];let s=null;const o=[NaN,NaN];let a=1/0;const l=[-1/0,-1/0,1/0,1/0];return t=t||zo,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){const h=c.getGeometry(),u=a;if(a=h instanceof As?0:h.closestPointXY(n,r,o,a),a<u){s=c;const f=Math.sqrt(a);l[0]=n-f,l[1]=r-f,l[2]=n+f,l[3]=r+f}}}),s}getExtent(e){return this.featuresRtree_.getExtent(e)}getFeatureById(e){const t=this.idIndex_[e.toString()];return t!==void 0?t:null}getFeatureByUid(e){const t=this.uidIndex_[e];return t!==void 0?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){const t=e.target,n=Ue(t),r=t.getGeometry();if(!r)n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[n]=t);else{const o=r.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(o,t)):this.featuresRtree_&&this.featuresRtree_.update(o,t)}const s=t.getId();if(s!==void 0){const o=s.toString();this.idIndex_[o]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[o]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[n]=t;this.changed(),this.dispatchEvent(new dl(An.CHANGEFEATURE,t))}hasFeature(e){const t=e.getId();return t!==void 0?t in this.idIndex_:Ue(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Fc(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,n){const r=this.loadedExtentsRtree_,s=this.strategy_(e,t,n);for(let o=0,a=s.length;o<a;++o){const l=s[o];r.forEachInExtent(l,function(h){return gs(h.extent,l)})||(++this.loadingExtentsCount_,this.dispatchEvent(new dl(An.FEATURESLOADSTART)),this.loader_.call(this,l,t,n,h=>{--this.loadingExtentsCount_,this.dispatchEvent(new dl(An.FEATURESLOADEND,void 0,h))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new dl(An.FEATURESLOADERROR))}),r.insert(l,{extent:l.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){const t=this.loadedExtentsRtree_,n=t.forEachInExtent(e,function(r){if(Ga(r.extent,e))return r});n&&t.remove(n)}removeFeatures(e){let t=!1;for(let n=0,r=e.length;n<r;++n)t=this.removeFeatureInternal(e[n])||t;t&&this.changed()}removeFeature(e){if(!e)return;this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){const t=Ue(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.featureChangeKeys_[t]?.forEach(Zt),delete this.featureChangeKeys_[t];const r=e.getId();if(r!==void 0){const s=r.toString(),o=this.idIndex_[s];o===e?delete this.idIndex_[s]:Array.isArray(o)&&(o.splice(o.indexOf(e),1),o.length===1&&(this.idIndex_[s]=o[0]))}return delete this.uidIndex_[t],this.hasListener(An.REMOVEFEATURE)&&this.dispatchEvent(new dl(An.REMOVEFEATURE,e)),!0}removeFromIdIndex_(e){for(const t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){Vt(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(Gb(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}}class zL extends Ko{constructor(e){e=e||{},super({attributions:e.attributions,wrapX:e.wrapX}),this.resolution=void 0,this.distance=e.distance!==void 0?e.distance:20,this.minDistance=e.minDistance||0,this.interpolationRatio=0,this.features=[],this.geometryFunction=e.geometryFunction||function(t){const n=t.getGeometry();return Vt(!n||n.getType()==="Point","The default `geometryFunction` can only handle `Point` or null geometries"),n},this.createCustomCluster_=e.createCluster,this.source=null,this.boundRefresh_=this.refresh.bind(this),this.updateDistance(this.distance,this.minDistance),this.setSource(e.source||null)}clear(e){this.features.length=0,super.clear(e)}getDistance(){return this.distance}getSource(){return this.source}loadFeatures(e,t,n){this.source?.loadFeatures(e,t,n),t!==this.resolution&&(this.resolution=t,this.refresh())}setDistance(e){this.updateDistance(e,this.minDistance)}setMinDistance(e){this.updateDistance(this.distance,e)}getMinDistance(){return this.minDistance}setSource(e){this.source&&this.source.removeEventListener(Qe.CHANGE,this.boundRefresh_),this.source=e,e&&e.addEventListener(Qe.CHANGE,this.boundRefresh_),this.refresh()}refresh(){this.clear(),this.cluster(),this.addFeatures(this.features)}updateDistance(e,t){const n=e===0?0:Math.min(t,e)/e,r=e!==this.distance||this.interpolationRatio!==n;this.distance=e,this.minDistance=t,this.interpolationRatio=n,r&&this.refresh()}cluster(){if(this.resolution===void 0||!this.source)return;const e=bn(),t=this.distance*this.resolution,n=this.source.getFeatures(),r={};for(let s=0,o=n.length;s<o;s++){const a=n[s];if(!(Ue(a)in r)){const l=this.geometryFunction(a);if(l){const c=l.getCoordinates();ou(c,e),Zn(e,t,e);const h=this.source.getFeaturesInExtent(e).filter(function(u){const f=Ue(u);return f in r?!1:(r[f]=!0,!0)});this.features.push(this.createCluster(h,e))}}}}createCluster(e,t){const n=[0,0];for(let a=e.length-1;a>=0;--a){const l=this.geometryFunction(e[a]);l?NT(n,l.getCoordinates()):e.splice(a,1)}FT(n,1/e.length);const r=In(t),s=this.interpolationRatio,o=new zi([n[0]*(1-s)+r[0]*s,n[1]*(1-s)+r[1]*s]);return this.createCustomCluster_?this.createCustomCluster_(o,e):new wi({geometry:o,features:e})}}function Au(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}function ky(i){return i instanceof Uint8Array||i instanceof Uint8ClampedArray||i instanceof Float32Array||i instanceof DataView?i:null}const OO=new Error("disposed");let Eh=null;function DO(i){Eh||(Eh=Xi(i.width,i.height,void 0,{willReadFrequently:!0}));const e=Eh.canvas,t=i.width;e.width!==t&&(e.width=t);const n=i.height;return e.height!==n&&(e.height=n),Eh.clearRect(0,0,t,n),Eh.drawImage(i,0,0),Eh.getImageData(0,0,t,n).data}const kO=[256,256];class Dd extends ng{constructor(e){const t=Oe.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;const e=Au(this.data_);return e?[e.width,e.height]:kO}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==Oe.IDLE&&this.state!==Oe.ERROR)return;this.state=Oe.LOADING,this.changed();const e=this;this.loader_().then(function(t){e.data_=t,e.state=Oe.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=Oe.ERROR,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(OO),this.controller_=null),super.disposeInternal()}}function Zc(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function k0(i,e){return i[0]=e[0],i[1]=e[1],i[4]=e[2],i[5]=e[3],i[12]=e[4],i[13]=e[5],i}function Gy(i,e,t,n,r,s,o){o=o??Zc();const a=1/(i-e),l=1/(t-n),c=1/(r-s);return o[0]=-2*a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=-2*l,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=2*c,o[11]=0,o[12]=(i+e)*a,o[13]=(n+t)*l,o[14]=(s+r)*c,o[15]=1,o}function jb(i,e,t,n,r){return r=r??Zc(),r[0]=i[0]*e,r[1]=i[1]*e,r[2]=i[2]*e,r[3]=i[3]*e,r[4]=i[4]*t,r[5]=i[5]*t,r[6]=i[6]*t,r[7]=i[7]*t,r[8]=i[8]*n,r[9]=i[9]*n,r[10]=i[10]*n,r[11]=i[11]*n,r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],r}function GO(i,e,t,n,r){r=r??Zc();let s,o,a,l,c,h,u,f,d,g,m,_;return i===r?(r[12]=i[0]*e+i[4]*t+i[8]*n+i[12],r[13]=i[1]*e+i[5]*t+i[9]*n+i[13],r[14]=i[2]*e+i[6]*t+i[10]*n+i[14],r[15]=i[3]*e+i[7]*t+i[11]*n+i[15]):(s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],h=i[5],u=i[6],f=i[7],d=i[8],g=i[9],m=i[10],_=i[11],r[0]=s,r[1]=o,r[2]=a,r[3]=l,r[4]=c,r[5]=h,r[6]=u,r[7]=f,r[8]=d,r[9]=g,r[10]=m,r[11]=_,r[12]=s*e+c*t+d*n+i[12],r[13]=o*e+h*t+g*n+i[13],r[14]=a*e+u*t+m*n+i[14],r[15]=l*e+f*t+_*n+i[15]),r}function BO(i,e,t,n){return n=n??Zc(),n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=i,n[13]=e,n[14]=t,n[15]=1,n}const jO=`
6
- attribute vec4 a_position;
7
- attribute vec4 a_texcoord;
8
-
9
- uniform mat4 u_matrix;
10
- uniform mat4 u_textureMatrix;
11
-
12
- varying vec2 v_texcoord;
13
-
14
- void main() {
15
- gl_Position = u_matrix * a_position;
16
- vec2 texcoord = (u_textureMatrix * a_texcoord).xy;
17
- v_texcoord = texcoord;
18
- }
19
- `,UO=`
20
- precision mediump float;
21
-
22
- varying vec2 v_texcoord;
23
-
24
- uniform sampler2D u_texture;
25
-
26
- void main() {
27
- if (
28
- v_texcoord.x < 0.0 ||
29
- v_texcoord.y < 0.0 ||
30
- v_texcoord.x > 1.0 ||
31
- v_texcoord.y > 1.0
32
- ) {
33
- discard;
34
- }
35
- gl_FragColor = texture2D(u_texture, v_texcoord);
36
- }
37
- `;class zO{constructor(e){this.gl_=e,this.program_=By(e,UO,jO),this.positionLocation=e.getAttribLocation(this.program_,"a_position"),this.texcoordLocation=e.getAttribLocation(this.program_,"a_texcoord"),this.matrixLocation=e.getUniformLocation(this.program_,"u_matrix"),this.textureMatrixLocation=e.getUniformLocation(this.program_,"u_textureMatrix"),this.textureLocation=e.getUniformLocation(this.program_,"u_texture"),this.positionBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this.positionBuffer),this.positions=[0,0,0,1,1,0,1,0,0,1,1,1],e.bufferData(e.ARRAY_BUFFER,new Float32Array(this.positions),e.STATIC_DRAW),this.texcoordBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this.texcoordBuffer),this.texcoords=[0,0,0,1,1,0,1,0,0,1,1,1],e.bufferData(e.ARRAY_BUFFER,new Float32Array(this.texcoords),e.STATIC_DRAW)}drawImage(e,t,n,r,s,o,a,l,c,h,u,f,d){const g=this.gl_;l===void 0&&(l=r),c===void 0&&(c=s),o===void 0&&(o=t),a===void 0&&(a=n),h===void 0&&(h=o),u===void 0&&(u=a),f===void 0&&(f=g.canvas.width),d===void 0&&(d=g.canvas.height),g.bindTexture(g.TEXTURE_2D,e),g.useProgram(this.program_),g.bindBuffer(g.ARRAY_BUFFER,this.positionBuffer),g.enableVertexAttribArray(this.positionLocation),g.vertexAttribPointer(this.positionLocation,2,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,this.texcoordBuffer),g.enableVertexAttribArray(this.texcoordLocation),g.vertexAttribPointer(this.texcoordLocation,2,g.FLOAT,!1,0,0);let m=Gy(0,f,0,d,-1,1);m=GO(m,l,c,0),m=jb(m,h,u,1),g.uniformMatrix4fv(this.matrixLocation,!1,m);let _=BO(r/t,s/n,0);_=jb(_,o/t,a/n,1),g.uniformMatrix4fv(this.textureMatrixLocation,!1,_),g.uniform1i(this.textureLocation,0),g.drawArrays(g.TRIANGLES,0,this.positions.length/2)}}function Ub(i,e,t){const n=i.createShader(e);if(n===null)throw new Error("Shader compilation failed");if(i.shaderSource(n,t),i.compileShader(n),!i.getShaderParameter(n,i.COMPILE_STATUS)){const r=i.getShaderInfoLog(n);throw r===null?new Error("Shader info log creation failed"):new Error(r)}return n}function By(i,e,t){const n=i.createProgram(),r=Ub(i,i.VERTEX_SHADER,t),s=Ub(i,i.FRAGMENT_SHADER,e);if(n===null)throw new Error("Program creation failed");if(i.attachShader(n,r),i.attachShader(n,s),i.linkProgram(n),!i.getProgramParameter(n,i.LINK_STATUS))throw i.getProgramInfoLog(n)===null?new Error("Program info log creation failed"):new Error;return n}const qO=`
38
- attribute vec4 a_position;
39
-
40
- uniform mat4 u_matrix;
41
-
42
- void main() {
43
- gl_Position = u_matrix * a_position;
44
- }
45
- `,VO=`
46
- precision mediump float;
47
-
48
- uniform vec4 u_val;
49
- void main() {
50
- gl_FragColor = u_val;
51
- }
52
- `,$O=`
53
- attribute vec4 a_position;
54
- attribute vec2 a_texcoord;
55
-
56
- varying vec2 v_texcoord;
57
-
58
- uniform mat4 u_matrix;
59
-
60
- void main() {
61
- gl_Position = u_matrix * a_position;
62
- v_texcoord = a_texcoord;
63
- }
64
- `,WO=`
65
- precision mediump float;
66
-
67
- varying vec2 v_texcoord;
68
-
69
- uniform sampler2D u_texture;
70
-
71
- void main() {
72
- if (v_texcoord.x < 0.0 || v_texcoord.x > 1.0 || v_texcoord.y < 0.0 || v_texcoord.y > 1.0) {
73
- discard;
74
- }
75
- gl_FragColor = texture2D(u_texture, v_texcoord);
76
- }
77
- `;function HO(i,e,t,n){let r;return t&&t.length?r=t.shift():Xr?r=new OffscreenCanvas(i||300,e||300):r=document.createElement("canvas"),i&&(r.width=i),e&&(r.height=e),r.getContext("webgl",n)}function XO(i){const e=i.canvas;e.width=1,e.height=1,i.clear(i.COLOR_BUFFER_BIT|i.DEPTH_BUFFER_BIT|i.STENCIL_BUFFER_BIT)}const zb=[];function KO(i,e,t,n,r,s,o,a,l,c,h,u,f,d){const g=Math.round(n*e),m=Math.round(n*t);i.canvas.width=g,i.canvas.height=m;let _,v;if(v=i.createTexture(),i.bindTexture(i.TEXTURE_2D,v),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),f?(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR)):(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.NEAREST)),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,g,m,0,i.RGBA,h,null),_=i.createFramebuffer(),i.bindFramebuffer(i.FRAMEBUFFER,_),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,v,0),_===null)throw new Error("Could not create framebuffer");if(v===null)throw new Error("Could not create texture");if(l.length===0)return{width:g,height:m,framebuffer:_,texture:v};const x=bn();l.forEach(function(O,L,T){Pc(x,O.extent)});let S,b,A;const F=1/r;{if(S=i.createTexture(),v===null)throw new Error("Could not create texture");b=Math.round(St(x)*F),A=Math.round(Wi(x)*F);const O=i.getParameter(i.MAX_TEXTURE_SIZE),L=Math.max(b,A),T=L>O?O/L:1,C=Math.round(b*T),D=Math.round(A*T);i.bindTexture(i.TEXTURE_2D,S),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),f?(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR)):(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.NEAREST)),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,C,D,0,i.RGBA,h,null);const W=i.createFramebuffer();i.bindFramebuffer(i.FRAMEBUFFER,W),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,S,0);const $=new zO(i);l.forEach(function(B,V,te){const ne=(B.extent[0]-x[0])*F*T,ae=-(B.extent[3]-x[3])*F*T,I=St(B.extent)*F*T,U=Wi(B.extent)*F*T;if(i.bindFramebuffer(i.FRAMEBUFFER,W),i.viewport(0,0,C,D),B.clipExtent){const K=(B.clipExtent[0]-x[0])*F*T,ie=-(B.clipExtent[3]-x[3])*F*T,re=St(B.clipExtent)*F*T,ce=Wi(B.clipExtent)*F*T;i.enable(i.SCISSOR_TEST),i.scissor(f?K:Math.round(K),f?ie:Math.round(ie),f?re:Math.round(K+re)-Math.round(K),f?ce:Math.round(ie+ce)-Math.round(ie))}$.drawImage(B.texture,B.width,B.height,c,c,B.width-2*c,B.height-2*c,f?ne:Math.round(ne),f?ae:Math.round(ae),f?I:Math.round(ne+I)-Math.round(ne),f?U:Math.round(ae+U)-Math.round(ae),C,D),i.disable(i.SCISSOR_TEST)}),i.deleteFramebuffer(W)}const N=no(o),R=no(x),P=O=>{const L=(O[0][0]-N[0])/s*n,T=-(O[0][1]-N[1])/s*n,C=(O[1][0]-N[0])/s*n,D=-(O[1][1]-N[1])/s*n,W=(O[2][0]-N[0])/s*n,$=-(O[2][1]-N[1])/s*n;return{u1:C,v1:D,u0:L,v0:T,u2:W,v2:$}};i.bindFramebuffer(i.FRAMEBUFFER,_),i.viewport(0,0,g,m);{const O=[],L=[],T=By(i,WO,$O);i.useProgram(T);const C=i.getUniformLocation(T,"u_texture");i.bindTexture(i.TEXTURE_2D,S),i.uniform1i(C,0),a.getTriangles().forEach(function(ne,ae,I){const U=ne.source,K=ne.target,{u1:ie,v1:re,u0:ce,v0:ve,u2:pe,v2:le}=P(K),Ce=(U[0][0]-R[0])/r/b,H=-(U[0][1]-R[1])/r/A,Z=(U[1][0]-R[0])/r/b,he=-(U[1][1]-R[1])/r/A,j=(U[2][0]-R[0])/r/b,fe=-(U[2][1]-R[1])/r/A;O.push(ie,re,ce,ve,pe,le),L.push(Z,he,Ce,H,j,fe)});const D=Gy(0,g,m,0,-1,1),W=i.getUniformLocation(T,"u_matrix");i.uniformMatrix4fv(W,!1,D);const $=i.getAttribLocation(T,"a_position"),B=i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,B),i.bufferData(i.ARRAY_BUFFER,new Float32Array(O),i.STATIC_DRAW),i.vertexAttribPointer($,2,i.FLOAT,!1,0,0),i.enableVertexAttribArray($);const V=i.getAttribLocation(T,"a_texcoord"),te=i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,te),i.bufferData(i.ARRAY_BUFFER,new Float32Array(L),i.STATIC_DRAW),i.vertexAttribPointer(V,2,i.FLOAT,!1,0,0),i.enableVertexAttribArray(V),i.drawArrays(i.TRIANGLES,0,O.length/2)}if(u){const O=By(i,VO,qO);i.useProgram(O);const L=Gy(0,g,m,0,-1,1),T=i.getUniformLocation(O,"u_matrix");i.uniformMatrix4fv(T,!1,L);const C=Array.isArray(u)?u:[0,0,0,255],D=i.getUniformLocation(O,"u_val");i.uniform4fv(D,C);const W=i.getAttribLocation(O,"a_position"),$=i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,$),i.vertexAttribPointer(W,2,i.FLOAT,!1,0,0),i.enableVertexAttribArray(W);const B=a.getTriangles().reduce(function(V,te){const ne=te.target,{u1:ae,v1:I,u0:U,v0:K,u2:ie,v2:re}=P(ne);return V.concat([ae,I,U,K,U,K,ie,re,ie,re,ae,I])},[]);i.bufferData(i.ARRAY_BUFFER,new Float32Array(B),i.STATIC_DRAW),i.drawArrays(i.LINES,0,B.length/2)}return{width:g,height:m,framebuffer:_,texture:v}}class YO extends Dd{constructor(e){super({tileCoord:e.tileCoord,loader:()=>Promise.resolve(new Uint8ClampedArray(4)),interpolate:e.interpolate,transition:e.transition}),this.renderEdges_=e.renderEdges!==void 0?e.renderEdges:!1,this.pixelRatio_=e.pixelRatio,this.gutter_=e.gutter,this.reprojData_=null,this.reprojError_=null,this.reprojSize_=void 0,this.sourceTileGrid_=e.sourceTileGrid,this.targetTileGrid_=e.targetTileGrid,this.wrappedTileCoord_=e.wrappedTileCoord||e.tileCoord,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const t=e.sourceProj,n=t.getExtent(),r=e.sourceTileGrid.getExtent();this.clipExtent_=t.canWrapX()?r?Mn(n,r):n:r;const s=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),o=this.targetTileGrid_.getExtent();let a=this.sourceTileGrid_.getExtent();const l=o?Mn(s,o):s;if(Ed(l)===0){this.state=Oe.EMPTY;return}n&&(a?a=Mn(a,n):a=n);const c=this.targetTileGrid_.getResolution(this.wrappedTileCoord_[0]),h=e.targetProj,u=DL(t,h,l,c);if(!isFinite(u)||u<=0){this.state=Oe.EMPTY;return}const f=e.errorThreshold!==void 0?e.errorThreshold:Ix;if(this.triangulation_=new Rx(t,h,l,a,u*f,c,e.transformMatrix),this.triangulation_.getTriangles().length===0){this.state=Oe.EMPTY;return}this.sourceZ_=this.sourceTileGrid_.getZForResolution(u);let d=this.triangulation_.calculateSourceExtent();if(a&&(t.canWrapX()?(d[1]=yt(d[1],a[1],a[3]),d[3]=yt(d[3],a[1],a[3])):d=Mn(d,a)),!Ed(d))this.state=Oe.EMPTY;else{let g=0,m=0;t.canWrapX()&&(g=St(n),m=Math.floor((d[0]-n[0])/g)),Bv(d.slice(),t,!0).forEach(v=>{const x=this.sourceTileGrid_.getTileRangeForExtentAndZ(v,this.sourceZ_),S=e.getTileFunction;for(let b=x.minX;b<=x.maxX;b++)for(let A=x.minY;A<=x.maxY;A++){const F=S(this.sourceZ_,b,A,this.pixelRatio_);if(F){const N=m*g;this.sourceTiles_.push({tile:F,offset:N})}}++m}),this.sourceTiles_.length===0&&(this.state=Oe.EMPTY)}}getSize(){return this.reprojSize_}getData(){return this.reprojData_}getError(){return this.reprojError_}reproject_(){const e=[];let t=!1;if(this.sourceTiles_.forEach(b=>{const A=b.tile;if(!A||A.getState()!==Oe.LOADED)return;const F=A.getSize(),N=this.gutter_;let R;const P=ky(A.getData());P?R=P:(t=!0,R=DO(Au(A.getData())));const O=[F[0]+2*N,F[1]+2*N],L=R instanceof Float32Array,T=O[0]*O[1],C=L?Float32Array:Uint8ClampedArray,D=new C(R.buffer),W=C.BYTES_PER_ELEMENT,$=W*D.length/T,B=D.byteLength/O[1],V=Math.floor(B/W/O[0]),te=this.sourceTileGrid_.getTileCoordExtent(A.tileCoord);te[0]+=b.offset,te[2]+=b.offset;const ne=this.clipExtent_?.slice();ne&&(ne[0]+=b.offset,ne[2]+=b.offset),e.push({extent:te,clipExtent:ne,data:D,dataType:C,bytesPerPixel:$,pixelSize:O,bandCount:V})}),this.sourceTiles_.length=0,e.length===0){this.state=Oe.ERROR,this.changed();return}const n=this.wrappedTileCoord_[0],r=this.targetTileGrid_.getTileSize(n),s=typeof r=="number"?r:r[0],o=typeof r=="number"?r:r[1],a=Math.round(s*this.pixelRatio_),l=Math.round(o*this.pixelRatio_),c=this.targetTileGrid_.getResolution(n),h=this.sourceTileGrid_.getResolution(this.sourceZ_),u=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),f=e[0].bandCount,d=new e[0].dataType(f*a*l),g=HO(a,l,zb,{premultipliedAlpha:!1,antialias:!1});let m;const _=g.RGBA;let v;e[0].dataType==Float32Array?(v=g.FLOAT,g.getExtension("WEBGL_color_buffer_float"),g.getExtension("OES_texture_float"),g.getExtension("EXT_float_blend"),m=g.getExtension("OES_texture_float_linear")!==null&&this.interpolate):(v=g.UNSIGNED_BYTE,m=this.interpolate);const x=4,S=Math.ceil(f/x);for(let b=S-1;b>=0;--b){const A=[];for(let C=0,D=e.length;C<D;++C){const W=e[C],$=W.pixelSize,B=$[0],V=$[1],te=new W.dataType(x*B*V),ne=W.data;let ae=b*x;for(let U=0,K=te.length;U<K;U+=x)te[U]=ne[ae],te[U+1]=ne[ae+1],te[U+2]=ne[ae+2],te[U+3]=ne[ae+3],ae+=f;const I=g.createTexture();g.bindTexture(g.TEXTURE_2D,I),m?(g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,g.LINEAR),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MAG_FILTER,g.LINEAR)):(g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,g.NEAREST),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MAG_FILTER,g.NEAREST)),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE),g.texImage2D(g.TEXTURE_2D,0,_,B,V,0,_,v,te),A.push({extent:W.extent,clipExtent:W.clipExtent,texture:I,width:B,height:V})}const{framebuffer:F,width:N,height:R}=KO(g,s,o,this.pixelRatio_,h,c,u,this.triangulation_,A,this.gutter_,v,this.renderEdges_,m),P=N,O=R*x,L=new e[0].dataType(P*O);g.bindFramebuffer(g.FRAMEBUFFER,F),g.readPixels(0,0,N,R,g.RGBA,v,L);let T=b*x;for(let C=0,D=L.length;C<D;C+=x){const W=(P-1-(C/O|0))*O+C%O;d[T]=L[W],d[T+1]=L[W+1],d[T+2]=L[W+2],d[T+3]=L[W+3],T+=f}}if(XO(g),zb.push(g.canvas),t){const b=Xi(s,o),A=new ImageData(d,s);b.putImageData(A,0,0),this.reprojData_=b.canvas}else this.reprojData_=d;this.reprojSize_=[a,l],this.state=Oe.LOADED,this.changed()}load(){if(this.state!==Oe.IDLE&&this.state!==Oe.ERROR)return;this.state=Oe.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{const n=t.getState();if(n!==Oe.IDLE&&n!==Oe.LOADING)return;e++;const r=wt(t,Qe.CHANGE,()=>{const s=t.getState();(s==Oe.LOADED||s==Oe.ERROR||s==Oe.EMPTY)&&(Zt(r),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(r)}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t}){t.getState()==Oe.IDLE&&t.load()})}unlistenSources_(){this.sourcesListenerKeys_.forEach(Zt),this.sourcesListenerKeys_=null}}class Dx extends jm{constructor(e){const t=e.projection===void 0?"EPSG:3857":e.projection;let n=e.tileGrid;n===void 0&&t&&(n=ku({extent:Yc(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize})),super({cacheSize:.1,attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:t,tileGrid:n,state:e.state,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate,key:e.key,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0,this.tileSize_=e.tileSize?Hi(e.tileSize):null,this.tileSizes_=null,this.tileLoadingKeys_={},this.loader_=e.loader,this.handleTileChange_=this.handleTileChange_.bind(this),this.bandCount=e.bandCount===void 0?4:e.bandCount,this.tileGridForProjection_={},this.crossOrigin_=e.crossOrigin||"anonymous",this.transformMatrix=null}setTileSizes(e){this.tileSizes_=e}getTileSize(e){if(this.tileSizes_)return this.tileSizes_[e];if(this.tileSize_)return this.tileSize_;const t=this.getTileGrid();return t?Hi(t.getTileSize(e)):[256,256]}getGutterForProjection(e){const t=this.getProjection();return(!t||mn(t,e))&&!this.transformMatrix?this.gutter_:0}setLoader(e){this.loader_=e}getReprojTile_(e,t,n,r,s,o){const a=this.tileGrid||this.getTileGridForProjection(s||r),l=Math.max.apply(null,a.getResolutions().map((g,m)=>{const _=Hi(a.getTileSize(m)),v=this.getTileSize(m);return Math.max(v[0]/_[0],v[1]/_[1])})),c=this.getTileGridForProjection(r),h=[e,t,n],u=this.getTileCoordForTileUrlFunction(h,r),f=Object.assign({sourceProj:s||r,sourceTileGrid:a,targetProj:r,targetTileGrid:c,tileCoord:h,wrappedTileCoord:u,pixelRatio:l,gutter:this.gutter_,getTileFunction:(g,m,_,v)=>this.getTile(g,m,_,v,void 0,o),transformMatrix:this.transformMatrix},this.tileOptions),d=new YO(f);return d.key=this.getKey(),d}getTile(e,t,n,r,s,o){const a=this.getProjection();if(s&&(a&&!mn(a,s)||this.transformMatrix))return this.getReprojTile_(e,t,n,s,a,o);const l=this.getTileSize(e),c=this.loader_,h=new AbortController,u={signal:h.signal,crossOrigin:this.crossOrigin_},f=this.getTileCoordForTileUrlFunction([e,t,n]);if(!f)return null;const d=this.getKey(),g=Qf(this,d,e,t,n);if(o&&o.containsKey(g))return o.get(g);const m=f[0],_=f[1],v=f[2],x=this.getTileGrid()?.getFullTileRange(m);x&&(u.maxY=x.getHeight()-1);function S(){return Nv(function(){return c(m,_,v,u)})}const b=Object.assign({tileCoord:[e,t,n],loader:S,size:l,controller:h},this.tileOptions),A=new Dd(b);return A.key=this.getKey(),A.addEventListener(Qe.CHANGE,this.handleTileChange_),o?.set(g,A),A}handleTileChange_(e){const t=e.target,n=Ue(t),r=t.getState();let s;r==Oe.LOADING?(this.tileLoadingKeys_[n]=!0,s=uu.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],s=r==Oe.ERROR?uu.TILELOADERROR:r==Oe.LOADED?uu.TILELOADEND:void 0),s&&this.dispatchEvent(new GL(s,t))}getTileGridForProjection(e){const t=this.getProjection();if(this.tileGrid&&(!t||mn(t,e))&&!this.transformMatrix)return this.tileGrid;const n=Ue(e);return n in this.tileGridForProjection_||(this.tileGridForProjection_[n]=km(e)),this.tileGridForProjection_[n]}setTileGridForProjection(e,t){const n=Mt(e);if(n){const r=Ue(n);r in this.tileGridForProjection_||(this.tileGridForProjection_[r]=t)}}}function ur(i){return(e,...t)=>ZO(i,e,t)}function ju(i,e){return ur(qL(i,e).get)}const{apply:ZO,getOwnPropertyDescriptor:qL,getPrototypeOf:kx,ownKeys:JO}=Reflect,{iterator:sg,toStringTag:QO}=Symbol,e3=Object,{create:Gx,defineProperty:t3}=e3,i3=Array,n3=i3.prototype,VL=n3[sg],r3=ur(VL),$L=ArrayBuffer,s3=$L.prototype;ju(s3,"byteLength");const qb=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:null;qb&&ju(qb.prototype,"byteLength");const WL=kx(Uint8Array);WL.from;const kr=WL.prototype;kr[sg];ur(kr.keys);ur(kr.values);ur(kr.entries);ur(kr.set);ur(kr.reverse);ur(kr.fill);ur(kr.copyWithin);ur(kr.sort);ur(kr.slice);ur(kr.subarray);ju(kr,"buffer");ju(kr,"byteOffset");ju(kr,"length");ju(kr,QO);const o3=Uint8Array,HL=Uint16Array,Bx=Uint32Array,a3=Float32Array,kd=kx([][sg]()),XL=ur(kd.next),l3=ur((function*(){})().next),c3=kx(kd),h3=DataView.prototype,u3=ur(h3.getUint16),jx=WeakMap,KL=jx.prototype,YL=ur(KL.get),f3=ur(KL.set),ZL=new jx,d3=Gx(null,{next:{value:function(){const e=YL(ZL,this);return XL(e)}},[sg]:{value:function(){return this}}});function g3(i){if(i[sg]===VL&&kd.next===XL)return i;const e=Gx(d3);return f3(ZL,e,r3(i)),e}const p3=new jx,m3=Gx(c3,{next:{value:function(){const e=YL(p3,this);return l3(e)},writable:!0,configurable:!0}});for(const i of JO(kd))i!=="next"&&t3(m3,i,qL(kd,i));const JL=new $L(4),_3=new a3(JL),y3=new Bx(JL),Eo=new HL(512),So=new o3(512);for(let i=0;i<256;++i){const e=i-127;e<-24?(Eo[i]=0,Eo[i|256]=32768,So[i]=24,So[i|256]=24):e<-14?(Eo[i]=1024>>-e-14,Eo[i|256]=1024>>-e-14|32768,So[i]=-e-1,So[i|256]=-e-1):e<=15?(Eo[i]=e+15<<10,Eo[i|256]=e+15<<10|32768,So[i]=13,So[i|256]=13):e<128?(Eo[i]=31744,Eo[i|256]=64512,So[i]=24,So[i|256]=24):(Eo[i]=31744,Eo[i|256]=64512,So[i]=13,So[i|256]=13)}const Ux=new Bx(2048);for(let i=1;i<1024;++i){let e=i<<13,t=0;for(;(e&8388608)===0;)e<<=1,t-=8388608;e&=-8388609,t+=947912704,Ux[i]=e|t}for(let i=1024;i<2048;++i)Ux[i]=939524096+(i-1024<<13);const Uu=new Bx(64);for(let i=1;i<31;++i)Uu[i]=i<<23;Uu[31]=1199570944;Uu[32]=2147483648;for(let i=33;i<63;++i)Uu[i]=2147483648+(i-32<<23);Uu[63]=3347054592;const QL=new HL(64);for(let i=1;i<64;++i)i!==32&&(QL[i]=1024);function v3(i){const e=i>>10;return y3[0]=Ux[QL[e]+(i&1023)]+Uu[e],_3[0]}function eC(i,e,...t){return v3(u3(i,e,...g3(t)))}function tC(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var ap={exports:{}},Vb;function x3(){if(Vb)return ap.exports;Vb=1;function i(e,t,n){const r=n&&n.debug||!1;r&&console.log("[xml-utils] getting "+t+" in "+e);const s=typeof e=="object"?e.outer:e,o=s.slice(0,s.indexOf(">")+1),a=['"',"'"];for(let l=0;l<a.length;l++){const c=a[l],h=t+"\\="+c+"([^"+c+"]*)"+c;r&&console.log("[xml-utils] pattern:",h);const f=new RegExp(h).exec(o);if(r&&console.log("[xml-utils] match:",f),f)return f[1]}}return ap.exports=i,ap.exports.default=i,ap.exports}var w3=x3();const c_=tC(w3);var lp={exports:{}},cp={exports:{}},hp={exports:{}},$b;function b3(){if($b)return hp.exports;$b=1;function i(e,t,n){const s=new RegExp(t).exec(e.slice(n));return s?n+s.index:-1}return hp.exports=i,hp.exports.default=i,hp.exports}var up={exports:{}},Wb;function E3(){if(Wb)return up.exports;Wb=1;function i(e,t,n){const s=new RegExp(t).exec(e.slice(n));return s?n+s.index+s[0].length-1:-1}return up.exports=i,up.exports.default=i,up.exports}var fp={exports:{}},Hb;function S3(){if(Hb)return fp.exports;Hb=1;function i(e,t){const n=new RegExp(t,"g"),r=e.match(n);return r?r.length:0}return fp.exports=i,fp.exports.default=i,fp.exports}var Xb;function T3(){if(Xb)return cp.exports;Xb=1;const i=b3(),e=E3(),t=S3();function n(r,s,o){const a=o&&o.debug||!1,l=!(o&&typeof o.nested===!1),c=o&&o.startIndex||0;a&&console.log("[xml-utils] starting findTagByName with",s," and ",o);const h=i(r,`<${s}[
78
- >/]`,c);if(a&&console.log("[xml-utils] start:",h),h===-1)return;const u=r.slice(h+s.length);let f=e(u,"^[^<]*[ /]>",0);const d=f!==-1&&u[f-1]==="/";if(a&&console.log("[xml-utils] selfClosing:",d),d===!1)if(l){let v=0,x=1,S=0;for(;(f=e(u,"[ /]"+s+">",v))!==-1;){const b=u.substring(v,f+1);if(x+=t(b,"<"+s+`[
79
- >]`),S+=t(b,"</"+s+">"),S>=x)break;v=f}}else f=e(u,"[ /]"+s+">",0);const g=h+s.length+f+1;if(a&&console.log("[xml-utils] end:",g),g===-1)return;const m=r.slice(h,g);let _;return d?_=null:_=m.slice(m.indexOf(">")+1,m.lastIndexOf("<")),{inner:_,outer:m,start:h,end:g}}return cp.exports=n,cp.exports.default=n,cp.exports}var Kb;function L3(){if(Kb)return lp.exports;Kb=1;const i=T3();function e(t,n,r){const s=[],o=r&&r.debug||!1,a=r&&typeof r.nested=="boolean"?r.nested:!0;let l=r&&r.startIndex||0,c;for(;c=i(t,n,{debug:o,startIndex:l});)a?l=c.start+1+n.length:l=c.end,s.push(c);return o&&console.log("findTagsByName found",s.length,"tags"),s}return lp.exports=e,lp.exports.default=e,lp.exports}var C3=L3();const A3=tC(C3),ed={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},Co={};for(const i in ed)ed.hasOwnProperty(i)&&(Co[ed[i]]=parseInt(i,10));const P3=[Co.BitsPerSample,Co.ExtraSamples,Co.SampleFormat,Co.StripByteCounts,Co.StripOffsets,Co.StripRowCounts,Co.TileByteCounts,Co.TileOffsets,Co.SubIFDs],h_={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},Bt={};for(const i in h_)h_.hasOwnProperty(i)&&(Bt[h_[i]]=parseInt(i,10));const jr={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,CMYK:5,YCbCr:6,CIELab:8,ICCLab:9},M3={Unspecified:0},vW={AddCompression:1},xW={None:0,Deflate:1,Zstandard:2},R3={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"};function I3(i,e){const{width:t,height:n}=i,r=new Uint8Array(t*n*3);let s;for(let o=0,a=0;o<i.length;++o,a+=3)s=256-i[o]/e*256,r[a]=s,r[a+1]=s,r[a+2]=s;return r}function N3(i,e){const{width:t,height:n}=i,r=new Uint8Array(t*n*3);let s;for(let o=0,a=0;o<i.length;++o,a+=3)s=i[o]/e*256,r[a]=s,r[a+1]=s,r[a+2]=s;return r}function F3(i,e){const{width:t,height:n}=i,r=new Uint8Array(t*n*3),s=e.length/3,o=e.length/3*2;for(let a=0,l=0;a<i.length;++a,l+=3){const c=i[a];r[l]=e[c]/65536*256,r[l+1]=e[c+s]/65536*256,r[l+2]=e[c+o]/65536*256}return r}function O3(i){const{width:e,height:t}=i,n=new Uint8Array(e*t*3);for(let r=0,s=0;r<i.length;r+=4,s+=3){const o=i[r],a=i[r+1],l=i[r+2],c=i[r+3];n[s]=255*((255-o)/256)*((255-c)/256),n[s+1]=255*((255-a)/256)*((255-c)/256),n[s+2]=255*((255-l)/256)*((255-c)/256)}return n}function D3(i){const{width:e,height:t}=i,n=new Uint8ClampedArray(e*t*3);for(let r=0,s=0;r<i.length;r+=3,s+=3){const o=i[r],a=i[r+1],l=i[r+2];n[s]=o+1.402*(l-128),n[s+1]=o-.34414*(a-128)-.71414*(l-128),n[s+2]=o+1.772*(a-128)}return n}const k3=.95047,G3=1,B3=1.08883;function j3(i){const{width:e,height:t}=i,n=new Uint8Array(e*t*3);for(let r=0,s=0;r<i.length;r+=3,s+=3){const o=i[r+0],a=i[r+1]<<24>>24,l=i[r+2]<<24>>24;let c=(o+16)/116,h=a/500+c,u=c-l/200,f,d,g;h=k3*(h*h*h>.008856?h*h*h:(h-16/116)/7.787),c=G3*(c*c*c>.008856?c*c*c:(c-16/116)/7.787),u=B3*(u*u*u>.008856?u*u*u:(u-16/116)/7.787),f=h*3.2406+c*-1.5372+u*-.4986,d=h*-.9689+c*1.8758+u*.0415,g=h*.0557+c*-.204+u*1.057,f=f>.0031308?1.055*f**(1/2.4)-.055:12.92*f,d=d>.0031308?1.055*d**(1/2.4)-.055:12.92*d,g=g>.0031308?1.055*g**(1/2.4)-.055:12.92*g,n[s]=Math.max(0,Math.min(1,f))*255,n[s+1]=Math.max(0,Math.min(1,d))*255,n[s+2]=Math.max(0,Math.min(1,g))*255}return n}const iC=new Map;function Wl(i,e){Array.isArray(i)||(i=[i]),i.forEach(t=>iC.set(t,e))}async function nC(i){const e=iC.get(i.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${i.Compression}`);const t=await e();return new t(i)}Wl([void 0,1],()=>Ys(()=>import("./raw-in9isEBO.js"),__vite__mapDeps([0,1])).then(i=>i.default));Wl(5,()=>Ys(()=>import("./lzw-_aCqfs4w.js"),__vite__mapDeps([2,1])).then(i=>i.default));Wl(6,()=>{throw new Error("old style JPEG compression is not supported.")});Wl(7,()=>Ys(()=>import("./jpeg-vtRboCKw.js"),__vite__mapDeps([3,1])).then(i=>i.default));Wl([8,32946],()=>Ys(()=>import("./deflate-B9JhHpvg.js"),__vite__mapDeps([4,5,1])).then(i=>i.default));Wl(32773,()=>Ys(()=>import("./packbits-DDWKfGV_.js"),__vite__mapDeps([6,1])).then(i=>i.default));Wl(34887,()=>Ys(()=>import("./lerc-CGvMh4cA.js"),__vite__mapDeps([7,5,1])).then(async i=>(await i.zstd.init(),i)).then(i=>i.default));Wl(50001,()=>Ys(()=>import("./webimage-DBgUwIbt.js"),__vite__mapDeps([8,1])).then(i=>i.default));function zm(i,e,t,n=1){return new(Object.getPrototypeOf(i)).constructor(e*t*n)}function U3(i,e,t,n,r){const s=e/n,o=t/r;return i.map(a=>{const l=zm(a,n,r);for(let c=0;c<r;++c){const h=Math.min(Math.round(o*c),t-1);for(let u=0;u<n;++u){const f=Math.min(Math.round(s*u),e-1),d=a[h*e+f];l[c*n+u]=d}}return l})}function fu(i,e,t){return(1-t)*i+t*e}function z3(i,e,t,n,r){const s=e/n,o=t/r;return i.map(a=>{const l=zm(a,n,r);for(let c=0;c<r;++c){const h=o*c,u=Math.floor(h),f=Math.min(Math.ceil(h),t-1);for(let d=0;d<n;++d){const g=s*d,m=g%1,_=Math.floor(g),v=Math.min(Math.ceil(g),e-1),x=a[u*e+_],S=a[u*e+v],b=a[f*e+_],A=a[f*e+v],F=fu(fu(x,S,m),fu(b,A,m),h%1);l[c*n+d]=F}}return l})}function q3(i,e,t,n,r,s="nearest"){switch(s.toLowerCase()){case"nearest":return U3(i,e,t,n,r);case"bilinear":case"linear":return z3(i,e,t,n,r);default:throw new Error(`Unsupported resampling method: '${s}'`)}}function V3(i,e,t,n,r,s){const o=e/n,a=t/r,l=zm(i,n,r,s);for(let c=0;c<r;++c){const h=Math.min(Math.round(a*c),t-1);for(let u=0;u<n;++u){const f=Math.min(Math.round(o*u),e-1);for(let d=0;d<s;++d){const g=i[h*e*s+f*s+d];l[c*n*s+u*s+d]=g}}}return l}function $3(i,e,t,n,r,s){const o=e/n,a=t/r,l=zm(i,n,r,s);for(let c=0;c<r;++c){const h=a*c,u=Math.floor(h),f=Math.min(Math.ceil(h),t-1);for(let d=0;d<n;++d){const g=o*d,m=g%1,_=Math.floor(g),v=Math.min(Math.ceil(g),e-1);for(let x=0;x<s;++x){const S=i[u*e*s+_*s+x],b=i[u*e*s+v*s+x],A=i[f*e*s+_*s+x],F=i[f*e*s+v*s+x],N=fu(fu(S,b,m),fu(A,F,m),h%1);l[c*n*s+d*s+x]=N}}}return l}function W3(i,e,t,n,r,s,o="nearest"){switch(o.toLowerCase()){case"nearest":return V3(i,e,t,n,r,s);case"bilinear":case"linear":return $3(i,e,t,n,r,s);default:throw new Error(`Unsupported resampling method: '${o}'`)}}function H3(i,e,t){let n=0;for(let r=e;r<t;++r)n+=i[r];return n}function jy(i,e,t){switch(i){case 1:if(e<=8)return new Uint8Array(t);if(e<=16)return new Uint16Array(t);if(e<=32)return new Uint32Array(t);break;case 2:if(e===8)return new Int8Array(t);if(e===16)return new Int16Array(t);if(e===32)return new Int32Array(t);break;case 3:switch(e){case 16:case 32:return new Float32Array(t);case 64:return new Float64Array(t)}break}throw Error("Unsupported data format/bitsPerSample")}function X3(i,e){return(i===1||i===2)&&e<=32&&e%8===0?!1:!(i===3&&(e===16||e===32||e===64))}function K3(i,e,t,n,r,s,o){const a=new DataView(i),l=t===2?o*s:o*s*n,c=t===2?1:n,h=jy(e,r,l),u=parseInt("1".repeat(r),2);if(e===1){let f;t===1?f=n*r:f=r;let d=s*f;(d&7)!==0&&(d=d+7&-8);for(let g=0;g<o;++g){const m=g*d;for(let _=0;_<s;++_){const v=m+_*c*r;for(let x=0;x<c;++x){const S=v+x*r,b=(g*s+_)*c+x,A=Math.floor(S/8),F=S%8;if(F+r<=8)h[b]=a.getUint8(A)>>8-r-F&u;else if(F+r<=16)h[b]=a.getUint16(A)>>16-r-F&u;else if(F+r<=24){const N=a.getUint16(A)<<8|a.getUint8(A+2);h[b]=N>>24-r-F&u}else h[b]=a.getUint32(A)>>32-r-F&u}}}}return h.buffer}class rC{constructor(e,t,n,r,s,o){this.fileDirectory=e,this.geoKeys=t,this.dataView=n,this.littleEndian=r,this.tiles=s?{}:null,this.isTiled=!e.StripOffsets;const a=e.PlanarConfiguration;if(this.planarConfiguration=typeof a>"u"?1:a,this.planarConfiguration!==1&&this.planarConfiguration!==2)throw new Error("Invalid planar configuration.");this.source=o}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return typeof this.fileDirectory.SamplesPerPixel<"u"?this.fileDirectory.SamplesPerPixel:1}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:typeof this.fileDirectory.RowsPerStrip<"u"?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}getBlockWidth(){return this.getTileWidth()}getBlockHeight(e){return this.isTiled||(e+1)*this.getTileHeight()<=this.getHeight()?this.getTileHeight():this.getHeight()-e*this.getTileHeight()}getBytesPerPixel(){let e=0;for(let t=0;t<this.fileDirectory.BitsPerSample.length;++t)e+=this.getSampleByteSize(t);return e}getSampleByteSize(e){if(e>=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${e} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[e]/8)}getReaderForSample(e){const t=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1,n=this.fileDirectory.BitsPerSample[e];switch(t){case 1:if(n<=8)return DataView.prototype.getUint8;if(n<=16)return DataView.prototype.getUint16;if(n<=32)return DataView.prototype.getUint32;break;case 2:if(n<=8)return DataView.prototype.getInt8;if(n<=16)return DataView.prototype.getInt16;if(n<=32)return DataView.prototype.getInt32;break;case 3:switch(n){case 16:return function(r,s){return eC(this,r,s)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}break}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(e=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1}getBitsPerSample(e=0){return this.fileDirectory.BitsPerSample[e]}getArrayForSample(e,t){const n=this.getSampleFormat(e),r=this.getBitsPerSample(e);return jy(n,r,t)}async getTileOrStrip(e,t,n,r,s){const o=Math.ceil(this.getWidth()/this.getTileWidth()),a=Math.ceil(this.getHeight()/this.getTileHeight());let l;const{tiles:c}=this;this.planarConfiguration===1?l=t*o+e:this.planarConfiguration===2&&(l=n*o*a+t*o+e);let h,u;this.isTiled?(h=this.fileDirectory.TileOffsets[l],u=this.fileDirectory.TileByteCounts[l]):(h=this.fileDirectory.StripOffsets[l],u=this.fileDirectory.StripByteCounts[l]);const f=(await this.source.fetch([{offset:h,length:u}],s))[0];let d;return c===null||!c[l]?(d=(async()=>{let g=await r.decode(this.fileDirectory,f);const m=this.getSampleFormat(),_=this.getBitsPerSample();return X3(m,_)&&(g=K3(g,m,this.planarConfiguration,this.getSamplesPerPixel(),_,this.getTileWidth(),this.getBlockHeight(t))),g})(),c!==null&&(c[l]=d)):d=c[l],{x:e,y:t,sample:n,data:await d}}async _readRaster(e,t,n,r,s,o,a,l,c){const h=this.getTileWidth(),u=this.getTileHeight(),f=this.getWidth(),d=this.getHeight(),g=Math.max(Math.floor(e[0]/h),0),m=Math.min(Math.ceil(e[2]/h),Math.ceil(f/h)),_=Math.max(Math.floor(e[1]/u),0),v=Math.min(Math.ceil(e[3]/u),Math.ceil(d/u)),x=e[2]-e[0];let S=this.getBytesPerPixel();const b=[],A=[];for(let R=0;R<t.length;++R)this.planarConfiguration===1?b.push(H3(this.fileDirectory.BitsPerSample,0,t[R])/8):b.push(0),A.push(this.getReaderForSample(t[R]));const F=[],{littleEndian:N}=this;for(let R=_;R<v;++R)for(let P=g;P<m;++P){let O;this.planarConfiguration===1&&(O=this.getTileOrStrip(P,R,0,s,c));for(let L=0;L<t.length;++L){const T=L,C=t[L];this.planarConfiguration===2&&(S=this.getSampleByteSize(C),O=this.getTileOrStrip(P,R,C,s,c));const D=O.then(W=>{const $=W.data,B=new DataView($),V=this.getBlockHeight(W.y),te=W.y*u,ne=W.x*h,ae=te+V,I=(W.x+1)*h,U=A[T],K=Math.min(V,V-(ae-e[3]),d-te),ie=Math.min(h,h-(I-e[2]),f-ne);for(let re=Math.max(0,e[1]-te);re<K;++re)for(let ce=Math.max(0,e[0]-ne);ce<ie;++ce){const ve=(re*h+ce)*S,pe=U.call(B,ve+b[T],N);let le;r?(le=(re+te-e[1])*x*t.length+(ce+ne-e[0])*t.length+T,n[le]=pe):(le=(re+te-e[1])*x+ce+ne-e[0],n[T][le]=pe)}});F.push(D)}}if(await Promise.all(F),o&&e[2]-e[0]!==o||a&&e[3]-e[1]!==a){let R;return r?R=W3(n,e[2]-e[0],e[3]-e[1],o,a,t.length,l):R=q3(n,e[2]-e[0],e[3]-e[1],o,a,l),R.width=o,R.height=a,R}return n.width=o||e[2]-e[0],n.height=a||e[3]-e[1],n}async readRasters({window:e,samples:t=[],interleave:n,pool:r=null,width:s,height:o,resampleMethod:a,fillValue:l,signal:c}={}){const h=e||[0,0,this.getWidth(),this.getHeight()];if(h[0]>h[2]||h[1]>h[3])throw new Error("Invalid subsets");const u=h[2]-h[0],f=h[3]-h[1],d=u*f,g=this.getSamplesPerPixel();if(!t||!t.length)for(let x=0;x<g;++x)t.push(x);else for(let x=0;x<t.length;++x)if(t[x]>=g)return Promise.reject(new RangeError(`Invalid sample index '${t[x]}'.`));let m;if(n){const x=this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,S=Math.max.apply(null,this.fileDirectory.BitsPerSample);m=jy(x,S,d*t.length),l&&m.fill(l)}else{m=[];for(let x=0;x<t.length;++x){const S=this.getArrayForSample(t[x],d);Array.isArray(l)&&x<l.length?S.fill(l[x]):l&&!Array.isArray(l)&&S.fill(l),m.push(S)}}const _=r||await nC(this.fileDirectory);return await this._readRaster(h,t,m,n,_,s,o,a,c)}async readRGB({window:e,interleave:t=!0,pool:n=null,width:r,height:s,resampleMethod:o,enableAlpha:a=!1,signal:l}={}){const c=e||[0,0,this.getWidth(),this.getHeight()];if(c[0]>c[2]||c[1]>c[3])throw new Error("Invalid subsets");const h=this.fileDirectory.PhotometricInterpretation;if(h===jr.RGB){let v=[0,1,2];if(this.fileDirectory.ExtraSamples!==M3.Unspecified&&a){v=[];for(let x=0;x<this.fileDirectory.BitsPerSample.length;x+=1)v.push(x)}return this.readRasters({window:e,interleave:t,samples:v,pool:n,width:r,height:s,resampleMethod:o,signal:l})}let u;switch(h){case jr.WhiteIsZero:case jr.BlackIsZero:case jr.Palette:u=[0];break;case jr.CMYK:u=[0,1,2,3];break;case jr.YCbCr:case jr.CIELab:u=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const f={window:c,interleave:!0,samples:u,pool:n,width:r,height:s,resampleMethod:o,signal:l},{fileDirectory:d}=this,g=await this.readRasters(f),m=2**this.fileDirectory.BitsPerSample[0];let _;switch(h){case jr.WhiteIsZero:_=I3(g,m);break;case jr.BlackIsZero:_=N3(g,m);break;case jr.Palette:_=F3(g,d.ColorMap);break;case jr.CMYK:_=O3(g);break;case jr.YCbCr:_=D3(g);break;case jr.CIELab:_=j3(g);break;default:throw new Error("Unsupported photometric interpretation.")}if(!t){const v=new Uint8Array(_.length/3),x=new Uint8Array(_.length/3),S=new Uint8Array(_.length/3);for(let b=0,A=0;b<_.length;b+=3,++A)v[A]=_[b],x[A]=_[b+1],S[A]=_[b+2];_=[v,x,S]}return _.width=g.width,_.height=g.height,_}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const e=[];for(let t=0;t<this.fileDirectory.ModelTiepoint.length;t+=6)e.push({i:this.fileDirectory.ModelTiepoint[t],j:this.fileDirectory.ModelTiepoint[t+1],k:this.fileDirectory.ModelTiepoint[t+2],x:this.fileDirectory.ModelTiepoint[t+3],y:this.fileDirectory.ModelTiepoint[t+4],z:this.fileDirectory.ModelTiepoint[t+5]});return e}getGDALMetadata(e=null){const t={};if(!this.fileDirectory.GDAL_METADATA)return null;const n=this.fileDirectory.GDAL_METADATA;let r=A3(n,"Item");e===null?r=r.filter(s=>c_(s,"sample")===void 0):r=r.filter(s=>Number(c_(s,"sample"))===e);for(let s=0;s<r.length;++s){const o=r[s];t[c_(o,"name")]=o.inner}return t}getGDALNoData(){if(!this.fileDirectory.GDAL_NODATA)return null;const e=this.fileDirectory.GDAL_NODATA;return Number(e.substring(0,e.length-1))}getOrigin(){const e=this.fileDirectory.ModelTiepoint,t=this.fileDirectory.ModelTransformation;if(e&&e.length===6)return[e[3],e[4],e[5]];if(t)return[t[3],t[7],t[11]];throw new Error("The image does not have an affine transformation.")}getResolution(e=null){const t=this.fileDirectory.ModelPixelScale,n=this.fileDirectory.ModelTransformation;if(t)return[t[0],-t[1],t[2]];if(n)return n[1]===0&&n[4]===0?[n[0],-n[5],n[10]]:[Math.sqrt(n[0]*n[0]+n[4]*n[4]),-Math.sqrt(n[1]*n[1]+n[5]*n[5]),n[10]];if(e){const[r,s,o]=e.getResolution();return[r*e.getWidth()/this.getWidth(),s*e.getHeight()/this.getHeight(),o*e.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return this.geoKeys.GTRasterTypeGeoKey===1}getBoundingBox(e=!1){const t=this.getHeight(),n=this.getWidth();if(this.fileDirectory.ModelTransformation&&!e){const[r,s,o,a,l,c,h,u]=this.fileDirectory.ModelTransformation,d=[[0,0],[0,t],[n,0],[n,t]].map(([_,v])=>[a+r*_+s*v,u+l*_+c*v]),g=d.map(_=>_[0]),m=d.map(_=>_[1]);return[Math.min(...g),Math.min(...m),Math.max(...g),Math.max(...m)]}else{const r=this.getOrigin(),s=this.getResolution(),o=r[0],a=r[1],l=o+s[0]*n,c=a+s[1]*t;return[Math.min(o,l),Math.min(a,c),Math.max(o,l),Math.max(a,c)]}}}class Y3{constructor(e){this._dataView=new DataView(e)}get buffer(){return this._dataView.buffer}getUint64(e,t){const n=this.getUint32(e,t),r=this.getUint32(e+4,t);let s;if(t){if(s=n+2**32*r,!Number.isSafeInteger(s))throw new Error(`${s} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return s}if(s=2**32*n+r,!Number.isSafeInteger(s))throw new Error(`${s} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return s}getInt64(e,t){let n=0;const r=(this._dataView.getUint8(e+(t?7:0))&128)>0;let s=!0;for(let o=0;o<8;o++){let a=this._dataView.getUint8(e+(t?o:7-o));r&&(s?a!==0&&(a=~(a-1)&255,s=!1):a=~a&255),n+=a*256**o}return r&&(n=-n),n}getUint8(e,t){return this._dataView.getUint8(e,t)}getInt8(e,t){return this._dataView.getInt8(e,t)}getUint16(e,t){return this._dataView.getUint16(e,t)}getInt16(e,t){return this._dataView.getInt16(e,t)}getUint32(e,t){return this._dataView.getUint32(e,t)}getInt32(e,t){return this._dataView.getInt32(e,t)}getFloat16(e,t){return eC(this._dataView,e,t)}getFloat32(e,t){return this._dataView.getFloat32(e,t)}getFloat64(e,t){return this._dataView.getFloat64(e,t)}}class Z3{constructor(e,t,n,r){this._dataView=new DataView(e),this._sliceOffset=t,this._littleEndian=n,this._bigTiff=r}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(e,t){return this.sliceOffset<=e&&this.sliceTop>=e+t}readUint8(e){return this._dataView.getUint8(e-this._sliceOffset,this._littleEndian)}readInt8(e){return this._dataView.getInt8(e-this._sliceOffset,this._littleEndian)}readUint16(e){return this._dataView.getUint16(e-this._sliceOffset,this._littleEndian)}readInt16(e){return this._dataView.getInt16(e-this._sliceOffset,this._littleEndian)}readUint32(e){return this._dataView.getUint32(e-this._sliceOffset,this._littleEndian)}readInt32(e){return this._dataView.getInt32(e-this._sliceOffset,this._littleEndian)}readFloat32(e){return this._dataView.getFloat32(e-this._sliceOffset,this._littleEndian)}readFloat64(e){return this._dataView.getFloat64(e-this._sliceOffset,this._littleEndian)}readUint64(e){const t=this.readUint32(e),n=this.readUint32(e+4);let r;if(this._littleEndian){if(r=t+2**32*n,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}if(r=2**32*t+n,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}readInt64(e){let t=0;const n=(this._dataView.getUint8(e+(this._littleEndian?7:0))&128)>0;let r=!0;for(let s=0;s<8;s++){let o=this._dataView.getUint8(e+(this._littleEndian?s:7-s));n&&(r?o!==0&&(o=~(o-1)&255,r=!1):o=~o&255),t+=o*256**s}return n&&(t=-t),t}readOffset(e){return this._bigTiff?this.readUint64(e):this.readUint32(e)}}const J3=typeof navigator<"u"&&navigator.hardwareConcurrency||2;class Q3{constructor(e=J3,t){this.workers=null,this._awaitingDecoder=null,this.size=e,this.messageId=0,e&&(this._awaitingDecoder=t?Promise.resolve(t):new Promise(n=>{Ys(()=>import("./decoder-tqM1uIvc.js"),[]).then(r=>{n(r.create)})}),this._awaitingDecoder.then(n=>{this._awaitingDecoder=null,this.workers=[];for(let r=0;r<e;r++)this.workers.push({worker:n(),idle:!0})}))}async decode(e,t){return this._awaitingDecoder&&await this._awaitingDecoder,this.size===0?nC(e).then(n=>n.decode(e,t)):new Promise(n=>{const r=this.workers.find(a=>a.idle)||this.workers[Math.floor(Math.random()*this.size)];r.idle=!1;const s=this.messageId++,o=a=>{a.data.id===s&&(r.idle=!0,n(a.data.decoded),r.worker.removeEventListener("message",o))};r.worker.addEventListener("message",o),r.worker.postMessage({fileDirectory:e,buffer:t,id:s},[t])})}destroy(){this.workers&&(this.workers.forEach(e=>{e.worker.terminate()}),this.workers=null)}}const Yb=`\r
80
- \r
81
- `;function sC(i){if(typeof Object.fromEntries<"u")return Object.fromEntries(i);const e={};for(const[t,n]of i)e[t.toLowerCase()]=n;return e}function e7(i){const e=i.split(`\r
82
- `).map(t=>{const n=t.split(":").map(r=>r.trim());return n[0]=n[0].toLowerCase(),n});return sC(e)}function t7(i){const[e,...t]=i.split(";").map(r=>r.trim()),n=t.map(r=>r.split("="));return{type:e,params:sC(n)}}function Uy(i){let e,t,n;return i&&([,e,t,n]=i.match(/bytes (\d+)-(\d+)\/(\d+)/),e=parseInt(e,10),t=parseInt(t,10),n=parseInt(n,10)),{start:e,end:t,total:n}}function i7(i,e){let t=null;const n=new TextDecoder("ascii"),r=[],s=`--${e}`,o=`${s}--`;for(let a=0;a<10;++a)n.decode(new Uint8Array(i,a,s.length))===s&&(t=a);if(t===null)throw new Error("Could not find initial boundary");for(;t<i.byteLength;){const a=n.decode(new Uint8Array(i,t,Math.min(s.length+1024,i.byteLength-t)));if(a.length===0||a.startsWith(o))break;if(!a.startsWith(s))throw new Error("Part does not start with boundary");const l=a.substr(s.length+2);if(l.length===0)break;const c=l.indexOf(Yb),h=e7(l.substr(0,c)),{start:u,end:f,total:d}=Uy(h["content-range"]),g=t+s.length+c+Yb.length,m=parseInt(f,10)+1-parseInt(u,10);r.push({headers:h,data:i.slice(g,g+m),offset:u,length:m,fileSize:d}),t=g+m+4}return r}class zx{async fetch(e,t=void 0){return Promise.all(e.map(n=>this.fetchSlice(n,t)))}async fetchSlice(e){throw new Error(`fetching of slice ${e} not possible, not implemented`)}get fileSize(){return null}async close(){}}class n7 extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if(typeof e.maxAge=="number"&&e.maxAge===0)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||Number.POSITIVE_INFINITY,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if(typeof this.onEviction=="function")for(const[t,n]of e)this.onEviction(t,n.value)}_deleteIfExpired(e,t){return typeof t.expiry=="number"&&t.expiry<=Date.now()?(typeof this.onEviction=="function"&&this.onEviction(e,t.value),this.delete(e)):!1}_getOrDeleteIfExpired(e,t){if(this._deleteIfExpired(e,t)===!1)return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){const n=t.get(e);return this._getItemValue(e,n)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(const e of this.oldCache){const[t,n]=e;this.cache.has(t)||this._deleteIfExpired(t,n)===!1&&(yield e)}for(const e of this.cache){const[t,n]=e;this._deleteIfExpired(t,n)===!1&&(yield e)}}get(e){if(this.cache.has(e)){const t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){const t=this.oldCache.get(e);if(this._deleteIfExpired(e,t)===!1)return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:n=this.maxAge}={}){const r=typeof n=="number"&&n!==Number.POSITIVE_INFINITY?Date.now()+n:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:r}):this._set(e,{value:t,expiry:r}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):this.oldCache.has(e)?!this._deleteIfExpired(e,this.oldCache.get(e)):!1}peek(e){if(this.cache.has(e))return this._peek(e,this.cache);if(this.oldCache.has(e))return this._peek(e,this.oldCache)}delete(e){const t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const t=[...this._entriesAscending()],n=t.length-e;n<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(n>0&&this._emitEvictions(t.slice(0,n)),this.oldCache=new Map(t.slice(n)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.cache){const[t,n]=e;this._deleteIfExpired(t,n)===!1&&(yield[t,n.value])}for(const e of this.oldCache){const[t,n]=e;this.cache.has(t)||this._deleteIfExpired(t,n)===!1&&(yield[t,n.value])}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){const n=e[t],[r,s]=n;this._deleteIfExpired(r,s)===!1&&(yield[r,s.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){const n=e[t],[r,s]=n;this.cache.has(r)||this._deleteIfExpired(r,s)===!1&&(yield[r,s.value])}}*entriesAscending(){for(const[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(const t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(const[n,r]of this.entriesAscending())e.call(t,r,n,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}async function r7(i){return new Promise(e=>setTimeout(e,i))}function s7(i,e){const t=Array.isArray(i)?i:Array.from(i),n=Array.isArray(e)?e:Array.from(e);return t.map((r,s)=>[r,n[s]])}class Pu extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,Pu),this.name="AbortError"}}class o7 extends Error{constructor(e,t){super(t),this.errors=e,this.message=t,this.name="AggregateError"}}const a7=o7;class l7{constructor(e,t,n=null){this.offset=e,this.length=t,this.data=n}get top(){return this.offset+this.length}}class Zb{constructor(e,t,n){this.offset=e,this.length=t,this.blockIds=n}}class c7 extends zx{constructor(e,{blockSize:t=65536,cacheSize:n=100}={}){super(),this.source=e,this.blockSize=t,this.blockCache=new n7({maxSize:n,onEviction:(r,s)=>{this.evictedBlocks.set(r,s)}}),this.evictedBlocks=new Map,this.blockRequests=new Map,this.blockIdsToFetch=new Set,this.abortedBlockIds=new Set}get fileSize(){return this.source.fileSize}async fetch(e,t){const n=[],r=[],s=[];this.evictedBlocks.clear();for(const{offset:f,length:d}of e){let g=f+d;const{fileSize:m}=this;m!==null&&(g=Math.min(g,m));const _=Math.floor(f/this.blockSize)*this.blockSize;for(let v=_;v<g;v+=this.blockSize){const x=Math.floor(v/this.blockSize);!this.blockCache.has(x)&&!this.blockRequests.has(x)&&(this.blockIdsToFetch.add(x),r.push(x)),this.blockRequests.has(x)&&n.push(this.blockRequests.get(x)),s.push(x)}}await r7(),this.fetchBlocks(t);const o=[];for(const f of r)this.blockRequests.has(f)&&o.push(this.blockRequests.get(f));await Promise.allSettled(n),await Promise.allSettled(o);const a=[],l=s.filter(f=>this.abortedBlockIds.has(f)||!this.blockCache.has(f));if(l.forEach(f=>this.blockIdsToFetch.add(f)),l.length>0&&t&&!t.aborted){this.fetchBlocks(null);for(const f of l){const d=this.blockRequests.get(f);if(!d)throw new Error(`Block ${f} is not in the block requests`);a.push(d)}await Promise.allSettled(a)}if(t&&t.aborted)throw new Pu("Request was aborted");const c=s.map(f=>this.blockCache.get(f)||this.evictedBlocks.get(f)),h=c.filter(f=>!f);if(h.length)throw new a7(h,"Request failed");const u=new Map(s7(s,c));return this.readSliceData(e,u)}fetchBlocks(e){if(this.blockIdsToFetch.size>0){const t=this.groupBlocks(this.blockIdsToFetch),n=this.source.fetch(t,e);for(let r=0;r<t.length;++r){const s=t[r];for(const o of s.blockIds)this.blockRequests.set(o,(async()=>{try{const a=(await n)[r],l=o*this.blockSize,c=l-a.offset,h=Math.min(c+this.blockSize,a.data.byteLength),u=a.data.slice(c,h),f=new l7(l,u.byteLength,u,o);this.blockCache.set(o,f),this.abortedBlockIds.delete(o)}catch(a){if(a.name==="AbortError")a.signal=e,this.blockCache.delete(o),this.abortedBlockIds.add(o);else throw a}finally{this.blockRequests.delete(o)}})())}this.blockIdsToFetch.clear()}}groupBlocks(e){const t=Array.from(e).sort((o,a)=>o-a);if(t.length===0)return[];let n=[],r=null;const s=[];for(const o of t)r===null||r+1===o?(n.push(o),r=o):(s.push(new Zb(n[0]*this.blockSize,n.length*this.blockSize,n)),n=[o],r=o);return s.push(new Zb(n[0]*this.blockSize,n.length*this.blockSize,n)),s}readSliceData(e,t){return e.map(n=>{let r=n.offset+n.length;this.fileSize!==null&&(r=Math.min(this.fileSize,r));const s=Math.floor(n.offset/this.blockSize),o=Math.floor(r/this.blockSize),a=new ArrayBuffer(n.length),l=new Uint8Array(a);for(let c=s;c<=o;++c){const h=t.get(c),u=h.offset-n.offset,f=h.top-r;let d=0,g=0,m;u<0?d=-u:u>0&&(g=u),f<0?m=h.length-d:m=r-h.offset-d;const _=new Uint8Array(h.data,d,m);l.set(_,g)}return a})}}class qx{get ok(){return this.status>=200&&this.status<=299}get status(){throw new Error("not implemented")}getHeader(e){throw new Error("not implemented")}async getData(){throw new Error("not implemented")}}class Vx{constructor(e){this.url=e}async request({headers:e,signal:t}={}){throw new Error("request is not implemented")}}class h7 extends qx{constructor(e){super(),this.response=e}get status(){return this.response.status}getHeader(e){return this.response.headers.get(e)}async getData(){return this.response.arrayBuffer?await this.response.arrayBuffer():(await this.response.buffer()).buffer}}class u7 extends Vx{constructor(e,t){super(e),this.credentials=t}async request({headers:e,signal:t}={}){const n=await fetch(this.url,{headers:e,credentials:this.credentials,signal:t});return new h7(n)}}class f7 extends qx{constructor(e,t){super(),this.xhr=e,this.data=t}get status(){return this.xhr.status}getHeader(e){return this.xhr.getResponseHeader(e)}async getData(){return this.data}}class d7 extends Vx{constructRequest(e,t){return new Promise((n,r)=>{const s=new XMLHttpRequest;s.open("GET",this.url),s.responseType="arraybuffer";for(const[o,a]of Object.entries(e))s.setRequestHeader(o,a);s.onload=()=>{const o=s.response;n(new f7(s,o))},s.onerror=r,s.onabort=()=>r(new Pu("Request aborted")),s.send(),t&&(t.aborted&&s.abort(),t.addEventListener("abort",()=>s.abort()))})}async request({headers:e,signal:t}={}){return await this.constructRequest(e,t)}}const u_={};class g7 extends qx{constructor(e,t){super(),this.response=e,this.dataPromise=t}get status(){return this.response.statusCode}getHeader(e){return this.response.headers[e]}async getData(){return await this.dataPromise}}class p7 extends Vx{constructor(e){super(e),this.parsedUrl=u_.parse(this.url),this.httpApi=(this.parsedUrl.protocol==="http:",u_)}constructRequest(e,t){return new Promise((n,r)=>{const s=this.httpApi.get({...this.parsedUrl,headers:e},o=>{const a=new Promise(l=>{const c=[];o.on("data",h=>{c.push(h)}),o.on("end",()=>{const h=Buffer.concat(c).buffer;l(h)}),o.on("error",r)});n(new g7(o,a))});s.on("error",r),t&&(t.aborted&&s.destroy(new Pu("Request aborted")),t.addEventListener("abort",()=>s.destroy(new Pu("Request aborted"))))})}async request({headers:e,signal:t}={}){return await this.constructRequest(e,t)}}class $x extends zx{constructor(e,t,n,r){super(),this.client=e,this.headers=t,this.maxRanges=n,this.allowFullFile=r,this._fileSize=null}async fetch(e,t){return this.maxRanges>=e.length?this.fetchSlices(e,t):(this.maxRanges>0&&e.length>1,Promise.all(e.map(n=>this.fetchSlice(n,t))))}async fetchSlices(e,t){const n=await this.client.request({headers:{...this.headers,Range:`bytes=${e.map(({offset:r,length:s})=>`${r}-${r+s}`).join(",")}`},signal:t});if(n.ok)if(n.status===206){const{type:r,params:s}=t7(n.getHeader("content-type"));if(r==="multipart/byteranges"){const u=i7(await n.getData(),s.boundary);return this._fileSize=u[0].fileSize||null,u}const o=await n.getData(),{start:a,end:l,total:c}=Uy(n.getHeader("content-range"));this._fileSize=c||null;const h=[{data:o,offset:a,length:l-a}];if(e.length>1){const u=await Promise.all(e.slice(1).map(f=>this.fetchSlice(f,t)));return h.concat(u)}return h}else{if(!this.allowFullFile)throw new Error("Server responded with full file");const r=await n.getData();return this._fileSize=r.byteLength,[{data:r,offset:0,length:r.byteLength}]}else throw new Error("Error fetching data.")}async fetchSlice(e,t){const{offset:n,length:r}=e,s=await this.client.request({headers:{...this.headers,Range:`bytes=${n}-${n+r}`},signal:t});if(s.ok)if(s.status===206){const o=await s.getData(),{total:a}=Uy(s.getHeader("content-range"));return this._fileSize=a||null,{data:o,offset:n,length:r}}else{if(!this.allowFullFile)throw new Error("Server responded with full file");const o=await s.getData();return this._fileSize=o.byteLength,{data:o,offset:0,length:o.byteLength}}else throw new Error("Error fetching data.")}get fileSize(){return this._fileSize}}function Wx(i,{blockSize:e,cacheSize:t}){return e===null?i:new c7(i,{blockSize:e,cacheSize:t})}function m7(i,{headers:e={},credentials:t,maxRanges:n=0,allowFullFile:r=!1,...s}={}){const o=new u7(i,t),a=new $x(o,e,n,r);return Wx(a,s)}function _7(i,{headers:e={},maxRanges:t=0,allowFullFile:n=!1,...r}={}){const s=new d7(i),o=new $x(s,e,t,n);return Wx(o,r)}function y7(i,{headers:e={},maxRanges:t=0,allowFullFile:n=!1,...r}={}){const s=new p7(i),o=new $x(s,e,t,n);return Wx(o,r)}function zy(i,{forceXHR:e=!1,...t}={}){return typeof fetch=="function"&&!e?m7(i,t):typeof XMLHttpRequest<"u"?_7(i,t):y7(i,t)}class v7 extends zx{constructor(e){super(),this.file=e}async fetchSlice(e,t){return new Promise((n,r)=>{const s=this.file.slice(e.offset,e.offset+e.length),o=new FileReader;o.onload=a=>n(a.target.result),o.onerror=r,o.onabort=r,o.readAsArrayBuffer(s),t&&t.addEventListener("abort",()=>o.abort())})}}function x7(i){return new v7(i)}function qy(i){switch(i){case Bt.BYTE:case Bt.ASCII:case Bt.SBYTE:case Bt.UNDEFINED:return 1;case Bt.SHORT:case Bt.SSHORT:return 2;case Bt.LONG:case Bt.SLONG:case Bt.FLOAT:case Bt.IFD:return 4;case Bt.RATIONAL:case Bt.SRATIONAL:case Bt.DOUBLE:case Bt.LONG8:case Bt.SLONG8:case Bt.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${i}`)}}function w7(i){const e=i.GeoKeyDirectory;if(!e)return null;const t={};for(let n=4;n<=e[3]*4;n+=4){const r=R3[e[n]],s=e[n+1]?ed[e[n+1]]:null,o=e[n+2],a=e[n+3];let l=null;if(!s)l=a;else{if(l=i[s],typeof l>"u"||l===null)throw new Error(`Could not get value of geoKey '${r}'.`);typeof l=="string"?l=l.substring(a,a+o-1):l.subarray&&(l=l.subarray(a,a+o),o===1&&(l=l[0]))}t[r]=l}return t}function Sh(i,e,t,n){let r=null,s=null;const o=qy(e);switch(e){case Bt.BYTE:case Bt.ASCII:case Bt.UNDEFINED:r=new Uint8Array(t),s=i.readUint8;break;case Bt.SBYTE:r=new Int8Array(t),s=i.readInt8;break;case Bt.SHORT:r=new Uint16Array(t),s=i.readUint16;break;case Bt.SSHORT:r=new Int16Array(t),s=i.readInt16;break;case Bt.LONG:case Bt.IFD:r=new Uint32Array(t),s=i.readUint32;break;case Bt.SLONG:r=new Int32Array(t),s=i.readInt32;break;case Bt.LONG8:case Bt.IFD8:r=new Array(t),s=i.readUint64;break;case Bt.SLONG8:r=new Array(t),s=i.readInt64;break;case Bt.RATIONAL:r=new Uint32Array(t*2),s=i.readUint32;break;case Bt.SRATIONAL:r=new Int32Array(t*2),s=i.readInt32;break;case Bt.FLOAT:r=new Float32Array(t),s=i.readFloat32;break;case Bt.DOUBLE:r=new Float64Array(t),s=i.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e===Bt.RATIONAL||e===Bt.SRATIONAL)for(let a=0;a<t;a+=2)r[a]=s.call(i,n+a*o),r[a+1]=s.call(i,n+(a*o+4));else for(let a=0;a<t;++a)r[a]=s.call(i,n+a*o);return e===Bt.ASCII?new TextDecoder("utf-8").decode(r):r}class b7{constructor(e,t,n){this.fileDirectory=e,this.geoKeyDirectory=t,this.nextIFDByteOffset=n}}class dp extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class oC{async readRasters(e={}){const{window:t,width:n,height:r}=e;let{resX:s,resY:o,bbox:a}=e;const l=await this.getImage();let c=l;const h=await this.getImageCount(),u=l.getBoundingBox();if(t&&a)throw new Error('Both "bbox" and "window" passed.');if(n||r){if(t){const[g,m]=l.getOrigin(),[_,v]=l.getResolution();a=[g+t[0]*_,m+t[1]*v,g+t[2]*_,m+t[3]*v]}const d=a||u;if(n){if(s)throw new Error("Both width and resX passed");s=(d[2]-d[0])/n}if(r){if(o)throw new Error("Both width and resY passed");o=(d[3]-d[1])/r}}if(s||o){const d=[];for(let g=0;g<h;++g){const m=await this.getImage(g),{SubfileType:_,NewSubfileType:v}=m.fileDirectory;(g===0||_===2||v&1)&&d.push(m)}d.sort((g,m)=>g.getWidth()-m.getWidth());for(let g=0;g<d.length;++g){const m=d[g],_=(u[2]-u[0])/m.getWidth(),v=(u[3]-u[1])/m.getHeight();if(c=m,s&&s>_||o&&o>v)break}}let f=t;if(a){const[d,g]=l.getOrigin(),[m,_]=c.getResolution(l);f=[Math.round((a[0]-d)/m),Math.round((a[1]-g)/_),Math.round((a[2]-d)/m),Math.round((a[3]-g)/_)],f=[Math.min(f[0],f[2]),Math.min(f[1],f[3]),Math.max(f[0],f[2]),Math.max(f[1],f[3])]}return c.readRasters({...e,window:f})}}class Mu extends oC{constructor(e,t,n,r,s={}){super(),this.source=e,this.littleEndian=t,this.bigTiff=n,this.firstIFDOffset=r,this.cache=s.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(e,t){const n=this.bigTiff?4048:1024;return new Z3((await this.source.fetch([{offset:e,length:typeof t<"u"?t:n}]))[0],e,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(e){const t=this.bigTiff?20:12,n=this.bigTiff?8:2;let r=await this.getSlice(e);const s=this.bigTiff?r.readUint64(e):r.readUint16(e),o=s*t+(this.bigTiff?16:6);r.covers(e,o)||(r=await this.getSlice(e,o));const a={};let l=e+(this.bigTiff?8:2);for(let u=0;u<s;l+=t,++u){const f=r.readUint16(l),d=r.readUint16(l+2),g=this.bigTiff?r.readUint64(l+4):r.readUint32(l+4);let m,_;const v=qy(d),x=l+(this.bigTiff?12:8);if(v*g<=(this.bigTiff?8:4))m=Sh(r,d,g,x);else{const S=r.readOffset(x),b=qy(d)*g;if(r.covers(S,b))m=Sh(r,d,g,S);else{const A=await this.getSlice(S,b);m=Sh(A,d,g,S)}}g===1&&P3.indexOf(f)===-1&&!(d===Bt.RATIONAL||d===Bt.SRATIONAL)?_=m[0]:_=m,a[ed[f]]=_}const c=w7(a),h=r.readOffset(e+n+t*s);return new b7(a,c,h)}async requestIFD(e){if(this.ifdRequests[e])return this.ifdRequests[e];if(e===0)return this.ifdRequests[e]=this.parseFileDirectoryAt(this.firstIFDOffset),this.ifdRequests[e];if(!this.ifdRequests[e-1])try{this.ifdRequests[e-1]=this.requestIFD(e-1)}catch(t){throw t instanceof dp?new dp(e):t}return this.ifdRequests[e]=(async()=>{const t=await this.ifdRequests[e-1];if(t.nextIFDByteOffset===0)throw new dp(e);return this.parseFileDirectoryAt(t.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const t=await this.requestIFD(e);return new rC(t.fileDirectory,t.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let e=0,t=!0;for(;t;)try{await this.requestIFD(e),++e}catch(n){if(n instanceof dp)t=!1;else throw n}return e}async getGhostValues(){const e=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const t="GDAL_STRUCTURAL_METADATA_SIZE=",n=t.length+100;let r=await this.getSlice(e,n);if(t===Sh(r,Bt.ASCII,t.length,e)){const o=Sh(r,Bt.ASCII,n,e).split(`
83
- `)[0],a=Number(o.split("=")[1].split(" ")[0])+o.length;a>n&&(r=await this.getSlice(e,a));const l=Sh(r,Bt.ASCII,a,e);this.ghostValues={},l.split(`
84
- `).filter(c=>c.length>0).map(c=>c.split("=")).forEach(([c,h])=>{this.ghostValues[c]=h})}return this.ghostValues}static async fromSource(e,t,n){const r=(await e.fetch([{offset:0,length:1024}],n))[0],s=new Y3(r),o=s.getUint16(0,0);let a;if(o===18761)a=!0;else if(o===19789)a=!1;else throw new TypeError("Invalid byte order value.");const l=s.getUint16(2,a);let c;if(l===42)c=!1;else if(l===43){if(c=!0,s.getUint16(4,a)!==8)throw new Error("Unsupported offset byte-size.")}else throw new TypeError("Invalid magic number.");const h=c?s.getUint64(8,a):s.getUint32(4,a);return new Mu(e,a,c,h,t)}close(){return typeof this.source.close=="function"?this.source.close():!1}}class E7 extends oC{constructor(e,t){super(),this.mainFile=e,this.overviewFiles=t,this.imageFiles=[e].concat(t),this.fileDirectoriesPerFile=null,this.fileDirectoriesPerFileParsing=null,this.imageCount=null}async parseFileDirectoriesPerFile(){const e=[this.mainFile.parseFileDirectoryAt(this.mainFile.firstIFDOffset)].concat(this.overviewFiles.map(t=>t.parseFileDirectoryAt(t.firstIFDOffset)));return this.fileDirectoriesPerFile=await Promise.all(e),this.fileDirectoriesPerFile}async getImage(e=0){await this.getImageCount(),await this.parseFileDirectoriesPerFile();let t=0,n=0;for(let r=0;r<this.imageFiles.length;r++){const s=this.imageFiles[r];for(let o=0;o<this.imageCounts[r];o++){if(e===t){const a=await s.requestIFD(n);return new rC(a.fileDirectory,a.geoKeyDirectory,s.dataView,s.littleEndian,s.cache,s.source)}t++,n++}n=0}throw new RangeError("Invalid image index")}async getImageCount(){if(this.imageCount!==null)return this.imageCount;const e=[this.mainFile.getImageCount()].concat(this.overviewFiles.map(t=>t.getImageCount()));return this.imageCounts=await Promise.all(e),this.imageCount=this.imageCounts.reduce((t,n)=>t+n,0),this.imageCount}}async function S7(i,e={},t){return Mu.fromSource(zy(i,e),t)}async function T7(i,e){return Mu.fromSource(x7(i),e)}async function L7(i,e=[],t={},n){const r=await Mu.fromSource(zy(i,t),n),s=await Promise.all(e.map(o=>Mu.fromSource(zy(o,t))));return new E7(r,s)}function C7(i){return((i.fileDirectory.NewSubfileType||0)&4)===4}function A7(i,e){if(!i)return!1;if(i===!0)return!0;if(e.getSamplesPerPixel()!==3)return!1;const t=e.fileDirectory.PhotometricInterpretation,n=jr;return t===n.CMYK||t===n.YCbCr||t===n.CIELab||t===n.ICCLab}const Jb="STATISTICS_MAXIMUM",Qb="STATISTICS_MINIMUM",f_=256;let d_;function P7(){return d_||(d_=new Q3),d_}function M7(i){try{return i.getBoundingBox(!0)}catch{return[0,0,i.getWidth(),i.getHeight()]}}function R7(i){try{return i.getOrigin().slice(0,2)}catch{return[0,i.getHeight()]}}function I7(i,e){try{return i.getResolution(e)}catch{return[e.getWidth()/i.getWidth(),e.getHeight()/i.getHeight()]}}function N7(i){const e=i.geoKeys;if(!e)return null;if(e.ProjectedCSTypeGeoKey&&e.ProjectedCSTypeGeoKey!==32767){const t="EPSG:"+e.ProjectedCSTypeGeoKey;let n=Mt(t);if(!n){const r=Qw(e.ProjLinearUnitsGeoKey);r&&(n=new Ba({code:t,units:r}))}return n}if(e.GeographicTypeGeoKey&&e.GeographicTypeGeoKey!==32767){const t="EPSG:"+e.GeographicTypeGeoKey;let n=Mt(t);if(!n){const r=Qw(e.GeogAngularUnitsGeoKey);r&&(n=new Ba({code:t,units:r}))}return n}return null}function F7(i){return i.getImageCount().then(function(e){const t=new Array(e);for(let n=0;n<e;++n)t[n]=i.getImage(n);return Promise.all(t)})}function O7(i,e){let t;return i.blob?t=T7(i.blob):i.overviews?t=L7(i.url,i.overviews,e):t=S7(i.url,e),t.then(F7)}function Df(i,e,t,n,r){if(Array.isArray(i)){const s=i.length;if(!Array.isArray(e)||s!=e.length){const o=new Error(n);throw r(o),o}for(let o=0;o<s;++o)Df(i[o],e[o],t,n,r);return}if(e=e,Math.abs(i-e)>t*i)throw new Error(n)}function D7(i){return i instanceof Int8Array?-128:i instanceof Int16Array?-32768:i instanceof Int32Array?-2147483648:i instanceof Float32Array?12e-39:0}function k7(i){return i instanceof Int8Array?127:i instanceof Uint8Array||i instanceof Uint8ClampedArray?255:i instanceof Int16Array?32767:i instanceof Uint16Array?65535:i instanceof Int32Array?2147483647:i instanceof Uint32Array?4294967295:i instanceof Float32Array?34e37:255}class aC extends Dx{constructor(e){super({state:"loading",tileGrid:null,projection:e.projection||null,transition:e.transition,interpolate:e.interpolate!==!1,wrapX:e.wrapX}),this.sourceInfo_=e.sources;const t=this.sourceInfo_.length;this.sourceOptions_=e.sourceOptions,this.sourceImagery_=new Array(t),this.sourceMasks_=new Array(t),this.resolutionFactors_=new Array(t),this.samplesPerPixel_,this.nodataValues_,this.metadata_,this.normalize_=e.normalize!==!1,this.addAlpha_=!1,this.error_=null,this.convertToRGB_=e.convertToRGB||!1,this.setKey(this.sourceInfo_.map(s=>s.url).join(","));const n=this,r=new Array(t);for(let s=0;s<t;++s)r[s]=O7(this.sourceInfo_[s],this.sourceOptions_);Promise.all(r).then(function(s){n.configure_(s)}).catch(function(s){Yw(s),n.error_=s,n.setState("error")})}getError(){return this.error_}determineProjection(e){const t=e[0];for(let n=t.length-1;n>=0;--n){const r=t[n],s=N7(r);if(s){this.projection=s;break}}}determineTransformMatrix(e){const t=e[0];for(let n=t.length-1;n>=0;--n){const s=t[n].fileDirectory.ModelTransformation;if(s){const[o,a,l,c,h,u,f,d]=s,g=Ua(Ua([1/Math.sqrt(o*o+h*h),0,0,-1/Math.sqrt(a*a+u*u),c,d],[o,h,a,u,0,0]),[1,0,0,1,-c,-d]);this.transformMatrix=g,this.addAlpha_=!0;break}}}configure_(e){let t,n,r,s,o;const a=new Array(e.length),l=new Array(e.length),c=new Array(e.length);let h=0;const u=e.length;for(let _=0;_<u;++_){const v=[],x=[];e[_].forEach(P=>{C7(P)?x.push(P):v.push(P)});const S=v.length;if(x.length>0&&x.length!==S)throw new Error(`Expected one mask per image found ${x.length} masks and ${S} images`);let b,A;const F=new Array(S),N=new Array(S),R=new Array(S);l[_]=new Array(S),c[_]=new Array(S);for(let P=0;P<S;++P){const O=v[P],L=O.getGDALNoData();c[_][P]=O.getGDALMetadata(0),l[_][P]=L;const T=this.sourceInfo_[_].bands;a[_]=T?T.length:O.getSamplesPerPixel();const C=S-(P+1);b||(b=M7(O)),A||(A=R7(O));const D=I7(O,v[0]);R[C]=D[0];const W=[O.getTileWidth(),O.getTileHeight()];W[0]!==W[1]&&W[1]<f_&&(W[0]=f_,W[1]=f_),F[C]=W;const $=D[0]/Math.abs(D[1]);N[C]=[W[0],W[1]/$]}if(t?Mn(t,b,t):t=b,!n)n=A;else{const P=`Origin mismatch for source ${_}, got [${A}] but expected [${n}]`;Df(n,A,0,P,this.viewRejector)}if(!o)o=R,this.resolutionFactors_[_]=1;else{o.length-h>R.length&&(h=o.length-R.length);const P=o[o.length-1]/R[R.length-1];this.resolutionFactors_[_]=P;const O=R.map(T=>T*=P),L=`Resolution mismatch for source ${_}, got [${O}] but expected [${o}]`;Df(o.slice(h,o.length),O,.02,L,this.viewRejector)}r?Df(r.slice(h,r.length),N,.01,`Tile size mismatch for source ${_}`,this.viewRejector):r=N,s?Df(s.slice(h,s.length),F,0,`Tile size mismatch for source ${_}`,this.viewRejector):s=F,this.sourceImagery_[_]=v.reverse(),this.sourceMasks_[_]=x.reverse()}for(let _=0,v=this.sourceImagery_.length;_<v;++_){const x=this.sourceImagery_[_];for(;x.length<o.length;)x.unshift(void 0)}this.getProjection()||this.determineProjection(e),this.determineTransformMatrix(e),this.samplesPerPixel_=a,this.nodataValues_=l,this.metadata_=c;e:for(let _=0;_<u;++_){if(this.sourceInfo_[_].nodata!==void 0){this.addAlpha_=!0;break}if(this.sourceMasks_[_].length){this.addAlpha_=!0;break}const v=l[_],x=this.sourceInfo_[_].bands;if(x){for(let S=0;S<x.length;++S)if(v[x[S]-1]!==null){this.addAlpha_=!0;break e}continue}for(let S=0;S<v.length;++S)if(v[S]!==null){this.addAlpha_=!0;break e}}let f=this.addAlpha_?1:0;for(let _=0;_<u;++_)f+=a[_];this.bandCount=f;const d=new ig({extent:t,minZoom:h,origin:n,resolutions:o,tileSizes:r});this.tileGrid=d,this.setTileSizes(s),this.setLoader(this.loadTile_.bind(this)),this.setState("ready");const g=1;o.length===2?o=[o[0],o[1],o[1]/2]:o.length===1&&(o=[o[0]*2,o[0],o[0]/2]);let m=t;if(this.transformMatrix){const _=Su(nn(),this.transformMatrix.slice()),v=E0(x=>Fi(_,x));m=bu(t,v)}this.viewResolver({showFullExtent:!0,projection:this.projection,resolutions:o,center:ja(In(m),this.projection),extent:Ou(m,this.projection),zoom:g})}loadTile_(e,t,n,r){const s=this.getTileSize(e),o=this.sourceImagery_.length,a=new Array(o*2),l=this.nodataValues_,c=this.sourceInfo_,h=P7();for(let u=0;u<o;++u){const f=c[u],d=this.resolutionFactors_[u],g=[Math.round(t*(s[0]*d)),Math.round(n*(s[1]*d)),Math.round((t+1)*(s[0]*d)),Math.round((n+1)*(s[1]*d))],m=this.sourceImagery_[u][e];let _;f.bands&&(_=f.bands.map(function(A){return A-1}));let v;"nodata"in f&&f.nodata!==null?v=f.nodata:_?v=_.map(function(A){return l[u][A]}):v=l[u];const x={window:g,width:s[0],height:s[1],samples:_,fillValue:v,pool:h,interleave:!1,signal:r.signal};A7(this.convertToRGB_,m)?a[u]=m.readRGB(x):a[u]=m.readRasters(x);const S=o+u,b=this.sourceMasks_[u][e];if(!b){a[S]=Promise.resolve(null);continue}a[S]=b.readRasters({window:g,width:s[0],height:s[1],samples:[0],pool:h,interleave:!1})}return Promise.all(a).then(this.composeTile_.bind(this,s)).catch(function(u){throw Yw(u),u})}composeTile_(e,t){const n=this.metadata_,r=this.sourceInfo_,s=this.sourceImagery_.length,o=this.bandCount,a=this.samplesPerPixel_,l=this.nodataValues_,c=this.normalize_,h=this.addAlpha_,u=e[0]*e[1],f=u*o;let d;c?d=new Uint8Array(f):d=new Float32Array(f);let g=0;for(let m=0;m<u;++m){let _=h;for(let v=0;v<s;++v){const x=r[v];let S=x.min,b=x.max,A,F;if(c){const N=n[v][0];S===void 0&&(N&&Qb in N?S=parseFloat(N[Qb]):S=D7(t[v][0])),b===void 0&&(N&&Jb in N?b=parseFloat(N[Jb]):b=k7(t[v][0])),A=255/(b-S),F=-S*A}for(let N=0;N<a[v];++N){const R=t[v][N][m];let P;if(c?P=yt(A*R+F,0,255):P=R,!h)d[g]=P;else{let O=x.nodata;if(O===void 0){let T;x.bands?T=x.bands[N]-1:T=N,O=l[v][T]}const L=isNaN(O);(!L&&R!==O||L&&!isNaN(R))&&(_=!1,d[g]=P)}g++}if(!_){const N=s+v,R=t[N];R&&!R[0][m]&&(_=!0)}}h&&(_||(d[g]=255),g++)}return d}}aC.prototype.getView;function G0(i){return Array.isArray(i)?Math.min(...i):i}class G7 extends Rm{constructor(e,t,n,r,s,o,a){let l=e.getExtent();l&&e.canWrapX()&&(l=l.slice(),l[0]=-1/0,l[2]=1/0);let c=t.getExtent();c&&t.canWrapX()&&(c=c.slice(),c[0]=-1/0,c[2]=1/0);const h=c?Mn(n,c):n,u=In(h),f=Od(e,t,u,r),d=Ix,g=new Rx(e,t,h,l,f*d,r),m=g.calculateSourceExtent(),_=Xo(m)?null:o(m,f,s),v=_?Ye.IDLE:Ye.EMPTY,x=_?_.getPixelRatio():1;super(n,r,x,v),this.targetProj_=t,this.maxSourceExtent_=l,this.triangulation_=g,this.targetResolution_=r,this.targetExtent_=n,this.sourceImage_=_,this.sourcePixelRatio_=x,this.interpolate_=a,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==Ye.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const e=this.sourceImage_.getState();if(e==Ye.LOADED){const t=St(this.targetExtent_)/this.targetResolution_,n=Wi(this.targetExtent_)/this.targetResolution_;this.canvas_=kL(t,n,this.sourcePixelRatio_,G0(this.sourceImage_.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_,!0)}this.state=e,this.changed()}load(){if(this.state==Ye.IDLE){this.state=Ye.LOADING,this.changed();const e=this.sourceImage_.getState();e==Ye.LOADED||e==Ye.ERROR?this.reproject_():(this.sourceListenerKey_=wt(this.sourceImage_,Qe.CHANGE,t=>{const n=this.sourceImage_.getState();(n==Ye.LOADED||n==Ye.ERROR)&&(this.unlistenSource_(),this.reproject_())}),this.sourceImage_.load())}}unlistenSource_(){Zt(this.sourceListenerKey_),this.sourceListenerKey_=null}}const Oo=4,g_={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class B7 extends Dr{constructor(e,t){super(e),this.image=t}}class Hx extends Bm{constructor(e){super({attributions:e.attributions,projection:e.projection,state:e.state,interpolate:e.interpolate!==void 0?e.interpolate:!0}),this.on,this.once,this.un,this.loader=e.loader||null,this.resolutions_=e.resolutions!==void 0?e.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=e.loader?e.loader.length===0:!1,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(e){this.resolutions_=e}findNearestResolution(e){const t=this.getResolutions();if(t){const n=vm(t,e,0);e=t[n]}return e}getImage(e,t,n,r){const s=this.getProjection();if(!s||!r||mn(s,r))return s&&(r=s),this.getImageInternal(e,t,n,r);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&mn(this.reprojectedImage_.getProjection(),r)&&this.reprojectedImage_.getResolution()==t&&Ga(this.reprojectedImage_.getExtent(),e))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new G7(s,r,e,t,n,(o,a,l)=>this.getImageInternal(o,a,l,s),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(e,t,n,r){if(this.loader){const s=cC(e,t,n,1),o=this.findNearestResolution(t);if(this.image&&(this.static_||this.wantedProjection_===r&&(this.wantedExtent_&&gs(this.wantedExtent_,s)||gs(this.image.getExtent(),s))&&(this.wantedResolution_&&G0(this.wantedResolution_)===o||G0(this.image.getResolution())===o)))return this.image;this.wantedProjection_=r,this.wantedExtent_=s,this.wantedResolution_=o,this.image=new Rm(s,o,n,this.loader),this.image.addEventListener(Qe.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(e){const t=e.target;let n;switch(t.getState()){case Ye.LOADING:this.loading=!0,n=g_.IMAGELOADSTART;break;case Ye.LOADED:this.loading=!1,n=g_.IMAGELOADEND;break;case Ye.ERROR:this.loading=!1,n=g_.IMAGELOADERROR;break;default:return}this.hasListener(n)&&this.dispatchEvent(new B7(n,t))}}function lC(i,e){i.getImage().src=e}function cC(i,e,t,n){const r=e/t,s=In(i),o=wl(St(i)/r,Oo),a=wl(Wi(i)/r,Oo),l=wl((n-1)*o/2,Oo),c=o+2*l,h=wl((n-1)*a/2,Oo),u=a+2*h;return Sd(s,r,0,[c,u])}function j7(i,e,t,n,r,s){const o=r.getCode().split(/:(?=\d+$)/).pop(),a=t/n,l=[v0(St(e)/a,Oo),v0(Wi(e)/a,Oo)];s.SIZE=l[0]+","+l[1],s.BBOX=e.join(","),s.BBOXSR=o,s.IMAGESR=o,s.DPI=Math.round(s.DPI?s.DPI*n:90*n);const c=i.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage");return Cu(c,s)}class U7 extends Rm{constructor(e,t,n,r,s){const o=s!==void 0?Ye.IDLE:Ye.LOADED;super(e,t,n,o),this.loader_=s!==void 0?s:null,this.canvas_=r,this.error_=null}getError(){return this.error_}handleLoad_(e){e?(this.error_=e,this.state=Ye.ERROR):this.state=Ye.LOADED,this.changed()}load(){this.state==Ye.IDLE&&(this.state=Ye.LOADING,this.changed(),this.loader_(this.handleLoad_.bind(this)))}getImage(){return this.canvas_}}function z7(i){const e=i.load||Im,t=i.imageExtent,n=i.crossOrigin??null;return()=>{const r=new Image;return r.crossOrigin=n,e(r,i.url).then(s=>{const o=St(t)/s.width,a=Wi(t)/s.height;return{image:s,extent:t,resolution:o!==a?[o,a]:a,pixelRatio:1}})}}class q7 extends Hx{constructor(e){const t=e.crossOrigin!==void 0?e.crossOrigin:null,n=e.imageLoadFunction!==void 0?e.imageLoadFunction:lC;super({attributions:e.attributions,interpolate:e.interpolate,projection:Mt(e.projection)}),this.url_=e.url,this.imageExtent_=e.imageExtent,this.image=null,this.image=new Rm(this.imageExtent_,void 0,1,z7({url:e.url,imageExtent:e.imageExtent,crossOrigin:t,load:(r,s)=>(this.image.setImage(r),n(this.image,s),Im(r))})),this.image.addEventListener(Qe.CHANGE,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(e,t,n,r){return Ei(e,this.image.getExtent())?this.image:null}getUrl(){return this.url_}}const V7=new Error("Image failed to load");function hC(i,e,t,n,r){return new Promise((s,o)=>{const a=new Image;a.crossOrigin=r.crossOrigin??null,a.addEventListener("load",()=>s(a)),a.addEventListener("error",()=>o(V7)),a.src=Px(i,e,t,n,r.maxY)})}function eE(i){return function(e,t,n,r){const s=SO(i,e,t,n);return hC(s,e,t,n,r)}}function $7(i){return function(e,t,n,r){const s=i(e,t,n,r);return hC(s,e,t,n,r)}}function tE(i){let e;if(Array.isArray(i))e=eE(i);else if(typeof i=="string"){const t=Mx(i);e=eE(t)}else if(typeof i=="function")e=$7(i);else throw new Error("The url option must be a single template, an array of templates, or a function for getting a URL");return e}let iE=0;function nE(i){return Array.isArray(i)?i.join(`
85
- `):typeof i=="string"?i:(++iE,"url-function-key-"+iE)}class W7 extends Dx{constructor(e){e=e||{};let t=e.loader,n;e.url&&(t=tE(e.url),n=nE(e.url));const r=t?e.state:"loading",s=e.wrapX===void 0?!0:e.wrapX;super({loader:t,key:n,attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize,gutter:e.gutter,maxResolution:e.maxResolution,projection:e.projection,tileGrid:e.tileGrid,state:r,wrapX:s,transition:e.transition,interpolate:e.interpolate!==!1,crossOrigin:e.crossOrigin,zDirection:e.zDirection})}setUrl(e){const t=tE(e);this.setLoader(t),this.setKey(nE(e)),this.getState()!=="ready"&&this.setState("ready")}}const B0="1.3.0",rE=[101,101];function uC(i,e,t,n,r){r.WIDTH=t[0],r.HEIGHT=t[1];const s=n.getAxisOrientation(),o=jv(r.VERSION,"1.3")>=0;r[o?"CRS":"SRS"]=n.getCode();const a=o&&s.startsWith("ne")?[e[1],e[0],e[3],e[2]]:e;return r.BBOX=a.join(","),Cu(i,r)}function fC(i,e,t,n,r,s,o){s=Object.assign({REQUEST:"GetMap"},s);const a=e/t,l=[v0(St(i)/a,Oo),v0(Wi(i)/a,Oo)];if(t!=1)switch(o){case"geoserver":const h=90*t+.5|0;"FORMAT_OPTIONS"in s?s.FORMAT_OPTIONS+=";dpi:"+h:s.FORMAT_OPTIONS="dpi:"+h;break;case"mapserver":s.MAP_RESOLUTION=90*t;break;case"carmentaserver":case"qgis":s.DPI=90*t;break;default:throw new Error("Unknown `serverType` configured")}return uC(r,i,l,n,s)}function j0(i,e){return Object.assign({REQUEST:e,SERVICE:"WMS",VERSION:B0,FORMAT:"image/png",STYLES:"",TRANSPARENT:"TRUE"},i)}function H7(i){const e=i.hidpi===void 0?!0:i.hidpi,t=Mt(i.projection||"EPSG:3857"),n=i.ratio||1.5,r=i.load||Im,s=i.crossOrigin??null;return(o,a,l)=>{o=cC(o,a,l,n),l!=1&&(!e||i.serverType===void 0)&&(l=1);const c=fC(o,a,l,t,i.url,j0(i.params,"GetMap"),i.serverType),h=new Image;return h.crossOrigin=s,r(h,c).then(u=>({image:u,extent:o,pixelRatio:l}))}}function X7(i,e,t){if(i.url===void 0)return;const n=Mt(i.projection||"EPSG:3857"),r=Sd(e,t,0,rE),s={QUERY_LAYERS:i.params.LAYERS,INFO_FORMAT:"application/json"};Object.assign(s,j0(i.params,"GetFeatureInfo"),i.params);const o=qh((e[0]-r[0])/t,Oo),a=qh((r[3]-e[1])/t,Oo),l=jv(s.VERSION,"1.3")>=0;return s[l?"I":"X"]=o,s[l?"J":"Y"]=a,uC(i.url,r,rE,n,s)}function K7(i,e){if(i.url===void 0)return;const t={SERVICE:"WMS",VERSION:B0,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(e!==void 0){const n=Mt(i.projection||"EPSG:3857").getMetersPerUnit()||1,r=28e-5;t.SCALE=e*n/r}if(Object.assign(t,i.params),i.params!==void 0&&t.LAYER===void 0){const n=t.LAYERS;if(!(!Array.isArray(n)||n.length!==1))return;t.LAYER=n}return Cu(i.url,t)}class Y7 extends Hx{constructor(e){e=e||{},super({attributions:e.attributions,interpolate:e.interpolate,projection:e.projection,resolutions:e.resolutions}),this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null,this.url_=e.url,this.imageLoadFunction_=e.imageLoadFunction!==void 0?e.imageLoadFunction:lC,this.params_=Object.assign({},e.params),this.serverType_=e.serverType,this.hidpi_=e.hidpi!==void 0?e.hidpi:!0,this.renderedRevision_=0,this.ratio_=e.ratio!==void 0?e.ratio:1.5,this.loaderProjection_=null}getFeatureInfoUrl(e,t,n,r){const s=Mt(n),o=this.getProjection();o&&o!==s&&(t=Od(o,s,e,t),e=ro(e,s,o));const a={url:this.url_,params:{...this.params_,...r},projection:o||s};return X7(a,e,t)}getLegendUrl(e,t){return K7({url:this.url_,params:{...this.params_,...t}},e)}getParams(){return this.params_}getImageInternal(e,t,n,r){return this.url_===void 0?null:((!this.loader||this.loaderProjection_!==r)&&(this.loaderProjection_=r,this.loader=H7({crossOrigin:this.crossOrigin_,params:this.params_,projection:r,serverType:this.serverType_,hidpi:this.hidpi_,url:this.url_,ratio:this.ratio_,load:(s,o)=>(this.image.setImage(s),this.imageLoadFunction_(this.image,o),Im(s))})),super.getImageInternal(e,t,n,r))}getImageLoadFunction(){return this.imageLoadFunction_}getUrl(){return this.url_}setImageLoadFunction(e){this.imageLoadFunction_=e,this.changed()}setUrl(e){e!=this.url_&&(this.url_=e,this.loader=null,this.changed())}setParams(e){this.params_=Object.assign({},e),this.changed()}updateParams(e){Object.assign(this.params_,e),this.changed()}changed(){this.image=null,super.changed()}}function Z7(i,e,t,n){const r=document.createElement("script"),s="olc_"+Ue(e);function o(){delete window[s],r.parentNode.removeChild(r)}r.async=!0,r.src=i+(i.includes("?")?"&":"?")+"callback="+s;const a=setTimeout(function(){o(),t&&t()},1e4);window[s]=function(l){clearTimeout(a),o(),e(l)},document.head.appendChild(r)}const sE=[];class J7 extends ng{constructor(e,t,n,r,s){super(e,t,{transition:0}),this.context_=null,this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=r.bind(void 0,this),this.removeSourceTiles_=s,this.wrappedTileCoord=n}getContext(){return this.context_||(this.context_=Xi(1,1,sE)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(e){const t=Ue(e);return t in this.replayState_||(this.replayState_[t]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[t]}load(){this.getSourceTiles()}release(){this.context_&&(Qd(this.context_),sE.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}}let Q7=class extends ng{constructor(e,t,n,r,s,o){super(e,t,o),this.extent=null,this.format_=r,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=s,this.url_=n,this.key=n}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){this.state==Oe.IDLE&&(this.setState(Oe.LOADING),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(e,t){this.setFeatures(e)}onError(){this.setState(Oe.ERROR)}setFeatures(e){this.features_=e,this.setState(Oe.LOADED)}setLoader(e){this.loader_=e}};class e4 extends Um{constructor(e){const t=e.projection||"EPSG:3857",n=e.extent||Yc(t),r=e.tileGrid||ku({extent:n,maxResolution:e.maxResolution,maxZoom:e.maxZoom!==void 0?e.maxZoom:22,minZoom:e.minZoom,tileSize:e.tileSize||512});super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,interpolate:!0,projection:t,state:e.state,tileGrid:r,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:t4,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX===void 0?!0:e.wrapX,transition:e.transition,zDirection:e.zDirection===void 0?1:e.zDirection}),this.format_=e.format?e.format:null,this.tileKeysBySourceTileUrl_={},this.sourceTiles_={},this.overlaps_=e.overlaps==null?!0:e.overlaps,this.tileClass=e.tileClass?e.tileClass:Q7,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceTiles(e,t,n){if(n.getState()===Oe.IDLE){n.setState(Oe.LOADING);const r=n.wrappedTileCoord,s=this.getTileGridForProjection(t);let o=s.getTileCoordExtent(r);const a=r[0],l=s.getResolution(a);Zn(o,-l,o);const c=this.projection;t&&this.projection&&!mn(t,c)&&(o=Mc(o,t,c));const h=this.tileGrid,u=h.getExtent();u&&Mn(o,u,o);let f=l;t&&c&&!mn(t,c)&&(f=l/c.getMetersPerUnit()/t.getMetersPerUnit());const d=h.getZForResolution(f,this.zDirection);h.forEachTileCoord(o,d,g=>{const m=this.tileUrlFunction(g,e,t);this.sourceTiles_[m]||(this.sourceTiles_[m]=new this.tileClass(g,m?Oe.IDLE:Oe.EMPTY,m,this.format_,this.tileLoadFunction));const _=this.sourceTiles_[m];n.sourceTiles.push(_),this.tileKeysBySourceTileUrl_[m]||(this.tileKeysBySourceTileUrl_[m]=[]),this.tileKeysBySourceTileUrl_[m].push(n.getKey());const v=_.getState();if(v<Oe.LOADED){const x=S=>{this.handleTileChange(S);const b=_.getState();if(b===Oe.LOADED||b===Oe.ERROR){const A=_.getKey();A in n.errorTileKeys?_.getState()===Oe.LOADED&&delete n.errorTileKeys[A]:n.loadingSourceTiles--,b===Oe.ERROR?n.errorTileKeys[A]=!0:_.removeEventListener(Qe.CHANGE,x),n.loadingSourceTiles===0&&n.setState(Fc(n.errorTileKeys)?Oe.LOADED:Oe.ERROR)}};_.addEventListener(Qe.CHANGE,x),n.loadingSourceTiles++}v===Oe.IDLE&&(_.extent=h.getTileCoordExtent(g),_.projection=this.projection,_.resolution=h.getResolution(g[0]),_.load())}),n.loadingSourceTiles||n.setState(n.sourceTiles.some(g=>g.getState()===Oe.ERROR)?Oe.ERROR:Oe.LOADED)}return n.sourceTiles}removeSourceTiles(e){const t=e.getKey(),n=e.sourceTiles;for(let r=0,s=n.length;r<s;++r){const o=n[r].getTileUrl();if(!this.tileKeysBySourceTileUrl_[o])return;const a=this.tileKeysBySourceTileUrl_[o].indexOf(t);a!==-1&&(this.tileKeysBySourceTileUrl_[o].splice(a,1),this.tileKeysBySourceTileUrl_[o].length===0&&(delete this.tileKeysBySourceTileUrl_[o],delete this.sourceTiles_[o]))}}getTile(e,t,n,r,s){const o=[e,t,n];let a=this.getTileCoordForTileUrlFunction(o,s);const l=this.getTileGrid().getExtent(),c=this.projection,h=this.getTileGridForProjection(s);if(a&&l){const d=h.getTileCoordExtent(a);Zn(d,-h.getResolution(e),d),Ei(l,!s||!c||mn(s,c)?d:Mc(d,s,c))||(a=null)}let u=!0;if(a!==null){const d=this.tileGrid,g=h.getResolution(e);let m=g;s&&c&&!mn(s,c)&&(m=g/c.getMetersPerUnit()/s.getMetersPerUnit());const _=d.getZForResolution(m,1),v=h.getTileCoordExtent(a);Zn(v,-g,v),d.forEachTileCoord(!s||!c||mn(s,c)?v:Mc(v,s,c),_,x=>{u=u&&!this.tileUrlFunction(x,r,c)})}const f=new J7(o,u?Oe.EMPTY:Oe.IDLE,a,this.getSourceTiles.bind(this,r,s),this.removeSourceTiles.bind(this));return f.key=this.getKey(),f}getTileGridForProjection(e){const t=e.getCode();let n=this.tileGrids_[t];if(!n){const r=this.projection;if(r!==null&&!mn(r,e))return km(e);const s=this.tileGrid,o=s.getResolutions().slice(),a=o.map(function(h,u){return s.getOrigin(u)}),l=o.map(function(h,u){return s.getTileSize(u)}),c=sL+1;for(let h=o.length;h<c;++h)o.push(o[h-1]/2),a.push(a[h-1]),l.push(l[h-1]);n=new ig({extent:s.getExtent(),origins:a,resolutions:o,tileSizes:l}),this.tileGrids_[t]=n}return n}getTilePixelRatio(e){return e}getTilePixelSize(e,t,n){const r=this.getTileGridForProjection(n),s=Hi(r.getTileSize(e),this.tmpSize);return[Math.round(s[0]*t),Math.round(s[1]*t)]}setOverlaps(e){this.overlaps_=e,this.changed()}}function t4(i,e){i.setLoader(function(t,n,r){jL(e,i.getFormat(),t,n,r,i.onLoad.bind(i),i.onError.bind(i))})}const dC='&#169; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.';class i4 extends Fx{constructor(e){e=e||{};let t;e.attributions!==void 0?t=e.attributions:t=[dC];const n=e.crossOrigin!==void 0?e.crossOrigin:"anonymous",r=e.url!==void 0?e.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:t,attributionsCollapsible:!1,cacheSize:e.cacheSize,crossOrigin:n,interpolate:e.interpolate,maxZoom:e.maxZoom!==void 0?e.maxZoom:19,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileLoadFunction:(s,o)=>{const a=s.getImage();!Xr&&a instanceof HTMLImageElement&&(a.referrerPolicy="origin-when-cross-origin"),(e.tileLoadFunction||BL)(s,o)},transition:e.transition,url:r,wrapX:e.wrapX,zDirection:e.zDirection})}}class Xx{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(L0(),{get:(e,t)=>{if(typeof L0()[t]=="function")return this.push_(t),this.pushMethodArgs_},set:(e,t,n)=>(this.push_(t,n),!0)})}push_(...e){const t=this.instructions_,n=this.zIndex+this.offset_;t[n]||(t[n]=[]),t[n].push(...e)}pushMethodArgs_=(...e)=>(this.push_(e),this);pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let n=0,r=t.length;n<r;++n){const s=t[n];if(typeof s=="function"){s(e);continue}const o=t[++n];if(typeof e[s]=="function")e[s](...o);else{if(typeof o=="function"){e[s]=o(e);continue}e[s]=o}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}}const n4=5;class gC extends Zd{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=n4}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(e){return Kt()}getData(e){return null}prepareFrame(e){return Kt()}renderFrame(e,t){return Kt()}forEachFeatureAtCoordinate(e,t,n,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){const t=e.target;(t.getState()===Ye.LOADED||t.getState()===Ye.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Ye.LOADED&&t!=Ye.ERROR&&e.addEventListener(Qe.CHANGE,this.boundHandleImageChange_),t==Ye.IDLE&&(e.load(),t=e.getState()),t==Ye.LOADED}renderIfReadyAndVisible(){const e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const oE=[];let Gh=null;function r4(){Gh=Xi(1,1,void 0,{willReadFrequently:!0})}class Kx extends gC{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=nn(),this.pixelTransform=nn(),this.inversePixelTransform=nn(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){Gh||r4(),Gh.clearRect(0,0,1,1);let r;try{Gh.drawImage(e,t,n,1,1,0,0,1,1),r=Gh.getImageData(0,0,1,1).data}catch{return Gh=null,null}return r}getBackground(e){let n=this.getLayer().getBackground();return typeof n=="function"&&(n=n(e.viewState.resolution)),n||void 0}useContainer(e,t,n){const r=this.getLayer().getClassName();let s,o;if(e&&e.className===r&&(!n||e&&e.style.backgroundColor&&Ho(so(e.style.backgroundColor),so(n)))){const a=e.firstElementChild;El(a)&&(o=a.getContext("2d"))}if(o&&B6(o.canvas.style.transform,t)?(this.container=e,this.context=o,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){s=Xr?aL():document.createElement("div"),s.className=r;let a=s.style;a.position="absolute",a.width="100%",a.height="100%",o=Xi();const l=o.canvas;s.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=s,this.context=o}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){const r=no(n),s=bm(n),o=wm(n),a=xm(n);Fi(t.coordinateToPixelTransform,r),Fi(t.coordinateToPixelTransform,s),Fi(t.coordinateToPixelTransform,o),Fi(t.coordinateToPixelTransform,a);const l=this.inversePixelTransform;Fi(l,r),Fi(l,s),Fi(l,o),Fi(l,a),e.save(),e.beginPath(),e.moveTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(s[0]),Math.round(s[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.clip()}prepareContainer(e,t){const n=e.extent,r=e.viewState.resolution,s=e.viewState.rotation,o=e.pixelRatio,a=Math.round(St(n)/r*o),l=Math.round(Wi(n)/r*o);_s(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),Su(this.inversePixelTransform,this.pixelTransform);const c=G6(this.pixelTransform);if(this.useContainer(t,c,this.getBackground(e)),!this.containerReused){const h=this.context.canvas;h.width!=a||h.height!=l?(h.width=a,h.height=l):this.context.clearRect(0,0,a,l),c!==h.style.transform&&(h.style.transform=c)}}dispatchRenderEvent_(e,t,n){const r=this.getLayer();if(r.hasListener(e)){const s=new Jf(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(qn.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(qn.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new Xx),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(qn.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(qn.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,r,s,o,a){const l=s/2,c=o/2,h=r/t,u=-h,f=-e[0]+a,d=-e[1];return _s(this.tempTransform,l,c,h,u,-n,f,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}}class pC extends Kx{constructor(e){super(e),this.image=null}getImage(){return this.image?this.image.getImage():null}prepareFrame(e){const t=e.layerStatesArray[e.layerIndex],n=e.pixelRatio,r=e.viewState,s=r.resolution,o=this.getLayer().getSource(),a=e.viewHints;let l=e.extent;if(t.extent!==void 0&&(l=Mn(l,ps(t.extent,r.projection))),!a[Ti.ANIMATING]&&!a[Ti.INTERACTING]&&!Xo(l))if(o){const c=r.projection,h=o.getImage(l,s,n,c);h&&(this.loadImage(h)?this.image=h:h.getState()===Ye.EMPTY&&(this.image=null))}else this.image=null;return!!this.image}getData(e){const t=this.frameState;if(!t)return null;const n=this.getLayer(),r=Fi(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!Hr(s,r))return null;const o=this.image.getExtent(),a=this.image.getImage(),l=St(o),c=Math.floor(a.width*((r[0]-o[0])/l));if(c<0||c>=a.width)return null;const h=Wi(o),u=Math.floor(a.height*((o[3]-r[1])/h));return u<0||u>=a.height?null:this.getImageData(a,c,u)}renderFrame(e,t){const n=this.image,r=n.getExtent(),s=n.getResolution(),[o,a]=Array.isArray(s)?s:[s,s],l=n.getPixelRatio(),c=e.layerStatesArray[e.layerIndex],h=e.pixelRatio,u=e.viewState,f=u.center,d=u.resolution,g=h*o/(d*l),m=h*a/(d*l);this.prepareContainer(e,t);const _=this.context.canvas.width,v=this.context.canvas.height,x=this.getRenderContext(e);let S=!1,b=!0;if(c.extent){const P=ps(c.extent,u.projection);b=Ei(P,e.extent),S=b&&!gs(P,e.extent),S&&this.clipUnrotated(x,e,P)}const A=n.getImage(),F=_s(this.tempTransform,_/2,v/2,g,m,0,l*(r[0]-f[0])/o,l*(f[1]-r[3])/a);this.renderedResolution=a*h/l;const N=A.width*F[0],R=A.height*F[3];if(this.getLayer().getSource().getInterpolate()||(x.imageSmoothingEnabled=!1),this.preRender(x,e),b&&N>=.5&&R>=.5){const P=F[4],O=F[5],L=c.opacity;L!==1&&(x.save(),x.globalAlpha=L),x.drawImage(A,0,0,+A.width,+A.height,P,O,N,R),L!==1&&x.restore()}return this.postRender(this.context,e),S&&x.restore(),x.imageSmoothingEnabled=!0,this.container}}class s4 extends Hc{constructor(e){e=e||{},super(e)}}class mC extends s4{constructor(e){super(e)}createRenderer(){return new pC(this)}getData(e){return super.getData(e)}}function p_(i,e,t){if(!(t in i))return i[t]=new Set([e]),!0;const n=i[t],r=n.has(e);return r||n.add(e),!r}function o4(i,e,t){const n=i[t];return n?n.delete(e):!1}function aE(i,e){const t=i.layerStatesArray[i.layerIndex];t.extent&&(e=Mn(e,ps(t.extent,i.viewState.projection)));const n=t.layer.getRenderSource();if(!n.getWrapX()){const r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=Mn(e,r))}return e}class _C extends Kx{constructor(e,t){super(e),t=t||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=bn(),this.tempTileRange_=new Dm(0,0,0,0),this.tempTileCoord_=kc(0,0,0);const n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new Oy(n),this.sourceTileCache_=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Oy(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){const s=this.tileCache_,a=this.getLayer().getSource(),l=Qf(a,a.getKey(),e,t,n);let c;if(s.containsKey(l))c=s.get(l);else{const h=r.viewState.projection,u=a.getProjection();if(c=a.getTile(e,t,n,r.pixelRatio,h,!u||mn(u,h)?void 0:this.getSourceTileCache()),!c)return null;s.set(l,c)}return c}getTile(e,t,n,r){const s=this.getOrCreateTile(e,t,n,r);return s||null}getData(e){const t=this.frameState;if(!t)return null;const n=this.getLayer(),r=Fi(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!Hr(s,r))return null;const o=t.viewState,a=n.getRenderSource(),l=a.getTileGridForProjection(o.projection),c=a.getTilePixelRatio(t.pixelRatio);for(let h=l.getZForResolution(o.resolution);h>=l.getMinZoom();--h){const u=l.getTileCoordForCoordAndZ(r,h),f=this.getTile(h,u[1],u[2],t);if(!f||f.getState()!==Oe.LOADED)continue;const d=l.getOrigin(h),g=Hi(l.getTileSize(h)),m=l.getResolution(h);let _;if(f instanceof Gm||f instanceof Nx)_=f.getImage();else if(f instanceof Dd){if(_=Au(f.getData()),!_)continue}else continue;const v=Math.floor(c*((r[0]-d[0])/m-u[1]*g[0])),x=Math.floor(c*((d[1]-r[1])/m-u[2]*g[1])),S=Math.round(c*a.getGutterForProjection(o.projection));return this.getImageData(_,v+S,x+S)}return null}prepareFrame(e){this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;const t=this.getLayer().getSource();if(!t)return!1;const n=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===t.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(e,t,n,r,s){const o=e.viewState,a=this.getLayer(),l=a.getRenderSource(),c=l.getTileGridForProjection(o.projection),h=Ue(l);h in e.wantedTiles||(e.wantedTiles[h]={});const u=e.wantedTiles[h],f=a.getMapInternal(),d=Math.max(n-s,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),f?f.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),g=o.rotation,m=g?kv(o.center,o.resolution,g,e.size):void 0;for(let _=n;_>=d;--_){const v=c.getTileRangeForExtentAndZ(t,_,this.tempTileRange_),x=c.getResolution(_);for(let S=v.minX;S<=v.maxX;++S)for(let b=v.minY;b<=v.maxY;++b){if(g&&!c.tileCoordIntersectsViewport([_,S,b],m))continue;const A=this.getTile(_,S,b,e);if(!A||!p_(r,A,_))continue;const N=A.getKey();if(u[N]=!0,A.getState()===Oe.IDLE&&!e.tileQueue.isKeyQueued(N)){const R=kc(_,S,b,this.tempTileCoord_);e.tileQueue.enqueue([A,h,c.getTileCoordCenter(R),x])}}}}findStaleTile_(e,t){const n=this.tileCache_,r=e[0],s=e[1],o=e[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){const c=Qf(this.getLayer().getSource(),a[l],r,s,o);if(n.containsKey(c)){const h=n.peek(c);if(h.getState()===Oe.LOADED)return h.endTransition(Ue(this)),p_(t,h,r),!0}}return!1}findAltTiles_(e,t,n,r){const s=e.getTileRangeForTileCoordAndZ(t,n,this.tempTileRange_);if(!s)return!1;let o=!0;const a=this.tileCache_,l=this.getLayer().getRenderSource(),c=l.getKey();for(let h=s.minX;h<=s.maxX;++h)for(let u=s.minY;u<=s.maxY;++u){const f=Qf(l,c,n,h,u);let d=!1;if(a.containsKey(f)){const g=a.peek(f);g.getState()===Oe.LOADED&&(p_(r,g,n),d=!0)}d||(o=!1)}return o}renderFrame(e,t){this.renderComplete=!0;const n=e.layerStatesArray[e.layerIndex],r=e.viewState,s=r.projection,o=r.resolution,a=r.center,l=e.pixelRatio,c=this.getLayer(),h=c.getSource(),u=h.getTileGridForProjection(s),f=u.getZForResolution(o,h.zDirection),d=u.getResolution(f),g=h.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==g&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=g):this.renderedSourceKey_=g;let m=e.extent;const _=h.getTilePixelRatio(l);this.prepareContainer(e,t);const v=this.context.canvas.width,x=this.context.canvas.height,S=n.extent&&ps(n.extent);S&&(m=Mn(m,ps(n.extent)));const b=d*v/2/_,A=d*x/2/_,F=[a[0]-b,a[1]-A,a[0]+b,a[1]+A],N={};this.renderedTiles.length=0;const R=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){const V=u.getZForResolution(r.nextResolution,h.zDirection),te=aE(e,e.nextExtent);this.enqueueTiles(e,te,V,N,R)}const P=aE(e,m);if(this.enqueueTiles(e,P,f,N,0),R>0&&setTimeout(()=>{this.enqueueTiles(e,P,f-1,N,R-1)},0),!(f in N))return this.container;const O=Ue(this),L=e.time;for(const V of N[f]){const te=V.getState();if(te===Oe.EMPTY)continue;const ne=V.tileCoord;if(te===Oe.LOADED&&V.getAlpha(O,L)===1){V.endTransition(O);continue}if(te!==Oe.ERROR&&(this.renderComplete=!1),this.findStaleTile_(ne,N)){o4(N,V,f),e.animate=!0;continue}if(this.findAltTiles_(u,ne,f+1,N))continue;const U=u.getMinZoom();for(let K=f-1;K>=U&&!this.findAltTiles_(u,ne,K,N);--K);}const T=d/o*l/_,C=this.getRenderContext(e);_s(this.tempTransform,v/2,x/2,T,T,0,-v/2,-x/2),n.extent&&this.clipUnrotated(C,e,S),h.getInterpolate()||(C.imageSmoothingEnabled=!1),this.preRender(C,e);const D=Object.keys(N).map(Number);D.sort(Bo);let W;const $=[],B=[];for(let V=D.length-1;V>=0;--V){const te=D[V],ne=h.getTilePixelSize(te,l,s),I=u.getResolution(te)/d,U=ne[0]*I*T,K=ne[1]*I*T,ie=u.getTileCoordForCoordAndZ(no(F),te),re=u.getTileCoordExtent(ie),ce=Fi(this.tempTransform,[_*(re[0]-F[0])/d,_*(F[3]-re[3])/d]),ve=_*h.getGutterForProjection(s);for(const pe of N[te]){if(pe.getState()!==Oe.LOADED)continue;const le=pe.tileCoord,Ce=ie[1]-le[1],H=Math.round(ce[0]-(Ce-1)*U),Z=ie[2]-le[2],he=Math.round(ce[1]-(Z-1)*K),j=Math.round(ce[0]-Ce*U),fe=Math.round(ce[1]-Z*K),Ee=H-j,Le=he-fe,ge=D.length===1;let Te=!1;W=[j,fe,j+Ee,fe,j+Ee,fe+Le,j,fe+Le];for(let _e=0,Ie=$.length;_e<Ie;++_e)if(!ge&&te<B[_e]){const Se=$[_e];Ei([j,fe,j+Ee,fe+Le],[Se[0],Se[3],Se[4],Se[7]])&&(Te||(C.save(),Te=!0),C.beginPath(),C.moveTo(W[0],W[1]),C.lineTo(W[2],W[3]),C.lineTo(W[4],W[5]),C.lineTo(W[6],W[7]),C.moveTo(Se[6],Se[7]),C.lineTo(Se[4],Se[5]),C.lineTo(Se[2],Se[3]),C.lineTo(Se[0],Se[1]),C.clip())}$.push(W),B.push(te),this.drawTile(pe,e,j,fe,Ee,Le,ve,ge),Te&&C.restore(),this.renderedTiles.unshift(pe),this.updateUsedTiles(e.usedTiles,h,pe)}}if(this.renderedResolution=d,this.extentChanged=!this.renderedExtent_||!Ga(this.renderedExtent_,F),this.renderedExtent_=F,this.renderedPixelRatio=l,this.postRender(this.context,e),n.extent&&C.restore(),C.imageSmoothingEnabled=!0,this.renderComplete){const V=(te,ne)=>{const ae=Ue(h),I=ne.wantedTiles[ae],U=I?Object.keys(I).length:0;this.updateCacheSize(U),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};e.postRenderFunctions.push(V)}return this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,n,r,s,o,a,l){let c;if(e instanceof Dd){if(c=Au(e.getData()),!c)throw new Error("Rendering array data is not yet supported")}else c=this.getTileImage(e);if(!c)return;const h=this.getRenderContext(t),u=Ue(this),f=t.layerStatesArray[t.layerIndex],d=f.opacity*(l?e.getAlpha(u,t.time):1),g=d!==h.globalAlpha;g&&(h.save(),h.globalAlpha=d),h.drawImage(c,a,a,c.width-2*a,c.height-2*a,n,r,s,o),g&&h.restore(),d!==f.opacity?t.animate=!0:l&&e.endTransition(u)}getImage(){const e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,n){const r=Ue(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}}const Sl={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class yC extends Hc{constructor(e){e=e||{};const t=Object.assign({},e),n=e.cacheSize;delete e.cacheSize,delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n,this.setPreload(e.preload!==void 0?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(Sl.PRELOAD)}setPreload(e){this.set(Sl.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(Sl.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(Sl.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}}class Vy extends yC{constructor(e){super(e)}createRenderer(){return new _C(this,{cacheSize:this.getCacheSize()})}}const a4='&copy; <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a>',l4='&copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a>',c4='&copy; <a href="https://stamen.com/" target="_blank">Stamen Design</a>',h4={stamen_terrain:{extension:"png"},stamen_terrain_background:{extension:"png"},stamen_terrain_labels:{extension:"png"},stamen_terrain_lines:{extension:"png"},stamen_toner_background:{extension:"png"},stamen_toner:{extension:"png"},stamen_toner_labels:{extension:"png"},stamen_toner_lines:{extension:"png"},stamen_toner_lite:{extension:"png"},stamen_toner_dark:{extension:"png"},stamen_toner_blacklite:{extension:"png"},stamen_watercolor:{extension:"jpg"},alidade_smooth:{extension:"png"},alidade_smooth_dark:{extension:"png"},alidade_satellite:{extension:"png"},outdoors:{extension:"png"},osm_bright:{extension:"png"}},u4={stamen_terrain:{minZoom:0,maxZoom:18,retina:!0},stamen_toner:{minZoom:0,maxZoom:20,retina:!0},stamen_toner_dark:{minZoom:0,maxZoom:20,retina:!0},stamen_toner_blacklite:{minZoom:0,maxZoom:20,retina:!0},stamen_watercolor:{minZoom:1,maxZoom:18,retina:!1}};class f4 extends Fx{constructor(e){const t=e.layer.indexOf("-"),n=t==-1?e.layer:e.layer.slice(0,t),r=u4[n]||{minZoom:0,maxZoom:20,retina:!0},s=h4[e.layer],o=e.apiKey?"?api_key="+e.apiKey:"",a=r.retina&&e.retina?"@2x":"",l=e.url!==void 0?e.url:"https://tiles.stadiamaps.com/tiles/"+e.layer+"/{z}/{x}/{y}"+a+"."+s.extension+o,c=[a4,l4,dC];e.layer.startsWith("stamen_")&&c.splice(1,0,c4),super({attributions:c,cacheSize:e.cacheSize,crossOrigin:"anonymous",interpolate:e.interpolate,maxZoom:e.maxZoom!==void 0?e.maxZoom:r.maxZoom,minZoom:e.minZoom!==void 0?e.minZoom:r.minZoom,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileLoadFunction:e.tileLoadFunction,transition:e.transition,url:l,tilePixelRatio:a?2:1,wrapX:e.wrapX,zDirection:e.zDirection})}}class d4 extends Gu{constructor(e){e=e||{},super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:e.projection,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,zDirection:e.zDirection}),this.params_=Object.assign({},e.params),this.hidpi_=e.hidpi!==void 0?e.hidpi:!0,this.tmpExtent_=bn(),this.setKey(this.getKeyForParams_())}getKeyForParams_(){let e=0;const t=[];for(const n in this.params_)t[e++]=n+"-"+this.params_[n];return t.join("/")}getParams(){return this.params_}getRequestUrl_(e,t,n,r,s,o){const a=this.urls;if(!a)return;let l;if(a.length==1)l=a[0];else{const c=Js(Ax(e),a.length);l=a[c]}return j7(l,n,(this.tileGrid||this.getTileGridForProjection(s)).getResolution(e[0]),r,s,o)}getTilePixelRatio(e){return this.hidpi_?e:1}setParams(e){this.params_=Object.assign({},e),this.setKey(this.getKeyForParams_())}updateParams(e){Object.assign(this.params_,e),this.setKey(this.getKeyForParams_())}tileUrlFunction(e,t,n){let r=this.getTileGrid();if(r||(r=this.getTileGridForProjection(n)),r.getResolutions().length<=e[0])return;t!=1&&!this.hidpi_&&(t=1);const s=r.getTileCoordExtent(e,this.tmpExtent_);let o=Hi(r.getTileSize(e[0]),this.tmpSize);t!=1&&(o=mL(o,t,this.tmpSize));const a={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};return Object.assign(a,this.params_),this.getRequestUrl_(e,o,s,t,n,a)}}class g4 extends W7{constructor(e){e=e||{};const t=e.template||"z:{z} x:{x} y:{y}",n=e.source,r=e.color||"grey";super({transition:0,wrapX:e.wrapX!==void 0?e.wrapX:n!==void 0?n.getWrapX():void 0});const s=()=>{this.projection=e.projection!==void 0?Mt(e.projection):n!==void 0?n.getProjection():this.projection,this.tileGrid=e.tileGrid!==void 0?e.tileGrid:n!==void 0?n.getTileGrid():this.tileGrid,this.zDirection=e.zDirection!==void 0?e.zDirection:n!==void 0?n.zDirection:this.zDirection,n instanceof Dx&&(this.transformMatrix=n.transformMatrix?.slice()||null);const o=this.tileGrid;o&&this.setTileSizes(o.getResolutions().map((a,l)=>Hi(o.getTileSize(l)).map(c=>Math.max(Math.floor(c),1)))),this.setLoader((a,l,c,h)=>{const u=Px(t,a,l,c,h.maxY),[f,d]=this.getTileSize(a),g=Xi(f,d);return g.strokeStyle=r,g.strokeRect(.5,.5,f+.5,d+.5),g.fillStyle=r,g.strokeStyle="white",g.textAlign="center",g.textBaseline="middle",g.font="24px sans-serif",g.lineWidth=4,g.strokeText(u,f/2,d/2,f),g.fillText(u,f/2,d/2,f),Promise.resolve(g.canvas)}),this.setState("ready")};if(n===void 0||n.getState()==="ready")s();else{const o=()=>{n.getState()==="ready"&&(n.removeEventListener(Qe.CHANGE,o),s())};n.addEventListener(Qe.CHANGE,o)}}}class p4 extends Gu{constructor(e){if(super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:Mt("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:"loading",tileLoadFunction:e.tileLoadFunction,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,zDirection:e.zDirection}),this.tileJSON_=null,this.tileSize_=e.tileSize,e.url)if(e.jsonp)Z7(e.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const t=new XMLHttpRequest;t.addEventListener("load",this.onXHRLoad_.bind(this)),t.addEventListener("error",this.onXHRError_.bind(this)),t.open("GET",e.url),t.send()}else if(e.tileJSON)this.handleTileJSONResponse(e.tileJSON);else throw new Error("Either `url` or `tileJSON` options must be provided")}onXHRLoad_(e){const t=e.target;if(!t.status||t.status>=200&&t.status<300){let n;try{n=JSON.parse(t.responseText)}catch{this.handleTileJSONError();return}this.handleTileJSONResponse(n)}else this.handleTileJSONError()}onXHRError_(e){this.handleTileJSONError()}getTileJSON(){return this.tileJSON_}handleTileJSONResponse(e){const t=Mt("EPSG:4326"),n=this.getProjection();let r;if(e.bounds!==void 0){const c=Wc(t,n);r=bu(e.bounds,c)}const s=Yc(n),o=e.minzoom||0,a=e.maxzoom||22,l=ku({extent:s,maxZoom:a,minZoom:o,tileSize:this.tileSize_});if(this.tileGrid=l,this.tileUrlFunction=OL(e.tiles,l),e.attribution&&!this.getAttributions()){const c=r!==void 0?r:s;this.setAttributions(function(h){return Ei(c,h.extent)?[e.attribution]:null})}this.tileJSON_=e,this.setState("ready")}handleTileJSONError(){this.setState("error")}}class vC extends Gu{constructor(e){e=e||{};const t=Object.assign({},e.params);super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:e.projection,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileClass:e.tileClass,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0,this.params_=t,this.v13_=!0,this.serverType_=e.serverType,this.hidpi_=e.hidpi!==void 0?e.hidpi:!0,this.tmpExtent_=bn(),this.updateV13_(),this.setKey(this.getKeyForParams_())}getFeatureInfoUrl(e,t,n,r){const s=Mt(n),o=this.getProjection()||s;let a=this.getTileGrid();a||(a=this.getTileGridForProjection(o));const l=ro(e,s,o),c=Od(o,s,e,t),h=a.getZForResolution(c,this.zDirection),u=a.getResolution(h),f=a.getTileCoordForCoordAndZ(l,h);if(a.getResolutions().length<=f[0])return;let d=a.getTileCoordExtent(f,this.tmpExtent_);const g=this.gutter_;g!==0&&(d=Zn(d,u*g,d));const m={QUERY_LAYERS:this.params_.LAYERS};Object.assign(m,j0(this.params_,"GetFeatureInfo"),r);const _=Math.floor((l[0]-d[0])/u),v=Math.floor((d[3]-l[1])/u);return m[this.v13_?"I":"X"]=_,m[this.v13_?"J":"Y"]=v,this.getRequestUrl_(f,d,1,o||s,m)}getLegendUrl(e,t){if(this.urls[0]===void 0)return;const n={SERVICE:"WMS",VERSION:B0,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(t===void 0||t.LAYER===void 0){const r=this.params_.LAYERS;if(!(!Array.isArray(r)||r.length===1))return;n.LAYER=r}if(e!==void 0){const r=this.getProjection()?this.getProjection().getMetersPerUnit():1,s=28e-5;n.SCALE=e*r/s}return Object.assign(n,t),Cu(this.urls[0],n)}getGutter(){return this.gutter_}getParams(){return this.params_}getRequestUrl_(e,t,n,r,s){const o=this.urls;if(!o)return;let a;if(o.length==1)a=o[0];else{const l=Js(Ax(e),o.length);a=o[l]}return fC(t,(this.tileGrid||this.getTileGridForProjection(r)).getResolution(e[0]),n,r,a,s,this.serverType_)}getTilePixelRatio(e){return!this.hidpi_||this.serverType_===void 0?1:e}getKeyForParams_(){let e=0;const t=[];for(const n in this.params_)t[e++]=n+"-"+this.params_[n];return t.join("/")}setParams_(e){this.params_=e,this.updateV13_(),this.setKey(this.getKeyForParams_())}setParams(e){this.setParams_(Object.assign({},e))}updateParams(e){this.setParams_(Object.assign(this.params_,e))}updateV13_(){const e=this.params_.VERSION||B0;this.v13_=jv(e,"1.3")>=0}tileUrlFunction(e,t,n){let r=this.getTileGrid();if(r||(r=this.getTileGridForProjection(n)),r.getResolutions().length<=e[0])return;t!=1&&(!this.hidpi_||this.serverType_===void 0)&&(t=1);const s=r.getResolution(e[0]);let o=r.getTileCoordExtent(e,this.tmpExtent_);const a=this.gutter_;a!==0&&(o=Zn(o,s*a,o));const l=Object.assign({},j0(this.params_,"GetMap"));return this.getRequestUrl_(e,o,t,n,l)}}class xC extends Gu{constructor(e){const t=e.requestEncoding!==void 0?e.requestEncoding:"KVP",n=e.tileGrid;let r=e.urls;r===void 0&&e.url!==void 0&&(r=Mx(e.url)),super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:e.projection,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileClass:e.tileClass,tileGrid:n,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,urls:r,wrapX:e.wrapX!==void 0?e.wrapX:!1,transition:e.transition,zDirection:e.zDirection}),this.version_=e.version!==void 0?e.version:"1.0.0",this.format_=e.format!==void 0?e.format:"image/jpeg",this.dimensions_=e.dimensions!==void 0?e.dimensions:{},this.layer_=e.layer,this.matrixSet_=e.matrixSet,this.style_=e.style,this.requestEncoding_=t,this.setKey(this.getKeyForDimensions_()),r&&r.length>0&&(this.tileUrlFunction=N0(r.map(this.createFromWMTSTemplate.bind(this))))}setUrls(e){this.urls=e;const t=e.join(`
86
- `);this.setTileUrlFunction(N0(e.map(this.createFromWMTSTemplate.bind(this))),t)}getDimensions(){return this.dimensions_}getFormat(){return this.format_}getLayer(){return this.layer_}getMatrixSet(){return this.matrixSet_}getRequestEncoding(){return this.requestEncoding_}getStyle(){return this.style_}getVersion(){return this.version_}getKeyForDimensions_(){const e=this.urls?this.urls.slice(0):[];for(const t in this.dimensions_)e.push(t+"-"+this.dimensions_[t]);return e.join("/")}updateDimensions(e){Object.assign(this.dimensions_,e),this.setKey(this.getKeyForDimensions_())}createFromWMTSTemplate(e){const t=this.requestEncoding_,n={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};t=="KVP"&&Object.assign(n,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),e=t=="KVP"?Cu(e,n):e.replace(/\{(\w+?)\}/g,function(o,a){return a.toLowerCase()in n?n[a.toLowerCase()]:o});const r=this.tileGrid,s=this.dimensions_;return(function(o,a,l){if(!o)return;const c={TileMatrix:r.getMatrixId(o[0]),TileCol:o[1],TileRow:o[2]};Object.assign(c,s);let h=e;return t=="KVP"?h=Cu(h,c):h=h.replace(/\{(\w+?)\}/g,function(u,f){return encodeURIComponent(c[f])}),h})}}function m4(i,e){const n=i.Contents.Layer?.find(function(C){return C.Identifier==e.layer});if(!n)return null;const r=i.Contents.TileMatrixSet;let s;n.TileMatrixSetLink.length>1?"projection"in e?s=n.TileMatrixSetLink.findIndex(function(C){const W=r.find(function(V){return V.Identifier==C.TileMatrixSet}).SupportedCRS,$=Mt(W),B=Mt(e.projection);return $&&B?mn($,B):W==e.projection}):s=n.TileMatrixSetLink.findIndex(function(C){return C.TileMatrixSet==e.matrixSet}):s=0,s<0&&(s=0);const o=n.TileMatrixSetLink[s].TileMatrixSet,a=n.TileMatrixSetLink[s].TileMatrixSetLimits;let l=n.Format[0];"format"in e&&(l=e.format),s=n.Style.findIndex(function(C){return"style"in e?C.Title==e.style:C.isDefault}),s<0&&(s=0);const c=n.Style[s].Identifier,h={};"Dimension"in n&&n.Dimension.forEach(function(C,D,W){const $=C.Identifier;let B=C.Default;B===void 0&&(B=C.Value[0]),h[$]=B});const f=i.Contents.TileMatrixSet.find(function(C){return C.Identifier==o});let d;const g=f.SupportedCRS;if(g&&(d=Mt(g)),"projection"in e){const C=Mt(e.projection);C&&(!d||mn(C,d))&&(d=C)}let m=!1;const _=d.getAxisOrientation().startsWith("ne");let v=f.TileMatrix[0],x={MinTileCol:0,MinTileRow:0,MaxTileCol:v.MatrixWidth-1,MaxTileRow:v.MatrixHeight-1};if(a){x=a[a.length-1];const C=f.TileMatrix.find(D=>D.Identifier===x.TileMatrix||f.Identifier+":"+D.Identifier===x.TileMatrix);C&&(v=C)}const S=n.BoundingBox?.find(C=>Mt(C.crs)&&mn(Mt(C.crs),d)),b=v.ScaleDenominator*28e-5/d.getMetersPerUnit(),A=_?[v.TopLeftCorner[1],v.TopLeftCorner[0]]:v.TopLeftCorner,F=v.TileWidth*b,N=v.TileHeight*b;let R=S?.extent??f.BoundingBox;R&&_&&(R=[R[1],R[0],R[3],R[2]]);let P=[A[0]+F*x.MinTileCol,A[1]-N*(1+x.MaxTileRow),A[0]+F*(1+x.MaxTileCol),A[1]-N*x.MinTileRow];if(R!==void 0&&!gs(R,P)){const C=n.WGS84BoundingBox,D=Mt("EPSG:4326").getExtent();if(P=R,C)m=C[0]===D[0]&&C[2]===D[2];else{const W=Mc(R,f.SupportedCRS,"EPSG:4326");m=W[0]-1e-10<=D[0]&&W[2]+1e-10>=D[2]}}const O=mO(f,P,a),L=[];let T=e.requestEncoding;if(T=T!==void 0?T:"","OperationsMetadata"in i&&"GetTile"in i.OperationsMetadata){const C=i.OperationsMetadata.GetTile.DCP.HTTP.Get;for(let D=0,W=C.length;D<W;++D)if(C[D].Constraint){const B=C[D].Constraint.find(function(V){return V.name=="GetEncoding"}).AllowedValues.Value;if(T===""&&(T=B[0]),T==="KVP")B.includes("KVP")&&L.push(C[D].href);else break}else C[D].href&&(T="KVP",L.push(C[D].href))}return L.length===0&&(T="REST",n.ResourceURL.forEach(function(C){C.resourceType==="tile"&&(l=C.format,L.push(C.template))})),{urls:L,layer:e.layer,matrixSet:o,format:l,projection:d,requestEncoding:T,tileGrid:O,style:c,dimensions:h,wrapX:m,crossOrigin:e.crossOrigin}}class wC{drawCustom(e,t,n,r,s){}drawGeometry(e){}setStyle(e){}drawCircle(e,t,n){}drawFeature(e,t,n){}drawGeometryCollection(e,t,n){}drawLineString(e,t,n){}drawMultiLineString(e,t,n){}drawMultiPoint(e,t,n){}drawMultiPolygon(e,t,n){}drawPoint(e,t,n){}drawPolygon(e,t,n){}drawText(e,t,n){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}}const pt={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},gp=[pt.FILL],Tl=[pt.STROKE],Cc=[pt.BEGIN_PATH],lE=[pt.CLOSE_PATH];class og extends wC{constructor(e,t,n,r){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=r,this.maxLineWidth=0,this.resolution=n,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(e){const t=this.pixelRatio;return t==1?e:e.map(function(n){return n*t})}appendFlatPointCoordinates(e,t){const n=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,s=this.coordinates;let o=s.length;for(let a=0,l=e.length;a<l;a+=t)r[0]=e[a],r[1]=e[a+1],Hr(n,r)&&(s[o++]=r[0],s[o++]=r[1]);return o}appendFlatLineCoordinates(e,t,n,r,s,o){const a=this.coordinates;let l=a.length;const c=this.getBufferedMaxExtent();o&&(t+=r);let h=e[t],u=e[t+1];const f=this.tmpCoordinate_;let d=!0,g,m,_;for(g=t+r;g<n;g+=r)f[0]=e[g],f[1]=e[g+1],_=_y(c,f),_!==m?(d&&(a[l++]=h,a[l++]=u,d=!1),a[l++]=f[0],a[l++]=f[1]):_===Wn.INTERSECTING?(a[l++]=f[0],a[l++]=f[1],d=!1):d=!0,h=f[0],u=f[1],m=_;return(s&&d||g===t+r)&&(a[l++]=h,a[l++]=u),l}drawCustomCoordinates_(e,t,n,r,s){for(let o=0,a=n.length;o<a;++o){const l=n[o],c=this.appendFlatLineCoordinates(e,t,l,r,!1,!1);s.push(c),t=l}return t}drawCustom(e,t,n,r,s){this.beginGeometry(e,t,s);const o=e.getType(),a=e.getStride(),l=this.coordinates.length;let c,h,u,f,d;switch(o){case"MultiPolygon":c=e.getOrientedFlatCoordinates(),f=[];const g=e.getEndss();d=0;for(let m=0,_=g.length;m<_;++m){const v=[];d=this.drawCustomCoordinates_(c,d,g[m],a,v),f.push(v)}this.instructions.push([pt.CUSTOM,l,f,e,n,Sy,s]),this.hitDetectionInstructions.push([pt.CUSTOM,l,f,e,r||n,Sy,s]);break;case"Polygon":case"MultiLineString":u=[],c=o=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),d=this.drawCustomCoordinates_(c,0,e.getEnds(),a,u),this.instructions.push([pt.CUSTOM,l,u,e,n,Ld,s]),this.hitDetectionInstructions.push([pt.CUSTOM,l,u,e,r||n,Ld,s]);break;case"LineString":case"Circle":c=e.getFlatCoordinates(),h=this.appendFlatLineCoordinates(c,0,c.length,a,!1,!1),this.instructions.push([pt.CUSTOM,l,h,e,n,bl,s]),this.hitDetectionInstructions.push([pt.CUSTOM,l,h,e,r||n,bl,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),h=this.appendFlatPointCoordinates(c,a),h>l&&(this.instructions.push([pt.CUSTOM,l,h,e,n,bl,s]),this.hitDetectionInstructions.push([pt.CUSTOM,l,h,e,r||n,bl,s]));break;case"Point":c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),h=this.coordinates.length,this.instructions.push([pt.CUSTOM,l,h,e,n,void 0,s]),this.hitDetectionInstructions.push([pt.CUSTOM,l,h,e,r||n,void 0,s]);break}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[pt.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[pt.BEGIN_GEOMETRY,t,0,e,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const e=this.hitDetectionInstructions;e.reverse();let t;const n=e.length;let r,s,o=-1;for(t=0;t<n;++t)r=e[t],s=r[0],s==pt.END_GEOMETRY?o=t:s==pt.BEGIN_GEOMETRY&&(r[2]=t,U8(this.hitDetectionInstructions,o,t),o=-1)}fillStyleToState(e,t={}){if(e){const n=e.getColor();t.fillPatternScale=n&&typeof n=="object"&&"src"in n?this.pixelRatio:1,t.fillStyle=Fo(n||qr)}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){const n=e.getColor();t.strokeStyle=Fo(n||Md);const r=e.getLineCap();t.lineCap=r!==void 0?r:Tu;const s=e.getLineDash();t.lineDash=s?s.slice():Fa;const o=e.getLineDashOffset();t.lineDashOffset=o||Oa;const a=e.getLineJoin();t.lineJoin=a!==void 0?a:Lu;const l=e.getWidth();t.lineWidth=l!==void 0?l:Id;const c=e.getMiterLimit();t.miterLimit=c!==void 0?c:Pd,t.lineWidth>this.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0;return t}setFillStrokeStyle(e,t){const n=this.state;this.fillStyleToState(e,n),this.strokeStyleToState(t,n)}createFill(e){const t=e.fillStyle,n=[pt.SET_FILL_STYLE,t];return typeof t!="string"&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[pt.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){const n=e.fillStyle;(typeof n!="string"||e.currentFillStyle!=n)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=n)}updateStrokeStyle(e,t){const n=e.strokeStyle,r=e.lineCap,s=e.lineDash,o=e.lineDashOffset,a=e.lineJoin,l=e.lineWidth,c=e.miterLimit;(e.currentStrokeStyle!=n||e.currentLineCap!=r||s!=e.currentLineDash&&!Ho(e.currentLineDash,s)||e.currentLineDashOffset!=o||e.currentLineJoin!=a||e.currentLineWidth!=l||e.currentMiterLimit!=c)&&(t.call(this,e),e.currentStrokeStyle=n,e.currentLineCap=r,e.currentLineDash=s,e.currentLineDashOffset=o,e.currentLineJoin=a,e.currentLineWidth=l,e.currentMiterLimit=c)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const t=[pt.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=PT(this.maxExtent),this.maxLineWidth>0)){const e=this.resolution*(this.maxLineWidth+1)/2;Zn(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class _4 extends og{constructor(e,t,n,r){super(e,t,n,r),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(e,t,n){if(!this.image_||this.maxExtent&&!Hr(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,n);const r=e.getFlatCoordinates(),s=e.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,s);this.instructions.push([pt.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([pt.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}drawMultiPoint(e,t,n){if(!this.image_)return;this.beginGeometry(e,t,n);const r=e.getFlatCoordinates(),s=[];for(let l=0,c=r.length;l<c;l+=e.getStride())(!this.maxExtent||Hr(this.maxExtent,r.slice(l,l+2)))&&s.push(r[l],r[l+1]);const o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,2);this.instructions.push([pt.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([pt.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(e,t){const n=e.getAnchor(),r=e.getSize(),s=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=r[1],this.opacity_=e.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=r[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}}class y4 extends og{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinates_(e,t,n,r){const s=this.coordinates.length,o=this.appendFlatLineCoordinates(e,t,n,r,!1,!1),a=[pt.MOVE_TO_LINE_TO,s,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),n}drawLineString(e,t,n){const r=this.state,s=r.strokeStyle,o=r.lineWidth;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([pt.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Fa,Oa],Cc);const a=e.getFlatCoordinates(),l=e.getStride();this.drawFlatCoordinates_(a,0,a.length,l),this.hitDetectionInstructions.push(Tl),this.endGeometry(t)}drawMultiLineString(e,t,n){const r=this.state,s=r.strokeStyle,o=r.lineWidth;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([pt.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Fa,Oa],Cc);const a=e.getEnds(),l=e.getFlatCoordinates(),c=e.getStride();let h=0;for(let u=0,f=a.length;u<f;++u)h=this.drawFlatCoordinates_(l,h,a[u],c);this.hitDetectionInstructions.push(Tl),this.endGeometry(t)}finish(){const e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(Tl),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(Tl),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(Cc)}}class cE extends og{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinatess_(e,t,n,r){const s=this.state,o=s.fillStyle!==void 0,a=s.strokeStyle!==void 0,l=n.length;this.instructions.push(Cc),this.hitDetectionInstructions.push(Cc);for(let c=0;c<l;++c){const h=n[c],u=this.coordinates.length,f=this.appendFlatLineCoordinates(e,t,h,r,!0,!a),d=[pt.MOVE_TO_LINE_TO,u,f];this.instructions.push(d),this.hitDetectionInstructions.push(d),a&&(this.instructions.push(lE),this.hitDetectionInstructions.push(lE)),t=h}return o&&(this.instructions.push(gp),this.hitDetectionInstructions.push(gp)),a&&(this.instructions.push(Tl),this.hitDetectionInstructions.push(Tl)),t}drawCircle(e,t,n){const r=this.state,s=r.fillStyle,o=r.strokeStyle;if(s===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([pt.SET_FILL_STYLE,qr]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([pt.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Fa,Oa]);const a=e.getFlatCoordinates(),l=e.getStride(),c=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const h=[pt.CIRCLE,c];this.instructions.push(Cc,h),this.hitDetectionInstructions.push(Cc,h),r.fillStyle!==void 0&&(this.instructions.push(gp),this.hitDetectionInstructions.push(gp)),r.strokeStyle!==void 0&&(this.instructions.push(Tl),this.hitDetectionInstructions.push(Tl)),this.endGeometry(t)}drawPolygon(e,t,n){const r=this.state,s=r.fillStyle,o=r.strokeStyle;if(s===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([pt.SET_FILL_STYLE,qr]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([pt.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Fa,Oa]);const a=e.getEnds(),l=e.getOrientedFlatCoordinates(),c=e.getStride();this.drawFlatCoordinatess_(l,0,a,c),this.endGeometry(t)}drawMultiPolygon(e,t,n){const r=this.state,s=r.fillStyle,o=r.strokeStyle;if(s===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([pt.SET_FILL_STYLE,qr]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([pt.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Fa,Oa]);const a=e.getEndss(),l=e.getOrientedFlatCoordinates(),c=e.getStride();let h=0;for(let u=0,f=a.length;u<f;++u)h=this.drawFlatCoordinatess_(l,h,a[u],c);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const e=this.tolerance;if(e!==0){const t=this.coordinates;for(let n=0,r=t.length;n<r;++n)t[n]=yc(t[n],e)}return super.finish()}setFillStrokeStyles_(){const e=this.state;this.updateFillStyle(e,this.createFill),this.updateStrokeStyle(e,this.applyStroke)}}function v4(i,e,t,n,r){const s=[];let o=t,a=0,l=e.slice(t,2);for(;a<i&&o+r<n;){const[c,h]=l.slice(-2),u=e[o+r],f=e[o+r+1],d=Math.sqrt((u-c)*(u-c)+(f-h)*(f-h));if(a+=d,a>=i){const g=(i-a+d)/d,m=us(c,u,g),_=us(h,f,g);l.push(m,_),s.push(l),l=[m,_],a==i&&(o+=r),a=0}else if(a<i)l.push(e[o+r],e[o+r+1]),o+=r;else{const g=d-a,m=us(c,u,g/d),_=us(h,f,g/d);l.push(m,_),s.push(l),l=[m,_],a=0,o+=r}}return a>0&&s.push(l),s}function x4(i,e,t,n,r){let s=t,o=t,a=0,l=0,c=t,h,u,f,d,g,m,_,v,x,S;for(u=t;u<n;u+=r){const b=e[u],A=e[u+1];g!==void 0&&(x=b-g,S=A-m,d=Math.sqrt(x*x+S*S),_!==void 0&&(l+=f,h=Math.acos((_*x+v*S)/(f*d)),h>i&&(l>a&&(a=l,s=c,o=u),l=0,c=u-r)),f=d,_=x,v=S),g=b,m=A}return l+=d,l>a?[c,u]:[s,o]}const U0={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class w4 extends og{constructor(e,t,n,r){super(e,t,n,r),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[qr]={fillStyle:qr},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,n){const r=this.textFillState_,s=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!r&&!s)return;const a=this.coordinates;let l=a.length;const c=e.getType();let h=null,u=e.getStride();if(o.placement==="line"&&(c=="LineString"||c=="MultiLineString"||c=="Polygon"||c=="MultiPolygon")){if(!Ei(this.maxExtent,e.getExtent()))return;let f;if(h=e.getFlatCoordinates(),c=="LineString")f=[h.length];else if(c=="MultiLineString")f=e.getEnds();else if(c=="Polygon")f=e.getEnds().slice(0,1);else if(c=="MultiPolygon"){const _=e.getEndss();f=[];for(let v=0,x=_.length;v<x;++v)f.push(_[v][0])}this.beginGeometry(e,t,n);const d=o.repeat,g=d?void 0:o.textAlign;let m=0;for(let _=0,v=f.length;_<v;++_){let x;d?x=v4(d*this.resolution,h,m,f[_],u):x=[h.slice(m,f[_])];for(let S=0,b=x.length;S<b;++S){const A=x[S];let F=0,N=A.length;if(g==null){const P=x4(o.maxAngle,A,0,A.length,2);F=P[0],N=P[1]}for(let P=F;P<N;P+=u)a.push(A[P],A[P+1]);const R=a.length;m=f[_],this.drawChars_(l,R),l=R}}this.endGeometry(t)}else{let f=o.overflow?null:[];switch(c){case"Point":case"MultiPoint":h=e.getFlatCoordinates();break;case"LineString":h=e.getFlatMidpoint();break;case"Circle":h=e.getCenter();break;case"MultiLineString":h=e.getFlatMidpoints(),u=2;break;case"Polygon":h=e.getFlatInteriorPoint(),o.overflow||f.push(h[2]/this.resolution),u=3;break;case"MultiPolygon":const b=e.getFlatInteriorPoints();h=[];for(let A=0,F=b.length;A<F;A+=3)o.overflow||f.push(b[A+2]/this.resolution),h.push(b[A],b[A+1]);if(h.length===0)return;u=2;break}const d=this.appendFlatPointCoordinates(h,u);if(d===l)return;if(f&&(d-l)/2!==h.length/u){let b=l/2;f=f.filter((A,F)=>{const N=a[(b+F)*2]===h[F*u]&&a[(b+F)*2+1]===h[F*u+1];return N||--b,N})}this.saveTextStates_();const g=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,m=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(e,t,n);let _=o.padding;if(_!=Lc&&(o.scale[0]<0||o.scale[1]<0)){let b=o.padding[0],A=o.padding[1],F=o.padding[2],N=o.padding[3];o.scale[0]<0&&(A=-A,N=-N),o.scale[1]<0&&(b=-b,F=-F),_=[b,A,F,N]}const v=this.pixelRatio;this.instructions.push([pt.DRAW_IMAGE,l,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,_==Lc?Lc:_.map(function(b){return b*v}),g,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,f]);const x=1/v,S=g?g.slice(0):null;S&&(S[1]=qr),this.hitDetectionInstructions.push([pt.DRAW_IMAGE,l,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[x,x],NaN,this.declutterMode_,this.declutterImageWithText_,_,S,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?qr:this.fillKey_,this.textOffsetX_,this.textOffsetY_,f]),this.endGeometry(t)}}saveTextStates_(){const e=this.textStrokeState_,t=this.textState_,n=this.textFillState_,r=this.strokeKey_;e&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));const s=this.textKey_;s in this.textStates||(this.textStates[s]={font:t.font,textAlign:t.textAlign||Rd,justify:t.justify,textBaseline:t.textBaseline||P0,scale:t.scale});const o=this.fillKey_;n&&(o in this.fillStates||(this.fillStates[o]={fillStyle:n.fillStyle}))}drawChars_(e,t){const n=this.textStrokeState_,r=this.textState_,s=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,c=U0[r.textBaseline],h=this.textOffsetY_*l,u=this.text_,f=n?n.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([pt.DRAW_CHARS,e,t,c,r.overflow,a,r.maxAngle,l,h,s,f*l,u,o,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([pt.DRAW_CHARS,e,t,c,r.overflow,a&&qr,r.maxAngle,l,h,s,f*l,u,o,1/l,this.declutterMode_,this.textKeepUpright_])}setTextStyle(e,t){let n,r,s;if(!e)this.text_="";else{const o=e.getFill();o?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=Fo(o.getColor()||qr)):(r=null,this.textFillState_=r);const a=e.getStroke();if(!a)s=null,this.textStrokeState_=s;else{s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);const m=a.getLineDash(),_=a.getLineDashOffset(),v=a.getWidth(),x=a.getMiterLimit();s.lineCap=a.getLineCap()||Tu,s.lineDash=m?m.slice():Fa,s.lineDashOffset=_===void 0?Oa:_,s.lineJoin=a.getLineJoin()||Lu,s.lineWidth=v===void 0?Id:v,s.miterLimit=x===void 0?Pd:x,s.strokeStyle=Fo(a.getColor()||Md)}n=this.textState_;const l=e.getFont()||wL;zF(l);const c=e.getScaleArray();n.overflow=e.getOverflow(),n.font=l,n.maxAngle=e.getMaxAngle(),n.placement=e.getPlacement(),n.textAlign=e.getTextAlign(),n.repeat=e.getRepeat(),n.justify=e.getJustify(),n.textBaseline=e.getTextBaseline()||P0,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||Lc,n.scale=c===void 0?[1,1]:c;const h=e.getOffsetX(),u=e.getOffsetY(),f=e.getRotateWithView(),d=e.getKeepUpright(),g=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=h===void 0?0:h,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=f===void 0?!1:f,this.textKeepUpright_=d===void 0?!0:d,this.textRotation_=g===void 0?0:g,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:Ue(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=n.font+n.scale+(n.textAlign||"?")+(n.repeat||"?")+(n.justify||"?")+(n.textBaseline||"?"),this.fillKey_=r&&r.fillStyle?typeof r.fillStyle=="string"?r.fillStyle:"|"+Ue(r.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}}const b4={Circle:cE,Default:og,Image:_4,LineString:y4,Polygon:cE,Text:w4};class bC{constructor(e,t,n,r){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=r,this.resolution_=n,this.buildersByZIndex_={}}finish(){const e={};for(const t in this.buildersByZIndex_){e[t]=e[t]||{};const n=this.buildersByZIndex_[t];for(const r in n){const s=n[r].finish();e[t][r]=s}}return e}getBuilder(e,t){const n=e!==void 0?e.toString():"0";let r=this.buildersByZIndex_[n];r===void 0&&(r={},this.buildersByZIndex_[n]=r);let s=r[t];if(s===void 0){const o=b4[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}}function E4(i,e,t,n,r,s,o,a,l,c,h,u,f=!0){let d=i[e],g=i[e+1],m=0,_=0,v=0,x=0;function S(){m=d,_=g,e+=n,d=i[e],g=i[e+1],x+=v,v=Math.sqrt((d-m)*(d-m)+(g-_)*(g-_))}do S();while(e<t-n&&x+v<s);let b=v===0?0:(s-x)/v;const A=us(m,d,b),F=us(_,g,b),N=e-n,R=x,P=s+a*l(c,r,h);for(;e<t-n&&x+v<P;)S();b=v===0?0:(P-x)/v;const O=us(m,d,b),L=us(_,g,b);let T=!1;if(f)if(u){const B=[A,F,O,L];Yv(B,0,4,2,u,B,B),T=B[0]>B[2]}else T=A>O;const C=Math.PI,D=[],W=N+n===e;e=N,v=0,x=R,d=i[e],g=i[e+1];let $;if(W){S(),$=Math.atan2(g-_,d-m),T&&($+=$>0?-C:C);const B=(O+A)/2,V=(L+F)/2;return D[0]=[B,V,(P-s)/2,$,r],D}r=r.replace(/\n/g," ");for(let B=0,V=r.length;B<V;){S();let te=Math.atan2(g-_,d-m);if(T&&(te+=te>0?-C:C),$!==void 0){let ie=te-$;if(ie+=ie>C?-2*C:ie<-C?2*C:0,Math.abs(ie)>o)return null}$=te;const ne=B;let ae=0;for(;B<V;++B){const ie=T?V-B-1:B,re=a*l(c,r[ie],h);if(e+n<t&&x+v<s+ae+re/2)break;ae+=re}if(B===ne)continue;const I=T?r.substring(V-ne,V-B):r.substring(ne,B);b=v===0?0:(s+ae/2-x)/v;const U=us(m,d,b),K=us(_,g,b);D.push([U,K,ae/2,te,I]),s+=ae}return D}const Th=bn(),gl=[],ma=[],_a=[],pl=[];function hE(i){return i[3].declutterBox}const uE=new RegExp("[֑-ࣿיִ-﷿ﹰ-ﻼࠀ-࿿-]");function m_(i,e){return e==="start"?e=uE.test(i)?"right":"left":e==="end"&&(e=uE.test(i)?"left":"right"),U0[e]}function S4(i,e,t){return t>0&&i.push(`
87
- `,""),i.push(e,""),i}function T4(i,e,t){return t%2===0&&(i+=e),i}class L4{constructor(e,t,n,r,s){this.overlaps=n,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=nn(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=s?new Xx:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,n,r){const s=e+t+n+r;if(this.labels_[s])return this.labels_[s];const o=r?this.strokeStates[r]:null,a=n?this.fillStates[n]:null,l=this.textStates[t],c=this.pixelRatio,h=[l.scale[0]*c,l.scale[1]*c],u=l.justify?U0[l.justify]:m_(Array.isArray(e)?e[0]:e,l.textAlign||Rd),f=r&&o.lineWidth?o.lineWidth:0,d=Array.isArray(e)?e:String(e).split(`
88
- `).reduce(S4,[]),{width:g,height:m,widths:_,heights:v,lineWidths:x}=VF(l,d),S=g+f,b=[],A=(S+2)*h[0],F=(m+f)*h[1],N={width:A<0?Math.floor(A):Math.ceil(A),height:F<0?Math.floor(F):Math.ceil(F),contextInstructions:b};(h[0]!=1||h[1]!=1)&&b.push("scale",h),r&&(b.push("strokeStyle",o.strokeStyle),b.push("lineWidth",f),b.push("lineCap",o.lineCap),b.push("lineJoin",o.lineJoin),b.push("miterLimit",o.miterLimit),b.push("setLineDash",[o.lineDash]),b.push("lineDashOffset",o.lineDashOffset)),n&&b.push("fillStyle",a.fillStyle),b.push("textBaseline","middle"),b.push("textAlign","center");const R=.5-u;let P=u*S+R*f;const O=[],L=[];let T=0,C=0,D=0,W=0,$;for(let B=0,V=d.length;B<V;B+=2){const te=d[B];if(te===`
89
- `){C+=T,T=0,P=u*S+R*f,++W;continue}const ne=d[B+1]||l.font;ne!==$&&(r&&O.push("font",ne),n&&L.push("font",ne),$=ne),T=Math.max(T,v[D]);const ae=[te,P+R*_[D]+u*(_[D]-x[W]),.5*(f+T)+C];P+=_[D],r&&O.push("strokeText",ae),n&&L.push("fillText",ae),++D}return Array.prototype.push.apply(b,O),Array.prototype.push.apply(b,L),this.labels_[s]=N,N}replayTextBackground_(e,t,n,r,s,o,a){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,n),e.lineTo.apply(e,r),e.lineTo.apply(e,s),e.lineTo.apply(e,t),o&&(this.alignAndScaleFill_=o[2],e.fillStyle=o[1],this.fill_(e)),a&&(this.setStrokeStyle_(e,a),e.stroke())}calculateImageOrLabelDimensions_(e,t,n,r,s,o,a,l,c,h,u,f,d,g,m,_){a*=f[0],l*=f[1];let v=n-a,x=r-l;const S=s+c>e?e-c:s,b=o+h>t?t-h:o,A=g[3]+S*f[0]+g[1],F=g[0]+b*f[1]+g[2],N=v-g[3],R=x-g[0];(m||u!==0)&&(gl[0]=N,pl[0]=N,gl[1]=R,ma[1]=R,ma[0]=N+A,_a[0]=ma[0],_a[1]=R+F,pl[1]=_a[1]);let P;return u!==0?(P=_s(nn(),n,r,1,1,u,-n,-r),Fi(P,gl),Fi(P,ma),Fi(P,_a),Fi(P,pl),qo(Math.min(gl[0],ma[0],_a[0],pl[0]),Math.min(gl[1],ma[1],_a[1],pl[1]),Math.max(gl[0],ma[0],_a[0],pl[0]),Math.max(gl[1],ma[1],_a[1],pl[1]),Th)):qo(Math.min(N,N+A),Math.min(R,R+F),Math.max(N,N+A),Math.max(R,R+F),Th),d&&(v=Math.round(v),x=Math.round(x)),{drawImageX:v,drawImageY:x,drawImageW:S,drawImageH:b,originX:c,originY:h,declutterBox:{minX:Th[0],minY:Th[1],maxX:Th[2],maxY:Th[3],value:_},canvasTransform:P,scale:f}}replayImageOrLabel_(e,t,n,r,s,o,a){const l=!!(o||a),c=r.declutterBox,h=a?a[2]*r.scale[0]/2:0;return c.minX-h<=t[0]&&c.maxX+h>=0&&c.minY-h<=t[1]&&c.maxY+h>=0&&(l&&this.replayTextBackground_(e,gl,ma,_a,pl,o,a),$F(e,r.canvasTransform,s,n,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(e){const t=this.alignAndScaleFill_;if(t){const n=Fi(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;e.save(),e.translate(n[0]%r,n[1]%r),t!==1&&e.scale(t,t),e.rotate(this.viewRotation_)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],t[1]&&(e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6]))}drawLabelWithPointPlacement_(e,t,n,r){const s=this.textStates[t],o=this.createLabel(e,t,r,n),a=this.strokeStates[n],l=this.pixelRatio,c=m_(Array.isArray(e)?e[0]:e,s.textAlign||Rd),h=U0[s.textBaseline||P0],u=a&&a.lineWidth?a.lineWidth:0,f=o.width/l-2*s.scale[0],d=c*f+2*(.5-c)*u,g=h*o.height/l+2*(.5-h)*u;return{label:o,anchorX:d,anchorY:g}}execute_(e,t,n,r,s,o,a,l){const c=this.zIndexContext_;let h;this.pixelCoordinates_&&Ho(n,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=jo(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),zT(this.renderedTransform_,n));let u=0;const f=r.length;let d=0,g,m,_,v,x,S,b,A,F,N,R,P,O,L=0,T=0;const C=this.coordinateCache_,D=this.viewRotation_,W=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,$={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:D},B=this.instructions!=r||this.overlaps?0:200;let V,te,ne,ae;for(;u<f;){const I=r[u];switch(I[0]){case pt.BEGIN_GEOMETRY:V=I[1],ae=I[3],V.getGeometry()?a!==void 0&&!Ei(a,ae.getExtent())?u=I[2]+1:++u:u=I[2],c&&(c.zIndex=I[4]);break;case pt.BEGIN_PATH:L>B&&(this.fill_(e),L=0),T>B&&(e.stroke(),T=0),!L&&!T&&(e.beginPath(),x=NaN,S=NaN),++u;break;case pt.CIRCLE:d=I[1];const K=h[d],ie=h[d+1],re=h[d+2],ce=h[d+3],ve=re-K,pe=ce-ie,le=Math.sqrt(ve*ve+pe*pe);e.moveTo(K+le,ie),e.arc(K,ie,le,0,2*Math.PI,!0),++u;break;case pt.CLOSE_PATH:e.closePath(),++u;break;case pt.CUSTOM:d=I[1],g=I[2];const Ce=I[3],H=I[4],Z=I[5];$.geometry=Ce,$.feature=V,u in C||(C[u]=[]);const he=C[u];Z?Z(h,d,g,2,he):(he[0]=h[d],he[1]=h[d+1],he.length=2),c&&(c.zIndex=I[6]),H(he,$),++u;break;case pt.DRAW_IMAGE:d=I[1],g=I[2],F=I[3],m=I[4],_=I[5];let j=I[6];const fe=I[7],Ee=I[8],Le=I[9],ge=I[10];let Te=I[11];const _e=I[12];let Ie=I[13];v=I[14]||"declutter";const Se=I[15];if(!F&&I.length>=20){N=I[19],R=I[20],P=I[21],O=I[22];const En=this.drawLabelWithPointPlacement_(N,R,P,O);F=En.label,I[3]=F;const Ki=I[23];m=(En.anchorX-Ki)*this.pixelRatio,I[4]=m;const rn=I[24];_=(En.anchorY-rn)*this.pixelRatio,I[5]=_,j=F.height,I[6]=j,Ie=F.width,I[13]=Ie}let Ge;I.length>25&&(Ge=I[25]);let Be,je,Ke;I.length>17?(Be=I[16],je=I[17],Ke=I[18]):(Be=Lc,je=null,Ke=null),ge&&W?Te+=D:!ge&&!W&&(Te-=D);let Xe=0;for(;d<g;d+=2){if(Ge&&Ge[Xe++]<Ie/this.pixelRatio)continue;const En=this.calculateImageOrLabelDimensions_(F.width,F.height,h[d],h[d+1],Ie,j,m,_,Ee,Le,Te,_e,s,Be,!!je||!!Ke,V),Ki=[e,t,F,En,fe,je,Ke];if(l){let rn,hn,tt;if(Se){const $t=g-d;if(!Se[$t]){Se[$t]={args:Ki,declutterMode:v};continue}const Si=Se[$t];rn=Si.args,hn=Si.declutterMode,delete Se[$t],tt=hE(rn)}let Fn,On;if(rn&&(hn!=="declutter"||!l.collides(tt))&&(Fn=!0),(v!=="declutter"||!l.collides(En.declutterBox))&&(On=!0),hn==="declutter"&&v==="declutter"){const $t=Fn&&On;Fn=$t,On=$t}Fn&&(hn!=="none"&&l.insert(tt),this.replayImageOrLabel_.apply(this,rn)),On&&(v!=="none"&&l.insert(En.declutterBox),this.replayImageOrLabel_.apply(this,Ki))}else this.replayImageOrLabel_.apply(this,Ki)}++u;break;case pt.DRAW_CHARS:const qe=I[1],st=I[2],$e=I[3],Jt=I[4];O=I[5];const Ot=I[6],Lt=I[7],ht=I[8];P=I[9];const Ut=I[10];N=I[11],Array.isArray(N)&&(N=N.reduce(T4,"")),R=I[12];const ot=[I[13],I[13]];v=I[14]||"declutter";const hi=I[15],dt=this.textStates[R],xt=dt.font,di=[dt.scale[0]*Lt,dt.scale[1]*Lt];let At;xt in this.widths_?At=this.widths_[xt]:(At={},this.widths_[xt]=At);const gt=Ox(h,qe,st,2),ii=Math.abs(di[0])*Cb(xt,N,At);if(Jt||ii<=gt){const En=this.textStates[R].textAlign,Ki=(gt-ii)*m_(N,En),rn=E4(h,qe,st,2,N,Ki,Ot,Math.abs(di[0]),Cb,xt,At,W?0:this.viewRotation_,hi);e:if(rn){const hn=[];let tt,Fn,On,$t,Si;if(P)for(tt=0,Fn=rn.length;tt<Fn;++tt){Si=rn[tt],On=Si[4],$t=this.createLabel(On,R,"",P),m=Si[2]+(di[0]<0?-Ut:Ut),_=$e*$t.height+(.5-$e)*2*Ut*di[1]/di[0]-ht;const si=this.calculateImageOrLabelDimensions_($t.width,$t.height,Si[0],Si[1],$t.width,$t.height,m,_,0,0,Si[3],ot,!1,Lc,!1,V);if(l&&v==="declutter"&&l.collides(si.declutterBox))break e;hn.push([e,t,$t,si,1,null,null])}if(O)for(tt=0,Fn=rn.length;tt<Fn;++tt){Si=rn[tt],On=Si[4],$t=this.createLabel(On,R,O,""),m=Si[2],_=$e*$t.height-ht;const si=this.calculateImageOrLabelDimensions_($t.width,$t.height,Si[0],Si[1],$t.width,$t.height,m,_,0,0,Si[3],ot,!1,Lc,!1,V);if(l&&v==="declutter"&&l.collides(si.declutterBox))break e;hn.push([e,t,$t,si,1,null,null])}l&&v!=="none"&&l.load(hn.map(hE));for(let si=0,Sn=hn.length;si<Sn;++si)this.replayImageOrLabel_.apply(this,hn[si])}}++u;break;case pt.END_GEOMETRY:if(o!==void 0){V=I[1];const En=o(V,ae,v);if(En)return En}++u;break;case pt.FILL:B?L++:this.fill_(e),++u;break;case pt.MOVE_TO_LINE_TO:for(d=I[1],g=I[2],te=h[d],ne=h[d+1],e.moveTo(te,ne),x=te+.5|0,S=ne+.5|0,d+=2;d<g;d+=2)te=h[d],ne=h[d+1],b=te+.5|0,A=ne+.5|0,(d==g-2||b!==x||A!==S)&&(e.lineTo(te,ne),x=b,S=A);++u;break;case pt.SET_FILL_STYLE:this.alignAndScaleFill_=I[2],L&&(this.fill_(e),L=0,T&&(e.stroke(),T=0)),e.fillStyle=I[1],++u;break;case pt.SET_STROKE_STYLE:T&&(e.stroke(),T=0),this.setStrokeStyle_(e,I),++u;break;case pt.STROKE:B?T++:e.stroke(),++u;break;default:++u;break}}L&&this.fill_(e),T&&e.stroke()}execute(e,t,n,r,s,o){this.viewRotation_=r,this.execute_(e,t,n,this.instructions,s,void 0,void 0,o)}executeHitDetection(e,t,n,r,s){return this.viewRotation_=n,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,r,s)}}const bc=["Polygon","Circle","LineString","Image","Text","Default"],z0=["Image","Text"],C4=bc.filter(i=>!z0.includes(i));class EC{constructor(e,t,n,r,s,o,a){this.maxExtent_=e,this.overlaps_=r,this.pixelRatio_=n,this.resolution_=t,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=nn(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(s,a)}clip(e,t){const n=this.getClipCoords(t);e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(n[2],n[3]),e.lineTo(n[4],n[5]),e.lineTo(n[6],n[7]),e.clip()}createExecutors_(e,t){for(const n in e){let r=this.executorsByZIndex_[n];r===void 0&&(r={},this.executorsByZIndex_[n]=r);const s=e[n];for(const o in s){const a=s[o];r[o]=new L4(this.resolution_,this.pixelRatio_,this.overlaps_,a,t)}}}hasExecutors(e){for(const t in this.executorsByZIndex_){const n=this.executorsByZIndex_[t];for(let r=0,s=e.length;r<s;++r)if(e[r]in n)return!0}return!1}forEachFeatureAtCoordinate(e,t,n,r,s,o){r=Math.round(r);const a=r*2+1,l=_s(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=Xi(a,a));const h=this.hitDetectionContext_;h.canvas.width!==a||h.canvas.height!==a?(h.canvas.width=a,h.canvas.height=a):c||h.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=bn(),Kf(u,e),Zn(u,t*(this.renderBuffer_+r),u));const f=A4(r);let d;function g(A,F,N){const R=h.getImageData(0,0,a,a).data;for(let P=0,O=f.length;P<O;P++)if(R[f[P]]>0){if(!o||N==="none"||d!=="Image"&&d!=="Text"||o.includes(A)){const L=(f[P]-3)/4,T=r-L%a,C=r-(L/a|0),D=s(A,F,T*T+C*C);if(D)return D}h.clearRect(0,0,a,a);break}}const m=Object.keys(this.executorsByZIndex_).map(Number);m.sort(Bo);let _,v,x,S,b;for(_=m.length-1;_>=0;--_){const A=m[_].toString();for(x=this.executorsByZIndex_[A],v=bc.length-1;v>=0;--v)if(d=bc[v],S=x[d],S!==void 0&&(b=S.executeHitDetection(h,l,n,g,u),b))return b}}getClipCoords(e){const t=this.maxExtent_;if(!t)return null;const n=t[0],r=t[1],s=t[2],o=t[3],a=[n,r,n,o,s,o,s,r];return jo(a,0,8,2,e,a),a}isEmpty(){return Fc(this.executorsByZIndex_)}execute(e,t,n,r,s,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?CT:Bo),o=o||bc;const c=bc.length;for(let h=0,u=l.length;h<u;++h){const f=l[h].toString(),d=this.executorsByZIndex_[f];for(let g=0,m=o.length;g<m;++g){const _=o[g],v=d[_];if(v!==void 0){const x=a===null?void 0:v.getZIndexContext(),S=x?x.getContext():e,b=this.maxExtent_&&_!=="Image"&&_!=="Text";if(b&&(S.save(),this.clip(S,n)),!x||_==="Text"||_==="Image"?v.execute(S,t,n,r,s,a):x.pushFunction(A=>v.execute(A,t,n,r,s,a)),b&&S.restore(),x){x.offset();const A=l[h]*c+bc.indexOf(_);this.deferredZIndexContexts_[A]||(this.deferredZIndexContexts_[A]=[]),this.deferredZIndexContexts_[A].push(x)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(Bo);for(let n=0,r=t.length;n<r;++n)e[t[n]].forEach(s=>{s.draw(this.renderedContext_),s.clear()}),e[t[n]].length=0}}const __={};function A4(i){if(__[i]!==void 0)return __[i];const e=i*2+1,t=i*i,n=new Array(t+1);for(let s=0;s<=i;++s)for(let o=0;o<=i;++o){const a=s*s+o*o;if(a>t)break;let l=n[a];l||(l=[],n[a]=l),l.push(((i+s)*e+(i+o))*4+3),s>0&&l.push(((i-s)*e+(i+o))*4+3),o>0&&(l.push(((i+s)*e+(i-o))*4+3),s>0&&l.push(((i-s)*e+(i-o))*4+3))}const r=[];for(let s=0,o=n.length;s<o;++s)n[s]&&r.push(...n[s]);return __[i]=r,r}class Yx extends wC{constructor(e,t,n,r,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?Ul(Math.atan2(r[1],r[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=nn()}drawImages_(e,t,n,r){if(!this.image_)return;const s=jo(e,t,n,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let c=this.imageRotation_;this.transformRotation_===0&&(c-=this.viewRotation_),this.imageRotateWithView_&&(c+=this.viewRotation_);for(let h=0,u=s.length;h<u;h+=2){const f=s[h]-this.imageAnchorX_,d=s[h+1]-this.imageAnchorY_;if(c!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const g=f+this.imageAnchorX_,m=d+this.imageAnchorY_;_s(a,g,m,1,1,c,-g,-m),o.save(),o.transform.apply(o,a),o.translate(g,m),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,f,d,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(e,t,n,r){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const s=jo(e,t,n,r,this.transform_,this.pixelCoordinates_),o=this.context_;let a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);t<n;t+=r){const l=s[t]+this.textOffsetX_,c=s[t+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,c-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,l,c),this.textFillState_&&o.fillText(this.text_,l,c))}}moveToLineTo_(e,t,n,r,s){const o=this.context_,a=jo(e,t,n,r,this.transform_,this.pixelCoordinates_);o.moveTo(a[0],a[1]);let l=a.length;s&&(l-=2);for(let c=2;c<l;c+=2)o.lineTo(a[c],a[c+1]);return s&&o.closePath(),n}drawRings_(e,t,n,r){for(let s=0,o=n.length;s<o;++s)t=this.moveToLineTo_(e,t,n[s],r,!0);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ei(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=V6(e,this.transform_,this.pixelCoordinates_),n=t[2]-t[0],r=t[3]-t[1],s=Math.sqrt(n*n+r*r),o=this.context_;o.beginPath(),o.arc(t[0],t[1],s,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case"Point":this.drawPoint(e);break;case"LineString":this.drawLineString(e);break;case"Polygon":this.drawPolygon(e);break;case"MultiPoint":this.drawMultiPoint(e);break;case"MultiLineString":this.drawMultiLineString(e);break;case"MultiPolygon":this.drawMultiPolygon(e);break;case"GeometryCollection":this.drawGeometryCollection(e);break;case"Circle":this.drawCircle(e);break}}drawFeature(e,t){const n=t.getGeometryFunction()(e);n&&(this.setStyle(t),this.drawGeometry(n))}drawGeometryCollection(e){const t=e.getGeometriesArray();for(let n=0,r=t.length;n<r;++n)this.drawGeometry(t[n])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ei(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const t=this.context_,n=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(n,0,n.length,e.getStride(),!1),t.stroke()}if(this.text_!==""){const t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getExtent();if(Ei(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const n=this.context_,r=e.getFlatCoordinates();let s=0;const o=e.getEnds(),a=e.getStride();n.beginPath();for(let l=0,c=o.length;l<c;++l)s=this.moveToLineTo_(r,s,o[l],a,!1);n.stroke()}if(this.text_!==""){const n=e.getFlatMidpoints();this.drawText_(n,0,n.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ei(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride()),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){const t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ei(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=this.context_,n=e.getOrientedFlatCoordinates();let r=0;const s=e.getEndss(),o=e.getStride();t.beginPath();for(let a=0,l=s.length;a<l;++a){const c=s[a];r=this.drawRings_(n,r,c,o)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){const t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){const t=this.context_,n=this.contextFillState_;n?n.fillStyle!=e.fillStyle&&(n.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){const t=this.context_,n=this.contextStrokeState_;n?(n.lineCap!=e.lineCap&&(n.lineCap=e.lineCap,t.lineCap=e.lineCap),Ho(n.lineDash,e.lineDash)||t.setLineDash(n.lineDash=e.lineDash),n.lineDashOffset!=e.lineDashOffset&&(n.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),n.lineJoin!=e.lineJoin&&(n.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),n.lineWidth!=e.lineWidth&&(n.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),n.miterLimit!=e.miterLimit&&(n.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),n.strokeStyle!=e.strokeStyle&&(n.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){const t=this.context_,n=this.contextTextState_,r=e.textAlign?e.textAlign:Rd;n?(n.font!=e.font&&(n.font=e.font,t.font=e.font),n.textAlign!=r&&(n.textAlign=r,t.textAlign=r),n.textBaseline!=e.textBaseline&&(n.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=r,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:r,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(!e)this.fillState_=null;else{const n=e.getColor();this.fillState_={fillStyle:Fo(n||qr)}}if(!t)this.strokeState_=null;else{const n=t.getColor(),r=t.getLineCap(),s=t.getLineDash(),o=t.getLineDashOffset(),a=t.getLineJoin(),l=t.getWidth(),c=t.getMiterLimit(),h=s||Fa;this.strokeState_={lineCap:r!==void 0?r:Tu,lineDash:this.pixelRatio_===1?h:h.map(u=>u*this.pixelRatio_),lineDashOffset:(o||Oa)*this.pixelRatio_,lineJoin:a!==void 0?a:Lu,lineWidth:(l!==void 0?l:Id)*this.pixelRatio_,miterLimit:c!==void 0?c:Pd,strokeStyle:Fo(n||Md)}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}const n=e.getPixelRatio(this.pixelRatio_),r=e.getAnchor(),s=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*n,this.imageAnchorY_=r[1]*n,this.imageHeight_=t[1]*n,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();const o=e.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/n,o[1]*this.pixelRatio_/n],this.imageWidth_=t[0]*n}setTextStyle(e){if(!e)this.text_="";else{const t=e.getFill();if(!t)this.textFillState_=null;else{const d=t.getColor();this.textFillState_={fillStyle:Fo(d||qr)}}const n=e.getStroke();if(!n)this.textStrokeState_=null;else{const d=n.getColor(),g=n.getLineCap(),m=n.getLineDash(),_=n.getLineDashOffset(),v=n.getLineJoin(),x=n.getWidth(),S=n.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:Tu,lineDash:m||Fa,lineDashOffset:_||Oa,lineJoin:v!==void 0?v:Lu,lineWidth:x!==void 0?x:Id,miterLimit:S!==void 0?S:Pd,strokeStyle:Fo(d||Md)}}const r=e.getFont(),s=e.getOffsetX(),o=e.getOffsetY(),a=e.getRotateWithView(),l=e.getRotation(),c=e.getScaleArray(),h=e.getText(),u=e.getTextAlign(),f=e.getTextBaseline();this.textState_={font:r!==void 0?r:wL,textAlign:u!==void 0?u:Rd,textBaseline:f!==void 0?f:P0},this.text_=h!==void 0?Array.isArray(h)?h.reduce((d,g,m)=>d+=m%2?" ":g,""):h:"",this.textOffsetX_=s!==void 0?this.pixelRatio_*s:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}}}const fs=.5;function SC(i,e,t,n,r,s,o,a,l){const c=l?Ou(r):r,h=i[0]*fs,u=i[1]*fs,f=Xi(h,u);f.imageSmoothingEnabled=!1;const d=f.canvas,g=new Yx(f,fs,r,null,o,a,l?Wc(N6(),l):null),m=t.length,_=Math.floor((256*256*256-1)/m),v={};for(let S=1;S<=m;++S){const b=t[S-1],A=b.getStyleFunction()||n;if(!A)continue;let F=A(b,s);if(!F)continue;Array.isArray(F)||(F=[F]);const R=(S*_).toString(16).padStart(7,"#00000");for(let P=0,O=F.length;P<O;++P){const L=F[P],T=L.getGeometryFunction()(b);if(!T||!Ei(c,T.getExtent()))continue;const C=L.clone(),D=C.getFill();D&&D.setColor(R);const W=C.getStroke();W&&(W.setColor(R),W.setLineDash(null)),C.setText(void 0);const $=L.getImage();if($){const ne=$.getImageSize();if(!ne)continue;const ae=Xi(ne[0],ne[1],void 0,{alpha:!1}),I=ae.canvas;ae.fillStyle=R,ae.fillRect(0,0,I.width,I.height),C.setImage(new eg({img:I,anchor:$.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:$.getOrigin(),opacity:1,size:$.getSize(),scale:$.getScale(),rotation:$.getRotation(),rotateWithView:$.getRotateWithView()}))}const B=C.getZIndex()||0;let V=v[B];V||(V={},v[B]=V,V.Polygon=[],V.Circle=[],V.LineString=[],V.Point=[]);const te=T.getType();if(te==="GeometryCollection"){const ne=T.getGeometriesArrayRecursive();for(let ae=0,I=ne.length;ae<I;++ae){const U=ne[ae];V[U.getType().replace("Multi","")].push(U,C)}}else V[te.replace("Multi","")].push(T,C)}}const x=Object.keys(v).map(Number).sort(Bo);for(let S=0,b=x.length;S<b;++S){const A=v[x[S]];for(const F in A){const N=A[F];for(let R=0,P=N.length;R<P;R+=2){g.setStyle(N[R+1]);for(let O=0,L=e.length;O<L;++O)g.setTransform(e[O]),g.drawGeometry(N[R])}}}return f.getImageData(0,0,d.width,d.height)}function TC(i,e,t){const n=[];if(t){const r=Math.floor(Math.round(i[0])*fs),s=Math.floor(Math.round(i[1])*fs),o=(yt(r,0,t.width-1)+yt(s,0,t.height-1)*t.width)*4,a=t.data[o],l=t.data[o+1],h=t.data[o+2]+256*(l+256*a),u=Math.floor((256*256*256-1)/e.length);h&&h%u===0&&n.push(e[h/u-1])}return n}const P4=.5,LC={Point:k4,LineString:F4,Polygon:B4,MultiPoint:G4,MultiLineString:O4,MultiPolygon:D4,GeometryCollection:N4,Circle:R4};function M4(i,e){return parseInt(Ue(i),10)-parseInt(Ue(e),10)}function q0(i,e){const t=CC(i,e);return t*t}function CC(i,e){return P4*i/e}function R4(i,e,t,n,r){const s=t.getFill(),o=t.getStroke();if(s||o){const l=i.getBuilder(t.getZIndex(),"Circle");l.setFillStrokeStyle(s,o),l.drawCircle(e,n,r)}const a=t.getText();if(a&&a.getText()){const l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n)}}function V0(i,e,t,n,r,s,o,a){const l=[],c=t.getImage();if(c){let f=!0;const d=c.getImageState();d==Ye.LOADED||d==Ye.ERROR?f=!1:d==Ye.IDLE&&c.load(),f&&l.push(c.ready())}const h=t.getFill();h&&h.loading()&&l.push(h.ready());const u=l.length>0;return u&&Promise.all(l).then(()=>r(null)),I4(i,e,t,n,s,o,a),u}function I4(i,e,t,n,r,s,o){const a=t.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(n,r);if(t.getRenderer())AC(i,l,t,e,o);else{const h=LC[l.getType()];h(i,l,t,e,o,s)}}function AC(i,e,t,n,r){if(e.getType()=="GeometryCollection"){const o=e.getGeometries();for(let a=0,l=o.length;a<l;++a)AC(i,o[a],t,n,r);return}i.getBuilder(t.getZIndex(),"Default").drawCustom(e,n,t.getRenderer(),t.getHitDetectionRenderer(),r)}function N4(i,e,t,n,r,s){const o=e.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a){const c=LC[o[a].getType()];c(i,o[a],t,n,r,s)}}function F4(i,e,t,n,r){const s=t.getStroke();if(s){const a=i.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawLineString(e,n,r)}const o=t.getText();if(o&&o.getText()){const a=i.getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,n,r)}}function O4(i,e,t,n,r){const s=t.getStroke();if(s){const a=i.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawMultiLineString(e,n,r)}const o=t.getText();if(o&&o.getText()){const a=i.getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,n,r)}}function D4(i,e,t,n,r){const s=t.getFill(),o=t.getStroke();if(o||s){const l=i.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawMultiPolygon(e,n,r)}const a=t.getText();if(a&&a.getText()){const l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}function k4(i,e,t,n,r,s){const o=t.getImage(),a=t.getText(),l=a&&a.getText(),c=s&&o&&l?{}:void 0;if(o){if(o.getImageState()!=Ye.LOADED)return;const h=i.getBuilder(t.getZIndex(),"Image");h.setImageStyle(o,c),h.drawPoint(e,n,r)}if(l){const h=i.getBuilder(t.getZIndex(),"Text");h.setTextStyle(a,c),h.drawText(e,n,r)}}function G4(i,e,t,n,r,s){const o=t.getImage(),a=o&&o.getOpacity()!==0,l=t.getText(),c=l&&l.getText(),h=s&&a&&c?{}:void 0;if(a){if(o.getImageState()!=Ye.LOADED)return;const u=i.getBuilder(t.getZIndex(),"Image");u.setImageStyle(o,h),u.drawMultiPoint(e,n,r)}if(c){const u=i.getBuilder(t.getZIndex(),"Text");u.setTextStyle(l,h),u.drawText(e,n,r)}}function B4(i,e,t,n,r){const s=t.getFill(),o=t.getStroke();if(s||o){const l=i.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawPolygon(e,n,r)}const a=t.getText();if(a&&a.getText()){const l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}class PC extends Kx{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipped_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=bn(),this.wrappedRenderedExtent_=bn(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(e,t,n){const r=t.extent,s=t.viewState,o=s.center,a=s.resolution,l=s.projection,c=s.rotation,h=l.getExtent(),u=this.getLayer().getSource(),f=this.getLayer().getDeclutter(),d=t.pixelRatio,g=t.viewHints,m=!(g[Ti.ANIMATING]||g[Ti.INTERACTING]),_=this.context,v=Math.round(St(r)/a*d),x=Math.round(Wi(r)/a*d),S=u.getWrapX()&&l.canWrapX(),b=S?St(h):null,A=S?Math.ceil((r[2]-h[2])/b)+1:1;let F=S?Math.floor((r[0]-h[0])/b):0;do{let N=this.getRenderTransform(o,a,0,d,v,x,F*b);t.declutter&&(N=N.slice(0)),e.execute(_,[_.canvas.width,_.canvas.height],N,c,m,n===void 0?bc:n?z0:C4,n?f&&t.declutter[f]:void 0)}while(++F<A)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Xi(this.context.canvas.width,this.context.canvas.height,oE))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){const e=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=e,Qd(this.context),oE.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(e){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,e,!0)}renderDeferredInternal(e){this.replayGroup_&&(this.replayGroup_.renderDeferred(),this.clipped_&&this.context.restore(),this.resetDrawContext_())}renderFrame(e,t){const n=e.layerStatesArray[e.layerIndex];this.opacity_=n.opacity;const r=e.viewState;this.prepareContainer(e,t);const s=this.context,o=this.replayGroup_;let a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(qn.PRERENDER)||this.getLayer().hasListener(qn.POSTRENDER)))return this.container;if(this.setDrawContext_(),this.preRender(s,e),r.projection,this.clipped_=!1,a&&n.extent&&this.clipping){const l=ps(n.extent);a=Ei(l,e.extent),this.clipped_=a&&!gs(l,e.extent),this.clipped_&&this.clipUnrotated(s,e,l)}return a&&this.renderWorlds(o,e,this.getLayer().getDeclutter()?!1:void 0),!e.declutter&&this.clipped_&&s.restore(),this.postRender(s,e),this.renderedRotation_!==r.rotation&&(this.renderedRotation_=r.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const n=this.frameState.size.slice(),r=this.renderedCenter_,s=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,c=this.getLayer(),h=[],u=n[0]*fs,f=n[1]*fs;h.push(this.getRenderTransform(r,s,o,fs,u,f,0).slice());const d=c.getSource(),g=a.getExtent();if(d.getWrapX()&&a.canWrapX()&&!gs(g,l)){let m=l[0];const _=St(g);let v=0,x;for(;m<g[0];)--v,x=_*v,h.push(this.getRenderTransform(r,s,o,fs,u,f,x).slice()),m+=_;for(v=0,m=l[2];m>g[2];)++v,x=_*v,h.push(this.getRenderTransform(r,s,o,fs,u,f,x).slice()),m-=_}this.hitDetectionImageData_=SC(n,h,this.renderedFeatures_,c.getStyleFunction(),l,s,o,q0(s,this.renderedPixelRatio_),null)}t(TC(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,n,r,s){if(!this.replayGroup_)return;const o=t.viewState.resolution,a=t.viewState.rotation,l=this.getLayer(),c={},h=function(f,d,g){const m=Ue(f),_=c[m];if(_){if(_!==!0&&g<_.distanceSq){if(g===0)return c[m]=!0,s.splice(s.lastIndexOf(_),1),r(f,l,d);_.geometry=d,_.distanceSq=g}}else{if(g===0)return c[m]=!0,r(f,l,d);s.push(c[m]={feature:f,layer:l,geometry:d,distanceSq:g,callback:r})}},u=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,o,a,n,h,u?t.declutter?.[u]?.all().map(f=>f.value):null)}handleFontsChanged(){const e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){const t=this.getLayer(),n=t.getSource();if(!n)return!1;const r=e.viewHints[Ti.ANIMATING],s=e.viewHints[Ti.INTERACTING],o=t.getUpdateWhileAnimating(),a=t.getUpdateWhileInteracting();if(this.ready&&!o&&r||!a&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=e.extent,c=e.viewState,h=c.projection,u=c.resolution,f=e.pixelRatio,d=t.getRevision(),g=t.getRenderBuffer();let m=t.getRenderOrder();m===void 0&&(m=M4);const _=c.center.slice(),v=Zn(l,g*u),x=v.slice(),S=[v.slice()],b=h.getExtent();if(n.getWrapX()&&h.canWrapX()&&!gs(b,e.extent)){const D=St(b),W=Math.max(St(v)/2,D);v[0]=b[0]-W,v[2]=b[2]+W,zv(_,h);const $=Gv(S[0],h);$[0]<b[0]&&$[2]<b[2]?S.push([$[0]+D,$[1],$[2]+D,$[3]]):$[0]>b[0]&&$[2]>b[2]&&S.push([$[0]-D,$[1],$[2]-D,$[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==d&&this.renderedRenderOrder_==m&&this.renderedFrameDeclutter_===!!e.declutter&&gs(this.wrappedRenderedExtent_,v))return Ho(this.renderedExtent_,x)||(this.hitDetectionImageData_=null,this.renderedExtent_=x),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const A=new bC(CC(u,f),v,u,f);let F;for(let D=0,W=S.length;D<W;++D)n.loadFeatures(S[D],u,h);const N=q0(u,f);let R=!0;const P=(D,W)=>{let $;const B=D.getStyleFunction()||t.getStyleFunction();if(B&&($=B(D,u)),$){const V=this.renderFeature(D,N,$,A,F,this.getLayer().getDeclutter(),W);R=R&&!V}},O=Ou(v),L=n.getFeaturesInExtent(O);m&&L.sort(m);for(let D=0,W=L.length;D<W;++D)P(L[D],D);this.renderedFeatures_=L,this.ready=R;const T=A.finish(),C=new EC(v,u,f,n.getOverlaps(),T,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=u,this.renderedRevision_=d,this.renderedRenderOrder_=m,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=x,this.wrappedRenderedExtent_=v,this.renderedCenter_=_,this.renderedProjection_=h,this.renderedPixelRatio_=f,this.replayGroup_=C,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,n,r,s,o,a){if(!n)return!1;let l=!1;if(Array.isArray(n))for(let c=0,h=n.length;c<h;++c)l=V0(r,e,n[c],t,this.boundHandleStyleImageChange_,s,o,a)||l;else l=V0(r,e,n,t,this.boundHandleStyleImageChange_,s,o,a);return l}}class ao extends Du{constructor(e){super(e)}createRenderer(){return new PC(this)}}function qm(i){const e=i.frameState,t=Ua(i.inversePixelTransform.slice(),e.coordinateToPixelTransform);return new Yx(i.context,e.pixelRatio,e.extent,t,e.viewState.rotation)}var td=V8.split(".");td=parseInt(td[0])*100+parseInt(td[1]);var $y=function(i,e){var t=i.frameState.pixelRatio;if(td>605&&td<700&&t!==1&&e.getImage()instanceof eg){e=e.clone();var n=e.getImage();n.setScale(n.getScale()*t);var r=n.getAnchor();if(r&&n.setDisplacement){var s=n.getDisplacement();s&&(s[0]-=r[0]/t,s[1]+=r[1]/t,n.setAnchor([0,0]))}else r&&(r[0]/=t,r[1]/=t)}return e},j4=class extends ao{constructor(e){var t=e||{};super(t),this.oldcluster=new Ko,this.clusters=[],this.animation={start:!1},this.set("animationDuration",typeof t.animationDuration=="number"?t.animationDuration:700),this.set("animationMethod",t.animationMethod||Va),this.on(["precompose","prerender"],this.animate.bind(this)),this.on(["postcompose","postrender"],this.postanimate.bind(this))}setSource(e){this._saveClusterFn||(this._saveClusterFn=this.saveCluster.bind(this)),this.getSource()&&this.getSource().un("change",this._saveClusterFn),ao.prototype.setSource.call(this,e),this.getSource()&&this.getSource().on("change",this._saveClusterFn)}saveCluster(){if(this.oldcluster){if(this.oldcluster.clear(),!this.get("animationDuration"))return;var e=this.getSource().getFeatures();e.length&&e[0].get("features")&&(this.oldcluster.addFeatures(this.clusters),this.clusters=e.slice(0),this.sourceChanged=!0)}}getClusterForFeature(e,t){for(var n=0,r;r=t[n];n++){var s=r.get("features");if(s&&s.length){for(var o=0,a;a=s[o];o++)if(e===a)return r}}return!1}stopAnimation(){this.animation.start=!1,this.animation.cA=[],this.animation.cB=[]}animate(e){var t=this.get("animationDuration");if(t){var n=e.frameState.viewState.resolution,r,s,o=this.animation,a=e.frameState.time;if(o.resolution!=n&&this.sourceChanged){var l=e.frameState.extent;for(o.resolution<n?(l=Zn(l,100*n),o.cA=this.oldcluster.getFeaturesInExtent(l),o.cB=this.getSource().getFeaturesInExtent(l),o.revers=!1):(l=Zn(l,100*n),o.cA=this.getSource().getFeaturesInExtent(l),o.cB=this.oldcluster.getFeaturesInExtent(l),o.revers=!0),o.clusters=[],r=0,s;s=o.cA[r];r++){var c=s.get("features");if(c&&c.length){var h=this.getClusterForFeature(c[0],o.cB);h&&o.clusters.push({f:s,pt:h.getGeometry().getCoordinates()})}}if(o.resolution=n,this.sourceChanged=!1,!o.clusters.length||o.clusters.length>1e3){this.stopAnimation();return}a=o.start=new Date().getTime()}if(o.start){var u=e.vectorContext||qm(e),f=(a-o.start)/t;f>1&&(this.stopAnimation(),f=1),f=this.get("animationMethod")(f);var d=this.getStyle(),g=typeof d=="function"?d:d.length?function(){return d}:function(){return[d]};for(e.context.save(),e.context.globalAlpha=this.getOpacity(),r=0,h;h=o.clusters[r];r++){var m=h.f.getGeometry().getCoordinates(),_=m[0]-h.pt[0],v=m[1]-h.pt[1];o.revers?(m[0]=h.pt[0]+f*_,m[1]=h.pt[1]+f*v):(m[0]=m[0]-f*_,m[1]=m[1]-f*v);var x=g(h.f,n,!0);if(Array.isArray(x)||(x=[x]),h.f.get("features").length===1&&!_&&!v)c=h.f.get("features")[0];else{var S=new zi(m);c=new wi(S)}for(var b=0,A;A=x[b];b++)if(A.getText()&&/\n/.test(A.getText().getText())){var F=A.getText().getOffsetX(),N=A.getText().getOffsetY(),R=A.getText().getRotation()||0,P=Number((A.getText().getFont()||"10px").match(/\d+/))*1.2,O=A.getText().getText().split(`
90
- `),L,T=O.length-1,C=A.clone();O.forEach(function(D,W){switch(W==1&&(C.setImage(),C.setFill(),C.setStroke()),A.getText().getTextBaseline()){case"alphabetic":case"ideographic":case"bottom":{L=T;break}case"hanging":case"top":{L=0;break}default:{L=T/2;break}}C.getText().setOffsetX(F-Math.sin(R)*P*(W-L)),C.getText().setOffsetY(N+Math.cos(R)*P*(W-L)),C.getText().setText(D),u.drawFeature(c,$y(e,C))})}else u.drawFeature(c,$y(e,A))}e.context.restore(),e.frameState.animate=!0,e.context.save(),e.context.beginPath(),e.context.rect(0,0,0,0),e.context.clip(),this.clip_=!0}}}postanimate(e){this.clip_&&(e.context.restore(),this.clip_=!1)}};function MC(i,e,t){const n=[];let r=i(0),s=i(1),o=e(r),a=e(s);const l=[s,r],c=[a,o],h=[1,0],u={};let f=1e5,d,g,m,_,v,x;for(;--f>0&&h.length>0;)m=h.pop(),r=l.pop(),o=c.pop(),x=m.toString(),x in u||(n.push(o[0],o[1]),u[x]=!0),_=h.pop(),s=l.pop(),a=c.pop(),v=(m+_)/2,d=i(v),g=e(d),IT(g[0],g[1],o[0],o[1],a[0],a[1])<t?(n.push(a[0],a[1]),x=_.toString(),u[x]=!0):(h.push(_,v,v,m),c.push(a,g,g,o),l.push(s,d,d,r));return n}function U4(i,e,t,n,r){const s=Mt("EPSG:4326");return MC(function(o){return[i,e+(t-e)*o]},Vo(s,n),r)}function z4(i,e,t,n,r){const s=Mt("EPSG:4326");return MC(function(o){return[e+(t-e)*o,i]},Vo(s,n),r)}function q4(i){if(!(i.context instanceof CanvasRenderingContext2D))throw new Error("Only works for render events from Canvas 2D layers");const e=i.inversePixelTransform[0],t=i.inversePixelTransform[1],n=Math.sqrt(e*e+t*t),r=i.frameState,s=Ua(i.inversePixelTransform.slice(),r.coordinateToPixelTransform),o=q0(r.viewState.resolution,n);let a;return new Yx(i.context,n,r.extent,s,r.viewState.rotation,o,a)}const V4=new xn({color:"rgba(0,0,0,0.2)"}),$4=[90,45,30,20,10,5,2,1,30/60,20/60,10/60,5/60,2/60,1/60,30/3600,20/3600,10/3600,5/3600,2/3600,1/3600];class W4 extends ao{constructor(e){e=e||{};const t=Object.assign({updateWhileAnimating:!0,updateWhileInteracting:!0,renderBuffer:0},e);delete t.maxLines,delete t.strokeStyle,delete t.targetSize,delete t.showLabels,delete t.lonLabelFormatter,delete t.latLabelFormatter,delete t.lonLabelPosition,delete t.latLabelPosition,delete t.lonLabelStyle,delete t.latLabelStyle,delete t.intervals,super(t),this.projection_=null,this.maxLat_=1/0,this.maxLon_=1/0,this.minLat_=-1/0,this.minLon_=-1/0,this.maxX_=1/0,this.maxY_=1/0,this.minX_=-1/0,this.minY_=-1/0,this.targetSize_=e.targetSize!==void 0?e.targetSize:100,this.maxLines_=e.maxLines!==void 0?e.maxLines:100,this.meridians_=[],this.parallels_=[],this.strokeStyle_=e.strokeStyle!==void 0?e.strokeStyle:V4,this.fromLonLatTransform_=void 0,this.toLonLatTransform_=void 0,this.projectionCenterLonLat_=null,this.bottomLeft_=null,this.bottomRight_=null,this.topLeft_=null,this.topRight_=null,this.meridiansLabels_=null,this.parallelsLabels_=null,e.showLabels&&(this.lonLabelFormatter_=e.lonLabelFormatter==null?Jw.bind(this,"EW"):e.lonLabelFormatter,this.latLabelFormatter_=e.latLabelFormatter==null?Jw.bind(this,"NS"):e.latLabelFormatter,this.lonLabelPosition_=e.lonLabelPosition==null?0:e.lonLabelPosition,this.latLabelPosition_=e.latLabelPosition==null?1:e.latLabelPosition,this.lonLabelStyleBase_=new Li({text:e.lonLabelStyle!==void 0?e.lonLabelStyle.clone():new Uo({font:"12px Calibri,sans-serif",textBaseline:"bottom",fill:new cr({color:"rgba(0,0,0,1)"}),stroke:new xn({color:"rgba(255,255,255,1)",width:3})})}),this.lonLabelStyle_=n=>{const r=n.get("graticule_label");return this.lonLabelStyleBase_.getText().setText(r),this.lonLabelStyleBase_},this.latLabelStyleBase_=new Li({text:e.latLabelStyle!==void 0?e.latLabelStyle.clone():new Uo({font:"12px Calibri,sans-serif",textAlign:"right",fill:new cr({color:"rgba(0,0,0,1)"}),stroke:new xn({color:"rgba(255,255,255,1)",width:3})})}),this.latLabelStyle_=n=>{const r=n.get("graticule_label");return this.latLabelStyleBase_.getText().setText(r),this.latLabelStyleBase_},this.meridiansLabels_=[],this.parallelsLabels_=[],this.addEventListener(qn.POSTRENDER,this.drawLabels_.bind(this))),this.intervals_=e.intervals!==void 0?e.intervals:$4,this.setSource(new Ko({loader:this.loaderFunction.bind(this),strategy:this.strategyFunction.bind(this),features:new Rn,overlaps:!1,useSpatialIndex:!1,wrapX:e.wrapX})),this.featurePool_=[],this.lineStyle_=new Li({stroke:this.strokeStyle_}),this.loadedExtent_=null,this.renderedExtent_=null,this.renderedResolution_=null,this.setRenderOrder(null)}strategyFunction(e,t){let n=e.slice();return this.projection_&&this.getSource().getWrapX()&&Gv(n,this.projection_),this.loadedExtent_&&(H8(this.loadedExtent_,n,t)?n=this.loadedExtent_.slice():this.getSource().removeLoadedExtent(this.loadedExtent_)),[n]}loaderFunction(e,t,n){this.loadedExtent_=e;const r=this.getSource(),s=this.getExtent()||[-1/0,-1/0,1/0,1/0],o=Mn(s,e);if(this.renderedExtent_&&Ga(this.renderedExtent_,o)&&this.renderedResolution_===t||(this.renderedExtent_=o,this.renderedResolution_=t,Xo(o)))return;const a=In(o),l=t*t/4;(!this.projection_||!mn(this.projection_,n))&&this.updateProjectionInfo_(n),this.createGraticule_(o,a,t,l);let h=this.meridians_.length+this.parallels_.length;this.meridiansLabels_&&(h+=this.meridians_.length),this.parallelsLabels_&&(h+=this.parallels_.length);let u;for(;h>this.featurePool_.length;)u=new wi,this.featurePool_.push(u);const f=r.getFeaturesCollection();f.clear();let d=0,g,m;for(g=0,m=this.meridians_.length;g<m;++g)u=this.featurePool_[d++],u.setGeometry(this.meridians_[g]),u.setStyle(this.lineStyle_),f.push(u);for(g=0,m=this.parallels_.length;g<m;++g)u=this.featurePool_[d++],u.setGeometry(this.parallels_[g]),u.setStyle(this.lineStyle_),f.push(u)}addMeridian_(e,t,n,r,s,o){const a=this.getMeridian_(e,t,n,r,o);if(Ei(a.getExtent(),s)){if(this.meridiansLabels_){const l=this.lonLabelFormatter_(e);o in this.meridiansLabels_?this.meridiansLabels_[o].text=l:this.meridiansLabels_[o]={geom:new zi([]),text:l}}this.meridians_[o++]=a}return o}addParallel_(e,t,n,r,s,o){const a=this.getParallel_(e,t,n,r,o);if(Ei(a.getExtent(),s)){if(this.parallelsLabels_){const l=this.latLabelFormatter_(e);o in this.parallelsLabels_?this.parallelsLabels_[o].text=l:this.parallelsLabels_[o]={geom:new zi([]),text:l}}this.parallels_[o++]=a}return o}drawLabels_(e){const t=e.frameState.viewState.rotation,n=e.frameState.viewState.resolution,r=e.frameState.size,s=e.frameState.extent,o=In(s);let a=s;if(t){const g=r[0]*n,m=r[1]*n;a=[o[0]-g/2,o[1]-m/2,o[0]+g/2,o[1]+m/2]}let l=0,c=0,h=this.latLabelPosition_<.5;const u=this.projection_.getExtent(),f=St(u);if(this.getSource().getWrapX()&&this.projection_.canWrapX()&&!gs(u,s)){l=Math.floor((s[0]-u[0])/f),c=Math.ceil((s[2]-u[2])/f);const g=Math.abs(t)>Math.PI/2;h=h!==g}const d=q4(e);for(let g=l;g<=c;++g){let m=this.meridians_.length+this.parallels_.length,_,v,x,S;if(this.meridiansLabels_)for(v=0,x=this.meridiansLabels_.length;v<x;++v){const b=this.meridians_[v];if(!t&&g===0)S=this.getMeridianPoint_(b,s,v);else{const A=b.clone();A.translate(g*f,0),A.rotate(-t,o),S=this.getMeridianPoint_(A,a,v),S.rotate(t,o)}_=this.featurePool_[m++],_.setGeometry(S),_.set("graticule_label",this.meridiansLabels_[v].text),d.drawFeature(_,this.lonLabelStyle_(_))}if(this.parallelsLabels_&&(g===l&&h||g===c&&!h))for(v=0,x=this.parallels_.length;v<x;++v){const b=this.parallels_[v];if(!t&&g===0)S=this.getParallelPoint_(b,s,v);else{const A=b.clone();A.translate(g*f,0),A.rotate(-t,o),S=this.getParallelPoint_(A,a,v),S.rotate(t,o)}_=this.featurePool_[m++],_.setGeometry(S),_.set("graticule_label",this.parallelsLabels_[v].text),d.drawFeature(_,this.latLabelStyle_(_))}}}createGraticule_(e,t,n,r){const s=this.getInterval_(n);if(s==-1){this.meridians_.length=0,this.parallels_.length=0,this.meridiansLabels_&&(this.meridiansLabels_.length=0),this.parallelsLabels_&&(this.parallelsLabels_.length=0);return}let o=!1;const a=this.projection_.getExtent(),l=St(a);this.getSource().getWrapX()&&this.projection_.canWrapX()&&!gs(a,e)&&(St(e)>=l?(e[0]=a[0],e[2]=a[2]):o=!0);const c=[yt(t[0],this.minX_,this.maxX_),yt(t[1],this.minY_,this.maxY_)],h=this.toLonLatTransform_(c);isNaN(h[1])&&(h[1]=Math.abs(this.maxLat_)>=Math.abs(this.minLat_)?this.maxLat_:this.minLat_);let u=yt(h[0],this.minLon_,this.maxLon_),f=yt(h[1],this.minLat_,this.maxLat_);const d=this.maxLines_;let g,m,_,v,x=e;o||(x=[yt(e[0],this.minX_,this.maxX_),yt(e[1],this.minY_,this.maxY_),yt(e[2],this.minX_,this.maxX_),yt(e[3],this.minY_,this.maxY_)]);const S=bu(x,this.toLonLatTransform_,void 0,8);let b=S[3],A=S[2],F=S[1],N=S[0];if(o||(Hr(x,this.bottomLeft_)&&(N=this.minLon_,F=this.minLat_),Hr(x,this.bottomRight_)&&(A=this.maxLon_,F=this.minLat_),Hr(x,this.topLeft_)&&(N=this.minLon_,b=this.maxLat_),Hr(x,this.topRight_)&&(A=this.maxLon_,b=this.maxLat_),b=yt(b,f,this.maxLat_),A=yt(A,u,this.maxLon_),F=yt(F,this.minLat_,f),N=yt(N,this.minLon_,u)),u=Math.floor(u/s)*s,v=yt(u,this.minLon_,this.maxLon_),m=this.addMeridian_(v,F,b,r,e,0),g=0,o)for(;(v-=s)>=N&&g++<d;)m=this.addMeridian_(v,F,b,r,e,m);else for(;v!=this.minLon_&&g++<d;)v=Math.max(v-s,this.minLon_),m=this.addMeridian_(v,F,b,r,e,m);if(v=yt(u,this.minLon_,this.maxLon_),g=0,o)for(;(v+=s)<=A&&g++<d;)m=this.addMeridian_(v,F,b,r,e,m);else for(;v!=this.maxLon_&&g++<d;)v=Math.min(v+s,this.maxLon_),m=this.addMeridian_(v,F,b,r,e,m);for(this.meridians_.length=m,this.meridiansLabels_&&(this.meridiansLabels_.length=m),f=Math.floor(f/s)*s,_=yt(f,this.minLat_,this.maxLat_),m=this.addParallel_(_,N,A,r,e,0),g=0;_!=this.minLat_&&g++<d;)_=Math.max(_-s,this.minLat_),m=this.addParallel_(_,N,A,r,e,m);for(_=yt(f,this.minLat_,this.maxLat_),g=0;_!=this.maxLat_&&g++<d;)_=Math.min(_+s,this.maxLat_),m=this.addParallel_(_,N,A,r,e,m);this.parallels_.length=m,this.parallelsLabels_&&(this.parallelsLabels_.length=m)}getInterval_(e){const t=this.projectionCenterLonLat_[0],n=this.projectionCenterLonLat_[1];let r=-1;const s=Math.pow(this.targetSize_*e,2),o=[],a=[];for(let l=0,c=this.intervals_.length;l<c;++l){const h=yt(this.intervals_[l]/2,0,90),u=yt(n,-90+h,90-h);if(o[0]=t-h,o[1]=u-h,a[0]=t+h,a[1]=u+h,this.fromLonLatTransform_(o,o),this.fromLonLatTransform_(a,a),Math.pow(a[0]-o[0],2)+Math.pow(a[1]-o[1],2)<=s)break;r=this.intervals_[l]}return r}getMeridian_(e,t,n,r,s){const o=U4(e,t,n,this.projection_,r);let a=this.meridians_[s];return a?(a.setFlatCoordinates("XY",o),a.changed()):(a=new ar(o,"XY"),this.meridians_[s]=a),a}getMeridianPoint_(e,t,n){const r=e.getFlatCoordinates();let s=1,o=r.length-1;r[s]>r[o]&&(s=o,o=1);const a=Math.max(t[1],r[s]),l=Math.min(t[3],r[o]),c=yt(t[1]+Math.abs(t[1]-t[3])*this.lonLabelPosition_,a,l),u=[r[s-1]+(r[o-1]-r[s-1])*(c-r[s])/(r[o]-r[s]),c],f=this.meridiansLabels_[n].geom;return f.setCoordinates(u),f}getMeridians(){return this.meridians_}getParallel_(e,t,n,r,s){const o=z4(e,t,n,this.projection_,r);let a=this.parallels_[s];return a?(a.setFlatCoordinates("XY",o),a.changed()):a=new ar(o,"XY"),a}getParallelPoint_(e,t,n){const r=e.getFlatCoordinates();let s=0,o=r.length-2;r[s]>r[o]&&(s=o,o=0);const a=Math.max(t[0],r[s]),l=Math.min(t[2],r[o]),c=yt(t[0]+Math.abs(t[0]-t[2])*this.latLabelPosition_,a,l),h=r[s+1]+(r[o+1]-r[s+1])*(c-r[s])/(r[o]-r[s]),u=[c,h],f=this.parallelsLabels_[n].geom;return f.setCoordinates(u),f}getParallels(){return this.parallels_}updateProjectionInfo_(e){const t=Mt("EPSG:4326"),n=e.getWorldExtent();this.maxLat_=n[3],this.maxLon_=n[2],this.minLat_=n[1],this.minLon_=n[0];const r=Vo(e,t);if(this.minLon_<this.maxLon_)this.toLonLatTransform_=r;else{const o=this.minLon_+this.maxLon_/2;this.maxLon_+=360,this.toLonLatTransform_=function(a,l,c){c=c||2;const h=r(a,l,c);for(let u=0,f=h.length;u<f;u+=c)h[u]<o&&(h[u]+=360);return h}}this.fromLonLatTransform_=Vo(t,e);const s=bu([this.minLon_,this.minLat_,this.maxLon_,this.maxLat_],this.fromLonLatTransform_,void 0,8);this.minX_=s[0],this.maxX_=s[2],this.minY_=s[1],this.maxY_=s[3],this.bottomLeft_=this.fromLonLatTransform_([this.minLon_,this.minLat_]),this.bottomRight_=this.fromLonLatTransform_([this.maxLon_,this.minLat_]),this.topLeft_=this.fromLonLatTransform_([this.minLon_,this.maxLat_]),this.topRight_=this.fromLonLatTransform_([this.maxLon_,this.maxLat_]),this.projectionCenterLonLat_=this.toLonLatTransform_(In(e.getExtent())),isNaN(this.projectionCenterLonLat_[1])&&(this.projectionCenterLonLat_[1]=Math.abs(this.maxLat_)>=Math.abs(this.minLat_)?this.maxLat_:this.minLat_),this.projection_=e}}const Gd=34962,Vm=34963,Zx=35044,y_=35048,H4=5121,X4=5123,K4=5125,RC=5126,fE=["experimental-webgl","webgl","webkit-3d","moz-webgl"];function Y4(i,e){e=Object.assign({preserveDrawingBuffer:!0,antialias:!hN},e);const t=fE.length;for(let n=0;n<t;++n)try{const r=i.getContext(fE[n],e);if(r)return r}catch{}return null}const Z4={STATIC_DRAW:Zx};class id{constructor(e,t){this.array_=null,this.type_=e,Vt(e===Gd||e===Vm,"A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`"),this.usage_=t!==void 0?t:Z4.STATIC_DRAW}ofSize(e){return this.array_=new(pp(this.type_))(e),this}fromArray(e){return this.array_=pp(this.type_).from(e),this}fromArrayBuffer(e){return this.array_=new(pp(this.type_))(e),this}getType(){return this.type_}getArray(){return this.array_}setArray(e){const t=pp(this.type_);if(!(e instanceof t))throw new Error(`Expected ${t}`);this.array_=e}getUsage(){return this.usage_}getSize(){return this.array_?this.array_.length:0}}function pp(i){switch(i){case Gd:return Float32Array;case Vm:return Uint32Array;default:return Float32Array}}const mp={LOST:"webglcontextlost",RESTORED:"webglcontextrestored"},J4=`
91
- precision mediump float;
92
-
93
- attribute vec2 a_position;
94
- varying vec2 v_texCoord;
95
- varying vec2 v_screenCoord;
96
-
97
- uniform vec2 u_screenSize;
98
-
99
- void main() {
100
- v_texCoord = a_position * 0.5 + 0.5;
101
- v_screenCoord = v_texCoord * u_screenSize;
102
- gl_Position = vec4(a_position, 0.0, 1.0);
103
- }
104
- `,Q4=`
105
- precision mediump float;
106
-
107
- uniform sampler2D u_image;
108
- uniform float u_opacity;
109
-
110
- varying vec2 v_texCoord;
111
-
112
- void main() {
113
- gl_FragColor = texture2D(u_image, v_texCoord) * u_opacity;
114
- }
115
- `;class dE{constructor(e){this.gl_=e.webGlContext;const t=this.gl_;this.scaleRatio_=e.scaleRatio||1,this.renderTargetTexture_=t.createTexture(),this.renderTargetTextureSize_=null,this.frameBuffer_=t.createFramebuffer(),this.depthBuffer_=t.createRenderbuffer();const n=t.createShader(t.VERTEX_SHADER);t.shaderSource(n,e.vertexShader||J4),t.compileShader(n);const r=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(r,e.fragmentShader||Q4),t.compileShader(r),this.renderTargetProgram_=t.createProgram(),t.attachShader(this.renderTargetProgram_,n),t.attachShader(this.renderTargetProgram_,r),t.linkProgram(this.renderTargetProgram_),this.renderTargetVerticesBuffer_=t.createBuffer();const s=[-1,-1,1,-1,-1,1,1,-1,1,1,-1,1];t.bindBuffer(t.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),t.bufferData(t.ARRAY_BUFFER,new Float32Array(s),t.STATIC_DRAW),this.renderTargetAttribLocation_=t.getAttribLocation(this.renderTargetProgram_,"a_position"),this.renderTargetUniformLocation_=t.getUniformLocation(this.renderTargetProgram_,"u_screenSize"),this.renderTargetOpacityLocation_=t.getUniformLocation(this.renderTargetProgram_,"u_opacity"),this.renderTargetTextureLocation_=t.getUniformLocation(this.renderTargetProgram_,"u_image"),this.uniforms_=[],e.uniforms&&Object.keys(e.uniforms).forEach(o=>{this.uniforms_.push({value:e.uniforms[o],location:t.getUniformLocation(this.renderTargetProgram_,o)})})}getRenderTargetTexture(){return this.renderTargetTexture_}getGL(){return this.gl_}init(e){const t=this.getGL(),n=[t.drawingBufferWidth*this.scaleRatio_,t.drawingBufferHeight*this.scaleRatio_];if(t.bindFramebuffer(t.FRAMEBUFFER,this.getFrameBuffer()),t.bindRenderbuffer(t.RENDERBUFFER,this.getDepthBuffer()),t.viewport(0,0,n[0],n[1]),!this.renderTargetTextureSize_||this.renderTargetTextureSize_[0]!==n[0]||this.renderTargetTextureSize_[1]!==n[1]){this.renderTargetTextureSize_=n;const r=0,s=t.RGBA,o=0,a=t.RGBA,l=t.UNSIGNED_BYTE,c=null;t.bindTexture(t.TEXTURE_2D,this.renderTargetTexture_),t.texImage2D(t.TEXTURE_2D,r,s,n[0],n[1],o,a,l,c),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this.renderTargetTexture_,0),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,n[0],n[1]),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,this.depthBuffer_)}}apply(e,t,n,r){const s=this.getGL(),o=e.size;if(s.bindFramebuffer(s.FRAMEBUFFER,t?t.getFrameBuffer():null),s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,this.renderTargetTexture_),!t){const l=Ue(s.canvas);if(!e.renderTargets[l]){const c=s.getContextAttributes();c&&c.preserveDrawingBuffer&&(s.clearColor(0,0,0,0),s.clearDepth(1),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT)),e.renderTargets[l]=!0}}s.disable(s.DEPTH_TEST),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA),s.viewport(0,0,s.drawingBufferWidth,s.drawingBufferHeight),s.bindBuffer(s.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),s.useProgram(this.renderTargetProgram_),s.enableVertexAttribArray(this.renderTargetAttribLocation_),s.vertexAttribPointer(this.renderTargetAttribLocation_,2,s.FLOAT,!1,0,0),s.uniform2f(this.renderTargetUniformLocation_,o[0],o[1]),s.uniform1i(this.renderTargetTextureLocation_,0);const a=e.layerStatesArray[e.layerIndex].opacity;s.uniform1f(this.renderTargetOpacityLocation_,a),this.applyUniforms(e),n&&n(s,e),s.drawArrays(s.TRIANGLES,0,6),r&&r(s,e)}getFrameBuffer(){return this.frameBuffer_}getDepthBuffer(){return this.depthBuffer_}applyUniforms(e){const t=this.getGL();let n,r=1;this.uniforms_.forEach(function(s){if(n=typeof s.value=="function"?s.value(e):s.value,n instanceof HTMLCanvasElement||n instanceof ImageData)s.texture||(s.texture=t.createTexture()),t.activeTexture(t[`TEXTURE${r}`]),t.bindTexture(t.TEXTURE_2D,s.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),n instanceof ImageData?t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,n.width,n.height,0,t.UNSIGNED_BYTE,new Uint8Array(n.data)):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n),t.uniform1i(s.location,r++);else if(Array.isArray(n))switch(n.length){case 2:t.uniform2f(s.location,n[0],n[1]);return;case 3:t.uniform3f(s.location,n[0],n[1],n[2]);return;case 4:t.uniform4f(s.location,n[0],n[1],n[2],n[3]);return;default:return}else typeof n=="number"&&t.uniform1f(s.location,n)})}}const Ea={PROJECTION_MATRIX:"u_projectionMatrix",SCREEN_TO_WORLD_MATRIX:"u_screenToWorldMatrix",TIME:"u_time",ZOOM:"u_zoom",RESOLUTION:"u_resolution",ROTATION:"u_rotation",VIEWPORT_SIZE_PX:"u_viewportSizePx",PIXEL_RATIO:"u_pixelRatio",HIT_DETECTION:"u_hitDetection"},$n={UNSIGNED_BYTE:H4,UNSIGNED_SHORT:X4,UNSIGNED_INT:K4,FLOAT:RC},$0={};function gE(i){return"shared/"+i}let pE=0;function eD(){const i="unique/"+pE;return pE+=1,i}function tD(i){let e=$0[i];if(!e){const t=document.createElement("canvas");t.width=1,t.height=1,t.style.position="absolute",t.style.left="0",e={users:0,context:Y4(t)},$0[i]=e}return e.users+=1,e.context}function iD(i){const e=$0[i];if(!e||(e.users-=1,e.users>0))return;const t=e.context,n=t.getExtension("WEBGL_lose_context");n&&n.loseContext();const r=t.canvas;r.width=1,r.height=1,delete $0[i]}class nD extends Yd{constructor(e){super(),e=e||{},this.boundHandleWebGLContextLost_=this.handleWebGLContextLost.bind(this),this.boundHandleWebGLContextRestored_=this.handleWebGLContextRestored.bind(this),this.canvasCacheKey_=e.canvasCacheKey?gE(e.canvasCacheKey):eD(),this.gl_=tD(this.canvasCacheKey_),this.bufferCache_={},this.extensionCache_={},this.currentProgram_=null,this.needsToBeRecreated_=!1;const t=this.gl_.canvas;t.addEventListener(mp.LOST,this.boundHandleWebGLContextLost_),t.addEventListener(mp.RESTORED,this.boundHandleWebGLContextRestored_),this.offsetRotateMatrix_=nn(),this.offsetScaleMatrix_=nn(),this.tmpMat4_=Zc(),this.uniformLocationsByProgram_={},this.attribLocationsByProgram_={},this.uniforms_=[],e.uniforms&&this.setUniforms(e.uniforms),this.postProcessPasses_=e.postProcesses?e.postProcesses.map(n=>new dE({webGlContext:this.gl_,scaleRatio:n.scaleRatio,vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,uniforms:n.uniforms})):[new dE({webGlContext:this.gl_})],this.shaderCompileErrors_=null,this.startTime_=Date.now(),this.maxAttributeCount_=this.gl_.getParameter(this.gl_.MAX_VERTEX_ATTRIBS)}setUniforms(e){this.uniforms_=[],this.addUniforms(e)}addUniforms(e){for(const t in e)this.uniforms_.push({name:t,value:e[t]})}canvasCacheKeyMatches(e){return this.canvasCacheKey_===gE(e)}getExtension(e){if(e in this.extensionCache_)return this.extensionCache_[e];const t=this.gl_.getExtension(e);return this.extensionCache_[e]=t,t}getInstancedRenderingExtension_(){const e=this.getExtension("ANGLE_instanced_arrays");return Vt(!!e,"WebGL extension 'ANGLE_instanced_arrays' is required for vector rendering"),e}bindBuffer(e){const t=this.gl_,n=Ue(e);let r=this.bufferCache_[n];if(!r){const s=t.createBuffer();r={buffer:e,webGlBuffer:s},this.bufferCache_[n]=r}t.bindBuffer(e.getType(),r.webGlBuffer)}flushBufferData(e){const t=this.gl_;this.bindBuffer(e),t.bufferData(e.getType(),e.getArray(),e.getUsage())}deleteBuffer(e){const t=Ue(e);delete this.bufferCache_[t]}disposeInternal(){const e=this.gl_.canvas;e.removeEventListener(mp.LOST,this.boundHandleWebGLContextLost_),e.removeEventListener(mp.RESTORED,this.boundHandleWebGLContextRestored_),iD(this.canvasCacheKey_),delete this.gl_}prepareDraw(e,t,n){const r=this.gl_,s=this.getCanvas(),o=e.size,a=e.pixelRatio;(s.width!==o[0]*a||s.height!==o[1]*a)&&(s.width=o[0]*a,s.height=o[1]*a,s.style.width=o[0]+"px",s.style.height=o[1]+"px");for(let l=this.postProcessPasses_.length-1;l>=0;l--)this.postProcessPasses_[l].init(e);r.bindTexture(r.TEXTURE_2D,null),r.clearColor(0,0,0,0),r.depthRange(0,1),r.clearDepth(1),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT),r.enable(r.BLEND),r.blendFunc(r.ONE,t?r.ZERO:r.ONE_MINUS_SRC_ALPHA),n?(r.enable(r.DEPTH_TEST),r.depthFunc(r.LEQUAL)):r.disable(r.DEPTH_TEST)}bindFrameBuffer(e,t){const n=this.getGL();n.bindFramebuffer(n.FRAMEBUFFER,e),t&&n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0)}bindInitialFrameBuffer(){const e=this.getGL(),t=this.postProcessPasses_[0].getFrameBuffer();e.bindFramebuffer(e.FRAMEBUFFER,t);const n=this.postProcessPasses_[0].getRenderTargetTexture();e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0)}bindTexture(e,t,n){const r=this.gl_;r.activeTexture(r.TEXTURE0+t),r.bindTexture(r.TEXTURE_2D,e),r.uniform1i(this.getUniformLocation(n),t)}bindAttribute(e,t,n){const r=this.getGL();this.bindBuffer(e);const s=this.getAttributeLocation(t);r.enableVertexAttribArray(s),r.vertexAttribPointer(s,n,r.FLOAT,!1,0,0)}prepareDrawToRenderTarget(e,t,n,r){const s=this.gl_,o=t.getSize();s.bindFramebuffer(s.FRAMEBUFFER,t.getFramebuffer()),s.bindRenderbuffer(s.RENDERBUFFER,t.getDepthbuffer()),s.viewport(0,0,o[0],o[1]),s.bindTexture(s.TEXTURE_2D,t.getTexture()),s.clearColor(0,0,0,0),s.depthRange(0,1),s.clearDepth(1),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),s.enable(s.BLEND),s.blendFunc(s.ONE,n?s.ZERO:s.ONE_MINUS_SRC_ALPHA),r?(s.enable(s.DEPTH_TEST),s.depthFunc(s.LEQUAL)):s.disable(s.DEPTH_TEST)}drawElements(e,t){const n=this.gl_;this.getExtension("OES_element_index_uint");const r=n.UNSIGNED_INT,s=4,o=t-e,a=e*s;n.drawElements(n.TRIANGLES,o,r,a)}drawElementsInstanced(e,t,n){const r=this.gl_;this.getExtension("OES_element_index_uint");const s=this.getInstancedRenderingExtension_(),o=r.UNSIGNED_INT,a=4,l=t-e,c=e*a;s.drawElementsInstancedANGLE(r.TRIANGLES,l,o,c,n);for(let h=0;h<this.maxAttributeCount_;h++)s.vertexAttribDivisorANGLE(h,0)}finalizeDraw(e,t,n){for(let r=0,s=this.postProcessPasses_.length;r<s;r++)r===s-1?this.postProcessPasses_[r].apply(e,null,t,n):this.postProcessPasses_[r].apply(e,this.postProcessPasses_[r+1])}getCanvas(){return this.gl_.canvas}getGL(){return this.gl_}applyFrameState(e){const t=e.size,n=e.viewState.rotation,r=e.pixelRatio;this.setUniformFloatValue(Ea.TIME,(Date.now()-this.startTime_)*.001),this.setUniformFloatValue(Ea.ZOOM,e.viewState.zoom),this.setUniformFloatValue(Ea.RESOLUTION,e.viewState.resolution),this.setUniformFloatValue(Ea.PIXEL_RATIO,r),this.setUniformFloatVec2(Ea.VIEWPORT_SIZE_PX,[t[0],t[1]]),this.setUniformFloatValue(Ea.ROTATION,n)}applyHitDetectionUniform(e){const t=this.getUniformLocation(Ea.HIT_DETECTION);this.getGL().uniform1i(t,e?1:0),e&&this.setUniformFloatValue(Ea.PIXEL_RATIO,.5)}applyUniforms(e){const t=this.gl_;let n,r=0;this.uniforms_.forEach(s=>{if(n=typeof s.value=="function"?s.value(e):s.value,n instanceof HTMLCanvasElement||n instanceof HTMLImageElement||n instanceof ImageData||n instanceof WebGLTexture){n instanceof WebGLTexture&&!s.texture?(s.prevValue=void 0,s.texture=n):s.texture||(s.prevValue=void 0,s.texture=t.createTexture()),this.bindTexture(s.texture,r,s.name),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE);const o=!(n instanceof HTMLImageElement)||n.complete;!(n instanceof WebGLTexture)&&o&&s.prevValue!==n&&(s.prevValue=n,t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n)),r++}else if(Array.isArray(n)&&n.length===6)this.setUniformMatrixValue(s.name,k0(this.tmpMat4_,n));else if(Array.isArray(n)&&n.length<=4)switch(n.length){case 2:t.uniform2f(this.getUniformLocation(s.name),n[0],n[1]);return;case 3:t.uniform3f(this.getUniformLocation(s.name),n[0],n[1],n[2]);return;case 4:t.uniform4f(this.getUniformLocation(s.name),n[0],n[1],n[2],n[3]);return;default:return}else typeof n=="number"&&t.uniform1f(this.getUniformLocation(s.name),n)})}useProgram(e,t){this.disableAllAttributes_(),this.gl_.useProgram(e),this.currentProgram_=e,t&&(this.applyFrameState(t),this.applyUniforms(t))}compileShader(e,t){const n=this.gl_,r=n.createShader(t);return n.shaderSource(r,e),n.compileShader(r),r}getProgram(e,t){const n=this.gl_,r=this.compileShader(e,n.FRAGMENT_SHADER),s=this.compileShader(t,n.VERTEX_SHADER),o=n.createProgram();if(n.attachShader(o,r),n.attachShader(o,s),n.linkProgram(o),!n.getShaderParameter(r,n.COMPILE_STATUS)){const a=`Fragment shader compilation failed: ${n.getShaderInfoLog(r)}`;throw new Error(a)}if(n.deleteShader(r),!n.getShaderParameter(s,n.COMPILE_STATUS)){const a=`Vertex shader compilation failed: ${n.getShaderInfoLog(s)}`;throw new Error(a)}if(n.deleteShader(s),!n.getProgramParameter(o,n.LINK_STATUS)){const a=`GL program linking failed: ${n.getProgramInfoLog(o)}`;throw new Error(a)}return o}getUniformLocation(e){const t=Ue(this.currentProgram_);return this.uniformLocationsByProgram_[t]===void 0&&(this.uniformLocationsByProgram_[t]={}),this.uniformLocationsByProgram_[t][e]===void 0&&(this.uniformLocationsByProgram_[t][e]=this.gl_.getUniformLocation(this.currentProgram_,e)),this.uniformLocationsByProgram_[t][e]}getAttributeLocation(e){const t=Ue(this.currentProgram_);return this.attribLocationsByProgram_[t]===void 0&&(this.attribLocationsByProgram_[t]={}),this.attribLocationsByProgram_[t][e]===void 0&&(this.attribLocationsByProgram_[t][e]=this.gl_.getAttribLocation(this.currentProgram_,e)),this.attribLocationsByProgram_[t][e]}makeProjectionTransform(e,t){const n=e.size,r=e.viewState.rotation,s=e.viewState.resolution,o=e.viewState.center;return _s(t,0,0,2/(s*n[0]),2/(s*n[1]),-r,-o[0],-o[1]),t}setUniformFloatValue(e,t){this.gl_.uniform1f(this.getUniformLocation(e),t)}setUniformFloatVec2(e,t){this.gl_.uniform2fv(this.getUniformLocation(e),t)}setUniformFloatVec4(e,t){this.gl_.uniform4fv(this.getUniformLocation(e),t)}setUniformMatrixValue(e,t){this.gl_.uniformMatrix4fv(this.getUniformLocation(e),!1,t)}disableAllAttributes_(){for(let e=0;e<this.maxAttributeCount_;e++)this.gl_.disableVertexAttribArray(e)}enableAttributeArray_(e,t,n,r,s,o){const a=this.getAttributeLocation(e);a<0||(this.gl_.enableVertexAttribArray(a),this.gl_.vertexAttribPointer(a,t,n,!1,r,s),o&&this.getInstancedRenderingExtension_().vertexAttribDivisorANGLE(a,1))}enableAttributes_(e,t){const n=rD(e);let r=0;for(let s=0;s<e.length;s++){const o=e[s];o.name&&this.enableAttributeArray_(o.name,o.size,o.type||RC,n,r,t),r+=o.size*IC(o.type)}}enableAttributes(e){this.enableAttributes_(e,!1)}enableAttributesInstanced(e){this.enableAttributes_(e,!0)}handleWebGLContextLost(e){jl(this.bufferCache_),this.currentProgram_=null,e.preventDefault()}handleWebGLContextRestored(){this.needsToBeRecreated_=!0}needsToBeRecreated(){return this.needsToBeRecreated_}createTexture(e,t,n,r){const s=this.gl_;n=n||s.createTexture();const o=r?s.NEAREST:s.LINEAR;s.bindTexture(s.TEXTURE_2D,n),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,o),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,o),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const a=0,l=s.RGBA,c=0,h=s.RGBA,u=s.UNSIGNED_BYTE;return t instanceof Uint8Array?s.texImage2D(s.TEXTURE_2D,a,l,e[0],e[1],c,h,u,t):t?s.texImage2D(s.TEXTURE_2D,a,l,h,u,t):s.texImage2D(s.TEXTURE_2D,a,l,e[0],e[1],c,h,u,null),n}}function rD(i){let e=0;for(let t=0;t<i.length;t++){const n=i[t];e+=n.size*IC(n.type)}return e}function IC(i){switch(i){case $n.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case $n.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case $n.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT;case $n.FLOAT:default:return Float32Array.BYTES_PER_ELEMENT}}class sD extends Nu{constructor(e){super(),this.tile,this.handleTileChange_=this.handleTileChange_.bind(this),this.gutter=e.gutter||0,this.helper=e.helper,this.loaded=!1,this.ready=!1}setTile(e){if(e!==this.tile)if(this.tile&&this.tile.removeEventListener(Qe.CHANGE,this.handleTileChange_),this.tile=e,this.loaded=e.getState()===Oe.LOADED,this.loaded)this.uploadTile();else{if(e instanceof Gm){const t=e.getImage();t instanceof Image&&!t.crossOrigin&&(t.crossOrigin="anonymous")}e.addEventListener(Qe.CHANGE,this.handleTileChange_)}}uploadTile(){Kt()}setReady(){this.ready=!0,this.dispatchEvent(Qe.CHANGE)}handleTileChange_(){this.tile.getState()===Oe.LOADED&&(this.loaded=!0,this.uploadTile())}setHelper(e){this.helper=e,this.helper&&this.loaded&&this.uploadTile()}disposeInternal(){this.setHelper(null),this.tile.removeEventListener(Qe.CHANGE,this.handleTileChange_)}}function NC(i,e,t){const n=t?i.LINEAR:i.NEAREST;i.bindTexture(i.TEXTURE_2D,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,n),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,n)}function oD(i,e,t,n){NC(i,e,n),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t)}function mE(i,e,t,n,r,s){const o=i.getGL();let a,l;t instanceof Float32Array?(a=o.FLOAT,i.getExtension("OES_texture_float"),l=i.getExtension("OES_texture_float_linear")!==null):(a=o.UNSIGNED_BYTE,l=!0),NC(o,e,s&&l);const c=t.byteLength/n[1];let h=1;c%8===0?h=8:c%4===0?h=4:c%2===0&&(h=2);let u;switch(r){case 1:{u=o.LUMINANCE;break}case 2:{u=o.LUMINANCE_ALPHA;break}case 3:{u=o.RGB;break}case 4:{u=o.RGBA;break}default:throw new Error(`Unsupported number of bands: ${r}`)}const f=o.getParameter(o.UNPACK_ALIGNMENT);o.pixelStorei(o.UNPACK_ALIGNMENT,h),o.texImage2D(o.TEXTURE_2D,0,u,n[0],n[1],0,u,a,t),o.pixelStorei(o.UNPACK_ALIGNMENT,f)}let Bh=null;function aD(){Bh=Xi(1,1,void 0,{willReadFrequently:!0})}class lD extends sD{constructor(e){super(e),this.textures=[],this.renderSize_=Hi(e.grid.getTileSize(e.tile.tileCoord[0])),this.bandCount=NaN;const t=new id(Gd,Zx);t.fromArray([0,1,1,1,1,0,0,0]),this.helper.flushBufferData(t),this.coords=t,this.setTile(e.tile)}setHelper(e){const t=this.helper?.getGL();if(t){this.helper.deleteBuffer(this.coords);for(let n=0;n<this.textures.length;++n)t.deleteTexture(this.textures[n])}super.setHelper(e),e&&e.flushBufferData(this.coords)}uploadTile(){const e=this.helper,t=e.getGL(),n=this.tile;this.textures.length=0;let r;n instanceof Gm||n instanceof Nx?r=n.getImage():r=n.getData();const s=Au(r);if(s){const x=t.createTexture();this.textures.push(x),this.bandCount=4,oD(t,x,s,n.interpolate),this.setReady();return}r=ky(r);const o=n.getSize(),a=[o[0]+2*this.gutter,o[1]+2*this.gutter],l=r instanceof Float32Array,c=a[0]*a[1],h=l?Float32Array:Uint8Array,u=h.BYTES_PER_ELEMENT,f=r.byteLength/a[1];this.bandCount=Math.floor(f/u/a[0]);const d=Math.ceil(this.bandCount/4);if(d===1){const x=t.createTexture();this.textures.push(x),mE(e,x,r,a,this.bandCount,n.interpolate),this.setReady();return}const g=new Array(d);for(let x=0;x<d;++x){const S=t.createTexture();this.textures.push(S);const b=x<d-1?4:(this.bandCount-1)%4+1;g[x]=new h(c*b)}let m=0,_=0;const v=a[0]*this.bandCount;for(let x=0;x<a[1];++x){for(let S=0;S<v;++S){const b=r[_+S],A=Math.floor(m/this.bandCount),F=S%this.bandCount,N=Math.floor(F/4),R=g[N],P=R.length/c,O=F%4;R[A*P+O]=b,++m}_+=f/u}for(let x=0;x<d;++x){const S=this.textures[x],b=g[x],A=b.length/c;mE(e,S,b,a,A,n.interpolate)}this.setReady()}getImagePixelData_(e,t,n){const r=this.gutter,s=this.renderSize_[0],o=this.renderSize_[1];Bh||aD(),Bh.clearRect(0,0,1,1);const a=e.width,l=e.height,c=a-2*r,h=l-2*r,u=r+Math.floor(c*(t/s)),f=r+Math.floor(h*(n/o));let d;try{Bh.drawImage(e,u,f,1,1,0,0,1,1),d=Bh.getImageData(0,0,1,1).data}catch{return Bh=null,null}return d}getArrayPixelData_(e,t,n,r){const s=this.gutter,o=this.renderSize_[0],a=this.renderSize_[1],l=t[0],c=t[1],h=l+2*s,u=c+2*s,f=s+Math.floor(l*(n/o)),d=s+Math.floor(c*(r/a));if(e instanceof DataView){const m=e.byteLength/(h*u),_=m*(d*h+f),v=e.buffer.slice(_,_+m);return new DataView(v)}const g=this.bandCount*(d*h+f);return e.slice(g,g+this.bandCount)}getPixelData(e,t){if(!this.loaded)return null;if(this.tile instanceof Dd){const n=this.tile.getData(),r=ky(n);if(r){const s=this.tile.getSize();return this.getArrayPixelData_(r,s,e,t)}return this.getImagePixelData_(Au(n),e,t)}return this.getImagePixelData_(this.tile.getImage(),e,t)}}class $m extends gC{constructor(e,t){super(e),t=t||{},this.inversePixelTransform_=nn(),this.postProcesses_=t.postProcesses,this.uniforms_=t.uniforms,this.helper,this.onMapChanged_=()=>{this.clearCache(),this.removeHelper()},e.addChangeListener(ai.MAP,this.onMapChanged_),this.dispatchPreComposeEvent=this.dispatchPreComposeEvent.bind(this),this.dispatchPostComposeEvent=this.dispatchPostComposeEvent.bind(this)}dispatchPreComposeEvent(e,t){const n=this.getLayer();if(n.hasListener(qn.PRECOMPOSE)){const r=new Jf(qn.PRECOMPOSE,void 0,t,e);n.dispatchEvent(r)}}dispatchPostComposeEvent(e,t){const n=this.getLayer();if(n.hasListener(qn.POSTCOMPOSE)){const r=new Jf(qn.POSTCOMPOSE,void 0,t,e);n.dispatchEvent(r)}}reset(e){this.uniforms_=e.uniforms,this.helper&&this.helper.setUniforms(this.uniforms_)}removeHelper(){this.helper&&(this.helper.dispose(),delete this.helper)}prepareFrame(e){if(this.getLayer().getRenderSource()){let t=!0,n=-1,r;for(let o=0,a=e.layerStatesArray.length;o<a;o++){const l=e.layerStatesArray[o].layer,c=l.getRenderer();if(!(c instanceof $m)){t=!0;continue}const h=l.getClassName();if((t||h!==r)&&(n+=1,t=!1),r=h,c===this)break}const s="map/"+e.mapId+"/group/"+n;(!this.helper||!this.helper.canvasCacheKeyMatches(s)||this.helper.needsToBeRecreated())&&(this.removeHelper(),this.helper=new nD({postProcesses:this.postProcesses_,uniforms:this.uniforms_,canvasCacheKey:s}),r&&(this.helper.getCanvas().className=r),this.afterHelperCreated())}return this.prepareFrameInternal(e)}afterHelperCreated(){}prepareFrameInternal(e){return!0}clearCache(){}disposeInternal(){this.clearCache(),this.removeHelper(),this.getLayer()?.removeChangeListener(ai.MAP,this.onMapChanged_),super.disposeInternal()}dispatchRenderEvent_(e,t,n){const r=this.getLayer();if(r.hasListener(e)){_s(this.inversePixelTransform_,0,0,n.pixelRatio,-n.pixelRatio,0,0,-n.size[1]);const s=new Jf(e,this.inversePixelTransform_,n,t);r.dispatchEvent(s)}}preRender(e,t){this.dispatchRenderEvent_(qn.PRERENDER,e,t)}postRender(e,t){this.dispatchRenderEvent_(qn.POSTRENDER,e,t)}}const cD={TILE_TRANSFORM:"u_tileTransform",TRANSITION_ALPHA:"u_transitionAlpha",DEPTH:"u_depth",RENDER_EXTENT:"u_renderExtent",PATTERN_ORIGIN:"u_patternOrigin",RESOLUTION:"u_resolution",ZOOM:"u_zoom",GLOBAL_ALPHA:"u_globalAlpha",PROJECTION_MATRIX:"u_projectionMatrix",SCREEN_TO_WORLD_MATRIX:"u_screenToWorldMatrix"};function _E(i){return 1/(i+2)}function hD(){return{tileIds:new Set,representationsByZ:{}}}function yE(i,e){return i.tileIds.has(Ue(e))}function vE(i,e,t){const n=i.representationsByZ;t in n||(n[t]=new Set),n[t].add(e),i.tileIds.add(Ue(e.tile))}function v_(i,e){const t=i.layerStatesArray[i.layerIndex];t.extent&&(e=Mn(e,ps(t.extent,i.viewState.projection)));const n=t.layer.getRenderSource();if(!n.getWrapX()){const r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=Mn(e,r))}return e}function Wy(i,e){return`${Ue(i)},${i.getKey()},${i.getRevision()},${kh(e)}`}class uD extends $m{constructor(e,t){super(e,{uniforms:t.uniforms,postProcesses:t.postProcesses}),this.renderComplete=!1,this.tileTransform_=nn(),this.tempMat4=Zc(),this.tempTileRange_=new Dm(0,0,0,0),this.tempTileCoord_=kc(0,0,0),this.tempSize_=[0,0];const n=t.cacheSize!==void 0?t.cacheSize:512;this.tileRepresentationCache=new Oy(n),this.frameState=null,this.renderedProjection_=void 0}reset(e){super.reset({uniforms:e.uniforms})}prepareFrameInternal(e){this.renderedProjection_?e.viewState.projection!==this.renderedProjection_&&(this.clearCache(),this.renderedProjection_=e.viewState.projection):this.renderedProjection_=e.viewState.projection;const n=this.getLayer().getRenderSource();return!n||Xo(v_(e,e.extent))?!1:n.getState()==="ready"}createTileRepresentation(e){return Kt()}enqueueTiles(e,t,n,r,s){const o=e.viewState,a=this.getLayer(),l=a.getRenderSource(),c=l.getTileGridForProjection(o.projection),h=l.getGutterForProjection(o.projection),u=Ue(l);u in e.wantedTiles||(e.wantedTiles[u]={});const f=e.wantedTiles[u],d=this.tileRepresentationCache,g=a.getMapInternal(),m=Math.max(n-s,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),g?g.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),_=o.rotation,v=_?kv(o.center,o.resolution,_,e.size):void 0;for(let x=n;x>=m;--x){const S=c.getTileRangeForExtentAndZ(t,x,this.tempTileRange_),b=c.getResolution(x);for(let A=S.minX;A<=S.maxX;++A)for(let F=S.minY;F<=S.maxY;++F){if(_&&!c.tileCoordIntersectsViewport([x,A,F],v))continue;const N=kc(x,A,F,this.tempTileCoord_),R=Wy(l,N);let P,O;if(d.containsKey(R)&&(P=d.get(R),O=P.tile),(!P||P.tile.key!==l.getKey())&&(O=l.getTile(x,A,F,e.pixelRatio,o.projection),!O)||yE(r,O))continue;P?P.setTile(O):(P=this.createTileRepresentation({tile:O,grid:c,helper:this.helper,gutter:h}),d.set(R,P)),vE(r,P,x);const L=O.getKey();f[L]=!0,O.getState()===Oe.IDLE&&(e.tileQueue.isKeyQueued(L)||e.tileQueue.enqueue([O,u,c.getTileCoordCenter(N),b]))}}}beforeTilesRender(e,t){this.helper.prepareDraw(this.frameState,!t,!0)}beforeTilesMaskRender(e){return!1}renderTile(e,t,n,r,s,o,a,l,c,h,u){}renderTileMask(e,t,n,r){}drawTile_(e,t,n,r,s,o,a){if(!t.ready)return;const c=t.tile.tileCoord,h=kh(c),u=h in o?o[h]:1,f=a.getResolution(n),d=Hi(a.getTileSize(n),this.tempSize_),g=a.getOrigin(n),m=a.getTileCoordExtent(c),_=u<1?-1:_E(n);u<1&&(e.animate=!0);const v=e.viewState,x=v.center[0],S=v.center[1],b=d[0]+2*r,A=d[1]+2*r,F=b/A,N=(x-g[0])/(d[0]*f),R=(g[1]-S)/(d[1]*f),P=v.resolution/f,O=c[1],L=c[2];by(this.tileTransform_),Yf(this.tileTransform_,2/(e.size[0]*P/b),-2/(e.size[1]*P/b)),O6(this.tileTransform_,v.rotation),Yf(this.tileTransform_,1,1/F),Kv(this.tileTransform_,(d[0]*(O-N)-r)/b,(d[1]*(L-R)-r)/A),this.renderTile(t,this.tileTransform_,e,s,f,d,g,m,_,r,u)}renderFrame(e){this.frameState=e,this.renderComplete=!0;const t=this.helper.getGL();this.preRender(t,e);const n=e.viewState,r=this.getLayer(),s=r.getRenderSource(),o=s.getTileGridForProjection(n.projection),a=s.getGutterForProjection(n.projection),l=v_(e,e.extent),c=o.getZForResolution(n.resolution,s.zDirection),h=hD(),u=r.getPreload();if(e.nextExtent){const S=o.getZForResolution(n.nextResolution,s.zDirection),b=v_(e,e.nextExtent);this.enqueueTiles(e,b,S,h,u)}this.enqueueTiles(e,l,c,h,0),u>0&&setTimeout(()=>{this.enqueueTiles(e,l,c-1,h,u-1)},0);const f={};let d=!1;const g=h.representationsByZ;if(c in g){const S=Ue(this),b=e.time;for(const A of g[c]){const F=A.tile;if(F.getState()===Oe.EMPTY)continue;const N=F.tileCoord;if(A.ready){const O=F.getAlpha(S,b);if(O===1){F.endTransition(S);continue}d=!0;const L=kh(N);f[L]=O}if(this.renderComplete=!1,this.findAltTiles_(o,N,c+1,h))continue;const P=o.getMinZoom();for(let O=c-1;O>=P&&!this.findAltTiles_(o,N,O,h);--O);}}const m=Object.keys(g).map(Number).sort(CT);if(this.beforeTilesMaskRender(e))for(let S=0,b=m.length;S<b;++S){const A=m[S];for(const F of g[A]){const N=F.tile.tileCoord;if(kh(N)in f)continue;const P=o.getTileCoordExtent(N);this.renderTileMask(F,A,P,_E(A))}}this.beforeTilesRender(e,d);for(let S=0,b=m.length;S<b;++S){const A=m[S];for(const F of g[A]){const N=F.tile.tileCoord;kh(N)in f||this.drawTile_(e,F,A,a,l,f,o)}}if(c in g)for(const S of g[c]){const b=S.tile.tileCoord;kh(b)in f&&this.drawTile_(e,S,c,a,l,f,o)}this.beforeFinalize(e),this.helper.finalizeDraw(e,this.dispatchPreComposeEvent,this.dispatchPostComposeEvent);const v=this.helper.getCanvas();return this.tileRepresentationCache.expireCache(),this.postRender(t,e),v}beforeFinalize(e){}findAltTiles_(e,t,n,r){const s=e.getTileRangeForTileCoordAndZ(t,n,this.tempTileRange_);if(!s)return!1;let o=!0;const a=this.tileRepresentationCache,l=this.getLayer().getRenderSource();for(let c=s.minX;c<=s.maxX;++c)for(let h=s.minY;h<=s.maxY;++h){const u=Wy(l,[n,c,h]);let f=!1;if(a.containsKey(u)){const d=a.get(u);d.ready&&!yE(r,d.tile)&&(vE(r,d,n),f=!0)}f||(o=!1)}return o}clearCache(){super.clearCache();const e=this.tileRepresentationCache;e.forEach(t=>t.dispose()),e.clear()}afterHelperCreated(){super.afterHelperCreated(),this.tileRepresentationCache.forEach(e=>e.setHelper(this.helper))}disposeInternal(){super.disposeInternal(),delete this.frameState}}const Nt={...cD,TILE_TEXTURE_ARRAY:"u_tileTextures",TEXTURE_PIXEL_WIDTH:"u_texturePixelWidth",TEXTURE_PIXEL_HEIGHT:"u_texturePixelHeight",TEXTURE_RESOLUTION:"u_textureResolution",TEXTURE_ORIGIN_X:"u_textureOriginX",TEXTURE_ORIGIN_Y:"u_textureOriginY"},Wp={TEXTURE_COORD:"a_textureCoord"},fD=[{name:Wp.TEXTURE_COORD,size:2,type:$n.FLOAT}];class dD extends uD{constructor(e,t){super(e,t),this.program_,this.vertexShader_=t.vertexShader,this.fragmentShader_=t.fragmentShader,this.indices_=new id(Vm,Zx),this.indices_.fromArray([0,1,3,1,2,3]),this.paletteTextures_=t.paletteTextures||[]}reset(e){if(super.reset(e),this.helper){const t=this.helper.getGL();for(const n of this.paletteTextures_)n.delete(t)}if(this.vertexShader_=e.vertexShader,this.fragmentShader_=e.fragmentShader,this.paletteTextures_=e.paletteTextures||[],this.helper){this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_);const t=this.helper.getGL();for(const n of this.paletteTextures_)n.getTexture(t)}}afterHelperCreated(){super.afterHelperCreated();const e=this.helper.getGL();for(const t of this.paletteTextures_)t.getTexture(e);this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_),this.helper.flushBufferData(this.indices_)}removeHelper(){if(this.helper){const e=this.helper.getGL();for(const t of this.paletteTextures_)t.delete(e)}super.removeHelper()}createTileRepresentation(e){return new lD(e)}beforeTilesRender(e,t){super.beforeTilesRender(e,t),this.helper.useProgram(this.program_,e)}renderTile(e,t,n,r,s,o,a,l,c,h,u){const f=this.helper.getGL();this.helper.bindBuffer(e.coords),this.helper.bindBuffer(this.indices_),this.helper.enableAttributes(fD);let d=0;for(;d<e.textures.length;){const F=`${Nt.TILE_TEXTURE_ARRAY}[${d}]`;this.helper.bindTexture(e.textures[d],d,F),++d}for(let F=0;F<this.paletteTextures_.length;++F){const N=this.paletteTextures_[F],R=N.getTexture(f);this.helper.bindTexture(R,d,N.name),++d}const g=n.viewState,m=o[0]+2*h,_=o[1]+2*h,x=e.tile.tileCoord,S=x[1],b=x[2];this.helper.setUniformMatrixValue(Nt.TILE_TRANSFORM,k0(this.tempMat4,t)),this.helper.setUniformFloatValue(Nt.TRANSITION_ALPHA,u),this.helper.setUniformFloatValue(Nt.DEPTH,c);let A=r;h>0&&(A=l,Mn(A,r,A)),this.helper.setUniformFloatVec4(Nt.RENDER_EXTENT,A),this.helper.setUniformFloatValue(Nt.RESOLUTION,g.resolution),this.helper.setUniformFloatValue(Nt.ZOOM,g.zoom),this.helper.setUniformFloatValue(Nt.TEXTURE_PIXEL_WIDTH,m),this.helper.setUniformFloatValue(Nt.TEXTURE_PIXEL_HEIGHT,_),this.helper.setUniformFloatValue(Nt.TEXTURE_RESOLUTION,s),this.helper.setUniformFloatValue(Nt.TEXTURE_ORIGIN_X,a[0]+S*o[0]*s-h*s),this.helper.setUniformFloatValue(Nt.TEXTURE_ORIGIN_Y,a[1]-b*o[1]*s+h*s),this.helper.drawElements(0,this.indices_.getSize())}getData(e){if(!this.helper.getGL())return null;const n=this.frameState;if(!n)return null;const r=this.getLayer(),s=Fi(n.pixelToCoordinateTransform,e.slice()),o=n.viewState,a=r.getExtent();if(a&&!Hr(ps(a,o.projection),s))return null;const l=r.getSources(Ui([s]),o.resolution);let c,h,u;for(c=l.length-1;c>=0;--c)if(h=l[c],h.getState()==="ready"){if(u=h.getTileGridForProjection(o.projection),h.getWrapX())break;const d=u.getExtent();if(!d||Hr(d,s))break}if(c<0)return null;const f=this.tileRepresentationCache;for(let d=u.getZForResolution(o.resolution);d>=u.getMinZoom();--d){const g=u.getTileCoordForCoordAndZ(s,d),m=Wy(h,g);if(!f.containsKey(m))continue;const _=f.get(m);if(_.tile.getState()===Oe.EMPTY)return null;if(!_.loaded)continue;const x=u.getOrigin(d),S=Hi(u.getTileSize(d)),b=u.getResolution(d),A=(s[0]-x[0])/b-g[1]*S[0],F=(x[1]-s[1])/b-g[2]*S[1];return _.getPixelData(A,F)}return null}disposeInternal(){const e=this.helper;if(e){const t=e.getGL();for(const n of this.paletteTextures_)n.delete(t);this.paletteTextures_.length=0,t.deleteProgram(this.program_),delete this.program_,e.deleteBuffer(this.indices_)}super.disposeInternal(),delete this.indices_}}class gD{constructor(e,t){this.name=e,this.data=t,this.texture_=null}getTexture(e){if(!this.texture_){const t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.data.length/4,1,0,e.RGBA,e.UNSIGNED_BYTE,this.data),this.texture_=t}return this.texture_}delete(e){this.texture_&&e.deleteTexture(this.texture_),this.texture_=null}}function pD(i,e){return`operator_${i}_${Object.keys(e.functions).length}`}function Rl(i){const e=i.toString();return e.includes(".")?e:e+".0"}function Jx(i){if(i.length<2||i.length>4)throw new Error("`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.");return`vec${i.length}(${i.map(Rl).join(", ")})`}function Hp(i){const e=so(i),t=e.length>3?e[3]:1;return Jx([e[0]/255,e[1]/255,e[2]/255,t])}function mD(i){const e=Hi(i);return Jx(e)}const x_={};let _D=0;function Ru(i){return i in x_||(x_[i]=_D++),x_[i]}function Aa(i){return Rl(Ru(i))}function Wm(i){return"u_var_"+i}function Qx(){return{variables:{},properties:{},functions:{},bandCount:0,featureId:!1,geometryType:!1}}const w_="getBandValue",FC="u_paletteTextures",OC="featureId",DC="geometryType",Hy=-9999999;function yD(i,e,t,n){const r=Kn(i,e,t);return e5(r,e,n)}function oi(i){return(e,t,n)=>{const r=t.args.length,s=new Array(r);for(let o=0;o<r;++o)s[o]=e5(t.args[o],n,e);return i(s,e)}}const vD={[xe.Get]:(i,e)=>{const n=e.args[0].value;n in i.properties||(i.properties[n]={name:n,type:e.type});let s="a_prop_"+n;return Mo(e.type,Pn)&&(s=`(${s} > 0.0)`),s},[xe.Id]:i=>(i.featureId=!0,"a_"+OC),[xe.GeometryType]:i=>(i.geometryType=!0,"a_"+DC),[xe.LineMetric]:()=>"currentLineMetric",[xe.Var]:(i,e)=>{const n=e.args[0].value;n in i.variables||(i.variables[n]={name:n,type:e.type});let s=Wm(n);return Mo(e.type,Pn)&&(s=`(${s} > 0.0)`),s},[xe.Has]:(i,e)=>{const n=e.args[0].value;return n in i.properties||(i.properties[n]={name:n,type:e.type}),`(a_prop_${n} != ${Rl(Hy)})`},[xe.Resolution]:()=>"u_resolution",[xe.Zoom]:()=>"u_zoom",[xe.Time]:()=>"u_time",[xe.Any]:oi(i=>`(${i.join(" || ")})`),[xe.All]:oi(i=>`(${i.join(" && ")})`),[xe.Not]:oi(([i])=>`(!${i})`),[xe.Equal]:oi(([i,e])=>`(${i} == ${e})`),[xe.NotEqual]:oi(([i,e])=>`(${i} != ${e})`),[xe.GreaterThan]:oi(([i,e])=>`(${i} > ${e})`),[xe.GreaterThanOrEqualTo]:oi(([i,e])=>`(${i} >= ${e})`),[xe.LessThan]:oi(([i,e])=>`(${i} < ${e})`),[xe.LessThanOrEqualTo]:oi(([i,e])=>`(${i} <= ${e})`),[xe.Multiply]:oi(i=>`(${i.join(" * ")})`),[xe.Divide]:oi(([i,e])=>`(${i} / ${e})`),[xe.Add]:oi(i=>`(${i.join(" + ")})`),[xe.Subtract]:oi(([i,e])=>`(${i} - ${e})`),[xe.Clamp]:oi(([i,e,t])=>`clamp(${i}, ${e}, ${t})`),[xe.Mod]:oi(([i,e])=>`mod(${i}, ${e})`),[xe.Pow]:oi(([i,e])=>`pow(${i}, ${e})`),[xe.Abs]:oi(([i])=>`abs(${i})`),[xe.Floor]:oi(([i])=>`floor(${i})`),[xe.Ceil]:oi(([i])=>`ceil(${i})`),[xe.Round]:oi(([i])=>`floor(${i} + 0.5)`),[xe.Sin]:oi(([i])=>`sin(${i})`),[xe.Cos]:oi(([i])=>`cos(${i})`),[xe.Atan]:oi(([i,e])=>e!==void 0?`atan(${i}, ${e})`:`atan(${i})`),[xe.Sqrt]:oi(([i])=>`sqrt(${i})`),[xe.Match]:oi(i=>{const e=i[0],t=i[i.length-1];let n=null;for(let r=i.length-3;r>=1;r-=2){const s=i[r],o=i[r+1];n=`(${e} == ${s} ? ${o} : ${n||t})`}return n}),[xe.Between]:oi(([i,e,t])=>`(${i} >= ${e} && ${i} <= ${t})`),[xe.Interpolate]:oi(([i,e,...t])=>{let n="";for(let r=0;r<t.length-2;r+=2){const s=t[r],o=n||t[r+1],a=t[r+2],l=t[r+3];let c;i===Rl(1)?c=`(${e} - ${s}) / (${a} - ${s})`:c=`(pow(${i}, (${e} - ${s})) - 1.0) / (pow(${i}, (${a} - ${s})) - 1.0)`,n=`mix(${o}, ${l}, clamp(${c}, 0.0, 1.0))`}return n}),[xe.Case]:oi(i=>{const e=i[i.length-1];let t=null;for(let n=i.length-3;n>=0;n-=2){const r=i[n],s=i[n+1];t=`(${r} ? ${s} : ${t||e})`}return t}),[xe.In]:oi(([i,...e],t)=>{const n=pD("in",t),r=[];for(let s=0;s<e.length;s+=1)r.push(` if (inputValue == ${e[s]}) { return true; }`);return t.functions[n]=`bool ${n}(float inputValue) {
116
- ${r.join(`
117
- `)}
118
- return false;
119
- }`,`${n}(${i})`}),[xe.Array]:oi(i=>`vec${i.length}(${i.join(", ")})`),[xe.Color]:oi(i=>{if(i.length===1)return`vec4(vec3(${i[0]} / 255.0), 1.0)`;if(i.length===2)return`vec4(vec3(${i[0]} / 255.0), ${i[1]})`;const e=i.slice(0,3).map(n=>`${n} / 255.0`);if(i.length===3)return`vec4(${e.join(", ")}, 1.0)`;const t=i[3];return`vec4(${e.join(", ")}, ${t})`}),[xe.Band]:oi(([i,e,t],n)=>{if(!(w_ in n.functions)){let r="";const s=n.bandCount||1;for(let o=0;o<s;o++){const a=Math.floor(o/4);let l=o%4;o===s-1&&l===1&&(l=3);const c=`${Nt.TILE_TEXTURE_ARRAY}[${a}]`;r+=` if (band == ${o+1}.0) {
120
- return texture2D(${c}, v_textureCoord + vec2(dx, dy))[${l}];
121
- }
122
- `}n.functions[w_]=`float getBandValue(float band, float xOffset, float yOffset) {
123
- float dx = xOffset / ${Nt.TEXTURE_PIXEL_WIDTH};
124
- float dy = yOffset / ${Nt.TEXTURE_PIXEL_HEIGHT};
125
- ${r}
126
- }`}return`${w_}(${i}, ${e??"0.0"}, ${t??"0.0"})`}),[xe.Palette]:(i,e)=>{const[t,...n]=e.args,r=n.length,s=new Uint8Array(r*4);for(let c=0;c<n.length;c++){const h=n[c].value,u=so(h),f=c*4;s[f]=u[0],s[f+1]=u[1],s[f+2]=u[2],s[f+3]=u[3]*255}i.paletteTextures||(i.paletteTextures=[]);const o=`${FC}[${i.paletteTextures.length}]`,a=new gD(o,s);i.paletteTextures.push(a);const l=e5(t,He,i);return`texture2D(${o}, vec2((${l} + 0.5) / ${r}.0, 0.5))`}};function e5(i,e,t){if(i instanceof _L){const n=vD[i.operator];if(n===void 0)throw new Error(`No compiler defined for this operator: ${JSON.stringify(i.operator)}`);return n(t,i,e)}if((i.type&He)>0)return Rl(i.value);if((i.type&Pn)>0)return i.value.toString();if((i.type&Vn)>0)return Aa(i.value.toString());if((i.type&Vi)>0)return Hp(i.value);if((i.type&Kr)>0)return Jx(i.value);if((i.type&Ps)>0)return mD(i.value);throw new Error(`Unexpected expression ${i.value} (expected type ${Hh(e)})`)}function xD(){return{"fill-color":"rgba(255,255,255,0.4)","stroke-color":"#3399CC","stroke-width":1.25,"circle-radius":5,"circle-fill-color":"rgba(255,255,255,0.4)","circle-stroke-width":1.25,"circle-stroke-color":"#3399CC"}}const xE=.985;function mt(i,e,t){const n=Sx();return yD(e,t,n,i)}function wD(i){const e=so(i),t=e[0]*256,n=e[1],r=e[2]*256,s=Math.round(e[3]*255);return[t+n,r+s]}const bD=`vec4 unpackColor(vec2 packedColor) {
127
- return vec4(
128
- min(floor(packedColor[0] / 256.0) / 255.0, 1.0),
129
- min(mod(packedColor[0], 256.0) / 255.0, 1.0),
130
- min(floor(packedColor[1] / 256.0) / 255.0, 1.0),
131
- min(mod(packedColor[1], 256.0) / 255.0, 1.0)
132
- );
133
- }`;function t5(i){return i===Vi||i===Ps?2:i===Kr?4:1}function Xy(i){const e=t5(i);return e>1?`vec${e}`:"float"}function kC(i,e){for(const t in e.variables){const n=e.variables[t],r=Wm(n.name);let s=Xy(n.type);n.type===Vi&&(s="vec4"),i.addUniform(r,s)}for(const t in e.properties){const n=e.properties[t],r=Xy(n.type),s=`a_prop_${n.name}`;n.type===Vi?i.addAttribute(s,r,`unpackColor(${s})`,"vec4"):i.addAttribute(s,r)}for(const t in e.functions)i.addVertexShaderFunction(e.functions[t]),i.addFragmentShaderFunction(e.functions[t])}function GC(i,e){const t={};for(const n in i.variables){const r=i.variables[n],s=Wm(r.name);t[s]=()=>{const o=e[r.name];if(typeof o=="number")return o;if(typeof o=="boolean")return o?1:0;if(r.type===Vi){const a=[...so(o||"#eee")];return a[0]/=255,a[1]/=255,a[2]/=255,a[3]??=1,a}return typeof o=="string"?Ru(o):o}}return t}function BC(i){const e={};for(const t in i.properties){const n=i.properties[t],r=s=>{const o=s.get(n.name);return n.type===Vi?wD([...so(o||"#eee")]):typeof o=="string"?Ru(o):typeof o=="boolean"?o?1:0:o};e[`prop_${n.name}`]={size:t5(n.type),callback:r}}return e}const Lh=`#ifdef GL_FRAGMENT_PRECISION_HIGH
134
- precision highp float;
135
- #else
136
- precision mediump float;
137
- #endif
138
- uniform mat4 u_projectionMatrix;
139
- uniform mat4 u_screenToWorldMatrix;
140
- uniform vec2 u_viewportSizePx;
141
- uniform float u_pixelRatio;
142
- uniform float u_globalAlpha;
143
- uniform float u_time;
144
- uniform float u_zoom;
145
- uniform float u_resolution;
146
- uniform float u_rotation;
147
- uniform vec4 u_renderExtent;
148
- uniform vec2 u_patternOrigin;
149
- uniform float u_depth;
150
- uniform mediump int u_hitDetection;
151
-
152
- const float PI = 3.141592653589793238;
153
- const float TWO_PI = 2.0 * PI;
154
- float currentLineMetric = 0.; // an actual value will be used in the stroke shaders
155
-
156
- ${bD}
157
- `,Ch=xD();class jC{constructor(){this.uniforms_=[],this.attributes_=[],this.hasSymbol_=!1,this.symbolSizeExpression_=`vec2(${Rl(Ch["circle-radius"])} + ${Rl(Ch["circle-stroke-width"]*.5)})`,this.symbolRotationExpression_="0.0",this.symbolOffsetExpression_="vec2(0.0)",this.symbolColorExpression_=Hp(Ch["circle-fill-color"]),this.texCoordExpression_="vec4(0.0, 0.0, 1.0, 1.0)",this.discardExpression_="false",this.symbolRotateWithView_=!1,this.hasStroke_=!1,this.strokeWidthExpression_=Rl(Ch["stroke-width"]),this.strokeColorExpression_=Hp(Ch["stroke-color"]),this.strokeOffsetExpression_="0.",this.strokeCapExpression_=Aa("round"),this.strokeJoinExpression_=Aa("round"),this.strokeMiterLimitExpression_="10.",this.strokeDistanceFieldExpression_="-1000.",this.strokePatternLengthExpression_=null,this.hasFill_=!1,this.fillColorExpression_=Hp(Ch["fill-color"]),this.vertexShaderFunctions_=[],this.fragmentShaderFunctions_=[]}addUniform(e,t){return this.uniforms_.push({name:e,type:t}),this}addAttribute(e,t,n,r){return this.attributes_.push({name:e,type:t,varyingName:e.replace(/^a_/,"v_"),varyingType:r??t,varyingExpression:n??e}),this}setSymbolSizeExpression(e){return this.hasSymbol_=!0,this.symbolSizeExpression_=e,this}getSymbolSizeExpression(){return this.symbolSizeExpression_}setSymbolRotationExpression(e){return this.symbolRotationExpression_=e,this}setSymbolOffsetExpression(e){return this.symbolOffsetExpression_=e,this}getSymbolOffsetExpression(){return this.symbolOffsetExpression_}setSymbolColorExpression(e){return this.hasSymbol_=!0,this.symbolColorExpression_=e,this}getSymbolColorExpression(){return this.symbolColorExpression_}setTextureCoordinateExpression(e){return this.texCoordExpression_=e,this}setFragmentDiscardExpression(e){return this.discardExpression_=e,this}getFragmentDiscardExpression(){return this.discardExpression_}setSymbolRotateWithView(e){return this.symbolRotateWithView_=e,this}setStrokeWidthExpression(e){return this.hasStroke_=!0,this.strokeWidthExpression_=e,this}setStrokeColorExpression(e){return this.hasStroke_=!0,this.strokeColorExpression_=e,this}getStrokeColorExpression(){return this.strokeColorExpression_}setStrokeOffsetExpression(e){return this.strokeOffsetExpression_=e,this}setStrokeCapExpression(e){return this.strokeCapExpression_=e,this}setStrokeJoinExpression(e){return this.strokeJoinExpression_=e,this}setStrokeMiterLimitExpression(e){return this.strokeMiterLimitExpression_=e,this}setStrokeDistanceFieldExpression(e){return this.strokeDistanceFieldExpression_=e,this}setStrokePatternLengthExpression(e){return this.strokePatternLengthExpression_=e,this}getStrokePatternLengthExpression(){return this.strokePatternLengthExpression_}setFillColorExpression(e){return this.hasFill_=!0,this.fillColorExpression_=e,this}getFillColorExpression(){return this.fillColorExpression_}addVertexShaderFunction(e){return this.vertexShaderFunctions_.includes(e)?this:(this.vertexShaderFunctions_.push(e),this)}addFragmentShaderFunction(e){return this.fragmentShaderFunctions_.includes(e)?this:(this.fragmentShaderFunctions_.push(e),this)}getSymbolVertexShader(){return this.hasSymbol_?`${Lh}
158
- ${this.uniforms_.map(e=>`uniform ${e.type} ${e.name};`).join(`
159
- `)}
160
- attribute vec2 a_position;
161
- attribute vec2 a_localPosition;
162
- attribute vec2 a_hitColor;
163
-
164
- varying vec2 v_texCoord;
165
- varying vec2 v_quadCoord;
166
- varying vec4 v_hitColor;
167
- varying vec2 v_centerPx;
168
- varying float v_angle;
169
- varying vec2 v_quadSizePx;
170
-
171
- ${this.attributes_.map(e=>`attribute ${e.type} ${e.name};
172
- varying ${e.varyingType} ${e.varyingName};`).join(`
173
- `)}
174
- ${this.vertexShaderFunctions_.join(`
175
- `)}
176
- vec2 pxToScreen(vec2 coordPx) {
177
- vec2 scaled = coordPx / u_viewportSizePx / 0.5;
178
- return scaled;
179
- }
180
-
181
- vec2 screenToPx(vec2 coordScreen) {
182
- return (coordScreen * 0.5 + 0.5) * u_viewportSizePx;
183
- }
184
-
185
- void main(void) {
186
- v_quadSizePx = ${this.symbolSizeExpression_};
187
- vec2 halfSizePx = v_quadSizePx * 0.5;
188
- vec2 centerOffsetPx = ${this.symbolOffsetExpression_};
189
- vec2 offsetPx = centerOffsetPx + a_localPosition * halfSizePx * vec2(1., -1.);
190
- float angle = ${this.symbolRotationExpression_}${this.symbolRotateWithView_?" + u_rotation":""};
191
- float c = cos(-angle);
192
- float s = sin(-angle);
193
- offsetPx = vec2(c * offsetPx.x - s * offsetPx.y, s * offsetPx.x + c * offsetPx.y);
194
- vec4 center = u_projectionMatrix * vec4(a_position, 0.0, 1.0);
195
- gl_Position = center + vec4(pxToScreen(offsetPx), u_depth, 0.);
196
- vec4 texCoord = ${this.texCoordExpression_};
197
- float u = mix(texCoord.s, texCoord.p, a_localPosition.x * 0.5 + 0.5);
198
- float v = mix(texCoord.t, texCoord.q, a_localPosition.y * 0.5 + 0.5);
199
- v_texCoord = vec2(u, v);
200
- v_hitColor = unpackColor(a_hitColor);
201
- v_angle = angle;
202
- c = cos(-v_angle);
203
- s = sin(-v_angle);
204
- centerOffsetPx = vec2(c * centerOffsetPx.x - s * centerOffsetPx.y, s * centerOffsetPx.x + c * centerOffsetPx.y);
205
- v_centerPx = screenToPx(center.xy) + centerOffsetPx;
206
- ${this.attributes_.map(e=>` ${e.varyingName} = ${e.varyingExpression};`).join(`
207
- `)}
208
- }`:null}getSymbolFragmentShader(){return this.hasSymbol_?`${Lh}
209
- ${this.uniforms_.map(e=>`uniform ${e.type} ${e.name};`).join(`
210
- `)}
211
- varying vec2 v_texCoord;
212
- varying vec4 v_hitColor;
213
- varying vec2 v_centerPx;
214
- varying float v_angle;
215
- varying vec2 v_quadSizePx;
216
- ${this.attributes_.map(e=>`varying ${e.varyingType} ${e.varyingName};`).join(`
217
- `)}
218
- ${this.fragmentShaderFunctions_.join(`
219
- `)}
220
-
221
- void main(void) {
222
- ${this.attributes_.map(e=>` ${e.varyingType} ${e.name} = ${e.varyingName}; // assign to original attribute name`).join(`
223
- `)}
224
- if (${this.discardExpression_}) { discard; }
225
- vec2 coordsPx = gl_FragCoord.xy / u_pixelRatio - v_centerPx; // relative to center
226
- float c = cos(v_angle);
227
- float s = sin(v_angle);
228
- coordsPx = vec2(c * coordsPx.x - s * coordsPx.y, s * coordsPx.x + c * coordsPx.y);
229
- gl_FragColor = ${this.symbolColorExpression_};
230
- gl_FragColor.rgb *= gl_FragColor.a;
231
- if (u_hitDetection > 0) {
232
- if (gl_FragColor.a < 0.05) { discard; };
233
- gl_FragColor = v_hitColor;
234
- }
235
- }`:null}getStrokeVertexShader(){return this.hasStroke_?`${Lh}
236
- ${this.uniforms_.map(e=>`uniform ${e.type} ${e.name};`).join(`
237
- `)}
238
- attribute vec2 a_segmentStart;
239
- attribute vec2 a_segmentEnd;
240
- attribute vec2 a_localPosition;
241
- attribute float a_measureStart;
242
- attribute float a_measureEnd;
243
- attribute float a_angleTangentSum;
244
- attribute float a_distanceLow;
245
- attribute float a_distanceHigh;
246
- attribute vec2 a_joinAngles;
247
- attribute vec2 a_hitColor;
248
-
249
- varying vec2 v_segmentStartPx;
250
- varying vec2 v_segmentEndPx;
251
- varying float v_angleStart;
252
- varying float v_angleEnd;
253
- varying float v_width;
254
- varying vec4 v_hitColor;
255
- varying float v_distancePx;
256
- varying float v_measureStart;
257
- varying float v_measureEnd;
258
-
259
- ${this.attributes_.map(e=>`attribute ${e.type} ${e.name};
260
- varying ${e.varyingType} ${e.varyingName};`).join(`
261
- `)}
262
- ${this.vertexShaderFunctions_.join(`
263
- `)}
264
- vec2 worldToPx(vec2 worldPos) {
265
- vec4 screenPos = u_projectionMatrix * vec4(worldPos, 0.0, 1.0);
266
- return (0.5 * screenPos.xy + 0.5) * u_viewportSizePx;
267
- }
268
-
269
- vec4 pxToScreen(vec2 pxPos) {
270
- vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;
271
- return vec4(screenPos, u_depth, 1.0);
272
- }
273
-
274
- bool isCap(float joinAngle) {
275
- return joinAngle < -0.1;
276
- }
277
-
278
- vec2 getJoinOffsetDirection(vec2 normalPx, float joinAngle) {
279
- float halfAngle = joinAngle / 2.0;
280
- float c = cos(halfAngle);
281
- float s = sin(halfAngle);
282
- vec2 angleBisectorNormal = vec2(s * normalPx.x + c * normalPx.y, -c * normalPx.x + s * normalPx.y);
283
- float length = 1.0 / s;
284
- return angleBisectorNormal * length;
285
- }
286
-
287
- vec2 getOffsetPoint(vec2 point, vec2 normal, float joinAngle, float offsetPx) {
288
- // if on a cap or the join angle is too high, offset the line along the segment normal
289
- if (cos(joinAngle) > 0.998 || isCap(joinAngle)) {
290
- return point - normal * offsetPx;
291
- }
292
- // offset is applied along the inverted normal (positive offset goes "right" relative to line direction)
293
- return point - getJoinOffsetDirection(normal, joinAngle) * offsetPx;
294
- }
295
-
296
- void main(void) {
297
- v_angleStart = a_joinAngles.x;
298
- v_angleEnd = a_joinAngles.y;
299
- float startEndRatio = a_localPosition.x * 0.5 + 0.5;
300
- currentLineMetric = mix(a_measureStart, a_measureEnd, startEndRatio);
301
- // we're reading the fractional part while keeping the sign (so -4.12 gives -0.12, 3.45 gives 0.45)
302
-
303
- float lineWidth = ${this.strokeWidthExpression_};
304
- float lineOffsetPx = ${this.strokeOffsetExpression_};
305
-
306
- // compute segment start/end in px with offset
307
- vec2 segmentStartPx = worldToPx(a_segmentStart);
308
- vec2 segmentEndPx = worldToPx(a_segmentEnd);
309
- vec2 tangentPx = normalize(segmentEndPx - segmentStartPx);
310
- vec2 normalPx = vec2(-tangentPx.y, tangentPx.x);
311
- segmentStartPx = getOffsetPoint(segmentStartPx, normalPx, v_angleStart, lineOffsetPx),
312
- segmentEndPx = getOffsetPoint(segmentEndPx, normalPx, v_angleEnd, lineOffsetPx);
313
-
314
- // compute current vertex position
315
- float normalDir = -1. * a_localPosition.y;
316
- float tangentDir = -1. * a_localPosition.x;
317
- float angle = mix(v_angleStart, v_angleEnd, startEndRatio);
318
- vec2 joinDirection;
319
- vec2 positionPx = mix(segmentStartPx, segmentEndPx, startEndRatio);
320
- // if angle is too high, do not make a proper join
321
- if (cos(angle) > ${xE} || isCap(angle)) {
322
- joinDirection = normalPx * normalDir - tangentPx * tangentDir;
323
- } else {
324
- joinDirection = getJoinOffsetDirection(normalPx * normalDir, angle);
325
- }
326
- positionPx = positionPx + joinDirection * (lineWidth * 0.5 + 1.); // adding 1 pixel for antialiasing
327
- gl_Position = pxToScreen(positionPx);
328
-
329
- v_segmentStartPx = segmentStartPx;
330
- v_segmentEndPx = segmentEndPx;
331
- v_width = lineWidth;
332
- v_hitColor = unpackColor(a_hitColor);
333
-
334
- v_distancePx = a_distanceLow / u_resolution - (lineOffsetPx * a_angleTangentSum);
335
- float distanceHighPx = a_distanceHigh / u_resolution;
336
- ${this.strokePatternLengthExpression_!==null?`v_distancePx = mod(v_distancePx, ${this.strokePatternLengthExpression_});
337
- distanceHighPx = mod(distanceHighPx, ${this.strokePatternLengthExpression_});
338
- `:""}v_distancePx += distanceHighPx;
339
-
340
- v_measureStart = a_measureStart;
341
- v_measureEnd = a_measureEnd;
342
- ${this.attributes_.map(e=>` ${e.varyingName} = ${e.varyingExpression};`).join(`
343
- `)}
344
- }`:null}getStrokeFragmentShader(){return this.hasStroke_?`${Lh}
345
- ${this.uniforms_.map(e=>`uniform ${e.type} ${e.name};`).join(`
346
- `)}
347
- varying vec2 v_segmentStartPx;
348
- varying vec2 v_segmentEndPx;
349
- varying float v_angleStart;
350
- varying float v_angleEnd;
351
- varying float v_width;
352
- varying vec4 v_hitColor;
353
- varying float v_distancePx;
354
- varying float v_measureStart;
355
- varying float v_measureEnd;
356
- ${this.attributes_.map(e=>`varying ${e.varyingType} ${e.varyingName};`).join(`
357
- `)}
358
- ${this.fragmentShaderFunctions_.join(`
359
- `)}
360
-
361
- vec2 pxToWorld(vec2 pxPos) {
362
- vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;
363
- return (u_screenToWorldMatrix * vec4(screenPos, 0.0, 1.0)).xy;
364
- }
365
-
366
- bool isCap(float joinAngle) {
367
- return joinAngle < -0.1;
368
- }
369
-
370
- float segmentDistanceField(vec2 point, vec2 start, vec2 end, float width) {
371
- vec2 tangent = normalize(end - start);
372
- vec2 normal = vec2(-tangent.y, tangent.x);
373
- vec2 startToPoint = point - start;
374
- return abs(dot(startToPoint, normal)) - width * 0.5;
375
- }
376
-
377
- float buttCapDistanceField(vec2 point, vec2 start, vec2 end) {
378
- vec2 startToPoint = point - start;
379
- vec2 tangent = normalize(end - start);
380
- return dot(startToPoint, -tangent);
381
- }
382
-
383
- float squareCapDistanceField(vec2 point, vec2 start, vec2 end, float width) {
384
- return buttCapDistanceField(point, start, end) - width * 0.5;
385
- }
386
-
387
- float roundCapDistanceField(vec2 point, vec2 start, vec2 end, float width) {
388
- float onSegment = max(0., 1000. * dot(point - start, end - start)); // this is very high when inside the segment
389
- return length(point - start) - width * 0.5 - onSegment;
390
- }
391
-
392
- float roundJoinDistanceField(vec2 point, vec2 start, vec2 end, float width) {
393
- return roundCapDistanceField(point, start, end, width);
394
- }
395
-
396
- float bevelJoinField(vec2 point, vec2 start, vec2 end, float width, float joinAngle) {
397
- vec2 startToPoint = point - start;
398
- vec2 tangent = normalize(end - start);
399
- float c = cos(joinAngle * 0.5);
400
- float s = sin(joinAngle * 0.5);
401
- float direction = -sign(sin(joinAngle));
402
- vec2 bisector = vec2(c * tangent.x - s * tangent.y, s * tangent.x + c * tangent.y);
403
- float radius = width * 0.5 * s;
404
- return dot(startToPoint, bisector * direction) - radius;
405
- }
406
-
407
- float miterJoinDistanceField(vec2 point, vec2 start, vec2 end, float width, float joinAngle) {
408
- if (cos(joinAngle) > ${xE}) { // avoid risking a division by zero
409
- return bevelJoinField(point, start, end, width, joinAngle);
410
- }
411
- float miterLength = 1. / sin(joinAngle * 0.5);
412
- float miterLimit = ${this.strokeMiterLimitExpression_};
413
- if (miterLength > miterLimit) {
414
- return bevelJoinField(point, start, end, width, joinAngle);
415
- }
416
- return -1000.;
417
- }
418
-
419
- float capDistanceField(vec2 point, vec2 start, vec2 end, float width, float capType) {
420
- if (capType == ${Aa("butt")}) {
421
- return buttCapDistanceField(point, start, end);
422
- } else if (capType == ${Aa("square")}) {
423
- return squareCapDistanceField(point, start, end, width);
424
- }
425
- return roundCapDistanceField(point, start, end, width);
426
- }
427
-
428
- float joinDistanceField(vec2 point, vec2 start, vec2 end, float width, float joinAngle, float joinType) {
429
- if (joinType == ${Aa("bevel")}) {
430
- return bevelJoinField(point, start, end, width, joinAngle);
431
- } else if (joinType == ${Aa("miter")}) {
432
- return miterJoinDistanceField(point, start, end, width, joinAngle);
433
- }
434
- return roundJoinDistanceField(point, start, end, width);
435
- }
436
-
437
- float computeSegmentPointDistance(vec2 point, vec2 start, vec2 end, float width, float joinAngle, float capType, float joinType) {
438
- if (isCap(joinAngle)) {
439
- return capDistanceField(point, start, end, width, capType);
440
- }
441
- return joinDistanceField(point, start, end, width, joinAngle, joinType);
442
- }
443
-
444
- float distanceFromSegment(vec2 point, vec2 start, vec2 end) {
445
- vec2 tangent = end - start;
446
- vec2 startToPoint = point - start;
447
- // inspire by capsule fn in https://iquilezles.org/articles/distfunctions/
448
- float h = clamp(dot(startToPoint, tangent) / dot(tangent, tangent), 0.0, 1.0);
449
- return length(startToPoint - tangent * h);
450
- }
451
-
452
- void main(void) {
453
- ${this.attributes_.map(e=>` ${e.varyingType} ${e.name} = ${e.varyingName}; // assign to original attribute name`).join(`
454
- `)}
455
-
456
- vec2 currentPointPx = gl_FragCoord.xy / u_pixelRatio;
457
- #ifdef GL_FRAGMENT_PRECISION_HIGH
458
- vec2 worldPos = pxToWorld(currentPointPx);
459
- if (
460
- abs(u_renderExtent[0] - u_renderExtent[2]) > 0.0 && (
461
- worldPos[0] < u_renderExtent[0] ||
462
- worldPos[1] < u_renderExtent[1] ||
463
- worldPos[0] > u_renderExtent[2] ||
464
- worldPos[1] > u_renderExtent[3]
465
- )
466
- ) {
467
- discard;
468
- }
469
- #endif
470
-
471
- float segmentLengthPx = length(v_segmentEndPx - v_segmentStartPx);
472
- segmentLengthPx = max(segmentLengthPx, 1.17549429e-38); // avoid divide by zero
473
- vec2 segmentTangent = (v_segmentEndPx - v_segmentStartPx) / segmentLengthPx;
474
- vec2 segmentNormal = vec2(-segmentTangent.y, segmentTangent.x);
475
- vec2 startToPointPx = currentPointPx - v_segmentStartPx;
476
- float lengthToPointPx = max(0., min(dot(segmentTangent, startToPointPx), segmentLengthPx));
477
- float currentLengthPx = lengthToPointPx + v_distancePx;
478
- float currentRadiusPx = distanceFromSegment(currentPointPx, v_segmentStartPx, v_segmentEndPx);
479
- float currentRadiusRatio = dot(segmentNormal, startToPointPx) * 2. / v_width;
480
- currentLineMetric = mix(v_measureStart, v_measureEnd, lengthToPointPx / segmentLengthPx);
481
-
482
- if (${this.discardExpression_}) { discard; }
483
-
484
- float capType = ${this.strokeCapExpression_};
485
- float joinType = ${this.strokeJoinExpression_};
486
- float segmentStartDistance = computeSegmentPointDistance(currentPointPx, v_segmentStartPx, v_segmentEndPx, v_width, v_angleStart, capType, joinType);
487
- float segmentEndDistance = computeSegmentPointDistance(currentPointPx, v_segmentEndPx, v_segmentStartPx, v_width, v_angleEnd, capType, joinType);
488
- float distanceField = max(
489
- segmentDistanceField(currentPointPx, v_segmentStartPx, v_segmentEndPx, v_width),
490
- max(segmentStartDistance, segmentEndDistance)
491
- );
492
- distanceField = max(distanceField, ${this.strokeDistanceFieldExpression_});
493
-
494
- vec4 color = ${this.strokeColorExpression_};
495
- color.a *= smoothstep(0.5, -0.5, distanceField);
496
- gl_FragColor = color;
497
- gl_FragColor.a *= u_globalAlpha;
498
- gl_FragColor.rgb *= gl_FragColor.a;
499
- if (u_hitDetection > 0) {
500
- if (gl_FragColor.a < 0.1) { discard; };
501
- gl_FragColor = v_hitColor;
502
- }
503
- }`:null}getFillVertexShader(){return this.hasFill_?`${Lh}
504
- ${this.uniforms_.map(e=>`uniform ${e.type} ${e.name};`).join(`
505
- `)}
506
- attribute vec2 a_position;
507
- attribute vec2 a_hitColor;
508
-
509
- varying vec4 v_hitColor;
510
-
511
- ${this.attributes_.map(e=>`attribute ${e.type} ${e.name};
512
- varying ${e.varyingType} ${e.varyingName};`).join(`
513
- `)}
514
- ${this.vertexShaderFunctions_.join(`
515
- `)}
516
- void main(void) {
517
- gl_Position = u_projectionMatrix * vec4(a_position, u_depth, 1.0);
518
- v_hitColor = unpackColor(a_hitColor);
519
- ${this.attributes_.map(e=>` ${e.varyingName} = ${e.varyingExpression};`).join(`
520
- `)}
521
- }`:null}getFillFragmentShader(){return this.hasFill_?`${Lh}
522
- ${this.uniforms_.map(e=>`uniform ${e.type} ${e.name};`).join(`
523
- `)}
524
- varying vec4 v_hitColor;
525
- ${this.attributes_.map(e=>`varying ${e.varyingType} ${e.varyingName};`).join(`
526
- `)}
527
- ${this.fragmentShaderFunctions_.join(`
528
- `)}
529
- vec2 pxToWorld(vec2 pxPos) {
530
- vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;
531
- return (u_screenToWorldMatrix * vec4(screenPos, 0.0, 1.0)).xy;
532
- }
533
-
534
- vec2 worldToPx(vec2 worldPos) {
535
- vec4 screenPos = u_projectionMatrix * vec4(worldPos, 0.0, 1.0);
536
- return (0.5 * screenPos.xy + 0.5) * u_viewportSizePx;
537
- }
538
-
539
- void main(void) {
540
- ${this.attributes_.map(e=>` ${e.varyingType} ${e.name} = ${e.varyingName}; // assign to original attribute name`).join(`
541
- `)}
542
- vec2 pxPos = gl_FragCoord.xy / u_pixelRatio;
543
- vec2 pxOrigin = worldToPx(u_patternOrigin);
544
- #ifdef GL_FRAGMENT_PRECISION_HIGH
545
- vec2 worldPos = pxToWorld(pxPos);
546
- if (
547
- abs(u_renderExtent[0] - u_renderExtent[2]) > 0.0 && (
548
- worldPos[0] < u_renderExtent[0] ||
549
- worldPos[1] < u_renderExtent[1] ||
550
- worldPos[0] > u_renderExtent[2] ||
551
- worldPos[1] > u_renderExtent[3]
552
- )
553
- ) {
554
- discard;
555
- }
556
- #endif
557
- if (${this.discardExpression_}) { discard; }
558
- gl_FragColor = ${this.fillColorExpression_};
559
- gl_FragColor.a *= u_globalAlpha;
560
- gl_FragColor.rgb *= gl_FragColor.a;
561
- if (u_hitDetection > 0) {
562
- if (gl_FragColor.a < 0.1) { discard; };
563
- gl_FragColor = v_hitColor;
564
- }
565
- }`:null}}class W0{constructor(){this.globalCounter_=0,this.refToFeature_=new Map,this.uidToRef_=new Map,this.freeGlobalRef_=[],this.polygonBatch={entries:{},geometriesCount:0,verticesCount:0,ringsCount:0},this.pointBatch={entries:{},geometriesCount:0},this.lineStringBatch={entries:{},geometriesCount:0,verticesCount:0}}addFeatures(e,t){for(let n=0;n<e.length;n++)this.addFeature(e[n],t)}addFeature(e,t){let n=e.getGeometry();n&&(t&&(n=n.clone(),n.applyTransform(t)),this.addGeometry_(n,e))}clearFeatureEntryInPointBatch_(e){const t=Ue(e),n=this.pointBatch.entries[t];if(n)return this.pointBatch.geometriesCount-=n.flatCoordss.length,delete this.pointBatch.entries[t],n}clearFeatureEntryInLineStringBatch_(e){const t=Ue(e),n=this.lineStringBatch.entries[t];if(n)return this.lineStringBatch.verticesCount-=n.verticesCount,this.lineStringBatch.geometriesCount-=n.flatCoordss.length,delete this.lineStringBatch.entries[t],n}clearFeatureEntryInPolygonBatch_(e){const t=Ue(e),n=this.polygonBatch.entries[t];if(n)return this.polygonBatch.verticesCount-=n.verticesCount,this.polygonBatch.ringsCount-=n.ringsCount,this.polygonBatch.geometriesCount-=n.flatCoordss.length,delete this.polygonBatch.entries[t],n}addGeometry_(e,t){const n=e.getType();switch(n){case"GeometryCollection":{const r=e.getGeometriesArray();for(const s of r)this.addGeometry_(s,t);break}case"MultiPolygon":{const r=e;this.addCoordinates_(n,r.getFlatCoordinates(),r.getEndss(),t,Ue(t),r.getStride());break}case"MultiLineString":{const r=e;this.addCoordinates_(n,r.getFlatCoordinates(),r.getEnds(),t,Ue(t),r.getStride());break}case"MultiPoint":{const r=e;this.addCoordinates_(n,r.getFlatCoordinates(),null,t,Ue(t),r.getStride());break}case"Polygon":{const r=e;this.addCoordinates_(n,r.getFlatCoordinates(),r.getEnds(),t,Ue(t),r.getStride());break}case"Point":{const r=e;this.addCoordinates_(n,r.getFlatCoordinates(),null,t,Ue(t),r.getStride());break}case"LineString":case"LinearRing":{const r=e,s=r.getStride();this.addCoordinates_(n,r.getFlatCoordinates(),null,t,Ue(t),s,r.getLayout?.());break}}}addCoordinates_(e,t,n,r,s,o,a){let l;switch(e){case"MultiPolygon":{const c=n;for(let h=0,u=c.length;h<u;h++){let f=c[h];const d=h>0?c[h-1]:null,g=d?d[d.length-1]:0,m=f[f.length-1];f=g>0?f.map(_=>_-g):f,this.addCoordinates_("Polygon",t.slice(g,m),f,r,s,o,a)}break}case"MultiLineString":{const c=n;for(let h=0,u=c.length;h<u;h++){const f=h>0?c[h-1]:0;this.addCoordinates_("LineString",t.slice(f,c[h]),null,r,s,o,a)}break}case"MultiPoint":for(let c=0,h=t.length;c<h;c+=o)this.addCoordinates_("Point",t.slice(c,c+2),null,r,s,null,null);break;case"Polygon":{const c=n;if(r instanceof As){const f=QT(t,c);if(f.length>1){this.addCoordinates_("MultiPolygon",t,f,r,s,o,a);return}}this.polygonBatch.entries[s]||(this.polygonBatch.entries[s]=this.addRefToEntry_(s,{feature:r,flatCoordss:[],verticesCount:0,ringsCount:0,ringsVerticesCounts:[]})),l=t.length/o;const h=n.length,u=n.map((f,d,g)=>d>0?(f-g[d-1])/o:f/o);this.polygonBatch.verticesCount+=l,this.polygonBatch.ringsCount+=h,this.polygonBatch.geometriesCount++,this.polygonBatch.entries[s].flatCoordss.push(ED(t,o)),this.polygonBatch.entries[s].ringsVerticesCounts.push(u),this.polygonBatch.entries[s].verticesCount+=l,this.polygonBatch.entries[s].ringsCount+=h;for(let f=0,d=c.length;f<d;f++){const g=f>0?c[f-1]:0;this.addCoordinates_("LinearRing",t.slice(g,c[f]),null,r,s,o,a)}break}case"Point":this.pointBatch.entries[s]||(this.pointBatch.entries[s]=this.addRefToEntry_(s,{feature:r,flatCoordss:[]})),this.pointBatch.geometriesCount++,this.pointBatch.entries[s].flatCoordss.push(t);break;case"LineString":case"LinearRing":this.lineStringBatch.entries[s]||(this.lineStringBatch.entries[s]=this.addRefToEntry_(s,{feature:r,flatCoordss:[],verticesCount:0})),l=t.length/o,this.lineStringBatch.verticesCount+=l,this.lineStringBatch.geometriesCount++,this.lineStringBatch.entries[s].flatCoordss.push(SD(t,o,a)),this.lineStringBatch.entries[s].verticesCount+=l;break}}addRefToEntry_(e,t){const n=this.uidToRef_.get(e),r=n||this.freeGlobalRef_.pop()||++this.globalCounter_;return t.ref=r,n||(this.refToFeature_.set(r,t.feature),this.uidToRef_.set(e,r)),t}removeRef_(e,t){if(!e)throw new Error("This feature has no ref: "+t);this.refToFeature_.delete(e),this.uidToRef_.delete(t),this.freeGlobalRef_.push(e)}changeFeature(e,t){if(!this.uidToRef_.get(Ue(e)))return;this.removeFeature(e);let n=e.getGeometry();n&&(t&&(n=n.clone(),n.applyTransform(t)),this.addGeometry_(n,e))}removeFeature(e){let t=this.clearFeatureEntryInPointBatch_(e);t=this.clearFeatureEntryInPolygonBatch_(e)||t,t=this.clearFeatureEntryInLineStringBatch_(e)||t,t&&this.removeRef_(t.ref,Ue(t.feature))}clear(){this.polygonBatch.entries={},this.polygonBatch.geometriesCount=0,this.polygonBatch.verticesCount=0,this.polygonBatch.ringsCount=0,this.lineStringBatch.entries={},this.lineStringBatch.geometriesCount=0,this.lineStringBatch.verticesCount=0,this.pointBatch.entries={},this.pointBatch.geometriesCount=0,this.globalCounter_=0,this.freeGlobalRef_=[],this.refToFeature_.clear(),this.uidToRef_.clear()}getFeatureFromRef(e){return this.refToFeature_.get(e)}isEmpty(){return this.globalCounter_===0}filter(e){const t=new W0;t.globalCounter_=this.globalCounter_,t.uidToRef_=this.uidToRef_,t.refToFeature_=this.refToFeature_;let n=!0;for(const r of this.refToFeature_.values())e(r)&&(t.addFeature(r),n=!1);return n?new W0:t}}function ED(i,e){return e===2?i:i.filter((t,n)=>n%e<2)}function SD(i,e,t){return e===3&&t==="XYM"?i:e===4?i.filter((n,r)=>r%e!==2):e===3?i.map((n,r)=>r%e!==2?n:0):new Array(i.length*1.5).fill(0).map((n,r)=>r%3===2?0:i[Math.round(r/1.5)])}function TD(){const i='function t(t,n,x=2){const o=n&&n.length,i=o?n[0]*x:t.length;let f=e(t,0,i,x,!0);const l=[];if(!f||f.next===f.prev)return l;let c,y,h;if(o&&(f=function(t,n,r,x){const o=[];for(let r=0,i=n.length;r<i;r++){const f=e(t,n[r]*x,r<i-1?n[r+1]*x:t.length,x,!1);f===f.next&&(f.steiner=!0),o.push(a(f))}o.sort(u);for(let t=0;t<o.length;t++)r=s(o[t],r);return r}(t,n,f,x)),t.length>80*x){c=t[0],y=t[1];let e=c,n=y;for(let r=x;r<i;r+=x){const x=t[r],o=t[r+1];x<c&&(c=x),o<y&&(y=o),x>e&&(e=x),o>n&&(n=o)}h=Math.max(e-c,n-y),h=0!==h?32767/h:0}return r(f,l,x,c,y,h,0),l}function e(t,e,n,r,x){let o;if(x===function(t,e,n,r){let x=0;for(let o=e,i=n-r;o<n;o+=r)x+=(t[i]-t[o])*(t[o+1]+t[i+1]),i=o;return x}(t,e,n,r)>0)for(let x=e;x<n;x+=r)o=d(x/r|0,t[x],t[x+1],o);else for(let x=n-r;x>=e;x-=r)o=d(x/r|0,t[x],t[x+1],o);return o&&b(o,o.next)&&(w(o),o=o.next),o}function n(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!b(r,r.next)&&0!==v(r.prev,r,r.next))r=r.next;else{if(w(r),r=e=r.prev,r===r.next)break;n=!0}}while(n||r!==e);return e}function r(t,e,u,s,l,a,y){if(!t)return;!y&&a&&function(t,e,n,r){let x=t;do{0===x.z&&(x.z=c(x.x,x.y,e,n,r)),x.prevZ=x.prev,x.nextZ=x.next,x=x.next}while(x!==t);x.prevZ.nextZ=null,x.prevZ=null,function(t){let e,n=1;do{let r,x=t;t=null;let o=null;for(e=0;x;){e++;let i=x,f=0;for(let t=0;t<n&&(f++,i=i.nextZ,i);t++);let u=n;for(;f>0||u>0&&i;)0!==f&&(0===u||!i||x.z<=i.z)?(r=x,x=x.nextZ,f--):(r=i,i=i.nextZ,u--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;x=i}o.nextZ=null,n*=2}while(e>1)}(x)}(t,s,l,a);let h=t;for(;t.prev!==t.next;){const c=t.prev,p=t.next;if(a?o(t,s,l,a):x(t))e.push(c.i,t.i,p.i),w(t),t=p.next,h=p.next;else if((t=p)===h){y?1===y?r(t=i(n(t),e),e,u,s,l,a,2):2===y&&f(t,e,u,s,l,a):r(n(t),e,u,s,l,a,1);break}}}function x(t){const e=t.prev,n=t,r=t.next;if(v(e,n,r)>=0)return!1;const x=e.x,o=n.x,i=r.x,f=e.y,u=n.y,s=r.y,l=Math.min(x,o,i),c=Math.min(f,u,s),a=Math.max(x,o,i),y=Math.max(f,u,s);let p=r.next;for(;p!==e;){if(p.x>=l&&p.x<=a&&p.y>=c&&p.y<=y&&h(x,f,o,u,i,s,p.x,p.y)&&v(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function o(t,e,n,r){const x=t.prev,o=t,i=t.next;if(v(x,o,i)>=0)return!1;const f=x.x,u=o.x,s=i.x,l=x.y,a=o.y,y=i.y,p=Math.min(f,u,s),b=Math.min(l,a,y),M=Math.max(f,u,s),m=Math.max(l,a,y),A=c(p,b,e,n,r),g=c(M,m,e,n,r);let Z=t.prevZ,d=t.nextZ;for(;Z&&Z.z>=A&&d&&d.z<=g;){if(Z.x>=p&&Z.x<=M&&Z.y>=b&&Z.y<=m&&Z!==x&&Z!==i&&h(f,l,u,a,s,y,Z.x,Z.y)&&v(Z.prev,Z,Z.next)>=0)return!1;if(Z=Z.prevZ,d.x>=p&&d.x<=M&&d.y>=b&&d.y<=m&&d!==x&&d!==i&&h(f,l,u,a,s,y,d.x,d.y)&&v(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;Z&&Z.z>=A;){if(Z.x>=p&&Z.x<=M&&Z.y>=b&&Z.y<=m&&Z!==x&&Z!==i&&h(f,l,u,a,s,y,Z.x,Z.y)&&v(Z.prev,Z,Z.next)>=0)return!1;Z=Z.prevZ}for(;d&&d.z<=g;){if(d.x>=p&&d.x<=M&&d.y>=b&&d.y<=m&&d!==x&&d!==i&&h(f,l,u,a,s,y,d.x,d.y)&&v(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function i(t,e){let r=t;do{const n=r.prev,x=r.next.next;!b(n,x)&&M(n,r,r.next,x)&&g(n,x)&&g(x,n)&&(e.push(n.i,r.i,x.i),w(r),w(r.next),r=t=x),r=r.next}while(r!==t);return n(r)}function f(t,e,x,o,i,f){let u=t;do{let t=u.next.next;for(;t!==u.prev;){if(u.i!==t.i&&p(u,t)){let s=Z(u,t);return u=n(u,u.next),s=n(s,s.next),r(u,e,x,o,i,f,0),void r(s,e,x,o,i,f,0)}t=t.next}u=u.next}while(u!==t)}function u(t,e){let n=t.x-e.x;if(0===n&&(n=t.y-e.y,0===n)){n=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return n}function s(t,e){const r=function(t,e){let n=e;const r=t.x,x=t.y;let o,i=-1/0;if(b(t,n))return n;do{if(b(t,n.next))return n.next;if(x<=n.y&&x>=n.next.y&&n.next.y!==n.y){const t=n.x+(x-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>i&&(i=t,o=n.x<n.next.x?n:n.next,t===r))return o}n=n.next}while(n!==e);if(!o)return null;const f=o,u=o.x,s=o.y;let c=1/0;n=o;do{if(r>=n.x&&n.x>=u&&r!==n.x&&y(x<s?r:i,x,u,s,x<s?i:r,x,n.x,n.y)){const e=Math.abs(x-n.y)/(r-n.x);g(n,t)&&(e<c||e===c&&(n.x>o.x||n.x===o.x&&l(o,n)))&&(o=n,c=e)}n=n.next}while(n!==f);return o}(t,e);if(!r)return e;const x=Z(r,t);return n(x,x.next),n(r,r.next)}function l(t,e){return v(t.prev,t,e.prev)<0&&v(e.next,t,t.next)<0}function c(t,e,n,r,x){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*x|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*x|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function a(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function y(t,e,n,r,x,o,i,f){return(x-i)*(e-f)>=(t-i)*(o-f)&&(t-i)*(r-f)>=(n-i)*(e-f)&&(n-i)*(o-f)>=(x-i)*(r-f)}function h(t,e,n,r,x,o,i,f){return!(t===i&&e===f)&&y(t,e,n,r,x,o,i,f)}function p(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&M(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(g(t,e)&&g(e,t)&&function(t,e){let n=t,r=!1;const x=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&x<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(v(t.prev,t,e.prev)||v(t,e.prev,e))||b(t,e)&&v(t.prev,t,t.next)>0&&v(e.prev,e,e.next)>0)}function v(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function b(t,e){return t.x===e.x&&t.y===e.y}function M(t,e,n,r){const x=A(v(t,e,n)),o=A(v(t,e,r)),i=A(v(n,r,t)),f=A(v(n,r,e));return x!==o&&i!==f||(!(0!==x||!m(t,n,e))||(!(0!==o||!m(t,r,e))||(!(0!==i||!m(n,t,r))||!(0!==f||!m(n,e,r)))))}function m(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function A(t){return t>0?1:t<0?-1:0}function g(t,e){return v(t.prev,t,t.next)<0?v(t,e,t.next)>=0&&v(t,t.prev,e)>=0:v(t,e,t.prev)<0||v(t,t.next,e)<0}function Z(t,e){const n=F(t.i,t.x,t.y),r=F(e.i,e.x,e.y),x=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=x,x.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function d(t,e,n,r){const x=F(t,e,n);return r?(x.next=r.next,x.prev=r,r.next.prev=x,r.next=x):(x.prev=x,x.next=x),x}function w(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function F(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function E(t,e){const n=e[0],r=e[1];return e[0]=t[0]*n+t[2]*r+t[4],e[1]=t[1]*n+t[3]*r+t[5],e}function I(t,e){const n=(r=e)[0]*r[3]-r[1]*r[2];var r;!function(t,e){if(!t)throw new Error(e)}(0!==n,"Transformation matrix cannot be inverted");const x=e[0],o=e[1],i=e[2],f=e[3],u=e[4],s=e[5];return t[0]=f/n,t[1]=-o/n,t[2]=-i/n,t[3]=x/n,t[4]=(i*s-f*u)/n,t[5]=-(x*s-o*u)/n,t}new Array(6);const z=[],B={vertexAttributesPosition:0,instanceAttributesPosition:0,indicesPosition:0};function P(t,e,n,r,x){const o=t[e++],i=t[e++],f=z;f.length=r;for(let n=0;n<f.length;n++)f[n]=t[e+n];let u=x?x.instanceAttributesPosition:0;return n[u++]=o,n[u++]=i,f.length&&(n.set(f,u),u+=f.length),B.instanceAttributesPosition=u,B}function N(t,e,n,r,x,o,i,f,u,s){const l=[t[e],t[e+1]],c=[t[n],t[n+1]],a=t[e+2],y=t[n+2],h=E(f,[...l]),p=E(f,[...c]);function v(t,e,n){const r=Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),x=[(e[0]-t[0])/r,(e[1]-t[1])/r],o=[-x[1],x[0]],i=Math.sqrt((n[0]-t[0])*(n[0]-t[0])+(n[1]-t[1])*(n[1]-t[1])),f=[(n[0]-t[0])/i,(n[1]-t[1])/i];let u=0===r||0===i?0:Math.acos((s=f[0]*x[0]+f[1]*x[1],l=-1,c=1,Math.min(Math.max(s,l),c)));var s,l,c;u=Math.max(u,1e-5);return f[0]*o[0]+f[1]*o[1]>0?u:2*Math.PI-u}let b=-1,M=-1,m=s;const A=null!==x;if(null!==r){b=v(h,p,E(f,[...[t[r],t[r+1]]])),Math.cos(b)<=.985&&(m+=Math.tan((b-Math.PI)/2))}if(A){M=v(p,h,E(f,[...[t[x],t[x+1]]])),Math.cos(M)<=.985&&(m+=Math.tan((Math.PI-M)/2))}const g=Math.pow(2,24),Z=u%g,d=Math.floor(u/g)*g;return o.push(l[0],l[1],a,c[0],c[1],y,b,M,Z,d,s),o.push(...i),{length:u+Math.sqrt((p[0]-h[0])*(p[0]-h[0])+(p[1]-h[1])*(p[1]-h[1])),angle:m}}function R(e,n,r,x,o){const i=2+o;let f=n;const u=e.slice(f,f+o);f+=o;const s=e[f++];let l=0;const c=new Array(s-1);for(let t=0;t<s;t++)l+=e[f++],t<s-1&&(c[t]=l);const a=e.slice(f,f+2*l),y=t(a,c,2);for(let t=0;t<y.length;t++)x.push(y[t]+r.length/i);for(let t=0;t<a.length;t+=2)r.push(a[t],a[t+1],...u);return f+2*l}const S="GENERATE_POLYGON_BUFFERS",T="GENERATE_POINT_BUFFERS",_="GENERATE_LINE_STRING_BUFFERS",O=self;O.onmessage=t=>{const e=t.data;switch(e.type){case T:{const t=2,n=2,r=e.customAttributesSize,x=n+r,o=new Float32Array(e.renderInstructions),i=o.length/x*(t+r),f=Uint32Array.from([0,1,3,1,2,3]),u=Float32Array.from([-1,-1,1,-1,1,1,-1,1]),s=new Float32Array(i);let l;for(let t=0;t<o.length;t+=x)l=P(o,t,s,r,l);const c=Object.assign({indicesBuffer:f.buffer,vertexAttributesBuffer:u.buffer,instanceAttributesBuffer:s.buffer,renderInstructions:o.buffer},e);O.postMessage(c,[u.buffer,s.buffer,f.buffer,o.buffer]);break}case _:{const t=[],n=e.customAttributesSize,r=3,x=new Float32Array(e.renderInstructions);let o=0;const i=[1,0,0,1,0,0];let f,u;for(I(i,e.renderInstructionsTransform);o<x.length;){u=Array.from(x.slice(o,o+n)),o+=n,f=x[o++];const e=o,s=o+(f-1)*r,l=x[e]===x[s]&&x[e+1]===x[s+1];let c=0,a=0;for(let n=0;n<f-1;n++){let y=null;n>0?y=o+(n-1)*r:l&&(y=s-r);let h=null;n<f-2?h=o+(n+2)*r:l&&(h=e+r);const p=N(x,o+n*r,o+(n+1)*r,y,h,t,u,i,c,a);c=p.length,a=p.angle}o+=f*r}const s=Uint32Array.from([0,1,3,1,2,3]),l=Float32Array.from([-1,-1,1,-1,1,1,-1,1]),c=Float32Array.from(t),a=Object.assign({indicesBuffer:s.buffer,vertexAttributesBuffer:l.buffer,instanceAttributesBuffer:c.buffer,renderInstructions:x.buffer},e);O.postMessage(a,[l.buffer,c.buffer,s.buffer,x.buffer]);break}case S:{const t=[],n=[],r=e.customAttributesSize,x=new Float32Array(e.renderInstructions);let o=0;for(;o<x.length;)o=R(x,o,t,n,r);const i=Uint32Array.from(n),f=Float32Array.from(t),u=Float32Array.from([]),s=Object.assign({indicesBuffer:i.buffer,vertexAttributesBuffer:f.buffer,instanceAttributesBuffer:u.buffer,renderInstructions:x.buffer},e);O.postMessage(s,[f.buffer,u.buffer,i.buffer,x.buffer]);break}}};';return new Worker(typeof Blob>"u"?"data:application/javascript;base64,"+Buffer.from(i,"binary").toString("base64"):URL.createObjectURL(new Blob([i],{type:"application/javascript"})))}const b_={GENERATE_POLYGON_BUFFERS:"GENERATE_POLYGON_BUFFERS",GENERATE_POINT_BUFFERS:"GENERATE_POINT_BUFFERS",GENERATE_LINE_STRING_BUFFERS:"GENERATE_LINE_STRING_BUFFERS"};function LD(i,e){e=e||[];const t=256,n=t-1,r=Math.floor(i/t/t/t)/n,s=Math.floor(i/t/t)%t/n,o=Math.floor(i/t)%t/n,a=i%t/n;return e[0]=r*256*255+s*255,e[1]=o*256*255+a*255,e}function CD(i){let e=0;const t=256,n=t-1;return e+=Math.round(i[0]*t*t*t*n),e+=Math.round(i[1]*t*t*n),e+=Math.round(i[2]*t*n),e+=Math.round(i[3]*n),e}function i5(i,e,t,n){let r=0;for(const s in e){const o=e[s],a=o.callback.call(t,t.feature);let l=a?.[0]??a;l===Hy&&console.warn('The "has" operator might return false positives.'),l===void 0?l=Hy:l===null&&(l=0),i[n+r++]=l,!(!o.size||o.size===1)&&(i[n+r++]=a[1],!(o.size<3)&&(i[n+r++]=a[2],!(o.size<4)&&(i[n+r++]=a[3])))}return r}function Hm(i){return Object.keys(i).reduce((e,t)=>e+(i[t].size||1),0)}function AD(i,e,t,n){const r=(2+Hm(t))*i.geometriesCount;(!e||e.length!==r)&&(e=new Float32Array(r));const s=[];let o=0;for(const a in i.entries){const l=i.entries[a];for(let c=0,h=l.flatCoordss.length;c<h;c++)s[0]=l.flatCoordss[c][0],s[1]=l.flatCoordss[c][1],Fi(n,s),e[o++]=s[0],e[o++]=s[1],o+=i5(e,t,l,o)}return e}function PD(i,e,t,n){const r=3*i.verticesCount+(1+Hm(t))*i.geometriesCount;(!e||e.length!==r)&&(e=new Float32Array(r));const s=[];let o=0;for(const a in i.entries){const l=i.entries[a];for(let c=0,h=l.flatCoordss.length;c<h;c++){s.length=l.flatCoordss[c].length,jo(l.flatCoordss[c],0,s.length,3,n,s,3),o+=i5(e,t,l,o),e[o++]=s.length/3;for(let u=0,f=s.length;u<f;u+=3)e[o++]=s[u],e[o++]=s[u+1],e[o++]=s[u+2]}}return e}function MD(i,e,t,n){const r=2*i.verticesCount+(1+Hm(t))*i.geometriesCount+i.ringsCount;(!e||e.length!==r)&&(e=new Float32Array(r));const s=[];let o=0;for(const a in i.entries){const l=i.entries[a];for(let c=0,h=l.flatCoordss.length;c<h;c++){s.length=l.flatCoordss[c].length,jo(l.flatCoordss[c],0,s.length,2,n,s),o+=i5(e,t,l,o),e[o++]=l.ringsVerticesCounts[c].length;for(let u=0,f=l.ringsVerticesCounts[c].length;u<f;u++)e[o++]=l.ringsVerticesCounts[c][u];for(let u=0,f=s.length;u<f;u+=2)e[o++]=s[u],e[o++]=s[u+1]}}return e}function H0(i){return(JSON.stringify(i).split("").reduce((t,n)=>(t<<5)-t+n.charCodeAt(0),0)>>>0).toString()}function n5(i,e,t,n){if(`${n}radius`in i&&n!=="icon-"){let r=mt(t,i[`${n}radius`],He);if(`${n}radius2`in i){const s=mt(t,i[`${n}radius2`],He);r=`max(${r}, ${s})`}`${n}stroke-width`in i&&(r=`(${r} + ${mt(t,i[`${n}stroke-width`],He)} * 0.5)`),e.setSymbolSizeExpression(`vec2(${r} * 2. + 0.5)`)}if(`${n}scale`in i){const r=mt(t,i[`${n}scale`],Ps);e.setSymbolSizeExpression(`${e.getSymbolSizeExpression()} * ${r}`)}`${n}displacement`in i&&e.setSymbolOffsetExpression(mt(t,i[`${n}displacement`],Kr)),`${n}rotation`in i&&e.setSymbolRotationExpression(mt(t,i[`${n}rotation`],He)),`${n}rotate-with-view`in i&&e.setSymbolRotateWithView(!!i[`${n}rotate-with-view`])}function UC(i,e,t,n,r){let s="vec4(0.)";if(e!==null&&(s=e),t!==null&&n!==null){const l=`smoothstep(-${n} + 0.63, -${n} - 0.58, ${i})`;s=`mix(${t}, ${s}, ${l})`}const o=`(1.0 - smoothstep(-0.63, 0.58, ${i}))`;let a=`${s} * vec4(1.0, 1.0, 1.0, ${o})`;return r!==null&&(a=`${a} * vec4(1.0, 1.0, 1.0, ${r})`),a}function r5(i,e,t,n,r){const s=new Image;s.crossOrigin=i[`${n}cross-origin`]===void 0?"anonymous":i[`${n}cross-origin`],Vt(typeof i[`${n}src`]=="string",`WebGL layers do not support expressions for the ${n}src style property`),s.src=i[`${n}src`],t[`u_texture${r}_size`]=()=>s.complete?[s.width,s.height]:[0,0],e.addUniform(`u_texture${r}_size`,"vec2");const o=`u_texture${r}_size`;return t[`u_texture${r}`]=s,e.addUniform(`u_texture${r}`,"sampler2D"),o}function s5(i,e,t,n,r){let s=mt(t,i[`${e}offset`],Ps);if(`${e}offset-origin`in i)switch(i[`${e}offset-origin`]){case"top-right":s=`vec2(${n}.x, 0.) + ${r} * vec2(-1., 0.) + ${s} * vec2(-1., 1.)`;break;case"bottom-left":s=`vec2(0., ${n}.y) + ${r} * vec2(0., -1.) + ${s} * vec2(1., -1.)`;break;case"bottom-right":s=`${n} - ${r} - ${s}`;break}return s}function RD(i,e,t,n){n.functions.circleDistanceField=`float circleDistanceField(vec2 point, float radius) {
566
- return length(point) - radius;
567
- }`,n5(i,e,n,"circle-");let r=null;"circle-opacity"in i&&(r=mt(n,i["circle-opacity"],He));let s="coordsPx";"circle-scale"in i&&(s=`coordsPx / ${mt(n,i["circle-scale"],Ps)}`);let o=null;"circle-fill-color"in i&&(o=mt(n,i["circle-fill-color"],Vi));let a=null;"circle-stroke-color"in i&&(a=mt(n,i["circle-stroke-color"],Vi));let l=mt(n,i["circle-radius"],He),c=null;"circle-stroke-width"in i&&(c=mt(n,i["circle-stroke-width"],He),l=`(${l} + ${c} * 0.5)`);const h=`circleDistanceField(${s}, ${l})`,u=UC(h,o,a,c,r);e.setSymbolColorExpression(u)}function ID(i,e,t,n){n.functions.round=`float round(float v) {
568
- return sign(v) * floor(abs(v) + 0.5);
569
- }`,n.functions.starDistanceField=`float starDistanceField(vec2 point, float numPoints, float radius, float radius2, float angle) {
570
- float startAngle = -PI * 0.5 + angle; // tip starts upwards and rotates clockwise with angle
571
- float c = cos(startAngle);
572
- float s = sin(startAngle);
573
- vec2 pointRotated = vec2(c * point.x - s * point.y, s * point.x + c * point.y);
574
- float alpha = TWO_PI / numPoints; // the angle of one sector
575
- float beta = atan(pointRotated.y, pointRotated.x);
576
- float gamma = round(beta / alpha) * alpha; // angle in sector
577
- c = cos(-gamma);
578
- s = sin(-gamma);
579
- vec2 inSector = vec2(c * pointRotated.x - s * pointRotated.y, abs(s * pointRotated.x + c * pointRotated.y));
580
- vec2 tipToPoint = inSector + vec2(-radius, 0.);
581
- vec2 edgeNormal = vec2(radius2 * sin(alpha * 0.5), -radius2 * cos(alpha * 0.5) + radius);
582
- return dot(normalize(edgeNormal), tipToPoint);
583
- }`,n.functions.regularDistanceField=`float regularDistanceField(vec2 point, float numPoints, float radius, float angle) {
584
- float startAngle = -PI * 0.5 + angle; // tip starts upwards and rotates clockwise with angle
585
- float c = cos(startAngle);
586
- float s = sin(startAngle);
587
- vec2 pointRotated = vec2(c * point.x - s * point.y, s * point.x + c * point.y);
588
- float alpha = TWO_PI / numPoints; // the angle of one sector
589
- float radiusIn = radius * cos(PI / numPoints);
590
- float beta = atan(pointRotated.y, pointRotated.x);
591
- float gamma = round((beta - alpha * 0.5) / alpha) * alpha + alpha * 0.5; // angle in sector from mid
592
- c = cos(-gamma);
593
- s = sin(-gamma);
594
- vec2 inSector = vec2(c * pointRotated.x - s * pointRotated.y, abs(s * pointRotated.x + c * pointRotated.y));
595
- return inSector.x - radiusIn;
596
- }`,n5(i,e,n,"shape-");let r=null;"shape-opacity"in i&&(r=mt(n,i["shape-opacity"],He));let s="coordsPx";"shape-scale"in i&&(s=`coordsPx / ${mt(n,i["shape-scale"],Ps)}`);let o=null;"shape-fill-color"in i&&(o=mt(n,i["shape-fill-color"],Vi));let a=null;"shape-stroke-color"in i&&(a=mt(n,i["shape-stroke-color"],Vi));let l=null;"shape-stroke-width"in i&&(l=mt(n,i["shape-stroke-width"],He));const c=mt(n,i["shape-points"],He);let h="0.";"shape-angle"in i&&(h=mt(n,i["shape-angle"],He));let u,f=mt(n,i["shape-radius"],He);if(l!==null&&(f=`${f} + ${l} * 0.5`),"shape-radius2"in i){let g=mt(n,i["shape-radius2"],He);l!==null&&(g=`${g} + ${l} * 0.5`),u=`starDistanceField(${s}, ${c}, ${f}, ${g}, ${h})`}else u=`regularDistanceField(${s}, ${c}, ${f}, ${h})`;const d=UC(u,o,a,l,r);e.setSymbolColorExpression(d)}function ND(i,e,t,n){let r="vec4(1.0)";"icon-color"in i&&(r=mt(n,i["icon-color"],Vi)),"icon-opacity"in i&&(r=`${r} * vec4(1.0, 1.0, 1.0, ${mt(n,i["icon-opacity"],He)})`);const s=H0(i["icon-src"]),o=r5(i,e,t,"icon-",s);if(e.setSymbolColorExpression(`${r} * texture2D(u_texture${s}, v_texCoord)`).setSymbolSizeExpression(o),"icon-width"in i&&"icon-height"in i&&e.setSymbolSizeExpression(`vec2(${mt(n,i["icon-width"],He)}, ${mt(n,i["icon-height"],He)})`),"icon-offset"in i&&"icon-size"in i){const a=mt(n,i["icon-size"],Kr),l=e.getSymbolSizeExpression();e.setSymbolSizeExpression(a);const c=s5(i,"icon-",n,"v_quadSizePx",a);e.setTextureCoordinateExpression(`(vec4((${c}).xyxy) + vec4(0., 0., ${a})) / (${l}).xyxy`)}if(n5(i,e,n,"icon-"),"icon-anchor"in i){const a=mt(n,i["icon-anchor"],Kr);let l="1.0";"icon-scale"in i&&(l=mt(n,i["icon-scale"],Ps));let c;i["icon-anchor-x-units"]==="pixels"&&i["icon-anchor-y-units"]==="pixels"?c=`${a} * ${l}`:i["icon-anchor-x-units"]==="pixels"?c=`${a} * vec2(vec2(${l}).x, v_quadSizePx.y)`:i["icon-anchor-y-units"]==="pixels"?c=`${a} * vec2(v_quadSizePx.x, vec2(${l}).x)`:c=`${a} * v_quadSizePx`;let h=`v_quadSizePx * vec2(0.5, -0.5) + ${c} * vec2(-1., 1.)`;if("icon-anchor-origin"in i)switch(i["icon-anchor-origin"]){case"top-right":h=`v_quadSizePx * -0.5 + ${c}`;break;case"bottom-left":h=`v_quadSizePx * 0.5 - ${c}`;break;case"bottom-right":h=`v_quadSizePx * vec2(-0.5, 0.5) + ${c} * vec2(1., -1.)`;break}e.setSymbolOffsetExpression(`${e.getSymbolOffsetExpression()} + ${h}`)}}function FD(i,e,t,n){if("stroke-color"in i&&e.setStrokeColorExpression(mt(n,i["stroke-color"],Vi)),"stroke-pattern-src"in i){const r=H0(i["stroke-pattern-src"]),s=r5(i,e,t,"stroke-pattern-",r);let o=s,a="vec2(0.)";"stroke-pattern-offset"in i&&"stroke-pattern-size"in i&&(o=mt(n,i["stroke-pattern-size"],Kr),a=s5(i,"stroke-pattern-",n,s,o));let l="0.";"stroke-pattern-spacing"in i&&(l=mt(n,i["stroke-pattern-spacing"],He));let c="0.";"stroke-pattern-start-offset"in i&&(c=mt(n,i["stroke-pattern-start-offset"],He)),n.functions.sampleStrokePattern=`vec4 sampleStrokePattern(sampler2D texture, vec2 textureSize, vec2 textureOffset, vec2 sampleSize, float spacingPx, float startOffsetPx, float currentLengthPx, float currentRadiusRatio, float lineWidth) {
597
- float currentLengthScaled = (currentLengthPx - startOffsetPx) * sampleSize.y / lineWidth;
598
- float spacingScaled = spacingPx * sampleSize.y / lineWidth;
599
- float uCoordPx = mod(currentLengthScaled, (sampleSize.x + spacingScaled));
600
- float isInsideOfPattern = step(uCoordPx, sampleSize.x);
601
- float vCoordPx = (-currentRadiusRatio * 0.5 + 0.5) * sampleSize.y;
602
- // make sure that we're not sampling too close to the borders to avoid interpolation with outside pixels
603
- uCoordPx = clamp(uCoordPx, 0.5, sampleSize.x - 0.5);
604
- vCoordPx = clamp(vCoordPx, 0.5, sampleSize.y - 0.5);
605
- vec2 texCoord = (vec2(uCoordPx, vCoordPx) + textureOffset) / textureSize;
606
- return texture2D(texture, texCoord) * vec4(1.0, 1.0, 1.0, isInsideOfPattern);
607
- }`;const h=`u_texture${r}`;let u="1.";"stroke-color"in i&&(u=e.getStrokeColorExpression()),e.setStrokeColorExpression(`${u} * sampleStrokePattern(${h}, ${s}, ${a}, ${o}, ${l}, ${c}, currentLengthPx, currentRadiusRatio, v_width)`),n.functions.computeStrokePatternLength=`float computeStrokePatternLength(vec2 sampleSize, float spacingPx, float lineWidth) {
608
- float patternLengthPx = sampleSize.x / sampleSize.y * lineWidth;
609
- return patternLengthPx + spacingPx;
610
- }`,e.setStrokePatternLengthExpression(`computeStrokePatternLength(${o}, ${l}, v_width)`)}if("stroke-width"in i&&e.setStrokeWidthExpression(mt(n,i["stroke-width"],He)),"stroke-offset"in i&&e.setStrokeOffsetExpression(mt(n,i["stroke-offset"],He)),"stroke-line-cap"in i&&e.setStrokeCapExpression(mt(n,i["stroke-line-cap"],Vn)),"stroke-line-join"in i&&e.setStrokeJoinExpression(mt(n,i["stroke-line-join"],Vn)),"stroke-miter-limit"in i&&e.setStrokeMiterLimitExpression(mt(n,i["stroke-miter-limit"],He)),"stroke-line-dash"in i){n.functions.getSingleDashDistance=`float getSingleDashDistance(float distance, float radius, float dashOffset, float dashLength, float dashLengthTotal, float capType, float lineWidth) {
611
- float localDistance = mod(distance, dashLengthTotal);
612
- float distanceSegment = abs(localDistance - dashOffset - dashLength * 0.5) - dashLength * 0.5;
613
- distanceSegment = min(distanceSegment, dashLengthTotal - localDistance);
614
- if (capType == ${Aa("square")}) {
615
- distanceSegment -= lineWidth * 0.5;
616
- } else if (capType == ${Aa("round")}) {
617
- distanceSegment = min(distanceSegment, sqrt(distanceSegment * distanceSegment + radius * radius) - lineWidth * 0.5);
618
- }
619
- return distanceSegment;
620
- }`;let r=i["stroke-line-dash"].map(g=>mt(n,g,He));r.length%2===1&&(r=[...r,...r]);let s="0.";"stroke-line-dash-offset"in i&&(s=mt(n,i["stroke-line-dash-offset"],He));const a=`dashDistanceField_${H0(i["stroke-line-dash"])}`,l=r.map((g,m)=>`float dashLength${m}`).join(", "),c=r.map((g,m)=>`dashLength${m}`).join(" + ");let h="0.",u=`getSingleDashDistance(distance, radius, ${h}, dashLength0, totalDashLength, capType, lineWidth)`;for(let g=2;g<r.length;g+=2)h=`${h} + dashLength${g-2} + dashLength${g-1}`,u=`min(${u}, getSingleDashDistance(distance, radius, ${h}, dashLength${g}, totalDashLength, capType, lineWidth))`;n.functions[a]=`float ${a}(float distance, float radius, float capType, float lineWidth, ${l}) {
621
- float totalDashLength = ${c};
622
- return ${u};
623
- }`;const f=r.map((g,m)=>`${g}`).join(", ");e.setStrokeDistanceFieldExpression(`${a}(currentLengthPx + ${s}, currentRadiusPx, capType, v_width, ${f})`);let d=r.join(" + ");e.getStrokePatternLengthExpression()&&(n.functions.combinePatternLengths=`float combinePatternLengths(float patternLength1, float patternLength2) {
624
- return patternLength1 * patternLength2;
625
- }`,d=`combinePatternLengths(${e.getStrokePatternLengthExpression()}, ${d})`),e.setStrokePatternLengthExpression(d)}}function OD(i,e,t,n){if("fill-color"in i&&e.setFillColorExpression(mt(n,i["fill-color"],Vi)),"fill-pattern-src"in i){const r=H0(i["fill-pattern-src"]),s=r5(i,e,t,"fill-pattern-",r);let o=s,a="vec2(0.)";"fill-pattern-offset"in i&&"fill-pattern-size"in i&&(o=mt(n,i["fill-pattern-size"],Kr),a=s5(i,"fill-pattern-",n,s,o)),n.functions.sampleFillPattern=`vec4 sampleFillPattern(sampler2D texture, vec2 textureSize, vec2 textureOffset, vec2 sampleSize, vec2 pxOrigin, vec2 pxPosition) {
626
- float scaleRatio = pow(2., mod(u_zoom + 0.5, 1.) - 0.5);
627
- vec2 pxRelativePos = pxPosition - pxOrigin;
628
- // rotate the relative position from origin by the current view rotation
629
- pxRelativePos = vec2(pxRelativePos.x * cos(u_rotation) - pxRelativePos.y * sin(u_rotation), pxRelativePos.x * sin(u_rotation) + pxRelativePos.y * cos(u_rotation));
630
- // sample position is computed according to the sample offset & size
631
- vec2 samplePos = mod(pxRelativePos / scaleRatio, sampleSize);
632
- // also make sure that we're not sampling too close to the borders to avoid interpolation with outside pixels
633
- samplePos = clamp(samplePos, vec2(0.5), sampleSize - vec2(0.5));
634
- samplePos.y = sampleSize.y - samplePos.y; // invert y axis so that images appear upright
635
- return texture2D(texture, (samplePos + textureOffset) / textureSize);
636
- }`;const l=`u_texture${r}`;let c="1.";"fill-color"in i&&(c=e.getFillColorExpression()),e.setFillColorExpression(`${c} * sampleFillPattern(${l}, ${s}, ${a}, ${o}, pxOrigin, pxPos)`)}}function wE(i,e,t){const n=Qx(),r=new jC,s={};if("icon-src"in i?ND(i,r,s,n):"shape-points"in i?ID(i,r,s,n):"circle-radius"in i&&RD(i,r,s,n),FD(i,r,s,n),OD(i,r,s,n),t){const l=mt(n,t,Pn);r.setFragmentDiscardExpression(`!${l}`)}const o={};function a(l,c,h,u){if(!n[l])return;const f=Xy(h),d=t5(h);r.addAttribute(`a_${c}`,f),o[c]={size:d,callback:u}}return a("geometryType",DC,Vn,l=>Ru(Tx(l.getGeometry()))),a("featureId",OC,Vn|He,l=>{const c=l.getId()??null;return typeof c=="string"?Ru(c):c}),kC(r,n),{builder:r,attributes:{...o,...BC(n)},uniforms:{...s,...GC(n,e)}}}const DD=[];let E_;function kD(){return E_||(E_=TD()),E_}let GD=0;const Ls={POSITION:"a_position",LOCAL_POSITION:"a_localPosition",SEGMENT_START:"a_segmentStart",SEGMENT_END:"a_segmentEnd",MEASURE_START:"a_measureStart",MEASURE_END:"a_measureEnd",ANGLE_TANGENT_SUM:"a_angleTangentSum",JOIN_ANGLES:"a_joinAngles",DISTANCE_LOW:"a_distanceLow",DISTANCE_HIGH:"a_distanceHigh"};class BD{constructor(e,t,n,r){this.helper_,this.hitDetectionEnabled_=!!r,this.styleShaders=jD(e,t),this.customAttributes_={},this.uniforms_={},this.hitDetectionEnabled_&&(this.customAttributes_.hitColor={callback(){return LD(this.ref,DD)},size:2});for(const s of this.styleShaders){for(const o in s.attributes)o in this.customAttributes_||(this.customAttributes_[o]=s.attributes[o]);for(const o in s.uniforms)o in this.uniforms_||(this.uniforms_[o]=s.uniforms[o])}this.renderPasses_=this.styleShaders.map(s=>{const o={},a=Object.entries(this.customAttributes_).map(([l,c])=>({name:l in s.attributes||l==="hitColor"?`a_${l}`:null,size:c.size||1,type:$n.FLOAT}));return s.builder.getFillVertexShader()&&(o.fillRenderPass={vertexShader:s.builder.getFillVertexShader(),fragmentShader:s.builder.getFillFragmentShader(),attributesDesc:[{name:Ls.POSITION,size:2,type:$n.FLOAT},...a],instancedAttributesDesc:[],instancePrimitiveVertexCount:3}),s.builder.getStrokeVertexShader()&&(o.strokeRenderPass={vertexShader:s.builder.getStrokeVertexShader(),fragmentShader:s.builder.getStrokeFragmentShader(),attributesDesc:[{name:Ls.LOCAL_POSITION,size:2,type:$n.FLOAT}],instancedAttributesDesc:[{name:Ls.SEGMENT_START,size:2,type:$n.FLOAT},{name:Ls.MEASURE_START,size:1,type:$n.FLOAT},{name:Ls.SEGMENT_END,size:2,type:$n.FLOAT},{name:Ls.MEASURE_END,size:1,type:$n.FLOAT},{name:Ls.JOIN_ANGLES,size:2,type:$n.FLOAT},{name:Ls.DISTANCE_LOW,size:1,type:$n.FLOAT},{name:Ls.DISTANCE_HIGH,size:1,type:$n.FLOAT},{name:Ls.ANGLE_TANGENT_SUM,size:1,type:$n.FLOAT},...a],instancePrimitiveVertexCount:6}),s.builder.getSymbolVertexShader()&&(o.symbolRenderPass={vertexShader:s.builder.getSymbolVertexShader(),fragmentShader:s.builder.getSymbolFragmentShader(),attributesDesc:[{name:Ls.LOCAL_POSITION,size:2,type:$n.FLOAT}],instancedAttributesDesc:[{name:Ls.POSITION,size:2,type:$n.FLOAT},...a],instancePrimitiveVertexCount:6}),o}),this.hasFill_=this.renderPasses_.some(s=>s.fillRenderPass),this.hasStroke_=this.renderPasses_.some(s=>s.strokeRenderPass),this.hasSymbol_=this.renderPasses_.some(s=>s.symbolRenderPass),this.setHelper(n)}async generateBuffers(e,t){if(e.isEmpty())return null;const n=this.generateRenderInstructions_(e,t),[r,s,o]=await Promise.all([this.generateBuffersForType_(n.polygonInstructions,"Polygon",t),this.generateBuffersForType_(n.lineStringInstructions,"LineString",t),this.generateBuffersForType_(n.pointInstructions,"Point",t)]),a=Su(nn(),t);return{polygonBuffers:r,lineStringBuffers:s,pointBuffers:o,invertVerticesTransform:a}}generateRenderInstructions_(e,t){const n=this.hasFill_?MD(e.polygonBatch,new Float32Array(0),this.customAttributes_,t):null,r=this.hasStroke_?PD(e.lineStringBatch,new Float32Array(0),this.customAttributes_,t):null,s=this.hasSymbol_?AD(e.pointBatch,new Float32Array(0),this.customAttributes_,t):null;return{polygonInstructions:n,lineStringInstructions:r,pointInstructions:s}}generateBuffersForType_(e,t,n){if(e===null)return null;const r=GD++;let s;switch(t){case"Polygon":s=b_.GENERATE_POLYGON_BUFFERS;break;case"LineString":s=b_.GENERATE_LINE_STRING_BUFFERS;break;case"Point":s=b_.GENERATE_POINT_BUFFERS;break}const o={id:r,type:s,renderInstructions:e.buffer,renderInstructionsTransform:n,customAttributesSize:Hm(this.customAttributes_)},a=kD();return a.postMessage(o,[e.buffer]),e=null,new Promise(l=>{const c=h=>{const u=h.data;if(u.id!==r||(a.removeEventListener("message",c),!this.helper_.getGL()))return;const f=new id(Vm,y_).fromArrayBuffer(u.indicesBuffer),d=new id(Gd,y_).fromArrayBuffer(u.vertexAttributesBuffer),g=new id(Gd,y_).fromArrayBuffer(u.instanceAttributesBuffer);this.helper_.flushBufferData(f),this.helper_.flushBufferData(d),this.helper_.flushBufferData(g),l([f,d,g])};a.addEventListener("message",c)})}render(e,t,n){for(const r of this.renderPasses_)r.fillRenderPass&&this.renderInternal_(e.polygonBuffers[0],e.polygonBuffers[1],e.polygonBuffers[2],r.fillRenderPass,t,n),r.strokeRenderPass&&this.renderInternal_(e.lineStringBuffers[0],e.lineStringBuffers[1],e.lineStringBuffers[2],r.strokeRenderPass,t,n),r.symbolRenderPass&&this.renderInternal_(e.pointBuffers[0],e.pointBuffers[1],e.pointBuffers[2],r.symbolRenderPass,t,n)}renderInternal_(e,t,n,r,s,o){const a=e.getSize();if(a===0)return;const l=r.instancedAttributesDesc.length;if(this.helper_.useProgram(r.program,s),this.helper_.bindBuffer(t),this.helper_.bindBuffer(e),this.helper_.enableAttributes(r.attributesDesc),this.helper_.bindBuffer(n),this.helper_.enableAttributesInstanced(r.instancedAttributesDesc),o(),l){const c=r.instancedAttributesDesc.reduce((u,f)=>u+(f.size||1),0),h=n.getSize()/c;this.helper_.drawElementsInstanced(0,a,h)}else this.helper_.drawElements(0,a)}setHelper(e,t=null){this.helper_=e;for(const n of this.renderPasses_)n.fillRenderPass&&(n.fillRenderPass.program=this.helper_.getProgram(n.fillRenderPass.fragmentShader,n.fillRenderPass.vertexShader)),n.strokeRenderPass&&(n.strokeRenderPass.program=this.helper_.getProgram(n.strokeRenderPass.fragmentShader,n.strokeRenderPass.vertexShader)),n.symbolRenderPass&&(n.symbolRenderPass.program=this.helper_.getProgram(n.symbolRenderPass.fragmentShader,n.symbolRenderPass.vertexShader));this.helper_.addUniforms(this.uniforms_),t&&(t.polygonBuffers&&(this.helper_.flushBufferData(t.polygonBuffers[0]),this.helper_.flushBufferData(t.polygonBuffers[1]),this.helper_.flushBufferData(t.polygonBuffers[2])),t.lineStringBuffers&&(this.helper_.flushBufferData(t.lineStringBuffers[0]),this.helper_.flushBufferData(t.lineStringBuffers[1]),this.helper_.flushBufferData(t.lineStringBuffers[2])),t.pointBuffers&&(this.helper_.flushBufferData(t.pointBuffers[0]),this.helper_.flushBufferData(t.pointBuffers[1]),this.helper_.flushBufferData(t.pointBuffers[2])))}}function jD(i,e){const t=Array.isArray(i)?i:[i];if("style"in t[0]){const n=[],r=t,s=[];for(const o of r){const a=Array.isArray(o.style)?o.style:[o.style];let l=o.filter;o.else&&s.length&&(l=["all",...s.map(h=>["!",h])],o.filter&&l.push(o.filter),l.length<3&&(l=l[1])),o.filter&&s.push(o.filter);const c=a.map(h=>wE(h,e,l));n.push(...c)}return n}return"builder"in t[0]?t:t.map(n=>wE(n,e,null))}const To=new Uint8Array(4);class UD{constructor(e,t){this.helper_=e;const n=e.getGL();this.texture_=n.createTexture(),this.framebuffer_=n.createFramebuffer(),this.depthbuffer_=n.createRenderbuffer(),this.size_=t||[1,1],this.data_=new Uint8Array(0),this.dataCacheDirty_=!0,this.updateSize_()}setSize(e){Ho(e,this.size_)||(this.size_[0]=e[0],this.size_[1]=e[1],this.updateSize_())}getSize(){return this.size_}clearCachedData(){this.dataCacheDirty_=!0}readAll(){if(this.dataCacheDirty_){const e=this.size_,t=this.helper_.getGL();t.bindFramebuffer(t.FRAMEBUFFER,this.framebuffer_),t.readPixels(0,0,e[0],e[1],t.RGBA,t.UNSIGNED_BYTE,this.data_),this.dataCacheDirty_=!1}return this.data_}readPixel(e,t){if(e<0||t<0||e>this.size_[0]||t>=this.size_[1])return To[0]=0,To[1]=0,To[2]=0,To[3]=0,To;this.readAll();const n=Math.floor(e)+(this.size_[1]-Math.floor(t)-1)*this.size_[0];return To[0]=this.data_[n*4],To[1]=this.data_[n*4+1],To[2]=this.data_[n*4+2],To[3]=this.data_[n*4+3],To}getTexture(){return this.texture_}getFramebuffer(){return this.framebuffer_}getDepthbuffer(){return this.depthbuffer_}updateSize_(){const e=this.size_,t=this.helper_.getGL();this.texture_=this.helper_.createTexture(e,null,this.texture_),t.bindFramebuffer(t.FRAMEBUFFER,this.framebuffer_),t.viewport(0,0,e[0],e[1]),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this.texture_,0),t.bindRenderbuffer(t.RENDERBUFFER,this.depthbuffer_),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,e[0],e[1]),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,this.depthbuffer_),this.data_=new Uint8Array(e[0]*e[1]*4)}}function zD(i,e){const t=i.viewState.projection,r=e.getSource().getWrapX()&&t.canWrapX(),s=t.getExtent(),o=i.extent,a=r?St(s):null,l=r?Math.ceil((o[2]-s[2])/a)+1:1;return[r?Math.floor((o[0]-s[0])/a):0,l,a]}const Ah={...Ea,RENDER_EXTENT:"u_renderExtent",PATTERN_ORIGIN:"u_patternOrigin",GLOBAL_ALPHA:"u_globalAlpha"};class zC extends $m{constructor(e,t){const n={[Ah.RENDER_EXTENT]:[0,0,0,0],[Ah.PATTERN_ORIGIN]:[0,0],[Ah.GLOBAL_ALPHA]:1};super(e,{uniforms:n,postProcesses:t.postProcesses}),this.hitDetectionEnabled_=!t.disableHitDetection,this.hitRenderTarget_,this.sourceRevision_=-1,this.previousExtent_=bn(),this.currentTransform_=nn(),this.tmpCoords_=[0,0],this.tmpTransform_=nn(),this.tmpMat4_=Zc(),this.currentFrameStateTransform_=nn(),this.styleVariables_={},this.style_=[],this.styleRenderer_=null,this.buffers_=null,this.applyOptions_(t),this.batch_=new W0,this.initialFeaturesAdded_=!1,this.sourceListenKeys_=null}addInitialFeatures_(e){const t=this.getLayer().getSource();let n;this.batch_.addFeatures(t.getFeatures(),n),this.sourceListenKeys_=[wt(t,An.ADDFEATURE,this.handleSourceFeatureAdded_.bind(this,n)),wt(t,An.CHANGEFEATURE,this.handleSourceFeatureChanged_.bind(this,n),this),wt(t,An.REMOVEFEATURE,this.handleSourceFeatureDelete_,this),wt(t,An.CLEAR,this.handleSourceFeatureClear_,this)]}applyOptions_(e){this.styleVariables_=e.variables,this.style_=e.style}createRenderers_(){this.buffers_=null,this.styleRenderer_=new BD(this.style_,this.styleVariables_,this.helper,this.hitDetectionEnabled_)}reset(e){this.applyOptions_(e),this.helper&&this.createRenderers_(),super.reset(e)}afterHelperCreated(){this.styleRenderer_?this.styleRenderer_.setHelper(this.helper,this.buffers_):this.createRenderers_(),this.hitDetectionEnabled_&&(this.hitRenderTarget_=new UD(this.helper))}handleSourceFeatureAdded_(e,t){const n=t.feature;this.batch_.addFeature(n,e)}handleSourceFeatureChanged_(e,t){const n=t.feature;this.batch_.changeFeature(n,e)}handleSourceFeatureDelete_(e){const t=e.feature;this.batch_.removeFeature(t)}handleSourceFeatureClear_(){this.batch_.clear()}applyUniforms_(e){zT(this.tmpTransform_,this.currentFrameStateTransform_),Ua(this.tmpTransform_,e),this.helper.setUniformMatrixValue(Ah.PROJECTION_MATRIX,k0(this.tmpMat4_,this.tmpTransform_)),Su(this.tmpTransform_,this.tmpTransform_),this.helper.setUniformMatrixValue(Ah.SCREEN_TO_WORLD_MATRIX,k0(this.tmpMat4_,this.tmpTransform_)),this.tmpCoords_[0]=0,this.tmpCoords_[1]=0,Su(this.tmpTransform_,e),Fi(this.tmpTransform_,this.tmpCoords_),this.helper.setUniformFloatVec2(Ah.PATTERN_ORIGIN,this.tmpCoords_)}renderFrame(e){const t=this.helper.getGL();this.preRender(t,e);const[n,r,s]=zD(e,this.getLayer());this.helper.prepareDraw(e),this.renderWorlds(e,!1,n,r,s),this.helper.finalizeDraw(e,this.dispatchPreComposeEvent,this.dispatchPostComposeEvent);const o=this.helper.getCanvas();return this.hitDetectionEnabled_&&(this.renderWorlds(e,!0,n,r,s),this.hitRenderTarget_.clearCachedData()),this.postRender(t,e),o}prepareFrameInternal(e){this.initialFeaturesAdded_||(this.addInitialFeatures_(e),this.initialFeaturesAdded_=!0);const t=this.getLayer(),n=t.getSource(),r=e.viewState,s=!e.viewHints[Ti.ANIMATING]&&!e.viewHints[Ti.INTERACTING],o=!Ga(this.previousExtent_,e.extent),a=this.sourceRevision_<n.getRevision();if(a&&(this.sourceRevision_=n.getRevision()),s&&(o||a)){const l=r.projection,c=r.resolution,h=t instanceof Du?t.getRenderBuffer():0,u=Zn(e.extent,h*c);n.loadFeatures(u,c,l),this.ready=!1;const f=this.helper.makeProjectionTransform(e,nn());this.styleRenderer_.generateBuffers(this.batch_,f).then(d=>{this.buffers_&&this.disposeBuffers(this.buffers_),this.buffers_=d,this.ready=!0,this.getLayer().changed()}),this.previousExtent_=e.extent.slice()}return!0}renderWorlds(e,t,n,r,s){let o=n;t&&(this.hitRenderTarget_.setSize([Math.floor(e.size[0]/2),Math.floor(e.size[1]/2)]),this.helper.prepareDrawToRenderTarget(e,this.hitRenderTarget_,!0));do this.helper.makeProjectionTransform(e,this.currentFrameStateTransform_),Kv(this.currentFrameStateTransform_,o*s,0),this.buffers_&&this.styleRenderer_.render(this.buffers_,e,()=>{this.applyUniforms_(this.buffers_.invertVerticesTransform),this.helper.applyHitDetectionUniform(t)});while(++o<r)}forEachFeatureAtCoordinate(e,t,n,r,s){if(Vt(this.hitDetectionEnabled_,"`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has been disabled using the `disableHitDetection: true` option."),!this.styleRenderer_||!this.hitDetectionEnabled_)return;const o=Fi(t.coordinateToPixelTransform,e.slice()),a=this.hitRenderTarget_.readPixel(o[0]/2,o[1]/2),l=[a[0]/255,a[1]/255,a[2]/255,a[3]/255],c=CD(l),h=this.batch_.getFeatureFromRef(c);if(h)return r(h,this.getLayer(),null)}disposeBuffers(e){const t=n=>{for(const r of n)r&&this.helper.deleteBuffer(r)};e.pointBuffers&&t(e.pointBuffers),e.lineStringBuffers&&t(e.lineStringBuffers),e.polygonBuffers&&t(e.polygonBuffers)}disposeInternal(){this.buffers_&&this.disposeBuffers(this.buffers_),this.sourceListenKeys_&&(this.sourceListenKeys_.forEach(function(e){Zt(e)}),this.sourceListenKeys_=null),super.disposeInternal()}renderDeclutter(){}}const ya={BLUR:"blur",GRADIENT:"gradient",RADIUS:"radius"},qD=["#00f","#0ff","#0f0","#ff0","#f00"];class qC extends Du{constructor(e){e=e||{};const t=Object.assign({},e);delete t.gradient,delete t.radius,delete t.blur,delete t.weight,super(t),this.filter_=e.filter??!0,this.styleVariables_=e.variables||{},this.gradient_=null,this.addChangeListener(ya.GRADIENT,this.handleGradientChanged_),this.setGradient(e.gradient?e.gradient:qD),this.setBlur(e.blur!==void 0?e.blur:15),this.setRadius(e.radius!==void 0?e.radius:8);const n=e.weight?e.weight:"weight";this.weight_=n,this.setRenderOrder(null)}getBlur(){return this.get(ya.BLUR)}getGradient(){return this.get(ya.GRADIENT)}getRadius(){return this.get(ya.RADIUS)}handleGradientChanged_(){this.gradient_=VD(this.getGradient())}setBlur(e){const t=this.get(ya.BLUR);if(this.set(ya.BLUR,e),typeof e=="number"&&typeof t=="number"){this.changed();return}this.clearRenderer()}setGradient(e){this.set(ya.GRADIENT,e)}setRadius(e){const t=this.get(ya.RADIUS);if(this.set(ya.RADIUS,e),typeof e=="number"&&typeof t=="number"){this.changed();return}this.clearRenderer()}setFilter(e){this.filter_=e,this.changed(),this.clearRenderer()}setWeight(e){this.weight_=e,this.changed(),this.clearRenderer()}createRenderer(){const e=new jC,t=Qx(),n=mt(t,this.filter_,Pn);let r=mt(t,this.getRadius(),He),s=mt(t,this.getBlur(),He);const o={};typeof this.getBlur()=="number"&&(s="a_blur",o.a_blur=()=>this.getBlur(),e.addUniform("a_blur","float")),typeof this.getRadius()=="number"&&(r="a_radius",o.a_radius=()=>this.getRadius(),e.addUniform("a_radius","float"));const a={};let l=null;if(typeof this.weight_=="string"||typeof this.weight_=="function"){const u=typeof this.weight_=="string"?f=>f.get(this.weight_):this.weight_;a.prop_weight={size:1,callback:f=>{const d=u(f);return d!==void 0?yt(d,0,1):1}},l="a_prop_weight",e.addAttribute("a_prop_weight","float")}else{const u=["clamp",this.weight_,0,1];l=mt(t,u,He)}e.addFragmentShaderFunction(`float getBlurSlope() {
637
- float blur = max(1., ${s});
638
- float radius = ${r};
639
- return radius / blur;
640
- }`).setSymbolSizeExpression(`vec2(${r} + ${s}) * 2.`).setSymbolColorExpression(`vec4(smoothstep(0., 1., (1. - length(coordsPx * 2. / v_quadSizePx)) * getBlurSlope()) * ${l})`).setStrokeColorExpression(`vec4(smoothstep(0., 1., (1. - length(currentRadiusPx * 2. / v_width)) * getBlurSlope()) * ${l})`).setStrokeWidthExpression(`(${r} + ${s}) * 2.`).setFillColorExpression(`vec4(${l})`).setFragmentDiscardExpression(`!${n}`),kC(e,t);const c=BC(t),h=GC(t,this.styleVariables_);return new zC(this,{className:this.getClassName(),variables:this.styleVariables_,style:{builder:e,attributes:{...c,...a},uniforms:{...h,...o}},disableHitDetection:!1,postProcesses:[{fragmentShader:`
641
- precision mediump float;
642
-
643
- uniform sampler2D u_image;
644
- uniform sampler2D u_gradientTexture;
645
- uniform float u_opacity;
646
-
647
- varying vec2 v_texCoord;
648
-
649
- void main() {
650
- vec4 color = texture2D(u_image, v_texCoord);
651
- gl_FragColor.a = color.a * u_opacity;
652
- gl_FragColor.rgb = texture2D(u_gradientTexture, vec2(0.5, color.a)).rgb;
653
- gl_FragColor.rgb *= gl_FragColor.a;
654
- }`,uniforms:{u_gradientTexture:()=>this.gradient_,u_opacity:()=>this.getOpacity()}}]})}updateStyleVariables(e){Object.assign(this.styleVariables_,e),this.changed()}renderDeclutter(){}}function VD(i){const n=Xi(1,256),r=n.createLinearGradient(0,0,1,256),s=1/(i.length-1);for(let o=0,a=i.length;o<a;++o)r.addColorStop(o*s,i[o]);return n.fillStyle=r,n.fillRect(0,0,1,256),n.canvas}const $D={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},bE={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class WD extends _C{constructor(e,t){super(e,t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=nn(),this.tileClipContexts_=null}enqueueTilesForNextExtent(){return this.getLayer().getRenderMode()!=="vector"}drawTile(e,t,n,r,s,o,a,l){this.updateExecutorGroup_(e,t.pixelRatio,t.viewState.projection),this.tileImageNeedsRender_(e)&&this.renderTileImage_(e,t),super.drawTile(e,t,n,r,s,o,a,l)}getTile(e,t,n,r){const s=this.getOrCreateTile(e,t,n,r);if(!s)return null;const o=r.viewState,a=o.resolution,l=r.viewHints,c=this.getLayer().getSource(),h=c.getTileGridForProjection(o.projection),u=!(l[Ti.ANIMATING]||l[Ti.INTERACTING]),f=h.getZForResolution(a,c.zDirection)===e;return u&&f?s.wantedResolution=a:s.wantedResolution||(s.wantedResolution=h.getResolution(e)),s}prepareFrame(e){const t=this.getLayer().getRevision();return this.renderedLayerRevision_!==t&&(this.renderedLayerRevision_=t,this.renderedTiles.length=0),super.prepareFrame(e)}updateExecutorGroup_(e,t,n){const r=this.getLayer(),s=r.getRevision(),o=r.getRenderOrder()||null,a=e.wantedResolution,l=e.getReplayState(r);if(!l.dirty&&l.renderedResolution===a&&l.renderedRevision==s&&l.renderedRenderOrder==o)return;const c=r.getSource(),h=!!r.getDeclutter(),u=c.getTileGrid(),d=c.getTileGridForProjection(n).getTileCoordExtent(e.wrappedTileCoord),g=c.getSourceTiles(t,n,e),m=Ue(r);delete e.hitDetectionImageData[m],e.executorGroups[m]=[],l.dirty=!1;for(let _=0,v=g.length;_<v;++_){const x=g[_];if(x.getState()!=Oe.LOADED)continue;const S=c.getProjection(),b=x.tileCoord;let A=u.getTileCoordExtent(b);n&&S&&!mn(n,S)&&(A=Mc(A,S,n,32));const F=Mn(d,A),N=Zn(F,r.getRenderBuffer()*a,this.tempExtent),R=Ga(A,F)?null:N,P=new bC(0,F,a,t),O=q0(a,t),L=function($,B){let V;const te=$.getStyleFunction()||r.getStyleFunction();if(te&&(V=te($,a)),V){const ne=this.renderFeature($,O,V,P,h,B);l.dirty=l.dirty||ne}},T=x.getFeatures();o&&o!==l.renderedRenderOrder&&T.sort(o);for(let $=0,B=T.length;$<B;++$){let V=T[$];n&&x.projection&&!mn(n,x.projection)&&(V=V.clone(),V.getGeometry().applyTransform(Vo(x.projection,n))),(!R||Ei(R,V.getGeometry().getExtent()))&&L.call(this,V,$)}const C=P.finish(),D=r.getRenderMode()!=="vector"&&h&&g.length===1?null:F,W=new EC(D,a,t,c.getOverlaps(),C,r.getRenderBuffer(),!0);e.executorGroups[m].push(W)}l.renderedRevision=s,l.renderedRenderOrder=o,l.renderedResolution=a}forEachFeatureAtCoordinate(e,t,n,r,s){const o=t.viewState.resolution,a=t.viewState.rotation;n=n??0;const l=this.getLayer(),h=l.getSource().getTileGridForProjection(t.viewState.projection),u=Ui([e]);Zn(u,o*n,u);const f={},d=function(S,b,A){let F=S.getId();F===void 0&&(F=Ue(S));const N=f[F];if(N){if(N!==!0&&A<N.distanceSq){if(A===0)return f[F]=!0,s.splice(s.lastIndexOf(N),1),r(S,l,b);N.geometry=b,N.distanceSq=A}}else{if(A===0)return f[F]=!0,r(S,l,b);s.push(f[F]={feature:S,layer:l,geometry:b,distanceSq:A,callback:r})}},g=this.renderedTiles,m=Ue(l),_=l.getDeclutter(),v=_?t.declutter?.[_]?.all().map(S=>S.value):null;let x;e:for(let S=0,b=g.length;S<b;++S){const A=g[S],F=h.getTileCoordExtent(A.wrappedTileCoord);if(!Ei(F,u))continue;const N=A.executorGroups[m];for(let R=0,P=N.length;R<P;++R)if(x=N[R].forEachFeatureAtCoordinate(e,o,a,n,d,v),x)break e}return x}getFeatures(e){return this.renderedTiles.length===0?Promise.resolve([]):new Promise((t,n)=>{const r=this.getLayer(),s=r.getSource(),o=this.renderedProjection,a=o.getExtent(),l=this.renderedResolution,c=s.getTileGridForProjection(o),h=Fi(this.renderedPixelToCoordinateTransform_,e.slice()),u=c.getTileCoordForCoordAndResolution(h,l).toString(),f=this.renderedTiles.find(S=>S.tileCoord.toString()===u&&S.getState()===Oe.LOADED);if(!f||f.loadingSourceTiles>0){t([]);return}s.getWrapX()&&o.canWrapX()&&!gs(a,c.getTileCoordExtent(f.tileCoord))&&zv(h,o);const d=Ue(r),g=c.getTileCoordExtent(f.wrappedTileCoord),m=no(g),_=[(h[0]-m[0])/l,(m[1]-h[1])/l],v=f.getSourceTiles().reduce((S,b)=>S.concat(b.getFeatures()),[]);let x=f.hitDetectionImageData[d];if(!x){const S=Hi(c.getTileSize(c.getZForResolution(l,s.zDirection))),b=this.renderedRotation_,A=[this.getRenderTransform(c.getTileCoordCenter(f.wrappedTileCoord),l,0,fs,S[0]*fs,S[1]*fs,0)];x=SC(S,A,v,r.getStyleFunction(),c.getTileCoordExtent(f.wrappedTileCoord),f.getReplayState(r).renderedResolution,b),f.hitDetectionImageData[d]=x}t(TC(_,v,x))})}getFeaturesInExtent(e){const t=[],n=this.getTileCache();if(n.getCount()===0)return t;const s=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),o=s.getZForResolution(this.renderedResolution),a={};return n.forEach(l=>{if(l.tileCoord[0]!==o||l.getState()!==Oe.LOADED)return;const c=l.getSourceTiles();for(let h=0,u=c.length;h<u;++h){const f=c[h],d=f.getKey();if(d in a)continue;a[d]=!0;const g=f.tileCoord;if(Ei(e,s.getTileCoordExtent(g))){const m=f.getFeatures();if(m)for(let _=0,v=m.length;_<v;++_){const x=m[_],S=x.getGeometry();Ei(e,S.getExtent())&&t.push(x)}}}}),t}handleFontsChanged(){const e=this.getLayer();e.getVisible()&&this.renderedLayerRevision_!==void 0&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}renderDeclutter(e,t){const n=this.context,r=n.globalAlpha;n.globalAlpha=t.opacity;const s=e.viewHints,o=!(s[Ti.ANIMATING]||s[Ti.INTERACTING]),a=[this.context.canvas.width,this.context.canvas.height],l=this.getLayer().getDeclutter(),c=l?e.declutter?.[l]:void 0,h=Ue(this.getLayer()),u=this.renderedTiles;for(let f=0,d=u.length;f<d;++f){const g=u[f],m=g.executorGroups[h];if(m)for(let _=m.length-1;_>=0;--_)m[_].execute(this.context,a,this.getTileRenderTransform(g,e),e.viewState.rotation,o,z0,c)}n.globalAlpha=r}renderDeferredInternal(e){const t=this.renderedTiles,n=Ue(this.getLayer()),r=t.reduce((l,c,h)=>(c.executorGroups[n].forEach(u=>l.push({executorGroup:u,index:h})),l),[]),s=r.map(({executorGroup:l})=>l.getDeferredZIndexContexts()),o={};for(let l=0,c=r.length;l<c;++l){const h=r[l].executorGroup.getDeferredZIndexContexts();for(const u in h)o[u]=!0}Object.keys(o).map(Number).sort(Bo).forEach(l=>{s.forEach((c,h)=>{c[l]&&(c[l].forEach(u=>{const{executorGroup:f,index:d}=r[h],g=f.getRenderedContext(),m=g.globalAlpha;g.globalAlpha=this.renderedOpacity_;const _=this.tileClipContexts_[d];_&&_.draw(g),u.draw(g),_&&g.restore(),g.globalAlpha=m,u.clear()}),c[l].length=0)})})}getTileRenderTransform(e,t){const n=t.pixelRatio,r=t.viewState,s=r.center,o=r.resolution,a=r.rotation,l=t.size,c=Math.round(l[0]*n),h=Math.round(l[1]*n),f=this.getLayer().getSource().getTileGridForProjection(t.viewState.projection),d=e.tileCoord,g=f.getTileCoordExtent(e.wrappedTileCoord),m=f.getTileCoordExtent(d,this.tempExtent)[0]-g[0];return Ua(Yf(this.inversePixelTransform.slice(),1/n,1/n),this.getRenderTransform(s,o,a,n,c,h,m))}postRender(e,t){const n=t.viewHints,r=!(n[Ti.ANIMATING]||n[Ti.INTERACTING]);this.renderedPixelToCoordinateTransform_=t.pixelToCoordinateTransform.slice(),this.renderedRotation_=t.viewState.rotation,this.renderedOpacity_=t.layerStatesArray[t.layerIndex].opacity;const s=this.getLayer(),o=s.getRenderMode(),a=e.globalAlpha;e.globalAlpha=this.renderedOpacity_;const l=s.getDeclutter(),c=l?bE[o].filter(A=>!z0.includes(A)):bE[o],h=t.viewState,u=h.rotation,f=s.getSource(),g=f.getTileGridForProjection(h.projection).getZForResolution(h.resolution,f.zDirection),m=this.renderedTiles,_=[],v=[],x=[],S=Ue(s);let b=!0;for(let A=m.length-1;A>=0;--A){const F=m[A];b=b&&!F.getReplayState(s).dirty;const N=F.executorGroups[S].filter(D=>D.hasExecutors(c));if(N.length===0)continue;const R=this.getTileRenderTransform(F,t),P=F.tileCoord[0];let O=!1;const L=N[0].getClipCoords(R);let T=e,C;if(L){C=new Xx,T=C.getContext();for(let D=0,W=_.length;D<W;++D)if(g!==P&&P<v[D]){const $=_[D];Ei([L[0],L[3],L[4],L[7]],[$[0],$[3],$[4],$[7]])&&(O||(T.save(),O=!0),T.beginPath(),T.moveTo(L[0],L[1]),T.lineTo(L[2],L[3]),T.lineTo(L[4],L[5]),T.lineTo(L[6],L[7]),T.moveTo($[6],$[7]),T.lineTo($[4],$[5]),T.lineTo($[2],$[3]),T.lineTo($[0],$[1]),T.clip())}_.push(L),v.push(P)}for(let D=0,W=N.length;D<W;++D)N[D].execute(e,[e.canvas.width,e.canvas.height],R,u,r,c,t.declutter?.[l]);O&&(T===e?T.restore():x[A]=C)}e.globalAlpha=a,this.ready=b,this.tileClipContexts_=x,t.declutter||this.renderDeferredInternal(t),super.postRender(e,t)}renderFeature(e,t,n,r,s,o){if(!n)return!1;let a=!1;if(Array.isArray(n))for(let l=0,c=n.length;l<c;++l)a=V0(r,e,n[l],t,this.boundHandleStyleImageChange_,void 0,s,o)||a;else a=V0(r,e,n,t,this.boundHandleStyleImageChange_,void 0,s,o);return a}tileImageNeedsRender_(e){const t=this.getLayer();if(t.getRenderMode()==="vector")return!1;const n=e.getReplayState(t),r=t.getRevision(),s=e.wantedResolution;return n.renderedTileResolution!==s||n.renderedTileRevision!==r}renderTileImage_(e,t){const n=this.getLayer(),r=e.getReplayState(n),s=n.getRevision(),o=e.executorGroups[Ue(n)];r.renderedTileRevision=s;const a=e.wrappedTileCoord,l=a[0],c=n.getSource();let h=t.pixelRatio;const f=t.viewState.projection,d=c.getTileGridForProjection(f),g=d.getResolution(e.tileCoord[0]),m=t.pixelRatio/e.wantedResolution*g,_=d.getResolution(l),v=e.getContext();h=Math.round(Math.max(h,m/h));const x=c.getTilePixelSize(l,h,f);v.canvas.width=x[0],v.canvas.height=x[1];const S=h/m;if(S!==1){const N=by(this.tmpTransform_);Yf(N,S,S),v.setTransform.apply(v,N)}const b=d.getTileCoordExtent(a,this.tempExtent),A=m/_,F=by(this.tmpTransform_);Yf(F,A,-A),Kv(F,-b[0],-b[3]);for(let N=0,R=o.length;N<R;++N)o[N].execute(v,[v.canvas.width*S,v.canvas.height*S],F,0,!0,$D[n.getRenderMode()],null);r.renderedTileResolution=e.wantedResolution}}class VC extends Du{constructor(e){e=e||{};const t=Object.assign({},e);delete t.preload;const n=e.cacheSize===void 0?0:e.cacheSize;delete e.cacheSize,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n;const r=e.renderMode||"hybrid";Vt(r=="hybrid"||r=="vector","`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=r,this.setPreload(e.preload?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0),this.getBackground,this.setBackground}createRenderer(){return new WD(this,{cacheSize:this.cacheSize_})}getFeatures(e){return super.getFeatures(e)}getFeaturesInExtent(e){return this.getRenderer().getFeaturesInExtent(e)}getRenderMode(){return this.renderMode_}getPreload(){return this.get(Sl.PRELOAD)}getUseInterimTilesOnError(){return this.get(Sl.USE_INTERIM_TILES_ON_ERROR)}setPreload(e){this.set(Sl.PRELOAD,e)}setUseInterimTilesOnError(e){this.set(Sl.USE_INTERIM_TILES_ON_ERROR,e)}}class HD extends pC{constructor(e){super(e),this.vectorRenderer_=new PC(e),this.layerImageRatio_=e.getImageRatio(),this.coordinateToVectorPixelTransform_=nn(),this.renderedPixelToCoordinateTransform_=null}disposeInternal(){this.vectorRenderer_.dispose(),super.disposeInternal()}getFeatures(e){if(!this.vectorRenderer_)return Promise.resolve([]);const t=Fi(this.coordinateToVectorPixelTransform_,Fi(this.renderedPixelToCoordinateTransform_,e.slice()));return this.vectorRenderer_.getFeatures(t)}handleFontsChanged(){this.vectorRenderer_.handleFontsChanged()}prepareFrame(e){const t=e.pixelRatio,n=e.viewState,r=n.resolution,s=e.viewHints,o=this.vectorRenderer_;let a=e.extent;this.layerImageRatio_!==1&&(a=a.slice(0),Z8(a,this.layerImageRatio_));const l=St(a)/r,c=Wi(a)/r;if(!s[Ti.ANIMATING]&&!s[Ti.INTERACTING]&&!Xo(a)){o.useContainer(null,null);const h=o.context,u=e.layerStatesArray[e.layerIndex],f=Object.assign({},u,{opacity:1}),d=Object.assign({},e,{extent:a,size:[l,c],viewState:Object.assign({},e.viewState,{rotation:0}),layerStatesArray:[f],layerIndex:0,declutter:null}),g=this.getLayer().getDeclutter();g&&(d.declutter={[g]:new vx(9)});const m=new U7(a,r,t,h.canvas,function(_){o.prepareFrame(d)&&o.replayGroupChanged&&(o.clipping=!1,o.renderFrame(d,null),o.renderDeclutter(d),o.renderDeferred(d),_())});m.addEventListener(Qe.CHANGE,()=>{if(m.getState()!==Ye.LOADED)return;this.image=m;const _=m.getPixelRatio(),v=G0(m.getResolution())*t/_;this.renderedResolution=v,this.coordinateToVectorPixelTransform_=_s(this.coordinateToVectorPixelTransform_,l/2,c/2,1/v,-1/v,0,-n.center[0],-n.center[1])}),m.load()}return this.image&&(this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice()),!this.getLayer().getSource()?.loading&&!!this.image}preRender(){}postRender(){}renderDeclutter(){}forEachFeatureAtCoordinate(e,t,n,r,s){return this.vectorRenderer_?this.vectorRenderer_.forEachFeatureAtCoordinate(e,t,n,r,s):super.forEachFeatureAtCoordinate(e,t,n,r,s)}}class XD extends Du{constructor(e){e=e||{};const t=Object.assign({},e);delete t.imageRatio,super(t),this.imageRatio_=e.imageRatio!==void 0?e.imageRatio:1}getImageRatio(){return this.imageRatio_}createRenderer(){return new HD(this)}}function EE(i,e){const t=`
655
- attribute vec2 ${Wp.TEXTURE_COORD};
656
- uniform mat4 ${Nt.TILE_TRANSFORM};
657
- uniform float ${Nt.TEXTURE_PIXEL_WIDTH};
658
- uniform float ${Nt.TEXTURE_PIXEL_HEIGHT};
659
- uniform float ${Nt.TEXTURE_RESOLUTION};
660
- uniform float ${Nt.TEXTURE_ORIGIN_X};
661
- uniform float ${Nt.TEXTURE_ORIGIN_Y};
662
- uniform float ${Nt.DEPTH};
663
-
664
- varying vec2 v_textureCoord;
665
- varying vec2 v_mapCoord;
666
-
667
- void main() {
668
- v_textureCoord = ${Wp.TEXTURE_COORD};
669
- v_mapCoord = vec2(
670
- ${Nt.TEXTURE_ORIGIN_X} + ${Nt.TEXTURE_RESOLUTION} * ${Nt.TEXTURE_PIXEL_WIDTH} * v_textureCoord[0],
671
- ${Nt.TEXTURE_ORIGIN_Y} - ${Nt.TEXTURE_RESOLUTION} * ${Nt.TEXTURE_PIXEL_HEIGHT} * v_textureCoord[1]
672
- );
673
- gl_Position = ${Nt.TILE_TRANSFORM} * vec4(${Wp.TEXTURE_COORD}, ${Nt.DEPTH}, 1.0);
674
- }
675
- `,n={...Qx(),bandCount:e},r=[];if(i.color!==void 0){const u=mt(n,i.color,Vi);r.push(`color = ${u};`)}if(i.contrast!==void 0){const u=mt(n,i.contrast,He);r.push(`color.rgb = clamp((${u} + 1.0) * color.rgb - (${u} / 2.0), vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}if(i.exposure!==void 0){const u=mt(n,i.exposure,He);r.push(`color.rgb = clamp((${u} + 1.0) * color.rgb, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}if(i.saturation!==void 0){const u=mt(n,i.saturation,He);r.push(`
676
- float saturation = ${u} + 1.0;
677
- float sr = (1.0 - saturation) * 0.2126;
678
- float sg = (1.0 - saturation) * 0.7152;
679
- float sb = (1.0 - saturation) * 0.0722;
680
- mat3 saturationMatrix = mat3(
681
- sr + saturation, sr, sr,
682
- sg, sg + saturation, sg,
683
- sb, sb, sb + saturation
684
- );
685
- color.rgb = clamp(saturationMatrix * color.rgb, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));
686
- `)}if(i.gamma!==void 0){const u=mt(n,i.gamma,He);r.push(`color.rgb = pow(color.rgb, vec3(1.0 / ${u}));`)}if(i.brightness!==void 0){const u=mt(n,i.brightness,He);r.push(`color.rgb = clamp(color.rgb + ${u}, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}const s={},o=Object.keys(n.variables).length;if(o>1&&!i.variables)throw new Error(`Missing variables in style (expected ${n.variables})`);for(let u=0;u<o;++u){const f=n.variables[Object.keys(n.variables)[u]];if(!(f.name in i.variables))throw new Error(`Missing '${f.name}' in style variables`);const d=Wm(f.name);s[d]=function(){let g=i.variables[f.name];return typeof g=="string"&&(g=Ru(g)),g!==void 0?g:-9999999}}const a=Object.keys(s).map(function(u){return`uniform float ${u};`}),l=Math.ceil(e/4);a.push(`uniform sampler2D ${Nt.TILE_TEXTURE_ARRAY}[${l}];`),n.paletteTextures&&a.push(`uniform sampler2D ${FC}[${n.paletteTextures.length}];`);const c=Object.keys(n.functions).map(function(u){return n.functions[u]}),h=`
687
- #ifdef GL_FRAGMENT_PRECISION_HIGH
688
- precision highp float;
689
- #else
690
- precision mediump float;
691
- #endif
692
-
693
- varying vec2 v_textureCoord;
694
- varying vec2 v_mapCoord;
695
- uniform vec4 ${Nt.RENDER_EXTENT};
696
- uniform float ${Nt.TRANSITION_ALPHA};
697
- uniform float ${Nt.TEXTURE_PIXEL_WIDTH};
698
- uniform float ${Nt.TEXTURE_PIXEL_HEIGHT};
699
- uniform float ${Nt.RESOLUTION};
700
- uniform float ${Nt.ZOOM};
701
-
702
- ${a.join(`
703
- `)}
704
-
705
- ${c.join(`
706
- `)}
707
-
708
- void main() {
709
- if (
710
- v_mapCoord[0] < ${Nt.RENDER_EXTENT}[0] ||
711
- v_mapCoord[1] < ${Nt.RENDER_EXTENT}[1] ||
712
- v_mapCoord[0] > ${Nt.RENDER_EXTENT}[2] ||
713
- v_mapCoord[1] > ${Nt.RENDER_EXTENT}[3]
714
- ) {
715
- discard;
716
- }
717
-
718
- vec4 color = texture2D(${Nt.TILE_TEXTURE_ARRAY}[0], v_textureCoord);
719
-
720
- ${r.join(`
721
- `)}
722
-
723
- gl_FragColor = color;
724
- gl_FragColor.rgb *= gl_FragColor.a;
725
- gl_FragColor *= ${Nt.TRANSITION_ALPHA};
726
- }`;return{vertexShader:t,fragmentShader:h,uniforms:s,paletteTextures:n.paletteTextures}}class $C extends yC{constructor(e){e=e?Object.assign({},e):{};const t=e.style||{};delete e.style,super(e),this.sources_=e.sources,this.renderedSource_=null,this.renderedResolution_=NaN,this.style_=t,this.styleVariables_=this.style_.variables||{},this.handleSourceUpdate_(),this.addChangeListener(ai.SOURCE,this.handleSourceUpdate_)}getSources(e,t){const n=this.getSource();return this.sources_?typeof this.sources_=="function"?this.sources_(e,t):this.sources_:n?[n]:[]}getRenderSource(){return this.renderedSource_||this.getSource()}getSourceState(){const e=this.getRenderSource();return e?e.getState():"undefined"}handleSourceUpdate_(){this.hasRenderer()&&this.getRenderer().clearCache();const e=this.getSource();if(e)if(e.getState()==="loading"){const t=()=>{e.getState()==="ready"&&(e.removeEventListener("change",t),this.setStyle(this.style_))};e.addEventListener("change",t)}else this.setStyle(this.style_)}getSourceBandCount_(){const e=Number.MAX_SAFE_INTEGER,t=this.getSources([-e,-e,e,e],e);return t&&t.length&&"bandCount"in t[0]?t[0].bandCount:4}createRenderer(){const e=EE(this.style_,this.getSourceBandCount_());return new dD(this,{vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,uniforms:e.uniforms,cacheSize:this.getCacheSize(),paletteTextures:e.paletteTextures})}renderSources(e,t){const n=this.getRenderer();let r;for(let s=0,o=t.length;s<o;++s)this.renderedSource_=t[s],n.prepareFrame(e)&&(r=n.renderFrame(e));return r}render(e,t){this.rendered=!0;const n=e.viewState,r=this.getSources(e.extent,n.resolution);let s=!0;for(let a=0,l=r.length;a<l;++a){const c=r[a],h=c.getState();if(h=="loading"){const u=()=>{c.getState()=="ready"&&(c.removeEventListener("change",u),this.changed())};c.addEventListener("change",u)}s=s&&h=="ready"}const o=this.renderSources(e,r);if(this.getRenderer().renderComplete&&s)return this.renderedResolution_=n.resolution,o;if(this.renderedResolution_>.5*n.resolution){const a=this.getSources(e.extent,this.renderedResolution_).filter(l=>!r.includes(l));if(a.length>0)return this.renderSources(e,a)}return o}setStyle(e){if(this.styleVariables_=e.variables||{},this.style_=e,this.hasRenderer()){const t=EE(this.style_,this.getSourceBandCount_());this.getRenderer().reset({vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms,paletteTextures:t.paletteTextures}),this.changed()}}updateStyleVariables(e){Object.assign(this.styleVariables_,e),this.changed()}}$C.prototype.dispose;class KD extends Hc{constructor(e){const t=Object.assign({},e);super(t),this.styleVariables_=e.variables||{},this.style_=e.style,this.hitDetectionDisabled_=!!e.disableHitDetection}createRenderer(){return new zC(this,{style:this.style_,variables:this.styleVariables_,disableHitDetection:this.hitDetectionDisabled_})}updateStyleVariables(e){Object.assign(this.styleVariables_,e),this.changed()}setStyle(e){this.style_=e,this.clearRenderer(),this.changed()}}var YD=class extends Yr{constructor(e){e=e||{},super();var t=this.input=e.input;t||(t=this.input=document.createElement("input"),e.type&&t.setAttribute("type",e.type),e.min!==void 0&&t.setAttribute("min",e.min),e.max!==void 0&&t.setAttribute("max",e.max),e.step!==void 0&&t.setAttribute("step",e.step),e.parent&&e.parent.appendChild(t)),e.disabled&&(t.disabled=!0),e.checked!==void 0&&(t.checked=!!e.checked),e.val!==void 0&&(t.value=e.val),e.hidden&&t.classList.add("ol-input-hidden"),t.addEventListener("focus",(function(){this.element&&this.element.classList.add("ol-focus")}).bind(this));var n;t.addEventListener("focusout",(function(){this.element&&(n&&clearTimeout(n),n=setTimeout((function(){this.element.classList.remove("ol-focus")}).bind(this),0))}).bind(this))}_listenDrag(e,t){var n=(function(r){this.moving=!0,this.element.classList.add("ol-moving");var s=(function(o){o.type==="pointerup"&&(document.removeEventListener("pointermove",s),document.removeEventListener("pointerup",s),document.removeEventListener("pointercancel",s),setTimeout((function(){this.moving=!1,this.element.classList.remove("ol-moving")}).bind(this))),o.target===e&&t(o),o.stopPropagation(),o.preventDefault()}).bind(this);document.addEventListener("pointermove",s,!1),document.addEventListener("pointerup",s,!1),document.addEventListener("pointercancel",s,!1),r.stopPropagation(),r.preventDefault()}).bind(this);e.addEventListener("mousedown",n,!1),e.addEventListener("touchstart",n,!1)}setValue(e){e!==void 0&&(this.input.value=e),this.input.dispatchEvent(new Event("change"))}getValue(){return this.input.value}getInputElement(){return this.input}},o5=class extends YD{constructor(e){e=e||{},super(e);var t=this.element=document.createElement("label");e.html instanceof Element?t.appendChild(e.html):e.html!==void 0&&(t.innerHTML=e.html),t.className=("ol-ext-check ol-ext-checkbox "+(e.className||"")).trim(),this.input.parentNode&&this.input.parentNode.insertBefore(t,this.input),t.appendChild(this.input),t.appendChild(document.createElement("span")),e.after&&t.appendChild(document.createTextNode(e.after)),this.input.addEventListener("change",(function(){this.dispatchEvent({type:"check",checked:this.input.checked,value:this.input.value})}).bind(this))}isChecked(){return this.input.checked}},ZD=class extends o5{constructor(e){e=e||{},super(e),this.element.className=("ol-ext-toggle-switch "+(e.className||"")).trim()}},JD=class extends o5{constructor(e){e=e||{},super(e),this.element.className=("ol-ext-check ol-ext-radio "+(e.className||"")).trim()}},se={};se.create=function(i,e){e=e||{};var t;if(i==="TEXT")t=document.createTextNode(e.html||""),e.parent&&e.parent.appendChild(t);else{t=document.createElement(i.toLowerCase()),/button/i.test(i)&&t.setAttribute("type","button");for(var n in e)switch(n){case"className":{e.className&&e.className.trim&&t.setAttribute("class",e.className.trim());break}case"text":{t.innerText=e.text;break}case"html":{e.html instanceof Element?t.appendChild(e.html):e.html!==void 0&&(t.innerHTML=e.html);break}case"parent":{e.parent&&e.parent.appendChild(t);break}case"options":{if(/select/i.test(i))for(var r in e.options)se.create("OPTION",{html:r,value:e.options[r],parent:t});break}case"style":{se.setStyle(t,e.style);break}case"change":case"click":{se.addListener(t,n,e[n]);break}case"on":{for(var s in e.on)se.addListener(t,s,e.on[s]);break}case"checked":{t.checked=!!e.checked;break}default:{t.setAttribute(n,e[n]);break}}}return t};se.createSwitch=function(i){var e=se.create("INPUT",{type:"checkbox",on:i.on,click:i.click,change:i.change,parent:i.parent}),t=Object.assign({input:e},i||{});return new ZD(t),e};se.createCheck=function(i){var e=se.create("INPUT",{name:i.name,type:i.type==="radio"?"radio":"checkbox",on:i.on,parent:i.parent}),t=Object.assign({input:e},i||{});return i.type==="radio"?new JD(t):new o5(t),e};se.setHTML=function(i,e){e instanceof Element?i.appendChild(e):e!==void 0&&(i.innerHTML=e)};se.appendText=function(i,e){i.appendChild(document.createTextNode(e||""))};se.addListener=function(i,e,t,n){typeof e=="string"&&(e=e.split(" ")),e.forEach(function(r){i.addEventListener(r,t,n)})};se.removeListener=function(i,e,t){typeof e=="string"&&(e=e.split(" ")),e.forEach(function(n){i.removeEventListener(n,t)})};se.show=function(i){i.style.display=""};se.hide=function(i){i.style.display="none"};se.hidden=function(i){return se.getStyle(i,"display")==="none"};se.toggle=function(i){i.style.display=i.style.display==="none"?"":"none"};se.setStyle=function(i,e){for(var t in e)switch(t){case"top":case"left":case"bottom":case"right":case"minWidth":case"maxWidth":case"width":case"height":{typeof e[t]=="number"?i.style[t]=e[t]+"px":i.style[t]=e[t];break}default:i.style[t]=e[t]}};se.getStyle=function(i,e){var t,n=(i.ownerDocument||document).defaultView;if(n&&n.getComputedStyle)e=e.replace(/([A-Z])/g,"-$1").toLowerCase(),t=n.getComputedStyle(i,null).getPropertyValue(e);else if(i.currentStyle&&(e=e.replace(/-(\w)/g,function(r,s){return s.toUpperCase()}),t=i.currentStyle[e],/^\d+(em|pt|%|ex)?$/i.test(t)))return(function(r){var s=i.style.left,o=i.runtimeStyle.left;return i.runtimeStyle.left=i.currentStyle.left,i.style.left=r||0,r=i.style.pixelLeft+"px",i.style.left=s,i.runtimeStyle.left=o,r})(t);return/px$/.test(t)?parseInt(t):t};se.outerHeight=function(i){return i.offsetHeight+se.getStyle(i,"marginBottom")};se.outerWidth=function(i){return i.offsetWidth+se.getStyle(i,"marginLeft")};se.offsetRect=function(i){var e=i.getBoundingClientRect();return{top:e.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),left:e.left+(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0),height:e.height||e.bottom-e.top,width:e.width||e.right-e.left}};se.getFixedOffset=function(i){var e={left:0,top:0},t=function(n){if(!n)return e;if(se.getStyle(n,"position")==="absolute"&&se.getStyle(n,"transform")!=="none"){var r=n.getBoundingClientRect();return e.left+=r.left,e.top+=r.top,e}return t(n.offsetParent)};return t(i.offsetParent)};se.positionRect=function(i,e){var t=0,n=0,r=function(s){if(s)return t+=s.offsetLeft,n+=s.offsetTop,r(s.offsetParent);var o={top:i.offsetTop+n,left:i.offsetLeft+t};return e&&(o.top-=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,o.left-=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0),o.bottom=o.top+i.offsetHeight,o.right=o.top+i.offsetWidth,o};return r(i.offsetParent)};se.scrollDiv=function(i,e){e=e||{};var t=!1,n=0,r,s=0,o=typeof e.onmove=="function"?e.onmove:function(){},a=e.vertical?"screenY":"screenX",l=e.vertical?"scrollTop":"scrollLeft",c=!1,h,u,f=0,d=function(){S&&(f++,setTimeout(g))},g=function(){if(S){if(f--,f)return;var N=i.clientHeight,R=i.scrollHeight;h=N/R,S.style.height=h*100+"%",S.style.top=i.scrollTop/R*100+"%",x.style.height=N+"px",N>R-.5?x.classList.add("ol-100pc"):x.classList.remove("ol-100pc")}},m=function(N){N.target.classList.contains("ol-noscroll")||(c=!1,t=N[a],s=new Date,i.classList.add("ol-move"),N.preventDefault(),window.addEventListener("pointermove",_),se.addListener(window,["pointerup","pointercancel"],A))},_=function(N){if(t!==!1){var R=(u?-1/h:1)*(t-N[a]);c=c||Math.round(R),i[l]+=R,r=new Date,r-s&&(n=(n+R/(r-s))/2),t=N[a],s=r,R&&o(!0)}else c=!0},v=function(N){var R=N>0?Math.min(100,N/2):Math.max(-100,N/2);N-=R,i[l]+=R,-1<N&&N<1?(c?setTimeout(function(){i.classList.remove("ol-move")}):i.classList.remove("ol-move"),c=!1,o(!1)):setTimeout(function(){v(N)},40)},x,S;if(e.vertical&&e.minibar){var b=function(N){i.removeEventListener("pointermove",b),i.parentNode.classList.add("ol-miniscroll"),S=se.create("DIV"),x=se.create("DIV",{className:"ol-scroll",html:S}),i.parentNode.insertBefore(x,i),S.addEventListener("pointerdown",function(R){u=!0,m(R)}),e.mousewheel&&(se.addListener(x,["mousewheel","DOMMouseScroll","onmousewheel"],function(R){F(R)}),se.addListener(S,["mousewheel","DOMMouseScroll","onmousewheel"],function(R){F(R)})),i.parentNode.addEventListener("pointerenter",d),window.addEventListener("resize",d),N!==!1&&d()};i.parentNode?b(!1):i.addEventListener("pointermove",b),i.addEventListener("scroll",function(){d()})}i.style["touch-action"]="none",i.style.overflow="hidden",i.classList.add("ol-scrolldiv"),se.addListener(i,["pointerdown"],function(N){u=!1,m(N)}),i.addEventListener("click",function(N){i.classList.contains("ol-move")&&(N.preventDefault(),N.stopPropagation())},!0);var A=function(N){s=new Date-s,s>100||u?n=0:s>0&&(n=((n||0)+(t-N[a])/s)/2),v(e.animate===!1?0:n*200),t=!1,n=0,s=0,i.classList.contains("ol-move")?i.classList.remove("ol-hasClick"):(i.classList.add("ol-hasClick"),setTimeout(function(){i.classList.remove("ol-hasClick")},500)),u=!1,window.removeEventListener("pointermove",_),se.removeListener(window,["pointerup","pointercancel"],A)},F=function(N){var R=Math.max(-1,Math.min(1,N.wheelDelta||-N.detail));return i.classList.add("ol-move"),i[l]-=R*30,i.classList.remove("ol-move"),!1};return e.mousewheel&&se.addListener(i,["mousewheel","DOMMouseScroll","onmousewheel"],F),{refresh:d}};se.dispatchEvent=function(i,e){var t;try{t=new CustomEvent(i)}catch{t=document.createEvent("CustomEvent"),t.initCustomEvent(i,!0,!0,{})}e.dispatchEvent(t)};se.setCursor=function(i,e){i instanceof Kc&&(i=i.getTargetElement()),!("ontouchstart"in window)&&i instanceof Element&&(i.style.cursor=e)};var WC={exports:{}};function a5(){}a5.prototype={on:function(i,e,t){var n=this.e||(this.e={});return(n[i]||(n[i]=[])).push({fn:e,ctx:t}),this},once:function(i,e,t){var n=this;function r(){n.off(i,r),e.apply(t,arguments)}return r._=e,this.on(i,r,t)},emit:function(i){var e=[].slice.call(arguments,1),t=((this.e||(this.e={}))[i]||[]).slice(),n=0,r=t.length;for(n;n<r;n++)t[n].fn.apply(t[n].ctx,e);return this},off:function(i,e){var t=this.e||(this.e={}),n=t[i],r=[];if(n&&e)for(var s=0,o=n.length;s<o;s++)n[s].fn!==e&&n[s].fn._!==e&&r.push(n[s]);return r.length?t[i]=r:delete t[i],this}};WC.exports=a5;WC.exports.TinyEmitter=a5;var HC=(i=>(i.CONTEXTMENU="contextmenu",i.CLICK="click",i.DBLCLICK="dblclick",i))(HC||{});HC.CONTEXTMENU;var QD=class extends Os{constructor(e){e=e||{};var t=se.create("DIV",{className:e.switcherClass||"ol-layerswitcher"});super({element:t,target:e.target});var n=this;this.dcount=0,this.show_progress=e.show_progress,this.oninfo=typeof e.oninfo=="function"?e.oninfo:null,this.onextent=typeof e.onextent=="function"?e.onextent:null,this.hasextent=e.extent||e.onextent,this.hastrash=e.trash,this.reordering=e.reordering!==!1,this._layers=[],this._layerGroup=e.layerGroup&&e.layerGroup.getLayers?e.layerGroup:null,this.onchangeCheck=typeof e.onchangeCheck=="function"?e.onchangeCheck:null,typeof e.displayInLayerSwitcher=="function"&&(this.displayInLayerSwitcher=e.displayInLayerSwitcher),e.target||(t.classList.add("ol-unselectable"),t.classList.add("ol-control"),t.classList.add(e.collapsed!==!1?"ol-collapsed":"ol-forceopen"),e.counter&&t.classList.add("ol-counter"),this.counter=se.create("SPAN",{class:"ol-counter",text:0,parent:t}),this.button=se.create("BUTTON",{type:"button",parent:t}),this.button.addEventListener("touchstart",function(r){t.classList.toggle("ol-forceopen"),t.classList.add("ol-collapsed"),n.dispatchEvent({type:"toggle",collapsed:t.classList.contains("ol-collapsed")}),r.preventDefault(),n.overflow()}),this.button.addEventListener("click",function(){t.classList.toggle("ol-forceopen"),t.classList.add("ol-collapsed"),n.dispatchEvent({type:"toggle",collapsed:!t.classList.contains("ol-forceopen")}),n.overflow()}),e.mouseover&&(t.addEventListener("mouseleave",function(){t.classList.add("ol-collapsed"),n.dispatchEvent({type:"toggle",collapsed:!0})}),t.addEventListener("mouseover",function(){t.classList.remove("ol-collapsed"),n.dispatchEvent({type:"toggle",collapsed:!1})})),e.minibar&&(e.noScroll=!0),e.noScroll||(this.topv=se.create("DIV",{className:"ol-switchertopdiv",parent:t,click:function(){n.overflow("+50%")}}),this.botv=se.create("DIV",{className:"ol-switcherbottomdiv",parent:t,click:function(){n.overflow("-50%")}})),this._noScroll=e.noScroll),this.panel_=se.create("UL",{className:"panel"}),this.panelContainer_=se.create("DIV",{className:"panel-container",html:this.panel_,parent:t}),!e.target&&!e.noScroll&&se.addListener(this.panel_,"mousewheel DOMMouseScroll onmousewheel",function(r){n.overflow(Math.max(-1,Math.min(1,r.wheelDelta||-r.detail)))&&(r.stopPropagation(),r.preventDefault())}),this.header_=se.create("LI",{className:"ol-header",parent:this.panel_}),this.set("drawDelay",e.drawDelay||0),this.set("selection",e.selection),e.minibar&&setTimeout((function(){var r=se.scrollDiv(this.panelContainer_,{mousewheel:!0,vertical:!0,minibar:!0});this.on(["drawlist","toggle"],function(){r.refresh()})}).bind(this))}displayInLayerSwitcher(e){return e.get("displayInLayerSwitcher")!==!1}setMap(e){if(super.setMap(e),this.drawPanel(),this._listener)for(var t in this._listener)Er(this._listener[t]);this._listener=null,e&&(this._listener={moveend:e.on("moveend",this.viewChange.bind(this)),size:e.on("change:size",this.overflow.bind(this))},this._layerGroup?this._listener.change=this._layerGroup.getLayers().on("change:length",this.drawPanel.bind(this)):this._listener.change=e.getLayerGroup().getLayers().on("change:length",this.drawPanel.bind(this)))}show(){this.element.classList.add("ol-forceopen"),this.overflow(),this.dispatchEvent({type:"toggle",collapsed:!1})}hide(){this.element.classList.remove("ol-forceopen"),this.overflow(),this.dispatchEvent({type:"toggle",collapsed:!0})}toggle(){this.element.classList.toggle("ol-forceopen"),this.overflow(),this.dispatchEvent({type:"toggle",collapsed:!this.isOpen()})}isOpen(){return this.element.classList.contains("ol-forceopen")}setHeader(e){se.setHTML(this.header_,e)}overflow(e){if(this.button&&!this._noScroll){if(se.hidden(this.panel_)){se.setStyle(this.element,{height:"auto"});return}var t=se.outerHeight(this.element),n=se.outerHeight(this.panel_),r=this.button.offsetTop+se.outerHeight(this.button),s=this.panel_.offsetTop-r;if(n>t-r){se.setStyle(this.element,{height:"100%"});var o=this.panel_.querySelectorAll("li.ol-visible .li-content")[0],a=o?2*se.getStyle(o,"height"):0;switch(e){case 1:s+=a;break;case-1:s-=a;break;case"+50%":s+=Math.round(t/2);break;case"-50%":s-=Math.round(t/2);break}return s+n<=t-3*r/2?(s=t-3*r/2-n,se.hide(this.botv)):se.show(this.botv),s>=0?(s=0,se.hide(this.topv)):se.show(this.topv),se.setStyle(this.panel_,{top:s+"px"}),!0}else return se.setStyle(this.element,{height:"auto"}),se.setStyle(this.panel_,{top:0}),se.hide(this.botv),se.hide(this.topv),!1}else return!1}_setLayerForLI(e,t){var n=[];t.getLayers&&n.push(t.getLayers().on("change:length",this.drawPanel.bind(this))),e&&(n.push(t.on("change:opacity",(function(){this.setLayerOpacity(t,e)}).bind(this))),n.push(t.on("change:visible",(function(){this.setLayerVisibility(t,e)}).bind(this)))),n.push(t.on("propertychange",(function(r){(r.key==="displayInLayerSwitcher"||r.key==="openInLayerSwitcher"||r.key==="title"||r.key==="name")&&this.drawPanel(r)}).bind(this))),this._layers.push({li:e,layer:t,listeners:n})}setLayerOpacity(e,t){var n=t.querySelector(".layerswitcher-opacity-cursor");n&&(n.style.left=e.getOpacity()*100+"%"),this.dispatchEvent({type:"layer:opacity",layer:e})}setLayerVisibility(e,t){var n=t.querySelector(".ol-visibility");n&&(n.checked=e.getVisible()),e.getVisible()?t.classList.add("ol-visible"):t.classList.remove("ol-visible"),this.dispatchEvent({type:"layer:visible",layer:e})}_clearLayerForLI(){this._layers.forEach(function(e){e.listeners.forEach(function(t){Er(t)})}),this._layers=[]}_getLayerForLI(e){for(var t=0,n;n=this._layers[t];t++)if(n.li===e)return n.layer;return null}viewChange(){this.panel_.querySelectorAll("li").forEach((function(e){var t=this._getLayerForLI(e);t&&(this.testLayerVisibility(t)?e.classList.remove("ol-layer-hidden"):e.classList.add("ol-layer-hidden"))}).bind(this))}getPanel(){return this.panelContainer_}drawPanel(){if(this.getMap()){var e=this;this.dcount++,setTimeout(function(){e.drawPanel_()},this.get("drawDelay")||0)}}drawPanel_(){if(!(--this.dcount||this.dragging_)){var e=this.panelContainer_.scrollTop;this._clearLayerForLI(),this.panel_.querySelectorAll("li").forEach((function(t){t.classList.contains("ol-header")||t.remove()}).bind(this)),this._layerGroup?this.drawList(this.panel_,this._layerGroup.getLayers()):this.getMap()&&this.drawList(this.panel_,this.getMap().getLayers()),this.panelContainer_.scrollTop=e,this.counter&&(this.counter.innerHTML=this.panel_.parentNode.querySelectorAll("ul.panel > li:not(.ol-header)").length)}}switchLayerVisibility(e,t){e.get("baseLayer")?(e.getVisible()||e.setVisible(!0),t.forEach(function(n){e!==n&&n.get("baseLayer")&&n.getVisible()&&n.setVisible(!1)})):e.setVisible(!e.getVisible())}testLayerVisibility(e){if(!this.getMap())return!0;var t=this.getMap().getView().getResolution(),n=this.getMap().getView().getZoom();if(e.getMaxResolution()<=t||e.getMinResolution()>=t)return!1;if(e.getMinZoom&&(e.getMinZoom()>=n||e.getMaxZoom()<n))return!1;var r=e.getExtent();if(r){var s=this.getMap().getView().calculateExtent(this.getMap().getSize());return Ei(s,r)}return!0}dragOrdering_(e){e.stopPropagation(),e.preventDefault();var t=this,n=e.currentTarget.parentNode.parentNode,r=!0,s=this.panel_,o,a=e.pageY||e.touches&&e.touches.length&&e.touches[0].pageY||e.changedTouches&&e.changedTouches.length&&e.changedTouches[0].pageY,l,c,h,u;n.parentNode.classList.add("drag");function f(){if(l){var g=h,m=t.getSelection()===g;if(g&&l){var _;u?_=u.getLayers():_=t._layerGroup?t._layerGroup.getLayers():t.getMap().getLayers();for(var v=_.getArray(),x=0;x<v.length;x++)if(v[x]==g){_.removeAt(x);break}for(var S=0;S<v.length;S++)if(v[S]===l){x>S?_.insertAt(S,g):_.insertAt(S+1,g);break}}m&&t.selectLayer(g),t.dispatchEvent({type:"reorder-end",layer:g,group:u})}n.parentNode.querySelectorAll("li").forEach(function(b){b.classList.remove("dropover"),b.classList.remove("dropover-after"),b.classList.remove("dropover-before")}),n.classList.remove("drag"),n.parentNode.classList.remove("drag"),t.element.classList.remove("drag"),c&&c.remove(),se.removeListener(document,"mousemove touchmove",d),se.removeListener(document,"mouseup touchend touchcancel",f)}function d(g){if(o=g.pageY||g.touches&&g.touches.length&&g.touches[0].pageY||g.changedTouches&&g.changedTouches.length&&g.changedTouches[0].pageY,r&&Math.abs(a-o)>2&&(r=!1,n.classList.add("drag"),h=t._getLayerForLI(n),l=!1,u=t._getLayerForLI(n.parentNode.parentNode),c=se.create("LI",{className:"ol-dragover",html:n.innerHTML,style:{position:"absolute","z-index":1e4,left:n.offsetLeft,opacity:.5,width:se.outerWidth(n),height:se.getStyle(n,"height")},parent:s}),t.element.classList.add("drag"),t.dispatchEvent({type:"reorder-start",layer:h,group:u})),!r){g.preventDefault(),g.stopPropagation(),se.setStyle(c,{top:o-se.offsetRect(s).top+s.scrollTop+5});var m;if(!g.touches)m=g.target,g.target.shadowRoot&&(m=g.composedPath()[0]);else for(m=document.elementFromPoint(g.touches[0].clientX,g.touches[0].clientY);m.shadowRoot;)m=m.shadowRoot.elementFromPoint(g.touches[0].clientX,g.touches[0].clientY);for(m.classList.contains("ol-switcherbottomdiv")?t.overflow(-1):m.classList.contains("ol-switchertopdiv")&&t.overflow(1);m&&m.tagName!=="LI";)m=m.parentNode;(!m||!m.classList.contains("dropover"))&&n.parentNode.querySelectorAll("li").forEach(function(_){_.classList.remove("dropover"),_.classList.remove("dropover-after"),_.classList.remove("dropover-before")}),m&&m.parentNode.classList.contains("drag")&&m!==n?(l=t._getLayerForLI(m),l&&!l.get("allwaysOnTop")==!h.get("allwaysOnTop")?(m.classList.add("dropover"),m.classList.add(n.offsetTop<m.offsetTop?"dropover-after":"dropover-before")):l=!1,se.show(c)):(l=!1,m===n?se.hide(c):se.show(c)),l?c.classList.remove("forbidden"):c.classList.add("forbidden")}}se.addListener(document,"mousemove touchmove",d),se.addListener(document,"mouseup touchend touchcancel",f)}dragOpacity_(e){e.stopPropagation(),e.preventDefault();var t=this,n=e.target,r=this._getLayerForLI(n.parentNode.parentNode.parentNode);if(!r)return;var s=e.pageX||e.touches&&e.touches.length&&e.touches[0].pageX||e.changedTouches&&e.changedTouches.length&&e.changedTouches[0].pageX,o=se.getStyle(n,"left")-s;t.dragging_=!0;function a(){se.removeListener(document,"mouseup touchend touchcancel",a),se.removeListener(document,"mousemove touchmove",l),t.dragging_=!1}function l(c){var h=c.pageX||c.touches&&c.touches.length&&c.touches[0].pageX||c.changedTouches&&c.changedTouches.length&&c.changedTouches[0].pageX,u=(o+h)/se.getStyle(n.parentNode,"width"),f=Math.max(0,Math.min(1,u));se.setStyle(n,{left:f*100+"%"}),n.parentNode.nextElementSibling.innerHTML=Math.round(f*100),r.setOpacity(f)}se.addListener(document,"mouseup touchend touchcancel",a),se.addListener(document,"mousemove touchmove",l)}drawList(e,t){var n=this,r=t.getArray(),s=function(u){u.stopPropagation(),u.preventDefault();var f=n._getLayerForLI(this.parentNode.parentNode);n.switchLayerVisibility(f,t),n.get("selection")&&f.getVisible()&&n.selectLayer(f),n.onchangeCheck&&n.onchangeCheck(f)};function o(u){u.stopPropagation(),u.preventDefault();var f=n._getLayerForLI(this.parentNode.parentNode);n.oninfo(f),n.dispatchEvent({type:"info",layer:f})}function a(u){u.stopPropagation(),u.preventDefault();var f=n._getLayerForLI(this.parentNode.parentNode);n.onextent?n.onextent(f):n.getMap().getView().fit(f.getExtent(),n.getMap().getSize()),n.dispatchEvent({type:"extent",layer:f})}function l(u){u.stopPropagation(),u.preventDefault();var f=this.parentNode.parentNode.parentNode.parentNode,d,g=n._getLayerForLI(f);g?(d=n._getLayerForLI(this.parentNode.parentNode),g.getLayers().remove(d),g.getLayers().getLength()==0&&!g.get("noSwitcherDelete")&&l.call(f.querySelectorAll(".layerTrash")[0],u)):(f=this.parentNode.parentNode,n.getMap().removeLayer(n._getLayerForLI(f)))}function c(u){if(!this.displayInLayerSwitcher(u)){this._setLayerForLI(null,u);return}var f=se.create("LI",{className:(u.getVisible()?"ol-visible ":" ")+(u.get("baseLayer")?"baselayer":""),parent:e});this._setLayerForLI(f,u),this._selectedLayer===u&&f.classList.add("ol-layer-select");var d=se.create("DIV",{className:"ol-layerswitcher-buttons",parent:f}),g=se.create("DIV",{className:"li-content",parent:f}),m=se.create("INPUT",{type:u.get("baseLayer")?"radio":"checkbox",className:"ol-visibility",checked:u.getVisible(),click:function(F){s.bind(this)(F),setTimeout(function(){F.target.checked=u.getVisible()})},on:{keydown:(function(F){switch(F.key){case"ArrowLeft":case"ArrowRight":{F.preventDefault(),F.stopPropagation();var N=F.key==="ArrowLeft"?-.1:.1,R=Math.min(1,Math.max(0,u.getOpacity()+N));u.setOpacity(R);break}case"Enter":{n.get("selection")&&(F.preventDefault(),F.stopPropagation(),n.selectLayer(u));break}case"-":case"+":u.getLayers&&(this._focus=u,u.set("openInLayerSwitcher",!u.get("openInLayerSwitcher")));case"ArrowUp":case"ArrowDown":{if(F.ctrlKey&&this.reordering){F.preventDefault(),F.stopPropagation();var P=t.getArray().indexOf(u);P>-1&&(F.key==="ArrowDown"?P>0&&(t.remove(u),t.insertAt(P-1,u),n._focus=u,n.dispatchEvent({type:"reorder-end",layer:u})):P<t.getLength()-1&&(t.remove(u),t.insertAt(P+1,u),n._focus=u,n.dispatchEvent({type:"reorder-end",layer:u})))}break}default:{var O=this._getLayerForLI(e.parentNode);this.dispatchEvent({type:"layer:keydown",key:F.key,group:O,li:f,layer:u,originalEvent:F})}}}).bind(this)},parent:g});u===n._focus&&(m.focus(),n.overflow());var _=se.create("LABEL",{title:u.get("title")||u.get("name"),click:s,style:{userSelect:"none"},parent:g});if(_.addEventListener("selectstart",function(){return!1}),se.create("SPAN",{html:u.get("title")||u.get("name"),click:(function(F){this.get("selection")&&(F.stopPropagation(),this.selectLayer(u))}).bind(this),parent:_}),this.reordering&&(h<r.length-1&&(u.get("allwaysOnTop")||!r[h+1].get("allwaysOnTop"))||h>0&&(!u.get("allwaysOnTop")||r[h-1].get("allwaysOnTop")))&&se.create("DIV",{className:"layerup ol-noscroll",title:this.tip.up,on:{"mousedown touchstart":function(F){n.dragOrdering_(F)}},parent:d}),u.getLayers){var v=0;u.getLayers().forEach(function(F){n.displayInLayerSwitcher(F)&&v++}),v&&se.create("DIV",{className:u.get("openInLayerSwitcher")?"collapse-layers":"expend-layers",title:this.tip.plus,click:function(){var F=n._getLayerForLI(this.parentNode.parentNode);F.set("openInLayerSwitcher",!F.get("openInLayerSwitcher"))},parent:d})}if(this.oninfo&&se.create("DIV",{className:"layerInfo",title:this.tip.info,click:o,parent:d}),this.hastrash&&!u.get("noSwitcherDelete")&&se.create("DIV",{className:"layerTrash",title:this.tip.trash,click:l,parent:d}),this.hasextent&&r[h].getExtent()){var x=r[h].getExtent();x.length==4&&x[0]<x[2]&&x[1]<x[3]&&se.create("DIV",{className:"layerExtent",title:this.tip.extent,click:a,parent:d})}if(this.show_progress&&u instanceof Vy){var S=se.create("DIV",{className:"layerswitcher-progress",parent:g});this.setprogress_(u),u.layerswitcher_progress=se.create("DIV",{parent:S})}var b=se.create("DIV",{className:"layerswitcher-opacity",click:function(F){if(F.target===this){F.stopPropagation(),F.preventDefault();var N=Math.max(0,Math.min(1,F.offsetX/se.getStyle(this,"width")));n._getLayerForLI(this.parentNode.parentNode).setOpacity(N),this.parentNode.querySelectorAll(".layerswitcher-opacity-label")[0].innerHTML=Math.round(N*100)}},parent:g});if(se.create("DIV",{className:"layerswitcher-opacity-cursor ol-noscroll",style:{left:u.getOpacity()*100+"%"},on:{"mousedown touchstart":function(F){n.dragOpacity_(F)}},parent:b}),se.create("DIV",{className:"layerswitcher-opacity-label",html:Math.round(u.getOpacity()*100),parent:g}),u.getLayers&&(f.classList.add("ol-layer-group"),u.get("openInLayerSwitcher")===!0)){var A=se.create("UL",{parent:f});this.drawList(A,u.getLayers())}f.classList.add(this.getLayerClass(u)),this.dispatchEvent({type:"drawlist",layer:u,li:f})}for(var h=r.length-1;h>=0;h--)c.call(this,r[h]);this.viewChange(),e===this.panel_&&(this.overflow(""),this._focus=null)}getLayerClass(e){return e?e.getLayers?"ol-layer-group":e instanceof ao?"ol-layer-vector":e instanceof VC?"ol-layer-vectortile":e instanceof Vy?"ol-layer-tile":e instanceof mC?"ol-layer-image":e instanceof qC?"ol-layer-heatmap":e.getFeatures?"ol-layer-vectorimage":"unknown":"none"}selectLayer(e,t){if(!e){if(!this.getMap())return;e=this.getMap().getLayers().item(this.getMap().getLayers().getLength()-1)}this._selectedLayer=e,this.element.querySelector("input.ol-visibility:focus")&&(this._focus=e),this.drawPanel(),t||this.dispatchEvent({type:"select",layer:e})}getSelection(){return this._selectedLayer}setprogress_(e){if(!e.layerswitcher_progress){var t=0,n=0,r=function(){n===t?(n=t=0,se.setStyle(e.layerswitcher_progress,{width:0})):se.setStyle(e.layerswitcher_progress,{width:(t/n*100).toFixed(1)+"%"})};e.getSource().on("tileloadstart",function(){n++,r()}),e.getSource().on("tileloadend",function(){t++,r()}),e.getSource().on("tileloaderror",function(){t++,r()})}}};QD.prototype.tip={up:"up/down",down:"down",info:"informations...",extent:"zoom to extent",trash:"remove layer",plus:"expand/shrink"};Bm.prototype.getPreview=function(){return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAk6QAAJOkBUCTn+AAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAANeSURBVHic7ZpPiE1RHMc/780MBhkik79JSUlIUbOxI+wkI2yRhYSUlJLNpJF/xcpiJBmZGBZsNM1CkmhKITGkGbH0/BuPmXnP4rxbb/TOn3fvOffeec6nfqvb/b7f93fveeec37ng8Xg8Ho/nf6Uu4d+fDswFssCvhHOJhaXAMeApMAQUyyIPPAdOAiuTStAVy4EHjDWsix5gdRLJ2mY34ulWYz6IEeA4kIk9awtkgTOEM/5vdAKT4k0/Ou3YMR/ELcbRm9AKFLBbgCJwNE4TYZkJfMG++SIwDCyLz0o4bI17WdyJz0r1TAZ+oDcxCBwAFgIzEIuhvcBbg3sLwOK4DFXLFvQGniCGSSUagS4DjUPOHESkA3XiOWCORqMR6Nfo9DjI3QqPUSd+ylBnv0Zn0GrWFvmIOvGNhjqrNDp/EAutyFgRKUM2tgO+Gur81FxvAKYZaimxXYBvmuuLDHWWaK4X0RfJCNsF6NdcbzXU2a65PohYFKWOc+jn8PUajbWIXaBKp9NB7lZYh34OzwFbFfd/NtDYYSth27urLGIm0M31AL3APWAAmIooymaDnPIl/Vz4NN1yHrd7gcvxWQnHAuA3bsyPop8hUsE13BSgK04TUViBeFo2zedJ8S6wElexW4D2eNOPTjNi6WvD/DtEr8E6tk6GGoAmxFY2iFHE9NZiQf8gogiB9gTEH23izAZuE77vHyU+ANucO1QwD3hD/MbLowAcdm20EmkwXx4n3NodS9rMB2HabYpEWs0HcRqHp0fNwAvJD+eBTZr7p6BvmQVxUaEzEbiruNfJekH15L8jtrEm7JJolEcOmKXRqQOuKDQuY7HZY8s8iNfzkSLxIuI43FTrkkLnOlBfRW4VsWk+oAX5weknxFAxJQNckGgVgZuIRVoomoGXEmGTMa+iQ6K7M4SW7k24QYgiuDQPYinbhugiF4H3RGtzZYCzyIvQXfpNI1ybLyeLpf5+iTbkRbiP2EcocTHm4+YI8iI8RFHwWjAfsA95Q+YZFU6wasl8wB7kReijtNbIILa0vcg/PRlGfPQwHmlCviDqAzaA+OREtzqr1ejOIDorxlNEjTGUBV4nnUWCvAJxGDlA8q9j3DEArAn2zvXAfOwfl6eVAmJrPpJ0Ih6Px+PxeJLjLwPul3vj5d0eAAAAAElFTkSuQmCC"};jm.prototype.getPreview=function(i,e){i||(i=[21020,6355964]),e||(e=150);var t=this.getTileGrid().getTileCoordForCoordAndResolution(i,e),n=this.getTileUrlFunction();return n.call(this,t,this.getProjection())};vC.prototype.getPreview=function(i,e){i||(i=[21020,6355964]),e||(e=150);var t=this.getTileUrlFunction();if(t){var n=this.getTileGrid()||this.getTileGridForProjection(this.getProjection()),r=n.getTileCoordForCoordAndResolution(i,e);return t.call(this,r,1,this.getProjection())}var s=this.getGetFeatureInfoUrl?this.getGetFeatureInfoUrl(i,e,this.getProjection()||"EPSG:3857",{}):this.getFeatureInfoUrl(i,e,this.getProjection()||"EPSG:3857",{});return s=s.replace(/getfeatureinfo/i,"GetMap"),s};Hc.prototype.getPreview=function(i,e,t){if(this.get("preview"))return[this.get("preview")];if(e||(e=150),e<this.getMinResolution()||e>this.getMaxResolution()){var n=this.getMinResolution(),r=this.getMaxResolution();for(r>1e5&&(r=156543),n<.15&&(n=.15),e=r;r>n;)n*=2,r/=2,e=n}var s=this.getExtent();if(i||(i=[21020,6355964]),s&&!Hr(s,i)&&(i=[(s[0]+s[2])/2,(s[1]+s[3])/2]),t&&(i=ro(i,t,this.getSource().getProjection())),this.getSource&&this.getSource())try{return[this.getSource().getPreview(i,e)]}catch{}return[]};Vl.prototype.getPreview=function(i,e){if(this.get("preview"))return[this.get("preview")];var t=[];if(this.getLayers)for(var n=this.getLayers().getArray(),r=0;r<n.length;r++)t=t.concat(n[r].getPreview(i,e));return t};var XC=class extends Os{constructor(e){e=e||{},e.fullscreen&&(e.target=document.body);var t=e.target===document.body,n=se.create(t?"DIALOG":"DIV",{className:((e.className||"")+(e.zoom?" ol-zoom":"")+" ol-ext-dialog").trim()});super({element:n,target:e.target}),t&&(n.addEventListener("close",(function(){this.hide()}).bind(this)),document.addEventListener("keydown",(function(o){o.key==="Escape"&&!this.get("closeBox")&&this.isOpen()&&o.preventDefault()}).bind(this)),n.addEventListener("cancel",(function(){setTimeout((function(){this.dispatchEvent("cancel")}).bind(this))}).bind(this))),n.addEventListener("click",(function(o){this.get("hideOnBack")&&o.target===n&&this.close(),this.get("hideOnClick")&&this.close()}).bind(this));var r=se.create("FORM",{on:{submit:this._onButton("submit")},parent:n});se.create("H2",{parent:r}),se.create("DIV",{className:"ol-closebox",click:this._onButton("cancel"),parent:r}),se.create("DIV",{className:"ol-content",parent:r}),this._progress=se.create("DIV",{style:{display:"none"},parent:r});var s=se.create("DIV",{className:"ol-progress-bar",parent:this._progress});this._progressbar=se.create("DIV",{parent:s}),this._progressMessage=se.create("DIV",{className:"ol-progress-message",parent:this._progress}),se.create("DIV",{className:"ol-buttons",parent:r}),this.set("closeBox",e.closeBox!==!1),this.set("zoom",!!e.zoom),this.set("hideOnClick",!!e.hideOnClick),this.set("hideOnBack",!!e.hideOnBack),this.set("className",n.className),this.set("closeOnSubmit",e.closeOnSubmit),this.set("buttons",e.buttons),this.setContent(e)}show(e){e&&((e instanceof Element||typeof e=="string")&&(e={content:e}),this.setContent(e)),this.element.showModal&&this.element.showModal(),this.element.classList.add("ol-visible"),this.element.setAttribute("aria-hidden",!1);var t=this.element.querySelector('input[type="text"],input[type="search"],input[type="number"]');if(t&&setTimeout(function(){t.focus()}),this.dispatchEvent({type:"show"}),e){if(e.autoclose){var n=setTimeout((function(){this.hide()}).bind(this),e.autoclose);this.once("hide",function(){clearTimeout(n)})}if(e.hideOnBack){var r=this.get("hideOnBack");this.set("hideOnBack",!0),this.once("hide",(function(){this.set("hideOnBack",r)}).bind(this))}}}open(){this.show()}setContentMessage(e){if(e!==void 0){var t=this.getContentElement();e instanceof Element&&se.setHTML(t,""),se.setHTML(t,e||"")}}setTitle(e){var t=this.element.querySelector("form");t.querySelector("h2").innerText=e||"",e?t.classList.add("ol-title"):t.classList.remove("ol-title")}setContent(e){if(e){this.element.className=this.get("className"),typeof e=="string"&&(e={content:e}),e=e||{},this.setProgress(!1),e.max&&this.setProgress(0,e.max),e.progress!==void 0&&this.setProgress(e.progress),this.get("zoom")?this.element.classList.add("ol-zoom"):this.element.classList.remove("ol-zoom"),e.className&&e.className.split(" ").forEach((function(o){this.element.classList.add(o)}).bind(this));var t=this.element.querySelector("form");e.content!==void 0&&(e.content instanceof Element&&se.setHTML(t.querySelector(".ol-content"),""),se.setHTML(t.querySelector(".ol-content"),e.content||"")),this.setTitle(e.title),e.closeBox||this.get("closeBox")&&e.closeBox!==!1?t.classList.add("ol-closebox"):t.classList.remove("ol-closebox");var n=this.element.querySelector(".ol-buttons");n.innerHTML="";var r=e.buttons||this.get("buttons");if(r){t.classList.add("ol-button");for(var s in r)se.create("INPUT",{type:s==="submit"?"submit":"button",value:r[s],click:this._onButton(s,e.onButton),parent:n})}else t.classList.remove("ol-button")}}getContentElement(){return this.element.querySelector("form .ol-content")}setProgress(e,t,n){if(e===!1){se.setStyle(this._progress,{display:"none"});return}if(t>0?this.set("max",Number(t)):t=this.get("max"),!t)se.setStyle(this._progress,{display:"none"});else{var r=Math.round(e/t*100);se.setStyle(this._progress,{display:""}),this._progressbar.className=r?"":"notransition",se.setStyle(this._progressbar,{width:r+"%"})}this._progressMessage.innerHTML="",se.setHTML(this._progressMessage,n||"")}_onButton(e,t){var n=(function(r){r.preventDefault(),(e!=="submit"||this.get("closeOnSubmit")!==!1)&&this.hide();var s=this.getInputs();setTimeout((function(){this.dispatchEvent({type:"button",button:e,inputs:s}),typeof t=="function"&&t(e,s)}).bind(this))}).bind(this);return n}getInputs(){var e={};return["input","textarea","select"].forEach((function(t){this.element.querySelectorAll("form "+t).forEach(function(n){n.className&&n.className.split(" ").forEach(function(r){e[r]=n})})}).bind(this)),e}hide(){document.activeElement&&document.activeElement!==document.body&&document.activeElement.blur(),this.element.close&&this.element.close(),this.isOpen()&&(this.element.classList.remove("ol-visible"),this.element.setAttribute("aria-hidden",!0),setTimeout((function(){this.dispatchEvent({type:"hide"})}).bind(this)))}close(){this.hide()}isOpen(){return this.element.classList.contains("ol-visible")}},ek=function(i){if(!i)return null;var e=i.getViewport().getElementsByClassName("ol-fixedoverlay")[0];return e||(i.getViewport().querySelector(".ol-layers")?(e=document.createElement("canvas"),e.className="ol-fixedoverlay",i.getViewport().querySelector(".ol-layers").after(e),i.on("precompose",function(t){e.width=i.getSize()[0]*t.frameState.pixelRatio,e.height=i.getSize()[1]*t.frameState.pixelRatio})):e=i.getViewport().querySelector("canvas")),e},l5=class extends Os{constructor(e){e=e||{},super(e),this.setStyle(e.style)}setMap(e){this.getCanvas(e);var t=this.getMap();if(this._listener&&(Er(this._listener),this._listener=null),super.setMap(e),t)try{t.renderSync()}catch{}e&&(this._listener=e.on("postcompose",this._draw.bind(this)))}getCanvas(e){return ek(e)}getContext(e){var t=e.context;if(!t&&this.getMap()){var n=this.getMap().getViewport().getElementsByClassName("ol-fixedoverlay")[0];t=n?n.getContext("2d"):null}return t}setStyle(e){this._style=e||new Li({})}getStyle(){return this._style}getStroke(){var e=this._style.getStroke();return e||this._style.setStroke(new xn({color:"#000",width:1.25})),this._style.getStroke()}getFill(){var e=this._style.getFill();return e||this._style.setFill(new cr({color:"#fff"})),this._style.getFill()}getTextStroke(){var e=this._style.getText();return e||(e=new Uo({})),e.getStroke()||e.setStroke(new xn({color:"#fff",width:3})),e.getStroke()}getTextFill(){var e=this._style.getText();return e||(e=new Uo({})),e.getFill()||e.setFill(new cr({color:"#fff"})),e.getFill()}getTextFont(){var e=this._style.getText();return e||(e=new Uo({})),e.getFont()||e.setFont("12px sans-serif"),e.getFont()}_draw(){console.warn("[CanvasBase] draw function not implemented.")}},tk=class extends l5{constructor(e){e=e||{};var t=document.createElement("div");if(super({element:t,target:e.target}),e.target)t.className=e.className||"ol-legend";else{t.className=(e.className||"ol-legend")+" ol-unselectable ol-control"+(e.collapsible===!1?" ol-uncollapsible":" ol-collapsed");var n=document.createElement("button");n.setAttribute("type","button"),n.addEventListener("click",(function(){this.toggle()}).bind(this)),t.appendChild(n),n=document.createElement("button"),n.setAttribute("type","button"),n.className="ol-closebox",n.addEventListener("click",(function(){this.toggle()}).bind(this)),t.appendChild(n)}this._legend=e.legend,this._legend.getCanvas().className="ol-legendImg",t.appendChild(this._legend.getCanvas()),t.appendChild(this._legend.getListElement()),e.collapsible!==!1&&e.collapsed===!1&&this.show(),this._legend.on("select",(function(r){this.dispatchEvent(r)}).bind(this)),this._legend.on("refresh",(function(){if(this._onCanvas&&this.getMap())try{this.getMap().renderSync()}catch{}}).bind(this)),this._legend.on("items",(function(r){r.nb?(this.element.classList.remove("ol-empty"),this.element.title=e.title||"legend"):(this.element.classList.add("ol-empty"),this.element.title=e.emptyTitle||"no legend"),this.dispatchEvent(r)}).bind(this))}getLegend(){return this._legend}setCanvas(e){if(this._onCanvas=e,this.element.style.visibility=e?"hidden":"visible",this.getMap())try{this.getMap().renderSync()}catch{}}onCanvas(){return!!this._onCanvas}_draw(e){if(this._onCanvas&&!this.element.classList.contains("ol-collapsed")){var t=this._legend.getCanvas(),n=this.getContext(e),r=n.canvas.height-t.height;n.save(),n.rect(0,r,t.width,t.height);var s="#fff";this._legend.getTextStyle().getBackgroundFill()&&(s=No(this._legend.getTextStyle().getBackgroundFill().getColor())),n.fillStyle=n.strokeStyle=s,n.lineWidth=10,n.lineJoin="round",n.stroke(),n.clearRect(0,r,t.width,t.height),n.fill(),n.drawImage(t,0,r),n.restore()}}show(){if(this.element.classList.contains("ol-collapsed")&&(this.element.classList.remove("ol-collapsed"),this.dispatchEvent({type:"change:collapse",collapsed:!1}),this.getMap()))try{this.getMap().renderSync()}catch{}}hide(){if(!this.element.classList.contains("ol-collapsed")&&(this.element.classList.add("ol-collapsed"),this.dispatchEvent({type:"change:collapse",collapsed:!0}),this.getMap()))try{this.getMap().renderSync()}catch{}}collapse(e){e===!1?this.show():this.hide()}isCollapsed(){return this.element.classList.contains("ol-collapsed")}toggle(){if(this.element.classList.toggle("ol-collapsed"),this.dispatchEvent({type:"change:collapse",collapsed:this.element.classList.contains("ol-collapsed")}),this.getMap())try{this.getMap().renderSync()}catch{}}},KC=class extends Os{constructor(e){e=e||{};var t=se.create("DIV",{className:e.className||"ol-print"});super({element:t,target:e.target}),e.target||(t.classList.add("ol-unselectable","ol-control"),se.create("BUTTON",{type:"button",title:e.title||"Print",click:(function(){this.print()}).bind(this),parent:t})),this.set("immediate",e.immediate),this.set("imageType",e.imageType||"image/jpeg"),this.set("quality",e.quality||.8),this.set("orientation",e.orientation)}toClipboard(e,t){try{e.canvas.toBlob(function(n){try{navigator.clipboard.write([new window.ClipboardItem(Object.defineProperty({},n.type,{value:n,enumerable:!0}))]),typeof t=="function"&&t(!0)}catch{typeof t=="function"&&t(!1)}})}catch{typeof t=="function"&&t(!1)}}copyMap(e,t){this.once("print",(function(n){this.toClipboard(n,t)}).bind(this)),this.print(e)}_getCanvas(e,t,n){var r;if(e.context)n=e.context.canvas;else{if(n)r=n.getContext("2d");else{n=document.createElement("canvas");var s=this.getMap().getSize();n.width=s[0],n.height=s[1],r=n.getContext("2d"),/jp.*g$/.test(t)&&(r.fillStyle=this.get("bgColor")||"white",r.fillRect(0,0,n.width,n.height))}this.getMap().getViewport().querySelectorAll(".ol-layers canvas, canvas.ol-fixedoverlay").forEach((function(o){if(o.width){if(r.save(),o.parentNode.style.opacity==="0")return;r.globalAlpha=parseFloat(o.parentNode.style.opacity)||1,r.globalCompositeOperation=se.getStyle(o.parentNode,"mix-blend-mode"),r.filter=se.getStyle(o.parentNode,"filter");var a=se.getStyle(o,"transform")||se.getStyle(o,"-webkit-transform");/^matrix/.test(a)?(a=a.replace(/^matrix\(|\)$/g,"").split(","),a.forEach(function(l,c){a[c]=parseFloat(l)}),r.transform(a[0],a[1],a[2],a[3],a[4],a[5]),r.drawImage(o,0,0)):r.drawImage(o,0,0,se.getStyle(o,"width"),se.getStyle(o,"height")),r.restore()}}).bind(this))}return n}fastPrint(e,t){e=e||{},this._ol6?requestAnimationFrame((function(){t(this._getCanvas({},e.imageType,e.canvas))}).bind(this)):(this.getMap().once("postcompose",(function(n){n.context||(this._ol6=!0),t(this._getCanvas(n,e.imageType,e.canvas))}).bind(this)),this.getMap().render())}print(e){e=e||{};var t=e.imageType||this.get("imageType"),n=e.quality||this.get("quality");if(this.getMap()){if(e.immediate!=="silent"&&this.dispatchEvent(Object.assign({type:"printing"},e)),!e.immediate){setTimeout((function(){e=Object.assign({},e),e.immediate="silent",this.print(e)}).bind(this),200);return}this.getMap().once(this.get("immediate")?"postcompose":"rendercomplete",(function(r){var s=this._getCanvas(r,t),o=e.size||[210,297],a=e.format||"a4",l,c,h,u=e.orient||this.get("orientation"),f=typeof e.margin=="number"?e.margin:10;if(s){u!=="landscape"&&u!=="portrait"&&(u=s.width>s.height?"landscape":"portrait"),u==="landscape"&&(o=[o[1],o[0]]);var d=Math.min((o[0]-2*f)/s.width,(o[1]-2*f)/s.height);l=d*s.width,c=d*s.height,h=[(o[0]-l)/2,(o[1]-c)/2]}var g;try{g=s?s.toDataURL(t,n):null}catch{this.dispatchEvent({type:"error",canvas:s});return}var m=Object.assign({type:"print",print:{format:a,orientation:u,unit:"mm",size:o,position:h,imageWidth:l,imageHeight:c},image:g,imageType:t,quality:n,canvas:s},e);this.dispatchEvent(m)}).bind(this)),this.getMap().render()}}},ik=class extends l5{constructor(e){e=e||{};var t=se.create("DIV",{className:(e.className||"")+" ol-control-title ol-unselectable",style:{display:"block",visibility:"hidden"}});super({element:t,style:e.style}),this.setTitle(e.title||""),this.setVisible(e.visible!==!1),this.element.style.font=this.getTextFont()}setStyle(e){super.setStyle(e),this.element&&(this.element.style.font=this.getTextFont()),this.getMap()&&this.getMap().render()}setTitle(e){if(this.element.textContent=e,this.set("title",e),this.getMap())try{this.getMap().renderSync()}catch{}}getTitle(){return this.get("title")}setVisible(e){if(this.element.style.display=e?"block":"none",this.getMap())try{this.getMap().renderSync()}catch{}}getVisible(){return this.element.style.display!=="none"}_draw(e){if(this.getVisible()){var t=this.getContext(e);if(t){var n=e.frameState.pixelRatio;t.save(),t.scale(n,n);var r=this.element.getBoundingClientRect(),s=this.getMap().getViewport().getBoundingClientRect(),o=this.getMap().getSize()[0]/s.width;t.translate(Math.round((r.left-s.left)*o),Math.round((r.top-s.top)*o));var a=this.element.clientHeight,l=this.element.clientWidth,c=l/2;t.beginPath(),t.fillStyle=No(this.getFill().getColor()),t.rect(0,0,l,a),t.fill(),t.closePath(),t.beginPath(),t.fillStyle=No(this.getTextFill().getColor()),t.strokeStyle=No(this.getTextStroke().getColor()),t.lineWidth=this.getTextStroke().getWidth(),t.textAlign="center",t.textBaseline="middle",t.font=this.getTextFont(),t.lineJoin="round",t.lineWidth&&t.strokeText(this.getTitle(),c,a/2),t.fillText(this.getTitle(),c,a/2),t.closePath(),t.restore()}}}},S_=function(i,e){var t=i.getView(),n=t.getProjection(),r=t.getCenter(),s=i.getPixelFromCoordinate(r);s[1]+=1;var o=i.getCoordinateFromPixel(s),a=Td(ro(r,n,"EPSG:4326"),ro(o,n,"EPSG:4326"));return a*=96/.0254,a},nk=function(i,e,t){if(i&&e){var n=e;if(typeof e=="string"&&(e=e.replace(":","/").split("/"),n=e[1],n||(n=e[0]||""),n=n.replace(/[^\d]/g,""),n=parseInt(n),e[1])){var r=parseInt(e[0]);r&&(n/=r)}if(!n)return;var s=i.getView(),o=s.getProjection(),a=s.getCenter(),l=i.getPixelFromCoordinate(a);l[1]+=1;var c=i.getCoordinateFromPixel(l),h=Td(ro(a,o,"EPSG:4326"),ro(c,o,"EPSG:4326"));return h*=96/.0254,s.setResolution(s.getResolution()*n/h),n}},SE=class extends l5{constructor(e){e=e||{};var t=document.createElement("div");t.className="ol-control ol-compassctrl ol-unselectable ol-hidden"+(e.className?" "+e.className:""),t.style.position="absolute",t.style.visibility="hidden";var n=e.style instanceof xn?new Li({stroke:e.style}):e.style;e.style||(n=new Li({stroke:new xn({width:0})})),super({element:t,style:n}),this.set("rotateVithView",e.rotateWithView!==!1),this.setVisible(e.visible!==!1),this.setImage(e.image||e.src)}setImage(e){if(e instanceof Image)this.img_=e,this.img_.onload=(function(){if(this.getMap())try{this.getMap().renderSync()}catch{}}).bind(this);else if(typeof e=="string")switch(e){case"compact":{this.img_=this.compactCompass_(this.element.clientWidth,this.getStroke().getColor());break}case"default":{this.img_=this.defaultCompass_(this.element.clientWidth,this.getStroke().getColor());break}default:{this.img_=new Image,this.img_.onload=(function(){if(this.getMap())try{this.getMap().renderSync()}catch{}}).bind(this),this.img_.src=e;break}}else this.img_=this.defaultCompass_(this.element.clientWidth,this.getStroke().getColor())}compactCompass_(e,t){var n=document.createElement("canvas"),r=n.getContext("2d");e=n.width=n.height=e||150;var s=e/2;return r.translate(s,s),r.fillStyle=t||"#963",r.lineWidth=5,r.lineJoin=r.lineCap="round",r.font="bold "+s*.4+"px sans-serif",r.textBaseline="bottom",r.textAlign="center",r.strokeStyle="#fff",r.globalAlpha=.75,r.strokeText("N",0,-s/2),r.globalAlpha=1,r.fillText("N",0,-s/2),r.beginPath(),r.moveTo(0,s/4),r.lineTo(s/3,s/2),r.lineTo(0,-s/2),r.lineTo(-s/3,s/2),r.lineTo(0,s/4),r.lineWidth=12,r.fillStyle="#fff",r.globalAlpha=.75,r.fill(),r.stroke(),r.globalAlpha=1,r.fillStyle=r.strokeStyle=t||"#963",r.lineWidth=5,r.beginPath(),r.moveTo(0,s/4),r.lineTo(0,-s/2),r.lineTo(s/3,s/2),r.lineTo(0,s/4),r.fill(),r.stroke(),r.beginPath(),r.moveTo(0,s/4),r.lineTo(0,-s/2),r.lineTo(-s/3,s/2),r.lineTo(0,s/4),r.stroke(),n}defaultCompass_(e,t){var n=document.createElement("canvas"),r=n.getContext("2d");e=n.width=n.height=e||150;var s=e/2,o=.22*s;function a(c,h){r.fillStyle=t||"#963",r.beginPath(),r.moveTo(0,0),r.lineTo(c,0),r.lineTo(h,h),r.moveTo(0,0),r.lineTo(-c,0),r.lineTo(-h,-h),r.moveTo(0,0),r.lineTo(0,c),r.lineTo(-h,h),r.moveTo(0,0),r.lineTo(0,-c),r.lineTo(h,-h),r.moveTo(0,0),r.fill(),r.stroke()}function l(c,h){r.globalCompositeOperation="destination-out",r.fillStyle="#fff",r.beginPath(),r.moveTo(0,0),r.lineTo(c,0),r.lineTo(h,-h),r.moveTo(0,0),r.lineTo(-c,0),r.lineTo(-h,h),r.moveTo(0,0),r.lineTo(0,c),r.lineTo(h,h),r.moveTo(0,0),r.lineTo(0,-c),r.lineTo(-h,-h),r.moveTo(0,0),r.fill(),r.globalCompositeOperation="source-over",r.beginPath(),r.moveTo(0,0),r.lineTo(c,0),r.lineTo(h,-h),r.moveTo(0,0),r.lineTo(-c,0),r.lineTo(-h,h),r.moveTo(0,0),r.lineTo(0,c),r.lineTo(h,h),r.moveTo(0,0),r.lineTo(0,-c),r.lineTo(-h,-h),r.moveTo(0,0),r.stroke()}return r.translate(s,s),r.strokeStyle=t||"#963",r.lineWidth=1.5,r.beginPath(),r.arc(0,0,e*.41,0,2*Math.PI),r.arc(0,0,e*.44,0,2*Math.PI),r.stroke(),r.rotate(Math.PI/4),a(s*.9,o*.8),l(s*.9,o*.8),r.rotate(-Math.PI/4),a(s,o),l(s,o),n}getVisible(){return se.getStyle(this.element,"display")==="block"}setVisible(e){e?this.element.classList.add("ol-visible"):this.element.classList.remove("ol-visible"),this.getMap()&&this.getMap().render()}_draw(e){var t=this.getContext(e);if(!(!t||!this.getVisible())){var n=t.canvas,r,s=[];for(r=0;r<8;r++)s[r]=[Math.cos(Math.PI*r/8),Math.sin(Math.PI*r/8)];var o=e.frameState.pixelRatio;t.save(),t.scale(o,o);var a=this.element.clientWidth,l=this.element.clientHeight,c={left:this.element.offsetLeft,top:this.element.offsetTop},h=this.img_,u=e.frameState.viewState.rotation;if(t.beginPath(),t.translate(c.left+a/2,c.top+l/2),this.get("rotateVithView")&&t.rotate(u),this.getStroke().getWidth()){t.beginPath(),t.strokeStyle=this.getStroke().getColor(),t.lineWidth=this.getStroke().getWidth();var f=Math.max(n.width,n.height);for(r=0;r<8;r++)t.moveTo(-s[r][0]*f,-s[r][1]*f),t.lineTo(s[r][0]*f,s[r][1]*f);t.stroke()}h.width&&t.drawImage(h,-a/2,-l/2,a,l),t.closePath(),t.restore()}}},zu=class extends Os{constructor(e){e=e||{};var t=se.create("DIV",{className:(e.className||"ol-print")+" ol-unselectable ol-control"});super({element:t}),this._lang=e.lang||"en",e.target||se.create("BUTTON",{type:"button",title:e.title||"Print",click:(function(){this.print()}).bind(this),parent:t}),e.openWindow&&this.on("print",function(T){T.canvas&&window.open().document.write('<img src="'+T.canvas.toDataURL()+'"/>')}),e.target=se.create("DIV");var n=this._printCtrl=new KC(e);n.on(["print","error","printing"],(function(T){this._printing(T)}).bind(this)),this._compass=new SE({src:e.northImage||"compact",visible:!1,className:"olext-print-compass",style:new xn({color:"#333",width:0})});var r=this._printDialog=new XC({target:e.targetDialog||document.body,closeBox:!0,className:"ol-ext-print-dialog"}),s=r.getContentElement();this._input={};var o=se.create("DIV",{className:"ol-print-param",parent:s});this._pages=[se.create("DIV",{className:"ol-page"})];var a=se.create("DIV",{className:"ol-map",parent:this._pages[0]});se.create("DIV",{html:this._pages[0],className:"ol-print-map",parent:s}),se.create("H2",{html:this.i18n("title"),parent:o});var l=se.create("UL",{parent:o}),c=se.create("LI",{className:"ol-orientation",parent:l});this._input.orientation={list:c};var h=se.create("LABEL",{className:"portrait",parent:c});this._input.orientation.portrait=se.create("INPUT",{type:"radio",name:"ol-print-orientation",value:"portrait",checked:!0,on:{change:(function(T){this.setOrientation(T.target.value)}).bind(this)},parent:h}),se.create("SPAN",{html:this.i18n("portrait"),parent:h}),h=se.create("LABEL",{className:"landscape",parent:c}),this._input.orientation.landscape=se.create("INPUT",{type:"radio",name:"ol-print-orientation",value:"landscape",on:{change:(function(T){this.setOrientation(T.target.value)}).bind(this)},parent:h}),se.create("SPAN",{html:this.i18n("landscape"),parent:h});var u;c=se.create("LI",{html:se.create("LABEL",{html:this.i18n("size")}),className:"ol-size",parent:l});var f=this._input.size=se.create("SELECT",{on:{change:(function(){this.setSize(f.value||P)}).bind(this)},parent:c});for(u in this.paperSize)se.create("OPTION",{html:u+(this.paperSize[u]?" - "+this.paperSize[u][0]+"x"+this.paperSize[u][1]+" mm":this.i18n("custom")),value:u,parent:f});c=se.create("LI",{html:se.create("LABEL",{html:this.i18n("margin")}),className:"ol-margin",parent:l});var d=this._input.margin=se.create("SELECT",{on:{change:(function(){this.setMargin(d.value)}).bind(this)},parent:c});for(u in this.marginSize)se.create("OPTION",{html:this.i18n(u)+" - "+this.marginSize[u]+" mm",value:this.marginSize[u],parent:d});c=se.create("LI",{html:se.create("LABEL",{html:this.i18n("scale")}),className:"ol-scale",parent:l});var g=this._input.scale=se.create("SELECT",{on:{change:(function(){this.setScale(parseInt(g.value))}).bind(this)},parent:c});Object.keys(this.scales).forEach((function(T){se.create("OPTION",{html:this.scales[T],value:T,parent:g})}).bind(this)),c=se.create("LI",{className:"ol-legend",parent:l});var m=se.createSwitch({html:this.i18n("legend"),checked:!1,on:{change:(function(){L.legend.control.setCanvas(m.checked)}).bind(this)},parent:c});c=se.create("LI",{className:"ol-print-north",parent:l});var _=this._input.north=se.createSwitch({html:this.i18n("north"),checked:"checked",on:{change:(function(){_.checked?this._compass.element.classList.add("ol-print-compass"):this._compass.element.classList.remove("ol-print-compass"),this.getMap().render()}).bind(this)},parent:c});c=se.create("LI",{className:"ol-print-title",parent:l});var v=se.createSwitch({html:this.i18n("mapTitle"),checked:!1,on:{change:(function(T){L.title.control.setVisible(T.target.checked)}).bind(this)},parent:c}),x=se.create("INPUT",{type:"text",placeholder:this.i18n("mapTitle"),on:{keydown:function(T){T.keyCode===13&&T.preventDefault()},keyup:function(){L.title.control.setTitle(x.value)},change:(function(){L.title.control.setTitle(x.value)}).bind(this)},parent:c}),S=se.create("DIV",{className:"ol-user-param",parent:o});c=se.create("LI",{className:"ol-saveas",parent:l}),se.create("DIV",{html:this.i18n("copied"),className:"ol-clipboard-copy",parent:c});var b=se.create("SELECT",{on:{change:(function(){var T=b.value;if(b.value="",!(this.formats[T].clipboard&&this._copyMap(T))){var C=typeof this.getSize()=="string"?this.getSize():null,D=Object.assign({format:C,size:C?this.paperSize[C]:null,orient:this.getOrientation(),margin:this.getMargin()},this.formats[T]);n.print(D)}}).bind(this)},parent:c});se.create("OPTION",{html:this.i18n("saveas"),style:{display:"none"},value:"",parent:b}),this.formats.forEach((function(T,C){if(T.pdf){if(e.pdf===!1)return}else if(T.clipboard){if(e.copy===!1)return}else if(e.save===!1)return;se.create("OPTION",{html:this.i18n(T.title),value:C,parent:b})}).bind(this)),b.querySelectorAll("option").length===1&&(b.style.display="none"),c=se.create("LI",{className:"ol-savelegend",parent:l});var A=se.create("DIV",{html:this.i18n("copied"),className:"ol-clipboard-copy",parent:c}),F=se.create("SELECT",{on:{change:(function(){var T=L.legend.control.getLegend().getCanvas(),C=document.createElement("canvas");C.width=T.width,C.height=T.height;var D=C.getContext("2d");if(D.fillStyle="#fff",D.fillRect(0,0,C.width,C.height),D.drawImage(T,0,0),this.formats[F.value].clipboard)C.toBlob(function(ae){try{navigator.clipboard.write([new window.ClipboardItem(Object.defineProperty({},ae.type,{value:ae,enumerable:!0}))]),A.classList.add("visible"),setTimeout(function(){A.classList.remove("visible")},1e3)}catch{}},"image/png");else{var W;try{W=C.toDataURL(this.formats[F.value].imageType,this.formats[F.value].quality);var $=typeof this.getSize()=="string"?this.getSize():"A4",B=C.width/96*25.4,V=C.height/96*25.4,te=this.paperSize[$];this.getOrientation()==="landscape"&&(te=[te[1],te[0]]);var ne=[(te[0]-B)/2,(te[1]-V)/2];this.dispatchEvent({type:"print",print:{legend:!0,format:$,orientation:this.getOrientation(),unit:"mm",size:this.paperSize[$],position:ne,imageWidth:B,imageHeight:V},image:W,imageType:this.formats[F.value].imageType,pdf:this.formats[F.value].pdf,quality:this.formats[F.value].quality,canvas:C})}catch{}}F.value=""}).bind(this)},parent:c});se.create("OPTION",{html:this.i18n("saveLegend"),style:{display:"none"},value:"",parent:F}),this.formats.forEach((function(T,C){se.create("OPTION",{html:this.i18n(T.title),value:C,parent:F})}).bind(this));var N=se.create("DIV",{className:"ol-ext-buttons",parent:o});se.create("BUTTON",{html:this.i18n("printBt"),type:"submit",click:function(T){T.preventDefault(),window.print()},parent:N}),se.create("BUTTON",{html:this.i18n("cancel"),type:"button",click:function(){r.hide()},parent:N}),se.create("DIV",{html:this.i18n("errorMsg"),className:"ol-error",parent:o});var R,P,O,L={};r.on("show",(function(){this.dispatchEvent({type:"show",userElement:S,dialog:this._printDialog,page:this.getPage()});var T=this.getMap();T&&(document.body.classList.add("ol-print-document"),R=T.getTargetElement(),P=T.getSize(),typeof this.getSize()=="string"?this.setSize(this.getSize()):this.setSize(P),T.setTarget(a),O&&Er(O),O=T.on("moveend",(function(){this.setScale(S_(T))}).bind(this)),this.setScale(S_(T)),L={},this.getMap().getControls().forEach((function(C){C instanceof tk&&(L.legend={control:C}),C instanceof ik&&(L.title={control:C}),C instanceof SE&&(L.compass?C.element.classList.remove("ol-print-compass"):(this._input.north.checked?C.element.classList.add("ol-print-compass"):C.element.classList.remove("ol-print-compass"),this._compass=C,L.compass={control:C}))}).bind(this)),L.title?(v.checked=L.title.isVisible=L.title.control.getVisible(),x.value=L.title.control.getTitle(),v.parentNode.parentNode.classList.remove("hidden")):v.parentNode.parentNode.classList.add("hidden"),L.legend?(L.legend.ison=L.legend.control.onCanvas(),L.legend.collapsed=L.legend.control.isCollapsed(),L.legend.control.collapse(!1),F.parentNode.classList.remove("hidden"),m.parentNode.parentNode.classList.remove("hidden"),m.checked=!L.legend.collapsed,L.legend.control.setCanvas(!L.legend.collapsed)):(F.parentNode.classList.add("hidden"),m.parentNode.parentNode.classList.add("hidden")))}).bind(this)),r.on("hide",(function(){document.body.classList.remove("ol-print-document"),R&&(this.getMap().setTarget(R),R=null,O&&Er(O),L.title&&L.title.control.setVisible(L.title.isVisible),L.legend&&(L.legend.control.setCanvas(L.legend.ison),L.legend.control.collapse(L.legend.collapsed)),this.dispatchEvent({type:"hide"}))}).bind(this)),window.addEventListener("resize",(function(){this.setSize()}).bind(this)),e.saveAs&&this.on("print",function(T){T.pdf||T.canvas.toBlob(function(C){var D=(T.print.legend?"legend.":"map.")+T.imageType.replace("image/","");e.saveAs(C,D)},T.imageType,T.quality)}),e.jsPDF&&this.on("print",function(T){if(T.pdf){var C=new e.jsPDF({orientation:T.print.orientation,unit:T.print.unit,format:T.print.size});C.addImage(T.image,"JPEG",T.print.position[0],T.print.position[0],T.print.imageWidth,T.print.imageHeight),C.save(T.print.legend?"legend.pdf":"map.pdf")}})}static addLang(e,t){zu.prototype._labels[e]=t}isOpen(){return this._printDialog.isOpen()}i18n(e){var t=this._labels.en[e]||e;return this._labels[this._lang]&&this._labels[this._lang][e]&&(t=this._labels[this._lang][e]),t}getOrientation(){return this._orientation||"portrait"}setOrientation(e){this._orientation=e==="landscape"?"landscape":"portrait",this._printDialog.element.dataset.orientation=this._orientation,this._input.orientation[this._orientation].checked=!0,this.setSize()}getMargin(){return this._margin||0}setMargin(e){this._margin=e,this._input.margin.value=e,this.setSize()}getSize(){return this._size}setSize(e){if(this._printDialog.getContentElement().dataset.status="",e?this._size=e:e=this._size,!!e){if(typeof e=="string"){for(var t in this.paperSize)t&&new RegExp(t,"i").test(e)&&(e=t);this.paperSize[e]||(e=this._size="A4"),this._input.size.value=e,e=[Math.trunc(this.paperSize[e][0]*96/25.4),Math.trunc(this.paperSize[e][1]*96/25.4)],this.getOrientation()==="landscape"&&(e=[e[1],e[0]]),this.getPage().classList.remove("margin")}else this._input.size.value="",this.getPage().classList.add("margin");var n=this.getPage(),r=n.parentNode.getBoundingClientRect(),s=(r.width-40)/e[0],o=(r.height-40)/e[1],a=Math.min(s,o,1);n.style.width=e[0]+"px",n.style.height=e[1]+"px",n.style["-webkit-transform"]=n.style.transform="translate(-50%,-50%) scale("+a+")";var l=Math.round(5/a);n.style["-webkit-box-shadow"]=n.style["box-shadow"]=l+"px "+l+"px "+l+"px rgba(0,0,0,.6)",n.style.padding=this.getMargin()*96/25.4+"px",this.getMap()&&this.getMap().updateSize(),this.dispatchEvent({type:"dialog:refresh"})}}_printing(e){this._printDialog.getContentElement().dataset.status=e.type,e.clipboard||this.dispatchEvent(e)}_copyMap(e){var t=this._printDialog.element.querySelector(".ol-clipboard-copy");return this._printCtrl.copyMap(this.formats[e],function(n){n&&(t.classList.add("visible"),setTimeout(function(){t.classList.remove("visible")},1e3))}),!0}getContentElement(){return this._printDialog.getContentElement()}getUserElement(){return this._printDialog.getContentElement().querySelector(".ol-user-param")}getPage(){return this._pages[0]}setMap(e){this.getMap()&&(this.getMap().removeControl(this._compass),this.getMap().removeControl(this._printCtrl),this.getMap().removeControl(this._printDialog)),super.setMap(e),this.getMap()&&(this.getMap().addControl(this._compass),this.getMap().addControl(this._printCtrl),this.getMap().addControl(this._printDialog))}setScale(e){nk(this.getMap(),e),this._input.scale.value=" "+Math.round(e/100)*100}getScale(){return S_(this.getMap())}print(e){e=e||{},e.size&&this.setSize(e.size),e.scale&&this.setScale(e.scale),e.orientation&&this.setOrientation(e.orientation),e.margin&&this.setMargin(e.margin),this._printDialog.show()}getPrintControl(){return this._printCtrl}};zu.prototype._labels={en:{title:"Print",orientation:"Orientation",portrait:"Portrait",landscape:"Landscape",size:"Page size",custom:"screen size",margin:"Margin",scale:"Scale",legend:"Legend",north:"North arrow",mapTitle:"Map title",saveas:"Save as...",saveLegend:"Save legend...",copied:"✔ Copied to clipboard",errorMsg:"Can't save map canvas...",printBt:"Print...",clipboardFormat:"copy to clipboard...",jpegFormat:"save as jpeg",pngFormat:"save as png",pdfFormat:"save as pdf",none:"none",small:"small",large:"large",cancel:"cancel"},fr:{title:"Imprimer",orientation:"Orientation",portrait:"Portrait",landscape:"Paysage",size:"Taille du papier",custom:"taille écran",margin:"Marges",scale:"Echelle",legend:"Légende",north:"Flèche du nord",mapTitle:"Titre de la carte",saveas:"Enregistrer sous...",saveLegend:"Enregistrer la légende...",copied:"✔ Carte copiée",errorMsg:"Impossible d'enregistrer la carte",printBt:"Imprimer",clipboardFormat:"copier dans le presse-papier...",jpegFormat:"enregistrer un jpeg",pngFormat:"enregistrer un png",pdfFormat:"enregistrer un pdf",none:"aucune",small:"petites",large:"larges",cancel:"annuler"},de:{title:"Drucken",orientation:"Ausrichtung",portrait:"Hochformat",landscape:"Querformat",size:"Papierformat",custom:"Bildschirmgröße",margin:"Rand",scale:"Maßstab",legend:"Legende",north:"Nordpfeil",mapTitle:"Kartentitel",saveas:"Speichern als...",saveLegend:"Legende speichern...",copied:"✔ In die Zwischenablage kopiert",errorMsg:"Kann Karte nicht speichern...",printBt:"Drucken...",clipboardFormat:"in die Zwischenablage kopieren...",jpegFormat:"speichern als jpeg",pngFormat:"speichern als png",pdfFormat:"speichern als pdf",none:"kein",small:"klein",large:"groß",cancel:"abbrechen"},zh:{title:"打印",orientation:"方向",portrait:"纵向",landscape:"横向",size:"页面大小",custom:"屏幕大小",margin:"外边距",scale:"尺度",legend:"图例",north:"指北针",mapTitle:"地图名字",saveas:"保存为...",saveLegend:"保存图例为...",copied:"✔ 已复制到剪贴板",errorMsg:"无法保存地图...",printBt:"打印...",cancel:"取消"},it:{title:"Stampa",orientation:"Orientamento",portrait:"Verticale",landscape:"Orizzontale",size:"Formato pagina",custom:"Dimensione schermo",margin:"Margini",scale:"Scala",legend:"Legenda",north:"Freccia nord",mapTitle:"Titolo della mappa",saveas:"Salva con nome...",saveLegend:"Salva legenda...",copied:"✔ Copiato negli appunti",errorMsg:"Impossibile salvare la mappa",printBt:"Stampa",clipboardFormat:"Copia negli appunti...",jpegFormat:"salva come jpeg",pngFormat:"salva come png",pdfFormat:"salva come pdf",none:"nessuno",small:"piccolo",large:"grande",cancel:"annulla"},"pt-br":{title:"Imprimir",orientation:"Orientação",portrait:"Retrato",landscape:"Paisagem",size:"Tamanho da página",custom:"Tamanho da tela",margin:"Margem",scale:"Escala",legend:"Legenda",north:"Seta do norte",mapTitle:"Título do mapa",saveas:"Salvar como...",saveLegend:"Salvar legenda...",copied:"✔ Copiado para a área de transferência",errorMsg:"Não foi possível salvar o mapa...",printBt:"Imprimir...",clipboardFormat:"Copiar para a área de transferência...",jpegFormat:"Salvar como JPEG",pngFormat:"Salvar como PNG",pdfFormat:"Salvar como PDF",none:"Nenhum",small:"Pequeno",large:"Grande",cancel:"Cancelar"},rm:{title:"Stampar",orientation:"Orientaziun",portrait:"Vertical",landscape:"Horizontal",size:"Format",custom:"Grondezza dal monitur",margin:"Margin",scale:"Stgala",legend:"Legenda",north:"Fritga nord",mapTitle:"Titel",saveas:"Memorisar sco...",saveLegend:"Memorisar legenda...",copied:"✔ Copià en las notizias",errorMsg:"Betg memorisar la carta",printBt:"Stampar",clipboardFormat:"Copia en las notizias...",jpegFormat:"Memorisar sco jpeg",pngFormat:"Memorisar sco png",pdfFormat:"Memorisar sco pdf",none:"betg",small:"pitschen",large:"grond",cancel:"Stizzar"}};zu.prototype.paperSize={"":null,A0:[841,1189],A1:[594,841],A2:[420,594],A3:[297,420],A4:[210,297],"US Letter":[215.9,279.4],A5:[148,210],B4:[257,364],B5:[182,257]};zu.prototype.marginSize={none:0,small:5,large:10};zu.prototype.formats=[{title:"clipboardFormat",imageType:"image/png",clipboard:!0},{title:"jpegFormat",imageType:"image/jpeg",quality:.8},{title:"pngFormat",imageType:"image/png",quality:.8},{title:"pdfFormat",imageType:"image/jpeg",pdf:!0}];zu.prototype.scales={" 5000":"1/5.000"," 10000":"1/10.000"," 25000":"1/25.000"," 50000":"1/50.000"," 100000":"1/100.000"," 250000":"1/250.000"," 1000000":"1/1.000.000"};var c5=function(i,e){var t=i[0]-e[0],n=i[1]-e[1];return Math.sqrt(t*t+n*n)},YC;(function(){function i(t,n){var r;for(let s=t.length-1;s>0;s--)(t[s][0]>n&&t[s-1][0]<n||t[s][0]<n&&t[s-1][0]>n)&&(r=[n,(n-t[s][0])/(t[s-1][0]-t[s][0])*(t[s-1][1]-t[s][1])+t[s][1]],t.splice(s,0,r))}function e(t,n){var r;for(let s=t.length-1;s>0;s--)(t[s][1]>n&&t[s-1][1]<n||t[s][1]<n&&t[s-1][1]>n)&&(r=[(n-t[s][1])/(t[s-1][1]-t[s][1])*(t[s-1][0]-t[s][0])+t[s][0],n],t.splice(s,0,r))}YC=function(t,n){var r=n.getType()==="Polygon";if(!r&&n.getType()!=="MultiPolygon")return null;var s=n.getCoordinates();return r&&(s=[s]),s.forEach(function(o){o.forEach(function(a){i(a,t[0]),i(a,t[2]),e(a,t[1]),e(a,t[3])})}),s.forEach(function(o){o.forEach(function(a){a.forEach(function(l){l[0]<t[0]?l[0]=t[0]:l[0]>t[2]&&(l[0]=t[2]),l[1]<t[1]?l[1]=t[1]:l[1]>t[3]&&(l[1]=t[3])})})}),r?new lr(s[0]):new $o(s)}})();var Xm=function(i,e,t,n){var r=[];n!==!1&&r.push(i);var s=c5(i,e);if(s){var o=Math.round(s/t);if(o>1)for(var a=(e[0]-i[0])/o,l=(e[1]-i[1])/o,c=1;c<o;c++)r.push([i[0]+a*c,i[1]+l*c])}return r.push(e),r};ar.prototype.sampleAt=function(i){for(var e=this.getCoordinates(),t=[],n=1;n<e.length;n++)t=t.concat(Xm(e[n-1],e[n],i,n===1));return new ar(t)};Dl.prototype.sampleAt=function(i){var e=this.getCoordinates(),t=[];return e.forEach(function(n){for(var r=[],s=1;s<n.length;s++)r=r.concat(Xm(n[s-1],n[s],i,s===1));t.push(r)}),new Dl(t)};lr.prototype.sampleAt=function(i){var e=this.getCoordinates(),t=[];return e.forEach(function(n){for(var r=[],s=1;s<n.length;s++)r=r.concat(Xm(n[s-1],n[s],i,s===1));t.push(r)}),new lr(t)};$o.prototype.sampleAt=function(i){var e=this.getCoordinates(),t=[];return e.forEach(function(n){var r=[];t.push(r),n.forEach(function(s){for(var o=[],a=1;a<s.length;a++)o=o.concat(Xm(s[a-1],s[a],i,a===1));r.push(o)})}),new $o(t)};Bu.prototype.intersection=function(i,e){if(i.sampleAt){var t=Zn(this.getCenter().concat(this.getCenter()),this.getRadius());i=YC(t,i),i=i.simplify(e);var n=this.getCenter(),r=this.getRadius(),s=i.sampleAt(e).getCoordinates();switch(i.getType()){case"Polygon":s=[s];case"MultiPolygon":{var o=!1,a=[];return s.forEach(function(l){var c=[];a.push(c),l.forEach(function(h){var u=[];c.push(u),h.forEach(function(f){var d=c5(n,f);d>r?(o=!0,u.push([n[0]+r/d*(f[0]-n[0]),n[1]+r/d*(f[1]-n[1])])):u.push(f)})})}),o?i.getType()==="Polygon"?new lr(a[0]):new $o(a):i}}}else console.warn("[ol/geom/Circle~intersection] Unsupported geometry type: "+i.getType());return i};var zt=class extends Os{constructor(e){e=e||{};var t=document.createElement("div");super({element:t,target:e.target});var n=this;if(this.info=e.info||zt.prototype.info,e.target)t.classList.add(e.className||"ol-profile");else{t.className=((e.className||"ol-profile")+" ol-unselectable ol-control ol-collapsed").trim(),this.button=document.createElement("button"),this.button.title=e.title||"Profile",this.button.setAttribute("type","button");var r=function(b){n.toggle(),b.preventDefault()};this.button.addEventListener("click",r),this.button.addEventListener("touchstart",r),t.appendChild(this.button),se.create("I",{parent:this.button})}e.style instanceof Li?this._style=e.style:this._style=new Li({text:new Uo,stroke:new xn({width:1.5,color:"#369"})}),this._style.getText()||this._style.setText(new Uo),e.selectStyle instanceof Li?this._selectStyle=e.selectStyle:this._selectStyle=new Li({fill:new cr({color:"#369"})});var s=document.createElement("div");s.classList.add("ol-inner"),t.appendChild(s);var o=document.createElement("div");o.style.position="relative",s.appendChild(o);var a=this.ratio=2;this.canvas_=document.createElement("canvas"),this.canvas_.width=(e.width||300)*a,this.canvas_.height=(e.height||150)*a;var l={msTransform:"scale(0.5,0.5)",msTransformOrigin:"0 0",webkitTransform:"scale(0.5,0.5)",webkitTransformOrigin:"0 0",mozTransform:"scale(0.5,0.5)",mozTransformOrigin:"0 0",transform:"scale(0.5,0.5)",transformOrigin:"0 0"};Object.keys(l).forEach(function(b){b in n.canvas_.style&&(n.canvas_.style[b]=l[b])}),this.div_to_canvas_=document.createElement("div"),o.appendChild(this.div_to_canvas_),this.div_to_canvas_.style.width=this.canvas_.width/a+"px",this.div_to_canvas_.style.height=this.canvas_.height/a+"px",this.div_to_canvas_.appendChild(this.canvas_),this.setProperties({units:e.units||"metric",numberFormat:e.numberFormat,selectable:e.selectable,skipFirst:parseInt(e.skipFirst)||0}),this._isMetric=this.get("units")==="metric",this.margin_={top:10*a,left:45*a,bottom:30*a,right:10*a},this.info.ytitle||(this.margin_.left-=20*a),this.info.xtitle||(this.margin_.bottom-=20*a),this.bar_=document.createElement("div"),this.bar_.classList.add("ol-profilebar"),this.bar_.style.top=this.margin_.top/a+"px",this.bar_.style.height=(this.canvas_.height-this.margin_.top-this.margin_.bottom)/a+"px",o.appendChild(this.bar_),this.cursor_=document.createElement("div"),this.cursor_.classList.add("ol-profilecursor"),o.appendChild(this.cursor_),this.popup_=document.createElement("div"),this.popup_.classList.add("ol-profilepopup"),this.cursor_.appendChild(this.popup_);var c=document.createElement("table");c.cellPadding="0",c.cellSpacing="0",c.style.clientWidth=this.canvas_.width/a+"px",o.appendChild(c);var h=se.create("tr",{className:"track-info",parent:c});se.create("td",{html:(this.info.zmin||"Zmin")+': <span class="zmin zinfo"></span>',parent:h}),se.create("td",{html:(this.info.zmax||"Zmax")+': <span class="zmax"></span>',parent:h});var u=se.create("td",{parent:h});u.innerHTML=(this.info.distance||"Distance")+': <span class="dist"></span>';var f=se.create("td",{parent:h});f.innerHTML=(this.info.time||"Time")+': <span class="time"></span>';var d=se.create("tr",{className:"track-info track-options",parent:c});se.create("td",{html:(this.info.elevation||"Elevation gain")+': <br/><span class="elevationGain"></span> / <span class="elevationLoss"></span>',colspan:2,parent:d}),se.create("td",{html:(this.info.maxslope||"Max. slope")+': <span class="maxSlope"></span>',parent:d}),se.create("td",{html:(this.info.avgslope||"Average slope")+': <span class="avgSlope"></span>',parent:d});var g=document.createElement("tr");g.classList.add("point-info"),c.appendChild(g);var m=document.createElement("td");m.innerHTML=(this.info.altitude||"Altitude")+': <span class="z"></span>',g.appendChild(m);var _=document.createElement("td");_.innerHTML=(this.info.distance||"Distance")+': <span class="dist"></span>',g.appendChild(_);var v=document.createElement("td");if(v.innerHTML=(this.info.time||"Time")+': <span class="time"></span>',g.appendChild(v),this.tab_=[],e.feature&&this.setGeometry(e.feature),e.zoomable){this.set("selectable",!0);var x,S;this.on("change:geometry",function(){S=null}),this.on("dragstart",function(b){x=b.index}),this.on("dragend",(function(b){if(Math.abs(x-b.index)>10){if(!S)var A=se.create("BUTTON",{parent:t,className:"ol-zoom-out",click:(function(R){R.stopPropagation(),R.preventDefault(),S&&(this.dispatchEvent({type:"zoom"}),this.setGeometry(S,this._geometry[1])),t.removeChild(A)}).bind(this)});var F=S||this._geometry[0],N=new ar(this.getSelection(x,b.index));this.setGeometry(N,this._geometry[1]),S=F,this.dispatchEvent({type:"zoom",geometry:N,start:x,end:b.index})}}).bind(this))}e.target&&this._addListeners()}_addListeners(){this.onMoveBinded||(this.onMoveBinded=this.onMove.bind(this),this.div_to_canvas_.addEventListener("pointerdown",this.onMoveBinded),this.div_to_canvas_.addEventListener("mousemove",this.onMoveBinded),this.div_to_canvas_.addEventListener("touchmove",this.onMoveBinded),document.addEventListener("pointerup",this.onMoveBinded))}_removeListeners(){this.onMoveBinded&&(this.div_to_canvas_.removeEventListener("pointerdown",this.onMoveBinded),this.div_to_canvas_.removeEventListener("mousemove",this.onMoveBinded),this.div_to_canvas_.removeEventListener("touchmove",this.onMoveBinded),document.removeEventListener("pointerup",this.onMoveBinded),this.onMoveBinded=null)}popup(e){this.popup_.innerHTML=e}_drawAt(e,t){if(e){this.cursor_.style.left=t+"px",this.cursor_.style.top=(this.canvas_.height-this.margin_.bottom+e[1]*this.scale_[1]+this.dy_)/this.ratio+"px",this.cursor_.style.display="block",this.bar_.parentElement.classList.add("over"),this.bar_.style.left=t+"px",this.bar_.style.display="block";var n=this._isMetric?zt.prototype.Unit.Meter:zt.prototype.Unit.Foot,r=this._unitsConversion(e[1],n);this.element.querySelector(".point-info .z").textContent=typeof r=="number"?this._numberFormat(r,this.get("zDigitsHover"))+n:"-";var s=this._isMetric?zt.prototype.Unit.Meter:zt.prototype.Unit.Foot,o=this._unitsConversion(e[0],s);this._isMetric?s=o>zt.prototype.KILOMETER_VALUE?zt.prototype.Unit.Kilometer:zt.prototype.Unit.Meter:s=o>zt.prototype.MILE_VALUE?zt.prototype.Unit.Mile:zt.prototype.Unit.Foot,o=this._unitsConversion(e[0],s),this.element.querySelector(".point-info .dist").textContent=typeof o=="number"?this._numberFormat(o,this.get("xDigitsHover"))+s:"-",this.element.querySelector(".point-info .time").textContent=e[2],t>this.canvas_.width/this.ratio/2?this.popup_.classList.add("ol-left"):this.popup_.classList.remove("ol-left")}else this.cursor_.style.display="none",this.bar_.style.display="none",this.cursor_.style.display="none",this.bar_.parentElement.classList.remove("over")}showAt(e){var t,n,r,s=1/0;if(typeof e>"u")this.bar_.parentElement.classList.contains("over")&&this._drawAt();else if(e.length)for(t=1;n=this.tab_[t];t++){var o=c5(n[3],e);o<s&&(r=n,s=o)}else for(t=0;(n=this.tab_[t])&&(r=n,!(n[0]>=e));t++);if(r){var a=(r[0]*this.scale_[0]+this.margin_.left)/this.ratio;return this._drawAt(r,a),r[3]}return null}showAtTime(e,t){var n,r,s;if(e instanceof Date?e=e.getTime()/1e3:t&&(e+=this.tab_[0][3][3]),typeof e>"u")this.bar_.parentElement.classList.contains("over")&&this._drawAt();else for(n=0;(r=this.tab_[n])&&(s=r,!(r[3][3]>=e));n++);if(s){var o=(s[0]*this.scale_[0]+this.margin_.left)/this.ratio;return this._drawAt(s,o),s[3]}return null}pointAtTime(e){var t,n;for(t=1;n=this.tab_[t];t++){var r=n[3][3];if(r>=e){var s=this.tab_[t-1][3];return(s[3]+r)/2<e?s:n}}return this.tab_[this.tab_.length-1][3]}onMove(e){if(this.tab_.length){var t=this.canvas_.getBoundingClientRect(),n={top:t.top+window.pageYOffset-document.documentElement.clientTop,left:t.left+window.pageXOffset-document.documentElement.clientLeft},r=e.pageX||e.touches&&e.touches.length&&e.touches[0].pageX||e.changedTouches&&e.changedTouches.length&&e.changedTouches[0].pageX,s=e.pageY||e.touches&&e.touches.length&&e.touches[0].pageY||e.changedTouches&&e.changedTouches.length&&e.changedTouches[0].pageY,o=r-n.left,a=s-n.top,l=this.ratio;if(o>this.margin_.left/l-20&&o<(this.canvas_.width-this.margin_.right)/l+8&&a>this.margin_.top/l&&a<(this.canvas_.height-this.margin_.bottom)/l){var c=(o*l-this.margin_.left)/this.scale_[0],h=this.tab_[0],u,f;for(u=1;f=this.tab_[u];u++)if(f[0]>=c){c<(f[0]+h[0])/2&&(u=0,f=h);break}if(f||(f=this.tab_[this.tab_.length-1]),o=Math.max(this.margin_.left/l,Math.min(o,(this.canvas_.width-this.margin_.right)/l)),typeof f[1]>"u")return;switch(this._drawAt(f,o),this.dispatchEvent({type:"over",click:e.type==="click",index:u,coord:f[3],time:f[2],distance:f[0]}),e.type){case"pointerdown":{this._dragging={event:{type:"dragstart",index:u,coord:f[3],time:f[2],distance:f[0]},pageX:r,pageY:s};break}case"pointerup":{this._dragging&&this._dragging.pageX?Math.abs(this._dragging.pageX-r)<3&&Math.abs(this._dragging.pageY-s)<3&&(this.dispatchEvent({type:"click",index:u,coord:f[3],time:f[2],distance:f[0]}),this.refresh()):this.dispatchEvent({type:"dragend",index:u,coord:f[3],time:f[2],distance:f[0]}),this._dragging=!1;break}default:{if(this._dragging)if(this._dragging.pageX)(Math.abs(this._dragging.pageX-r)>3||Math.abs(this._dragging.pageY-s)>3)&&(this._dragging.pageX=this._dragging.pageY=!1,this.dispatchEvent(this._dragging.event));else{this.dispatchEvent({type:"dragging",index:u,coord:f[3],time:f[2],distance:f[0]});var d=Math.min(this._dragging.event.index,u),g=Math.max(this._dragging.event.index,u);this.refresh(),this.get("selectable")&&this._drawGraph(this.tab_.slice(d,g),this._selectStyle)}break}}}else this.bar_.parentElement.classList.contains("over")&&(this._drawAt(),this.dispatchEvent({type:"out"})),e.type==="pointerup"&&this._dragging&&(this.dispatchEvent({type:"dragcancel"}),this._dragging=!1)}}show(){this.element.classList.remove("ol-collapsed"),this._addListeners(),this.dispatchEvent({type:"show",show:!0})}hide(){this.element.classList.add("ol-collapsed"),this._removeListeners(),this.dispatchEvent({type:"show",show:!1})}toggle(){this.isShown()?this.hide():this.show()}isShown(){return!this.element.classList.contains("ol-collapsed")}getSelection(e,t){for(var n=[],r=Math.max(Math.min(e,t),0),s=Math.min(Math.max(e,t),this.tab_.length-1),o=r;o<=s;o++)n.push(this.tab_[o][3]);return n}_drawGraph(e,t){if(!e.length)return;function n(g,m){if(t.getStroke()){var _=t.getStroke().getColor();r.strokeStyle=_?No(_):"#000",r.lineWidth=t.getStroke().getWidth()*l,r.setLineDash([]),r.stroke()}if(t.getFill()){var v=t.getFill().getColor();r.fillStyle=v?No(v):"#000",r.Style=v?No(v):"#000",r.lineTo(m*s,0),r.lineTo(g*s,0),r.fill()}}var r=this.canvas_.getContext("2d"),s=this.scale_[0],o=this.scale_[1],a=this.dy_,l=this.ratio,c,h,u,f,d=!1;for(r.beginPath(),c=0;h=e[c];c++)c==0?r.moveTo(h[0]*s,h[1]*o+a):h[1]?(d=!0,u||(u=h[0]),f=h[0],r.lineTo(h[0]*s,h[1]*o+a)):(d&&(n(u,f),d=!1,u=null,f=null),e[c+1]&&(r.beginPath(),r.moveTo(e[c+1][0]*s,e[c+1][1]*o+a)));d&&n(u,f)}setGeometry(e,t){if(t||(t={}),e instanceof wi&&(e=e.getGeometry()),this._geometry=[e,t],!/Z/.test(e.getLayout()))return;/M/.test(e.getLayout())?this.element.querySelector(".time").parentElement.style.display="table-cell":this.element.querySelector(".time").parentElement.style.display="none";var n=e.getCoordinates();switch(e.getType()){case"LineString":break;case"MultiLineString":n=n[0];break;default:return}var r=t.projection||this.getMap().getView().getProjection();function s(F,N){return Td(ro(F,r,"EPSG:4326"),ro(N,r,"EPSG:4326"))}function o(F,N){if(!F||!N)return"-";var R=(N-F)/60,P=Math.trunc(R/60),O=Math.trunc(R-P*60);return P+"h"+(O<10?"0":"")+O+"mn"}var a=1/0,l=-1/0,c=0,h=0,u=0,f=0,d,g,m,_,v,x=this.tab_=[];for(d=0,g;g=n[d];d++){if(_=g[2],_<a&&(a=_),_>l&&(l=_),d==0)m=0;else{var S=s(n[d-1],g),b=_-n[d-1][2],A=S?Math.abs(b/S):0;(d<this.get("skipFirst")||d>n.length-this.get("skipFirst"))&&(A=0),u=Math.max(u,A),f+=A,m+=S,c+=Math.max(0,_-n[d-1][2]),h+=Math.max(0,n[d-1][2]-_)}v=o(n[0][3],g[3]),x.push([m,_,v,g])}this._z=[a,l],this._elevation=[c,h],this._maxSlope=100*u,this._avgSlope=100*f/x.length,this.setProperties({graduation:t.graduation||100,zmin:t.zmin,zmax:t.zmax,amplitude:t.amplitude,unit:t.unit,zunit:t.zunit,zDigits:typeof t.zDigits=="number"?t.zDigits:0,xDigits:typeof t.xDigits=="number"?t.xDigits:1,zDigitsHover:typeof t.zDigitsHover=="number"?t.zDigitsHover:2,xDigitsHover:typeof t.xDigitsHover=="number"?t.xDigitsHover:1,zMaxChars:t.zMaxChars,xSteps:t.xSteps,zSteps:t.zSteps}),this.dispatchEvent({type:"change:geometry",geometry:e}),this.refresh()}refresh(){var e=this.canvas_,t=e.getContext("2d"),n=e.width,r=e.height;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r);var s=this._z[0],o=this._z[1],a=this.tab_,l=a[a.length-1][0],c=a[a.length-1][2],h;if(!l){console.error("[ol/control/Profile] no data...",a);return}t.setTransform(1,0,0,1,this.margin_.left,r-this.margin_.bottom);var u=this.ratio;n-=this.margin_.right+this.margin_.left,r-=this.margin_.top+this.margin_.bottom;var f=this._style.getText().getFill().getColor();t.strokeStyle=f?No(f):"#000",t.lineWidth=.5*u,t.beginPath(),t.moveTo(0,0),t.lineTo(0,-r),t.moveTo(0,0),t.lineTo(n,0),t.stroke();var C=this._isMetric?zt.prototype.Unit.Meter:zt.prototype.Unit.Foot,d=this._unitsConversion(s,C);this.element.querySelector(".track-info .zmin").textContent=this._numberFormat(d,this.get("zDigitsHover"))+C;var g=this._unitsConversion(o,C);this.element.querySelector(".track-info .zmax").textContent=this._numberFormat(g,this.get("zDigitsHover"))+C;var m=this._unitsConversion(this._elevation[0],C);this.element.querySelector(".track-options .elevationGain").textContent=this._numberFormat(m,this.get("zDigitsHover"))+C;var _=this._unitsConversion(this._elevation[1],C);this.element.querySelector(".track-options .elevationLoss").textContent=this._numberFormat(-_,this.get("zDigitsHover"))+C,this.element.querySelector(".track-options .maxSlope").textContent=this._numberFormat(this._maxSlope,0)+"%",this.element.querySelector(".track-options .avgSlope").textContent=this._numberFormat(this._avgSlope,0)+"%";var v;this._isMetric?v=l>1e3?zt.prototype.Unit.Kilometer:zt.prototype.Unit.Meter:v=l>zt.prototype.MILE_VALUE?zt.prototype.Unit.Mile:zt.prototype.Unit.Foot;var x=this._unitsConversion(l,v);this.element.querySelector(".track-info .dist").textContent=this._numberFormat(x,this.get("xDigitsHover"))+v,this.element.querySelector(".track-info .time").textContent=c;var S=this.get("zSteps"),b;if(S){o=Math.ceil(o),s=Math.floor(s*10)/10;var A=this.get("amplitude")||o-s;b=A/(S-1)}else for(b=this.get("graduation");;){o=Math.ceil(o/b)*b,s=Math.floor(s/b)*b;var F=(o-s)/b;if(r/F<15*u)b*=2;else break}typeof this.get("zmin")=="number"&&s>this.get("zmin")&&(s=this.get("zmin")),typeof this.get("zmax")=="number"&&o<this.get("zmax")&&(o=this.get("zmax"));var N=this.get("amplitude");N&&(o=Math.max(s+N,o));var R=n/l,P=-r/(o-s),O=this.dy_=-s*P;this.scale_=[R,P],this._drawGraph(a,this._style),t.textAlign="right",t.textBaseline="top";var L=this._style.getText().getFill().getColor();t.fillStyle=L?No(L):"#000",t.beginPath();var T=this.get("zDigits"),C=this.get("zunit")||this._isMetric?zt.prototype.Unit.Meter:zt.prototype.Unit.Foot,D=null;if(typeof this.get("zMaxChars")=="number"){var W,$=this._unitsConversion(s,C),B=this._unitsConversion(o,C);if(W=Math.max($.toFixed(1).length,B.toFixed(1).length),this.get("zMaxChars")<W){D=Math.floor(Math.log10(Math.max(Math.abs(s),Math.abs(o),Number.MIN_VALUE))),t.font="bold "+9*u+"px arial",t.fillText(D.toString(),-8*u,8*u);var V=t.measureText(D.toString()),te=V.width,ne=V.actualBoundingBoxAscent+V.actualBoundingBoxDescent;t.font="bold "+12*u+"px arial",t.fillText("10",-8*u-te,8*u+.5*ne)}}for(t.font=10*u+"px arial",t.textBaseline="middle",h=s;h<=o;h+=b){var ae=this._unitsConversion(h,C);if(D!==null){var I=ae/Math.pow(10,D),U=this.get("zMaxChars")-Math.floor(Math.log10(Math.max(Math.abs(I),1))+1)-1;I<0&&(U-=1),t.fillText(I.toFixed(Math.max(U,0)),-4*u,h*P+O)}else{if(typeof T=="number")ae=this._numberFormat(ae,T);else{var K=10;ae=this._unitsConversion(o,C)-this._unitsConversion(s,C)>K?this._numberFormat(ae,0):this._numberFormat(ae,2)}t.fillText(ae,-4*u,h*P+O)}t.moveTo(-2*u,h*P+O),h!=0?t.lineTo(l*R,h*P+O):t.lineTo(0,h*P+O)}t.textAlign="center",t.textBaseline="top",t.setLineDash([u,3*u]);var ie=this.get("unit")||(this._isMetric?zt.prototype.Unit.Kilometer:zt.prototype.Unit.Mile),re=this.get("xSteps"),ce=this.get("xDigits"),ve=ie===zt.prototype.Unit.Mile?zt.prototype.MILE_VALUE:1e3,pe;for(l<ve&&(ie=this._isMetric?zt.prototype.Unit.Meter:zt.prototype.Unit.Foot),typeof re=="number"?pe=l/(re-1):l>ve?(pe=Math.round(l/1e3)*100,pe>1e3&&(pe=Math.ceil(pe/1e3)*1e3)):l>100?pe=Math.round(l/100)*10:l>10?pe=Math.round(l/10):l>1?pe=Math.round(l)/10:pe=l,h=0;h<=l;h+=pe){var le=Number(this._unitsConversion(h,ie).toFixed(ce)),Ce=this._numberFormat(le,ce);t.fillText(Ce,h*R,4*u),t.moveTo(h*R,3*u),t.lineTo(h*R,0)}t.font=12*u+"px arial";var H=this.info.xtitle.search("(km)"),Z=H!==-1?this.info.xtitle.replace("(km)","("+ie+")"):this.info.xtitle+" ("+ie+")";t.fillText(Z,n/2,18*u),t.save(),t.rotate(-Math.PI/2);var he=this.info.xtitle.search("(m)"),j=he!==-1?this.info.ytitle.replace("(m)","("+C+")"):this.info.ytitle+" ("+C+")";t.fillText(j,r/2,-this.margin_.left),t.restore(),t.stroke()}getImage(e,t){return e==="canvas"?this.canvas_:this.canvas_.toDataURL(e,t)}_unitsConversion(e,t){switch(t=t||zt.prototype.Unit.Meter,t){case zt.prototype.Unit.Kilometer:return e/zt.prototype.KILOMETER_VALUE;case zt.prototype.Unit.Foot:return e/zt.prototype.FOOT_VALUE;case zt.prototype.Unit.Mile:return e/zt.prototype.MILE_VALUE;case zt.prototype.Unit.Meter:default:return e}}_numberFormat(e,t=2){var n=this.get("numberFormat");return n?Number(e).toLocaleString(n,{minimumFractionDigits:0,maximumFractionDigits:t}):Number(e).toFixed(t)}};zt.prototype.info={zmin:"Zmin",zmax:"Zmax",ytitle:"Altitude",xtitle:"Distance",time:"Time",altitude:"Altitude",elevation:"Elevation gain / loss",elevgain:"Elevation gain",elevloss:"Elevation loss",maxslope:"Max. slope",avgslope:"Avg. slope"};zt.prototype.Unit={Meter:"m",Kilometer:"km",Foot:"ft",Mile:"mi"};zt.prototype.FOOT_VALUE=.3048;zt.prototype.MILE_VALUE=1609.344;zt.prototype.KILOMETER_VALUE=1e3;var rk=class extends Os{constructor(e){e=e||{};var t=(e.className||"")+" ol-search"+(e.target?"":" ol-unselectable ol-control"),n=se.create("DIV",{className:t});super({element:n,target:e.target});var r=this;if(e.typing==null&&(e.typing=300),this._classname=e.className||"search",e.collapsed!==!1&&n.classList.add("ol-collapsed"),e.target||(this.button=document.createElement("button"),this.button.setAttribute("type","button"),this.button.setAttribute("title",e.title||e.label||"Search"),this.button.addEventListener("click",function(){if(n.classList.toggle("ol-collapsed"),!n.classList.contains("ol-collapsed")){n.querySelector("input.search").focus();for(var f=n.querySelectorAll("li"),d=0;d<f.length;d++)f[d].classList.remove("select");l.value||r.drawList_()}}),n.appendChild(this.button)),e.inputLabel){var s=document.createElement("LABEL");s.innerText=e.inputLabel,n.appendChild(s)}var o,a="",l=this._input=document.createElement("INPUT");l.setAttribute("type","search"),l.setAttribute("class","search"),l.setAttribute("autocomplete","off"),l.setAttribute("placeholder",e.placeholder||"Search..."),l.addEventListener("change",function(f){r.dispatchEvent({type:"change:input",input:f,value:l.value})});var c=function(f){var d=n.querySelector("ul.autocomplete li.select"),g=l.value;if(f.key=="ArrowDown"||f.key=="ArrowUp"||f.key=="Down"||f.key=="Up")if(d){var m=/Down/.test(f.key)?d.nextElementSibling:d.previousElementSibling;m&&!m.classList.contains("copy")&&(d.classList.remove("select"),m.classList.add("select"),l.value=m.innerText)}else d=n.querySelector("ul.autocomplete li"),d&&(d.classList.add("select"),l.value=d.innerText);else if(f.type=="input")g||setTimeout(function(){r.drawList_()},200),d&&(l.value=g="",d.classList.remove("select"));else if(d&&(f.type==="search"||f.key==="Enter"))n.classList.contains("ol-control")&&l.blur(),d.classList.remove("select"),a=g,r._handleSelect(r._list[d.getAttribute("data-search")]);else if(f.type==="search"||f.key==="Enter"||a!=g&&e.typing>=0)if(a=g,a){o&&clearTimeout(o);var _=r.get("minLength");o=setTimeout(function(){if(a.length>=_){var v=r.autocomplete(a,function(x){r.drawList_(x)});v&&r.drawList_(v)}else r.drawList_()},e.typing)}else r.drawList_();else d=n.querySelector("ul.autocomplete li"),d&&d.classList.remove("select")};if(l.addEventListener("keyup",c),l.addEventListener("search",c),l.addEventListener("cut",c),l.addEventListener("paste",c),l.addEventListener("input",c),e.noCollapse||(l.addEventListener("blur",(function(){setTimeout((function(){l!==document.activeElement&&(n.classList.add("ol-collapsed"),this.set("reverse",!1),n.classList.remove("ol-revers"))}).bind(this),200)}).bind(this)),l.addEventListener("focus",(function(){this.get("reverse")||(n.classList.remove("ol-collapsed"),n.classList.remove("ol-revers"))}).bind(this)),l.addEventListener("keydown",(function(){this.set("reverse",!1),n.classList.remove("ol-collapsed"),n.classList.remove("ol-revers")}).bind(this))),n.appendChild(l),e.reverse){var h=se.create("BUTTON",{type:"button",class:"ol-revers",title:e.reverseTitle||"click on the map",on:{focus:(function(){this.get("reverse")?this.set("reverse",!1):(this.set("reverse",!this.get("reverse")),l.focus(),n.classList.add("ol-revers"))}).bind(this)}});n.appendChild(h)}var u=document.createElement("ul");u.classList.add("autocomplete"),n.appendChild(u),typeof e.getTitle=="function"&&(this.getTitle=e.getTitle),typeof e.autocomplete=="function"&&(this.autocomplete=e.autocomplete),this.set("copy",e.copy),this.set("minLength",e.minLength||1),this.set("maxItems",e.maxItems||10),this.set("maxHistory",e.maxHistory||e.maxItems||10),e.onselect&&this.on("select",e.onselect),e.centerOnSelect&&this.on("select",(function(f){var d=this.getMap();d&&d.getView().setCenter(f.coordinate)}).bind(this)),e.zoomOnSelect&&this.on("select",(function(f){var d=this.getMap();d&&(d.getView().setCenter(f.coordinate),d.getView().getZoom()<e.zoomOnSelect&&d.getView().setZoom(e.zoomOnSelect))}).bind(this)),this.restoreHistory(),this.drawList_()}setMap(e){this._listener&&Er(this._listener),this._listener=null,super.setMap(e),e&&(this._listener=e.on("click",this._handleClick.bind(this)))}collapse(e){e===!1?this.element.classList.remove("ol-collapsed"):this.element.classList.add("ol-collapsed")}getInputField(){return this._input}getTitle(e){return e.name||"No title"}_getTitleTxt(e){return se.create("DIV",{html:this.getTitle(e)}).innerText}search(){var e=this.element.querySelector("input.search");this._triggerCustomEvent("search",e)}_handleClick(e){this.get("reverse")&&(document.activeElement.blur(),this.reverseGeocode(e.coordinate))}reverseGeocode(){}_triggerCustomEvent(e,t){se.dispatchEvent(e,t)}setInput(e,t){var n=this.element.querySelector("input.search");n.value=e,t&&this._triggerCustomEvent("keyup",n)}select(e,t,n,r){var s={type:"select",search:e,reverse:!!t,coordinate:n};if(r)for(var o in r)s[o]=r[o];this.dispatchEvent(s)}_handleSelect(e,t,n){if(e){var r=this.get("history"),s;try{var o=JSON.stringify(e);for(s=r.length-1;s>=0;s--)(!r[s]||JSON.stringify(r[s])===o)&&r.splice(s,1)}catch{for(s=r.length-1;s>=0;s--)r[s]===e&&r.splice(s,1)}r.unshift(e);for(var a=Math.max(0,this.get("maxHistory")||10)||0;r.length>a;)r.pop();this.saveHistory(),this.select(e,t,null,n),t&&(this.setInput(this._getTitleTxt(e)),this.drawList_(),setTimeout((function(){this.collapse(!1)}).bind(this),300))}}saveHistory(){try{this.get("maxHistory")>=0?localStorage["ol@search-"+this._classname]=JSON.stringify(this.get("history")):localStorage.removeItem("ol@search-"+this._classname)}catch{console.warn("Failed to access localStorage...")}}restoreHistory(){if(this._history[this._classname])this.set("history",this._history[this._classname]);else try{this._history[this._classname]=JSON.parse(localStorage["ol@search-"+this._classname]),this.set("history",this._history[this._classname])}catch{this.set("history",[])}}clearHistory(){this.set("history",[]),this.saveHistory(),this.drawList_()}getHistory(){return this.get("history")}autocomplete(e,t){return t([]),!1}drawList_(e){var t=this,n=this.element.querySelector("ul.autocomplete");if(n.innerHTML="",this._list=[],e)n.setAttribute("class","autocomplete");else{var r=this.element.querySelector("input.search"),s=r.value;if(!s)e=this.get("history");else return;n.setAttribute("class","autocomplete history")}for(var o,a=Math.min(t.get("maxItems"),e.length),l=0;l<a;l++)if(e[l]&&(!l||!t.equalFeatures(e[l],e[l-1]))){o=document.createElement("LI"),o.setAttribute("data-search",this._list.length),this._list.push(e[l]),o.addEventListener("click",function(h){t._handleSelect(t._list[h.currentTarget.getAttribute("data-search")])});var c=t.getTitle(e[l]);c instanceof Element?o.appendChild(c):o.innerHTML=c,n.appendChild(o)}a&&this.get("copy")&&(o=document.createElement("LI"),o.classList.add("copy"),o.innerHTML=this.get("copy"),n.appendChild(o))}equalFeatures(){return!1}};rk.prototype._history={};var kf=class extends Os{constructor(e){e=e||{};var t=se.create("DIV",{className:(e.className||"ol-videorec")+" ol-unselectable ol-control"});super({element:t,target:e.target}),se.create("BUTTON",{type:"button",className:"ol-start",title:kf.prototype.tips.start,click:(function(){this.start()}).bind(this),parent:t}),se.create("BUTTON",{type:"button",className:"ol-stop",title:kf.prototype.tips.stop,click:(function(){this.stop()}).bind(this),parent:t}),se.create("BUTTON",{type:"button",className:"ol-pause",title:kf.prototype.tips.pause,click:(function(){this.pause()}).bind(this),parent:t}),se.create("BUTTON",{type:"button",className:"ol-resume",title:kf.prototype.tips.resume,click:(function(){this.resume()}).bind(this),parent:t}),this.set("framerate",30),this.set("videoBitsPerSecond",5e6),e.videoTarget==="DIALOG"?(this._dialog=new XC({className:"ol-fullscreen-dialog",target:document.body,closeBox:!0}),this._videoTarget=this._dialog.getContentElement()):this._videoTarget=e.videoTarget,this._printCtrl=new KC({target:se.create("DIV")})}setTooltip(e,t){var n=this.element.querySelector("button.ol-"+e);n&&(n.title=t)}setMap(e){this.getMap()&&(this.getMap().removeControl(this._printCtrl),this._dialog&&this.getMap().removeControl(this._dialog)),super.setMap(e),this.getMap()&&(this.getMap().addControl(this._printCtrl),this._dialog&&this.getMap().addControl(this._dialog))}start(){var e=this._printCtrl,t=!1;function n(r){t||e.fastPrint({canvas:r},n)}e.fastPrint({},(function(r){var s;try{s=r.captureStream(this.get("framerate")||30)}catch(a){this.dispatchEvent({type:"error",error:a});return}this._mediaRecorder=new MediaRecorder(s,{videoBitsPerSecond:this.get("videoBitsPerSecond")||5e6});var o=[];this._mediaRecorder.ondataavailable=function(a){o.push(a.data)},this._mediaRecorder.onstop=(function(){t=!0;var a=new Blob(o,{type:"video/mp4"});if(o=[],this._videoTarget instanceof Element){var l;this._videoTarget.tagName==="VIDEO"?l=this._videoTarget:(l=this._videoTarget.querySelector("video"),l||(l=se.create("VIDEO",{controls:"",parent:this._videoTarget}))),this._dialog&&this._dialog.show(),l.src=URL.createObjectURL(a),this.dispatchEvent({type:"stop",videoURL:l.src})}else this.dispatchEvent({type:"stop",videoURL:URL.createObjectURL(a)})}).bind(this),this._mediaRecorder.onpause=(function(){t=!0,this.dispatchEvent({type:"pause"})}).bind(this),this._mediaRecorder.onresume=(function(){t=!1,n(r),this.dispatchEvent({type:"resume"})}).bind(this),this._mediaRecorder.onerror=(function(a){this.dispatchEvent({type:"error",error:a})}).bind(this),t=!1,n(r),this._mediaRecorder.start(),this.dispatchEvent({type:"start",canvas:r}),this.element.setAttribute("data-state","rec")}).bind(this))}stop(){this._mediaRecorder&&(this._mediaRecorder.stop(),this._mediaRecorder=null,this.element.setAttribute("data-state","inactive"))}pause(){this._mediaRecorder&&(this._mediaRecorder.pause(),this.element.setAttribute("data-state","pause"))}resume(){this._mediaRecorder&&(this._mediaRecorder.resume(),this.element.setAttribute("data-state","rec"))}};kf.prototype.tips={start:"start video",stop:"stop",pause:"pause",resume:"resume"};var du=class extends Os{constructor(e){e=e||{};var t=t=se.create("DIV",{className:e.className||"ol-mapzone"});if(super({element:t,target:e.target}),!e.target){["ol-unselectable","ol-control","ol-collapsed"].forEach(function(s){t.classList.add(s)});var n=se.create("BUTTON",{type:"button",on:{click:(function(){this.setVisible(this.getCollapsed())}).bind(this)},parent:t});se.create("I",{parent:n})}this.set("centerOnClick",e.centerOnClick);var r=this._maps=[];this._projection=e.projection,this._layer=e.layer,e.zones.forEach(this.addZone.bind(this)),setTimeout(function(){r.forEach(function(s){s.updateSize()})})}setCollapsed(e){e?this.element.classList.add("ol-collapsed"):(this.element.classList.remove("ol-collapsed"),this.getMaps().forEach(function(t){setTimeout(()=>t.getView().fit(t.get("extent")))})),this.dispatchEvent({type:"change:collapse",collapsed:!!e})}setVisible(e){this.setCollapsed(!e)}getCollapsed(){return this.element.classList.contains("ol-collapsed")}getMaps(){return this._maps}getLength(){return this._maps.length}addZone(e){var t=new Xs({zoom:6,center:[0,0],projection:this._projection}),n;e.map?n=Mc(e.map.getView().calculateExtent(),e.map.getView().getProjection(),t.getProjection()):n=Mc(e.extent,"EPSG:4326",t.getProjection());var r=se.create("DIV",{className:"ol-mapzonezone",tabindex:"0",parent:this.element,on:{keydown:function(a){a.key===" "&&a.target.click()}},click:(function(){var a=-1;this._maps.forEach(function(l,c){l.get("zone")===e&&(a=c)}),this.dispatchEvent({type:"select",zone:e,index:a,coordinate:In(n),extent:n}),this.get("centerOnClick")!==!1&&this.getMap().getView().fit(n)}).bind(this)}),s;e.layer?s=e.layer:typeof this._layer=="function"?s=this._layer(e):s=new this._layer.constructor({source:this._layer.getSource()});var o=new Kc({target:r,view:t,controls:[],interactions:[],layers:[s]});o.set("zone",e),o.set("extent",n),this._maps.push(o),t.fit(n),se.create("P",{html:e.title,parent:r})}removeZone(e){var t=this.element.querySelectorAll(".ol-mapzonezone")[e];t&&(t.remove(),this._maps.splice(e,1))}};du.zones={};du.zones.DOM=[{title:"Guadeloupe",extent:[-61.898594315312444,15.75623038647845,-60.957887532935324,16.575317670979473]},{title:"Guyane",extent:[-54.72525931072715,2.1603763430019,-51.528236062921344,5.7984307809552575]},{title:"Martinique",extent:[-61.257556528564756,14.387506317407514,-60.76934912110432,14.895067461729951]},{title:"Mayotte",extent:[44.959844536967815,-13.01674138212816,45.35328866510648,-12.65521942207829]},{title:"La réunion",extent:[55.17059012967656,-21.407680069231688,55.88195702001797,-20.85560221637526]}];du.zones.TOM=[{title:"Polynésie Française",extent:[206.23664226630862,-22.189040615809787,221.85920743981987,-10.835039595040698]},{title:"Nouvelle Calédonie",extent:[163.76420580160925,-22.581641092751838,167.66984709498706,-19.816411635668445]},{title:"St-Pierre et Miquelon",extent:[-56.453698765748676,46.74449858188555,-56.0980198121544,47.14669874229787]},{title:"Wallis et Futuna",extent:[181.7588623143665,-14.7341169873267,183.95612353301715,-13.134720799175085]},{title:"St-Martin St-Barthélemy",extent:[-63.1726389501678,17.806097291313506,-62.7606535945649,18.13267688837938]}];du.zones.DOMTOM=[{title:"Métropole",extent:[-5.318421740712579,41.16082274292913,9.73284186155716,51.21957336557702]}].concat(du.zones.DOM,du.zones.TOM);function Ll(i,e){const t=i.length;return e<0?i[e+t]:e>=t?i[e-t]:i[e]}function Xh(i,e){const t=i.length;let n=Math.floor(e);const r=e-n;n>=t?n-=t:n<0&&(n+=t);let s=n+1;s>=t&&(s-=t);const o=i[n],a=o[0],l=o[1],c=i[s],h=c[0]-a,u=c[1]-l;return[a+h*r,l+u*r]}const _p={index:-1,endIndex:NaN,closestTargetDistance:1/0};function ZC(i,e,t,n){const r=i[0],s=i[1];let o=1/0,a=-1,l=NaN;for(let u=0;u<e.targets.length;++u){const f=e.targets[u],d=f.coordinates;let g=1/0,m;for(let _=0;_<d.length-1;++_){const v=d[_],x=d[_+1],S=eA(r,s,v,x);S.squaredDistance<g&&(g=S.squaredDistance,m=_+S.along)}g<o&&(o=g,f.ring&&e.targetIndex===u&&(f.endIndex>f.startIndex?m<f.startIndex&&(m+=d.length):f.endIndex<f.startIndex&&m>f.startIndex&&(m-=d.length)),l=m,a=u)}const c=e.targets[a];let h=c.ring;if(e.targetIndex===a&&h){const u=Xh(c.coordinates,l),f=t.getPixelFromCoordinate(u),d=t.getPixelFromCoordinate(e.startCoord);Vh(f,d)>n&&(h=!1)}if(h){const u=c.coordinates,f=u.length,d=c.startIndex,g=l;if(d<g){const m=xp(u,d,g);xp(u,d,g-f)<m&&(l-=f)}else{const m=xp(u,d,g);xp(u,d,g+f)<m&&(l+=f)}}return _p.index=a,_p.endIndex=l,_p.closestTargetDistance=o,_p}function JC(i,e){const t=[];for(let n=0;n<e.length;++n){const s=e[n].getGeometry();QC(i,s,t)}return t}function QC(i,e,t){if(e instanceof ar){yp(i,e.getCoordinates(),!1,t);return}if(e instanceof Dl){const n=e.getCoordinates();for(let r=0,s=n.length;r<s;++r)yp(i,n[r],!1,t);return}if(e instanceof lr){const n=e.getCoordinates();for(let r=0,s=n.length;r<s;++r)yp(i,n[r],!0,t);return}if(e instanceof $o){const n=e.getCoordinates();for(let r=0,s=n.length;r<s;++r){const o=n[r];for(let a=0,l=o.length;a<l;++a)yp(i,o[a],!0,t)}return}if(e instanceof O0){const n=e.getGeometries();for(let r=0;r<n.length;++r)QC(i,n[r],t);return}}function yp(i,e,t,n){const r=i[0],s=i[1];for(let o=0,a=e.length-1;o<a;++o){const l=e[o],c=e[o+1],h=eA(r,s,l,c);if(h.squaredDistance===0){const u=o+h.along;n.push({coordinates:e,ring:t,startIndex:u,endIndex:u});return}}}function vp(i,e){return Ia(i[0],i[1],e[0],e[1])}function xp(i,e,t){let n,r;e<t?(n=e,r=t):(n=t,r=e);const s=Math.ceil(n),o=Math.floor(r);if(s>o){const l=Xh(i,n),c=Xh(i,r);return vp(l,c)}let a=0;if(n<s){const l=Xh(i,n),c=Ll(i,s);a+=vp(l,c)}if(o<r){const l=Ll(i,o),c=Xh(i,r);a+=vp(l,c)}for(let l=s;l<o-1;++l){const c=Ll(i,l),h=Ll(i,l+1);a+=vp(c,h)}return a}const T_={along:0,squaredDistance:0};function eA(i,e,t,n){const r=t[0],s=t[1],o=n[0],a=n[1],l=o-r,c=a-s;let h=0,u=r,f=s;return(l!==0||c!==0)&&(h=yt(((i-r)*l+(e-s)*c)/(l*l+c*c),0,1),u+=l*h,f+=c*h),T_.along=h,T_.squaredDistance=Ul(Ia(i,e,u,f),10),T_}const wp={DRAWSTART:"drawstart",DRAWEND:"drawend",DRAWABORT:"drawabort"};class bp extends Dr{constructor(e,t){super(e),this.feature=t}}class sk extends co{constructor(e){const t=e;t.stopDown||(t.stopDown=Vc),super(t),this.on,this.once,this.un,this.options_=e,this.shouldHandle_=!1,this.downPx_=null,this.downTimeout_,this.lastDragTime_,this.pointerType_,this.freehand_=!1,this.source_=e.source?e.source:null,this.features_=e.features?e.features:null,this.snapTolerance_=e.snapTolerance?e.snapTolerance:12,this.type_=e.type,this.mode_=ak(this.type_),this.stopClick_=!!e.stopClick,this.ignoreNextUpEvent_=!1,this.minPoints_=e.minPoints?e.minPoints:this.mode_==="Polygon"?3:2,this.maxPoints_=this.mode_==="Circle"?2:e.maxPoints?e.maxPoints:1/0,this.finishCondition_=e.finishCondition?e.finishCondition:zo,this.geometryLayout_=e.geometryLayout?e.geometryLayout:"XY";let n=e.geometryFunction;if(!n){const r=this.mode_;if(r==="Circle")n=(s,o,a)=>{const l=o||new Bu([NaN,NaN]),c=Ni(s[0]),h=Na(c,Ni(s[s.length-1]));return l.setCenterAndRadius(c,Math.sqrt(h),this.geometryLayout_),l};else{let s;r==="Point"?s=zi:r==="LineString"?s=ar:r==="Polygon"&&(s=lr),n=(o,a,l)=>(a?r==="Polygon"?o[0].length?a.setCoordinates([o[0].concat([o[0][0]])],this.geometryLayout_):a.setCoordinates([],this.geometryLayout_):a.setCoordinates(o,this.geometryLayout_):a=new s(o,this.geometryLayout_),a)}}this.geometryFunction_=n,this.dragVertexDelay_=e.dragVertexDelay!==void 0?e.dragVertexDelay:500,this.finishCoordinate_=null,this.sketchFeature_=null,this.sketchPoint_=null,this.sketchCoords_=null,this.sketchLine_=null,this.sketchLineCoords_=null,this.squaredClickTolerance_=e.clickTolerance?e.clickTolerance*e.clickTolerance:36,this.overlay_=new ao({source:new Ko({useSpatialIndex:!1,wrapX:e.wrapX?e.wrapX:!1}),style:e.style?e.style:ok(),updateWhileInteracting:!0}),this.geometryName_=e.geometryName,this.condition_=e.condition?e.condition:px,this.freehandCondition_,e.freehand?this.freehandCondition_=Rc:this.freehandCondition_=e.freehandCondition?e.freehandCondition:Ad,this.traceCondition_,this.setTrace(e.trace||!1),this.traceState_={active:!1},this.traceSource_=e.traceSource||e.source||null,this.addChangeListener(Py.ACTIVE,this.updateState_)}setTrace(e){let t;e?e===!0?t=Rc:t=e:t=C0,this.traceCondition_=t}setMap(e){super.setMap(e),this.updateState_()}setFreehand(e){this.freehand_=e,this.freehand_?this.freehandCondition_=Rc:this.freehandCondition_=this.options_&&this.options_.freehandCondition?this.options_.freehandCondition:Ad}getOverlay(){return this.overlay_}getFreehand(){return this.freehand_}handleEvent(e){e.originalEvent.type===Qe.CONTEXTMENU&&e.originalEvent.preventDefault(),this.freehand_=this.mode_!=="Point"&&this.freehandCondition_(e);let t=e.type===Ht.POINTERMOVE,n=!0;return!this.freehand_&&this.lastDragTime_&&e.type===Ht.POINTERDRAG&&(Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,t=!0):this.lastDragTime_=void 0,this.shouldHandle_&&this.downTimeout_!==void 0&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0)),this.freehand_&&e.type===Ht.POINTERDRAG&&this.sketchFeature_!==null?(this.addToDrawing_(e.coordinate),n=!1):this.freehand_&&e.type===Ht.POINTERDOWN?n=!1:t&&this.getPointerCount()<2?(n=e.type===Ht.POINTERMOVE,n&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.originalEvent.preventDefault()):(e.originalEvent.pointerType==="mouse"||e.type===Ht.POINTERDRAG&&this.downTimeout_===void 0)&&this.handlePointerMove_(e)):e.type===Ht.DBLCLICK&&(n=!1),super.handleEvent(e)&&n}handleDownEvent(e){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=e.pixel,this.finishCoordinate_||this.startDrawing_(e.coordinate),!0):this.condition_(e)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(()=>{this.handlePointerMove_(new Ta(Ht.POINTERMOVE,e.map,e.originalEvent,!1,e.frameState))},this.dragVertexDelay_),this.downPx_=e.pixel,!0):(this.lastDragTime_=void 0,!1)}deactivateTrace_(){this.traceState_={active:!1}}toggleTraceState_(e){if(!this.traceSource_||!this.traceCondition_(e))return;if(this.traceState_.active){this.deactivateTrace_();return}const t=this.getMap(),n=t.getCoordinateFromPixel([e.pixel[0]-this.snapTolerance_,e.pixel[1]+this.snapTolerance_]),r=t.getCoordinateFromPixel([e.pixel[0]+this.snapTolerance_,e.pixel[1]-this.snapTolerance_]),s=Ui([n,r]),o=this.traceSource_.getFeaturesInExtent(s);if(o.length===0)return;const a=JC(e.coordinate,o);a.length&&(this.traceState_={active:!0,startCoord:e.coordinate.slice(),targets:a,targetIndex:-1})}addOrRemoveTracedCoordinates_(e,t){const n=e.startIndex<=e.endIndex,r=e.startIndex<=t;n===r?n&&t>e.endIndex||!n&&t<e.endIndex?this.addTracedCoordinates_(e,e.endIndex,t):(n&&t<e.endIndex||!n&&t>e.endIndex)&&this.removeTracedCoordinates_(t,e.endIndex):(this.removeTracedCoordinates_(e.startIndex,e.endIndex),this.addTracedCoordinates_(e,e.startIndex,t))}removeTracedCoordinates_(e,t){if(e===t)return;let n=0;if(e<t){const r=Math.ceil(e);let s=Math.floor(t);s===t&&(s-=1),n=s-r+1}else{const r=Math.floor(e);let s=Math.ceil(t);s===t&&(s+=1),n=r-s+1}n>0&&this.removeLastPoints_(n)}addTracedCoordinates_(e,t,n){if(t===n)return;const r=[];if(t<n){const s=Math.ceil(t);let o=Math.floor(n);o===n&&(o-=1);for(let a=s;a<=o;++a)r.push(Ll(e.coordinates,a))}else{const s=Math.floor(t);let o=Math.ceil(n);o===n&&(o+=1);for(let a=s;a>=o;--a)r.push(Ll(e.coordinates,a))}r.length&&this.appendCoordinates(r)}updateTrace_(e){const t=this.traceState_;if(!t.active)return;if(t.targetIndex===-1){const a=e.map.getPixelFromCoordinate(t.startCoord);if(Vh(a,e.pixel)<this.snapTolerance_)return}const n=ZC(e.coordinate,t,this.getMap(),this.snapTolerance_);if(t.targetIndex!==n.index){if(t.targetIndex!==-1){const l=t.targets[t.targetIndex];this.removeTracedCoordinates_(l.startIndex,l.endIndex)}const a=t.targets[n.index];this.addTracedCoordinates_(a,a.startIndex,n.endIndex)}else{const a=t.targets[t.targetIndex];this.addOrRemoveTracedCoordinates_(a,n.endIndex)}t.targetIndex=n.index;const r=t.targets[t.targetIndex];r.endIndex=n.endIndex;const s=Xh(r.coordinates,r.endIndex),o=this.getMap().getPixelFromCoordinate(s);e.coordinate=s,e.pixel=[Math.round(o[0]),Math.round(o[1])]}handleDragEvent(e){this.ignoreNextUpEvent_=!0,super.handleDragEvent(e)}handleUpEvent(e){let t=!0;if(this.getPointerCount()===0){this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(e);const n=this.traceState_.active;if(this.ignoreNextUpEvent_||this.toggleTraceState_(e),this.shouldHandle_){const r=!this.finishCoordinate_;r&&this.startDrawing_(e.coordinate),!r&&this.freehand_?this.finishDrawing():!this.freehand_&&(!r||this.mode_==="Point")&&(this.atFinish_(e.pixel,n)?this.finishCondition_(e)&&this.finishDrawing():this.addToDrawing_(e.coordinate)),t=!1}else this.freehand_&&this.abortDrawing()}return this.ignoreNextUpEvent_=!1,!t&&this.stopClick_&&e.preventDefault(),t}handlePointerMove_(e){if(this.pointerType_=e.originalEvent.pointerType,this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){const t=this.downPx_,n=e.pixel,r=t[0]-n[0],s=t[1]-n[1],o=r*r+s*s;if(this.shouldHandle_=this.freehand_?o>this.squaredClickTolerance_:o<=this.squaredClickTolerance_,!this.shouldHandle_)return}if(!this.finishCoordinate_){this.createOrUpdateSketchPoint_(e.coordinate.slice());return}this.updateTrace_(e),this.modifyDrawing_(e.coordinate)}atFinish_(e,t){let n=!1;if(this.sketchFeature_){let r=!1,s=[this.finishCoordinate_];const o=this.mode_;if(o==="Point")n=!0;else if(o==="Circle")n=this.sketchCoords_.length===2;else if(o==="LineString")r=!t&&this.sketchCoords_.length>this.minPoints_;else if(o==="Polygon"){const a=this.sketchCoords_;r=a[0].length>this.minPoints_,s=[a[0][0],a[0][a[0].length-2]],t?s=[a[0][0]]:s=[a[0][0],a[0][a[0].length-2]]}if(r){const a=this.getMap();for(let l=0,c=s.length;l<c;l++){const h=s[l],u=a.getPixelFromCoordinate(h),f=e[0]-u[0],d=e[1]-u[1],g=this.freehand_?1:this.snapTolerance_;if(n=Math.sqrt(f*f+d*d)<=g,n){this.finishCoordinate_=h;break}}}}return n}createOrUpdateSketchPoint_(e){this.sketchPoint_?this.sketchPoint_.getGeometry().setCoordinates(e):(this.sketchPoint_=new wi(new zi(e)),this.updateSketchFeatures_())}createOrUpdateCustomSketchLine_(e){this.sketchLine_||(this.sketchLine_=new wi);const t=e.getLinearRing(0);let n=this.sketchLine_.getGeometry();n?(n.setFlatCoordinates(t.getLayout(),t.getFlatCoordinates()),n.changed()):(n=new ar(t.getFlatCoordinates(),t.getLayout()),this.sketchLine_.setGeometry(n))}startDrawing_(e){const t=this.getMap().getView().getProjection(),n=S0(this.geometryLayout_);for(;e.length<n;)e.push(0);this.finishCoordinate_=e,this.mode_==="Point"?this.sketchCoords_=e.slice():this.mode_==="Polygon"?(this.sketchCoords_=[[e.slice(),e.slice()]],this.sketchLineCoords_=this.sketchCoords_[0]):this.sketchCoords_=[e.slice(),e.slice()],this.sketchLineCoords_&&(this.sketchLine_=new wi(new ar(this.sketchLineCoords_)));const r=this.geometryFunction_(this.sketchCoords_,void 0,t);this.sketchFeature_=new wi,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(r),this.updateSketchFeatures_(),this.dispatchEvent(new bp(wp.DRAWSTART,this.sketchFeature_))}modifyDrawing_(e){const t=this.getMap(),n=this.sketchFeature_.getGeometry(),r=t.getView().getProjection(),s=S0(this.geometryLayout_);let o,a;for(;e.length<s;)e.push(0);this.mode_==="Point"?a=this.sketchCoords_:this.mode_==="Polygon"?(o=this.sketchCoords_[0],a=o[o.length-1],this.atFinish_(t.getPixelFromCoordinate(e))&&(e=this.finishCoordinate_.slice())):(o=this.sketchCoords_,a=o[o.length-1]),a[0]=e[0],a[1]=e[1],this.geometryFunction_(this.sketchCoords_,n,r),this.sketchPoint_&&this.sketchPoint_.getGeometry().setCoordinates(e),n.getType()==="Polygon"&&this.mode_!=="Polygon"?this.createOrUpdateCustomSketchLine_(n):this.sketchLineCoords_&&this.sketchLine_.getGeometry().setCoordinates(this.sketchLineCoords_),this.updateSketchFeatures_()}addToDrawing_(e){const t=this.sketchFeature_.getGeometry(),n=this.getMap().getView().getProjection();let r,s;const o=this.mode_;return o==="LineString"||o==="Circle"?(this.finishCoordinate_=e.slice(),s=this.sketchCoords_,s.length>=this.maxPoints_&&(this.freehand_?s.pop():r=!0),s.push(e.slice()),this.geometryFunction_(s,t,n)):o==="Polygon"&&(s=this.sketchCoords_[0],s.length>=this.maxPoints_&&(this.freehand_?s.pop():r=!0),s.push(e.slice()),r&&(this.finishCoordinate_=s[0]),this.geometryFunction_(this.sketchCoords_,t,n)),this.createOrUpdateSketchPoint_(e.slice()),this.updateSketchFeatures_(),r?this.finishDrawing():this.sketchFeature_}removeLastPoints_(e){if(!this.sketchFeature_)return;const t=this.sketchFeature_.getGeometry(),n=this.getMap().getView().getProjection(),r=this.mode_;for(let s=0;s<e;++s){let o;if(r==="LineString"||r==="Circle"){if(o=this.sketchCoords_,o.splice(-2,1),o.length>=2){this.finishCoordinate_=o[o.length-2].slice();const a=this.finishCoordinate_.slice();o[o.length-1]=a,this.createOrUpdateSketchPoint_(a)}this.geometryFunction_(o,t,n),t.getType()==="Polygon"&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(t)}else if(r==="Polygon"){o=this.sketchCoords_[0],o.splice(-2,1);const a=this.sketchLine_.getGeometry();if(o.length>=2){const l=o[o.length-2].slice();o[o.length-1]=l,this.createOrUpdateSketchPoint_(l)}a.setCoordinates(o),this.geometryFunction_(this.sketchCoords_,t,n)}if(o.length===1){this.abortDrawing();break}}this.updateSketchFeatures_()}removeLastPoint(){this.removeLastPoints_(1)}finishDrawing(){const e=this.abortDrawing_();if(!e)return null;let t=this.sketchCoords_;const n=e.getGeometry(),r=this.getMap().getView().getProjection();return this.mode_==="LineString"?(t.pop(),this.geometryFunction_(t,n,r)):this.mode_==="Polygon"&&(t[0].pop(),this.geometryFunction_(t,n,r),t=n.getCoordinates()),this.type_==="MultiPoint"?e.setGeometry(new rg([t])):this.type_==="MultiLineString"?e.setGeometry(new Dl([t])):this.type_==="MultiPolygon"&&e.setGeometry(new $o([t])),this.dispatchEvent(new bp(wp.DRAWEND,e)),this.features_&&this.features_.push(e),this.source_&&this.source_.addFeature(e),e}abortDrawing_(){this.finishCoordinate_=null;const e=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),this.deactivateTrace_(),e}abortDrawing(){const e=this.abortDrawing_();e&&this.dispatchEvent(new bp(wp.DRAWABORT,e))}appendCoordinates(e){const t=this.mode_,n=!this.sketchFeature_;n&&this.startDrawing_(e[0]);let r;if(t==="LineString"||t==="Circle")r=this.sketchCoords_;else if(t==="Polygon")r=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[];else return;n&&r.shift(),r.pop();for(let o=0;o<e.length;o++)this.addToDrawing_(e[o]);const s=e[e.length-1];this.sketchFeature_=this.addToDrawing_(s),this.modifyDrawing_(s)}extend(e){const n=e.getGeometry();this.sketchFeature_=e,this.sketchCoords_=n.getCoordinates();const r=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=r.slice(),this.sketchCoords_.push(r.slice()),this.sketchPoint_=new wi(new zi(r)),this.updateSketchFeatures_(),this.dispatchEvent(new bp(wp.DRAWSTART,this.sketchFeature_))}updateSketchFeatures_(){const e=[];this.sketchFeature_&&e.push(this.sketchFeature_),this.sketchLine_&&e.push(this.sketchLine_),this.sketchPoint_&&e.push(this.sketchPoint_);const t=this.overlay_.getSource();t.clear(!0),t.addFeatures(e)}updateState_(){const e=this.getMap(),t=this.getActive();(!e||!t)&&this.abortDrawing(),this.overlay_.setMap(t?e:null)}}function ok(){const i=Lx();return function(e,t){return i[e.getGeometry().getType()]}}function ak(i){switch(i){case"Point":case"MultiPoint":return"Point";case"LineString":case"MultiLineString":return"LineString";case"Polygon":case"MultiPolygon":return"Polygon";case"Circle":return"Circle";default:throw new Error("Invalid type: "+i)}}const TE=0,nd=1,LE=[0,0,0,0],gu=[],L_={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"};function C_(i,e,t){let n;switch(e){case"LineString":n=i;break;case"MultiLineString":case"Polygon":n=i[t[0]];break;case"MultiPolygon":n=i[t[1]][t[0]];break}return n}class A_ extends Dr{constructor(e,t,n){super(e),this.features=t,this.mapBrowserEvent=n}}class lk extends co{constructor(e){super(e),this.on,this.once,this.un,this.boundHandleFeatureChange_=this.handleFeatureChange_.bind(this),this.condition_=e.condition?e.condition:uL,this.defaultDeleteCondition_=function(n){return BN(n)&&gx(n)},this.deleteCondition_=e.deleteCondition?e.deleteCondition:this.defaultDeleteCondition_,this.insertVertexCondition_=e.insertVertexCondition?e.insertVertexCondition:Rc,this.vertexFeature_=null,this.vertexSegments_=null,this.lastCoordinate_=[0,0],this.ignoreNextSingleClick_=!1,this.featuresBeingModified_=null,this.rBush_=new D0,this.pixelTolerance_=e.pixelTolerance!==void 0?e.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new ao({source:new Ko({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:hk(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.SEGMENT_WRITERS_={Point:this.writePointGeometry_.bind(this),LineString:this.writeLineStringGeometry_.bind(this),LinearRing:this.writeLineStringGeometry_.bind(this),Polygon:this.writePolygonGeometry_.bind(this),MultiPoint:this.writeMultiPointGeometry_.bind(this),MultiLineString:this.writeMultiLineStringGeometry_.bind(this),MultiPolygon:this.writeMultiPolygonGeometry_.bind(this),Circle:this.writeCircleGeometry_.bind(this),GeometryCollection:this.writeGeometryCollectionGeometry_.bind(this)},this.source_=null,this.traceSource_=e.traceSource||e.source||null,this.traceCondition_,this.setTrace(e.trace||!1),this.traceState_={active:!1},this.traceSegments_=null,this.hitDetection_=null;let t;if(e.features?t=e.features:e.source&&(this.source_=e.source,t=new Rn(this.source_.getFeatures()),this.source_.addEventListener(An.ADDFEATURE,this.handleSourceAdd_.bind(this)),this.source_.addEventListener(An.REMOVEFEATURE,this.handleSourceRemove_.bind(this))),!t)throw new Error("The modify interaction requires features, a source or a layer");e.hitDetection&&(this.hitDetection_=e.hitDetection),this.features_=t,this.features_.forEach(this.addFeature_.bind(this)),this.features_.addEventListener(ln.ADD,this.handleFeatureAdd_.bind(this)),this.features_.addEventListener(ln.REMOVE,this.handleFeatureRemove_.bind(this)),this.lastPointerEvent_=null,this.delta_=[0,0],this.snapToPointer_=e.snapToPointer===void 0?!this.hitDetection_:e.snapToPointer}setTrace(e){let t;e?e===!0?t=Rc:t=e:t=C0,this.traceCondition_=t}addFeature_(e){const t=e.getGeometry();if(t){const r=this.SEGMENT_WRITERS_[t.getType()];r&&r(e,t)}const n=this.getMap();n&&n.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastCoordinate_),e.addEventListener(Qe.CHANGE,this.boundHandleFeatureChange_)}willModifyFeatures_(e,t){if(!this.featuresBeingModified_){this.featuresBeingModified_=new Rn;const n=this.featuresBeingModified_.getArray();for(let r=0,s=t.length;r<s;++r){const o=t[r].feature;o&&!n.includes(o)&&this.featuresBeingModified_.push(o)}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new A_(L_.MODIFYSTART,this.featuresBeingModified_,e))}}removeFeature_(e){this.removeFeatureSegmentData_(e),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),e.removeEventListener(Qe.CHANGE,this.boundHandleFeatureChange_)}removeFeatureSegmentData_(e){const t=this.rBush_,n=[];t.forEach(function(r){e===r.feature&&n.push(r)});for(let r=n.length-1;r>=0;--r){const s=n[r];for(let o=this.dragSegments_.length-1;o>=0;--o)this.dragSegments_[o][0]===s&&this.dragSegments_.splice(o,1);t.remove(s)}}setActive(e){this.vertexFeature_&&!e&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(e)}setMap(e){this.overlay_.setMap(e),super.setMap(e)}getOverlay(){return this.overlay_}handleSourceAdd_(e){e.feature&&this.features_.push(e.feature)}handleSourceRemove_(e){e.feature&&this.features_.remove(e.feature)}handleFeatureAdd_(e){this.addFeature_(e.element)}handleFeatureChange_(e){if(!this.changingFeature_){const t=e.target;this.removeFeature_(t),this.addFeature_(t)}}handleFeatureRemove_(e){this.removeFeature_(e.element)}writePointGeometry_(e,t){const n=t.getCoordinates(),r={feature:e,geometry:t,segment:[n,n]};this.rBush_.insert(t.getExtent(),r)}writeMultiPointGeometry_(e,t){const n=t.getCoordinates();for(let r=0,s=n.length;r<s;++r){const o=n[r],a={feature:e,geometry:t,depth:[r],index:r,segment:[o,o]};this.rBush_.insert(t.getExtent(),a)}}writeLineStringGeometry_(e,t){const n=t.getCoordinates();for(let r=0,s=n.length-1;r<s;++r){const o=n.slice(r,r+2),a={feature:e,geometry:t,index:r,segment:o};this.rBush_.insert(Ui(o),a)}}writeMultiLineStringGeometry_(e,t){const n=t.getCoordinates();for(let r=0,s=n.length;r<s;++r){const o=n[r];for(let a=0,l=o.length-1;a<l;++a){const c=o.slice(a,a+2),h={feature:e,geometry:t,depth:[r],index:a,segment:c};this.rBush_.insert(Ui(c),h)}}}writePolygonGeometry_(e,t){const n=t.getCoordinates();for(let r=0,s=n.length;r<s;++r){const o=n[r];for(let a=0,l=o.length-1;a<l;++a){const c=o.slice(a,a+2),h={feature:e,geometry:t,depth:[r],index:a,segment:c};this.rBush_.insert(Ui(c),h)}}}writeMultiPolygonGeometry_(e,t){const n=t.getCoordinates();for(let r=0,s=n.length;r<s;++r){const o=n[r];for(let a=0,l=o.length;a<l;++a){const c=o[a];for(let h=0,u=c.length-1;h<u;++h){const f=c.slice(h,h+2),d={feature:e,geometry:t,depth:[a,r],index:h,segment:f};this.rBush_.insert(Ui(f),d)}}}}writeCircleGeometry_(e,t){const n=t.getCenter(),r={feature:e,geometry:t,index:TE,segment:[n,n]},s={feature:e,geometry:t,index:nd,segment:[n,n]},o=[r,s];r.featureSegments=o,s.featureSegments=o,this.rBush_.insert(ou(n),r);let a=t;this.rBush_.insert(a.getExtent(),s)}writeGeometryCollectionGeometry_(e,t){const n=t.getGeometriesArray();for(let r=0;r<n.length;++r){const s=n[r],o=this.SEGMENT_WRITERS_[s.getType()];o(e,s)}}createOrUpdateVertexFeature_(e,t,n,r){let s=this.vertexFeature_;return s?s.getGeometry().setCoordinates(e):(s=new wi(new zi(e)),this.vertexFeature_=s,this.overlay_.getSource().addFeature(s)),s.set("features",t),s.set("geometries",n),s.set("existing",r),s}handleEvent(e){if(!e.originalEvent)return!0;this.lastPointerEvent_=e;let t;return!e.map.getView().getInteracting()&&e.type==Ht.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(e),this.vertexFeature_&&this.deleteCondition_(e)&&(e.type!=Ht.SINGLECLICK||!this.ignoreNextSingleClick_?t=this.removePoint():t=!0),e.type==Ht.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),super.handleEvent(e)&&!t}findInsertVerticesAndUpdateDragSegments_(e){if(this.handlePointerAtPixel_(e),this.dragSegments_.length=0,this.featuresBeingModified_=null,!this.vertexFeature_)return;this.getMap().getView().getProjection();const n=[],r=this.vertexFeature_.getGeometry().getCoordinates(),s=Ui([r]),o=this.rBush_.getInExtent(s),a={};o.sort(ck);for(let l=0,c=o.length;l<c;++l){const h=o[l],u=h.segment;let f=Ue(h.geometry);const d=h.depth;if(d&&(f+="-"+d.join("-")),a[f]||(a[f]=new Array(2)),h.geometry.getType()==="Circle"&&h.index===nd){const g=AE(e,h);Rr(g,r)&&!a[f][0]&&(this.dragSegments_.push([h,0]),a[f][0]=h);continue}if(Rr(u[0],r)&&!a[f][0]){this.dragSegments_.push([h,0]),a[f][0]=h;continue}if(Rr(u[1],r)&&!a[f][1]){if(a[f][0]&&a[f][0].index===0){let g=h.geometry.getCoordinates();switch(h.geometry.getType()){case"LineString":case"MultiLineString":continue;case"MultiPolygon":g=g[d[1]];case"Polygon":if(h.index!==g[d[0]].length-2)continue;break}}this.dragSegments_.push([h,1]),a[f][1]=h;continue}Ue(u)in this.vertexSegments_&&!a[f][0]&&!a[f][1]&&n.push(h)}return n}deactivateTrace_(){this.traceState_={active:!1}}updateTrace_(e){const t=this.traceState_;if(!t.active)return;if(t.targetIndex===-1){const s=e.map.getPixelFromCoordinate(t.startCoord);if(Vh(s,e.pixel)<this.pixelTolerance_)return}const n=ZC(e.coordinate,t,e.map,this.pixelTolerance_);if(t.targetIndex===-1&&Math.sqrt(n.closestTargetDistance)/e.map.getView().getResolution()>this.pixelTolerance_)return;if(t.targetIndex!==n.index){if(t.targetIndex!==-1){const o=t.targets[t.targetIndex];this.removeTracedCoordinates_(o.startIndex,o.endIndex)}else for(const o of this.traceSegments_){const a=o[0],l=a.geometry,c=o[1],h=l.getCoordinates();C_(h,l.getType(),a.depth).splice(a.index+c,1),l.setCoordinates(h),c===0&&(a.index-=1)}const s=t.targets[n.index];this.addTracedCoordinates_(s,s.startIndex,n.endIndex)}else{const s=t.targets[t.targetIndex];this.addOrRemoveTracedCoordinates_(s,n.endIndex)}t.targetIndex=n.index;const r=t.targets[t.targetIndex];r.endIndex=n.endIndex}getTraceCandidates_(e){const t=this.getMap(),n=this.pixelTolerance_,r=t.getCoordinateFromPixel([e.pixel[0]-n,e.pixel[1]+n]),s=t.getCoordinateFromPixel([e.pixel[0]+n,e.pixel[1]-n]),o=Ui([r,s]);return this.traceSource_.getFeaturesInExtent(o)}toggleTraceState_(e){if(!this.traceSource_||!this.traceCondition_(e))return;if(this.traceState_.active){this.deactivateTrace_(),this.traceSegments_=null;return}const t=this.getTraceCandidates_(e);if(t.length===0)return;const n=JC(e.coordinate,t);n.length&&(this.traceState_={active:!0,startCoord:e.coordinate.slice(),targets:n,targetIndex:-1})}addOrRemoveTracedCoordinates_(e,t){const n=e.startIndex<=e.endIndex,r=e.startIndex<=t;n===r?n&&t>e.endIndex||!n&&t<e.endIndex?this.addTracedCoordinates_(e,e.endIndex,t):(n&&t<e.endIndex||!n&&t>e.endIndex)&&this.removeTracedCoordinates_(t,e.endIndex):(this.removeTracedCoordinates_(e.startIndex,e.endIndex),this.addTracedCoordinates_(e,e.startIndex,t))}removeTracedCoordinates_(e,t){if(e===t)return;let n=0;if(e<t){const r=Math.ceil(e);let s=Math.floor(t);s===t&&(s-=1),n=s-r+1}else{const r=Math.floor(e);let s=Math.ceil(t);s===t&&(s+=1),n=r-s+1}if(n>0)for(const r of this.traceSegments_){const s=r[0],o=s.geometry,a=r[1];let l=r[0].index+1;a===1&&(l-=n);const c=o.getCoordinates();C_(c,o.getType(),s.depth).splice(l,n),o.setCoordinates(c),a===1&&(s.index-=n)}}addTracedCoordinates_(e,t,n){if(t===n)return;const r=[];if(t<n){const s=Math.ceil(t);let o=Math.floor(n);o===n&&(o-=1);for(let a=s;a<=o;++a)r.push(Ll(e.coordinates,a))}else{const s=Math.floor(t);let o=Math.ceil(n);o===n&&(o+=1);for(let a=s;a>=o;--a)r.push(Ll(e.coordinates,a))}if(r.length)for(const s of this.traceSegments_){const o=s[0],a=o.geometry,l=s[1],c=o.index+1;l===0&&r.reverse();const h=a.getCoordinates();C_(h,a.getType(),o.depth).splice(c,0,...r),a.setCoordinates(h),l===1&&(o.index+=r.length)}}updateGeometry_(e,t){const n=t[0],r=n.depth;let s;const o=n.segment,a=n.geometry,l=t[1];for(;e.length<a.getStride();)e.push(o[l][e.length]);switch(a.getType()){case"Point":s=e,o[0]=e,o[1]=e;break;case"MultiPoint":s=a.getCoordinates(),s[n.index]=e,o[0]=e,o[1]=e;break;case"LineString":s=a.getCoordinates(),s[n.index+l]=e,o[l]=e;break;case"MultiLineString":s=a.getCoordinates(),s[r[0]][n.index+l]=e,o[l]=e;break;case"Polygon":s=a.getCoordinates(),s[r[0]][n.index+l]=e,o[l]=e;break;case"MultiPolygon":s=a.getCoordinates(),s[r[1]][r[0]][n.index+l]=e,o[l]=e;break;case"Circle":const c=a;if(o[0]=e,o[1]=e,n.index===TE)this.changingFeature_=!0,c.setCenter(e),this.changingFeature_=!1;else{this.changingFeature_=!0,this.getMap().getView().getProjection();let h=Vh(Ni(c.getCenter()),Ni(e));c.setRadius(h),this.changingFeature_=!1}break}s&&this.setGeometryCoordinates_(a,s)}handleDragEvent(e){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(e,this.dragSegments_.map(([o])=>o));const t=[e.coordinate[0]+this.delta_[0],e.coordinate[1]+this.delta_[1]],n=[],r=[],s=this.traceState_.active&&!this.traceSegments_?this.traceState_.startCoord:null;if(s){this.traceSegments_=[];for(const o of this.dragSegments_){const a=o[0];Vh(Em(s,a.segment),s)/e.map.getView().getResolution()<1&&this.traceSegments_.push(o)}}for(let o=0,a=this.dragSegments_.length;o<a;++o){const l=this.dragSegments_[o],c=l[0],h=c.feature;n.includes(h)||n.push(h);const u=c.geometry;r.includes(u)||r.push(u),this.updateGeometry_(t,l)}this.updateTrace_(e),this.createOrUpdateVertexFeature_(t,n,r,!0)}handleDownEvent(e){if(!this.condition_(e))return!1;const t=e.coordinate,n=this.findInsertVerticesAndUpdateDragSegments_(t);if(n?.length&&this.insertVertexCondition_(e)&&(this.willModifyFeatures_(e,n),this.vertexFeature_)){const r=this.vertexFeature_.getGeometry().getCoordinates();for(let s=n.length-1;s>=0;--s)this.insertVertex_(n[s],r);this.ignoreNextSingleClick_=!0}return!!this.vertexFeature_}handleUpEvent(e){for(let t=this.dragSegments_.length-1;t>=0;--t){const n=this.dragSegments_[t][0],r=n.geometry;if(r.getType()==="Circle"){const s=r,o=s.getCenter(),a=n.featureSegments[0],l=n.featureSegments[1];a.segment[0]=o,a.segment[1]=o,l.segment[0]=o,l.segment[1]=o,this.rBush_.update(ou(o),a);let c=s;this.rBush_.update(c.getExtent(),l)}else this.rBush_.update(Ui(n.segment),n)}return this.featuresBeingModified_&&(this.toggleTraceState_(e),this.dispatchEvent(new A_(L_.MODIFYEND,this.featuresBeingModified_,e)),this.featuresBeingModified_=null),!1}handlePointerMove_(e){this.lastCoordinate_=e.coordinate,this.handlePointerAtPixel_(this.lastCoordinate_)}handlePointerAtPixel_(e){const t=this.getMap(),n=t.getPixelFromCoordinate(e);t.getView().getProjection();const r=function(a,l){return CE(e,a)-CE(e,l)};let s,o;if(this.hitDetection_){const a=typeof this.hitDetection_=="object"?l=>l===this.hitDetection_:void 0;t.forEachFeatureAtPixel(n,(l,c,h)=>{h&&h.getType()==="Point"&&(h=new zi(ja(h.getCoordinates())));const u=h||l.getGeometry();if(u&&u.getType()==="Point"&&l instanceof wi&&this.features_.getArray().includes(l)){o=u;const f=l.getGeometry().getFlatCoordinates().slice(0,2);s=[{feature:l,geometry:o,segment:[f,f]}]}return!0},{layerFilter:a})}if(!s){const a=ps(ou(e,LE)),l=t.getView().getResolution()*this.pixelTolerance_,c=Ou(Zn(a,l,LE));s=this.rBush_.getInExtent(c)}if(s&&s.length>0){const a=s.sort(r)[0],l=a.segment;let c=AE(e,a);const h=t.getPixelFromCoordinate(c);let u=Vh(n,h);if(o||u<=this.pixelTolerance_){const f={};if(f[Ue(l)]=!0,this.snapToPointer_||(this.delta_[0]=c[0]-e[0],this.delta_[1]=c[1]-e[1]),a.geometry.getType()==="Circle"&&a.index===nd)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(c,[a.feature],[a.geometry],this.snappedToVertex_);else{const d=t.getPixelFromCoordinate(l[0]),g=t.getPixelFromCoordinate(l[1]),m=Na(h,d),_=Na(h,g);if(u=Math.sqrt(Math.min(m,_)),this.snappedToVertex_=u<=this.pixelTolerance_,!this.snappedToVertex_&&!this.insertVertexCondition_(this.lastPointerEvent_)){this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null);return}this.snappedToVertex_&&(c=m>_?l[1]:l[0]),this.createOrUpdateVertexFeature_(c,[a.feature],[a.geometry],this.snappedToVertex_);const v={};v[Ue(a.geometry)]=!0;for(let x=1,S=s.length;x<S;++x){const b=s[x].segment;if(Rr(l[0],b[0])&&Rr(l[1],b[1])||Rr(l[0],b[1])&&Rr(l[1],b[0])){const A=Ue(s[x].geometry);A in v||(v[A]=!0,f[Ue(b)]=!0)}else break}}this.vertexSegments_=f;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)}insertVertex_(e,t){const n=e.segment,r=e.feature,s=e.geometry,o=e.depth,a=e.index;let l;for(;t.length<s.getStride();)t.push(0);switch(s.getType()){case"MultiLineString":l=s.getCoordinates(),l[o[0]].splice(a+1,0,t);break;case"Polygon":l=s.getCoordinates(),l[o[0]].splice(a+1,0,t);break;case"MultiPolygon":l=s.getCoordinates(),l[o[1]][o[0]].splice(a+1,0,t);break;case"LineString":l=s.getCoordinates(),l.splice(a+1,0,t);break;default:return!1}this.setGeometryCoordinates_(s,l);const c=this.rBush_;c.remove(e),this.updateSegmentIndices_(s,a,o,1);const h={segment:[n[0],t],feature:r,geometry:s,depth:o,index:a};c.insert(Ui(h.segment),h),this.dragSegments_.push([h,1]);const u={segment:[t,n[1]],feature:r,geometry:s,depth:o,index:a+1};return c.insert(Ui(u.segment),u),this.dragSegments_.push([u,0]),!0}updatePointer_(e){return e&&this.findInsertVerticesAndUpdateDragSegments_(e),this.vertexFeature_?.getGeometry().getCoordinates()}getPoint(){const e=this.vertexFeature_?.getGeometry().getCoordinates();return e?ja(e,this.getMap().getView().getProjection()):null}canRemovePoint(){if(!this.vertexFeature_||this.vertexFeature_.get("geometries").every(n=>n.getType()==="Circle"||n.getType().endsWith("Point")))return!1;const e=this.vertexFeature_.getGeometry().getCoordinates();return this.rBush_.getInExtent(Ui([e])).some(({segment:n})=>Rr(n[0],e)||Rr(n[1],e))}removePoint(e){if(e&&(e=Ni(e,this.getMap().getView().getProjection()),this.updatePointer_(e)),!this.lastPointerEvent_||this.lastPointerEvent_&&this.lastPointerEvent_.type!=Ht.POINTERDRAG){const t=this.lastPointerEvent_;this.willModifyFeatures_(t,this.dragSegments_.map(([r])=>r));const n=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new A_(L_.MODIFYEND,this.featuresBeingModified_,t)),this.featuresBeingModified_=null,n}return!1}removeVertex_(){const e=this.dragSegments_,t={};let n=!1,r,s,o,a,l,c,h,u,f,d,g;for(l=e.length-1;l>=0;--l)o=e[l],d=o[0],g=Ue(d.feature),d.depth&&(g+="-"+d.depth.join("-")),g in t||(t[g]={}),o[1]===0?(t[g].right=d,t[g].index=d.index):o[1]==1&&(t[g].left=d,t[g].index=d.index+1);for(g in t){switch(f=t[g].right,h=t[g].left,c=t[g].index,u=c-1,h!==void 0?d=h:d=f,u<0&&(u=0),a=d.geometry,s=a.getCoordinates(),r=s,n=!1,a.getType()){case"MultiLineString":s[d.depth[0]].length>2&&(s[d.depth[0]].splice(c,1),n=!0);break;case"LineString":s.length>2&&(s.splice(c,1),n=!0);break;case"MultiPolygon":r=r[d.depth[1]];case"Polygon":r=r[d.depth[0]],r.length>4&&(c==r.length-1&&(c=0),r.splice(c,1),n=!0,c===0&&(r.pop(),r.push(r[0]),u=r.length-1));break}if(n){this.setGeometryCoordinates_(a,s);const m=[];if(h!==void 0&&(this.rBush_.remove(h),m.push(h.segment[0])),f!==void 0&&(this.rBush_.remove(f),m.push(f.segment[1])),h!==void 0&&f!==void 0){const _={depth:d.depth,feature:d.feature,geometry:d.geometry,index:u,segment:m};this.rBush_.insert(Ui(_.segment),_)}this.updateSegmentIndices_(a,c,d.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),e.length=0}}return n}canInsertPoint(){if(!this.vertexFeature_||this.vertexFeature_.get("geometries").every(n=>n.getType()==="Circle"||n.getType().endsWith("Point")))return!1;const e=this.vertexFeature_.getGeometry().getCoordinates();return this.rBush_.getInExtent(Ui([e])).some(({segment:n})=>!(Rr(n[0],e)||Rr(n[1],e)))}insertPoint(e){const t=e?Ni(e,this.getMap().getView().getProjection()):this.vertexFeature_?.getGeometry().getCoordinates();return t?this.findInsertVerticesAndUpdateDragSegments_(t).reduce((r,s)=>r||this.insertVertex_(s,t),!1):!1}setGeometryCoordinates_(e,t){this.changingFeature_=!0,e.setCoordinates(t),this.changingFeature_=!1}updateSegmentIndices_(e,t,n,r){this.rBush_.forEachInExtent(e.getExtent(),function(s){s.geometry===e&&(n===void 0||s.depth===void 0||Ho(s.depth,n))&&s.index>t&&(s.index+=r)})}}function ck(i,e){return i.index-e.index}function CE(i,e,t){const n=e.geometry;if(n.getType()==="Circle"){let s=n;if(e.index===nd){const o=Na(s.getCenter(),Ni(i)),a=Math.sqrt(o)-s.getRadius();return a*a}}const r=Ni(i);return gu[0]=Ni(e.segment[0]),gu[1]=Ni(e.segment[1]),t6(r,gu)}function AE(i,e,t){const n=e.geometry;if(n.getType()==="Circle"&&e.index===nd)return ja(n.getClosestPoint(Ni(i)));const r=Ni(i);return gu[0]=Ni(e.segment[0]),gu[1]=Ni(e.segment[1]),ja(Em(r,gu))}function hk(){const i=Lx();return function(e,t){return i.Point}}class uk extends co{constructor(e){e=e||{},super(e),this.condition_=e.condition?e.condition:Ad,this.lastAngle_=void 0,this.lastMagnitude_=void 0,this.lastScaleDelta_=0,this.duration_=e.duration!==void 0?e.duration:400}handleDragEvent(e){if(!lu(e))return;const t=e.map,n=t.getSize(),r=e.pixel,s=r[0]-n[0]/2,o=n[1]/2-r[1],a=Math.atan2(o,s),l=Math.sqrt(s*s+o*o),c=t.getView();if(this.lastAngle_!==void 0){const h=this.lastAngle_-a;c.adjustRotationInternal(h)}this.lastAngle_=a,this.lastMagnitude_!==void 0&&c.adjustResolutionInternal(this.lastMagnitude_/l),this.lastMagnitude_!==void 0&&(this.lastScaleDelta_=this.lastMagnitude_/l),this.lastMagnitude_=l}handleUpEvent(e){if(!lu(e))return!0;const n=e.map.getView(),r=this.lastScaleDelta_>1?1:-1;return n.endInteraction(this.duration_,r),this.lastScaleDelta_=0,!1}handleDownEvent(e){return lu(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,this.lastMagnitude_=void 0,!0):!1}}function fk(i){return Ul(i,5)}function Gf(i){return parseFloat(i)}function Bf(i){return fk(i).toString()}function X0(i,e){return isNaN(i)?!1:i!==Gf(Bf(e))}function dk(i,e){return X0(i[0],e[0])||X0(i[1],e[1])}class gk extends ql{constructor(e){super(),e=Object.assign({animate:!0,params:["x","y","z","r","l"],replace:!1,prefix:""},e||{});let t;e.animate===!0?t={duration:250}:e.animate?t=e.animate:t=null,this.animationOptions_=t,this.params_=e.params.reduce((n,r)=>(n[r]=!0,n),{}),this.replace_=e.replace,this.prefix_=e.prefix,this.listenerKeys_=[],this.initial_=!0,this.updateState_=this.updateState_.bind(this),this.trackedCallbacks_={},this.trackedValues_={}}getParamName_(e){return this.prefix_?this.prefix_+e:e}get_(e,t){return e.get(this.getParamName_(t))}set_(e,t,n){t in this.params_&&e.set(this.getParamName_(t),n)}delete_(e,t){t in this.params_&&e.delete(this.getParamName_(t))}setMap(e){const t=this.getMap();super.setMap(e),e!==t&&(t&&this.unregisterListeners_(t),e&&(this.initial_=!0,this.updateState_(),this.registerListeners_(e)))}registerListeners_(e){this.listenerKeys_.push(wt(e,Ro.MOVEEND,this.updateUrl_,this),wt(e.getLayerGroup(),Qe.CHANGE,this.updateUrl_,this),wt(e,"change:layergroup",this.handleChangeLayerGroup_,this)),this.replace_||addEventListener("popstate",this.updateState_)}unregisterListeners_(e){for(let r=0,s=this.listenerKeys_.length;r<s;++r)Zt(this.listenerKeys_[r]);this.listenerKeys_.length=0,this.replace_||removeEventListener("popstate",this.updateState_);const t=new URL(window.location.href),n=t.searchParams;this.delete_(n,"x"),this.delete_(n,"y"),this.delete_(n,"z"),this.delete_(n,"r"),this.delete_(n,"l"),window.history.replaceState(null,"",t)}handleChangeLayerGroup_(){const e=this.getMap();e&&(this.unregisterListeners_(e),this.registerListeners_(e),this.initial_=!0,this.updateUrl_())}updateState_(){const t=new URL(window.location.href).searchParams;for(const f in this.trackedCallbacks_){const d=t.get(f);f in this.trackedCallbacks_&&d!==this.trackedValues_[f]&&(this.trackedValues_[f]=d,this.trackedCallbacks_[f](d))}const n=this.getMap();if(!n)return;const r=n.getView();if(!r)return;let s=!1;const o={},a=Gf(this.get_(t,"z"));"z"in this.params_&&X0(a,r.getZoom())&&(s=!0,o.zoom=a);const l=Gf(this.get_(t,"r"));"r"in this.params_&&X0(l,r.getRotation())&&(s=!0,o.rotation=l);const c=[Gf(this.get_(t,"x")),Gf(this.get_(t,"y"))];("x"in this.params_||"y"in this.params_)&&dk(c,r.getCenter())&&(s=!0,o.center=c),s&&(!this.initial_&&this.animationOptions_?r.animate(Object.assign(o,this.animationOptions_)):(o.center&&r.setCenter(o.center),"zoom"in o&&r.setZoom(o.zoom),"rotation"in o&&r.setRotation(o.rotation)));const h=n.getAllLayers(),u=this.get_(t,"l");if("l"in this.params_&&u&&u.length===h.length)for(let f=0,d=h.length;f<d;++f){const g=parseInt(u[f]);if(!isNaN(g)){const m=!!g,_=h[f];_.getVisible()!==m&&_.setVisible(m)}}}track(e,t){this.trackedCallbacks_[e]=t;const s=new URL(window.location.href).searchParams.get(e);return this.trackedValues_[e]=s,s}update(e,t){const n=new URL(window.location.href),r=n.searchParams;t===null?r.delete(e):r.set(e,t),e in this.trackedValues_&&(this.trackedValues_[e]=t),this.updateHistory_(n)}updateUrl_(){const e=this.getMap();if(!e)return;const t=e.getView();if(!t)return;const n=t.getCenter(),r=t.getZoom(),s=t.getRotation(),o=e.getAllLayers(),a=new Array(o.length);for(let h=0,u=o.length;h<u;++h)a[h]=o[h].getVisible()?"1":"0";const l=new URL(window.location.href),c=l.searchParams;this.set_(c,"x",Bf(n[0])),this.set_(c,"y",Bf(n[1])),this.set_(c,"z",Bf(r)),this.set_(c,"r",Bf(s)),this.set_(c,"l",a.join("")),this.updateHistory_(l),this.initial_=!1}updateHistory_(e){e.href!==window.location.href&&(this.initial_||this.replace_?window.history.replaceState(history.state,"",e):window.history.pushState(null,"",e))}}const Ep={SELECT:"select"};class Sp extends Dr{constructor(e,t,n,r){super(e),this.selected=t,this.deselected=n,this.mapBrowserEvent=r}}const Tp={};class Km extends ql{constructor(e){super(),this.on,this.once,this.un,e=e||{},this.boundAddFeature_=this.addFeature_.bind(this),this.boundRemoveFeature_=this.removeFeature_.bind(this),this.condition_=e.condition?e.condition:gx,this.addCondition_=e.addCondition?e.addCondition:C0,this.removeCondition_=e.removeCondition?e.removeCondition:C0,this.toggleCondition_=e.toggleCondition?e.toggleCondition:Ad,this.multi_=e.multi?e.multi:!1,this.filter_=e.filter?e.filter:zo,this.hitTolerance_=e.hitTolerance?e.hitTolerance:0,this.style_=e.style!==void 0?e.style:pk(),this.features_=e.features||new Rn;let t;if(e.layers)if(typeof e.layers=="function")t=e.layers;else{const n=e.layers;t=function(r){return n.includes(r)}}else t=zo;this.layerFilter_=t,this.featureLayerAssociation_={}}addFeatureLayerAssociation_(e,t){this.featureLayerAssociation_[Ue(e)]=t}getFeatures(){return this.features_}getHitTolerance(){return this.hitTolerance_}getLayer(e){return this.featureLayerAssociation_[Ue(e)]}setHitTolerance(e){this.hitTolerance_=e}setMap(e){this.getMap()&&this.style_&&this.features_.forEach(this.restorePreviousStyle_.bind(this)),super.setMap(e),e?(this.features_.addEventListener(ln.ADD,this.boundAddFeature_),this.features_.addEventListener(ln.REMOVE,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(ln.ADD,this.boundAddFeature_),this.features_.removeEventListener(ln.REMOVE,this.boundRemoveFeature_))}addFeature_(e){const t=e.element;if(this.style_&&this.applySelectedStyle_(t),!this.getLayer(t)){const n=this.findLayerOfFeature_(t);n&&this.addFeatureLayerAssociation_(t,n)}}removeFeature_(e){this.style_&&this.restorePreviousStyle_(e.element)}findLayerOfFeature_(e){return this.getMap().getAllLayers().find(function(n){if(n instanceof ao&&n.getSource()&&n.getSource().hasFeature(e))return n})}getStyle(){return this.style_}applySelectedStyle_(e){const t=Ue(e);t in Tp||(Tp[t]=e.getStyle()),e.setStyle(this.style_)}restorePreviousStyle_(e){const t=this.getMap().getInteractions().getArray();for(let r=t.length-1;r>=0;--r){const s=t[r];if(s!==this&&s instanceof Km&&s.getStyle()&&s.getFeatures().getArray().lastIndexOf(e)!==-1){e.setStyle(s.getStyle());return}}const n=Ue(e);e.setStyle(Tp[n]),delete Tp[n]}removeFeatureLayerAssociation_(e){delete this.featureLayerAssociation_[Ue(e)]}selectFeatureInternal_(e,t,n){if(!(e instanceof wi)||!this.filter_(e,t))return;const r=this.getFeatures();return r.getArray().includes(e)||(this.addFeatureLayerAssociation_(e,t),r.push(e),n?.push(e)),e}selectFeature(e){const t=this.findLayerOfFeature_(e);if(!this.layerFilter_(t))return!1;const n=this.selectFeatureInternal_(e,t);return n&&this.dispatchEvent(new Sp(Ep.SELECT,[n],[],void 0)),!!n}removeFeatureInternal_(e,t){const n=this.getFeatures();if(!(!(e instanceof wi)||!n.getArray().includes(e)))return n.remove(e),this.removeFeatureLayerAssociation_(e),t?.push(e),e}deselectFeature(e){const t=this.removeFeatureInternal_(e);return t&&this.dispatchEvent(new Sp(Ep.SELECT,[],[t],void 0)),!!t}toggleFeature(e){this.deselectFeature(e)||this.selectFeature(e)}clearSelection(){jl(this.featureLayerAssociation_);const e=this.getFeatures(),t=e.getArray().slice();e.clear(),t.length!==0&&this.dispatchEvent(new Sp(Ep.SELECT,[],t,void 0))}handleEvent(e){if(!this.condition_(e))return!0;const t=this.addCondition_(e),n=this.removeCondition_(e),r=this.toggleCondition_(e),s=!t&&!n&&!r,o=e.map,a=this.getFeatures(),l=[],c=[];if(s){let h=!1;o.forEachFeatureAtPixel(e.pixel,(u,f)=>{if(h=!0,!!this.selectFeatureInternal_(u,f,c))return!this.multi_},{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let u=a.getLength()-1;u>=0;--u){const f=a.item(u);(c.length>0&&!c.includes(f)||!h)&&this.removeFeatureInternal_(f,l)}}else o.forEachFeatureAtPixel(e.pixel,(h,u)=>{let f;if((n||r)&&(f=this.removeFeatureInternal_(h,l)),(t||r)&&!f&&(f=this.selectFeatureInternal_(h,u,c)),!!f)return!this.multi_},{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});return(c.length>0||l.length>0)&&this.dispatchEvent(new Sp(Ep.SELECT,c,l,e)),!0}}function pk(){const i=Lx();return ms(i.Polygon,i.LineString),ms(i.GeometryCollection,i.LineString),function(e){return e.getGeometry()?i[e.getGeometry().getType()]:null}}const P_={SNAP:"snap",UNSNAP:"unsnap"};class M_ extends Dr{constructor(e,t){super(e),this.vertex=t.vertex,this.vertexPixel=t.vertexPixel,this.feature=t.feature,this.segment=t.segment}}const tA={Circle(i,e){const n=rN(i);return tA.Polygon(n)},GeometryCollection(i,e){const t=[],n=i.getGeometriesArray();for(let r=0;r<n.length;++r){const s=this[n[r].getType()];s&&t.push(s(n[r],e))}return t.flat()},LineString(i){const e=[],t=i.getFlatCoordinates(),n=i.getStride();for(let r=0,s=t.length-n;r<s;r+=n)e.push([t.slice(r,r+2),t.slice(r+n,r+n+2)]);return e},MultiLineString(i){const e=[],t=i.getFlatCoordinates(),n=i.getStride(),r=i.getEnds();let s=0;for(let o=0,a=r.length;o<a;++o){const l=r[o];for(let c=s,h=l-n;c<h;c+=n)e.push([t.slice(c,c+2),t.slice(c+n,c+n+2)]);s=l}return e},MultiPoint(i){const e=[],t=i.getFlatCoordinates(),n=i.getStride();for(let r=0,s=t.length;r<s;r+=n)e.push([t.slice(r,r+2)]);return e},MultiPolygon(i){const e=[],t=i.getFlatCoordinates(),n=i.getStride(),r=i.getEndss();let s=0;for(let o=0,a=r.length;o<a;++o){const l=r[o];for(let c=0,h=l.length;c<h;++c){const u=l[c];for(let f=s,d=u-n;f<d;f+=n)e.push([t.slice(f,f+2),t.slice(f+n,f+n+2)]);s=u}}return e},Point(i){return[[i.getFlatCoordinates().slice(0,2)]]},Polygon(i){const e=[],t=i.getFlatCoordinates(),n=i.getStride(),r=i.getEnds();let s=0;for(let o=0,a=r.length;o<a;++o){const l=r[o];for(let c=s,h=l-n;c<h;c+=n)e.push([t.slice(c,c+2),t.slice(c+n,c+n+2)]);s=l}return e}};function PE(i){return i.feature?i.feature:i.element?i.element:null}const R_=[],va=[],Ph=[];class mk extends co{constructor(e){e=e||{},super({handleDownEvent:zo,stopDown:Vc}),this.on,this.once,this.un,this.source_=e.source?e.source:null,this.vertex_=e.vertex!==void 0?e.vertex:!0,this.edge_=e.edge!==void 0?e.edge:!0,this.intersection_=e.intersection!==void 0?e.intersection:!1,this.features_=e.features?e.features:null,this.featuresListenerKeys_=[],this.featureChangeListenerKeys_={},this.indexedFeaturesExtents_={},this.pendingFeatures_={},this.pixelTolerance_=e.pixelTolerance!==void 0?e.pixelTolerance:10,this.rBush_=new D0,this.snapped_=null,this.segmenters_=Object.assign({},tA,e.segmenters)}addFeature(e,t){t=t!==void 0?t:!0;const n=Ue(e),r=e.getGeometry();if(r){const s=this.segmenters_[r.getType()];if(s){this.indexedFeaturesExtents_[n]=r.getExtent(bn());const o=s.call(this.segmenters_,r,this.getMap().getView().getProjection());let a=o.length;for(let l=0;l<a;++l){const c=o[l];va[l]=Ui(c),Ph[l]={feature:e,segment:c}}if(this.intersection_)for(let l=0,c=o.length;l<c;++l){const h=o[l];if(h.length===1)continue;const u=va[l];for(let d=0,g=l-1;d<g;++d){const m=o[d];if(!Ei(u,va[d]))continue;const _=ub(h,m);if(!_)continue;const v=[_];va[a]=Ui(v),Ph[a++]={feature:e,intersectionFeature:e,segment:v}}const f=this.rBush_.getInExtent(va[l]);for(let d=0,g=f.length;d<g;++d){const m=f[d].segment;if(m.length===1)continue;const _=ub(h,m);if(!_)continue;const v=[_];va[a]=Ui(v),Ph[a++]={feature:e,intersectionFeature:f[d].feature,segment:v}}}a===1?this.rBush_.insert(va[0],Ph[0]):(va.length=a,Ph.length=a,this.rBush_.load(va,Ph))}}t&&(this.featureChangeListenerKeys_[n]&&Zt(this.featureChangeListenerKeys_[n]),this.featureChangeListenerKeys_[n]=wt(e,Qe.CHANGE,this.handleFeatureChange_,this))}getFeatures_(){let e;return this.features_?e=this.features_:this.source_&&(e=this.source_.getFeatures()),e}areSnapDataEqual_(e,t){return e.segment===t.segment&&e.feature===t.feature}handleEvent(e){const t=this.snapTo(e.pixel,e.coordinate,e.map);return t?(e.coordinate=t.vertex.slice(0,2),e.pixel=t.vertexPixel,this.snapped_&&!this.areSnapDataEqual_(this.snapped_,t)&&this.dispatchEvent(new M_(P_.UNSNAP,this.snapped_)),this.snapped_={vertex:e.coordinate,vertexPixel:e.pixel,feature:t.feature,segment:t.segment},this.dispatchEvent(new M_(P_.SNAP,this.snapped_))):this.snapped_&&(this.dispatchEvent(new M_(P_.UNSNAP,this.snapped_)),this.snapped_=null),super.handleEvent(e)}handleFeatureAdd_(e){const t=PE(e);t&&this.addFeature(t)}handleFeatureRemove_(e){const t=PE(e);t&&(this.removeFeature(t),delete this.pendingFeatures_[Ue(t)])}handleFeatureChange_(e){const t=e.target;this.handlingDownUpSequence?this.pendingFeatures_[Ue(t)]=t:this.updateFeature_(t)}handleUpEvent(e){const t=Object.values(this.pendingFeatures_);if(t.length){for(const n of t)this.updateFeature_(n);jl(this.pendingFeatures_)}return!1}removeFeature(e,t){const n=t!==void 0?t:!0,r=Ue(e),s=this.indexedFeaturesExtents_[r];if(s){const o=this.rBush_;o.getInExtent(s).forEach(a=>{(e===a.feature||e===a.intersectionFeature)&&o.remove(a)})}n&&(Zt(this.featureChangeListenerKeys_[r]),delete this.featureChangeListenerKeys_[r])}setMap(e){const t=this.getMap(),n=this.featuresListenerKeys_;let r=this.getFeatures_();if(Array.isArray(r)||(r=r.getArray()),t&&(n.forEach(Zt),n.length=0,this.rBush_.clear(),Object.values(this.featureChangeListenerKeys_).forEach(Zt),this.featureChangeListenerKeys_={}),super.setMap(e),e){this.features_?n.push(wt(this.features_,ln.ADD,this.handleFeatureAdd_,this),wt(this.features_,ln.REMOVE,this.handleFeatureRemove_,this)):this.source_&&n.push(wt(this.source_,An.ADDFEATURE,this.handleFeatureAdd_,this),wt(this.source_,An.REMOVEFEATURE,this.handleFeatureRemove_,this));for(const s of r)this.addFeature(s)}}snapTo(e,t,n){n.getView().getProjection();const r=Ni(t),s=Ou(Zn(Ui([r]),n.getView().getResolution()*this.pixelTolerance_)),o=this.rBush_.getInExtent(s),a=o.length;if(a===0)return null;let l,c=1/0,h,u=null;const f=this.pixelTolerance_*this.pixelTolerance_,d=()=>{if(!l)return null;const g=n.getPixelFromCoordinate(l);return Na(e,g)>f?null:{vertex:l,vertexPixel:[Math.round(g[0]),Math.round(g[1])],feature:h,segment:u}};if(this.vertex_||this.intersection_){for(let m=0;m<a;++m){const _=o[m];if(_.feature.getGeometry().getType()!=="Circle")for(const v of _.segment){const x=Ni(v),S=Na(r,x);S<c&&(this.intersection_&&_.intersectionFeature||this.vertex_&&!_.intersectionFeature)&&(l=v,c=S,h=_.feature)}}const g=d();if(g)return g}if(this.edge_){for(let m=0;m<a;++m){let _=null;const v=o[m];if(v.feature.getGeometry().getType()==="Circle"){let x=v.feature.getGeometry();_=e6(r,x)}else{const[x,S]=v.segment;S&&(R_[0]=Ni(x),R_[1]=Ni(S),_=Em(r,R_))}if(_){const x=Na(r,_);x<c&&(l=ja(_),u=v.feature.getGeometry().getType()==="Circle"?null:v.segment,c=x,h=v.feature)}}const g=d();if(g)return g}return null}updateFeature_(e){this.removeFeature(e,!1),this.addFeature(e,!1)}}var _k=class extends Km{constructor(e){e=e||{};var t=new ao({source:new Ko({features:new Rn,wrapX:e.wrapX,useSpatialIndex:!0}),name:"Cluster overlay",updateWhileAnimating:!0,updateWhileInteracting:!0,displayInLayerSwitcher:!1,style:e.featureStyle});if(e.layers)if(typeof e.layers=="function"){var n=e.layers;e.layers=function(s){return s===t||n(s)}}else e.layers.push&&e.layers.push(t);if(e.filter){var r=e.filter;e.filter=function(s,o){return!o&&s.get("selectclusterlink")?!1:r(s,o)}}else e.filter=function(s,o){return!(!o&&s.get("selectclusterlink"))};e.autoClose===!1&&!e.toggleCondition&&(e.toggleCondition=gx),super(e),this.overlayLayer_=t,this.filter_=e.filter,this.pointRadius=e.pointRadius||12,this.circleMaxObjects=e.circleMaxObjects||10,this.maxObjects=e.maxObjects||60,this.spiral=e.spiral!==!1,this.animate=e.animate,this.animationDuration=e.animationDuration||500,this.selectCluster_=e.selectCluster!==!1,this._autoClose=e.autoClose!==!1,this.on("select",this.selectCluster.bind(this))}setMap(e){this.getMap()&&this.getMap().removeLayer(this.overlayLayer_),this._listener&&Er(this._listener),this._listener=null,super.setMap(e),this.overlayLayer_.setMap(e),e&&e.getView()&&(this._listener=e.getView().on("change:resolution",this.clear.bind(this)))}clear(){this.getFeatures().clear(),this.overlayLayer_.getSource().clear()}getLayer(){return this.overlayLayer_}selectCluster(e){if(e instanceof wi&&(e={selected:[e]}),!e.selected.length){if(this._autoClose)this.clear();else{var t=e.deselected;t.forEach(b=>{var A=b.get("selectcluserfeatures");A&&A.forEach(F=>{this.overlayLayer_.getSource().removeFeature(F)})})}return}var n=e.selected[0];if(!n.get("selectclusterfeature")){var r=this.overlayLayer_.getSource();this._autoClose&&r.clear();var s=n.get("features");if(!(!s||s.length==1)){this.selectCluster_||this.getFeatures().clear();var o=n.getGeometry().getCoordinates(),a=this.getMap().getView(),l=a.getResolution()*1,c,h,u,f,d,g,m,_=[];if(!this.spiral||s.length<=this.circleMaxObjects)for(f=Math.min(s.length,this.circleMaxObjects),c=l*this.pointRadius*(.5+f/4),u=0;u<f;u++)h=2*Math.PI*u/f,(f==2||f==4)&&(h+=Math.PI/4),d=[o[0]+c*Math.sin(h),o[1]+c*Math.cos(h)],g=new wi({selectclusterfeature:!0,features:[s[u]],geometry:new zi(d)}),g.setStyle(s[u].getStyle()),_.push(g),m=new wi({selectclusterlink:!0,geometry:new ar([o,d])}),_.push(m);else{h=0;var v=2*this.pointRadius;for(f=Math.min(this.maxObjects,s.length),u=0;u<f;u++){c=v/2+v*h/(2*Math.PI),h=h+(v+.1)/c;var x=l*c*Math.sin(h),S=l*c*Math.cos(h);d=[o[0]+x,o[1]+S],g=new wi({selectclusterfeature:!0,features:[s[u]],geometry:new zi(d)}),g.setStyle(s[u].getStyle()),_.push(g),m=new wi({selectclusterlink:!0,geometry:new ar([o,d])}),_.push(m)}}n.set("selectcluserfeatures",_),this.animate?this.animateCluster_(o,_):r.addFeatures(_)}}}animateCluster_(e,t){if(this.listenerKey_&&Er(this.listenerKey_),!t.length)return;var n=this.overlayLayer_.getStyle(),r=typeof n=="function"?n:n.length?function(){return n}:function(){return[n]},s=this.animationDuration||500,o=new Date().getTime();function a(c){for(var h=c.vectorContext||qm(c),u=c.frameState.pixelRatio,f=this.getMap().getView(),d=f.getResolution()+1,g=Va((c.frameState.time-o)/s),m=0,_;_=t[m];m++)if(_.get("features")){var v=_.getGeometry().getCoordinates();v[0]=e[0]+g*(v[0]-e[0]),v[1]=e[1]+g*(v[1]-e[1]);for(var x=new zi(v),S=r(_,d),b=0;b<S.length;b++){var A,F=Kc.prototype.getFeaturesAtPixel?!1:S[b].getImage();F&&(A=F.getScale(),F.setScale(u)),h.setStyle?(h.setStyle(S[b]),h.drawGeometry(x)):(h.setImageStyle(F),h.drawPointGeometry(x)),F&&F.setScale(A)}}if(g>1){Er(this.listenerKey_),this.overlayLayer_.getSource().addFeatures(t),this.overlayLayer_.changed();return}c.frameState.animate=!0}this.listenerKey_=this.overlayLayer_.on(["postcompose","postrender"],a.bind(this));var l=new wi(new zi(this.getMap().getView().getCenter()));l.setStyle(new Li({image:new $l({})})),this.overlayLayer_.getSource().addFeature(l)}getClusterExtent(e){if(!e.get("features"))return null;var t=bn();return e.get("features").forEach(function(n){t=Pc(t,n.getGeometry().getExtent())}),t[0]===t[2]&&t[1]===t[3]?null:t}},iA=class extends co{constructor(e){e=e||{},super({handleDownEvent:function(n){return t.handleDownEvent_(n)},handleDragEvent:function(n){return this.handleDragEvent_(n)},handleMoveEvent:function(n){return this.handleMoveEvent_(n)},handleUpEvent:function(n){return this.handleUpEvent_(n)}});var t=this;this.selection_=new Rn,this.handles_=new Rn,this.overlayLayer_=new ao({source:new Ko({features:this.handles_,useSpatialIndex:!1,wrapX:!1}),name:"Transform overlay",displayInLayerSwitcher:!1,style:function(n){return t.style[(n.get("handle")||"default")+(n.get("constraint")||"")+(n.get("option")||"")]},updateWhileAnimating:!0,updateWhileInteracting:!0}),this.features_=e.features,typeof e.filter=="function"&&(this._filter=e.filter),this.layers_=e.layers?e.layers instanceof Array?e.layers:[e.layers]:null,this._handleEvent=e.condition||function(){return!0},this.addFn_=e.addCondition||function(){return!1},this.setPointRadius(e.pointRadius),this.set("translateFeature",e.translateFeature!==!1),this.set("translate",e.translate!==!1),this.set("translateBBox",e.translateBBox===!0),this.set("stretch",e.stretch!==!1),this.set("scale",e.scale!==!1),this.set("rotate",e.rotate!==!1),this.set("keepAspectRatio",e.keepAspectRatio||function(n){return n.originalEvent.shiftKey}),this.set("modifyCenter",e.modifyCenter||function(n){return n.originalEvent.metaKey||n.originalEvent.ctrlKey}),this.set("noFlip",e.noFlip||!1),this.set("selection",e.selection!==!1),this.set("hitTolerance",e.hitTolerance||0),this.set("enableRotatedTransform",e.enableRotatedTransform||!1),this.set("keepRectangle",e.keepRectangle||!1),this.set("buffer",e.buffer||0),this.on("propertychange",function(){this.drawSketch_()}),this.setDefaultStyle(),e.select?this.on("change:active",(function(n){this.getActive()?this.setSelection(e.select.getFeatures().getArray()):(e.select.getFeatures().extend(this.selection_),this.selection_.forEach(function(r){e.select.getFeatures().push(r)}),this.select(null))}).bind(this)):this.on("change:active",(function(n){this.select(null)}).bind(this))}setMap(e){var t=this.getMap();t&&(t.removeLayer(this.overlayLayer_),this.previousCursor_&&se.setCursor(t,this.previousCursor_),this.previousCursor_=void 0),super.setMap(e),this.overlayLayer_.setMap(e),e===null&&this.select(null),e!==null&&(this.isTouch=/touch/.test(e.getViewport().className),this.setDefaultStyle())}setActive(e){this.overlayLayer_&&this.overlayLayer_.setVisible(e),super.setActive(e)}setDefaultStyle(e){e=e||{};var t=e.pointStroke||new xn({color:[255,0,0,1],width:1}),n=e.stroke||new xn({color:[255,0,0,1],width:1,lineDash:[4,4]}),r=e.fill||new cr({color:[255,0,0,.01]}),s=e.pointFill||new cr({color:[255,255,255,.8]}),o=new Ic({fill:s,stroke:t,radius:this.isTouch?12:6,displacement:this.isTouch?[24,-24]:[12,-12],points:15});o.setDisplacement||(o.getAnchor()[0]=this.isTouch?-10:-5);var a=new Ic({fill:s,stroke:t,radius:this.isTouch?16:8,points:4,angle:Math.PI/4}),l=new Ic({fill:s,stroke:t,radius:this.isTouch?12:6,points:4,angle:Math.PI/4});function c(h,u,f){return[new Li({image:h,stroke:u,fill:f})]}this.style={default:c(a,n,r),translate:c(a,t,s),rotate:c(o,t,s),rotate0:c(a,t,s),scale:c(a,t,s),scale1:c(a,t,s),scale2:c(a,t,s),scale3:c(a,t,s),scalev:c(l,t,s),scaleh1:c(l,t,s),scalev2:c(l,t,s),scaleh3:c(l,t,s)},this.drawSketch_()}setStyle(e,t){if(t){t instanceof Array?this.style[e]=t:this.style[e]=[t];for(var n=0;n<this.style[e].length;n++){var r=this.style[e][n].getImage();r&&(e=="rotate"&&(r.getAnchor()[0]=-5),this.isTouch&&r.setScale(1.8));var s=this.style[e][n].getText();s&&(e=="rotate"&&s.setOffsetX(this.isTouch?14:7),this.isTouch&&s.setScale(1.8))}this.drawSketch_()}}getFeatureAtPixel_(e){var t=this;return this.getMap().forEachFeatureAtPixel(e,function(n,r){var s=!1;if(!r){if(n===t.bbox_)return t.get("translateBBox")?{feature:n,handle:"translate",constraint:"",option:""}:!1;if(t.handles_.forEach(function(a){a===n&&(s=!0)}),s)return{feature:n,handle:n.get("handle"),constraint:n.get("constraint"),option:n.get("option")}}if(!t.get("selection"))return t.selection_.getArray().some(function(a){return n===a})?{feature:n}:null;if(t._filter)return t._filter(n,r)?{feature:n}:null;if(t.layers_){for(var o=0;o<t.layers_.length;o++)if(t.layers_[o]===r)return{feature:n};return null}else return t.features_?(t.features_.forEach(function(a){a===n&&(s=!0)}),s?{feature:n}:null):{feature:n}},{hitTolerance:this.get("hitTolerance")})||{}}getGeometryRotateToZero_(e,t){var n=e.getGeometry(),r=this.getMap().getView().getRotation();if(r===0||!this.get("enableRotatedTransform"))return t?n.clone():n;var s=n.clone();return s.rotate(r*-1,this.getMap().getView().getCenter()),s}_isRectangle(e){if(this.get("keepRectangle")&&e.getType()==="Polygon"){var t=e.getCoordinates()[0];return t.length===5}return!1}drawSketch_(e){var t,n,r,s=this.selection_.item(0)&&this._isRectangle(this.selection_.item(0).getGeometry());if(this.overlayLayer_.getSource().clear(),!(!this.selection_.getLength()||!this.selection_.item(0).getGeometry())){var o=this.getMap().getView().getRotation(),a=this.getGeometryRotateToZero_(this.selection_.item(0)).getExtent(),l;s&&(l=this.getGeometryRotateToZero_(this.selection_.item(0)).getCoordinates()[0].slice(0,4),l.unshift(l[3])),a=Zn(a,this.get("buffer")),this.selection_.forEach((function(m){var _=this.getGeometryRotateToZero_(m).getExtent();Pc(a,_)}).bind(this));var c=this.selection_.getLength()===1?this._pointRadius(this.selection_.item(0)):0;if(c&&!(c instanceof Array)&&(c=[c,c]),e===!0)this.ispt_||(this.overlayLayer_.getSource().addFeature(new wi({geometry:new zi(this.center_),handle:"rotate0"})),r=Wh(a),this.get("enableRotatedTransform")&&o!==0&&r.rotate(o,this.getMap().getView().getCenter()),n=this.bbox_=new wi(r),this.overlayLayer_.getSource().addFeature(n));else{if(this.ispt_){var h=this.getMap().getPixelFromCoordinate(In(a));if(h){var u=c&&c[0]||10,f=c&&c[1]||10;a=Ui([this.getMap().getCoordinateFromPixel([h[0]-u,h[1]-f]),this.getMap().getCoordinateFromPixel([h[0]+u,h[1]+f])])}}r=s?new lr([l]):Wh(a),this.get("enableRotatedTransform")&&o!==0&&r.rotate(o,this.getMap().getView().getCenter()),n=this.bbox_=new wi(r);var d=[],g=r.getCoordinates()[0];if(!this.ispt_||c){if(d.push(n),!this.iscircle_&&!this.ispt_&&this.get("stretch")&&this.get("scale"))for(t=0;t<g.length-1;t++)n=new wi({geometry:new zi([(g[t][0]+g[t+1][0])/2,(g[t][1]+g[t+1][1])/2]),handle:"scale",constraint:t%2?"h":"v",option:t}),d.push(n);if(this.get("scale"))for(t=0;t<g.length-1;t++)n=new wi({geometry:new zi(g[t]),handle:"scale",option:t}),d.push(n);this.get("translate")&&!this.get("translateFeature")&&(n=new wi({geometry:new zi([(g[0][0]+g[2][0])/2,(g[0][1]+g[2][1])/2]),handle:"translate"}),d.push(n))}!this.iscircle_&&this.get("rotate")&&(n=new wi({geometry:new zi(g[3]),handle:"rotate"}),d.push(n)),this.overlayLayer_.getSource().addFeatures(d)}}}select(e,t){if(!e){this.selection_&&(this.selection_.clear(),this.drawSketch_());return}if(!(!e.getGeometry||!e.getGeometry())){if(t)this.selection_.push(e);else{var n=this.selection_.getArray().indexOf(e);this.selection_.removeAt(n)}this.ispt_=this.selection_.getLength()===1?this.selection_.item(0).getGeometry().getType()=="Point":!1,this.iscircle_=this.selection_.getLength()===1?this.selection_.item(0).getGeometry().getType()=="Circle":!1,this.drawSketch_(),this.watchFeatures_(),this.dispatchEvent({type:"select",feature:e,features:this.selection_})}}setSelection(e){this.selection_.clear(),e.forEach((function(t){this.selection_.push(t)}).bind(this)),this.ispt_=this.selection_.getLength()===1?this.selection_.item(0).getGeometry().getType()=="Point":!1,this.iscircle_=this.selection_.getLength()===1?this.selection_.item(0).getGeometry().getType()=="Circle":!1,this.drawSketch_(),this.watchFeatures_(),this.dispatchEvent({type:"select",features:this.selection_})}watchFeatures_(){this._featureListeners&&this._featureListeners.forEach(function(e){Er(e)}),this._featureListeners=[],this.selection_.forEach((function(e){this._featureListeners.push(e.on("change",(function(){this.isUpdating_||this.drawSketch_()}).bind(this)))}).bind(this))}handleDownEvent_(e){if(this._handleEvent(e,this.selection_)){var t=this.getFeatureAtPixel_(e.pixel),n=t.feature;if(this.selection_.getLength()&&this.selection_.getArray().indexOf(n)>=0&&(this.ispt_&&this.get("translate")||this.get("translateFeature"))&&(t.handle="translate"),t.handle){this.mode_=t.handle,this.opt_=t.option,this.constraint_=t.constraint;var r=this.getMap().getView().getRotation();this.coordinate_=n.get("handle")?n.getGeometry().getCoordinates():e.coordinate,this.pixel_=this.getMap().getCoordinateFromPixel(this.coordinate_),this.geoms_=[],this.rotatedGeoms_=[];var s=bn(),o=bn();this.hasChanged_=!1;for(var a=0,l;l=this.selection_.item(a);a++)if(this.geoms_.push(l.getGeometry().clone()),s=Pc(s,l.getGeometry().getExtent()),this.get("enableRotatedTransform")&&r!==0){var c=this.getGeometryRotateToZero_(l,!0);this.rotatedGeoms_.push(c),o=Pc(o,c.getExtent())}if(this.extent_=Wh(s).getCoordinates()[0],this.get("enableRotatedTransform")&&r!==0&&(this.rotatedExtent_=Wh(o).getCoordinates()[0]),this.mode_==="rotate"){this.center_=this.getCenter()||In(s);var h=e.map.getTargetElement();se.setCursor(h,this.Cursors.rotate0),this.previousCursor_=h.style.cursor}else this.center_=In(s);return this.angle_=Math.atan2(this.center_[1]-e.coordinate[1],this.center_[0]-e.coordinate[0]),this.dispatchEvent({type:this.mode_+"start",feature:this.selection_.item(0),features:this.selection_,pixel:e.pixel,coordinate:e.coordinate}),!0}else if(this.get("selection")){if(n){this.addFn_(e)||this.selection_.clear();var u=this.selection_.getArray().indexOf(n);u<0?this.selection_.push(n):this.selection_.removeAt(u)}else this.selection_.clear();return this.ispt_=this.selection_.getLength()===1?this.selection_.item(0).getGeometry().getType()=="Point":!1,this.iscircle_=this.selection_.getLength()===1?this.selection_.item(0).getGeometry().getType()=="Circle":!1,this.drawSketch_(),this.watchFeatures_(),this.dispatchEvent({type:"select",feature:n,features:this.selection_,pixel:e.pixel,coordinate:e.coordinate}),!1}}}getCenter(){return this.get("center")}setCenter(e){return this.set("center",e)}handleDragEvent_(e){if(this._handleEvent(e,this.features_)){var t=this.getMap().getView().getRotation(),n,r,s,o,a=[this.coordinate_[0],this.coordinate_[1]],l=[e.coordinate[0],e.coordinate[1]];switch(this.isUpdating_=!0,this.hasChanged_=!0,this.mode_){case"rotate":{var c=Math.atan2(this.center_[1]-l[1],this.center_[0]-l[0]);if(!this.ispt)for(n=0,s;s=this.selection_.item(n);n++)o=this.geoms_[n].clone(),o.rotate(c-this.angle_,this.center_),o.getType()=="Circle"&&o.setCenterAndRadius(o.getCenter(),o.getRadius()),s.setGeometry(o);this.drawSketch_(!0),this.dispatchEvent({type:"rotating",feature:this.selection_.item(0),features:this.selection_,angle:c-this.angle_,pixel:e.pixel,coordinate:e.coordinate});break}case"translate":{var h=l[0]-a[0],u=l[1]-a[1];for(n=0,s;s=this.selection_.item(n);n++)s.getGeometry().translate(h,u);this.handles_.forEach(function(O){O.getGeometry().translate(h,u)}),this.coordinate_=e.coordinate,this.dispatchEvent({type:"translating",feature:this.selection_.item(0),features:this.selection_,delta:[h,u],pixel:e.pixel,coordinate:e.coordinate});break}case"scale":{var f=this.center_;if(this.get("modifyCenter")(e)){var d=this.extent_;this.get("enableRotatedTransform")&&t!==0&&(d=this.rotatedExtent_),f=d[(Number(this.opt_)+2)%4]}var g=this.geoms_.length==1&&this._isRectangle(this.geoms_[0]),m=this.constraint_,_=this.opt_,v=this.coordinate_,x=e.coordinate;if(this.get("enableRotatedTransform")&&t!==0){var S=new zi(this.coordinate_);S.rotate(t*-1,f),v=S.getCoordinates();var b=new zi(e.coordinate);b.rotate(t*-1,f),x=b.getCoordinates()}var A=(x[0]-f[0])/(v[0]-f[0]),F=(x[1]-f[1])/(v[1]-f[1]),N=[x[0]-v[0],x[1]-v[1]];if(this.get("enableRotatedTransform")&&t!==0){var R=new zi(f);R.rotate(t*-1,this.getMap().getView().getCenter()),f=R.getCoordinates()}this.get("noFlip")&&(A<0&&(A=-A),F<0&&(F=-F)),this.constraint_?this.constraint_=="h"?A=1:F=1:this.get("keepAspectRatio")(e)&&(A=F=Math.min(A,F));var P=this.get("keepAspectRatio")(e);for(n=0,s;s=this.selection_.item(n);n++)o=t===0||!this.get("enableRotatedTransform")?this.geoms_[n].clone():this.rotatedGeoms_[n].clone(),o.applyTransform((function(O,L,T){if(T<2)return L;if(g){var C=[[6],[0,8],[2],[4]],D=[O[0],O[1]],W=[O[2],O[3]],$=[O[4],O[5]],B=[O[6],O[7]],V=[O[8],O[9]];if(m){var te=_%2===0?this._countVector(D,W):this._countVector(B,D),ne=this._projectVectorOnVector(N,te),ae=_+1<C.length?_+1:0,I=[...C[_],...C[ae]];for(r=0;r<O.length;r+=T)L[r]=I.includes(r)?O[r]+ne[0]:O[r],L[r+1]=I.includes(r)?O[r+1]+ne[1]:O[r+1]}else{var U,K,ie;switch(_){case 0:P?(ie=this._snapToDiagonal(B,W,x),N=this._countVector(B,ie)):N=this._countVector(B,x),U=this._projectVectorOnVector(N,this._countVector($,B)),K=this._projectVectorOnVector(N,this._countVector(D,B)),[L[0],L[1]]=this._movePoint(D,U),[L[4],L[5]]=this._movePoint($,K),[L[6],L[7]]=this._movePoint(B,N),[L[8],L[9]]=this._movePoint(V,U);break;case 1:P?(ie=this._snapToDiagonal(D,$,x),N=this._countVector(D,ie)):N=this._countVector(D,x),U=this._projectVectorOnVector(N,this._countVector(B,D)),K=this._projectVectorOnVector(N,this._countVector(W,D)),[L[0],L[1]]=this._movePoint(D,N),[L[2],L[3]]=this._movePoint(W,U),[L[6],L[7]]=this._movePoint(B,K),[L[8],L[9]]=this._movePoint(V,N);break;case 2:P?(ie=this._snapToDiagonal(W,B,x),N=this._countVector(W,ie)):N=this._countVector(W,x),U=this._projectVectorOnVector(N,this._countVector(D,W)),K=this._projectVectorOnVector(N,this._countVector($,W)),[L[0],L[1]]=this._movePoint(D,K),[L[2],L[3]]=this._movePoint(W,N),[L[4],L[5]]=this._movePoint($,U),[L[8],L[9]]=this._movePoint(V,K);break;case 3:P?(ie=this._snapToDiagonal($,D,x),N=this._countVector($,ie)):N=this._countVector($,x),U=this._projectVectorOnVector(N,this._countVector(W,$)),K=this._projectVectorOnVector(N,this._countVector(B,$)),[L[2],L[3]]=this._movePoint(W,K),[L[4],L[5]]=this._movePoint($,N),[L[6],L[7]]=this._movePoint(B,U);break}}}else for(r=0;r<O.length;r+=T)A!=1&&(L[r]=f[0]+(O[r]-f[0])*A),F!=1&&(L[r+1]=f[1]+(O[r+1]-f[1])*F);return o.getType()=="Circle"&&o.setCenterAndRadius(o.getCenter(),o.getRadius()),L}).bind(this)),this.get("enableRotatedTransform")&&t!==0&&o.rotate(t,this.getMap().getView().getCenter()),s.setGeometry(o);this.drawSketch_(),this.dispatchEvent({type:"scaling",feature:this.selection_.item(0),features:this.selection_,scale:[A,F],pixel:e.pixel,coordinate:e.coordinate});break}}this.isUpdating_=!1}}handleMoveEvent_(e){if(this._handleEvent(e,this.features_)&&!this.mode_){var t=this.getFeatureAtPixel_(e.pixel),n=e.map.getTargetElement();if(t.feature){var r=t.handle?this.Cursors[(t.handle||"default")+(t.constraint||"")+(t.option||"")]:this.Cursors.select;this.previousCursor_===void 0&&(this.previousCursor_=n.style.cursor),se.setCursor(n,r)}else this.previousCursor_!==void 0&&se.setCursor(n,this.previousCursor_),this.previousCursor_=void 0}}handleUpEvent_(e){if(this.mode_==="rotate"){var t=e.map.getTargetElement();se.setCursor(t,this.Cursors.default),this.previousCursor_=void 0}return this.dispatchEvent({type:this.mode_+"end",feature:this.selection_.item(0),features:this.selection_,oldgeom:this.geoms_[0],oldgeoms:this.geoms_,transformed:this.hasChanged_}),this.drawSketch_(),this.hasChanged_=!1,this.mode_=null,!1}setPointRadius(e){typeof e=="function"?this._pointRadius=e:this._pointRadius=function(){return e}}getFeatures(){return this.selection_}_projectVectorOnVector(e,t){var n=(e[0]*t[0]+e[1]*t[1])/(t[0]*t[0]+t[1]*t[1]);return[t[0]*n,t[1]*n]}_countVector(e,t){return[t[0]-e[0],t[1]-e[1]]}_movePoint(e,t){return[e[0]+t[0],e[1]+t[1]]}_snapToDiagonal(e,t,n){var r=[e[0]-t[0],e[1]-t[1]],s=[n[0]-t[0],n[1]-t[1]],o=s[0]*r[0]+s[1]*r[1],a=r[0]*r[0]+r[1]*r[1],l=o/a;return[t[0]+r[0]*l,t[1]+r[1]*l]}};iA.prototype.Cursors={default:"auto",select:"pointer",translate:"move",rotate:"move",rotate0:"move",scale:"nesw-resize",scale1:"nwse-resize",scale2:"nesw-resize",scale3:"nwse-resize",scalev:"ew-resize",scaleh1:"ns-resize",scalev2:"ew-resize",scaleh3:"ns-resize"};var yk=class extends ql{constructor(e){e=e||{},super({handleEvent:function(t){return t.type=="pointermove"&&this.handleMove_(t),!0}}),this.maps=e.maps||[],e.active===!1&&this.setActive(!1)}setMap(e){this._listener&&(Er(this._listener.center),Er(this._listener.rotation),Er(this._listener.resolution),this.getMap().getTargetElement().removeEventListener("mouseout",this._listener.mouseout)),this._listener=null,super.setMap(e),e&&(this._listener={},this._listener.center=this.getMap().getView().on("change:center",this.syncMaps.bind(this)),this._listener.rotation=this.getMap().getView().on("change:rotation",this.syncMaps.bind(this)),this._listener.resolution=this.getMap().getView().on("change:resolution",this.syncMaps.bind(this)),this._listener.mouseout=this.handleMouseOut_.bind(this),this.getMap().getTargetElement()&&this.getMap().getTargetElement().addEventListener("mouseout",this._listener.mouseout),this.syncMaps())}setActive(e){super.setActive(e),this.syncMaps()}syncMaps(){if(this.getActive()){var e=this.getMap();if(e){if(e.get("lockView"))return;for(var t=0;t<this.maps.length;t++)this.maps[t].set("lockView",!0),this.maps[t].getView().getRotation()!=e.getView().getRotation()&&this.maps[t].getView().setRotation(e.getView().getRotation()),this.maps[t].getView().getCenter()!=e.getView().getCenter()&&this.maps[t].getView().setCenter(e.getView().getCenter()),this.maps[t].getView().getResolution()!=e.getView().getResolution()&&this.maps[t].getView().setResolution(e.getView().getResolution()),this.maps[t].set("lockView",!1)}}}handleMove_(e){for(var t=0;t<this.maps.length;t++)this.maps[t].showTarget(e.coordinate);this.getMap().showTarget()}handleMouseOut_(){for(var e=0;e<this.maps.length;e++)this.maps[e]._targetOverlay&&this.maps[e]._targetOverlay.setPosition(void 0)}};Kc.prototype.showTarget=function(i){if(!this._targetOverlay){var e=document.createElement("div");e.classList.add("ol-target"),this._targetOverlay=new RL({element:e}),this._targetOverlay.setPositioning("center-center"),this.addOverlay(this._targetOverlay),e.parentElement.classList.add("ol-target-overlay"),this._targetOverlay.setPosition([0,0])}this._targetOverlay.setPosition(i)};Kc.prototype.hideTarget=function(){this.removeOverlay(this._targetOverlay),this._targetOverlay=void 0};var Wa=class extends Yr{constructor(e){e=e||{},super(),this.duration_=typeof e.duration=="number"?e.duration>=0?e.duration:0:1e3,this.fade_=typeof e.fade=="function"?e.fade:null,this.repeat_=Number(e.repeat);var t=typeof e.easing=="function"?e.easing:rL;e.revers?this.easing_=function(n){return 1-t(n)}:this.easing_=t,this.hiddenStyle=e.hiddenStyle}drawGeom_(e,t,n){var r={type:"drawing",time:e.time,feature:e.feature,start:e.start,stop:e.stop,rotation:e.rotation,style:e.style,extra:e.extra};this.dispatchEvent(r);var s=r.style instanceof Array?r.style:[r.style];this.fade_&&(e.context.globalAlpha=this.fade_(1-e.elapsed));for(var o=0;o<s.length;o++)try{var a=e.vectorContext||qm(e),l=$y(e,s[o]);a.setStyle(l),l.getZIndex()<0?a.drawGeometry(n||t):a.drawGeometry(t)}catch{}}animate(){return!1}};Wa.hiddenStyle=new Li({image:new $l({}),stroke:new xn({color:"transparent"})});Kc.prototype.animateFeature=function(i,e){var t=this._featureAnimationLayer;t||(t=this._featureAnimationLayer=new ao({source:new Ko}),t.setMap(this)),t.getSource().addFeature(i);var n=e.on("animationend",function(r){r.feature===i&&(t.getSource().removeFeature(i),Er(n))});return t.animateFeature(i,e)};_x.prototype.animateFeature=function(i,e,t){var n=this,r,s=i.getStyle(),o=s||(this.getStyleFunction?this.getStyleFunction()(i):null);o||(o=[]),o instanceof Array||(o=[o]);var a={vectorContext:null,frameState:null,start:0,time:0,elapsed:0,extent:!1,feature:i,geom:i.getGeometry(),typeGeom:i.getGeometry().getType(),bbox:i.getGeometry().getExtent(),coord:In(i.getGeometry().getExtent()),style:o};e instanceof Array||(e=[e]);for(var l=e.length-1;l>=0;l--)e[l].duration_===0&&e.splice(l,1);var c=0,h=0,u=t&&this.getFilters?this.getFilters():[];function f(m){a.type=m.type;try{a.vectorContext=m.vectorContext||qm(m)}catch{}if(a.frameState=m.frameState,a.inversePixelTransform=m.inversePixelTransform,a.extent||(a.extent=m.frameState.extent,a.start=m.frameState.time,a.context=m.context),a.time=m.frameState.time-a.start,a.elapsed=a.time/e[h].duration_,a.elapsed>1&&(a.elapsed=1),m.context.save(),u.forEach(function(v){v.get("active")&&v.precompose(m)}),this.getOpacity&&(m.context.globalAlpha=this.getOpacity()),!e[h].animate(a))c++,c<e[h].repeat_?(a.extent=!1,e[h].dispatchEvent({type:"animationrepeat",feature:i})):h<e.length-1?(e[h].dispatchEvent({type:"animationend",feature:i}),h++,c=0,a.extent=!1):d();else{var _={type:"animating",step:h,start:a.start,time:a.time,elapsed:a.elapsed,rotation:a.rotation||0,geom:a.geom,coordinate:a.coord,feature:i,extra:a.extra||{},style:o};e[h].dispatchEvent(_),n.dispatchEvent(_)}u.forEach(function(v){v.get("active")&&v.postcompose(m)}),m.context.restore(),m.frameState.animate=!0}function d(m){Er(r),r=null,i.setStyle(s),a.stop=new Date().getTime();var _={type:"animationend",feature:i};if(m)for(var v in m)m.hasOwnProperty(v)&&(_[v]=m[v]);e[h].dispatchEvent(_),n.dispatchEvent(_)}function g(m){if(e.length&&!r){if(a.stop&&(a.start=new Date().getTime()-a.stop+a.start,a.stop=0),r=n.on(["postcompose","postrender"],f.bind(n)),n.renderSync)try{n.renderSync()}catch{}else n.changed();i.setStyle(e[h].hiddenStyle||Wa.hiddenStyle);var _={type:"animationstart",feature:i};if(m)for(var v in m)m.hasOwnProperty(v)&&(_[v]=m[v]);e[h].dispatchEvent(_),n.dispatchEvent(_)}}return g(),{start:g,stop:d,isPlaying:function(){return!!r}}};var vk=class extends Wa{constructor(e){e=e||{},super(e),this.speed_=e.speed||0,this.side_=e.side||"top"}animate(e){if(!e.time){var t=e.frameState.viewState.rotation,n=e.frameState.size[1]*e.frameState.viewState.resolution;this.side_!="top"&&(n*=-1),this.dx=-Math.sin(t)*n,this.dy=Math.cos(t)*n,this.speed_&&(this.duration_=n/this.speed_/e.frameState.viewState.resolution)}var r=e.geom.clone();return r.translate(this.dx*(1-this.easing_(e.elapsed)),this.dy*(1-this.easing_(e.elapsed))),this.drawGeom_(e,r,e.geom),e.time<=this.duration_}},xk=class extends Wa{constructor(e){e=e||{},super(e),this.speed_=e.speed||0}animate(e){return e.context.globalAlpha=this.easing_(e.elapsed),this.drawGeom_(e,e.geom),e.time<=this.duration_}},wk=class extends Wa{constructor(e){switch(e=e||{},super(e),this.speed_=e.speed||0,this.path_=e.path,e.rotate){case!0:case 0:this.rotate_=0;break;default:this.rotate_=e.rotate||!1;break}this.path_&&this.path_.getGeometry&&(this.path_=this.path_.getGeometry()),this.path_&&this.path_.getLineString&&(this.path_=this.path_.getLineString()),this.path_.getLength?(this.dist_=this.path_.getLength(),this.path_&&this.path_.getCoordinates&&(this.path_=this.path_.getCoordinates())):this.dist_=0,this.speed_>0&&(this.duration_=this.dist_/this.speed_)}animate(e){if(!e.time&&!this.dist_)return!1;var t=this.dist_*this.easing_(e.elapsed),n,r,s,o,a,l,c=0;r=this.path_[0];for(var h=1;h<this.path_.length;h++){if(n=r,r=this.path_[h],o=r[0]-n[0],a=r[1]-n[1],l=Math.sqrt(o*o+a*a),l&&c+l>=t){e.extra={index:h,coordinates:r},s=(t-c)/l,r=[n[0]+(r[0]-n[0])*s,n[1]+(r[1]-n[1])*s];break}c+=l}var u=e.style;if(e.rotation=Math.PI/2+Math.atan2(n[1]-r[1],n[0]-r[0]),this.rotate_!==!1){var f=[],d=this.rotate_-e.rotation+e.frameState.viewState.rotation;e.rotation=Math.PI/2+Math.atan2(n[1]-r[1],n[0]-r[0]);for(var g=0;s=e.style[g];g++)s.getImage()&&s.getImage().setRotation(d),f.push(s);e.style=f}return e.geom.setCoordinates(r),this.drawGeom_(e,e.geom),e.style=u,e.time<=this.duration_}},bk=class extends Wa{constructor(e){e=e||{},super(e),this.amplitude_=e.amplitude||40,this.bounce_=-Math.PI*(e.bounce||6),this.horizontal_=e.horizontal}animate(e){var t=e.geom.clone(),n=e.geom.clone(),r=this.easing_(e.elapsed);return r=Math.sin(this.bounce_*r)*this.amplitude_*(1-r)*e.frameState.viewState.resolution,this.horizontal_?(t.translate(r,0),n.translate(r,0)):t.translate(0,r),this.drawGeom_(e,t,n),e.time<=this.duration_}},Ek=class extends Wa{constructor(e){e=e||{},super(e),this.speed_=e.speed||0,this.side_=e.side||"left"}animate(e){e.time||(this.side_=="left"?this.dx=e.extent[0]-e.bbox[2]:this.dx=e.extent[2]-e.bbox[0],this.speed_&&(this.duration_=Math.abs(this.dx)/this.speed_/e.frameState.viewState.resolution));var t=e.geom.clone();return t.translate(this.dx*(1-this.easing_(e.elapsed)),0),this.drawGeom_(e,t),e.time<=this.duration_}},Sk=class extends Wa{constructor(e){super(e)}animate(e){var t=this.easing_(e.elapsed);if(t){e.context.save();var n=e.frameState.pixelRatio;e.context.globalAlpha=t,e.context.scale(t,1/t);var r=e.frameState.coordinateToPixelTransform,s=(1/t-1)*n*(r[0]*e.coord[0]+r[1]*e.coord[1]+r[4]),o=(t-1)*n*(r[2]*e.coord[0]+r[3]*e.coord[1]+r[5]);e.context.translate(s,o),this.drawGeom_(e,e.geom),e.context.restore()}return e.time<=this.duration_}},Tk=class extends Wa{constructor(e){e=e||{},super(e),this.set("zoomout",e.zoomOut)}animate(e){var t=this.easing_(e.elapsed);if(t){this.get("zoomout")&&(t=1/t);var n=e.style,r,s,o=[];for(r=0;r<n.length;r++)s=n[r].getImage(),s&&(o[r]=s.getScale(),e.type==="postrender"?s.setScale(o[r]*t/e.frameState.pixelRatio):s.setScale(o[r]*t));for(this.drawGeom_(e,e.geom),r=0;r<n.length;r++)s=n[r].getImage(),s&&s.setScale(o[r])}return e.time<=this.duration_}};function h5(i,e){return nA(i,e,[]).join("")}function nA(i,e,t){if(i.nodeType==Node.CDATA_SECTION_NODE||i.nodeType==Node.TEXT_NODE)t.push(i.nodeValue);else{let n;for(n=i.firstChild;n;n=n.nextSibling)nA(n,e,t)}return t}function Lk(i){return"documentElement"in i}function Ck(i){return new DOMParser().parseFromString(i,"application/xml")}function Ky(i,e){return(function(t,n){const r=i.call(this,t,n);r!==void 0&&n[n.length-1].push(r)})}function Vr(i,e,t){return(function(n,r){const s=i.call(this,n,r);if(s!==void 0){const o=r[r.length-1],a=n.localName;let l;a in o?l=o[a]:(l=[],o[a]=l),l.push(s)}})}function ut(i,e,t){return(function(n,r){const s=i.call(this,n,r);if(s!==void 0){const o=r[r.length-1],a=n.localName;o[a]=s}})}function yi(i,e,t){t=t!==void 0?t:{};let n,r;for(n=0,r=i.length;n<r;++n)t[i[n]]=e;return t}function Ak(i,e,t,n){let r;for(r=e.firstElementChild;r;r=r.nextElementSibling){const s=i[r.namespaceURI];if(s!==void 0){const o=s[r.localName];o!==void 0&&o.call(n,r,t)}}}function Gi(i,e,t,n,r){return n.push(i),Ak(e,t,n,r),n.pop()}function Pk(i){const e=h5(i,!1);return Mk(e)}function Mk(i){const e=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(i);if(e)return parseFloat(e[1])}function Cl(i){const e=h5(i,!1);return Rk(e)}function Rk(i){const e=/^\s*(\d+)\s*$/.exec(i);if(e)return parseInt(e[1],10)}function ei(i){return h5(i,!1).trim()}class rA{read(e){if(!e)return null;if(typeof e=="string"){const t=Ck(e);return this.readFromDocument(t)}return Lk(e)?this.readFromDocument(e):this.readFromNode(e)}readFromDocument(e){for(let t=e.firstChild;t;t=t.nextSibling)if(t.nodeType==Node.ELEMENT_NODE)return this.readFromNode(t);return null}readFromNode(e){Kt()}}const Ik="http://www.w3.org/1999/xlink";function u5(i){return i.getAttributeNS(Ik,"href")}const Zr=[null,"http://www.opengis.net/ows/1.1"],Nk=yi(Zr,{ServiceIdentification:ut(r9),ServiceProvider:ut(o9),OperationsMetadata:ut(i9)});class Fk extends rA{constructor(){super()}readFromNode(e){const t=Gi({},Nk,e,[]);return t||null}}const Ok=yi(Zr,{DeliveryPoint:ut(ei),City:ut(ei),AdministrativeArea:ut(ei),PostalCode:ut(ei),Country:ut(ei),ElectronicMailAddress:ut(ei)}),Dk=yi(Zr,{Value:Vr(a9)}),kk=yi(Zr,{AllowedValues:ut(Kk)}),Gk=yi(Zr,{Phone:ut(n9),Address:ut(Xk)}),Bk=yi(Zr,{HTTP:ut(e9)}),jk=yi(Zr,{Get:Vr(Qk),Post:void 0}),Uk=yi(Zr,{DCP:ut(Jk)}),zk=yi(Zr,{Operation:t9}),qk=yi(Zr,{Voice:ut(ei),Facsimile:ut(ei)}),Vk=yi(Zr,{Constraint:Vr(Yk)}),$k=yi(Zr,{IndividualName:ut(ei),PositionName:ut(ei),ContactInfo:ut(Zk)}),Wk=yi(Zr,{Abstract:ut(ei),AccessConstraints:ut(ei),Fees:ut(ei),Title:ut(ei),ServiceTypeVersion:ut(ei),ServiceType:ut(ei)}),Hk=yi(Zr,{ProviderName:ut(ei),ProviderSite:ut(u5),ServiceContact:ut(s9)});function Xk(i,e){return Gi({},Ok,i,e)}function Kk(i,e){return Gi({},Dk,i,e)}function Yk(i,e){const t=i.getAttribute("name");if(t)return Gi({name:t},kk,i,e)}function Zk(i,e){return Gi({},Gk,i,e)}function Jk(i,e){return Gi({},Bk,i,e)}function Qk(i,e){const t=u5(i);if(t)return Gi({href:t},Vk,i,e)}function e9(i,e){return Gi({},jk,i,e)}function t9(i,e){const t=i.getAttribute("name"),n=Gi({},Uk,i,e);if(!n)return;const r=e[e.length-1];r[t]=n}function i9(i,e){return Gi({},zk,i,e)}function n9(i,e){return Gi({},qk,i,e)}function r9(i,e){return Gi({},Wk,i,e)}function s9(i,e){return Gi({},$k,i,e)}function o9(i,e){return Gi({},Hk,i,e)}function a9(i,e){return ei(i)}const Yo=[null,"http://www.opengis.net/wmts/1.0"],qu=[null,"http://www.opengis.net/ows/1.1"],l9=yi(Yo,{Contents:ut(v9)});class c9 extends rA{constructor(){super(),this.owsParser_=new Fk}readFromNode(e){let t=e.getAttribute("version");t&&(t=t.trim());let n=this.owsParser_.readFromNode(e);return n?(n.version=t,n=Gi(n,l9,e,[]),n||null):null}}const h9=yi(Yo,{Layer:Vr(x9),TileMatrixSet:Vr(w9)}),u9=yi(Yo,{Style:Vr(b9),Format:Vr(ei),TileMatrixSetLink:Vr(E9),Dimension:Vr(S9),ResourceURL:Vr(T9)},yi(qu,{Title:ut(ei),Abstract:ut(ei),WGS84BoundingBox:ut(oA),BoundingBox:Vr(L9),Identifier:ut(ei)})),f9=yi(Yo,{LegendURL:Vr(C9)},yi(qu,{Title:ut(ei),Identifier:ut(ei)})),d9=yi(Yo,{TileMatrixSet:ut(ei),TileMatrixSetLimits:ut(P9)}),g9=yi(Yo,{TileMatrixLimits:Ky(M9)}),p9=yi(Yo,{TileMatrix:ut(ei),MinTileRow:ut(Cl),MaxTileRow:ut(Cl),MinTileCol:ut(Cl),MaxTileCol:ut(Cl)}),m9=yi(Yo,{Default:ut(ei),Value:Vr(ei)},yi(qu,{Identifier:ut(ei)})),sA=yi(qu,{LowerCorner:Ky(Yy),UpperCorner:Ky(Yy)}),_9=yi(Yo,{WellKnownScaleSet:ut(ei),TileMatrix:Vr(A9)},yi(qu,{SupportedCRS:ut(ei),Identifier:ut(ei),BoundingBox:ut(oA)})),y9=yi(Yo,{TopLeftCorner:ut(Yy),ScaleDenominator:ut(Pk),TileWidth:ut(Cl),TileHeight:ut(Cl),MatrixWidth:ut(Cl),MatrixHeight:ut(Cl)},yi(qu,{Identifier:ut(ei)}));function v9(i,e){return Gi({},h9,i,e)}function x9(i,e){return Gi({},u9,i,e)}function w9(i,e){return Gi({},_9,i,e)}function b9(i,e){const t=Gi({},f9,i,e);if(!t)return;const n=i.getAttribute("isDefault")==="true";return t.isDefault=n,t}function E9(i,e){return Gi({},d9,i,e)}function S9(i,e){return Gi({},m9,i,e)}function T9(i,e){const t=i.getAttribute("format"),n=i.getAttribute("template"),r=i.getAttribute("resourceType"),s={};return t&&(s.format=t),n&&(s.template=n),r&&(s.resourceType=r),s}function oA(i,e){const t=Gi([],sA,i,e);if(t.length==2)return Ui(t)}function L9(i,e){const t=i.getAttribute("crs"),n=Gi([],sA,i,e);if(n.length==2)return{extent:Ui(n),crs:t}}function C9(i,e){const t={};return t.format=i.getAttribute("format"),t.href=u5(i),t}function Yy(i,e){const t=ei(i).split(/\s+/);if(!t||t.length!=2)return;const n=+t[0],r=+t[1];if(!(isNaN(n)||isNaN(r)))return[n,r]}function A9(i,e){return Gi({},y9,i,e)}function P9(i,e){return Gi([],g9,i,e)}function M9(i,e){return Gi({},p9,i,e)}const aA=et({__name:"OlFeature",props:{properties:{}},setup(i,{expose:e}){const t=i,n=ft("vectorSource"),r=ft("vectorLayer",null),o=ft("heatmapLayer",null)||r,a=ft("animation",null),l=Zi(new wi({...t.properties}));return ti(()=>t.properties,c=>{c instanceof Zv?(l.value.setGeometry(c),l.value.setProperties({})):typeof c<"u"?(l.value.setGeometry(void 0),l.value.setProperties(c)):(l.value.setGeometry(void 0),l.value.setProperties({}))}),ti(()=>n,(c,h)=>{h?.value?.removeFeature(l.value),c?.value?.addFeature(l.value),c?.value?.changed()}),Ji(()=>{a?.value&&o?.value?.animateFeature(l.value,a.value),pd(()=>{n?.value?.addFeature(l.value)})}),cn(()=>{n?.value?.removeFeature(l.value)}),fi("feature",l),fi("stylable",l),e({feature:l}),(c,h)=>qt(c.$slots,"default")}});function R9(i){if("styles"in i){const{styles:e,...t}=Hd(Wd(i));return{style:e,...t}}else return i}function Nn(i){const e=_m();let t={debug:!1};e&&(t=ft("ol-options",t));const n=R9(i),r=Wd(n);return t?.debug&&console.debug("[Vue3-OpenLayers Debug] PROPS",{in:i,out:r}),r}const lA=["change","error","propertychange"],I9=["change:extent","change:maxResolution","change:maxZoom","change:minResolution","change:minZoom","change:opacity","change:source","change:visible","change:zIndex","postrender","prerender","sourceready"],N9=["tileloadend","tileloaderror","tileloadstart"],F9=["imageloadend","imageloaderror","imageloadstart"],cA=["addfeature","changefeature","clear","featuresloadend","featuresloaderror","featuresloadstart","removefeature"];function Jr(i,e){const t=_m();let n={debug:!1};t&&(n=ft("ol-options",n));function r(){[...lA,...e].forEach(s=>{let o;Yn(i)?o=i.value:o=i,o.on(s,(...a)=>{n?.debug&&console.debug("[Vue3-OpenLayers Debug] EVENT",s,{eventName:s,args:a,source:i}),t?.emit(s,...a)})})}return t&&Ji(()=>{r()}),{updateOpenLayersEventHandlers:r}}const hA=et({inheritAttrs:!1,__name:"OlGeoLocation",props:{tracking:{type:Boolean,default:!0},trackingOptions:{default:()=>({enableHighAccuracy:!0})},projection:{default:"EPSG:3857"}},emits:["change","error","propertychange","change:accuracy","change:accuracyGeometry","change:altitude","change:altitudeAccuracy","change:heading","change:position","change:projection","change:speed","change:tracking","change:trackingOptions"],setup(i,{expose:e}){const n=Nn(i),r=qi(()=>new lN(n));Jr(r,["change:accuracy","change:accuracyGeometry","change:altitude","change:altitudeAccuracy","change:heading","change:position","change:projection","change:speed","change:tracking","change:trackingOptions"]);const s=Zi([]),o=Zi(0),a=Zi(0),l=Zi(0),c=Zi(0),h=Zi(0),u=Zi(null);return e({geoLoc:r,position:s,accuracy:o,altitude:a,altitudeAccuracy:l,speed:c,heading:h,accuracyGeometry:u}),(f,d)=>qt(f.$slots,"default",{position:s.value,speed:c.value,heading:h.value,accuracy:o.value,altitude:a.value,altitudeAccuracy:l.value,accuracyGeometry:u.value})}});function O9(i,e){for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==void 0&&(i[t]=e[t]);return i}const uA=et({__name:"OlMap",props:{controls:{},pixelRatio:{},interactions:{},keyboardEventTarget:{},layers:{},maxTilesLoading:{},moveTolerance:{},overlays:{},target:{},view:{},instance:{}},emits:["change","error","propertychange","change:layerGroup","change:size","change:target","change:view","click","dblclick","singleclick","loadstart","loadend","pointerdrag","pointermove","movestart","moveend","postrender","precompose","postcompose","rendercomplete"],setup(i,{expose:e,emit:t}){const n=i,r=t,s=Nn({...n,instance:void 0}),o=Zi(void 0);let a=n.instance||new Kc({...s});ti(s,()=>{const f=n.instance?O9(s,n.instance.getProperties()):s;a?.setProperties(f)},{immediate:!0}),Ji(()=>{n.instance||a?.setTarget(o.value)}),Av(()=>{n.instance||a?.setTarget(void 0)}),cn(()=>{a=void 0}),fi("map",a);const l=(f,d,g)=>a?.forEachFeatureAtPixel(f,d,g),c=f=>a?.getCoordinateFromPixel(f),h=()=>a?.render(),u=()=>a?.updateSize();return a.on("change",f=>r("change",f)),a.on("error",f=>r("error",f)),a.on("propertychange",f=>r("propertychange",f)),a.on("click",f=>r("click",f)),a.on("change:size",f=>r("change:size",f)),a.on("change:target",f=>r("change:target",f)),a.on("change:view",f=>r("change:view",f)),a.on("dblclick",f=>r("dblclick",f)),a.on("singleclick",f=>r("singleclick",f)),a.on("pointerdrag",f=>r("pointerdrag",f)),a.on("pointermove",f=>r("pointermove",f)),a.on("movestart",f=>r("movestart",f)),a.on("moveend",f=>r("moveend",f)),a.on("postrender",f=>r("postrender",f)),a.on("precompose",f=>r("precompose",f)),a.on("postcompose",f=>r("postcompose",f)),a.on("rendercomplete",f=>r("rendercomplete",f)),a.on("loadstart",f=>{a?.getTargetElement().classList.add("ol-map"),a?.getTargetElement().classList.add("ol-map-loading"),a?.getTargetElement().classList.remove("ol-map-fully-loaded"),r("loadstart",f)}),a.on("loadend",f=>{a?.getTargetElement().classList.add("ol-map-fully-loaded"),a?.getTargetElement().classList.remove("ol-map-loading"),r("loadend",f)}),e({map:a,mapRef:o,forEachFeatureAtPixel:l,getCoordinateFromPixel:c,render:h,updateSize:u}),(f,d)=>(vt(),Yt("div",{ref_key:"mapRef",ref:o},[qt(f.$slots,"default")],512))}}),fA=et({inheritAttrs:!1,__name:"OlOverlay",props:{id:{},element:{},offset:{},position:{},positioning:{},stopEvent:{type:Boolean,default:!0},insertFirst:{type:Boolean,default:!0},autoPan:{type:[Boolean,Object]},className:{}},emits:["change","error","propertychange","change:element","change:map","change:offset","change:position","change:positioning"],setup(i,{expose:e}){const t=i,n=ft("map"),r=Zi(),s=Nn(t),o=za(new RL(s));Jr(o,["change:element","change:map","change:offset","change:position","change:positioning"]);const a=()=>o.value.getOffset(),l=()=>o.value.getPosition(),c=()=>o.value.getPositioning(),h=_=>o.value.panIntoView(_),u=_=>o.value.setElement(_),f=_=>o.value.setOffset(_),d=_=>o.value.setPosition(_),g=_=>o.value.setPositioning(_);function m(_){n?.removeOverlay(_)||console.warn("couldn't find matching overlay to remove",o.value)}return Ji(()=>{n?.addOverlay(o.value)}),cn(()=>m(o.value)),ti(()=>s,_=>{for(const v in _){const x=v;_[x]!==void 0&&o.value.set(v,_[x])}},{deep:!0}),GI(()=>{u(r.value)},{flush:"post"}),e({overlay:o,htmlContent:r,getOffset:a,getPosition:l,getPositioning:c,panIntoView:h,setElement:u,setOffset:f,setPosition:d,setPositioning:g}),(_,v)=>(vt(),Yt("div",{ref_key:"htmlContent",ref:r},[qt(_.$slots,"default",{position:_.position})],512))}});function D9(i){i("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),i("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),i("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");for(var e=1;e<=60;++e)i("EPSG:"+(32600+e),"+proj=utm +zone="+e+" +datum=WGS84 +units=m"),i("EPSG:"+(32700+e),"+proj=utm +zone="+e+" +south +datum=WGS84 +units=m");i.WGS84=i["EPSG:4326"],i["EPSG:3785"]=i["EPSG:3857"],i.GOOGLE=i["EPSG:3857"],i["EPSG:900913"]=i["EPSG:3857"],i["EPSG:102113"]=i["EPSG:3857"]}var Gc=1,Bc=2,pu=3,k9=4,Zy=5,ME=6378137,G9=6356752314e-3,RE=.0066943799901413165,rd=484813681109536e-20,De=Math.PI/2,B9=.16666666666666666,j9=.04722222222222222,U9=.022156084656084655,Ve=1e-10,sr=.017453292519943295,Do=57.29577951308232,mi=Math.PI/4,Bd=Math.PI*2,pn=3.14159265359,Qr={};Qr.greenwich=0;Qr.lisbon=-9.131906111111;Qr.paris=2.337229166667;Qr.bogota=-74.080916666667;Qr.madrid=-3.687938888889;Qr.rome=12.452333333333;Qr.bern=7.439583333333;Qr.jakarta=106.807719444444;Qr.ferro=-17.666666666667;Qr.brussels=4.367975;Qr.stockholm=18.058277777778;Qr.athens=23.7163375;Qr.oslo=10.722916666667;const z9={mm:{to_meter:.001},cm:{to_meter:.01},ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937},fath:{to_meter:1.8288},kmi:{to_meter:1852},"us-ch":{to_meter:20.1168402336805},"us-mi":{to_meter:1609.34721869444},km:{to_meter:1e3},"ind-ft":{to_meter:.30479841},"ind-yd":{to_meter:.91439523},mi:{to_meter:1609.344},yd:{to_meter:.9144},ch:{to_meter:20.1168},link:{to_meter:.201168},dm:{to_meter:.1},in:{to_meter:.0254},"ind-ch":{to_meter:20.11669506},"us-in":{to_meter:.025400050800101},"us-yd":{to_meter:.914401828803658}};var IE=/[\s_\-\/\(\)]/g;function kl(i,e){if(i[e])return i[e];for(var t=Object.keys(i),n=e.toLowerCase().replace(IE,""),r=-1,s,o;++r<t.length;)if(s=t[r],o=s.toLowerCase().replace(IE,""),o===n)return i[s]}function Jy(i){var e={},t=i.split("+").map(function(a){return a.trim()}).filter(function(a){return a}).reduce(function(a,l){var c=l.split("=");return c.push(!0),a[c[0].toLowerCase()]=c[1],a},{}),n,r,s,o={proj:"projName",datum:"datumCode",rf:function(a){e.rf=parseFloat(a)},lat_0:function(a){e.lat0=a*sr},lat_1:function(a){e.lat1=a*sr},lat_2:function(a){e.lat2=a*sr},lat_ts:function(a){e.lat_ts=a*sr},lon_0:function(a){e.long0=a*sr},lon_1:function(a){e.long1=a*sr},lon_2:function(a){e.long2=a*sr},alpha:function(a){e.alpha=parseFloat(a)*sr},gamma:function(a){e.rectified_grid_angle=parseFloat(a)*sr},lonc:function(a){e.longc=a*sr},x_0:function(a){e.x0=parseFloat(a)},y_0:function(a){e.y0=parseFloat(a)},k_0:function(a){e.k0=parseFloat(a)},k:function(a){e.k0=parseFloat(a)},a:function(a){e.a=parseFloat(a)},b:function(a){e.b=parseFloat(a)},r:function(a){e.a=e.b=parseFloat(a)},r_a:function(){e.R_A=!0},zone:function(a){e.zone=parseInt(a,10)},south:function(){e.utmSouth=!0},towgs84:function(a){e.datum_params=a.split(",").map(function(l){return parseFloat(l)})},to_meter:function(a){e.to_meter=parseFloat(a)},units:function(a){e.units=a;var l=kl(z9,a);l&&(e.to_meter=l.to_meter)},from_greenwich:function(a){e.from_greenwich=a*sr},pm:function(a){var l=kl(Qr,a);e.from_greenwich=(l||parseFloat(a))*sr},nadgrids:function(a){a==="@null"?e.datumCode="none":e.nadgrids=a},axis:function(a){var l="ewnsud";a.length===3&&l.indexOf(a.substr(0,1))!==-1&&l.indexOf(a.substr(1,1))!==-1&&l.indexOf(a.substr(2,1))!==-1&&(e.axis=a)},approx:function(){e.approx=!0}};for(n in t)r=t[n],n in o?(s=o[n],typeof s=="function"?s(r):e[s]=r):e[n]=r;return typeof e.datumCode=="string"&&e.datumCode!=="WGS84"&&(e.datumCode=e.datumCode.toLowerCase()),e}class dA{static getId(e){const t=e.find(n=>Array.isArray(n)&&n[0]==="ID");return t&&t.length>=3?{authority:t[1],code:parseInt(t[2],10)}:null}static convertUnit(e,t="unit"){if(!e||e.length<3)return{type:t,name:"unknown",conversion_factor:null};const n=e[1],r=parseFloat(e[2])||null,s=e.find(a=>Array.isArray(a)&&a[0]==="ID"),o=s?{authority:s[1],code:parseInt(s[2],10)}:null;return{type:t,name:n,conversion_factor:r,id:o}}static convertAxis(e){const t=e[1]||"Unknown";let n;const r=t.match(/^\((.)\)$/);if(r){const c=r[1].toUpperCase();if(c==="E")n="east";else if(c==="N")n="north";else if(c==="U")n="up";else throw new Error(`Unknown axis abbreviation: ${c}`)}else n=e[2]?e[2].toLowerCase():"unknown";const s=e.find(c=>Array.isArray(c)&&c[0]==="ORDER"),o=s?parseInt(s[1],10):null,a=e.find(c=>Array.isArray(c)&&(c[0]==="LENGTHUNIT"||c[0]==="ANGLEUNIT"||c[0]==="SCALEUNIT")),l=this.convertUnit(a);return{name:t,direction:n,unit:l,order:o}}static extractAxes(e){return e.filter(t=>Array.isArray(t)&&t[0]==="AXIS").map(t=>this.convertAxis(t)).sort((t,n)=>(t.order||0)-(n.order||0))}static convert(e,t={}){switch(e[0]){case"PROJCRS":t.type="ProjectedCRS",t.name=e[1],t.base_crs=e.find(f=>Array.isArray(f)&&f[0]==="BASEGEOGCRS")?this.convert(e.find(f=>Array.isArray(f)&&f[0]==="BASEGEOGCRS")):null,t.conversion=e.find(f=>Array.isArray(f)&&f[0]==="CONVERSION")?this.convert(e.find(f=>Array.isArray(f)&&f[0]==="CONVERSION")):null;const n=e.find(f=>Array.isArray(f)&&f[0]==="CS");n&&(t.coordinate_system={type:n[1],axis:this.extractAxes(e)});const r=e.find(f=>Array.isArray(f)&&f[0]==="LENGTHUNIT");if(r){const f=this.convertUnit(r);t.coordinate_system.unit=f}t.id=this.getId(e);break;case"BASEGEOGCRS":case"GEOGCRS":t.type="GeographicCRS",t.name=e[1];const s=e.find(f=>Array.isArray(f)&&(f[0]==="DATUM"||f[0]==="ENSEMBLE"));if(s){const f=this.convert(s);s[0]==="ENSEMBLE"?t.datum_ensemble=f:t.datum=f;const d=e.find(g=>Array.isArray(g)&&g[0]==="PRIMEM");d&&d[1]!=="Greenwich"&&(f.prime_meridian={name:d[1],longitude:parseFloat(d[2])})}t.coordinate_system={type:"ellipsoidal",axis:this.extractAxes(e)},t.id=this.getId(e);break;case"DATUM":t.type="GeodeticReferenceFrame",t.name=e[1],t.ellipsoid=e.find(f=>Array.isArray(f)&&f[0]==="ELLIPSOID")?this.convert(e.find(f=>Array.isArray(f)&&f[0]==="ELLIPSOID")):null;break;case"ENSEMBLE":t.type="DatumEnsemble",t.name=e[1],t.members=e.filter(f=>Array.isArray(f)&&f[0]==="MEMBER").map(f=>({type:"DatumEnsembleMember",name:f[1],id:this.getId(f)}));const o=e.find(f=>Array.isArray(f)&&f[0]==="ENSEMBLEACCURACY");o&&(t.accuracy=parseFloat(o[1]));const a=e.find(f=>Array.isArray(f)&&f[0]==="ELLIPSOID");a&&(t.ellipsoid=this.convert(a)),t.id=this.getId(e);break;case"ELLIPSOID":t.type="Ellipsoid",t.name=e[1],t.semi_major_axis=parseFloat(e[2]),t.inverse_flattening=parseFloat(e[3]),e.find(f=>Array.isArray(f)&&f[0]==="LENGTHUNIT")&&this.convert(e.find(f=>Array.isArray(f)&&f[0]==="LENGTHUNIT"),t);break;case"CONVERSION":t.type="Conversion",t.name=e[1],t.method=e.find(f=>Array.isArray(f)&&f[0]==="METHOD")?this.convert(e.find(f=>Array.isArray(f)&&f[0]==="METHOD")):null,t.parameters=e.filter(f=>Array.isArray(f)&&f[0]==="PARAMETER").map(f=>this.convert(f));break;case"METHOD":t.type="Method",t.name=e[1],t.id=this.getId(e);break;case"PARAMETER":t.type="Parameter",t.name=e[1],t.value=parseFloat(e[2]),t.unit=this.convertUnit(e.find(f=>Array.isArray(f)&&(f[0]==="LENGTHUNIT"||f[0]==="ANGLEUNIT"||f[0]==="SCALEUNIT"))),t.id=this.getId(e);break;case"BOUNDCRS":t.type="BoundCRS";const l=e.find(f=>Array.isArray(f)&&f[0]==="SOURCECRS");if(l){const f=l.find(d=>Array.isArray(d));t.source_crs=f?this.convert(f):null}const c=e.find(f=>Array.isArray(f)&&f[0]==="TARGETCRS");if(c){const f=c.find(d=>Array.isArray(d));t.target_crs=f?this.convert(f):null}const h=e.find(f=>Array.isArray(f)&&f[0]==="ABRIDGEDTRANSFORMATION");h?t.transformation=this.convert(h):t.transformation=null;break;case"ABRIDGEDTRANSFORMATION":if(t.type="Transformation",t.name=e[1],t.method=e.find(f=>Array.isArray(f)&&f[0]==="METHOD")?this.convert(e.find(f=>Array.isArray(f)&&f[0]==="METHOD")):null,t.parameters=e.filter(f=>Array.isArray(f)&&(f[0]==="PARAMETER"||f[0]==="PARAMETERFILE")).map(f=>{if(f[0]==="PARAMETER")return this.convert(f);if(f[0]==="PARAMETERFILE")return{name:f[1],value:f[2],id:{authority:"EPSG",code:8656}}}),t.parameters.length===7){const f=t.parameters[6];f.name==="Scale difference"&&(f.value=Math.round((f.value-1)*1e12)/1e6)}t.id=this.getId(e);break;case"AXIS":t.coordinate_system||(t.coordinate_system={type:"unspecified",axis:[]}),t.coordinate_system.axis.push(this.convertAxis(e));break;case"LENGTHUNIT":const u=this.convertUnit(e,"LinearUnit");t.coordinate_system&&t.coordinate_system.axis&&t.coordinate_system.axis.forEach(f=>{f.unit||(f.unit=u)}),u.conversion_factor&&u.conversion_factor!==1&&t.semi_major_axis&&(t.semi_major_axis={value:t.semi_major_axis,unit:u});break;default:t.keyword=e[0];break}return t}}class q9 extends dA{static convert(e,t={}){return super.convert(e,t),t.coordinate_system&&t.coordinate_system.subtype==="Cartesian"&&delete t.coordinate_system,t.usage&&delete t.usage,t}}class V9 extends dA{static convert(e,t={}){super.convert(e,t);const n=e.find(s=>Array.isArray(s)&&s[0]==="CS");n&&(t.coordinate_system={subtype:n[1],axis:this.extractAxes(e)});const r=e.find(s=>Array.isArray(s)&&s[0]==="USAGE");if(r){const s=r.find(l=>Array.isArray(l)&&l[0]==="SCOPE"),o=r.find(l=>Array.isArray(l)&&l[0]==="AREA"),a=r.find(l=>Array.isArray(l)&&l[0]==="BBOX");t.usage={},s&&(t.usage.scope=s[1]),o&&(t.usage.area=o[1]),a&&(t.usage.bbox=a.slice(1))}return t}}function $9(i){return i.find(e=>Array.isArray(e)&&e[0]==="USAGE")?"2019":(i.find(e=>Array.isArray(e)&&e[0]==="CS")||i[0]==="BOUNDCRS"||i[0]==="PROJCRS"||i[0]==="GEOGCRS","2015")}function W9(i){return($9(i)==="2019"?V9:q9).convert(i)}function H9(i){const e=i.toUpperCase();return e.includes("PROJCRS")||e.includes("GEOGCRS")||e.includes("BOUNDCRS")||e.includes("VERTCRS")||e.includes("LENGTHUNIT")||e.includes("ANGLEUNIT")||e.includes("SCALEUNIT")?"WKT2":(e.includes("PROJCS")||e.includes("GEOGCS")||e.includes("LOCAL_CS")||e.includes("VERT_CS")||e.includes("UNIT"),"WKT1")}var jd=1,gA=2,pA=3,K0=4,mA=5,f5=-1,X9=/\s/,K9=/[A-Za-z]/,Y9=/[A-Za-z84_]/,Ym=/[,\]]/,_A=/[\d\.E\-\+]/;function Ha(i){if(typeof i!="string")throw new Error("not a string");this.text=i.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=jd}Ha.prototype.readCharicter=function(){var i=this.text[this.place++];if(this.state!==K0)for(;X9.test(i);){if(this.place>=this.text.length)return;i=this.text[this.place++]}switch(this.state){case jd:return this.neutral(i);case gA:return this.keyword(i);case K0:return this.quoted(i);case mA:return this.afterquote(i);case pA:return this.number(i);case f5:return}};Ha.prototype.afterquote=function(i){if(i==='"'){this.word+='"',this.state=K0;return}if(Ym.test(i)){this.word=this.word.trim(),this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in afterquote yet, index '+this.place)};Ha.prototype.afterItem=function(i){if(i===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=jd;return}if(i==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=jd,this.currentObject=this.stack.pop(),this.currentObject||(this.state=f5);return}};Ha.prototype.number=function(i){if(_A.test(i)){this.word+=i;return}if(Ym.test(i)){this.word=parseFloat(this.word),this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in number yet, index '+this.place)};Ha.prototype.quoted=function(i){if(i==='"'){this.state=mA;return}this.word+=i};Ha.prototype.keyword=function(i){if(Y9.test(i)){this.word+=i;return}if(i==="["){var e=[];e.push(this.word),this.level++,this.root===null?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,this.state=jd;return}if(Ym.test(i)){this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in keyword yet, index '+this.place)};Ha.prototype.neutral=function(i){if(K9.test(i)){this.word=i,this.state=gA;return}if(i==='"'){this.word="",this.state=K0;return}if(_A.test(i)){this.word=i,this.state=pA;return}if(Ym.test(i)){this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in neutral yet, index '+this.place)};Ha.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===f5)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function Z9(i){var e=new Ha(i);return e.output()}function I_(i,e,t){Array.isArray(e)&&(t.unshift(e),e=null);var n=e?{}:i,r=t.reduce(function(s,o){return Kh(o,s),s},n);e&&(i[e]=r)}function Kh(i,e){if(!Array.isArray(i)){e[i]=!0;return}var t=i.shift();if(t==="PARAMETER"&&(t=i.shift()),i.length===1){if(Array.isArray(i[0])){e[t]={},Kh(i[0],e[t]);return}e[t]=i[0];return}if(!i.length){e[t]=!0;return}if(t==="TOWGS84"){e[t]=i;return}if(t==="AXIS"){t in e||(e[t]=[]),e[t].push(i);return}Array.isArray(t)||(e[t]={});var n;switch(t){case"UNIT":case"PRIMEM":case"VERT_DATUM":e[t]={name:i[0].toLowerCase(),convert:i[1]},i.length===3&&Kh(i[2],e[t]);return;case"SPHEROID":case"ELLIPSOID":e[t]={name:i[0],a:i[1],rf:i[2]},i.length===4&&Kh(i[3],e[t]);return;case"EDATUM":case"ENGINEERINGDATUM":case"LOCAL_DATUM":case"DATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":i[0]=["name",i[0]],I_(e,t,i);return;case"COMPD_CS":case"COMPOUNDCRS":case"FITTED_CS":case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"ENGCRS":case"ENGINEERINGCRS":i[0]=["name",i[0]],I_(e,t,i),e[t].type=t;return;default:for(n=-1;++n<i.length;)if(!Array.isArray(i[n]))return Kh(i,e[t]);return I_(e,t,i)}}var J9=.017453292519943295;function Ws(i){return i*J9}function yA(i){const e=(i.projName||"").toLowerCase().replace(/_/g," ");!i.long0&&i.longc&&(e==="albers conic equal area"||e==="lambert azimuthal equal area")&&(i.long0=i.longc),!i.lat_ts&&i.lat1&&(e==="stereographic south pole"||e==="polar stereographic (variant b)")?(i.lat0=Ws(i.lat1>0?90:-90),i.lat_ts=i.lat1,delete i.lat1):!i.lat_ts&&i.lat0&&(e==="polar stereographic"||e==="polar stereographic (variant a)")&&(i.lat_ts=i.lat0,i.lat0=Ws(i.lat0>0?90:-90),delete i.lat1)}function NE(i){let e={units:null,to_meter:void 0};return typeof i=="string"?(e.units=i.toLowerCase(),e.units==="metre"&&(e.units="meter"),e.units==="meter"&&(e.to_meter=1)):i&&i.name&&(e.units=i.name.toLowerCase(),e.units==="metre"&&(e.units="meter"),e.to_meter=i.conversion_factor),e}function FE(i){return typeof i=="object"?i.value*i.unit.conversion_factor:i}function OE(i,e){i.ellipsoid.radius?(e.a=i.ellipsoid.radius,e.rf=0):(e.a=FE(i.ellipsoid.semi_major_axis),i.ellipsoid.inverse_flattening!==void 0?e.rf=i.ellipsoid.inverse_flattening:i.ellipsoid.semi_major_axis!==void 0&&i.ellipsoid.semi_minor_axis!==void 0&&(e.rf=e.a/(e.a-FE(i.ellipsoid.semi_minor_axis))))}function Y0(i,e={}){return!i||typeof i!="object"?i:i.type==="BoundCRS"?(Y0(i.source_crs,e),i.transformation&&(i.transformation.method&&i.transformation.method.name==="NTv2"?e.nadgrids=i.transformation.parameters[0].value:e.datum_params=i.transformation.parameters.map(t=>t.value)),e):(Object.keys(i).forEach(t=>{const n=i[t];if(n!==null)switch(t){case"name":if(e.srsCode)break;e.name=n,e.srsCode=n;break;case"type":n==="GeographicCRS"?e.projName="longlat":n==="ProjectedCRS"&&i.conversion&&i.conversion.method&&(e.projName=i.conversion.method.name);break;case"datum":case"datum_ensemble":n.ellipsoid&&(e.ellps=n.ellipsoid.name,OE(n,e)),n.prime_meridian&&(e.from_greenwich=n.prime_meridian.longitude*Math.PI/180);break;case"ellipsoid":e.ellps=n.name,OE(n,e);break;case"prime_meridian":e.long0=(n.longitude||0)*Math.PI/180;break;case"coordinate_system":if(n.axis){if(e.axis=n.axis.map(r=>{const s=r.direction;if(s==="east")return"e";if(s==="north")return"n";if(s==="west")return"w";if(s==="south")return"s";throw new Error(`Unknown axis direction: ${s}`)}).join("")+"u",n.unit){const{units:r,to_meter:s}=NE(n.unit);e.units=r,e.to_meter=s}else if(n.axis[0]&&n.axis[0].unit){const{units:r,to_meter:s}=NE(n.axis[0].unit);e.units=r,e.to_meter=s}}break;case"id":n.authority&&n.code&&(e.title=n.authority+":"+n.code);break;case"conversion":n.method&&n.method.name&&(e.projName=n.method.name),n.parameters&&n.parameters.forEach(r=>{const s=r.name.toLowerCase().replace(/\s+/g,"_"),o=r.value;r.unit&&r.unit.conversion_factor?e[s]=o*r.unit.conversion_factor:r.unit==="degree"?e[s]=o*Math.PI/180:e[s]=o});break;case"unit":n.name&&(e.units=n.name.toLowerCase(),e.units==="metre"&&(e.units="meter")),n.conversion_factor&&(e.to_meter=n.conversion_factor);break;case"base_crs":Y0(n,e),e.datumCode=n.id?n.id.authority+"_"+n.id.code:n.name;break}}),e.latitude_of_false_origin!==void 0&&(e.lat0=e.latitude_of_false_origin),e.longitude_of_false_origin!==void 0&&(e.long0=e.longitude_of_false_origin),e.latitude_of_standard_parallel!==void 0&&(e.lat0=e.latitude_of_standard_parallel,e.lat1=e.latitude_of_standard_parallel),e.latitude_of_1st_standard_parallel!==void 0&&(e.lat1=e.latitude_of_1st_standard_parallel),e.latitude_of_2nd_standard_parallel!==void 0&&(e.lat2=e.latitude_of_2nd_standard_parallel),e.latitude_of_projection_centre!==void 0&&(e.lat0=e.latitude_of_projection_centre),e.longitude_of_projection_centre!==void 0&&(e.longc=e.longitude_of_projection_centre),e.easting_at_false_origin!==void 0&&(e.x0=e.easting_at_false_origin),e.northing_at_false_origin!==void 0&&(e.y0=e.northing_at_false_origin),e.latitude_of_natural_origin!==void 0&&(e.lat0=e.latitude_of_natural_origin),e.longitude_of_natural_origin!==void 0&&(e.long0=e.longitude_of_natural_origin),e.longitude_of_origin!==void 0&&(e.long0=e.longitude_of_origin),e.false_easting!==void 0&&(e.x0=e.false_easting),e.easting_at_projection_centre&&(e.x0=e.easting_at_projection_centre),e.false_northing!==void 0&&(e.y0=e.false_northing),e.northing_at_projection_centre&&(e.y0=e.northing_at_projection_centre),e.standard_parallel_1!==void 0&&(e.lat1=e.standard_parallel_1),e.standard_parallel_2!==void 0&&(e.lat2=e.standard_parallel_2),e.scale_factor_at_natural_origin!==void 0&&(e.k0=e.scale_factor_at_natural_origin),e.scale_factor_at_projection_centre!==void 0&&(e.k0=e.scale_factor_at_projection_centre),e.scale_factor_on_pseudo_standard_parallel!==void 0&&(e.k0=e.scale_factor_on_pseudo_standard_parallel),e.azimuth!==void 0&&(e.alpha=e.azimuth),e.azimuth_at_projection_centre!==void 0&&(e.alpha=e.azimuth_at_projection_centre),e.angle_from_rectified_to_skew_grid&&(e.rectified_grid_angle=e.angle_from_rectified_to_skew_grid),yA(e),e)}var Q9=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function eG(i,e){var t=e[0],n=e[1];!(t in i)&&n in i&&(i[t]=i[n],e.length===3&&(i[t]=e[2](i[t])))}function vA(i){for(var e=Object.keys(i),t=0,n=e.length;t<n;++t){var r=e[t];Q9.indexOf(r)!==-1&&tG(i[r]),typeof i[r]=="object"&&vA(i[r])}}function tG(i){if(i.AUTHORITY){var e=Object.keys(i.AUTHORITY)[0];e&&e in i.AUTHORITY&&(i.title=e+":"+i.AUTHORITY[e])}if(i.type==="GEOGCS"?i.projName="longlat":i.type==="LOCAL_CS"?(i.projName="identity",i.local=!0):typeof i.PROJECTION=="object"?i.projName=Object.keys(i.PROJECTION)[0]:i.projName=i.PROJECTION,i.AXIS){for(var t="",n=0,r=i.AXIS.length;n<r;++n){var s=[i.AXIS[n][0].toLowerCase(),i.AXIS[n][1].toLowerCase()];s[0].indexOf("north")!==-1||(s[0]==="y"||s[0]==="lat")&&s[1]==="north"?t+="n":s[0].indexOf("south")!==-1||(s[0]==="y"||s[0]==="lat")&&s[1]==="south"?t+="s":s[0].indexOf("east")!==-1||(s[0]==="x"||s[0]==="lon")&&s[1]==="east"?t+="e":(s[0].indexOf("west")!==-1||(s[0]==="x"||s[0]==="lon")&&s[1]==="west")&&(t+="w")}t.length===2&&(t+="u"),t.length===3&&(i.axis=t)}i.UNIT&&(i.units=i.UNIT.name.toLowerCase(),i.units==="metre"&&(i.units="meter"),i.UNIT.convert&&(i.type==="GEOGCS"?i.DATUM&&i.DATUM.SPHEROID&&(i.to_meter=i.UNIT.convert*i.DATUM.SPHEROID.a):i.to_meter=i.UNIT.convert));var o=i.GEOGCS;i.type==="GEOGCS"&&(o=i),o&&(o.DATUM?i.datumCode=o.DATUM.name.toLowerCase():i.datumCode=o.name.toLowerCase(),i.datumCode.slice(0,2)==="d_"&&(i.datumCode=i.datumCode.slice(2)),i.datumCode==="new_zealand_1949"&&(i.datumCode="nzgd49"),(i.datumCode==="wgs_1984"||i.datumCode==="world_geodetic_system_1984")&&(i.PROJECTION==="Mercator_Auxiliary_Sphere"&&(i.sphere=!0),i.datumCode="wgs84"),i.datumCode==="belge_1972"&&(i.datumCode="rnb72"),o.DATUM&&o.DATUM.SPHEROID&&(i.ellps=o.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),i.ellps.toLowerCase().slice(0,13)==="international"&&(i.ellps="intl"),i.a=o.DATUM.SPHEROID.a,i.rf=parseFloat(o.DATUM.SPHEROID.rf,10)),o.DATUM&&o.DATUM.TOWGS84&&(i.datum_params=o.DATUM.TOWGS84),~i.datumCode.indexOf("osgb_1936")&&(i.datumCode="osgb36"),~i.datumCode.indexOf("osni_1952")&&(i.datumCode="osni52"),(~i.datumCode.indexOf("tm65")||~i.datumCode.indexOf("geodetic_datum_of_1965"))&&(i.datumCode="ire65"),i.datumCode==="ch1903+"&&(i.datumCode="ch1903"),~i.datumCode.indexOf("israel")&&(i.datumCode="isr93")),i.b&&!isFinite(i.b)&&(i.b=i.a),i.rectified_grid_angle&&(i.rectified_grid_angle=Ws(i.rectified_grid_angle));function a(h){var u=i.to_meter||1;return h*u}var l=function(h){return eG(i,h)},c=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",Ws],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",Ws],["x0","false_easting",a],["y0","false_northing",a],["long0","central_meridian",Ws],["lat0","latitude_of_origin",Ws],["lat0","standard_parallel_1",Ws],["lat1","standard_parallel_1",Ws],["lat2","standard_parallel_2",Ws],["azimuth","Azimuth"],["alpha","azimuth",Ws],["srsCode","name"]];c.forEach(l),yA(i)}function Qy(i){if(typeof i=="object")return Y0(i);const e=H9(i);var t=Z9(i);if(e==="WKT2"){const s=W9(t);return Y0(s)}var n=t[0],r={};return Kh(t,r),vA(r),r[n]}function Ir(i){var e=this;if(arguments.length===2){var t=arguments[1];typeof t=="string"?t.charAt(0)==="+"?Ir[i]=Jy(arguments[1]):Ir[i]=Qy(arguments[1]):Ir[i]=t}else if(arguments.length===1){if(Array.isArray(i))return i.map(function(n){return Array.isArray(n)?Ir.apply(e,n):Ir(n)});if(typeof i=="string"){if(i in Ir)return Ir[i]}else"EPSG"in i?Ir["EPSG:"+i.EPSG]=i:"ESRI"in i?Ir["ESRI:"+i.ESRI]=i:"IAU2000"in i?Ir["IAU2000:"+i.IAU2000]=i:console.log(i);return}}D9(Ir);function iG(i){return typeof i=="string"}function nG(i){return i in Ir}function rG(i){return i.indexOf("+")!==0&&i.indexOf("[")!==-1||typeof i=="object"&&!("srsCode"in i)}var sG=["3857","900913","3785","102113"];function oG(i){var e=kl(i,"authority");if(e){var t=kl(e,"epsg");return t&&sG.indexOf(t)>-1}}function aG(i){var e=kl(i,"extension");if(e)return kl(e,"proj4")}function lG(i){return i[0]==="+"}function cG(i){if(iG(i)){if(nG(i))return Ir[i];if(rG(i)){var e=Qy(i);if(oG(e))return Ir["EPSG:3857"];var t=aG(e);return t?Jy(t):e}if(lG(i))return Jy(i)}else return"projName"in i?i:Qy(i)}function DE(i,e){i=i||{};var t,n;if(!e)return i;for(n in e)t=e[n],t!==void 0&&(i[n]=t);return i}function Wo(i,e,t){var n=i*e;return t/Math.sqrt(1-n*n)}function ag(i){return i<0?-1:1}function We(i){return Math.abs(i)<=pn?i:i-ag(i)*Bd}function Qs(i,e,t){var n=i*t,r=.5*i;return n=Math.pow((1-n)/(1+n),r),Math.tan(.5*(De-e))/n}function Ud(i,e){for(var t=.5*i,n,r,s=De-2*Math.atan(e),o=0;o<=15;o++)if(n=i*Math.sin(s),r=De-2*Math.atan(e*Math.pow((1-n)/(1+n),t))-s,s+=r,Math.abs(r)<=1e-10)return s;return-9999}function hG(){var i=this.b/this.a;this.es=1-i*i,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=Wo(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function uG(i){var e=i.x,t=i.y;if(t*Do>90&&t*Do<-90&&e*Do>180&&e*Do<-180)return null;var n,r;if(Math.abs(Math.abs(t)-De)<=Ve)return null;if(this.sphere)n=this.x0+this.a*this.k0*We(e-this.long0),r=this.y0+this.a*this.k0*Math.log(Math.tan(mi+.5*t));else{var s=Math.sin(t),o=Qs(this.e,t,s);n=this.x0+this.a*this.k0*We(e-this.long0),r=this.y0-this.a*this.k0*Math.log(o)}return i.x=n,i.y=r,i}function fG(i){var e=i.x-this.x0,t=i.y-this.y0,n,r;if(this.sphere)r=De-2*Math.atan(Math.exp(-t/(this.a*this.k0)));else{var s=Math.exp(-t/(this.a*this.k0));if(r=Ud(this.e,s),r===-9999)return null}return n=We(this.long0+e/(this.a*this.k0)),i.x=n,i.y=r,i}var dG=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","Mercator_Variant_A","merc"];const gG={init:hG,forward:uG,inverse:fG,names:dG};function pG(){}function kE(i){return i}var mG=["longlat","identity"];const _G={init:pG,forward:kE,inverse:kE,names:mG};var yG=[gG,_G],vc={},Yh=[];function xA(i,e){var t=Yh.length;return i.names?(Yh[t]=i,i.names.forEach(function(n){vc[n.toLowerCase()]=t}),this):(console.log(e),!0)}function wA(i){return i.replace(/[-\(\)\s]+/g," ").trim().replace(/ /g,"_")}function vG(i){if(!i)return!1;var e=i.toLowerCase();if(typeof vc[e]<"u"&&Yh[vc[e]]||(e=wA(e),e in vc&&Yh[vc[e]]))return Yh[vc[e]]}function xG(){yG.forEach(xA)}const wG={start:xG,add:xA,get:vG};var bA={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"},andrae:{a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"},clrk80:{a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:63782492e-1,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:63558348467e-4,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}};const bG=bA.WGS84;function EG(i,e,t,n){var r=i*i,s=e*e,o=(r-s)/r,a=0;n?(i*=1-o*(B9+o*(j9+o*U9)),r=i*i,o=0):a=Math.sqrt(o);var l=(r-s)/s;return{es:o,e:a,ep2:l}}function SG(i,e,t,n,r){if(!i){var s=kl(bA,n);s||(s=bG),i=s.a,e=s.b,t=s.rf}return t&&!e&&(e=(1-1/t)*i),(t===0||Math.abs(i-e)<Ve)&&(r=!0,e=i),{a:i,b:e,rf:t,sphere:r}}var Xp={wgs84:{towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},ch1903:{towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},ggrs87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},nad83:{towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},nad27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},mgi:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Militar-Geographische Institut"},osni52:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},rassadiran:{towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},osgb36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Ordnance Survey of Great Britain 1936"},s_jtsk:{towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},beduaram:{towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},gunung_segara:{towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},rnb72:{towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"},EPSG_5451:{towgs84:"6.41,-49.05,-11.28,1.5657,0.5242,6.9718,-5.7649"},IGNF_LURESG:{towgs84:"-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43"},EPSG_4614:{towgs84:"-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065"},EPSG_4615:{towgs84:"-494.088,-312.129,279.877,-1.423,-1.013,1.59,-0.748"},ESRI_37241:{towgs84:"-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031"},ESRI_37249:{towgs84:"-440.296,58.548,296.265,1.128,10.202,4.559,-0.438"},ESRI_37245:{towgs84:"-511.151,-181.269,139.609,1.05,2.703,1.798,3.071"},EPSG_4178:{towgs84:"24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01"},EPSG_4622:{towgs84:"-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984"},EPSG_4625:{towgs84:"126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227"},EPSG_5252:{towgs84:"0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439"},EPSG_4314:{towgs84:"597.1,71.4,412.1,0.894,0.068,-1.563,7.58"},EPSG_4282:{towgs84:"-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166"},EPSG_4231:{towgs84:"-83.11,-97.38,-117.22,0.0276,-0.2167,0.2147,0.1218"},EPSG_4274:{towgs84:"-230.994,102.591,25.199,0.633,-0.239,0.9,1.95"},EPSG_4134:{towgs84:"-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006"},EPSG_4254:{towgs84:"18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013"},EPSG_4159:{towgs84:"-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175"},EPSG_4687:{towgs84:"0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093"},EPSG_4227:{towgs84:"-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225"},EPSG_4746:{towgs84:"599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46"},EPSG_4745:{towgs84:"612.4,77,440.2,-0.054,0.057,-2.797,2.55"},EPSG_6311:{towgs84:"8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926"},EPSG_4289:{towgs84:"565.7381,50.4018,465.2904,-1.91514,1.60363,-9.09546,4.07244"},EPSG_4230:{towgs84:"-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4"},EPSG_4154:{towgs84:"-123.02,-158.95,-168.47"},EPSG_4156:{towgs84:"570.8,85.7,462.8,4.998,1.587,5.261,3.56"},EPSG_4299:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4179:{towgs84:"33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84"},EPSG_4313:{towgs84:"-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747"},EPSG_4194:{towgs84:"163.511,127.533,-159.789"},EPSG_4195:{towgs84:"105,326,-102.5"},EPSG_4196:{towgs84:"-45,417,-3.5"},EPSG_4611:{towgs84:"-162.619,-276.959,-161.764,0.067753,-2.243649,-1.158827,-1.094246"},EPSG_4633:{towgs84:"137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824"},EPSG_4641:{towgs84:"-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993"},EPSG_4643:{towgs84:"-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002"},EPSG_4300:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4188:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4660:{towgs84:"982.6087,552.753,-540.873,32.39344,-153.25684,-96.2266,16.805"},EPSG_4662:{towgs84:"97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259"},EPSG_3906:{towgs84:"577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664"},EPSG_4307:{towgs84:"-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547"},EPSG_6892:{towgs84:"-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686"},EPSG_4690:{towgs84:"221.597,152.441,176.523,2.403,1.3893,0.884,11.4648"},EPSG_4691:{towgs84:"218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817"},EPSG_4629:{towgs84:"72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653"},EPSG_4630:{towgs84:"165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111"},EPSG_4692:{towgs84:"217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093"},EPSG_9333:{towgs84:"0,0,0,-8.393,0.749,-10.276,0"},EPSG_9059:{towgs84:"0,0,0"},EPSG_4312:{towgs84:"601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887"},EPSG_4123:{towgs84:"-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496"},EPSG_4309:{towgs84:"-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365"},ESRI_104106:{towgs84:"-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058"},EPSG_4281:{towgs84:"-219.247,-73.802,269.529"},EPSG_4322:{towgs84:"0,0,4.5"},EPSG_4324:{towgs84:"0,0,1.9"},EPSG_4284:{towgs84:"43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549"},EPSG_4277:{towgs84:"446.448,-125.157,542.06,0.15,0.247,0.842,-20.489"},EPSG_4207:{towgs84:"-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46"},EPSG_4688:{towgs84:"347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647"},EPSG_4689:{towgs84:"410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218"},EPSG_4720:{towgs84:"0,0,4.5"},EPSG_4273:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},EPSG_4240:{towgs84:"204.64,834.74,293.8"},EPSG_4817:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},ESRI_104131:{towgs84:"426.62,142.62,460.09,4.98,4.49,-12.42,-17.1"},EPSG_4265:{towgs84:"-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68"},EPSG_4263:{towgs84:"-111.92,-87.85,114.5,1.875,0.202,0.219,0.032"},EPSG_4298:{towgs84:"-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536"},EPSG_4270:{towgs84:"-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424"},EPSG_4229:{towgs84:"-121.8,98.1,-10.7"},EPSG_4220:{towgs84:"-55.5,-348,-229.2"},EPSG_4214:{towgs84:"12.646,-155.176,-80.863"},EPSG_4232:{towgs84:"-345,3,223"},EPSG_4238:{towgs84:"-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037"},EPSG_4168:{towgs84:"-170,33,326"},EPSG_4131:{towgs84:"199,931,318.9"},EPSG_4152:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_5228:{towgs84:"572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378"},EPSG_8351:{towgs84:"485.021,169.465,483.839,7.786342,4.397554,4.102655,0"},EPSG_4683:{towgs84:"-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06"},EPSG_4133:{towgs84:"0,0,0"},EPSG_7373:{towgs84:"0.819,-0.5762,-1.6446,-0.00378,-0.03317,0.00318,0.0693"},EPSG_9075:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9072:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9294:{towgs84:"1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388"},EPSG_4212:{towgs84:"-267.434,173.496,181.814,-13.4704,8.7154,7.3926,14.7492"},EPSG_4191:{towgs84:"-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703"},EPSG_4237:{towgs84:"52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191"},EPSG_4740:{towgs84:"-1.08,-0.27,-0.9"},EPSG_4124:{towgs84:"419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496"},EPSG_5681:{towgs84:"584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922"},EPSG_4141:{towgs84:"23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262"},EPSG_4204:{towgs84:"-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194"},EPSG_4319:{towgs84:"226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798"},EPSG_4200:{towgs84:"24.82,-131.21,-82.66"},EPSG_4130:{towgs84:"0,0,0"},EPSG_4127:{towgs84:"-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359"},EPSG_4149:{towgs84:"674.374,15.056,405.346"},EPSG_4617:{towgs84:"-0.991,1.9072,0.5129,1.25033e-7,4.6785e-8,5.6529e-8,0"},EPSG_4663:{towgs84:"-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485"},EPSG_4664:{towgs84:"-211.939,137.626,58.3,-0.089,0.251,0.079,0.384"},EPSG_4665:{towgs84:"-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048"},EPSG_4666:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},EPSG_4756:{towgs84:"-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188"},EPSG_4723:{towgs84:"-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925"},EPSG_4726:{towgs84:"8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081"},EPSG_4267:{towgs84:"-8.0,160.0,176.0"},EPSG_5365:{towgs84:"-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693"},EPSG_4218:{towgs84:"304.5,306.5,-318.1"},EPSG_4242:{towgs84:"-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95"},EPSG_4216:{towgs84:"-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289"},ESRI_104105:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},ESRI_104129:{towgs84:"0,0,0"},EPSG_4673:{towgs84:"174.05,-25.49,112.57"},EPSG_4202:{towgs84:"-124,-60,154"},EPSG_4203:{towgs84:"-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191"},EPSG_3819:{towgs84:"595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408"},EPSG_8694:{towgs84:"-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169"},EPSG_4145:{towgs84:"275.57,676.78,229.6"},EPSG_4283:{towgs84:"61.55,-10.87,-40.19,39.4924,32.7221,32.8979,-9.994"},EPSG_4317:{towgs84:"2.3287,-147.0425,-92.0802,-0.3092483,0.32482185,0.49729934,5.68906266"},EPSG_4272:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993"},EPSG_4248:{towgs84:"-307.7,265.3,-363.5"},EPSG_5561:{towgs84:"24,-121,-76"},EPSG_5233:{towgs84:"-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338"},ESRI_104130:{towgs84:"-86,-98,-119"},ESRI_104102:{towgs84:"682,-203,480"},ESRI_37207:{towgs84:"7,-10,-26"},EPSG_4675:{towgs84:"59.935,118.4,-10.871"},ESRI_104109:{towgs84:"-89.121,-348.182,260.871"},ESRI_104112:{towgs84:"-185.583,-230.096,281.361"},ESRI_104113:{towgs84:"25.1,-275.6,222.6"},IGNF_WGS72G:{towgs84:"0,12,6"},IGNF_NTFG:{towgs84:"-168,-60,320"},IGNF_EFATE57G:{towgs84:"-127,-769,472"},IGNF_PGP50G:{towgs84:"324.8,153.6,172.1"},IGNF_REUN47G:{towgs84:"94,-948,-1262"},IGNF_CSG67G:{towgs84:"-186,230,110"},IGNF_GUAD48G:{towgs84:"-467,-16,-300"},IGNF_TAHI51G:{towgs84:"162,117,154"},IGNF_TAHAAG:{towgs84:"65,342,77"},IGNF_NUKU72G:{towgs84:"84,274,65"},IGNF_PETRELS72G:{towgs84:"365,194,166"},IGNF_WALL78G:{towgs84:"253,-133,-127"},IGNF_MAYO50G:{towgs84:"-382,-59,-262"},IGNF_TANNAG:{towgs84:"-139,-967,436"},IGNF_IGN72G:{towgs84:"-13,-348,292"},IGNF_ATIGG:{towgs84:"1118,23,66"},IGNF_FANGA84G:{towgs84:"150.57,158.33,118.32"},IGNF_RUSAT84G:{towgs84:"202.13,174.6,-15.74"},IGNF_KAUE70G:{towgs84:"126.74,300.1,-75.49"},IGNF_MOP90G:{towgs84:"-10.8,-1.8,12.77"},IGNF_MHPF67G:{towgs84:"338.08,212.58,-296.17"},IGNF_TAHI79G:{towgs84:"160.61,116.05,153.69"},IGNF_ANAA92G:{towgs84:"1.5,3.84,4.81"},IGNF_MARQUI72G:{towgs84:"330.91,-13.92,58.56"},IGNF_APAT86G:{towgs84:"143.6,197.82,74.05"},IGNF_TUBU69G:{towgs84:"237.17,171.61,-77.84"},IGNF_STPM50G:{towgs84:"11.363,424.148,373.13"},EPSG_4150:{towgs84:"674.374,15.056,405.346"},EPSG_4754:{towgs84:"-208.4058,-109.8777,-2.5764"},ESRI_104101:{towgs84:"374,150,588"},EPSG_4693:{towgs84:"0,-0.15,0.68"},EPSG_6207:{towgs84:"293.17,726.18,245.36"},EPSG_4153:{towgs84:"-133.63,-157.5,-158.62"},EPSG_4132:{towgs84:"-241.54,-163.64,396.06"},EPSG_4221:{towgs84:"-154.5,150.7,100.4"},EPSG_4266:{towgs84:"-80.7,-132.5,41.1"},EPSG_4193:{towgs84:"-70.9,-151.8,-41.4"},EPSG_5340:{towgs84:"-0.41,0.46,-0.35"},EPSG_4246:{towgs84:"-294.7,-200.1,525.5"},EPSG_4318:{towgs84:"-3.2,-5.7,2.8"},EPSG_4121:{towgs84:"-199.87,74.79,246.62"},EPSG_4223:{towgs84:"-260.1,5.5,432.2"},EPSG_4158:{towgs84:"-0.465,372.095,171.736"},EPSG_4285:{towgs84:"-128.16,-282.42,21.93"},EPSG_4613:{towgs84:"-404.78,685.68,45.47"},EPSG_4607:{towgs84:"195.671,332.517,274.607"},EPSG_4475:{towgs84:"-381.788,-57.501,-256.673"},EPSG_4208:{towgs84:"-157.84,308.54,-146.6"},EPSG_4743:{towgs84:"70.995,-335.916,262.898"},EPSG_4710:{towgs84:"-323.65,551.39,-491.22"},EPSG_7881:{towgs84:"-0.077,0.079,0.086"},EPSG_4682:{towgs84:"283.729,735.942,261.143"},EPSG_4739:{towgs84:"-156,-271,-189"},EPSG_4679:{towgs84:"-80.01,253.26,291.19"},EPSG_4750:{towgs84:"-56.263,16.136,-22.856"},EPSG_4644:{towgs84:"-10.18,-350.43,291.37"},EPSG_4695:{towgs84:"-103.746,-9.614,-255.95"},EPSG_4292:{towgs84:"-355,21,72"},EPSG_4302:{towgs84:"-61.702,284.488,472.052"},EPSG_4143:{towgs84:"-124.76,53,466.79"},EPSG_4606:{towgs84:"-153,153,307"},EPSG_4699:{towgs84:"-770.1,158.4,-498.2"},EPSG_4247:{towgs84:"-273.5,110.6,-357.9"},EPSG_4160:{towgs84:"8.88,184.86,106.69"},EPSG_4161:{towgs84:"-233.43,6.65,173.64"},EPSG_9251:{towgs84:"-9.5,122.9,138.2"},EPSG_9253:{towgs84:"-78.1,101.6,133.3"},EPSG_4297:{towgs84:"-198.383,-240.517,-107.909"},EPSG_4269:{towgs84:"0,0,0"},EPSG_4301:{towgs84:"-147,506,687"},EPSG_4618:{towgs84:"-59,-11,-52"},EPSG_4612:{towgs84:"0,0,0"},EPSG_4678:{towgs84:"44.585,-131.212,-39.544"},EPSG_4250:{towgs84:"-130,29,364"},EPSG_4144:{towgs84:"214,804,268"},EPSG_4147:{towgs84:"-17.51,-108.32,-62.39"},EPSG_4259:{towgs84:"-254.1,-5.36,-100.29"},EPSG_4164:{towgs84:"-76,-138,67"},EPSG_4211:{towgs84:"-378.873,676.002,-46.255"},EPSG_4182:{towgs84:"-422.651,-172.995,84.02"},EPSG_4224:{towgs84:"-143.87,243.37,-33.52"},EPSG_4225:{towgs84:"-205.57,168.77,-4.12"},EPSG_5527:{towgs84:"-67.35,3.88,-38.22"},EPSG_4752:{towgs84:"98,390,-22"},EPSG_4310:{towgs84:"-30,190,89"},EPSG_9248:{towgs84:"-192.26,65.72,132.08"},EPSG_4680:{towgs84:"124.5,-63.5,-281"},EPSG_4701:{towgs84:"-79.9,-158,-168.9"},EPSG_4706:{towgs84:"-146.21,112.63,4.05"},EPSG_4805:{towgs84:"682,-203,480"},EPSG_4201:{towgs84:"-165,-11,206"},EPSG_4210:{towgs84:"-157,-2,-299"},EPSG_4183:{towgs84:"-104,167,-38"},EPSG_4139:{towgs84:"11,72,-101"},EPSG_4668:{towgs84:"-86,-98,-119"},EPSG_4717:{towgs84:"-2,151,181"},EPSG_4732:{towgs84:"102,52,-38"},EPSG_4280:{towgs84:"-377,681,-50"},EPSG_4209:{towgs84:"-138,-105,-289"},EPSG_4261:{towgs84:"31,146,47"},EPSG_4658:{towgs84:"-73,46,-86"},EPSG_4721:{towgs84:"265.025,384.929,-194.046"},EPSG_4222:{towgs84:"-136,-108,-292"},EPSG_4601:{towgs84:"-255,-15,71"},EPSG_4602:{towgs84:"725,685,536"},EPSG_4603:{towgs84:"72,213.7,93"},EPSG_4605:{towgs84:"9,183,236"},EPSG_4621:{towgs84:"137,248,-430"},EPSG_4657:{towgs84:"-28,199,5"},EPSG_4316:{towgs84:"103.25,-100.4,-307.19"},EPSG_4642:{towgs84:"-13,-348,292"},EPSG_4698:{towgs84:"145,-187,103"},EPSG_4192:{towgs84:"-206.1,-174.7,-87.7"},EPSG_4311:{towgs84:"-265,120,-358"},EPSG_4135:{towgs84:"58,-283,-182"},ESRI_104138:{towgs84:"198,-226,-347"},EPSG_4245:{towgs84:"-11,851,5"},EPSG_4142:{towgs84:"-125,53,467"},EPSG_4213:{towgs84:"-106,-87,188"},EPSG_4253:{towgs84:"-133,-77,-51"},EPSG_4129:{towgs84:"-132,-110,-335"},EPSG_4713:{towgs84:"-77,-128,142"},EPSG_4239:{towgs84:"217,823,299"},EPSG_4146:{towgs84:"295,736,257"},EPSG_4155:{towgs84:"-83,37,124"},EPSG_4165:{towgs84:"-173,253,27"},EPSG_4672:{towgs84:"175,-38,113"},EPSG_4236:{towgs84:"-637,-549,-203"},EPSG_4251:{towgs84:"-90,40,88"},EPSG_4271:{towgs84:"-2,374,172"},EPSG_4175:{towgs84:"-88,4,101"},EPSG_4716:{towgs84:"298,-304,-375"},EPSG_4315:{towgs84:"-23,259,-9"},EPSG_4744:{towgs84:"-242.2,-144.9,370.3"},EPSG_4244:{towgs84:"-97,787,86"},EPSG_4293:{towgs84:"616,97,-251"},EPSG_4714:{towgs84:"-127,-769,472"},EPSG_4736:{towgs84:"260,12,-147"},EPSG_6883:{towgs84:"-235,-110,393"},EPSG_6894:{towgs84:"-63,176,185"},EPSG_4205:{towgs84:"-43,-163,45"},EPSG_4256:{towgs84:"41,-220,-134"},EPSG_4262:{towgs84:"639,405,60"},EPSG_4604:{towgs84:"174,359,365"},EPSG_4169:{towgs84:"-115,118,426"},EPSG_4620:{towgs84:"-106,-129,165"},EPSG_4184:{towgs84:"-203,141,53"},EPSG_4616:{towgs84:"-289,-124,60"},EPSG_9403:{towgs84:"-307,-92,127"},EPSG_4684:{towgs84:"-133,-321,50"},EPSG_4708:{towgs84:"-491,-22,435"},EPSG_4707:{towgs84:"114,-116,-333"},EPSG_4709:{towgs84:"145,75,-272"},EPSG_4712:{towgs84:"-205,107,53"},EPSG_4711:{towgs84:"124,-234,-25"},EPSG_4718:{towgs84:"230,-199,-752"},EPSG_4719:{towgs84:"211,147,111"},EPSG_4724:{towgs84:"208,-435,-229"},EPSG_4725:{towgs84:"189,-79,-202"},EPSG_4735:{towgs84:"647,1777,-1124"},EPSG_4722:{towgs84:"-794,119,-298"},EPSG_4728:{towgs84:"-307,-92,127"},EPSG_4734:{towgs84:"-632,438,-609"},EPSG_4727:{towgs84:"912,-58,1227"},EPSG_4729:{towgs84:"185,165,42"},EPSG_4730:{towgs84:"170,42,84"},EPSG_4733:{towgs84:"276,-57,149"},ESRI_37218:{towgs84:"230,-199,-752"},ESRI_37240:{towgs84:"-7,215,225"},ESRI_37221:{towgs84:"252,-209,-751"},ESRI_4305:{towgs84:"-123,-206,219"},ESRI_104139:{towgs84:"-73,-247,227"},EPSG_4748:{towgs84:"51,391,-36"},EPSG_4219:{towgs84:"-384,664,-48"},EPSG_4255:{towgs84:"-333,-222,114"},EPSG_4257:{towgs84:"-587.8,519.75,145.76"},EPSG_4646:{towgs84:"-963,510,-359"},EPSG_6881:{towgs84:"-24,-203,268"},EPSG_6882:{towgs84:"-183,-15,273"},EPSG_4715:{towgs84:"-104,-129,239"},IGNF_RGF93GDD:{towgs84:"0,0,0"},IGNF_RGM04GDD:{towgs84:"0,0,0"},IGNF_RGSPM06GDD:{towgs84:"0,0,0"},IGNF_RGTAAF07GDD:{towgs84:"0,0,0"},IGNF_RGFG95GDD:{towgs84:"0,0,0"},IGNF_RGNCG:{towgs84:"0,0,0"},IGNF_RGPFGDD:{towgs84:"0,0,0"},IGNF_ETRS89G:{towgs84:"0,0,0"},IGNF_RGR92GDD:{towgs84:"0,0,0"},EPSG_4173:{towgs84:"0,0,0"},EPSG_4180:{towgs84:"0,0,0"},EPSG_4619:{towgs84:"0,0,0"},EPSG_4667:{towgs84:"0,0,0"},EPSG_4075:{towgs84:"0,0,0"},EPSG_6706:{towgs84:"0,0,0"},EPSG_7798:{towgs84:"0,0,0"},EPSG_4661:{towgs84:"0,0,0"},EPSG_4669:{towgs84:"0,0,0"},EPSG_8685:{towgs84:"0,0,0"},EPSG_4151:{towgs84:"0,0,0"},EPSG_9702:{towgs84:"0,0,0"},EPSG_4758:{towgs84:"0,0,0"},EPSG_4761:{towgs84:"0,0,0"},EPSG_4765:{towgs84:"0,0,0"},EPSG_8997:{towgs84:"0,0,0"},EPSG_4023:{towgs84:"0,0,0"},EPSG_4670:{towgs84:"0,0,0"},EPSG_4694:{towgs84:"0,0,0"},EPSG_4148:{towgs84:"0,0,0"},EPSG_4163:{towgs84:"0,0,0"},EPSG_4167:{towgs84:"0,0,0"},EPSG_4189:{towgs84:"0,0,0"},EPSG_4190:{towgs84:"0,0,0"},EPSG_4176:{towgs84:"0,0,0"},EPSG_4659:{towgs84:"0,0,0"},EPSG_3824:{towgs84:"0,0,0"},EPSG_3889:{towgs84:"0,0,0"},EPSG_4046:{towgs84:"0,0,0"},EPSG_4081:{towgs84:"0,0,0"},EPSG_4558:{towgs84:"0,0,0"},EPSG_4483:{towgs84:"0,0,0"},EPSG_5013:{towgs84:"0,0,0"},EPSG_5264:{towgs84:"0,0,0"},EPSG_5324:{towgs84:"0,0,0"},EPSG_5354:{towgs84:"0,0,0"},EPSG_5371:{towgs84:"0,0,0"},EPSG_5373:{towgs84:"0,0,0"},EPSG_5381:{towgs84:"0,0,0"},EPSG_5393:{towgs84:"0,0,0"},EPSG_5489:{towgs84:"0,0,0"},EPSG_5593:{towgs84:"0,0,0"},EPSG_6135:{towgs84:"0,0,0"},EPSG_6365:{towgs84:"0,0,0"},EPSG_5246:{towgs84:"0,0,0"},EPSG_7886:{towgs84:"0,0,0"},EPSG_8431:{towgs84:"0,0,0"},EPSG_8427:{towgs84:"0,0,0"},EPSG_8699:{towgs84:"0,0,0"},EPSG_8818:{towgs84:"0,0,0"},EPSG_4757:{towgs84:"0,0,0"},EPSG_9140:{towgs84:"0,0,0"},EPSG_8086:{towgs84:"0,0,0"},EPSG_4686:{towgs84:"0,0,0"},EPSG_4737:{towgs84:"0,0,0"},EPSG_4702:{towgs84:"0,0,0"},EPSG_4747:{towgs84:"0,0,0"},EPSG_4749:{towgs84:"0,0,0"},EPSG_4674:{towgs84:"0,0,0"},EPSG_4755:{towgs84:"0,0,0"},EPSG_4759:{towgs84:"0,0,0"},EPSG_4762:{towgs84:"0,0,0"},EPSG_4763:{towgs84:"0,0,0"},EPSG_4764:{towgs84:"0,0,0"},EPSG_4166:{towgs84:"0,0,0"},EPSG_4170:{towgs84:"0,0,0"},EPSG_5546:{towgs84:"0,0,0"},EPSG_7844:{towgs84:"0,0,0"},EPSG_4818:{towgs84:"589,76,480"}};for(var TG in Xp){var N_=Xp[TG];N_.datumName&&(Xp[N_.datumName]=N_)}function LG(i,e,t,n,r,s,o){var a={};return i===void 0||i==="none"?a.datum_type=Zy:a.datum_type=k9,e&&(a.datum_params=e.map(parseFloat),(a.datum_params[0]!==0||a.datum_params[1]!==0||a.datum_params[2]!==0)&&(a.datum_type=Gc),a.datum_params.length>3&&(a.datum_params[3]!==0||a.datum_params[4]!==0||a.datum_params[5]!==0||a.datum_params[6]!==0)&&(a.datum_type=Bc,a.datum_params[3]*=rd,a.datum_params[4]*=rd,a.datum_params[5]*=rd,a.datum_params[6]=a.datum_params[6]/1e6+1)),o&&(a.datum_type=pu,a.grids=o),a.a=t,a.b=n,a.es=r,a.ep2=s,a}var d5={};function CG(i,e,t){return e instanceof ArrayBuffer?AG(i,e,t):{ready:PG(i,e)}}function AG(i,e,t){var n=!0;t!==void 0&&t.includeErrorFields===!1&&(n=!1);var r=new DataView(e),s=IG(r),o=NG(r,s),a=FG(r,o,s,n),l={header:o,subgrids:a};return d5[i]=l,l}async function PG(i,e){for(var t=[],n=await e.getImageCount(),r=n-1;r>=0;r--){var s=await e.getImage(r),o=await s.readRasters(),a=o,l=[s.getWidth(),s.getHeight()],c=s.getBoundingBox().map(GE),h=[s.fileDirectory.ModelPixelScale[0],s.fileDirectory.ModelPixelScale[1]].map(GE),u=c[0]+(l[0]-1)*h[0],f=c[3]-(l[1]-1)*h[1],d=a[0],g=a[1],m=[];for(let x=l[1]-1;x>=0;x--)for(let S=l[0]-1;S>=0;S--){var _=x*l[0]+S;m.push([-Al(g[_]),Al(d[_])])}t.push({del:h,lim:l,ll:[-u,f],cvs:m})}var v={header:{nSubgrids:n},subgrids:t};return d5[i]=v,v}function MG(i){if(i===void 0)return null;var e=i.split(",");return e.map(RG)}function RG(i){if(i.length===0)return null;var e=i[0]==="@";return e&&(i=i.slice(1)),i==="null"?{name:"null",mandatory:!e,grid:null,isNull:!0}:{name:i,mandatory:!e,grid:d5[i]||null,isNull:!1}}function GE(i){return i*Math.PI/180}function Al(i){return i/3600*Math.PI/180}function IG(i){var e=i.getInt32(8,!1);return e===11?!1:(e=i.getInt32(8,!0),e!==11&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}function NG(i,e){return{nFields:i.getInt32(8,e),nSubgridFields:i.getInt32(24,e),nSubgrids:i.getInt32(40,e),shiftType:ev(i,56,64).trim(),fromSemiMajorAxis:i.getFloat64(120,e),fromSemiMinorAxis:i.getFloat64(136,e),toSemiMajorAxis:i.getFloat64(152,e),toSemiMinorAxis:i.getFloat64(168,e)}}function ev(i,e,t){return String.fromCharCode.apply(null,new Uint8Array(i.buffer.slice(e,t)))}function FG(i,e,t,n){for(var r=176,s=[],o=0;o<e.nSubgrids;o++){var a=DG(i,r,t),l=kG(i,r,a,t,n),c=Math.round(1+(a.upperLongitude-a.lowerLongitude)/a.longitudeInterval),h=Math.round(1+(a.upperLatitude-a.lowerLatitude)/a.latitudeInterval);s.push({ll:[Al(a.lowerLongitude),Al(a.lowerLatitude)],del:[Al(a.longitudeInterval),Al(a.latitudeInterval)],lim:[c,h],count:a.gridNodeCount,cvs:OG(l)});var u=16;n===!1&&(u=8),r+=176+a.gridNodeCount*u}return s}function OG(i){return i.map(function(e){return[Al(e.longitudeShift),Al(e.latitudeShift)]})}function DG(i,e,t){return{name:ev(i,e+8,e+16).trim(),parent:ev(i,e+24,e+24+8).trim(),lowerLatitude:i.getFloat64(e+72,t),upperLatitude:i.getFloat64(e+88,t),lowerLongitude:i.getFloat64(e+104,t),upperLongitude:i.getFloat64(e+120,t),latitudeInterval:i.getFloat64(e+136,t),longitudeInterval:i.getFloat64(e+152,t),gridNodeCount:i.getInt32(e+168,t)}}function kG(i,e,t,n,r){var s=e+176,o=16;r===!1&&(o=8);for(var a=[],l=0;l<t.gridNodeCount;l++){var c={latitudeShift:i.getFloat32(s+l*o,n),longitudeShift:i.getFloat32(s+l*o+4,n)};r!==!1&&(c.latitudeAccuracy=i.getFloat32(s+l*o+8,n),c.longitudeAccuracy=i.getFloat32(s+l*o+12,n)),a.push(c)}return a}function eo(i,e){if(!(this instanceof eo))return new eo(i);this.forward=null,this.inverse=null,this.init=null,this.name,this.names=null,this.title,e=e||function(c){if(c)throw c};var t=cG(i);if(typeof t!="object"){e("Could not parse to valid json: "+i);return}var n=eo.projections.get(t.projName);if(!n){e("Could not get projection name from: "+i);return}if(t.datumCode&&t.datumCode!=="none"){var r=kl(Xp,t.datumCode);r&&(t.datum_params=t.datum_params||(r.towgs84?r.towgs84.split(","):null),t.ellps=r.ellipse,t.datumName=r.datumName?r.datumName:t.datumCode)}t.k0=t.k0||1,t.axis=t.axis||"enu",t.ellps=t.ellps||"wgs84",t.lat1=t.lat1||t.lat0;var s=SG(t.a,t.b,t.rf,t.ellps,t.sphere),o=EG(s.a,s.b,s.rf,t.R_A),a=MG(t.nadgrids),l=t.datum||LG(t.datumCode,t.datum_params,s.a,s.b,o.es,o.ep2,a);DE(this,t),DE(this,n),this.a=s.a,this.b=s.b,this.rf=s.rf,this.sphere=s.sphere,this.es=o.es,this.e=o.e,this.ep2=o.ep2,this.datum=l,"init"in this&&typeof this.init=="function"&&this.init(),e(null,this)}eo.projections=wG;eo.projections.start();function GG(i,e){return i.datum_type!==e.datum_type||i.a!==e.a||Math.abs(i.es-e.es)>5e-11?!1:i.datum_type===Gc?i.datum_params[0]===e.datum_params[0]&&i.datum_params[1]===e.datum_params[1]&&i.datum_params[2]===e.datum_params[2]:i.datum_type===Bc?i.datum_params[0]===e.datum_params[0]&&i.datum_params[1]===e.datum_params[1]&&i.datum_params[2]===e.datum_params[2]&&i.datum_params[3]===e.datum_params[3]&&i.datum_params[4]===e.datum_params[4]&&i.datum_params[5]===e.datum_params[5]&&i.datum_params[6]===e.datum_params[6]:!0}function EA(i,e,t){var n=i.x,r=i.y,s=i.z?i.z:0,o,a,l,c;if(r<-De&&r>-1.001*De)r=-De;else if(r>De&&r<1.001*De)r=De;else{if(r<-De)return{x:-1/0,y:-1/0,z:i.z};if(r>De)return{x:1/0,y:1/0,z:i.z}}return n>Math.PI&&(n-=2*Math.PI),a=Math.sin(r),c=Math.cos(r),l=a*a,o=t/Math.sqrt(1-e*l),{x:(o+s)*c*Math.cos(n),y:(o+s)*c*Math.sin(n),z:(o*(1-e)+s)*a}}function SA(i,e,t,n){var r=1e-12,s=r*r,o=30,a,l,c,h,u,f,d,g,m,_,v,x,S,b=i.x,A=i.y,F=i.z?i.z:0,N,R,P;if(a=Math.sqrt(b*b+A*A),l=Math.sqrt(b*b+A*A+F*F),a/t<r){if(N=0,l/t<r)return R=De,P=-n,{x:i.x,y:i.y,z:i.z}}else N=Math.atan2(A,b);c=F/l,h=a/l,u=1/Math.sqrt(1-e*(2-e)*h*h),g=h*(1-e)*u,m=c*u,S=0;do S++,d=t/Math.sqrt(1-e*m*m),P=a*g+F*m-d*(1-e*m*m),f=e*d/(d+P),u=1/Math.sqrt(1-f*(2-f)*h*h),_=h*(1-f)*u,v=c*u,x=v*g-_*m,g=_,m=v;while(x*x>s&&S<o);return R=Math.atan(v/Math.abs(_)),{x:N,y:R,z:P}}function BG(i,e,t){if(e===Gc)return{x:i.x+t[0],y:i.y+t[1],z:i.z+t[2]};if(e===Bc){var n=t[0],r=t[1],s=t[2],o=t[3],a=t[4],l=t[5],c=t[6];return{x:c*(i.x-l*i.y+a*i.z)+n,y:c*(l*i.x+i.y-o*i.z)+r,z:c*(-a*i.x+o*i.y+i.z)+s}}}function jG(i,e,t){if(e===Gc)return{x:i.x-t[0],y:i.y-t[1],z:i.z-t[2]};if(e===Bc){var n=t[0],r=t[1],s=t[2],o=t[3],a=t[4],l=t[5],c=t[6],h=(i.x-n)/c,u=(i.y-r)/c,f=(i.z-s)/c;return{x:h+l*u-a*f,y:-l*h+u+o*f,z:a*h-o*u+f}}}function Lp(i){return i===Gc||i===Bc}function UG(i,e,t){if(GG(i,e)||i.datum_type===Zy||e.datum_type===Zy)return t;var n=i.a,r=i.es;if(i.datum_type===pu){var s=BE(i,!1,t);if(s!==0)return;n=ME,r=RE}var o=e.a,a=e.b,l=e.es;if(e.datum_type===pu&&(o=ME,a=G9,l=RE),r===l&&n===o&&!Lp(i.datum_type)&&!Lp(e.datum_type))return t;if(t=EA(t,r,n),Lp(i.datum_type)&&(t=BG(t,i.datum_type,i.datum_params)),Lp(e.datum_type)&&(t=jG(t,e.datum_type,e.datum_params)),t=SA(t,l,o,a),e.datum_type===pu){var c=BE(e,!0,t);if(c!==0)return}return t}function BE(i,e,t){if(i.grids===null||i.grids.length===0)return console.log("Grid shift grids not found"),-1;var n={x:-t.x,y:t.y},r={x:Number.NaN,y:Number.NaN},s=[];e:for(var o=0;o<i.grids.length;o++){var a=i.grids[o];if(s.push(a.name),a.isNull){r=n;break}if(a.grid===null){if(a.mandatory)return console.log("Unable to find mandatory grid '"+a.name+"'"),-1;continue}for(var l=a.grid.subgrids,c=0,h=l.length;c<h;c++){var u=l[c],f=(Math.abs(u.del[1])+Math.abs(u.del[0]))/1e4,d=u.ll[0]-f,g=u.ll[1]-f,m=u.ll[0]+(u.lim[0]-1)*u.del[0]+f,_=u.ll[1]+(u.lim[1]-1)*u.del[1]+f;if(!(g>n.y||d>n.x||_<n.y||m<n.x)&&(r=zG(n,e,u),!isNaN(r.x)))break e}}return isNaN(r.x)?(console.log("Failed to find a grid shift table for location '"+-n.x*Do+" "+n.y*Do+" tried: '"+s+"'"),-1):(t.x=-r.x,t.y=r.y,0)}function zG(i,e,t){var n={x:Number.NaN,y:Number.NaN};if(isNaN(i.x))return n;var r={x:i.x,y:i.y};r.x-=t.ll[0],r.y-=t.ll[1],r.x=We(r.x-Math.PI)+Math.PI;var s=jE(r,t);if(e){if(isNaN(s.x))return n;s.x=r.x-s.x,s.y=r.y-s.y;var o=9,a=1e-12,l,c;do{if(c=jE(s,t),isNaN(c.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}l={x:r.x-(c.x+s.x),y:r.y-(c.y+s.y)},s.x+=l.x,s.y+=l.y}while(o--&&Math.abs(l.x)>a&&Math.abs(l.y)>a);if(o<0)return console.log("Inverse grid shift iterator failed to converge."),n;n.x=We(s.x+t.ll[0]),n.y=s.y+t.ll[1]}else isNaN(s.x)||(n.x=i.x+s.x,n.y=i.y+s.y);return n}function jE(i,e){var t={x:i.x/e.del[0],y:i.y/e.del[1]},n={x:Math.floor(t.x),y:Math.floor(t.y)},r={x:t.x-1*n.x,y:t.y-1*n.y},s={x:Number.NaN,y:Number.NaN},o;if(n.x<0||n.x>=e.lim[0]||n.y<0||n.y>=e.lim[1])return s;o=n.y*e.lim[0]+n.x;var a={x:e.cvs[o][0],y:e.cvs[o][1]};o++;var l={x:e.cvs[o][0],y:e.cvs[o][1]};o+=e.lim[0];var c={x:e.cvs[o][0],y:e.cvs[o][1]};o--;var h={x:e.cvs[o][0],y:e.cvs[o][1]},u=r.x*r.y,f=r.x*(1-r.y),d=(1-r.x)*(1-r.y),g=(1-r.x)*r.y;return s.x=d*a.x+f*l.x+g*h.x+u*c.x,s.y=d*a.y+f*l.y+g*h.y+u*c.y,s}function UE(i,e,t){var n=t.x,r=t.y,s=t.z||0,o,a,l,c={};for(l=0;l<3;l++)if(!(e&&l===2&&t.z===void 0))switch(l===0?(o=n,"ew".indexOf(i.axis[l])!==-1?a="x":a="y"):l===1?(o=r,"ns".indexOf(i.axis[l])!==-1?a="y":a="x"):(o=s,a="z"),i.axis[l]){case"e":c[a]=o;break;case"w":c[a]=-o;break;case"n":c[a]=o;break;case"s":c[a]=-o;break;case"u":t[a]!==void 0&&(c.z=o);break;case"d":t[a]!==void 0&&(c.z=-o);break;default:return null}return c}function TA(i){var e={x:i[0],y:i[1]};return i.length>2&&(e.z=i[2]),i.length>3&&(e.m=i[3]),e}function qG(i){zE(i.x),zE(i.y)}function zE(i){if(typeof Number.isFinite=="function"){if(Number.isFinite(i))return;throw new TypeError("coordinates must be finite numbers")}if(typeof i!="number"||i!==i||!isFinite(i))throw new TypeError("coordinates must be finite numbers")}function VG(i,e){return(i.datum.datum_type===Gc||i.datum.datum_type===Bc||i.datum.datum_type===pu)&&e.datumCode!=="WGS84"||(e.datum.datum_type===Gc||e.datum.datum_type===Bc||e.datum.datum_type===pu)&&i.datumCode!=="WGS84"}function Z0(i,e,t,n){var r;Array.isArray(t)?t=TA(t):t={x:t.x,y:t.y,z:t.z,m:t.m};var s=t.z!==void 0;if(qG(t),i.datum&&e.datum&&VG(i,e)&&(r=new eo("WGS84"),t=Z0(i,r,t,n),i=r),n&&i.axis!=="enu"&&(t=UE(i,!1,t)),i.projName==="longlat")t={x:t.x*sr,y:t.y*sr,z:t.z||0};else if(i.to_meter&&(t={x:t.x*i.to_meter,y:t.y*i.to_meter,z:t.z||0}),t=i.inverse(t),!t)return;if(i.from_greenwich&&(t.x+=i.from_greenwich),t=UG(i.datum,e.datum,t),!!t)return t=t,e.from_greenwich&&(t={x:t.x-e.from_greenwich,y:t.y,z:t.z||0}),e.projName==="longlat"?t={x:t.x*Do,y:t.y*Do,z:t.z||0}:(t=e.forward(t),e.to_meter&&(t={x:t.x/e.to_meter,y:t.y/e.to_meter,z:t.z||0})),n&&e.axis!=="enu"?UE(e,!0,t):(t&&!s&&delete t.z,t)}var qE=eo("WGS84");function F_(i,e,t,n){var r,s,o;return Array.isArray(t)?(r=Z0(i,e,t,n)||{x:NaN,y:NaN},t.length>2?typeof i.name<"u"&&i.name==="geocent"||typeof e.name<"u"&&e.name==="geocent"?typeof r.z=="number"?[r.x,r.y,r.z].concat(t.slice(3)):[r.x,r.y,t[2]].concat(t.slice(3)):[r.x,r.y].concat(t.slice(2)):[r.x,r.y]):(s=Z0(i,e,t,n),o=Object.keys(t),o.length===2||o.forEach(function(a){if(typeof i.name<"u"&&i.name==="geocent"||typeof e.name<"u"&&e.name==="geocent"){if(a==="x"||a==="y"||a==="z")return}else if(a==="x"||a==="y")return;s[a]=t[a]}),s)}function Cp(i){return i instanceof eo?i:typeof i=="object"&&"oProj"in i?i.oProj:eo(i)}function $G(i,e,t){var n,r,s=!1,o;return typeof e>"u"?(r=Cp(i),n=qE,s=!0):(typeof e.x<"u"||Array.isArray(e))&&(t=e,r=Cp(i),n=qE,s=!0),n||(n=Cp(i)),r||(r=Cp(e)),t?F_(n,r,t):(o={forward:function(a,l){return F_(n,r,a,l)},inverse:function(a,l){return F_(r,n,a,l)}},s&&(o.oProj=r),o)}var VE=6,LA="AJSAJS",CA="AFAFAF",Zh=65,Ur=73,Cs=79,jf=86,Uf=90;const WG={forward:AA,inverse:HG,toPoint:PA};function AA(i,e){return e=e||5,YG(XG({lat:i[1],lon:i[0]}),e)}function HG(i){var e=g5(RA(i.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]}function PA(i){var e=g5(RA(i.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function O_(i){return i*(Math.PI/180)}function $E(i){return 180*(i/Math.PI)}function XG(i){var e=i.lat,t=i.lon,n=6378137,r=.00669438,s=.9996,o,a,l,c,h,u,f,d=O_(e),g=O_(t),m,_;_=Math.floor((t+180)/6)+1,t===180&&(_=60),e>=56&&e<64&&t>=3&&t<12&&(_=32),e>=72&&e<84&&(t>=0&&t<9?_=31:t>=9&&t<21?_=33:t>=21&&t<33?_=35:t>=33&&t<42&&(_=37)),o=(_-1)*6-180+3,m=O_(o),a=r/(1-r),l=n/Math.sqrt(1-r*Math.sin(d)*Math.sin(d)),c=Math.tan(d)*Math.tan(d),h=a*Math.cos(d)*Math.cos(d),u=Math.cos(d)*(g-m),f=n*((1-r/4-3*r*r/64-5*r*r*r/256)*d-(3*r/8+3*r*r/32+45*r*r*r/1024)*Math.sin(2*d)+(15*r*r/256+45*r*r*r/1024)*Math.sin(4*d)-35*r*r*r/3072*Math.sin(6*d));var v=s*l*(u+(1-c+h)*u*u*u/6+(5-18*c+c*c+72*h-58*a)*u*u*u*u*u/120)+5e5,x=s*(f+l*Math.tan(d)*(u*u/2+(5-c+9*h+4*h*h)*u*u*u*u/24+(61-58*c+c*c+600*h-330*a)*u*u*u*u*u*u/720));return e<0&&(x+=1e7),{northing:Math.round(x),easting:Math.round(v),zoneNumber:_,zoneLetter:KG(e)}}function g5(i){var e=i.northing,t=i.easting,n=i.zoneLetter,r=i.zoneNumber;if(r<0||r>60)return null;var s=.9996,o=6378137,a=.00669438,l,c=(1-Math.sqrt(1-a))/(1+Math.sqrt(1-a)),h,u,f,d,g,m,_,v,x,S=t-5e5,b=e;n<"N"&&(b-=1e7),_=(r-1)*6-180+3,l=a/(1-a),m=b/s,v=m/(o*(1-a/4-3*a*a/64-5*a*a*a/256)),x=v+(3*c/2-27*c*c*c/32)*Math.sin(2*v)+(21*c*c/16-55*c*c*c*c/32)*Math.sin(4*v)+151*c*c*c/96*Math.sin(6*v),h=o/Math.sqrt(1-a*Math.sin(x)*Math.sin(x)),u=Math.tan(x)*Math.tan(x),f=l*Math.cos(x)*Math.cos(x),d=o*(1-a)/Math.pow(1-a*Math.sin(x)*Math.sin(x),1.5),g=S/(h*s);var A=x-h*Math.tan(x)/d*(g*g/2-(5+3*u+10*f-4*f*f-9*l)*g*g*g*g/24+(61+90*u+298*f+45*u*u-252*l-3*f*f)*g*g*g*g*g*g/720);A=$E(A);var F=(g-(1+2*u+f)*g*g*g/6+(5-2*f+28*u-3*f*f+8*l+24*u*u)*g*g*g*g*g/120)/Math.cos(x);F=_+$E(F);var N;if(i.accuracy){var R=g5({northing:i.northing+i.accuracy,easting:i.easting+i.accuracy,zoneLetter:i.zoneLetter,zoneNumber:i.zoneNumber});N={top:R.lat,right:R.lon,bottom:A,left:F}}else N={lat:A,lon:F};return N}function KG(i){var e="Z";return 84>=i&&i>=72?e="X":72>i&&i>=64?e="W":64>i&&i>=56?e="V":56>i&&i>=48?e="U":48>i&&i>=40?e="T":40>i&&i>=32?e="S":32>i&&i>=24?e="R":24>i&&i>=16?e="Q":16>i&&i>=8?e="P":8>i&&i>=0?e="N":0>i&&i>=-8?e="M":-8>i&&i>=-16?e="L":-16>i&&i>=-24?e="K":-24>i&&i>=-32?e="J":-32>i&&i>=-40?e="H":-40>i&&i>=-48?e="G":-48>i&&i>=-56?e="F":-56>i&&i>=-64?e="E":-64>i&&i>=-72?e="D":-72>i&&i>=-80&&(e="C"),e}function YG(i,e){var t="00000"+i.easting,n="00000"+i.northing;return i.zoneNumber+i.zoneLetter+ZG(i.easting,i.northing,i.zoneNumber)+t.substr(t.length-5,e)+n.substr(n.length-5,e)}function ZG(i,e,t){var n=MA(t),r=Math.floor(i/1e5),s=Math.floor(e/1e5)%20;return JG(r,s,n)}function MA(i){var e=i%VE;return e===0&&(e=VE),e}function JG(i,e,t){var n=t-1,r=LA.charCodeAt(n),s=CA.charCodeAt(n),o=r+i-1,a=s+e,l=!1;o>Uf&&(o=o-Uf+Zh-1,l=!0),(o===Ur||r<Ur&&o>Ur||(o>Ur||r<Ur)&&l)&&o++,(o===Cs||r<Cs&&o>Cs||(o>Cs||r<Cs)&&l)&&(o++,o===Ur&&o++),o>Uf&&(o=o-Uf+Zh-1),a>jf?(a=a-jf+Zh-1,l=!0):l=!1,(a===Ur||s<Ur&&a>Ur||(a>Ur||s<Ur)&&l)&&a++,(a===Cs||s<Cs&&a>Cs||(a>Cs||s<Cs)&&l)&&(a++,a===Ur&&a++),a>jf&&(a=a-jf+Zh-1);var c=String.fromCharCode(o)+String.fromCharCode(a);return c}function RA(i){if(i&&i.length===0)throw"MGRSPoint coverting from nothing";for(var e=i.length,t=null,n="",r,s=0;!/[A-Z]/.test(r=i.charAt(s));){if(s>=2)throw"MGRSPoint bad conversion from: "+i;n+=r,s++}var o=parseInt(n,10);if(s===0||s+3>e)throw"MGRSPoint bad conversion from: "+i;var a=i.charAt(s++);if(a<="A"||a==="B"||a==="Y"||a>="Z"||a==="I"||a==="O")throw"MGRSPoint zone letter "+a+" not handled: "+i;t=i.substring(s,s+=2);for(var l=MA(o),c=QG(t.charAt(0),l),h=eB(t.charAt(1),l);h<tB(a);)h+=2e6;var u=e-s;if(u%2!==0)throw`MGRSPoint has to have an even number
727
- of digits after the zone letter and two 100km letters - front
728
- half for easting meters, second half for
729
- northing meters`+i;var f=u/2,d=0,g=0,m,_,v,x,S;return f>0&&(m=1e5/Math.pow(10,f),_=i.substring(s,s+f),d=parseFloat(_)*m,v=i.substring(s+f),g=parseFloat(v)*m),x=d+c,S=g+h,{easting:x,northing:S,zoneLetter:a,zoneNumber:o,accuracy:m}}function QG(i,e){for(var t=LA.charCodeAt(e-1),n=1e5,r=!1;t!==i.charCodeAt(0);){if(t++,t===Ur&&t++,t===Cs&&t++,t>Uf){if(r)throw"Bad character: "+i;t=Zh,r=!0}n+=1e5}return n}function eB(i,e){if(i>"V")throw"MGRSPoint given invalid Northing "+i;for(var t=CA.charCodeAt(e-1),n=0,r=!1;t!==i.charCodeAt(0);){if(t++,t===Ur&&t++,t===Cs&&t++,t>jf){if(r)throw"Bad character: "+i;t=Zh,r=!0}n+=1e5}return n}function tB(i){var e;switch(i){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+i}function Iu(i,e,t){if(!(this instanceof Iu))return new Iu(i,e,t);if(Array.isArray(i))this.x=i[0],this.y=i[1],this.z=i[2]||0;else if(typeof i=="object")this.x=i.x,this.y=i.y,this.z=i.z||0;else if(typeof i=="string"&&typeof e>"u"){var n=i.split(",");this.x=parseFloat(n[0]),this.y=parseFloat(n[1]),this.z=parseFloat(n[2])||0}else this.x=i,this.y=e,this.z=t||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Iu.fromMGRS=function(i){return new Iu(PA(i))};Iu.prototype.toMGRS=function(i){return AA([this.x,this.y],i)};var iB=1,nB=.25,WE=.046875,HE=.01953125,XE=.01068115234375,rB=.75,sB=.46875,oB=.013020833333333334,aB=.007120768229166667,lB=.3645833333333333,cB=.005696614583333333,hB=.3076171875;function p5(i){var e=[];e[0]=iB-i*(nB+i*(WE+i*(HE+i*XE))),e[1]=i*(rB-i*(WE+i*(HE+i*XE)));var t=i*i;return e[2]=t*(sB-i*(oB+i*aB)),t*=i,e[3]=t*(lB-i*cB),e[4]=t*i*hB,e}function Vu(i,e,t,n){return t*=e,e*=e,n[0]*i-t*(n[1]+e*(n[2]+e*(n[3]+e*n[4])))}var uB=20;function m5(i,e,t){for(var n=1/(1-e),r=i,s=uB;s;--s){var o=Math.sin(r),a=1-e*o*o;if(a=(Vu(r,o,Math.cos(r),t)-i)*(a*Math.sqrt(a))*n,r-=a,Math.abs(a)<Ve)return r}return r}function fB(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.es&&(this.en=p5(this.es),this.ml0=Vu(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function dB(i){var e=i.x,t=i.y,n=We(e-this.long0),r,s,o,a=Math.sin(t),l=Math.cos(t);if(this.es){var h=l*n,u=Math.pow(h,2),f=this.ep2*Math.pow(l,2),d=Math.pow(f,2),g=Math.abs(l)>Ve?Math.tan(t):0,m=Math.pow(g,2),_=Math.pow(m,2);r=1-this.es*Math.pow(a,2),h=h/Math.sqrt(r);var v=Vu(t,a,l,this.en);s=this.a*(this.k0*h*(1+u/6*(1-m+f+u/20*(5-18*m+_+14*f-58*m*f+u/42*(61+179*_-_*m-479*m)))))+this.x0,o=this.a*(this.k0*(v-this.ml0+a*n*h/2*(1+u/12*(5-m+9*f+4*d+u/30*(61+_-58*m+270*f-330*m*f+u/56*(1385+543*_-_*m-3111*m))))))+this.y0}else{var c=l*Math.sin(n);if(Math.abs(Math.abs(c)-1)<Ve)return 93;if(s=.5*this.a*this.k0*Math.log((1+c)/(1-c))+this.x0,o=l*Math.cos(n)/Math.sqrt(1-Math.pow(c,2)),c=Math.abs(o),c>=1){if(c-1>Ve)return 93;o=0}else o=Math.acos(o);t<0&&(o=-o),o=this.a*this.k0*(o-this.lat0)+this.y0}return i.x=s,i.y=o,i}function gB(i){var e,t,n,r,s=(i.x-this.x0)*(1/this.a),o=(i.y-this.y0)*(1/this.a);if(this.es)if(e=this.ml0+o/this.k0,t=m5(e,this.es,this.en),Math.abs(t)<De){var u=Math.sin(t),f=Math.cos(t),d=Math.abs(f)>Ve?Math.tan(t):0,g=this.ep2*Math.pow(f,2),m=Math.pow(g,2),_=Math.pow(d,2),v=Math.pow(_,2);e=1-this.es*Math.pow(u,2);var x=s*Math.sqrt(e)/this.k0,S=Math.pow(x,2);e=e*d,n=t-e*S/(1-this.es)*.5*(1-S/12*(5+3*_-9*g*_+g-4*m-S/30*(61+90*_-252*g*_+45*v+46*g-S/56*(1385+3633*_+4095*v+1574*v*_)))),r=We(this.long0+x*(1-S/6*(1+2*_+g-S/20*(5+28*_+24*v+8*g*_+6*g-S/42*(61+662*_+1320*v+720*v*_))))/f)}else n=De*ag(o),r=0;else{var a=Math.exp(s/this.k0),l=.5*(a-1/a),c=this.lat0+o/this.k0,h=Math.cos(c);e=Math.sqrt((1-Math.pow(h,2))/(1+Math.pow(l,2))),n=Math.asin(e),o<0&&(n=-n),l===0&&h===0?r=0:r=We(Math.atan2(l,h)+this.long0)}return i.x=r,i.y=n,i}var pB=["Fast_Transverse_Mercator","Fast Transverse Mercator"];const Kp={init:fB,forward:dB,inverse:gB,names:pB};function IA(i){var e=Math.exp(i);return e=(e-1/e)/2,e}function Wr(i,e){i=Math.abs(i),e=Math.abs(e);var t=Math.max(i,e),n=Math.min(i,e)/(t||1);return t*Math.sqrt(1+Math.pow(n,2))}function mB(i){var e=1+i,t=e-1;return t===0?i:i*Math.log(e)/t}function _B(i){var e=Math.abs(i);return e=mB(e*(1+e/(Wr(1,e)+1))),i<0?-e:e}function _5(i,e){for(var t=2*Math.cos(2*e),n=i.length-1,r=i[n],s=0,o;--n>=0;)o=-s+t*r+i[n],s=r,r=o;return e+o*Math.sin(2*e)}function yB(i,e){for(var t=2*Math.cos(e),n=i.length-1,r=i[n],s=0,o;--n>=0;)o=-s+t*r+i[n],s=r,r=o;return Math.sin(e)*o}function vB(i){var e=Math.exp(i);return e=(e+1/e)/2,e}function NA(i,e,t){for(var n=Math.sin(e),r=Math.cos(e),s=IA(t),o=vB(t),a=2*r*o,l=-2*n*s,c=i.length-1,h=i[c],u=0,f=0,d=0,g,m;--c>=0;)g=f,m=u,f=h,u=d,h=-g+a*f-l*u+i[c],d=-m+l*f+a*u;return a=n*o,l=r*s,[a*h-l*d,a*d+l*h]}function xB(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(Kp.init.apply(this),this.forward=Kp.forward,this.inverse=Kp.inverse),this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var i=this.es/(1+Math.sqrt(1-this.es)),e=i/(2-i),t=e;this.cgb[0]=e*(2+e*(-2/3+e*(-2+e*(116/45+e*(26/45+e*(-2854/675)))))),this.cbg[0]=e*(-2+e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))),t=t*e,this.cgb[1]=t*(7/3+e*(-8/5+e*(-227/45+e*(2704/315+e*(2323/945))))),this.cbg[1]=t*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),t=t*e,this.cgb[2]=t*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=t*(-26/15+e*(34/21+e*(8/5+e*(-12686/2835)))),t=t*e,this.cgb[3]=t*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=t*(1237/630+e*(-12/5+e*(-24832/14175))),t=t*e,this.cgb[4]=t*(4174/315+e*(-144838/6237)),this.cbg[4]=t*(-734/315+e*(109598/31185)),t=t*e,this.cgb[5]=t*(601676/22275),this.cbg[5]=t*(444337/155925),t=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+t*(1/4+t*(1/64+t/256))),this.utg[0]=e*(-.5+e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=t*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=t*(13/48+e*(-3/5+e*(557/1440+e*(281/630+e*(-1983433/1935360))))),t=t*e,this.utg[2]=t*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=t*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),t=t*e,this.utg[3]=t*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=t*(49561/161280+e*(-179/168+e*(6601661/7257600))),t=t*e,this.utg[4]=t*(-4583/161280+e*(108847/3991680)),this.gtu[4]=t*(34729/80640+e*(-3418889/1995840)),t=t*e,this.utg[5]=t*(-20648693/638668800),this.gtu[5]=t*(212378941/319334400);var n=_5(this.cbg,this.lat0);this.Zb=-this.Qn*(n+yB(this.gtu,2*n))}function wB(i){var e=We(i.x-this.long0),t=i.y;t=_5(this.cbg,t);var n=Math.sin(t),r=Math.cos(t),s=Math.sin(e),o=Math.cos(e);t=Math.atan2(n,o*r),e=Math.atan2(s*r,Wr(n,r*o)),e=_B(Math.tan(e));var a=NA(this.gtu,2*t,2*e);t=t+a[0],e=e+a[1];var l,c;return Math.abs(e)<=2.623395162778?(l=this.a*(this.Qn*e)+this.x0,c=this.a*(this.Qn*t+this.Zb)+this.y0):(l=1/0,c=1/0),i.x=l,i.y=c,i}function bB(i){var e=(i.x-this.x0)*(1/this.a),t=(i.y-this.y0)*(1/this.a);t=(t-this.Zb)/this.Qn,e=e/this.Qn;var n,r;if(Math.abs(e)<=2.623395162778){var s=NA(this.utg,2*t,2*e);t=t+s[0],e=e+s[1],e=Math.atan(IA(e));var o=Math.sin(t),a=Math.cos(t),l=Math.sin(e),c=Math.cos(e);t=Math.atan2(o*c,Wr(l,c*a)),e=Math.atan2(l,c*a),n=We(e+this.long0),r=_5(this.cgb,t)}else n=1/0,r=1/0;return i.x=n,i.y=r,i}var EB=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","Gauss Kruger","Gauss_Kruger","tmerc"];const Yp={init:xB,forward:wB,inverse:bB,names:EB};function SB(i,e){if(i===void 0){if(i=Math.floor((We(e)+Math.PI)*30/Math.PI)+1,i<0)return 0;if(i>60)return 60}return i}var TB="etmerc";function LB(){var i=SB(this.zone,this.long0);if(i===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(i)-183)*sr,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Yp.init.apply(this),this.forward=Yp.forward,this.inverse=Yp.inverse}var CB=["Universal Transverse Mercator System","utm"];const AB={init:LB,names:CB,dependsOn:TB};function y5(i,e){return Math.pow((1-i)/(1+i),e)}var PB=20;function MB(){var i=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*i*i),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(i/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+mi)/(Math.pow(Math.tan(.5*this.lat0+mi),this.C)*y5(this.e*i,this.ratexp))}function RB(i){var e=i.x,t=i.y;return i.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*t+mi),this.C)*y5(this.e*Math.sin(t),this.ratexp))-De,i.x=this.C*e,i}function IB(i){for(var e=1e-14,t=i.x/this.C,n=i.y,r=Math.pow(Math.tan(.5*n+mi)/this.K,1/this.C),s=PB;s>0&&(n=2*Math.atan(r*y5(this.e*Math.sin(i.y),-.5*this.e))-De,!(Math.abs(n-i.y)<e));--s)i.y=n;return s?(i.x=t,i.y=n,i):null}const v5={init:MB,forward:RB,inverse:IB};function NB(){v5.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function FB(i){var e,t,n,r;return i.x=We(i.x-this.long0),v5.forward.apply(this,[i]),e=Math.sin(i.y),t=Math.cos(i.y),n=Math.cos(i.x),r=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*t*n),i.x=r*t*Math.sin(i.x),i.y=r*(this.cosc0*e-this.sinc0*t*n),i.x=this.a*i.x+this.x0,i.y=this.a*i.y+this.y0,i}function OB(i){var e,t,n,r,s;if(i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a,i.x/=this.k0,i.y/=this.k0,s=Wr(i.x,i.y)){var o=2*Math.atan2(s,this.R2);e=Math.sin(o),t=Math.cos(o),r=Math.asin(t*this.sinc0+i.y*e*this.cosc0/s),n=Math.atan2(i.x*e,s*this.cosc0*t-i.y*this.sinc0*e)}else r=this.phic0,n=0;return i.x=n,i.y=r,v5.inverse.apply(this,[i]),i.x=We(i.x+this.long0),i}var DB=["Stereographic_North_Pole","Oblique_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"];const kB={init:NB,forward:FB,inverse:OB,names:DB};function x5(i,e,t){return e*=t,Math.tan(.5*(De+i))*Math.pow((1-e)/(1+e),.5*t)}function GB(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=Ve&&(this.k0=.5*(1+ag(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=Ve&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=Ve&&Math.abs(Math.cos(this.lat_ts))>Ve&&(this.k0=.5*this.cons*Wo(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Qs(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=Wo(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(x5(this.lat0,this.sinlat0,this.e))-De,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function BB(i){var e=i.x,t=i.y,n=Math.sin(t),r=Math.cos(t),s,o,a,l,c,h,u=We(e-this.long0);return Math.abs(Math.abs(e-this.long0)-Math.PI)<=Ve&&Math.abs(t+this.lat0)<=Ve?(i.x=NaN,i.y=NaN,i):this.sphere?(s=2*this.k0/(1+this.sinlat0*n+this.coslat0*r*Math.cos(u)),i.x=this.a*s*r*Math.sin(u)+this.x0,i.y=this.a*s*(this.coslat0*n-this.sinlat0*r*Math.cos(u))+this.y0,i):(o=2*Math.atan(x5(t,n,this.e))-De,l=Math.cos(o),a=Math.sin(o),Math.abs(this.coslat0)<=Ve?(c=Qs(this.e,t*this.con,this.con*n),h=2*this.a*this.k0*c/this.cons,i.x=this.x0+h*Math.sin(e-this.long0),i.y=this.y0-this.con*h*Math.cos(e-this.long0),i):(Math.abs(this.sinlat0)<Ve?(s=2*this.a*this.k0/(1+l*Math.cos(u)),i.y=s*a):(s=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*a+this.cosX0*l*Math.cos(u))),i.y=s*(this.cosX0*a-this.sinX0*l*Math.cos(u))+this.y0),i.x=s*l*Math.sin(u)+this.x0,i))}function jB(i){i.x-=this.x0,i.y-=this.y0;var e,t,n,r,s,o=Math.sqrt(i.x*i.x+i.y*i.y);if(this.sphere){var a=2*Math.atan(o/(2*this.a*this.k0));return e=this.long0,t=this.lat0,o<=Ve?(i.x=e,i.y=t,i):(t=Math.asin(Math.cos(a)*this.sinlat0+i.y*Math.sin(a)*this.coslat0/o),Math.abs(this.coslat0)<Ve?this.lat0>0?e=We(this.long0+Math.atan2(i.x,-1*i.y)):e=We(this.long0+Math.atan2(i.x,i.y)):e=We(this.long0+Math.atan2(i.x*Math.sin(a),o*this.coslat0*Math.cos(a)-i.y*this.sinlat0*Math.sin(a))),i.x=e,i.y=t,i)}else if(Math.abs(this.coslat0)<=Ve){if(o<=Ve)return t=this.lat0,e=this.long0,i.x=e,i.y=t,i;i.x*=this.con,i.y*=this.con,n=o*this.cons/(2*this.a*this.k0),t=this.con*Ud(this.e,n),e=this.con*We(this.con*this.long0+Math.atan2(i.x,-1*i.y))}else r=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,o<=Ve?s=this.X0:(s=Math.asin(Math.cos(r)*this.sinX0+i.y*Math.sin(r)*this.cosX0/o),e=We(this.long0+Math.atan2(i.x*Math.sin(r),o*this.cosX0*Math.cos(r)-i.y*this.sinX0*Math.sin(r)))),t=-1*Ud(this.e,Math.tan(.5*(De+s)));return i.x=e,i.y=t,i}var UB=["stere","Stereographic_South_Pole","Polar_Stereographic_variant_A","Polar_Stereographic_variant_B","Polar_Stereographic"];const zB={init:GB,forward:BB,inverse:jB,names:UB,ssfn_:x5};function qB(){var i=this.lat0;this.lambda0=this.long0;var e=Math.sin(i),t=this.a,n=this.rf,r=1/n,s=2*r-Math.pow(r,2),o=this.e=Math.sqrt(s);this.R=this.k0*t*Math.sqrt(1-s)/(1-s*Math.pow(e,2)),this.alpha=Math.sqrt(1+s/(1-s)*Math.pow(Math.cos(i),4)),this.b0=Math.asin(e/this.alpha);var a=Math.log(Math.tan(Math.PI/4+this.b0/2)),l=Math.log(Math.tan(Math.PI/4+i/2)),c=Math.log((1+o*e)/(1-o*e));this.K=a-this.alpha*l+this.alpha*o/2*c}function VB(i){var e=Math.log(Math.tan(Math.PI/4-i.y/2)),t=this.e/2*Math.log((1+this.e*Math.sin(i.y))/(1-this.e*Math.sin(i.y))),n=-this.alpha*(e+t)+this.K,r=2*(Math.atan(Math.exp(n))-Math.PI/4),s=this.alpha*(i.x-this.lambda0),o=Math.atan(Math.sin(s)/(Math.sin(this.b0)*Math.tan(r)+Math.cos(this.b0)*Math.cos(s))),a=Math.asin(Math.cos(this.b0)*Math.sin(r)-Math.sin(this.b0)*Math.cos(r)*Math.cos(s));return i.y=this.R/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)))+this.y0,i.x=this.R*o+this.x0,i}function $B(i){for(var e=i.x-this.x0,t=i.y-this.y0,n=e/this.R,r=2*(Math.atan(Math.exp(t/this.R))-Math.PI/4),s=Math.asin(Math.cos(this.b0)*Math.sin(r)+Math.sin(this.b0)*Math.cos(r)*Math.cos(n)),o=Math.atan(Math.sin(n)/(Math.cos(this.b0)*Math.cos(n)-Math.sin(this.b0)*Math.tan(r))),a=this.lambda0+o/this.alpha,l=0,c=s,h=-1e3,u=0;Math.abs(c-h)>1e-7;){if(++u>20)return;l=1/this.alpha*(Math.log(Math.tan(Math.PI/4+s/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(c))/2)),h=c,c=2*Math.atan(Math.exp(l))-Math.PI/2}return i.x=a,i.y=c,i}var WB=["somerc"];const HB={init:qB,forward:VB,inverse:$B,names:WB};var jh=1e-7;function XB(i){var e=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],t=typeof i.projName=="object"?Object.keys(i.projName)[0]:i.projName;return"no_uoff"in i||"no_off"in i||e.indexOf(t)!==-1||e.indexOf(wA(t))!==-1}function KB(){var i,e,t,n,r,s,o,a,l,c,h=0,u,f=0,d=0,g=0,m=0,_=0,v=0;this.no_off=XB(this),this.no_rot="no_rot"in this;var x=!1;"alpha"in this&&(x=!0);var S=!1;if("rectified_grid_angle"in this&&(S=!0),x&&(v=this.alpha),S&&(h=this.rectified_grid_angle),x||S)f=this.longc;else if(d=this.long1,m=this.lat1,g=this.long2,_=this.lat2,Math.abs(m-_)<=jh||(i=Math.abs(m))<=jh||Math.abs(i-De)<=jh||Math.abs(Math.abs(this.lat0)-De)<=jh||Math.abs(Math.abs(_)-De)<=jh)throw new Error;var b=1-this.es;e=Math.sqrt(b),Math.abs(this.lat0)>Ve?(a=Math.sin(this.lat0),t=Math.cos(this.lat0),i=1-this.es*a*a,this.B=t*t,this.B=Math.sqrt(1+this.es*this.B*this.B/b),this.A=this.B*this.k0*e/i,n=this.B*e/(t*Math.sqrt(i)),r=n*n-1,r<=0?r=0:(r=Math.sqrt(r),this.lat0<0&&(r=-r)),this.E=r+=n,this.E*=Math.pow(Qs(this.e,this.lat0,a),this.B)):(this.B=1/e,this.A=this.k0,this.E=n=r=1),x||S?(x?(u=Math.asin(Math.sin(v)/n),S||(h=v)):(u=h,v=Math.asin(n*Math.sin(u))),this.lam0=f-Math.asin(.5*(r-1/r)*Math.tan(u))/this.B):(s=Math.pow(Qs(this.e,m,Math.sin(m)),this.B),o=Math.pow(Qs(this.e,_,Math.sin(_)),this.B),r=this.E/s,l=(o-s)/(o+s),c=this.E*this.E,c=(c-o*s)/(c+o*s),i=d-g,i<-Math.PI?g-=Bd:i>Math.PI&&(g+=Bd),this.lam0=We(.5*(d+g)-Math.atan(c*Math.tan(.5*this.B*(d-g))/l)/this.B),u=Math.atan(2*Math.sin(this.B*We(d-this.lam0))/(r-1/r)),h=v=Math.asin(n*Math.sin(u))),this.singam=Math.sin(u),this.cosgam=Math.cos(u),this.sinrot=Math.sin(h),this.cosrot=Math.cos(h),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(n*n-1)/Math.cos(v))),this.lat0<0&&(this.u_0=-this.u_0)),r=.5*u,this.v_pole_n=this.ArB*Math.log(Math.tan(mi-r)),this.v_pole_s=this.ArB*Math.log(Math.tan(mi+r))}function YB(i){var e={},t,n,r,s,o,a,l,c;if(i.x=i.x-this.lam0,Math.abs(Math.abs(i.y)-De)>Ve){if(o=this.E/Math.pow(Qs(this.e,i.y,Math.sin(i.y)),this.B),a=1/o,t=.5*(o-a),n=.5*(o+a),s=Math.sin(this.B*i.x),r=(t*this.singam-s*this.cosgam)/n,Math.abs(Math.abs(r)-1)<Ve)throw new Error;c=.5*this.ArB*Math.log((1-r)/(1+r)),a=Math.cos(this.B*i.x),Math.abs(a)<jh?l=this.A*i.x:l=this.ArB*Math.atan2(t*this.cosgam+s*this.singam,a)}else c=i.y>0?this.v_pole_n:this.v_pole_s,l=this.ArB*i.y;return this.no_rot?(e.x=l,e.y=c):(l-=this.u_0,e.x=c*this.cosrot+l*this.sinrot,e.y=l*this.cosrot-c*this.sinrot),e.x=this.a*e.x+this.x0,e.y=this.a*e.y+this.y0,e}function ZB(i){var e,t,n,r,s,o,a,l={};if(i.x=(i.x-this.x0)*(1/this.a),i.y=(i.y-this.y0)*(1/this.a),this.no_rot?(t=i.y,e=i.x):(t=i.x*this.cosrot-i.y*this.sinrot,e=i.y*this.cosrot+i.x*this.sinrot+this.u_0),n=Math.exp(-this.BrA*t),r=.5*(n-1/n),s=.5*(n+1/n),o=Math.sin(this.BrA*e),a=(o*this.cosgam+r*this.singam)/s,Math.abs(Math.abs(a)-1)<Ve)l.x=0,l.y=a<0?-De:De;else{if(l.y=this.E/Math.sqrt((1+a)/(1-a)),l.y=Ud(this.e,Math.pow(l.y,1/this.B)),l.y===1/0)throw new Error;l.x=-this.rB*Math.atan2(r*this.cosgam-o*this.singam,Math.cos(this.BrA*e))}return l.x+=this.lam0,l}var JB=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Variant_B","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"];const QB={init:KB,forward:YB,inverse:ZB,names:JB};function ej(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<Ve)){var i=this.b/this.a;this.e=Math.sqrt(1-i*i);var e=Math.sin(this.lat1),t=Math.cos(this.lat1),n=Wo(this.e,e,t),r=Qs(this.e,this.lat1,e),s=Math.sin(this.lat2),o=Math.cos(this.lat2),a=Wo(this.e,s,o),l=Qs(this.e,this.lat2,s),c=Math.abs(Math.abs(this.lat0)-De)<Ve?0:Qs(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>Ve?this.ns=Math.log(n/a)/Math.log(r/l):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=n/(this.ns*Math.pow(r,this.ns)),this.rh=this.a*this.f0*Math.pow(c,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function tj(i){var e=i.x,t=i.y;Math.abs(2*Math.abs(t)-Math.PI)<=Ve&&(t=ag(t)*(De-2*Ve));var n=Math.abs(Math.abs(t)-De),r,s;if(n>Ve)r=Qs(this.e,t,Math.sin(t)),s=this.a*this.f0*Math.pow(r,this.ns);else{if(n=t*this.ns,n<=0)return null;s=0}var o=this.ns*We(e-this.long0);return i.x=this.k0*(s*Math.sin(o))+this.x0,i.y=this.k0*(this.rh-s*Math.cos(o))+this.y0,i}function ij(i){var e,t,n,r,s,o=(i.x-this.x0)/this.k0,a=this.rh-(i.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(o*o+a*a),t=1):(e=-Math.sqrt(o*o+a*a),t=-1);var l=0;if(e!==0&&(l=Math.atan2(t*o,t*a)),e!==0||this.ns>0){if(t=1/this.ns,n=Math.pow(e/(this.a*this.f0),t),r=Ud(this.e,n),r===-9999)return null}else r=-De;return s=We(l/this.ns+this.long0),i.x=s,i.y=r,i}var nj=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"];const rj={init:ej,forward:tj,inverse:ij,names:nj};function sj(){this.a=6377397155e-3,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.7417649320975901-.308341501185665),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function oj(i){var e,t,n,r,s,o,a,l=i.x,c=i.y,h=We(l-this.long0);return e=Math.pow((1+this.e*Math.sin(c))/(1-this.e*Math.sin(c)),this.alfa*this.e/2),t=2*(Math.atan(this.k*Math.pow(Math.tan(c/2+this.s45),this.alfa)/e)-this.s45),n=-h*this.alfa,r=Math.asin(Math.cos(this.ad)*Math.sin(t)+Math.sin(this.ad)*Math.cos(t)*Math.cos(n)),s=Math.asin(Math.cos(t)*Math.sin(n)/Math.cos(r)),o=this.n*s,a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(r/2+this.s45),this.n),i.y=a*Math.cos(o)/1,i.x=a*Math.sin(o)/1,this.czech||(i.y*=-1,i.x*=-1),i}function aj(i){var e,t,n,r,s,o,a,l,c=i.x;i.x=i.y,i.y=c,this.czech||(i.y*=-1,i.x*=-1),o=Math.sqrt(i.x*i.x+i.y*i.y),s=Math.atan2(i.y,i.x),r=s/Math.sin(this.s0),n=2*(Math.atan(Math.pow(this.ro0/o,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(n)-Math.sin(this.ad)*Math.cos(n)*Math.cos(r)),t=Math.asin(Math.cos(n)*Math.sin(r)/Math.cos(e)),i.x=this.long0-t/this.alfa,a=e,l=0;var h=0;do i.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(a))/(1-this.e*Math.sin(a)),this.e/2))-this.s45),Math.abs(a-i.y)<1e-10&&(l=1),a=i.y,h+=1;while(l===0&&h<15);return h>=15?null:i}var lj=["Krovak","krovak"];const cj={init:sj,forward:oj,inverse:aj,names:lj};function Or(i,e,t,n,r){return i*r-e*Math.sin(2*r)+t*Math.sin(4*r)-n*Math.sin(6*r)}function lg(i){return 1-.25*i*(1+i/16*(3+1.25*i))}function cg(i){return .375*i*(1+.25*i*(1+.46875*i))}function hg(i){return .05859375*i*i*(1+.75*i)}function ug(i){return i*i*i*(35/3072)}function w5(i,e,t){var n=e*t;return i/Math.sqrt(1-n*n)}function Hl(i){return Math.abs(i)<De?i:i-ag(i)*Math.PI}function J0(i,e,t,n,r){var s,o;s=i/e;for(var a=0;a<15;a++)if(o=(i-(e*s-t*Math.sin(2*s)+n*Math.sin(4*s)-r*Math.sin(6*s)))/(e-2*t*Math.cos(2*s)+4*n*Math.cos(4*s)-6*r*Math.cos(6*s)),s+=o,Math.abs(o)<=1e-10)return s;return NaN}function hj(){this.sphere||(this.e0=lg(this.es),this.e1=cg(this.es),this.e2=hg(this.es),this.e3=ug(this.es),this.ml0=this.a*Or(this.e0,this.e1,this.e2,this.e3,this.lat0))}function uj(i){var e,t,n=i.x,r=i.y;if(n=We(n-this.long0),this.sphere)e=this.a*Math.asin(Math.cos(r)*Math.sin(n)),t=this.a*(Math.atan2(Math.tan(r),Math.cos(n))-this.lat0);else{var s=Math.sin(r),o=Math.cos(r),a=w5(this.a,this.e,s),l=Math.tan(r)*Math.tan(r),c=n*Math.cos(r),h=c*c,u=this.es*o*o/(1-this.es),f=this.a*Or(this.e0,this.e1,this.e2,this.e3,r);e=a*c*(1-h*l*(1/6-(8-l+8*u)*h/120)),t=f-this.ml0+a*s/o*h*(.5+(5-l+6*u)*h/24)}return i.x=e+this.x0,i.y=t+this.y0,i}function fj(i){i.x-=this.x0,i.y-=this.y0;var e=i.x/this.a,t=i.y/this.a,n,r;if(this.sphere){var s=t+this.lat0;n=Math.asin(Math.sin(s)*Math.cos(e)),r=Math.atan2(Math.tan(e),Math.cos(s))}else{var o=this.ml0/this.a+t,a=J0(o,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(a)-De)<=Ve)return i.x=this.long0,i.y=De,t<0&&(i.y*=-1),i;var l=w5(this.a,this.e,Math.sin(a)),c=l*l*l/this.a/this.a*(1-this.es),h=Math.pow(Math.tan(a),2),u=e*this.a/l,f=u*u;n=a-l*Math.tan(a)/c*u*u*(.5-(1+3*h)*u*u/24),r=u*(1-f*(h/3+(1+3*h)*h*f/15))/Math.cos(a)}return i.x=We(r+this.long0),i.y=Hl(n),i}var dj=["Cassini","Cassini_Soldner","cass"];const gj={init:hj,forward:uj,inverse:fj,names:dj};function Il(i,e){var t;return i>1e-7?(t=i*e,(1-i*i)*(e/(1-t*t)-.5/i*Math.log((1-t)/(1+t)))):2*e}var tv=1,iv=2,nv=3,Zp=4;function pj(){var i=Math.abs(this.lat0);if(Math.abs(i-De)<Ve?this.mode=this.lat0<0?tv:iv:Math.abs(i)<Ve?this.mode=nv:this.mode=Zp,this.es>0){var e;switch(this.qp=Il(this.e,1),this.mmf=.5/(1-this.es),this.apa=Sj(this.es),this.mode){case iv:this.dd=1;break;case tv:this.dd=1;break;case nv:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case Zp:this.rq=Math.sqrt(.5*this.qp),e=Math.sin(this.lat0),this.sinb1=Il(this.e,e)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*e*e)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===Zp&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function mj(i){var e,t,n,r,s,o,a,l,c,h,u=i.x,f=i.y;if(u=We(u-this.long0),this.sphere){if(s=Math.sin(f),h=Math.cos(f),n=Math.cos(u),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(t=this.mode===this.EQUIT?1+h*n:1+this.sinph0*s+this.cosph0*h*n,t<=Ve)return null;t=Math.sqrt(2/t),e=t*h*Math.sin(u),t*=this.mode===this.EQUIT?s:this.cosph0*s-this.sinph0*h*n}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(n=-n),Math.abs(f+this.lat0)<Ve)return null;t=mi-f*.5,t=2*(this.mode===this.S_POLE?Math.cos(t):Math.sin(t)),e=t*Math.sin(u),t*=n}}else{switch(a=0,l=0,c=0,n=Math.cos(u),r=Math.sin(u),s=Math.sin(f),o=Il(this.e,s),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(a=o/this.qp,l=Math.sqrt(1-a*a)),this.mode){case this.OBLIQ:c=1+this.sinb1*a+this.cosb1*l*n;break;case this.EQUIT:c=1+l*n;break;case this.N_POLE:c=De+f,o=this.qp-o;break;case this.S_POLE:c=f-De,o=this.qp+o;break}if(Math.abs(c)<Ve)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:c=Math.sqrt(2/c),this.mode===this.OBLIQ?t=this.ymf*c*(this.cosb1*a-this.sinb1*l*n):t=(c=Math.sqrt(2/(1+l*n)))*a*this.ymf,e=this.xmf*c*l*r;break;case this.N_POLE:case this.S_POLE:o>=0?(e=(c=Math.sqrt(o))*r,t=n*(this.mode===this.S_POLE?c:-c)):e=t=0;break}}return i.x=this.a*e+this.x0,i.y=this.a*t+this.y0,i}function _j(i){i.x-=this.x0,i.y-=this.y0;var e=i.x/this.a,t=i.y/this.a,n,r,s,o,a,l,c;if(this.sphere){var h=0,u,f=0;if(u=Math.sqrt(e*e+t*t),r=u*.5,r>1)return null;switch(r=2*Math.asin(r),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(f=Math.sin(r),h=Math.cos(r)),this.mode){case this.EQUIT:r=Math.abs(u)<=Ve?0:Math.asin(t*f/u),e*=f,t=h*u;break;case this.OBLIQ:r=Math.abs(u)<=Ve?this.lat0:Math.asin(h*this.sinph0+t*f*this.cosph0/u),e*=f*this.cosph0,t=(h-Math.sin(r)*this.sinph0)*u;break;case this.N_POLE:t=-t,r=De-r;break;case this.S_POLE:r-=De;break}n=t===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(e,t)}else{if(c=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(e/=this.dd,t*=this.dd,l=Math.sqrt(e*e+t*t),l<Ve)return i.x=this.long0,i.y=this.lat0,i;o=2*Math.asin(.5*l/this.rq),s=Math.cos(o),e*=o=Math.sin(o),this.mode===this.OBLIQ?(c=s*this.sinb1+t*o*this.cosb1/l,a=this.qp*c,t=l*this.cosb1*s-t*this.sinb1*o):(c=t*o/l,a=this.qp*c,t=l*s)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(t=-t),a=e*e+t*t,!a)return i.x=this.long0,i.y=this.lat0,i;c=1-a/this.qp,this.mode===this.S_POLE&&(c=-c)}n=Math.atan2(e,t),r=Tj(Math.asin(c),this.apa)}return i.x=We(this.long0+n),i.y=r,i}var yj=.3333333333333333,vj=.17222222222222222,xj=.10257936507936508,wj=.06388888888888888,bj=.0664021164021164,Ej=.016415012942191543;function Sj(i){var e,t=[];return t[0]=i*yj,e=i*i,t[0]+=e*vj,t[1]=e*wj,e*=i,t[0]+=e*xj,t[1]+=e*bj,t[2]=e*Ej,t}function Tj(i,e){var t=i+i;return i+e[0]*Math.sin(t)+e[1]*Math.sin(t+t)+e[2]*Math.sin(t+t+t)}var Lj=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"];const Cj={init:pj,forward:mj,inverse:_j,names:Lj,S_POLE:tv,N_POLE:iv,EQUIT:nv,OBLIQ:Zp};function Gl(i){return Math.abs(i)>1&&(i=i>1?1:-1),Math.asin(i)}function Aj(){Math.abs(this.lat1+this.lat2)<Ve||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=Wo(this.e3,this.sin_po,this.cos_po),this.qs1=Il(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=Wo(this.e3,this.sin_po,this.cos_po),this.qs2=Il(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=Il(this.e3,this.sin_po),Math.abs(this.lat1-this.lat2)>Ve?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function Pj(i){var e=i.x,t=i.y;this.sin_phi=Math.sin(t),this.cos_phi=Math.cos(t);var n=Il(this.e3,this.sin_phi),r=this.a*Math.sqrt(this.c-this.ns0*n)/this.ns0,s=this.ns0*We(e-this.long0),o=r*Math.sin(s)+this.x0,a=this.rh-r*Math.cos(s)+this.y0;return i.x=o,i.y=a,i}function Mj(i){var e,t,n,r,s,o;return i.x-=this.x0,i.y=this.rh-i.y+this.y0,this.ns0>=0?(e=Math.sqrt(i.x*i.x+i.y*i.y),n=1):(e=-Math.sqrt(i.x*i.x+i.y*i.y),n=-1),r=0,e!==0&&(r=Math.atan2(n*i.x,n*i.y)),n=e*this.ns0/this.a,this.sphere?o=Math.asin((this.c-n*n)/(2*this.ns0)):(t=(this.c-n*n)/this.ns0,o=this.phi1z(this.e3,t)),s=We(r/this.ns0+this.long0),i.x=s,i.y=o,i}function Rj(i,e){var t,n,r,s,o,a=Gl(.5*e);if(i<Ve)return a;for(var l=i*i,c=1;c<=25;c++)if(t=Math.sin(a),n=Math.cos(a),r=i*t,s=1-r*r,o=.5*s*s/n*(e/(1-l)-t/s+.5/i*Math.log((1-r)/(1+r))),a=a+o,Math.abs(o)<=1e-7)return a;return null}var Ij=["Albers_Conic_Equal_Area","Albers_Equal_Area","Albers","aea"];const Nj={init:Aj,forward:Pj,inverse:Mj,names:Ij,phi1z:Rj};function Fj(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function Oj(i){var e,t,n,r,s,o,a,l,c=i.x,h=i.y;return n=We(c-this.long0),e=Math.sin(h),t=Math.cos(h),r=Math.cos(n),o=this.sin_p14*e+this.cos_p14*t*r,s=1,o>0||Math.abs(o)<=Ve?(a=this.x0+this.a*s*t*Math.sin(n)/o,l=this.y0+this.a*s*(this.cos_p14*e-this.sin_p14*t*r)/o):(a=this.x0+this.infinity_dist*t*Math.sin(n),l=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*t*r)),i.x=a,i.y=l,i}function Dj(i){var e,t,n,r,s,o;return i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a,i.x/=this.k0,i.y/=this.k0,(e=Math.sqrt(i.x*i.x+i.y*i.y))?(r=Math.atan2(e,this.rc),t=Math.sin(r),n=Math.cos(r),o=Gl(n*this.sin_p14+i.y*t*this.cos_p14/e),s=Math.atan2(i.x*t,e*this.cos_p14*n-i.y*this.sin_p14*t),s=We(this.long0+s)):(o=this.phic0,s=0),i.x=s,i.y=o,i}var kj=["gnom"];const Gj={init:Fj,forward:Oj,inverse:Dj,names:kj};function Bj(i,e){var t=1-(1-i*i)/(2*i)*Math.log((1-i)/(1+i));if(Math.abs(Math.abs(e)-t)<1e-6)return e<0?-1*De:De;for(var n=Math.asin(.5*e),r,s,o,a,l=0;l<30;l++)if(s=Math.sin(n),o=Math.cos(n),a=i*s,r=Math.pow(1-a*a,2)/(2*o)*(e/(1-i*i)-s/(1-a*a)+.5/i*Math.log((1-a)/(1+a))),n+=r,Math.abs(r)<=1e-10)return n;return NaN}function jj(){this.sphere||(this.k0=Wo(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function Uj(i){var e=i.x,t=i.y,n,r,s=We(e-this.long0);if(this.sphere)n=this.x0+this.a*s*Math.cos(this.lat_ts),r=this.y0+this.a*Math.sin(t)/Math.cos(this.lat_ts);else{var o=Il(this.e,Math.sin(t));n=this.x0+this.a*this.k0*s,r=this.y0+this.a*o*.5/this.k0}return i.x=n,i.y=r,i}function zj(i){i.x-=this.x0,i.y-=this.y0;var e,t;return this.sphere?(e=We(this.long0+i.x/this.a/Math.cos(this.lat_ts)),t=Math.asin(i.y/this.a*Math.cos(this.lat_ts))):(t=Bj(this.e,2*i.y*this.k0/this.a),e=We(this.long0+i.x/(this.a*this.k0))),i.x=e,i.y=t,i}var qj=["cea"];const Vj={init:jj,forward:Uj,inverse:zj,names:qj};function $j(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function Wj(i){var e=i.x,t=i.y,n=We(e-this.long0),r=Hl(t-this.lat0);return i.x=this.x0+this.a*n*this.rc,i.y=this.y0+this.a*r,i}function Hj(i){var e=i.x,t=i.y;return i.x=We(this.long0+(e-this.x0)/(this.a*this.rc)),i.y=Hl(this.lat0+(t-this.y0)/this.a),i}var Xj=["Equirectangular","Equidistant_Cylindrical","Equidistant_Cylindrical_Spherical","eqc"];const Kj={init:$j,forward:Wj,inverse:Hj,names:Xj};var KE=20;function Yj(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=lg(this.es),this.e1=cg(this.es),this.e2=hg(this.es),this.e3=ug(this.es),this.ml0=this.a*Or(this.e0,this.e1,this.e2,this.e3,this.lat0)}function Zj(i){var e=i.x,t=i.y,n,r,s,o=We(e-this.long0);if(s=o*Math.sin(t),this.sphere)Math.abs(t)<=Ve?(n=this.a*o,r=-1*this.a*this.lat0):(n=this.a*Math.sin(s)/Math.tan(t),r=this.a*(Hl(t-this.lat0)+(1-Math.cos(s))/Math.tan(t)));else if(Math.abs(t)<=Ve)n=this.a*o,r=-1*this.ml0;else{var a=w5(this.a,this.e,Math.sin(t))/Math.tan(t);n=a*Math.sin(s),r=this.a*Or(this.e0,this.e1,this.e2,this.e3,t)-this.ml0+a*(1-Math.cos(s))}return i.x=n+this.x0,i.y=r+this.y0,i}function Jj(i){var e,t,n,r,s,o,a,l,c;if(n=i.x-this.x0,r=i.y-this.y0,this.sphere)if(Math.abs(r+this.a*this.lat0)<=Ve)e=We(n/this.a+this.long0),t=0;else{o=this.lat0+r/this.a,a=n*n/this.a/this.a+o*o,l=o;var h;for(s=KE;s;--s)if(h=Math.tan(l),c=-1*(o*(l*h+1)-l-.5*(l*l+a)*h)/((l-o)/h-1),l+=c,Math.abs(c)<=Ve){t=l;break}e=We(this.long0+Math.asin(n*Math.tan(l)/this.a)/Math.sin(t))}else if(Math.abs(r+this.ml0)<=Ve)t=0,e=We(this.long0+n/this.a);else{o=(this.ml0+r)/this.a,a=n*n/this.a/this.a+o*o,l=o;var u,f,d,g,m;for(s=KE;s;--s)if(m=this.e*Math.sin(l),u=Math.sqrt(1-m*m)*Math.tan(l),f=this.a*Or(this.e0,this.e1,this.e2,this.e3,l),d=this.e0-2*this.e1*Math.cos(2*l)+4*this.e2*Math.cos(4*l)-6*this.e3*Math.cos(6*l),g=f/this.a,c=(o*(u*g+1)-g-.5*u*(g*g+a))/(this.es*Math.sin(2*l)*(g*g+a-2*o*g)/(4*u)+(o-g)*(u*d-2/Math.sin(2*l))-d),l-=c,Math.abs(c)<=Ve){t=l;break}u=Math.sqrt(1-this.es*Math.pow(Math.sin(t),2))*Math.tan(t),e=We(this.long0+Math.asin(n*u/this.a)/Math.sin(t))}return i.x=e,i.y=t,i}var Qj=["Polyconic","American_Polyconic","poly"];const eU={init:Yj,forward:Zj,inverse:Jj,names:Qj};function tU(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function iU(i){var e,t=i.x,n=i.y,r=n-this.lat0,s=t-this.long0,o=r/rd*1e-5,a=s,l=1,c=0;for(e=1;e<=10;e++)l=l*o,c=c+this.A[e]*l;var h=c,u=a,f=1,d=0,g,m,_=0,v=0;for(e=1;e<=6;e++)g=f*h-d*u,m=d*h+f*u,f=g,d=m,_=_+this.B_re[e]*f-this.B_im[e]*d,v=v+this.B_im[e]*f+this.B_re[e]*d;return i.x=v*this.a+this.x0,i.y=_*this.a+this.y0,i}function nU(i){var e,t=i.x,n=i.y,r=t-this.x0,s=n-this.y0,o=s/this.a,a=r/this.a,l=1,c=0,h,u,f=0,d=0;for(e=1;e<=6;e++)h=l*o-c*a,u=c*o+l*a,l=h,c=u,f=f+this.C_re[e]*l-this.C_im[e]*c,d=d+this.C_im[e]*l+this.C_re[e]*c;for(var g=0;g<this.iterations;g++){var m=f,_=d,v,x,S=o,b=a;for(e=2;e<=6;e++)v=m*f-_*d,x=_*f+m*d,m=v,_=x,S=S+(e-1)*(this.B_re[e]*m-this.B_im[e]*_),b=b+(e-1)*(this.B_im[e]*m+this.B_re[e]*_);m=1,_=0;var A=this.B_re[1],F=this.B_im[1];for(e=2;e<=6;e++)v=m*f-_*d,x=_*f+m*d,m=v,_=x,A=A+e*(this.B_re[e]*m-this.B_im[e]*_),F=F+e*(this.B_im[e]*m+this.B_re[e]*_);var N=A*A+F*F;f=(S*A+b*F)/N,d=(b*A-S*F)/N}var R=f,P=d,O=1,L=0;for(e=1;e<=9;e++)O=O*R,L=L+this.D[e]*O;var T=this.lat0+L*rd*1e5,C=this.long0+P;return i.x=C,i.y=T,i}var rU=["New_Zealand_Map_Grid","nzmg"];const sU={init:tU,forward:iU,inverse:nU,names:rU};function oU(){}function aU(i){var e=i.x,t=i.y,n=We(e-this.long0),r=this.x0+this.a*n,s=this.y0+this.a*Math.log(Math.tan(Math.PI/4+t/2.5))*1.25;return i.x=r,i.y=s,i}function lU(i){i.x-=this.x0,i.y-=this.y0;var e=We(this.long0+i.x/this.a),t=2.5*(Math.atan(Math.exp(.8*i.y/this.a))-Math.PI/4);return i.x=e,i.y=t,i}var cU=["Miller_Cylindrical","mill"];const hU={init:oU,forward:aU,inverse:lU,names:cU};var uU=20;function fU(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=p5(this.es)}function dU(i){var e,t,n=i.x,r=i.y;if(n=We(n-this.long0),this.sphere){if(!this.m)r=this.n!==1?Math.asin(this.n*Math.sin(r)):r;else for(var s=this.n*Math.sin(r),o=uU;o;--o){var a=(this.m*r+Math.sin(r)-s)/(this.m+Math.cos(r));if(r-=a,Math.abs(a)<Ve)break}e=this.a*this.C_x*n*(this.m+Math.cos(r)),t=this.a*this.C_y*r}else{var l=Math.sin(r),c=Math.cos(r);t=this.a*Vu(r,l,c,this.en),e=this.a*n*c/Math.sqrt(1-this.es*l*l)}return i.x=e,i.y=t,i}function gU(i){var e,t,n,r;return i.x-=this.x0,n=i.x/this.a,i.y-=this.y0,e=i.y/this.a,this.sphere?(e/=this.C_y,n=n/(this.C_x*(this.m+Math.cos(e))),this.m?e=Gl((this.m*e+Math.sin(e))/this.n):this.n!==1&&(e=Gl(Math.sin(e)/this.n)),n=We(n+this.long0),e=Hl(e)):(e=m5(i.y/this.a,this.es,this.en),r=Math.abs(e),r<De?(r=Math.sin(e),t=this.long0+i.x*Math.sqrt(1-this.es*r*r)/(this.a*Math.cos(e)),n=We(t)):r-Ve<De&&(n=this.long0)),i.x=n,i.y=e,i}var pU=["Sinusoidal","sinu"];const mU={init:fU,forward:dU,inverse:gU,names:pU};function _U(){}function yU(i){for(var e=i.x,t=i.y,n=We(e-this.long0),r=t,s=Math.PI*Math.sin(t);;){var o=-(r+Math.sin(r)-s)/(1+Math.cos(r));if(r+=o,Math.abs(o)<Ve)break}r/=2,Math.PI/2-Math.abs(t)<Ve&&(n=0);var a=.900316316158*this.a*n*Math.cos(r)+this.x0,l=1.4142135623731*this.a*Math.sin(r)+this.y0;return i.x=a,i.y=l,i}function vU(i){var e,t;i.x-=this.x0,i.y-=this.y0,t=i.y/(1.4142135623731*this.a),Math.abs(t)>.999999999999&&(t=.999999999999),e=Math.asin(t);var n=We(this.long0+i.x/(.900316316158*this.a*Math.cos(e)));n<-Math.PI&&(n=-Math.PI),n>Math.PI&&(n=Math.PI),t=(2*e+Math.sin(2*e))/Math.PI,Math.abs(t)>1&&(t=1);var r=Math.asin(t);return i.x=n,i.y=r,i}var xU=["Mollweide","moll"];const wU={init:_U,forward:yU,inverse:vU,names:xU};function bU(){Math.abs(this.lat1+this.lat2)<Ve||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=lg(this.es),this.e1=cg(this.es),this.e2=hg(this.es),this.e3=ug(this.es),this.sin_phi=Math.sin(this.lat1),this.cos_phi=Math.cos(this.lat1),this.ms1=Wo(this.e,this.sin_phi,this.cos_phi),this.ml1=Or(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<Ve?this.ns=this.sin_phi:(this.sin_phi=Math.sin(this.lat2),this.cos_phi=Math.cos(this.lat2),this.ms2=Wo(this.e,this.sin_phi,this.cos_phi),this.ml2=Or(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=Or(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function EU(i){var e=i.x,t=i.y,n;if(this.sphere)n=this.a*(this.g-t);else{var r=Or(this.e0,this.e1,this.e2,this.e3,t);n=this.a*(this.g-r)}var s=this.ns*We(e-this.long0),o=this.x0+n*Math.sin(s),a=this.y0+this.rh-n*Math.cos(s);return i.x=o,i.y=a,i}function SU(i){i.x-=this.x0,i.y=this.rh-i.y+this.y0;var e,t,n,r;this.ns>=0?(t=Math.sqrt(i.x*i.x+i.y*i.y),e=1):(t=-Math.sqrt(i.x*i.x+i.y*i.y),e=-1);var s=0;if(t!==0&&(s=Math.atan2(e*i.x,e*i.y)),this.sphere)return r=We(this.long0+s/this.ns),n=Hl(this.g-t/this.a),i.x=r,i.y=n,i;var o=this.g-t/this.a;return n=J0(o,this.e0,this.e1,this.e2,this.e3),r=We(this.long0+s/this.ns),i.x=r,i.y=n,i}var TU=["Equidistant_Conic","eqdc"];const LU={init:bU,forward:EU,inverse:SU,names:TU};function CU(){this.R=this.a}function AU(i){var e=i.x,t=i.y,n=We(e-this.long0),r,s;Math.abs(t)<=Ve&&(r=this.x0+this.R*n,s=this.y0);var o=Gl(2*Math.abs(t/Math.PI));(Math.abs(n)<=Ve||Math.abs(Math.abs(t)-De)<=Ve)&&(r=this.x0,t>=0?s=this.y0+Math.PI*this.R*Math.tan(.5*o):s=this.y0+Math.PI*this.R*-Math.tan(.5*o));var a=.5*Math.abs(Math.PI/n-n/Math.PI),l=a*a,c=Math.sin(o),h=Math.cos(o),u=h/(c+h-1),f=u*u,d=u*(2/c-1),g=d*d,m=Math.PI*this.R*(a*(u-g)+Math.sqrt(l*(u-g)*(u-g)-(g+l)*(f-g)))/(g+l);n<0&&(m=-m),r=this.x0+m;var _=l+u;return m=Math.PI*this.R*(d*_-a*Math.sqrt((g+l)*(l+1)-_*_))/(g+l),t>=0?s=this.y0+m:s=this.y0-m,i.x=r,i.y=s,i}function PU(i){var e,t,n,r,s,o,a,l,c,h,u,f,d;return i.x-=this.x0,i.y-=this.y0,u=Math.PI*this.R,n=i.x/u,r=i.y/u,s=n*n+r*r,o=-Math.abs(r)*(1+s),a=o-2*r*r+n*n,l=-2*o+1+2*r*r+s*s,d=r*r/l+(2*a*a*a/l/l/l-9*o*a/l/l)/27,c=(o-a*a/3/l)/l,h=2*Math.sqrt(-c/3),u=3*d/c/h,Math.abs(u)>1&&(u>=0?u=1:u=-1),f=Math.acos(u)/3,i.y>=0?t=(-h*Math.cos(f+Math.PI/3)-a/3/l)*Math.PI:t=-(-h*Math.cos(f+Math.PI/3)-a/3/l)*Math.PI,Math.abs(n)<Ve?e=this.long0:e=We(this.long0+Math.PI*(s-1+Math.sqrt(1+2*(n*n-r*r)+s*s))/2/n),i.x=e,i.y=t,i}var MU=["Van_der_Grinten_I","VanDerGrinten","Van_der_Grinten","vandg"];const RU={init:CU,forward:AU,inverse:PU,names:MU};function IU(i,e,t,n,r,s){const o=n-e,a=Math.atan((1-s)*Math.tan(i)),l=Math.atan((1-s)*Math.tan(t)),c=Math.sin(a),h=Math.cos(a),u=Math.sin(l),f=Math.cos(l);let d=o,g,m=100,_,v,x,S,b,A,F,N,R,P,O,L,T,C;do{if(_=Math.sin(d),v=Math.cos(d),x=Math.sqrt(f*_*(f*_)+(h*u-c*f*v)*(h*u-c*f*v)),x===0)return{azi1:0,s12:0};S=c*u+h*f*v,b=Math.atan2(x,S),A=h*f*_/x,F=1-A*A,N=F!==0?S-2*c*u/F:0,R=s/16*F*(4+s*(4-3*F)),g=d,d=o+(1-R)*s*A*(b+R*x*(N+R*S*(-1+2*N*N)))}while(Math.abs(d-g)>1e-12&&--m>0);return m===0?{azi1:NaN,s12:NaN}:(P=F*(r*r-r*(1-s)*(r*(1-s)))/(r*(1-s)*(r*(1-s))),O=1+P/16384*(4096+P*(-768+P*(320-175*P))),L=P/1024*(256+P*(-128+P*(74-47*P))),T=L*x*(N+L/4*(S*(-1+2*N*N)-L/6*N*(-3+4*x*x)*(-3+4*N*N))),C=r*(1-s)*O*(b-T),{azi1:Math.atan2(f*_,h*u-c*f*v),s12:C})}function NU(i,e,t,n,r,s){const o=Math.atan((1-s)*Math.tan(i)),a=Math.sin(o),l=Math.cos(o),c=Math.sin(t),h=Math.cos(t),u=Math.atan2(a,l*h),f=l*c,d=1-f*f,g=d*(r*r-r*(1-s)*(r*(1-s)))/(r*(1-s)*(r*(1-s))),m=1+g/16384*(4096+g*(-768+g*(320-175*g))),_=g/1024*(256+g*(-128+g*(74-47*g)));let v=n/(r*(1-s)*m),x,S=100,b,A,F,N;do b=Math.cos(2*u+v),A=Math.sin(v),F=Math.cos(v),N=_*A*(b+_/4*(F*(-1+2*b*b)-_/6*b*(-3+4*A*A)*(-3+4*b*b))),x=v,v=n/(r*(1-s)*m)+N;while(Math.abs(v-x)>1e-12&&--S>0);if(S===0)return{lat2:NaN,lon2:NaN};const R=a*A-l*F*h,P=Math.atan2(a*F+l*A*h,(1-s)*Math.sqrt(f*f+R*R)),O=Math.atan2(A*c,l*F-a*A*h),L=s/16*d*(4+s*(4-3*d)),T=O-(1-L)*s*f*(v+L*A*(b+L*F*(-1+2*b*b))),C=e+T;return{lat2:P,lon2:C}}function FU(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0),this.f=this.es/(1+Math.sqrt(1-this.es))}function OU(i){var e=i.x,t=i.y,n=Math.sin(i.y),r=Math.cos(i.y),s=We(e-this.long0),o,a,l,c,h,u,f,d,g,m,_;return this.sphere?Math.abs(this.sin_p12-1)<=Ve?(i.x=this.x0+this.a*(De-t)*Math.sin(s),i.y=this.y0-this.a*(De-t)*Math.cos(s),i):Math.abs(this.sin_p12+1)<=Ve?(i.x=this.x0+this.a*(De+t)*Math.sin(s),i.y=this.y0+this.a*(De+t)*Math.cos(s),i):(g=this.sin_p12*n+this.cos_p12*r*Math.cos(s),f=Math.acos(g),d=f?f/Math.sin(f):1,i.x=this.x0+this.a*d*r*Math.sin(s),i.y=this.y0+this.a*d*(this.cos_p12*n-this.sin_p12*r*Math.cos(s)),i):(o=lg(this.es),a=cg(this.es),l=hg(this.es),c=ug(this.es),Math.abs(this.sin_p12-1)<=Ve?(h=this.a*Or(o,a,l,c,De),u=this.a*Or(o,a,l,c,t),i.x=this.x0+(h-u)*Math.sin(s),i.y=this.y0-(h-u)*Math.cos(s),i):Math.abs(this.sin_p12+1)<=Ve?(h=this.a*Or(o,a,l,c,De),u=this.a*Or(o,a,l,c,t),i.x=this.x0+(h+u)*Math.sin(s),i.y=this.y0+(h+u)*Math.cos(s),i):Math.abs(e)<Ve&&Math.abs(t-this.lat0)<Ve?(i.x=i.y=0,i):(m=IU(this.lat0,this.long0,t,e,this.a,this.f),_=m.azi1,i.x=m.s12*Math.sin(_),i.y=m.s12*Math.cos(_),i))}function DU(i){i.x-=this.x0,i.y-=this.y0;var e,t,n,r,s,o,a,l,c,h,u,f,d,g,m,_;return this.sphere?(e=Math.sqrt(i.x*i.x+i.y*i.y),e>2*De*this.a?void 0:(t=e/this.a,n=Math.sin(t),r=Math.cos(t),s=this.long0,Math.abs(e)<=Ve?o=this.lat0:(o=Gl(r*this.sin_p12+i.y*n*this.cos_p12/e),a=Math.abs(this.lat0)-De,Math.abs(a)<=Ve?this.lat0>=0?s=We(this.long0+Math.atan2(i.x,-i.y)):s=We(this.long0-Math.atan2(-i.x,i.y)):s=We(this.long0+Math.atan2(i.x*n,e*this.cos_p12*r-i.y*this.sin_p12*n))),i.x=s,i.y=o,i)):(l=lg(this.es),c=cg(this.es),h=hg(this.es),u=ug(this.es),Math.abs(this.sin_p12-1)<=Ve?(f=this.a*Or(l,c,h,u,De),e=Math.sqrt(i.x*i.x+i.y*i.y),d=f-e,o=J0(d/this.a,l,c,h,u),s=We(this.long0+Math.atan2(i.x,-1*i.y)),i.x=s,i.y=o,i):Math.abs(this.sin_p12+1)<=Ve?(f=this.a*Or(l,c,h,u,De),e=Math.sqrt(i.x*i.x+i.y*i.y),d=e-f,o=J0(d/this.a,l,c,h,u),s=We(this.long0+Math.atan2(i.x,i.y)),i.x=s,i.y=o,i):(g=Math.atan2(i.x,i.y),m=Math.sqrt(i.x*i.x+i.y*i.y),_=NU(this.lat0,this.long0,g,m,this.a,this.f),i.x=_.lon2,i.y=_.lat2,i))}var kU=["Azimuthal_Equidistant","aeqd"];const GU={init:FU,forward:OU,inverse:DU,names:kU};function BU(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function jU(i){var e,t,n,r,s,o,a,l,c=i.x,h=i.y;return n=We(c-this.long0),e=Math.sin(h),t=Math.cos(h),r=Math.cos(n),o=this.sin_p14*e+this.cos_p14*t*r,s=1,(o>0||Math.abs(o)<=Ve)&&(a=this.a*s*t*Math.sin(n),l=this.y0+this.a*s*(this.cos_p14*e-this.sin_p14*t*r)),i.x=a,i.y=l,i}function UU(i){var e,t,n,r,s,o,a;return i.x-=this.x0,i.y-=this.y0,e=Math.sqrt(i.x*i.x+i.y*i.y),t=Gl(e/this.a),n=Math.sin(t),r=Math.cos(t),o=this.long0,Math.abs(e)<=Ve?(a=this.lat0,i.x=o,i.y=a,i):(a=Gl(r*this.sin_p14+i.y*n*this.cos_p14/e),s=Math.abs(this.lat0)-De,Math.abs(s)<=Ve?(this.lat0>=0?o=We(this.long0+Math.atan2(i.x,-i.y)):o=We(this.long0-Math.atan2(-i.x,i.y)),i.x=o,i.y=a,i):(o=We(this.long0+Math.atan2(i.x*n,e*this.cos_p14*r-i.y*this.sin_p14*n)),i.x=o,i.y=a,i))}var zU=["ortho"];const qU={init:BU,forward:jU,inverse:UU,names:zU};var tn={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},_i={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function VU(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=De-mi/2?this.face=tn.TOP:this.lat0<=-(De-mi/2)?this.face=tn.BOTTOM:Math.abs(this.long0)<=mi?this.face=tn.FRONT:Math.abs(this.long0)<=De+mi?this.face=this.long0>0?tn.RIGHT:tn.LEFT:this.face=tn.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function $U(i){var e={x:0,y:0},t,n,r,s,o,a,l={value:0};if(i.x-=this.long0,this.es!==0?t=Math.atan(this.one_minus_f_squared*Math.tan(i.y)):t=i.y,n=i.x,this.face===tn.TOP)s=De-t,n>=mi&&n<=De+mi?(l.value=_i.AREA_0,r=n-De):n>De+mi||n<=-(De+mi)?(l.value=_i.AREA_1,r=n>0?n-pn:n+pn):n>-(De+mi)&&n<=-mi?(l.value=_i.AREA_2,r=n+De):(l.value=_i.AREA_3,r=n);else if(this.face===tn.BOTTOM)s=De+t,n>=mi&&n<=De+mi?(l.value=_i.AREA_0,r=-n+De):n<mi&&n>=-mi?(l.value=_i.AREA_1,r=-n):n<-mi&&n>=-(De+mi)?(l.value=_i.AREA_2,r=-n-De):(l.value=_i.AREA_3,r=n>0?-n+pn:-n-pn);else{var c,h,u,f,d,g,m;this.face===tn.RIGHT?n=mu(n,+De):this.face===tn.BACK?n=mu(n,+pn):this.face===tn.LEFT&&(n=mu(n,-De)),f=Math.sin(t),d=Math.cos(t),g=Math.sin(n),m=Math.cos(n),c=d*m,h=d*g,u=f,this.face===tn.FRONT?(s=Math.acos(c),r=Ap(s,u,h,l)):this.face===tn.RIGHT?(s=Math.acos(h),r=Ap(s,u,-c,l)):this.face===tn.BACK?(s=Math.acos(-c),r=Ap(s,u,-h,l)):this.face===tn.LEFT?(s=Math.acos(-h),r=Ap(s,u,c,l)):(s=r=0,l.value=_i.AREA_0)}return a=Math.atan(12/pn*(r+Math.acos(Math.sin(r)*Math.cos(mi))-De)),o=Math.sqrt((1-Math.cos(s))/(Math.cos(a)*Math.cos(a))/(1-Math.cos(Math.atan(1/Math.cos(r))))),l.value===_i.AREA_1?a+=De:l.value===_i.AREA_2?a+=pn:l.value===_i.AREA_3&&(a+=1.5*pn),e.x=o*Math.cos(a),e.y=o*Math.sin(a),e.x=e.x*this.a+this.x0,e.y=e.y*this.a+this.y0,i.x=e.x,i.y=e.y,i}function WU(i){var e={lam:0,phi:0},t,n,r,s,o,a,l,c,h,u={value:0};if(i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a,n=Math.atan(Math.sqrt(i.x*i.x+i.y*i.y)),t=Math.atan2(i.y,i.x),i.x>=0&&i.x>=Math.abs(i.y)?u.value=_i.AREA_0:i.y>=0&&i.y>=Math.abs(i.x)?(u.value=_i.AREA_1,t-=De):i.x<0&&-i.x>=Math.abs(i.y)?(u.value=_i.AREA_2,t=t<0?t+pn:t-pn):(u.value=_i.AREA_3,t+=De),h=pn/12*Math.tan(t),o=Math.sin(h)/(Math.cos(h)-1/Math.sqrt(2)),a=Math.atan(o),r=Math.cos(t),s=Math.tan(n),l=1-r*r*s*s*(1-Math.cos(Math.atan(1/Math.cos(a)))),l<-1?l=-1:l>1&&(l=1),this.face===tn.TOP)c=Math.acos(l),e.phi=De-c,u.value===_i.AREA_0?e.lam=a+De:u.value===_i.AREA_1?e.lam=a<0?a+pn:a-pn:u.value===_i.AREA_2?e.lam=a-De:e.lam=a;else if(this.face===tn.BOTTOM)c=Math.acos(l),e.phi=c-De,u.value===_i.AREA_0?e.lam=-a+De:u.value===_i.AREA_1?e.lam=-a:u.value===_i.AREA_2?e.lam=-a-De:e.lam=a<0?-a-pn:-a+pn;else{var f,d,g;f=l,h=f*f,h>=1?g=0:g=Math.sqrt(1-h)*Math.sin(a),h+=g*g,h>=1?d=0:d=Math.sqrt(1-h),u.value===_i.AREA_1?(h=d,d=-g,g=h):u.value===_i.AREA_2?(d=-d,g=-g):u.value===_i.AREA_3&&(h=d,d=g,g=-h),this.face===tn.RIGHT?(h=f,f=-d,d=h):this.face===tn.BACK?(f=-f,d=-d):this.face===tn.LEFT&&(h=f,f=d,d=-h),e.phi=Math.acos(-g)-De,e.lam=Math.atan2(d,f),this.face===tn.RIGHT?e.lam=mu(e.lam,-De):this.face===tn.BACK?e.lam=mu(e.lam,-pn):this.face===tn.LEFT&&(e.lam=mu(e.lam,+De))}if(this.es!==0){var m,_,v;m=e.phi<0?1:0,_=Math.tan(e.phi),v=this.b/Math.sqrt(_*_+this.one_minus_f_squared),e.phi=Math.atan(Math.sqrt(this.a*this.a-v*v)/(this.one_minus_f*v)),m&&(e.phi=-e.phi)}return e.lam+=this.long0,i.x=e.lam,i.y=e.phi,i}function Ap(i,e,t,n){var r;return i<Ve?(n.value=_i.AREA_0,r=0):(r=Math.atan2(e,t),Math.abs(r)<=mi?n.value=_i.AREA_0:r>mi&&r<=De+mi?(n.value=_i.AREA_1,r-=De):r>De+mi||r<=-(De+mi)?(n.value=_i.AREA_2,r=r>=0?r-pn:r+pn):(n.value=_i.AREA_3,r+=De)),r}function mu(i,e){var t=i+e;return t<-pn?t+=Bd:t>+pn&&(t-=Bd),t}var HU=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"];const XU={init:VU,forward:$U,inverse:WU,names:HU};var rv=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],zf=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],FA=.8487,OA=1.3523,DA=Do/5,KU=1/DA,Jh=18,Q0=function(i,e){return i[0]+e*(i[1]+e*(i[2]+e*i[3]))},YU=function(i,e){return i[1]+e*(2*i[2]+e*3*i[3])};function ZU(i,e,t,n){for(var r=e;n;--n){var s=i(r);if(r-=s,Math.abs(s)<t)break}return r}function JU(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function QU(i){var e=We(i.x-this.long0),t=Math.abs(i.y),n=Math.floor(t*DA);n<0?n=0:n>=Jh&&(n=Jh-1),t=Do*(t-KU*n);var r={x:Q0(rv[n],t)*e,y:Q0(zf[n],t)};return i.y<0&&(r.y=-r.y),r.x=r.x*this.a*FA+this.x0,r.y=r.y*this.a*OA+this.y0,r}function ez(i){var e={x:(i.x-this.x0)/(this.a*FA),y:Math.abs(i.y-this.y0)/(this.a*OA)};if(e.y>=1)e.x/=rv[Jh][0],e.y=i.y<0?-De:De;else{var t=Math.floor(e.y*Jh);for(t<0?t=0:t>=Jh&&(t=Jh-1);;)if(zf[t][0]>e.y)--t;else if(zf[t+1][0]<=e.y)++t;else break;var n=zf[t],r=5*(e.y-n[0])/(zf[t+1][0]-n[0]);r=ZU(function(s){return(Q0(n,s)-e.y)/YU(n,s)},r,Ve,100),e.x/=Q0(rv[t],r),e.y=(5*t+r)*sr,i.y<0&&(e.y=-e.y)}return e.x=We(e.x+this.long0),e}var tz=["Robinson","robin"];const iz={init:JU,forward:QU,inverse:ez,names:tz};function nz(){this.name="geocent"}function rz(i){var e=EA(i,this.es,this.a);return e}function sz(i){var e=SA(i,this.es,this.a,this.b);return e}var oz=["Geocentric","geocentric","geocent","Geocent"];const az={init:nz,forward:rz,inverse:sz,names:oz};var vr={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},Af={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function lz(){if(Object.keys(Af).forEach((function(t){if(typeof this[t]>"u")this[t]=Af[t].def;else{if(Af[t].num&&isNaN(this[t]))throw new Error("Invalid parameter value, must be numeric "+t+" = "+this[t]);Af[t].num&&(this[t]=parseFloat(this[t]))}Af[t].degrees&&(this[t]=this[t]*sr)}).bind(this)),Math.abs(Math.abs(this.lat0)-De)<Ve?this.mode=this.lat0<0?vr.S_POLE:vr.N_POLE:Math.abs(this.lat0)<Ve?this.mode=vr.EQUIT:(this.mode=vr.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var i=this.tilt,e=this.azi;this.cg=Math.cos(e),this.sg=Math.sin(e),this.cw=Math.cos(i),this.sw=Math.sin(i)}function cz(i){i.x-=this.long0;var e=Math.sin(i.y),t=Math.cos(i.y),n=Math.cos(i.x),r,s;switch(this.mode){case vr.OBLIQ:s=this.sinph0*e+this.cosph0*t*n;break;case vr.EQUIT:s=t*n;break;case vr.S_POLE:s=-e;break;case vr.N_POLE:s=e;break}switch(s=this.pn1/(this.p-s),r=s*t*Math.sin(i.x),this.mode){case vr.OBLIQ:s*=this.cosph0*e-this.sinph0*t*n;break;case vr.EQUIT:s*=e;break;case vr.N_POLE:s*=-(t*n);break;case vr.S_POLE:s*=t*n;break}var o,a;return o=s*this.cg+r*this.sg,a=1/(o*this.sw*this.h1+this.cw),r=(r*this.cg-s*this.sg)*this.cw*a,s=o*a,i.x=r*this.a,i.y=s*this.a,i}function hz(i){i.x/=this.a,i.y/=this.a;var e={x:i.x,y:i.y},t,n,r;r=1/(this.pn1-i.y*this.sw),t=this.pn1*i.x*r,n=this.pn1*i.y*this.cw*r,i.x=t*this.cg+n*this.sg,i.y=n*this.cg-t*this.sg;var s=Wr(i.x,i.y);if(Math.abs(s)<Ve)e.x=0,e.y=i.y;else{var o,a;switch(a=1-s*s*this.pfact,a=(this.p-Math.sqrt(a))/(this.pn1/s+s/this.pn1),o=Math.sqrt(1-a*a),this.mode){case vr.OBLIQ:e.y=Math.asin(o*this.sinph0+i.y*a*this.cosph0/s),i.y=(o-this.sinph0*Math.sin(e.y))*s,i.x*=a*this.cosph0;break;case vr.EQUIT:e.y=Math.asin(i.y*a/s),i.y=o*s,i.x*=a;break;case vr.N_POLE:e.y=Math.asin(o),i.y=-i.y;break;case vr.S_POLE:e.y=-Math.asin(o);break}e.x=Math.atan2(i.x,i.y)}return i.x=e.x+this.long0,i.y=e.y,i}var uz=["Tilted_Perspective","tpers"];const fz={init:lz,forward:cz,inverse:hz,names:uz};function dz(){if(this.flip_axis=this.sweep==="x"?1:0,this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,this.es!==0){var i=1-this.es,e=1/i;this.radius_p=Math.sqrt(i),this.radius_p2=i,this.radius_p_inv2=e,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")}function gz(i){var e=i.x,t=i.y,n,r,s,o;if(e=e-this.long0,this.shape==="ellipse"){t=Math.atan(this.radius_p2*Math.tan(t));var a=this.radius_p/Wr(this.radius_p*Math.cos(t),Math.sin(t));if(r=a*Math.cos(e)*Math.cos(t),s=a*Math.sin(e)*Math.cos(t),o=a*Math.sin(t),(this.radius_g-r)*r-s*s-o*o*this.radius_p_inv2<0)return i.x=Number.NaN,i.y=Number.NaN,i;n=this.radius_g-r,this.flip_axis?(i.x=this.radius_g_1*Math.atan(s/Wr(o,n)),i.y=this.radius_g_1*Math.atan(o/n)):(i.x=this.radius_g_1*Math.atan(s/n),i.y=this.radius_g_1*Math.atan(o/Wr(s,n)))}else this.shape==="sphere"&&(n=Math.cos(t),r=Math.cos(e)*n,s=Math.sin(e)*n,o=Math.sin(t),n=this.radius_g-r,this.flip_axis?(i.x=this.radius_g_1*Math.atan(s/Wr(o,n)),i.y=this.radius_g_1*Math.atan(o/n)):(i.x=this.radius_g_1*Math.atan(s/n),i.y=this.radius_g_1*Math.atan(o/Wr(s,n))));return i.x=i.x*this.a,i.y=i.y*this.a,i}function pz(i){var e=-1,t=0,n=0,r,s,o,a;if(i.x=i.x/this.a,i.y=i.y/this.a,this.shape==="ellipse"){this.flip_axis?(n=Math.tan(i.y/this.radius_g_1),t=Math.tan(i.x/this.radius_g_1)*Wr(1,n)):(t=Math.tan(i.x/this.radius_g_1),n=Math.tan(i.y/this.radius_g_1)*Wr(1,t));var l=n/this.radius_p;if(r=t*t+l*l+e*e,s=2*this.radius_g*e,o=s*s-4*r*this.C,o<0)return i.x=Number.NaN,i.y=Number.NaN,i;a=(-s-Math.sqrt(o))/(2*r),e=this.radius_g+a*e,t*=a,n*=a,i.x=Math.atan2(t,e),i.y=Math.atan(n*Math.cos(i.x)/e),i.y=Math.atan(this.radius_p_inv2*Math.tan(i.y))}else if(this.shape==="sphere"){if(this.flip_axis?(n=Math.tan(i.y/this.radius_g_1),t=Math.tan(i.x/this.radius_g_1)*Math.sqrt(1+n*n)):(t=Math.tan(i.x/this.radius_g_1),n=Math.tan(i.y/this.radius_g_1)*Math.sqrt(1+t*t)),r=t*t+n*n+e*e,s=2*this.radius_g*e,o=s*s-4*r*this.C,o<0)return i.x=Number.NaN,i.y=Number.NaN,i;a=(-s-Math.sqrt(o))/(2*r),e=this.radius_g+a*e,t*=a,n*=a,i.x=Math.atan2(t,e),i.y=Math.atan(n*Math.cos(i.x)/e)}return i.x=i.x+this.long0,i}var mz=["Geostationary Satellite View","Geostationary_Satellite","geos"];const _z={init:dz,forward:gz,inverse:pz,names:mz};var sd=1.340264,od=-.081106,ad=893e-6,ld=.003796,em=Math.sqrt(3)/2;function yz(){this.es=0,this.long0=this.long0!==void 0?this.long0:0}function vz(i){var e=We(i.x-this.long0),t=i.y,n=Math.asin(em*Math.sin(t)),r=n*n,s=r*r*r;return i.x=e*Math.cos(n)/(em*(sd+3*od*r+s*(7*ad+9*ld*r))),i.y=n*(sd+od*r+s*(ad+ld*r)),i.x=this.a*i.x+this.x0,i.y=this.a*i.y+this.y0,i}function xz(i){i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a;var e=1e-9,t=12,n=i.y,r,s,o,a,l,c;for(c=0;c<t&&(r=n*n,s=r*r*r,o=n*(sd+od*r+s*(ad+ld*r))-i.y,a=sd+3*od*r+s*(7*ad+9*ld*r),n-=l=o/a,!(Math.abs(l)<e));++c);return r=n*n,s=r*r*r,i.x=em*i.x*(sd+3*od*r+s*(7*ad+9*ld*r))/Math.cos(n),i.y=Math.asin(Math.sin(n)/em),i.x=We(i.x+this.long0),i}var wz=["eqearth","Equal Earth","Equal_Earth"];const bz={init:yz,forward:vz,inverse:xz,names:wz};var zd=1e-10;function Ez(){var i;if(this.phi1=this.lat1,Math.abs(this.phi1)<zd)throw new Error;this.es?(this.en=p5(this.es),this.m1=Vu(this.phi1,this.am1=Math.sin(this.phi1),i=Math.cos(this.phi1),this.en),this.am1=i/(Math.sqrt(1-this.es*this.am1*this.am1)*this.am1),this.inverse=Tz,this.forward=Sz):(Math.abs(this.phi1)+zd>=De?this.cphi1=0:this.cphi1=1/Math.tan(this.phi1),this.inverse=Cz,this.forward=Lz)}function Sz(i){var e=We(i.x-(this.long0||0)),t=i.y,n,r,s;return n=this.am1+this.m1-Vu(t,r=Math.sin(t),s=Math.cos(t),this.en),r=s*e/(n*Math.sqrt(1-this.es*r*r)),i.x=n*Math.sin(r),i.y=this.am1-n*Math.cos(r),i.x=this.a*i.x+(this.x0||0),i.y=this.a*i.y+(this.y0||0),i}function Tz(i){i.x=(i.x-(this.x0||0))/this.a,i.y=(i.y-(this.y0||0))/this.a;var e,t,n,r;if(t=Wr(i.x,i.y=this.am1-i.y),r=m5(this.am1+this.m1-t,this.es,this.en),(e=Math.abs(r))<De)e=Math.sin(r),n=t*Math.atan2(i.x,i.y)*Math.sqrt(1-this.es*e*e)/Math.cos(r);else if(Math.abs(e-De)<=zd)n=0;else throw new Error;return i.x=We(n+(this.long0||0)),i.y=Hl(r),i}function Lz(i){var e=We(i.x-(this.long0||0)),t=i.y,n,r;return r=this.cphi1+this.phi1-t,Math.abs(r)>zd?(i.x=r*Math.sin(n=e*Math.cos(t)/r),i.y=this.cphi1-r*Math.cos(n)):i.x=i.y=0,i.x=this.a*i.x+(this.x0||0),i.y=this.a*i.y+(this.y0||0),i}function Cz(i){i.x=(i.x-(this.x0||0))/this.a,i.y=(i.y-(this.y0||0))/this.a;var e,t,n=Wr(i.x,i.y=this.cphi1-i.y);if(t=this.cphi1+this.phi1-n,Math.abs(t)>De)throw new Error;return Math.abs(Math.abs(t)-De)<=zd?e=0:e=n*Math.atan2(i.x,i.y)/Math.cos(t),i.x=We(e+(this.long0||0)),i.y=Hl(t),i}var Az=["bonne","Bonne (Werner lat_1=90)"];const Pz={init:Ez,names:Az};function Mz(i){i.Proj.projections.add(Kp),i.Proj.projections.add(Yp),i.Proj.projections.add(AB),i.Proj.projections.add(kB),i.Proj.projections.add(zB),i.Proj.projections.add(HB),i.Proj.projections.add(QB),i.Proj.projections.add(rj),i.Proj.projections.add(cj),i.Proj.projections.add(gj),i.Proj.projections.add(Cj),i.Proj.projections.add(Nj),i.Proj.projections.add(Gj),i.Proj.projections.add(Vj),i.Proj.projections.add(Kj),i.Proj.projections.add(eU),i.Proj.projections.add(sU),i.Proj.projections.add(hU),i.Proj.projections.add(mU),i.Proj.projections.add(wU),i.Proj.projections.add(LU),i.Proj.projections.add(RU),i.Proj.projections.add(GU),i.Proj.projections.add(qU),i.Proj.projections.add(XU),i.Proj.projections.add(iz),i.Proj.projections.add(az),i.Proj.projections.add(fz),i.Proj.projections.add(_z),i.Proj.projections.add(bz),i.Proj.projections.add(Pz)}const sv=Object.assign($G,{defaultDatum:"WGS84",Proj:eo,WGS84:new eo("WGS84"),Point:Iu,toPoint:TA,defs:Ir,nadgrid:CG,transform:Z0,mgrs:WG,version:"__VERSION__"});Mz(sv);const kA=et({__name:"OlProjectionRegister",props:{projectionName:{},projectionDef:{},projectionExtent:{}},setup(i,{expose:e}){const t=i,{projectionName:n,projectionDef:r,projectionExtent:s}=Hd(t);sv.defs(n.value,r.value),gO(sv);const o=new Ba({code:n.value,extent:s.value});return e({projection:o}),(a,l)=>Xt("",!0)}});function GA(i){if(i)return typeof i=="string"||i instanceof Ba?i:new Ba(i)}const BA=et({inheritAttrs:!1,__name:"OlView",props:{center:{},constrainRotation:{type:[Number,Boolean]},enableRotation:{type:Boolean,default:!0},extent:{},constrainOnlyCenter:{type:Boolean},smoothExtentConstraint:{type:Boolean,default:!0},maxResolution:{},minResolution:{},maxZoom:{},minZoom:{},multiWorld:{type:Boolean},constrainResolution:{type:Boolean},smoothResolutionConstraint:{type:Boolean,default:!0},showFullExtent:{type:Boolean},projection:{},resolution:{},resolutions:{},rotation:{},zoom:{},zoomFactor:{},padding:{}},emits:["change","error","propertychange","change:center","change:resolution","change:rotation"],setup(i,{expose:e}){const t=i,n=ft("map"),r=Nn(t),s=()=>({...r,projection:GA(r.projection)}),o=new Xs(s());return Jr(o,["change:center","change:resolution","change:rotation"]),Ji(()=>{n?.setView(o)}),ti(r,()=>{const le=s();o.setProperties(le),o.applyOptions_(le)}),e({view:o,adjustCenter:le=>o.adjustCenter(le),adjustResolution:(le,Ce)=>o.adjustResolution(le,Ce),adjustRotation:(le,Ce)=>o.adjustRotation(le,Ce),adjustZoom:(le,Ce)=>o.adjustZoom(le,Ce),animate:(...le)=>o.animate(...le),beginInteraction:()=>o.beginInteraction(),calculateExtent:le=>o.calculateExtent(le),cancelAnimations:()=>o.cancelAnimations(),centerOn:(le,Ce,H)=>o.centerOn(le,Ce,H),changed:()=>o.changed(),dispatchEvent:le=>o.dispatchEvent(le),endInteraction:(le,Ce,H)=>o.endInteraction(le,Ce,H),fit:(le,Ce)=>o.fit(le,Ce),get:le=>o.get(le),getAnimating:()=>o.getAnimating(),getCenter:()=>o.getCenter(),getInteracting:()=>o.getInteracting(),getKeys:()=>o.getKeys(),getMaxResolution:()=>o.getMaxResolution(),getMaxZoom:()=>o.getMaxZoom(),getMinResolution:()=>o.getMinResolution(),getMinZoom:()=>o.getMinZoom(),getProjection:()=>o.getProjection(),getProperties:()=>o.getProperties(),getResolution:()=>o.getResolution(),getResolutionForExtent:(le,Ce)=>o.getResolutionForExtent(le,Ce),getResolutionForZoom:le=>o.getResolutionForZoom(le),getResolutions:()=>o.getResolutions(),getRevision:()=>o.getRevision(),getRotation:()=>o.getRotation(),getZoom:()=>o.getZoom(),getZoomForResolution:le=>o.getZoomForResolution(le),setCenter:le=>o.setCenter(le),setConstrainResolution:le=>o.setConstrainResolution(le),setMaxZoom:le=>o.setMaxZoom(le),setMinZoom:le=>o.setMinZoom(le),setResolution:le=>o.setResolution(le),setRotation:le=>o.setRotation(le),setZoom:le=>o.setZoom(le)}),(le,Ce)=>Xt("",!0)}});function Rz(i){return[i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()]}function jt(i,e,t){for(const n of Rz(e))i.component(n,t);i.component(e,t)}function YE(i,e){jt(i,"OlFeature",aA),jt(i,"OlGeoLocation",hA),jt(i,"OlMap",uA),jt(i,"OlOverlay",fA),jt(i,"OlProjectionRegister",kA),jt(i,"OlView",BA),e&&i.provide("ol-options",e)}const Pp=Object.freeze(Object.defineProperty({__proto__:null,OlFeature:aA,OlGeoLocation:hA,OlMap:uA,OlOverlay:fA,OlProjectionRegister:kA,OlView:BA,default:YE,install:YE},Symbol.toStringTag,{value:"Module"})),jA={className:"ol-layer",opacity:1,visible:!0,properties:()=>({}),displayInLayerSwitcher:!0};function ho(i){return{...jA,...i}}function Zo(i,e,t=[]){const n=Nn(e),r=za(new i(n));Jr(r,[...I9,...t]);const s=ft("map"),o=ft("layerGroup",null),a=ft("overviewMap",null),l=Zi(!1);function c(){for(const u in n){const f=u;n[f]!==void 0&&r.value.set(u,n[f])}if(r.value.setOpacity(n.opacity??1),r.value.setVisible(n.visible??!0),!l.value){if(o){const u=o.getLayers();u.push(r.value),o.setLayers(u)}else a?.value?a.value?.getOverviewMap().addLayer(r.value):s?.addLayer(r.value);l.value=!0}}function h(){o?o.getLayers().remove(r.value):a?.value?(a.value?.getOverviewMap().removeLayer(r.value),a.value?.changed()):s?.removeLayer(r.value),l.value=!1}return cn(h),ti(()=>n,c,{deep:!0,immediate:!0}),a?.value&&ti(a,()=>{h(),c()}),{layer:r,map:s}}const UA=et({inheritAttrs:!1,__name:"OlAnimatedClusterLayer",props:hr({distance:{},animationDuration:{},easingFunction:{type:Function},animationMethod:{type:Function},className:{},opacity:{},visible:{type:Boolean},extent:{},zIndex:{},minResolution:{},maxResolution:{},minZoom:{},maxZoom:{},renderOrder:{type:Function},renderBuffer:{},source:{},map:{},declutter:{type:[String,Number,Boolean]},style:{type:[Object,Array,Function,null]},background:{type:[String,Function]},updateWhileAnimating:{type:Boolean},updateWhileInteracting:{type:Boolean},properties:{},openInLayerSwitcher:{type:Boolean},title:{},name:{},allwaysOnTop:{type:Boolean},baseLayer:{type:Boolean},displayInLayerSwitcher:{type:Boolean},preview:{}},ho()),emits:["sourceready","change","error","propertychange","change:extent","change:maxResolution","change:maxZoom","change:minResolution","change:minZoom","change:opacity","change:source","change:visible","change:zIndex","postrender","prerender","addfeature","changefeature","clear","featuresloadend","featuresloaderror","featuresloadstart","removefeature"],setup(i,{expose:e}){const t=i,n=za(new zL({distance:t.distance,geometryFunction:o=>o.getGeometry()})),{layer:r,map:s}=Zo(j4,{...t,source:n.value},cA);return ti(()=>t.distance,o=>{n.value.setDistance(o)}),fi("vectorLayer",n),fi("stylable",r),e({vectorLayer:r,map:s}),(o,a)=>(vt(),Yt("div",null,[qt(o.$slots,"default")]))}}),zA=et({__name:"OlGraticuleLayer",props:hr({className:{},opacity:{},visible:{type:Boolean},extent:{},zIndex:{},minResolution:{},maxResolution:{},minZoom:{},maxZoom:{},maxLines:{},strokeStyle:{},targetSize:{},showLabels:{type:Boolean},lonLabelFormatter:{type:Function},latLabelFormatter:{type:Function},lonLabelPosition:{},latLabelPosition:{},lonLabelStyle:{},latLabelStyle:{},intervals:{},wrapX:{type:Boolean},properties:{},openInLayerSwitcher:{type:Boolean},title:{},name:{},allwaysOnTop:{type:Boolean},baseLayer:{type:Boolean},displayInLayerSwitcher:{type:Boolean},preview:{}},ho()),emits:["sourceready","change","error","propertychange","change:extent","change:maxResolution","change:maxZoom","change:minResolution","change:minZoom","change:opacity","change:source","change:visible","change:zIndex","postrender","prerender"],setup(i,{expose:e}){const t=i,{layer:n}=Zo(W4,t);return fi("vectorLayer",n),fi("stylable",n),e({vectorLayer:n}),(r,s)=>(vt(),Yt("div",null,[qt(r.$slots,"default")]))}}),qA=et({__name:"OlHeatmapLayer",props:hr({className:{},opacity:{},visible:{type:Boolean},extent:{},zIndex:{},minResolution:{},maxResolution:{},minZoom:{},maxZoom:{},source:{},map:{},render:{type:Function},properties:{},gradient:{},radius:{},blur:{},weight:{type:[Number,Array,String,Function]},filter:{type:[Boolean,Array]},variables:{},openInLayerSwitcher:{type:Boolean},title:{},name:{},allwaysOnTop:{type:Boolean},baseLayer:{type:Boolean},displayInLayerSwitcher:{type:Boolean},preview:{}},ho()),emits:["sourceready","change","error","propertychange","change:extent","change:maxResolution","change:maxZoom","change:minResolution","change:minZoom","change:opacity","change:source","change:visible","change:zIndex","postrender","prerender","change:blur","change:gradient","change:radius"],setup(i,{expose:e}){const t=i,{layer:n}=Zo(qC,t,["change:blur","change:extent","change:gradient","change:radius"]);return fi("heatmapLayer",n),fi("stylable",n),e({heatmapLayer:n}),(r,s)=>(vt(),Yt("div",null,[qt(r.$slots,"default")]))}}),VA=et({__name:"OlImageLayer",props:hr({className:{},opacity:{},visible:{type:Boolean},extent:{},zIndex:{},minResolution:{},maxResolution:{},minZoom:{},maxZoom:{},map:{},source:{},properties:{},openInLayerSwitcher:{type:Boolean},title:{},name:{},allwaysOnTop:{type:Boolean},baseLayer:{type:Boolean},displayInLayerSwitcher:{type:Boolean},preview:{}},ho()),emits:["sourceready","change","error","propertychange","change:extent","change:maxResolution","change:maxZoom","change:minResolution","change:minZoom","change:opacity","change:source","change:visible","change:zIndex","postrender","prerender"],setup(i,{expose:e}){const t=i,{layer:n}=Zo(mC,t);return fi("imageLayer",n),e({imageLayer:n}),(r,s)=>(vt(),Yt("div",null,[qt(r.$slots,"default")]))}}),$A=et({inheritAttrs:!1,__name:"OlLayerGroup",props:{opacity:{default:1},visible:{type:Boolean,default:!0},extent:{},zIndex:{},minResolution:{},maxResolution:{},minZoom:{},maxZoom:{},layers:{},properties:{default:()=>({})},openInLayerSwitcher:{type:Boolean},title:{},name:{},allwaysOnTop:{type:Boolean},baseLayer:{type:Boolean},displayInLayerSwitcher:{type:Boolean,default:!0},preview:{}},emits:["change","error","propertychange","change:extent","change:maxResolution","change:maxZoom","change:minResolution","change:minZoom","change:opacity","change:source","change:visible","change:zIndex","postrender","prerender","change:layers"],setup(i,{expose:e}){const t=i,n=ft("map"),r=Nn(t),s=za(new Vl(r));Jr(s,["change:extent","change:layers","change:maxResolution","change:maxZoom","change:minResolution","change:minZoom","change:opacity","change:visible","change:zIndex"]);const o=ft("layerGroup",null);return ti(()=>r,a=>{for(const l in a){const c=l;a[c]!==void 0&&s.value.set(l,a[c])}},{deep:!0}),Ji(()=>{if(n?.addLayer(s.value),o){const a=o.getLayers();a.push(s.value),o.setLayers(a)}}),cn(()=>{n?.removeLayer(s.value)}),fi("layerGroup",s.value),e({layerGroup:s.value}),(a,l)=>(vt(),Yt("div",null,[qt(a.$slots,"default")]))}}),WA=et({__name:"OlTileLayer",props:hr({className:{},opacity:{},visible:{type:Boolean},extent:{},zIndex:{},minResolution:{},maxResolution:{},minZoom:{},maxZoom:{},preload:{},source:{},map:{},background:{type:[String,Function]},useInterimTilesOnError:{type:Boolean},properties:{},cacheSize:{},openInLayerSwitcher:{type:Boolean},title:{},name:{},allwaysOnTop:{type:Boolean},baseLayer:{type:Boolean},displayInLayerSwitcher:{type:Boolean},preview:{}},ho({preload:1})),emits:["sourceready","change","error","propertychange","change:extent","change:maxResolution","change:maxZoom","change:minResolution","change:minZoom","change:opacity","change:source","change:visible","change:zIndex","postrender","prerender","change:useInterimTilesOnError","change:preload"],setup(i,{expose:e}){const t=i,{layer:n}=Zo(Vy,Hd(t),["change:useInterimTilesOnError","change:preload"]);return fi("tileLayer",n),e({tileLayer:n}),(r,s)=>(vt(),Yt("div",null,[qt(r.$slots,"default")]))}}),HA=et({__name:"OlVectorLayer",props:hr({className:{},opacity:{},visible:{type:Boolean},extent:{},zIndex:{},minResolution:{},maxResolution:{},minZoom:{},maxZoom:{},renderOrder:{type:Function},renderBuffer:{},source:{},map:{},declutter:{type:[String,Number,Boolean]},style:{type:[Object,Array,Function,null]},background:{type:[String,Function]},updateWhileAnimating:{type:Boolean},updateWhileInteracting:{type:Boolean},properties:{},openInLayerSwitcher:{type:Boolean},title:{},name:{},allwaysOnTop:{type:Boolean},baseLayer:{type:Boolean},displayInLayerSwitcher:{type:Boolean},preview:{}},ho()),emits:["sourceready","change","error","propertychange","change:extent","change:maxResolution","change:maxZoom","change:minResolution","change:minZoom","change:opacity","change:source","change:visible","change:zIndex","postrender","prerender"],setup(i,{expose:e}){const t=i,{layer:n}=Zo(ao,t);return fi("vectorLayer",n),fi("stylable",n),e({vectorLayer:n}),(r,s)=>(vt(),Yt("div",null,[qt(r.$slots,"default")]))}}),XA=et({__name:"OlVectorTileLayer",props:hr({className:{},opacity:{},visible:{type:Boolean},extent:{},zIndex:{},minResolution:{},maxResolution:{},minZoom:{},maxZoom:{},renderOrder:{type:Function},renderBuffer:{},renderMode:{},source:{},map:{},declutter:{type:[String,Number,Boolean]},style:{type:[Object,Array,Function,null]},background:{type:[String,Function]},updateWhileAnimating:{type:Boolean},updateWhileInteracting:{type:Boolean},preload:{},useInterimTilesOnError:{type:Boolean},properties:{},cacheSize:{},openInLayerSwitcher:{type:Boolean},title:{},name:{},allwaysOnTop:{type:Boolean},baseLayer:{type:Boolean},displayInLayerSwitcher:{type:Boolean},preview:{}},ho()),emits:["sourceready","change","error","propertychange","change:extent","change:maxResolution","change:maxZoom","change:minResolution","change:minZoom","change:opacity","change:source","change:visible","change:zIndex","postrender","prerender"],setup(i,{expose:e}){const t=i,{layer:n}=Zo(VC,t);return fi("vectorTileLayer",n),fi("stylable",n),e({vectorTileLayer:n}),(r,s)=>(vt(),Yt("div",null,[qt(r.$slots,"default")]))}}),KA=et({__name:"OlVectorImageLayer",props:hr({className:{},opacity:{},visible:{type:Boolean},extent:{},zIndex:{},minResolution:{},maxResolution:{},minZoom:{},maxZoom:{},renderOrder:{type:Function},renderBuffer:{},source:{},map:{},declutter:{type:[String,Number,Boolean]},style:{type:[Object,Array,Function,null]},background:{type:[String,Function]},imageRatio:{},properties:{},openInLayerSwitcher:{type:Boolean},title:{},name:{},allwaysOnTop:{type:Boolean},baseLayer:{type:Boolean},displayInLayerSwitcher:{type:Boolean},preview:{}},ho()),emits:["sourceready","change","error","propertychange","change:extent","change:maxResolution","change:maxZoom","change:minResolution","change:minZoom","change:opacity","change:source","change:visible","change:zIndex","postrender","prerender"],setup(i,{expose:e}){const t=i,{layer:n}=Zo(XD,t);return fi("vectorLayer",n),fi("stylable",n),e({vectorImageLayer:n}),(r,s)=>(vt(),Yt("div",null,[qt(r.$slots,"default")]))}}),YA=et({__name:"OlWebglTileLayer",props:hr({style:{},className:{},opacity:{},visible:{type:Boolean},extent:{},zIndex:{},minResolution:{},maxResolution:{},minZoom:{},maxZoom:{},preload:{},source:{},sources:{type:[Array,Function]},map:{},useInterimTilesOnError:{type:Boolean},cacheSize:{},properties:{},openInLayerSwitcher:{type:Boolean},title:{},name:{},allwaysOnTop:{type:Boolean},baseLayer:{type:Boolean},displayInLayerSwitcher:{type:Boolean},preview:{}},ho()),emits:["sourceready","change","error","propertychange","change:extent","change:maxResolution","change:maxZoom","change:minResolution","change:minZoom","change:opacity","change:source","change:visible","change:zIndex","postrender","prerender","change:useInterimTilesOnError","change:preload"],setup(i,{expose:e}){const t=i,{layer:n}=Zo($C,t,["change:useInterimTilesOnError","change:preload"]);return fi("tileLayer",n),e({tileLayer:n}),(r,s)=>(vt(),Yt("div",null,[qt(r.$slots,"default")]))}}),ZA=et({__name:"OlWebglVectorLayer",props:hr({className:{},opacity:{},visible:{type:Boolean},extent:{},zIndex:{},minResolution:{},maxResolution:{},minZoom:{},maxZoom:{},source:{},variables:{},background:{type:[String,Function]},disableHitDetection:{type:Boolean},properties:{},map:{},render:{type:Function},openInLayerSwitcher:{type:Boolean},title:{},name:{},allwaysOnTop:{type:Boolean},baseLayer:{type:Boolean},displayInLayerSwitcher:{type:Boolean},preview:{},styles:{}},ho({styles:()=>({"shape-points":1,"shape-radius":10,"shape-opacity":.5,"shape-fill-color":"blue"})})),emits:["sourceready","change","error","propertychange","change:extent","change:maxResolution","change:maxZoom","change:minResolution","change:minZoom","change:opacity","change:source","change:visible","change:zIndex","postrender","prerender"],setup(i,{expose:e}){const t=i,{layer:n}=Zo(KD,t);return fi("webglVectorLayer",n),ti(()=>t.variables,r=>{r&&n.value.updateStyleVariables(r)}),e({webglVectorLayer:n}),(r,s)=>(vt(),Yt("div",null,[qt(r.$slots,"default")]))}});function ZE(i,e){jt(i,"OlAnimatedClusterLayer",UA),jt(i,"OlGraticuleLayer",zA),jt(i,"OlHeatmapLayer",qA),jt(i,"OlImageLayer",VA),jt(i,"OlLayerGroup",$A),jt(i,"OlTileLayer",WA),jt(i,"OlVectorImageLayer",KA),jt(i,"OlVectorLayer",HA),jt(i,"OlVectorTileLayer",XA),jt(i,"OlWebglTileLayer",YA),jt(i,"OlWebglVectorLayer",ZA),e&&i.provide("ol-options",e)}const D_=Object.freeze(Object.defineProperty({__proto__:null,OlAnimatedClusterLayer:UA,OlGraticuleLayer:zA,OlHeatmapLayer:qA,OlImageLayer:VA,OlLayerGroup:$A,OlTileLayer:WA,OlVectorImageLayer:KA,OlVectorLayer:HA,OlVectorTileLayer:XA,OlWebglTileLayer:YA,OlWebglVectorLayer:ZA,default:ZE,install:ZE,layersCommonDefaultProps:jA,useLayerDefaults:ho},Symbol.toStringTag,{value:"Module"}));function Sr(i,e,t,n=[],r){function s(){return Nn({...t,...t.projection?{projection:GA(t.projection)}:{}})}const o=za(new i(s()));a();function a(){e?.value?.setSource(null);const h=s();o.value.setProperties(h);for(const u in h){const f=u;h[f]!==void 0&&o.value.set(u,h[f])}return r&&r(o.value),e?.value?.setSource(o.value),Jr(o,[...lA,...l(),...n]),o}function l(){const h=o.value;return h instanceof Ko?cA:h instanceof jm?N9:h instanceof Hx?F9:[]}function c(){e?.value?.setSource(null)}return cn(c),ti(o,a),ti(()=>e,a),ti(()=>t,a,{deep:!0}),{source:o,updateSource:a,removeSource:c}}const JA=et({inheritAttrs:!1,__name:"OlSourceBingMaps",props:{cacheSize:{},hidpi:{type:Boolean},culture:{},imagerySet:{},interpolate:{type:Boolean,default:!0},maxZoom:{},reprojectionErrorThreshold:{},tileLoadFunction:{},wrapX:{type:Boolean,default:!0},transition:{},zDirection:{},placeholderTiles:{type:Boolean},apiKey:{}},emits:["tileloadend","tileloaderror","tileloadstart","change","error","propertychange"],setup(i,{expose:e}){const t=i,n=ft("tileLayer"),{source:r}=Sr(RO,n,{...t,key:t.apiKey});return e({layer:n,source:r}),(s,o)=>Xt("",!0)}}),QA=et({inheritAttrs:!1,__name:"OlSourceCluster",props:{attributions:{},distance:{},minDistance:{},geometryFunction:{},createCluster:{},source:{},wrapX:{type:Boolean,default:!0}},emits:["addfeature","changefeature","clear","featuresloadend","featuresloaderror","featuresloadstart","removefeature","change","error","propertychange"],setup(i,{expose:e}){const t=i,n=ft("vectorLayer"),{source:r}=Sr(zL,n,t);return fi("vectorLayer",r),e({layer:n,source:r}),(s,o)=>(vt(),Yt("div",null,[qt(s.$slots,"default")]))}}),eP=et({inheritAttrs:!1,__name:"OlSourceImageStatic",props:{attributions:{},crossOrigin:{},imageExtent:{},imageLoadFunction:{},interpolate:{type:Boolean,default:!0},projection:{},url:{}},emits:["imageloadend","imageloaderror","imageloadstart","change","error","propertychange"],setup(i,{expose:e}){const t=i,n=ft("imageLayer"),{source:r}=Sr(q7,n,t);return e({layer:n,source:r}),(s,o)=>Xt("",!0)}}),tP=et({inheritAttrs:!1,__name:"OlSourceImageWMS",props:{attributions:{},crossOrigin:{},hidpi:{type:Boolean,default:!0},serverType:{default:"mapserver"},imageLoadFunction:{},interpolate:{type:Boolean,default:!0},params:{},projection:{},ratio:{default:1},resolutions:{},url:{},layers:{},styles:{default:""},time:{}},emits:["imageloadend","imageloaderror","imageloadstart","change","error","propertychange"],setup(i,{expose:e}){const t=i,n=ft("imageLayer"),{source:r}=Sr(Y7,n,{...t,params:{...t.params,LAYERS:t.layers,STYLES:t.styles,TIME:t.time}});return e({layer:n,source:r}),(s,o)=>Xt("",!0)}}),iP=et({inheritAttrs:!1,__name:"OlSourceOSM",props:{attributions:{},cacheSize:{},crossOrigin:{},interpolate:{type:Boolean,default:!0},maxZoom:{},reprojectionErrorThreshold:{},tileLoadFunction:{},transition:{},url:{},wrapX:{type:Boolean,default:!0},zDirection:{}},emits:["tileloadend","tileloaderror","tileloadstart","change","error","propertychange"],setup(i,{expose:e}){const t=i,n=ft("tileLayer"),{source:r}=Sr(i4,n,t);return e({layer:n,source:r}),(s,o)=>Xt("",!0)}}),nP=et({inheritAttrs:!1,__name:"OlSourceStadiaMaps",props:{cacheSize:{},interpolate:{type:Boolean,default:!0},layer:{},minZoom:{},maxZoom:{},reprojectionErrorThreshold:{},tileLoadFunction:{},transition:{},url:{},wrapX:{type:Boolean,default:!0},zDirection:{},apiKey:{},retina:{type:Boolean}},emits:["tileloadend","tileloaderror","tileloadstart","change","error","propertychange"],setup(i,{expose:e}){const t=i,n=ft("tileLayer"),{source:r}=Sr(f4,n,t);return e({layer:n,source:r}),(s,o)=>Xt("",!0)}});class Hs extends xC{static layerLabelMap={};static layerZoomMap={};static tileProxy;constructor(e){Hs.layerLabelMap={vec:"cva",ter:"cta",img:"cia"},Hs.layerZoomMap={vec:18,ter:14,img:18};const t={...e};t.layerType=t.layerType||"vec",t.layerType=t.isLabel?Hs.layerLabelMap[t.layerType]:t.layerType,t.matrixSet=t.projection==="EPSG:4326"||t.projection==="EPSG:4490"?"c":"w",!t.url&&!t.urls&&(t.url="https://t{0-7}.tianditu.gov.cn/{layer}_{proj}/wmts?"),t.tk&&(t.url=`${t.url}tk=${t.tk}`),t.url=(t.url||"").replace("{layer}",t.layerType).replace("{proj}",t.matrixSet);const n=t.tileGrid||Hs.getTileGrid(t.projection),r=t.crossOrigin!==void 0?t.crossOrigin:"anonymous",s={version:t.version||"1.0.0",format:t.format||"tiles",dimensions:t.dimensions||{},layer:t.layerType,matrixSet:t.matrixSet,tileGrid:n,style:t.style||"default",cacheSize:t.cacheSize,crossOrigin:r,maxZoom:Hs.layerZoomMap[t.layerType],reprojectionErrorThreshold:t.reprojectionErrorThreshold,url:t.url,urls:t.urls,projection:t.projection||"EPSG:3857",wrapX:t.wrapX};t.tileProxy&&(Hs.tileProxy=t.tileProxy,s.tileLoadFunction=(o,a)=>{o.getImage().src=Hs.tileProxy+encodeURIComponent(a)}),super(s)}static getTileGrid(e){return e==="EPSG:4326"||e==="EPSG:4490"?Hs.default4326TileGrid():Hs.default3857TileGrid()}static default4326TileGrid(){const e=[],t=[];for(let r=1;r<19;r++)e.push(.703125*2/2**r),t.push(r.toString());return new I0({extent:[-180,-90,180,90],resolutions:e,origin:[-180,90],matrixIds:t})}static default3857TileGrid(){const e=[],t=[];for(let r=1;r<19;r++)e.push(78271.51696402031*2/2**r),t.push(r.toString());return new I0({extent:[-200375083427892e-7,-200375083427892e-7,200375083427892e-7,200375083427892e-7],resolutions:e,matrixIds:t,origin:[-200375083427892e-7,200375083427892e-7]})}}const rP=et({inheritAttrs:!1,__name:"OlSourceTianditu",props:{attributions:{},attributionsCollapsible:{type:Boolean},cacheSize:{},crossOrigin:{},interpolate:{type:Boolean},tileGrid:{},projection:{default:"EPSG:3857"},reprojectionErrorThreshold:{},requestEncoding:{default:"KVP"},layer:{},style:{},tileClass:{},tilePixelRatio:{},format:{},version:{default:"1.0.0"},matrixSet:{},dimensions:{default:()=>({})},url:{},tileLoadFunction:{type:Function,default:(i,e)=>{i.getImage().src=e}},urls:{},wrapX:{type:Boolean,default:!0},transition:{},zDirection:{},tileProxy:{},layerType:{default:"img"},tk:{},isLabel:{type:Boolean,default:!1},maxZoom:{default:21}},emits:["tileloadend","tileloaderror","tileloadstart","change","error","propertychange"],setup(i,{expose:e}){const t=i,n=ft("tileLayer"),{source:r}=Sr(Hs,n,t);return e({layer:n,source:r}),(s,o)=>Xt("",!0)}}),sP=et({inheritAttrs:!1,__name:"OlSourceTileArcGISRest",props:{attributions:{},cacheSize:{},crossOrigin:{},interpolate:{type:Boolean,default:!0},params:{},hidpi:{type:Boolean,default:!0},tileGrid:{},projection:{},reprojectionErrorThreshold:{},tileLoadFunction:{},url:{},wrapX:{type:Boolean,default:!0},transition:{},urls:{},zDirection:{},tileSize:{default:()=>[256,256]}},emits:["tileloadend","tileloaderror","tileloadstart","change","error","propertychange"],setup(i,{expose:e}){const t=i,n=ft("tileLayer"),r=qi(()=>t.tileGrid||ku({tileSize:t.tileSize})),{source:s}=Sr(d4,n,{...t,tileGrid:r.value});return e({tileLayer:n,source:s}),(o,a)=>Xt("",!0)}}),oP=et({inheritAttrs:!1,__name:"OlSourceTileDebug",props:{projection:{},tileGrid:{},wrapX:{type:Boolean,default:!0},zDirection:{},source:{},template:{},color:{}},emits:["tileloadend","tileloaderror","tileloadstart","change","error","propertychange"],setup(i,{expose:e}){const t=i,n=ft("tileLayer"),{source:r}=Sr(g4,n,t);return e({layer:n,source:r}),(s,o)=>Xt("",!0)}}),aP=et({inheritAttrs:!1,__name:"OlSourceGeoTIFF",props:{sources:{},sourceOptions:{},convertToRGB:{type:[Boolean,String]},normalize:{type:Boolean,default:!0},projection:{},transition:{},wrapX:{type:Boolean},interpolate:{type:Boolean,default:!0}},emits:["tileloadend","tileloaderror","tileloadstart","change","error","propertychange"],setup(i,{expose:e}){const t=i,n=ft("tileLayer"),{source:r}=Sr(aC,n,t);return e({layer:n,source:r}),(s,o)=>Xt("",!0)}}),lP=et({inheritAttrs:!1,__name:"OlSourceTileJSON",props:{attributions:{},cacheSize:{},crossOrigin:{},interpolate:{type:Boolean,default:!0},jsonp:{type:Boolean},reprojectionErrorThreshold:{},tileJSON:{},tileLoadFunction:{},tileSize:{},url:{},wrapX:{type:Boolean,default:!0},transition:{},zDirection:{}},emits:["tileloadend","tileloaderror","tileloadstart","change","error","propertychange"],setup(i,{expose:e}){const t=i,n=ft("tileLayer"),{source:r}=Sr(p4,n,t);return e({layer:n,source:r}),(s,o)=>Xt("",!0)}}),cP=et({inheritAttrs:!1,__name:"OlSourceTileWMS",props:{attributions:{},attributionsCollapsible:{type:Boolean,default:!0},cacheSize:{},crossOrigin:{},interpolate:{type:Boolean,default:!0},params:{},gutter:{},hidpi:{type:Boolean,default:!0},projection:{default:"EPSG:3857"},reprojectionErrorThreshold:{},tileClass:{},tileGrid:{},serverType:{},tileLoadFunction:{},url:{},urls:{},wrapX:{type:Boolean,default:!0},transition:{},zDirection:{},layers:{},styles:{default:""}},emits:["tileloadend","tileloaderror","tileloadstart","change","error","propertychange"],setup(i,{expose:e}){const t=i,n=ft("tileLayer"),{source:r}=Sr(vC,n,{...t,params:{...t.params,LAYERS:t.layers,STYLES:t.styles},tileGrid:t.tileGrid});return e({layer:n,source:r}),(s,o)=>Xt("",!0)}}),hP=et({inheritAttrs:!1,__name:"OlSourceVector",props:{attributions:{},features:{},format:{},loader:{},overlaps:{type:Boolean,default:!0},strategy:{},url:{},useSpatialIndex:{type:Boolean,default:!0},wrapX:{type:Boolean,default:!0}},emits:["addfeature","changefeature","clear","featuresloadend","featuresloaderror","featuresloadstart","removefeature","change","error","propertychange"],setup(i,{expose:e}){const t=i,n=ft("vectorLayer",null),r=ft("heatmapLayer",null),s=ft("webglVectorLayer",null),o=r||n||s,{source:a,updateSource:l}=Sr(Ko,o,t);return ti(()=>t.features,(c,h)=>{if(c!==h&&(a.value.clear(),c)){const u=c instanceof Rn?c.getArray():c;a.value.addFeatures(u)}l()},{deep:!0}),ti(()=>t.url,(c,h)=>{c!==h&&(a.value.clear(),c&&(a.value.setUrl(c),a.value.refresh())),l()}),fi("vectorSource",a),e({layer:o,source:a}),(c,h)=>(vt(),Yt("div",null,[qt(c.$slots,"default")]))}}),uP=et({inheritAttrs:!1,__name:"OlSourceVectorTile",props:{attributions:{},attributionsCollapsible:{type:Boolean,default:!0},cacheSize:{},extent:{},format:{},overlaps:{type:Boolean,default:!0},projection:{},state:{},tileClass:{},maxZoom:{},minZoom:{},tileSize:{},maxResolution:{},tileGrid:{},tileLoadFunction:{},tileUrlFunction:{},url:{},transition:{},urls:{},wrapX:{type:Boolean,default:!0},zDirection:{}},emits:["tileloadend","tileloaderror","tileloadstart","change","error","propertychange"],setup(i,{expose:e}){const t=i,n=ft("vectorTileLayer",null),{source:r}=Sr(e4,n,t);return fi("vectorSource",r),e({vectorTileLayer:n,source:r}),(s,o)=>(vt(),Yt("div",null,[qt(s.$slots,"default")]))}}),fP=et({inheritAttrs:!1,__name:"OlSourceXYZ",props:{attributions:{},attributionsCollapsible:{type:Boolean,default:!0},cacheSize:{},crossOrigin:{},interpolate:{type:Boolean,default:!0},projection:{},reprojectionErrorThreshold:{},maxZoom:{},minZoom:{},maxResolution:{},tileGrid:{},tileLoadFunction:{},tilePixelRatio:{},tileSize:{},gutter:{},tileUrlFunction:{},url:{},urls:{},wrapX:{type:Boolean,default:!0},transition:{},zDirection:{}},emits:["tileloadend","tileloaderror","tileloadstart","change","error","propertychange"],setup(i,{expose:e}){const t=i,n=ft("tileLayer"),{source:r,updateSource:s}=Sr(Fx,n,t,[],o=>{t.url&&o.setUrl(t.url)});return ti(()=>t.url,()=>s()),e({layer:n,source:r}),(o,a)=>Xt("",!0)}}),dP=et({inheritAttrs:!1,__name:"OlSourceWMTS",props:{attributions:{},attributionsCollapsible:{type:Boolean,default:!0},cacheSize:{},crossOrigin:{},interpolate:{type:Boolean,default:!0},projection:{},reprojectionErrorThreshold:{},requestEncoding:{},layer:{},tileClass:{},tilePixelRatio:{},format:{},version:{},matrixSet:{},dimensions:{},url:{},tileLoadFunction:{},urls:{},wrapX:{type:Boolean},transition:{},zDirection:{},tileGrid:{},styles:{},tileZoomLevel:{default:30},tileMatrixPrefix:{default:""}},emits:["tileloadend","tileloaderror","tileloadstart","change","error","propertychange"],setup(i,{expose:e}){const t=i,n=ft("tileLayer"),r=qi(()=>Mt(t.projection)?.getExtent()),s=qi(()=>r.value?no(r.value):void 0),o=qi(()=>r.value?St(r.value)/256:0),a=qi(()=>{if(t.tileGrid)return t.tileGrid;const c=[t.tileZoomLevel],h=[`${t.tileZoomLevel}`];for(let u=0;u<t.tileZoomLevel;++u)c[u]=o.value/Math.pow(2,u),h[u]=t.tileMatrixPrefix+u;return new I0({origin:s.value,resolutions:c,matrixIds:h})}),{source:l}=Sr(xC,n,{...t,style:t.styles,tileGrid:a.value});return e({tileLayer:n,source:l}),(c,h)=>Xt("",!0)}});function JE(i,e){jt(i,"OlSourceBingMaps",JA),jt(i,"OlSourceCluster",QA),jt(i,"OlSourceImageStatic",eP),jt(i,"OlSourceImageWMS",tP),jt(i,"OlSourceOSM",iP),jt(i,"OlSourceStadiaMaps",nP),jt(i,"OlSourceTianditu",rP),jt(i,"OlSourceTileArcGISRest",sP),jt(i,"OlSourceTileDebug",oP),jt(i,"OlSourceGeoTIFF",aP),jt(i,"OlSourceTileJSON",lP),jt(i,"OlSourceTileWMS",cP),jt(i,"OlSourceVector",hP),jt(i,"OlSourceVectorTile",uP),jt(i,"OlSourceXYZ",fP),jt(i,"OlSourceWMTS",dP),e&&i.provide("ol-options",e)}const k_=Object.freeze(Object.defineProperty({__proto__:null,OlSourceBingMaps:JA,OlSourceCluster:QA,OlSourceGeoTIFF:aP,OlSourceImageStatic:eP,OlSourceImageWMS:tP,OlSourceOSM:iP,OlSourceStadiaMaps:nP,OlSourceTianditu:rP,OlSourceTileArcGISRest:sP,OlSourceTileDebug:oP,OlSourceTileJSON:lP,OlSourceTileWMS:cP,OlSourceVector:hP,OlSourceVectorTile:uP,OlSourceWMTS:dP,OlSourceXYZ:fP,default:JE,install:JE},Symbol.toStringTag,{value:"Module"}));var Mp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function YW(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Jp={exports:{}},Iz=Jp.exports,QE;function Nz(){return QE||(QE=1,(function(i,e){(function(t,n){n()})(Iz,function(){function t(c,h){return typeof h>"u"?h={autoBom:!1}:typeof h!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),h={autoBom:!h}),h.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(c.type)?new Blob(["\uFEFF",c],{type:c.type}):c}function n(c,h,u){var f=new XMLHttpRequest;f.open("GET",c),f.responseType="blob",f.onload=function(){l(f.response,h,u)},f.onerror=function(){console.error("could not download file")},f.send()}function r(c){var h=new XMLHttpRequest;h.open("HEAD",c,!1);try{h.send()}catch{}return 200<=h.status&&299>=h.status}function s(c){try{c.dispatchEvent(new MouseEvent("click"))}catch{var h=document.createEvent("MouseEvents");h.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),c.dispatchEvent(h)}}var o=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof Mp=="object"&&Mp.global===Mp?Mp:void 0,a=o.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),l=o.saveAs||(typeof window!="object"||window!==o?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(c,h,u){var f=o.URL||o.webkitURL,d=document.createElement("a");h=h||c.name||"download",d.download=h,d.rel="noopener",typeof c=="string"?(d.href=c,d.origin===location.origin?s(d):r(d.href)?n(c,h,u):s(d,d.target="_blank")):(d.href=f.createObjectURL(c),setTimeout(function(){f.revokeObjectURL(d.href)},4e4),setTimeout(function(){s(d)},0))}:"msSaveOrOpenBlob"in navigator?function(c,h,u){if(h=h||c.name||"download",typeof c!="string")navigator.msSaveOrOpenBlob(t(c,u),h);else if(r(c))n(c,h,u);else{var f=document.createElement("a");f.href=c,f.target="_blank",setTimeout(function(){s(f)})}}:function(c,h,u,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof c=="string")return n(c,h,u);var d=c.type==="application/octet-stream",g=/constructor/i.test(o.HTMLElement)||o.safari,m=/CriOS\/[\d]+/.test(navigator.userAgent);if((m||d&&g||a)&&typeof FileReader<"u"){var _=new FileReader;_.onloadend=function(){var S=_.result;S=m?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=S:location=S,f=null},_.readAsDataURL(c)}else{var v=o.URL||o.webkitURL,x=v.createObjectURL(c);f?f.location=x:location.href=x,f=null,setTimeout(function(){v.revokeObjectURL(x)},4e4)}});o.saveAs=l.saveAs=l,i.exports=l})})(Jp)),Jp.exports}Nz();function bi(i){"@babel/helpers - typeof";return bi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bi(i)}var lo=Uint8Array,Rs=Uint16Array,b5=Int32Array,E5=new lo([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),S5=new lo([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),e2=new lo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),gP=function(i,e){for(var t=new Rs(31),n=0;n<31;++n)t[n]=e+=1<<i[n-1];for(var r=new b5(t[30]),n=1;n<30;++n)for(var s=t[n];s<t[n+1];++s)r[s]=s-t[n]<<5|n;return{b:t,r}},pP=gP(E5,2),Fz=pP.b,ov=pP.r;Fz[28]=258,ov[258]=28;var Oz=gP(S5,0),t2=Oz.r,mP=new Rs(32768);for(var $i=0;$i<32768;++$i){var ml=($i&43690)>>1|($i&21845)<<1;ml=(ml&52428)>>2|(ml&13107)<<2,ml=(ml&61680)>>4|(ml&3855)<<4,mP[$i]=((ml&65280)>>8|(ml&255)<<8)>>1}var cd=(function(i,e,t){for(var n=i.length,r=0,s=new Rs(e);r<n;++r)i[r]&&++s[i[r]-1];var o=new Rs(e);for(r=1;r<e;++r)o[r]=o[r-1]+s[r-1]<<1;var a;for(a=new Rs(n),r=0;r<n;++r)i[r]&&(a[r]=mP[o[i[r]-1]++]>>15-i[r]);return a}),jc=new lo(288);for(var $i=0;$i<144;++$i)jc[$i]=8;for(var $i=144;$i<256;++$i)jc[$i]=9;for(var $i=256;$i<280;++$i)jc[$i]=7;for(var $i=280;$i<288;++$i)jc[$i]=8;var tm=new lo(32);for(var $i=0;$i<32;++$i)tm[$i]=5;var Dz=cd(jc,9),kz=cd(tm,5),_P=function(i){return(i+7)/8|0},Gz=function(i,e,t){return(t==null||t>i.length)&&(t=i.length),new lo(i.subarray(e,t))},xa=function(i,e,t){t<<=e&7;var n=e/8|0;i[n]|=t,i[n+1]|=t>>8},Pf=function(i,e,t){t<<=e&7;var n=e/8|0;i[n]|=t,i[n+1]|=t>>8,i[n+2]|=t>>16},G_=function(i,e){for(var t=[],n=0;n<i.length;++n)i[n]&&t.push({s:n,f:i[n]});var r=t.length,s=t.slice();if(!r)return{t:vP,l:0};if(r==1){var o=new lo(t[0].s+1);return o[t[0].s]=1,{t:o,l:1}}t.sort(function(A,F){return A.f-F.f}),t.push({s:-1,f:25001});var a=t[0],l=t[1],c=0,h=1,u=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=r-1;)a=t[t[c].f<t[u].f?c++:u++],l=t[c!=h&&t[c].f<t[u].f?c++:u++],t[h++]={s:-1,f:a.f+l.f,l:a,r:l};for(var f=s[0].s,n=1;n<r;++n)s[n].s>f&&(f=s[n].s);var d=new Rs(f+1),g=av(t[h-1],d,0);if(g>e){var n=0,m=0,_=g-e,v=1<<_;for(s.sort(function(F,N){return d[N.s]-d[F.s]||F.f-N.f});n<r;++n){var x=s[n].s;if(d[x]>e)m+=v-(1<<g-d[x]),d[x]=e;else break}for(m>>=_;m>0;){var S=s[n].s;d[S]<e?m-=1<<e-d[S]++-1:++n}for(;n>=0&&m;--n){var b=s[n].s;d[b]==e&&(--d[b],++m)}g=e}return{t:new lo(d),l:g}},av=function(i,e,t){return i.s==-1?Math.max(av(i.l,e,t+1),av(i.r,e,t+1)):e[i.s]=t},i2=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new Rs(++e),n=0,r=i[0],s=1,o=function(l){t[n++]=l},a=1;a<=e;++a)if(i[a]==r&&a!=e)++s;else{if(!r&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(r),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(r);s=1,r=i[a]}return{c:t.subarray(0,n),n:e}},Mf=function(i,e){for(var t=0,n=0;n<e.length;++n)t+=i[n]*e[n];return t},yP=function(i,e,t){var n=t.length,r=_P(e+2);i[r]=n&255,i[r+1]=n>>8,i[r+2]=i[r]^255,i[r+3]=i[r+1]^255;for(var s=0;s<n;++s)i[r+s+4]=t[s];return(r+4+n)*8},n2=function(i,e,t,n,r,s,o,a,l,c,h){xa(e,h++,t),++r[256];for(var u=G_(r,15),f=u.t,d=u.l,g=G_(s,15),m=g.t,_=g.l,v=i2(f),x=v.c,S=v.n,b=i2(m),A=b.c,F=b.n,N=new Rs(19),R=0;R<x.length;++R)++N[x[R]&31];for(var R=0;R<A.length;++R)++N[A[R]&31];for(var P=G_(N,7),O=P.t,L=P.l,T=19;T>4&&!O[e2[T-1]];--T);var C=c+5<<3,D=Mf(r,jc)+Mf(s,tm)+o,W=Mf(r,f)+Mf(s,m)+o+14+3*T+Mf(N,O)+2*N[16]+3*N[17]+7*N[18];if(l>=0&&C<=D&&C<=W)return yP(e,h,i.subarray(l,l+c));var $,B,V,te;if(xa(e,h,1+(W<D)),h+=2,W<D){$=cd(f,d),B=f,V=cd(m,_),te=m;var ne=cd(O,L);xa(e,h,S-257),xa(e,h+5,F-1),xa(e,h+10,T-4),h+=14;for(var R=0;R<T;++R)xa(e,h+3*R,O[e2[R]]);h+=3*T;for(var ae=[x,A],I=0;I<2;++I)for(var U=ae[I],R=0;R<U.length;++R){var K=U[R]&31;xa(e,h,ne[K]),h+=O[K],K>15&&(xa(e,h,U[R]>>5&127),h+=U[R]>>12)}}else $=Dz,B=jc,V=kz,te=tm;for(var R=0;R<a;++R){var ie=n[R];if(ie>255){var K=ie>>18&31;Pf(e,h,$[K+257]),h+=B[K+257],K>7&&(xa(e,h,ie>>23&31),h+=E5[K]);var re=ie&31;Pf(e,h,V[re]),h+=te[re],re>3&&(Pf(e,h,ie>>5&8191),h+=S5[re])}else Pf(e,h,$[ie]),h+=B[ie]}return Pf(e,h,$[256]),h+B[256]},Bz=new b5([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),vP=new lo(0),jz=function(i,e,t,n,r,s){var o=s.z||i.length,a=new lo(n+o+5*(1+Math.ceil(o/7e3))+r),l=a.subarray(n,a.length-r),c=s.l,h=(s.r||0)&7;if(e){h&&(l[0]=s.r>>3);for(var u=Bz[e-1],f=u>>13,d=u&8191,g=(1<<t)-1,m=s.p||new Rs(32768),_=s.h||new Rs(g+1),v=Math.ceil(t/3),x=2*v,S=function(he){return(i[he]^i[he+1]<<v^i[he+2]<<x)&g},b=new b5(25e3),A=new Rs(288),F=new Rs(32),N=0,R=0,P=s.i||0,O=0,L=s.w||0,T=0;P+2<o;++P){var C=S(P),D=P&32767,W=_[C];if(m[D]=W,_[C]=D,L<=P){var $=o-P;if((N>7e3||O>24576)&&($>423||!c)){h=n2(i,l,0,b,A,F,R,O,T,P-T,h),O=N=R=0,T=P;for(var B=0;B<286;++B)A[B]=0;for(var B=0;B<30;++B)F[B]=0}var V=2,te=0,ne=d,ae=D-W&32767;if($>2&&C==S(P-ae))for(var I=Math.min(f,$)-1,U=Math.min(32767,P),K=Math.min(258,$);ae<=U&&--ne&&D!=W;){if(i[P+V]==i[P+V-ae]){for(var ie=0;ie<K&&i[P+ie]==i[P+ie-ae];++ie);if(ie>V){if(V=ie,te=ae,ie>I)break;for(var re=Math.min(ae,ie-2),ce=0,B=0;B<re;++B){var ve=P-ae+B&32767,pe=m[ve],le=ve-pe&32767;le>ce&&(ce=le,W=ve)}}}D=W,W=m[D],ae+=D-W&32767}if(te){b[O++]=268435456|ov[V]<<18|t2[te];var Ce=ov[V]&31,H=t2[te]&31;R+=E5[Ce]+S5[H],++A[257+Ce],++F[H],L=P+V,++N}else b[O++]=i[P],++A[i[P]]}}for(P=Math.max(P,L);P<o;++P)b[O++]=i[P],++A[i[P]];h=n2(i,l,c,b,A,F,R,O,T,P-T,h),c||(s.r=h&7|l[h/8|0]<<3,h-=7,s.h=_,s.p=m,s.i=P,s.w=L)}else{for(var P=s.w||0;P<o+c;P+=65535){var Z=P+65535;Z>=o&&(l[h/8|0]=c,Z=o),h=yP(l,h+1,i.subarray(P,Z))}s.i=o}return Gz(a,0,n+_P(h)+r)},xP=function(){var i=1,e=0;return{p:function(t){for(var n=i,r=e,s=t.length|0,o=0;o!=s;){for(var a=Math.min(o+2655,s);o<a;++o)r+=n+=t[o];n=(n&65535)+15*(n>>16),r=(r&65535)+15*(r>>16)}i=n,e=r},d:function(){return i%=65521,e%=65521,(i&255)<<24|(i&65280)<<8|(e&255)<<8|e>>8}}},Uz=function(i,e,t,n,r){if(!r&&(r={l:1},e.dictionary)){var s=e.dictionary.subarray(-32768),o=new lo(s.length+i.length);o.set(s),o.set(i,s.length),i=o,r.w=s.length}return jz(i,e.level==null?6:e.level,e.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(i.length)))*1.5):20:12+e.mem,t,n,r)},wP=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8},zz=function(i,e){var t=e.level,n=t==0?0:t<6?1:t==9?3:2;if(i[0]=120,i[1]=n<<6|(e.dictionary&&32),i[1]|=31-(i[0]<<8|i[1])%31,e.dictionary){var r=xP();r.p(e.dictionary),wP(i,2,r.d())}};function lv(i,e){e||(e={});var t=xP();t.p(i);var n=Uz(i,e,e.dictionary?6:2,4);return zz(n,e),wP(n,n.length-4,t.d()),n}var qz=typeof TextDecoder<"u"&&new TextDecoder,Vz=0;try{qz.decode(vP,{stream:!0}),Vz=1}catch{}function $z(i){if(Array.isArray(i))return i}function Wz(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(h){c=!0,r=h}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function r2(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function Hz(i,e){if(i){if(typeof i=="string")return r2(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?r2(i,e):void 0}}function Xz(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
730
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function s2(i,e){return $z(i)||Wz(i,e)||Hz(i,e)||Xz()}function o2(i,e="utf8"){return new TextDecoder(e).decode(i)}const Kz=new TextEncoder;function Yz(i){return Kz.encode(i)}const Zz=1024*8,Jz=(()=>{const i=new Uint8Array(4),e=new Uint32Array(i.buffer);return!((e[0]=1)&i[0])})(),B_={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array};class T5{buffer;byteLength;byteOffset;length;offset;lastWrittenByte;littleEndian;_data;_mark;_marks;constructor(e=Zz,t={}){let n=!1;typeof e=="number"?e=new ArrayBuffer(e):(n=!0,this.lastWrittenByte=e.byteLength);const r=t.offset?t.offset>>>0:0,s=e.byteLength-r;let o=r;(ArrayBuffer.isView(e)||e instanceof T5)&&(e.byteLength!==e.buffer.byteLength&&(o=e.byteOffset+r),e=e.buffer),n?this.lastWrittenByte=s:this.lastWrittenByte=0,this.buffer=e,this.length=s,this.byteLength=s,this.byteOffset=o,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,o,s),this._mark=0,this._marks=[]}available(e=1){return this.offset+e<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(e=1){return this.offset+=e,this}back(e=1){return this.offset-=e,this}seek(e){return this.offset=e,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){const e=this._marks.pop();if(e===void 0)throw new Error("Mark stack empty");return this.seek(e),this}rewind(){return this.offset=0,this}ensureAvailable(e=1){if(!this.available(e)){const n=(this.offset+e)*2,r=new Uint8Array(n);r.set(new Uint8Array(this.buffer)),this.buffer=r.buffer,this.length=n,this.byteLength=n,this._data=new DataView(this.buffer)}return this}readBoolean(){return this.readUint8()!==0}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(e=1){return this.readArray(e,"uint8")}readArray(e,t){const n=B_[t].BYTES_PER_ELEMENT*e,r=this.byteOffset+this.offset,s=this.buffer.slice(r,r+n);if(this.littleEndian===Jz&&t!=="uint8"&&t!=="int8"){const a=new Uint8Array(this.buffer.slice(r,r+n));a.reverse();const l=new B_[t](a.buffer);return this.offset+=n,l.reverse(),l}const o=new B_[t](s);return this.offset+=n,o}readInt16(){const e=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}readUint16(){const e=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,e}readInt32(){const e=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}readUint32(){const e=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat32(){const e=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat64(){const e=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}readBigInt64(){const e=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,e}readBigUint64(){const e=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,e}readChar(){return String.fromCharCode(this.readInt8())}readChars(e=1){let t="";for(let n=0;n<e;n++)t+=this.readChar();return t}readUtf8(e=1){return o2(this.readBytes(e))}decodeText(e=1,t="utf8"){return o2(this.readBytes(e),t)}writeBoolean(e){return this.writeUint8(e?255:0),this}writeInt8(e){return this.ensureAvailable(1),this._data.setInt8(this.offset++,e),this._updateLastWrittenByte(),this}writeUint8(e){return this.ensureAvailable(1),this._data.setUint8(this.offset++,e),this._updateLastWrittenByte(),this}writeByte(e){return this.writeUint8(e)}writeBytes(e){this.ensureAvailable(e.length);for(let t=0;t<e.length;t++)this._data.setUint8(this.offset++,e[t]);return this._updateLastWrittenByte(),this}writeInt16(e){return this.ensureAvailable(2),this._data.setInt16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(e){return this.ensureAvailable(2),this._data.setUint16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(e){return this.ensureAvailable(4),this._data.setInt32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(e){return this.ensureAvailable(4),this._data.setUint32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(e){return this.ensureAvailable(4),this._data.setFloat32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(e){return this.ensureAvailable(8),this._data.setFloat64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigInt64(e){return this.ensureAvailable(8),this._data.setBigInt64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigUint64(e){return this.ensureAvailable(8),this._data.setBigUint64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(e){return this.writeUint8(e.charCodeAt(0))}writeChars(e){for(let t=0;t<e.length;t++)this.writeUint8(e.charCodeAt(t));return this}writeUtf8(e){return this.writeBytes(Yz(e))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}getWrittenByteLength(){return this.lastWrittenByte-this.byteOffset}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}function $u(i){let e=i.length;for(;--e>=0;)i[e]=0}const Qz=3,eq=258,bP=29,tq=256,iq=tq+1+bP,EP=30,nq=512,rq=new Array((iq+2)*2);$u(rq);const sq=new Array(EP*2);$u(sq);const oq=new Array(nq);$u(oq);const aq=new Array(eq-Qz+1);$u(aq);const lq=new Array(bP);$u(lq);const cq=new Array(EP);$u(cq);const hq=(i,e,t,n)=>{let r=i&65535|0,s=i>>>16&65535|0,o=0;for(;t!==0;){o=t>2e3?2e3:t,t-=o;do r=r+e[n++]|0,s=s+r|0;while(--o);r%=65521,s%=65521}return r|s<<16|0};var cv=hq;const uq=()=>{let i,e=[];for(var t=0;t<256;t++){i=t;for(var n=0;n<8;n++)i=i&1?3988292384^i>>>1:i>>>1;e[t]=i}return e},fq=new Uint32Array(uq()),dq=(i,e,t,n)=>{const r=fq,s=n+t;i^=-1;for(let o=n;o<s;o++)i=i>>>8^r[(i^e[o])&255];return i^-1};var Lo=dq,hv={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},SP={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8};const gq=(i,e)=>Object.prototype.hasOwnProperty.call(i,e);var pq=function(i){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const t=e.shift();if(t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(const n in t)gq(t,n)&&(i[n]=t[n])}}return i},mq=i=>{let e=0;for(let n=0,r=i.length;n<r;n++)e+=i[n].length;const t=new Uint8Array(e);for(let n=0,r=0,s=i.length;n<s;n++){let o=i[n];t.set(o,r),r+=o.length}return t},TP={assign:pq,flattenChunks:mq};let LP=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{LP=!1}const qd=new Uint8Array(256);for(let i=0;i<256;i++)qd[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;qd[254]=qd[254]=1;var _q=i=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(i);let e,t,n,r,s,o=i.length,a=0;for(r=0;r<o;r++)t=i.charCodeAt(r),(t&64512)===55296&&r+1<o&&(n=i.charCodeAt(r+1),(n&64512)===56320&&(t=65536+(t-55296<<10)+(n-56320),r++)),a+=t<128?1:t<2048?2:t<65536?3:4;for(e=new Uint8Array(a),s=0,r=0;s<a;r++)t=i.charCodeAt(r),(t&64512)===55296&&r+1<o&&(n=i.charCodeAt(r+1),(n&64512)===56320&&(t=65536+(t-55296<<10)+(n-56320),r++)),t<128?e[s++]=t:t<2048?(e[s++]=192|t>>>6,e[s++]=128|t&63):t<65536?(e[s++]=224|t>>>12,e[s++]=128|t>>>6&63,e[s++]=128|t&63):(e[s++]=240|t>>>18,e[s++]=128|t>>>12&63,e[s++]=128|t>>>6&63,e[s++]=128|t&63);return e};const yq=(i,e)=>{if(e<65534&&i.subarray&&LP)return String.fromCharCode.apply(null,i.length===e?i:i.subarray(0,e));let t="";for(let n=0;n<e;n++)t+=String.fromCharCode(i[n]);return t};var vq=(i,e)=>{const t=e||i.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(i.subarray(0,e));let n,r;const s=new Array(t*2);for(r=0,n=0;n<t;){let o=i[n++];if(o<128){s[r++]=o;continue}let a=qd[o];if(a>4){s[r++]=65533,n+=a-1;continue}for(o&=a===2?31:a===3?15:7;a>1&&n<t;)o=o<<6|i[n++]&63,a--;if(a>1){s[r++]=65533;continue}o<65536?s[r++]=o:(o-=65536,s[r++]=55296|o>>10&1023,s[r++]=56320|o&1023)}return yq(s,r)},xq=(i,e)=>{e=e||i.length,e>i.length&&(e=i.length);let t=e-1;for(;t>=0&&(i[t]&192)===128;)t--;return t<0||t===0?e:t+qd[i[t]]>e?t:e},uv={string2buf:_q,buf2string:vq,utf8border:xq};function wq(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var bq=wq;const Rp=16209,Eq=16191;var Sq=function(e,t){let n,r,s,o,a,l,c,h,u,f,d,g,m,_,v,x,S,b,A,F,N,R,P,O;const L=e.state;n=e.next_in,P=e.input,r=n+(e.avail_in-5),s=e.next_out,O=e.output,o=s-(t-e.avail_out),a=s+(e.avail_out-257),l=L.dmax,c=L.wsize,h=L.whave,u=L.wnext,f=L.window,d=L.hold,g=L.bits,m=L.lencode,_=L.distcode,v=(1<<L.lenbits)-1,x=(1<<L.distbits)-1;e:do{g<15&&(d+=P[n++]<<g,g+=8,d+=P[n++]<<g,g+=8),S=m[d&v];t:for(;;){if(b=S>>>24,d>>>=b,g-=b,b=S>>>16&255,b===0)O[s++]=S&65535;else if(b&16){A=S&65535,b&=15,b&&(g<b&&(d+=P[n++]<<g,g+=8),A+=d&(1<<b)-1,d>>>=b,g-=b),g<15&&(d+=P[n++]<<g,g+=8,d+=P[n++]<<g,g+=8),S=_[d&x];i:for(;;){if(b=S>>>24,d>>>=b,g-=b,b=S>>>16&255,b&16){if(F=S&65535,b&=15,g<b&&(d+=P[n++]<<g,g+=8,g<b&&(d+=P[n++]<<g,g+=8)),F+=d&(1<<b)-1,F>l){e.msg="invalid distance too far back",L.mode=Rp;break e}if(d>>>=b,g-=b,b=s-o,F>b){if(b=F-b,b>h&&L.sane){e.msg="invalid distance too far back",L.mode=Rp;break e}if(N=0,R=f,u===0){if(N+=c-b,b<A){A-=b;do O[s++]=f[N++];while(--b);N=s-F,R=O}}else if(u<b){if(N+=c+u-b,b-=u,b<A){A-=b;do O[s++]=f[N++];while(--b);if(N=0,u<A){b=u,A-=b;do O[s++]=f[N++];while(--b);N=s-F,R=O}}}else if(N+=u-b,b<A){A-=b;do O[s++]=f[N++];while(--b);N=s-F,R=O}for(;A>2;)O[s++]=R[N++],O[s++]=R[N++],O[s++]=R[N++],A-=3;A&&(O[s++]=R[N++],A>1&&(O[s++]=R[N++]))}else{N=s-F;do O[s++]=O[N++],O[s++]=O[N++],O[s++]=O[N++],A-=3;while(A>2);A&&(O[s++]=O[N++],A>1&&(O[s++]=O[N++]))}}else if((b&64)===0){S=_[(S&65535)+(d&(1<<b)-1)];continue i}else{e.msg="invalid distance code",L.mode=Rp;break e}break}}else if((b&64)===0){S=m[(S&65535)+(d&(1<<b)-1)];continue t}else if(b&32){L.mode=Eq;break e}else{e.msg="invalid literal/length code",L.mode=Rp;break e}break}}while(n<r&&s<a);A=g>>3,n-=A,g-=A<<3,d&=(1<<g)-1,e.next_in=n,e.next_out=s,e.avail_in=n<r?5+(r-n):5-(n-r),e.avail_out=s<a?257+(a-s):257-(s-a),L.hold=d,L.bits=g};const Mh=15,a2=852,l2=592,c2=0,j_=1,h2=2,Tq=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Lq=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Cq=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Aq=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),Pq=(i,e,t,n,r,s,o,a)=>{const l=a.bits;let c=0,h=0,u=0,f=0,d=0,g=0,m=0,_=0,v=0,x=0,S,b,A,F,N,R=null,P;const O=new Uint16Array(Mh+1),L=new Uint16Array(Mh+1);let T=null,C,D,W;for(c=0;c<=Mh;c++)O[c]=0;for(h=0;h<n;h++)O[e[t+h]]++;for(d=l,f=Mh;f>=1&&O[f]===0;f--);if(d>f&&(d=f),f===0)return r[s++]=1<<24|64<<16|0,r[s++]=1<<24|64<<16|0,a.bits=1,0;for(u=1;u<f&&O[u]===0;u++);for(d<u&&(d=u),_=1,c=1;c<=Mh;c++)if(_<<=1,_-=O[c],_<0)return-1;if(_>0&&(i===c2||f!==1))return-1;for(L[1]=0,c=1;c<Mh;c++)L[c+1]=L[c]+O[c];for(h=0;h<n;h++)e[t+h]!==0&&(o[L[e[t+h]]++]=h);if(i===c2?(R=T=o,P=20):i===j_?(R=Tq,T=Lq,P=257):(R=Cq,T=Aq,P=0),x=0,h=0,c=u,N=s,g=d,m=0,A=-1,v=1<<d,F=v-1,i===j_&&v>a2||i===h2&&v>l2)return 1;for(;;){C=c-m,o[h]+1<P?(D=0,W=o[h]):o[h]>=P?(D=T[o[h]-P],W=R[o[h]-P]):(D=96,W=0),S=1<<c-m,b=1<<g,u=b;do b-=S,r[N+(x>>m)+b]=C<<24|D<<16|W|0;while(b!==0);for(S=1<<c-1;x&S;)S>>=1;if(S!==0?(x&=S-1,x+=S):x=0,h++,--O[c]===0){if(c===f)break;c=e[t+o[h]]}if(c>d&&(x&F)!==A){for(m===0&&(m=d),N+=u,g=c-m,_=1<<g;g+m<f&&(_-=O[g+m],!(_<=0));)g++,_<<=1;if(v+=1<<g,i===j_&&v>a2||i===h2&&v>l2)return 1;A=x&F,r[A]=d<<24|g<<16|N-s|0}}return x!==0&&(r[N+x]=c-m<<24|64<<16|0),a.bits=d,0};var hd=Pq;const Mq=0,CP=1,AP=2,{Z_FINISH:u2,Z_BLOCK:Rq,Z_TREES:Ip,Z_OK:Uc,Z_STREAM_END:Iq,Z_NEED_DICT:Nq,Z_STREAM_ERROR:Fs,Z_DATA_ERROR:PP,Z_MEM_ERROR:MP,Z_BUF_ERROR:Fq,Z_DEFLATED:f2}=SP,Zm=16180,d2=16181,g2=16182,p2=16183,m2=16184,_2=16185,y2=16186,v2=16187,x2=16188,w2=16189,im=16190,wa=16191,U_=16192,b2=16193,z_=16194,E2=16195,S2=16196,T2=16197,L2=16198,Np=16199,Fp=16200,C2=16201,A2=16202,P2=16203,M2=16204,R2=16205,q_=16206,I2=16207,N2=16208,Yi=16209,RP=16210,IP=16211,Oq=852,Dq=592,kq=15,Gq=kq,F2=i=>(i>>>24&255)+(i>>>8&65280)+((i&65280)<<8)+((i&255)<<24);function Bq(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Jc=i=>{if(!i)return 1;const e=i.state;return!e||e.strm!==i||e.mode<Zm||e.mode>IP?1:0},NP=i=>{if(Jc(i))return Fs;const e=i.state;return i.total_in=i.total_out=e.total=0,i.msg="",e.wrap&&(i.adler=e.wrap&1),e.mode=Zm,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(Oq),e.distcode=e.distdyn=new Int32Array(Dq),e.sane=1,e.back=-1,Uc},FP=i=>{if(Jc(i))return Fs;const e=i.state;return e.wsize=0,e.whave=0,e.wnext=0,NP(i)},OP=(i,e)=>{let t;if(Jc(i))return Fs;const n=i.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?Fs:(n.window!==null&&n.wbits!==e&&(n.window=null),n.wrap=t,n.wbits=e,FP(i))},DP=(i,e)=>{if(!i)return Fs;const t=new Bq;i.state=t,t.strm=i,t.window=null,t.mode=Zm;const n=OP(i,e);return n!==Uc&&(i.state=null),n},jq=i=>DP(i,Gq);let O2=!0,V_,$_;const Uq=i=>{if(O2){V_=new Int32Array(512),$_=new Int32Array(32);let e=0;for(;e<144;)i.lens[e++]=8;for(;e<256;)i.lens[e++]=9;for(;e<280;)i.lens[e++]=7;for(;e<288;)i.lens[e++]=8;for(hd(CP,i.lens,0,288,V_,0,i.work,{bits:9}),e=0;e<32;)i.lens[e++]=5;hd(AP,i.lens,0,32,$_,0,i.work,{bits:5}),O2=!1}i.lencode=V_,i.lenbits=9,i.distcode=$_,i.distbits=5},kP=(i,e,t,n)=>{let r;const s=i.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),n>=s.wsize?(s.window.set(e.subarray(t-s.wsize,t),0),s.wnext=0,s.whave=s.wsize):(r=s.wsize-s.wnext,r>n&&(r=n),s.window.set(e.subarray(t-n,t-n+r),s.wnext),n-=r,n?(s.window.set(e.subarray(t-n,t),0),s.wnext=n,s.whave=s.wsize):(s.wnext+=r,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=r))),0},zq=(i,e)=>{let t,n,r,s,o,a,l,c,h,u,f,d,g,m,_=0,v,x,S,b,A,F,N,R;const P=new Uint8Array(4);let O,L;const T=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Jc(i)||!i.output||!i.input&&i.avail_in!==0)return Fs;t=i.state,t.mode===wa&&(t.mode=U_),o=i.next_out,r=i.output,l=i.avail_out,s=i.next_in,n=i.input,a=i.avail_in,c=t.hold,h=t.bits,u=a,f=l,R=Uc;e:for(;;)switch(t.mode){case Zm:if(t.wrap===0){t.mode=U_;break}for(;h<16;){if(a===0)break e;a--,c+=n[s++]<<h,h+=8}if(t.wrap&2&&c===35615){t.wbits===0&&(t.wbits=15),t.check=0,P[0]=c&255,P[1]=c>>>8&255,t.check=Lo(t.check,P,2,0),c=0,h=0,t.mode=d2;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((c&255)<<8)+(c>>8))%31){i.msg="incorrect header check",t.mode=Yi;break}if((c&15)!==f2){i.msg="unknown compression method",t.mode=Yi;break}if(c>>>=4,h-=4,N=(c&15)+8,t.wbits===0&&(t.wbits=N),N>15||N>t.wbits){i.msg="invalid window size",t.mode=Yi;break}t.dmax=1<<t.wbits,t.flags=0,i.adler=t.check=1,t.mode=c&512?w2:wa,c=0,h=0;break;case d2:for(;h<16;){if(a===0)break e;a--,c+=n[s++]<<h,h+=8}if(t.flags=c,(t.flags&255)!==f2){i.msg="unknown compression method",t.mode=Yi;break}if(t.flags&57344){i.msg="unknown header flags set",t.mode=Yi;break}t.head&&(t.head.text=c>>8&1),t.flags&512&&t.wrap&4&&(P[0]=c&255,P[1]=c>>>8&255,t.check=Lo(t.check,P,2,0)),c=0,h=0,t.mode=g2;case g2:for(;h<32;){if(a===0)break e;a--,c+=n[s++]<<h,h+=8}t.head&&(t.head.time=c),t.flags&512&&t.wrap&4&&(P[0]=c&255,P[1]=c>>>8&255,P[2]=c>>>16&255,P[3]=c>>>24&255,t.check=Lo(t.check,P,4,0)),c=0,h=0,t.mode=p2;case p2:for(;h<16;){if(a===0)break e;a--,c+=n[s++]<<h,h+=8}t.head&&(t.head.xflags=c&255,t.head.os=c>>8),t.flags&512&&t.wrap&4&&(P[0]=c&255,P[1]=c>>>8&255,t.check=Lo(t.check,P,2,0)),c=0,h=0,t.mode=m2;case m2:if(t.flags&1024){for(;h<16;){if(a===0)break e;a--,c+=n[s++]<<h,h+=8}t.length=c,t.head&&(t.head.extra_len=c),t.flags&512&&t.wrap&4&&(P[0]=c&255,P[1]=c>>>8&255,t.check=Lo(t.check,P,2,0)),c=0,h=0}else t.head&&(t.head.extra=null);t.mode=_2;case _2:if(t.flags&1024&&(d=t.length,d>a&&(d=a),d&&(t.head&&(N=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(n.subarray(s,s+d),N)),t.flags&512&&t.wrap&4&&(t.check=Lo(t.check,n,d,s)),a-=d,s+=d,t.length-=d),t.length))break e;t.length=0,t.mode=y2;case y2:if(t.flags&2048){if(a===0)break e;d=0;do N=n[s+d++],t.head&&N&&t.length<65536&&(t.head.name+=String.fromCharCode(N));while(N&&d<a);if(t.flags&512&&t.wrap&4&&(t.check=Lo(t.check,n,d,s)),a-=d,s+=d,N)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=v2;case v2:if(t.flags&4096){if(a===0)break e;d=0;do N=n[s+d++],t.head&&N&&t.length<65536&&(t.head.comment+=String.fromCharCode(N));while(N&&d<a);if(t.flags&512&&t.wrap&4&&(t.check=Lo(t.check,n,d,s)),a-=d,s+=d,N)break e}else t.head&&(t.head.comment=null);t.mode=x2;case x2:if(t.flags&512){for(;h<16;){if(a===0)break e;a--,c+=n[s++]<<h,h+=8}if(t.wrap&4&&c!==(t.check&65535)){i.msg="header crc mismatch",t.mode=Yi;break}c=0,h=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),i.adler=t.check=0,t.mode=wa;break;case w2:for(;h<32;){if(a===0)break e;a--,c+=n[s++]<<h,h+=8}i.adler=t.check=F2(c),c=0,h=0,t.mode=im;case im:if(t.havedict===0)return i.next_out=o,i.avail_out=l,i.next_in=s,i.avail_in=a,t.hold=c,t.bits=h,Nq;i.adler=t.check=1,t.mode=wa;case wa:if(e===Rq||e===Ip)break e;case U_:if(t.last){c>>>=h&7,h-=h&7,t.mode=q_;break}for(;h<3;){if(a===0)break e;a--,c+=n[s++]<<h,h+=8}switch(t.last=c&1,c>>>=1,h-=1,c&3){case 0:t.mode=b2;break;case 1:if(Uq(t),t.mode=Np,e===Ip){c>>>=2,h-=2;break e}break;case 2:t.mode=S2;break;case 3:i.msg="invalid block type",t.mode=Yi}c>>>=2,h-=2;break;case b2:for(c>>>=h&7,h-=h&7;h<32;){if(a===0)break e;a--,c+=n[s++]<<h,h+=8}if((c&65535)!==(c>>>16^65535)){i.msg="invalid stored block lengths",t.mode=Yi;break}if(t.length=c&65535,c=0,h=0,t.mode=z_,e===Ip)break e;case z_:t.mode=E2;case E2:if(d=t.length,d){if(d>a&&(d=a),d>l&&(d=l),d===0)break e;r.set(n.subarray(s,s+d),o),a-=d,s+=d,l-=d,o+=d,t.length-=d;break}t.mode=wa;break;case S2:for(;h<14;){if(a===0)break e;a--,c+=n[s++]<<h,h+=8}if(t.nlen=(c&31)+257,c>>>=5,h-=5,t.ndist=(c&31)+1,c>>>=5,h-=5,t.ncode=(c&15)+4,c>>>=4,h-=4,t.nlen>286||t.ndist>30){i.msg="too many length or distance symbols",t.mode=Yi;break}t.have=0,t.mode=T2;case T2:for(;t.have<t.ncode;){for(;h<3;){if(a===0)break e;a--,c+=n[s++]<<h,h+=8}t.lens[T[t.have++]]=c&7,c>>>=3,h-=3}for(;t.have<19;)t.lens[T[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,O={bits:t.lenbits},R=hd(Mq,t.lens,0,19,t.lencode,0,t.work,O),t.lenbits=O.bits,R){i.msg="invalid code lengths set",t.mode=Yi;break}t.have=0,t.mode=L2;case L2:for(;t.have<t.nlen+t.ndist;){for(;_=t.lencode[c&(1<<t.lenbits)-1],v=_>>>24,x=_>>>16&255,S=_&65535,!(v<=h);){if(a===0)break e;a--,c+=n[s++]<<h,h+=8}if(S<16)c>>>=v,h-=v,t.lens[t.have++]=S;else{if(S===16){for(L=v+2;h<L;){if(a===0)break e;a--,c+=n[s++]<<h,h+=8}if(c>>>=v,h-=v,t.have===0){i.msg="invalid bit length repeat",t.mode=Yi;break}N=t.lens[t.have-1],d=3+(c&3),c>>>=2,h-=2}else if(S===17){for(L=v+3;h<L;){if(a===0)break e;a--,c+=n[s++]<<h,h+=8}c>>>=v,h-=v,N=0,d=3+(c&7),c>>>=3,h-=3}else{for(L=v+7;h<L;){if(a===0)break e;a--,c+=n[s++]<<h,h+=8}c>>>=v,h-=v,N=0,d=11+(c&127),c>>>=7,h-=7}if(t.have+d>t.nlen+t.ndist){i.msg="invalid bit length repeat",t.mode=Yi;break}for(;d--;)t.lens[t.have++]=N}}if(t.mode===Yi)break;if(t.lens[256]===0){i.msg="invalid code -- missing end-of-block",t.mode=Yi;break}if(t.lenbits=9,O={bits:t.lenbits},R=hd(CP,t.lens,0,t.nlen,t.lencode,0,t.work,O),t.lenbits=O.bits,R){i.msg="invalid literal/lengths set",t.mode=Yi;break}if(t.distbits=6,t.distcode=t.distdyn,O={bits:t.distbits},R=hd(AP,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,O),t.distbits=O.bits,R){i.msg="invalid distances set",t.mode=Yi;break}if(t.mode=Np,e===Ip)break e;case Np:t.mode=Fp;case Fp:if(a>=6&&l>=258){i.next_out=o,i.avail_out=l,i.next_in=s,i.avail_in=a,t.hold=c,t.bits=h,Sq(i,f),o=i.next_out,r=i.output,l=i.avail_out,s=i.next_in,n=i.input,a=i.avail_in,c=t.hold,h=t.bits,t.mode===wa&&(t.back=-1);break}for(t.back=0;_=t.lencode[c&(1<<t.lenbits)-1],v=_>>>24,x=_>>>16&255,S=_&65535,!(v<=h);){if(a===0)break e;a--,c+=n[s++]<<h,h+=8}if(x&&(x&240)===0){for(b=v,A=x,F=S;_=t.lencode[F+((c&(1<<b+A)-1)>>b)],v=_>>>24,x=_>>>16&255,S=_&65535,!(b+v<=h);){if(a===0)break e;a--,c+=n[s++]<<h,h+=8}c>>>=b,h-=b,t.back+=b}if(c>>>=v,h-=v,t.back+=v,t.length=S,x===0){t.mode=R2;break}if(x&32){t.back=-1,t.mode=wa;break}if(x&64){i.msg="invalid literal/length code",t.mode=Yi;break}t.extra=x&15,t.mode=C2;case C2:if(t.extra){for(L=t.extra;h<L;){if(a===0)break e;a--,c+=n[s++]<<h,h+=8}t.length+=c&(1<<t.extra)-1,c>>>=t.extra,h-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=A2;case A2:for(;_=t.distcode[c&(1<<t.distbits)-1],v=_>>>24,x=_>>>16&255,S=_&65535,!(v<=h);){if(a===0)break e;a--,c+=n[s++]<<h,h+=8}if((x&240)===0){for(b=v,A=x,F=S;_=t.distcode[F+((c&(1<<b+A)-1)>>b)],v=_>>>24,x=_>>>16&255,S=_&65535,!(b+v<=h);){if(a===0)break e;a--,c+=n[s++]<<h,h+=8}c>>>=b,h-=b,t.back+=b}if(c>>>=v,h-=v,t.back+=v,x&64){i.msg="invalid distance code",t.mode=Yi;break}t.offset=S,t.extra=x&15,t.mode=P2;case P2:if(t.extra){for(L=t.extra;h<L;){if(a===0)break e;a--,c+=n[s++]<<h,h+=8}t.offset+=c&(1<<t.extra)-1,c>>>=t.extra,h-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){i.msg="invalid distance too far back",t.mode=Yi;break}t.mode=M2;case M2:if(l===0)break e;if(d=f-l,t.offset>d){if(d=t.offset-d,d>t.whave&&t.sane){i.msg="invalid distance too far back",t.mode=Yi;break}d>t.wnext?(d-=t.wnext,g=t.wsize-d):g=t.wnext-d,d>t.length&&(d=t.length),m=t.window}else m=r,g=o-t.offset,d=t.length;d>l&&(d=l),l-=d,t.length-=d;do r[o++]=m[g++];while(--d);t.length===0&&(t.mode=Fp);break;case R2:if(l===0)break e;r[o++]=t.length,l--,t.mode=Fp;break;case q_:if(t.wrap){for(;h<32;){if(a===0)break e;a--,c|=n[s++]<<h,h+=8}if(f-=l,i.total_out+=f,t.total+=f,t.wrap&4&&f&&(i.adler=t.check=t.flags?Lo(t.check,r,f,o-f):cv(t.check,r,f,o-f)),f=l,t.wrap&4&&(t.flags?c:F2(c))!==t.check){i.msg="incorrect data check",t.mode=Yi;break}c=0,h=0}t.mode=I2;case I2:if(t.wrap&&t.flags){for(;h<32;){if(a===0)break e;a--,c+=n[s++]<<h,h+=8}if(t.wrap&4&&c!==(t.total&4294967295)){i.msg="incorrect length check",t.mode=Yi;break}c=0,h=0}t.mode=N2;case N2:R=Iq;break e;case Yi:R=PP;break e;case RP:return MP;case IP:default:return Fs}return i.next_out=o,i.avail_out=l,i.next_in=s,i.avail_in=a,t.hold=c,t.bits=h,(t.wsize||f!==i.avail_out&&t.mode<Yi&&(t.mode<q_||e!==u2))&&kP(i,i.output,i.next_out,f-i.avail_out),u-=i.avail_in,f-=i.avail_out,i.total_in+=u,i.total_out+=f,t.total+=f,t.wrap&4&&f&&(i.adler=t.check=t.flags?Lo(t.check,r,f,i.next_out-f):cv(t.check,r,f,i.next_out-f)),i.data_type=t.bits+(t.last?64:0)+(t.mode===wa?128:0)+(t.mode===Np||t.mode===z_?256:0),(u===0&&f===0||e===u2)&&R===Uc&&(R=Fq),R},qq=i=>{if(Jc(i))return Fs;let e=i.state;return e.window&&(e.window=null),i.state=null,Uc},Vq=(i,e)=>{if(Jc(i))return Fs;const t=i.state;return(t.wrap&2)===0?Fs:(t.head=e,e.done=!1,Uc)},$q=(i,e)=>{const t=e.length;let n,r,s;return Jc(i)||(n=i.state,n.wrap!==0&&n.mode!==im)?Fs:n.mode===im&&(r=1,r=cv(r,e,t,0),r!==n.check)?PP:(s=kP(i,e,t,t),s?(n.mode=RP,MP):(n.havedict=1,Uc))};var Wq=FP,Hq=OP,Xq=NP,Kq=jq,Yq=DP,Zq=zq,Jq=qq,Qq=Vq,eV=$q,tV="pako inflate (from Nodeca project)",Pa={inflateReset:Wq,inflateReset2:Hq,inflateResetKeep:Xq,inflateInit:Kq,inflateInit2:Yq,inflate:Zq,inflateEnd:Jq,inflateGetHeader:Qq,inflateSetDictionary:eV,inflateInfo:tV};function iV(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var nV=iV;const GP=Object.prototype.toString,{Z_NO_FLUSH:rV,Z_FINISH:sV,Z_OK:Vd,Z_STREAM_END:W_,Z_NEED_DICT:H_,Z_STREAM_ERROR:oV,Z_DATA_ERROR:D2,Z_MEM_ERROR:aV}=SP;function fg(i){this.options=TP.assign({chunkSize:1024*64,windowBits:15,to:""},i||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(i&&i.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new bq,this.strm.avail_out=0;let t=Pa.inflateInit2(this.strm,e.windowBits);if(t!==Vd)throw new Error(hv[t]);if(this.header=new nV,Pa.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=uv.string2buf(e.dictionary):GP.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=Pa.inflateSetDictionary(this.strm,e.dictionary),t!==Vd)))throw new Error(hv[t])}fg.prototype.push=function(i,e){const t=this.strm,n=this.options.chunkSize,r=this.options.dictionary;let s,o,a;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?sV:rV,GP.call(i)==="[object ArrayBuffer]"?t.input=new Uint8Array(i):t.input=i,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(n),t.next_out=0,t.avail_out=n),s=Pa.inflate(t,o),s===H_&&r&&(s=Pa.inflateSetDictionary(t,r),s===Vd?s=Pa.inflate(t,o):s===D2&&(s=H_));t.avail_in>0&&s===W_&&t.state.wrap>0&&i[t.next_in]!==0;)Pa.inflateReset(t),s=Pa.inflate(t,o);switch(s){case oV:case D2:case H_:case aV:return this.onEnd(s),this.ended=!0,!1}if(a=t.avail_out,t.next_out&&(t.avail_out===0||s===W_))if(this.options.to==="string"){let l=uv.utf8border(t.output,t.next_out),c=t.next_out-l,h=uv.buf2string(t.output,l);t.next_out=c,t.avail_out=n-c,c&&t.output.set(t.output.subarray(l,l+c),0),this.onData(h)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(s===Vd&&a===0)){if(s===W_)return s=Pa.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};fg.prototype.onData=function(i){this.chunks.push(i)};fg.prototype.onEnd=function(i){i===Vd&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=TP.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function lV(i,e){const t=new fg(e);if(t.push(i),t.err)throw t.msg||hv[t.err];return t.result}var cV=fg,hV=lV,uV={Inflate:cV,inflate:hV};const{Inflate:fV,inflate:dV}=uV;var k2=fV,gV=dV;const BP=[];for(let i=0;i<256;i++){let e=i;for(let t=0;t<8;t++)e&1?e=3988292384^e>>>1:e=e>>>1;BP[i]=e}const G2=4294967295;function pV(i,e,t){let n=i;for(let r=0;r<t;r++)n=BP[(n^e[r])&255]^n>>>8;return n}function mV(i,e){return(pV(G2,i,e)^G2)>>>0}function B2(i,e,t){const n=i.readUint32(),r=mV(new Uint8Array(i.buffer,i.byteOffset+i.offset-e-4,e),e);if(r!==n)throw new Error(`CRC mismatch for chunk ${t}. Expected ${n}, found ${r}`)}function jP(i,e,t){for(let n=0;n<t;n++)e[n]=i[n]}function UP(i,e,t,n){let r=0;for(;r<n;r++)e[r]=i[r];for(;r<t;r++)e[r]=i[r]+e[r-n]&255}function zP(i,e,t,n){let r=0;if(t.length===0)for(;r<n;r++)e[r]=i[r];else for(;r<n;r++)e[r]=i[r]+t[r]&255}function qP(i,e,t,n,r){let s=0;if(t.length===0){for(;s<r;s++)e[s]=i[s];for(;s<n;s++)e[s]=i[s]+(e[s-r]>>1)&255}else{for(;s<r;s++)e[s]=i[s]+(t[s]>>1)&255;for(;s<n;s++)e[s]=i[s]+(e[s-r]+t[s]>>1)&255}}function VP(i,e,t,n,r){let s=0;if(t.length===0){for(;s<r;s++)e[s]=i[s];for(;s<n;s++)e[s]=i[s]+e[s-r]&255}else{for(;s<r;s++)e[s]=i[s]+t[s]&255;for(;s<n;s++)e[s]=i[s]+_V(e[s-r],t[s],t[s-r])&255}}function _V(i,e,t){const n=i+e-t,r=Math.abs(n-i),s=Math.abs(n-e),o=Math.abs(n-t);return r<=s&&r<=o?i:s<=o?e:t}function yV(i,e,t,n,r,s){switch(i){case 0:jP(e,t,r);break;case 1:UP(e,t,r,s);break;case 2:zP(e,t,n,r);break;case 3:qP(e,t,n,r,s);break;case 4:VP(e,t,n,r,s);break;default:throw new Error(`Unsupported filter: ${i}`)}}const vV=new Uint16Array([255]),xV=new Uint8Array(vV.buffer),wV=xV[0]===255;function bV(i){const{data:e,width:t,height:n,channels:r,depth:s}=i,o=[{x:0,y:0,xStep:8,yStep:8},{x:4,y:0,xStep:8,yStep:8},{x:0,y:4,xStep:4,yStep:8},{x:2,y:0,xStep:4,yStep:4},{x:0,y:2,xStep:2,yStep:4},{x:1,y:0,xStep:2,yStep:2},{x:0,y:1,xStep:1,yStep:2}],a=Math.ceil(s/8)*r,l=new Uint8Array(n*t*a);let c=0;for(let h=0;h<7;h++){const u=o[h],f=Math.ceil((t-u.x)/u.xStep),d=Math.ceil((n-u.y)/u.yStep);if(f<=0||d<=0)continue;const g=f*a,m=new Uint8Array(g);for(let _=0;_<d;_++){const v=e[c++],x=e.subarray(c,c+g);c+=g;const S=new Uint8Array(g);yV(v,x,S,m,g,a),m.set(S);for(let b=0;b<f;b++){const A=u.x+b*u.xStep,F=u.y+_*u.yStep;if(!(A>=t||F>=n))for(let N=0;N<a;N++)l[(F*t+A)*a+N]=S[b*a+N]}}}if(s===16){const h=new Uint16Array(l.buffer);if(wV)for(let u=0;u<h.length;u++)h[u]=EV(h[u]);return h}else return l}function EV(i){return(i&255)<<8|i>>8&255}const SV=new Uint16Array([255]),TV=new Uint8Array(SV.buffer),LV=TV[0]===255,CV=new Uint8Array(0);function j2(i){const{data:e,width:t,height:n,channels:r,depth:s}=i,o=Math.ceil(s/8)*r,a=Math.ceil(s/8*r*t),l=new Uint8Array(n*a);let c=CV,h=0,u,f;for(let d=0;d<n;d++){switch(u=e.subarray(h+1,h+1+a),f=l.subarray(d*a,(d+1)*a),e[h]){case 0:jP(u,f,a);break;case 1:UP(u,f,a,o);break;case 2:zP(u,f,c,a);break;case 3:qP(u,f,c,a,o);break;case 4:VP(u,f,c,a,o);break;default:throw new Error(`Unsupported filter: ${e[h]}`)}c=f,h+=a+1}if(s===16){const d=new Uint16Array(l.buffer);if(LV)for(let g=0;g<d.length;g++)d[g]=AV(d[g]);return d}else return l}function AV(i){return(i&255)<<8|i>>8&255}const Qp=Uint8Array.of(137,80,78,71,13,10,26,10);function U2(i){if(!PV(i.readBytes(Qp.length)))throw new Error("wrong PNG signature")}function PV(i){if(i.length<Qp.length)return!1;for(let e=0;e<Qp.length;e++)if(i[e]!==Qp[e])return!1;return!0}const MV="tEXt",RV=0,$P=new TextDecoder("latin1");function IV(i){if(FV(i),i.length===0||i.length>79)throw new Error("keyword length must be between 1 and 79")}const NV=/^[\u0000-\u00FF]*$/;function FV(i){if(!NV.test(i))throw new Error("invalid latin1 text")}function OV(i,e,t){const n=WP(e);i[n]=DV(e,t-n.length-1)}function WP(i){for(i.mark();i.readByte()!==RV;);const e=i.offset;i.reset();const t=$P.decode(i.readBytes(e-i.offset-1));return i.skip(1),IV(t),t}function DV(i,e){return $P.decode(i.readBytes(e))}const cs={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},X_={UNKNOWN:-1,DEFLATE:0},z2={UNKNOWN:-1,ADAPTIVE:0},K_={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},Op={NONE:0,BACKGROUND:1,PREVIOUS:2},Y_={SOURCE:0,OVER:1};class kV extends T5{_checkCrc;_inflator;_png;_apng;_end;_hasPalette;_palette;_hasTransparency;_transparency;_compressionMethod;_filterMethod;_interlaceMethod;_colorType;_isAnimated;_numberOfFrames;_numberOfPlays;_frames;_writingDataChunks;constructor(e,t={}){super(e);const{checkCrc:n=!1}=t;this._checkCrc=n,this._inflator=new k2,this._png={width:-1,height:-1,channels:-1,data:new Uint8Array(0),depth:1,text:{}},this._apng={width:-1,height:-1,channels:-1,depth:1,numberOfFrames:1,numberOfPlays:0,text:{},frames:[]},this._end=!1,this._hasPalette=!1,this._palette=[],this._hasTransparency=!1,this._transparency=new Uint16Array(0),this._compressionMethod=X_.UNKNOWN,this._filterMethod=z2.UNKNOWN,this._interlaceMethod=K_.UNKNOWN,this._colorType=cs.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this.setBigEndian()}decode(){for(U2(this);!this._end;){const e=this.readUint32(),t=this.readChars(4);this.decodeChunk(e,t)}return this.decodeImage(),this._png}decodeApng(){for(U2(this);!this._end;){const e=this.readUint32(),t=this.readChars(4);this.decodeApngChunk(e,t)}return this.decodeApngImage(),this._apng}decodeChunk(e,t){const n=this.offset;switch(t){case"IHDR":this.decodeIHDR();break;case"PLTE":this.decodePLTE(e);break;case"IDAT":this.decodeIDAT(e);break;case"IEND":this._end=!0;break;case"tRNS":this.decodetRNS(e);break;case"iCCP":this.decodeiCCP(e);break;case MV:OV(this._png.text,this,e);break;case"pHYs":this.decodepHYs();break;default:this.skip(e);break}if(this.offset-n!==e)throw new Error(`Length mismatch while decoding chunk ${t}`);this._checkCrc?B2(this,e+4,t):this.skip(4)}decodeApngChunk(e,t){const n=this.offset;switch(t!=="fdAT"&&t!=="IDAT"&&this._writingDataChunks&&this.pushDataToFrame(),t){case"acTL":this.decodeACTL();break;case"fcTL":this.decodeFCTL();break;case"fdAT":this.decodeFDAT(e);break;default:this.decodeChunk(e,t),this.offset=n+e;break}if(this.offset-n!==e)throw new Error(`Length mismatch while decoding chunk ${t}`);this._checkCrc?B2(this,e+4,t):this.skip(4)}decodeIHDR(){const e=this._png;e.width=this.readUint32(),e.height=this.readUint32(),e.depth=GV(this.readUint8());const t=this.readUint8();this._colorType=t;let n;switch(t){case cs.GREYSCALE:n=1;break;case cs.TRUECOLOUR:n=3;break;case cs.INDEXED_COLOUR:n=1;break;case cs.GREYSCALE_ALPHA:n=2;break;case cs.TRUECOLOUR_ALPHA:n=4;break;case cs.UNKNOWN:default:throw new Error(`Unknown color type: ${t}`)}if(this._png.channels=n,this._compressionMethod=this.readUint8(),this._compressionMethod!==X_.DEFLATE)throw new Error(`Unsupported compression method: ${this._compressionMethod}`);this._filterMethod=this.readUint8(),this._interlaceMethod=this.readUint8()}decodeACTL(){this._numberOfFrames=this.readUint32(),this._numberOfPlays=this.readUint32(),this._isAnimated=!0}decodeFCTL(){const e={sequenceNumber:this.readUint32(),width:this.readUint32(),height:this.readUint32(),xOffset:this.readUint32(),yOffset:this.readUint32(),delayNumber:this.readUint16(),delayDenominator:this.readUint16(),disposeOp:this.readUint8(),blendOp:this.readUint8(),data:new Uint8Array(0)};this._frames.push(e)}decodePLTE(e){if(e%3!==0)throw new RangeError(`PLTE field length must be a multiple of 3. Got ${e}`);const t=e/3;this._hasPalette=!0;const n=[];this._palette=n;for(let r=0;r<t;r++)n.push([this.readUint8(),this.readUint8(),this.readUint8()])}decodeIDAT(e){this._writingDataChunks=!0;const t=e,n=this.offset+this.byteOffset;if(this._inflator.push(new Uint8Array(this.buffer,n,t)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(e)}decodeFDAT(e){this._writingDataChunks=!0;let t=e,n=this.offset+this.byteOffset;if(n+=4,t-=4,this._inflator.push(new Uint8Array(this.buffer,n,t)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(e)}decodetRNS(e){switch(this._colorType){case cs.GREYSCALE:case cs.TRUECOLOUR:{if(e%2!==0)throw new RangeError(`tRNS chunk length must be a multiple of 2. Got ${e}`);if(e/2>this._png.width*this._png.height)throw new Error(`tRNS chunk contains more alpha values than there are pixels (${e/2} vs ${this._png.width*this._png.height})`);this._hasTransparency=!0,this._transparency=new Uint16Array(e/2);for(let t=0;t<e/2;t++)this._transparency[t]=this.readUint16();break}case cs.INDEXED_COLOUR:{if(e>this._palette.length)throw new Error(`tRNS chunk contains more alpha values than there are palette colors (${e} vs ${this._palette.length})`);let t=0;for(;t<e;t++){const n=this.readByte();this._palette[t].push(n)}for(;t<this._palette.length;t++)this._palette[t].push(255);break}case cs.UNKNOWN:case cs.GREYSCALE_ALPHA:case cs.TRUECOLOUR_ALPHA:default:throw new Error(`tRNS chunk is not supported for color type ${this._colorType}`)}}decodeiCCP(e){const t=WP(this),n=this.readUint8();if(n!==X_.DEFLATE)throw new Error(`Unsupported iCCP compression method: ${n}`);const r=this.readBytes(e-t.length-2);this._png.iccEmbeddedProfile={name:t,profile:gV(r)}}decodepHYs(){const e=this.readUint32(),t=this.readUint32(),n=this.readByte();this._png.resolution={x:e,y:t,unit:n}}decodeApngImage(){this._apng.width=this._png.width,this._apng.height=this._png.height,this._apng.channels=this._png.channels,this._apng.depth=this._png.depth,this._apng.numberOfFrames=this._numberOfFrames,this._apng.numberOfPlays=this._numberOfPlays,this._apng.text=this._png.text,this._apng.resolution=this._png.resolution;for(let e=0;e<this._numberOfFrames;e++){const t={sequenceNumber:this._frames[e].sequenceNumber,delayNumber:this._frames[e].delayNumber,delayDenominator:this._frames[e].delayDenominator,data:this._apng.depth===8?new Uint8Array(this._apng.width*this._apng.height*this._apng.channels):new Uint16Array(this._apng.width*this._apng.height*this._apng.channels)},n=this._frames.at(e);if(n){if(n.data=j2({data:n.data,width:n.width,height:n.height,channels:this._apng.channels,depth:this._apng.depth}),this._hasPalette&&(this._apng.palette=this._palette),this._hasTransparency&&(this._apng.transparency=this._transparency),e===0||n.xOffset===0&&n.yOffset===0&&n.width===this._png.width&&n.height===this._png.height)t.data=n.data;else{const r=this._apng.frames.at(e-1);this.disposeFrame(n,r,t),this.addFrameDataToCanvas(t,n)}this._apng.frames.push(t)}}return this._apng}disposeFrame(e,t,n){switch(e.disposeOp){case Op.NONE:break;case Op.BACKGROUND:for(let r=0;r<this._png.height;r++)for(let s=0;s<this._png.width;s++){const o=(r*e.width+s)*this._png.channels;for(let a=0;a<this._png.channels;a++)n.data[o+a]=0}break;case Op.PREVIOUS:n.data.set(t.data);break;default:throw new Error("Unknown disposeOp")}}addFrameDataToCanvas(e,t){const n=1<<this._png.depth,r=(s,o)=>{const a=((s+t.yOffset)*this._png.width+t.xOffset+o)*this._png.channels,l=(s*t.width+o)*this._png.channels;return{index:a,frameIndex:l}};switch(t.blendOp){case Y_.SOURCE:for(let s=0;s<t.height;s++)for(let o=0;o<t.width;o++){const{index:a,frameIndex:l}=r(s,o);for(let c=0;c<this._png.channels;c++)e.data[a+c]=t.data[l+c]}break;case Y_.OVER:for(let s=0;s<t.height;s++)for(let o=0;o<t.width;o++){const{index:a,frameIndex:l}=r(s,o);for(let c=0;c<this._png.channels;c++){const h=t.data[l+this._png.channels-1]/n,u=c%(this._png.channels-1)===0?1:t.data[l+c],f=Math.floor(h*u+(1-h)*e.data[a+c]);e.data[a+c]+=f}}break;default:throw new Error("Unknown blendOp")}}decodeImage(){if(this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);const e=this._isAnimated?(this._frames?.at(0)).data:this._inflator.result;if(this._filterMethod!==z2.ADAPTIVE)throw new Error(`Filter method ${this._filterMethod} not supported`);if(this._interlaceMethod===K_.NO_INTERLACE)this._png.data=j2({data:e,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else if(this._interlaceMethod===K_.ADAM7)this._png.data=bV({data:e,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else throw new Error(`Interlace method ${this._interlaceMethod} not supported`);this._hasPalette&&(this._png.palette=this._palette),this._hasTransparency&&(this._png.transparency=this._transparency)}pushDataToFrame(){const e=this._inflator.result,t=this._frames.at(-1);t?t.data=e:this._frames.push({sequenceNumber:0,width:this._png.width,height:this._png.height,xOffset:0,yOffset:0,delayNumber:0,delayDenominator:0,disposeOp:Op.NONE,blendOp:Y_.SOURCE,data:e}),this._inflator=new k2,this._writingDataChunks=!1}}function GV(i){if(i!==1&&i!==2&&i!==4&&i!==8&&i!==16)throw new Error(`invalid bit depth: ${i}`);return i}var q2;(function(i){i[i.UNKNOWN=0]="UNKNOWN",i[i.METRE=1]="METRE"})(q2||(q2={}));function BV(i,e){return new kV(i,e).decode()}var Et=(function(){return typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this})();function Z_(){Et.console&&typeof Et.console.log=="function"&&Et.console.log.apply(Et.console,arguments)}var Mi={log:Z_,warn:function(i){Et.console&&(typeof Et.console.warn=="function"?Et.console.warn.apply(Et.console,arguments):Z_.call(null,arguments))},error:function(i){Et.console&&(typeof Et.console.error=="function"?Et.console.error.apply(Et.console,arguments):Z_(i))}};function J_(i,e,t){var n=new XMLHttpRequest;n.open("GET",i),n.responseType="blob",n.onload=function(){xc(n.response,e,t)},n.onerror=function(){Mi.error("could not download file")},n.send()}function V2(i){var e=new XMLHttpRequest;e.open("HEAD",i,!1);try{e.send()}catch{}return e.status>=200&&e.status<=299}function Dp(i){try{i.dispatchEvent(new MouseEvent("click"))}catch{var e=document.createEvent("MouseEvents");e.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),i.dispatchEvent(e)}}var xc=Et.saveAs||((typeof window>"u"?"undefined":bi(window))!=="object"||window!==Et?function(){}:typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype?function(i,e,t){var n=Et.URL||Et.webkitURL,r=document.createElement("a");e=e||i.name||"download",r.download=e,r.rel="noopener",typeof i=="string"?(r.href=i,r.origin!==location.origin?V2(r.href)?J_(i,e,t):Dp(r,r.target="_blank"):Dp(r)):(r.href=n.createObjectURL(i),setTimeout(function(){n.revokeObjectURL(r.href)},4e4),setTimeout(function(){Dp(r)},0))}:"msSaveOrOpenBlob"in navigator?function(i,e,t){if(e=e||i.name||"download",typeof i=="string")if(V2(i))J_(i,e,t);else{var n=document.createElement("a");n.href=i,n.target="_blank",setTimeout(function(){Dp(n)})}else navigator.msSaveOrOpenBlob((function(r,s){return s===void 0?s={autoBom:!1}:bi(s)!=="object"&&(Mi.warn("Deprecated: Expected third argument to be a object"),s={autoBom:!s}),s.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(r.type)?new Blob(["\uFEFF",r],{type:r.type}):r})(i,t),e)}:function(i,e,t,n){if((n=n||open("","_blank"))&&(n.document.title=n.document.body.innerText="downloading..."),typeof i=="string")return J_(i,e,t);var r=i.type==="application/octet-stream",s=/constructor/i.test(Et.HTMLElement)||Et.safari,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||r&&s)&&(typeof FileReader>"u"?"undefined":bi(FileReader))==="object"){var a=new FileReader;a.onloadend=function(){var h=a.result;h=o?h:h.replace(/^data:[^;]*;/,"data:attachment/file;"),n?n.location.href=h:location=h,n=null},a.readAsDataURL(i)}else{var l=Et.URL||Et.webkitURL,c=l.createObjectURL(i);n?n.location=c:location.href=c,n=null,setTimeout(function(){l.revokeObjectURL(c)},4e4)}});function HP(i){var e;i=i||"",this.ok=!1,i.charAt(0)=="#"&&(i=i.substr(1,6)),i={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"}[i=(i=i.replace(/ /g,"")).toLowerCase()]||i;for(var t=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(a){return[parseInt(a[1]),parseInt(a[2]),parseInt(a[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(a){return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(a){return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)]}}],n=0;n<t.length;n++){var r=t[n].re,s=t[n].process,o=r.exec(i);o&&(e=s(o),this.r=e[0],this.g=e[1],this.b=e[2],this.ok=!0)}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toHex=function(){var a=this.r.toString(16),l=this.g.toString(16),c=this.b.toString(16);return a.length==1&&(a="0"+a),l.length==1&&(l="0"+l),c.length==1&&(c="0"+c),"#"+a+l+c}}var e0=Et.atob.bind(Et),$2=Et.btoa.bind(Et);function Q_(i,e){var t=i[0],n=i[1],r=i[2],s=i[3];t=gr(t,n,r,s,e[0],7,-680876936),s=gr(s,t,n,r,e[1],12,-389564586),r=gr(r,s,t,n,e[2],17,606105819),n=gr(n,r,s,t,e[3],22,-1044525330),t=gr(t,n,r,s,e[4],7,-176418897),s=gr(s,t,n,r,e[5],12,1200080426),r=gr(r,s,t,n,e[6],17,-1473231341),n=gr(n,r,s,t,e[7],22,-45705983),t=gr(t,n,r,s,e[8],7,1770035416),s=gr(s,t,n,r,e[9],12,-1958414417),r=gr(r,s,t,n,e[10],17,-42063),n=gr(n,r,s,t,e[11],22,-1990404162),t=gr(t,n,r,s,e[12],7,1804603682),s=gr(s,t,n,r,e[13],12,-40341101),r=gr(r,s,t,n,e[14],17,-1502002290),t=pr(t,n=gr(n,r,s,t,e[15],22,1236535329),r,s,e[1],5,-165796510),s=pr(s,t,n,r,e[6],9,-1069501632),r=pr(r,s,t,n,e[11],14,643717713),n=pr(n,r,s,t,e[0],20,-373897302),t=pr(t,n,r,s,e[5],5,-701558691),s=pr(s,t,n,r,e[10],9,38016083),r=pr(r,s,t,n,e[15],14,-660478335),n=pr(n,r,s,t,e[4],20,-405537848),t=pr(t,n,r,s,e[9],5,568446438),s=pr(s,t,n,r,e[14],9,-1019803690),r=pr(r,s,t,n,e[3],14,-187363961),n=pr(n,r,s,t,e[8],20,1163531501),t=pr(t,n,r,s,e[13],5,-1444681467),s=pr(s,t,n,r,e[2],9,-51403784),r=pr(r,s,t,n,e[7],14,1735328473),t=mr(t,n=pr(n,r,s,t,e[12],20,-1926607734),r,s,e[5],4,-378558),s=mr(s,t,n,r,e[8],11,-2022574463),r=mr(r,s,t,n,e[11],16,1839030562),n=mr(n,r,s,t,e[14],23,-35309556),t=mr(t,n,r,s,e[1],4,-1530992060),s=mr(s,t,n,r,e[4],11,1272893353),r=mr(r,s,t,n,e[7],16,-155497632),n=mr(n,r,s,t,e[10],23,-1094730640),t=mr(t,n,r,s,e[13],4,681279174),s=mr(s,t,n,r,e[0],11,-358537222),r=mr(r,s,t,n,e[3],16,-722521979),n=mr(n,r,s,t,e[6],23,76029189),t=mr(t,n,r,s,e[9],4,-640364487),s=mr(s,t,n,r,e[12],11,-421815835),r=mr(r,s,t,n,e[15],16,530742520),t=_r(t,n=mr(n,r,s,t,e[2],23,-995338651),r,s,e[0],6,-198630844),s=_r(s,t,n,r,e[7],10,1126891415),r=_r(r,s,t,n,e[14],15,-1416354905),n=_r(n,r,s,t,e[5],21,-57434055),t=_r(t,n,r,s,e[12],6,1700485571),s=_r(s,t,n,r,e[3],10,-1894986606),r=_r(r,s,t,n,e[10],15,-1051523),n=_r(n,r,s,t,e[1],21,-2054922799),t=_r(t,n,r,s,e[8],6,1873313359),s=_r(s,t,n,r,e[15],10,-30611744),r=_r(r,s,t,n,e[6],15,-1560198380),n=_r(n,r,s,t,e[13],21,1309151649),t=_r(t,n,r,s,e[4],6,-145523070),s=_r(s,t,n,r,e[11],10,-1120210379),r=_r(r,s,t,n,e[2],15,718787259),n=_r(n,r,s,t,e[9],21,-343485551),i[0]=Pl(t,i[0]),i[1]=Pl(n,i[1]),i[2]=Pl(r,i[2]),i[3]=Pl(s,i[3])}function Jm(i,e,t,n,r,s){return e=Pl(Pl(e,i),Pl(n,s)),Pl(e<<r|e>>>32-r,t)}function gr(i,e,t,n,r,s,o){return Jm(e&t|~e&n,i,e,r,s,o)}function pr(i,e,t,n,r,s,o){return Jm(e&n|t&~n,i,e,r,s,o)}function mr(i,e,t,n,r,s,o){return Jm(e^t^n,i,e,r,s,o)}function _r(i,e,t,n,r,s,o){return Jm(t^(e|~n),i,e,r,s,o)}function XP(i){var e,t=i.length,n=[1732584193,-271733879,-1732584194,271733878];for(e=64;e<=i.length;e+=64)Q_(n,jV(i.substring(e-64,e)));i=i.substring(e-64);var r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(e=0;e<i.length;e++)r[e>>2]|=i.charCodeAt(e)<<(e%4<<3);if(r[e>>2]|=128<<(e%4<<3),e>55)for(Q_(n,r),e=0;e<16;e++)r[e]=0;return r[14]=8*t,Q_(n,r),n}function jV(i){var e,t=[];for(e=0;e<64;e+=4)t[e>>2]=i.charCodeAt(e)+(i.charCodeAt(e+1)<<8)+(i.charCodeAt(e+2)<<16)+(i.charCodeAt(e+3)<<24);return t}var W2="0123456789abcdef".split("");function UV(i){for(var e="",t=0;t<4;t++)e+=W2[i>>8*t+4&15]+W2[i>>8*t&15];return e}function zV(i){return String.fromCharCode(255&i,(65280&i)>>8,(16711680&i)>>16,(4278190080&i)>>24)}function fv(i){return XP(i).map(zV).join("")}var qV=(function(i){for(var e=0;e<i.length;e++)i[e]=UV(i[e]);return i.join("")})(XP("hello"))!="5d41402abc4b2a76b9719d911017c592";function Pl(i,e){if(qV){var t=(65535&i)+(65535&e);return(i>>16)+(e>>16)+(t>>16)<<16|65535&t}return i+e&4294967295}function dv(i,e){var t,n,r,s;if(i!==t){for(var o=(r=i,s=1+(256/i.length|0),new Array(s+1).join(r)),a=[],l=0;l<256;l++)a[l]=l;var c=0;for(l=0;l<256;l++){var h=a[l];c=(c+h+o.charCodeAt(l))%256,a[l]=a[c],a[c]=h}t=i,n=a}else a=n;var u=e.length,f=0,d=0,g="";for(l=0;l<u;l++)d=(d+(h=a[f=(f+1)%256]))%256,a[f]=a[d],a[d]=h,o=a[(a[f]+a[d])%256],g+=String.fromCharCode(e.charCodeAt(l)^o);return g}var H2={print:4,modify:8,copy:16,"annot-forms":32};function Uh(i,e,t,n){this.v=1,this.r=2;var r=192;i.forEach(function(a){if(H2.perm!==void 0)throw new Error("Invalid permission: "+a);r+=H2[a]}),this.padding="(¿N^NuŠAd\0NVÿú\b..\0¶Ðh>€/\f©þdSiz";var s=(e+this.padding).substr(0,32),o=(t+this.padding).substr(0,32);this.O=this.processOwnerPassword(s,o),this.P=-(1+(255^r)),this.encryptionKey=fv(s+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(n)).substr(0,5),this.U=dv(this.encryptionKey,this.padding)}function zh(i){if(/[^\u0000-\u00ff]/.test(i))throw new Error("Invalid PDF Name Object: "+i+", Only accept ASCII characters.");for(var e="",t=i.length,n=0;n<t;n++){var r=i.charCodeAt(n);e+=r<33||r===35||r===37||r===40||r===41||r===47||r===60||r===62||r===91||r===93||r===123||r===125||r>126?"#"+("0"+r.toString(16)).slice(-2):i[n]}return e}function X2(i){if(bi(i)!=="object")throw new Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var e={};this.subscribe=function(t,n,r){if(r=r||!1,typeof t!="string"||typeof n!="function"||typeof r!="boolean")throw new Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");e.hasOwnProperty(t)||(e[t]={});var s=Math.random().toString(35);return e[t][s]=[n,!!r],s},this.unsubscribe=function(t){for(var n in e)if(e[n][t])return delete e[n][t],Object.keys(e[n]).length===0&&delete e[n],!0;return!1},this.publish=function(t){if(e.hasOwnProperty(t)){var n=Array.prototype.slice.call(arguments,1),r=[];for(var s in e[t]){var o=e[t][s];try{o[0].apply(i,n)}catch(a){Et.console&&Mi.error("jsPDF PubSub Error",a.message,a)}o[1]&&r.push(s)}r.length&&r.forEach(this.unsubscribe)}},this.getTopics=function(){return e}}function nm(i){if(!(this instanceof nm))return new nm(i);var e="opacity,stroke-opacity".split(",");for(var t in i)i.hasOwnProperty(t)&&e.indexOf(t)>=0&&(this[t]=i[t]);this.id="",this.objectNumber=-1}function KP(i,e){this.gState=i,this.matrix=e,this.id="",this.objectNumber=-1}function Ec(i,e,t,n,r){if(!(this instanceof Ec))return new Ec(i,e,t,n,r);this.type=i==="axial"?2:3,this.coords=e,this.colors=t,KP.call(this,n,r)}function Qh(i,e,t,n,r){if(!(this instanceof Qh))return new Qh(i,e,t,n,r);this.boundingBox=i,this.xStep=e,this.yStep=t,this.stream="",this.cloneIndex=0,KP.call(this,n,r)}function ct(i){var e,t=typeof arguments[0]=="string"?arguments[0]:"p",n=arguments[1],r=arguments[2],s=arguments[3],o=[],a=1,l=16,c="S",h=null;bi(i=i||{})==="object"&&(t=i.orientation,n=i.unit||n,r=i.format||r,s=i.compress||i.compressPdf||s,(h=i.encryption||null)!==null&&(h.userPassword=h.userPassword||"",h.ownerPassword=h.ownerPassword||"",h.userPermissions=h.userPermissions||[]),a=typeof i.userUnit=="number"?Math.abs(i.userUnit):1,i.precision!==void 0&&(e=i.precision),i.floatPrecision!==void 0&&(l=i.floatPrecision),c=i.defaultPathOperation||"S"),o=i.filters||(s===!0?["FlateEncode"]:o),n=n||"mm",t=(""+(t||"P")).toLowerCase();var u=i.putOnlyUsedFonts||!1,f={},d={internal:{},__private__:{}};d.__private__.PubSub=X2;var g="1.3",m=d.__private__.getPdfVersion=function(){return g};d.__private__.setPdfVersion=function(w){g=w};var _={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};d.__private__.getPageFormats=function(){return _};var v=d.__private__.getPageFormat=function(w){return _[w]};r=r||"a4";var x="compat",S="advanced",b=x;function A(){this.saveGraphicsState(),j(new tt(st,0,0,-st,0,tc()*st).toString()+" cm"),this.setFontSize(this.getFontSize()/st),c="n",b=S}function F(){this.restoreGraphicsState(),c="S",b=x}var N=d.__private__.combineFontStyleAndFontWeight=function(w,k){if(w=="bold"&&k=="normal"||w=="bold"&&k==400||w=="normal"&&k=="italic"||w=="bold"&&k=="italic")throw new Error("Invalid Combination of fontweight and fontstyle");return k&&(w=k==400||k==="normal"?w==="italic"?"italic":"normal":k!=700&&k!=="bold"||w!=="normal"?(k==700?"bold":k)+""+w:"bold"),w};d.advancedAPI=function(w){var k=b===x;return k&&A.call(this),typeof w!="function"||(w(this),k&&F.call(this)),this},d.compatAPI=function(w){var k=b===S;return k&&F.call(this),typeof w!="function"||(w(this),k&&A.call(this)),this},d.isAdvancedAPI=function(){return b===S};var R,P=function(w){if(b!==S)throw new Error(w+" is only available in 'advanced' API mode. You need to call advancedAPI() first.")},O=d.roundToPrecision=d.__private__.roundToPrecision=function(w,k){var ee=e||k;if(isNaN(w)||isNaN(ee))throw new Error("Invalid argument passed to jsPDF.roundToPrecision");return w.toFixed(ee).replace(/0+$/,"")};R=d.hpf=d.__private__.hpf=typeof l=="number"?function(w){if(isNaN(w))throw new Error("Invalid argument passed to jsPDF.hpf");return O(w,l)}:l==="smart"?function(w){if(isNaN(w))throw new Error("Invalid argument passed to jsPDF.hpf");return O(w,w>-1&&w<1?16:5)}:function(w){if(isNaN(w))throw new Error("Invalid argument passed to jsPDF.hpf");return O(w,16)};var L=d.f2=d.__private__.f2=function(w){if(isNaN(w))throw new Error("Invalid argument passed to jsPDF.f2");return O(w,2)},T=d.__private__.f3=function(w){if(isNaN(w))throw new Error("Invalid argument passed to jsPDF.f3");return O(w,3)},C=d.scale=d.__private__.scale=function(w){if(isNaN(w))throw new Error("Invalid argument passed to jsPDF.scale");return b===x?w*st:b===S?w:void 0},D=function(w){return C((function(k){return b===x?tc()-k:b===S?k:void 0})(w))};d.__private__.setPrecision=d.setPrecision=function(w){typeof parseInt(w,10)=="number"&&(e=parseInt(w,10))};var W,$="00000000000000000000000000000000",B=d.__private__.getFileId=function(){return $},V=d.__private__.setFileId=function(w){return $=w!==void 0&&/^[a-fA-F0-9]{32}$/.test(w)?w.toUpperCase():$.split("").map(function(){return"ABCDEF0123456789".charAt(Math.floor(16*Math.random()))}).join(""),h!==null&&(Dn=new Uh(h.userPermissions,h.userPassword,h.ownerPassword,$)),$};d.setFileId=function(w){return V(w),this},d.getFileId=function(){return B()};var te=d.__private__.convertDateToPDFDate=function(w){var k=w.getTimezoneOffset(),ee=k<0?"+":"-",oe=Math.floor(Math.abs(k/60)),me=Math.abs(k%60),Me=[ee,K(oe),"'",K(me),"'"].join("");return["D:",w.getFullYear(),K(w.getMonth()+1),K(w.getDate()),K(w.getHours()),K(w.getMinutes()),K(w.getSeconds()),Me].join("")},ne=d.__private__.convertPDFDateToDate=function(w){var k=parseInt(w.substr(2,4),10),ee=parseInt(w.substr(6,2),10)-1,oe=parseInt(w.substr(8,2),10),me=parseInt(w.substr(10,2),10),Me=parseInt(w.substr(12,2),10),Ne=parseInt(w.substr(14,2),10);return new Date(k,ee,oe,me,Me,Ne,0)},ae=d.__private__.setCreationDate=function(w){var k;if(w===void 0&&(w=new Date),w instanceof Date)k=te(w);else{if(!/^D:(20[0-2][0-9]|203[0-7]|19[7-9][0-9])(0[0-9]|1[0-2])([0-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])(0[0-9]|[1-5][0-9])(0[0-9]|[1-5][0-9])(\+0[0-9]|\+1[0-4]|-0[0-9]|-1[0-1])'(0[0-9]|[1-5][0-9])'?$/.test(w))throw new Error("Invalid argument passed to jsPDF.setCreationDate");k=w}return W=k},I=d.__private__.getCreationDate=function(w){var k=W;return w==="jsDate"&&(k=ne(W)),k};d.setCreationDate=function(w){return ae(w),this},d.getCreationDate=function(w){return I(w)};var U,K=d.__private__.padd2=function(w){return("0"+parseInt(w)).slice(-2)},ie=d.__private__.padd2Hex=function(w){return("00"+(w=w.toString())).substr(w.length)},re=0,ce=[],ve=[],pe=0,le=[],Ce=[],H=!1,Z=ve;d.__private__.setCustomOutputDestination=function(w){H=!0,Z=w};var he=function(w){H||(Z=w)};d.__private__.resetCustomOutputDestination=function(){H=!1,Z=ve};var j=d.__private__.out=function(w){return w=w.toString(),pe+=w.length+1,Z.push(w),Z},fe=d.__private__.write=function(w){return j(arguments.length===1?w.toString():Array.prototype.join.call(arguments," "))},Ee=d.__private__.getArrayBuffer=function(w){for(var k=w.length,ee=new ArrayBuffer(k),oe=new Uint8Array(ee);k--;)oe[k]=w.charCodeAt(k);return ee},Le=[["Helvetica","helvetica","normal","WinAnsiEncoding"],["Helvetica-Bold","helvetica","bold","WinAnsiEncoding"],["Helvetica-Oblique","helvetica","italic","WinAnsiEncoding"],["Helvetica-BoldOblique","helvetica","bolditalic","WinAnsiEncoding"],["Courier","courier","normal","WinAnsiEncoding"],["Courier-Bold","courier","bold","WinAnsiEncoding"],["Courier-Oblique","courier","italic","WinAnsiEncoding"],["Courier-BoldOblique","courier","bolditalic","WinAnsiEncoding"],["Times-Roman","times","normal","WinAnsiEncoding"],["Times-Bold","times","bold","WinAnsiEncoding"],["Times-Italic","times","italic","WinAnsiEncoding"],["Times-BoldItalic","times","bolditalic","WinAnsiEncoding"],["ZapfDingbats","zapfdingbats","normal",null],["Symbol","symbol","normal",null]];d.__private__.getStandardFonts=function(){return Le};var ge=i.fontSize||16;d.__private__.setFontSize=d.setFontSize=function(w){return ge=b===S?w/st:w,this};var Te,_e=d.__private__.getFontSize=d.getFontSize=function(){return b===x?ge:ge*st},Ie=i.R2L||!1;d.__private__.setR2L=d.setR2L=function(w){return Ie=w,this},d.__private__.getR2L=d.getR2L=function(){return Ie};var Se,Ge=d.__private__.setZoomMode=function(w){if(/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(w))Te=w;else if(isNaN(w)){if([void 0,null,"fullwidth","fullheight","fullpage","original"].indexOf(w)===-1)throw new Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+w+'" is not recognized.');Te=w}else Te=parseInt(w,10)};d.__private__.getZoomMode=function(){return Te};var Be,je=d.__private__.setPageMode=function(w){if([void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"].indexOf(w)==-1)throw new Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+w+'" is not recognized.');Se=w};d.__private__.getPageMode=function(){return Se};var Ke=d.__private__.setLayoutMode=function(w){if([void 0,null,"continuous","single","twoleft","tworight","two"].indexOf(w)==-1)throw new Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+w+'" is not recognized.');Be=w};d.__private__.getLayoutMode=function(){return Be},d.__private__.setDisplayMode=d.setDisplayMode=function(w,k,ee){return Ge(w),Ke(k),je(ee),this};var Xe={title:"",subject:"",author:"",keywords:"",creator:""};d.__private__.getDocumentProperty=function(w){if(Object.keys(Xe).indexOf(w)===-1)throw new Error("Invalid argument passed to jsPDF.getDocumentProperty");return Xe[w]},d.__private__.getDocumentProperties=function(){return Xe},d.__private__.setDocumentProperties=d.setProperties=d.setDocumentProperties=function(w){for(var k in Xe)Xe.hasOwnProperty(k)&&w[k]&&(Xe[k]=w[k]);return this},d.__private__.setDocumentProperty=function(w,k){if(Object.keys(Xe).indexOf(w)===-1)throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty");return Xe[w]=k};var qe,st,$e,Jt,Ot,Lt={},ht={},Ut=[],ot={},hi={},dt={},xt={},di=null,At=0,gt=[],ii=new X2(d),En=i.hotfixes||[],Ki={},rn={},hn=[],tt=function w(k,ee,oe,me,Me,Ne){if(!(this instanceof w))return new w(k,ee,oe,me,Me,Ne);isNaN(k)&&(k=1),isNaN(ee)&&(ee=0),isNaN(oe)&&(oe=0),isNaN(me)&&(me=1),isNaN(Me)&&(Me=0),isNaN(Ne)&&(Ne=0),this._matrix=[k,ee,oe,me,Me,Ne]};Object.defineProperty(tt.prototype,"sx",{get:function(){return this._matrix[0]},set:function(w){this._matrix[0]=w}}),Object.defineProperty(tt.prototype,"shy",{get:function(){return this._matrix[1]},set:function(w){this._matrix[1]=w}}),Object.defineProperty(tt.prototype,"shx",{get:function(){return this._matrix[2]},set:function(w){this._matrix[2]=w}}),Object.defineProperty(tt.prototype,"sy",{get:function(){return this._matrix[3]},set:function(w){this._matrix[3]=w}}),Object.defineProperty(tt.prototype,"tx",{get:function(){return this._matrix[4]},set:function(w){this._matrix[4]=w}}),Object.defineProperty(tt.prototype,"ty",{get:function(){return this._matrix[5]},set:function(w){this._matrix[5]=w}}),Object.defineProperty(tt.prototype,"a",{get:function(){return this._matrix[0]},set:function(w){this._matrix[0]=w}}),Object.defineProperty(tt.prototype,"b",{get:function(){return this._matrix[1]},set:function(w){this._matrix[1]=w}}),Object.defineProperty(tt.prototype,"c",{get:function(){return this._matrix[2]},set:function(w){this._matrix[2]=w}}),Object.defineProperty(tt.prototype,"d",{get:function(){return this._matrix[3]},set:function(w){this._matrix[3]=w}}),Object.defineProperty(tt.prototype,"e",{get:function(){return this._matrix[4]},set:function(w){this._matrix[4]=w}}),Object.defineProperty(tt.prototype,"f",{get:function(){return this._matrix[5]},set:function(w){this._matrix[5]=w}}),Object.defineProperty(tt.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(tt.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(tt.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(tt.prototype,"isIdentity",{get:function(){return this.sx===1&&this.shy===0&&this.shx===0&&this.sy===1&&this.tx===0&&this.ty===0}}),tt.prototype.join=function(w){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(R).join(w)},tt.prototype.multiply=function(w){var k=w.sx*this.sx+w.shy*this.shx,ee=w.sx*this.shy+w.shy*this.sy,oe=w.shx*this.sx+w.sy*this.shx,me=w.shx*this.shy+w.sy*this.sy,Me=w.tx*this.sx+w.ty*this.shx+this.tx,Ne=w.tx*this.shy+w.ty*this.sy+this.ty;return new tt(k,ee,oe,me,Me,Ne)},tt.prototype.decompose=function(){var w=this.sx,k=this.shy,ee=this.shx,oe=this.sy,me=this.tx,Me=this.ty,Ne=Math.sqrt(w*w+k*k),it=(w/=Ne)*ee+(k/=Ne)*oe;ee-=w*it,oe-=k*it;var at=Math.sqrt(ee*ee+oe*oe);return it/=at,w*(oe/=at)<k*(ee/=at)&&(w=-w,k=-k,it=-it,Ne=-Ne),{scale:new tt(Ne,0,0,at,0,0),translate:new tt(1,0,0,1,me,Me),rotate:new tt(w,k,-k,w,0,0),skew:new tt(1,0,it,1,0,0)}},tt.prototype.toString=function(w){return this.join(" ")},tt.prototype.inversed=function(){var w=this.sx,k=this.shy,ee=this.shx,oe=this.sy,me=this.tx,Me=this.ty,Ne=1/(w*oe-k*ee),it=oe*Ne,at=-k*Ne,Tt=-ee*Ne,Ft=w*Ne;return new tt(it,at,Tt,Ft,-it*me-Tt*Me,-at*me-Ft*Me)},tt.prototype.applyToPoint=function(w){var k=w.x*this.sx+w.y*this.shx+this.tx,ee=w.x*this.shy+w.y*this.sy+this.ty;return new na(k,ee)},tt.prototype.applyToRectangle=function(w){var k=this.applyToPoint(w),ee=this.applyToPoint(new na(w.x+w.w,w.y+w.h));return new ef(k.x,k.y,ee.x-k.x,ee.y-k.y)},tt.prototype.clone=function(){var w=this.sx,k=this.shy,ee=this.shx,oe=this.sy,me=this.tx,Me=this.ty;return new tt(w,k,ee,oe,me,Me)},d.Matrix=tt;var Fn=d.matrixMult=function(w,k){return k.multiply(w)},On=new tt(1,0,0,1,0,0);d.unitMatrix=d.identityMatrix=On;var $t=function(w,k){if(!hi[w]){var ee=(k instanceof Ec?"Sh":"P")+(Object.keys(ot).length+1).toString(10);k.id=ee,hi[w]=ee,ot[ee]=k,ii.publish("addPattern",k)}};d.ShadingPattern=Ec,d.TilingPattern=Qh,d.addShadingPattern=function(w,k){return P("addShadingPattern()"),$t(w,k),this},d.beginTilingPattern=function(w){P("beginTilingPattern()"),tf(w.boundingBox[0],w.boundingBox[1],w.boundingBox[2]-w.boundingBox[0],w.boundingBox[3]-w.boundingBox[1],w.matrix)},d.endTilingPattern=function(w,k){P("endTilingPattern()"),k.stream=Ce[U].join(`
731
- `),$t(w,k),ii.publish("endTilingPattern",k),hn.pop().restore()};var Si,si=d.__private__.newObject=function(){var w=Sn();return Qn(w,!0),w},Sn=d.__private__.newObjectDeferred=function(){return re++,ce[re]=function(){return pe},re},Qn=function(w,k){return k=typeof k=="boolean"&&k,ce[w]=pe,k&&j(w+" 0 obj"),w},Xl=d.__private__.newAdditionalObject=function(){var w={objId:Sn(),content:""};return le.push(w),w},Xa=Sn(),Ds=Sn(),go=d.__private__.decodeColorString=function(w){var k=w.split(" ");if(k.length!==2||k[1]!=="g"&&k[1]!=="G")k.length!==5||k[4]!=="k"&&k[4]!=="K"||(k=[(1-k[0])*(1-k[3]),(1-k[1])*(1-k[3]),(1-k[2])*(1-k[3]),"r"]);else{var ee=parseFloat(k[0]);k=[ee,ee,ee,"r"]}for(var oe="#",me=0;me<3;me++)oe+=("0"+Math.floor(255*parseFloat(k[me])).toString(16)).slice(-2);return oe},ks=d.__private__.encodeColorString=function(w){var k;typeof w=="string"&&(w={ch1:w});var ee=w.ch1,oe=w.ch2,me=w.ch3,Me=w.ch4,Ne=w.pdfColorType==="draw"?["G","RG","K"]:["g","rg","k"];if(typeof ee=="string"&&ee.charAt(0)!=="#"){var it=new HP(ee);if(it.ok)ee=it.toHex();else if(!/^\d*\.?\d*$/.test(ee))throw new Error('Invalid color "'+ee+'" passed to jsPDF.encodeColorString.')}if(typeof ee=="string"&&/^#[0-9A-Fa-f]{3}$/.test(ee)&&(ee="#"+ee[1]+ee[1]+ee[2]+ee[2]+ee[3]+ee[3]),typeof ee=="string"&&/^#[0-9A-Fa-f]{6}$/.test(ee)){var at=parseInt(ee.substr(1),16);ee=at>>16&255,oe=at>>8&255,me=255&at}if(oe===void 0||Me===void 0&&ee===oe&&oe===me)k=typeof ee=="string"?ee+" "+Ne[0]:w.precision===2?L(ee/255)+" "+Ne[0]:T(ee/255)+" "+Ne[0];else if(Me===void 0||bi(Me)==="object"){if(Me&&!isNaN(Me.a)&&Me.a===0)return["1.","1.","1.",Ne[1]].join(" ");k=typeof ee=="string"?[ee,oe,me,Ne[1]].join(" "):w.precision===2?[L(ee/255),L(oe/255),L(me/255),Ne[1]].join(" "):[T(ee/255),T(oe/255),T(me/255),Ne[1]].join(" ")}else k=typeof ee=="string"?[ee,oe,me,Me,Ne[2]].join(" "):w.precision===2?[L(ee),L(oe),L(me),L(Me),Ne[2]].join(" "):[T(ee),T(oe),T(me),T(Me),Ne[2]].join(" ");return k},Gs=d.__private__.getFilters=function(){return o},ys=d.__private__.putStream=function(w){var k=(w=w||{}).data||"",ee=w.filters||Gs(),oe=w.alreadyAppliedFilters||[],me=w.addLength1||!1,Me=k.length,Ne=w.objectId,it=function(kn){return kn};if(h!==null&&Ne===void 0)throw new Error("ObjectId must be passed to putStream for file encryption");h!==null&&(it=Dn.encryptor(Ne,0));var at={};ee===!0&&(ee=["FlateEncode"]);var Tt=w.additionalKeyValues||[],Ft=(at=ct.API.processDataByFilters!==void 0?ct.API.processDataByFilters(k,ee):{data:k,reverseChain:[]}).reverseChain+(Array.isArray(oe)?oe.join(" "):oe.toString());if(at.data.length!==0&&(Tt.push({key:"Length",value:at.data.length}),me===!0&&Tt.push({key:"Length1",value:Me})),Ft.length!=0)if(Ft.split("/").length-1==1)Tt.push({key:"Filter",value:Ft});else{Tt.push({key:"Filter",value:"["+Ft+"]"});for(var ni=0;ni<Tt.length;ni+=1)if(Tt[ni].key==="DecodeParms"){for(var Qi=[],Ln=0;Ln<at.reverseChain.split("/").length-1;Ln+=1)Qi.push("null");Qi.push(Tt[ni].value),Tt[ni].value="["+Qi.join(" ")+"]"}}j("<<");for(var Oi=0;Oi<Tt.length;Oi++)j("/"+Tt[Oi].key+" "+Tt[Oi].value);j(">>"),at.data.length!==0&&(j("stream"),j(it(at.data)),j("endstream"))},Kl=d.__private__.putPage=function(w){var k=w.number,ee=w.data,oe=w.objId,me=w.contentsObjId;Qn(oe,!0),j("<</Type /Page"),j("/Parent "+w.rootDictionaryObjId+" 0 R"),j("/Resources "+w.resourceDictionaryObjId+" 0 R"),j("/MediaBox ["+parseFloat(R(w.mediaBox.bottomLeftX))+" "+parseFloat(R(w.mediaBox.bottomLeftY))+" "+R(w.mediaBox.topRightX)+" "+R(w.mediaBox.topRightY)+"]"),w.cropBox!==null&&j("/CropBox ["+R(w.cropBox.bottomLeftX)+" "+R(w.cropBox.bottomLeftY)+" "+R(w.cropBox.topRightX)+" "+R(w.cropBox.topRightY)+"]"),w.bleedBox!==null&&j("/BleedBox ["+R(w.bleedBox.bottomLeftX)+" "+R(w.bleedBox.bottomLeftY)+" "+R(w.bleedBox.topRightX)+" "+R(w.bleedBox.topRightY)+"]"),w.trimBox!==null&&j("/TrimBox ["+R(w.trimBox.bottomLeftX)+" "+R(w.trimBox.bottomLeftY)+" "+R(w.trimBox.topRightX)+" "+R(w.trimBox.topRightY)+"]"),w.artBox!==null&&j("/ArtBox ["+R(w.artBox.bottomLeftX)+" "+R(w.artBox.bottomLeftY)+" "+R(w.artBox.topRightX)+" "+R(w.artBox.topRightY)+"]"),typeof w.userUnit=="number"&&w.userUnit!==1&&j("/UserUnit "+w.userUnit),ii.publish("putPage",{objId:oe,pageContext:gt[k],pageNumber:k,page:ee}),j("/Contents "+me+" 0 R"),j(">>"),j("endobj");var Me=ee.join(`
732
- `);return b===S&&(Me+=`
733
- Q`),Qn(me,!0),ys({data:Me,filters:Gs(),objectId:me}),j("endobj"),oe},po=d.__private__.putPages=function(){var w,k,ee=[];for(w=1;w<=At;w++)gt[w].objId=Sn(),gt[w].contentsObjId=Sn();for(w=1;w<=At;w++)ee.push(Kl({number:w,data:Ce[w],objId:gt[w].objId,contentsObjId:gt[w].contentsObjId,mediaBox:gt[w].mediaBox,cropBox:gt[w].cropBox,bleedBox:gt[w].bleedBox,trimBox:gt[w].trimBox,artBox:gt[w].artBox,userUnit:gt[w].userUnit,rootDictionaryObjId:Xa,resourceDictionaryObjId:Ds}));Qn(Xa,!0),j("<</Type /Pages");var oe="/Kids [";for(k=0;k<At;k++)oe+=ee[k]+" 0 R ";j(oe+"]"),j("/Count "+At),j(">>"),j("endobj"),ii.publish("postPutPages")},Yl=function(w){ii.publish("putFont",{font:w,out:j,newObject:si,putStream:ys}),w.isAlreadyPutted!==!0&&(w.objectNumber=si(),j("<<"),j("/Type /Font"),j("/BaseFont /"+zh(w.postScriptName)),j("/Subtype /Type1"),typeof w.encoding=="string"&&j("/Encoding /"+w.encoding),j("/FirstChar 32"),j("/LastChar 255"),j(">>"),j("endobj"))},nh=function(w){w.objectNumber=si();var k=[];k.push({key:"Type",value:"/XObject"}),k.push({key:"Subtype",value:"/Form"}),k.push({key:"BBox",value:"["+[R(w.x),R(w.y),R(w.x+w.width),R(w.y+w.height)].join(" ")+"]"}),k.push({key:"Matrix",value:"["+w.matrix.toString()+"]"});var ee=w.pages[1].join(`
734
- `);ys({data:ee,additionalKeyValues:k,objectId:w.objectNumber}),j("endobj")},rh=function(w,k){k||(k=21);var ee=si(),oe=(function(Ne,it){var at,Tt=[],Ft=1/(it-1);for(at=0;at<1;at+=Ft)Tt.push(at);if(Tt.push(1),Ne[0].offset!=0){var ni={offset:0,color:Ne[0].color};Ne.unshift(ni)}if(Ne[Ne.length-1].offset!=1){var Qi={offset:1,color:Ne[Ne.length-1].color};Ne.push(Qi)}for(var Ln="",Oi=0,kn=0;kn<Tt.length;kn++){for(at=Tt[kn];at>Ne[Oi+1].offset;)Oi++;var Cn=Ne[Oi].offset,er=(at-Cn)/(Ne[Oi+1].offset-Cn),oa=Ne[Oi].color,js=Ne[Oi+1].color;Ln+=ie(Math.round((1-er)*oa[0]+er*js[0]).toString(16))+ie(Math.round((1-er)*oa[1]+er*js[1]).toString(16))+ie(Math.round((1-er)*oa[2]+er*js[2]).toString(16))}return Ln.trim()})(w.colors,k),me=[];me.push({key:"FunctionType",value:"0"}),me.push({key:"Domain",value:"[0.0 1.0]"}),me.push({key:"Size",value:"["+k+"]"}),me.push({key:"BitsPerSample",value:"8"}),me.push({key:"Range",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),me.push({key:"Decode",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),ys({data:oe,additionalKeyValues:me,alreadyAppliedFilters:["/ASCIIHexDecode"],objectId:ee}),j("endobj"),w.objectNumber=si(),j("<< /ShadingType "+w.type),j("/ColorSpace /DeviceRGB");var Me="/Coords ["+R(parseFloat(w.coords[0]))+" "+R(parseFloat(w.coords[1]))+" ";w.type===2?Me+=R(parseFloat(w.coords[2]))+" "+R(parseFloat(w.coords[3])):Me+=R(parseFloat(w.coords[2]))+" "+R(parseFloat(w.coords[3]))+" "+R(parseFloat(w.coords[4]))+" "+R(parseFloat(w.coords[5])),j(Me+="]"),w.matrix&&j("/Matrix ["+w.matrix.toString()+"]"),j("/Function "+ee+" 0 R"),j("/Extend [true true]"),j(">>"),j("endobj")},sh=function(w,k){var ee=Sn(),oe=si();k.push({resourcesOid:ee,objectOid:oe}),w.objectNumber=oe;var me=[];me.push({key:"Type",value:"/Pattern"}),me.push({key:"PatternType",value:"1"}),me.push({key:"PaintType",value:"1"}),me.push({key:"TilingType",value:"1"}),me.push({key:"BBox",value:"["+w.boundingBox.map(R).join(" ")+"]"}),me.push({key:"XStep",value:R(w.xStep)}),me.push({key:"YStep",value:R(w.yStep)}),me.push({key:"Resources",value:ee+" 0 R"}),w.matrix&&me.push({key:"Matrix",value:"["+w.matrix.toString()+"]"}),ys({data:w.stream,additionalKeyValues:me,objectId:w.objectNumber}),j("endobj")},Qm=function(w){for(var k in w.objectNumber=si(),j("<<"),w)switch(k){case"opacity":j("/ca "+L(w[k]));break;case"stroke-opacity":j("/CA "+L(w[k]))}j(">>"),j("endobj")},Wu=function(w){Qn(w.resourcesOid,!0),j("<<"),j("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),(function(){for(var k in j("/Font <<"),Lt)Lt.hasOwnProperty(k)&&(u===!1||u===!0&&f.hasOwnProperty(k))&&j("/"+k+" "+Lt[k].objectNumber+" 0 R");j(">>")})(),(function(){if(Object.keys(ot).length>0){for(var k in j("/Shading <<"),ot)ot.hasOwnProperty(k)&&ot[k]instanceof Ec&&ot[k].objectNumber>=0&&j("/"+k+" "+ot[k].objectNumber+" 0 R");ii.publish("putShadingPatternDict"),j(">>")}})(),(function(k){if(Object.keys(ot).length>0){for(var ee in j("/Pattern <<"),ot)ot.hasOwnProperty(ee)&&ot[ee]instanceof d.TilingPattern&&ot[ee].objectNumber>=0&&ot[ee].objectNumber<k&&j("/"+ee+" "+ot[ee].objectNumber+" 0 R");ii.publish("putTilingPatternDict"),j(">>")}})(w.objectOid),(function(){if(Object.keys(dt).length>0){var k;for(k in j("/ExtGState <<"),dt)dt.hasOwnProperty(k)&&dt[k].objectNumber>=0&&j("/"+k+" "+dt[k].objectNumber+" 0 R");ii.publish("putGStateDict"),j(">>")}})(),(function(){for(var k in j("/XObject <<"),Ki)Ki.hasOwnProperty(k)&&Ki[k].objectNumber>=0&&j("/"+k+" "+Ki[k].objectNumber+" 0 R");ii.publish("putXobjectDict"),j(">>")})(),j(">>"),j("endobj")},dg=function(w){ht[w.fontName]=ht[w.fontName]||{},ht[w.fontName][w.fontStyle]=w.id},gg=function(w,k,ee,oe,me){var Me={id:"F"+(Object.keys(Lt).length+1).toString(10),postScriptName:w,fontName:k,fontStyle:ee,encoding:oe,isStandardFont:me||!1,metadata:{}};return ii.publish("addFont",{font:Me,instance:this}),Lt[Me.id]=Me,dg(Me),Me.id},vs=d.__private__.pdfEscape=d.pdfEscape=function(w,k){return(function(ee,oe){var me,Me,Ne,it,at,Tt,Ft,ni,Qi;if(Ne=(oe=oe||{}).sourceEncoding||"Unicode",at=oe.outputEncoding,(oe.autoencode||at)&&Lt[qe].metadata&&Lt[qe].metadata[Ne]&&Lt[qe].metadata[Ne].encoding&&(it=Lt[qe].metadata[Ne].encoding,!at&&Lt[qe].encoding&&(at=Lt[qe].encoding),!at&&it.codePages&&(at=it.codePages[0]),typeof at=="string"&&(at=it[at]),at)){for(Ft=!1,Tt=[],me=0,Me=ee.length;me<Me;me++)(ni=at[ee.charCodeAt(me)])?Tt.push(String.fromCharCode(ni)):Tt.push(ee[me]),Tt[me].charCodeAt(0)>>8&&(Ft=!0);ee=Tt.join("")}for(me=ee.length;Ft===void 0&&me!==0;)ee.charCodeAt(me-1)>>8&&(Ft=!0),me--;if(!Ft)return ee;for(Tt=oe.noBOM?[]:[254,255],me=0,Me=ee.length;me<Me;me++){if((Qi=(ni=ee.charCodeAt(me))>>8)>>8)throw new Error("Character at position "+me+" of string '"+ee+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");Tt.push(Qi),Tt.push(ni-(Qi<<8))}return String.fromCharCode.apply(void 0,Tt)})(w,k).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},Hu=d.__private__.beginPage=function(w){Ce[++At]=[],gt[At]={objId:0,contentsObjId:0,userUnit:Number(a),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(w[0]),topRightY:Number(w[1])}},mg(At),he(Ce[U])},pg=function(w,k){var ee,oe,me;switch(t=k||t,typeof w=="string"&&(ee=v(w.toLowerCase()),Array.isArray(ee)&&(oe=ee[0],me=ee[1])),Array.isArray(w)&&(oe=w[0]*st,me=w[1]*st),isNaN(oe)&&(oe=r[0],me=r[1]),(oe>14400||me>14400)&&(Mi.warn("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),oe=Math.min(14400,oe),me=Math.min(14400,me)),r=[oe,me],t.substr(0,1)){case"l":me>oe&&(r=[me,oe]);break;case"p":oe>me&&(r=[me,oe])}Hu(r),Ct(Yu),j(ch),Ju!==0&&j(Ju+" J"),Qu!==0&&j(Qu+" j"),ii.publish("addPage",{pageNumber:At})},Xu=function(w){w>0&&w<=At&&(Ce.splice(w,1),gt.splice(w,1),At--,U>At&&(U=At),this.setPage(U))},mg=function(w){w>0&&w<=At&&(U=w)},_g=d.__private__.getNumberOfPages=d.getNumberOfPages=function(){return Ce.length-1},yg=function(w,k,ee){var oe,me=void 0;return ee=ee||{},w=w!==void 0?w:Lt[qe].fontName,k=k!==void 0?k:Lt[qe].fontStyle,oe=w.toLowerCase(),ht[oe]!==void 0&&ht[oe][k]!==void 0?me=ht[oe][k]:ht[w]!==void 0&&ht[w][k]!==void 0?me=ht[w][k]:ee.disableWarning===!1&&Mi.warn("Unable to look up font label for font '"+w+"', '"+k+"'. Refer to getFontList() for available fonts."),me||ee.noFallback||(me=ht.times[k])==null&&(me=ht.times.normal),me},mo=d.__private__.putInfo=function(){var w=si(),k=function(oe){return oe};for(var ee in h!==null&&(k=Dn.encryptor(w,0)),j("<<"),j("/Producer ("+vs(k("jsPDF "+ct.version))+")"),Xe)Xe.hasOwnProperty(ee)&&Xe[ee]&&j("/"+ee.substr(0,1).toUpperCase()+ee.substr(1)+" ("+vs(k(Xe[ee]))+")");j("/CreationDate ("+vs(k(W))+")"),j(">>"),j("endobj")},oh=d.__private__.putCatalog=function(w){var k=(w=w||{}).rootDictionaryObjId||Xa;switch(si(),j("<<"),j("/Type /Catalog"),j("/Pages "+k+" 0 R"),Te||(Te="fullwidth"),Te){case"fullwidth":j("/OpenAction [3 0 R /FitH null]");break;case"fullheight":j("/OpenAction [3 0 R /FitV null]");break;case"fullpage":j("/OpenAction [3 0 R /Fit]");break;case"original":j("/OpenAction [3 0 R /XYZ null null 1]");break;default:var ee=""+Te;ee.substr(ee.length-1)==="%"&&(Te=parseInt(Te)/100),typeof Te=="number"&&j("/OpenAction [3 0 R /XYZ null null "+L(Te)+"]")}switch(Be||(Be="continuous"),Be){case"continuous":j("/PageLayout /OneColumn");break;case"single":j("/PageLayout /SinglePage");break;case"two":case"twoleft":j("/PageLayout /TwoColumnLeft");break;case"tworight":j("/PageLayout /TwoColumnRight")}Se&&j("/PageMode /"+Se),ii.publish("putCatalog"),j(">>"),j("endobj")},e1=d.__private__.putTrailer=function(){j("trailer"),j("<<"),j("/Size "+(re+1)),j("/Root "+re+" 0 R"),j("/Info "+(re-1)+" 0 R"),h!==null&&j("/Encrypt "+Dn.oid+" 0 R"),j("/ID [ <"+$+"> <"+$+"> ]"),j(">>")},Tn=d.__private__.putHeader=function(){j("%PDF-"+g),j("%ºß¬à")},vg=d.__private__.putXRef=function(){var w="0000000000";j("xref"),j("0 "+(re+1)),j("0000000000 65535 f ");for(var k=1;k<=re;k++)typeof ce[k]=="function"?j((w+ce[k]()).slice(-10)+" 00000 n "):ce[k]!==void 0?j((w+ce[k]).slice(-10)+" 00000 n "):j("0000000000 00000 n ")},_o=d.__private__.buildDocument=function(){var w;re=0,pe=0,ve=[],ce=[],le=[],Xa=Sn(),Ds=Sn(),he(ve),ii.publish("buildDocument"),Tn(),po(),(function(){ii.publish("putAdditionalObjects");for(var ee=0;ee<le.length;ee++){var oe=le[ee];Qn(oe.objId,!0),j(oe.content),j("endobj")}ii.publish("postPutAdditionalObjects")})(),w=[],(function(){for(var ee in Lt)Lt.hasOwnProperty(ee)&&(u===!1||u===!0&&f.hasOwnProperty(ee))&&Yl(Lt[ee])})(),(function(){var ee;for(ee in dt)dt.hasOwnProperty(ee)&&Qm(dt[ee])})(),(function(){for(var ee in Ki)Ki.hasOwnProperty(ee)&&nh(Ki[ee])})(),(function(ee){var oe;for(oe in ot)ot.hasOwnProperty(oe)&&(ot[oe]instanceof Ec?rh(ot[oe]):ot[oe]instanceof Qh&&sh(ot[oe],ee))})(w),ii.publish("putResources"),w.forEach(Wu),Wu({resourcesOid:Ds,objectOid:Number.MAX_SAFE_INTEGER}),ii.publish("postPutResources"),h!==null&&(Dn.oid=si(),j("<<"),j("/Filter /Standard"),j("/V "+Dn.v),j("/R "+Dn.r),j("/U <"+Dn.toHexString(Dn.U)+">"),j("/O <"+Dn.toHexString(Dn.O)+">"),j("/P "+Dn.P),j(">>"),j("endobj")),mo(),oh();var k=pe;return vg(),e1(),j("startxref"),j(""+k),j("%%EOF"),he(Ce[U]),ve.join(`
735
- `)},ah=d.__private__.getBlob=function(w){return new Blob([Ee(w)],{type:"application/pdf"})},xg=d.output=d.__private__.output=(Si=function(w,k){switch(typeof(k=k||{})=="string"?k={filename:k}:k.filename=k.filename||"generated.pdf",w){case void 0:return _o();case"save":d.save(k.filename);break;case"arraybuffer":return Ee(_o());case"blob":return ah(_o());case"bloburi":case"bloburl":if(Et.URL!==void 0&&typeof Et.URL.createObjectURL=="function")return Et.URL&&Et.URL.createObjectURL(ah(_o()))||void 0;Mi.warn("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":var ee="",oe=_o();try{ee=$2(oe)}catch{ee=$2(unescape(encodeURIComponent(oe)))}return"data:application/pdf;filename="+k.filename+";base64,"+ee;case"pdfobjectnewwindow":if(Object.prototype.toString.call(Et)==="[object Window]"){var me="https://cdnjs.cloudflare.com/ajax/libs/pdfobject/2.1.1/pdfobject.min.js",Me=' integrity="sha512-4ze/a9/4jqu+tX9dfOqJYSvyYd5M6qum/3HpCLr+/Jqf0whc37VUbkpNGHR7/8pSnCFw47T1fmIpwBV7UySh3g==" crossorigin="anonymous"';k.pdfObjectUrl&&(me=k.pdfObjectUrl,Me="");var Ne='<html><style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;} </style><body><script src="'+me+'"'+Me+'><\/script><script >PDFObject.embed("'+this.output("dataurlstring")+'", '+JSON.stringify(k)+");<\/script></body></html>",it=Et.open();return it!==null&&it.document.write(Ne),it}throw new Error("The option pdfobjectnewwindow just works in a browser-environment.");case"pdfjsnewwindow":if(Object.prototype.toString.call(Et)==="[object Window]"){var at='<html><style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;} </style><body><iframe id="pdfViewer" src="'+(k.pdfJsUrl||"examples/PDF.js/web/viewer.html")+"?file=&downloadName="+k.filename+'" width="500px" height="400px" /></body></html>',Tt=Et.open();if(Tt!==null){Tt.document.write(at);var Ft=this;Tt.document.documentElement.querySelector("#pdfViewer").onload=function(){Tt.document.title=k.filename,Tt.document.documentElement.querySelector("#pdfViewer").contentWindow.PDFViewerApplication.open(Ft.output("bloburl"))}}return Tt}throw new Error("The option pdfjsnewwindow just works in a browser-environment.");case"dataurlnewwindow":if(Object.prototype.toString.call(Et)!=="[object Window]")throw new Error("The option dataurlnewwindow just works in a browser-environment.");var ni='<html><style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;} </style><body><iframe src="'+this.output("datauristring",k)+'"></iframe></body></html>',Qi=Et.open();if(Qi!==null&&(Qi.document.write(ni),Qi.document.title=k.filename),Qi||typeof safari>"u")return Qi;break;case"datauri":case"dataurl":return Et.document.location.href=this.output("datauristring",k);default:return null}},Si.foo=function(){try{return Si.apply(this,arguments)}catch(ee){var w=ee.stack||"";~w.indexOf(" at ")&&(w=w.split(" at ")[1]);var k="Error in function "+w.split(`
736
- `)[0].split("<")[0]+": "+ee.message;if(!Et.console)throw new Error(k);Et.console.error(k,ee),Et.alert&&alert(k)}},Si.foo.bar=Si,Si.foo),xs=function(w){return Array.isArray(En)===!0&&En.indexOf(w)>-1};switch(n){case"pt":st=1;break;case"mm":st=72/25.4;break;case"cm":st=72/2.54;break;case"in":st=72;break;case"px":st=xs("px_scaling")==1?.75:96/72;break;case"pc":case"em":st=12;break;case"ex":st=6;break;default:if(typeof n!="number")throw new Error("Invalid unit: "+n);st=n}var Dn=null;ae(),V();var Qo=d.__private__.getPageInfo=d.getPageInfo=function(w){if(isNaN(w)||w%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfo");return{objId:gt[w].objId,pageNumber:w,pageContext:gt[w]}},wg=d.__private__.getPageInfoByObjId=function(w){if(isNaN(w)||w%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfoByObjId");for(var k in gt)if(gt[k].objId===w)break;return Qo(k)},t1=d.__private__.getCurrentPageInfo=d.getCurrentPageInfo=function(){return{objId:gt[U].objId,pageNumber:U,pageContext:gt[U]}};d.addPage=function(){return pg.apply(this,arguments),this},d.setPage=function(){return mg.apply(this,arguments),he.call(this,Ce[U]),this},d.insertPage=function(w){return this.addPage(),this.movePage(U,w),this},d.movePage=function(w,k){var ee,oe;if(w>k){ee=Ce[w],oe=gt[w];for(var me=w;me>k;me--)Ce[me]=Ce[me-1],gt[me]=gt[me-1];Ce[k]=ee,gt[k]=oe,this.setPage(k)}else if(w<k){ee=Ce[w],oe=gt[w];for(var Me=w;Me<k;Me++)Ce[Me]=Ce[Me+1],gt[Me]=gt[Me+1];Ce[k]=ee,gt[k]=oe,this.setPage(k)}return this},d.deletePage=function(){return Xu.apply(this,arguments),this},d.__private__.text=d.text=function(w,k,ee,oe,me){var Me,Ne,it,at,Tt,Ft,ni,Qi,Ln,Oi=(oe=oe||{}).scope||this;if(typeof w=="number"&&typeof k=="number"&&(typeof ee=="string"||Array.isArray(ee))){var kn=ee;ee=k,k=w,w=kn}if(arguments[3]instanceof tt==0?(it=arguments[4],at=arguments[5],bi(ni=arguments[3])==="object"&&ni!==null||(typeof it=="string"&&(at=it,it=null),typeof ni=="string"&&(at=ni,ni=null),typeof ni=="number"&&(it=ni,ni=null),oe={flags:ni,angle:it,align:at})):(P("The transform parameter of text() with a Matrix value"),Ln=me),isNaN(k)||isNaN(ee)||w==null)throw new Error("Invalid arguments passed to jsPDF.text");if(w.length===0)return Oi;var Cn,er="",oa=typeof oe.lineHeightFactor=="number"?oe.lineHeightFactor:Jl,js=Oi.internal.scaleFactor;function aa(gi){return gi=gi.split(" ").join(Array(oe.TabLen||9).join(" ")),vs(gi,ni)}function rf(gi){for(var Ai,fn=gi.concat(),Gn=[],ha=fn.length;ha--;)typeof(Ai=fn.shift())=="string"?Gn.push(Ai):Array.isArray(gi)&&(Ai.length===1||Ai[1]===void 0&&Ai[2]===void 0)?Gn.push(Ai[0]):Gn.push([Ai[0],Ai[1],Ai[2]]);return Gn}function uh(gi,Ai){var fn;if(typeof gi=="string")fn=Ai(gi)[0];else if(Array.isArray(gi)){for(var Gn,ha,gf=gi.concat(),gh=[],Ig=gf.length;Ig--;)typeof(Gn=gf.shift())=="string"?gh.push(Ai(Gn)[0]):Array.isArray(Gn)&&typeof Gn[0]=="string"&&(ha=Ai(Gn[0],Gn[1],Gn[2]),gh.push([ha[0],ha[1],ha[2]]));fn=gh}return fn}var Ka=!1,ic=!0;if(typeof w=="string")Ka=!0;else if(Array.isArray(w)){var nc=w.concat();Ne=[];for(var Ya,tr=nc.length;tr--;)(typeof(Ya=nc.shift())!="string"||Array.isArray(Ya)&&typeof Ya[0]!="string")&&(ic=!1);Ka=ic}if(Ka===!1)throw new Error('Type of text must be string or Array. "'+w+'" is not recognized.');typeof w=="string"&&(w=w.match(/[\r?\n]/)?w.split(/\r\n|\r|\n/g):[w]);var rc=ge/Oi.internal.scaleFactor,sc=rc*(oa-1);switch(oe.baseline){case"bottom":ee-=sc;break;case"top":ee+=rc-sc;break;case"hanging":ee+=rc-2*sc;break;case"middle":ee+=rc/2-sc}if((Ft=oe.maxWidth||0)>0&&(typeof w=="string"?w=Oi.splitTextToSize(w,Ft):Object.prototype.toString.call(w)==="[object Array]"&&(w=w.reduce(function(gi,Ai){return gi.concat(Oi.splitTextToSize(Ai,Ft))},[]))),Me={text:w,x:k,y:ee,options:oe,mutex:{pdfEscape:vs,activeFontKey:qe,fonts:Lt,activeFontSize:ge}},ii.publish("preProcessText",Me),w=Me.text,it=(oe=Me.options).angle,Ln instanceof tt==0&&it&&typeof it=="number"){it*=Math.PI/180,oe.rotationDirection===0&&(it=-it),b===S&&(it=-it);var sf=Math.cos(it),of=Math.sin(it);Ln=new tt(sf,of,-of,sf,0,0)}else it&&it instanceof tt&&(Ln=it);b!==S||Ln||(Ln=On),(Tt=oe.charSpace||ia)!==void 0&&(er+=R(C(Tt))+` Tc
737
- `,this.setCharSpace(this.getCharSpace()||0)),(Qi=oe.horizontalScale)!==void 0&&(er+=R(100*Qi)+` Tz
738
- `),oe.lang;var Tr=-1,la=oe.renderingMode!==void 0?oe.renderingMode:oe.stroke,fh=Oi.internal.getCurrentPageInfo().pageContext;switch(la){case 0:case!1:case"fill":Tr=0;break;case 1:case!0:case"stroke":Tr=1;break;case 2:case"fillThenStroke":Tr=2;break;case 3:case"invisible":Tr=3;break;case 4:case"fillAndAddForClipping":Tr=4;break;case 5:case"strokeAndAddPathForClipping":Tr=5;break;case 6:case"fillThenStrokeAndAddToPathForClipping":Tr=6;break;case 7:case"addToPathForClipping":Tr=7}var Mg=fh.usedRenderingMode!==void 0?fh.usedRenderingMode:-1;Tr!==-1?er+=Tr+` Tr
739
- `:Mg!==-1&&(er+=`0 Tr
740
- `),Tr!==-1&&(fh.usedRenderingMode=Tr),at=oe.align||"left";var ws,oc=ge*oa,af=Oi.internal.pageSize.getWidth(),lf=Lt[qe];Tt=oe.charSpace||ia,Ft=oe.maxWidth||0,ni=Object.assign({autoencode:!0,noBOM:!0},oe.flags);var Za=[],ac=function(gi){return Oi.getStringUnitWidth(gi,{font:lf,charSpace:Tt,fontSize:ge,doKerning:!1})*ge/js};if(Object.prototype.toString.call(w)==="[object Array]"){var ts;Ne=rf(w),at!=="left"&&(ws=Ne.map(ac));var is,Ja=0;if(at==="right"){k-=ws[0],w=[],tr=Ne.length;for(var ca=0;ca<tr;ca++)ca===0?(is=ea(k),ts=ta(ee)):(is=C(Ja-ws[ca]),ts=-oc),w.push([Ne[ca],is,ts]),Ja=ws[ca]}else if(at==="center"){k-=ws[0]/2,w=[],tr=Ne.length;for(var Qa=0;Qa<tr;Qa++)Qa===0?(is=ea(k),ts=ta(ee)):(is=C((Ja-ws[Qa])/2),ts=-oc),w.push([Ne[Qa],is,ts]),Ja=ws[Qa]}else if(at==="left"){w=[],tr=Ne.length;for(var cf=0;cf<tr;cf++)w.push(Ne[cf])}else if(at==="justify"&&lf.encoding==="Identity-H"){w=[],tr=Ne.length,Ft=Ft!==0?Ft:af;for(var dh=0,un=0;un<tr;un++)if(ts=un===0?ta(ee):-oc,is=un===0?ea(k):dh,un<tr-1){var Rg=C((Ft-ws[un])/(Ne[un].split(" ").length-1)),vo=Ne[un].split(" ");w.push([vo[0]+" ",is,ts]),dh=0;for(var xo=1;xo<vo.length;xo++){var hf=(ac(vo[xo-1]+" "+vo[xo])-ac(vo[xo]))*js+Rg;xo==vo.length-1?w.push([vo[xo],hf,0]):w.push([vo[xo]+" ",hf,0]),dh-=hf}}else w.push([Ne[un],is,ts]);w.push(["",dh,0])}else{if(at!=="justify")throw new Error('Unrecognized alignment option, use "left", "center", "right" or "justify".');for(w=[],tr=Ne.length,Ft=Ft!==0?Ft:af,un=0;un<tr;un++){ts=un===0?ta(ee):-oc,is=un===0?ea(k):0;var uf=Ne[un].split(" ").length-1,ff=uf>0?(Ft-ws[un])/uf:0;un<tr-1?Za.push(R(C(ff))):Za.push(0),w.push([Ne[un],is,ts])}}}(typeof oe.R2L=="boolean"?oe.R2L:Ie)===!0&&(w=uh(w,function(gi,Ai,fn){return[gi.split("").reverse().join(""),Ai,fn]})),Me={text:w,x:k,y:ee,options:oe,mutex:{pdfEscape:vs,activeFontKey:qe,fonts:Lt,activeFontSize:ge}},ii.publish("postProcessText",Me),w=Me.text,Cn=Me.mutex.isHex||!1;var df=Lt[qe].encoding;df!=="WinAnsiEncoding"&&df!=="StandardEncoding"||(w=uh(w,function(gi,Ai,fn){return[aa(gi),Ai,fn]})),Ne=rf(w),w=[];for(var el,tl,il,lc=Array.isArray(Ne[0])?1:0,nl="",cc=function(gi,Ai,fn){var Gn="";return fn instanceof tt?(fn=typeof oe.angle=="number"?Fn(fn,new tt(1,0,0,1,gi,Ai)):Fn(new tt(1,0,0,1,gi,Ai),fn),b===S&&(fn=Fn(new tt(1,0,0,-1,0,0),fn)),Gn=fn.join(" ")+` Tm
741
- `):Gn=R(gi)+" "+R(Ai)+` Td
742
- `,Gn},bs=0;bs<Ne.length;bs++){switch(nl="",lc){case 1:il=(Cn?"<":"(")+Ne[bs][0]+(Cn?">":")"),el=parseFloat(Ne[bs][1]),tl=parseFloat(Ne[bs][2]);break;case 0:il=(Cn?"<":"(")+Ne[bs]+(Cn?">":")"),el=ea(k),tl=ta(ee)}Za!==void 0&&Za[bs]!==void 0&&(nl=Za[bs]+` Tw
743
- `),bs===0?w.push(nl+cc(el,tl,Ln)+il):lc===0?w.push(nl+il):lc===1&&w.push(nl+cc(el,tl,Ln)+il)}w=lc===0?w.join(` Tj
744
- T* `):w.join(` Tj
745
- `),w+=` Tj
746
- `;var wo=`BT
747
- /`;return wo+=qe+" "+ge+` Tf
748
- `,wo+=R(ge*oa)+` TL
749
- `,wo+=Ql+`
750
- `,wo+=er,wo+=w,j(wo+="ET"),f[qe]=!0,Oi};var i1=d.__private__.clip=d.clip=function(w){return j(w==="evenodd"?"W*":"W"),this};d.clipEvenOdd=function(){return i1("evenodd")},d.__private__.discardPath=d.discardPath=function(){return j("n"),this};var yo=d.__private__.isValidStyle=function(w){var k=!1;return[void 0,null,"S","D","F","DF","FD","f","f*","B","B*","n"].indexOf(w)!==-1&&(k=!0),k};d.__private__.setDefaultPathOperation=d.setDefaultPathOperation=function(w){return yo(w)&&(c=w),this};var bg=d.__private__.getStyle=d.getStyle=function(w){var k=c;switch(w){case"D":case"S":k="S";break;case"F":k="f";break;case"FD":case"DF":k="B";break;case"f":case"f*":case"B":case"B*":k=w}return k},Eg=d.close=function(){return j("h"),this};d.stroke=function(){return j("S"),this},d.fill=function(w){return lh("f",w),this},d.fillEvenOdd=function(w){return lh("f*",w),this},d.fillStroke=function(w){return lh("B",w),this},d.fillStrokeEvenOdd=function(w){return lh("B*",w),this};var lh=function(w,k){bi(k)==="object"?r1(k,w):j(w)},Zl=function(w){w===null||b===S&&w===void 0||(w=bg(w),j(w))};function n1(w,k,ee,oe,me){var Me=new Qh(k||this.boundingBox,ee||this.xStep,oe||this.yStep,this.gState,me||this.matrix);Me.stream=this.stream;var Ne=w+"$$"+this.cloneIndex+++"$$";return $t(Ne,Me),Me}var r1=function(w,k){var ee=hi[w.key],oe=ot[ee];if(oe instanceof Ec)j("q"),j(s1(k)),oe.gState&&d.setGState(oe.gState),j(w.matrix.toString()+" cm"),j("/"+ee+" sh"),j("Q");else if(oe instanceof Qh){var me=new tt(1,0,0,-1,0,tc());w.matrix&&(me=me.multiply(w.matrix||On),ee=n1.call(oe,w.key,w.boundingBox,w.xStep,w.yStep,me).id),j("q"),j("/Pattern cs"),j("/"+ee+" scn"),oe.gState&&d.setGState(oe.gState),j(k),j("Q")}},s1=function(w){switch(w){case"f":case"F":case"n":return"W n";case"f*":return"W* n";case"B":case"S":return"W S";case"B*":return"W* S"}},Ku=d.moveTo=function(w,k){return j(R(C(w))+" "+R(D(k))+" m"),this},Sg=d.lineTo=function(w,k){return j(R(C(w))+" "+R(D(k))+" l"),this},Bs=d.curveTo=function(w,k,ee,oe,me,Me){return j([R(C(w)),R(D(k)),R(C(ee)),R(D(oe)),R(C(me)),R(D(Me)),"c"].join(" ")),this};d.__private__.line=d.line=function(w,k,ee,oe,me){if(isNaN(w)||isNaN(k)||isNaN(ee)||isNaN(oe)||!yo(me))throw new Error("Invalid arguments passed to jsPDF.line");return b===x?this.lines([[ee-w,oe-k]],w,k,[1,1],me||"S"):this.lines([[ee-w,oe-k]],w,k,[1,1]).stroke()},d.__private__.lines=d.lines=function(w,k,ee,oe,me,Me){var Ne,it,at,Tt,Ft,ni,Qi,Ln,Oi,kn,Cn,er;if(typeof w=="number"&&(er=ee,ee=k,k=w,w=er),oe=oe||[1,1],Me=Me||!1,isNaN(k)||isNaN(ee)||!Array.isArray(w)||!Array.isArray(oe)||!yo(me)||typeof Me!="boolean")throw new Error("Invalid arguments passed to jsPDF.lines");for(Ku(k,ee),Ne=oe[0],it=oe[1],Tt=w.length,kn=k,Cn=ee,at=0;at<Tt;at++)(Ft=w[at]).length===2?(kn=Ft[0]*Ne+kn,Cn=Ft[1]*it+Cn,Sg(kn,Cn)):(ni=Ft[0]*Ne+kn,Qi=Ft[1]*it+Cn,Ln=Ft[2]*Ne+kn,Oi=Ft[3]*it+Cn,kn=Ft[4]*Ne+kn,Cn=Ft[5]*it+Cn,Bs(ni,Qi,Ln,Oi,kn,Cn));return Me&&Eg(),Zl(me),this},d.path=function(w){for(var k=0;k<w.length;k++){var ee=w[k],oe=ee.c;switch(ee.op){case"m":Ku(oe[0],oe[1]);break;case"l":Sg(oe[0],oe[1]);break;case"c":Bs.apply(this,oe);break;case"h":Eg()}}return this},d.__private__.rect=d.rect=function(w,k,ee,oe,me){if(isNaN(w)||isNaN(k)||isNaN(ee)||isNaN(oe)||!yo(me))throw new Error("Invalid arguments passed to jsPDF.rect");return b===x&&(oe=-oe),j([R(C(w)),R(D(k)),R(C(ee)),R(C(oe)),"re"].join(" ")),Zl(me),this},d.__private__.triangle=d.triangle=function(w,k,ee,oe,me,Me,Ne){if(isNaN(w)||isNaN(k)||isNaN(ee)||isNaN(oe)||isNaN(me)||isNaN(Me)||!yo(Ne))throw new Error("Invalid arguments passed to jsPDF.triangle");return this.lines([[ee-w,oe-k],[me-ee,Me-oe],[w-me,k-Me]],w,k,[1,1],Ne,!0),this},d.__private__.roundedRect=d.roundedRect=function(w,k,ee,oe,me,Me,Ne){if(isNaN(w)||isNaN(k)||isNaN(ee)||isNaN(oe)||isNaN(me)||isNaN(Me)||!yo(Ne))throw new Error("Invalid arguments passed to jsPDF.roundedRect");var it=4/3*(Math.SQRT2-1);return me=Math.min(me,.5*ee),Me=Math.min(Me,.5*oe),this.lines([[ee-2*me,0],[me*it,0,me,Me-Me*it,me,Me],[0,oe-2*Me],[0,Me*it,-me*it,Me,-me,Me],[2*me-ee,0],[-me*it,0,-me,-Me*it,-me,-Me],[0,2*Me-oe],[0,-Me*it,me*it,-Me,me,-Me]],w+me,k,[1,1],Ne,!0),this},d.__private__.ellipse=d.ellipse=function(w,k,ee,oe,me){if(isNaN(w)||isNaN(k)||isNaN(ee)||isNaN(oe)||!yo(me))throw new Error("Invalid arguments passed to jsPDF.ellipse");var Me=4/3*(Math.SQRT2-1)*ee,Ne=4/3*(Math.SQRT2-1)*oe;return Ku(w+ee,k),Bs(w+ee,k-Ne,w+Me,k-oe,w,k-oe),Bs(w-Me,k-oe,w-ee,k-Ne,w-ee,k),Bs(w-ee,k+Ne,w-Me,k+oe,w,k+oe),Bs(w+Me,k+oe,w+ee,k+Ne,w+ee,k),Zl(me),this},d.__private__.circle=d.circle=function(w,k,ee,oe){if(isNaN(w)||isNaN(k)||isNaN(ee)||!yo(oe))throw new Error("Invalid arguments passed to jsPDF.circle");return this.ellipse(w,k,ee,ee,oe)},d.setFont=function(w,k,ee){return ee&&(k=N(k,ee)),qe=yg(w,k,{disableWarning:!1}),this};var o1=d.__private__.getFont=d.getFont=function(){return Lt[yg.apply(d,arguments)]};d.__private__.getFontList=d.getFontList=function(){var w,k,ee={};for(w in ht)if(ht.hasOwnProperty(w))for(k in ee[w]=[],ht[w])ht[w].hasOwnProperty(k)&&ee[w].push(k);return ee},d.addFont=function(w,k,ee,oe,me){var Me=["StandardEncoding","MacRomanEncoding","Identity-H","WinAnsiEncoding"];return arguments[3]&&Me.indexOf(arguments[3])!==-1?me=arguments[3]:arguments[3]&&Me.indexOf(arguments[3])==-1&&(ee=N(ee,oe)),gg.call(this,w,k,ee,me=me||"Identity-H")};var Jl,Yu=i.lineWidth||.200025,a1=d.__private__.getLineWidth=d.getLineWidth=function(){return Yu},Ct=d.__private__.setLineWidth=d.setLineWidth=function(w){return Yu=w,j(R(C(w))+" w"),this};d.__private__.setLineDash=ct.API.setLineDash=ct.API.setLineDashPattern=function(w,k){if(w=w||[],k=k||0,isNaN(k)||!Array.isArray(w))throw new Error("Invalid arguments passed to jsPDF.setLineDash");return w=w.map(function(ee){return R(C(ee))}).join(" "),k=R(C(k)),j("["+w+"] "+k+" d"),this};var l1=d.__private__.getLineHeight=d.getLineHeight=function(){return ge*Jl};d.__private__.getLineHeight=d.getLineHeight=function(){return ge*Jl};var c1=d.__private__.setLineHeightFactor=d.setLineHeightFactor=function(w){return typeof(w=w||1.15)=="number"&&(Jl=w),this},h1=d.__private__.getLineHeightFactor=d.getLineHeightFactor=function(){return Jl};c1(i.lineHeight);var ea=d.__private__.getHorizontalCoordinate=function(w){return C(w)},ta=d.__private__.getVerticalCoordinate=function(w){return b===S?w:gt[U].mediaBox.topRightY-gt[U].mediaBox.bottomLeftY-C(w)},u1=d.__private__.getHorizontalCoordinateString=d.getHorizontalCoordinateString=function(w){return R(ea(w))},f1=d.__private__.getVerticalCoordinateString=d.getVerticalCoordinateString=function(w){return R(ta(w))},ch=i.strokeColor||"0 G";d.__private__.getStrokeColor=d.getDrawColor=function(){return go(ch)},d.__private__.setStrokeColor=d.setDrawColor=function(w,k,ee,oe){return ch=ks({ch1:w,ch2:k,ch3:ee,ch4:oe,pdfColorType:"draw",precision:2}),j(ch),this};var Zu=i.fillColor||"0 g";d.__private__.getFillColor=d.getFillColor=function(){return go(Zu)},d.__private__.setFillColor=d.setFillColor=function(w,k,ee,oe){return Zu=ks({ch1:w,ch2:k,ch3:ee,ch4:oe,pdfColorType:"fill",precision:2}),j(Zu),this};var Ql=i.textColor||"0 g",d1=d.__private__.getTextColor=d.getTextColor=function(){return go(Ql)};d.__private__.setTextColor=d.setTextColor=function(w,k,ee,oe){return Ql=ks({ch1:w,ch2:k,ch3:ee,ch4:oe,pdfColorType:"text",precision:3}),this};var ia=i.charSpace,g1=d.__private__.getCharSpace=d.getCharSpace=function(){return parseFloat(ia||0)};d.__private__.setCharSpace=d.setCharSpace=function(w){if(isNaN(w))throw new Error("Invalid argument passed to jsPDF.setCharSpace");return ia=w,this};var Ju=0;d.CapJoinStyles={0:0,butt:0,but:0,miter:0,1:1,round:1,rounded:1,circle:1,2:2,projecting:2,project:2,square:2,bevel:2},d.__private__.setLineCap=d.setLineCap=function(w){var k=d.CapJoinStyles[w];if(k===void 0)throw new Error("Line cap style of '"+w+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return Ju=k,j(k+" J"),this};var Qu=0;d.__private__.setLineJoin=d.setLineJoin=function(w){var k=d.CapJoinStyles[w];if(k===void 0)throw new Error("Line join style of '"+w+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return Qu=k,j(k+" j"),this},d.__private__.setLineMiterLimit=d.__private__.setMiterLimit=d.setLineMiterLimit=d.setMiterLimit=function(w){if(w=w||0,isNaN(w))throw new Error("Invalid argument passed to jsPDF.setLineMiterLimit");return j(R(C(w))+" M"),this},d.GState=nm,d.setGState=function(w){(w=typeof w=="string"?dt[xt[w]]:Tg(null,w)).equals(di)||(j("/"+w.id+" gs"),di=w)};var Tg=function(w,k){if(!w||!xt[w]){var ee=!1;for(var oe in dt)if(dt.hasOwnProperty(oe)&&dt[oe].equals(k)){ee=!0;break}if(ee)k=dt[oe];else{var me="GS"+(Object.keys(dt).length+1).toString(10);dt[me]=k,k.id=me}return w&&(xt[w]=k.id),ii.publish("addGState",k),k}};d.addGState=function(w,k){return Tg(w,k),this},d.saveGraphicsState=function(){return j("q"),Ut.push({key:qe,size:ge,color:Ql}),this},d.restoreGraphicsState=function(){j("Q");var w=Ut.pop();return qe=w.key,ge=w.size,Ql=w.color,di=null,this},d.setCurrentTransformationMatrix=function(w){return j(w.toString()+" cm"),this},d.comment=function(w){return j("#"+w),this};var na=function(w,k){var ee=w||0;Object.defineProperty(this,"x",{enumerable:!0,get:function(){return ee},set:function(Me){isNaN(Me)||(ee=parseFloat(Me))}});var oe=k||0;Object.defineProperty(this,"y",{enumerable:!0,get:function(){return oe},set:function(Me){isNaN(Me)||(oe=parseFloat(Me))}});var me="pt";return Object.defineProperty(this,"type",{enumerable:!0,get:function(){return me},set:function(Me){me=Me.toString()}}),this},ef=function(w,k,ee,oe){na.call(this,w,k),this.type="rect";var me=ee||0;Object.defineProperty(this,"w",{enumerable:!0,get:function(){return me},set:function(Ne){isNaN(Ne)||(me=parseFloat(Ne))}});var Me=oe||0;return Object.defineProperty(this,"h",{enumerable:!0,get:function(){return Me},set:function(Ne){isNaN(Ne)||(Me=parseFloat(Ne))}}),this},hh=function(){this.page=At,this.currentPage=U,this.pages=Ce.slice(0),this.pagesContext=gt.slice(0),this.x=$e,this.y=Jt,this.matrix=Ot,this.width=nf(U),this.height=Cg(U),this.outputDestination=Z,this.id="",this.objectNumber=-1};hh.prototype.restore=function(){At=this.page,U=this.currentPage,gt=this.pagesContext,Ce=this.pages,$e=this.x,Jt=this.y,Ot=this.matrix,Lg(U,this.width),ra(U,this.height),Z=this.outputDestination};var tf=function(w,k,ee,oe,me){hn.push(new hh),At=U=0,Ce=[],$e=w,Jt=k,Ot=me,Hu([ee,oe])};for(var ec in d.beginFormObject=function(w,k,ee,oe,me){return tf(w,k,ee,oe,me),this},d.endFormObject=function(w){return(function(k){if(rn[k])hn.pop().restore();else{var ee=new hh,oe="Xo"+(Object.keys(Ki).length+1).toString(10);ee.id=oe,rn[k]=oe,Ki[oe]=ee,ii.publish("addFormObject",ee),hn.pop().restore()}})(w),this},d.doFormObject=function(w,k){var ee=Ki[rn[w]];return j("q"),j(k.toString()+" cm"),j("/"+ee.id+" Do"),j("Q"),this},d.getFormObject=function(w){var k=Ki[rn[w]];return{x:k.x,y:k.y,width:k.width,height:k.height,matrix:k.matrix}},d.save=function(w,k){return w=w||"generated.pdf",(k=k||{}).returnPromise=k.returnPromise||!1,k.returnPromise===!1?(xc(ah(_o()),w),typeof xc.unload=="function"&&Et.setTimeout&&setTimeout(xc.unload,911),this):new Promise(function(ee,oe){try{var me=xc(ah(_o()),w);typeof xc.unload=="function"&&Et.setTimeout&&setTimeout(xc.unload,911),ee(me)}catch(Me){oe(Me.message)}})},ct.API)ct.API.hasOwnProperty(ec)&&(ec==="events"&&ct.API.events.length?(function(w,k){var ee,oe,me;for(me=k.length-1;me!==-1;me--)ee=k[me][0],oe=k[me][1],w.subscribe.apply(w,[ee].concat(typeof oe=="function"?[oe]:oe))})(ii,ct.API.events):d[ec]=ct.API[ec]);function nf(w){return gt[w].mediaBox.topRightX-gt[w].mediaBox.bottomLeftX}function Lg(w,k){gt[w].mediaBox.topRightX=k+gt[w].mediaBox.bottomLeftX}function Cg(w){return gt[w].mediaBox.topRightY-gt[w].mediaBox.bottomLeftY}function ra(w,k){gt[w].mediaBox.topRightY=k+gt[w].mediaBox.bottomLeftY}var sa=d.getPageWidth=function(w){return nf(w=w||U)/st},Ag=d.setPageWidth=function(w,k){Lg(w,k*st)},tc=d.getPageHeight=function(w){return Cg(w=w||U)/st},Pg=d.setPageHeight=function(w,k){ra(w,k*st)};return d.internal={pdfEscape:vs,getStyle:bg,getFont:o1,getFontSize:_e,getCharSpace:g1,getTextColor:d1,getLineHeight:l1,getLineHeightFactor:h1,getLineWidth:a1,write:fe,getHorizontalCoordinate:ea,getVerticalCoordinate:ta,getCoordinateString:u1,getVerticalCoordinateString:f1,collections:{},newObject:si,newAdditionalObject:Xl,newObjectDeferred:Sn,newObjectDeferredBegin:Qn,getFilters:Gs,putStream:ys,events:ii,scaleFactor:st,pageSize:{getWidth:function(){return sa(U)},setWidth:function(w){Ag(U,w)},getHeight:function(){return tc(U)},setHeight:function(w){Pg(U,w)}},encryptionOptions:h,encryption:Dn,getEncryptor:function(w){return h!==null?Dn.encryptor(w,0):function(k){return k}},output:xg,getNumberOfPages:_g,get pages(){return Ce},out:j,f2:L,f3:T,getPageInfo:Qo,getPageInfoByObjId:wg,getCurrentPageInfo:t1,getPDFVersion:m,Point:na,Rectangle:ef,Matrix:tt,hasHotfix:xs},Object.defineProperty(d.internal.pageSize,"width",{get:function(){return sa(U)},set:function(w){Ag(U,w)},enumerable:!0,configurable:!0}),Object.defineProperty(d.internal.pageSize,"height",{get:function(){return tc(U)},set:function(w){Pg(U,w)},enumerable:!0,configurable:!0}),(function(w){for(var k=0,ee=Le.length;k<ee;k++){var oe=gg.call(this,w[k][0],w[k][1],w[k][2],Le[k][3],!0);u===!1&&(f[oe]=!0);var me=w[k][0].split("-");dg({id:oe,fontName:me[0],fontStyle:me[1]||""})}ii.publish("addFonts",{fonts:Lt,dictionary:ht})}).call(d,Le),qe="F1",pg(r,t),ii.publish("initialized"),d}Uh.prototype.lsbFirstWord=function(i){return String.fromCharCode(255&i,i>>8&255,i>>16&255,i>>24&255)},Uh.prototype.toHexString=function(i){return i.split("").map(function(e){return("0"+(255&e.charCodeAt(0)).toString(16)).slice(-2)}).join("")},Uh.prototype.hexToBytes=function(i){for(var e=[],t=0;t<i.length;t+=2)e.push(String.fromCharCode(parseInt(i.substr(t,2),16)));return e.join("")},Uh.prototype.processOwnerPassword=function(i,e){return dv(fv(e).substr(0,5),i)},Uh.prototype.encryptor=function(i,e){var t=fv(this.encryptionKey+String.fromCharCode(255&i,i>>8&255,i>>16&255,255&e,e>>8&255)).substr(0,10);return function(n){return dv(t,n)}},nm.prototype.equals=function(i){var e,t="id,objectNumber,equals";if(!i||bi(i)!==bi(this))return!1;var n=0;for(e in this)if(!(t.indexOf(e)>=0)){if(this.hasOwnProperty(e)&&!i.hasOwnProperty(e)||this[e]!==i[e])return!1;n++}for(e in i)i.hasOwnProperty(e)&&t.indexOf(e)<0&&n--;return n===0},ct.API={events:[]},ct.version="4.2.0";var an=ct.API,L5=1,Qc=function(i){return i.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},Rh=function(i){return i.replace(/\\\\/g,"\\").replace(/\\\(/g,"(").replace(/\\\)/g,")")},zc=function(i){return i.toString().replace(/#/g,"#23").replace(/[\s\n\r()<>[\]{}\/%]/g,function(e){var t=e.charCodeAt(0).toString(16).toUpperCase();return"#"+(t.length===1?"0"+t:t)})},Pt=function(i){return i.toFixed(2)},_l=function(i){return i.toFixed(5)};an.__acroform__={};var es=function(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i},K2=function(i){return i*L5},Ao=function(i){var e=new ZP,t=Je.internal.getHeight(i)||0,n=Je.internal.getWidth(i)||0;return e.BBox=[0,0,Number(Pt(n)),Number(Pt(t))],e},VV=an.__acroform__.setBit=function(i,e){if(i=i||0,e=e||0,isNaN(i)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBit");return i|1<<e},$V=an.__acroform__.clearBit=function(i,e){if(i=i||0,e=e||0,isNaN(i)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBit");return i&~(1<<e)},WV=an.__acroform__.getBit=function(i,e){if(isNaN(i)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBit");return i&1<<e?1:0},_n=an.__acroform__.getBitForPdf=function(i,e){if(isNaN(i)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBitForPdf");return WV(i,e-1)},yn=an.__acroform__.setBitForPdf=function(i,e){if(isNaN(i)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBitForPdf");return VV(i,e-1)},vn=an.__acroform__.clearBitForPdf=function(i,e){if(isNaN(i)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBitForPdf");return $V(i,e-1)},HV=an.__acroform__.calculateCoordinates=function(i,e){var t=e.internal.getHorizontalCoordinate,n=e.internal.getVerticalCoordinate,r=i[0],s=i[1],o=i[2],a=i[3],l={};return l.lowerLeft_X=t(r)||0,l.lowerLeft_Y=n(s+a)||0,l.upperRight_X=t(r+o)||0,l.upperRight_Y=n(s)||0,[Number(Pt(l.lowerLeft_X)),Number(Pt(l.lowerLeft_Y)),Number(Pt(l.upperRight_X)),Number(Pt(l.upperRight_Y))]},XV=function(i){if(i.appearanceStreamContent)return i.appearanceStreamContent;if(i.V||i.DV){var e=[],t=i._V||i.DV,n=gv(i,t),r=i.scope.internal.getFont(i.fontName,i.fontStyle).id;e.push("/Tx BMC"),e.push("q"),e.push("BT"),e.push(i.scope.__private__.encodeColorString(i.color)),e.push("/"+r+" "+Pt(n.fontSize)+" Tf"),e.push("1 0 0 1 0 0 Tm"),e.push(n.text),e.push("ET"),e.push("Q"),e.push("EMC");var s=Ao(i);return s.scope=i.scope,s.stream=e.join(`
751
- `),s}},gv=function(i,e){var t=i.fontSize===0?i.maxFontSize:i.fontSize,n={text:"",fontSize:""},r=(e=(e=e.substr(0,1)=="("?e.substr(1):e).substr(e.length-1)==")"?e.substr(0,e.length-1):e).split(" ");r=i.multiline?r.map(function(L){return L.split(`
752
- `)}):r.map(function(L){return[L]});var s=t,o=Je.internal.getHeight(i)||0;o=o<0?-o:o;var a=Je.internal.getWidth(i)||0;a=a<0?-a:a;var l=function(L,T,C){if(L+1<r.length){var D=T+" "+r[L+1][0];return kp(D,i,C).width<=a-4}return!1};s++;e:for(;s>0;){e="",s--;var c,h,u=kp("3",i,s).height,f=i.multiline?o-s:(o-u)/2,d=f+=2,g=0,m=0,_=0;if(s<=0){e=`(...) Tj
753
- `,e+="% Width of Text: "+kp(e,i,s=12).width+", FieldWidth:"+a+`
754
- `;break}for(var v="",x=0,S=0;S<r.length;S++)if(r.hasOwnProperty(S)){var b=!1;if(r[S].length!==1&&_!==r[S].length-1){if((u+2)*(x+2)+2>o)continue e;v+=r[S][_],b=!0,m=S,S--}else{v=(v+=r[S][_]+" ").substr(v.length-1)==" "?v.substr(0,v.length-1):v;var A=parseInt(S),F=l(A,v,s),N=S>=r.length-1;if(F&&!N){v+=" ",_=0;continue}if(F||N){if(N)m=A;else if(i.multiline&&(u+2)*(x+2)+2>o)continue e}else{if(!i.multiline||(u+2)*(x+2)+2>o)continue e;m=A}}for(var R="",P=g;P<=m;P++){var O=r[P];if(i.multiline){if(P===m){R+=O[_]+" ",_=(_+1)%O.length;continue}if(P===g){R+=O[O.length-1]+" ";continue}}R+=O[0]+" "}switch(R=R.substr(R.length-1)==" "?R.substr(0,R.length-1):R,h=kp(R,i,s).width,i.textAlign){case"right":c=a-h-2;break;case"center":c=(a-h)/2;break;default:c=2}e+=Pt(c)+" "+Pt(d)+` Td
755
- `,e+="("+Qc(R)+`) Tj
756
- `,e+=-Pt(c)+` 0 Td
757
- `,d=-(s+2),h=0,g=b?m:m+1,x++,v=""}break}return n.text=e,n.fontSize=s,n},kp=function(i,e,t){var n=e.scope.internal.getFont(e.fontName,e.fontStyle),r=e.scope.getStringUnitWidth(i,{font:n,fontSize:parseFloat(t),charSpace:0})*parseFloat(t);return{height:e.scope.getStringUnitWidth("3",{font:n,fontSize:parseFloat(t),charSpace:0})*parseFloat(t)*1.5,width:r}},KV={fields:[],xForms:[],acroFormDictionaryRoot:null,printedOut:!1,internal:null,isInitialized:!1},YV=function(i,e){var t={type:"reference",object:i};e.internal.getPageInfo(i.page).pageContext.annotations.find(function(n){return n.type===t.type&&n.object===t.object})===void 0&&e.internal.getPageInfo(i.page).pageContext.annotations.push(t)},ZV=function(i,e){if(e.scope=i,i.internal!==void 0&&(i.internal.acroformPlugin===void 0||i.internal.acroformPlugin.isInitialized===!1)){if(uo.FieldNum=0,i.internal.acroformPlugin=JSON.parse(JSON.stringify(KV)),i.internal.acroformPlugin.acroFormDictionaryRoot)throw new Error("Exception while creating AcroformDictionary");L5=i.internal.scaleFactor,i.internal.acroformPlugin.acroFormDictionaryRoot=new JP,i.internal.acroformPlugin.acroFormDictionaryRoot.scope=i,i.internal.acroformPlugin.acroFormDictionaryRoot._eventID=i.internal.events.subscribe("postPutResources",function(){(function(t){t.internal.events.unsubscribe(t.internal.acroformPlugin.acroFormDictionaryRoot._eventID),delete t.internal.acroformPlugin.acroFormDictionaryRoot._eventID,t.internal.acroformPlugin.printedOut=!0})(i)}),i.internal.events.subscribe("buildDocument",function(){(function(t){t.internal.acroformPlugin.acroFormDictionaryRoot.objId=void 0;var n=t.internal.acroformPlugin.acroFormDictionaryRoot.Fields;for(var r in n)if(n.hasOwnProperty(r)){var s=n[r];s.objId=void 0,s.hasAnnotation&&YV(s,t)}})(i)}),i.internal.events.subscribe("putCatalog",function(){(function(t){if(t.internal.acroformPlugin.acroFormDictionaryRoot===void 0)throw new Error("putCatalogCallback: Root missing.");t.internal.write("/AcroForm "+t.internal.acroformPlugin.acroFormDictionaryRoot.objId+" 0 R")})(i)}),i.internal.events.subscribe("postPutPages",function(t){(function(n,r){var s=!n;for(var o in n||(r.internal.newObjectDeferredBegin(r.internal.acroformPlugin.acroFormDictionaryRoot.objId,!0),r.internal.acroformPlugin.acroFormDictionaryRoot.putStream()),n=n||r.internal.acroformPlugin.acroFormDictionaryRoot.Kids)if(n.hasOwnProperty(o)){var a=n[o],l=[],c=a.Rect;if(a.Rect&&(a.Rect=HV(a.Rect,r)),r.internal.newObjectDeferredBegin(a.objId,!0),a.DA=Je.createDefaultAppearanceStream(a),bi(a)==="object"&&typeof a.getKeyValueListForStream=="function"&&(l=a.getKeyValueListForStream()),a.Rect=c,a.hasAppearanceStream&&!a.appearanceStreamContent){var h=XV(a);l.push({key:"AP",value:"<</N "+h+">>"}),r.internal.acroformPlugin.xForms.push(h)}if(a.appearanceStreamContent){var u="";for(var f in a.appearanceStreamContent)if(a.appearanceStreamContent.hasOwnProperty(f)){var d=a.appearanceStreamContent[f];if(u+="/"+f+" ",u+="<<",Object.keys(d).length>=1||Array.isArray(d)){for(var o in d)if(d.hasOwnProperty(o)){var g=d[o];typeof g=="function"&&(g=g.call(r,a)),u+="/"+o+" "+g+" ",r.internal.acroformPlugin.xForms.indexOf(g)>=0||r.internal.acroformPlugin.xForms.push(g)}}else typeof(g=d)=="function"&&(g=g.call(r,a)),u+="/"+o+" "+g,r.internal.acroformPlugin.xForms.indexOf(g)>=0||r.internal.acroformPlugin.xForms.push(g);u+=">>"}l.push({key:"AP",value:`<<
758
- `+u+">>"})}r.internal.putStream({additionalKeyValues:l,objectId:a.objId}),r.internal.out("endobj")}s&&(function(m,_){for(var v in m)if(m.hasOwnProperty(v)){var x=v,S=m[v];_.internal.newObjectDeferredBegin(S.objId,!0),bi(S)==="object"&&typeof S.putStream=="function"&&S.putStream(),delete m[x]}})(r.internal.acroformPlugin.xForms,r)})(t,i)}),i.internal.acroformPlugin.isInitialized=!0}},YP=an.__acroform__.arrayToPdfArray=function(i,e,t){var n=function(o){return o};if(Array.isArray(i)){for(var r="[",s=0;s<i.length;s++)switch(s!==0&&(r+=" "),bi(i[s])){case"boolean":case"number":case"object":r+=i[s].toString();break;case"string":i[s].substr(0,1)==="/"?r+="/"+zc(i[s].substr(1)):(e!==void 0&&t&&(n=t.internal.getEncryptor(e)),r+="("+Qc(n(i[s].toString()))+")")}return r+"]"}throw new Error("Invalid argument passed to jsPDF.__acroform__.arrayToPdfArray")},ey=function(i,e,t){var n=function(r){return r};return e!==void 0&&t&&(n=t.internal.getEncryptor(e)),(i=i||"").toString(),"("+Qc(n(i))+")"},ko=function(){this._objId=void 0,this._scope=void 0,Object.defineProperty(this,"objId",{get:function(){if(this._objId===void 0){if(this.scope===void 0)return;this._objId=this.scope.internal.newObjectDeferred()}return this._objId},set:function(i){this._objId=i}}),Object.defineProperty(this,"scope",{value:this._scope,writable:!0})};ko.prototype.toString=function(){return this.objId+" 0 R"},ko.prototype.putStream=function(){var i=this.getKeyValueListForStream();this.scope.internal.putStream({data:this.stream,additionalKeyValues:i,objectId:this.objId}),this.scope.internal.out("endobj")},ko.prototype.getKeyValueListForStream=function(){var i=[],e=Object.getOwnPropertyNames(this).filter(function(s){return s!="content"&&s!="appearanceStreamContent"&&s!="scope"&&s!="objId"&&s.substring(0,1)!="_"});for(var t in e)if(Object.getOwnPropertyDescriptor(this,e[t]).configurable===!1){var n=e[t],r=this[n];r&&(Array.isArray(r)?i.push({key:n,value:YP(r,this.objId,this.scope)}):r instanceof ko?(r.scope=this.scope,i.push({key:n,value:r.objId+" 0 R"})):typeof r!="function"&&i.push({key:n,value:r}))}return i};var ZP=function(){ko.call(this),Object.defineProperty(this,"Type",{value:"/XObject",configurable:!1,writable:!0}),Object.defineProperty(this,"Subtype",{value:"/Form",configurable:!1,writable:!0}),Object.defineProperty(this,"FormType",{value:1,configurable:!1,writable:!0});var i,e=[];Object.defineProperty(this,"BBox",{configurable:!1,get:function(){return e},set:function(t){e=t}}),Object.defineProperty(this,"Resources",{value:"2 0 R",configurable:!1,writable:!0}),Object.defineProperty(this,"stream",{enumerable:!1,configurable:!0,set:function(t){i=t.trim()},get:function(){return i||null}})};es(ZP,ko);var JP=function(){ko.call(this);var i,e=[];Object.defineProperty(this,"Kids",{enumerable:!1,configurable:!0,get:function(){return e.length>0?e:void 0}}),Object.defineProperty(this,"Fields",{enumerable:!1,configurable:!1,get:function(){return e}}),Object.defineProperty(this,"DA",{enumerable:!1,configurable:!1,get:function(){if(i){var t=function(n){return n};return this.scope&&(t=this.scope.internal.getEncryptor(this.objId)),"("+Qc(t(i))+")"}},set:function(t){i=t}})};es(JP,ko);var uo=function i(){ko.call(this);var e=4;Object.defineProperty(this,"F",{enumerable:!1,configurable:!1,get:function(){return e},set:function(v){if(isNaN(v))throw new Error('Invalid value "'+v+'" for attribute F supplied.');e=v}}),Object.defineProperty(this,"showWhenPrinted",{enumerable:!0,configurable:!0,get:function(){return!!_n(e,3)},set:function(v){v?this.F=yn(e,3):this.F=vn(e,3)}});var t=0;Object.defineProperty(this,"Ff",{enumerable:!1,configurable:!1,get:function(){return t},set:function(v){if(isNaN(v))throw new Error('Invalid value "'+v+'" for attribute Ff supplied.');t=v}});var n=[];Object.defineProperty(this,"Rect",{enumerable:!1,configurable:!1,get:function(){if(n.length!==0)return n},set:function(v){n=v!==void 0?v:[]}}),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,get:function(){return!n||isNaN(n[0])?0:n[0]},set:function(v){n[0]=v}}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,get:function(){return!n||isNaN(n[1])?0:n[1]},set:function(v){n[1]=v}}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,get:function(){return!n||isNaN(n[2])?0:n[2]},set:function(v){n[2]=v}}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,get:function(){return!n||isNaN(n[3])?0:n[3]},set:function(v){n[3]=v}});var r="";Object.defineProperty(this,"FT",{enumerable:!0,configurable:!1,get:function(){return r},set:function(v){switch(v){case"/Btn":case"/Tx":case"/Ch":case"/Sig":r=v;break;default:throw new Error('Invalid value "'+v+'" for attribute FT supplied.')}}});var s=null;Object.defineProperty(this,"T",{enumerable:!0,configurable:!1,get:function(){if(!s||s.length<1){if(this instanceof rm)return;s="FieldObject"+i.FieldNum++}var v=function(x){return x};return this.scope&&(v=this.scope.internal.getEncryptor(this.objId)),"("+Qc(v(s))+")"},set:function(v){s=v.toString()}}),Object.defineProperty(this,"fieldName",{configurable:!0,enumerable:!0,get:function(){return s},set:function(v){s=v}});var o="helvetica";Object.defineProperty(this,"fontName",{enumerable:!0,configurable:!0,get:function(){return o},set:function(v){o=v}});var a="normal";Object.defineProperty(this,"fontStyle",{enumerable:!0,configurable:!0,get:function(){return a},set:function(v){a=v}});var l=0;Object.defineProperty(this,"fontSize",{enumerable:!0,configurable:!0,get:function(){return l},set:function(v){l=v}});var c=void 0;Object.defineProperty(this,"maxFontSize",{enumerable:!0,configurable:!0,get:function(){return c===void 0?50/L5:c},set:function(v){c=v}});var h="black";Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,get:function(){return h},set:function(v){h=v}});var u="/F1 0 Tf 0 g";Object.defineProperty(this,"DA",{enumerable:!0,configurable:!1,get:function(){if(!(!u||this instanceof rm||this instanceof Nc))return ey(u,this.objId,this.scope)},set:function(v){v=v.toString(),u=v}});var f=null;Object.defineProperty(this,"DV",{enumerable:!1,configurable:!1,get:function(){if(f)return this instanceof Hn==0?ey(f,this.objId,this.scope):f},set:function(v){v=v.toString(),f=this instanceof Hn==0?v.substr(0,1)==="("?Rh(v.substr(1,v.length-2)):Rh(v):v}}),Object.defineProperty(this,"defaultValue",{enumerable:!0,configurable:!0,get:function(){return this instanceof Hn==1?Rh(f.substr(1,f.length-1)):f},set:function(v){v=v.toString(),f=this instanceof Hn==1?"/"+zc(v):v}});var d=null;Object.defineProperty(this,"_V",{enumerable:!1,configurable:!1,get:function(){if(d)return d},set:function(v){this.V=v}}),Object.defineProperty(this,"V",{enumerable:!1,configurable:!1,get:function(){if(d)return this instanceof Hn==0?ey(d,this.objId,this.scope):d},set:function(v){v=v.toString(),d=this instanceof Hn==0?v.substr(0,1)==="("?Rh(v.substr(1,v.length-2)):Rh(v):v}}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,get:function(){return this instanceof Hn==1?Rh(d.substr(1,d.length-1)):d},set:function(v){v=v.toString(),d=this instanceof Hn==1?"/"+zc(v):v}}),Object.defineProperty(this,"hasAnnotation",{enumerable:!0,configurable:!0,get:function(){return this.Rect}}),Object.defineProperty(this,"Type",{enumerable:!0,configurable:!1,get:function(){return this.hasAnnotation?"/Annot":null}}),Object.defineProperty(this,"Subtype",{enumerable:!0,configurable:!1,get:function(){return this.hasAnnotation?"/Widget":null}});var g,m=!1;Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return m},set:function(v){v=!!v,m=v}}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,get:function(){if(g)return g},set:function(v){g=v}}),Object.defineProperty(this,"readOnly",{enumerable:!0,configurable:!0,get:function(){return!!_n(this.Ff,1)},set:function(v){v?this.Ff=yn(this.Ff,1):this.Ff=vn(this.Ff,1)}}),Object.defineProperty(this,"required",{enumerable:!0,configurable:!0,get:function(){return!!_n(this.Ff,2)},set:function(v){v?this.Ff=yn(this.Ff,2):this.Ff=vn(this.Ff,2)}}),Object.defineProperty(this,"noExport",{enumerable:!0,configurable:!0,get:function(){return!!_n(this.Ff,3)},set:function(v){v?this.Ff=yn(this.Ff,3):this.Ff=vn(this.Ff,3)}});var _=null;Object.defineProperty(this,"Q",{enumerable:!0,configurable:!1,get:function(){if(_!==null)return _},set:function(v){if([0,1,2].indexOf(v)===-1)throw new Error('Invalid value "'+v+'" for attribute Q supplied.');_=v}}),Object.defineProperty(this,"textAlign",{get:function(){var v;switch(_){case 0:default:v="left";break;case 1:v="center";break;case 2:v="right"}return v},configurable:!0,enumerable:!0,set:function(v){switch(v){case"right":case 2:_=2;break;case"center":case 1:_=1;break;default:_=0}}})};es(uo,ko);var _u=function(){uo.call(this),this.FT="/Ch",this.V="()",this.fontName="zapfdingbats";var i=0;Object.defineProperty(this,"TI",{enumerable:!0,configurable:!1,get:function(){return i},set:function(t){i=t}}),Object.defineProperty(this,"topIndex",{enumerable:!0,configurable:!0,get:function(){return i},set:function(t){i=t}});var e=[];Object.defineProperty(this,"Opt",{enumerable:!0,configurable:!1,get:function(){return YP(e,this.objId,this.scope)},set:function(t){var n,r;r=[],typeof(n=t)=="string"&&(r=(function(s,o,a){a||(a=1);for(var l,c=[];l=o.exec(s);)c.push(l[a]);return c})(n,/\((.*?)\)/g)),e=r}}),this.getOptions=function(){return e},this.setOptions=function(t){e=t,this.sort&&e.sort()},this.addOption=function(t){t=(t=t||"").toString(),e.push(t),this.sort&&e.sort()},this.removeOption=function(t,n){for(n=n||!1,t=(t=t||"").toString();e.indexOf(t)!==-1&&(e.splice(e.indexOf(t),1),n!==!1););},Object.defineProperty(this,"combo",{enumerable:!0,configurable:!0,get:function(){return!!_n(this.Ff,18)},set:function(t){t?this.Ff=yn(this.Ff,18):this.Ff=vn(this.Ff,18)}}),Object.defineProperty(this,"edit",{enumerable:!0,configurable:!0,get:function(){return!!_n(this.Ff,19)},set:function(t){this.combo===!0&&(t?this.Ff=yn(this.Ff,19):this.Ff=vn(this.Ff,19))}}),Object.defineProperty(this,"sort",{enumerable:!0,configurable:!0,get:function(){return!!_n(this.Ff,20)},set:function(t){t?(this.Ff=yn(this.Ff,20),e.sort()):this.Ff=vn(this.Ff,20)}}),Object.defineProperty(this,"multiSelect",{enumerable:!0,configurable:!0,get:function(){return!!_n(this.Ff,22)},set:function(t){t?this.Ff=yn(this.Ff,22):this.Ff=vn(this.Ff,22)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!_n(this.Ff,23)},set:function(t){t?this.Ff=yn(this.Ff,23):this.Ff=vn(this.Ff,23)}}),Object.defineProperty(this,"commitOnSelChange",{enumerable:!0,configurable:!0,get:function(){return!!_n(this.Ff,27)},set:function(t){t?this.Ff=yn(this.Ff,27):this.Ff=vn(this.Ff,27)}}),this.hasAppearanceStream=!1};es(_u,uo);var yu=function(){_u.call(this),this.fontName="helvetica",this.combo=!1};es(yu,_u);var vu=function(){yu.call(this),this.combo=!0};es(vu,yu);var t0=function(){vu.call(this),this.edit=!0};es(t0,vu);var Hn=function(){uo.call(this),this.FT="/Btn",Object.defineProperty(this,"noToggleToOff",{enumerable:!0,configurable:!0,get:function(){return!!_n(this.Ff,15)},set:function(t){t?this.Ff=yn(this.Ff,15):this.Ff=vn(this.Ff,15)}}),Object.defineProperty(this,"radio",{enumerable:!0,configurable:!0,get:function(){return!!_n(this.Ff,16)},set:function(t){t?this.Ff=yn(this.Ff,16):this.Ff=vn(this.Ff,16)}}),Object.defineProperty(this,"pushButton",{enumerable:!0,configurable:!0,get:function(){return!!_n(this.Ff,17)},set:function(t){t?this.Ff=yn(this.Ff,17):this.Ff=vn(this.Ff,17)}}),Object.defineProperty(this,"radioIsUnison",{enumerable:!0,configurable:!0,get:function(){return!!_n(this.Ff,26)},set:function(t){t?this.Ff=yn(this.Ff,26):this.Ff=vn(this.Ff,26)}});var i,e={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var t=function(s){return s};if(this.scope&&(t=this.scope.internal.getEncryptor(this.objId)),Object.keys(e).length!==0){var n,r=[];for(n in r.push("<<"),e)r.push("/"+n+" ("+Qc(t(e[n]))+")");return r.push(">>"),r.join(`
759
- `)}},set:function(t){bi(t)==="object"&&(e=t)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return e.CA||""},set:function(t){typeof t=="string"&&(e.CA=t)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return i},set:function(t){var n=t==null?"":t.toString();n.substr(0,1)==="/"&&(n=n.substr(1)),i="/"+zc(n)}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return i.substr(1,i.length-1)},set:function(t){i="/"+zc(t)}})};es(Hn,uo);var i0=function(){Hn.call(this),this.pushButton=!0};es(i0,Hn);var xu=function(){Hn.call(this),this.radio=!0,this.pushButton=!1;var i=[];Object.defineProperty(this,"Kids",{enumerable:!0,configurable:!1,get:function(){return i},set:function(e){i=e!==void 0?e:[]}})};es(xu,Hn);var rm=function(){var i,e;uo.call(this),Object.defineProperty(this,"Parent",{enumerable:!1,configurable:!1,get:function(){return i},set:function(r){i=r}}),Object.defineProperty(this,"optionName",{enumerable:!1,configurable:!0,get:function(){return e},set:function(r){e=r}});var t,n={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var r=function(a){return a};this.scope&&(r=this.scope.internal.getEncryptor(this.objId));var s,o=[];for(s in o.push("<<"),n)o.push("/"+s+" ("+Qc(r(n[s]))+")");return o.push(">>"),o.join(`
760
- `)},set:function(r){bi(r)==="object"&&(n=r)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return n.CA||""},set:function(r){typeof r=="string"&&(n.CA=r)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return t},set:function(r){var s=r==null?"":r.toString();s.substr(0,1)==="/"&&(s=s.substr(1)),t="/"+zc(s)}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return t.substr(1,t.length-1)},set:function(r){var s=r==null?"":r.toString();s.substr(0,1)==="/"&&(s=s.substr(1)),t="/"+zc(s)}}),this.caption="l",this.appearanceState="Off",this._AppearanceType=Je.RadioButton.Circle,this.appearanceStreamContent=this._AppearanceType.createAppearanceStream(this.optionName)};es(rm,uo),xu.prototype.setAppearance=function(i){if(!("createAppearanceStream"in i)||!("getCA"in i))throw new Error("Couldn't assign Appearance to RadioButton. Appearance was Invalid!");for(var e in this.Kids)if(this.Kids.hasOwnProperty(e)){var t=this.Kids[e];t.appearanceStreamContent=i.createAppearanceStream(t.optionName),t.caption=i.getCA()}},xu.prototype.createOption=function(i){var e=new rm;return e.Parent=this,e.optionName=i,this.Kids.push(e),JV.call(this.scope,e),e};var n0=function(){Hn.call(this),this.fontName="zapfdingbats",this.caption="3",this.appearanceState="On",this.value="On",this.textAlign="center",this.appearanceStreamContent=Je.CheckBox.createAppearanceStream()};es(n0,Hn);var Nc=function(){uo.call(this),this.FT="/Tx",Object.defineProperty(this,"multiline",{enumerable:!0,configurable:!0,get:function(){return!!_n(this.Ff,13)},set:function(e){e?this.Ff=yn(this.Ff,13):this.Ff=vn(this.Ff,13)}}),Object.defineProperty(this,"fileSelect",{enumerable:!0,configurable:!0,get:function(){return!!_n(this.Ff,21)},set:function(e){e?this.Ff=yn(this.Ff,21):this.Ff=vn(this.Ff,21)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!_n(this.Ff,23)},set:function(e){e?this.Ff=yn(this.Ff,23):this.Ff=vn(this.Ff,23)}}),Object.defineProperty(this,"doNotScroll",{enumerable:!0,configurable:!0,get:function(){return!!_n(this.Ff,24)},set:function(e){e?this.Ff=yn(this.Ff,24):this.Ff=vn(this.Ff,24)}}),Object.defineProperty(this,"comb",{enumerable:!0,configurable:!0,get:function(){return!!_n(this.Ff,25)},set:function(e){e?this.Ff=yn(this.Ff,25):this.Ff=vn(this.Ff,25)}}),Object.defineProperty(this,"richText",{enumerable:!0,configurable:!0,get:function(){return!!_n(this.Ff,26)},set:function(e){e?this.Ff=yn(this.Ff,26):this.Ff=vn(this.Ff,26)}});var i=null;Object.defineProperty(this,"MaxLen",{enumerable:!0,configurable:!1,get:function(){return i},set:function(e){i=e}}),Object.defineProperty(this,"maxLength",{enumerable:!0,configurable:!0,get:function(){return i},set:function(e){Number.isInteger(e)&&(i=e)}}),Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return this.V||this.DV}})};es(Nc,uo);var r0=function(){Nc.call(this),Object.defineProperty(this,"password",{enumerable:!0,configurable:!0,get:function(){return!!_n(this.Ff,14)},set:function(i){i?this.Ff=yn(this.Ff,14):this.Ff=vn(this.Ff,14)}}),this.password=!0};es(r0,Nc);var Je={CheckBox:{createAppearanceStream:function(){return{N:{On:Je.CheckBox.YesNormal},D:{On:Je.CheckBox.YesPushDown,Off:Je.CheckBox.OffPushDown}}},YesPushDown:function(i){var e=Ao(i);e.scope=i.scope;var t=[],n=i.scope.internal.getFont(i.fontName,i.fontStyle).id,r=i.scope.__private__.encodeColorString(i.color),s=gv(i,i.caption);return t.push("0.749023 g"),t.push("0 0 "+Pt(Je.internal.getWidth(i))+" "+Pt(Je.internal.getHeight(i))+" re"),t.push("f"),t.push("BMC"),t.push("q"),t.push("0 0 1 rg"),t.push("/"+n+" "+Pt(s.fontSize)+" Tf "+r),t.push("BT"),t.push(s.text),t.push("ET"),t.push("Q"),t.push("EMC"),e.stream=t.join(`
761
- `),e},YesNormal:function(i){var e=Ao(i);e.scope=i.scope;var t=i.scope.internal.getFont(i.fontName,i.fontStyle).id,n=i.scope.__private__.encodeColorString(i.color),r=[],s=Je.internal.getHeight(i),o=Je.internal.getWidth(i),a=gv(i,i.caption);return r.push("1 g"),r.push("0 0 "+Pt(o)+" "+Pt(s)+" re"),r.push("f"),r.push("q"),r.push("0 0 1 rg"),r.push("0 0 "+Pt(o-1)+" "+Pt(s-1)+" re"),r.push("W"),r.push("n"),r.push("0 g"),r.push("BT"),r.push("/"+t+" "+Pt(a.fontSize)+" Tf "+n),r.push(a.text),r.push("ET"),r.push("Q"),e.stream=r.join(`
762
- `),e},OffPushDown:function(i){var e=Ao(i);e.scope=i.scope;var t=[];return t.push("0.749023 g"),t.push("0 0 "+Pt(Je.internal.getWidth(i))+" "+Pt(Je.internal.getHeight(i))+" re"),t.push("f"),e.stream=t.join(`
763
- `),e}},RadioButton:{Circle:{createAppearanceStream:function(i){var e={D:{Off:Je.RadioButton.Circle.OffPushDown},N:{}};return e.N[i]=Je.RadioButton.Circle.YesNormal,e.D[i]=Je.RadioButton.Circle.YesPushDown,e},getCA:function(){return"l"},YesNormal:function(i){var e=Ao(i);e.scope=i.scope;var t=[],n=Je.internal.getWidth(i)<=Je.internal.getHeight(i)?Je.internal.getWidth(i)/4:Je.internal.getHeight(i)/4;n=Number((.9*n).toFixed(5));var r=Je.internal.Bezier_C,s=Number((n*r).toFixed(5));return t.push("q"),t.push("1 0 0 1 "+_l(Je.internal.getWidth(i)/2)+" "+_l(Je.internal.getHeight(i)/2)+" cm"),t.push(n+" 0 m"),t.push(n+" "+s+" "+s+" "+n+" 0 "+n+" c"),t.push("-"+s+" "+n+" -"+n+" "+s+" -"+n+" 0 c"),t.push("-"+n+" -"+s+" -"+s+" -"+n+" 0 -"+n+" c"),t.push(s+" -"+n+" "+n+" -"+s+" "+n+" 0 c"),t.push("f"),t.push("Q"),e.stream=t.join(`
764
- `),e},YesPushDown:function(i){var e=Ao(i);e.scope=i.scope;var t=[],n=Je.internal.getWidth(i)<=Je.internal.getHeight(i)?Je.internal.getWidth(i)/4:Je.internal.getHeight(i)/4;n=Number((.9*n).toFixed(5));var r=Number((2*n).toFixed(5)),s=Number((r*Je.internal.Bezier_C).toFixed(5)),o=Number((n*Je.internal.Bezier_C).toFixed(5));return t.push("0.749023 g"),t.push("q"),t.push("1 0 0 1 "+_l(Je.internal.getWidth(i)/2)+" "+_l(Je.internal.getHeight(i)/2)+" cm"),t.push(r+" 0 m"),t.push(r+" "+s+" "+s+" "+r+" 0 "+r+" c"),t.push("-"+s+" "+r+" -"+r+" "+s+" -"+r+" 0 c"),t.push("-"+r+" -"+s+" -"+s+" -"+r+" 0 -"+r+" c"),t.push(s+" -"+r+" "+r+" -"+s+" "+r+" 0 c"),t.push("f"),t.push("Q"),t.push("0 g"),t.push("q"),t.push("1 0 0 1 "+_l(Je.internal.getWidth(i)/2)+" "+_l(Je.internal.getHeight(i)/2)+" cm"),t.push(n+" 0 m"),t.push(n+" "+o+" "+o+" "+n+" 0 "+n+" c"),t.push("-"+o+" "+n+" -"+n+" "+o+" -"+n+" 0 c"),t.push("-"+n+" -"+o+" -"+o+" -"+n+" 0 -"+n+" c"),t.push(o+" -"+n+" "+n+" -"+o+" "+n+" 0 c"),t.push("f"),t.push("Q"),e.stream=t.join(`
765
- `),e},OffPushDown:function(i){var e=Ao(i);e.scope=i.scope;var t=[],n=Je.internal.getWidth(i)<=Je.internal.getHeight(i)?Je.internal.getWidth(i)/4:Je.internal.getHeight(i)/4;n=Number((.9*n).toFixed(5));var r=Number((2*n).toFixed(5)),s=Number((r*Je.internal.Bezier_C).toFixed(5));return t.push("0.749023 g"),t.push("q"),t.push("1 0 0 1 "+_l(Je.internal.getWidth(i)/2)+" "+_l(Je.internal.getHeight(i)/2)+" cm"),t.push(r+" 0 m"),t.push(r+" "+s+" "+s+" "+r+" 0 "+r+" c"),t.push("-"+s+" "+r+" -"+r+" "+s+" -"+r+" 0 c"),t.push("-"+r+" -"+s+" -"+s+" -"+r+" 0 -"+r+" c"),t.push(s+" -"+r+" "+r+" -"+s+" "+r+" 0 c"),t.push("f"),t.push("Q"),e.stream=t.join(`
766
- `),e}},Cross:{createAppearanceStream:function(i){var e={D:{Off:Je.RadioButton.Cross.OffPushDown},N:{}};return e.N[i]=Je.RadioButton.Cross.YesNormal,e.D[i]=Je.RadioButton.Cross.YesPushDown,e},getCA:function(){return"8"},YesNormal:function(i){var e=Ao(i);e.scope=i.scope;var t=[],n=Je.internal.calculateCross(i);return t.push("q"),t.push("1 1 "+Pt(Je.internal.getWidth(i)-2)+" "+Pt(Je.internal.getHeight(i)-2)+" re"),t.push("W"),t.push("n"),t.push(Pt(n.x1.x)+" "+Pt(n.x1.y)+" m"),t.push(Pt(n.x2.x)+" "+Pt(n.x2.y)+" l"),t.push(Pt(n.x4.x)+" "+Pt(n.x4.y)+" m"),t.push(Pt(n.x3.x)+" "+Pt(n.x3.y)+" l"),t.push("s"),t.push("Q"),e.stream=t.join(`
767
- `),e},YesPushDown:function(i){var e=Ao(i);e.scope=i.scope;var t=Je.internal.calculateCross(i),n=[];return n.push("0.749023 g"),n.push("0 0 "+Pt(Je.internal.getWidth(i))+" "+Pt(Je.internal.getHeight(i))+" re"),n.push("f"),n.push("q"),n.push("1 1 "+Pt(Je.internal.getWidth(i)-2)+" "+Pt(Je.internal.getHeight(i)-2)+" re"),n.push("W"),n.push("n"),n.push(Pt(t.x1.x)+" "+Pt(t.x1.y)+" m"),n.push(Pt(t.x2.x)+" "+Pt(t.x2.y)+" l"),n.push(Pt(t.x4.x)+" "+Pt(t.x4.y)+" m"),n.push(Pt(t.x3.x)+" "+Pt(t.x3.y)+" l"),n.push("s"),n.push("Q"),e.stream=n.join(`
768
- `),e},OffPushDown:function(i){var e=Ao(i);e.scope=i.scope;var t=[];return t.push("0.749023 g"),t.push("0 0 "+Pt(Je.internal.getWidth(i))+" "+Pt(Je.internal.getHeight(i))+" re"),t.push("f"),e.stream=t.join(`
769
- `),e}}},createDefaultAppearanceStream:function(i){var e=i.scope.internal.getFont(i.fontName,i.fontStyle).id,t=i.scope.__private__.encodeColorString(i.color);return"/"+e+" "+i.fontSize+" Tf "+t}};Je.internal={Bezier_C:.551915024494,calculateCross:function(i){var e=Je.internal.getWidth(i),t=Je.internal.getHeight(i),n=Math.min(e,t);return{x1:{x:(e-n)/2,y:(t-n)/2+n},x2:{x:(e-n)/2+n,y:(t-n)/2},x3:{x:(e-n)/2,y:(t-n)/2},x4:{x:(e-n)/2+n,y:(t-n)/2+n}}}},Je.internal.getWidth=function(i){var e=0;return bi(i)==="object"&&(e=K2(i.Rect[2])),e},Je.internal.getHeight=function(i){var e=0;return bi(i)==="object"&&(e=K2(i.Rect[3])),e};var JV=an.addField=function(i){if(ZV(this,i),!(i instanceof uo))throw new Error("Invalid argument passed to jsPDF.addField.");var e;return(e=i).scope.internal.acroformPlugin.printedOut&&(e.scope.internal.acroformPlugin.printedOut=!1,e.scope.internal.acroformPlugin.acroFormDictionaryRoot=null),e.scope.internal.acroformPlugin.acroFormDictionaryRoot.Fields.push(e),i.page=i.scope.internal.getCurrentPageInfo().pageNumber,this};an.AcroFormChoiceField=_u,an.AcroFormListBox=yu,an.AcroFormComboBox=vu,an.AcroFormEditBox=t0,an.AcroFormButton=Hn,an.AcroFormPushButton=i0,an.AcroFormRadioButton=xu,an.AcroFormCheckBox=n0,an.AcroFormTextField=Nc,an.AcroFormPasswordField=r0,an.AcroFormAppearance=Je,an.AcroForm={ChoiceField:_u,ListBox:yu,ComboBox:vu,EditBox:t0,Button:Hn,PushButton:i0,RadioButton:xu,CheckBox:n0,TextField:Nc,PasswordField:r0,Appearance:Je},ct.AcroForm={ChoiceField:_u,ListBox:yu,ComboBox:vu,EditBox:t0,Button:Hn,PushButton:i0,RadioButton:xu,CheckBox:n0,TextField:Nc,PasswordField:r0,Appearance:Je};ct.AcroForm;function QP(i){return i.reduce(function(e,t,n){return e[t]=n,e},{})}(function(i){var e="addImage_";i.__addimage__={};var t="UNKNOWN",n={PNG:[[137,80,78,71]],TIFF:[[77,77,0,42],[73,73,42,0]],JPEG:[[255,216,255,224,void 0,void 0,74,70,73,70,0],[255,216,255,225,void 0,void 0,69,120,105,102,0,0],[255,216,255,219],[255,216,255,238]],JPEG2000:[[0,0,0,12,106,80,32,32]],GIF87a:[[71,73,70,56,55,97]],GIF89a:[[71,73,70,56,57,97]],WEBP:[[82,73,70,70,void 0,void 0,void 0,void 0,87,69,66,80]],BMP:[[66,77],[66,65],[67,73],[67,80],[73,67],[80,84]]},r=i.__addimage__.getImageFileTypeByImageData=function(L,T){var C,D,W,$,B,V=t;if((T=T||t)==="RGBA"||L.data!==void 0&&L.data instanceof Uint8ClampedArray&&"height"in L&&"width"in L)return"RGBA";if(F(L))for(B in n)for(W=n[B],C=0;C<W.length;C+=1){for($=!0,D=0;D<W[C].length;D+=1)if(W[C][D]!==void 0&&W[C][D]!==L[D]){$=!1;break}if($===!0){V=B;break}}else for(B in n)for(W=n[B],C=0;C<W.length;C+=1){for($=!0,D=0;D<W[C].length;D+=1)if(W[C][D]!==void 0&&W[C][D]!==L.charCodeAt(D)){$=!1;break}if($===!0){V=B;break}}return V===t&&T!==t&&(V=T),V},s=function L(T){for(var C=this.internal.write,D=this.internal.putStream,W=(0,this.internal.getFilters)();W.indexOf("FlateEncode")!==-1;)W.splice(W.indexOf("FlateEncode"),1);T.objectId=this.internal.newObject();var $=[];if($.push({key:"Type",value:"/XObject"}),$.push({key:"Subtype",value:"/Image"}),$.push({key:"Width",value:T.width}),$.push({key:"Height",value:T.height}),T.colorSpace===v.INDEXED?$.push({key:"ColorSpace",value:"[/Indexed /DeviceRGB "+(T.palette.length/3-1)+" "+("sMask"in T&&T.sMask!==void 0?T.objectId+2:T.objectId+1)+" 0 R]"}):($.push({key:"ColorSpace",value:"/"+T.colorSpace}),T.colorSpace===v.DEVICE_CMYK&&$.push({key:"Decode",value:"[1 0 1 0 1 0 1 0]"})),$.push({key:"BitsPerComponent",value:T.bitsPerComponent}),"decodeParameters"in T&&T.decodeParameters!==void 0&&$.push({key:"DecodeParms",value:"<<"+T.decodeParameters+">>"}),"transparency"in T&&Array.isArray(T.transparency)&&T.transparency.length>0){for(var B="",V=0,te=T.transparency.length;V<te;V++)B+=T.transparency[V]+" "+T.transparency[V]+" ";$.push({key:"Mask",value:"["+B+"]"})}T.sMask!==void 0&&$.push({key:"SMask",value:T.objectId+1+" 0 R"});var ne=T.filter!==void 0?["/"+T.filter]:void 0;if(D({data:T.data,additionalKeyValues:$,alreadyAppliedFilters:ne,objectId:T.objectId}),C("endobj"),"sMask"in T&&T.sMask!==void 0){var ae,I=(ae=T.sMaskBitsPerComponent)!==null&&ae!==void 0?ae:T.bitsPerComponent,U={width:T.width,height:T.height,colorSpace:"DeviceGray",bitsPerComponent:I,data:T.sMask};"filter"in T&&(U.decodeParameters="/Predictor ".concat(T.predictor," /Colors 1 /BitsPerComponent ").concat(I," /Columns ").concat(T.width),U.filter=T.filter),L.call(this,U)}if(T.colorSpace===v.INDEXED){var K=this.internal.newObject();D({data:R(new Uint8Array(T.palette)),objectId:K}),C("endobj")}},o=function(){var L=this.internal.collections[e+"images"];for(var T in L)s.call(this,L[T])},a=function(){var L,T=this.internal.collections[e+"images"],C=this.internal.write;for(var D in T)C("/I"+(L=T[D]).index,L.objectId,"0","R")},l=function(){this.internal.collections[e+"images"]||(this.internal.collections[e+"images"]={},this.internal.events.subscribe("putResources",o),this.internal.events.subscribe("putXobjectDict",a))},c=function(){var L=this.internal.collections[e+"images"];return l.call(this),L},h=function(){return Object.keys(this.internal.collections[e+"images"]).length},u=function(L){return typeof i["process"+L.toUpperCase()]=="function"},f=function(L){return bi(L)==="object"&&L.nodeType===1},d=function(L,T){if(L.nodeName==="IMG"&&L.hasAttribute("src")){var C=""+L.getAttribute("src");if(C.indexOf("data:image/")===0)return e0(unescape(C).split("base64,").pop());var D=i.loadFile(C,!0);if(D!==void 0)return D}if(L.nodeName==="CANVAS"){if(L.width===0||L.height===0)throw new Error("Given canvas must have data. Canvas width: "+L.width+", height: "+L.height);var W;switch(T){case"PNG":W="image/png";break;case"WEBP":W="image/webp";break;default:W="image/jpeg"}return e0(L.toDataURL(W,1).split("base64,").pop())}},g=function(L){var T=this.internal.collections[e+"images"];if(T){for(var C in T)if(L===T[C].alias)return T[C]}},m=function(L,T,C){return L||T||(L=-96,T=-96),L<0&&(L=-1*C.width*72/L/this.internal.scaleFactor),T<0&&(T=-1*C.height*72/T/this.internal.scaleFactor),L===0&&(L=T*C.width/C.height),T===0&&(T=L*C.height/C.width),[L,T]},_=function(L,T,C,D,W,$){var B=m.call(this,C,D,W),V=this.internal.getCoordinateString,te=this.internal.getVerticalCoordinateString,ne=c.call(this);if(C=B[0],D=B[1],ne[W.index]=W,$){$*=Math.PI/180;var ae=Math.cos($),I=Math.sin($),U=function(ie){return ie.toFixed(4)},K=[U(ae),U(I),U(-1*I),U(ae),0,0,"cm"]}this.internal.write("q"),$?(this.internal.write([1,"0","0",1,V(L),te(T+D),"cm"].join(" ")),this.internal.write(K.join(" ")),this.internal.write([V(C),"0","0",V(D),"0","0","cm"].join(" "))):this.internal.write([V(C),"0","0",V(D),V(L),te(T+D),"cm"].join(" ")),this.isAdvancedAPI()&&this.internal.write([1,0,0,-1,0,0,"cm"].join(" ")),this.internal.write("/I"+W.index+" Do"),this.internal.write("Q")},v=i.color_spaces={DEVICE_RGB:"DeviceRGB",DEVICE_GRAY:"DeviceGray",DEVICE_CMYK:"DeviceCMYK",CAL_GREY:"CalGray",CAL_RGB:"CalRGB",LAB:"Lab",ICC_BASED:"ICCBased",INDEXED:"Indexed",PATTERN:"Pattern",SEPARATION:"Separation",DEVICE_N:"DeviceN"};i.decode={DCT_DECODE:"DCTDecode",FLATE_DECODE:"FlateDecode",LZW_DECODE:"LZWDecode",JPX_DECODE:"JPXDecode",JBIG2_DECODE:"JBIG2Decode",ASCII85_DECODE:"ASCII85Decode",ASCII_HEX_DECODE:"ASCIIHexDecode",RUN_LENGTH_DECODE:"RunLengthDecode",CCITT_FAX_DECODE:"CCITTFaxDecode"};var x=i.image_compression={NONE:"NONE",FAST:"FAST",MEDIUM:"MEDIUM",SLOW:"SLOW"},S=i.__addimage__.sHashCode=function(L){var T,C,D=0;if(typeof L=="string")for(C=L.length,T=0;T<C;T++)D=(D<<5)-D+L.charCodeAt(T),D|=0;else if(F(L))for(C=L.byteLength/2,T=0;T<C;T++)D=(D<<5)-D+L[T],D|=0;return D},b=i.__addimage__.validateStringAsBase64=function(L){(L=L||"").toString().trim();var T=!0;return L.length===0&&(T=!1),L.length%4!=0&&(T=!1),/^[A-Za-z0-9+/]+$/.test(L.substr(0,L.length-2))===!1&&(T=!1),/^[A-Za-z0-9/][A-Za-z0-9+/]|[A-Za-z0-9+/]=|==$/.test(L.substr(-2))===!1&&(T=!1),T},A=i.__addimage__.extractImageFromDataUrl=function(L){if(L==null||!(L=L.trim()).startsWith("data:"))return null;var T=L.indexOf(",");return T<0?null:L.substring(0,T).trim().endsWith("base64")?L.substring(T+1):null};i.__addimage__.isArrayBuffer=function(L){return L instanceof ArrayBuffer};var F=i.__addimage__.isArrayBufferView=function(L){return L instanceof Int8Array||L instanceof Uint8Array||L instanceof Uint8ClampedArray||L instanceof Int16Array||L instanceof Uint16Array||L instanceof Int32Array||L instanceof Uint32Array||L instanceof Float32Array||L instanceof Float64Array},N=i.__addimage__.binaryStringToUint8Array=function(L){for(var T=L.length,C=new Uint8Array(T),D=0;D<T;D++)C[D]=L.charCodeAt(D);return C},R=i.__addimage__.arrayBufferToBinaryString=function(L){for(var T="",C=F(L)?L:new Uint8Array(L),D=0;D<C.length;D+=8192)T+=String.fromCharCode.apply(null,C.subarray(D,D+8192));return T};i.addImage=function(){var L,T,C,D,W,$,B,V,te;if(typeof arguments[1]=="number"?(T=t,C=arguments[1],D=arguments[2],W=arguments[3],$=arguments[4],B=arguments[5],V=arguments[6],te=arguments[7]):(T=arguments[1],C=arguments[2],D=arguments[3],W=arguments[4],$=arguments[5],B=arguments[6],V=arguments[7],te=arguments[8]),bi(L=arguments[0])==="object"&&!f(L)&&"imageData"in L){var ne=L;L=ne.imageData,T=ne.format||T||t,C=ne.x||C||0,D=ne.y||D||0,W=ne.w||ne.width||W,$=ne.h||ne.height||$,B=ne.alias||B,V=ne.compression||V,te=ne.rotation||ne.angle||te}var ae=this.internal.getFilters();if(V===void 0&&ae.indexOf("FlateEncode")!==-1&&(V="SLOW"),isNaN(C)||isNaN(D))throw new Error("Invalid coordinates passed to jsPDF.addImage");l.call(this);var I=P.call(this,L,T,B,V);return _.call(this,C,D,W,$,I,te),this};var P=function(L,T,C,D){var W,$,B;if(typeof L=="string"&&r(L)===t){L=unescape(L);var V=O(L,!1);(V!==""||(V=i.loadFile(L,!0))!==void 0)&&(L=V)}if(f(L)&&(L=d(L,T)),T=r(L,T),!u(T))throw new Error("addImage does not support files of type '"+T+"', please ensure that a plugin for '"+T+"' support is added.");if(((B=C)==null||B.length===0)&&(C=(function(te){return typeof te=="string"||F(te)?S(te):F(te.data)?S(te.data):null})(L)),(W=g.call(this,C))||(L instanceof Uint8Array||T==="RGBA"||($=L,L=N(L)),W=this["process"+T.toUpperCase()](L,h.call(this),C,(function(te){return te&&typeof te=="string"&&(te=te.toUpperCase()),te in i.image_compression?te:x.NONE})(D),$)),!W)throw new Error("An unknown error occurred whilst processing the image.");return W},O=i.__addimage__.convertBase64ToBinaryString=function(L,T){T=typeof T!="boolean"||T;var C,D="";if(typeof L=="string"){var W;C=(W=A(L))!==null&&W!==void 0?W:L;try{D=e0(C)}catch($){if(T)throw b(C)?new Error("atob-Error in jsPDF.convertBase64ToBinaryString "+$.message):new Error("Supplied Data is not a valid base64-String jsPDF.convertBase64ToBinaryString ")}}return D};i.getImageProperties=function(L){var T,C,D="";if(f(L)&&(L=d(L)),typeof L=="string"&&r(L)===t&&((D=O(L,!1))===""&&(D=i.loadFile(L)||""),L=D),C=r(L),!u(C))throw new Error("addImage does not support files of type '"+C+"', please ensure that a plugin for '"+C+"' support is added.");if(L instanceof Uint8Array||(L=N(L)),!(T=this["process"+C.toUpperCase()](L)))throw new Error("An unknown error occurred whilst processing the image");return T.fileType=C,T}})(ct.API),(function(i){var e=function(t){if(t!==void 0&&t!="")return!0};ct.API.events.push(["addPage",function(t){this.internal.getPageInfo(t.pageNumber).pageContext.annotations=[]}]),i.events.push(["putPage",function(t){for(var n,r,s,o=this.internal.getCoordinateString,a=this.internal.getVerticalCoordinateString,l=this.internal.getPageInfoByObjId(t.objId),c=t.pageContext.annotations,h=!1,u=0;u<c.length&&!h;u++)switch((n=c[u]).type){case"link":(e(n.options.url)||e(n.options.pageNumber))&&(h=!0);break;case"reference":case"text":case"freetext":h=!0}if(h!=0){this.internal.write("/Annots [");for(var f=0;f<c.length;f++){n=c[f];var d=this.internal.pdfEscape,g=this.internal.getEncryptor(t.objId);switch(n.type){case"reference":this.internal.write(" "+n.object.objId+" 0 R ");break;case"text":var m=this.internal.newAdditionalObject(),_=this.internal.newAdditionalObject(),v=this.internal.getEncryptor(m.objId),x=n.title||"Note";s="<</Type /Annot /Subtype /Text "+(r="/Rect ["+o(n.bounds.x)+" "+a(n.bounds.y+n.bounds.h)+" "+o(n.bounds.x+n.bounds.w)+" "+a(n.bounds.y)+"] ")+"/Contents ("+d(v(n.contents))+")",s+=" /Popup "+_.objId+" 0 R",s+=" /P "+l.objId+" 0 R",s+=" /T ("+d(v(x))+") >>",m.content=s;var S=m.objId+" 0 R";s="<</Type /Annot /Subtype /Popup "+(r="/Rect ["+o(n.bounds.x+30)+" "+a(n.bounds.y+n.bounds.h)+" "+o(n.bounds.x+n.bounds.w+30)+" "+a(n.bounds.y)+"] ")+" /Parent "+S,n.open&&(s+=" /Open true"),s+=" >>",_.content=s,this.internal.write(m.objId,"0 R",_.objId,"0 R");break;case"freetext":r="/Rect ["+o(n.bounds.x)+" "+a(n.bounds.y)+" "+o(n.bounds.x+n.bounds.w)+" "+a(n.bounds.y+n.bounds.h)+"] ";var b=n.color||"#000000";s="<</Type /Annot /Subtype /FreeText "+r+"/Contents ("+d(g(n.contents))+")",s+=" /DS(font: Helvetica,sans-serif 12.0pt; text-align:left; color:#"+b+")",s+=" /Border [0 0 0]",s+=" >>",this.internal.write(s);break;case"link":if(n.options.name){var A=this.annotations._nameMap[n.options.name];n.options.pageNumber=A.page,n.options.top=A.y}else n.options.top||(n.options.top=0);if(r="/Rect ["+n.finalBounds.x+" "+n.finalBounds.y+" "+n.finalBounds.w+" "+n.finalBounds.h+"] ",s="",n.options.url)s="<</Type /Annot /Subtype /Link "+r+"/Border [0 0 0] /A <</S /URI /URI ("+d(g(n.options.url))+") >>";else if(n.options.pageNumber)switch(s="<</Type /Annot /Subtype /Link "+r+"/Border [0 0 0] /Dest ["+this.internal.getPageInfo(n.options.pageNumber).objId+" 0 R",n.options.magFactor=n.options.magFactor||"XYZ",n.options.magFactor){case"Fit":s+=" /Fit]";break;case"FitH":s+=" /FitH "+n.options.top+"]";break;case"FitV":n.options.left=n.options.left||0,s+=" /FitV "+n.options.left+"]";break;default:var F=a(n.options.top);n.options.left=n.options.left||0,n.options.zoom===void 0&&(n.options.zoom=0),s+=" /XYZ "+n.options.left+" "+F+" "+n.options.zoom+"]"}s!=""&&(s+=" >>",this.internal.write(s))}}this.internal.write("]")}}]),i.createAnnotation=function(t){var n=this.internal.getCurrentPageInfo();switch(t.type){case"link":this.link(t.bounds.x,t.bounds.y,t.bounds.w,t.bounds.h,t);break;case"text":case"freetext":n.pageContext.annotations.push(t)}},i.link=function(t,n,r,s,o){var a=this.internal.getCurrentPageInfo(),l=this.internal.getCoordinateString,c=this.internal.getVerticalCoordinateString;a.pageContext.annotations.push({finalBounds:{x:l(t),y:c(n),w:l(t+r),h:c(n+s)},options:o,type:"link"})},i.textWithLink=function(t,n,r,s){var o,a,l=this.getTextWidth(t),c=this.internal.getLineHeight()/this.internal.scaleFactor;if(s.maxWidth!==void 0){a=s.maxWidth;var h=this.splitTextToSize(t,a).length;o=Math.ceil(c*h)}else a=l,o=c;return this.text(t,n,r,s),r+=.2*c,s.align==="center"&&(n-=l/2),s.align==="right"&&(n-=l),this.link(n,r-c,a,o,s),l},i.getTextWidth=function(t){var n=this.internal.getFontSize();return this.getStringUnitWidth(t)*n/this.internal.scaleFactor}})(ct.API),(function(i){var e={1569:[65152],1570:[65153,65154],1571:[65155,65156],1572:[65157,65158],1573:[65159,65160],1574:[65161,65162,65163,65164],1575:[65165,65166],1576:[65167,65168,65169,65170],1577:[65171,65172],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194],1584:[65195,65196],1585:[65197,65198],1586:[65199,65200],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1649:[64336,64337],1655:[64477],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,64377],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393],1676:[64388,64389],1677:[64386,64387],1678:[64390,64391],1681:[64396,64397],1688:[64394,64395],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421],1729:[64422,64423,64424,64425],1733:[64480,64481],1734:[64473,64474],1735:[64471,64472],1736:[64475,64476],1737:[64482,64483],1739:[64478,64479],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431],1747:[64432,64433]},t={65247:{65154:65269,65156:65271,65160:65273,65166:65275},65248:{65154:65270,65156:65272,65160:65274,65166:65276},65165:{65247:{65248:{65258:65010}}},1617:{1612:64606,1613:64607,1614:64608,1615:64609,1616:64610}},n={1612:64606,1613:64607,1614:64608,1615:64609,1616:64610},r=[1570,1571,1573,1575];i.__arabicParser__={};var s=i.__arabicParser__.isInArabicSubstitutionA=function(m){return e[m.charCodeAt(0)]!==void 0},o=i.__arabicParser__.isArabicLetter=function(m){return typeof m=="string"&&/^[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]+$/.test(m)},a=i.__arabicParser__.isArabicEndLetter=function(m){return o(m)&&s(m)&&e[m.charCodeAt(0)].length<=2},l=i.__arabicParser__.isArabicAlfLetter=function(m){return o(m)&&r.indexOf(m.charCodeAt(0))>=0};i.__arabicParser__.arabicLetterHasIsolatedForm=function(m){return o(m)&&s(m)&&e[m.charCodeAt(0)].length>=1};var c=i.__arabicParser__.arabicLetterHasFinalForm=function(m){return o(m)&&s(m)&&e[m.charCodeAt(0)].length>=2};i.__arabicParser__.arabicLetterHasInitialForm=function(m){return o(m)&&s(m)&&e[m.charCodeAt(0)].length>=3};var h=i.__arabicParser__.arabicLetterHasMedialForm=function(m){return o(m)&&s(m)&&e[m.charCodeAt(0)].length==4},u=i.__arabicParser__.resolveLigatures=function(m){var _=0,v=t,x="",S=0;for(_=0;_<m.length;_+=1)v[m.charCodeAt(_)]!==void 0?(S++,typeof(v=v[m.charCodeAt(_)])=="number"&&(x+=String.fromCharCode(v),v=t,S=0),_===m.length-1&&(v=t,x+=m.charAt(_-(S-1)),_-=S-1,S=0)):(v=t,x+=m.charAt(_-S),_-=S,S=0);return x};i.__arabicParser__.isArabicDiacritic=function(m){return m!==void 0&&n[m.charCodeAt(0)]!==void 0};var f=i.__arabicParser__.getCorrectForm=function(m,_,v){return o(m)?s(m)===!1?-1:!c(m)||!o(_)&&!o(v)||!o(v)&&a(_)||a(m)&&!o(_)||a(m)&&l(_)||a(m)&&a(_)?0:h(m)&&o(_)&&!a(_)&&o(v)&&c(v)?3:a(m)||!o(v)?1:2:-1},d=function(m){var _=0,v=0,x=0,S="",b="",A="",F=(m=m||"").split("\\s+"),N=[];for(_=0;_<F.length;_+=1){for(N.push(""),v=0;v<F[_].length;v+=1)S=F[_][v],b=F[_][v-1],A=F[_][v+1],o(S)?(x=f(S,b,A),N[_]+=x!==-1?String.fromCharCode(e[S.charCodeAt(0)][x]):S):N[_]+=S;N[_]=u(N[_])}return N.join(" ")},g=i.__arabicParser__.processArabic=i.processArabic=function(){var m,_=typeof arguments[0]=="string"?arguments[0]:arguments[0].text,v=[];if(Array.isArray(_)){var x=0;for(v=[],x=0;x<_.length;x+=1)Array.isArray(_[x])?v.push([d(_[x][0]),_[x][1],_[x][2]]):v.push([d(_[x])]);m=v}else m=d(_);return typeof arguments[0]=="string"?m:(arguments[0].text=m,arguments[0])};i.events.push(["preProcessText",g])})(ct.API),ct.API.autoPrint=function(i){var e;return(i=i||{}).variant=i.variant||"non-conform",i.variant==="javascript"?this.addJS("print({});"):(this.internal.events.subscribe("postPutResources",function(){e=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /Named"),this.internal.out("/Type /Action"),this.internal.out("/N /Print"),this.internal.out(">>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){this.internal.out("/OpenAction "+e+" 0 R")})),this},(function(i){var e=function(){var t=void 0;Object.defineProperty(this,"pdf",{get:function(){return t},set:function(a){t=a}});var n=150;Object.defineProperty(this,"width",{get:function(){return n},set:function(a){n=isNaN(a)||Number.isInteger(a)===!1||a<0?150:a,this.getContext("2d").pageWrapXEnabled&&(this.getContext("2d").pageWrapX=n+1)}});var r=300;Object.defineProperty(this,"height",{get:function(){return r},set:function(a){r=isNaN(a)||Number.isInteger(a)===!1||a<0?300:a,this.getContext("2d").pageWrapYEnabled&&(this.getContext("2d").pageWrapY=r+1)}});var s=[];Object.defineProperty(this,"childNodes",{get:function(){return s},set:function(a){s=a}});var o={};Object.defineProperty(this,"style",{get:function(){return o},set:function(a){o=a}}),Object.defineProperty(this,"parentNode",{})};e.prototype.getContext=function(t,n){var r;if((t=t||"2d")!=="2d")return null;for(r in n)this.pdf.context2d.hasOwnProperty(r)&&(this.pdf.context2d[r]=n[r]);return this.pdf.context2d._canvas=this,this.pdf.context2d},e.prototype.toDataURL=function(){throw new Error("toDataURL is not implemented.")},i.events.push(["initialized",function(){this.canvas=new e,this.canvas.pdf=this}])})(ct.API),(function(i){var e={left:0,top:0,bottom:0,right:0},t=!1,n=function(){this.internal.__cell__===void 0&&(this.internal.__cell__={},this.internal.__cell__.padding=3,this.internal.__cell__.headerFunction=void 0,this.internal.__cell__.margins=Object.assign({},e),this.internal.__cell__.margins.width=this.getPageWidth(),r.call(this))},r=function(){this.internal.__cell__.lastCell=new s,this.internal.__cell__.pages=1},s=function(){var l=arguments[0];Object.defineProperty(this,"x",{enumerable:!0,get:function(){return l},set:function(m){l=m}});var c=arguments[1];Object.defineProperty(this,"y",{enumerable:!0,get:function(){return c},set:function(m){c=m}});var h=arguments[2];Object.defineProperty(this,"width",{enumerable:!0,get:function(){return h},set:function(m){h=m}});var u=arguments[3];Object.defineProperty(this,"height",{enumerable:!0,get:function(){return u},set:function(m){u=m}});var f=arguments[4];Object.defineProperty(this,"text",{enumerable:!0,get:function(){return f},set:function(m){f=m}});var d=arguments[5];Object.defineProperty(this,"lineNumber",{enumerable:!0,get:function(){return d},set:function(m){d=m}});var g=arguments[6];return Object.defineProperty(this,"align",{enumerable:!0,get:function(){return g},set:function(m){g=m}}),this};s.prototype.clone=function(){return new s(this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align)},s.prototype.toArray=function(){return[this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align]},i.setHeaderFunction=function(l){return n.call(this),this.internal.__cell__.headerFunction=typeof l=="function"?l:void 0,this},i.getTextDimensions=function(l,c){n.call(this);var h=(c=c||{}).fontSize||this.getFontSize(),u=c.font||this.getFont(),f=c.scaleFactor||this.internal.scaleFactor,d=0,g=0,m=0,_=this;if(!Array.isArray(l)&&typeof l!="string"){if(typeof l!="number")throw new Error("getTextDimensions expects text-parameter to be of type String or type Number or an Array of Strings.");l=String(l)}var v=c.maxWidth;v>0?typeof l=="string"?l=this.splitTextToSize(l,v):Object.prototype.toString.call(l)==="[object Array]"&&(l=l.reduce(function(S,b){return S.concat(_.splitTextToSize(b,v))},[])):l=Array.isArray(l)?l:[l];for(var x=0;x<l.length;x++)d<(m=this.getStringUnitWidth(l[x],{font:u})*h)&&(d=m);return d!==0&&(g=l.length),{w:d/=f,h:Math.max((g*h*this.getLineHeightFactor()-h*(this.getLineHeightFactor()-1))/f,0)}},i.cellAddPage=function(){n.call(this),this.addPage();var l=this.internal.__cell__.margins||e;return this.internal.__cell__.lastCell=new s(l.left,l.top,void 0,void 0),this.internal.__cell__.pages+=1,this};var o=i.cell=function(){var l;l=arguments[0]instanceof s?arguments[0]:new s(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6]),n.call(this);var c=this.internal.__cell__.lastCell,h=this.internal.__cell__.padding,u=this.internal.__cell__.margins||e,f=this.internal.__cell__.tableHeaderRow,d=this.internal.__cell__.printHeaders;return c.lineNumber!==void 0&&(c.lineNumber===l.lineNumber?(l.x=(c.x||0)+(c.width||0),l.y=c.y||0):c.y+c.height+l.height+u.bottom>this.getPageHeight()?(this.cellAddPage(),l.y=u.top,d&&f&&(this.printHeaderRow(l.lineNumber,!0),l.y+=f[0].height)):l.y=c.y+c.height||l.y),l.text[0]!==void 0&&(this.rect(l.x,l.y,l.width,l.height,t===!0?"FD":void 0),l.align==="right"?this.text(l.text,l.x+l.width-h,l.y+h,{align:"right",baseline:"top"}):l.align==="center"?this.text(l.text,l.x+l.width/2,l.y+h,{align:"center",baseline:"top",maxWidth:l.width-h-h}):this.text(l.text,l.x+h,l.y+h,{align:"left",baseline:"top",maxWidth:l.width-h-h})),this.internal.__cell__.lastCell=l,this};i.table=function(l,c,h,u,f){if(n.call(this),!h)throw new Error("No data for PDF table.");var d,g,m,_,v=[],x=[],S=[],b={},A={},F=[],N=[],R=(f=f||{}).autoSize||!1,P=f.printHeaders!==!1,O=f.css&&f.css["font-size"]!==void 0?16*f.css["font-size"]:f.fontSize||12,L=f.margins||Object.assign({width:this.getPageWidth()},e),T=typeof f.padding=="number"?f.padding:3,C=f.headerBackgroundColor||"#c8c8c8",D=f.headerTextColor||"#000";if(r.call(this),this.internal.__cell__.printHeaders=P,this.internal.__cell__.margins=L,this.internal.__cell__.table_font_size=O,this.internal.__cell__.padding=T,this.internal.__cell__.headerBackgroundColor=C,this.internal.__cell__.headerTextColor=D,this.setFontSize(O),u==null)x=v=Object.keys(h[0]),S=v.map(function(){return"left"});else if(Array.isArray(u)&&bi(u[0])==="object")for(v=u.map(function(ne){return ne.name}),x=u.map(function(ne){return ne.prompt||ne.name||""}),S=u.map(function(ne){return ne.align||"left"}),d=0;d<u.length;d+=1)A[u[d].name]=.7499990551181103*u[d].width;else Array.isArray(u)&&typeof u[0]=="string"&&(x=v=u,S=v.map(function(){return"left"}));if(R||Array.isArray(u)&&typeof u[0]=="string")for(d=0;d<v.length;d+=1){for(b[_=v[d]]=h.map(function(ne){return ne[_]}),this.setFont(void 0,"bold"),F.push(this.getTextDimensions(x[d],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w),g=b[_],this.setFont(void 0,"normal"),m=0;m<g.length;m+=1)F.push(this.getTextDimensions(g[m],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w);A[_]=Math.max.apply(null,F)+T+T,F=[]}if(P){var W={};for(d=0;d<v.length;d+=1)W[v[d]]={},W[v[d]].text=x[d],W[v[d]].align=S[d];var $=a.call(this,W,A);N=v.map(function(ne){return new s(l,c,A[ne],$,W[ne].text,void 0,W[ne].align)}),this.setTableHeaderRow(N),this.printHeaderRow(1,!1)}var B=u.reduce(function(ne,ae){return ne[ae.name]=ae.align,ne},{});for(d=0;d<h.length;d+=1){"rowStart"in f&&f.rowStart instanceof Function&&f.rowStart({row:d,data:h[d]},this);var V=a.call(this,h[d],A);for(m=0;m<v.length;m+=1){var te=h[d][v[m]];"cellStart"in f&&f.cellStart instanceof Function&&f.cellStart({row:d,col:m,data:te},this),o.call(this,new s(l,c,A[v[m]],V,te,d+2,B[v[m]]))}}return this.internal.__cell__.table_x=l,this.internal.__cell__.table_y=c,this};var a=function(l,c){var h=this.internal.__cell__.padding,u=this.internal.__cell__.table_font_size,f=this.internal.scaleFactor;return Object.keys(l).map(function(d){var g=l[d];return this.splitTextToSize(g.hasOwnProperty("text")?g.text:g,c[d]-h-h)},this).map(function(d){return this.getLineHeightFactor()*d.length*u/f+h+h},this).reduce(function(d,g){return Math.max(d,g)},0)};i.setTableHeaderRow=function(l){n.call(this),this.internal.__cell__.tableHeaderRow=l},i.printHeaderRow=function(l,c){if(n.call(this),!this.internal.__cell__.tableHeaderRow)throw new Error("Property tableHeaderRow does not exist.");var h;if(t=!0,typeof this.internal.__cell__.headerFunction=="function"){var u=this.internal.__cell__.headerFunction(this,this.internal.__cell__.pages);this.internal.__cell__.lastCell=new s(u[0],u[1],u[2],u[3],void 0,-1)}this.setFont(void 0,"bold");for(var f=[],d=0;d<this.internal.__cell__.tableHeaderRow.length;d+=1){h=this.internal.__cell__.tableHeaderRow[d].clone(),c&&(h.y=this.internal.__cell__.margins.top||0,f.push(h)),h.lineNumber=l;var g=this.getTextColor();this.setTextColor(this.internal.__cell__.headerTextColor),this.setFillColor(this.internal.__cell__.headerBackgroundColor),o.call(this,h),this.setTextColor(g)}f.length>0&&this.setTableHeaderRow(f),this.setFont(void 0,"normal"),t=!1}})(ct.API);var eM={italic:["italic","oblique","normal"],oblique:["oblique","italic","normal"],normal:["normal","oblique","italic"]},tM=["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"],pv=QP(tM),iM=[100,200,300,400,500,600,700,800,900],QV=QP(iM);function ty(i){var e=i.family.replace(/"|'/g,"").toLowerCase(),t=(function(s){return eM[s=s||"normal"]?s:"normal"})(i.style),n=(function(s){return s?typeof s=="number"?s>=100&&s<=900&&s%100==0?s:400:/^\d00$/.test(s)?parseInt(s):s==="bold"?700:400:400})(i.weight),r=(function(s){return typeof pv[s=s||"normal"]=="number"?s:"normal"})(i.stretch);return{family:e,style:t,weight:n,stretch:r,src:i.src||[],ref:i.ref||{name:e,style:[r,t,n].join(" ")}}}function Y2(i,e,t,n){var r;for(r=t;r>=0&&r<e.length;r+=n)if(i[e[r]])return i[e[r]];for(r=t;r>=0&&r<e.length;r-=n)if(i[e[r]])return i[e[r]]}var e$={"sans-serif":"helvetica",fixed:"courier",monospace:"courier",terminal:"courier",cursive:"times",fantasy:"times",serif:"times"},Z2={caption:"times",icon:"times",menu:"times","message-box":"times","small-caption":"times","status-bar":"times"};function J2(i){return[i.stretch,i.style,i.weight,i.family].join(" ")}function Q2(i){return i.trimLeft()}function t$(i,e){for(var t=0;t<i.length;){if(i.charAt(t)===e)return[i.substring(0,t),i.substring(t+1)];t+=1}return null}function i$(i){var e=i.match(/^(-[a-z_]|[a-z_])[a-z0-9_-]*/i);return e===null?null:[e[0],i.substring(e[0].length)]}var Ih,Gp,eS,tS,iS,iy=["times"];function nS(i,e,t,n,r){var s=4,o=sS;switch(r){case ct.API.image_compression.FAST:s=1,o=rS;break;case ct.API.image_compression.MEDIUM:s=6,o=oS;break;case ct.API.image_compression.SLOW:s=9,o=aS}i=(function(l,c,h,u){for(var f,d=l.length/c,g=new Uint8Array(l.length+d),m=[n$,rS,sS,oS,aS],_=0;_<d;_+=1){var v=_*c,x=l.subarray(v,v+c);if(u)g.set(u(x,h,f),v+_);else{for(var S=m.length,b=[],A=0;A<S;A+=1)b[A]=m[A](x,h,f);var F=s$(b.concat());g.set(b[F],v+_)}f=x}return g})(i,e,Math.ceil(t*n/8),o);var a=lv(i,{level:s});return ct.API.__addimage__.arrayBufferToBinaryString(a)}function n$(i){var e=Array.apply([],i);return e.unshift(0),e}function rS(i,e){var t=i.length,n=[];n[0]=1;for(var r=0;r<t;r+=1){var s=i[r-e]||0;n[r+1]=i[r]-s+256&255}return n}function sS(i,e,t){var n=i.length,r=[];r[0]=2;for(var s=0;s<n;s+=1){var o=t&&t[s]||0;r[s+1]=i[s]-o+256&255}return r}function oS(i,e,t){var n=i.length,r=[];r[0]=3;for(var s=0;s<n;s+=1){var o=i[s-e]||0,a=t&&t[s]||0;r[s+1]=i[s]+256-(o+a>>>1)&255}return r}function aS(i,e,t){var n=i.length,r=[];r[0]=4;for(var s=0;s<n;s+=1){var o=r$(i[s-e]||0,t&&t[s]||0,t&&t[s-e]||0);r[s+1]=i[s]-o+256&255}return r}function r$(i,e,t){if(i===e&&e===t)return i;var n=Math.abs(e-t),r=Math.abs(i-t),s=Math.abs(i+e-t-t);return n<=r&&n<=s?i:r<=s?e:t}function s$(i){var e=i.map(function(t){return t.reduce(function(n,r){return n+Math.abs(r)},0)});return e.indexOf(Math.min.apply(null,e))}function ny(i,e,t){var n=e*t,r=Math.floor(n/8),s=16-(n-8*r+t),o=(1<<t)-1;return nM(i,r)>>s&o}function lS(i,e,t,n){var r=t*n,s=Math.floor(r/8),o=16-(r-8*s+n),a=(1<<n)-1,l=(e&a)<<o;(function(c,h,u){if(h+1<c.byteLength)c.setUint16(h,u,!1);else{var f=u>>8&255;c.setUint8(h,f)}})(i,s,nM(i,s)&~(a<<o)&65535|l)}function nM(i,e){return e+1<i.byteLength?i.getUint16(e,!1):i.getUint8(e)<<8}function o$(i){var e=0;if(i[e++]!==71||i[e++]!==73||i[e++]!==70||i[e++]!==56||(i[e++]+1&253)!=56||i[e++]!==97)throw new Error("Invalid GIF 87a/89a header.");var t=i[e++]|i[e++]<<8,n=i[e++]|i[e++]<<8,r=i[e++],s=r>>7,o=1<<1+(7&r);i[e++],i[e++];var a=null,l=null;s&&(a=e,l=o,e+=3*o);var c=!0,h=[],u=0,f=null,d=0,g=null;for(this.width=t,this.height=n;c&&e<i.length;)switch(i[e++]){case 33:switch(i[e++]){case 255:if(i[e]!==11||i[e+1]==78&&i[e+2]==69&&i[e+3]==84&&i[e+4]==83&&i[e+5]==67&&i[e+6]==65&&i[e+7]==80&&i[e+8]==69&&i[e+9]==50&&i[e+10]==46&&i[e+11]==48&&i[e+12]==3&&i[e+13]==1&&i[e+16]==0)e+=14,g=i[e++]|i[e++]<<8,e++;else for(e+=12;;){if(!((L=i[e++])>=0))throw Error("Invalid block size");if(L===0)break;e+=L}break;case 249:if(i[e++]!==4||i[e+4]!==0)throw new Error("Invalid graphics extension block.");var m=i[e++];u=i[e++]|i[e++]<<8,f=i[e++],1&m||(f=null),d=m>>2&7,e++;break;case 254:for(;;){if(!((L=i[e++])>=0))throw Error("Invalid block size");if(L===0)break;e+=L}break;default:throw new Error("Unknown graphic control label: 0x"+i[e-1].toString(16))}break;case 44:var _=i[e++]|i[e++]<<8,v=i[e++]|i[e++]<<8,x=i[e++]|i[e++]<<8,S=i[e++]|i[e++]<<8,b=i[e++],A=b>>6&1,F=1<<1+(7&b),N=a,R=l,P=!1;b>>7&&(P=!0,N=e,R=F,e+=3*F);var O=e;for(e++;;){var L;if(!((L=i[e++])>=0))throw Error("Invalid block size");if(L===0)break;e+=L}h.push({x:_,y:v,width:x,height:S,has_local_palette:P,palette_offset:N,palette_size:R,data_offset:O,data_length:e-O,transparent_index:f,interlaced:!!A,delay:u,disposal:d});break;case 59:c=!1;break;default:throw new Error("Unknown gif block: 0x"+i[e-1].toString(16))}this.numFrames=function(){return h.length},this.loopCount=function(){return g},this.frameInfo=function(T){if(T<0||T>=h.length)throw new Error("Frame index out of range.");return h[T]},this.decodeAndBlitFrameBGRA=function(T,C){var D=this.frameInfo(T),W=D.width*D.height;if(W>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");var $=new Uint8Array(W);cS(i,D.data_offset,$,W);var B=D.palette_offset,V=D.transparent_index;V===null&&(V=256);var te=D.width,ne=t-te,ae=te,I=4*(D.y*t+D.x),U=4*((D.y+D.height)*t+D.x),K=I,ie=4*ne;D.interlaced===!0&&(ie+=4*t*7);for(var re=8,ce=0,ve=$.length;ce<ve;++ce){var pe=$[ce];if(ae===0&&(ae=te,(K+=ie)>=U&&(ie=4*ne+4*t*(re-1),K=I+(te+ne)*(re<<1),re>>=1)),pe===V)K+=4;else{var le=i[B+3*pe],Ce=i[B+3*pe+1],H=i[B+3*pe+2];C[K++]=H,C[K++]=Ce,C[K++]=le,C[K++]=255}--ae}},this.decodeAndBlitFrameRGBA=function(T,C){var D=this.frameInfo(T),W=D.width*D.height;if(W>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");var $=new Uint8Array(W);cS(i,D.data_offset,$,W);var B=D.palette_offset,V=D.transparent_index;V===null&&(V=256);var te=D.width,ne=t-te,ae=te,I=4*(D.y*t+D.x),U=4*((D.y+D.height)*t+D.x),K=I,ie=4*ne;D.interlaced===!0&&(ie+=4*t*7);for(var re=8,ce=0,ve=$.length;ce<ve;++ce){var pe=$[ce];if(ae===0&&(ae=te,(K+=ie)>=U&&(ie=4*ne+4*t*(re-1),K=I+(te+ne)*(re<<1),re>>=1)),pe===V)K+=4;else{var le=i[B+3*pe],Ce=i[B+3*pe+1],H=i[B+3*pe+2];C[K++]=le,C[K++]=Ce,C[K++]=H,C[K++]=255}--ae}}}function cS(i,e,t,n){for(var r=i[e++],s=1<<r,o=s+1,a=o+1,l=r+1,c=(1<<l)-1,h=0,u=0,f=0,d=i[e++],g=new Int32Array(4096),m=null;;){for(;h<16&&d!==0;)u|=i[e++]<<h,h+=8,d===1?d=i[e++]:--d;if(h<l)break;var _=u&c;if(u>>=l,h-=l,_!==s){if(_===o)break;for(var v=_<a?_:m,x=0,S=v;S>s;)S=g[S]>>8,++x;var b=S;if(f+x+(v!==_?1:0)>n)return void Mi.log("Warning, gif stream longer than expected.");t[f++]=b;var A=f+=x;for(v!==_&&(t[f++]=b),S=v;x--;)S=g[S],t[--A]=255&S,S>>=8;m!==null&&a<4096&&(g[a++]=m<<8|b,a>=c+1&&l<12&&(++l,c=c<<1|1)),m=_}else a=o+1,c=(1<<(l=r+1))-1,m=null}return f!==n&&Mi.log("Warning, gif stream shorter than expected."),t}function ry(i){var e,t,n,r,s,o=Math.floor,a=new Array(64),l=new Array(64),c=new Array(64),h=new Array(64),u=new Array(65535),f=new Array(65535),d=new Array(64),g=new Array(64),m=[],_=0,v=7,x=new Array(64),S=new Array(64),b=new Array(64),A=new Array(256),F=new Array(2048),N=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],R=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],P=[0,1,2,3,4,5,6,7,8,9,10,11],O=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],L=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],T=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],C=[0,1,2,3,4,5,6,7,8,9,10,11],D=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],W=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function $(I,U){for(var K=0,ie=0,re=new Array,ce=1;ce<=16;ce++){for(var ve=1;ve<=I[ce];ve++)re[U[ie]]=[],re[U[ie]][0]=K,re[U[ie]][1]=ce,ie++,K++;K*=2}return re}function B(I){for(var U=I[0],K=I[1]-1;K>=0;)U&1<<K&&(_|=1<<v),K--,--v<0&&(_==255?(V(255),V(0)):V(_),v=7,_=0)}function V(I){m.push(I)}function te(I){V(I>>8&255),V(255&I)}function ne(I,U,K,ie,re){for(var ce,ve=re[0],pe=re[240],le=(function(ge,Te){var _e,Ie,Se,Ge,Be,je,Ke,Xe,qe,st,$e=0;for(qe=0;qe<8;++qe){_e=ge[$e],Ie=ge[$e+1],Se=ge[$e+2],Ge=ge[$e+3],Be=ge[$e+4],je=ge[$e+5],Ke=ge[$e+6];var Jt=_e+(Xe=ge[$e+7]),Ot=_e-Xe,Lt=Ie+Ke,ht=Ie-Ke,Ut=Se+je,ot=Se-je,hi=Ge+Be,dt=Ge-Be,xt=Jt+hi,di=Jt-hi,At=Lt+Ut,gt=Lt-Ut;ge[$e]=xt+At,ge[$e+4]=xt-At;var ii=.707106781*(gt+di);ge[$e+2]=di+ii,ge[$e+6]=di-ii;var En=.382683433*((xt=dt+ot)-(gt=ht+Ot)),Ki=.5411961*xt+En,rn=1.306562965*gt+En,hn=.707106781*(At=ot+ht),tt=Ot+hn,Fn=Ot-hn;ge[$e+5]=Fn+Ki,ge[$e+3]=Fn-Ki,ge[$e+1]=tt+rn,ge[$e+7]=tt-rn,$e+=8}for($e=0,qe=0;qe<8;++qe){_e=ge[$e],Ie=ge[$e+8],Se=ge[$e+16],Ge=ge[$e+24],Be=ge[$e+32],je=ge[$e+40],Ke=ge[$e+48];var On=_e+(Xe=ge[$e+56]),$t=_e-Xe,Si=Ie+Ke,si=Ie-Ke,Sn=Se+je,Qn=Se-je,Xl=Ge+Be,Xa=Ge-Be,Ds=On+Xl,go=On-Xl,ks=Si+Sn,Gs=Si-Sn;ge[$e]=Ds+ks,ge[$e+32]=Ds-ks;var ys=.707106781*(Gs+go);ge[$e+16]=go+ys,ge[$e+48]=go-ys;var Kl=.382683433*((Ds=Xa+Qn)-(Gs=si+$t)),po=.5411961*Ds+Kl,Yl=1.306562965*Gs+Kl,nh=.707106781*(ks=Qn+si),rh=$t+nh,sh=$t-nh;ge[$e+40]=sh+po,ge[$e+24]=sh-po,ge[$e+8]=rh+Yl,ge[$e+56]=rh-Yl,$e++}for(qe=0;qe<64;++qe)st=ge[qe]*Te[qe],d[qe]=st>0?st+.5|0:st-.5|0;return d})(I,U),Ce=0;Ce<64;++Ce)g[N[Ce]]=le[Ce];var H=g[0]-K;K=g[0],H==0?B(ie[0]):(B(ie[f[ce=32767+H]]),B(u[ce]));for(var Z=63;Z>0&&g[Z]==0;)Z--;if(Z==0)return B(ve),K;for(var he,j=1;j<=Z;){for(var fe=j;g[j]==0&&j<=Z;)++j;var Ee=j-fe;if(Ee>=16){he=Ee>>4;for(var Le=1;Le<=he;++Le)B(pe);Ee&=15}ce=32767+g[j],B(re[(Ee<<4)+f[ce]]),B(u[ce]),j++}return Z!=63&&B(ve),K}function ae(I){I=Math.min(Math.max(I,1),100),s!=I&&((function(U){for(var K=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],ie=0;ie<64;ie++){var re=o((K[ie]*U+50)/100);re=Math.min(Math.max(re,1),255),a[N[ie]]=re}for(var ce=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],ve=0;ve<64;ve++){var pe=o((ce[ve]*U+50)/100);pe=Math.min(Math.max(pe,1),255),l[N[ve]]=pe}for(var le=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],Ce=0,H=0;H<8;H++)for(var Z=0;Z<8;Z++)c[Ce]=1/(a[N[Ce]]*le[H]*le[Z]*8),h[Ce]=1/(l[N[Ce]]*le[H]*le[Z]*8),Ce++})(I<50?Math.floor(5e3/I):Math.floor(200-2*I)),s=I)}this.encode=function(I,U){U&&ae(U),m=new Array,_=0,v=7,te(65496),te(65504),te(16),V(74),V(70),V(73),V(70),V(0),V(1),V(1),V(0),te(1),te(1),V(0),V(0),(function(){te(65499),te(132),V(0);for(var Ie=0;Ie<64;Ie++)V(a[Ie]);V(1);for(var Se=0;Se<64;Se++)V(l[Se])})(),(function(Ie,Se){te(65472),te(17),V(8),te(Se),te(Ie),V(3),V(1),V(17),V(0),V(2),V(17),V(1),V(3),V(17),V(1)})(I.width,I.height),(function(){te(65476),te(418),V(0);for(var Ie=0;Ie<16;Ie++)V(R[Ie+1]);for(var Se=0;Se<=11;Se++)V(P[Se]);V(16);for(var Ge=0;Ge<16;Ge++)V(O[Ge+1]);for(var Be=0;Be<=161;Be++)V(L[Be]);V(1);for(var je=0;je<16;je++)V(T[je+1]);for(var Ke=0;Ke<=11;Ke++)V(C[Ke]);V(17);for(var Xe=0;Xe<16;Xe++)V(D[Xe+1]);for(var qe=0;qe<=161;qe++)V(W[qe])})(),te(65498),te(12),V(3),V(1),V(0),V(2),V(17),V(3),V(17),V(0),V(63),V(0);var K=0,ie=0,re=0;_=0,v=7,this.encode.displayName="_encode_";for(var ce,ve,pe,le,Ce,H,Z,he,j,fe=I.data,Ee=I.width,Le=I.height,ge=4*Ee,Te=0;Te<Le;){for(ce=0;ce<ge;){for(Ce=ge*Te+ce,Z=-1,he=0,j=0;j<64;j++)H=Ce+(he=j>>3)*ge+(Z=4*(7&j)),Te+he>=Le&&(H-=ge*(Te+1+he-Le)),ce+Z>=ge&&(H-=ce+Z-ge+4),ve=fe[H++],pe=fe[H++],le=fe[H++],x[j]=(F[ve]+F[pe+256|0]+F[le+512|0]>>16)-128,S[j]=(F[ve+768|0]+F[pe+1024|0]+F[le+1280|0]>>16)-128,b[j]=(F[ve+1280|0]+F[pe+1536|0]+F[le+1792|0]>>16)-128;K=ne(x,c,K,e,n),ie=ne(S,h,ie,t,r),re=ne(b,h,re,t,r),ce+=32}Te+=8}if(v>=0){var _e=[];_e[1]=v+1,_e[0]=(1<<v+1)-1,B(_e)}return te(65497),new Uint8Array(m)},i=i||50,(function(){for(var I=String.fromCharCode,U=0;U<256;U++)A[U]=I(U)})(),e=$(R,P),t=$(T,C),n=$(O,L),r=$(D,W),(function(){for(var I=1,U=2,K=1;K<=15;K++){for(var ie=I;ie<U;ie++)f[32767+ie]=K,u[32767+ie]=[],u[32767+ie][1]=K,u[32767+ie][0]=ie;for(var re=-(U-1);re<=-I;re++)f[32767+re]=K,u[32767+re]=[],u[32767+re][1]=K,u[32767+re][0]=U-1+re;I<<=1,U<<=1}})(),(function(){for(var I=0;I<256;I++)F[I]=19595*I,F[I+256|0]=38470*I,F[I+512|0]=7471*I+32768,F[I+768|0]=-11059*I,F[I+1024|0]=-21709*I,F[I+1280|0]=32768*I+8421375,F[I+1536|0]=-27439*I,F[I+1792|0]=-5329*I})(),ae(i)}function $s(i,e){if(this.pos=0,this.buffer=i,this.datav=new DataView(i.buffer),this.is_with_alpha=!!e,this.bottom_up=!0,this.flag=String.fromCharCode(this.buffer[0])+String.fromCharCode(this.buffer[1]),this.pos+=2,["BM","BA","CI","CP","IC","PT"].indexOf(this.flag)===-1)throw new Error("Invalid BMP File");this.parseHeader(),this.parseBGR()}function hS(i){function e(P){if(!P)throw Error("assert :P")}function t(P,O,L){for(var T=0;4>T;T++)if(P[O+T]!=L.charCodeAt(T))return!0;return!1}function n(P,O,L,T,C){for(var D=0;D<C;D++)P[O+D]=L[T+D]}function r(P,O,L,T){for(var C=0;C<T;C++)P[O+C]=L}function s(P){return new Int32Array(P)}function o(P,O){for(var L=[],T=0;T<P;T++)L.push(new O);return L}function a(P,O){var L=[];return(function T(C,D,W){for(var $=W[D],B=0;B<$&&(C.push(W.length>D+1?[]:new O),!(W.length<D+1));B++)T(C[B],D+1,W)})(L,0,P),L}var l=function(){var P=this;function O(p,y){for(var E=1<<y-1>>>0;p&E;)E>>>=1;return E?(p&E-1)+E:p}function L(p,y,E,M,G){e(!(M%E));do p[y+(M-=E)]=G;while(0<M)}function T(p,y,E,M,G){if(e(2328>=G),512>=G)var z=s(512);else if((z=s(G))==null)return 0;return(function(q,X,Y,J,ue,be){var Q,de,ye=X,Ae=1<<Y,we=s(16),Pe=s(16);for(e(ue!=0),e(J!=null),e(q!=null),e(0<Y),de=0;de<ue;++de){if(15<J[de])return 0;++we[J[de]]}if(we[0]==ue)return 0;for(Pe[1]=0,Q=1;15>Q;++Q){if(we[Q]>1<<Q)return 0;Pe[Q+1]=Pe[Q]+we[Q]}for(de=0;de<ue;++de)Q=J[de],0<J[de]&&(be[Pe[Q]++]=de);if(Pe[15]==1)return(J=new C).g=0,J.value=be[0],L(q,ye,1,Ae,J),Ae;var Re,ke=-1,Fe=Ae-1,lt=0,Ze=1,Dt=1,nt=1<<Y;for(de=0,Q=1,ue=2;Q<=Y;++Q,ue<<=1){if(Ze+=Dt<<=1,0>(Dt-=we[Q]))return 0;for(;0<we[Q];--we[Q])(J=new C).g=Q,J.value=be[de++],L(q,ye+lt,ue,nt,J),lt=O(lt,Q)}for(Q=Y+1,ue=2;15>=Q;++Q,ue<<=1){if(Ze+=Dt<<=1,0>(Dt-=we[Q]))return 0;for(;0<we[Q];--we[Q]){if(J=new C,(lt&Fe)!=ke){for(ye+=nt,Re=1<<(ke=Q)-Y;15>ke&&!(0>=(Re-=we[ke]));)++ke,Re<<=1;Ae+=nt=1<<(Re=ke-Y),q[X+(ke=lt&Fe)].g=Re+Y,q[X+ke].value=ye-X-ke}J.g=Q-Y,J.value=be[de++],L(q,ye+(lt>>Y),ue,nt,J),lt=O(lt,Q)}}return Ze!=2*Pe[15]-1?0:Ae})(p,y,E,M,G,z)}function C(){this.value=this.g=0}function D(){this.value=this.g=0}function W(){this.G=o(5,C),this.H=s(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=o(ac,D)}function $(p,y,E,M){e(p!=null),e(y!=null),e(2147483648>M),p.Ca=254,p.I=0,p.b=-8,p.Ka=0,p.oa=y,p.pa=E,p.Jd=y,p.Yc=E+M,p.Zc=4<=M?E+M-4+1:E,ve(p)}function B(p,y){for(var E=0;0<y--;)E|=le(p,128)<<y;return E}function V(p,y){var E=B(p,y);return pe(p)?-E:E}function te(p,y,E,M){var G,z=0;for(e(p!=null),e(y!=null),e(4294967288>M),p.Sb=M,p.Ra=0,p.u=0,p.h=0,4<M&&(M=4),G=0;G<M;++G)z+=y[E+G]<<8*G;p.Ra=z,p.bb=M,p.oa=y,p.pa=E}function ne(p){for(;8<=p.u&&p.bb<p.Sb;)p.Ra>>>=8,p.Ra+=p.oa[p.pa+p.bb]<<Ja-8>>>0,++p.bb,p.u-=8;ie(p)&&(p.h=1,p.u=0)}function ae(p,y){if(e(0<=y),!p.h&&y<=is){var E=K(p)&ts[y];return p.u+=y,ne(p),E}return p.h=1,p.u=0}function I(){this.b=this.Ca=this.I=0,this.oa=[],this.pa=0,this.Jd=[],this.Yc=0,this.Zc=[],this.Ka=0}function U(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function K(p){return p.Ra>>>(p.u&Ja-1)>>>0}function ie(p){return e(p.bb<=p.Sb),p.h||p.bb==p.Sb&&p.u>Ja}function re(p,y){p.u=y,p.h=ie(p)}function ce(p){p.u>=ca&&(e(p.u>=ca),ne(p))}function ve(p){e(p!=null&&p.oa!=null),p.pa<p.Zc?(p.I=(p.oa[p.pa++]|p.I<<8)>>>0,p.b+=8):(e(p!=null&&p.oa!=null),p.pa<p.Yc?(p.b+=8,p.I=p.oa[p.pa++]|p.I<<8):p.Ka?p.b=0:(p.I<<=8,p.b+=8,p.Ka=1))}function pe(p){return B(p,1)}function le(p,y){var E=p.Ca;0>p.b&&ve(p);var M=p.b,G=E*y>>>8,z=(p.I>>>M>G)+0;for(z?(E-=G,p.I-=G+1<<M>>>0):E=G+1,M=E,G=0;256<=M;)G+=8,M>>=8;return M=7^G+Qa[M],p.b-=M,p.Ca=(E<<M)-1,z}function Ce(p,y,E){p[y+0]=E>>24&255,p[y+1]=E>>16&255,p[y+2]=E>>8&255,p[y+3]=255&E}function H(p,y){return p[y+0]|p[y+1]<<8}function Z(p,y){return H(p,y)|p[y+2]<<16}function he(p,y){return H(p,y)|H(p,y+2)<<16}function j(p,y){var E=1<<y;return e(p!=null),e(0<y),p.X=s(E),p.X==null?0:(p.Mb=32-y,p.Xa=y,1)}function fe(p,y){e(p!=null),e(y!=null),e(p.Xa==y.Xa),n(y.X,0,p.X,0,1<<y.Xa)}function Ee(){this.X=[],this.Xa=this.Mb=0}function Le(p,y,E,M){e(E!=null),e(M!=null);var G=E[0],z=M[0];return G==0&&(G=(p*z+y/2)/y),z==0&&(z=(y*G+p/2)/p),0>=G||0>=z?0:(E[0]=G,M[0]=z,1)}function ge(p,y){return p+(1<<y)-1>>>y}function Te(p,y){return((4278255360&p)+(4278255360&y)>>>0&4278255360)+((16711935&p)+(16711935&y)>>>0&16711935)>>>0}function _e(p,y){P[y]=function(E,M,G,z,q,X,Y){var J;for(J=0;J<q;++J){var ue=P[p](X[Y+J-1],G,z+J);X[Y+J]=Te(E[M+J],ue)}}}function Ie(){this.ud=this.hd=this.jd=0}function Se(p,y){return((4278124286&(p^y))>>>1)+(p&y)>>>0}function Ge(p){return 0<=p&&256>p?p:0>p?0:255<p?255:void 0}function Be(p,y){return Ge(p+(p-y+.5>>1))}function je(p,y,E){return Math.abs(y-E)-Math.abs(p-E)}function Ke(p,y,E,M,G,z,q){for(M=z[q-1],E=0;E<G;++E)z[q+E]=M=Te(p[y+E],M)}function Xe(p,y,E,M,G){var z;for(z=0;z<E;++z){var q=p[y+z],X=q>>8&255,Y=16711935&(Y=(Y=16711935&q)+((X<<16)+X));M[G+z]=(4278255360&q)+Y>>>0}}function qe(p,y){y.jd=255&p,y.hd=p>>8&255,y.ud=p>>16&255}function st(p,y,E,M,G,z){var q;for(q=0;q<M;++q){var X=y[E+q],Y=X>>>8,J=X,ue=255&(ue=(ue=X>>>16)+((p.jd<<24>>24)*(Y<<24>>24)>>>5));J=255&(J=(J+=(p.hd<<24>>24)*(Y<<24>>24)>>>5)+((p.ud<<24>>24)*(ue<<24>>24)>>>5)),G[z+q]=(4278255360&X)+(ue<<16)+J}}function $e(p,y,E,M,G){P[y]=function(z,q,X,Y,J,ue,be,Q,de){for(Y=be;Y<Q;++Y)for(be=0;be<de;++be)J[ue++]=G(X[M(z[q++])])},P[p]=function(z,q,X,Y,J,ue,be){var Q=8>>z.b,de=z.Ea,ye=z.K[0],Ae=z.w;if(8>Q)for(z=(1<<z.b)-1,Ae=(1<<Q)-1;q<X;++q){var we,Pe=0;for(we=0;we<de;++we)we&z||(Pe=M(Y[J++])),ue[be++]=G(ye[Pe&Ae]),Pe>>=Q}else P["VP8LMapColor"+E](Y,J,ye,Ae,ue,be,q,X,de)}}function Jt(p,y,E,M,G){for(E=y+E;y<E;){var z=p[y++];M[G++]=z>>16&255,M[G++]=z>>8&255,M[G++]=255&z}}function Ot(p,y,E,M,G){for(E=y+E;y<E;){var z=p[y++];M[G++]=z>>16&255,M[G++]=z>>8&255,M[G++]=255&z,M[G++]=z>>24&255}}function Lt(p,y,E,M,G){for(E=y+E;y<E;){var z=(q=p[y++])>>16&240|q>>12&15,q=240&q|q>>28&15;M[G++]=z,M[G++]=q}}function ht(p,y,E,M,G){for(E=y+E;y<E;){var z=(q=p[y++])>>16&248|q>>13&7,q=q>>5&224|q>>3&31;M[G++]=z,M[G++]=q}}function Ut(p,y,E,M,G){for(E=y+E;y<E;){var z=p[y++];M[G++]=255&z,M[G++]=z>>8&255,M[G++]=z>>16&255}}function ot(p,y,E,M,G,z){if(z==0)for(E=y+E;y<E;)Ce(M,((z=p[y++])[0]>>24|z[1]>>8&65280|z[2]<<8&16711680|z[3]<<24)>>>0),G+=32;else n(M,G,p,y,E)}function hi(p,y){P[y][0]=P[p+"0"],P[y][1]=P[p+"1"],P[y][2]=P[p+"2"],P[y][3]=P[p+"3"],P[y][4]=P[p+"4"],P[y][5]=P[p+"5"],P[y][6]=P[p+"6"],P[y][7]=P[p+"7"],P[y][8]=P[p+"8"],P[y][9]=P[p+"9"],P[y][10]=P[p+"10"],P[y][11]=P[p+"11"],P[y][12]=P[p+"12"],P[y][13]=P[p+"13"],P[y][14]=P[p+"0"],P[y][15]=P[p+"0"]}function dt(p){return p==_1||p==y1||p==Gg||p==v1}function xt(){this.eb=[],this.size=this.A=this.fb=0}function di(){this.y=[],this.f=[],this.ea=[],this.F=[],this.Tc=this.Ed=this.Cd=this.Fd=this.lb=this.Db=this.Ab=this.fa=this.J=this.W=this.N=this.O=0}function At(){this.Rd=this.height=this.width=this.S=0,this.f={},this.f.RGBA=new xt,this.f.kb=new di,this.sd=null}function gt(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function ii(){this.Id=this.fd=this.Md=this.hb=this.ib=this.da=this.bd=this.cd=this.j=this.v=this.Da=this.Sd=this.ob=0}function En(p){return alert("todo:WebPSamplerProcessPlane"),p.T}function Ki(p,y){var E=p.T,M=y.ba.f.RGBA,G=M.eb,z=M.fb+p.ka*M.A,q=Ss[y.ba.S],X=p.y,Y=p.O,J=p.f,ue=p.N,be=p.ea,Q=p.W,de=y.cc,ye=y.dc,Ae=y.Mc,we=y.Nc,Pe=p.ka,Re=p.ka+p.T,ke=p.U,Fe=ke+1>>1;for(Pe==0?q(X,Y,null,null,J,ue,be,Q,J,ue,be,Q,G,z,null,null,ke):(q(y.ec,y.fc,X,Y,de,ye,Ae,we,J,ue,be,Q,G,z-M.A,G,z,ke),++E);Pe+2<Re;Pe+=2)de=J,ye=ue,Ae=be,we=Q,ue+=p.Rc,Q+=p.Rc,z+=2*M.A,q(X,(Y+=2*p.fa)-p.fa,X,Y,de,ye,Ae,we,J,ue,be,Q,G,z-M.A,G,z,ke);return Y+=p.fa,p.j+Re<p.o?(n(y.ec,y.fc,X,Y,ke),n(y.cc,y.dc,J,ue,Fe),n(y.Mc,y.Nc,be,Q,Fe),E--):1&Re||q(X,Y,null,null,J,ue,be,Q,J,ue,be,Q,G,z+M.A,null,null,ke),E}function rn(p,y,E){var M=p.F,G=[p.J];if(M!=null){var z=p.U,q=y.ba.S,X=q==kg||q==Gg;y=y.ba.f.RGBA;var Y=[0],J=p.ka;Y[0]=p.T,p.Kb&&(J==0?--Y[0]:(--J,G[0]-=p.width),p.j+p.ka+p.T==p.o&&(Y[0]=p.o-p.j-J));var ue=y.eb;J=y.fb+J*y.A,p=O5(M,G[0],p.width,z,Y,ue,J+(X?0:3),y.A),e(E==Y),p&&dt(q)&&pf(ue,J,X,z,Y,y.A)}return 0}function hn(p){var y=p.ma,E=y.ba.S,M=11>E,G=E==Og||E==Dg||E==kg||E==m1||E==12||dt(E);if(y.memory=null,y.Ib=null,y.Jb=null,y.Nd=null,!af(y.Oa,p,G?11:12))return 0;if(G&&dt(E)&&rf(),p.da)alert("todo:use_scaling");else{if(M){if(y.Ib=En,p.Kb){if(E=p.U+1>>1,y.memory=s(p.U+2*E),y.memory==null)return 0;y.ec=y.memory,y.fc=0,y.cc=y.ec,y.dc=y.fc+p.U,y.Mc=y.cc,y.Nc=y.dc+E,y.Ib=Ki,rf()}}else alert("todo:EmitYUV");G&&(y.Jb=rn,M&&js())}if(M&&!Z5){for(p=0;256>p;++p)VM[p]=89858*(p-128)+jg>>Bg,HM[p]=-22014*(p-128)+jg,WM[p]=-45773*(p-128),$M[p]=113618*(p-128)+jg>>Bg;for(p=_f;p<b1;++p)y=76283*(p-16)+jg>>Bg,XM[p-_f]=mo(y,255),KM[p-_f]=mo(y+8>>4,15);Z5=1}return 1}function tt(p){var y=p.ma,E=p.U,M=p.T;return e(!(1&p.ka)),0>=E||0>=M?0:(E=y.Ib(p,y),y.Jb!=null&&y.Jb(p,y,E),y.Dc+=E,1)}function Fn(p){p.ma.memory=null}function On(p,y,E,M){return ae(p,8)!=47?0:(y[0]=ae(p,14)+1,E[0]=ae(p,14)+1,M[0]=ae(p,1),ae(p,3)!=0?0:!p.h)}function $t(p,y){if(4>p)return p+1;var E=p-2>>1;return(2+(1&p)<<E)+ae(y,E)+1}function Si(p,y){return 120<y?y-120:1<=(E=((E=MM[y-1])>>4)*p+(8-(15&E)))?E:1;var E}function si(p,y,E){var M=K(E),G=p[y+=255&M].g-8;return 0<G&&(re(E,E.u+8),M=K(E),y+=p[y].value,y+=M&(1<<G)-1),re(E,E.u+p[y].g),p[y].value}function Sn(p,y,E){return E.g+=p.g,E.value+=p.value<<y>>>0,e(8>=E.g),p.g}function Qn(p,y,E){var M=p.xc;return e((y=M==0?0:p.vc[p.md*(E>>M)+(y>>M)])<p.Wb),p.Ya[y]}function Xl(p,y,E,M){var G=p.ab,z=p.c*y,q=p.C;y=q+y;var X=E,Y=M;for(M=p.Ta,E=p.Ua;0<G--;){var J=p.gc[G],ue=q,be=y,Q=X,de=Y,ye=(Y=M,X=E,J.Ea);switch(e(ue<be),e(be<=J.nc),J.hc){case 2:un(Q,de,(be-ue)*ye,Y,X);break;case 0:var Ae=ue,we=be,Pe=Y,Re=X,ke=(nt=J).Ea;Ae==0&&(cf(Q,de,null,null,1,Pe,Re),Ke(Q,de+1,0,0,ke-1,Pe,Re+1),de+=ke,Re+=ke,++Ae);for(var Fe=1<<nt.b,lt=Fe-1,Ze=ge(ke,nt.b),Dt=nt.K,nt=nt.w+(Ae>>nt.b)*Ze;Ae<we;){var Wt=Dt,Bn=nt,kt=1;for(dh(Q,de,Pe,Re-ke,1,Pe,Re);kt<ke;){var rt=(kt&~lt)+Fe;rt>ke&&(rt=ke),(0,uf[Wt[Bn++]>>8&15])(Q,de+ +kt,Pe,Re+kt-ke,rt-kt,Pe,Re+kt),kt=rt}de+=ke,Re+=ke,++Ae&lt||(nt+=Ze)}be!=J.nc&&n(Y,X-ye,Y,X+(be-ue-1)*ye,ye);break;case 1:for(ye=Q,we=de,ke=(Q=J.Ea)-(Re=Q&~(Pe=(de=1<<J.b)-1)),Ae=ge(Q,J.b),Fe=J.K,J=J.w+(ue>>J.b)*Ae;ue<be;){for(lt=Fe,Ze=J,Dt=new Ie,nt=we+Re,Wt=we+Q;we<nt;)qe(lt[Ze++],Dt),ff(Dt,ye,we,de,Y,X),we+=de,X+=de;we<Wt&&(qe(lt[Ze++],Dt),ff(Dt,ye,we,ke,Y,X),we+=ke,X+=ke),++ue&Pe||(J+=Ae)}break;case 3:if(Q==Y&&de==X&&0<J.b){for(we=Y,Q=ye=X+(be-ue)*ye-(Re=(be-ue)*ge(J.Ea,J.b)),de=Y,Pe=X,Ae=[],Re=(ke=Re)-1;0<=Re;--Re)Ae[Re]=de[Pe+Re];for(Re=ke-1;0<=Re;--Re)we[Q+Re]=Ae[Re];Rg(J,ue,be,Y,ye,Y,X)}else Rg(J,ue,be,Q,de,Y,X)}X=M,Y=E}Y!=E&&n(M,E,X,Y,z)}function Xa(p,y){var E=p.V,M=p.Ba+p.c*p.C,G=y-p.C;if(e(y<=p.l.o),e(16>=G),0<G){var z=p.l,q=p.Ta,X=p.Ua,Y=z.width;if(Xl(p,G,E,M),G=X=[X],e((E=p.C)<(M=y)),e(z.v<z.va),M>z.o&&(M=z.o),E<z.j){var J=z.j-E;E=z.j,G[0]+=J*Y}if(E>=M?E=0:(G[0]+=4*z.v,z.ka=E-z.j,z.U=z.va-z.v,z.T=M-E,E=1),E){if(X=X[0],11>(E=p.ca).S){var ue=E.f.RGBA,be=(M=E.S,G=z.U,z=z.T,J=ue.eb,ue.A),Q=z;for(ue=ue.fb+p.Ma*ue.A;0<Q--;){var de=q,ye=X,Ae=G,we=J,Pe=ue;switch(M){case Fg:df(de,ye,Ae,we,Pe);break;case Og:el(de,ye,Ae,we,Pe);break;case _1:el(de,ye,Ae,we,Pe),pf(we,Pe,0,Ae,1,0);break;case z5:lc(de,ye,Ae,we,Pe);break;case Dg:ot(de,ye,Ae,we,Pe,1);break;case y1:ot(de,ye,Ae,we,Pe,1),pf(we,Pe,0,Ae,1,0);break;case kg:ot(de,ye,Ae,we,Pe,0);break;case Gg:ot(de,ye,Ae,we,Pe,0),pf(we,Pe,1,Ae,1,0);break;case m1:tl(de,ye,Ae,we,Pe);break;case v1:tl(de,ye,Ae,we,Pe),F5(we,Pe,Ae,1,0);break;case q5:il(de,ye,Ae,we,Pe);break;default:e(0)}X+=Y,ue+=be}p.Ma+=z}else alert("todo:EmitRescaledRowsYUVA");e(p.Ma<=E.height)}}p.C=y,e(p.C<=p.i)}function Ds(p){var y;if(0<p.ua)return 0;for(y=0;y<p.Wb;++y){var E=p.Ya[y].G,M=p.Ya[y].H;if(0<E[1][M[1]+0].g||0<E[2][M[2]+0].g||0<E[3][M[3]+0].g)return 0}return 1}function go(p,y,E,M,G,z){if(p.Z!=0){var q=p.qd,X=p.rd;for(e(sl[p.Z]!=null);y<E;++y)sl[p.Z](q,X,M,G,M,G,z),q=M,X=G,G+=z;p.qd=q,p.rd=X}}function ks(p,y){var E=p.l.ma,M=E.Z==0||E.Z==1?p.l.j:p.C;if(M=p.C<M?M:p.C,e(y<=p.l.o),y>M){var G=p.l.width,z=E.ca,q=E.tb+G*M,X=p.V,Y=p.Ba+p.c*M,J=p.gc;e(p.ab==1),e(J[0].hc==3),xo(J[0],M,y,X,Y,z,q),go(E,M,y,z,q,G)}p.C=p.Ma=y}function Gs(p,y,E,M,G,z,q){var X=p.$/M,Y=p.$%M,J=p.m,ue=p.s,be=E+p.$,Q=be;G=E+M*G;var de=E+M*z,ye=280+ue.ua,Ae=p.Pb?X:16777216,we=0<ue.ua?ue.Wa:null,Pe=ue.wc,Re=be<de?Qn(ue,Y,X):null;e(p.C<z),e(de<=G);var ke=!1;e:for(;;){for(;ke||be<de;){var Fe=0;if(X>=Ae){var lt=be-E;e((Ae=p).Pb),Ae.wd=Ae.m,Ae.xd=lt,0<Ae.s.ua&&fe(Ae.s.Wa,Ae.s.vb),Ae=X+IM}if(Y&Pe||(Re=Qn(ue,Y,X)),e(Re!=null),Re.Qb&&(y[be]=Re.qb,ke=!0),!ke)if(ce(J),Re.jc){Fe=J,lt=y;var Ze=be,Dt=Re.pd[K(Fe)&ac-1];e(Re.jc),256>Dt.g?(re(Fe,Fe.u+Dt.g),lt[Ze]=Dt.value,Fe=0):(re(Fe,Fe.u+Dt.g-256),e(256<=Dt.value),Fe=Dt.value),Fe==0&&(ke=!0)}else Fe=si(Re.G[0],Re.H[0],J);if(J.h)break;if(ke||256>Fe){if(!ke)if(Re.nd)y[be]=(Re.qb|Fe<<8)>>>0;else{if(ce(J),ke=si(Re.G[1],Re.H[1],J),ce(J),lt=si(Re.G[2],Re.H[2],J),Ze=si(Re.G[3],Re.H[3],J),J.h)break;y[be]=(Ze<<24|ke<<16|Fe<<8|lt)>>>0}if(ke=!1,++be,++Y>=M&&(Y=0,++X,q!=null&&X<=z&&!(X%16)&&q(p,X),we!=null))for(;Q<be;)Fe=y[Q++],we.X[(506832829*Fe&4294967295)>>>we.Mb]=Fe}else if(280>Fe){if(Fe=$t(Fe-256,J),lt=si(Re.G[4],Re.H[4],J),ce(J),lt=Si(M,lt=$t(lt,J)),J.h)break;if(be-E<lt||G-be<Fe)break e;for(Ze=0;Ze<Fe;++Ze)y[be+Ze]=y[be+Ze-lt];for(be+=Fe,Y+=Fe;Y>=M;)Y-=M,++X,q!=null&&X<=z&&!(X%16)&&q(p,X);if(e(be<=G),Y&Pe&&(Re=Qn(ue,Y,X)),we!=null)for(;Q<be;)Fe=y[Q++],we.X[(506832829*Fe&4294967295)>>>we.Mb]=Fe}else{if(!(Fe<ye))break e;for(ke=Fe-280,e(we!=null);Q<be;)Fe=y[Q++],we.X[(506832829*Fe&4294967295)>>>we.Mb]=Fe;Fe=be,e(!(ke>>>(lt=we).Xa)),y[Fe]=lt.X[ke],ke=!0}ke||e(J.h==ie(J))}if(p.Pb&&J.h&&be<G)e(p.m.h),p.a=5,p.m=p.wd,p.$=p.xd,0<p.s.ua&&fe(p.s.vb,p.s.Wa);else{if(J.h)break e;q?.(p,X>z?z:X),p.a=0,p.$=be-E}return 1}return p.a=3,0}function ys(p){e(p!=null),p.vc=null,p.yc=null,p.Ya=null;var y=p.Wa;y!=null&&(y.X=null),p.vb=null,e(p!=null)}function Kl(){var p=new Tt;return p==null?null:(p.a=0,p.xb=W5,hi("Predictor","VP8LPredictors"),hi("Predictor","VP8LPredictors_C"),hi("PredictorAdd","VP8LPredictorsAdd"),hi("PredictorAdd","VP8LPredictorsAdd_C"),un=Xe,ff=st,df=Jt,el=Ot,tl=Lt,il=ht,lc=Ut,P.VP8LMapColor32b=vo,P.VP8LMapColor8b=hf,p)}function po(p,y,E,M,G){var z=1,q=[p],X=[y],Y=M.m,J=M.s,ue=null,be=0;e:for(;;){if(E)for(;z&&ae(Y,1);){var Q=q,de=X,ye=M,Ae=1,we=ye.m,Pe=ye.gc[ye.ab],Re=ae(we,2);if(ye.Oc&1<<Re)z=0;else{switch(ye.Oc|=1<<Re,Pe.hc=Re,Pe.Ea=Q[0],Pe.nc=de[0],Pe.K=[null],++ye.ab,e(4>=ye.ab),Re){case 0:case 1:Pe.b=ae(we,3)+2,Ae=po(ge(Pe.Ea,Pe.b),ge(Pe.nc,Pe.b),0,ye,Pe.K),Pe.K=Pe.K[0];break;case 3:var ke,Fe=ae(we,8)+1,lt=16<Fe?0:4<Fe?1:2<Fe?2:3;if(Q[0]=ge(Pe.Ea,lt),Pe.b=lt,ke=Ae=po(Fe,1,0,ye,Pe.K)){var Ze,Dt=Fe,nt=Pe,Wt=1<<(8>>nt.b),Bn=s(Wt);if(Bn==null)ke=0;else{var kt=nt.K[0],rt=nt.w;for(Bn[0]=nt.K[0][0],Ze=1;Ze<1*Dt;++Ze)Bn[Ze]=Te(kt[rt+Ze],Bn[Ze-1]);for(;Ze<4*Wt;++Ze)Bn[Ze]=0;nt.K[0]=null,nt.K[0]=Bn,ke=1}}Ae=ke;break;case 2:break;default:e(0)}z=Ae}}if(q=q[0],X=X[0],z&&ae(Y,1)&&!(z=1<=(be=ae(Y,4))&&11>=be)){M.a=3;break e}var ze;if(ze=z)t:{var dn,It,Qt,Bi=M,ir=q,Lr=X,sn=be,fr=E,Cr=Bi.m,jn=Bi.s,ri=[null],vi=1,on=0,xi=RM[sn];i:for(;;){if(fr&&ae(Cr,1)){var nr=ae(Cr,3)+2,zs=ge(ir,nr),gn=ge(Lr,nr),Gr=zs*gn;if(!po(zs,gn,0,Bi,ri))break i;for(ri=ri[0],jn.xc=nr,dn=0;dn<Gr;++dn){var Pi=ri[dn]>>8&65535;ri[dn]=Pi,Pi>=vi&&(vi=Pi+1)}}if(Cr.h)break i;for(It=0;5>It;++It){var Un=V5[It];!It&&0<sn&&(Un+=1<<sn),on<Un&&(on=Un)}var rs=o(vi*xi,C),Ar=vi,ss=o(Ar,W);if(ss==null)var os=null;else e(65536>=Ar),os=ss;var Br=s(on);if(os==null||Br==null||rs==null){Bi.a=1;break i}var as=rs;for(dn=Qt=0;dn<vi;++dn){var Di=os[dn],ls=Di.G,qs=Di.H,hc=0,fa=1,rr=0;for(It=0;5>It;++It){Un=V5[It],ls[It]=as,qs[It]=Qt,!It&&0<sn&&(Un+=1<<sn);r:{var zg,E1=Un,qg=Bi,yf=Br,JM=as,QM=Qt,S1=0,ol=qg.m,eR=ae(ol,1);if(r(yf,0,0,E1),eR){var tR=ae(ol,1)+1,iR=ae(ol,1),ew=ae(ol,iR==0?1:8);yf[ew]=1,tR==2&&(yf[ew=ae(ol,8)]=1);var Vg=1}else{var tw=s(19),iw=ae(ol,4)+4;if(19<iw){qg.a=3;var $g=0;break r}for(zg=0;zg<iw;++zg)tw[PM[zg]]=ae(ol,3);var T1=void 0,vf=void 0,nw=qg,nR=tw,Wg=E1,rw=yf,L1=0,al=nw.m,sw=8,ow=o(128,C);n:for(;T(ow,0,7,nR,19);){if(ae(al,1)){var rR=2+2*ae(al,3);if((T1=2+ae(al,rR))>Wg)break n}else T1=Wg;for(vf=0;vf<Wg&&T1--;){ce(al);var aw=ow[0+(127&K(al))];re(al,al.u+aw.g);var ph=aw.value;if(16>ph)rw[vf++]=ph,ph!=0&&(sw=ph);else{var sR=ph==16,lw=ph-16,oR=CM[lw],cw=ae(al,LM[lw])+oR;if(vf+cw>Wg)break n;for(var aR=sR?sw:0;0<cw--;)rw[vf++]=aR}}L1=1;break n}L1||(nw.a=3),Vg=L1}(Vg=Vg&&!ol.h)&&(S1=T(JM,QM,8,yf,E1)),Vg&&S1!=0?$g=S1:(qg.a=3,$g=0)}if($g==0)break i;if(fa&&AM[It]==1&&(fa=as[Qt].g==0),hc+=as[Qt].g,Qt+=$g,3>=It){var xf,C1=Br[0];for(xf=1;xf<Un;++xf)Br[xf]>C1&&(C1=Br[xf]);rr+=C1}}if(Di.nd=fa,Di.Qb=0,fa&&(Di.qb=(ls[3][qs[3]+0].value<<24|ls[1][qs[1]+0].value<<16|ls[2][qs[2]+0].value)>>>0,hc==0&&256>ls[0][qs[0]+0].value&&(Di.Qb=1,Di.qb+=ls[0][qs[0]+0].value<<8)),Di.jc=!Di.Qb&&6>rr,Di.jc){var Hg,da=Di;for(Hg=0;Hg<ac;++Hg){var ll=Hg,cl=da.pd[ll],Xg=da.G[0][da.H[0]+ll];256<=Xg.value?(cl.g=Xg.g+256,cl.value=Xg.value):(cl.g=0,cl.value=0,ll>>=Sn(Xg,8,cl),ll>>=Sn(da.G[1][da.H[1]+ll],16,cl),ll>>=Sn(da.G[2][da.H[2]+ll],0,cl),Sn(da.G[3][da.H[3]+ll],24,cl))}}}jn.vc=ri,jn.Wb=vi,jn.Ya=os,jn.yc=rs,ze=1;break t}ze=0}if(!(z=ze)){M.a=3;break e}if(0<be){if(J.ua=1<<be,!j(J.Wa,be)){M.a=1,z=0;break e}}else J.ua=0;var A1=M,hw=q,lR=X,P1=A1.s,M1=P1.xc;if(A1.c=hw,A1.i=lR,P1.md=ge(hw,M1),P1.wc=M1==0?-1:(1<<M1)-1,E){M.xb=BM;break e}if((ue=s(q*X))==null){M.a=1,z=0;break e}z=(z=Gs(M,ue,0,q,X,X,null))&&!Y.h;break e}return z?(G!=null?G[0]=ue:(e(ue==null),e(E)),M.$=0,E||ys(J)):ys(J),z}function Yl(p,y){var E=p.c*p.i,M=E+y+16*y;return e(p.c<=y),p.V=s(M),p.V==null?(p.Ta=null,p.Ua=0,p.a=1,0):(p.Ta=p.V,p.Ua=p.Ba+E+y,1)}function nh(p,y){var E=p.C,M=y-E,G=p.V,z=p.Ba+p.c*E;for(e(y<=p.l.o);0<M;){var q=16<M?16:M,X=p.l.ma,Y=p.l.width,J=Y*q,ue=X.ca,be=X.tb+Y*E,Q=p.Ta,de=p.Ua;Xl(p,q,G,z),D5(Q,de,ue,be,J),go(X,E,E+q,ue,be,Y),M-=q,G+=q*p.c,E+=q}e(E==y),p.C=p.Ma=y}function rh(){this.ub=this.yd=this.td=this.Rb=0}function sh(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function Qm(){this.Fb=this.Bb=this.Cb=0,this.Zb=s(4),this.Lb=s(4)}function Wu(){this.Yb=(function(){var p=[];return(function y(E,M,G){for(var z=G[M],q=0;q<z&&(E.push(G.length>M+1?[]:0),!(G.length<M+1));q++)y(E[q],M+1,G)})(p,0,[3,11]),p})()}function dg(){this.jb=s(3),this.Wc=a([4,8],Wu),this.Xc=a([4,17],Wu)}function gg(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new s(4),this.od=new s(4)}function vs(){this.ld=this.La=this.dd=this.tc=0}function Hu(){this.Na=this.la=0}function pg(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function Xu(){this.ad=s(384),this.Za=0,this.Ob=s(16),this.$b=this.Ad=this.ia=this.Gc=this.Hc=this.Dd=0}function mg(){this.uc=this.M=this.Nb=0,this.wa=Array(new vs),this.Y=0,this.ya=Array(new Xu),this.aa=0,this.l=new oh}function _g(){this.y=s(16),this.f=s(8),this.ea=s(8)}function yg(){this.cb=this.a=0,this.sc="",this.m=new I,this.Od=new rh,this.Kc=new sh,this.ed=new gg,this.Qa=new Qm,this.Ic=this.$c=this.Aa=0,this.D=new mg,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=o(8,I),this.ia=0,this.pb=o(4,pg),this.Pa=new dg,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new _g),this.Hd=0,this.rb=Array(new Hu),this.sb=0,this.wa=Array(new vs),this.Y=0,this.oc=[],this.pc=0,this.sa=[],this.ta=0,this.qa=[],this.ra=0,this.Ha=[],this.B=this.R=this.Ia=0,this.Ec=[],this.M=this.ja=this.Vb=this.Fc=0,this.ya=Array(new Xu),this.L=this.aa=0,this.gd=a([4,2],vs),this.ga=null,this.Fa=[],this.Cc=this.qc=this.P=0,this.Gb=[],this.Uc=0,this.mb=[],this.nb=0,this.rc=[],this.Ga=this.Vc=0}function mo(p,y){return 0>p?0:p>y?y:p}function oh(){this.T=this.U=this.ka=this.height=this.width=0,this.y=[],this.f=[],this.ea=[],this.Rc=this.fa=this.W=this.N=this.O=0,this.ma="void",this.put="VP8IoPutHook",this.ac="VP8IoSetupHook",this.bc="VP8IoTeardownHook",this.ha=this.Kb=0,this.data=[],this.hb=this.ib=this.da=this.o=this.j=this.va=this.v=this.Da=this.ob=this.w=0,this.F=[],this.J=0}function e1(){var p=new yg;return p!=null&&(p.a=0,p.sc="OK",p.cb=0,p.Xb=0,mf||(mf=ah)),p}function Tn(p,y,E){return p.a==0&&(p.a=y,p.sc=E,p.cb=0),0}function vg(p,y,E){return 3<=E&&p[y+0]==157&&p[y+1]==1&&p[y+2]==42}function _o(p,y){if(p==null)return 0;if(p.a=0,p.sc="OK",y==null)return Tn(p,2,"null VP8Io passed to VP8GetHeaders()");var E=y.data,M=y.w,G=y.ha;if(4>G)return Tn(p,7,"Truncated header.");var z=E[M+0]|E[M+1]<<8|E[M+2]<<16,q=p.Od;if(q.Rb=!(1&z),q.td=z>>1&7,q.yd=z>>4&1,q.ub=z>>5,3<q.td)return Tn(p,3,"Incorrect keyframe parameters.");if(!q.yd)return Tn(p,4,"Frame not displayable.");M+=3,G-=3;var X=p.Kc;if(q.Rb){if(7>G)return Tn(p,7,"cannot parse picture header");if(!vg(E,M,G))return Tn(p,3,"Bad code word");X.c=16383&(E[M+4]<<8|E[M+3]),X.Td=E[M+4]>>6,X.i=16383&(E[M+6]<<8|E[M+5]),X.Ud=E[M+6]>>6,M+=7,G-=7,p.za=X.c+15>>4,p.Ub=X.i+15>>4,y.width=X.c,y.height=X.i,y.Da=0,y.j=0,y.v=0,y.va=y.width,y.o=y.height,y.da=0,y.ib=y.width,y.hb=y.height,y.U=y.width,y.T=y.height,r((z=p.Pa).jb,0,255,z.jb.length),e((z=p.Qa)!=null),z.Cb=0,z.Bb=0,z.Fb=1,r(z.Zb,0,0,z.Zb.length),r(z.Lb,0,0,z.Lb)}if(q.ub>G)return Tn(p,7,"bad partition length");$(z=p.m,E,M,q.ub),M+=q.ub,G-=q.ub,q.Rb&&(X.Ld=pe(z),X.Kd=pe(z)),X=p.Qa;var Y,J=p.Pa;if(e(z!=null),e(X!=null),X.Cb=pe(z),X.Cb){if(X.Bb=pe(z),pe(z)){for(X.Fb=pe(z),Y=0;4>Y;++Y)X.Zb[Y]=pe(z)?V(z,7):0;for(Y=0;4>Y;++Y)X.Lb[Y]=pe(z)?V(z,6):0}if(X.Bb)for(Y=0;3>Y;++Y)J.jb[Y]=pe(z)?B(z,8):255}else X.Bb=0;if(z.Ka)return Tn(p,3,"cannot parse segment header");if((X=p.ed).zd=pe(z),X.Tb=B(z,6),X.wb=B(z,3),X.Pc=pe(z),X.Pc&&pe(z)){for(J=0;4>J;++J)pe(z)&&(X.vd[J]=V(z,6));for(J=0;4>J;++J)pe(z)&&(X.od[J]=V(z,6))}if(p.L=X.Tb==0?0:X.zd?1:2,z.Ka)return Tn(p,3,"cannot parse filter header");var ue=G;if(G=Y=M,M=Y+ue,X=ue,p.Xb=(1<<B(p.m,2))-1,ue<3*(J=p.Xb))E=7;else{for(Y+=3*J,X-=3*J,ue=0;ue<J;++ue){var be=E[G+0]|E[G+1]<<8|E[G+2]<<16;be>X&&(be=X),$(p.Jc[+ue],E,Y,be),Y+=be,X-=be,G+=3}$(p.Jc[+J],E,Y,X),E=Y<M?0:5}if(E!=0)return Tn(p,E,"cannot parse partitions");for(E=B(Y=p.m,7),G=pe(Y)?V(Y,4):0,M=pe(Y)?V(Y,4):0,X=pe(Y)?V(Y,4):0,J=pe(Y)?V(Y,4):0,Y=pe(Y)?V(Y,4):0,ue=p.Qa,be=0;4>be;++be){if(ue.Cb){var Q=ue.Zb[be];ue.Fb||(Q+=E)}else{if(0<be){p.pb[be]=p.pb[0];continue}Q=E}var de=p.pb[be];de.Sc[0]=x1[mo(Q+G,127)],de.Sc[1]=w1[mo(Q+0,127)],de.Eb[0]=2*x1[mo(Q+M,127)],de.Eb[1]=101581*w1[mo(Q+X,127)]>>16,8>de.Eb[1]&&(de.Eb[1]=8),de.Qc[0]=x1[mo(Q+J,117)],de.Qc[1]=w1[mo(Q+Y,127)],de.lc=Q+Y}if(!q.Rb)return Tn(p,4,"Not a key frame.");for(pe(z),q=p.Pa,E=0;4>E;++E){for(G=0;8>G;++G)for(M=0;3>M;++M)for(X=0;11>X;++X)J=le(z,kM[E][G][M][X])?B(z,8):OM[E][G][M][X],q.Wc[E][G].Yb[M][X]=J;for(G=0;17>G;++G)q.Xc[E][G]=q.Wc[E][GM[G]]}return p.kc=pe(z),p.kc&&(p.Bd=B(z,8)),p.cb=1}function ah(p,y,E,M,G,z,q){var X=y[G].Yb[E];for(E=0;16>G;++G){if(!le(p,X[E+0]))return G;for(;!le(p,X[E+1]);)if(X=y[++G].Yb[0],E=0,G==16)return 16;var Y=y[G+1].Yb;if(le(p,X[E+2])){var J=p,ue=0;if(le(J,(Q=X)[(be=E)+3]))if(le(J,Q[be+6])){for(X=0,be=2*(ue=le(J,Q[be+8]))+(Q=le(J,Q[be+9+ue])),ue=0,Q=NM[be];Q[X];++X)ue+=ue+le(J,Q[X]);ue+=3+(8<<be)}else le(J,Q[be+7])?(ue=7+2*le(J,165),ue+=le(J,145)):ue=5+le(J,159);else ue=le(J,Q[be+4])?3+le(J,Q[be+5]):2;X=Y[2]}else ue=1,X=Y[1];Y=q+FM[G],0>(J=p).b&&ve(J);var be,Q=J.b,de=(be=J.Ca>>1)-(J.I>>Q)>>31;--J.b,J.Ca+=de,J.Ca|=1,J.I-=(be+1&de)<<Q,z[Y]=((ue^de)-de)*M[(0<G)+0]}return 16}function xg(p){var y=p.rb[p.sb-1];y.la=0,y.Na=0,r(p.zc,0,0,p.zc.length),p.ja=0}function xs(p,y,E,M,G){G=p[y+E+32*M]+(G>>3),p[y+E+32*M]=-256&G?0>G?0:255:G}function Dn(p,y,E,M,G,z){xs(p,y,0,E,M+G),xs(p,y,1,E,M+z),xs(p,y,2,E,M-z),xs(p,y,3,E,M-G)}function Qo(p){return(20091*p>>16)+p}function wg(p,y,E,M){var G,z=0,q=s(16);for(G=0;4>G;++G){var X=p[y+0]+p[y+8],Y=p[y+0]-p[y+8],J=(35468*p[y+4]>>16)-Qo(p[y+12]),ue=Qo(p[y+4])+(35468*p[y+12]>>16);q[z+0]=X+ue,q[z+1]=Y+J,q[z+2]=Y-J,q[z+3]=X-ue,z+=4,y++}for(G=z=0;4>G;++G)X=(p=q[z+0]+4)+q[z+8],Y=p-q[z+8],J=(35468*q[z+4]>>16)-Qo(q[z+12]),xs(E,M,0,0,X+(ue=Qo(q[z+4])+(35468*q[z+12]>>16))),xs(E,M,1,0,Y+J),xs(E,M,2,0,Y-J),xs(E,M,3,0,X-ue),z++,M+=32}function t1(p,y,E,M){var G=p[y+0]+4,z=35468*p[y+4]>>16,q=Qo(p[y+4]),X=35468*p[y+1]>>16;Dn(E,M,0,G+q,p=Qo(p[y+1]),X),Dn(E,M,1,G+z,p,X),Dn(E,M,2,G-z,p,X),Dn(E,M,3,G-q,p,X)}function i1(p,y,E,M,G){wg(p,y,E,M),G&&wg(p,y+16,E,M+4)}function yo(p,y,E,M){cc(p,y+0,E,M,1),cc(p,y+32,E,M+128,1)}function bg(p,y,E,M){var G;for(p=p[y+0]+4,G=0;4>G;++G)for(y=0;4>y;++y)xs(E,M,y,G,p)}function Eg(p,y,E,M){p[y+0]&&gi(p,y+0,E,M),p[y+16]&&gi(p,y+16,E,M+4),p[y+32]&&gi(p,y+32,E,M+128),p[y+48]&&gi(p,y+48,E,M+128+4)}function lh(p,y,E,M){var G,z=s(16);for(G=0;4>G;++G){var q=p[y+0+G]+p[y+12+G],X=p[y+4+G]+p[y+8+G],Y=p[y+4+G]-p[y+8+G],J=p[y+0+G]-p[y+12+G];z[0+G]=q+X,z[8+G]=q-X,z[4+G]=J+Y,z[12+G]=J-Y}for(G=0;4>G;++G)q=(p=z[0+4*G]+3)+z[3+4*G],X=z[1+4*G]+z[2+4*G],Y=z[1+4*G]-z[2+4*G],J=p-z[3+4*G],E[M+0]=q+X>>3,E[M+16]=J+Y>>3,E[M+32]=q-X>>3,E[M+48]=J-Y>>3,M+=64}function Zl(p,y,E){var M,G=y-32,z=ns,q=255-p[G-1];for(M=0;M<E;++M){var X,Y=z,J=q+p[y-1];for(X=0;X<E;++X)p[y+X]=Y[J+p[G+X]];y+=32}}function n1(p,y){Zl(p,y,4)}function r1(p,y){Zl(p,y,8)}function s1(p,y){Zl(p,y,16)}function Ku(p,y){var E;for(E=0;16>E;++E)n(p,y+32*E,p,y-32,16)}function Sg(p,y){var E;for(E=16;0<E;--E)r(p,y,p[y-1],16),y+=32}function Bs(p,y,E){var M;for(M=0;16>M;++M)r(y,E+32*M,p,16)}function o1(p,y){var E,M=16;for(E=0;16>E;++E)M+=p[y-1+32*E]+p[y+E-32];Bs(M>>5,p,y)}function Jl(p,y){var E,M=8;for(E=0;16>E;++E)M+=p[y-1+32*E];Bs(M>>4,p,y)}function Yu(p,y){var E,M=8;for(E=0;16>E;++E)M+=p[y+E-32];Bs(M>>4,p,y)}function a1(p,y){Bs(128,p,y)}function Ct(p,y,E){return p+2*y+E+2>>2}function l1(p,y){var E,M=y-32;for(M=new Uint8Array([Ct(p[M-1],p[M+0],p[M+1]),Ct(p[M+0],p[M+1],p[M+2]),Ct(p[M+1],p[M+2],p[M+3]),Ct(p[M+2],p[M+3],p[M+4])]),E=0;4>E;++E)n(p,y+32*E,M,0,M.length)}function c1(p,y){var E=p[y-1],M=p[y-1+32],G=p[y-1+64],z=p[y-1+96];Ce(p,y+0,16843009*Ct(p[y-1-32],E,M)),Ce(p,y+32,16843009*Ct(E,M,G)),Ce(p,y+64,16843009*Ct(M,G,z)),Ce(p,y+96,16843009*Ct(G,z,z))}function h1(p,y){var E,M=4;for(E=0;4>E;++E)M+=p[y+E-32]+p[y-1+32*E];for(M>>=3,E=0;4>E;++E)r(p,y+32*E,M,4)}function ea(p,y){var E=p[y-1+0],M=p[y-1+32],G=p[y-1+64],z=p[y-1-32],q=p[y+0-32],X=p[y+1-32],Y=p[y+2-32],J=p[y+3-32];p[y+0+96]=Ct(M,G,p[y-1+96]),p[y+1+96]=p[y+0+64]=Ct(E,M,G),p[y+2+96]=p[y+1+64]=p[y+0+32]=Ct(z,E,M),p[y+3+96]=p[y+2+64]=p[y+1+32]=p[y+0+0]=Ct(q,z,E),p[y+3+64]=p[y+2+32]=p[y+1+0]=Ct(X,q,z),p[y+3+32]=p[y+2+0]=Ct(Y,X,q),p[y+3+0]=Ct(J,Y,X)}function ta(p,y){var E=p[y+1-32],M=p[y+2-32],G=p[y+3-32],z=p[y+4-32],q=p[y+5-32],X=p[y+6-32],Y=p[y+7-32];p[y+0+0]=Ct(p[y+0-32],E,M),p[y+1+0]=p[y+0+32]=Ct(E,M,G),p[y+2+0]=p[y+1+32]=p[y+0+64]=Ct(M,G,z),p[y+3+0]=p[y+2+32]=p[y+1+64]=p[y+0+96]=Ct(G,z,q),p[y+3+32]=p[y+2+64]=p[y+1+96]=Ct(z,q,X),p[y+3+64]=p[y+2+96]=Ct(q,X,Y),p[y+3+96]=Ct(X,Y,Y)}function u1(p,y){var E=p[y-1+0],M=p[y-1+32],G=p[y-1+64],z=p[y-1-32],q=p[y+0-32],X=p[y+1-32],Y=p[y+2-32],J=p[y+3-32];p[y+0+0]=p[y+1+64]=z+q+1>>1,p[y+1+0]=p[y+2+64]=q+X+1>>1,p[y+2+0]=p[y+3+64]=X+Y+1>>1,p[y+3+0]=Y+J+1>>1,p[y+0+96]=Ct(G,M,E),p[y+0+64]=Ct(M,E,z),p[y+0+32]=p[y+1+96]=Ct(E,z,q),p[y+1+32]=p[y+2+96]=Ct(z,q,X),p[y+2+32]=p[y+3+96]=Ct(q,X,Y),p[y+3+32]=Ct(X,Y,J)}function f1(p,y){var E=p[y+0-32],M=p[y+1-32],G=p[y+2-32],z=p[y+3-32],q=p[y+4-32],X=p[y+5-32],Y=p[y+6-32],J=p[y+7-32];p[y+0+0]=E+M+1>>1,p[y+1+0]=p[y+0+64]=M+G+1>>1,p[y+2+0]=p[y+1+64]=G+z+1>>1,p[y+3+0]=p[y+2+64]=z+q+1>>1,p[y+0+32]=Ct(E,M,G),p[y+1+32]=p[y+0+96]=Ct(M,G,z),p[y+2+32]=p[y+1+96]=Ct(G,z,q),p[y+3+32]=p[y+2+96]=Ct(z,q,X),p[y+3+64]=Ct(q,X,Y),p[y+3+96]=Ct(X,Y,J)}function ch(p,y){var E=p[y-1+0],M=p[y-1+32],G=p[y-1+64],z=p[y-1+96];p[y+0+0]=E+M+1>>1,p[y+2+0]=p[y+0+32]=M+G+1>>1,p[y+2+32]=p[y+0+64]=G+z+1>>1,p[y+1+0]=Ct(E,M,G),p[y+3+0]=p[y+1+32]=Ct(M,G,z),p[y+3+32]=p[y+1+64]=Ct(G,z,z),p[y+3+64]=p[y+2+64]=p[y+0+96]=p[y+1+96]=p[y+2+96]=p[y+3+96]=z}function Zu(p,y){var E=p[y-1+0],M=p[y-1+32],G=p[y-1+64],z=p[y-1+96],q=p[y-1-32],X=p[y+0-32],Y=p[y+1-32],J=p[y+2-32];p[y+0+0]=p[y+2+32]=E+q+1>>1,p[y+0+32]=p[y+2+64]=M+E+1>>1,p[y+0+64]=p[y+2+96]=G+M+1>>1,p[y+0+96]=z+G+1>>1,p[y+3+0]=Ct(X,Y,J),p[y+2+0]=Ct(q,X,Y),p[y+1+0]=p[y+3+32]=Ct(E,q,X),p[y+1+32]=p[y+3+64]=Ct(M,E,q),p[y+1+64]=p[y+3+96]=Ct(G,M,E),p[y+1+96]=Ct(z,G,M)}function Ql(p,y){var E;for(E=0;8>E;++E)n(p,y+32*E,p,y-32,8)}function d1(p,y){var E;for(E=0;8>E;++E)r(p,y,p[y-1],8),y+=32}function ia(p,y,E){var M;for(M=0;8>M;++M)r(y,E+32*M,p,8)}function g1(p,y){var E,M=8;for(E=0;8>E;++E)M+=p[y+E-32]+p[y-1+32*E];ia(M>>4,p,y)}function Ju(p,y){var E,M=4;for(E=0;8>E;++E)M+=p[y+E-32];ia(M>>3,p,y)}function Qu(p,y){var E,M=4;for(E=0;8>E;++E)M+=p[y-1+32*E];ia(M>>3,p,y)}function Tg(p,y){ia(128,p,y)}function na(p,y,E){var M=p[y-E],G=p[y+0],z=3*(G-M)+p1[1020+p[y-2*E]-p[y+E]],q=Ng[112+(z+4>>3)];p[y-E]=ns[255+M+Ng[112+(z+3>>3)]],p[y+0]=ns[255+G-q]}function ef(p,y,E,M){var G=p[y+0],z=p[y+E];return Es[255+p[y-2*E]-p[y-E]]>M||Es[255+z-G]>M}function hh(p,y,E,M){return 4*Es[255+p[y-E]-p[y+0]]+Es[255+p[y-2*E]-p[y+E]]<=M}function tf(p,y,E,M,G){var z=p[y-3*E],q=p[y-2*E],X=p[y-E],Y=p[y+0],J=p[y+E],ue=p[y+2*E],be=p[y+3*E];return 4*Es[255+X-Y]+Es[255+q-J]>M?0:Es[255+p[y-4*E]-z]<=G&&Es[255+z-q]<=G&&Es[255+q-X]<=G&&Es[255+be-ue]<=G&&Es[255+ue-J]<=G&&Es[255+J-Y]<=G}function ec(p,y,E,M){var G=2*M+1;for(M=0;16>M;++M)hh(p,y+M,E,G)&&na(p,y+M,E)}function nf(p,y,E,M){var G=2*M+1;for(M=0;16>M;++M)hh(p,y+M*E,1,G)&&na(p,y+M*E,1)}function Lg(p,y,E,M){var G;for(G=3;0<G;--G)ec(p,y+=4*E,E,M)}function Cg(p,y,E,M){var G;for(G=3;0<G;--G)nf(p,y+=4,E,M)}function ra(p,y,E,M,G,z,q,X){for(z=2*z+1;0<G--;){if(tf(p,y,E,z,q))if(ef(p,y,E,X))na(p,y,E);else{var Y=p,J=y,ue=E,be=Y[J-2*ue],Q=Y[J-ue],de=Y[J+0],ye=Y[J+ue],Ae=Y[J+2*ue],we=27*(Re=p1[1020+3*(de-Q)+p1[1020+be-ye]])+63>>7,Pe=18*Re+63>>7,Re=9*Re+63>>7;Y[J-3*ue]=ns[255+Y[J-3*ue]+Re],Y[J-2*ue]=ns[255+be+Pe],Y[J-ue]=ns[255+Q+we],Y[J+0]=ns[255+de-we],Y[J+ue]=ns[255+ye-Pe],Y[J+2*ue]=ns[255+Ae-Re]}y+=M}}function sa(p,y,E,M,G,z,q,X){for(z=2*z+1;0<G--;){if(tf(p,y,E,z,q))if(ef(p,y,E,X))na(p,y,E);else{var Y=p,J=y,ue=E,be=Y[J-ue],Q=Y[J+0],de=Y[J+ue],ye=Ng[112+(4+(Ae=3*(Q-be))>>3)],Ae=Ng[112+(Ae+3>>3)],we=ye+1>>1;Y[J-2*ue]=ns[255+Y[J-2*ue]+we],Y[J-ue]=ns[255+be+Ae],Y[J+0]=ns[255+Q-ye],Y[J+ue]=ns[255+de-we]}y+=M}}function Ag(p,y,E,M,G,z){ra(p,y,E,1,16,M,G,z)}function tc(p,y,E,M,G,z){ra(p,y,1,E,16,M,G,z)}function Pg(p,y,E,M,G,z){var q;for(q=3;0<q;--q)sa(p,y+=4*E,E,1,16,M,G,z)}function w(p,y,E,M,G,z){var q;for(q=3;0<q;--q)sa(p,y+=4,1,E,16,M,G,z)}function k(p,y,E,M,G,z,q,X){ra(p,y,G,1,8,z,q,X),ra(E,M,G,1,8,z,q,X)}function ee(p,y,E,M,G,z,q,X){ra(p,y,1,G,8,z,q,X),ra(E,M,1,G,8,z,q,X)}function oe(p,y,E,M,G,z,q,X){sa(p,y+4*G,G,1,8,z,q,X),sa(E,M+4*G,G,1,8,z,q,X)}function me(p,y,E,M,G,z,q,X){sa(p,y+4,1,G,8,z,q,X),sa(E,M+4,1,G,8,z,q,X)}function Me(){this.ba=new At,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new ii,this.memory=0,this.Ib="OutputFunc",this.Jb="OutputAlphaFunc",this.Nd="OutputRowFunc"}function Ne(){this.data=[],this.offset=this.kd=this.ha=this.w=0,this.na=[],this.xa=this.gb=this.Ja=this.Sa=this.P=0}function it(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function at(){this.ua=0,this.Wa=new Ee,this.vb=new Ee,this.md=this.xc=this.wc=0,this.vc=[],this.Wb=0,this.Ya=new W,this.yc=new C}function Tt(){this.xb=this.a=0,this.l=new oh,this.ca=new At,this.V=[],this.Ba=0,this.Ta=[],this.Ua=0,this.m=new U,this.Pb=0,this.wd=new U,this.Ma=this.$=this.C=this.i=this.c=this.xd=0,this.s=new at,this.ab=0,this.gc=o(4,it),this.Oc=0}function Ft(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new oh,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function ni(p,y,E,M,G,z,q){for(p=p==null?0:p[y+0],y=0;y<q;++y)G[z+y]=p+E[M+y]&255,p=G[z+y]}function Qi(p,y,E,M,G,z,q){var X;if(p==null)ni(null,null,E,M,G,z,q);else for(X=0;X<q;++X)G[z+X]=p[y+X]+E[M+X]&255}function Ln(p,y,E,M,G,z,q){if(p==null)ni(null,null,E,M,G,z,q);else{var X,Y=p[y+0],J=Y,ue=Y;for(X=0;X<q;++X)J=ue+(Y=p[y+X])-J,ue=E[M+X]+(-256&J?0>J?0:255:J)&255,J=Y,G[z+X]=ue}}function Oi(p,y,E,M){var G=y.width,z=y.o;if(e(p!=null&&y!=null),0>E||0>=M||E+M>z)return null;if(!p.Cc){if(p.ga==null){var q;if(p.ga=new Ft,(q=p.ga==null)||(q=y.width*y.o,e(p.Gb.length==0),p.Gb=s(q),p.Uc=0,p.Gb==null?q=0:(p.mb=p.Gb,p.nb=p.Uc,p.rc=null,q=1),q=!q),!q){q=p.ga;var X=p.Fa,Y=p.P,J=p.qc,ue=p.mb,be=p.nb,Q=Y+1,de=J-1,ye=q.l;if(e(X!=null&&ue!=null&&y!=null),sl[0]=null,sl[1]=ni,sl[2]=Qi,sl[3]=Ln,q.ca=ue,q.tb=be,q.c=y.width,q.i=y.height,e(0<q.c&&0<q.i),1>=J)y=0;else if(q.$a=3&X[Y+0],q.Z=X[Y+0]>>2&3,q.Lc=X[Y+0]>>4&3,Y=X[Y+0]>>6&3,0>q.$a||1<q.$a||4<=q.Z||1<q.Lc||Y)y=0;else if(ye.put=tt,ye.ac=hn,ye.bc=Fn,ye.ma=q,ye.width=y.width,ye.height=y.height,ye.Da=y.Da,ye.v=y.v,ye.va=y.va,ye.j=y.j,ye.o=y.o,q.$a)e:{e(q.$a==1),y=Kl();t:for(;;){if(y==null){y=0;break e}if(e(q!=null),q.mc=y,y.c=q.c,y.i=q.i,y.l=q.l,y.l.ma=q,y.l.width=q.c,y.l.height=q.i,y.a=0,te(y.m,X,Q,de),!po(q.c,q.i,1,y,null)||(y.ab==1&&y.gc[0].hc==3&&Ds(y.s)?(q.ic=1,X=y.c*y.i,y.Ta=null,y.Ua=0,y.V=s(X),y.Ba=0,y.V==null?(y.a=1,y=0):y=1):(q.ic=0,y=Yl(y,q.c)),!y))break t;y=1;break e}q.mc=null,y=0}else y=de>=q.c*q.i;q=!y}if(q)return null;p.ga.Lc!=1?p.Ga=0:M=z-E}e(p.ga!=null),e(E+M<=z);e:{if(y=(X=p.ga).c,z=X.l.o,X.$a==0){if(Q=p.rc,de=p.Vc,ye=p.Fa,Y=p.P+1+E*y,J=p.mb,ue=p.nb+E*y,e(Y<=p.P+p.qc),X.Z!=0)for(e(sl[X.Z]!=null),q=0;q<M;++q)sl[X.Z](Q,de,ye,Y,J,ue,y),Q=J,de=ue,ue+=y,Y+=y;else for(q=0;q<M;++q)n(J,ue,ye,Y,y),Q=J,de=ue,ue+=y,Y+=y;p.rc=Q,p.Vc=de}else{if(e(X.mc!=null),y=E+M,e((q=X.mc)!=null),e(y<=q.i),q.C>=y)y=1;else if(X.ic||js(),X.ic){X=q.V,Q=q.Ba,de=q.c;var Ae=q.i,we=(ye=1,Y=q.$/de,J=q.$%de,ue=q.m,be=q.s,q.$),Pe=de*Ae,Re=de*y,ke=be.wc,Fe=we<Re?Qn(be,J,Y):null;e(we<=Pe),e(y<=Ae),e(Ds(be));t:for(;;){for(;!ue.h&&we<Re;){if(J&ke||(Fe=Qn(be,J,Y)),e(Fe!=null),ce(ue),256>(Ae=si(Fe.G[0],Fe.H[0],ue)))X[Q+we]=Ae,++we,++J>=de&&(J=0,++Y<=y&&!(Y%16)&&ks(q,Y));else{if(!(280>Ae)){ye=0;break t}Ae=$t(Ae-256,ue);var lt,Ze=si(Fe.G[4],Fe.H[4],ue);if(ce(ue),!(we>=(Ze=Si(de,Ze=$t(Ze,ue)))&&Pe-we>=Ae)){ye=0;break t}for(lt=0;lt<Ae;++lt)X[Q+we+lt]=X[Q+we+lt-Ze];for(we+=Ae,J+=Ae;J>=de;)J-=de,++Y<=y&&!(Y%16)&&ks(q,Y);we<Re&&J&ke&&(Fe=Qn(be,J,Y))}e(ue.h==ie(ue))}ks(q,Y>y?y:Y);break t}!ye||ue.h&&we<Pe?(ye=0,q.a=ue.h?5:3):q.$=we,y=ye}else y=Gs(q,q.V,q.Ba,q.c,q.i,y,nh);if(!y){M=0;break e}}E+M>=z&&(p.Cc=1),M=1}if(!M)return null;if(p.Cc&&((M=p.ga)!=null&&(M.mc=null),p.ga=null,0<p.Ga))return alert("todo:WebPDequantizeLevels"),null}return p.nb+E*G}function kn(p,y,E,M,G,z){for(;0<G--;){var q,X=p,Y=y+(E?1:0),J=p,ue=y+(E?0:3);for(q=0;q<M;++q){var be=J[ue+4*q];be!=255&&(be*=32897,X[Y+4*q+0]=X[Y+4*q+0]*be>>23,X[Y+4*q+1]=X[Y+4*q+1]*be>>23,X[Y+4*q+2]=X[Y+4*q+2]*be>>23)}y+=z}}function Cn(p,y,E,M,G){for(;0<M--;){var z;for(z=0;z<E;++z){var q=p[y+2*z+0],X=15&(J=p[y+2*z+1]),Y=4369*X,J=(240&J|J>>4)*Y>>16;p[y+2*z+0]=(240&q|q>>4)*Y>>16&240|(15&q|q<<4)*Y>>16>>4&15,p[y+2*z+1]=240&J|X}y+=G}}function er(p,y,E,M,G,z,q,X){var Y,J,ue=255;for(J=0;J<G;++J){for(Y=0;Y<M;++Y){var be=p[y+Y];z[q+4*Y]=be,ue&=be}y+=E,q+=X}return ue!=255}function oa(p,y,E,M,G){var z;for(z=0;z<G;++z)E[M+z]=p[y+z]>>8}function js(){pf=kn,F5=Cn,O5=er,D5=oa}function aa(p,y,E){P[p]=function(M,G,z,q,X,Y,J,ue,be,Q,de,ye,Ae,we,Pe,Re,ke){var Fe,lt=ke-1>>1,Ze=X[Y+0]|J[ue+0]<<16,Dt=be[Q+0]|de[ye+0]<<16;e(M!=null);var nt=3*Ze+Dt+131074>>2;for(y(M[G+0],255&nt,nt>>16,Ae,we),z!=null&&(nt=3*Dt+Ze+131074>>2,y(z[q+0],255&nt,nt>>16,Pe,Re)),Fe=1;Fe<=lt;++Fe){var Wt=X[Y+Fe]|J[ue+Fe]<<16,Bn=be[Q+Fe]|de[ye+Fe]<<16,kt=Ze+Wt+Dt+Bn+524296,rt=kt+2*(Wt+Dt)>>3;nt=rt+Ze>>1,Ze=(kt=kt+2*(Ze+Bn)>>3)+Wt>>1,y(M[G+2*Fe-1],255&nt,nt>>16,Ae,we+(2*Fe-1)*E),y(M[G+2*Fe-0],255&Ze,Ze>>16,Ae,we+(2*Fe-0)*E),z!=null&&(nt=kt+Dt>>1,Ze=rt+Bn>>1,y(z[q+2*Fe-1],255&nt,nt>>16,Pe,Re+(2*Fe-1)*E),y(z[q+2*Fe+0],255&Ze,Ze>>16,Pe,Re+(2*Fe+0)*E)),Ze=Wt,Dt=Bn}1&ke||(nt=3*Ze+Dt+131074>>2,y(M[G+ke-1],255&nt,nt>>16,Ae,we+(ke-1)*E),z!=null&&(nt=3*Dt+Ze+131074>>2,y(z[q+ke-1],255&nt,nt>>16,Pe,Re+(ke-1)*E)))}}function rf(){Ss[Fg]=jM,Ss[Og]=H5,Ss[z5]=UM,Ss[Dg]=X5,Ss[kg]=K5,Ss[m1]=Y5,Ss[q5]=zM,Ss[_1]=H5,Ss[y1]=X5,Ss[Gg]=K5,Ss[v1]=Y5}function uh(p){return p&-16384?0>p?0:255:p>>qM}function Ka(p,y){return uh((19077*p>>8)+(26149*y>>8)-14234)}function ic(p,y,E){return uh((19077*p>>8)-(6419*y>>8)-(13320*E>>8)+8708)}function nc(p,y){return uh((19077*p>>8)+(33050*y>>8)-17685)}function Ya(p,y,E,M,G){M[G+0]=Ka(p,E),M[G+1]=ic(p,y,E),M[G+2]=nc(p,y)}function tr(p,y,E,M,G){M[G+0]=nc(p,y),M[G+1]=ic(p,y,E),M[G+2]=Ka(p,E)}function rc(p,y,E,M,G){var z=ic(p,y,E);y=z<<3&224|nc(p,y)>>3,M[G+0]=248&Ka(p,E)|z>>5,M[G+1]=y}function sc(p,y,E,M,G){var z=240&nc(p,y)|15;M[G+0]=240&Ka(p,E)|ic(p,y,E)>>4,M[G+1]=z}function sf(p,y,E,M,G){M[G+0]=255,Ya(p,y,E,M,G+1)}function of(p,y,E,M,G){tr(p,y,E,M,G),M[G+3]=255}function Tr(p,y,E,M,G){Ya(p,y,E,M,G),M[G+3]=255}function la(p,y,E){P[p]=function(M,G,z,q,X,Y,J,ue,be){for(var Q=ue+(-2&be)*E;ue!=Q;)y(M[G+0],z[q+0],X[Y+0],J,ue),y(M[G+1],z[q+0],X[Y+0],J,ue+E),G+=2,++q,++Y,ue+=2*E;1&be&&y(M[G+0],z[q+0],X[Y+0],J,ue)}}function fh(p,y,E){return E==0?p==0?y==0?6:5:y==0?4:0:E}function Mg(p,y,E,M,G){switch(p>>>30){case 3:cc(y,E,M,G,0);break;case 2:bs(y,E,M,G);break;case 1:gi(y,E,M,G)}}function ws(p,y){var E,M,G=y.M,z=y.Nb,q=p.oc,X=p.pc+40,Y=p.oc,J=p.pc+584,ue=p.oc,be=p.pc+600;for(E=0;16>E;++E)q[X+32*E-1]=129;for(E=0;8>E;++E)Y[J+32*E-1]=129,ue[be+32*E-1]=129;for(0<G?q[X-1-32]=Y[J-1-32]=ue[be-1-32]=129:(r(q,X-32-1,127,21),r(Y,J-32-1,127,9),r(ue,be-32-1,127,9)),M=0;M<p.za;++M){var Q=y.ya[y.aa+M];if(0<M){for(E=-1;16>E;++E)n(q,X+32*E-4,q,X+32*E+12,4);for(E=-1;8>E;++E)n(Y,J+32*E-4,Y,J+32*E+4,4),n(ue,be+32*E-4,ue,be+32*E+4,4)}var de=p.Gd,ye=p.Hd+M,Ae=Q.ad,we=Q.Hc;if(0<G&&(n(q,X-32,de[ye].y,0,16),n(Y,J-32,de[ye].f,0,8),n(ue,be-32,de[ye].ea,0,8)),Q.Za){var Pe=q,Re=X-32+16;for(0<G&&(M>=p.za-1?r(Pe,Re,de[ye].y[15],4):n(Pe,Re,de[ye+1].y,0,4)),E=0;4>E;E++)Pe[Re+128+E]=Pe[Re+256+E]=Pe[Re+384+E]=Pe[Re+0+E];for(E=0;16>E;++E,we<<=2)Pe=q,Re=X+J5[E],Us[Q.Ob[E]](Pe,Re),Mg(we,Ae,16*+E,Pe,Re)}else if(Pe=fh(M,G,Q.Ob[0]),rl[Pe](q,X),we!=0)for(E=0;16>E;++E,we<<=2)Mg(we,Ae,16*+E,q,X+J5[E]);for(E=Q.Gc,Pe=fh(M,G,Q.Dd),ua[Pe](Y,J),ua[Pe](ue,be),we=Ae,Pe=Y,Re=J,255&(Q=0|E)&&(170&Q?wo(we,256,Pe,Re):Ai(we,256,Pe,Re)),Q=ue,we=be,255&(E>>=8)&&(170&E?wo(Ae,320,Q,we):Ai(Ae,320,Q,we)),G<p.Ub-1&&(n(de[ye].y,0,q,X+480,16),n(de[ye].f,0,Y,J+224,8),n(de[ye].ea,0,ue,be+224,8)),E=8*z*p.B,de=p.sa,ye=p.ta+16*M+16*z*p.R,Ae=p.qa,Q=p.ra+8*M+E,we=p.Ha,Pe=p.Ia+8*M+E,E=0;16>E;++E)n(de,ye+E*p.R,q,X+32*E,16);for(E=0;8>E;++E)n(Ae,Q+E*p.B,Y,J+32*E,8),n(we,Pe+E*p.B,ue,be+32*E,8)}}function oc(p,y,E,M,G,z,q,X,Y){var J=[0],ue=[0],be=0,Q=Y!=null?Y.kd:0,de=Y??new Ne;if(p==null||12>E)return 7;de.data=p,de.w=y,de.ha=E,y=[y],E=[E],de.gb=[de.gb];e:{var ye=y,Ae=E,we=de.gb;if(e(p!=null),e(Ae!=null),e(we!=null),we[0]=0,12<=Ae[0]&&!t(p,ye[0],"RIFF")){if(t(p,ye[0]+8,"WEBP")){we=3;break e}var Pe=he(p,ye[0]+4);if(12>Pe||4294967286<Pe){we=3;break e}if(Q&&Pe>Ae[0]-8){we=7;break e}we[0]=Pe,ye[0]+=12,Ae[0]-=12}we=0}if(we!=0)return we;for(Pe=0<de.gb[0],E=E[0];;){e:{var Re=p;Ae=y,we=E;var ke=J,Fe=ue,lt=ye=[0];if((nt=be=[be])[0]=0,8>we[0])we=7;else{if(!t(Re,Ae[0],"VP8X")){if(he(Re,Ae[0]+4)!=10){we=3;break e}if(18>we[0]){we=7;break e}var Ze=he(Re,Ae[0]+8),Dt=1+Z(Re,Ae[0]+12);if(2147483648<=Dt*(Re=1+Z(Re,Ae[0]+15))){we=3;break e}lt!=null&&(lt[0]=Ze),ke!=null&&(ke[0]=Dt),Fe!=null&&(Fe[0]=Re),Ae[0]+=18,we[0]-=18,nt[0]=1}we=0}}if(be=be[0],ye=ye[0],we!=0)return we;if(Ae=!!(2&ye),!Pe&&be)return 3;if(z!=null&&(z[0]=!!(16&ye)),q!=null&&(q[0]=Ae),X!=null&&(X[0]=0),q=J[0],ye=ue[0],be&&Ae&&Y==null){we=0;break}if(4>E){we=7;break}if(Pe&&be||!Pe&&!be&&!t(p,y[0],"ALPH")){E=[E],de.na=[de.na],de.P=[de.P],de.Sa=[de.Sa];e:{Ze=p,we=y,Pe=E;var nt=de.gb;ke=de.na,Fe=de.P,lt=de.Sa,Dt=22,e(Ze!=null),e(Pe!=null),Re=we[0];var Wt=Pe[0];for(e(ke!=null),e(lt!=null),ke[0]=null,Fe[0]=null,lt[0]=0;;){if(we[0]=Re,Pe[0]=Wt,8>Wt){we=7;break e}var Bn=he(Ze,Re+4);if(4294967286<Bn){we=3;break e}var kt=8+Bn+1&-2;if(Dt+=kt,0<nt&&Dt>nt){we=3;break e}if(!t(Ze,Re,"VP8 ")||!t(Ze,Re,"VP8L")){we=0;break e}if(Wt[0]<kt){we=7;break e}t(Ze,Re,"ALPH")||(ke[0]=Ze,Fe[0]=Re+8,lt[0]=Bn),Re+=kt,Wt-=kt}}if(E=E[0],de.na=de.na[0],de.P=de.P[0],de.Sa=de.Sa[0],we!=0)break}E=[E],de.Ja=[de.Ja],de.xa=[de.xa];e:if(nt=p,we=y,Pe=E,ke=de.gb[0],Fe=de.Ja,lt=de.xa,Ze=we[0],Re=!t(nt,Ze,"VP8 "),Dt=!t(nt,Ze,"VP8L"),e(nt!=null),e(Pe!=null),e(Fe!=null),e(lt!=null),8>Pe[0])we=7;else{if(Re||Dt){if(nt=he(nt,Ze+4),12<=ke&&nt>ke-12){we=3;break e}if(Q&&nt>Pe[0]-8){we=7;break e}Fe[0]=nt,we[0]+=8,Pe[0]-=8,lt[0]=Dt}else lt[0]=5<=Pe[0]&&nt[Ze+0]==47&&!(nt[Ze+4]>>5),Fe[0]=Pe[0];we=0}if(E=E[0],de.Ja=de.Ja[0],de.xa=de.xa[0],y=y[0],we!=0)break;if(4294967286<de.Ja)return 3;if(X==null||Ae||(X[0]=de.xa?2:1),q=[q],ye=[ye],de.xa){if(5>E){we=7;break}X=q,Q=ye,Ae=z,p==null||5>E?p=0:5<=E&&p[y+0]==47&&!(p[y+4]>>5)?(Pe=[0],nt=[0],ke=[0],te(Fe=new U,p,y,E),On(Fe,Pe,nt,ke)?(X!=null&&(X[0]=Pe[0]),Q!=null&&(Q[0]=nt[0]),Ae!=null&&(Ae[0]=ke[0]),p=1):p=0):p=0}else{if(10>E){we=7;break}X=ye,p==null||10>E||!vg(p,y+3,E-3)?p=0:(Q=p[y+0]|p[y+1]<<8|p[y+2]<<16,Ae=16383&(p[y+7]<<8|p[y+6]),p=16383&(p[y+9]<<8|p[y+8]),1&Q||3<(Q>>1&7)||!(Q>>4&1)||Q>>5>=de.Ja||!Ae||!p?p=0:(q&&(q[0]=Ae),X&&(X[0]=p),p=1))}if(!p||(q=q[0],ye=ye[0],be&&(J[0]!=q||ue[0]!=ye)))return 3;Y!=null&&(Y[0]=de,Y.offset=y-Y.w,e(4294967286>y-Y.w),e(Y.offset==Y.ha-E));break}return we==0||we==7&&be&&Y==null?(z!=null&&(z[0]|=de.na!=null&&0<de.na.length),M!=null&&(M[0]=q),G!=null&&(G[0]=ye),0):we}function af(p,y,E){var M=y.width,G=y.height,z=0,q=0,X=M,Y=G;if(y.Da=p!=null&&0<p.Da,y.Da&&(X=p.cd,Y=p.bd,z=p.v,q=p.j,11>E||(z&=-2,q&=-2),0>z||0>q||0>=X||0>=Y||z+X>M||q+Y>G))return 0;if(y.v=z,y.j=q,y.va=z+X,y.o=q+Y,y.U=X,y.T=Y,y.da=p!=null&&0<p.da,y.da){if(!Le(X,Y,E=[p.ib],z=[p.hb]))return 0;y.ib=E[0],y.hb=z[0]}return y.ob=p!=null&&p.ob,y.Kb=p==null||!p.Sd,y.da&&(y.ob=y.ib<3*M/4&&y.hb<3*G/4,y.Kb=0),1}function lf(p){if(p==null)return 2;if(11>p.S){var y=p.f.RGBA;y.fb+=(p.height-1)*y.A,y.A=-y.A}else y=p.f.kb,p=p.height,y.O+=(p-1)*y.fa,y.fa=-y.fa,y.N+=(p-1>>1)*y.Ab,y.Ab=-y.Ab,y.W+=(p-1>>1)*y.Db,y.Db=-y.Db,y.F!=null&&(y.J+=(p-1)*y.lb,y.lb=-y.lb);return 0}function Za(p,y,E,M){if(M==null||0>=p||0>=y)return 2;if(E!=null){if(E.Da){var G=E.cd,z=E.bd,q=-2&E.v,X=-2&E.j;if(0>q||0>X||0>=G||0>=z||q+G>p||X+z>y)return 2;p=G,y=z}if(E.da){if(!Le(p,y,G=[E.ib],z=[E.hb]))return 2;p=G[0],y=z[0]}}M.width=p,M.height=y;e:{var Y=M.width,J=M.height;if(p=M.S,0>=Y||0>=J||!(p>=Fg&&13>p))p=2;else{if(0>=M.Rd&&M.sd==null){q=z=G=y=0;var ue=(X=Y*Q5[p])*J;if(11>p||(z=(J+1)/2*(y=(Y+1)/2),p==12&&(q=(G=Y)*J)),(J=s(ue+2*z+q))==null){p=1;break e}M.sd=J,11>p?((Y=M.f.RGBA).eb=J,Y.fb=0,Y.A=X,Y.size=ue):((Y=M.f.kb).y=J,Y.O=0,Y.fa=X,Y.Fd=ue,Y.f=J,Y.N=0+ue,Y.Ab=y,Y.Cd=z,Y.ea=J,Y.W=0+ue+z,Y.Db=y,Y.Ed=z,p==12&&(Y.F=J,Y.J=0+ue+2*z),Y.Tc=q,Y.lb=G)}if(y=1,G=M.S,z=M.width,q=M.height,G>=Fg&&13>G)if(11>G)p=M.f.RGBA,y&=(X=Math.abs(p.A))*(q-1)+z<=p.size,y&=X>=z*Q5[G],y&=p.eb!=null;else{p=M.f.kb,X=(z+1)/2,ue=(q+1)/2,Y=Math.abs(p.fa),J=Math.abs(p.Ab);var be=Math.abs(p.Db),Q=Math.abs(p.lb),de=Q*(q-1)+z;y&=Y*(q-1)+z<=p.Fd,y&=J*(ue-1)+X<=p.Cd,y=(y&=be*(ue-1)+X<=p.Ed)&Y>=z&J>=X&be>=X,y&=p.y!=null,y&=p.f!=null,y&=p.ea!=null,G==12&&(y&=Q>=z,y&=de<=p.Tc,y&=p.F!=null)}else y=0;p=y?0:2}}return p!=0||E!=null&&E.fd&&(p=lf(M)),p}var ac=64,ts=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215],is=24,Ja=32,ca=8,Qa=[0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7];_e("Predictor0","PredictorAdd0"),P.Predictor0=function(){return 4278190080},P.Predictor1=function(p){return p},P.Predictor2=function(p,y,E){return y[E+0]},P.Predictor3=function(p,y,E){return y[E+1]},P.Predictor4=function(p,y,E){return y[E-1]},P.Predictor5=function(p,y,E){return Se(Se(p,y[E+1]),y[E+0])},P.Predictor6=function(p,y,E){return Se(p,y[E-1])},P.Predictor7=function(p,y,E){return Se(p,y[E+0])},P.Predictor8=function(p,y,E){return Se(y[E-1],y[E+0])},P.Predictor9=function(p,y,E){return Se(y[E+0],y[E+1])},P.Predictor10=function(p,y,E){return Se(Se(p,y[E-1]),Se(y[E+0],y[E+1]))},P.Predictor11=function(p,y,E){var M=y[E+0];return 0>=je(M>>24&255,p>>24&255,(y=y[E-1])>>24&255)+je(M>>16&255,p>>16&255,y>>16&255)+je(M>>8&255,p>>8&255,y>>8&255)+je(255&M,255&p,255&y)?M:p},P.Predictor12=function(p,y,E){var M=y[E+0];return(Ge((p>>24&255)+(M>>24&255)-((y=y[E-1])>>24&255))<<24|Ge((p>>16&255)+(M>>16&255)-(y>>16&255))<<16|Ge((p>>8&255)+(M>>8&255)-(y>>8&255))<<8|Ge((255&p)+(255&M)-(255&y)))>>>0},P.Predictor13=function(p,y,E){var M=y[E-1];return(Be((p=Se(p,y[E+0]))>>24&255,M>>24&255)<<24|Be(p>>16&255,M>>16&255)<<16|Be(p>>8&255,M>>8&255)<<8|Be(255&p,255&M))>>>0};var cf=P.PredictorAdd0;P.PredictorAdd1=Ke,_e("Predictor2","PredictorAdd2"),_e("Predictor3","PredictorAdd3"),_e("Predictor4","PredictorAdd4"),_e("Predictor5","PredictorAdd5"),_e("Predictor6","PredictorAdd6"),_e("Predictor7","PredictorAdd7"),_e("Predictor8","PredictorAdd8"),_e("Predictor9","PredictorAdd9"),_e("Predictor10","PredictorAdd10"),_e("Predictor11","PredictorAdd11"),_e("Predictor12","PredictorAdd12"),_e("Predictor13","PredictorAdd13");var dh=P.PredictorAdd2;$e("ColorIndexInverseTransform","MapARGB","32b",function(p){return p>>8&255},function(p){return p}),$e("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",function(p){return p},function(p){return p>>8&255});var un,Rg=P.ColorIndexInverseTransform,vo=P.MapARGB,xo=P.VP8LColorIndexInverseTransformAlpha,hf=P.MapAlpha,uf=P.VP8LPredictorsAdd=[];uf.length=16,(P.VP8LPredictors=[]).length=16,(P.VP8LPredictorsAdd_C=[]).length=16,(P.VP8LPredictors_C=[]).length=16;var ff,df,el,tl,il,lc,nl,cc,bs,wo,gi,Ai,fn,Gn,ha,gf,gh,Ig,A5,P5,M5,R5,I5,N5,pf,F5,O5,D5,k5=s(511),G5=s(2041),B5=s(225),j5=s(767),U5=0,p1=G5,Ng=B5,ns=j5,Es=k5,Fg=0,Og=1,z5=2,Dg=3,kg=4,m1=5,q5=6,_1=7,y1=8,Gg=9,v1=10,LM=[2,3,7],CM=[3,3,11],V5=[280,256,256,256,40],AM=[0,1,1,1,0],PM=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],MM=[24,7,23,25,40,6,39,41,22,26,38,42,56,5,55,57,21,27,54,58,37,43,72,4,71,73,20,28,53,59,70,74,36,44,88,69,75,52,60,3,87,89,19,29,86,90,35,45,68,76,85,91,51,61,104,2,103,105,18,30,102,106,34,46,84,92,67,77,101,107,50,62,120,1,119,121,83,93,17,31,100,108,66,78,118,122,33,47,117,123,49,63,99,109,82,94,0,116,124,65,79,16,32,98,110,48,115,125,81,95,64,114,126,97,111,80,113,127,96,112],RM=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],IM=8,x1=[4,5,6,7,8,9,10,10,11,12,13,14,15,16,17,17,18,19,20,20,21,21,22,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,43,44,45,46,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,76,77,78,79,80,81,82,83,84,85,86,87,88,89,91,93,95,96,98,100,101,102,104,106,108,110,112,114,116,118,122,124,126,128,130,132,134,136,138,140,143,145,148,151,154,157],w1=[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,177,181,185,189,193,197,201,205,209,213,217,221,225,229,234,239,245,249,254,259,264,269,274,279,284],mf=null,NM=[[173,148,140,0],[176,155,140,135,0],[180,157,141,134,130,0],[254,254,243,230,196,177,153,140,133,130,129,0]],FM=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],$5=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],OM=[[[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]],[[253,136,254,255,228,219,128,128,128,128,128],[189,129,242,255,227,213,255,219,128,128,128],[106,126,227,252,214,209,255,255,128,128,128]],[[1,98,248,255,236,226,255,255,128,128,128],[181,133,238,254,221,234,255,154,128,128,128],[78,134,202,247,198,180,255,219,128,128,128]],[[1,185,249,255,243,255,128,128,128,128,128],[184,150,247,255,236,224,128,128,128,128,128],[77,110,216,255,236,230,128,128,128,128,128]],[[1,101,251,255,241,255,128,128,128,128,128],[170,139,241,252,236,209,255,255,128,128,128],[37,116,196,243,228,255,255,255,128,128,128]],[[1,204,254,255,245,255,128,128,128,128,128],[207,160,250,255,238,128,128,128,128,128,128],[102,103,231,255,211,171,128,128,128,128,128]],[[1,152,252,255,240,255,128,128,128,128,128],[177,135,243,255,234,225,128,128,128,128,128],[80,129,211,255,194,224,128,128,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[246,1,255,128,128,128,128,128,128,128,128],[255,128,128,128,128,128,128,128,128,128,128]]],[[[198,35,237,223,193,187,162,160,145,155,62],[131,45,198,221,172,176,220,157,252,221,1],[68,47,146,208,149,167,221,162,255,223,128]],[[1,149,241,255,221,224,255,255,128,128,128],[184,141,234,253,222,220,255,199,128,128,128],[81,99,181,242,176,190,249,202,255,255,128]],[[1,129,232,253,214,197,242,196,255,255,128],[99,121,210,250,201,198,255,202,128,128,128],[23,91,163,242,170,187,247,210,255,255,128]],[[1,200,246,255,234,255,128,128,128,128,128],[109,178,241,255,231,245,255,255,128,128,128],[44,130,201,253,205,192,255,255,128,128,128]],[[1,132,239,251,219,209,255,165,128,128,128],[94,136,225,251,218,190,255,255,128,128,128],[22,100,174,245,186,161,255,199,128,128,128]],[[1,182,249,255,232,235,128,128,128,128,128],[124,143,241,255,227,234,128,128,128,128,128],[35,77,181,251,193,211,255,205,128,128,128]],[[1,157,247,255,236,231,255,255,128,128,128],[121,141,235,255,225,227,255,255,128,128,128],[45,99,188,251,195,217,255,224,128,128,128]],[[1,1,251,255,213,255,128,128,128,128,128],[203,1,248,255,255,128,128,128,128,128,128],[137,1,177,255,224,255,128,128,128,128,128]]],[[[253,9,248,251,207,208,255,192,128,128,128],[175,13,224,243,193,185,249,198,255,255,128],[73,17,171,221,161,179,236,167,255,234,128]],[[1,95,247,253,212,183,255,255,128,128,128],[239,90,244,250,211,209,255,255,128,128,128],[155,77,195,248,188,195,255,255,128,128,128]],[[1,24,239,251,218,219,255,205,128,128,128],[201,51,219,255,196,186,128,128,128,128,128],[69,46,190,239,201,218,255,228,128,128,128]],[[1,191,251,255,255,128,128,128,128,128,128],[223,165,249,255,213,255,128,128,128,128,128],[141,124,248,255,255,128,128,128,128,128,128]],[[1,16,248,255,255,128,128,128,128,128,128],[190,36,230,255,236,255,128,128,128,128,128],[149,1,255,128,128,128,128,128,128,128,128]],[[1,226,255,128,128,128,128,128,128,128,128],[247,192,255,128,128,128,128,128,128,128,128],[240,128,255,128,128,128,128,128,128,128,128]],[[1,134,252,255,255,128,128,128,128,128,128],[213,62,250,255,255,128,128,128,128,128,128],[55,93,255,128,128,128,128,128,128,128,128]],[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]]],[[[202,24,213,235,186,191,220,160,240,175,255],[126,38,182,232,169,184,228,174,255,187,128],[61,46,138,219,151,178,240,170,255,216,128]],[[1,112,230,250,199,191,247,159,255,255,128],[166,109,228,252,211,215,255,174,128,128,128],[39,77,162,232,172,180,245,178,255,255,128]],[[1,52,220,246,198,199,249,220,255,255,128],[124,74,191,243,183,193,250,221,255,255,128],[24,71,130,219,154,170,243,182,255,255,128]],[[1,182,225,249,219,240,255,224,128,128,128],[149,150,226,252,216,205,255,171,128,128,128],[28,108,170,242,183,194,254,223,255,255,128]],[[1,81,230,252,204,203,255,192,128,128,128],[123,102,209,247,188,196,255,233,128,128,128],[20,95,153,243,164,173,255,203,128,128,128]],[[1,222,248,255,216,213,128,128,128,128,128],[168,175,246,252,235,205,255,255,128,128,128],[47,116,215,255,211,212,255,255,128,128,128]],[[1,121,236,253,212,214,255,255,128,128,128],[141,84,213,252,201,202,255,219,128,128,128],[42,80,160,240,162,185,255,205,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[244,1,255,128,128,128,128,128,128,128,128],[238,1,255,128,128,128,128,128,128,128,128]]]],DM=[[[231,120,48,89,115,113,120,152,112],[152,179,64,126,170,118,46,70,95],[175,69,143,80,85,82,72,155,103],[56,58,10,171,218,189,17,13,152],[114,26,17,163,44,195,21,10,173],[121,24,80,195,26,62,44,64,85],[144,71,10,38,171,213,144,34,26],[170,46,55,19,136,160,33,206,71],[63,20,8,114,114,208,12,9,226],[81,40,11,96,182,84,29,16,36]],[[134,183,89,137,98,101,106,165,148],[72,187,100,130,157,111,32,75,80],[66,102,167,99,74,62,40,234,128],[41,53,9,178,241,141,26,8,107],[74,43,26,146,73,166,49,23,157],[65,38,105,160,51,52,31,115,128],[104,79,12,27,217,255,87,17,7],[87,68,71,44,114,51,15,186,23],[47,41,14,110,182,183,21,17,194],[66,45,25,102,197,189,23,18,22]],[[88,88,147,150,42,46,45,196,205],[43,97,183,117,85,38,35,179,61],[39,53,200,87,26,21,43,232,171],[56,34,51,104,114,102,29,93,77],[39,28,85,171,58,165,90,98,64],[34,22,116,206,23,34,43,166,73],[107,54,32,26,51,1,81,43,31],[68,25,106,22,64,171,36,225,114],[34,19,21,102,132,188,16,76,124],[62,18,78,95,85,57,50,48,51]],[[193,101,35,159,215,111,89,46,111],[60,148,31,172,219,228,21,18,111],[112,113,77,85,179,255,38,120,114],[40,42,1,196,245,209,10,25,109],[88,43,29,140,166,213,37,43,154],[61,63,30,155,67,45,68,1,209],[100,80,8,43,154,1,51,26,71],[142,78,78,16,255,128,34,197,171],[41,40,5,102,211,183,4,1,221],[51,50,17,168,209,192,23,25,82]],[[138,31,36,171,27,166,38,44,229],[67,87,58,169,82,115,26,59,179],[63,59,90,180,59,166,93,73,154],[40,40,21,116,143,209,34,39,175],[47,15,16,183,34,223,49,45,183],[46,17,33,183,6,98,15,32,183],[57,46,22,24,128,1,54,17,37],[65,32,73,115,28,128,23,128,205],[40,3,9,115,51,192,18,6,223],[87,37,9,115,59,77,64,21,47]],[[104,55,44,218,9,54,53,130,226],[64,90,70,205,40,41,23,26,57],[54,57,112,184,5,41,38,166,213],[30,34,26,133,152,116,10,32,134],[39,19,53,221,26,114,32,73,255],[31,9,65,234,2,15,1,118,73],[75,32,12,51,192,255,160,43,51],[88,31,35,67,102,85,55,186,85],[56,21,23,111,59,205,45,37,192],[55,38,70,124,73,102,1,34,98]],[[125,98,42,88,104,85,117,175,82],[95,84,53,89,128,100,113,101,45],[75,79,123,47,51,128,81,171,1],[57,17,5,71,102,57,53,41,49],[38,33,13,121,57,73,26,1,85],[41,10,67,138,77,110,90,47,114],[115,21,2,10,102,255,166,23,6],[101,29,16,10,85,128,101,196,26],[57,18,10,102,102,213,34,20,43],[117,20,15,36,163,128,68,1,26]],[[102,61,71,37,34,53,31,243,192],[69,60,71,38,73,119,28,222,37],[68,45,128,34,1,47,11,245,171],[62,17,19,70,146,85,55,62,70],[37,43,37,154,100,163,85,160,1],[63,9,92,136,28,64,32,201,85],[75,15,9,9,64,255,184,119,16],[86,6,28,5,64,255,25,248,1],[56,8,17,132,137,255,55,116,128],[58,15,20,82,135,57,26,121,40]],[[164,50,31,137,154,133,25,35,218],[51,103,44,131,131,123,31,6,158],[86,40,64,135,148,224,45,183,128],[22,26,17,131,240,154,14,1,209],[45,16,21,91,64,222,7,1,197],[56,21,39,155,60,138,23,102,213],[83,12,13,54,192,255,68,47,28],[85,26,85,85,128,128,32,146,171],[18,11,7,63,144,171,4,4,246],[35,27,10,146,174,171,12,26,128]],[[190,80,35,99,180,80,126,54,45],[85,126,47,87,176,51,41,20,32],[101,75,128,139,118,146,116,128,85],[56,41,15,176,236,85,37,9,62],[71,30,17,119,118,255,17,18,138],[101,38,60,138,55,70,43,26,142],[146,36,19,30,171,255,97,27,20],[138,45,61,62,219,1,81,188,64],[32,41,20,117,151,142,20,21,163],[112,19,12,61,195,128,48,4,24]]],kM=[[[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[176,246,255,255,255,255,255,255,255,255,255],[223,241,252,255,255,255,255,255,255,255,255],[249,253,253,255,255,255,255,255,255,255,255]],[[255,244,252,255,255,255,255,255,255,255,255],[234,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255]],[[255,246,254,255,255,255,255,255,255,255,255],[239,253,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[251,255,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[251,254,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,254,253,255,254,255,255,255,255,255,255],[250,255,254,255,254,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[217,255,255,255,255,255,255,255,255,255,255],[225,252,241,253,255,255,254,255,255,255,255],[234,250,241,250,253,255,253,254,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[223,254,254,255,255,255,255,255,255,255,255],[238,253,254,254,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[249,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,255,255,255,255,255,255,255,255,255],[247,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[252,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[186,251,250,255,255,255,255,255,255,255,255],[234,251,244,254,255,255,255,255,255,255,255],[251,251,243,253,254,255,254,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[236,253,254,255,255,255,255,255,255,255,255],[251,253,253,254,254,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[254,254,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[254,254,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[248,255,255,255,255,255,255,255,255,255,255],[250,254,252,254,255,255,255,255,255,255,255],[248,254,249,253,255,255,255,255,255,255,255]],[[255,253,253,255,255,255,255,255,255,255,255],[246,253,253,255,255,255,255,255,255,255,255],[252,254,251,254,254,255,255,255,255,255,255]],[[255,254,252,255,255,255,255,255,255,255,255],[248,254,253,255,255,255,255,255,255,255,255],[253,255,254,254,255,255,255,255,255,255,255]],[[255,251,254,255,255,255,255,255,255,255,255],[245,251,254,255,255,255,255,255,255,255,255],[253,253,254,255,255,255,255,255,255,255,255]],[[255,251,253,255,255,255,255,255,255,255,255],[252,253,254,255,255,255,255,255,255,255,255],[255,254,255,255,255,255,255,255,255,255,255]],[[255,252,255,255,255,255,255,255,255,255,255],[249,255,254,255,255,255,255,255,255,255,255],[255,255,254,255,255,255,255,255,255,255,255]],[[255,255,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]]],GM=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],rl=[],Us=[],ua=[],BM=1,W5=2,sl=[],Ss=[];aa("UpsampleRgbLinePair",Ya,3),aa("UpsampleBgrLinePair",tr,3),aa("UpsampleRgbaLinePair",Tr,4),aa("UpsampleBgraLinePair",of,4),aa("UpsampleArgbLinePair",sf,4),aa("UpsampleRgba4444LinePair",sc,2),aa("UpsampleRgb565LinePair",rc,2);var jM=P.UpsampleRgbLinePair,UM=P.UpsampleBgrLinePair,H5=P.UpsampleRgbaLinePair,X5=P.UpsampleBgraLinePair,K5=P.UpsampleArgbLinePair,Y5=P.UpsampleRgba4444LinePair,zM=P.UpsampleRgb565LinePair,Bg=16,jg=1<<Bg-1,_f=-227,b1=482,qM=6,Z5=0,VM=s(256),$M=s(256),WM=s(256),HM=s(256),XM=s(b1-_f),KM=s(b1-_f);la("YuvToRgbRow",Ya,3),la("YuvToBgrRow",tr,3),la("YuvToRgbaRow",Tr,4),la("YuvToBgraRow",of,4),la("YuvToArgbRow",sf,4),la("YuvToRgba4444Row",sc,2),la("YuvToRgb565Row",rc,2);var J5=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],Ug=[0,2,8],YM=[8,7,6,4,4,2,2,2,1,1,1,1],ZM=1;this.WebPDecodeRGBA=function(p,y,E,M,G){var z=Og,q=new Me,X=new At;q.ba=X,X.S=z,X.width=[X.width],X.height=[X.height];var Y=X.width,J=X.height,ue=new gt;if(ue==null||p==null)var be=2;else e(ue!=null),be=oc(p,y,E,ue.width,ue.height,ue.Pd,ue.Qd,ue.format,null);if(be!=0?Y=0:(Y!=null&&(Y[0]=ue.width[0]),J!=null&&(J[0]=ue.height[0]),Y=1),Y){X.width=X.width[0],X.height=X.height[0],M!=null&&(M[0]=X.width),G!=null&&(G[0]=X.height);e:{if(M=new oh,(G=new Ne).data=p,G.w=y,G.ha=E,G.kd=1,y=[0],e(G!=null),((p=oc(G.data,G.w,G.ha,null,null,null,y,null,G))==0||p==7)&&y[0]&&(p=4),(y=p)==0){if(e(q!=null),M.data=G.data,M.w=G.w+G.offset,M.ha=G.ha-G.offset,M.put=tt,M.ac=hn,M.bc=Fn,M.ma=q,G.xa){if((p=Kl())==null){q=1;break e}if((function(Q,de){var ye=[0],Ae=[0],we=[0];t:for(;;){if(Q==null)return 0;if(de==null)return Q.a=2,0;if(Q.l=de,Q.a=0,te(Q.m,de.data,de.w,de.ha),!On(Q.m,ye,Ae,we)){Q.a=3;break t}if(Q.xb=W5,de.width=ye[0],de.height=Ae[0],!po(ye[0],Ae[0],1,Q,null))break t;return 1}return e(Q.a!=0),0})(p,M)){if(M=(y=Za(M.width,M.height,q.Oa,q.ba))==0){t:{M=p;i:for(;;){if(M==null){M=0;break t}if(e(M.s.yc!=null),e(M.s.Ya!=null),e(0<M.s.Wb),e((E=M.l)!=null),e((G=E.ma)!=null),M.xb!=0){if(M.ca=G.ba,M.tb=G.tb,e(M.ca!=null),!af(G.Oa,E,Dg)){M.a=2;break i}if(!Yl(M,E.width)||E.da)break i;if((E.da||dt(M.ca.S))&&js(),11>M.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),M.ca.f.kb.F!=null&&js()),M.Pb&&0<M.s.ua&&M.s.vb.X==null&&!j(M.s.vb,M.s.Wa.Xa)){M.a=1;break i}M.xb=0}if(!Gs(M,M.V,M.Ba,M.c,M.i,E.o,Xa))break i;G.Dc=M.Ma,M=1;break t}e(M.a!=0),M=0}M=!M}M&&(y=p.a)}else y=p.a}else{if((p=new e1)==null){q=1;break e}if(p.Fa=G.na,p.P=G.P,p.qc=G.Sa,_o(p,M)){if((y=Za(M.width,M.height,q.Oa,q.ba))==0){if(p.Aa=0,E=q.Oa,e((G=p)!=null),E!=null){if(0<(Y=0>(Y=E.Md)?0:100<Y?255:255*Y/100)){for(J=ue=0;4>J;++J)12>(be=G.pb[J]).lc&&(be.ia=Y*YM[0>be.lc?0:be.lc]>>3),ue|=be.ia;ue&&(alert("todo:VP8InitRandom"),G.ia=1)}G.Ga=E.Id,100<G.Ga?G.Ga=100:0>G.Ga&&(G.Ga=0)}(function(Q,de){if(Q==null)return 0;if(de==null)return Tn(Q,2,"NULL VP8Io parameter in VP8Decode().");if(!Q.cb&&!_o(Q,de))return 0;if(e(Q.cb),de.ac==null||de.ac(de)){de.ob&&(Q.L=0);var ye=Ug[Q.L];if(Q.L==2?(Q.yb=0,Q.zb=0):(Q.yb=de.v-ye>>4,Q.zb=de.j-ye>>4,0>Q.yb&&(Q.yb=0),0>Q.zb&&(Q.zb=0)),Q.Va=de.o+15+ye>>4,Q.Hb=de.va+15+ye>>4,Q.Hb>Q.za&&(Q.Hb=Q.za),Q.Va>Q.Ub&&(Q.Va=Q.Ub),0<Q.L){var Ae=Q.ed;for(ye=0;4>ye;++ye){var we;if(Q.Qa.Cb){var Pe=Q.Qa.Lb[ye];Q.Qa.Fb||(Pe+=Ae.Tb)}else Pe=Ae.Tb;for(we=0;1>=we;++we){var Re=Q.gd[ye][we],ke=Pe;if(Ae.Pc&&(ke+=Ae.vd[0],we&&(ke+=Ae.od[0])),0<(ke=0>ke?0:63<ke?63:ke)){var Fe=ke;0<Ae.wb&&(Fe=4<Ae.wb?Fe>>2:Fe>>1)>9-Ae.wb&&(Fe=9-Ae.wb),1>Fe&&(Fe=1),Re.dd=Fe,Re.tc=2*ke+Fe,Re.ld=40<=ke?2:15<=ke?1:0}else Re.tc=0;Re.La=we}}}ye=0}else Tn(Q,6,"Frame setup failed"),ye=Q.a;if(ye=ye==0){if(ye){Q.$c=0,0<Q.Aa||(Q.Ic=ZM);t:{ye=Q.Ic,Ae=4*(Fe=Q.za);var lt=32*Fe,Ze=Fe+1,Dt=0<Q.L?Fe*(0<Q.Aa?2:1):0,nt=(Q.Aa==2?2:1)*Fe;if((Re=Ae+832+(we=3*(16*ye+Ug[Q.L])/2*lt)+(Pe=Q.Fa!=null&&0<Q.Fa.length?Q.Kc.c*Q.Kc.i:0))!=Re)ye=0;else{if(Re>Q.Vb){if(Q.Vb=0,Q.Ec=s(Re),Q.Fc=0,Q.Ec==null){ye=Tn(Q,1,"no memory during frame initialization.");break t}Q.Vb=Re}Re=Q.Ec,ke=Q.Fc,Q.Ac=Re,Q.Bc=ke,ke+=Ae,Q.Gd=o(lt,_g),Q.Hd=0,Q.rb=o(Ze+1,Hu),Q.sb=1,Q.wa=Dt?o(Dt,vs):null,Q.Y=0,Q.D.Nb=0,Q.D.wa=Q.wa,Q.D.Y=Q.Y,0<Q.Aa&&(Q.D.Y+=Fe),e(!0),Q.oc=Re,Q.pc=ke,ke+=832,Q.ya=o(nt,Xu),Q.aa=0,Q.D.ya=Q.ya,Q.D.aa=Q.aa,Q.Aa==2&&(Q.D.aa+=Fe),Q.R=16*Fe,Q.B=8*Fe,Fe=(lt=Ug[Q.L])*Q.R,lt=lt/2*Q.B,Q.sa=Re,Q.ta=ke+Fe,Q.qa=Q.sa,Q.ra=Q.ta+16*ye*Q.R+lt,Q.Ha=Q.qa,Q.Ia=Q.ra+8*ye*Q.B+lt,Q.$c=0,ke+=we,Q.mb=Pe?Re:null,Q.nb=Pe?ke:null,e(ke+Pe<=Q.Fc+Q.Vb),xg(Q),r(Q.Ac,Q.Bc,0,Ae),ye=1}}if(ye){if(de.ka=0,de.y=Q.sa,de.O=Q.ta,de.f=Q.qa,de.N=Q.ra,de.ea=Q.Ha,de.Vd=Q.Ia,de.fa=Q.R,de.Rc=Q.B,de.F=null,de.J=0,!U5){for(ye=-255;255>=ye;++ye)k5[255+ye]=0>ye?-ye:ye;for(ye=-1020;1020>=ye;++ye)G5[1020+ye]=-128>ye?-128:127<ye?127:ye;for(ye=-112;112>=ye;++ye)B5[112+ye]=-16>ye?-16:15<ye?15:ye;for(ye=-255;510>=ye;++ye)j5[255+ye]=0>ye?0:255<ye?255:ye;U5=1}nl=lh,cc=i1,wo=yo,gi=bg,Ai=Eg,bs=t1,fn=Ag,Gn=tc,ha=k,gf=ee,gh=Pg,Ig=w,A5=oe,P5=me,M5=ec,R5=nf,I5=Lg,N5=Cg,Us[0]=h1,Us[1]=n1,Us[2]=l1,Us[3]=c1,Us[4]=ea,Us[5]=u1,Us[6]=ta,Us[7]=f1,Us[8]=Zu,Us[9]=ch,rl[0]=o1,rl[1]=s1,rl[2]=Ku,rl[3]=Sg,rl[4]=Jl,rl[5]=Yu,rl[6]=a1,ua[0]=g1,ua[1]=r1,ua[2]=Ql,ua[3]=d1,ua[4]=Qu,ua[5]=Ju,ua[6]=Tg,ye=1}else ye=0}ye&&(ye=(function(Wt,Bn){for(Wt.M=0;Wt.M<Wt.Va;++Wt.M){var kt,rt=Wt.Jc[Wt.M&Wt.Xb],ze=Wt.m,dn=Wt;for(kt=0;kt<dn.za;++kt){var It=ze,Qt=dn,Bi=Qt.Ac,ir=Qt.Bc+4*kt,Lr=Qt.zc,sn=Qt.ya[Qt.aa+kt];if(Qt.Qa.Bb?sn.$b=le(It,Qt.Pa.jb[0])?2+le(It,Qt.Pa.jb[2]):le(It,Qt.Pa.jb[1]):sn.$b=0,Qt.kc&&(sn.Ad=le(It,Qt.Bd)),sn.Za=!le(It,145)+0,sn.Za){var fr=sn.Ob,Cr=0;for(Qt=0;4>Qt;++Qt){var jn,ri=Lr[0+Qt];for(jn=0;4>jn;++jn){ri=DM[Bi[ir+jn]][ri];for(var vi=$5[le(It,ri[0])];0<vi;)vi=$5[2*vi+le(It,ri[vi])];ri=-vi,Bi[ir+jn]=ri}n(fr,Cr,Bi,ir,4),Cr+=4,Lr[0+Qt]=ri}}else ri=le(It,156)?le(It,128)?1:3:le(It,163)?2:0,sn.Ob[0]=ri,r(Bi,ir,ri,4),r(Lr,0,ri,4);sn.Dd=le(It,142)?le(It,114)?le(It,183)?1:3:2:0}if(dn.m.Ka)return Tn(Wt,7,"Premature end-of-partition0 encountered.");for(;Wt.ja<Wt.za;++Wt.ja){if(dn=rt,It=(ze=Wt).rb[ze.sb-1],Bi=ze.rb[ze.sb+ze.ja],kt=ze.ya[ze.aa+ze.ja],ir=ze.kc?kt.Ad:0)It.la=Bi.la=0,kt.Za||(It.Na=Bi.Na=0),kt.Hc=0,kt.Gc=0,kt.ia=0;else{var on,xi;if(It=Bi,Bi=dn,ir=ze.Pa.Xc,Lr=ze.ya[ze.aa+ze.ja],sn=ze.pb[Lr.$b],Qt=Lr.ad,fr=0,Cr=ze.rb[ze.sb-1],ri=jn=0,r(Qt,fr,0,384),Lr.Za)var nr=0,zs=ir[3];else{vi=s(16);var gn=It.Na+Cr.Na;if(gn=mf(Bi,ir[1],gn,sn.Eb,0,vi,0),It.Na=Cr.Na=(0<gn)+0,1<gn)nl(vi,0,Qt,fr);else{var Gr=vi[0]+3>>3;for(vi=0;256>vi;vi+=16)Qt[fr+vi]=Gr}nr=1,zs=ir[0]}var Pi=15&It.la,Un=15&Cr.la;for(vi=0;4>vi;++vi){var rs=1&Un;for(Gr=xi=0;4>Gr;++Gr)Pi=Pi>>1|(rs=(gn=mf(Bi,zs,gn=rs+(1&Pi),sn.Sc,nr,Qt,fr))>nr)<<7,xi=xi<<2|(3<gn?3:1<gn?2:Qt[fr+0]!=0),fr+=16;Pi>>=4,Un=Un>>1|rs<<7,jn=(jn<<8|xi)>>>0}for(zs=Pi,nr=Un>>4,on=0;4>on;on+=2){for(xi=0,Pi=It.la>>4+on,Un=Cr.la>>4+on,vi=0;2>vi;++vi){for(rs=1&Un,Gr=0;2>Gr;++Gr)gn=rs+(1&Pi),Pi=Pi>>1|(rs=0<(gn=mf(Bi,ir[2],gn,sn.Qc,0,Qt,fr)))<<3,xi=xi<<2|(3<gn?3:1<gn?2:Qt[fr+0]!=0),fr+=16;Pi>>=2,Un=Un>>1|rs<<5}ri|=xi<<4*on,zs|=Pi<<4<<on,nr|=(240&Un)<<on}It.la=zs,Cr.la=nr,Lr.Hc=jn,Lr.Gc=ri,Lr.ia=43690&ri?0:sn.ia,ir=!(jn|ri)}if(0<ze.L&&(ze.wa[ze.Y+ze.ja]=ze.gd[kt.$b][kt.Za],ze.wa[ze.Y+ze.ja].La|=!ir),dn.Ka)return Tn(Wt,7,"Premature end-of-file encountered.")}if(xg(Wt),ze=Bn,dn=1,kt=(rt=Wt).D,It=0<rt.L&&rt.M>=rt.zb&&rt.M<=rt.Va,rt.Aa==0)t:{if(kt.M=rt.M,kt.uc=It,ws(rt,kt),dn=1,kt=(xi=rt.D).Nb,It=(ri=Ug[rt.L])*rt.R,Bi=ri/2*rt.B,vi=16*kt*rt.R,Gr=8*kt*rt.B,ir=rt.sa,Lr=rt.ta-It+vi,sn=rt.qa,Qt=rt.ra-Bi+Gr,fr=rt.Ha,Cr=rt.Ia-Bi+Gr,Un=(Pi=xi.M)==0,jn=Pi>=rt.Va-1,rt.Aa==2&&ws(rt,xi),xi.uc)for(rs=(gn=rt).D.M,e(gn.D.uc),xi=gn.yb;xi<gn.Hb;++xi){nr=xi,zs=rs;var Ar=(ss=(rr=gn).D).Nb;on=rr.R;var ss=ss.wa[ss.Y+nr],os=rr.sa,Br=rr.ta+16*Ar*on+16*nr,as=ss.dd,Di=ss.tc;if(Di!=0)if(e(3<=Di),rr.L==1)0<nr&&R5(os,Br,on,Di+4),ss.La&&N5(os,Br,on,Di),0<zs&&M5(os,Br,on,Di+4),ss.La&&I5(os,Br,on,Di);else{var ls=rr.B,qs=rr.qa,hc=rr.ra+8*Ar*ls+8*nr,fa=rr.Ha,rr=rr.Ia+8*Ar*ls+8*nr;Ar=ss.ld,0<nr&&(Gn(os,Br,on,Di+4,as,Ar),gf(qs,hc,fa,rr,ls,Di+4,as,Ar)),ss.La&&(Ig(os,Br,on,Di,as,Ar),P5(qs,hc,fa,rr,ls,Di,as,Ar)),0<zs&&(fn(os,Br,on,Di+4,as,Ar),ha(qs,hc,fa,rr,ls,Di+4,as,Ar)),ss.La&&(gh(os,Br,on,Di,as,Ar),A5(qs,hc,fa,rr,ls,Di,as,Ar))}}if(rt.ia&&alert("todo:DitherRow"),ze.put!=null){if(xi=16*Pi,Pi=16*(Pi+1),Un?(ze.y=rt.sa,ze.O=rt.ta+vi,ze.f=rt.qa,ze.N=rt.ra+Gr,ze.ea=rt.Ha,ze.W=rt.Ia+Gr):(xi-=ri,ze.y=ir,ze.O=Lr,ze.f=sn,ze.N=Qt,ze.ea=fr,ze.W=Cr),jn||(Pi-=ri),Pi>ze.o&&(Pi=ze.o),ze.F=null,ze.J=null,rt.Fa!=null&&0<rt.Fa.length&&xi<Pi&&(ze.J=Oi(rt,ze,xi,Pi-xi),ze.F=rt.mb,ze.F==null&&ze.F.length==0)){dn=Tn(rt,3,"Could not decode alpha data.");break t}xi<ze.j&&(ri=ze.j-xi,xi=ze.j,e(!(1&ri)),ze.O+=rt.R*ri,ze.N+=rt.B*(ri>>1),ze.W+=rt.B*(ri>>1),ze.F!=null&&(ze.J+=ze.width*ri)),xi<Pi&&(ze.O+=ze.v,ze.N+=ze.v>>1,ze.W+=ze.v>>1,ze.F!=null&&(ze.J+=ze.v),ze.ka=xi-ze.j,ze.U=ze.va-ze.v,ze.T=Pi-xi,dn=ze.put(ze))}kt+1!=rt.Ic||jn||(n(rt.sa,rt.ta-It,ir,Lr+16*rt.R,It),n(rt.qa,rt.ra-Bi,sn,Qt+8*rt.B,Bi),n(rt.Ha,rt.Ia-Bi,fr,Cr+8*rt.B,Bi))}if(!dn)return Tn(Wt,6,"Output aborted.")}return 1})(Q,de)),de.bc!=null&&de.bc(de),ye&=1}return ye?(Q.cb=0,ye):0})(p,M)||(y=p.a)}}else y=p.a}y==0&&q.Oa!=null&&q.Oa.fd&&(y=lf(q.ba))}q=y}z=q!=0?null:11>z?X.f.RGBA.eb:X.f.kb.y}else z=null;return z};var Q5=[3,4,3,4,4,2,2,4,4,4,2,1,1]};function c(P,O){for(var L="",T=0;T<4;T++)L+=String.fromCharCode(P[O++]);return L}function h(P,O){return P[O+0]|P[O+1]<<8}function u(P,O){return(P[O+0]|P[O+1]<<8|P[O+2]<<16)>>>0}function f(P,O){return(P[O+0]|P[O+1]<<8|P[O+2]<<16|P[O+3]<<24)>>>0}new l;var d=[0],g=[0],m=[],_=new l,v=i,x=(function(P,O){var L={},T=0,C=!1,D=0,W=0;if(L.frames=[],!(function(I,U){for(var K=0;K<4;K++)if(I[U+K]!="RIFF".charCodeAt(K))return!0;return!1})(P,O)){for(f(P,O+=4),O+=8;O<P.length;){var $=c(P,O),B=f(P,O+=4);O+=4;var V=B+(1&B);switch($){case"VP8 ":case"VP8L":L.frames[T]===void 0&&(L.frames[T]={}),(ae=L.frames[T]).src_off=C?W:O-8,ae.src_size=D+B+8,T++,C&&(C=!1,D=0,W=0);break;case"VP8X":(ae=L.header={}).feature_flags=P[O];var te=O+4;ae.canvas_width=1+u(P,te),te+=3,ae.canvas_height=1+u(P,te),te+=3;break;case"ALPH":C=!0,D=V+8,W=O-8;break;case"ANIM":(ae=L.header).bgcolor=f(P,O),te=O+4,ae.loop_count=h(P,te),te+=2;break;case"ANMF":var ne,ae;(ae=L.frames[T]={}).offset_x=2*u(P,O),O+=3,ae.offset_y=2*u(P,O),O+=3,ae.width=1+u(P,O),O+=3,ae.height=1+u(P,O),O+=3,ae.duration=u(P,O),O+=3,ne=P[O++],ae.dispose=1&ne,ae.blend=ne>>1&1}$!="ANMF"&&(O+=V)}return L}})(v,0);x.response=v,x.rgbaoutput=!0,x.dataurl=!1;var S=x.header?x.header:null,b=x.frames?x.frames:null;if(S){S.loop_counter=S.loop_count,d=[S.canvas_height],g=[S.canvas_width];for(var A=0;A<b.length&&b[A].blend!=0;A++);}var F=b[0],N=_.WebPDecodeRGBA(v,F.src_off,F.src_size,g,d);F.rgba=N,F.imgwidth=g[0],F.imgheight=d[0];for(var R=0;R<g[0]*d[0]*4;R++)m[R]=N[R];return this.width=g,this.height=d,this.data=m,this}function a$(){var i,e=this.internal.__metadata__.metadata,t=unescape(encodeURIComponent(e));i=this.internal.__metadata__.rawXml?t:'<x:xmpmeta xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:jspdf="'+this.internal.__metadata__.namespaceUri+'"><jspdf:metadata>'+t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")+"</jspdf:metadata></rdf:Description></rdf:RDF></x:xmpmeta>",this.internal.__metadata__.metadataObjectNumber=this.internal.newObject(),this.internal.write("<< /Type /Metadata /Subtype /XML /Length "+i.length+" >>"),this.internal.write("stream"),this.internal.write(i),this.internal.write("endstream"),this.internal.write("endobj")}function l$(){this.internal.__metadata__.metadataObjectNumber&&this.internal.write("/Metadata "+this.internal.__metadata__.metadataObjectNumber+" 0 R")}(function(i){var e,t,n,r,s,o,a,l,c,h=function(I){return I=I||{},this.isStrokeTransparent=I.isStrokeTransparent||!1,this.strokeOpacity=I.strokeOpacity||1,this.strokeStyle=I.strokeStyle||"#000000",this.fillStyle=I.fillStyle||"#000000",this.isFillTransparent=I.isFillTransparent||!1,this.fillOpacity=I.fillOpacity||1,this.font=I.font||"10px sans-serif",this.textBaseline=I.textBaseline||"alphabetic",this.textAlign=I.textAlign||"left",this.lineWidth=I.lineWidth||1,this.lineJoin=I.lineJoin||"miter",this.lineCap=I.lineCap||"butt",this.path=I.path||[],this.transform=I.transform!==void 0?I.transform.clone():new l,this.globalCompositeOperation=I.globalCompositeOperation||"normal",this.globalAlpha=I.globalAlpha||1,this.clip_path=I.clip_path||[],this.currentPoint=I.currentPoint||new o,this.miterLimit=I.miterLimit||10,this.lastPoint=I.lastPoint||new o,this.lineDashOffset=I.lineDashOffset||0,this.lineDash=I.lineDash||[],this.margin=I.margin||[0,0,0,0],this.prevPageLastElemOffset=I.prevPageLastElemOffset||0,this.ignoreClearRect=typeof I.ignoreClearRect!="boolean"||I.ignoreClearRect,this};i.events.push(["initialized",function(){this.context2d=new u(this),e=this.internal.f2,t=this.internal.getCoordinateString,n=this.internal.getVerticalCoordinateString,r=this.internal.getHorizontalCoordinate,s=this.internal.getVerticalCoordinate,o=this.internal.Point,a=this.internal.Rectangle,l=this.internal.Matrix,c=new h}]);var u=function(I){Object.defineProperty(this,"canvas",{get:function(){return{parentNode:!1,style:!1}}});var U=I;Object.defineProperty(this,"pdf",{get:function(){return U}});var K=!1;Object.defineProperty(this,"pageWrapXEnabled",{get:function(){return K},set:function(j){K=!!j}});var ie=!1;Object.defineProperty(this,"pageWrapYEnabled",{get:function(){return ie},set:function(j){ie=!!j}});var re=0;Object.defineProperty(this,"posX",{get:function(){return re},set:function(j){isNaN(j)||(re=j)}});var ce=0;Object.defineProperty(this,"posY",{get:function(){return ce},set:function(j){isNaN(j)||(ce=j)}}),Object.defineProperty(this,"margin",{get:function(){return c.margin},set:function(j){var fe;typeof j=="number"?fe=[j,j,j,j]:((fe=new Array(4))[0]=j[0],fe[1]=j.length>=2?j[1]:fe[0],fe[2]=j.length>=3?j[2]:fe[0],fe[3]=j.length>=4?j[3]:fe[1]),c.margin=fe}});var ve=!1;Object.defineProperty(this,"autoPaging",{get:function(){return ve},set:function(j){ve=j}});var pe=0;Object.defineProperty(this,"lastBreak",{get:function(){return pe},set:function(j){pe=j}});var le=[];Object.defineProperty(this,"pageBreaks",{get:function(){return le},set:function(j){le=j}}),Object.defineProperty(this,"ctx",{get:function(){return c},set:function(j){j instanceof h&&(c=j)}}),Object.defineProperty(this,"path",{get:function(){return c.path},set:function(j){c.path=j}});var Ce=[];Object.defineProperty(this,"ctxStack",{get:function(){return Ce},set:function(j){Ce=j}}),Object.defineProperty(this,"fillStyle",{get:function(){return this.ctx.fillStyle},set:function(j){var fe;fe=f(j),this.ctx.fillStyle=fe.style,this.ctx.isFillTransparent=fe.a===0,this.ctx.fillOpacity=fe.a,this.pdf.setFillColor(fe.r,fe.g,fe.b,{a:fe.a}),this.pdf.setTextColor(fe.r,fe.g,fe.b,{a:fe.a})}}),Object.defineProperty(this,"strokeStyle",{get:function(){return this.ctx.strokeStyle},set:function(j){var fe=f(j);this.ctx.strokeStyle=fe.style,this.ctx.isStrokeTransparent=fe.a===0,this.ctx.strokeOpacity=fe.a,fe.a===0?this.pdf.setDrawColor(255,255,255):(fe.a,this.pdf.setDrawColor(fe.r,fe.g,fe.b))}}),Object.defineProperty(this,"lineCap",{get:function(){return this.ctx.lineCap},set:function(j){["butt","round","square"].indexOf(j)!==-1&&(this.ctx.lineCap=j,this.pdf.setLineCap(j))}}),Object.defineProperty(this,"lineWidth",{get:function(){return this.ctx.lineWidth},set:function(j){isNaN(j)||(this.ctx.lineWidth=j,this.pdf.setLineWidth(j))}}),Object.defineProperty(this,"lineJoin",{get:function(){return this.ctx.lineJoin},set:function(j){["bevel","round","miter"].indexOf(j)!==-1&&(this.ctx.lineJoin=j,this.pdf.setLineJoin(j))}}),Object.defineProperty(this,"miterLimit",{get:function(){return this.ctx.miterLimit},set:function(j){isNaN(j)||(this.ctx.miterLimit=j,this.pdf.setMiterLimit(j))}}),Object.defineProperty(this,"textBaseline",{get:function(){return this.ctx.textBaseline},set:function(j){this.ctx.textBaseline=j}}),Object.defineProperty(this,"textAlign",{get:function(){return this.ctx.textAlign},set:function(j){["right","end","center","left","start"].indexOf(j)!==-1&&(this.ctx.textAlign=j)}});var H=null,Z=null,he=null;Object.defineProperty(this,"fontFaces",{get:function(){return he},set:function(j){H=null,Z=null,he=j}}),Object.defineProperty(this,"font",{get:function(){return this.ctx.font},set:function(j){var fe;if(this.ctx.font=j,(fe=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-_,\"\'\sa-z0-9]+?)\s*$/i.exec(j))!==null){var Ee=fe[1];fe[2];var Le=fe[3],ge=fe[4];fe[5];var Te=fe[6],_e=/^([.\d]+)((?:%|in|[cem]m|ex|p[ctx]))$/i.exec(ge)[2];ge=Math.floor(_e==="px"?parseFloat(ge)*this.pdf.internal.scaleFactor:_e==="em"?parseFloat(ge)*this.pdf.getFontSize():parseFloat(ge)*this.pdf.internal.scaleFactor),this.pdf.setFontSize(ge);var Ie=(function($e){var Jt,Ot,Lt=[],ht=$e.trim();if(ht==="")return iy;if(ht in Z2)return[Z2[ht]];for(;ht!=="";){switch(Ot=null,Jt=(ht=Q2(ht)).charAt(0)){case'"':case"'":Ot=t$(ht.substring(1),Jt);break;default:Ot=i$(ht)}if(Ot===null||(Lt.push(Ot[0]),(ht=Q2(Ot[1]))!==""&&ht.charAt(0)!==","))return iy;ht=ht.replace(/^,/,"")}return Lt})(Te);if(this.fontFaces){var Se=(function($e,Jt){var Ot=$e.getFontList(),Lt=JSON.stringify(Ot);if(H===null||Z!==Lt){var ht=(function(Ut){var ot=[];return Object.keys(Ut).forEach(function(hi){Ut[hi].forEach(function(dt){var xt=null;switch(dt){case"bold":xt={family:hi,weight:"bold"};break;case"italic":xt={family:hi,style:"italic"};break;case"bolditalic":xt={family:hi,weight:"bold",style:"italic"};break;case"":case"normal":xt={family:hi}}xt!==null&&(xt.ref={name:hi,style:dt},ot.push(xt))})}),ot})(Ot);H=(function(Ut){for(var ot={},hi=0;hi<Ut.length;++hi){var dt=ty(Ut[hi]),xt=dt.family,di=dt.stretch,At=dt.style,gt=dt.weight;ot[xt]=ot[xt]||{},ot[xt][di]=ot[xt][di]||{},ot[xt][di][At]=ot[xt][di][At]||{},ot[xt][di][At][gt]=dt}return ot})(ht.concat(Jt)),Z=Lt}return H})(this.pdf,this.fontFaces),Ge=Ie.map(function($e){return{family:$e,stretch:"normal",weight:Le,style:Ee}}),Be=(function($e,Jt,Ot){for(var Lt=(Ot=Ot||{}).defaultFontFamily||"times",ht=Object.assign({},e$,Ot.genericFontFamilies||{}),Ut=null,ot=null,hi=0;hi<Jt.length;++hi)if(ht[(Ut=ty(Jt[hi])).family]&&(Ut.family=ht[Ut.family]),$e.hasOwnProperty(Ut.family)){ot=$e[Ut.family];break}if(!(ot=ot||$e[Lt]))throw new Error("Could not find a font-family for the rule '"+J2(Ut)+"' and default family '"+Lt+"'.");if(ot=(function(dt,xt){if(xt[dt])return xt[dt];var di=pv[dt],At=di<=pv.normal?-1:1,gt=Y2(xt,tM,di,At);if(!gt)throw new Error("Could not find a matching font-stretch value for "+dt);return gt})(Ut.stretch,ot),ot=(function(dt,xt){if(xt[dt])return xt[dt];for(var di=eM[dt],At=0;At<di.length;++At)if(xt[di[At]])return xt[di[At]];throw new Error("Could not find a matching font-style for "+dt)})(Ut.style,ot),!(ot=(function(dt,xt){if(xt[dt])return xt[dt];if(dt===400&&xt[500])return xt[500];if(dt===500&&xt[400])return xt[400];var di=QV[dt],At=Y2(xt,iM,di,dt<400?-1:1);if(!At)throw new Error("Could not find a matching font-weight for value "+dt);return At})(Ut.weight,ot)))throw new Error("Failed to resolve a font for the rule '"+J2(Ut)+"'.");return ot})(Se,Ge);this.pdf.setFont(Be.ref.name,Be.ref.style)}else{var je="";(Le==="bold"||parseInt(Le,10)>=700||Ee==="bold")&&(je="bold"),Ee==="italic"&&(je+="italic"),je.length===0&&(je="normal");for(var Ke="",Xe={arial:"Helvetica",Arial:"Helvetica",verdana:"Helvetica",Verdana:"Helvetica",helvetica:"Helvetica",Helvetica:"Helvetica","sans-serif":"Helvetica",fixed:"Courier",monospace:"Courier",terminal:"Courier",cursive:"Times",fantasy:"Times",serif:"Times"},qe=0;qe<Ie.length;qe++){if(this.pdf.internal.getFont(Ie[qe],je,{noFallback:!0,disableWarning:!0})!==void 0){Ke=Ie[qe];break}if(je==="bolditalic"&&this.pdf.internal.getFont(Ie[qe],"bold",{noFallback:!0,disableWarning:!0})!==void 0)Ke=Ie[qe],je="bold";else if(this.pdf.internal.getFont(Ie[qe],"normal",{noFallback:!0,disableWarning:!0})!==void 0){Ke=Ie[qe],je="normal";break}}if(Ke===""){for(var st=0;st<Ie.length;st++)if(Xe[Ie[st]]){Ke=Xe[Ie[st]];break}}Ke=Ke===""?"Times":Ke,this.pdf.setFont(Ke,je)}}}}),Object.defineProperty(this,"globalCompositeOperation",{get:function(){return this.ctx.globalCompositeOperation},set:function(j){this.ctx.globalCompositeOperation=j}}),Object.defineProperty(this,"globalAlpha",{get:function(){return this.ctx.globalAlpha},set:function(j){this.ctx.globalAlpha=j}}),Object.defineProperty(this,"lineDashOffset",{get:function(){return this.ctx.lineDashOffset},set:function(j){this.ctx.lineDashOffset=j,ae.call(this)}}),Object.defineProperty(this,"lineDash",{get:function(){return this.ctx.lineDash},set:function(j){this.ctx.lineDash=j,ae.call(this)}}),Object.defineProperty(this,"ignoreClearRect",{get:function(){return this.ctx.ignoreClearRect},set:function(j){this.ctx.ignoreClearRect=!!j}})};u.prototype.setLineDash=function(I){this.lineDash=I},u.prototype.getLineDash=function(){return this.lineDash.length%2?this.lineDash.concat(this.lineDash):this.lineDash.slice()},u.prototype.fill=function(){b.call(this,"fill",!1)},u.prototype.stroke=function(){b.call(this,"stroke",!1)},u.prototype.beginPath=function(){this.path=[{type:"begin"}]},u.prototype.moveTo=function(I,U){if(isNaN(I)||isNaN(U))throw Mi.error("jsPDF.context2d.moveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.moveTo");var K=this.ctx.transform.applyToPoint(new o(I,U));this.path.push({type:"mt",x:K.x,y:K.y}),this.ctx.lastPoint=new o(I,U)},u.prototype.closePath=function(){var I=new o(0,0),U=0;for(U=this.path.length-1;U!==-1;U--)if(this.path[U].type==="begin"&&bi(this.path[U+1])==="object"&&typeof this.path[U+1].x=="number"){I=new o(this.path[U+1].x,this.path[U+1].y);break}this.path.push({type:"close"}),this.ctx.lastPoint=new o(I.x,I.y)},u.prototype.lineTo=function(I,U){if(isNaN(I)||isNaN(U))throw Mi.error("jsPDF.context2d.lineTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.lineTo");var K=this.ctx.transform.applyToPoint(new o(I,U));this.path.push({type:"lt",x:K.x,y:K.y}),this.ctx.lastPoint=new o(K.x,K.y)},u.prototype.clip=function(){this.ctx.clip_path=JSON.parse(JSON.stringify(this.path)),b.call(this,null,!0)},u.prototype.quadraticCurveTo=function(I,U,K,ie){if(isNaN(K)||isNaN(ie)||isNaN(I)||isNaN(U))throw Mi.error("jsPDF.context2d.quadraticCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.quadraticCurveTo");var re=this.ctx.transform.applyToPoint(new o(K,ie)),ce=this.ctx.transform.applyToPoint(new o(I,U));this.path.push({type:"qct",x1:ce.x,y1:ce.y,x:re.x,y:re.y}),this.ctx.lastPoint=new o(re.x,re.y)},u.prototype.bezierCurveTo=function(I,U,K,ie,re,ce){if(isNaN(re)||isNaN(ce)||isNaN(I)||isNaN(U)||isNaN(K)||isNaN(ie))throw Mi.error("jsPDF.context2d.bezierCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.bezierCurveTo");var ve=this.ctx.transform.applyToPoint(new o(re,ce)),pe=this.ctx.transform.applyToPoint(new o(I,U)),le=this.ctx.transform.applyToPoint(new o(K,ie));this.path.push({type:"bct",x1:pe.x,y1:pe.y,x2:le.x,y2:le.y,x:ve.x,y:ve.y}),this.ctx.lastPoint=new o(ve.x,ve.y)},u.prototype.arc=function(I,U,K,ie,re,ce){if(isNaN(I)||isNaN(U)||isNaN(K)||isNaN(ie)||isNaN(re))throw Mi.error("jsPDF.context2d.arc: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.arc");if(ce=!!ce,!this.ctx.transform.isIdentity){var ve=this.ctx.transform.applyToPoint(new o(I,U));I=ve.x,U=ve.y;var pe=this.ctx.transform.applyToPoint(new o(0,K)),le=this.ctx.transform.applyToPoint(new o(0,0));K=Math.sqrt(Math.pow(pe.x-le.x,2)+Math.pow(pe.y-le.y,2))}Math.abs(re-ie)>=2*Math.PI&&(ie=0,re=2*Math.PI),this.path.push({type:"arc",x:I,y:U,radius:K,startAngle:ie,endAngle:re,counterclockwise:ce})},u.prototype.arcTo=function(I,U,K,ie,re){throw new Error("arcTo not implemented.")},u.prototype.rect=function(I,U,K,ie){if(isNaN(I)||isNaN(U)||isNaN(K)||isNaN(ie))throw Mi.error("jsPDF.context2d.rect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rect");this.moveTo(I,U),this.lineTo(I+K,U),this.lineTo(I+K,U+ie),this.lineTo(I,U+ie),this.lineTo(I,U),this.lineTo(I+K,U),this.lineTo(I,U)},u.prototype.fillRect=function(I,U,K,ie){if(isNaN(I)||isNaN(U)||isNaN(K)||isNaN(ie))throw Mi.error("jsPDF.context2d.fillRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillRect");if(!d.call(this)){var re={};this.lineCap!=="butt"&&(re.lineCap=this.lineCap,this.lineCap="butt"),this.lineJoin!=="miter"&&(re.lineJoin=this.lineJoin,this.lineJoin="miter"),this.beginPath(),this.rect(I,U,K,ie),this.fill(),re.hasOwnProperty("lineCap")&&(this.lineCap=re.lineCap),re.hasOwnProperty("lineJoin")&&(this.lineJoin=re.lineJoin)}},u.prototype.strokeRect=function(I,U,K,ie){if(isNaN(I)||isNaN(U)||isNaN(K)||isNaN(ie))throw Mi.error("jsPDF.context2d.strokeRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeRect");g.call(this)||(this.beginPath(),this.rect(I,U,K,ie),this.stroke())},u.prototype.clearRect=function(I,U,K,ie){if(isNaN(I)||isNaN(U)||isNaN(K)||isNaN(ie))throw Mi.error("jsPDF.context2d.clearRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.clearRect");this.ignoreClearRect||(this.fillStyle="#ffffff",this.fillRect(I,U,K,ie))},u.prototype.save=function(I){I=typeof I!="boolean"||I;for(var U=this.pdf.internal.getCurrentPageInfo().pageNumber,K=0;K<this.pdf.internal.getNumberOfPages();K++)this.pdf.setPage(K+1),this.pdf.internal.out("q");if(this.pdf.setPage(U),I){this.ctx.fontSize=this.pdf.internal.getFontSize();var ie=new h(this.ctx);this.ctxStack.push(this.ctx),this.ctx=ie}},u.prototype.restore=function(I){I=typeof I!="boolean"||I;for(var U=this.pdf.internal.getCurrentPageInfo().pageNumber,K=0;K<this.pdf.internal.getNumberOfPages();K++)this.pdf.setPage(K+1),this.pdf.internal.out("Q");this.pdf.setPage(U),I&&this.ctxStack.length!==0&&(this.ctx=this.ctxStack.pop(),this.fillStyle=this.ctx.fillStyle,this.strokeStyle=this.ctx.strokeStyle,this.font=this.ctx.font,this.lineCap=this.ctx.lineCap,this.lineWidth=this.ctx.lineWidth,this.lineJoin=this.ctx.lineJoin,this.lineDash=this.ctx.lineDash,this.lineDashOffset=this.ctx.lineDashOffset)},u.prototype.toDataURL=function(){throw new Error("toDataUrl not implemented.")};var f=function(I){var U,K,ie,re;if(I.isCanvasGradient===!0&&(I=I.getColor()),!I)return{r:0,g:0,b:0,a:0,style:I};if(/transparent|rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*0+\s*\)/.test(I))U=0,K=0,ie=0,re=0;else{var ce=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(I);if(ce!==null)U=parseInt(ce[1]),K=parseInt(ce[2]),ie=parseInt(ce[3]),re=1;else if((ce=/rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)/.exec(I))!==null)U=parseInt(ce[1]),K=parseInt(ce[2]),ie=parseInt(ce[3]),re=parseFloat(ce[4]);else{if(re=1,typeof I=="string"&&I.charAt(0)!=="#"){var ve=new HP(I);I=ve.ok?ve.toHex():"#000000"}I.length===4?(U=I.substring(1,2),U+=U,K=I.substring(2,3),K+=K,ie=I.substring(3,4),ie+=ie):(U=I.substring(1,3),K=I.substring(3,5),ie=I.substring(5,7)),U=parseInt(U,16),K=parseInt(K,16),ie=parseInt(ie,16)}}return{r:U,g:K,b:ie,a:re,style:I}},d=function(){return this.ctx.isFillTransparent||this.globalAlpha==0},g=function(){return!!(this.ctx.isStrokeTransparent||this.globalAlpha==0)};u.prototype.fillText=function(I,U,K,ie){if(isNaN(U)||isNaN(K)||typeof I!="string")throw Mi.error("jsPDF.context2d.fillText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillText");if(ie=isNaN(ie)?void 0:ie,!d.call(this)){var re=V(this.ctx.transform.rotation),ce=this.ctx.transform.scaleX;T.call(this,{text:I,x:U,y:K,scale:ce,angle:re,align:this.textAlign,maxWidth:ie})}},u.prototype.strokeText=function(I,U,K,ie){if(isNaN(U)||isNaN(K)||typeof I!="string")throw Mi.error("jsPDF.context2d.strokeText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeText");if(!g.call(this)){ie=isNaN(ie)?void 0:ie;var re=V(this.ctx.transform.rotation),ce=this.ctx.transform.scaleX;T.call(this,{text:I,x:U,y:K,scale:ce,renderingMode:"stroke",angle:re,align:this.textAlign,maxWidth:ie})}},u.prototype.measureText=function(I){if(typeof I!="string")throw Mi.error("jsPDF.context2d.measureText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.measureText");var U=this.pdf,K=this.pdf.internal.scaleFactor,ie=U.internal.getFontSize(),re=U.getStringUnitWidth(I)*ie/U.internal.scaleFactor;return new function(ce){var ve=(ce=ce||{}).width||0;return Object.defineProperty(this,"width",{get:function(){return ve}}),this}({width:re*=Math.round(96*K/72*1e4)/1e4})},u.prototype.scale=function(I,U){if(isNaN(I)||isNaN(U))throw Mi.error("jsPDF.context2d.scale: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.scale");var K=new l(I,0,0,U,0,0);this.ctx.transform=this.ctx.transform.multiply(K)},u.prototype.rotate=function(I){if(isNaN(I))throw Mi.error("jsPDF.context2d.rotate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rotate");var U=new l(Math.cos(I),Math.sin(I),-Math.sin(I),Math.cos(I),0,0);this.ctx.transform=this.ctx.transform.multiply(U)},u.prototype.translate=function(I,U){if(isNaN(I)||isNaN(U))throw Mi.error("jsPDF.context2d.translate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.translate");var K=new l(1,0,0,1,I,U);this.ctx.transform=this.ctx.transform.multiply(K)},u.prototype.transform=function(I,U,K,ie,re,ce){if(isNaN(I)||isNaN(U)||isNaN(K)||isNaN(ie)||isNaN(re)||isNaN(ce))throw Mi.error("jsPDF.context2d.transform: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.transform");var ve=new l(I,U,K,ie,re,ce);this.ctx.transform=this.ctx.transform.multiply(ve)},u.prototype.setTransform=function(I,U,K,ie,re,ce){I=isNaN(I)?1:I,U=isNaN(U)?0:U,K=isNaN(K)?0:K,ie=isNaN(ie)?1:ie,re=isNaN(re)?0:re,ce=isNaN(ce)?0:ce,this.ctx.transform=new l(I,U,K,ie,re,ce)};var m=function(){return this.margin[0]>0||this.margin[1]>0||this.margin[2]>0||this.margin[3]>0};u.prototype.drawImage=function(I,U,K,ie,re,ce,ve,pe,le){var Ce=this.pdf.getImageProperties(I),H=1,Z=1,he=1,j=1;ie!==void 0&&pe!==void 0&&(he=pe/ie,j=le/re,H=Ce.width/ie*pe/ie,Z=Ce.height/re*le/re),ce===void 0&&(ce=U,ve=K,U=0,K=0),ie!==void 0&&pe===void 0&&(pe=ie,le=re),ie===void 0&&pe===void 0&&(pe=Ce.width,le=Ce.height);var fe=this.ctx.transform.decompose(),Ee=V(fe.rotate.shx),Le=new l,ge=(Le=(Le=(Le=Le.multiply(fe.translate)).multiply(fe.skew)).multiply(fe.scale)).applyToRectangle(new a(ce-U*he,ve-K*j,ie*H,re*Z));if(this.autoPaging){for(var Te,_e=_.call(this,ge),Ie=[],Se=0;Se<_e.length;Se+=1)Ie.indexOf(_e[Se])===-1&&Ie.push(_e[Se]);S(Ie);for(var Ge=Ie[0],Be=Ie[Ie.length-1],je=Ge;je<Be+1;je++){this.pdf.setPage(je);var Ke=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],Xe=je===1?this.posY+this.margin[0]:this.margin[0],qe=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],st=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],$e=je===1?0:qe+(je-2)*st;if(this.ctx.clip_path.length!==0){var Jt=this.path;Te=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=x(Te,this.posX+this.margin[3],-$e+Xe+this.ctx.prevPageLastElemOffset),A.call(this,"fill",!0),this.path=Jt}var Ot=JSON.parse(JSON.stringify(ge));Ot=x([Ot],this.posX+this.margin[3],-$e+Xe+this.ctx.prevPageLastElemOffset)[0];var Lt=(je>Ge||je<Be)&&m.call(this);Lt&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],Ke,st,null).clip().discardPath()),this.pdf.addImage(I,"JPEG",Ot.x,Ot.y,Ot.w,Ot.h,null,null,Ee),Lt&&this.pdf.restoreGraphicsState()}}else this.pdf.addImage(I,"JPEG",ge.x,ge.y,ge.w,ge.h,null,null,Ee)};var _=function(I,U,K){var ie=[];U=U||this.pdf.internal.pageSize.width,K=K||this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2];var re=this.posY+this.ctx.prevPageLastElemOffset;switch(I.type){default:case"mt":case"lt":ie.push(Math.floor((I.y+re)/K)+1);break;case"arc":ie.push(Math.floor((I.y+re-I.radius)/K)+1),ie.push(Math.floor((I.y+re+I.radius)/K)+1);break;case"qct":var ce=te(this.ctx.lastPoint.x,this.ctx.lastPoint.y,I.x1,I.y1,I.x,I.y);ie.push(Math.floor((ce.y+re)/K)+1),ie.push(Math.floor((ce.y+ce.h+re)/K)+1);break;case"bct":var ve=ne(this.ctx.lastPoint.x,this.ctx.lastPoint.y,I.x1,I.y1,I.x2,I.y2,I.x,I.y);ie.push(Math.floor((ve.y+re)/K)+1),ie.push(Math.floor((ve.y+ve.h+re)/K)+1);break;case"rect":ie.push(Math.floor((I.y+re)/K)+1),ie.push(Math.floor((I.y+I.h+re)/K)+1)}for(var pe=0;pe<ie.length;pe+=1)for(;this.pdf.internal.getNumberOfPages()<ie[pe];)v.call(this);return ie},v=function(){var I=this.fillStyle,U=this.strokeStyle,K=this.font,ie=this.lineCap,re=this.lineWidth,ce=this.lineJoin;this.pdf.addPage(),this.fillStyle=I,this.strokeStyle=U,this.font=K,this.lineCap=ie,this.lineWidth=re,this.lineJoin=ce},x=function(I,U,K){for(var ie=0;ie<I.length;ie++)switch(I[ie].type){case"bct":I[ie].x2+=U,I[ie].y2+=K;case"qct":I[ie].x1+=U,I[ie].y1+=K;default:I[ie].x+=U,I[ie].y+=K}return I},S=function(I){return I.sort(function(U,K){return U-K})},b=function(I,U){var K=this.fillStyle,ie=this.strokeStyle,re=this.lineCap,ce=this.lineWidth,ve=Math.abs(ce*this.ctx.transform.scaleX),pe=this.lineJoin;if(this.autoPaging){for(var le,Ce,H=JSON.parse(JSON.stringify(this.path)),Z=JSON.parse(JSON.stringify(this.path)),he=[],j=0;j<Z.length;j++)if(Z[j].x!==void 0)for(var fe=_.call(this,Z[j]),Ee=0;Ee<fe.length;Ee+=1)he.indexOf(fe[Ee])===-1&&he.push(fe[Ee]);for(var Le=0;Le<he.length;Le++)for(;this.pdf.internal.getNumberOfPages()<he[Le];)v.call(this);S(he);for(var ge=he[0],Te=he[he.length-1],_e=ge;_e<Te+1;_e++){this.pdf.setPage(_e),this.fillStyle=K,this.strokeStyle=ie,this.lineCap=re,this.lineWidth=ve,this.lineJoin=pe;var Ie=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],Se=_e===1?this.posY+this.margin[0]:this.margin[0],Ge=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Be=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],je=_e===1?0:Ge+(_e-2)*Be;if(this.ctx.clip_path.length!==0){var Ke=this.path;le=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=x(le,this.posX+this.margin[3],-je+Se+this.ctx.prevPageLastElemOffset),A.call(this,I,!0),this.path=Ke}if(Ce=JSON.parse(JSON.stringify(H)),this.path=x(Ce,this.posX+this.margin[3],-je+Se+this.ctx.prevPageLastElemOffset),U===!1||_e===0){var Xe=(_e>ge||_e<Te)&&m.call(this);Xe&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],Ie,Be,null).clip().discardPath()),A.call(this,I,U),Xe&&this.pdf.restoreGraphicsState()}this.lineWidth=ce}this.path=H}else this.lineWidth=ve,A.call(this,I,U),this.lineWidth=ce},A=function(I,U){if((I!=="stroke"||U||!g.call(this))&&(I==="stroke"||U||!d.call(this))){for(var K,ie,re=[],ce=this.path,ve=0;ve<ce.length;ve++){var pe=ce[ve];switch(pe.type){case"begin":re.push({begin:!0});break;case"close":re.push({close:!0});break;case"mt":re.push({start:pe,deltas:[],abs:[]});break;case"lt":var le=re.length;if(ce[ve-1]&&!isNaN(ce[ve-1].x)&&(K=[pe.x-ce[ve-1].x,pe.y-ce[ve-1].y],le>0)){for(;le>=0;le--)if(re[le-1].close!==!0&&re[le-1].begin!==!0){re[le-1].deltas.push(K),re[le-1].abs.push(pe);break}}break;case"bct":K=[pe.x1-ce[ve-1].x,pe.y1-ce[ve-1].y,pe.x2-ce[ve-1].x,pe.y2-ce[ve-1].y,pe.x-ce[ve-1].x,pe.y-ce[ve-1].y],re[re.length-1].deltas.push(K);break;case"qct":var Ce=ce[ve-1].x+2/3*(pe.x1-ce[ve-1].x),H=ce[ve-1].y+2/3*(pe.y1-ce[ve-1].y),Z=pe.x+2/3*(pe.x1-pe.x),he=pe.y+2/3*(pe.y1-pe.y),j=pe.x,fe=pe.y;K=[Ce-ce[ve-1].x,H-ce[ve-1].y,Z-ce[ve-1].x,he-ce[ve-1].y,j-ce[ve-1].x,fe-ce[ve-1].y],re[re.length-1].deltas.push(K);break;case"arc":re.push({deltas:[],abs:[],arc:!0}),Array.isArray(re[re.length-1].abs)&&re[re.length-1].abs.push(pe)}}ie=U?null:I==="stroke"?"stroke":"fill";for(var Ee=!1,Le=0;Le<re.length;Le++)if(re[Le].arc)for(var ge=re[Le].abs,Te=0;Te<ge.length;Te++){var _e=ge[Te];_e.type==="arc"?R.call(this,_e.x,_e.y,_e.radius,_e.startAngle,_e.endAngle,_e.counterclockwise,void 0,U,!Ee):C.call(this,_e.x,_e.y),Ee=!0}else if(re[Le].close===!0)this.pdf.internal.out("h"),Ee=!1;else if(re[Le].begin!==!0){var Ie=re[Le].start.x,Se=re[Le].start.y;D.call(this,re[Le].deltas,Ie,Se),Ee=!0}ie&&P.call(this,ie),U&&O.call(this)}},F=function(I){var U=this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor,K=U*(this.pdf.internal.getLineHeightFactor()-1);switch(this.ctx.textBaseline){case"bottom":return I-K;case"top":return I+U-K;case"hanging":return I+U-2*K;case"middle":return I+U/2-K;default:return I}},N=function(I){return I+this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor*(this.pdf.internal.getLineHeightFactor()-1)};u.prototype.createLinearGradient=function(){var I=function(){};return I.colorStops=[],I.addColorStop=function(U,K){this.colorStops.push([U,K])},I.getColor=function(){return this.colorStops.length===0?"#000000":this.colorStops[0][1]},I.isCanvasGradient=!0,I},u.prototype.createPattern=function(){return this.createLinearGradient()},u.prototype.createRadialGradient=function(){return this.createLinearGradient()};var R=function(I,U,K,ie,re,ce,ve,pe,le){for(var Ce=$.call(this,K,ie,re,ce),H=0;H<Ce.length;H++){var Z=Ce[H];H===0&&(le?L.call(this,Z.x1+I,Z.y1+U):C.call(this,Z.x1+I,Z.y1+U)),W.call(this,I,U,Z.x2,Z.y2,Z.x3,Z.y3,Z.x4,Z.y4)}pe?O.call(this):P.call(this,ve)},P=function(I){switch(I){case"stroke":this.pdf.internal.out("S");break;case"fill":this.pdf.internal.out("f")}},O=function(){this.pdf.clip(),this.pdf.discardPath()},L=function(I,U){this.pdf.internal.out(t(I)+" "+n(U)+" m")},T=function(I){var U;switch(I.align){case"right":case"end":U="right";break;case"center":U="center";break;default:U="left"}var K,ie,re,ce=this.pdf.getTextDimensions(I.text),ve=F.call(this,I.y),pe=N.call(this,ve)-ce.h,le=this.ctx.transform.applyToPoint(new o(I.x,ve));if(this.autoPaging){var Ce=this.ctx.transform.decompose(),H=new l;H=(H=(H=H.multiply(Ce.translate)).multiply(Ce.skew)).multiply(Ce.scale);for(var Z=this.ctx.transform.applyToRectangle(new a(I.x,ve,ce.w,ce.h)),he=H.applyToRectangle(new a(I.x,pe,ce.w,ce.h)),j=_.call(this,he),fe=[],Ee=0;Ee<j.length;Ee+=1)fe.indexOf(j[Ee])===-1&&fe.push(j[Ee]);S(fe);for(var Le=fe[0],ge=fe[fe.length-1],Te=Le;Te<ge+1;Te++){this.pdf.setPage(Te);var _e=Te===1?this.posY+this.margin[0]:this.margin[0],Ie=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Se=this.pdf.internal.pageSize.height-this.margin[2],Ge=Se-this.margin[0],Be=this.pdf.internal.pageSize.width-this.margin[1],je=Be-this.margin[3],Ke=Te===1?0:Ie+(Te-2)*Ge;if(this.ctx.clip_path.length!==0){var Xe=this.path;K=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=x(K,this.posX+this.margin[3],-1*Ke+_e),A.call(this,"fill",!0),this.path=Xe}var qe=x([JSON.parse(JSON.stringify(he))],this.posX+this.margin[3],-Ke+_e+this.ctx.prevPageLastElemOffset)[0];I.scale>=.01&&(ie=this.pdf.internal.getFontSize(),this.pdf.setFontSize(ie*I.scale),re=this.lineWidth,this.lineWidth=re*I.scale);var st=this.autoPaging!=="text";if(st||qe.y+qe.h<=Se){if(st||qe.y>=_e&&qe.x<=Be){var $e=st?I.text:this.pdf.splitTextToSize(I.text,I.maxWidth||Be-qe.x)[0],Jt=x([JSON.parse(JSON.stringify(Z))],this.posX+this.margin[3],-Ke+_e+this.ctx.prevPageLastElemOffset)[0],Ot=st&&(Te>Le||Te<ge)&&m.call(this);Ot&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],je,Ge,null).clip().discardPath()),this.pdf.text($e,Jt.x,Jt.y,{angle:I.angle,align:U,renderingMode:I.renderingMode}),Ot&&this.pdf.restoreGraphicsState()}}else qe.y<Se&&(this.ctx.prevPageLastElemOffset+=Se-qe.y);I.scale>=.01&&(this.pdf.setFontSize(ie),this.lineWidth=re)}}else I.scale>=.01&&(ie=this.pdf.internal.getFontSize(),this.pdf.setFontSize(ie*I.scale),re=this.lineWidth,this.lineWidth=re*I.scale),this.pdf.text(I.text,le.x+this.posX,le.y+this.posY,{angle:I.angle,align:U,renderingMode:I.renderingMode,maxWidth:I.maxWidth}),I.scale>=.01&&(this.pdf.setFontSize(ie),this.lineWidth=re)},C=function(I,U,K,ie){K=K||0,ie=ie||0,this.pdf.internal.out(t(I+K)+" "+n(U+ie)+" l")},D=function(I,U,K){return this.pdf.lines(I,U,K,null,null)},W=function(I,U,K,ie,re,ce,ve,pe){this.pdf.internal.out([e(r(K+I)),e(s(ie+U)),e(r(re+I)),e(s(ce+U)),e(r(ve+I)),e(s(pe+U)),"c"].join(" "))},$=function(I,U,K,ie){for(var re=2*Math.PI,ce=Math.PI/2;U>K;)U-=re;var ve=Math.abs(K-U);ve<re&&ie&&(ve=re-ve);for(var pe=[],le=ie?-1:1,Ce=U;ve>1e-5;){var H=Ce+le*Math.min(ve,ce);pe.push(B.call(this,I,Ce,H)),ve-=Math.abs(H-Ce),Ce=H}return pe},B=function(I,U,K){var ie=(K-U)/2,re=I*Math.cos(ie),ce=I*Math.sin(ie),ve=re,pe=-ce,le=ve*ve+pe*pe,Ce=le+ve*re+pe*ce,H=4/3*(Math.sqrt(2*le*Ce)-Ce)/(ve*ce-pe*re),Z=ve-H*pe,he=pe+H*ve,j=Z,fe=-he,Ee=ie+U,Le=Math.cos(Ee),ge=Math.sin(Ee);return{x1:I*Math.cos(U),y1:I*Math.sin(U),x2:Z*Le-he*ge,y2:Z*ge+he*Le,x3:j*Le-fe*ge,y3:j*ge+fe*Le,x4:I*Math.cos(K),y4:I*Math.sin(K)}},V=function(I){return 180*I/Math.PI},te=function(I,U,K,ie,re,ce){var ve=I+.5*(K-I),pe=U+.5*(ie-U),le=re+.5*(K-re),Ce=ce+.5*(ie-ce),H=Math.min(I,re,ve,le),Z=Math.max(I,re,ve,le),he=Math.min(U,ce,pe,Ce),j=Math.max(U,ce,pe,Ce);return new a(H,he,Z-H,j-he)},ne=function(I,U,K,ie,re,ce,ve,pe){var le,Ce,H,Z,he,j,fe,Ee,Le,ge,Te,_e,Ie,Se,Ge=K-I,Be=ie-U,je=re-K,Ke=ce-ie,Xe=ve-re,qe=pe-ce;for(Ce=0;Ce<41;Ce++)Le=(fe=(H=I+(le=Ce/40)*Ge)+le*((he=K+le*je)-H))+le*(he+le*(re+le*Xe-he)-fe),ge=(Ee=(Z=U+le*Be)+le*((j=ie+le*Ke)-Z))+le*(j+le*(ce+le*qe-j)-Ee),Ce==0?(Te=Le,_e=ge,Ie=Le,Se=ge):(Te=Math.min(Te,Le),_e=Math.min(_e,ge),Ie=Math.max(Ie,Le),Se=Math.max(Se,ge));return new a(Math.round(Te),Math.round(_e),Math.round(Ie-Te),Math.round(Se-_e))},ae=function(){if(this.prevLineDash||this.ctx.lineDash.length||this.ctx.lineDashOffset){var I,U,K=(I=this.ctx.lineDash,U=this.ctx.lineDashOffset,JSON.stringify({lineDash:I,lineDashOffset:U}));this.prevLineDash!==K&&(this.pdf.setLineDash(this.ctx.lineDash,this.ctx.lineDashOffset),this.prevLineDash=K)}}})(ct.API),(function(i){var e=function(o){var a,l,c,h,u,f,d,g,m,_;for(l=[],c=0,h=(o+=a="\0\0\0\0".slice(o.length%4||4)).length;h>c;c+=4)(u=(o.charCodeAt(c)<<24)+(o.charCodeAt(c+1)<<16)+(o.charCodeAt(c+2)<<8)+o.charCodeAt(c+3))!==0?(f=(u=((u=((u=((u=(u-(_=u%85))/85)-(m=u%85))/85)-(g=u%85))/85)-(d=u%85))/85)%85,l.push(f+33,d+33,g+33,m+33,_+33)):l.push(122);return(function(v,x){for(var S=x;S>0;S--)v.pop()})(l,a.length),String.fromCharCode.apply(String,l)+"~>"},t=function(o){var a,l,c,h,u,f=String,d="length",g=255,m="charCodeAt",_="slice",v="replace";for(o[_](-2),o=o[_](0,-2)[v](/\s/g,"")[v]("z","!!!!!"),c=[],h=0,u=(o+=a="uuuuu"[_](o[d]%5||5))[d];u>h;h+=5)l=52200625*(o[m](h)-33)+614125*(o[m](h+1)-33)+7225*(o[m](h+2)-33)+85*(o[m](h+3)-33)+(o[m](h+4)-33),c.push(g&l>>24,g&l>>16,g&l>>8,g&l);return(function(x,S){for(var b=S;b>0;b--)x.pop()})(c,a[d]),f.fromCharCode.apply(f,c)},n=function(o){return o.split("").map(function(a){return("0"+a.charCodeAt().toString(16)).slice(-2)}).join("")+">"},r=function(o){var a=new RegExp(/^([0-9A-Fa-f]{2})+$/);if((o=o.replace(/\s/g,"")).indexOf(">")!==-1&&(o=o.substr(0,o.indexOf(">"))),o.length%2&&(o+="0"),a.test(o)===!1)return"";for(var l="",c=0;c<o.length;c+=2)l+=String.fromCharCode("0x"+(o[c]+o[c+1]));return l},s=function(o){for(var a=new Uint8Array(o.length),l=o.length;l--;)a[l]=o.charCodeAt(l);return(a=lv(a)).reduce(function(c,h){return c+String.fromCharCode(h)},"")};i.processDataByFilters=function(o,a){var l=0,c=o||"",h=[];for(typeof(a=a||[])=="string"&&(a=[a]),l=0;l<a.length;l+=1)switch(a[l]){case"ASCII85Decode":case"/ASCII85Decode":c=t(c),h.push("/ASCII85Encode");break;case"ASCII85Encode":case"/ASCII85Encode":c=e(c),h.push("/ASCII85Decode");break;case"ASCIIHexDecode":case"/ASCIIHexDecode":c=r(c),h.push("/ASCIIHexEncode");break;case"ASCIIHexEncode":case"/ASCIIHexEncode":c=n(c),h.push("/ASCIIHexDecode");break;case"FlateEncode":case"/FlateEncode":c=s(c),h.push("/FlateDecode");break;default:throw new Error('The filter: "'+a[l]+'" is not implemented')}return{data:c,reverseChain:h.reverse().join(" ")}}})(ct.API),(function(i){i.loadFile=function(e,t,n){return(function(r,s,o){s=s!==!1,o=typeof o=="function"?o:function(){};var a=void 0;try{a=(function(l,c,h){var u=new XMLHttpRequest,f=0,d=function(g){var m=g.length,_=[],v=String.fromCharCode;for(f=0;f<m;f+=1)_.push(v(255&g.charCodeAt(f)));return _.join("")};if(u.open("GET",l,!c),u.overrideMimeType("text/plain; charset=x-user-defined"),c===!1&&(u.onload=function(){u.status===200?h(d(this.responseText)):h(void 0)}),u.send(null),c&&u.status===200)return d(u.responseText)})(r,s,o)}catch{}return a})(e,t,n)},i.allowFsRead=void 0,i.loadImageFile=i.loadFile})(ct.API),(function(i){function e(){return(Et.html2canvas?Promise.resolve(Et.html2canvas):Ys(()=>import("./html2canvas.esm-C17pzFXx-Bnh1DqN7.js"),[])).catch(function(a){return Promise.reject(new Error("Could not load html2canvas: "+a))}).then(function(a){return a.default?a.default:a})}function t(){return(Et.DOMPurify?Promise.resolve(Et.DOMPurify):Ys(()=>import("./purify.es-DaUpxO-q-B6zaa5rw.js"),[])).catch(function(a){return Promise.reject(new Error("Could not load dompurify: "+a))}).then(function(a){return a.default?a.default:a})}var n=function(a){var l=bi(a);return l==="undefined"?"undefined":l==="string"||a instanceof String?"string":l==="number"||a instanceof Number?"number":l==="function"||a instanceof Function?"function":a&&a.constructor===Array?"array":a&&a.nodeType===1?"element":l==="object"?"object":"unknown"},r=function(a,l){var c=document.createElement(a);for(var h in l.className&&(c.className=l.className),l.innerHTML&&l.dompurify&&(c.innerHTML=l.dompurify.sanitize(l.innerHTML)),l.style)c.style[h]=l.style[h];return c},s=function a(l,c){for(var h=l.nodeType===3?document.createTextNode(l.nodeValue):l.cloneNode(!1),u=l.firstChild;u;u=u.nextSibling)c!==!0&&u.nodeType===1&&u.nodeName==="SCRIPT"||h.appendChild(a(u,c));return l.nodeType===1&&(l.nodeName==="CANVAS"?(h.width=l.width,h.height=l.height,h.getContext("2d").drawImage(l,0,0)):l.nodeName!=="TEXTAREA"&&l.nodeName!=="SELECT"||(h.value=l.value),h.addEventListener("load",function(){h.scrollTop=l.scrollTop,h.scrollLeft=l.scrollLeft},!0)),h},o=function a(l){var c=Object.assign(a.convert(Promise.resolve()),JSON.parse(JSON.stringify(a.template))),h=a.convert(Promise.resolve(),c);return(h=h.setProgress(1,a,1,[a])).set(l)};(o.prototype=Object.create(Promise.prototype)).constructor=o,o.convert=function(a,l){return a.__proto__=l||o.prototype,a},o.template={prop:{src:null,container:null,overlay:null,canvas:null,img:null,pdf:null,pageSize:null,callback:function(){}},progress:{val:0,state:null,n:0,stack:[]},opt:{filename:"file.pdf",margin:[0,0,0,0],enableLinks:!0,x:0,y:0,html2canvas:{},jsPDF:{},backgroundColor:"transparent"}},o.prototype.from=function(a,l){return this.then(function(){switch(l=l||(function(c){switch(n(c)){case"string":return"string";case"element":return c.nodeName.toLowerCase()==="canvas"?"canvas":"element";default:return"unknown"}})(a),l){case"string":return this.then(t).then(function(c){return this.set({src:r("div",{innerHTML:a,dompurify:c})})});case"element":return this.set({src:a});case"canvas":return this.set({canvas:a});case"img":return this.set({img:a});default:return this.error("Unknown source type.")}})},o.prototype.to=function(a){switch(a){case"container":return this.toContainer();case"canvas":return this.toCanvas();case"img":return this.toImg();case"pdf":return this.toPdf();default:return this.error("Invalid target.")}},o.prototype.toContainer=function(){return this.thenList([function(){return this.prop.src||this.error("Cannot duplicate - no source HTML.")},function(){return this.prop.pageSize||this.setPageSize()}]).then(function(){var a={position:"relative",display:"inline-block",width:(typeof this.opt.width!="number"||isNaN(this.opt.width)||typeof this.opt.windowWidth!="number"||isNaN(this.opt.windowWidth)?Math.max(this.prop.src.clientWidth,this.prop.src.scrollWidth,this.prop.src.offsetWidth):this.opt.windowWidth)+"px",left:0,right:0,top:0,margin:"auto",backgroundColor:this.opt.backgroundColor},l=s(this.prop.src,this.opt.html2canvas.javascriptEnabled);l.tagName==="BODY"&&(a.height=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)+"px"),this.prop.overlay=r("div",{className:"html2pdf__overlay",style:{position:"fixed",overflow:"hidden",zIndex:1e3,left:"-100000px",right:0,bottom:0,top:0}}),this.prop.container=r("div",{className:"html2pdf__container",style:a}),this.prop.container.appendChild(l),this.prop.container.firstChild.appendChild(r("div",{style:{clear:"both",border:"0 none transparent",margin:0,padding:0,height:0}})),this.prop.container.style.float="none",this.prop.overlay.appendChild(this.prop.container),document.body.appendChild(this.prop.overlay),this.prop.container.firstChild.style.position="relative",this.prop.container.height=Math.max(this.prop.container.firstChild.clientHeight,this.prop.container.firstChild.scrollHeight,this.prop.container.firstChild.offsetHeight)+"px"})},o.prototype.toCanvas=function(){var a=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(a).then(e).then(function(l){var c=Object.assign({},this.opt.html2canvas);return delete c.onrendered,l(this.prop.container,c)}).then(function(l){(this.opt.html2canvas.onrendered||function(){})(l),this.prop.canvas=l,document.body.removeChild(this.prop.overlay)})},o.prototype.toContext2d=function(){var a=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(a).then(e).then(function(l){var c=this.opt.jsPDF,h=this.opt.fontFaces,u=typeof this.opt.width!="number"||isNaN(this.opt.width)||typeof this.opt.windowWidth!="number"||isNaN(this.opt.windowWidth)?1:this.opt.width/this.opt.windowWidth,f=Object.assign({async:!0,allowTaint:!0,scale:u,scrollX:this.opt.scrollX||0,scrollY:this.opt.scrollY||0,backgroundColor:"#ffffff",imageTimeout:15e3,logging:!0,proxy:null,removeContainer:!0,foreignObjectRendering:!1,useCORS:!1},this.opt.html2canvas);if(delete f.onrendered,c.context2d.autoPaging=this.opt.autoPaging===void 0||this.opt.autoPaging,c.context2d.posX=this.opt.x,c.context2d.posY=this.opt.y,c.context2d.margin=this.opt.margin,c.context2d.fontFaces=h,h)for(var d=0;d<h.length;++d){var g=h[d],m=g.src.find(function(_){return _.format==="truetype"});m&&c.addFont(m.url,g.ref.name,g.ref.style)}return f.windowHeight=f.windowHeight||0,f.windowHeight=f.windowHeight==0?Math.max(this.prop.container.clientHeight,this.prop.container.scrollHeight,this.prop.container.offsetHeight):f.windowHeight,c.context2d.save(!0),l(this.prop.container,f)}).then(function(l){this.opt.jsPDF.context2d.restore(!0),(this.opt.html2canvas.onrendered||function(){})(l),this.prop.canvas=l,document.body.removeChild(this.prop.overlay)})},o.prototype.toImg=function(){return this.thenList([function(){return this.prop.canvas||this.toCanvas()}]).then(function(){var a=this.prop.canvas.toDataURL("image/"+this.opt.image.type,this.opt.image.quality);this.prop.img=document.createElement("img"),this.prop.img.src=a})},o.prototype.toPdf=function(){return this.thenList([function(){return this.toContext2d()}]).then(function(){this.prop.pdf=this.prop.pdf||this.opt.jsPDF})},o.prototype.output=function(a,l,c){return(c=c||"pdf").toLowerCase()==="img"||c.toLowerCase()==="image"?this.outputImg(a,l):this.outputPdf(a,l)},o.prototype.outputPdf=function(a,l){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then(function(){return this.prop.pdf.output(a,l)})},o.prototype.outputImg=function(a){return this.thenList([function(){return this.prop.img||this.toImg()}]).then(function(){switch(a){case void 0:case"img":return this.prop.img;case"datauristring":case"dataurlstring":return this.prop.img.src;case"datauri":case"dataurl":return document.location.href=this.prop.img.src;default:throw'Image output type "'+a+'" is not supported.'}})},o.prototype.save=function(a){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).set(a?{filename:a}:null).then(function(){this.prop.pdf.save(this.opt.filename)})},o.prototype.doCallback=function(){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then(function(){this.prop.callback(this.prop.pdf)})},o.prototype.set=function(a){if(n(a)!=="object")return this;var l=Object.keys(a||{}).map(function(c){if(c in o.template.prop)return function(){this.prop[c]=a[c]};switch(c){case"margin":return this.setMargin.bind(this,a.margin);case"jsPDF":return function(){return this.opt.jsPDF=a.jsPDF,this.setPageSize()};case"pageSize":return this.setPageSize.bind(this,a.pageSize);default:return function(){this.opt[c]=a[c]}}},this);return this.then(function(){return this.thenList(l)})},o.prototype.get=function(a,l){return this.then(function(){var c=a in o.template.prop?this.prop[a]:this.opt[a];return l?l(c):c})},o.prototype.setMargin=function(a){return this.then(function(){switch(n(a)){case"number":a=[a,a,a,a];case"array":if(a.length===2&&(a=[a[0],a[1],a[0],a[1]]),a.length===4)break;default:return this.error("Invalid margin array.")}this.opt.margin=a}).then(this.setPageSize)},o.prototype.setPageSize=function(a){function l(c,h){return Math.floor(c*h/72*96)}return this.then(function(){(a=a||ct.getPageSize(this.opt.jsPDF)).hasOwnProperty("inner")||(a.inner={width:a.width-this.opt.margin[1]-this.opt.margin[3],height:a.height-this.opt.margin[0]-this.opt.margin[2]},a.inner.px={width:l(a.inner.width,a.k),height:l(a.inner.height,a.k)},a.inner.ratio=a.inner.height/a.inner.width),this.prop.pageSize=a})},o.prototype.setProgress=function(a,l,c,h){return a!=null&&(this.progress.val=a),l!=null&&(this.progress.state=l),c!=null&&(this.progress.n=c),h!=null&&(this.progress.stack=h),this.progress.ratio=this.progress.val/this.progress.state,this},o.prototype.updateProgress=function(a,l,c,h){return this.setProgress(a?this.progress.val+a:null,l||null,c?this.progress.n+c:null,h?this.progress.stack.concat(h):null)},o.prototype.then=function(a,l){var c=this;return this.thenCore(a,l,function(h,u){return c.updateProgress(null,null,1,[h]),Promise.prototype.then.call(this,function(f){return c.updateProgress(null,h),f}).then(h,u).then(function(f){return c.updateProgress(1),f})})},o.prototype.thenCore=function(a,l,c){c=c||Promise.prototype.then;var h=this;a&&(a=a.bind(h)),l&&(l=l.bind(h));var u=Promise.toString().indexOf("[native code]")!==-1&&Promise.name==="Promise"?h:o.convert(Object.assign({},h),Promise.prototype),f=c.call(u,a,l);return o.convert(f,h.__proto__)},o.prototype.thenExternal=function(a,l){return Promise.prototype.then.call(this,a,l)},o.prototype.thenList=function(a){var l=this;return a.forEach(function(c){l=l.thenCore(c)}),l},o.prototype.catch=function(a){a&&(a=a.bind(this));var l=Promise.prototype.catch.call(this,a);return o.convert(l,this)},o.prototype.catchExternal=function(a){return Promise.prototype.catch.call(this,a)},o.prototype.error=function(a){return this.then(function(){throw new Error(a)})},o.prototype.using=o.prototype.set,o.prototype.saveAs=o.prototype.save,o.prototype.export=o.prototype.output,o.prototype.run=o.prototype.then,ct.getPageSize=function(a,l,c){if(bi(a)==="object"){var h=a;a=h.orientation,l=h.unit||l,c=h.format||c}l=l||"mm",c=c||"a4",a=(""+(a||"P")).toLowerCase();var u,f=(""+c).toLowerCase(),d={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};switch(l){case"pt":u=1;break;case"mm":u=72/25.4;break;case"cm":u=72/2.54;break;case"in":u=72;break;case"px":u=.75;break;case"pc":case"em":u=12;break;case"ex":u=6;break;default:throw"Invalid unit: "+l}var g,m=0,_=0;if(d.hasOwnProperty(f))m=d[f][1]/u,_=d[f][0]/u;else try{m=c[1],_=c[0]}catch{throw new Error("Invalid format: "+c)}if(a==="p"||a==="portrait")a="p",_>m&&(g=_,_=m,m=g);else{if(a!=="l"&&a!=="landscape")throw"Invalid orientation: "+a;a="l",m>_&&(g=_,_=m,m=g)}return{width:_,height:m,unit:l,k:u,orientation:a}},i.html=function(a,l){(l=l||{}).callback=l.callback||function(){},l.html2canvas=l.html2canvas||{},l.html2canvas.canvas=l.html2canvas.canvas||this.canvas,l.jsPDF=l.jsPDF||this,l.fontFaces=l.fontFaces?l.fontFaces.map(ty):null;var c=new o(l);return l.worker?c:c.from(a).doCallback()}})(ct.API),ct.API.addJS=function(i){var e,t,n=(function(r){for(var s="",o=0;o<r.length;o++){var a=r[o];if(a==="("||a===")"){for(var l=0,c=o-1;c>=0&&r[c]==="\\";c--)l++;s+=l%2==0?"\\"+a:a}else s+=a}return s})(i);return this.internal.events.subscribe("postPutResources",function(){e=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/Names [(EmbeddedJS) "+(e+1)+" 0 R]"),this.internal.out(">>"),this.internal.out("endobj"),t=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /JavaScript"),this.internal.out("/JS ("+n+")"),this.internal.out(">>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){e!==void 0&&t!==void 0&&this.internal.out("/Names <</JavaScript "+e+" 0 R>>")}),this},(function(i){var e;i.events.push(["postPutResources",function(){var t=this,n=/^(\d+) 0 obj$/;if(this.outline.root.children.length>0)for(var r=t.outline.render().split(/\r\n/),s=0;s<r.length;s++){var o=r[s],a=n.exec(o);if(a!=null){var l=a[1];t.internal.newObjectDeferredBegin(l,!1)}t.internal.write(o)}if(this.outline.createNamedDestinations){var c=this.internal.pages.length,h=[];for(s=0;s<c;s++){var u=t.internal.newObject();h.push(u);var f=t.internal.getPageInfo(s+1);t.internal.write("<< /D["+f.objId+" 0 R /XYZ null null null]>> endobj")}var d=t.internal.newObject();for(t.internal.write("<< /Names [ "),s=0;s<h.length;s++)t.internal.write("(page_"+(s+1)+")"+h[s]+" 0 R");t.internal.write(" ] >>","endobj"),e=t.internal.newObject(),t.internal.write("<< /Dests "+d+" 0 R"),t.internal.write(">>","endobj")}}]),i.events.push(["putCatalog",function(){var t=this;t.outline.root.children.length>0&&(t.internal.write("/Outlines",this.outline.makeRef(this.outline.root)),this.outline.createNamedDestinations&&t.internal.write("/Names "+e+" 0 R"))}]),i.events.push(["initialized",function(){var t=this;t.outline={createNamedDestinations:!1,root:{children:[]}},t.outline.add=function(n,r,s){var o={title:r,options:s,children:[]};return n==null&&(n=this.root),n.children.push(o),o},t.outline.render=function(){return this.ctx={},this.ctx.val="",this.ctx.pdf=t,this.genIds_r(this.root),this.renderRoot(this.root),this.renderItems(this.root),this.ctx.val},t.outline.genIds_r=function(n){n.id=t.internal.newObjectDeferred();for(var r=0;r<n.children.length;r++)this.genIds_r(n.children[r])},t.outline.renderRoot=function(n){this.objStart(n),this.line("/Type /Outlines"),n.children.length>0&&(this.line("/First "+this.makeRef(n.children[0])),this.line("/Last "+this.makeRef(n.children[n.children.length-1]))),this.line("/Count "+this.count_r({count:0},n)),this.objEnd()},t.outline.renderItems=function(n){for(var r=this.ctx.pdf.internal.getVerticalCoordinateString,s=0;s<n.children.length;s++){var o=n.children[s];this.objStart(o),this.line("/Title "+this.makeString(o.title)),this.line("/Parent "+this.makeRef(n)),s>0&&this.line("/Prev "+this.makeRef(n.children[s-1])),s<n.children.length-1&&this.line("/Next "+this.makeRef(n.children[s+1])),o.children.length>0&&(this.line("/First "+this.makeRef(o.children[0])),this.line("/Last "+this.makeRef(o.children[o.children.length-1])));var a=this.count=this.count_r({count:0},o);if(a>0&&this.line("/Count "+a),o.options&&o.options.pageNumber){var l=t.internal.getPageInfo(o.options.pageNumber);this.line("/Dest ["+l.objId+" 0 R /XYZ 0 "+r(0)+" 0]")}this.objEnd()}for(var c=0;c<n.children.length;c++)this.renderItems(n.children[c])},t.outline.line=function(n){this.ctx.val+=n+`\r
770
- `},t.outline.makeRef=function(n){return n.id+" 0 R"},t.outline.makeString=function(n){return"("+t.internal.pdfEscape(n)+")"},t.outline.objStart=function(n){this.ctx.val+=`\r
771
- `+n.id+` 0 obj\r
772
- <<\r
773
- `},t.outline.objEnd=function(){this.ctx.val+=`>> \r
774
- endobj\r
775
- `},t.outline.count_r=function(n,r){for(var s=0;s<r.children.length;s++)n.count++,this.count_r(n,r.children[s]);return n.count}}])})(ct.API),(function(i){var e=[192,193,194,195,196,197,198,199];i.processJPEG=function(t,n,r,s,o,a){var l,c=this.decode.DCT_DECODE,h=null;if(typeof t=="string"||this.__addimage__.isArrayBuffer(t)||this.__addimage__.isArrayBufferView(t)){switch(t=o||t,t=this.__addimage__.isArrayBuffer(t)?new Uint8Array(t):t,l=(function(u){for(var f,d=256*u.charCodeAt(4)+u.charCodeAt(5),g=u.length,m={width:0,height:0,numcomponents:1},_=4;_<g;_+=2){if(_+=d,e.indexOf(u.charCodeAt(_+1))!==-1){f=256*u.charCodeAt(_+5)+u.charCodeAt(_+6),m={width:256*u.charCodeAt(_+7)+u.charCodeAt(_+8),height:f,numcomponents:u.charCodeAt(_+9)};break}d=256*u.charCodeAt(_+2)+u.charCodeAt(_+3)}return m})(t=this.__addimage__.isArrayBufferView(t)?this.__addimage__.arrayBufferToBinaryString(t):t),l.numcomponents){case 1:a=this.color_spaces.DEVICE_GRAY;break;case 4:a=this.color_spaces.DEVICE_CMYK;break;case 3:a=this.color_spaces.DEVICE_RGB}h={data:t,width:l.width,height:l.height,colorSpace:a,bitsPerComponent:8,filter:c,index:n,alias:r}}return h}})(ct.API),ct.API.processPNG=function(i,e,t,n){if(this.__addimage__.isArrayBuffer(i)&&(i=new Uint8Array(i)),this.__addimage__.isArrayBufferView(i)){var r,s=BV(i,{checkCrc:!0}),o=s.width,a=s.height,l=s.channels,c=s.palette,h=s.depth;r=c&&l===1?(function(R){for(var P=R.width,O=R.height,L=R.data,T=R.palette,C=R.depth,D=!1,W=[],$=[],B=void 0,V=!1,te=0,ne=0;ne<T.length;ne++){var ae=s2(T[ne],4),I=ae[0],U=ae[1],K=ae[2],ie=ae[3];W.push(I,U,K),ie!=null&&(ie===0?(te++,$.length<1&&$.push(ne)):ie<255&&(V=!0))}if(V||te>1){D=!0,$=void 0;var re=P*O;B=new Uint8Array(re);for(var ce=new DataView(L.buffer),ve=0;ve<re;ve++){var pe=ny(ce,ve,C),le=s2(T[pe],4)[3];B[ve]=le}}else te===0&&($=void 0);return{colorSpace:"Indexed",colorsPerPixel:1,sMaskBitsPerComponent:D?8:void 0,colorBytes:L,alphaBytes:B,needSMask:D,palette:W,mask:$}})(s):l===2||l===4?(function(R){for(var P=R.data,O=R.width,L=R.height,T=R.channels,C=R.depth,D=T===2?"DeviceGray":"DeviceRGB",W=T-1,$=O*L,B=W,V=$*B,te=1*$,ne=Math.ceil(V*C/8),ae=Math.ceil(te*C/8),I=new Uint8Array(ne),U=new Uint8Array(ae),K=new DataView(P.buffer),ie=new DataView(I.buffer),re=new DataView(U.buffer),ce=!1,ve=0;ve<$;ve++){for(var pe=ve*T,le=0;le<B;le++)lS(ie,ny(K,pe+le,C),ve*B+le,C);var Ce=ny(K,pe+B,C);Ce<(1<<C)-1&&(ce=!0),lS(re,Ce,1*ve,C)}return{colorSpace:D,colorsPerPixel:W,sMaskBitsPerComponent:ce?C:void 0,colorBytes:I,alphaBytes:U,needSMask:ce}})(s):(function(R){var P=R.data,O=R.channels===1?"DeviceGray":"DeviceRGB";return{colorSpace:O,colorsPerPixel:O==="DeviceGray"?1:3,colorBytes:P instanceof Uint16Array?(function(L){for(var T=L.length,C=new Uint8Array(2*T),D=new DataView(C.buffer,C.byteOffset,C.byteLength),W=0;W<T;W++)D.setUint16(2*W,L[W],!1);return C})(P):P,needSMask:!1}})(s);var u,f,d,g=r,m=g.colorSpace,_=g.colorsPerPixel,v=g.sMaskBitsPerComponent,x=g.colorBytes,S=g.alphaBytes,b=g.needSMask,A=g.palette,F=g.mask,N=null;return n!==ct.API.image_compression.NONE&&typeof lv=="function"?(N=(function(R){var P;switch(R){case ct.API.image_compression.FAST:P=11;break;case ct.API.image_compression.MEDIUM:P=13;break;case ct.API.image_compression.SLOW:P=14;break;default:P=12}return P})(n),u=this.decode.FLATE_DECODE,f="/Predictor ".concat(N," /Colors ").concat(_," /BitsPerComponent ").concat(h," /Columns ").concat(o),i=nS(x,Math.ceil(o*_*h/8),_,h,n),b&&(d=nS(S,Math.ceil(o*v/8),1,v,n))):(u=void 0,f=void 0,i=x,b&&(d=S)),(this.__addimage__.isArrayBuffer(i)||this.__addimage__.isArrayBufferView(i))&&(i=this.__addimage__.arrayBufferToBinaryString(i)),(d&&this.__addimage__.isArrayBuffer(d)||this.__addimage__.isArrayBufferView(d))&&(d=this.__addimage__.arrayBufferToBinaryString(d)),{alias:t,data:i,index:e,filter:u,decodeParameters:f,transparency:F,palette:A,sMask:d,predictor:N,width:o,height:a,bitsPerComponent:h,sMaskBitsPerComponent:v,colorSpace:m}}},(function(i){i.processGIF89A=function(e,t,n,r){var s=new o$(e),o=s.width,a=s.height,l=[];s.decodeAndBlitFrameRGBA(0,l);var c={data:l,width:o,height:a},h=new ry(100).encode(c,100);return i.processJPEG.call(this,h,t,n,r)},i.processGIF87A=i.processGIF89A})(ct.API),$s.prototype.parseHeader=function(){if(this.fileSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.reserved=this.datav.getUint32(this.pos,!0),this.pos+=4,this.offset=this.datav.getUint32(this.pos,!0),this.pos+=4,this.headerSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.width=this.datav.getUint32(this.pos,!0),this.pos+=4,this.height=this.datav.getInt32(this.pos,!0),this.pos+=4,this.planes=this.datav.getUint16(this.pos,!0),this.pos+=2,this.bitPP=this.datav.getUint16(this.pos,!0),this.pos+=2,this.compress=this.datav.getUint32(this.pos,!0),this.pos+=4,this.rawSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.hr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.vr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.colors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.importantColors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.bitPP===16&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var i=this.colors===0?1<<this.bitPP:this.colors;this.palette=new Array(i);for(var e=0;e<i;e++){var t=this.datav.getUint8(this.pos++,!0),n=this.datav.getUint8(this.pos++,!0),r=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0);this.palette[e]={red:r,green:n,blue:t,quad:s}}}this.height<0&&(this.height*=-1,this.bottom_up=!1)},$s.prototype.parseBGR=function(){this.pos=this.offset;var i="bit"+this.bitPP,e=this.width*this.height*4;if(e>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");this.data=new Uint8Array(e);try{this[i]()}catch(t){Mi.log("bit decode error:"+t)}},$s.prototype.bit1=function(){var i,e=Math.ceil(this.width/8),t=e%4;for(i=this.height-1;i>=0;i--){for(var n=this.bottom_up?i:this.height-1-i,r=0;r<e;r++)for(var s=this.datav.getUint8(this.pos++,!0),o=n*this.width*4+8*r*4,a=0;a<8&&8*r+a<this.width;a++){var l=this.palette[s>>7-a&1];this.data[o+4*a]=l.blue,this.data[o+4*a+1]=l.green,this.data[o+4*a+2]=l.red,this.data[o+4*a+3]=255}t!==0&&(this.pos+=4-t)}},$s.prototype.bit4=function(){for(var i=Math.ceil(this.width/2),e=i%4,t=this.height-1;t>=0;t--){for(var n=this.bottom_up?t:this.height-1-t,r=0;r<i;r++){var s=this.datav.getUint8(this.pos++,!0),o=n*this.width*4+2*r*4,a=s>>4,l=15&s,c=this.palette[a];if(this.data[o]=c.blue,this.data[o+1]=c.green,this.data[o+2]=c.red,this.data[o+3]=255,2*r+1>=this.width)break;c=this.palette[l],this.data[o+4]=c.blue,this.data[o+4+1]=c.green,this.data[o+4+2]=c.red,this.data[o+4+3]=255}e!==0&&(this.pos+=4-e)}},$s.prototype.bit8=function(){for(var i=this.width%4,e=this.height-1;e>=0;e--){for(var t=this.bottom_up?e:this.height-1-e,n=0;n<this.width;n++){var r=this.datav.getUint8(this.pos++,!0),s=t*this.width*4+4*n;if(r<this.palette.length){var o=this.palette[r];this.data[s]=o.red,this.data[s+1]=o.green,this.data[s+2]=o.blue,this.data[s+3]=255}else this.data[s]=255,this.data[s+1]=255,this.data[s+2]=255,this.data[s+3]=255}i!==0&&(this.pos+=4-i)}},$s.prototype.bit15=function(){for(var i=this.width%3,e=parseInt("11111",2),t=this.height-1;t>=0;t--){for(var n=this.bottom_up?t:this.height-1-t,r=0;r<this.width;r++){var s=this.datav.getUint16(this.pos,!0);this.pos+=2;var o=(s&e)/e*255|0,a=(s>>5&e)/e*255|0,l=(s>>10&e)/e*255|0,c=s>>15?255:0,h=n*this.width*4+4*r;this.data[h]=l,this.data[h+1]=a,this.data[h+2]=o,this.data[h+3]=c}this.pos+=i}},$s.prototype.bit16=function(){for(var i=this.width%3,e=parseInt("11111",2),t=parseInt("111111",2),n=this.height-1;n>=0;n--){for(var r=this.bottom_up?n:this.height-1-n,s=0;s<this.width;s++){var o=this.datav.getUint16(this.pos,!0);this.pos+=2;var a=(o&e)/e*255|0,l=(o>>5&t)/t*255|0,c=(o>>11)/e*255|0,h=r*this.width*4+4*s;this.data[h]=c,this.data[h+1]=l,this.data[h+2]=a,this.data[h+3]=255}this.pos+=i}},$s.prototype.bit24=function(){for(var i=this.height-1;i>=0;i--){for(var e=this.bottom_up?i:this.height-1-i,t=0;t<this.width;t++){var n=this.datav.getUint8(this.pos++,!0),r=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0),o=e*this.width*4+4*t;this.data[o]=s,this.data[o+1]=r,this.data[o+2]=n,this.data[o+3]=255}this.pos+=this.width%4}},$s.prototype.bit32=function(){for(var i=this.height-1;i>=0;i--)for(var e=this.bottom_up?i:this.height-1-i,t=0;t<this.width;t++){var n=this.datav.getUint8(this.pos++,!0),r=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0),o=this.datav.getUint8(this.pos++,!0),a=e*this.width*4+4*t;this.data[a]=s,this.data[a+1]=r,this.data[a+2]=n,this.data[a+3]=o}},$s.prototype.getData=function(){return this.data},(function(i){i.processBMP=function(e,t,n,r){var s=new $s(e,!1),o=s.width,a=s.height,l={data:s.getData(),width:o,height:a},c=new ry(100).encode(l,100);return i.processJPEG.call(this,c,t,n,r)}})(ct.API),hS.prototype.getData=function(){return this.data},(function(i){i.processWEBP=function(e,t,n,r){var s=new hS(e),o=s.width,a=s.height,l={data:s.getData(),width:o,height:a},c=new ry(100).encode(l,100);return i.processJPEG.call(this,c,t,n,r)}})(ct.API),ct.API.processRGBA=function(i,e,t){for(var n=i.data,r=n.length,s=new Uint8Array(r/4*3),o=new Uint8Array(r/4),a=0,l=0,c=0;c<r;c+=4){var h=n[c],u=n[c+1],f=n[c+2],d=n[c+3];s[a++]=h,s[a++]=u,s[a++]=f,o[l++]=d}var g=this.__addimage__.arrayBufferToBinaryString(s);return{alpha:this.__addimage__.arrayBufferToBinaryString(o),data:g,index:e,alias:t,colorSpace:"DeviceRGB",bitsPerComponent:8,width:i.width,height:i.height}},ct.API.setLanguage=function(i){return this.internal.languageSettings===void 0&&(this.internal.languageSettings={},this.internal.languageSettings.isSubscribed=!1),{af:"Afrikaans",sq:"Albanian",ar:"Arabic (Standard)","ar-DZ":"Arabic (Algeria)","ar-BH":"Arabic (Bahrain)","ar-EG":"Arabic (Egypt)","ar-IQ":"Arabic (Iraq)","ar-JO":"Arabic (Jordan)","ar-KW":"Arabic (Kuwait)","ar-LB":"Arabic (Lebanon)","ar-LY":"Arabic (Libya)","ar-MA":"Arabic (Morocco)","ar-OM":"Arabic (Oman)","ar-QA":"Arabic (Qatar)","ar-SA":"Arabic (Saudi Arabia)","ar-SY":"Arabic (Syria)","ar-TN":"Arabic (Tunisia)","ar-AE":"Arabic (U.A.E.)","ar-YE":"Arabic (Yemen)",an:"Aragonese",hy:"Armenian",as:"Assamese",ast:"Asturian",az:"Azerbaijani",eu:"Basque",be:"Belarusian",bn:"Bengali",bs:"Bosnian",br:"Breton",bg:"Bulgarian",my:"Burmese",ca:"Catalan",ch:"Chamorro",ce:"Chechen",zh:"Chinese","zh-HK":"Chinese (Hong Kong)","zh-CN":"Chinese (PRC)","zh-SG":"Chinese (Singapore)","zh-TW":"Chinese (Taiwan)",cv:"Chuvash",co:"Corsican",cr:"Cree",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch (Standard)","nl-BE":"Dutch (Belgian)",en:"English","en-AU":"English (Australia)","en-BZ":"English (Belize)","en-CA":"English (Canada)","en-IE":"English (Ireland)","en-JM":"English (Jamaica)","en-NZ":"English (New Zealand)","en-PH":"English (Philippines)","en-ZA":"English (South Africa)","en-TT":"English (Trinidad & Tobago)","en-GB":"English (United Kingdom)","en-US":"English (United States)","en-ZW":"English (Zimbabwe)",eo:"Esperanto",et:"Estonian",fo:"Faeroese",fj:"Fijian",fi:"Finnish",fr:"French (Standard)","fr-BE":"French (Belgium)","fr-CA":"French (Canada)","fr-FR":"French (France)","fr-LU":"French (Luxembourg)","fr-MC":"French (Monaco)","fr-CH":"French (Switzerland)",fy:"Frisian",fur:"Friulian",gd:"Gaelic (Scots)","gd-IE":"Gaelic (Irish)",gl:"Galacian",ka:"Georgian",de:"German (Standard)","de-AT":"German (Austria)","de-DE":"German (Germany)","de-LI":"German (Liechtenstein)","de-LU":"German (Luxembourg)","de-CH":"German (Switzerland)",el:"Greek",gu:"Gujurati",ht:"Haitian",he:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",iu:"Inuktitut",ga:"Irish",it:"Italian (Standard)","it-CH":"Italian (Switzerland)",ja:"Japanese",kn:"Kannada",ks:"Kashmiri",kk:"Kazakh",km:"Khmer",ky:"Kirghiz",tlh:"Klingon",ko:"Korean","ko-KP":"Korean (North Korea)","ko-KR":"Korean (South Korea)",la:"Latin",lv:"Latvian",lt:"Lithuanian",lb:"Luxembourgish",mk:"North Macedonia",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mo:"Moldavian",nv:"Navajo",ng:"Ndonga",ne:"Nepali",no:"Norwegian",nb:"Norwegian (Bokmal)",nn:"Norwegian (Nynorsk)",oc:"Occitan",or:"Oriya",om:"Oromo",fa:"Persian","fa-IR":"Persian/Iran",pl:"Polish",pt:"Portuguese","pt-BR":"Portuguese (Brazil)",pa:"Punjabi","pa-IN":"Punjabi (India)","pa-PK":"Punjabi (Pakistan)",qu:"Quechua",rm:"Rhaeto-Romanic",ro:"Romanian","ro-MO":"Romanian (Moldavia)",ru:"Russian","ru-MO":"Russian (Moldavia)",sz:"Sami (Lappish)",sg:"Sango",sa:"Sanskrit",sc:"Sardinian",sd:"Sindhi",si:"Singhalese",sr:"Serbian",sk:"Slovak",sl:"Slovenian",so:"Somani",sb:"Sorbian",es:"Spanish","es-AR":"Spanish (Argentina)","es-BO":"Spanish (Bolivia)","es-CL":"Spanish (Chile)","es-CO":"Spanish (Colombia)","es-CR":"Spanish (Costa Rica)","es-DO":"Spanish (Dominican Republic)","es-EC":"Spanish (Ecuador)","es-SV":"Spanish (El Salvador)","es-GT":"Spanish (Guatemala)","es-HN":"Spanish (Honduras)","es-MX":"Spanish (Mexico)","es-NI":"Spanish (Nicaragua)","es-PA":"Spanish (Panama)","es-PY":"Spanish (Paraguay)","es-PE":"Spanish (Peru)","es-PR":"Spanish (Puerto Rico)","es-ES":"Spanish (Spain)","es-UY":"Spanish (Uruguay)","es-VE":"Spanish (Venezuela)",sx:"Sutu",sw:"Swahili",sv:"Swedish","sv-FI":"Swedish (Finland)","sv-SV":"Swedish (Sweden)",ta:"Tamil",tt:"Tatar",te:"Teluga",th:"Thai",tig:"Tigre",ts:"Tsonga",tn:"Tswana",tr:"Turkish",tk:"Turkmen",uk:"Ukrainian",hsb:"Upper Sorbian",ur:"Urdu",ve:"Venda",vi:"Vietnamese",vo:"Volapuk",wa:"Walloon",cy:"Welsh",xh:"Xhosa",ji:"Yiddish",zu:"Zulu"}[i]!==void 0&&(this.internal.languageSettings.languageCode=i,this.internal.languageSettings.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){this.internal.write("/Lang ("+this.internal.languageSettings.languageCode+")")}),this.internal.languageSettings.isSubscribed=!0)),this},Ih=ct.API,Gp=Ih.getCharWidthsArray=function(i,e){var t,n,r=(e=e||{}).font||this.internal.getFont(),s=e.fontSize||this.internal.getFontSize(),o=e.charSpace||this.internal.getCharSpace(),a=e.widths?e.widths:r.metadata.Unicode.widths,l=a.fof?a.fof:1,c=e.kerning?e.kerning:r.metadata.Unicode.kerning,h=c.fof?c.fof:1,u=e.doKerning!==!1,f=0,d=i.length,g=0,m=a[0]||l,_=[];for(t=0;t<d;t++)n=i.charCodeAt(t),typeof r.metadata.widthOfString=="function"?_.push((r.metadata.widthOfGlyph(r.metadata.characterToGlyph(n))+o*(1e3/s)||0)/1e3):(f=u&&bi(c[n])==="object"&&!isNaN(parseInt(c[n][g],10))?c[n][g]/h:0,_.push((a[n]||m)/l+f)),g=n;return _},eS=Ih.getStringUnitWidth=function(i,e){var t=(e=e||{}).fontSize||this.internal.getFontSize(),n=e.font||this.internal.getFont(),r=e.charSpace||this.internal.getCharSpace();return Ih.processArabic&&(i=Ih.processArabic(i)),typeof n.metadata.widthOfString=="function"?n.metadata.widthOfString(i,t,r)/t:Gp.apply(this,arguments).reduce(function(s,o){return s+o},0)},tS=function(i,e,t,n){for(var r=[],s=0,o=i.length,a=0;s!==o&&a+e[s]<t;)a+=e[s],s++;r.push(i.slice(0,s));var l=s;for(a=0;s!==o;)a+e[s]>n&&(r.push(i.slice(l,s)),a=0,l=s),a+=e[s],s++;return l!==s&&r.push(i.slice(l,s)),r},iS=function(i,e,t){t||(t={});var n,r,s,o,a,l,c,h=[],u=[h],f=t.textIndent||0,d=0,g=0,m=i.split(" "),_=Gp.apply(this,[" ",t])[0];if(l=t.lineIndent===-1?m[0].length+2:t.lineIndent||0){var v=Array(l).join(" "),x=[];m.map(function(b){(b=b.split(/\s*\n/)).length>1?x=x.concat(b.map(function(A,F){return(F&&A.length?`
776
- `:"")+A})):x.push(b[0])}),m=x,l=eS.apply(this,[v,t])}for(s=0,o=m.length;s<o;s++){var S=0;if(n=m[s],l&&n[0]==`
777
- `&&(n=n.substr(1),S=1),f+d+(g=(r=Gp.apply(this,[n,t])).reduce(function(b,A){return b+A},0))>e||S){if(g>e){for(a=tS.apply(this,[n,r,e-(f+d),e]),h.push(a.shift()),h=[a.pop()];a.length;)u.push([a.shift()]);g=r.slice(n.length-(h[0]?h[0].length:0)).reduce(function(b,A){return b+A},0)}else h=[n];u.push(h),f=g+l,d=_}else h.push(n),f+=d+g,d=_}return c=l?function(b,A){return(A?v:"")+b.join(" ")}:function(b){return b.join(" ")},u.map(c)},Ih.splitTextToSize=function(i,e,t){var n,r=(t=t||{}).fontSize||this.internal.getFontSize(),s=(function(h){if(h.widths&&h.kerning)return{widths:h.widths,kerning:h.kerning};var u=this.internal.getFont(h.fontName,h.fontStyle),f="Unicode";return u.metadata[f]?{widths:u.metadata[f].widths||{0:1},kerning:u.metadata[f].kerning||{}}:{font:u.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}).call(this,t);n=Array.isArray(i)?i:String(i).split(/\r?\n/);var o=1*this.internal.scaleFactor*e/r;s.textIndent=t.textIndent?1*t.textIndent*this.internal.scaleFactor/r:0,s.lineIndent=t.lineIndent;var a,l,c=[];for(a=0,l=n.length;a<l;a++)c=c.concat(iS.apply(this,[n[a],o,s]));return c},(function(i){i.__fontmetrics__=i.__fontmetrics__||{};for(var e="0123456789abcdef",t="klmnopqrstuvwxyz",n={},r={},s=0;s<16;s++)n[t[s]]=e[s],r[e[s]]=t[s];var o=function(f){return"0x"+parseInt(f,10).toString(16)},a=i.__fontmetrics__.compress=function(f){var d,g,m,_,v=["{"];for(var x in f){if(d=f[x],isNaN(parseInt(x,10))?g="'"+x+"'":(x=parseInt(x,10),g=(g=o(x).slice(2)).slice(0,-1)+r[g.slice(-1)]),typeof d=="number")d<0?(m=o(d).slice(3),_="-"):(m=o(d).slice(2),_=""),m=_+m.slice(0,-1)+r[m.slice(-1)];else{if(bi(d)!=="object")throw new Error("Don't know what to do with value type "+bi(d)+".");m=a(d)}v.push(g+m)}return v.push("}"),v.join("")},l=i.__fontmetrics__.uncompress=function(f){if(typeof f!="string")throw new Error("Invalid argument passed to uncompress.");for(var d,g,m,_,v={},x=1,S=v,b=[],A="",F="",N=f.length-1,R=1;R<N;R+=1)(_=f[R])=="'"?d?(m=d.join(""),d=void 0):d=[]:d?d.push(_):_=="{"?(b.push([S,m]),S={},m=void 0):_=="}"?((g=b.pop())[0][g[1]]=S,m=void 0,S=g[0]):_=="-"?x=-1:m===void 0?n.hasOwnProperty(_)?(A+=n[_],m=parseInt(A,16)*x,x=1,A=""):A+=_:n.hasOwnProperty(_)?(F+=n[_],S[m]=parseInt(F,16)*x,x=1,m=void 0,F=""):F+=_;return v},c={codePages:["WinAnsiEncoding"],WinAnsiEncoding:l("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")},h={Unicode:{Courier:c,"Courier-Bold":c,"Courier-BoldOblique":c,"Courier-Oblique":c,Helvetica:c,"Helvetica-Bold":c,"Helvetica-BoldOblique":c,"Helvetica-Oblique":c,"Times-Roman":c,"Times-Bold":c,"Times-BoldItalic":c,"Times-Italic":c}},u={Unicode:{"Courier-Oblique":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-BoldItalic":l("{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}"),"Helvetica-Bold":l("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),Courier:l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-BoldOblique":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Bold":l("{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}"),Symbol:l("{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}"),Helvetica:l("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}"),"Helvetica-BoldOblique":l("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),ZapfDingbats:l("{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-Bold":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Italic":l("{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}"),"Times-Roman":l("{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}"),"Helvetica-Oblique":l("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")}};i.events.push(["addFont",function(f){var d=f.font,g=u.Unicode[d.postScriptName];g&&(d.metadata.Unicode={},d.metadata.Unicode.widths=g.widths,d.metadata.Unicode.kerning=g.kerning);var m=h.Unicode[d.postScriptName];m&&(d.metadata.Unicode.encoding=m,d.encoding=m.codePages[0])}])})(ct.API),(function(i){var e=function(t){for(var n=t.length,r=new Uint8Array(n),s=0;s<n;s++)r[s]=t.charCodeAt(s);return r};i.API.events.push(["addFont",function(t){var n=void 0,r=t.font,s=t.instance;if(!r.isStandardFont){if(s===void 0)throw new Error("Font does not exist in vFS, import fonts or remove declaration doc.addFont('"+r.postScriptName+"').");if(typeof(n=s.existsFileInVFS(r.postScriptName)===!1?s.loadFile(r.postScriptName):s.getFileFromVFS(r.postScriptName))!="string")throw new Error("Font is not stored as string-data in vFS, import fonts or remove declaration doc.addFont('"+r.postScriptName+"').");(function(o,a){a=/^\x00\x01\x00\x00/.test(a)?e(a):e(e0(a)),o.metadata=i.API.TTFFont.open(a),o.metadata.Unicode=o.metadata.Unicode||{encoding:{},kerning:{},widths:[]},o.metadata.glyIdsUsed=[0]})(r,n)}}])})(ct),ct.API.addSvgAsImage=function(i,e,t,n,r,s,o,a){if(isNaN(e)||isNaN(t))throw Mi.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(n)||isNaN(r))throw Mi.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var l=document.createElement("canvas");l.width=n,l.height=r;var c=l.getContext("2d");c.fillStyle="#fff",c.fillRect(0,0,l.width,l.height);var h={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},u=this;return(Et.canvg?Promise.resolve(Et.canvg):Ys(()=>import("./index.es-Di2I6Ukg-BWbYOQQ8.js"),[])).catch(function(f){return Promise.reject(new Error("Could not load canvg: "+f))}).then(function(f){return f.default?f.default:f}).then(function(f){return f.fromString(c,i,h)},function(){return Promise.reject(new Error("Could not load canvg."))}).then(function(f){return f.render(h)}).then(function(){u.addImage(l.toDataURL("image/jpeg",1),e,t,n,r,o,a)})},ct.API.putTotalPages=function(i){var e,t=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(e=new RegExp(i,"g"),t=this.internal.getNumberOfPages()):(e=new RegExp(this.pdfEscape16(i,this.internal.getFont()),"g"),t=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var n=1;n<=this.internal.getNumberOfPages();n++)for(var r=0;r<this.internal.pages[n].length;r++)this.internal.pages[n][r]=this.internal.pages[n][r].replace(e,t);return this},ct.API.viewerPreferences=function(i,e){var t;i=i||{},e=e||!1;var n,r,s,o={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},a=Object.keys(o),l=[],c=0,h=0,u=0;function f(g,m){var _,v=!1;for(_=0;_<g.length;_+=1)g[_]===m&&(v=!0);return v}if(this.internal.viewerpreferences===void 0&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(o)),this.internal.viewerpreferences.isSubscribed=!1),t=this.internal.viewerpreferences.configuration,i==="reset"||e===!0){var d=a.length;for(u=0;u<d;u+=1)t[a[u]].value=t[a[u]].defaultValue,t[a[u]].explicitSet=!1}if(bi(i)==="object"){for(r in i)if(s=i[r],f(a,r)&&s!==void 0){if(t[r].type==="boolean"&&typeof s=="boolean")t[r].value=s;else if(t[r].type==="name"&&f(t[r].valueSet,s))t[r].value=s;else if(t[r].type==="integer"&&Number.isInteger(s))t[r].value=s;else if(t[r].type==="array"){for(c=0;c<s.length;c+=1)if(n=!0,s[c].length===1&&typeof s[c][0]=="number")l.push(String(s[c]-1));else if(s[c].length>1){for(h=0;h<s[c].length;h+=1)typeof s[c][h]!="number"&&(n=!1);n===!0&&l.push([s[c][0]-1,s[c][1]-1].join(" "))}t[r].value="["+l.join(" ")+"]"}else t[r].value=t[r].defaultValue;t[r].explicitSet=!0}}return this.internal.viewerpreferences.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){var g,m=[];for(g in t)t[g].explicitSet===!0&&(t[g].type==="name"?m.push("/"+g+" /"+t[g].value):m.push("/"+g+" "+t[g].value));m.length!==0&&this.internal.write(`/ViewerPreferences
778
- <<
779
- `+m.join(`
780
- `)+`
781
- >>`)}),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=t,this},ct.API.addMetadata=function(i,e){return this.internal.__metadata__===void 0&&(this.internal.__metadata__={metadata:i,namespaceUri:e??"http://jspdf.default.namespaceuri/",rawXml:typeof e=="boolean"&&e},this.internal.events.subscribe("putCatalog",l$),this.internal.events.subscribe("postPutResources",a$)),this},(function(i){var e=i.API,t=e.pdfEscape16=function(s,o){for(var a,l=o.metadata.Unicode.widths,c=["","0","00","000","0000"],h=[""],u=0,f=s.length;u<f;++u){if(a=o.metadata.characterToGlyph(s.charCodeAt(u)),o.metadata.glyIdsUsed.push(a),o.metadata.toUnicode[a]=s.charCodeAt(u),l.indexOf(a)==-1&&(l.push(a),l.push([parseInt(o.metadata.widthOfGlyph(a),10)])),a=="0")return h.join("");a=a.toString(16),h.push(c[4-a.length],a)}return h.join("")},n=function(s){var o,a,l,c,h,u,f;for(h=`/CIDInit /ProcSet findresource begin
782
- 12 dict begin
783
- begincmap
784
- /CIDSystemInfo <<
785
- /Registry (Adobe)
786
- /Ordering (UCS)
787
- /Supplement 0
788
- >> def
789
- /CMapName /Adobe-Identity-UCS def
790
- /CMapType 2 def
791
- 1 begincodespacerange
792
- <0000><ffff>
793
- endcodespacerange`,l=[],u=0,f=(a=Object.keys(s).sort(function(d,g){return d-g})).length;u<f;u++)o=a[u],l.length>=100&&(h+=`
794
- `+l.length+` beginbfchar
795
- `+l.join(`
796
- `)+`
797
- endbfchar`,l=[]),s[o]!==void 0&&s[o]!==null&&typeof s[o].toString=="function"&&(c=("0000"+s[o].toString(16)).slice(-4),o=("0000"+(+o).toString(16)).slice(-4),l.push("<"+o+"><"+c+">"));return l.length&&(h+=`
798
- `+l.length+` beginbfchar
799
- `+l.join(`
800
- `)+`
801
- endbfchar
802
- `),h+`endcmap
803
- CMapName currentdict /CMap defineresource pop
804
- end
805
- end`};e.events.push(["putFont",function(s){(function(o){var a=o.font,l=o.out,c=o.newObject,h=o.putStream;if(a.metadata instanceof i.API.TTFFont&&a.encoding==="Identity-H"){for(var u=a.metadata.Unicode.widths,f=a.metadata.subset.encode(a.metadata.glyIdsUsed,1),d="",g=0;g<f.length;g++)d+=String.fromCharCode(f[g]);var m=c();h({data:d,addLength1:!0,objectId:m}),l("endobj");var _=c();h({data:n(a.metadata.toUnicode),addLength1:!0,objectId:_}),l("endobj");var v=c();l("<<"),l("/Type /FontDescriptor"),l("/FontName /"+zh(a.fontName)),l("/FontFile2 "+m+" 0 R"),l("/FontBBox "+i.API.PDFObject.convert(a.metadata.bbox)),l("/Flags "+a.metadata.flags),l("/StemV "+a.metadata.stemV),l("/ItalicAngle "+a.metadata.italicAngle),l("/Ascent "+a.metadata.ascender),l("/Descent "+a.metadata.decender),l("/CapHeight "+a.metadata.capHeight),l(">>"),l("endobj");var x=c();l("<<"),l("/Type /Font"),l("/BaseFont /"+zh(a.fontName)),l("/FontDescriptor "+v+" 0 R"),l("/W "+i.API.PDFObject.convert(u)),l("/CIDToGIDMap /Identity"),l("/DW 1000"),l("/Subtype /CIDFontType2"),l("/CIDSystemInfo"),l("<<"),l("/Supplement 0"),l("/Registry (Adobe)"),l("/Ordering ("+a.encoding+")"),l(">>"),l(">>"),l("endobj"),a.objectNumber=c(),l("<<"),l("/Type /Font"),l("/Subtype /Type0"),l("/ToUnicode "+_+" 0 R"),l("/BaseFont /"+zh(a.fontName)),l("/Encoding /"+a.encoding),l("/DescendantFonts ["+x+" 0 R]"),l(">>"),l("endobj"),a.isAlreadyPutted=!0}})(s)}]),e.events.push(["putFont",function(s){(function(o){var a=o.font,l=o.out,c=o.newObject,h=o.putStream;if(a.metadata instanceof i.API.TTFFont&&a.encoding==="WinAnsiEncoding"){for(var u=a.metadata.rawData,f="",d=0;d<u.length;d++)f+=String.fromCharCode(u[d]);var g=c();h({data:f,addLength1:!0,objectId:g}),l("endobj");var m=c();h({data:n(a.metadata.toUnicode),addLength1:!0,objectId:m}),l("endobj");var _=c();l("<<"),l("/Descent "+a.metadata.decender),l("/CapHeight "+a.metadata.capHeight),l("/StemV "+a.metadata.stemV),l("/Type /FontDescriptor"),l("/FontFile2 "+g+" 0 R"),l("/Flags 96"),l("/FontBBox "+i.API.PDFObject.convert(a.metadata.bbox)),l("/FontName /"+zh(a.fontName)),l("/ItalicAngle "+a.metadata.italicAngle),l("/Ascent "+a.metadata.ascender),l(">>"),l("endobj"),a.objectNumber=c();for(var v=0;v<a.metadata.hmtx.widths.length;v++)a.metadata.hmtx.widths[v]=parseInt(a.metadata.hmtx.widths[v]*(1e3/a.metadata.head.unitsPerEm));l("<</Subtype/TrueType/Type/Font/ToUnicode "+m+" 0 R/BaseFont/"+zh(a.fontName)+"/FontDescriptor "+_+" 0 R/Encoding/"+a.encoding+" /FirstChar 29 /LastChar 255 /Widths "+i.API.PDFObject.convert(a.metadata.hmtx.widths)+">>"),l("endobj"),a.isAlreadyPutted=!0}})(s)}]);var r=function(s){var o,a=s.text||"",l=s.x,c=s.y,h=s.options||{},u=s.mutex||{},f=u.pdfEscape,d=u.activeFontKey,g=u.fonts,m=d,_="",v=0,x="",S=g[m].encoding;if(g[m].encoding!=="Identity-H")return{text:a,x:l,y:c,options:h,mutex:u};for(x=a,m=d,Array.isArray(a)&&(x=a[0]),v=0;v<x.length;v+=1)g[m].metadata.hasOwnProperty("cmap")&&(o=g[m].metadata.cmap.unicode.codeMap[x[v].charCodeAt(0)]),o||x[v].charCodeAt(0)<256&&g[m].metadata.hasOwnProperty("Unicode")?_+=x[v]:_+="";var b="";return parseInt(m.slice(1))<14||S==="WinAnsiEncoding"?b=f(_,m).split("").map(function(A){return A.charCodeAt(0).toString(16)}).join(""):S==="Identity-H"&&(b=t(_,g[m])),u.isHex=!0,{text:b,x:l,y:c,options:h,mutex:u}};e.events.push(["postProcessText",function(s){var o=s.text||"",a=[],l={text:o,x:s.x,y:s.y,options:s.options,mutex:s.mutex};if(Array.isArray(o)){var c=0;for(c=0;c<o.length;c+=1)Array.isArray(o[c])&&o[c].length===3?a.push([r(Object.assign({},l,{text:o[c][0]})).text,o[c][1],o[c][2]]):a.push(r(Object.assign({},l,{text:o[c]})).text);s.text=a}else s.text=r(Object.assign({},l,{text:o})).text}])})(ct),(function(i){var e=function(){return this.internal.vFS===void 0&&(this.internal.vFS={}),!0};i.existsFileInVFS=function(t){return e.call(this),this.internal.vFS[t]!==void 0},i.addFileToVFS=function(t,n){return e.call(this),this.internal.vFS[t]=n,this},i.getFileFromVFS=function(t){return e.call(this),this.internal.vFS[t]!==void 0?this.internal.vFS[t]:null}})(ct.API),(function(i){i.__bidiEngine__=i.prototype.__bidiEngine__=function(n){var r,s,o,a,l,c,h,u=e,f=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],d=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],g={L:0,R:1,EN:2,AN:3,N:4,B:5,S:6},m={0:0,5:1,6:2,7:3,32:4,251:5,254:6,255:7},_=["(",")","(","<",">","<","[","]","[","{","}","{","«","»","«","‹","›","‹","⁅","⁆","⁅","⁽","⁾","⁽","₍","₎","₍","≤","≥","≤","〈","〉","〈","﹙","﹚","﹙","﹛","﹜","﹛","﹝","﹞","﹝","﹤","﹥","﹤"],v=new RegExp(/^([1-4|9]|1[0-9]|2[0-9]|3[0168]|4[04589]|5[012]|7[78]|159|16[0-9]|17[0-2]|21[569]|22[03489]|250)$/),x=!1,S=0;this.__bidiEngine__={};var b=function(L){var T=L.charCodeAt(),C=T>>8,D=m[C];return D!==void 0?u[256*D+(255&T)]:C===252||C===253?"AL":v.test(C)?"L":C===8?"R":"N"},A=function(L){for(var T,C=0;C<L.length;C++){if((T=b(L.charAt(C)))==="L")return!1;if(T==="R")return!0}return!1},F=function(L,T,C,D){var W,$,B,V,te=T[D];switch(te){case"L":case"R":case"LRE":case"RLE":case"LRO":case"RLO":case"PDF":x=!1;break;case"N":case"AN":break;case"EN":x&&(te="AN");break;case"AL":x=!0,te="R";break;case"WS":case"BN":te="N";break;case"CS":D<1||D+1>=T.length||(W=C[D-1])!=="EN"&&W!=="AN"||($=T[D+1])!=="EN"&&$!=="AN"?te="N":x&&($="AN"),te=$===W?$:"N";break;case"ES":te=(W=D>0?C[D-1]:"B")==="EN"&&D+1<T.length&&T[D+1]==="EN"?"EN":"N";break;case"ET":if(D>0&&C[D-1]==="EN"){te="EN";break}if(x){te="N";break}for(B=D+1,V=T.length;B<V&&T[B]==="ET";)B++;te=B<V&&T[B]==="EN"?"EN":"N";break;case"NSM":if(o&&!a){for(V=T.length,B=D+1;B<V&&T[B]==="NSM";)B++;if(B<V){var ne=L[D],ae=ne>=1425&&ne<=2303||ne===64286;if(W=T[B],ae&&(W==="R"||W==="AL")){te="R";break}}}te=D<1||(W=T[D-1])==="B"?"N":C[D-1];break;case"B":x=!1,r=!0,te=S;break;case"S":s=!0,te="N"}return te},N=function(L,T,C){var D=L.split("");return C&&R(D,C,{hiLevel:S}),D.reverse(),T&&T.reverse(),D.join("")},R=function(L,T,C){var D,W,$,B,V,te=-1,ne=L.length,ae=0,I=[],U=S?d:f,K=[];for(x=!1,r=!1,s=!1,W=0;W<ne;W++)K[W]=b(L[W]);for($=0;$<ne;$++){if(V=ae,I[$]=F(L,K,I,$),D=240&(ae=U[V][g[I[$]]]),ae&=15,T[$]=B=U[ae][5],D>0)if(D===16){for(W=te;W<$;W++)T[W]=1;te=-1}else te=-1;if(U[ae][6])te===-1&&(te=$);else if(te>-1){for(W=te;W<$;W++)T[W]=B;te=-1}K[$]==="B"&&(T[$]=0),C.hiLevel|=B}s&&(function(ie,re,ce){for(var ve=0;ve<ce;ve++)if(ie[ve]==="S"){re[ve]=S;for(var pe=ve-1;pe>=0&&ie[pe]==="WS";pe--)re[pe]=S}})(K,T,ne)},P=function(L,T,C,D,W){if(!(W.hiLevel<L)){if(L===1&&S===1&&!r)return T.reverse(),void(C&&C.reverse());for(var $,B,V,te,ne=T.length,ae=0;ae<ne;){if(D[ae]>=L){for(V=ae+1;V<ne&&D[V]>=L;)V++;for(te=ae,B=V-1;te<B;te++,B--)$=T[te],T[te]=T[B],T[B]=$,C&&($=C[te],C[te]=C[B],C[B]=$);ae=V}ae++}}},O=function(L,T,C){var D=L.split(""),W={hiLevel:S};return C||(C=[]),R(D,C,W),(function($,B,V){if(V.hiLevel!==0&&h)for(var te,ne=0;ne<$.length;ne++)B[ne]===1&&(te=_.indexOf($[ne]))>=0&&($[ne]=_[te+1])})(D,C,W),P(2,D,T,C,W),P(1,D,T,C,W),D.join("")};return this.__bidiEngine__.doBidiReorder=function(L,T,C){if((function(W,$){if($)for(var B=0;B<W.length;B++)$[B]=B;a===void 0&&(a=A(W)),c===void 0&&(c=A(W))})(L,T),o||!l||c)if(o&&l&&a^c)S=a?1:0,L=N(L,T,C);else if(!o&&l&&c)S=a?1:0,L=O(L,T,C),L=N(L,T);else if(!o||a||l||c){if(o&&!l&&a^c)L=N(L,T),a?(S=0,L=O(L,T,C)):(S=1,L=O(L,T,C),L=N(L,T));else if(o&&a&&!l&&c)S=1,L=O(L,T,C),L=N(L,T);else if(!o&&!l&&a^c){var D=h;a?(S=1,L=O(L,T,C),S=0,h=!1,L=O(L,T,C),h=D):(S=0,L=O(L,T,C),L=N(L,T),S=1,h=!1,L=O(L,T,C),h=D,L=N(L,T))}}else S=0,L=O(L,T,C);else S=a?1:0,L=O(L,T,C);return L},this.__bidiEngine__.setOptions=function(L){L&&(o=L.isInputVisual,l=L.isOutputVisual,a=L.isInputRtl,c=L.isOutputRtl,h=L.isSymmetricSwapping)},this.__bidiEngine__.setOptions(n),this.__bidiEngine__};var e=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","N","ET","ET","ET","ET","N","N","N","N","L","N","N","BN","N","N","ET","ET","EN","EN","N","L","N","N","N","EN","L","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","N","N","N","N","N","ET","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","NSM","R","NSM","NSM","R","NSM","NSM","R","NSM","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","N","N","N","N","N","R","R","R","R","R","N","N","N","N","N","N","N","N","N","N","N","AN","AN","AN","AN","AN","AN","N","N","AL","ET","ET","AL","CS","AL","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","N","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","NSM","NSM","N","NSM","NSM","NSM","NSM","AL","AL","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","R","N","N","N","N","R","N","N","N","N","N","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","BN","BN","BN","L","R","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","B","LRE","RLE","PDF","LRO","RLO","CS","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","BN","BN","BN","BN","BN","N","LRI","RLI","FSI","PDI","BN","BN","BN","BN","BN","BN","EN","L","N","N","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","L","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","N","N","N","N","N","R","NSM","R","R","R","R","R","R","R","R","R","R","ES","R","R","R","R","R","R","R","R","R","R","R","R","R","N","R","R","R","R","R","N","R","N","R","R","N","R","R","N","R","R","R","R","R","R","R","R","R","R","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","CS","N","N","CS","N","N","N","N","N","N","N","N","N","ET","N","N","ES","ES","N","N","N","N","N","ET","ET","N","N","N","N","N","AL","AL","AL","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","BN","N","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","N","N","N","ET","ET","N","N","N","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N"],t=new i.__bidiEngine__({isInputVisual:!0});i.API.events.push(["postProcessText",function(n){var r=n.text;n.x,n.y;var s=n.options||{};n.mutex,s.lang;var o=[];if(s.isInputVisual=typeof s.isInputVisual!="boolean"||s.isInputVisual,t.setOptions(s),Object.prototype.toString.call(r)==="[object Array]"){var a=0;for(o=[],a=0;a<r.length;a+=1)Object.prototype.toString.call(r[a])==="[object Array]"?o.push([t.doBidiReorder(r[a][0]),r[a][1],r[a][2]]):o.push([t.doBidiReorder(r[a])]);n.text=o}else n.text=t.doBidiReorder(r);t.setOptions({isInputVisual:!0})}])})(ct),ct.API.TTFFont=(function(){function i(e){var t;if(this.rawData=e,t=this.contents=new Bl(e),this.contents.pos=4,t.readString(4)==="ttcf")throw new Error("TTCF not supported.");t.pos=0,this.parse(),this.subset=new E$(this),this.registerTTF()}return i.open=function(e){return new i(e)},i.prototype.parse=function(){return this.directory=new c$(this.contents),this.head=new u$(this),this.name=new m$(this),this.cmap=new rM(this),this.toUnicode={},this.hhea=new f$(this),this.maxp=new _$(this),this.hmtx=new y$(this),this.post=new g$(this),this.os2=new d$(this),this.loca=new b$(this),this.glyf=new v$(this),this.ascender=this.os2.exists&&this.os2.ascender||this.hhea.ascender,this.decender=this.os2.exists&&this.os2.decender||this.hhea.decender,this.lineGap=this.os2.exists&&this.os2.lineGap||this.hhea.lineGap,this.bbox=[this.head.xMin,this.head.yMin,this.head.xMax,this.head.yMax]},i.prototype.registerTTF=function(){var e,t,n,r,s;if(this.scaleFactor=1e3/this.head.unitsPerEm,this.bbox=(function(){var o,a,l,c;for(c=[],o=0,a=(l=this.bbox).length;o<a;o++)e=l[o],c.push(Math.round(e*this.scaleFactor));return c}).call(this),this.stemV=0,this.post.exists?(n=255&(r=this.post.italic_angle),32768&(t=r>>16)&&(t=-(1+(65535^t))),this.italicAngle=+(t+"."+n)):this.italicAngle=0,this.ascender=Math.round(this.ascender*this.scaleFactor),this.decender=Math.round(this.decender*this.scaleFactor),this.lineGap=Math.round(this.lineGap*this.scaleFactor),this.capHeight=this.os2.exists&&this.os2.capHeight||this.ascender,this.xHeight=this.os2.exists&&this.os2.xHeight||0,this.familyClass=(this.os2.exists&&this.os2.familyClass||0)>>8,this.isSerif=(s=this.familyClass)===1||s===2||s===3||s===4||s===5||s===7,this.isScript=this.familyClass===10,this.flags=0,this.post.isFixedPitch&&(this.flags|=1),this.isSerif&&(this.flags|=2),this.isScript&&(this.flags|=8),this.italicAngle!==0&&(this.flags|=64),this.flags|=32,!this.cmap.unicode)throw new Error("No unicode cmap for font")},i.prototype.characterToGlyph=function(e){var t;return((t=this.cmap.unicode)!=null?t.codeMap[e]:void 0)||0},i.prototype.widthOfGlyph=function(e){var t;return t=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(e).advance*t},i.prototype.widthOfString=function(e,t,n){var r,s,o,a;for(o=0,s=0,a=(e=""+e).length;0<=a?s<a:s>a;s=0<=a?++s:--s)r=e.charCodeAt(s),o+=this.widthOfGlyph(this.characterToGlyph(r))+n*(1e3/t)||0;return o*(t/1e3)},i.prototype.lineHeight=function(e,t){var n;return t==null&&(t=!1),n=t?this.lineGap:0,(this.ascender+n-this.decender)/1e3*e},i})();var fo,Bl=(function(){function i(e){this.data=e??[],this.pos=0,this.length=this.data.length}return i.prototype.readByte=function(){return this.data[this.pos++]},i.prototype.writeByte=function(e){return this.data[this.pos++]=e},i.prototype.readUInt32=function(){return 16777216*this.readByte()+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()},i.prototype.writeUInt32=function(e){return this.writeByte(e>>>24&255),this.writeByte(e>>16&255),this.writeByte(e>>8&255),this.writeByte(255&e)},i.prototype.readInt32=function(){var e;return(e=this.readUInt32())>=2147483648?e-4294967296:e},i.prototype.writeInt32=function(e){return e<0&&(e+=4294967296),this.writeUInt32(e)},i.prototype.readUInt16=function(){return this.readByte()<<8|this.readByte()},i.prototype.writeUInt16=function(e){return this.writeByte(e>>8&255),this.writeByte(255&e)},i.prototype.readInt16=function(){var e;return(e=this.readUInt16())>=32768?e-65536:e},i.prototype.writeInt16=function(e){return e<0&&(e+=65536),this.writeUInt16(e)},i.prototype.readString=function(e){var t,n;for(n=[],t=0;0<=e?t<e:t>e;t=0<=e?++t:--t)n[t]=String.fromCharCode(this.readByte());return n.join("")},i.prototype.writeString=function(e){var t,n,r;for(r=[],t=0,n=e.length;0<=n?t<n:t>n;t=0<=n?++t:--t)r.push(this.writeByte(e.charCodeAt(t)));return r},i.prototype.readShort=function(){return this.readInt16()},i.prototype.writeShort=function(e){return this.writeInt16(e)},i.prototype.readLongLong=function(){var e,t,n,r,s,o,a,l;return e=this.readByte(),t=this.readByte(),n=this.readByte(),r=this.readByte(),s=this.readByte(),o=this.readByte(),a=this.readByte(),l=this.readByte(),128&e?-1*(72057594037927940*(255^e)+281474976710656*(255^t)+1099511627776*(255^n)+4294967296*(255^r)+16777216*(255^s)+65536*(255^o)+256*(255^a)+(255^l)+1):72057594037927940*e+281474976710656*t+1099511627776*n+4294967296*r+16777216*s+65536*o+256*a+l},i.prototype.writeLongLong=function(e){var t,n;return t=Math.floor(e/4294967296),n=4294967295&e,this.writeByte(t>>24&255),this.writeByte(t>>16&255),this.writeByte(t>>8&255),this.writeByte(255&t),this.writeByte(n>>24&255),this.writeByte(n>>16&255),this.writeByte(n>>8&255),this.writeByte(255&n)},i.prototype.readInt=function(){return this.readInt32()},i.prototype.writeInt=function(e){return this.writeInt32(e)},i.prototype.read=function(e){var t,n;for(t=[],n=0;0<=e?n<e:n>e;n=0<=e?++n:--n)t.push(this.readByte());return t},i.prototype.write=function(e){var t,n,r,s;for(s=[],n=0,r=e.length;n<r;n++)t=e[n],s.push(this.writeByte(t));return s},i})(),c$=(function(){var i;function e(t){var n,r,s;for(this.scalarType=t.readInt(),this.tableCount=t.readShort(),this.searchRange=t.readShort(),this.entrySelector=t.readShort(),this.rangeShift=t.readShort(),this.tables={},r=0,s=this.tableCount;0<=s?r<s:r>s;r=0<=s?++r:--r)n={tag:t.readString(4),checksum:t.readInt(),offset:t.readInt(),length:t.readInt()},this.tables[n.tag]=n}return e.prototype.encode=function(t){var n,r,s,o,a,l,c,h,u,f,d,g,m;for(m in d=Object.keys(t).length,l=Math.log(2),u=16*Math.floor(Math.log(d)/l),o=Math.floor(u/l),h=16*d-u,(r=new Bl).writeInt(this.scalarType),r.writeShort(d),r.writeShort(u),r.writeShort(o),r.writeShort(h),s=16*d,c=r.pos+s,a=null,g=[],t)for(f=t[m],r.writeString(m),r.writeInt(i(f)),r.writeInt(c),r.writeInt(f.length),g=g.concat(f),m==="head"&&(a=c),c+=f.length;c%4;)g.push(0),c++;return r.write(g),n=2981146554-i(r.data),r.pos=a+8,r.writeUInt32(n),r.data},i=function(t){var n,r,s,o;for(t=sM.call(t);t.length%4;)t.push(0);for(s=new Bl(t),r=0,n=0,o=t.length;n<o;n=n+=4)r+=s.readUInt32();return 4294967295&r},e})(),h$={}.hasOwnProperty,Jo=function(i,e){for(var t in e)h$.call(e,t)&&(i[t]=e[t]);function n(){this.constructor=i}return n.prototype=e.prototype,i.prototype=new n,i.__super__=e.prototype,i};fo=(function(){function i(e){var t;this.file=e,t=this.file.directory.tables[this.tag],this.exists=!!t,t&&(this.offset=t.offset,this.length=t.length,this.parse(this.file.contents))}return i.prototype.parse=function(){},i.prototype.encode=function(){},i.prototype.raw=function(){return this.exists?(this.file.contents.pos=this.offset,this.file.contents.read(this.length)):null},i})();var u$=(function(){function i(){return i.__super__.constructor.apply(this,arguments)}return Jo(i,fo),i.prototype.tag="head",i.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.revision=e.readInt(),this.checkSumAdjustment=e.readInt(),this.magicNumber=e.readInt(),this.flags=e.readShort(),this.unitsPerEm=e.readShort(),this.created=e.readLongLong(),this.modified=e.readLongLong(),this.xMin=e.readShort(),this.yMin=e.readShort(),this.xMax=e.readShort(),this.yMax=e.readShort(),this.macStyle=e.readShort(),this.lowestRecPPEM=e.readShort(),this.fontDirectionHint=e.readShort(),this.indexToLocFormat=e.readShort(),this.glyphDataFormat=e.readShort()},i.prototype.encode=function(e){var t;return(t=new Bl).writeInt(this.version),t.writeInt(this.revision),t.writeInt(this.checkSumAdjustment),t.writeInt(this.magicNumber),t.writeShort(this.flags),t.writeShort(this.unitsPerEm),t.writeLongLong(this.created),t.writeLongLong(this.modified),t.writeShort(this.xMin),t.writeShort(this.yMin),t.writeShort(this.xMax),t.writeShort(this.yMax),t.writeShort(this.macStyle),t.writeShort(this.lowestRecPPEM),t.writeShort(this.fontDirectionHint),t.writeShort(e),t.writeShort(this.glyphDataFormat),t.data},i})(),uS=(function(){function i(e,t){var n,r,s,o,a,l,c,h,u,f,d,g,m,_,v,x,S;switch(this.platformID=e.readUInt16(),this.encodingID=e.readShort(),this.offset=t+e.readInt(),u=e.pos,e.pos=this.offset,this.format=e.readUInt16(),this.length=e.readUInt16(),this.language=e.readUInt16(),this.isUnicode=this.platformID===3&&this.encodingID===1&&this.format===4||this.platformID===0&&this.format===4,this.codeMap={},this.format){case 0:for(l=0;l<256;++l)this.codeMap[l]=e.readByte();break;case 4:for(d=e.readUInt16(),f=d/2,e.pos+=6,s=(function(){var b,A;for(A=[],l=b=0;0<=f?b<f:b>f;l=0<=f?++b:--b)A.push(e.readUInt16());return A})(),e.pos+=2,m=(function(){var b,A;for(A=[],l=b=0;0<=f?b<f:b>f;l=0<=f?++b:--b)A.push(e.readUInt16());return A})(),c=(function(){var b,A;for(A=[],l=b=0;0<=f?b<f:b>f;l=0<=f?++b:--b)A.push(e.readUInt16());return A})(),h=(function(){var b,A;for(A=[],l=b=0;0<=f?b<f:b>f;l=0<=f?++b:--b)A.push(e.readUInt16());return A})(),r=(this.length-e.pos+this.offset)/2,a=(function(){var b,A;for(A=[],l=b=0;0<=r?b<r:b>r;l=0<=r?++b:--b)A.push(e.readUInt16());return A})(),l=v=0,S=s.length;v<S;l=++v)for(_=s[l],n=x=g=m[l];g<=_?x<=_:x>=_;n=g<=_?++x:--x)h[l]===0?o=n+c[l]:(o=a[h[l]/2+(n-g)-(f-l)]||0)!==0&&(o+=c[l]),this.codeMap[n]=65535&o}e.pos=u}return i.encode=function(e,t){var n,r,s,o,a,l,c,h,u,f,d,g,m,_,v,x,S,b,A,F,N,R,P,O,L,T,C,D,W,$,B,V,te,ne,ae,I,U,K,ie,re,ce,ve,pe,le,Ce,H;switch(D=new Bl,o=Object.keys(e).sort(function(Z,he){return Z-he}),t){case"macroman":for(m=0,_=(function(){var Z=[];for(g=0;g<256;++g)Z.push(0);return Z})(),x={0:0},s={},W=0,te=o.length;W<te;W++)x[pe=e[r=o[W]]]==null&&(x[pe]=++m),s[r]={old:e[r],new:x[e[r]]},_[r]=x[e[r]];return D.writeUInt16(1),D.writeUInt16(0),D.writeUInt32(12),D.writeUInt16(0),D.writeUInt16(262),D.writeUInt16(0),D.write(_),{charMap:s,subtable:D.data,maxGlyphID:m+1};case"unicode":for(T=[],u=[],S=0,x={},n={},v=c=null,$=0,ne=o.length;$<ne;$++)x[A=e[r=o[$]]]==null&&(x[A]=++S),n[r]={old:A,new:x[A]},a=x[A]-r,v!=null&&a===c||(v&&u.push(v),T.push(r),c=a),v=r;for(v&&u.push(v),u.push(65535),T.push(65535),O=2*(P=T.length),R=2*Math.pow(Math.log(P)/Math.LN2,2),f=Math.log(R/2)/Math.LN2,N=2*P-R,l=[],F=[],d=[],g=B=0,ae=T.length;B<ae;g=++B){if(L=T[g],h=u[g],L===65535){l.push(0),F.push(0);break}if(L-(C=n[L].new)>=32768)for(l.push(0),F.push(2*(d.length+P-g)),r=V=L;L<=h?V<=h:V>=h;r=L<=h?++V:--V)d.push(n[r].new);else l.push(C-L),F.push(0)}for(D.writeUInt16(3),D.writeUInt16(1),D.writeUInt32(12),D.writeUInt16(4),D.writeUInt16(16+8*P+2*d.length),D.writeUInt16(0),D.writeUInt16(O),D.writeUInt16(R),D.writeUInt16(f),D.writeUInt16(N),ce=0,I=u.length;ce<I;ce++)r=u[ce],D.writeUInt16(r);for(D.writeUInt16(0),ve=0,U=T.length;ve<U;ve++)r=T[ve],D.writeUInt16(r);for(le=0,K=l.length;le<K;le++)a=l[le],D.writeUInt16(a);for(Ce=0,ie=F.length;Ce<ie;Ce++)b=F[Ce],D.writeUInt16(b);for(H=0,re=d.length;H<re;H++)m=d[H],D.writeUInt16(m);return{charMap:n,subtable:D.data,maxGlyphID:S+1}}},i})(),rM=(function(){function i(){return i.__super__.constructor.apply(this,arguments)}return Jo(i,fo),i.prototype.tag="cmap",i.prototype.parse=function(e){var t,n,r;for(e.pos=this.offset,this.version=e.readUInt16(),r=e.readUInt16(),this.tables=[],this.unicode=null,n=0;0<=r?n<r:n>r;n=0<=r?++n:--n)t=new uS(e,this.offset),this.tables.push(t),t.isUnicode&&this.unicode==null&&(this.unicode=t);return!0},i.encode=function(e,t){var n,r;return t==null&&(t="macroman"),n=uS.encode(e,t),(r=new Bl).writeUInt16(0),r.writeUInt16(1),n.table=r.data.concat(n.subtable),n},i})(),f$=(function(){function i(){return i.__super__.constructor.apply(this,arguments)}return Jo(i,fo),i.prototype.tag="hhea",i.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.ascender=e.readShort(),this.decender=e.readShort(),this.lineGap=e.readShort(),this.advanceWidthMax=e.readShort(),this.minLeftSideBearing=e.readShort(),this.minRightSideBearing=e.readShort(),this.xMaxExtent=e.readShort(),this.caretSlopeRise=e.readShort(),this.caretSlopeRun=e.readShort(),this.caretOffset=e.readShort(),e.pos+=8,this.metricDataFormat=e.readShort(),this.numberOfMetrics=e.readUInt16()},i})(),d$=(function(){function i(){return i.__super__.constructor.apply(this,arguments)}return Jo(i,fo),i.prototype.tag="OS/2",i.prototype.parse=function(e){if(e.pos=this.offset,this.version=e.readUInt16(),this.averageCharWidth=e.readShort(),this.weightClass=e.readUInt16(),this.widthClass=e.readUInt16(),this.type=e.readShort(),this.ySubscriptXSize=e.readShort(),this.ySubscriptYSize=e.readShort(),this.ySubscriptXOffset=e.readShort(),this.ySubscriptYOffset=e.readShort(),this.ySuperscriptXSize=e.readShort(),this.ySuperscriptYSize=e.readShort(),this.ySuperscriptXOffset=e.readShort(),this.ySuperscriptYOffset=e.readShort(),this.yStrikeoutSize=e.readShort(),this.yStrikeoutPosition=e.readShort(),this.familyClass=e.readShort(),this.panose=(function(){var t,n;for(n=[],t=0;t<10;++t)n.push(e.readByte());return n})(),this.charRange=(function(){var t,n;for(n=[],t=0;t<4;++t)n.push(e.readInt());return n})(),this.vendorID=e.readString(4),this.selection=e.readShort(),this.firstCharIndex=e.readShort(),this.lastCharIndex=e.readShort(),this.version>0&&(this.ascent=e.readShort(),this.descent=e.readShort(),this.lineGap=e.readShort(),this.winAscent=e.readShort(),this.winDescent=e.readShort(),this.codePageRange=(function(){var t,n;for(n=[],t=0;t<2;t=++t)n.push(e.readInt());return n})(),this.version>1))return this.xHeight=e.readShort(),this.capHeight=e.readShort(),this.defaultChar=e.readShort(),this.breakChar=e.readShort(),this.maxContext=e.readShort()},i})(),g$=(function(){function i(){return i.__super__.constructor.apply(this,arguments)}return Jo(i,fo),i.prototype.tag="post",i.prototype.parse=function(e){var t,n,r;switch(e.pos=this.offset,this.format=e.readInt(),this.italicAngle=e.readInt(),this.underlinePosition=e.readShort(),this.underlineThickness=e.readShort(),this.isFixedPitch=e.readInt(),this.minMemType42=e.readInt(),this.maxMemType42=e.readInt(),this.minMemType1=e.readInt(),this.maxMemType1=e.readInt(),this.format){case 65536:case 196608:break;case 131072:var s;for(n=e.readUInt16(),this.glyphNameIndex=[],s=0;0<=n?s<n:s>n;s=0<=n?++s:--s)this.glyphNameIndex.push(e.readUInt16());for(this.names=[],r=[];e.pos<this.offset+this.length;)t=e.readByte(),r.push(this.names.push(e.readString(t)));return r;case 151552:return n=e.readUInt16(),this.offsets=e.read(n);case 262144:return this.map=(function(){var o,a,l;for(l=[],s=o=0,a=this.file.maxp.numGlyphs;0<=a?o<a:o>a;s=0<=a?++o:--o)l.push(e.readUInt32());return l}).call(this)}},i})(),p$=function(i,e){this.raw=i,this.length=i.length,this.platformID=e.platformID,this.encodingID=e.encodingID,this.languageID=e.languageID},m$=(function(){function i(){return i.__super__.constructor.apply(this,arguments)}return Jo(i,fo),i.prototype.tag="name",i.prototype.parse=function(e){var t,n,r,s,o,a,l,c,h,u,f;for(e.pos=this.offset,e.readShort(),t=e.readShort(),a=e.readShort(),n=[],s=0;0<=t?s<t:s>t;s=0<=t?++s:--s)n.push({platformID:e.readShort(),encodingID:e.readShort(),languageID:e.readShort(),nameID:e.readShort(),length:e.readShort(),offset:this.offset+a+e.readShort()});for(l={},s=h=0,u=n.length;h<u;s=++h)r=n[s],e.pos=r.offset,c=e.readString(r.length),o=new p$(c,r),l[f=r.nameID]==null&&(l[f]=[]),l[r.nameID].push(o);this.strings=l,this.copyright=l[0],this.fontFamily=l[1],this.fontSubfamily=l[2],this.uniqueSubfamily=l[3],this.fontName=l[4],this.version=l[5];try{this.postscriptName=l[6][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}catch{this.postscriptName=l[4][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}return this.trademark=l[7],this.manufacturer=l[8],this.designer=l[9],this.description=l[10],this.vendorUrl=l[11],this.designerUrl=l[12],this.license=l[13],this.licenseUrl=l[14],this.preferredFamily=l[15],this.preferredSubfamily=l[17],this.compatibleFull=l[18],this.sampleText=l[19]},i})(),_$=(function(){function i(){return i.__super__.constructor.apply(this,arguments)}return Jo(i,fo),i.prototype.tag="maxp",i.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.numGlyphs=e.readUInt16(),this.maxPoints=e.readUInt16(),this.maxContours=e.readUInt16(),this.maxCompositePoints=e.readUInt16(),this.maxComponentContours=e.readUInt16(),this.maxZones=e.readUInt16(),this.maxTwilightPoints=e.readUInt16(),this.maxStorage=e.readUInt16(),this.maxFunctionDefs=e.readUInt16(),this.maxInstructionDefs=e.readUInt16(),this.maxStackElements=e.readUInt16(),this.maxSizeOfInstructions=e.readUInt16(),this.maxComponentElements=e.readUInt16(),this.maxComponentDepth=e.readUInt16()},i})(),y$=(function(){function i(){return i.__super__.constructor.apply(this,arguments)}return Jo(i,fo),i.prototype.tag="hmtx",i.prototype.parse=function(e){var t,n,r,s,o,a,l;for(e.pos=this.offset,this.metrics=[],t=0,a=this.file.hhea.numberOfMetrics;0<=a?t<a:t>a;t=0<=a?++t:--t)this.metrics.push({advance:e.readUInt16(),lsb:e.readInt16()});for(r=this.file.maxp.numGlyphs-this.file.hhea.numberOfMetrics,this.leftSideBearings=(function(){var c,h;for(h=[],t=c=0;0<=r?c<r:c>r;t=0<=r?++c:--c)h.push(e.readInt16());return h})(),this.widths=(function(){var c,h,u,f;for(f=[],c=0,h=(u=this.metrics).length;c<h;c++)s=u[c],f.push(s.advance);return f}).call(this),n=this.widths[this.widths.length-1],l=[],t=o=0;0<=r?o<r:o>r;t=0<=r?++o:--o)l.push(this.widths.push(n));return l},i.prototype.forGlyph=function(e){return e in this.metrics?this.metrics[e]:{advance:this.metrics[this.metrics.length-1].advance,lsb:this.leftSideBearings[e-this.metrics.length]}},i})(),sM=[].slice,v$=(function(){function i(){return i.__super__.constructor.apply(this,arguments)}return Jo(i,fo),i.prototype.tag="glyf",i.prototype.parse=function(){return this.cache={}},i.prototype.glyphFor=function(e){var t,n,r,s,o,a,l,c,h,u;return e in this.cache?this.cache[e]:(s=this.file.loca,t=this.file.contents,n=s.indexOf(e),(r=s.lengthOf(e))===0?this.cache[e]=null:(t.pos=this.offset+n,o=(a=new Bl(t.read(r))).readShort(),c=a.readShort(),u=a.readShort(),l=a.readShort(),h=a.readShort(),this.cache[e]=o===-1?new w$(a,c,u,l,h):new x$(a,o,c,u,l,h),this.cache[e]))},i.prototype.encode=function(e,t,n){var r,s,o,a,l;for(o=[],s=[],a=0,l=t.length;a<l;a++)r=e[t[a]],s.push(o.length),r&&(o=o.concat(r.encode(n)));return s.push(o.length),{table:o,offsets:s}},i})(),x$=(function(){function i(e,t,n,r,s,o){this.raw=e,this.numberOfContours=t,this.xMin=n,this.yMin=r,this.xMax=s,this.yMax=o,this.compound=!1}return i.prototype.encode=function(){return this.raw.data},i})(),w$=(function(){function i(e,t,n,r,s){var o,a;for(this.raw=e,this.xMin=t,this.yMin=n,this.xMax=r,this.yMax=s,this.compound=!0,this.glyphIDs=[],this.glyphOffsets=[],o=this.raw;a=o.readShort(),this.glyphOffsets.push(o.pos),this.glyphIDs.push(o.readUInt16()),32&a;)o.pos+=1&a?4:2,128&a?o.pos+=8:64&a?o.pos+=4:8&a&&(o.pos+=2)}return i.prototype.encode=function(){var e,t,n;for(t=new Bl(sM.call(this.raw.data)),e=0,n=this.glyphIDs.length;e<n;++e)t.pos=this.glyphOffsets[e];return t.data},i})(),b$=(function(){function i(){return i.__super__.constructor.apply(this,arguments)}return Jo(i,fo),i.prototype.tag="loca",i.prototype.parse=function(e){var t,n;return e.pos=this.offset,t=this.file.head.indexToLocFormat,this.offsets=t===0?(function(){var r,s;for(s=[],n=0,r=this.length;n<r;n+=2)s.push(2*e.readUInt16());return s}).call(this):(function(){var r,s;for(s=[],n=0,r=this.length;n<r;n+=4)s.push(e.readUInt32());return s}).call(this)},i.prototype.indexOf=function(e){return this.offsets[e]},i.prototype.lengthOf=function(e){return this.offsets[e+1]-this.offsets[e]},i.prototype.encode=function(e,t){for(var n=new Uint32Array(this.offsets.length),r=0,s=0,o=0;o<n.length;++o)if(n[o]=r,s<t.length&&t[s]==o){++s,n[o]=r;var a=this.offsets[o],l=this.offsets[o+1]-a;l>0&&(r+=l)}for(var c=new Array(4*n.length),h=0;h<n.length;++h)c[4*h+3]=255&n[h],c[4*h+2]=(65280&n[h])>>8,c[4*h+1]=(16711680&n[h])>>16,c[4*h]=(4278190080&n[h])>>24;return c},i})(),E$=(function(){function i(e){this.font=e,this.subset={},this.unicodes={},this.next=33}return i.prototype.generateCmap=function(){var e,t,n,r,s;for(t in r=this.font.cmap.tables[0].codeMap,e={},s=this.subset)n=s[t],e[t]=r[n];return e},i.prototype.glyphsFor=function(e){var t,n,r,s,o,a,l;for(r={},o=0,a=e.length;o<a;o++)r[s=e[o]]=this.font.glyf.glyphFor(s);for(s in t=[],r)(n=r[s])!=null&&n.compound&&t.push.apply(t,n.glyphIDs);if(t.length>0)for(s in l=this.glyphsFor(t))n=l[s],r[s]=n;return r},i.prototype.encode=function(e,t){var n,r,s,o,a,l,c,h,u,f,d,g,m,_,v;for(r in n=rM.encode(this.generateCmap(),"unicode"),o=this.glyphsFor(e),d={0:0},v=n.charMap)d[(l=v[r]).old]=l.new;for(g in f=n.maxGlyphID,o)g in d||(d[g]=f++);return h=(function(x){var S,b;for(S in b={},x)b[x[S]]=S;return b})(d),u=Object.keys(h).sort(function(x,S){return x-S}),m=(function(){var x,S,b;for(b=[],x=0,S=u.length;x<S;x++)a=u[x],b.push(h[a]);return b})(),s=this.font.glyf.encode(o,m,d),c=this.font.loca.encode(s.offsets,m),_={cmap:this.font.cmap.raw(),glyf:s.table,loca:c,hmtx:this.font.hmtx.raw(),hhea:this.font.hhea.raw(),maxp:this.font.maxp.raw(),post:this.font.post.raw(),name:this.font.name.raw(),head:this.font.head.encode(t)},this.font.os2.exists&&(_["OS/2"]=this.font.os2.raw()),this.font.directory.encode(_)},i})();ct.API.PDFObject=(function(){var i;function e(){}return i=function(t,n){return(Array(n+1).join("0")+t).slice(-n)},e.convert=function(t){var n,r,s,o;if(Array.isArray(t))return"["+(function(){var a,l,c;for(c=[],a=0,l=t.length;a<l;a++)n=t[a],c.push(e.convert(n));return c})().join(" ")+"]";if(typeof t=="string")return"/"+t;if(t?.isString)return"("+t+")";if(t instanceof Date)return"(D:"+i(t.getUTCFullYear(),4)+i(t.getUTCMonth(),2)+i(t.getUTCDate(),2)+i(t.getUTCHours(),2)+i(t.getUTCMinutes(),2)+i(t.getUTCSeconds(),2)+"Z)";if({}.toString.call(t)==="[object Object]"){for(r in s=["<<"],t)o=t[r],s.push("/"+r+" "+e.convert(o));return s.push(">>"),s.join(`
806
- `)}return""+t},e})();function eh(i,e){const t=ft("feature"),n=Nn(e),r=qi(()=>{const s=Object.values(n);return new i(...s)});return ti(n,()=>{t?.value?.setGeometry(r.value),t?.value?.changed()}),ti(()=>t,()=>{t?.value?.setGeometry(r.value)}),Ji(()=>{t?.value?.setGeometry(r.value)}),cn(()=>{t?.value?.setGeometry(void 0)}),r}const oM=et({__name:"OlGeomCircle",props:{center:{},radius:{},layout:{default:"XY"}},setup(i,{expose:e}){const n=eh(Bu,i);return e({geometry:n}),(r,s)=>Xt("",!0)}}),aM=et({__name:"OlGeomLineString",props:{coordinates:{},layout:{default:"XY"}},setup(i,{expose:e}){const n=eh(ar,i);return e({geometry:n}),(r,s)=>Xt("",!0)}}),lM=et({__name:"OlGeomMultiLineString",props:{coordinates:{},layout:{default:"XY"},ends:{}},setup(i,{expose:e}){const n=eh(Dl,i);return e({geometry:n}),(r,s)=>Xt("",!0)}}),cM=et({__name:"OlGeomMultiPoint",props:{coordinates:{},layout:{default:"XY"}},setup(i,{expose:e}){const n=eh(rg,i);return e({geometry:n}),(r,s)=>Xt("",!0)}}),hM=et({__name:"OlGeomMultiPolygon",props:{coordinates:{},layout:{default:"XY"},endss:{}},setup(i,{expose:e}){const n=eh($o,i);return e({geometry:n}),(r,s)=>Xt("",!0)}}),uM=et({__name:"OlGeomPoint",props:{coordinates:{},layout:{default:"XY"}},setup(i,{expose:e}){const n=eh(zi,i);return e({geometry:n}),(r,s)=>Xt("",!0)}}),fM=et({__name:"OlGeomPolygon",props:{coordinates:{},layout:{default:"XY"},ends:{}},setup(i,{expose:e}){const n=eh(lr,i);return e({geometry:n}),(r,s)=>Xt("",!0)}});function fS(i,e){jt(i,"OlGeomCircle",oM),jt(i,"OlGeomLineString",aM),jt(i,"OlGeomMultiLineString",lM),jt(i,"OlGeomMultiPoint",cM),jt(i,"OlGeomMultiPolygon",hM),jt(i,"OlGeomPoint",uM),jt(i,"OlGeomPolygon",fM),e&&i.provide("ol-options",e)}const dS=Object.freeze(Object.defineProperty({__proto__:null,OlGeomCircle:oM,OlGeomLineString:aM,OlGeomMultiLineString:lM,OlGeomMultiPoint:cM,OlGeomMultiPolygon:hM,OlGeomPoint:uM,OlGeomPolygon:fM,default:fS,install:fS},Symbol.toStringTag,{value:"Module"}));var s0={exports:{}},S$=s0.exports,gS;function T$(){return gS||(gS=1,(function(i,e){(t=>{let n=(()=>{let N=0;return{escape:function(C){return C.replace(/([.*+?^${}()|[\]/\\])/g,"\\$1")},isDataUrl:function(C){return C.search(/^(data:)/)!==-1},canvasToBlob:function(C){return C.toBlob?new Promise(function(D){C.toBlob(D)}):(D=>new Promise(function(W){var $=d(D.toDataURL().split(",")[1]),B=$.length,V=new Uint8Array(B);for(let te=0;te<B;te++)V[te]=$.charCodeAt(te);W(new Blob([V],{type:"image/png"}))}))(C)},resolveUrl:function(C,D){var W=document.implementation.createHTMLDocument(),$=W.createElement("base"),B=(W.head.appendChild($),W.createElement("a"));return W.body.appendChild(B),$.href=D,B.href=C,B.href},getAndEncode:function(C){let D=h.impl.urlCache.find(function(W){return W.url===C});return D||(D={url:C,promise:null},h.impl.urlCache.push(D)),D.promise===null&&(h.impl.options.cacheBust&&(C+=(/\?/.test(C)?"&":"?")+new Date().getTime()),D.promise=new Promise(function(W){let $=new XMLHttpRequest;function B(ne){console.error(ne),W("")}function V(){var ne=h.impl.options.imagePlaceholder;ne?W(ne):B("Status:"+$.status+" while fetching resource: "+C)}if($.timeout=h.impl.options.httpTimeout,$.onerror=V,$.ontimeout=V,$.onloadend=function(){if($.readyState===XMLHttpRequest.DONE){var ne=$.status;if(ne===0&&C.toLowerCase().startsWith("file://")||200<=ne&&ne<=300&&$.response!==null){ne=$.response,ne instanceof Blob||B("Expected response to be a Blob, but got: "+typeof ne);let ae=new FileReader;ae.onloadend=function(){var I=ae.result;W(I)};try{ae.readAsDataURL(ne)}catch(I){B("Failed to read the response as Data URL: "+I.toString())}}else V()}},0<h.impl.options.useCredentialsFilters.length&&(h.impl.options.useCredentials=0<h.impl.options.useCredentialsFilters.filter(ne=>0<=C.search(ne)).length),h.impl.options.useCredentials&&($.withCredentials=!0),h.impl.options.corsImg&&C.indexOf("http")===0&&C.indexOf(window.location.origin)===-1){var te=(h.impl.options.corsImg.method||"GET").toUpperCase()==="POST"?"POST":"GET";$.open(te,(h.impl.options.corsImg.url||"").replace("#{cors}",C),!0);let ne=!1,ae=h.impl.options.corsImg.headers||{},I=(Object.keys(ae).forEach(function(U){ae[U].indexOf("application/json")!==-1&&(ne=!0),$.setRequestHeader(U,ae[U])}),(U=>{try{return JSON.parse(JSON.stringify(U))}catch(K){B("corsImg.data is missing or invalid:"+K.toString())}})(h.impl.options.corsImg.data||""));Object.keys(I).forEach(function(U){typeof I[U]=="string"&&(I[U]=I[U].replace("#{cors}",C))}),$.responseType="blob",$.send(ne?JSON.stringify(I):I)}else $.open("GET",C,!0),$.responseType="blob",$.send()})),D.promise},uid:function(){return"u"+("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)+N++},asArray:function(C){var D=[],W=C.length;for(let $=0;$<W;$++)D.push(C[$]);return D},escapeXhtml:function(C){return C.replace(/%/g,"%25").replace(/#/g,"%23").replace(/\n/g,"%0A")},makeImage:function(C){return C!=="data:,"?new Promise(function(D,W){let $=document.createElementNS("http://www.w3.org/2000/svg","svg"),B=new Image;h.impl.options.useCredentials&&(B.crossOrigin="use-credentials"),B.onload=function(){document.body.removeChild($),window&&window.requestAnimationFrame?window.requestAnimationFrame(function(){D(B)}):D(B)},B.onerror=V=>{document.body.removeChild($),W(V)},$.appendChild(B),B.src=C,document.body.appendChild($)}):Promise.resolve()},width:function(C){var D=T(C,"width");if(!isNaN(D))return D;var D=T(C,"border-left-width"),W=T(C,"border-right-width");return C.scrollWidth+D+W},height:function(C){var D=T(C,"height");if(!isNaN(D))return D;var D=T(C,"border-top-width"),W=T(C,"border-bottom-width");return C.scrollHeight+D+W},getWindow:R,isElement:L,isElementHostForOpenShadowRoot:function(C){return L(C)&&C.shadowRoot!==null},isShadowRoot:P,isInShadowRoot:O,isHTMLElement:function(C){return C instanceof R(C).HTMLElement},isHTMLCanvasElement:function(C){return C instanceof R(C).HTMLCanvasElement},isHTMLInputElement:function(C){return C instanceof R(C).HTMLInputElement},isHTMLImageElement:function(C){return C instanceof R(C).HTMLImageElement},isHTMLLinkElement:function(C){return C instanceof R(C).HTMLLinkElement},isHTMLScriptElement:function(C){return C instanceof R(C).HTMLScriptElement},isHTMLStyleElement:function(C){return C instanceof R(C).HTMLStyleElement},isHTMLTextAreaElement:function(C){return C instanceof R(C).HTMLTextAreaElement},isShadowSlotElement:function(C){return O(C)&&C instanceof R(C).HTMLSlotElement},isSVGElement:function(C){return C instanceof R(C).SVGElement},isSVGRectElement:function(C){return C instanceof R(C).SVGRectElement},isDimensionMissing:function(C){return isNaN(C)||C<=0}};function R(C){return C=C?C.ownerDocument:void 0,(C?C.defaultView:void 0)||window||t}function P(C){return C instanceof R(C).ShadowRoot}function O(C){return C!=null&&C.getRootNode!==void 0&&P(C.getRootNode())}function L(C){return C instanceof R(C).Element}function T(C,D){if(C.nodeType===u){let W=f(C).getPropertyValue(D);if(W.slice(-2)==="px")return W=W.slice(0,-2),parseFloat(W)}return NaN}})(),r=(()=>{let N=/url\(\s*(["']?)((?:\\.|[^\\)])+)\1\s*\)/gm;return{inlineAll:function(T,C,D){return R(T)?Promise.resolve(T).then(P).then(function(W){let $=Promise.resolve(T);return W.forEach(function(B){$=$.then(function(V){return L(V,B,C,D)})}),$}):Promise.resolve(T)},shouldProcess:R,impl:{readUrls:P,inline:L,urlAsRegex:O}};function R(T){return T.search(N)!==-1}function P(T){for(var C,D=[];(C=N.exec(T))!==null;)D.push(C[2]);return D.filter(function(W){return!n.isDataUrl(W)})}function O(T){return new RegExp(`url\\((["']?)(${n.escape(T)})\\1\\)`,"gm")}function L(T,C,D,W){return Promise.resolve(C).then(function($){return D?n.resolveUrl($,D):$}).then(W||n.getAndEncode).then(function($){var B=O(C);return T.replace(B,`url($1${$}$1)`)})}})(),s={resolveAll:function(){return o().then(function(N){return Promise.all(N.map(function(R){return R.resolve()}))}).then(function(N){return N.join(`
807
- `)})},impl:{readAll:o}};function o(){return Promise.resolve(n.asArray(document.styleSheets)).then(function(R){let P=[];return R.forEach(function(O){var L=Object.getPrototypeOf(O);if(Object.prototype.hasOwnProperty.call(L,"cssRules"))try{n.asArray(O.cssRules||[]).forEach(P.push.bind(P))}catch(T){console.error("domtoimage: Error while reading CSS rules from: "+O.href,T.toString())}}),P}).then(function(R){return R.filter(function(P){return P.type===CSSRule.FONT_FACE_RULE}).filter(function(P){return r.shouldProcess(P.style.getPropertyValue("src"))})}).then(function(R){return R.map(N)});function N(R){return{resolve:function(){var P=(R.parentStyleSheet||{}).href;return r.inlineAll(R.cssText,P)},src:function(){return R.style.getPropertyValue("src")}}}}let a={inlineAll:function N(R){if(!n.isElement(R))return Promise.resolve(R);return P(R).then(function(){return n.isHTMLImageElement(R)?l(R).inline():Promise.all(n.asArray(R.childNodes).map(function(O){return N(O)}))});function P(O){let L=["background","background-image"],T=L.map(function(C){let D=O.style.getPropertyValue(C),W=O.style.getPropertyPriority(C);return D?r.inlineAll(D).then(function($){O.style.setProperty(C,$,W)}):Promise.resolve()});return Promise.all(T).then(function(){return O})}},impl:{newImage:l}};function l(N){return{inline:function(R){return n.isDataUrl(N.src)?Promise.resolve():Promise.resolve(N.src).then(R||n.getAndEncode).then(function(P){return new Promise(function(O){N.onload=O,N.onerror=O,N.src=P})})}}}let c={copyDefaultStyles:!0,imagePlaceholder:void 0,cacheBust:!1,useCredentials:!1,useCredentialsFilters:[],httpTimeout:3e4,styleCaching:"strict",corsImg:void 0},h={toSvg:g,toPng:function(N,R){return m(N,R).then(function(P){return P.toDataURL()})},toJpeg:function(N,R){return m(N,R).then(function(P){return P.toDataURL("image/jpeg",(R?R.quality:void 0)||1)})},toBlob:function(N,R){return m(N,R).then(n.canvasToBlob)},toPixelData:function(N,R){return m(N,R).then(function(P){return P.getContext("2d").getImageData(0,0,n.width(N),n.height(N)).data})},toCanvas:m,impl:{fontFaces:s,images:a,util:n,inliner:r,urlCache:[],options:{},copyOptions:function(N){N.copyDefaultStyles===void 0?h.impl.options.copyDefaultStyles=c.copyDefaultStyles:h.impl.options.copyDefaultStyles=N.copyDefaultStyles,h.impl.options.imagePlaceholder=(N.imagePlaceholder===void 0?c:N).imagePlaceholder,h.impl.options.cacheBust=(N.cacheBust===void 0?c:N).cacheBust,h.impl.options.corsImg=(N.corsImg===void 0?c:N).corsImg,h.impl.options.useCredentials=(N.useCredentials===void 0?c:N).useCredentials,h.impl.options.useCredentialsFilters=(N.useCredentialsFilters===void 0?c:N).useCredentialsFilters,h.impl.options.httpTimeout=(N.httpTimeout===void 0?c:N).httpTimeout,h.impl.options.styleCaching=(N.styleCaching===void 0?c:N).styleCaching}}},u=(i.exports=h,(typeof Node<"u"?Node.ELEMENT_NODE:void 0)||1),f=(t!==void 0?t.getComputedStyle:void 0)||(typeof window<"u"?window.getComputedStyle:void 0)||globalThis.getComputedStyle,d=(t!==void 0?t.atob:void 0)||(typeof window<"u"?window.atob:void 0)||globalThis.atob;function g(N,R){h.impl.util.getWindow(N);let P=(R=R||{},h.impl.copyOptions(R),[]);return Promise.resolve(N).then(function(O){if(O.nodeType===u)return O;var L=O,T=O.parentNode,C=document.createElement("span");return T.replaceChild(C,L),C.append(O),P.push({parent:T,child:L,wrapper:C}),C}).then(function(O){return(function L(T,C,D,W){let $=C.filter;if(T===_||n.isHTMLScriptElement(T)||n.isHTMLStyleElement(T)||n.isHTMLLinkElement(T)||D!==null&&$&&!$(T))return Promise.resolve();return Promise.resolve(T).then(B).then(V).then(function(U){return ae(U,ne(T))}).then(te).then(function(U){return I(U,T)});function B(U){return n.isHTMLCanvasElement(U)?n.makeImage(U.toDataURL()):U.cloneNode(!1)}function V(U){return C.adjustClonedNode&&C.adjustClonedNode(T,U,!1),Promise.resolve(U)}function te(U){return C.adjustClonedNode&&C.adjustClonedNode(T,U,!0),Promise.resolve(U)}function ne(U){return n.isElementHostForOpenShadowRoot(U)?U.shadowRoot:U}function ae(U,K){let ie=ve(K),re=Promise.resolve();if(ie.length!==0){let pe=f(ce(K));n.asArray(ie).forEach(function(le){re=re.then(function(){return L(le,C,pe).then(function(Ce){Ce&&U.appendChild(Ce)})})})}return re.then(function(){return U});function ce(pe){return n.isShadowRoot(pe)?pe.host:pe}function ve(pe){if(n.isShadowSlotElement(pe)){let le=pe.assignedNodes();if(le&&0<le.length)return le}return pe.childNodes}}function I(U,K){return!n.isElement(U)||n.isShadowSlotElement(K)?Promise.resolve(U):Promise.resolve().then(re).then(ce).then(ve).then(pe).then(ie).then(function(){return U});function ie(){n.isHTMLImageElement(U)&&(U.removeAttribute("loading"),K.srcset||K.sizes)&&(U.removeAttribute("srcset"),U.removeAttribute("sizes"),U.src=K.currentSrc||K.src)}function re(){function le(H,Z){Z.font=H.font,Z.fontFamily=H.fontFamily,Z.fontFeatureSettings=H.fontFeatureSettings,Z.fontKerning=H.fontKerning,Z.fontSize=H.fontSize,Z.fontStretch=H.fontStretch,Z.fontStyle=H.fontStyle,Z.fontVariant=H.fontVariant,Z.fontVariantCaps=H.fontVariantCaps,Z.fontVariantEastAsian=H.fontVariantEastAsian,Z.fontVariantLigatures=H.fontVariantLigatures,Z.fontVariantNumeric=H.fontVariantNumeric,Z.fontVariationSettings=H.fontVariationSettings,Z.fontWeight=H.fontWeight}function Ce(H,Z){let he=f(H);he.cssText?(Z.style.cssText=he.cssText,le(he,Z.style)):(S(C,H,he,D,Z),D===null&&(["inset-block","inset-block-start","inset-block-end"].forEach(j=>Z.style.removeProperty(j)),["left","right","top","bottom"].forEach(j=>{Z.style.getPropertyValue(j)&&Z.style.setProperty(j,"0px")})))}Ce(K,U)}function ce(){let le=n.uid();function Ce(H){let Z=f(K,H),he=Z.getPropertyValue("content");if(he!==""&&he!=="none"){let j=function(){let Le=`.${le}:`+H,ge=(Z.cssText?Te:_e)();return document.createTextNode(Le+`{${ge}}`);function Te(){return`${Z.cssText} content: ${he};`}function _e(){return n.asArray(Z).map(Se).join("; ")+";";function Se(Ge){let Be=Z.getPropertyValue(Ge),je=Z.getPropertyPriority(Ge)?" !important":"";return Ge+": "+Be+je}}},fe=U.getAttribute("class")||"",Ee=(U.setAttribute("class",fe+" "+le),document.createElement("style"));Ee.appendChild(j()),U.appendChild(Ee)}}[":before",":after"].forEach(function(H){Ce(H)})}function ve(){n.isHTMLTextAreaElement(K)&&(U.innerHTML=K.value),n.isHTMLInputElement(K)&&U.setAttribute("value",K.value)}function pe(){n.isSVGElement(U)&&(U.setAttribute("xmlns","http://www.w3.org/2000/svg"),n.isSVGRectElement(U))&&["width","height"].forEach(function(le){let Ce=U.getAttribute(le);Ce&&U.style.setProperty(le,Ce)})}}})(O,R,null)}).then(R.disableEmbedFonts?Promise.resolve(N):v).then(R.disableInlineImages?Promise.resolve(N):x).then(function(O){R.bgcolor&&(O.style.backgroundColor=R.bgcolor),R.width&&(O.style.width=R.width+"px"),R.height&&(O.style.height=R.height+"px"),R.style&&Object.keys(R.style).forEach(function(T){O.style[T]=R.style[T]});let L=null;return typeof R.onclone=="function"&&(L=R.onclone(O)),Promise.resolve(L).then(function(){return O})}).then(function(O){let L=R.width||n.width(N),T=R.height||n.height(N);return Promise.resolve(O).then(function(C){return C.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),new XMLSerializer().serializeToString(C)}).then(n.escapeXhtml).then(function(C){var D=(n.isDimensionMissing(L)?' width="100%"':` width="${L}"`)+(n.isDimensionMissing(T)?' height="100%"':` height="${T}"`);return`<svg xmlns="http://www.w3.org/2000/svg"${(n.isDimensionMissing(L)?"":` width="${L}"`)+(n.isDimensionMissing(T)?"":` height="${T}"`)}><foreignObject${D}>${C}</foreignObject></svg>`}).then(function(C){return"data:image/svg+xml;charset=utf-8,"+C})}).then(function(O){for(;0<P.length;){var L=P.pop();L.parent.replaceChild(L.child,L.wrapper)}return O}).then(function(O){return h.impl.urlCache=[],_&&(document.body.removeChild(_),_=null),b&&clearTimeout(b),b=setTimeout(()=>{b=null,A={}},2e4),O})}function m(N,R){return g(N,R=R||{}).then(n.makeImage).then(function(P){var O=typeof R.scale!="number"?1:R.scale,L=((C,D)=>{let W=R.width||n.width(C),$=R.height||n.height(C);return n.isDimensionMissing(W)&&(W=n.isDimensionMissing($)?300:2*$),n.isDimensionMissing($)&&($=W/2),(C=document.createElement("canvas")).width=W*D,C.height=$*D,R.bgcolor&&((D=C.getContext("2d")).fillStyle=R.bgcolor,D.fillRect(0,0,C.width,C.height)),C})(N,O),T=L.getContext("2d");return T.msImageSmoothingEnabled=!1,T.imageSmoothingEnabled=!1,P&&(T.scale(O,O),T.drawImage(P,0,0)),L})}let _=null;function v(N){return s.resolveAll().then(function(R){var P;return R!==""&&(P=document.createElement("style"),N.appendChild(P),P.appendChild(document.createTextNode(R))),N})}function x(N){return a.inlineAll(N).then(function(){return N})}function S(N,R,P,O,L){let T=h.impl.options.copyDefaultStyles?((D,W)=>{var $,B=(ne=>(D.styleCaching!=="relaxed"?ne:ne.filter((ae,I,U)=>I===0||I===U.length-1)).join(">"))(W=(ne=>{var ae=[];do if(ne.nodeType===u){var I=ne.tagName;if(ae.push(I),F.includes(I))break}while(ne=ne.parentNode);return ae})(W));{if(A[B])return A[B];W=((ne,ae)=>{let I=ne.body;do{var U=ae.pop(),U=ne.createElement(U);I.appendChild(U),I=U}while(0<ae.length);return I.textContent="​",I})(($=(()=>{if(_)return _.contentWindow;ae=document.characterSet||"UTF-8",ne=(ne=document.doctype)?(`<!DOCTYPE ${ce(ne.name)} ${ce(ne.publicId)} `+ce(ne.systemId)).trim()+">":"",(_=document.createElement("iframe")).id="domtoimage-sandbox-"+n.uid(),_.style.visibility="hidden",_.style.position="fixed",document.body.appendChild(_);var ne,ae,I=_,U="domtoimage-sandbox";try{return I.contentWindow.document.write(ne+`<html><head><meta charset='${ae}'><title>${U}</title></head><body></body></html>`),I.contentWindow}catch{}var K=document.createElement("meta");K.setAttribute("charset",ae);try{var ie=document.implementation.createHTMLDocument(U),re=(ie.head.appendChild(K),ne+ie.documentElement.outerHTML);return I.setAttribute("srcdoc",re),I.contentWindow}catch{}return I.contentDocument.head.appendChild(K),I.contentDocument.title=U,I.contentWindow;function ce(ve){var pe;return ve?((pe=document.createElement("div")).innerText=ve,pe.innerHTML):""}})()).document,W),$=((ne,ae)=>{let I={},U=ne.getComputedStyle(ae);return n.asArray(U).forEach(function(K){I[K]=K==="width"||K==="height"?"auto":U.getPropertyValue(K)}),I})($,W);var V=W;do{var te=V.parentElement;te!==null&&te.removeChild(V),V=te}while(V&&V.tagName!=="BODY");return A[B]=$}})(N,R):{},C=L.style;n.asArray(P).forEach(function(D){var W,$,B,V;N.filterStyles&&!N.filterStyles(R,D)||($=P.getPropertyValue(D),B=T[D],W=O?O.getPropertyValue(D):void 0,C.getPropertyValue(D))||($!==B||O&&$!==W)&&(B=P.getPropertyPriority(D),W=C,$=$,B=B,V=0<=["background-clip"].indexOf(D=D),B?(W.setProperty(D,$,B),V&&W.setProperty("-webkit-"+D,$,B)):(W.setProperty(D,$),V&&W.setProperty("-webkit-"+D,$)))})}let b=null,A={},F=["ADDRESS","ARTICLE","ASIDE","BLOCKQUOTE","DETAILS","DIALOG","DD","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","LI","MAIN","NAV","OL","P","PRE","SECTION","SVG","TABLE","UL","math","svg","BODY","HEAD","HTML"]})(S$)})(s0)),s0.exports}T$();const dM=et({inheritAttrs:!1,__name:"OlInteractionClusterSelect",props:{featureStyle:{},selectCluster:{type:Boolean,default:!0},pointRadius:{default:7},spiral:{type:Boolean,default:!0},circleMaxObject:{},maxObjects:{},animate:{type:Boolean,default:!0},animationDuration:{default:500},autoClose:{type:Boolean,default:!0},addCondition:{},condition:{},layers:{},style:{},removeCondition:{},toggleCondition:{},multi:{type:Boolean,default:!1},features:{},filter:{},hitTolerance:{}},emits:["change","error","propertychange","select"],setup(i,{expose:e}){const t=i,n=ft("map"),r=Nn(t),s=qi(()=>new _k({style:new Li,...r}));return Jr(s,["select"]),ti(s,(o,a)=>{n?.removeInteraction(a),n?.addInteraction(o),n?.changed()}),Ji(()=>{n?.addInteraction(s.value)}),cn(()=>{n?.removeInteraction(s.value)}),fi("stylable",s),e({select:s}),(o,a)=>qt(o.$slots,"default")}}),gM=et({inheritAttrs:!1,__name:"OlInteractionDragBox",props:{className:{},condition:{type:Function},minArea:{},boxEndCondition:{type:Function},onBoxEnd:{type:Function}},emits:["change","error","propertychange","boxcancel","boxdrag","boxend","boxstart"],setup(i,{expose:e}){const t=i,n=ft("map"),r=Nn(t),s=qi(()=>new dL(r));return Jr(s,["boxcancel","boxdrag","boxend","boxstart"]),ti(s,(o,a)=>{n?.removeInteraction(a),n?.addInteraction(o),n?.changed()}),Ji(()=>{n?.addInteraction(s.value)}),cn(()=>{n?.removeInteraction(s.value)}),e({dragbox:s}),(o,a)=>qt(o.$slots,"default")}}),pM=et({__name:"OlInteractionDragRotate",props:{condition:{type:Function},duration:{}},setup(i,{expose:e}){const t=i,n=ft("map"),r=Nn(t),s=qi(()=>new fL(r));return ti(s,(o,a)=>{n?.removeInteraction(a),n?.addInteraction(o),n?.changed()}),Ji(()=>{n?.addInteraction(s.value)}),cn(()=>{n?.removeInteraction(s.value)}),e({dragrotate:s}),(o,a)=>qt(o.$slots,"default")}}),mM=et({__name:"OlInteractionDragRotateAndZoom",props:{condition:{type:Function},duration:{}},setup(i,{expose:e}){const t=i,n=ft("map"),r=Nn(t),s=qi(()=>new uk(r));return ti(s,(o,a)=>{n?.removeInteraction(a),n?.addInteraction(o),n?.changed()}),Ji(()=>{n?.addInteraction(s.value)}),cn(()=>{n?.removeInteraction(s.value)}),e({dragRotateZoom:s}),(o,a)=>qt(o.$slots,"default")}}),_M=et({inheritAttrs:!1,__name:"OlInteractionLink",props:{animate:{type:[Boolean,Object],default:!0},params:{default:()=>["x","y","z","r","l"]},replace:{type:Boolean,default:!1},prefix:{default:""}},emits:["change","error","propertychange","change:active"],setup(i,{expose:e}){const t=i,n=ft("map"),r=Nn(t),s=za(new gk(r));return Jr(s,["change:active"]),ti(s,(o,a)=>{n?.removeInteraction(a),n?.addInteraction(o),n?.changed()}),Ji(()=>{n?.addInteraction(s.value)}),cn(()=>{n?.removeInteraction(s.value)}),fi("stylable",s),e({link:s}),(o,a)=>qt(o.$slots,"default")}}),yM=et({inheritAttrs:!1,__name:"OlInteractionSelect",props:{addCondition:{type:Function},condition:{type:Function},layers:{type:[Array,Function]},style:{type:[Object,Array,Function,null]},removeCondition:{type:Function},toggleCondition:{type:Function},multi:{type:Boolean},features:{},filter:{type:Function},hitTolerance:{}},emits:["change","error","propertychange","select"],setup(i,{expose:e}){const t=i,n=ft("map"),r=Nn(t),s=qi(()=>new Km({style:new Li,...r}));return Jr(s,["select"]),ti(s,(o,a)=>{n?.removeInteraction(a),n?.addInteraction(o),n?.changed()}),Ji(()=>{n?.addInteraction(s.value)}),cn(()=>{n?.removeInteraction(s.value)}),fi("stylable",s),e({select:s}),(o,a)=>qt(o.$slots,"default")}}),vM=et({inheritAttrs:!1,__name:"OlInteractionDraw",props:{type:{},clickTolerance:{},features:{},source:{},dragVertexDelay:{},snapTolerance:{},stopClick:{type:Boolean},maxPoints:{},minPoints:{},finishCondition:{type:Function},style:{type:[Object,Array,Function]},geometryFunction:{type:Function},geometryName:{},condition:{type:Function},freehand:{type:Boolean},freehandCondition:{type:Function},trace:{type:[Boolean,Function]},traceSource:{},wrapX:{type:Boolean},geometryLayout:{}},emits:["change","error","propertychange","drawstart","drawend"],setup(i,{expose:e}){const t=i,n=ft("map"),r=ft("vectorSource",null),{source:s,type:o,clickTolerance:a,dragVertexDelay:l,snapTolerance:c,stopClick:h,maxPoints:u,minPoints:f,finishCondition:d,geometryFunction:g,geometryName:m,condition:_,freehand:v,freehandCondition:x,wrapX:S,features:b,geometryLayout:A,trace:F,traceSource:N}=Hd(t);function R(){return new sk({source:s.value||r?.value,type:o.value,clickTolerance:a.value,dragVertexDelay:l.value,snapTolerance:c.value,stopClick:h.value,maxPoints:u.value,minPoints:f.value,finishCondition:d.value,geometryFunction:g.value,geometryName:m.value,condition:_.value,freehand:v.value,freehandCondition:x.value,wrapX:S.value,features:b.value,geometryLayout:A.value,trace:F.value,traceSource:N.value})}const P=za(R()),{updateOpenLayersEventHandlers:O}=Jr(P,["drawstart","drawend"]);return ti([s,o,a,l,c,h,u,f,d,g,m,_,v,x,S,b,A,F,N],()=>{P.value.abortDrawing(),n?.removeInteraction(P.value),P.value=R(),O(),n?.addInteraction(P.value),n?.changed()}),Ji(()=>{n?.addInteraction(P.value)}),cn(()=>{n?.removeInteraction(P.value)}),fi("stylable",P),e({draw:P.value}),(L,T)=>qt(L.$slots,"default")}}),xM=et({inheritAttrs:!1,__name:"OlInteractionModify",props:{condition:{type:Function},deleteCondition:{type:Function},insertVertexCondition:{type:Function},pixelTolerance:{},style:{type:[Object,Array,Function]},source:{},hitDetection:{type:Boolean},features:{},wrapX:{type:Boolean},snapToPointer:{type:Boolean}},emits:["change","error","propertychange","modifystart","modifyend"],setup(i,{expose:e}){const t=i,n=ft("map"),r=ft("vectorSource",null),{source:s,features:o,condition:a,deleteCondition:l,insertVertexCondition:c,pixelTolerance:h,wrapX:u,hitDetection:f,snapToPointer:d}=Hd(t);function g(){return s?.value||o.value||console.error(`[Vue3-OpenLayers Error] OlInteractionModify: Modify interactions needs either a source or features to work.
808
- Please provide either the props 'source' or 'feature' or use the component with an '<OlSourceVector>' component.`),new lk({source:s.value||r?.value,features:o.value,condition:a.value,deleteCondition:l.value,insertVertexCondition:c.value,pixelTolerance:h.value,wrapX:u.value,hitDetection:f.value,snapToPointer:d.value})}let m=g();return Jr(m,["modifystart","modifyend"]),ti([a,l,c,h,u,f,d],()=>{m.dispose(),n?.removeInteraction(m),m=g(),n?.addInteraction(m),n?.changed()}),Ji(()=>{n?.addInteraction(m)}),cn(()=>{n?.removeInteraction(m)}),fi("stylable",Zi(m)),e({modify:m}),(_,v)=>qt(_.$slots,"default")}}),wM=et({inheritAttrs:!1,__name:"OlInteractionPointer",props:{handleEvent:{type:Function},stopDown:{type:Function}},emits:["change","error","propertychange","down","move","up","drag","change:active"],setup(i,{expose:e,emit:t}){const n=i,r=t,s=ft("map"),o=Nn(n),a=za(new co({...o,handleDownEvent:l=>(r("down",l),!0),handleDragEvent:l=>(r("drag",l),!0),handleMoveEvent:l=>{r("move",l)},handleUpEvent:l=>(r("up",l),!0)}));return Jr(a,["change:active"]),ti(a,(l,c)=>{s?.removeInteraction(c),s?.addInteraction(l),s?.changed()}),Ji(()=>{s?.addInteraction(a.value)}),cn(()=>{s?.removeInteraction(a.value)}),e({pointer:a}),(l,c)=>qt(l.$slots,"default")}}),bM=et({__name:"OlInteractionSnap",props:{features:{},source:{},edge:{type:Boolean,default:!0},vertex:{type:Boolean,default:!0},intersection:{type:Boolean},pixelTolerance:{},segmenters:{}},setup(i,{expose:e}){const t=i,n=ft("map"),r=ft("vectorSource"),s=Nn(t),o=()=>new mk({...s,source:t.source||r?.value});let a=o();return ti(s,()=>{n?.removeInteraction(a),a=o(),n?.addInteraction(a),n?.changed()}),Ji(()=>{n?.addInteraction(a)}),cn(()=>{n?.removeInteraction(a)}),e({snap:a}),(l,c)=>qt(l.$slots,"default")}}),EM=et({inheritAttrs:!1,__name:"OlInteractionTransform",props:{filter:{},layers:{},features:{},addCondition:{},hitTolerance:{},translateFeature:{type:Boolean,default:!0},translate:{type:Boolean,default:!0},translateBBox:{type:Boolean},stretch:{type:Boolean,default:!0},scale:{type:Boolean,default:!0},rotate:{type:Boolean,default:!0},noFlip:{type:Boolean},selection:{type:Boolean,default:zo},keepAspectRatio:{type:Function,default:Rc},modifyCenter:{},enableRotatedTransform:{type:Boolean},keepRectangle:{type:Boolean},style:{},pointRadius:{}},emits:["change","error","propertychange","select","rotatestart","rotating","rotateend","translatestart","translating","translateend","scalestart","scaling","scaleend"],setup(i,{expose:e}){const t=i,n=ft("map"),r=Nn(t);function s(){return new iA(r)}const o=za(s()),{updateOpenLayersEventHandlers:a}=Jr(o,["select","rotatestart","rotating","rotateend","translatestart","translating","translateend","scalestart","scaling","scaleend"]);return ti(o,(l,c)=>{n?.removeInteraction(c),o.value=s(),a(),n?.addInteraction(l),n?.changed()}),Ji(()=>{n?.addInteraction(o.value)}),cn(()=>{n?.removeInteraction(o.value)}),fi("stylable",o),e({transform:o.value}),(l,c)=>qt(l.$slots,"default")}}),SM=et({__name:"OlInteractionMouseWheelZoom",props:{condition:{},onFocusOnly:{type:Boolean},maxDelta:{},duration:{},timeout:{},useAnchor:{type:Boolean,default:!0},constrainResolution:{type:Boolean}},setup(i,{expose:e}){const t=i,n=ft("map"),r=Nn(t),s=qi(()=>new Ry(r));return ti(s,(o,a)=>{n?.removeInteraction(a),n?.addInteraction(o),n?.changed()}),Ji(()=>{n?.getInteractions().forEach(o=>{o instanceof Ry&&n?.removeInteraction(o)}),n?.addInteraction(s.value)}),cn(()=>{n?.removeInteraction(s.value)}),e({mouseWheelZoom:s}),(o,a)=>qt(o.$slots,"default")}}),TM=et({inheritAttrs:!1,__name:"OlInteractionSynchronize",props:{maps:{default:()=>[]}},setup(i,{expose:e}){const t=i,n=ft("map"),r=Nn(t),s=qi(()=>new yk({...r}));return ti(s,async(o,a)=>{a&&n?.removeInteraction(a),await pd(),n?.getTargetElement()&&(n.addInteraction(o),n.changed())},{immediate:!1}),Ji(async()=>{await pd(),n?.getTargetElement()&&n.addInteraction(s.value)}),cn(()=>{n?.removeInteraction(s.value)}),e({synchronize:s}),(o,a)=>qt(o.$slots,"default")}});function pS(i,e){i.component("OlInteractionClusterSelect",dM),i.component("OlInteractionDragBox",gM),i.component("OlInteractionDragRotate",pM),i.component("OlInteractionDragRotateAndZoom",mM),i.component("OlInteractionLink",_M),i.component("OlInteractionSelect",yM),i.component("OlInteractionDraw",vM),i.component("OlInteractionModify",xM),i.component("OlInteractionPointer",wM),i.component("OlInteractionSnap",bM),i.component("OlInteractionTransform",EM),i.component("OlInteractionMouseWheelZoom",SM),i.component("OlInteractionSynchronize",TM),e&&i.provide("ol-options",e)}const Bp=Object.freeze(Object.defineProperty({__proto__:null,OlInteractionClusterSelect:dM,OlInteractionDragBox:gM,OlInteractionDragRotate:pM,OlInteractionDragRotateAndZoom:mM,OlInteractionDraw:vM,OlInteractionLink:_M,OlInteractionModify:xM,OlInteractionMouseWheelZoom:SM,OlInteractionPointer:wM,OlInteractionSelect:yM,OlInteractionSnap:bM,OlInteractionSynchronize:TM,OlInteractionTransform:EM,default:pS,install:pS},Symbol.toStringTag,{value:"Module"}));function th(i,e){const t=ft("map"),n=ft("vectorLayer"),r=Nn(e),s=qi(()=>new i(r));return fi("animation",s),{map:t,vectorLayer:n,animation:s,properties:r}}const L$={duration:1e3,revers:!1,repeat:0,easing:Va};function ih(i){return{...L$,...i}}ih({side:"top",speed:0});ih();ih();ih();ih();ih();ih();const jp={name:"EPSG:28992",def:"+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=565.417,50.3319,465.552,-0.398957,0.343988,-1.8774,4.0725 +units=m +no_defs",extent:[-285401.92,22598.08,595401.92,903401.92]},C$={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor"};function A$(i,e){return vt(),Yt("svg",C$,[...e[0]||(e[0]=[ci("path",{fill:"none",d:"M0 0h24v24H0z"},null,-1),ci("path",{d:"m20.5 3-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5M10 5.47l4 1.4v11.66l-4-1.4zm-5 .99 3-1.01v11.7l-3 1.16zm14 11.08-3 1.01V6.86l3-1.16z"},null,-1)])])}const P$={render:A$},M$={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24"};function R$(i,e){return vt(),Yt("svg",M$,[...e[0]||(e[0]=[ci("path",{fill:"none",d:"M0 0h24v24H0z"},null,-1),ci("path",{fill:"currentColor",d:"m11.99 18.54-7.37-5.73L3 14.07l9 7 9-7-1.63-1.27zM12 16l7.36-5.73L21 9l-9-7-9 7 1.63 1.27zm0-11.47L17.74 9 12 13.47 6.26 9z"},null,-1)])])}const I$={render:R$},N$={xmlns:"http://www.w3.org/2000/svg",width:"10",height:"10"};function F$(i,e){return vt(),Yt("svg",N$,[...e[0]||(e[0]=[ci("path",{fill:"#000","fill-rule":"evenodd",d:"M4 10h2V6h4V4H6V0H4v4H0v2h4z"},null,-1)])])}const O$={render:F$},D$={xmlns:"http://www.w3.org/2000/svg",width:"10",height:"2"};function k$(i,e){return vt(),Yt("svg",D$,[...e[0]||(e[0]=[ci("path",{fill:"#000","fill-rule":"evenodd",d:"M10 2V0H0v2z"},null,-1)])])}const G$={render:k$},B$={class:"wrapper"},j$=["id","checked","onClick"],U$=["for"],z$={class:"layer"},q$=["checked"],V$=et({__name:"BaseLayers",props:{baseLayers:{},selectedBaseLayerId:{}},emits:["selectBaseLayer"],setup(i,{emit:e}){const t=i,n=e,r=qi(()=>t.selectedBaseLayerId===null),s=o=>{if(!o){n("selectBaseLayer",null);return}t.selectedBaseLayerId!==o.options.identifier&&n("selectBaseLayer",o.options.identifier)};return(o,a)=>(vt(),Yt("div",B$,[ci("ul",null,[(vt(!0),Yt(Xn,null,f0(i.baseLayers,l=>(vt(),Yt("li",{key:l.options.identifier,class:"layer"},[ci("input",{id:l.options.identifier,type:"radio",name:"baseLayer",checked:t.selectedBaseLayerId===l.options.identifier,onClick:()=>s(l)},null,8,j$),ci("label",{for:l.options.identifier},hm(l.options.title),9,U$)]))),128)),ci("li",z$,[ci("input",{id:"baseLayer_none",type:"radio",name:"baseLayer",checked:r.value,onClick:a[0]||(a[0]=()=>s(null))},null,8,q$),a[1]||(a[1]=ci("label",{for:"baseLayer_none"},"Geen",-1))])])]))}}),C5=(i,e)=>{const t=i.__vccOpts||i;for(const[n,r]of e)t[n]=r;return t},$$=C5(V$,[["__scopeId","data-v-7a503b81"]]),W$={class:"wrapper"},H$={key:0},X$={class:"layer-control"},K$=["checked","onChange"],Y$={class:"layer-title"},Z$=et({__name:"Layers",props:{toggleableLayers:{},visibleToggleableLayers:{}},emits:["toggleLayer"],setup(i,{emit:e}){const t=e,n=r=>{t("toggleLayer",r)};return(r,s)=>(vt(),Yt("div",W$,[i.toggleableLayers.length>0?(vt(),Yt("ul",H$,[(vt(!0),Yt(Xn,null,f0(i.toggleableLayers,o=>(vt(),Yt("li",{key:"toggle-"+o.options.identifier,class:"layer"},[ci("label",X$,[ci("input",{type:"checkbox",checked:i.visibleToggleableLayers.has(o.options.identifier),onChange:a=>n(o.options.identifier),class:"layer-checkbox"},null,40,K$),ci("span",Y$,hm(o.options.title),1)])]))),128))])):Xt("",!0)]))}}),J$=C5(Z$,[["__scopeId","data-v-16f7d1b3"]]),Q$={class:"map-container"},eW={class:"bottom-left-panels"},tW={key:0,class:"layers-control"},iW=["aria-expanded"],nW={class:"bottom-right-panels"},rW={key:0,class:"base-layers-control"},sW=["aria-expanded"],oW={class:"zoom-panel"},aW=et({__name:"Map",props:{layers:{default:()=>[]},baseLayers:{default:()=>[]},toggleableLayers:{default:()=>[]},interactions:{},zoom:{default:10},center:{default:()=>[12e4,487e3]}},emits:["featureSelected","featureDeselected","featureModified","featureDrawn"],setup(i,{expose:e,emit:t}){const n=i,r=t,s=Zi(),o=Zi(),a=Zi({}),l=Zi({}),c=Zi(!1),h=Zi(!1),u=Zi(null),f=Zi(new Set),d=Zi(new globalThis.Map),g=B=>{if(!B)return;if(B instanceof Li||typeof B=="function")return B;const V={};return B["fill-color"]&&(V.fill=new cr({color:B["fill-color"]})),(B["stroke-color"]||B["stroke-width"])&&(V.stroke=new xn({color:B["stroke-color"]||"#3399CC",width:B["stroke-width"]||1.25})),(B["circle-radius"]||B["circle-fill-color"]||B["circle-stroke-color"])&&(V.image=new $l({radius:B["circle-radius"]||5,fill:B["circle-fill-color"]?new cr({color:B["circle-fill-color"]}):void 0,stroke:B["circle-stroke-color"]||B["circle-stroke-width"]?new xn({color:B["circle-stroke-color"]||"#3399CC",width:B["circle-stroke-width"]||1.25}):void 0})),new Li(V)},m=qi(()=>n.layers.map(B=>{if(B.type==="wmts"){const V=d.value.get(B.options.identifier);return{type:"wmts",identifier:B.options.identifier,options:V||null}}else return B.type==="wms"?{type:"wms",identifier:B.options.identifier,wmsUrl:B.options.url,layerName:B.options.layer}:{type:"vector",identifier:B.options.identifier,options:B.options,style:B.options.style}})),_=qi(()=>{if(!u.value||!n.baseLayers)return null;const B=n.baseLayers.find(V=>V.options.identifier===u.value);return!B||B.type==="wmts"&&!d.value.get(B.options.identifier)?null:B}),v=qi(()=>_.value&&d.value.get(_.value.options.identifier)||null),x=qi(()=>(n.toggleableLayers||[]).filter(B=>f.value.has(B.options.identifier)).map(B=>B.type==="wms"?{type:"wms",identifier:B.options.identifier,wmsUrl:B.options.url,layerName:B.options.layer}:B.type==="wmts"?{type:"wmts",identifier:B.options.identifier,wmtsOptions:d.value.get(B.options.identifier)}:B.type==="vector"?{type:"vector",identifier:B.options.identifier,options:B.options,style:B.options.style}:{...B,identifier:B.options.identifier})),S=qi(()=>{const B=[];if(_.value){const ne=_.value;ne.type==="wmts"?B.push({type:"wmts",identifier:ne.options.identifier,wmtsOptions:v.value,zIndex:0}):ne.type==="wms"?B.push({type:"wms",identifier:ne.options.identifier,wmsUrl:ne.options.url,layerName:ne.options.layer,zIndex:0}):ne.type==="vector"&&B.push({type:"vector",identifier:ne.options.identifier,options:ne.options,style:ne.options.style,zIndex:0})}const V=x.value.map((ne,ae)=>({...ne,zIndex:ae+10})),te=m.value.map((ne,ae)=>({...ne,zIndex:V.length+ae+20}));return[...B,...V,...te]}),b=()=>{c.value=!c.value},A=()=>{h.value=!h.value},F=B=>{f.value.has(B)?f.value.delete(B):f.value.add(B)},N=B=>{u.value=B},R=()=>{if(o.value?.view){const B=o.value.view,V=B.getZoom(),te=B.getMaxZoom();typeof V=="number"&&V<te&&B.animate({zoom:V+1,duration:250})}},P=()=>{if(o.value?.view){const B=o.value.view,V=B.getZoom(),te=B.getMinZoom();typeof V=="number"&&V>te&&B.animate({zoom:V-1,duration:250})}},O=async(B,V,te)=>{try{const ae=await(await fetch(B)).text(),I=new c9().read(ae),U=te?[te,"image/jpeg","image/png"]:["image/png","image/jpeg"];let K=null;for(const ie of U)try{if(K=m4(I,{layer:V,matrixSet:"EPSG:28992",projection:"EPSG:28992",format:ie,crossOrigin:"anonymous",style:"default"}),K)break}catch(re){console.warn(`Format ${ie} failed for layer ${V}:`,re)}return K&&(K.style="default"),K}catch(ne){return console.error("Failed to fetch WMTS capabilities:",ne),null}},L=B=>{if(!B||B.length===0||!o.value?.view)return;const V=[];for(const te of B)if(te.type==="Point")V.push(te.coordinates);else if(te.type==="Polygon"){const ne=te.coordinates;for(const ae of ne)for(const I of ae)V.push(I)}if(V.length>0){const te=Ui(V);o.value.view.fit(te,{padding:[50,50,50,50]})}};Ji(async()=>{if(!u.value&&n.baseLayers&&n.baseLayers.length>0){const B=n.baseLayers[0];B?.options.identifier&&(u.value=B.options.identifier)}for(const B of n.layers.filter(V=>V.type==="wmts"))if(B.options.url){const V=await O(B.options.url,B.options.identifier,B.options.format);d.value.set(B.options.identifier,V)}if(n.baseLayers){for(const B of n.baseLayers.filter(V=>V.type==="wmts"))if(B.options.url){const V=await O(B.options.url,B.options.identifier,B.options.format);d.value.set(B.options.identifier,V)}}if(n.toggleableLayers){for(const B of n.toggleableLayers.filter(V=>V.type==="wmts"))if(B.options.url){const V=await O(B.options.url,B.options.identifier,B.options.format);d.value.set(B.options.identifier,V)}}});const T=qi(()=>{if(!n.interactions?.selectable?.layers||n.interactions.selectable.layers.length===0)return;const B=n.interactions.selectable.layers;return(V,te)=>{if(!te)return!1;const ne=te.get("name");return B.includes(ne)}}),C=qi(()=>g(n.interactions?.selectable?.style)),D=B=>{r("featureSelected",B)},W=B=>{r("featureModified",{features:B.features.getArray()})},$=B=>{r("featureDrawn",{feature:B.feature})};return e({map:s,view:o,fitToFeatures:L}),(B,V)=>(vt(),Yt("div",Q$,[Ri(ji(Pp).OlMap,{ref_key:"mapRef",ref:s,style:{width:"100%",height:"100%"},controls:[]},{default:ba(()=>[Ri(ji(Pp).OlProjectionRegister,{projectionName:ji(jp).name,projectionDef:ji(jp).def,extent:ji(jp).extent},null,8,["projectionName","projectionDef","extent"]),Ri(ji(Pp).OlView,{ref_key:"viewRef",ref:o,center:i.center,zoom:i.zoom,projection:ji(jp).name},null,8,["center","zoom","projection"]),n.interactions?.selectable?.enabled?(vt(),Mr(ji(Bp).OlInteractionSelect,{key:0,multi:!1,filter:T.value,style:ud(C.value),onSelect:D},null,8,["filter","style"])):Xt("",!0),(vt(!0),Yt(Xn,null,f0(S.value,te=>(vt(),Yt(Xn,{key:te.identifier},[te.type==="wms"?(vt(),Mr(ji(D_).OlTileLayer,{key:0,zIndex:te.zIndex},{default:ba(()=>[Ri(ji(k_).OlSourceTileWMS,{url:te.wmsUrl,layers:te.layerName||"",params:{LAYERS:te.layerName||"",TILED:!0},serverType:"geoserver",crossOrigin:"anonymous"},null,8,["url","layers","params"])]),_:2},1032,["zIndex"])):te.type==="wmts"&&(te.wmtsOptions||te.options)?(vt(),Mr(ji(D_).OlTileLayer,{key:1,zIndex:te.zIndex},{default:ba(()=>[Ri(ji(k_).OlSourceWMTS,wT({ref_for:!0},te.wmtsOptions||te.options,{styles:"default"}),null,16)]),_:2},1032,["zIndex"])):te.type==="vector"?(vt(),Mr(ji(D_).OlVectorLayer,{key:2,zIndex:te.zIndex,style:ud(te.style),properties:{name:te.identifier},ref_for:!0,ref:ne=>{ne&&(a.value[te.identifier]=ne)}},{default:ba(()=>[Ri(ji(k_).OlSourceVector,{ref_for:!0,ref:ne=>{ne&&(l.value[te.identifier]=ne)}},{default:ba(()=>[(vt(!0),Yt(Xn,null,f0(te.options?.features,ne=>(vt(),Mr(ji(Pp).OlFeature,{key:`${te.identifier}-${ne.coordinates}`,properties:ne.properties||{}},{default:ba(()=>[ne.type==="Point"?(vt(),Mr(ji(dS).OlGeomPoint,{key:0,coordinates:ne.coordinates},null,8,["coordinates"])):Xt("",!0),ne.type==="Polygon"?(vt(),Mr(ji(dS).OlGeomPolygon,{key:1,coordinates:ne.coordinates},null,8,["coordinates"])):Xt("",!0)]),_:2},1032,["properties"]))),128)),n.interactions?.snap?.enabled&&(n.interactions.draw?.enabled||n.interactions.modify?.enabled)&&(n.interactions.draw?.layer===te.identifier||n.interactions.modify?.layer===te.identifier)&&l.value[n.interactions.snap.targetLayer]?.source?(vt(),Mr(ji(Bp).OlInteractionSnap,{key:`snap-${n.interactions?.snap?.enabled}-${n.interactions?.draw?.enabled}-${n.interactions?.draw?.layer}-${n.interactions?.modify?.enabled}-${n.interactions?.modify?.layer}`,source:l.value[n.interactions.snap.targetLayer]?.source,pixelTolerance:n.interactions?.snap?.pixelTolerance||8},null,8,["source","pixelTolerance"])):Xt("",!0),n.interactions?.modify?.enabled&&n.interactions.modify.layer===te.identifier&&l.value[te.identifier]?.source?(vt(),Mr(ji(Bp).OlInteractionModify,{key:1,source:l.value[te.identifier]?.source,onModifyend:W},null,8,["source"])):Xt("",!0),n.interactions?.draw?.enabled&&n.interactions.draw.layer===te.identifier&&l.value[te.identifier]?.source?(vt(),Mr(ji(Bp).OlInteractionDraw,{key:2,source:l.value[te.identifier]?.source,type:n.interactions.draw.type||"Point",onDrawend:$},null,8,["source","type"])):Xt("",!0)]),_:2},1536)]),_:2},1032,["zIndex","style","properties"])):Xt("",!0)],64))),128))]),_:1},512),ci("div",eW,[i.toggleableLayers&&i.toggleableLayers.length>0?(vt(),Yt("div",tW,[ci("button",{class:fd(["iconbutton",{isActive:h.value}]),"aria-label":"Toon lagen","aria-expanded":h.value,onClick:A},[Ri(ji(I$))],10,iW),Ri(Pw,{name:"fade"},{default:ba(()=>[h.value?(vt(),Mr(J$,{key:0,toggleableLayers:i.toggleableLayers||[],visibleToggleableLayers:f.value,onToggleLayer:F},null,8,["toggleableLayers","visibleToggleableLayers"])):Xt("",!0)]),_:1})])):Xt("",!0)]),ci("div",nW,[n.baseLayers&&n.baseLayers.length>0?(vt(),Yt("div",rW,[ci("button",{class:fd(["iconbutton",{isActive:c.value}]),"aria-label":"Toon basislagen","aria-expanded":c.value,onClick:b},[Ri(ji(P$))],10,sW),Ri(Pw,{name:"fade"},{default:ba(()=>[c.value?(vt(),Mr($$,{key:0,baseLayers:n.baseLayers,selectedBaseLayerId:u.value,onSelectBaseLayer:N},null,8,["baseLayers","selectedBaseLayerId"])):Xt("",!0)]),_:1})])):Xt("",!0),ci("div",oW,[ci("button",{class:"iconbutton","aria-label":"Zoom in",onClick:R},[Ri(ji(O$))]),ci("button",{class:"iconbutton","aria-label":"Zoom out",onClick:P},[Ri(ji(G$))])])])]))}}),lW=C5(aW,[["__scopeId","data-v-843b95b9"]]),mS=[{type:"Polygon",coordinates:[[[116044.06969709918,495387.60845237196],[116036.42889836353,495385.8300816352],[116041.44790271131,495365.34220878844],[116048.77752176934,495366.9938547696],[116044.06969709918,495387.60845237196]]],properties:{id:"1"}}],cW=[{type:"Point",coordinates:[116039.55578897425,495373.06592906645],properties:{id:"1",geplaatst:!1}},{type:"Point",coordinates:[116045.62957295871,495380.7780762627],properties:{id:"2",geplaatst:!0}},{type:"Point",coordinates:[116040.36077535816,495369.7799269963],properties:{id:"3",geplaatst:!1}}],hW={class:"example-container"},uW={class:"map-container"},fW={class:"interaction-control"},dW={key:0,class:"message-display"},gW=et({__name:"Example",setup(i){const e=[{type:"vector",options:{identifier:"pand",title:"Panden",features:mS,style:{"fill-color":"rgba(173, 216, 230, 0.6)","stroke-color":"blue","stroke-width":2}}},{type:"vector",options:{identifier:"meetbouten",title:"Meetbouten",features:cW,style:{"circle-radius":10,"circle-fill-color":["case",["==",["get","geplaatst"],!0],"green","blue"],"circle-stroke-color":"blue","circle-stroke-width":2}}}],t=[{type:"wmts",options:{identifier:"referentiekaart",title:"Referentiekaart",url:"https://tiles.zaanstad.nl/mapproxy/service?REQUEST=GetCapabilities&service=wmts"}},{type:"wmts",options:{identifier:"BGT_lijngericht",title:"BGT lijngericht",url:"https://tiles.zaanstad.nl/mapproxy/service?REQUEST=GetCapabilities&service=wmts"}},{type:"wmts",options:{identifier:"lufo-actueel",title:"Luchtfoto actueel",url:"https://tiles.zaanstad.nl/mapproxy/service?REQUEST=GetCapabilities&service=wmts",format:"image/jpeg"}}],n=[{type:"wms",options:{identifier:"bag-pand-bouwjaar",title:"BAG Pand Bouwjaar",url:"https://maps.zaanstad.nl/geoserver/wms",layer:"geo:bag_pand_bouwjaar"}}],r=Zi(""),s=Zi(null),o=Zi(""),a=qi(()=>{const u=r.value==="select",f=r.value==="draw",d=r.value==="modify";return{selectable:{enabled:u,layers:["meetbouten"],style:{"circle-radius":8,"circle-fill-color":"rgba(173, 216, 230, 0.6)","circle-stroke-color":"red","circle-stroke-width":3}},modify:{enabled:d,layer:"meetbouten"},draw:{enabled:f,layer:"meetbouten"},snap:{enabled:f||d,layer:"meetbouten",targetLayer:"pand",pixelTolerance:10}}}),l=u=>{o.value=`Feature getekend: ${JSON.stringify(u.feature.getGeometry().getCoordinates())}`,console.log("Feature getekend:",u.feature)},c=u=>{o.value=`Feature geselecteerd: ${u.selected.length} feature(s)`,console.log("Feature geselecteerd:",u.selected,u.selected[0]?.getProperties())},h=u=>{o.value=`Feature gewijzigd: ${u.features.length} feature(s)`,console.log("Feature gewijzigd",u.features)};return Ji(()=>{s.value&&s.value.fitToFeatures(mS)}),(u,f)=>(vt(),Yt("div",hW,[ci("div",uW,[Ri(lW,{ref_key:"mapRef",ref:s,baseLayers:t,toggleableLayers:n,layers:e,interactions:a.value,onFeatureSelected:c,onFeatureDrawn:l,onFeatureModified:h},null,8,["interactions"])]),ci("div",fW,[f[2]||(f[2]=ci("label",{for:"interaction-mode"},"Stel interactie in",-1)),iI(ci("select",{id:"interaction-mode","onUpdate:modelValue":f[0]||(f[0]=d=>r.value=d)},[...f[1]||(f[1]=[ci("option",{value:""},"---",-1),ci("option",{value:"select"},"Selecteren",-1),ci("option",{value:"draw"},"Toevoegen",-1),ci("option",{value:"modify"},"Wijzigen",-1)])],512),[[I8,r.value]])]),o.value?(vt(),Yt("div",dW,hm(o.value),1)):Xt("",!0)]))}});O8(gW).mount("#app");export{vW as L,bi as _,tC as a,xW as b,Mp as c,YW as g};