diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 9962722c..cb220fe5 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -7,6 +7,9 @@ on: - 'main' tags: - '*' + paths: + - 'src/**' + - 'docker/**' release: types: [ published ] diff --git a/README.md b/README.md index 15e3337f..94f6e7f2 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@
0?-A:A),F!==void 0){let st=K-F;if(st+=st>A?-2*A:st<-A?2*A:0,Math.abs(st)>o)return null}F=K;const Z=G;let Q=0;for(;G 0&&n.push(`
+`,""),n.push(t,""),n}function lf(n,t,e){return e%2===0&&(n+=t),n}class hf{constructor(t,e,i,s,r){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=s.instructions,this.coordinates=s.coordinates,this.coordinateCache_={},this.renderedTransform_=Zt(),this.hitDetectionInstructions=s.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=s.fillStates||{},this.strokeStates=s.strokeStates||{},this.textStates=s.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=r?new ll:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,s){const r=t+e+i+s;if(this.labels_[r])return this.labels_[r];const o=s?this.strokeStates[s]:null,a=i?this.fillStates[i]:null,l=this.textStates[e],h=this.pixelRatio,c=[l.scale[0]*h,l.scale[1]*h],u=l.justify?zn[l.justify]:Fs(Array.isArray(t)?t[0]:t,l.textAlign||$i),d=s&&o.lineWidth?o.lineWidth:0,f=Array.isArray(t)?t:String(t).split(`
+`).reduce(af,[]),{width:g,height:m,widths:_,heights:p,lineWidths:E}=vu(l,f),C=g+d,y=[],x=(C+2)*c[0],R=(m+d)*c[1],I={width:x<0?Math.floor(x):Math.ceil(x),height:R<0?Math.floor(R):Math.ceil(R),contextInstructions:y};(c[0]!=1||c[1]!=1)&&y.push("scale",c),s&&(y.push("strokeStyle",o.strokeStyle),y.push("lineWidth",d),y.push("lineCap",o.lineCap),y.push("lineJoin",o.lineJoin),y.push("miterLimit",o.miterLimit),y.push("setLineDash",[o.lineDash]),y.push("lineDashOffset",o.lineDashOffset)),i&&y.push("fillStyle",a.fillStyle),y.push("textBaseline","middle"),y.push("textAlign","center");const T=.5-u;let v=u*C+T*d;const L=[],k=[];let b=0,A=0,M=0,Y=0,F;for(let G=0,P=f.length;G t?t-h:r,y=o+c>e?e-c:o,x=g[3]+C*d[0]+g[1],R=g[0]+y*d[1]+g[2],I=p-g[3],T=E-g[0];(m||u!==0)&&(me[0]=I,pe[0]=I,me[1]=T,ee[1]=T,ee[0]=I+x,ie[0]=ee[0],ie[1]=T+R,pe[1]=ie[1]);let v;return u!==0?(v=he(Zt(),i,s,1,1,u,-i,-s),ht(v,me),ht(v,ee),ht(v,ie),ht(v,pe),Se(Math.min(me[0],ee[0],ie[0],pe[0]),Math.min(me[1],ee[1],ie[1],pe[1]),Math.max(me[0],ee[0],ie[0],pe[0]),Math.max(me[1],ee[1],ie[1],pe[1]),ii)):Se(Math.min(I,I+x),Math.min(T,T+R),Math.max(I,I+x),Math.max(T,T+R),ii),f&&(p=Math.round(p),E=Math.round(E)),{drawImageX:p,drawImageY:E,drawImageW:C,drawImageH:y,originX:h,originY:c,declutterBox:{minX:ii[0],minY:ii[1],maxX:ii[2],maxY:ii[3],value:_},canvasTransform:v,scale:d}}replayImageOrLabel_(t,e,i,s,r,o,a){const l=!!(o||a),h=s.declutterBox,c=a?a[2]*s.scale[0]/2:0;return h.minX-c<=e[0]&&h.maxX+c>=0&&h.minY-c<=e[1]&&h.maxY+c>=0&&(l&&this.replayTextBackground_(t,me,ee,ie,pe,o,a),Lu(t,s.canvasTransform,r,i,s.originX,s.originY,s.drawImageW,s.drawImageH,s.drawImageX,s.drawImageY,s.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=ht(this.renderedTransform_,[0,0]),s=512*this.pixelRatio;t.save(),t.translate(i[0]%s,i[1]%s),e!==1&&t.scale(e,e),t.rotate(this.viewRotation_)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,s){const r=this.textStates[e],o=this.createLabel(t,e,s,i),a=this.strokeStates[i],l=this.pixelRatio,h=Fs(Array.isArray(t)?t[0]:t,r.textAlign||$i),c=zn[r.textBaseline||Fn],u=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*r.scale[0],f=h*d+2*(.5-h)*u,g=c*o.height/l+2*(.5-c)*u;return{label:o,anchorX:f,anchorY:g}}execute_(t,e,i,s,r,o,a,l){const h=this.zIndexContext_;let c;this.pixelCoordinates_&&ve(i,this.renderedTransform_)?c=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),c=Ie(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),Rh(this.renderedTransform_,i));let u=0;const d=s.length;let f=0,g,m,_,p,E,C,y,x,R,I,T,v,L,k=0,b=0;const A=this.coordinateCache_,M=this.viewRotation_,Y=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,F={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:M},G=this.instructions!=s||this.overlaps?0:200;let P,K,Z,Q;for(;u
-
+
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 52a6eb05..e0b0b3b4 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -97,8 +97,9 @@ LABEL maintainer="dselen@nerthus.nl"
# Install only the runtime dependencies
RUN apk add --no-cache \
iproute2 iptables \
- bash curl procps \
- tzdata wireguard-tools
+ bash curl procps openrc \
+ tzdata wireguard-tools envsubst
+SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Copy only the final binaries from the AWG builder stages
COPY --from=awg-go /usr/bin/amneziawg-go /usr/bin/amneziawg-go
@@ -107,6 +108,7 @@ COPY --from=awg-tools /workspace/awg-tools/src/wg-quick/linux.bash /usr/bin/awg-
# Environment variables
ARG wg_net="10.0.0.1"
+ARG wg_subn="24"
ARG wg_port="51820"
ENV TZ="Europe/Amsterdam" \
global_dns="9.9.9.9" \
@@ -117,32 +119,23 @@ ENV TZ="Europe/Amsterdam" \
# Create directories needed for operation
RUN mkdir /data /configs -p ${WGDASH}/src /etc/amnezia/amneziawg
-# Copy the python virtual environment from the pip-builder stage
+# Copy the venv and source files from local compiled locations or repos
COPY ./src ${WGDASH}/src
COPY --from=pip-builder /opt/wgdashboard/src/venv /opt/wgdashboard/src/venv
+COPY ./docker/wg0.conf.template /tmp/wg0.conf.template
+# Copy in the runtime script, essential.
+COPY ./docker/entrypoint.sh /entrypoint.sh
# First WireGuard interface template
-SHELL ["/bin/bash", "-o", "pipefail", "-c"]
-RUN out_adapt=$(ip -o -4 route show to default | awk '{print $NF}') \
- && echo -e "[Interface]\n\
-Address = ${wg_net}/24\n\
-PrivateKey =\n\
-PostUp = iptables -t nat -I POSTROUTING 1 -s ${wg_net}/24 -o ${out_adapt} -j MASQUERADE\n\
-PostUp = iptables -I FORWARD -i wg0 -o wg0 -j DROP\n\
-PreDown = iptables -t nat -D POSTROUTING -s ${wg_net}/24 -o ${out_adapt} -j MASQUERADE\n\
-PreDown = iptables -D FORWARD -i wg0 -o wg0 -j DROP\n\
-ListenPort = ${wg_port}\n\
-SaveConfig = true\n\
-DNS = ${global_dns}" > /configs/wg0.conf.template \
- && chmod 600 /configs/wg0.conf.template
+RUN export out_adapt=$(ip -o -4 route show to default | awk '{print $NF}') \
+ && envsubst < /tmp/wg0.conf.template > /configs/wg0.conf.template \
+ && chmod 600 /configs/wg0.conf.template \
+ && cat /configs/wg0.conf.template
# Set a healthcheck to determine the container its health
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD sh -c 'pgrep gunicorn > /dev/null && pgrep tail > /dev/null' || exit 1
-# Copy in the runtime script, essential.
-COPY ./docker/entrypoint.sh /entrypoint.sh
-
# Expose ports on the container
EXPOSE 10086
WORKDIR $WGDASH/src
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
index 5ffe9d4a..76ba02b4 100644
--- a/docker/entrypoint.sh
+++ b/docker/entrypoint.sh
@@ -217,8 +217,11 @@ start_and_monitor() {
echo "Starting WGDashboard directly with Gunicorn..."
[[ ! -d ${WGDASH}/src/log ]] && mkdir ${WGDASH}/src/log
+ [[ ! -d ${WGDASH}/src/download ]] && mkdir ${WGDASH}/src/download
${WGDASH}/src/venv/bin/gunicorn --config ${WGDASH}/src/gunicorn.conf.py
+ /usr/sbin/resolvconf -u
+
if [ $? -ne 0 ]; then
echo "Loading WGDashboard failed... Look above for details."
fi
diff --git a/docker/wg0.conf.template b/docker/wg0.conf.template
new file mode 100644
index 00000000..4d7779c0
--- /dev/null
+++ b/docker/wg0.conf.template
@@ -0,0 +1,8 @@
+[Interface]
+Address = ${wg_net}/24
+PrivateKey =
+PostUp = iptables -t nat -I POSTROUTING 1 -s ${wg_net}/24 -o ${out_adapt} -j MASQUERADE; iptables -I FORWARD -i wg0 -o wg0 -j DROP
+PreDown = iptables -t nat -D POSTROUTING -s ${wg_net}/24 -o ${out_adapt} -j MASQUERADE; iptables -D FORWARD -i wg0 -o wg0 -j DROP
+ListenPort = ${wg_port}
+SaveConfig = true
+DNS = ${global_dns}
diff --git a/src/dashboard.py b/src/dashboard.py
index f08c3d3f..ec57ef9d 100644
--- a/src/dashboard.py
+++ b/src/dashboard.py
@@ -1238,8 +1238,9 @@ def API_ping_getAllPeersIpAddress():
ip = ipaddress.ip_network(x, strict=False)
except ValueError as e:
app.logger.error(f"Failed to parse IP address of {p.id} - {c.Name}")
- if len(list(ip.hosts())) == 1:
- parsed.append(str(ip.hosts()[0]))
+ host = list(ip.hosts())
+ if len(host) == 1:
+ parsed.append(str(host[0]))
endpoint = p.endpoint.replace(" ", "").replace("(none)", "")
if len(p.name) > 0:
cips[f"{p.name} - {p.id}"] = {
diff --git a/src/modules/DashboardConfig.py b/src/modules/DashboardConfig.py
index 7fef8d05..8a910d5a 100644
--- a/src/modules/DashboardConfig.py
+++ b/src/modules/DashboardConfig.py
@@ -16,7 +16,7 @@ from .DashboardAPIKey import DashboardAPIKey
class DashboardConfig:
- DashboardVersion = 'v4.3.0.2'
+ DashboardVersion = 'v4.3.1'
ConfigurationPath = os.getenv('CONFIGURATION_PATH', '.')
ConfigurationFilePath = os.path.join(ConfigurationPath, 'wg-dashboard.ini')
diff --git a/src/modules/PeerJobLogger.py b/src/modules/PeerJobLogger.py
index 0c6834f4..9f121971 100644
--- a/src/modules/PeerJobLogger.py
+++ b/src/modules/PeerJobLogger.py
@@ -97,5 +97,5 @@ class PeerJobLogger:
def vacuum(self):
with self.engine.begin() as conn:
if conn.dialect.name == 'sqlite':
- print("[WGDashboard] SQLite Vacuuming PeerJogLogs Database")
+ print("[WGDashboard] SQLite Vacuuming PeerJobLogs Database")
conn.execute(db.text('VACUUM;'))
\ No newline at end of file
diff --git a/src/static/app/package-lock.json b/src/static/app/package-lock.json
index 7dfd7b6c..362fc23c 100644
--- a/src/static/app/package-lock.json
+++ b/src/static/app/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "app",
- "version": "4.3.0.2",
+ "version": "4.3.0.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "app",
- "version": "4.3.0.2",
+ "version": "4.3.0.3",
"dependencies": {
"@volar/language-server": "2.4.26",
"@vue/language-server": "3.1.8",
@@ -384,6 +384,7 @@
"integrity": "sha512-dfZeox66AvdPtb2lD8OsIIQh12Tp0GNCRUDfBHIKGpbmopZto2/A8nSpYYLoedPIHpqkeblZ/k8OV0Gy7PYuyQ==",
"license": "BSD-2-Clause",
"optional": true,
+ "peer": true,
"dependencies": {
"cross-dirname": "^0.1.0",
"debug": "^4.3.4",
@@ -404,6 +405,7 @@
"integrity": "sha512-Xr9F6z6up6Ws+NjzMCZc6WXg2YFRlrLP9NQDO3VQrWrfiojdhS56TzueT88ze0uBdCTwEIhQ3ptnmKeWGFAe0A==",
"license": "MIT",
"optional": true,
+ "peer": true,
"dependencies": {
"graceful-fs": "^4.2.0",
"jsonfile": "^6.0.1",
@@ -1111,7 +1113,8 @@
"version": "0.3.4",
"resolved": "https://registry.npmmirror.com/@kurkle/color/-/color-0.3.4.tgz",
"integrity": "sha512-M5UknZPHRu3DEDWoipU6sE8PdkZ6Z/S+v4dD+Ke8IaNlpdSQah50lz1KtcFBa2vsdOnwbbnxJwVM4wty6udA5w==",
- "license": "MIT"
+ "license": "MIT",
+ "peer": true
},
"node_modules/@malept/cross-spawn-promise": {
"version": "2.0.0",
@@ -2086,7 +2089,6 @@
"resolved": "https://registry.npmmirror.com/ajv/-/ajv-6.12.6.tgz",
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
"license": "MIT",
- "peer": true,
"dependencies": {
"fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0",
@@ -2892,7 +2894,8 @@
"resolved": "https://registry.npmmirror.com/cross-dirname/-/cross-dirname-0.1.0.tgz",
"integrity": "sha512-+R08/oI0nl3vfPcqftZRpytksBXDzOUveBq/NBVx0sUp1axwzPQrKinNx5yd5sxPu8j1wIy8AfnVQ+5eFdha6Q==",
"license": "MIT",
- "optional": true
+ "optional": true,
+ "peer": true
},
"node_modules/cross-spawn": {
"version": "7.0.6",
@@ -3078,7 +3081,6 @@
"resolved": "https://registry.npmmirror.com/dmg-builder/-/dmg-builder-26.0.12.tgz",
"integrity": "sha512-59CAAjAhTaIMCN8y9kD573vDkxbs1uhDcrFLHSgutYdPcGOU35Rf95725snvzEOy4BFB7+eLJ8djCNPmGwG67w==",
"license": "MIT",
- "peer": true,
"dependencies": {
"app-builder-lib": "26.0.12",
"builder-util": "26.0.11",
@@ -3244,6 +3246,7 @@
"integrity": "sha512-bO3y10YikuUwUuDUQRM4KfwNkKhnpVO7IPdbsrejwN9/AABJzzTQ4GeHwyzNSrVO+tEH3/Np255a3sVZpZDjvg==",
"hasInstallScript": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@electron/asar": "^3.2.1",
"debug": "^4.1.1",
@@ -3263,6 +3266,7 @@
"resolved": "https://registry.npmmirror.com/fs-extra/-/fs-extra-7.0.1.tgz",
"integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==",
"license": "MIT",
+ "peer": true,
"dependencies": {
"graceful-fs": "^4.1.2",
"jsonfile": "^4.0.0",
@@ -3277,6 +3281,7 @@
"resolved": "https://registry.npmmirror.com/jsonfile/-/jsonfile-4.0.0.tgz",
"integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==",
"license": "MIT",
+ "peer": true,
"optionalDependencies": {
"graceful-fs": "^4.1.6"
}
@@ -3286,6 +3291,7 @@
"resolved": "https://registry.npmmirror.com/universalify/-/universalify-0.1.2.tgz",
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
"license": "MIT",
+ "peer": true,
"engines": {
"node": ">= 4.0.0"
}
@@ -6585,7 +6591,6 @@
"version": "4.0.3",
"inBundle": true,
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=12"
},
@@ -6991,7 +6996,6 @@
"resolved": "https://registry.npmmirror.com/pinia/-/pinia-3.0.3.tgz",
"integrity": "sha512-ttXO/InUULUXkMHpTdp9Fj4hLpD/2AoJdmAbAeW2yu1iy1k+pkFekQXw5VpC0/5p51IOR/jDaDRfRWRnMMsGOA==",
"license": "MIT",
- "peer": true,
"dependencies": {
"@vue/devtools-api": "^7.7.2"
},
@@ -7090,6 +7094,7 @@
"integrity": "sha512-b9Eb8h2eVqNE8edvKdwqkrY6O7kAwmI8kcnBv1NScolYJbo59XUF0noFq+lxbC1yN20bmC0WBEbDC5H/7ASb0A==",
"license": "MIT",
"optional": true,
+ "peer": true,
"dependencies": {
"commander": "^9.4.0"
},
@@ -7106,6 +7111,7 @@
"integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==",
"license": "MIT",
"optional": true,
+ "peer": true,
"engines": {
"node": "^12.20.0 || >=14"
}
@@ -7829,6 +7835,7 @@
"resolved": "https://registry.npmmirror.com/temp/-/temp-0.9.4.tgz",
"integrity": "sha512-yYrrsWnrXMcdsnu/7YMYAofM1ktpL5By7vZhf15CrXijWWrEYZks5AXBudalfSWJLlnen/QUJUB5aoB0kqZUGA==",
"license": "MIT",
+ "peer": true,
"dependencies": {
"mkdirp": "^0.5.1",
"rimraf": "~2.6.2"
@@ -7852,6 +7859,7 @@
"resolved": "https://registry.npmmirror.com/mkdirp/-/mkdirp-0.5.6.tgz",
"integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
"license": "MIT",
+ "peer": true,
"dependencies": {
"minimist": "^1.2.6"
},
@@ -7865,6 +7873,7 @@
"integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==",
"deprecated": "Rimraf versions prior to v4 are no longer supported",
"license": "ISC",
+ "peer": true,
"dependencies": {
"glob": "^7.1.3"
},
@@ -7945,7 +7954,6 @@
"resolved": "https://registry.npmmirror.com/typescript/-/typescript-5.9.2.tgz",
"integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==",
"license": "Apache-2.0",
- "peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@@ -8057,7 +8065,6 @@
"integrity": "sha512-BxAKBWmIbrDgrokdGZH1IgkIk/5mMHDreLDmCJ0qpyJaAteP8NvMhkwr/ZCQNqNH97bw/dANTE9PDzqwJghfMQ==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"esbuild": "^0.25.0",
"fdir": "^6.5.0",
@@ -8360,7 +8367,6 @@
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.24.tgz",
"integrity": "sha512-uTHDOpVQTMjcGgrqFPSb8iO2m1DUvo+WbGqoXQz8Y1CeBYQ0FXf2z1gLRaBtHjlRz7zZUBHxjVB5VTLzYkvftg==",
"license": "MIT",
- "peer": true,
"dependencies": {
"@vue/compiler-dom": "3.5.24",
"@vue/compiler-sfc": "3.5.24",
diff --git a/src/static/app/package.json b/src/static/app/package.json
index 5b534233..0c68e6a8 100644
--- a/src/static/app/package.json
+++ b/src/static/app/package.json
@@ -1,6 +1,6 @@
{
"name": "app",
- "version": "4.3.0.3",
+ "version": "4.3.1",
"private": true,
"type": "module",
"module": "es2022",
diff --git a/src/static/app/src/components/configurationComponents/peerScheduleJobsComponents/schedulePeerJob.vue b/src/static/app/src/components/configurationComponents/peerScheduleJobsComponents/schedulePeerJob.vue
index 71342c81..291043cd 100644
--- a/src/static/app/src/components/configurationComponents/peerScheduleJobsComponents/schedulePeerJob.vue
+++ b/src/static/app/src/components/configurationComponents/peerScheduleJobsComponents/schedulePeerJob.vue
@@ -3,7 +3,7 @@ import ScheduleDropdown from "@/components/configurationComponents/peerScheduleJ
import {ref} from "vue";
import {DashboardConfigurationStore} from "@/stores/DashboardConfigurationStore.js";
import {fetchPost} from "@/utilities/fetch.js";
-import VueDatePicker from "@vuepic/vue-datepicker";
+import { VueDatePicker } from "@vuepic/vue-datepicker";
import dayjs from "dayjs";
import LocaleText from "@/components/text/localeText.vue";
diff --git a/src/static/app/src/components/configurationComponents/peerShareLinkModal.vue b/src/static/app/src/components/configurationComponents/peerShareLinkModal.vue
index 7fc4a352..310d45a5 100644
--- a/src/static/app/src/components/configurationComponents/peerShareLinkModal.vue
+++ b/src/static/app/src/components/configurationComponents/peerShareLinkModal.vue
@@ -3,7 +3,7 @@ import {WireguardConfigurationsStore} from "@/stores/WireguardConfigurationsStor
import {fetchPost} from "@/utilities/fetch.js";
import dayjs from "dayjs";
import {DashboardConfigurationStore} from "@/stores/DashboardConfigurationStore.js";
-import VueDatePicker from '@vuepic/vue-datepicker';
+import { VueDatePicker } from '@vuepic/vue-datepicker';
import LocaleText from "@/components/text/localeText.vue";
import PeerShareWithEmail from "@/components/configurationComponents/peerShareLinkComponents/peerShareWithEmail.vue";
diff --git a/src/static/app/src/components/settingsComponent/dashboardAPIKeysComponents/newDashboardAPIKey.vue b/src/static/app/src/components/settingsComponent/dashboardAPIKeysComponents/newDashboardAPIKey.vue
index d14d3d54..9aaad232 100644
--- a/src/static/app/src/components/settingsComponent/dashboardAPIKeysComponents/newDashboardAPIKey.vue
+++ b/src/static/app/src/components/settingsComponent/dashboardAPIKeysComponents/newDashboardAPIKey.vue
@@ -2,7 +2,7 @@
import dayjs from "dayjs";
import {fetchPost} from "@/utilities/fetch.js";
import {DashboardConfigurationStore} from "@/stores/DashboardConfigurationStore.js";
-import VueDatePicker from "@vuepic/vue-datepicker";
+import { VueDatePicker } from "@vuepic/vue-datepicker";
import LocaleText from "@/components/text/localeText.vue";
export default {
diff --git a/src/static/dist/WGDashboardAdmin/assets/DashboardClientAssignmentStore-CzviEuNq.js b/src/static/dist/WGDashboardAdmin/assets/DashboardClientAssignmentStore-DDEBJ8Q3.js
similarity index 95%
rename from src/static/dist/WGDashboardAdmin/assets/DashboardClientAssignmentStore-CzviEuNq.js
rename to src/static/dist/WGDashboardAdmin/assets/DashboardClientAssignmentStore-DDEBJ8Q3.js
index da93dc9f..ae588245 100644
--- a/src/static/dist/WGDashboardAdmin/assets/DashboardClientAssignmentStore-CzviEuNq.js
+++ b/src/static/dist/WGDashboardAdmin/assets/DashboardClientAssignmentStore-DDEBJ8Q3.js
@@ -1 +1 @@
-import{a7 as A,r as n,D as S,g as l,z as v}from"./index-BuOf6BZp.js";const b=A("DashboardClientAssignmentStore",()=>{const f=n({}),d=n([]),o=n({}),c=n([]),g=n(!1),r=n(""),i=S(),w=async()=>{await l("/api/clients/allClients",{},s=>{o.value=s.data})},y=async()=>{await l("/api/clients/allClientsRaw",{},s=>{c.value=s.data,console.log(c.value)})},m=s=>Object.values(o.value).flat().find(e=>e.ClientID===s),u=async(s,e)=>{await l("/api/clients/assignedClients",{ConfigurationName:s,Peer:e},a=>{d.value=a.data})};return{assignments:d,getAssignedClients:u,getClients:w,getClientsRaw:y,clients:o,unassignClient:async(s,e,a)=>{g.value=!0,await v("/api/clients/unassignClient",{AssignmentID:a},async t=>{t.status?(i.newMessage("Server","Unassign successfully!","success"),s&&e&&await u(s,e)):(i.newMessage("Server","Unassign Failed. Reason: "+t.message,"success"),console.error("Unassign Failed. Reason: "+t.message)),g.value=!1})},assignClient:async(s,e,a,t=!0)=>{r.value=a,await v("/api/clients/assignClient",{ConfigurationName:s,Peer:e,ClientID:a},async C=>{C.status?(i.newMessage("Server","Assign successfully!","success"),t&&await u(s,e)):(i.newMessage("Server","Assign Failed. Reason: "+C.message,"success"),console.error("Assign Failed. Reason: "+C.message)),r.value=""})},getClientById:m,unassigning:g,assigning:r,clientsRaw:c,allConfigurationsPeers:f,getAllConfigurationsPeers:async()=>{await l("/api/clients/allConfigurationsPeers",{},s=>{f.value=s.data})}}});export{b as D};
+import{a5 as A,r as n,D as S,g as l,z as v}from"./index-DYYtDSji.js";const b=A("DashboardClientAssignmentStore",()=>{const f=n({}),d=n([]),o=n({}),c=n([]),g=n(!1),r=n(""),i=S(),w=async()=>{await l("/api/clients/allClients",{},s=>{o.value=s.data})},y=async()=>{await l("/api/clients/allClientsRaw",{},s=>{c.value=s.data,console.log(c.value)})},m=s=>Object.values(o.value).flat().find(e=>e.ClientID===s),u=async(s,e)=>{await l("/api/clients/assignedClients",{ConfigurationName:s,Peer:e},a=>{d.value=a.data})};return{assignments:d,getAssignedClients:u,getClients:w,getClientsRaw:y,clients:o,unassignClient:async(s,e,a)=>{g.value=!0,await v("/api/clients/unassignClient",{AssignmentID:a},async t=>{t.status?(i.newMessage("Server","Unassign successfully!","success"),s&&e&&await u(s,e)):(i.newMessage("Server","Unassign Failed. Reason: "+t.message,"success"),console.error("Unassign Failed. Reason: "+t.message)),g.value=!1})},assignClient:async(s,e,a,t=!0)=>{r.value=a,await v("/api/clients/assignClient",{ConfigurationName:s,Peer:e,ClientID:a},async C=>{C.status?(i.newMessage("Server","Assign successfully!","success"),t&&await u(s,e)):(i.newMessage("Server","Assign Failed. Reason: "+C.message,"success"),console.error("Assign Failed. Reason: "+C.message)),r.value=""})},getClientById:m,unassigning:g,assigning:r,clientsRaw:c,allConfigurationsPeers:f,getAllConfigurationsPeers:async()=>{await l("/api/clients/allConfigurationsPeers",{},s=>{f.value=s.data})}}});export{b as D};
diff --git a/src/static/dist/WGDashboardAdmin/assets/Vector-CuSZivra.js b/src/static/dist/WGDashboardAdmin/assets/Vector-CuSZivra.js
new file mode 100644
index 00000000..11227948
--- /dev/null
+++ b/src/static/dist/WGDashboardAdmin/assets/Vector-CuSZivra.js
@@ -0,0 +1,7 @@
+const Et={ADD:"add",REMOVE:"remove"},gi={PROPERTYCHANGE:"propertychange"},W={CHANGE:"change",ERROR:"error",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",TOUCHMOVE:"touchmove",WHEEL:"wheel"};class Xn{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function Cl(n,t,e){let i,s;e=e||oe;let r=0,o=n.length,a=!1;for(;r
=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new dn(Et.REMOVE,e,t)),e}setAt(t,e){const i=this.getLength();if(t>=i){this.insertAt(t,e);return}if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const s=this.array_[t];this.array_[t]=e,this.dispatchEvent(new dn(Et.REMOVE,s,t)),this.dispatchEvent(new dn(Et.ADD,e,t))}updateLength_(){this.set(Br.LENGTH,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let s=0,r=i.length;s>1;){const l=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),c=ht;){const a=this.getParentIndex_(e);if(s[a]>o)i[e]=i[a],s[e]=s[a],e=a;else break}i[e]=r,s[e]=o}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let s=0;const r=e.length;let o,a,l;for(a=0;a_n?o=_n:o<-_n&&(o=-_n),t[r+1]=o}return t}function Jl(n,t,e,i){const s=n.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(s));for(let r=0;reo&&(t=eo);const i=Te(t),s=Math.sin(i),r=Math.cos(i),o=s/r,a=o*o,l=a*a,h=Te(n),c=ma(e.number),u=Te(c),d=Mn/Math.sqrt(1-Gt*s**2),f=Fe*r**2,g=r*Gs(h-u,-Math.PI,Math.PI),m=g*g,_=m*g,p=_*g,E=p*g,C=E*g,y=Mn*(_a*i-nh*Math.sin(2*i)+sh*Math.sin(4*i)-rh*Math.sin(6*i)),x=An*d*(g+_/6*(1-a+f)+E/120*(5-18*a+l+72*f-58*Fe))+5e5;let R=An*(y+d*o*(m/2+p/24*(5-a+9*f+4*f**2)+C/720*(61-58*a+l+600*f-330*Fe)));return e.north||(R+=1e7),[x,R]}function ma(n){return(n-1)*6-180+3}const gh=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function pa(n){let t=0;for(const s of gh){const r=n.match(s);if(r){t=parseInt(r[1]);break}}if(!t)return null;let e=0,i=!1;return t>32700&&t<32761?e=t-32700:t>32600&&t<32661&&(i=!0,e=t-32600),e?{number:e,north:i}:null}function io(n,t){return function(e,i,s,r){const o=e.length;s=s>1?s:2,r=r??s,i||(s>2?i=e.slice():i=new Array(o));for(let a=0;a{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return!this.renderer_||!this.rendered?null:this.renderer_.getData(t)}isVisible(t){let e;const i=this.getMapInternal();!t&&i&&(t=i.getView()),t instanceof re?e={viewState:t.getState(),extent:t.calculateExtent()}:e=t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray());let s;if(e.layerStatesArray){if(s=e.layerStatesArray.find(o=>o.layer===this),!s)return!1}else s=this.getLayerState();const r=this.getExtent();return Sr(s,e.viewState)&&(!r||wt(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];const i=t instanceof re?t.getViewStateAndExtent():t;let s=e(i);return Array.isArray(s)||(s=[s]),s}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set($.MAP,t)}getMapInternal(){return this.get($.MAP)}setMap(t){this.mapPrecomposeKey_&&(tt(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(tt(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=V(t,kt.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=V(this,W.CHANGE,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);q(!e.some(s=>s.layer===i.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set($.SOURCE,t)}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 Sr(n,t){if(!n.visible)return!1;const e=t.resolution;if(ei(r)<=s(r);case w.GreaterThan:return r=>i(r)>s(r);case w.GreaterThanOrEqualTo:return r=>i(r)>=s(r);default:throw new Error(`Unsupported comparison operator ${e}`)}}function uu(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r{for(let o=0;o{for(let o=0;o{const o=s[0](r),a=s[1](r),l=s[2](r);return o>=a&&o<=l};case w.In:return r=>{const o=s[0](r);for(let a=1;a!s[0](r);default:throw new Error(`Unsupported logical operator ${e}`)}}function du(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r{let o=1;for(let a=0;as[0](r)/s[1](r);case w.Add:return r=>{let o=0;for(let a=0;as[0](r)-s[1](r);case w.Clamp:return r=>{const o=s[0](r),a=s[1](r);if(ol?l:o};case w.Mod:return r=>s[0](r)%s[1](r);case w.Pow:return r=>Math.pow(s[0](r),s[1](r));case w.Abs:return r=>Math.abs(s[0](r));case w.Floor:return r=>Math.floor(s[0](r));case w.Ceil:return r=>Math.ceil(s[0](r));case w.Round:return r=>Math.round(s[0](r));case w.Sin:return r=>Math.sin(s[0](r));case w.Cos:return r=>Math.cos(s[0](r));case w.Atan:return i===2?r=>Math.atan2(s[0](r),s[1](r)):r=>Math.atan(s[0](r));case w.Sqrt:return r=>Math.sqrt(s[0](r));default:throw new Error(`Unsupported numeric operator ${e}`)}}function fu(n,t){const e=n.args.length,i=new Array(e);for(let s=0;sthis.imageState_=X.LOADED),this.render()}clone(){const t=this.getScale(),e=new es({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(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let s=Nt.get(i,null,null)?.getImage(1);if(!s){const r=this.renderOptions_,o=Math.ceil(r.size*t),a=ot(o,o);this.draw_(r,a,t),s=a.canvas,Nt.set(i,null,null,new Ya(s,void 0,null,X.LOADED,null))}return s}getPixelRatio(t){return t}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(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(e===0||this.points_===1/0||t!=="bevel"&&t!=="miter")return e;let s=this.radius,r=this.radius2_===void 0?s:this.radius2_;if(sthis.updateSize())),this.controls=e.controls||(At?new Ft:hc()),this.interactions=e.interactions||(At?new Ft:bc({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Ol(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(ft.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(ft.VIEW,this.handleViewChanged_),this.addChangeListener(ft.SIZE,this.handleSizeChanged_),this.addChangeListener(ft.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;t.view&&!(t.view instanceof re)&&t.view.then(function(s){i.setView(new re(s))}),this.controls.addEventListener(Et.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(Et.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(Et.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(Et.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(Et.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(Et.REMOVE,s=>{const r=s.element.getId();r!==void 0&&delete this.overlayIdIndex_[r.toString()],s.element.setMap(null)}),this.controls.forEach(s=>{s.setMap(this)}),this.interactions.forEach(s=>{s.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){tl(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();e!==void 0&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(t);i=i!==void 0?i:{};const r=i.hitTolerance!==void 0?i.hitTolerance:0,o=i.layerFilter!==void 0?i.layerFilter:Ki,a=i.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,r,a,e,null,o,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(s){i.push(s)},e),i}getAllLayers(){const t=[];function e(i){i.forEach(function(s){s instanceof Ri?e(s.getLayers()):t.push(s)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t);e=e!==void 0?e:{};const s=e.layerFilter!==void 0?e.layerFilter:Ki,r=e.hitTolerance!==void 0?e.hitTolerance:0,o=e.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,o,s,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const i=this.viewport_.getBoundingClientRect(),s=this.getSize(),r=i.width/s[0],o=i.height/s[1],a="changedTouches"in t?t.changedTouches[0]:t;return[(a.clientX-i.left)/r,(a.clientY-i.top)/o]}getTarget(){return this.get(ft.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return Bs(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?ht(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return e!==void 0?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(ft.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof Ft){e.setLayers(t);return}const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e=0;r--){const o=s[r];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let s=this.maxTilesLoading_,r=s;if(t){const o=t.viewHints;if(o[gt.ANIMATING]||o[gt.INTERACTING]){const a=Date.now()-t.time>8;s=a?0:8,r=a?0:2}}e.getTilesLoading(){this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new xe("removelayer",e)),this.set(ft.LAYERGROUP,t)}setSize(t){this.set(ft.SIZE,t)}setTarget(t){this.set(ft.TARGET,t)}setView(t){if(!t||t instanceof re){this.set(ft.VIEW,t);return}this.set(ft.VIEW,new re);const e=this;t.then(function(i){e.setView(new re(i))})}updateSize(){const t=this.getTargetElement();let e;if(t){let s,r;if(we(t))s=t.width,r=t.height;else{const o=getComputedStyle(t);s=t.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),r=t.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(s)&&!isNaN(r)&&(e=[Math.max(0,s),Math.max(0,r)],!xo(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&da("No map visible because the map container's width or height are 0."))}const i=this.getSize();e&&(!i||!ve(e,i))&&(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}}function qu(n){let t=null;n.keyboardEventTarget!==void 0&&(t=typeof n.keyboardEventTarget=="string"?document.getElementById(n.keyboardEventTarget):n.keyboardEventTarget);const e={},i=n.layers&&typeof n.layers.getLayers=="function"?n.layers:new Ri({layers:n.layers});e[ft.LAYERGROUP]=i,e[ft.TARGET]=n.target,e[ft.VIEW]=n.view instanceof re?n.view:new re;let s;n.controls!==void 0&&(Array.isArray(n.controls)?s=new Ft(n.controls.slice()):(q(typeof n.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),s=n.controls));let r;n.interactions!==void 0&&(Array.isArray(n.interactions)?r=new Ft(n.interactions.slice()):(q(typeof n.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),r=n.interactions));let o;return n.overlays!==void 0?Array.isArray(n.overlays)?o=new Ft(n.overlays.slice()):(q(typeof n.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=n.overlays):o=new Ft,{controls:s,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}class Or extends Yn{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=i.transition===void 0?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(W.CHANGE)}release(){this.setState(D.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==D.EMPTY){if(this.state!==D.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){U()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(!i)i=e,this.transitionStarts_[t]=i;else if(i===-1)return 1;const s=e-i+1e3/60;return s>=this.transition_?1:ua(s/this.transition_)}inTransition(t){return this.transition_?this.transitionStarts_[t]!==-1:!1}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}}class el extends Or{constructor(t,e,i,s,r,o){super(t,e,o),this.crossOrigin_=s,this.src_=i,this.key=i,this.image_,At?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,s!==null&&(this.image_.crossOrigin=s)),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=D.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}handleImageError_(){this.state=D.ERROR,this.unlistenImage_(),this.image_=$u(),this.changed()}handleImageLoad_(){if(At)this.state=D.LOADED;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=D.LOADED:this.state=D.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==D.ERROR&&(this.state=D.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==D.IDLE&&(this.state=D.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=yu(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 $u(){const n=ot(1,1);return n.fillStyle="rgba(0,0,0,0)",n.fillRect(0,0,1,1),n.canvas}let bs;const fi=[];function Oo(n,t,e,i,s){n.beginPath(),n.moveTo(0,0),n.lineTo(t,e),n.lineTo(i,s),n.closePath(),n.save(),n.clip(),n.fillRect(0,0,Math.max(t,i)+1,Math.max(e,s)),n.restore()}function Ds(n,t){return Math.abs(n[t*4]-210)>2||Math.abs(n[t*4+3]-.75*255)>2}function Ju(){if(bs===void 0){const n=ot(6,6,fi);n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",Oo(n,4,5,4,0),Oo(n,4,5,0,5);const t=n.getImageData(0,0,3,3).data;bs=Ds(t,0)||Ds(t,4)||Ds(t,8),Jn(n),fi.push(n.canvas)}return bs}function Po(n,t,e,i){const s=dr(e,t,n);let r=no(t,i,e);const o=t.getMetersPerUnit();o!==void 0&&(r*=o);const a=n.getMetersPerUnit();a!==void 0&&(r/=a);const l=n.getExtent();if(!l||mi(l,s)){const h=no(n,r,s)/r;isFinite(h)&&h>0&&(r/=h)}return r}function Qu(n,t,e,i){const s=Ye(e);let r=Po(n,t,s,i);return(!isFinite(r)||r<=0)&&oa(e,function(o){return r=Po(n,t,o,i),isFinite(r)&&r>0}),r}function td(n,t,e,i,s,r,o,a,l,h,c,u,d,f){const g=ot(Math.round(e*n),Math.round(e*t),fi);if(u||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(e,e);function m(x){return Math.round(x*e)/e}g.globalCompositeOperation="lighter";const _=zt();l.forEach(function(x,R,I){Gl(_,x.extent)});let p;const E=e/i,C=(u?1:1+Math.pow(2,-24))/E;p=ot(Math.round(J(_)*E),Math.round(yt(_)*E),fi),u||(p.imageSmoothingEnabled=!1),l.forEach(function(x,R,I){if(x.image.width>0&&x.image.height>0){if(x.clipExtent){p.save();const b=(x.clipExtent[0]-_[0])*E,A=-(x.clipExtent[3]-_[3])*E,M=J(x.clipExtent)*E,Y=yt(x.clipExtent)*E;p.rect(u?b:Math.round(b),u?A:Math.round(A),u?M:Math.round(b+M)-Math.round(b),u?Y:Math.round(A+Y)-Math.round(A)),p.clip()}const T=(x.extent[0]-_[0])*E,v=-(x.extent[3]-_[3])*E,L=J(x.extent)*E,k=yt(x.extent)*E;p.drawImage(x.image,h,h,x.image.width-2*h,x.image.height-2*h,u?T:Math.round(T),u?v:Math.round(v),u?L:Math.round(T+L)-Math.round(T),u?k:Math.round(v+k)-Math.round(v)),x.clipExtent&&p.restore()}});const y=Ze(o);return a.getTriangles().forEach(function(x,R,I){const T=x.source,v=x.target;let L=T[0][0],k=T[0][1],b=T[1][0],A=T[1][1],M=T[2][0],Y=T[2][1];const F=m((v[0][0]-y[0])/r),G=m(-(v[0][1]-y[1])/r),P=m((v[1][0]-y[0])/r),K=m(-(v[1][1]-y[1])/r),Z=m((v[2][0]-y[0])/r),Q=m(-(v[2][1]-y[1])/r),S=L,ut=k;L=0,k=0,b-=S,A-=ut,M-=S,Y-=ut;const _t=[[b,A,0,0,P-F],[M,Y,0,0,Z-F],[0,0,b,A,K-G],[0,0,M,Y,Q-G]],st=kl(_t);if(!st)return;if(g.save(),g.beginPath(),Ju()||!u){g.moveTo(P,K);const dt=4,Ut=F-P,Xt=G-K;for(let vt=0;vtthis.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return U()}getData(t){return null}prepareFrame(t){return U()}renderFrame(t,e){return U()}forEachFeatureAtCoordinate(t,e,i,s,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;(e.getState()===X.LOADED||e.getState()===X.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=X.LOADED&&e!=X.ERROR&&t.addEventListener(W.CHANGE,this.boundHandleImageChange_),e==X.IDLE&&(t.load(),e=t.getState()),e==X.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const zo=[];let oi=null;function Md(){oi=ot(1,1,void 0,{willReadFrequently:!0})}class hl extends Ad{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=Zt(),this.pixelTransform=Zt(),this.inversePixelTransform=Zt(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){oi||Md(),oi.clearRect(0,0,1,1);let s;try{oi.drawImage(t,e,i,1,1,0,0,1,1),s=oi.getImageData(0,0,1,1).data}catch{return oi=null,null}return s}getBackground(t){let i=this.getLayer().getBackground();return typeof i=="function"&&(i=i(t.viewState.resolution)),i||void 0}useContainer(t,e,i){const s=this.getLayer().getClassName();let r,o;if(t&&t.className===s&&(!i||t&&t.style.backgroundColor&&ve(yi(t.style.backgroundColor),yi(i)))){const a=t.firstElementChild;we(a)&&(o=a.getContext("2d"))}if(o&&vh(o.canvas.style.transform,e)?(this.container=t,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){r=At?Ma():document.createElement("div"),r.className=s;let a=r.style;a.position="absolute",a.width="100%",a.height="100%",o=ot();const l=o.canvas;r.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=r,this.context=o}!this.containerReused&&i&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const s=Ze(i),r=Vn(i),o=Un(i),a=Bn(i);ht(e.coordinateToPixelTransform,s),ht(e.coordinateToPixelTransform,r),ht(e.coordinateToPixelTransform,o),ht(e.coordinateToPixelTransform,a);const l=this.inversePixelTransform;ht(l,s),ht(l,r),ht(l,o),ht(l,a),t.save(),t.beginPath(),t.moveTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}prepareContainer(t,e){const i=t.extent,s=t.viewState.resolution,r=t.viewState.rotation,o=t.pixelRatio,a=Math.round(J(i)/s*o),l=Math.round(yt(i)/s*o);he(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/o,1/o,r,-a/2,-l/2),xa(this.inversePixelTransform,this.pixelTransform);const h=Sh(this.pixelTransform);if(this.useContainer(e,h,this.getBackground(t)),!this.containerReused){const c=this.context.canvas;c.width!=a||c.height!=l?(c.width=a,c.height=l):this.context.clearRect(0,0,a,l),h!==c.style.transform&&(c.style.transform=h)}}dispatchRenderEvent_(t,e,i){const s=this.getLayer();if(s.hasListener(t)){const r=new Ja(t,this.inversePixelTransform,i,e);s.dispatchEvent(r)}}preRender(t,e){this.frameState=e,!e.declutter&&this.dispatchRenderEvent_(kt.PRERENDER,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(kt.POSTRENDER,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new ll),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(kt.PRERENDER,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(kt.POSTRENDER,this.context,t))}getRenderTransform(t,e,i,s,r,o,a){const l=r/2,h=o/2,c=s/e,u=-c,d=-t[0]+a,f=-t[1];return he(this.tempTransform,l,h,c,u,-i,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}function Ps(n,t,e){if(!(e in n))return n[e]=new Set([t]),!0;const i=n[e],s=i.has(t);return s||i.add(t),!s}function bd(n,t,e){const i=n[e];return i?i.delete(t):!1}function Xo(n,t){const e=n.layerStatesArray[n.layerIndex];e.extent&&(t=ze(t,Ce(e.extent,n.viewState.projection)));const i=e.layer.getRenderSource();if(!i.getWrapX()){const s=i.getTileGridForProjection(n.viewState.projection).getExtent();s&&(t=ze(t,s))}return t}class Dd extends hl{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=zt(),this.tempTileRange_=new Pr(0,0,0,0),this.tempTileCoord_=Gn(0,0,0);const i=e.cacheSize!==void 0?e.cacheSize:512;this.tileCache_=new Go(i),this.sourceTileCache_=null,this.maxStaleKeys=i*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Go(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,s){const r=this.tileCache_,a=this.getLayer().getSource(),l=In(a,a.getKey(),t,e,i);let h;if(r.containsKey(l))h=r.get(l);else{const c=s.viewState.projection,u=a.getProjection();if(h=a.getTile(t,e,i,s.pixelRatio,c,!u||Tn(u,c)?void 0:this.getSourceTileCache()),!h)return null;r.set(l,h)}return h}getTile(t,e,i,s){const r=this.getOrCreateTile(t,e,i,s);return r||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),s=ht(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!mi(r,s))return null;const o=e.viewState,a=i.getRenderSource(),l=a.getTileGridForProjection(o.projection),h=a.getTilePixelRatio(e.pixelRatio);for(let c=l.getZForResolution(o.resolution);c>=l.getMinZoom();--c){const u=l.getTileCoordForCoordAndZ(s,c),d=this.getTile(c,u[1],u[2],e);if(!d||d.getState()!==D.LOADED)continue;const f=l.getOrigin(c),g=Tt(l.getTileSize(c)),m=l.getResolution(c);let _;if(d instanceof el||d instanceof il)_=d.getImage();else if(d instanceof No){if(_=Qs(d.getData()),!_)continue}else continue;const p=Math.floor(h*((s[0]-f[0])/m-u[1]*g[0])),E=Math.floor(h*((f[1]-s[1])/m-u[2]*g[1])),C=Math.round(h*a.getGutterForProjection(o.projection));return this.getImageData(_,p+C,E+C)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,i,s,r){const o=t.viewState,a=this.getLayer(),l=a.getRenderSource(),h=l.getTileGridForProjection(o.projection),c=j(l);c in t.wantedTiles||(t.wantedTiles[c]={});const u=t.wantedTiles[c],d=a.getMapInternal(),f=Math.max(i-r,h.getMinZoom(),h.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):h.getResolution(0)),l.zDirection)),g=o.rotation,m=g?aa(o.center,o.resolution,g,t.size):void 0;for(let _=i;_>=f;--_){const p=h.getTileRangeForExtentAndZ(e,_,this.tempTileRange_),E=h.getResolution(_);for(let C=p.minX;C<=p.maxX;++C)for(let y=p.minY;y<=p.maxY;++y){if(g&&!h.tileCoordIntersectsViewport([_,C,y],m))continue;const x=this.getTile(_,C,y,t);if(!x||!Ps(s,x,_))continue;const I=x.getKey();if(u[I]=!0,x.getState()===D.IDLE&&!t.tileQueue.isKeyQueued(I)){const T=Gn(_,C,y,this.tempTileCoord_);t.tileQueue.enqueue([x,c,h.getTileCoordCenter(T),E])}}}}findStaleTile_(t,e){const i=this.tileCache_,s=t[0],r=t[1],o=t[2],a=this.getStaleKeys();for(let l=0;ll&&(this.instructions.push([O.CUSTOM,l,c,t,i,li,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,c,t,s||i,li,r]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),c=this.coordinates.length,this.instructions.push([O.CUSTOM,l,c,t,i,void 0,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,c,t,s||i,void 0,r]);break}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[O.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[O.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;t.reverse();let e;const i=t.length;let s,r,o=-1;for(e=0;ethis.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[O.SET_FILL_STYLE,e];return typeof e!="string"&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[O.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;(typeof i!="string"||t.currentFillStyle!=i)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,s=t.lineCap,r=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,l=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=s||r!=t.currentLineDash&&!ve(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=h)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=s,t.currentLineDash=r,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=l,t.currentMiterLimit=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[O.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=ea(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;ir(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class Jd extends ln{constructor(t,e,i,s){super(t,e,i,s),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(t,e,i){if(!this.image_||this.maxExtent&&!mi(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const s=t.getFlatCoordinates(),r=t.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,r);this.instructions.push([O.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([O.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(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const s=t.getFlatCoordinates(),r=[];for(let l=0,h=s.length;l{r.draw(this.renderedContext_),r.clear()}),t[e[i]].length=0}}const ks={};function df(n){if(ks[n]!==void 0)return ks[n];const t=n*2+1,e=n*n,i=new Array(e+1);for(let r=0;r<=n;++r)for(let o=0;o<=n;++o){const a=r*r+o*o;if(a>e)break;let l=i[a];l||(l=[],i[a]=l),l.push(((n+r)*t+(n+o))*4+3),r>0&&l.push(((n-r)*t+(n+o))*4+3),o>0&&(l.push(((n+r)*t+(n-o))*4+3),r>0&&l.push(((n-r)*t+(n-o))*4+3))}const s=[];for(let r=0,o=i.length;r=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new hn(Et.REMOVE,e,t)),e}setAt(t,e){const i=this.getLength();if(t>=i){this.insertAt(t,e);return}if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const s=this.array_[t];this.array_[t]=e,this.dispatchEvent(new hn(Et.REMOVE,s,t)),this.dispatchEvent(new hn(Et.ADD,e,t))}updateLength_(){this.set(Yr.LENGTH,this.array_.length)}assertUnique_(t,e){for(let i=0,s=this.array_.length;i{this.clickTimeoutId_=void 0;const i=new me(nt.SINGLECLICK,this.map_,t);this.dispatchEvent(i)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==nt.POINTERUP||e.type==nt.POINTERCANCEL){delete this.trackedTouches_[i];for(const s in this.trackedTouches_)if(this.trackedTouches_[s].target!==e.target){delete this.trackedTouches_[s];break}}else(e.type==nt.POINTERDOWN||e.type==nt.POINTERMOVE)&&(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new me(nt.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(tt),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return t.button===0}handlePointerDown_(t){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(t);const e=new me(nt.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),this.dragListenerKeys_.length===0){const i=this.map_.getOwnerDocument();this.dragListenerKeys_.push(V(i,nt.POINTERMOVE,this.handlePointerMove_,this),V(i,nt.POINTERUP,this.handlePointerUp_,this),V(this.element_,nt.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(V(this.element_.getRootNode(),nt.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new me(nt.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!!(this.down_&&this.isMoving_(t));this.dispatchEvent(new me(nt.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;(!e||e.defaultPrevented)&&(typeof t.cancelable!="boolean"||t.cancelable===!0)&&t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(tt(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(X.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(tt(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(tt),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const pe={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},ft={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},D={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function q(n,t){if(!n)throw new Error(t)}const wn=1/0;class vl{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,$i(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const s=this.keyFunction_(i);return delete this.queuedElements_[s],i}enqueue(t){q(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=wn?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,s=e.length,r=e[t],o=i[t],a=t;for(;t>1;){const l=this.getLeftChildIndex_(t),c=this.getRightChildIndex_(t),h=ct;){const a=this.getParentIndex_(e);if(s[a]>o)i[e]=i[a],s[e]=s[a],e=a;else break}i[e]=r,s[e]=o}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let s=0;const r=e.length;let o,a,l;for(a=0;adn?o=dn:o<-dn&&(o=-dn),t[r+1]=o}return t}function Vl(n,t,e,i){const s=n.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(s));for(let r=0;rJr&&(t=Jr);const i=Ce(t),s=Math.sin(i),r=Math.cos(i),o=s/r,a=o*o,l=a*a,c=Ce(n),h=fa(e.number),u=Ce(h),d=Tn/Math.sqrt(1-kt*s**2),f=Pe*r**2,g=r*Os(c-u,-Math.PI,Math.PI),m=g*g,_=m*g,p=_*g,E=p*g,C=E*g,y=Tn*(da*i-Jl*Math.sin(2*i)+Ql*Math.sin(4*i)-th*Math.sin(6*i)),x=In*d*(g+_/6*(1-a+f)+E/120*(5-18*a+l+72*f-58*Pe))+5e5;let R=In*(y+d*o*(m/2+p/24*(5-a+9*f+4*f**2)+C/720*(61-58*a+l+600*f-330*Pe)));return e.north||(R+=1e7),[x,R]}function fa(n){return(n-1)*6-180+3}const hh=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function ga(n){let t=0;for(const s of hh){const r=n.match(s);if(r){t=parseInt(r[1]);break}}if(!t)return null;let e=0,i=!1;return t>32700&&t<32761?e=t-32700:t>32600&&t<32661&&(i=!0,e=t-32600),e?{number:e,north:i}:null}function Qr(n,t){return function(e,i,s,r){const o=e.length;s=s>1?s:2,r=r??s,i||(s>2?i=e.slice():i=new Array(o));for(let a=0;a{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return!this.renderer_||!this.rendered?null:this.renderer_.getData(t)}isVisible(t){let e;const i=this.getMapInternal();!t&&i&&(t=i.getView()),t instanceof se?e={viewState:t.getState(),extent:t.calculateExtent()}:e=t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray());let s;if(e.layerStatesArray){if(s=e.layerStatesArray.find(o=>o.layer===this),!s)return!1}else s=this.getLayerState();const r=this.getExtent();return wr(s,e.viewState)&&(!r||wt(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];const i=t instanceof se?t.getViewStateAndExtent():t;let s=e(i);return Array.isArray(s)||(s=[s]),s}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set($.MAP,t)}getMapInternal(){return this.get($.MAP)}setMap(t){this.mapPrecomposeKey_&&(tt(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(tt(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=V(t,Ot.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=V(this,X.CHANGE,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);q(!e.some(s=>s.layer===i.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set($.SOURCE,t)}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 wr(n,t){if(!n.visible)return!1;const e=t.resolution;if(ei(r)<=s(r);case w.GreaterThan:return r=>i(r)>s(r);case w.GreaterThanOrEqualTo:return r=>i(r)>=s(r);default:throw new Error(`Unsupported comparison operator ${e}`)}}function ou(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r{for(let o=0;o{for(let o=0;o{const o=s[0](r),a=s[1](r),l=s[2](r);return o>=a&&o<=l};case w.In:return r=>{const o=s[0](r);for(let a=1;a!s[0](r);default:throw new Error(`Unsupported logical operator ${e}`)}}function au(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r{let o=1;for(let a=0;as[0](r)/s[1](r);case w.Add:return r=>{let o=0;for(let a=0;as[0](r)-s[1](r);case w.Clamp:return r=>{const o=s[0](r),a=s[1](r);if(ol?l:o};case w.Mod:return r=>s[0](r)%s[1](r);case w.Pow:return r=>Math.pow(s[0](r),s[1](r));case w.Abs:return r=>Math.abs(s[0](r));case w.Floor:return r=>Math.floor(s[0](r));case w.Ceil:return r=>Math.ceil(s[0](r));case w.Round:return r=>Math.round(s[0](r));case w.Sin:return r=>Math.sin(s[0](r));case w.Cos:return r=>Math.cos(s[0](r));case w.Atan:return i===2?r=>Math.atan2(s[0](r),s[1](r)):r=>Math.atan(s[0](r));case w.Sqrt:return r=>Math.sqrt(s[0](r));default:throw new Error(`Unsupported numeric operator ${e}`)}}function lu(n,t){const e=n.args.length,i=new Array(e);for(let s=0;sthis.imageState_=W.LOADED),this.render()}clone(){const t=this.getScale(),e=new Hn({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(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let s=Ft.get(i,null,null)?.getImage(1);if(!s){const r=this.renderOptions_,o=Math.ceil(r.size*t),a=ot(o,o);this.draw_(r,a,t),s=a.canvas,Ft.set(i,null,null,new Ga(s,void 0,null,W.LOADED,null))}return s}getPixelRatio(t){return t}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(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(e===0||this.points_===1/0||t!=="bevel"&&t!=="miter")return e;let s=this.radius,r=this.radius2_===void 0?s:this.radius2_;if(sthis.updateSize()),this.controls=e.controls||sc(),this.interactions=e.interactions||Sc({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Ll(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(ft.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(ft.VIEW,this.handleViewChanged_),this.addChangeListener(ft.SIZE,this.handleSizeChanged_),this.addChangeListener(ft.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;t.view&&!(t.view instanceof se)&&t.view.then(function(s){i.setView(new se(s))}),this.controls.addEventListener(Et.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(Et.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(Et.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(Et.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(Et.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(Et.REMOVE,s=>{const r=s.element.getId();r!==void 0&&delete this.overlayIdIndex_[r.toString()],s.element.setMap(null)}),this.controls.forEach(s=>{s.setMap(this)}),this.interactions.forEach(s=>{s.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){qa(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();e!==void 0&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(t);i=i!==void 0?i:{};const r=i.hitTolerance!==void 0?i.hitTolerance:0,o=i.layerFilter!==void 0?i.layerFilter:zi,a=i.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,r,a,e,null,o,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(s){i.push(s)},e),i}getAllLayers(){const t=[];function e(i){i.forEach(function(s){s instanceof Ei?e(s.getLayers()):t.push(s)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t);e=e!==void 0?e:{};const s=e.layerFilter!==void 0?e.layerFilter:zi,r=e.hitTolerance!==void 0?e.hitTolerance:0,o=e.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,o,s,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const i=this.viewport_.getBoundingClientRect(),s=this.getSize(),r=i.width/s[0],o=i.height/s[1],a="changedTouches"in t?t.changedTouches[0]:t;return[(a.clientX-i.left)/r,(a.clientY-i.top)/o]}getTarget(){return this.get(ft.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return Ws(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?ht(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return e!==void 0?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(ft.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof jt){e.setLayers(t);return}const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e=0;r--){const o=s[r];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let s=this.maxTilesLoading_,r=s;if(t){const o=t.viewHints;if(o[gt.ANIMATING]||o[gt.INTERACTING]){const a=Date.now()-t.time>8;s=a?0:8,r=a?0:2}}e.getTilesLoading(){this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new ye("removelayer",e)),this.set(ft.LAYERGROUP,t)}setSize(t){this.set(ft.SIZE,t)}setTarget(t){this.set(ft.TARGET,t)}setView(t){if(!t||t instanceof se){this.set(ft.VIEW,t);return}this.set(ft.VIEW,new se);const e=this;t.then(function(i){e.setView(new se(i))})}updateSize(){const t=this.getTargetElement();let e;if(t){const s=getComputedStyle(t),r=t.offsetWidth-parseFloat(s.borderLeftWidth)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)-parseFloat(s.borderRightWidth),o=t.offsetHeight-parseFloat(s.borderTopWidth)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)-parseFloat(s.borderBottomWidth);!isNaN(r)&&!isNaN(o)&&(e=[Math.max(0,r),Math.max(0,o)],!yo(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&ha("No map visible because the map container's width or height are 0."))}const i=this.getSize();e&&(!i||!Ie(e,i))&&(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}}function Zu(n){let t=null;n.keyboardEventTarget!==void 0&&(t=typeof n.keyboardEventTarget=="string"?document.getElementById(n.keyboardEventTarget):n.keyboardEventTarget);const e={},i=n.layers&&typeof n.layers.getLayers=="function"?n.layers:new Ei({layers:n.layers});e[ft.LAYERGROUP]=i,e[ft.TARGET]=n.target,e[ft.VIEW]=n.view instanceof se?n.view:new se;let s;n.controls!==void 0&&(Array.isArray(n.controls)?s=new jt(n.controls.slice()):(q(typeof n.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),s=n.controls));let r;n.interactions!==void 0&&(Array.isArray(n.interactions)?r=new jt(n.interactions.slice()):(q(typeof n.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),r=n.interactions));let o;return n.overlays!==void 0?Array.isArray(n.overlays)?o=new jt(n.overlays.slice()):(q(typeof n.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=n.overlays):o=new jt,{controls:s,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}class Mr{constructor(t,e,i,s){this.minX=t,this.maxX=e,this.minY=i,this.maxY=s}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minXthis.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return U()}getData(t){return null}prepareFrame(t){return U()}renderFrame(t,e){return U()}forEachFeatureAtCoordinate(t,e,i,s,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;(e.getState()===W.LOADED||e.getState()===W.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=W.LOADED&&e!=W.ERROR&&t.addEventListener(X.CHANGE,this.boundHandleImageChange_),e==W.IDLE&&(t.load(),e=t.getState()),e==W.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const ko=[];let ni=null;function vd(){ni=ot(1,1,void 0,{willReadFrequently:!0})}class sl extends Sd{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=Yt(),this.pixelTransform=Yt(),this.inversePixelTransform=Yt(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){ni||vd(),ni.clearRect(0,0,1,1);let s;try{ni.drawImage(t,e,i,1,1,0,0,1,1),s=ni.getImageData(0,0,1,1).data}catch{return ni=null,null}return s}getBackground(t){let i=this.getLayer().getBackground();return typeof i=="function"&&(i=i(t.viewState.resolution)),i||void 0}useContainer(t,e,i){const s=this.getLayer().getClassName();let r,o;if(t&&t.className===s&&(!i||t&&t.style.backgroundColor&&Ie(_i(t.style.backgroundColor),_i(i)))){const a=t.firstElementChild;a instanceof HTMLCanvasElement&&(o=a.getContext("2d"))}if(o&&wh(o.canvas.style.transform,e)?(this.container=t,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){r=document.createElement("div"),r.className=s;let a=r.style;a.position="absolute",a.width="100%",a.height="100%",o=ot();const l=o.canvas;r.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=r,this.context=o}!this.containerReused&&i&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const s=We(i),r=Wn(i),o=Xn(i),a=zn(i);ht(e.coordinateToPixelTransform,s),ht(e.coordinateToPixelTransform,r),ht(e.coordinateToPixelTransform,o),ht(e.coordinateToPixelTransform,a);const l=this.inversePixelTransform;ht(l,s),ht(l,r),ht(l,o),ht(l,a),t.save(),t.beginPath(),t.moveTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}prepareContainer(t,e){const i=t.extent,s=t.viewState.resolution,r=t.viewState.rotation,o=t.pixelRatio,a=Math.round(J(i)/s*o),l=Math.round(yt(i)/s*o);le(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/o,1/o,r,-a/2,-l/2),pa(this.inversePixelTransform,this.pixelTransform);const c=Ch(this.pixelTransform);if(this.useContainer(e,c,this.getBackground(t)),!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_(t,e,i){const s=this.getLayer();if(s.hasListener(t)){const r=new ja(t,this.inversePixelTransform,i,e);s.dispatchEvent(r)}}preRender(t,e){this.frameState=e,!e.declutter&&this.dispatchRenderEvent_(Ot.PRERENDER,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(Ot.POSTRENDER,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new nl),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(Ot.PRERENDER,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(Ot.POSTRENDER,this.context,t))}getRenderTransform(t,e,i,s,r,o,a){const l=r/2,c=o/2,h=s/e,u=-h,d=-t[0]+a,f=-t[1];return le(this.tempTransform,l,c,h,u,-i,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}function As(n,t,e,i,s){return`${j(n)},${t},${Uu(e,i,s)}`}function Ms(n,t,e){if(!(e in n))return n[e]=new Set([t]),!0;const i=n[e],s=i.has(t);return s||i.add(t),!s}function Ld(n,t,e){const i=n[e];return i?i.delete(t):!1}function No(n,t){const e=n.layerStatesArray[n.layerIndex];e.extent&&(t=ke(t,Ee(e.extent,n.viewState.projection)));const i=e.layer.getRenderSource();if(!i.getWrapX()){const s=i.getTileGridForProjection(n.viewState.projection).getExtent();s&&(t=ke(t,s))}return t}class Ad extends sl{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=Nt(),this.tempTileRange_=new Mr(0,0,0,0),this.tempTileCoord_=Pn(0,0,0);const i=e.cacheSize!==void 0?e.cacheSize:512;this.tileCache_=new Id(i),this.maxStaleKeys=i*.5}getTileCache(){return this.tileCache_}getOrCreateTile(t,e,i,s){const r=this.tileCache_,a=this.getLayer().getSource(),l=As(a,a.getKey(),t,e,i);let c;if(r.containsKey(l))c=r.get(l);else{if(c=a.getTile(t,e,i,s.pixelRatio,s.viewState.projection),!c)return null;r.set(l,c)}return c}getTile(t,e,i,s){const r=this.getOrCreateTile(t,e,i,s);return r||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),s=ht(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!fi(r,s))return null;const o=e.viewState,a=i.getRenderSource(),l=a.getTileGridForProjection(o.projection),c=a.getTilePixelRatio(e.pixelRatio);for(let h=l.getZForResolution(o.resolution);h>=l.getMinZoom();--h){const u=l.getTileCoordForCoordAndZ(s,h),d=this.getTile(h,u[1],u[2],e);if(!d||d.getState()!==D.LOADED)continue;const f=l.getOrigin(h),g=It(l.getTileSize(h)),m=l.getResolution(h);let _;if(d instanceof tl||d instanceof el)_=d.getImage();else if(d instanceof Fo){if(_=js(d.getData()),!_)continue}else continue;const p=Math.floor(c*((s[0]-f[0])/m-u[1]*g[0])),E=Math.floor(c*((f[1]-s[1])/m-u[2]*g[1])),C=Math.round(c*a.getGutterForProjection(o.projection));return this.getImageData(_,p+C,E+C)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&this.tileCache_.clear()):this.renderedSourceRevision_=i,!0}enqueueTiles(t,e,i,s,r){const o=t.viewState,a=this.getLayer(),l=a.getRenderSource(),c=l.getTileGridForProjection(o.projection),h=j(l);h in t.wantedTiles||(t.wantedTiles[h]={});const u=t.wantedTiles[h],d=a.getMapInternal(),f=Math.max(i-r,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),g=o.rotation,m=g?sa(o.center,o.resolution,g,t.size):void 0;for(let _=i;_>=f;--_){const p=c.getTileRangeForExtentAndZ(e,_,this.tempTileRange_),E=c.getResolution(_);for(let C=p.minX;C<=p.maxX;++C)for(let y=p.minY;y<=p.maxY;++y){if(g&&!c.tileCoordIntersectsViewport([_,C,y],m))continue;const x=this.getTile(_,C,y,t);if(!x||!Ms(s,x,_))continue;const T=x.getKey();if(u[T]=!0,x.getState()===D.IDLE&&!t.tileQueue.isKeyQueued(T)){const I=Pn(_,C,y,this.tempTileCoord_);t.tileQueue.enqueue([x,h,c.getTileCoordCenter(I),E])}}}}findStaleTile_(t,e){const i=this.tileCache_,s=t[0],r=t[1],o=t[2],a=this.getStaleKeys();for(let l=0;ll&&(this.instructions.push([P.CUSTOM,l,h,t,i,ri,r]),this.hitDetectionInstructions.push([P.CUSTOM,l,h,t,s||i,ri,r]));break;case"Point":c=t.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),h=this.coordinates.length,this.instructions.push([P.CUSTOM,l,h,t,i,void 0,r]),this.hitDetectionInstructions.push([P.CUSTOM,l,h,t,s||i,void 0,r]);break}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[P.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[P.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;t.reverse();let e;const i=t.length;let s,r,o=-1;for(e=0;ethis.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[P.SET_FILL_STYLE,e];return typeof e!="string"&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[P.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;(typeof i!="string"||t.currentFillStyle!=i)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,s=t.lineCap,r=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,l=t.lineWidth,c=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=s||r!=t.currentLineDash&&!Ie(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=c)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=s,t.currentLineDash=r,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=l,t.currentMiterLimit=c)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[P.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Jo(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;Js(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class Hd extends rn{constructor(t,e,i,s){super(t,e,i,s),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(t,e,i){if(!this.image_||this.maxExtent&&!fi(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const s=t.getFlatCoordinates(),r=t.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,r);this.instructions.push([P.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([P.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(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const s=t.getFlatCoordinates(),r=[];for(let l=0,c=s.length;l{r.draw(this.renderedContext_),r.clear()}),t[e[i]].length=0}}const Ps={};function hf(n){if(Ps[n]!==void 0)return Ps[n];const t=n*2+1,e=n*n,i=new Array(e+1);for(let r=0;r<=n;++r)for(let o=0;o<=n;++o){const a=r*r+o*o;if(a>e)break;let l=i[a];l||(l=[],i[a]=l),l.push(((n+r)*t+(n+o))*4+3),r>0&&l.push(((n-r)*t+(n+o))*4+3),o>0&&(l.push(((n+r)*t+(n-o))*4+3),r>0&&l.push(((n-r)*t+(n-o))*4+3))}const s=[];for(let r=0,o=i.length;r