+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package com.atomgraph.client.filter.request;
+
+import com.atomgraph.client.MediaTypes;
+import com.atomgraph.client.util.HTMLMediaTypePredicate;
+import com.atomgraph.core.exception.BadGatewayException;
+import com.atomgraph.core.io.ModelProvider;
+import com.atomgraph.core.util.ModelUtils;
+import com.atomgraph.core.util.ResultSetUtils;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Pattern;
+import jakarta.annotation.Priority;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.HttpMethod;
+import jakarta.ws.rs.NotAcceptableException;
+import jakarta.ws.rs.Priorities;
+import jakarta.ws.rs.ProcessingException;
+import jakarta.ws.rs.client.Client;
+import jakarta.ws.rs.client.Entity;
+import jakarta.ws.rs.client.Invocation;
+import jakarta.ws.rs.client.WebTarget;
+import jakarta.ws.rs.container.ContainerRequestContext;
+import jakarta.ws.rs.container.ContainerRequestFilter;
+import jakarta.ws.rs.container.PreMatching;
+import jakarta.ws.rs.core.Context;
+import jakarta.ws.rs.core.EntityTag;
+import jakarta.ws.rs.core.HttpHeaders;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Request;
+import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.core.Variant;
+import org.apache.jena.query.ResultSet;
+import org.apache.jena.query.ResultSetRewindable;
+import org.apache.jena.rdf.model.Model;
+import org.apache.jena.riot.Lang;
+import org.apache.jena.riot.RDFLanguages;
+import org.apache.jena.riot.RiotException;
+import org.apache.jena.riot.resultset.ResultSetReaderRegistry;
+import org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * JAX-RS request filter that intercepts {@code ?uri=} proxy requests and short-circuits the pipeline
+ * via {@link ContainerRequestContext#abortWith(Response)}. The proxy is a global transport function,
+ * not a document operation, so it is not modelled as a resource class: the filter forwards the
+ * request method, entity stream and conditional headers to the target verbatim - no local entity
+ * parsing on writes (an RDF/POST form body reaches the origin as
+ * {@code application/x-www-form-urlencoded} for the origin to parse) - and converts the target's
+ * response for the original caller.
+ *
+ * External HTTP responses are dispatched on upstream {@code Content-Type} via Jena's live RIOT
+ * registry (the same predicate {@code ModelProvider.isReadable} consults, and unlike the
+ * {@code MediaTypes} snapshot it includes langs registered after class-loading, such as RDF/POST):
+ * RDF langs parse into a {@link Model} and SPARQL results langs into a {@link ResultSet}, both
+ * re-served through content negotiation - including (X)HTML via the XSLT writers, which is this
+ * application's purpose. Error responses keep the origin's status and validators but their RDF
+ * diagnostic bodies re-serve through the same negotiation, so a browser gets the rendered error
+ * page rather than raw RDF bytes (a rejected write - 412 on a stale {@code If-Match}, 401/403 on
+ * an unauthorized delta - must surface as that status); non-RDF and unparseable bodies relay verbatim.
+ *
+ * @author Martynas Jusevičius {@literal }
+ */
+@PreMatching
+@Priority(Priorities.USER + 50) // after HttpMethodOverrideFilter (Priorities.USER), so ?_method= is already applied
+public class ProxyRequestFilter implements ContainerRequestFilter
+{
+
+ private static final Logger log = LoggerFactory.getLogger(ProxyRequestFilter.class);
+ private static final Pattern LINK_SPLITTER = Pattern.compile(",(?=\\s*<)");
+ /**
+ * End-to-end response headers forwarded verbatim from the upstream. Excludes hop-by-hop headers
+ * (RFC 7230 §6.1), framing headers re-emitted by the container, origin-bound security headers
+ * (CSP, HSTS, CORS), cookies, and {@code Content-Type}/{@code Link} which are set explicitly.
+ */
+ private static final Set FORWARDED_RESPONSE_HEADERS = Set.of(
+ HttpHeaders.ETAG,
+ HttpHeaders.LAST_MODIFIED,
+ HttpHeaders.CACHE_CONTROL,
+ HttpHeaders.VARY,
+ HttpHeaders.EXPIRES,
+ HttpHeaders.CONTENT_LANGUAGE,
+ HttpHeaders.CONTENT_DISPOSITION,
+ HttpHeaders.CONTENT_LOCATION,
+ HttpHeaders.LOCATION,
+ HttpHeaders.RETRY_AFTER,
+ "Age");
+ /**
+ * Conditional request headers forwarded verbatim to the upstream so preconditions are evaluated
+ * at the origin: {@code If-Match}/{@code If-Unmodified-Since} carry optimistic-concurrency
+ * validators on writes, {@code If-None-Match}/{@code If-Modified-Since} carry cache validation on
+ * reads. Excludes {@code Authorization}/{@code Cookie} and {@code Range}, whose byte offsets do
+ * not survive the Model re-serialization the proxy performs.
+ */
+ private static final Set FORWARDED_REQUEST_HEADERS = Set.of(
+ HttpHeaders.IF_MATCH,
+ HttpHeaders.IF_NONE_MATCH,
+ HttpHeaders.IF_MODIFIED_SINCE,
+ HttpHeaders.IF_UNMODIFIED_SINCE);
+
+ @Inject MediaTypes mediaTypes;
+ @Inject Client client;
+ @Context Request request;
+
+ @Override
+ public void filter(ContainerRequestContext requestContext) throws IOException
+ {
+ URI targetURI = resolveTargetURI(requestContext);
+ if (targetURI == null) return; // not a proxy request - the root resource handles it
+
+ // the ?accept= query param overrides content negotiation (used by the RDF export links)
+ String acceptParam = requestContext.getUriInfo().getQueryParameters().getFirst("accept");
+ if (acceptParam != null) requestContext.getHeaders().putSingle(HttpHeaders.ACCEPT, acceptParam);
+
+ if (log.isDebugEnabled()) log.debug("Proxying {} {} → {}", requestContext.getMethod(), requestContext.getUriInfo().getRequestUri(), targetURI);
+ requestContext.abortWith(proxy(requestContext, getClient().target(targetURI)));
+ }
+
+ /**
+ * Resolves the proxy target URI from the {@code ?uri=} query parameter, with the
+ * {@code #fragment} stripped (servers do not receive fragment identifiers).
+ * Returns null if this request should not be proxied.
+ *
+ * @param requestContext the current request context
+ * @return target URI to proxy to, or null
+ */
+ protected URI resolveTargetURI(ContainerRequestContext requestContext)
+ {
+ String uriParam = requestContext.getUriInfo().getQueryParameters().getFirst("uri");
+ if (uriParam == null) return null;
+
+ URI targetURI = URI.create(uriParam);
+ if (targetURI.getFragment() != null)
+ {
+ try
+ {
+ targetURI = new URI(targetURI.getScheme(), targetURI.getAuthority(), targetURI.getPath(), targetURI.getQuery(), null);
+ }
+ catch (URISyntaxException ex)
+ {
+ // should not happen when only removing the fragment
+ }
+ }
+
+ return targetURI;
+ }
+
+ /**
+ * Forwards the current request to the target and converts the target's response.
+ *
+ * @param requestContext the current request context
+ * @param target proxy target
+ * @return response for the original caller
+ */
+ protected Response proxy(ContainerRequestContext requestContext, WebTarget target)
+ {
+ try
+ {
+ Invocation.Builder builder = target.request(getReadableMediaTypes());
+
+ // forward conditional request headers so preconditions reach the origin, which owns the
+ // validators - without this the origin sees an unconditional request and a proxied If-Match
+ // write silently loses its optimistic-concurrency guard
+ for (String name : FORWARDED_REQUEST_HEADERS)
+ {
+ String value = requestContext.getHeaderString(name);
+ if (value != null) builder.header(name, value);
+ }
+
+ Response clientResponse = requestContext.hasEntity()
+ ? builder.method(requestContext.getMethod(),
+ Entity.entity(requestContext.getEntityStream(), requestContext.getMediaType()))
+ : builder.method(requestContext.getMethod());
+
+ try (clientResponse)
+ {
+ // special case for http <-> https 301/303 redirection, which the connector does not follow across schemes
+ if (("GET".equalsIgnoreCase(requestContext.getMethod()) || HttpMethod.HEAD.equalsIgnoreCase(requestContext.getMethod())) &&
+ (clientResponse.getStatusInfo().toEnum().equals(Response.Status.SEE_OTHER) || clientResponse.getStatusInfo().toEnum().equals(Response.Status.MOVED_PERMANENTLY)) &&
+ ((target.getUri().getScheme().equals("http") && clientResponse.getLocation().getScheme().equals("https")) ||
+ (target.getUri().getScheme().equals("https") && clientResponse.getLocation().getScheme().equals("http"))))
+ return proxy(requestContext, getClient().target(clientResponse.getLocation()));
+
+ return getResponse(clientResponse, target.getUri(), requestContext.getMethod());
+ }
+ }
+ catch (MessageBodyProviderNotFoundException ex)
+ {
+ if (log.isWarnEnabled()) log.warn("Proxied URI {} returned non-RDF media type", target.getUri());
+ throw new NotAcceptableException(ex);
+ }
+ catch (RiotException ex)
+ {
+ if (log.isWarnEnabled()) log.warn("Proxied URI {} returned body typed as RDF but unparseable", target.getUri());
+ throw new BadGatewayException(ex);
+ }
+ catch (ProcessingException ex)
+ {
+ if (log.isWarnEnabled()) log.warn("Could not dereference proxied URI: {}", target.getUri());
+ throw new BadGatewayException(ex);
+ }
+ }
+
+ /**
+ * Converts the proxy target's HTTP response into a JAX-RS response for the original caller.
+ * RDF and SPARQL results bodies parse and re-serve through content negotiation (including
+ * (X)HTML via the XSLT writers); HEAD, error and non-RDF responses relay verbatim.
+ *
+ * @param clientResponse response from the proxy target
+ * @param targetURI upstream URI (used as the parse base URI hint for {@code ModelProvider})
+ * @param method HTTP method
+ * @return JAX-RS response to return to the original caller
+ */
+ protected Response getResponse(Response clientResponse, URI targetURI, String method)
+ {
+ // HEAD responses have no body by HTTP semantics. Routing them through the typed branches
+ // below would parse an empty entity into an empty Model/ResultSet, then re-stamp
+ // ETag/Last-Modified off that empty value - producing validators that disagree with the
+ // upstream GET. Forward the upstream headers (including ETag) verbatim instead.
+ if (HttpMethod.HEAD.equalsIgnoreCase(method))
+ {
+ Response.ResponseBuilder rb = Response.status(clientResponse.getStatus());
+ if (clientResponse.getMediaType() != null) rb.type(clientResponse.getMediaType());
+ return overlayHeaders(rb.build(), clientResponse, true);
+ }
+
+ if (clientResponse.getMediaType() == null)
+ {
+ Response.ResponseBuilder rb = Response.status(clientResponse.getStatus());
+ return overlayHeaders(rb.build(), clientResponse, true);
+ }
+
+ // error responses keep the origin's status but re-serve an RDF diagnostic body through content
+ // negotiation - this client's consumer is a browser, and relaying e.g. RDF/Thrift bytes verbatim
+ // on a 403 gives it nothing it can render. The entity is buffered first so a body that is not
+ // the RDF its Content-Type claims falls back to the verbatim relay instead of masking the
+ // origin's status as 502/406. A proxied write that the origin rejects (412 on a stale If-Match,
+ // 401/403 on an unauthorized delta) must reach the client as that status either way, with the
+ // origin's validators forwarded
+ Response.Status.Family family = clientResponse.getStatusInfo().getFamily();
+ if (family == Response.Status.Family.CLIENT_ERROR || family == Response.Status.Family.SERVER_ERROR)
+ {
+ clientResponse.bufferEntity();
+
+ MediaType errorType = clientResponse.getMediaType();
+ if (RDFLanguages.contentTypeToLang(new MediaType(errorType.getType(), errorType.getSubtype()).toString()) != null)
+ try
+ {
+ clientResponse.getHeaders().putSingle(ModelProvider.REQUEST_URI_HEADER, targetURI.toString());
+ Model errorModel = clientResponse.readEntity(Model.class);
+ return overlayHeaders(getResponse(errorModel, clientResponse.getStatusInfo()), clientResponse, true);
+ }
+ catch (ProcessingException | RiotException ex)
+ {
+ if (log.isWarnEnabled()) log.warn("Error body from proxied URI {} typed as RDF but unparseable - relaying verbatim", targetURI);
+ }
+
+ Response.ResponseBuilder rb = Response.status(clientResponse.getStatus()).
+ type(clientResponse.getMediaType()).
+ entity(clientResponse.readEntity(InputStream.class));
+ return overlayHeaders(rb.build(), clientResponse, true);
+ }
+
+ // dispatch on the live Jena RIOT registry - the same predicate ModelProvider.isReadable uses,
+ // so any RDF lang Jersey can read into a Model routes to the Model branch, including langs
+ // registered after the MediaTypes static snapshot was captured (e.g. RDF/POST)
+ MediaType upstreamCT = clientResponse.getMediaType();
+ MediaType formatType = new MediaType(upstreamCT.getType(), upstreamCT.getSubtype()); // strip charset
+ Lang lang = RDFLanguages.contentTypeToLang(formatType.toString());
+
+ if (lang != null && ResultSetReaderRegistry.isRegistered(lang))
+ {
+ ResultSetRewindable results = clientResponse.readEntity(ResultSetRewindable.class);
+ return overlayHeaders(getResponse(results, clientResponse.getStatusInfo()), clientResponse, false);
+ }
+
+ if (lang != null)
+ {
+ // base URI hint so ModelProvider resolves relative IRIs against the upstream URI
+ clientResponse.getHeaders().putSingle(ModelProvider.REQUEST_URI_HEADER, targetURI.toString());
+ Model model = clientResponse.readEntity(Model.class);
+ // forward the origin's validators (replacing the ones the Model builder stamps off the re-serialized
+ // bytes): a client editing the proxied document sends If-Match through this proxy to the origin, which
+ // compares against its own ETag - a re-serialization validator would 412 every proxied write
+ return overlayHeaders(getResponse(model, clientResponse.getStatusInfo()), clientResponse, true);
+ }
+
+ // upstream is neither RDF nor SPARQL results - pipe raw bytes
+ // buffer so the stream remains readable after try-with-resources closes the client response
+ clientResponse.bufferEntity();
+ InputStream entity = clientResponse.readEntity(InputStream.class);
+
+ Response.ResponseBuilder rb = Response.status(clientResponse.getStatus()).
+ type(upstreamCT).
+ entity(entity);
+
+ return overlayHeaders(rb.build(), clientResponse, true);
+ }
+
+ /**
+ * Copies the upstream {@code Link} and end-to-end cache/content headers onto the given
+ * built response, replacing any locally stamped values. {@code ETag}/{@code Last-Modified}
+ * are skipped when {@code copyValidators} is {@code false} (the ResultSet branch), where the
+ * builder-stamped validators stand.
+ *
+ * @param response the response built by the typed or raw branch
+ * @param clientResponse upstream response to copy headers from
+ * @param copyValidators whether to forward {@code ETag} and {@code Last-Modified}
+ * @return response with overlaid upstream headers
+ */
+ protected Response overlayHeaders(Response response, Response clientResponse, boolean copyValidators)
+ {
+ Response.ResponseBuilder rb = Response.fromResponse(response);
+
+ // forward all Link headers from the external response so the client receives remote hypermedia
+ String linkHeader = clientResponse.getHeaderString(HttpHeaders.LINK);
+ if (linkHeader != null)
+ for (String part : LINK_SPLITTER.split(linkHeader))
+ rb.header(HttpHeaders.LINK, part.trim());
+
+ for (String name : FORWARDED_RESPONSE_HEADERS)
+ {
+ if (!copyValidators && (HttpHeaders.ETAG.equalsIgnoreCase(name) || HttpHeaders.LAST_MODIFIED.equalsIgnoreCase(name))) continue;
+ String value = clientResponse.getHeaderString(name);
+ if (value != null) rb.header(name, null).header(name, value); // replace, not append - the upstream value overlays any locally stamped one
+ }
+
+ return rb.build();
+ }
+
+ /**
+ * Builds a response for the given RDF model with content negotiation, including (X)HTML.
+ *
+ * @param model RDF model
+ * @param statusType response status
+ * @return JAX-RS response
+ */
+ protected Response getResponse(Model model, Response.StatusType statusType)
+ {
+ List variants = com.atomgraph.core.model.impl.Response.getVariants(getMediaTypes().getWritable(Model.class),
+ new ArrayList<>(),
+ new ArrayList<>());
+
+ return new com.atomgraph.core.model.impl.Response(getRequest(),
+ model,
+ null,
+ new EntityTag(Long.toHexString(ModelUtils.hashModel(model))),
+ variants,
+ new HTMLMediaTypePredicate()).
+ getResponseBuilder().
+ status(statusType).
+ build();
+ }
+
+ /**
+ * Builds a response for the given SPARQL result set with content negotiation, including (X)HTML.
+ *
+ * @param resultSet SPARQL results (rewindable so we can hash without consuming)
+ * @param statusType response status
+ * @return JAX-RS response
+ */
+ protected Response getResponse(ResultSetRewindable resultSet, Response.StatusType statusType)
+ {
+ long hash = ResultSetUtils.hashResultSet(resultSet);
+ resultSet.reset();
+
+ List variants = com.atomgraph.core.model.impl.Response.getVariants(getMediaTypes().getWritable(ResultSet.class),
+ new ArrayList<>(),
+ new ArrayList<>());
+
+ return new com.atomgraph.core.model.impl.Response(getRequest(),
+ resultSet,
+ null,
+ new EntityTag(Long.toHexString(hash)),
+ variants,
+ new HTMLMediaTypePredicate()).
+ getResponseBuilder().
+ status(statusType).
+ build();
+ }
+
+ /**
+ * Returns the outbound {@code Accept} types: everything readable as a model or SPARQL results.
+ *
+ * @return readable media types
+ */
+ protected MediaType[] getReadableMediaTypes()
+ {
+ List readable = new ArrayList<>();
+ readable.addAll(getMediaTypes().getReadable(Model.class));
+ readable.addAll(getMediaTypes().getReadable(ResultSet.class));
+ return readable.toArray(MediaType[]::new);
+ }
+
+ /**
+ * Returns the media types registry used for content negotiation and outbound {@code Accept} headers.
+ *
+ * @return media types
+ */
+ public MediaTypes getMediaTypes()
+ {
+ return mediaTypes;
+ }
+
+ /**
+ * Returns the HTTP client used to reach proxy targets.
+ *
+ * @return HTTP client
+ */
+ public Client getClient()
+ {
+ return client;
+ }
+
+ /**
+ * Returns the JAX-RS request.
+ *
+ * @return request
+ */
+ public Request getRequest()
+ {
+ return request;
+ }
+
+}
diff --git a/src/main/java/com/atomgraph/client/interceptor/RDFPostMediaTypeInterceptor.java b/src/main/java/com/atomgraph/client/interceptor/RDFPostMediaTypeInterceptor.java
new file mode 100644
index 00000000..5d019ded
--- /dev/null
+++ b/src/main/java/com/atomgraph/client/interceptor/RDFPostMediaTypeInterceptor.java
@@ -0,0 +1,66 @@
+/**
+ * Copyright 2019 Martynas Jusevičius
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package com.atomgraph.client.interceptor;
+
+import com.atomgraph.core.MediaType;
+import com.atomgraph.core.riot.lang.TokenizerRDFPost;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.nio.charset.StandardCharsets;
+import jakarta.annotation.Priority;
+import jakarta.ws.rs.Priorities;
+import jakarta.ws.rs.WebApplicationException;
+import jakarta.ws.rs.ext.ReaderInterceptor;
+import jakarta.ws.rs.ext.ReaderInterceptorContext;
+import org.apache.commons.io.IOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Request interceptor that fixes RDF/POST media type.
+ *
+ * @author Martynas Jusevičius {@literal }
+ */
+@Priority(Priorities.ENTITY_CODER)
+public class RDFPostMediaTypeInterceptor implements ReaderInterceptor
+{
+
+ private static final Logger log = LoggerFactory.getLogger(RDFPostMediaTypeInterceptor.class);
+
+ @Override
+ public Object aroundReadFrom(ReaderInterceptorContext context) throws IOException, WebApplicationException
+ {
+ // cannot use the RDF/POST-specific MediaType.APPLICATION_RDF_URLENCODED_TYPE because browsers do not support it as form/@enctype: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#attr-enctype -->
+ if (context.getMediaType() != null && context.getMediaType().isCompatible(MediaType.APPLICATION_FORM_URLENCODED_TYPE))
+ {
+ StringWriter writer = new StringWriter();
+ IOUtils.copy(context.getInputStream(), writer, StandardCharsets.UTF_8);
+
+ String formData = writer.toString();
+
+ if (formData.startsWith(TokenizerRDFPost.RDF))
+ // replace the generic "application/x-www-form-urlencoded" media type with RDF/POST
+ context.setMediaType(MediaType.APPLICATION_RDF_URLENCODED_TYPE);
+
+ context.setInputStream(new ByteArrayInputStream(formData.getBytes(StandardCharsets.UTF_8))); // restore the request entity
+ }
+
+ return context.proceed();
+ }
+
+}
diff --git a/src/main/java/com/atomgraph/client/model/impl/ProxiedGraph.java b/src/main/java/com/atomgraph/client/model/impl/ProxiedGraph.java
deleted file mode 100644
index 063496d1..00000000
--- a/src/main/java/com/atomgraph/client/model/impl/ProxiedGraph.java
+++ /dev/null
@@ -1,449 +0,0 @@
-/**
- * Copyright 2013 Martynas Jusevičius
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package com.atomgraph.client.model.impl;
-
-import com.atomgraph.client.MediaTypes;
-import com.atomgraph.client.util.HTMLMediaTypePredicate;
-import com.atomgraph.client.vocabulary.AC;
-import java.net.URI;
-import java.util.ArrayList;
-import jakarta.ws.rs.DELETE;
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.POST;
-import jakarta.ws.rs.PUT;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.QueryParam;
-import jakarta.ws.rs.core.Context;
-import jakarta.ws.rs.core.HttpHeaders;
-import jakarta.ws.rs.core.MediaType;
-import jakarta.ws.rs.core.Request;
-import jakarta.ws.rs.core.Response;
-import jakarta.ws.rs.core.Response.Status;
-import jakarta.ws.rs.core.UriInfo;
-import com.atomgraph.core.exception.BadGatewayException;
-import com.atomgraph.core.io.ModelProvider;
-import com.atomgraph.core.model.DirectGraphStore;
-import com.atomgraph.core.util.ModelUtils;
-import com.atomgraph.core.util.ResultSetUtils;
-import java.net.URISyntaxException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Locale;
-import jakarta.inject.Inject;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.ws.rs.NotAcceptableException;
-import jakarta.ws.rs.NotFoundException;
-import jakarta.ws.rs.ProcessingException;
-import jakarta.ws.rs.client.Client;
-import jakarta.ws.rs.client.Entity;
-import jakarta.ws.rs.client.Invocation;
-import jakarta.ws.rs.client.WebTarget;
-import jakarta.ws.rs.core.EntityTag;
-import jakarta.ws.rs.core.UriBuilder;
-import jakarta.ws.rs.core.Variant;
-import org.apache.jena.query.ResultSet;
-import org.apache.jena.query.ResultSetRewindable;
-import org.apache.jena.rdf.model.Model;
-import org.apache.jena.riot.Lang;
-import org.apache.jena.riot.RDFLanguages;
-import org.apache.jena.riot.resultset.ResultSetReaderRegistry;
-import org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException;
-import org.glassfish.jersey.uri.UriComponent;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Resource that can publish Linked Data and (X)HTML as well as load RDF from remote sources.
- *
- * @author Martynas Jusevičius {@literal }
- */
-@Path("/")
-public class ProxiedGraph implements DirectGraphStore
-{
- private static final Logger log = LoggerFactory.getLogger(ProxiedGraph.class);
-
- private final UriInfo uriInfo;
- private final Request request;
- private final HttpHeaders httpHeaders;
- private final MediaTypes mediaTypes;
- private final MediaType accept;
- private final MediaType[] readableMediaTypes;
- private final Client client;
- private final WebTarget webTarget;
- private final URI endpoint;
- private final String query;
-
- private final HttpServletRequest httpServletRequest;
-
- /**
- * JAX-RS compatible resource constructor with injected initialization objects.
- *
- * @param uriInfo URI information
- * @param request request
- * @param httpHeaders HTTP headers
- * @param mediaTypes supported media types
- * @param uri RDF resource URI
- * @param endpoint SPARQL endpoint URI
- * @param query SPARQL query
- * @param accept response media type
- * @param mode layout mode
- * @param client HTTP client
- * @param httpServletRequest HTTP request
- */
- @Inject
- public ProxiedGraph(@Context UriInfo uriInfo, @Context Request request, @Context HttpHeaders httpHeaders, MediaTypes mediaTypes,
- @QueryParam("uri") URI uri, @QueryParam("endpoint") URI endpoint, @QueryParam("query") String query, @QueryParam("accept") MediaType accept, @QueryParam("mode") URI mode,
- Client client, @Context HttpServletRequest httpServletRequest)
- {
- this.uriInfo = uriInfo;
- this.request = request;
- this.httpHeaders = httpHeaders;
- this.mediaTypes = mediaTypes;
- this.endpoint = endpoint;
- this.query = query;
- this.accept = accept;
- this.client = client;
- List readableMediaTypesList = new ArrayList<>();
- readableMediaTypesList.addAll(mediaTypes.getReadable(Model.class));
- readableMediaTypesList.addAll(mediaTypes.getReadable(ResultSet.class));
- this.readableMediaTypes = readableMediaTypesList.toArray(MediaType[]::new);
-
- if (uri != null)
- {
- if (uri.getFragment() != null)
- try
- {
- // strip #fragment as we don't want to use it in the request to server
- uri = new URI(uri.getScheme(), uri.getAuthority(), uri.getPath(), uri.getQuery(), null);
- }
- catch (URISyntaxException ex)
- {
- // should not happen
- }
-
- webTarget = client.target(uri);
- //webTarget.register(new RedirectFilter()); // TO-DO
- }
- else
- {
- webTarget = null;
- }
- this.httpServletRequest = httpServletRequest;
- }
-
- public URI getURI()
- {
- return getWebTarget().getUri();
- }
-
- public MediaType[] getReadableMediaTypes()
- {
- return readableMediaTypes;
- }
-
- public List getWritableMediaTypes(Class clazz)
- {
- // restrict writable MediaTypes to the requested one (usually by RDF export feature)
- if (getAcceptMediaType() != null) return Arrays.asList(getAcceptMediaType());
-
- return getMediaTypes().getWritable(clazz);
- }
-
- /**
- * Forwards GET request and returns response from remote resource.
- *
- * @return response
- */
- @GET
- @Override
- public Response get()
- {
- return get(getWebTarget());
- }
-
- public Response get(WebTarget target)
- {
- if (target == null)
- {
- // if SPARQL endpoint and query are provided, build a SPARQL Protocol URI and then redirect to a URI that proxies it
- if (getEndpoint() != null && getQuery() != null)
- {
- if (log.isDebugEnabled()) log.debug("Redirecting from endpoint/query URL to a proxied URL");
- String encodedQuery = UriComponent.encode(getQuery(), UriComponent.Type.UNRESERVED); // manually encode query string because UriBuilder::build will complain about {}
- URI sparqlUrl = UriBuilder.fromUri(getEndpoint()).queryParam(AC.query.getLocalName(), encodedQuery).build();
- String encodedSparqlUrl = UriComponent.encode(sparqlUrl.toString(), UriComponent.Type.UNRESERVED); // manually encode URL
- URI uri = getUriInfo().getBaseUriBuilder().queryParam(AC.uri.getLocalName(), encodedSparqlUrl).build();
-
- return Response.seeOther(uri).build();
- }
-
- throw new NotFoundException("Resource URI not supplied");
- }
-
- return get(target, getBuilder(target));
- }
-
- public Invocation.Builder getBuilder(WebTarget target)
- {
- return target.request(getReadableMediaTypes());
- }
-
- public Response get(WebTarget target, Invocation.Builder builder)
- {
- if (target == null) throw new NotFoundException("Resource URI not supplied"); // cannot throw Exception in constructor: https://github.com/eclipse-ee4j/jersey/issues/4436
-
- try (Response cr = builder.get())
- {
- // special case for http <-> https 301/303 redirection
- if ((cr.getStatusInfo().toEnum().equals(Status.SEE_OTHER) || cr.getStatusInfo().toEnum().equals(Status.MOVED_PERMANENTLY)) &&
- ((target.getUri().getScheme().equals("http") && cr.getLocation().getScheme().equals("https")) ||
- (target.getUri().getScheme().equals("https") && cr.getLocation().getScheme().equals("http"))) )
- return get(getClient().target(cr.getLocation()));
-
- cr.getHeaders().putSingle(ModelProvider.REQUEST_URI_HEADER, target.getUri().toString()); // provide a base URI hint to ModelProvider
-
- if (log.isDebugEnabled()) log.debug("GETing response from URI: {}", target.getUri());
-
- Response response = getResponse(cr);
-
- List linkValues = cr.getHeaders().get(HttpHeaders.LINK);
- if (linkValues != null) setLinks(linkValues, response);
-
- return response;
- }
- catch (MessageBodyProviderNotFoundException ex)
- {
- if (log.isWarnEnabled()) log.debug("Dereferenced URI {} returned non-RDF media type", ex);
- throw new NotAcceptableException(ex);
- }
- catch (ProcessingException ex)
- {
- if (log.isWarnEnabled()) log.debug("Could not dereference URI: {}", webTarget.getUri());
- throw new BadGatewayException(ex);
- }
- }
-
- public Response getResponse(Response clientResponse)
- {
- MediaType formatType = new MediaType(clientResponse.getMediaType().getType(), clientResponse.getMediaType().getSubtype()); // discard charset param
- Lang lang = RDFLanguages.contentTypeToLang(formatType.toString());
-
- // check if we got SPARQL results first
- if (lang != null && ResultSetReaderRegistry.isRegistered(lang))
- {
- ResultSetRewindable results = clientResponse.readEntity(ResultSetRewindable.class);
- return getResponse(results);
- }
-
- // fallback to RDF graph
- Model description = clientResponse.readEntity(Model.class);
- return getResponse(description);
- }
-
- /**
- * Returns response for the given RDF model.
- *
- * @param model RDF model
- * @return response object
- */
- public Response getResponse(Model model)
- {
- List variants = com.atomgraph.core.model.impl.Response.getVariants(getWritableMediaTypes(Model.class),
- getLanguages(),
- getEncodings());
-
- return new com.atomgraph.core.model.impl.Response(getRequest(),
- model,
- null,
- new EntityTag(Long.toHexString(ModelUtils.hashModel(model))),
- variants,
- new HTMLMediaTypePredicate()).
- getResponseBuilder().
- build();
- }
-
- /**
- * Returns response for the given SPARQL results.
- *
- * @param resultSet SPARQL results
- * @return response object
- */
- public Response getResponse(ResultSetRewindable resultSet)
- {
- long hash = ResultSetUtils.hashResultSet(resultSet);
- resultSet.reset();
-
- List variants = com.atomgraph.core.model.impl.Response.getVariants(getWritableMediaTypes(ResultSet.class),
- getLanguages(),
- getEncodings());
-
- return new com.atomgraph.core.model.impl.Response(getRequest(),
- resultSet,
- null,
- new EntityTag(Long.toHexString(hash)),
- variants,
- new HTMLMediaTypePredicate()).
- getResponseBuilder().
- build();
- }
-
- /**
- * Forwards Link header values.
- *
- * @param linkValues header values
- * @param response proxy response
- * @return the response
- */
- protected Response setLinks(List linkValues, Response response)
- {
- linkValues.forEach(linkValue -> {
- response.getHeaders().add(HttpHeaders.LINK, linkValue);
- });
-
- return response;
- }
-
- /**
- * Forwards POST request with RDF dataset body and returns RDF response from remote resource.
- *
- * @param model
- * @return response
- */
- @POST
- @Override
- public Response post(Model model)
- {
- if (getWebTarget() == null) throw new NotFoundException("Resource URI not supplied"); // cannot throw Exception in constructor: https://github.com/eclipse-ee4j/jersey/issues/4436
-
- if (log.isDebugEnabled()) log.debug("POSTing Dataset to URI: {}", getWebTarget().getUri());
- return getWebTarget().request().
- accept(getMediaTypes().getReadable(Model.class).toArray(jakarta.ws.rs.core.MediaType[]::new)).
- post(Entity.entity(model, com.atomgraph.core.MediaType.APPLICATION_NTRIPLES_TYPE));
- }
-
- /**
- * Forwards PUT request with RDF dataset body and returns response from remote resource.
- *
- * @param model RDF payload
- * @return response
- */
- @PUT
- @Override
- public Response put(Model model)
- {
- if (getWebTarget() == null) throw new NotFoundException("Resource URI not supplied"); // cannot throw Exception in constructor: https://github.com/eclipse-ee4j/jersey/issues/4436
-
- if (log.isDebugEnabled()) log.debug("PUTting Dataset to URI: {}", getWebTarget().getUri());
- return getWebTarget().request().
- accept(getMediaTypes().getReadable(Model.class).toArray(jakarta.ws.rs.core.MediaType[]::new)).
- put(Entity.entity(model, com.atomgraph.core.MediaType.APPLICATION_NTRIPLES_TYPE));
- }
-
- /**
- * Forwards DELETE request and returns response from remote resource.
- * @return response
- */
- @DELETE
- @Override
- public Response delete()
- {
- if (getWebTarget() == null) throw new NotFoundException("Resource URI not supplied"); // cannot throw Exception in constructor: https://github.com/eclipse-ee4j/jersey/issues/4436
-
- if (log.isDebugEnabled()) log.debug("DELETEing Dataset from URI: {}", getWebTarget().getUri());
- return getWebTarget().request().
- accept(getMediaTypes().getReadable(Model.class).toArray(jakarta.ws.rs.core.MediaType[]::new)).
- delete(Response.class);
- }
-
- public UriInfo getUriInfo()
- {
- return uriInfo;
- }
-
- public HttpHeaders getHttpHeaders()
- {
- return httpHeaders;
- }
-
- /**
- * Returns media type requested by the client ("accept" query string parameter).
- * This mechanism overrides the normally used content negotiation.
- *
- * @return media type parsed from query param
- */
- public MediaType getAcceptMediaType()
- {
- return accept;
- }
-
- public Client getClient()
- {
- return client;
- }
-
- public final WebTarget getWebTarget()
- {
- return webTarget;
- }
-
- public final URI getEndpoint()
- {
- return endpoint;
- }
-
- public final String getQuery()
- {
- return query;
- }
-
- public Request getRequest()
- {
- return request;
- }
-
- public MediaTypes getMediaTypes()
- {
- return mediaTypes;
- }
-
- public HttpServletRequest getHttpServletRequest()
- {
- return httpServletRequest;
- }
-
- /**
- * Returns a list of supported languages.
- *
- * @return list of languages
- */
- public List getLanguages()
- {
- return new ArrayList<>();
- }
-
- /**
- * Returns a list of supported HTTP encodings.
- * Note: this is different from content encodings such as UTF-8.
- *
- * @return list of encodings
- */
- public List getEncodings()
- {
- return new ArrayList<>();
- }
-
-}
diff --git a/src/main/java/com/atomgraph/client/resource/Root.java b/src/main/java/com/atomgraph/client/resource/Root.java
new file mode 100644
index 00000000..faf9206c
--- /dev/null
+++ b/src/main/java/com/atomgraph/client/resource/Root.java
@@ -0,0 +1,73 @@
+/**
+ * Copyright 2025 Martynas Jusevičius
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package com.atomgraph.client.resource;
+
+import com.atomgraph.client.vocabulary.AC;
+import java.net.URI;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.NotFoundException;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.QueryParam;
+import jakarta.ws.rs.core.Context;
+import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.core.UriBuilder;
+import jakarta.ws.rs.core.UriInfo;
+import org.glassfish.jersey.uri.UriComponent;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The application root. Proxy requests ({@code ?uri=}) never reach it - the
+ * {@link com.atomgraph.client.filter.request.ProxyRequestFilter} aborts them pre-matching - so it
+ * only handles the non-proxy cases: turning a SPARQL Protocol {@code ?endpoint=}/{@code ?query=}
+ * pair into a redirect to the proxied query URL, and 404 when no resource URI is supplied.
+ *
+ * @author Martynas Jusevičius {@literal }
+ */
+@Path("/")
+public class Root
+{
+
+ private static final Logger log = LoggerFactory.getLogger(Root.class);
+
+ /**
+ * Handles non-proxy GET requests.
+ *
+ * @param endpoint SPARQL endpoint URI
+ * @param query SPARQL query string
+ * @param uriInfo URI information
+ * @return redirect to the proxied SPARQL Protocol URL
+ */
+ @GET
+ public Response get(@QueryParam("endpoint") URI endpoint, @QueryParam("query") String query, @Context UriInfo uriInfo)
+ {
+ // if SPARQL endpoint and query are provided, build a SPARQL Protocol URI and then redirect to a URI that proxies it
+ if (endpoint != null && query != null)
+ {
+ if (log.isDebugEnabled()) log.debug("Redirecting from endpoint/query URL to a proxied URL");
+ String encodedQuery = UriComponent.encode(query, UriComponent.Type.UNRESERVED); // manually encode query string because UriBuilder::build will complain about {}
+ URI sparqlUrl = UriBuilder.fromUri(endpoint).queryParam(AC.query.getLocalName(), encodedQuery).build();
+ String encodedSparqlUrl = UriComponent.encode(sparqlUrl.toString(), UriComponent.Type.UNRESERVED); // manually encode URL
+ URI uri = uriInfo.getBaseUriBuilder().queryParam(AC.uri.getLocalName(), encodedSparqlUrl).build();
+
+ return Response.seeOther(uri).build();
+ }
+
+ throw new NotFoundException("Resource URI not supplied");
+ }
+
+}
diff --git a/src/main/java/com/atomgraph/client/util/Constructor.java b/src/main/java/com/atomgraph/client/util/Constructor.java
deleted file mode 100644
index 2d947902..00000000
--- a/src/main/java/com/atomgraph/client/util/Constructor.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright 2015 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.atomgraph.client.util;
-
-import com.atomgraph.client.exception.OntologyException;
-import com.atomgraph.client.vocabulary.SP;
-import com.atomgraph.client.vocabulary.SPIN;
-import org.apache.jena.ontapi.model.OntClass;
-import org.apache.jena.rdf.model.Model;
-import org.apache.jena.rdf.model.Property;
-import org.apache.jena.rdf.model.Resource;
-import org.apache.jena.rdf.model.Statement;
-import org.apache.jena.rdf.model.StmtIterator;
-import org.apache.jena.vocabulary.RDF;
-import org.apache.jena.query.Query;
-import org.apache.jena.query.QueryExecution;
-import org.apache.jena.query.QueryFactory;
-import org.apache.jena.query.QueryParseException;
-import org.apache.jena.rdf.model.RDFNode;
-import org.apache.jena.sparql.core.Var;
-import org.apache.jena.sparql.engine.binding.Binding;
-import org.apache.jena.sparql.engine.binding.BindingFactory;
-import org.apache.jena.sparql.expr.ExprVar;
-import org.apache.jena.sparql.syntax.ElementBind;
-import org.apache.jena.sparql.syntax.ElementGroup;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author Martynas Jusevičius {@literal }
- */
-public class Constructor
-{
-
- private static final Logger log = LoggerFactory.getLogger(Constructor.class);
-
- public Resource construct(OntClass forClass, Model targetModel, String baseURI)
- {
- return construct(forClass, targetModel, baseURI, null);
- }
-
- public Resource construct(OntClass forClass, Model targetModel, String baseURI, String resourceURI)
- {
- if (targetModel == null) throw new IllegalArgumentException("Model cannot be null");
-
- final Resource resource;
- if (resourceURI == null) resource = targetModel.createResource(); // blank node
- else resource = targetModel.createResource(resourceURI); // URI resource
-
- return constructInstance(forClass, SPIN.constructor, resource, baseURI).
- addProperty(RDF.type, forClass);
- }
-
- /**
- * Constructs new anonymous individual of an ontology class.
- * It walks up the superclass chains and executes SPIN constructors.
- *
- * @param forClass class for which to construct new instance
- * @param property property that attaches CONSTRUCT query resource to class resource, usually spin:constructor
- * @param instance the instance resource
- * @param baseURI base URI of the query
- * @return the instance resource with constructed properties
- */
- public Resource constructInstance(OntClass forClass, Property property, Resource instance, String baseURI)
- {
- if (forClass == null) throw new IllegalArgumentException("OntClass cannot be null");
- if (instance == null) throw new IllegalArgumentException("Instance Resource cannot be null");
- if (baseURI == null) throw new IllegalArgumentException("Base URI cannot be null");
-
- StmtIterator constructorIt = forClass.listProperties(property);
- try
- {
- while (constructorIt.hasNext()) // traverse all constructors
- {
- RDFNode constructor = constructorIt.next().getObject();
- if (!constructor.isResource())
- {
- if (log.isErrorEnabled()) log.error("Constructor is invoked but {} is not defined for class <{}>", property, forClass.getURI());
- throw new OntologyException("Constructor property not defined", forClass, property);
- }
-
- Statement queryText = constructor.asResource().getProperty(SP.text);
- if (queryText == null || !queryText.getObject().isLiteral())
- {
- if (log.isErrorEnabled()) log.error("Constructor resource <{}> does not have sp:text property", constructor);
- throw new OntologyException("Query property not defined", constructor.asResource(), SP.text);
- }
-
- try
- {
- Query query = QueryFactory.create(queryText.getString(), baseURI);
-
- // Inject BIND(?_this_bind AS ?this) into the WHERE clause.
- // This keeps ?this as a variable in the CONSTRUCT template (not a written blank node),
- // so the template picks up the concrete node value — preserving blank node identity.
- // See: https://github.com/apache/jena/issues/3267
- Var bindVar = Var.alloc("_this_bind");
- ElementGroup group = new ElementGroup();
- group.addElement(query.getQueryPattern());
- group.addElement(new ElementBind(Var.alloc(SPIN.THIS_VAR_NAME), new ExprVar(bindVar)));
- query.setQueryPattern(group);
-
- Binding binding = BindingFactory.binding(bindVar, instance.asNode());
-
- try (QueryExecution qex = QueryExecution.create().
- query(query).
- model(instance.getModel()).
- substitution(binding).
- build())
- {
- instance.getModel().add(qex.execConstruct());
- }
- }
- catch (QueryParseException ex)
- {
- if (log.isErrorEnabled()) log.error("Constructor resource '{}' sp:text property contains an invalid SPARQL CONSTRUCT", constructor);
- throw new OntologyException("Invalid SPARQL CONSTRUCT", ex, constructor.asResource(), SP.text);
- }
- }
- }
- finally
- {
- constructorIt.close();
- }
-
- forClass.superClasses(true).forEach(superClass -> constructInstance(superClass, property, instance, baseURI));
-
- return instance;
- }
-
-}
diff --git a/src/main/java/com/atomgraph/client/vocabulary/AC.java b/src/main/java/com/atomgraph/client/vocabulary/AC.java
index 9d6aa1da..27e4affa 100644
--- a/src/main/java/com/atomgraph/client/vocabulary/AC.java
+++ b/src/main/java/com/atomgraph/client/vocabulary/AC.java
@@ -65,8 +65,6 @@ public static String getURI()
public static final Resource MapMode = m_model.createOntClass( NS + "MapMode" );
public static final Resource ReadMode = m_model.createOntClass( NS + "ReadMode" );
-
- public static final Resource ConstructMode = m_model.createOntClass( NS + "ConstructMode" );
public static final Property contextUri = m_model.createObjectProperty( NS + "contextUri" );
@@ -97,8 +95,6 @@ public static String getURI()
/** The language the representation is composed in, as opposed to the languages the reader accepts. */
public static final Property contentLang = m_model.createDataProperty( NS + "contentLang" );
- public static final Property forClass = m_model.createObjectProperty( NS + "forClass" );
-
public static final Property instance = m_model.createDataProperty( NS + "instance" );
// CONFIG - separate?
diff --git a/src/main/java/com/atomgraph/client/vocabulary/SPIN.java b/src/main/java/com/atomgraph/client/vocabulary/SPIN.java
deleted file mode 100644
index d02f5866..00000000
--- a/src/main/java/com/atomgraph/client/vocabulary/SPIN.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2018 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.atomgraph.client.vocabulary;
-
-import org.apache.jena.ontapi.OntModelFactory;
-import org.apache.jena.ontapi.OntSpecification;
-import org.apache.jena.ontapi.model.OntModel;
-
-import org.apache.jena.rdf.model.Property;
-import org.apache.jena.rdf.model.ResourceFactory;
-
-/**
- *
- * @author Martynas Jusevičius {@literal }
- */
-public class SPIN
-{
-
- static
- {
- org.apache.jena.sys.JenaSystem.init(); // ensure Jena (RDFS vocab) is initialized before ontapi touches it
- }
-
- public final static String THIS_VAR_NAME = "this";
-
- /** The RDF model that holds the vocabulary terms
*/
- private static OntModel m_model = OntModelFactory.createModel(OntSpecification.OWL2_FULL_MEM);
-
- /** The namespace of the vocabulary as a string
*/
- public static final String NS = "http://spinrdf.org/spin#";
-
- /** The namespace of the vocabulary as a string
- * @see #NS */
- public static String getURI()
- {
- return NS;
- }
-
- public final static Property constructor = ResourceFactory.createProperty(NS + "constructor");
-
-}
diff --git a/src/main/java/com/atomgraph/client/writer/XSLTWriterBase.java b/src/main/java/com/atomgraph/client/writer/XSLTWriterBase.java
index e31ae36d..79246cfe 100644
--- a/src/main/java/com/atomgraph/client/writer/XSLTWriterBase.java
+++ b/src/main/java/com/atomgraph/client/writer/XSLTWriterBase.java
@@ -17,7 +17,6 @@
import com.atomgraph.client.util.RDFSourceResolver;
import com.atomgraph.client.vocabulary.AC;
-import com.atomgraph.client.vocabulary.LDT;
import com.atomgraph.core.util.Link;
import java.net.URI;
import java.net.URISyntaxException;
@@ -148,8 +147,6 @@ public Map getParameters(MultivaluedMap params = new HashMap<>();
- params.put(new QName("ac", AC.httpHeaders.getNameSpace(), AC.httpHeaders.getLocalName()), new XdmAtomicValue(headerMap.toString()));
- params.put(new QName("ac", AC.method.getNameSpace(), AC.method.getLocalName()), new XdmAtomicValue(getRequest().getMethod()));
params.put(new QName("ac", AC.contextUri.getNameSpace(), AC.contextUri.getLocalName()), new XdmAtomicValue(getContextURI()));
try
@@ -161,15 +158,6 @@ public Map getParameters(MultivaluedMap modes = getModes(getSupportedNamespaces()); // check if explicit mode URL parameter is provided
if (!modes.isEmpty()) params.put(new QName("ac", AC.mode.getNameSpace(), AC.mode.getLocalName()), XdmValue.makeSequence(modes));
- URI ontologyURI = getLinkURI(headerMap, LDT.ontology);
- if (ontologyURI != null) params.put(new QName("ldt", LDT.ontology.getNameSpace(), LDT.ontology.getLocalName()), new XdmAtomicValue(ontologyURI));
-
- URI baseURI = getLinkURI(headerMap, LDT.base);
- if (baseURI != null) params.put(new QName("ldt", LDT.base.getNameSpace(), LDT.base.getLocalName()), new XdmAtomicValue(baseURI));
-
- String forClassURI = getUriInfo().getQueryParameters().getFirst(AC.forClass.getLocalName());
- if (forClassURI != null) params.put(new QName("ac", AC.forClass.getNameSpace(), AC.forClass.getLocalName()), new XdmAtomicValue(URI.create(forClassURI)));
-
// ordered language preference list from Accept-Language
List langs = getHttpHeaders().getAcceptableLanguages().stream().
map(Locale::getLanguage).
diff --git a/src/main/java/com/atomgraph/client/writer/function/ConstructForClass.java b/src/main/java/com/atomgraph/client/writer/function/ConstructForClass.java
deleted file mode 100644
index c7168da2..00000000
--- a/src/main/java/com/atomgraph/client/writer/function/ConstructForClass.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright 2020 Martynas Jusevičius .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.atomgraph.client.writer.function;
-
-import com.atomgraph.client.util.Constructor;
-import com.atomgraph.client.vocabulary.AC;
-import static com.atomgraph.client.writer.ModelXSLTWriter.checkURI;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import javax.xml.transform.stream.StreamSource;
-import net.sf.saxon.s9api.ExtensionFunction;
-import net.sf.saxon.s9api.ItemType;
-import net.sf.saxon.s9api.OccurrenceIndicator;
-import net.sf.saxon.s9api.Processor;
-import net.sf.saxon.s9api.QName;
-import net.sf.saxon.s9api.SaxonApiException;
-import net.sf.saxon.s9api.SequenceType;
-import net.sf.saxon.s9api.XdmValue;
-import com.atomgraph.client.util.jena.PrefixGraphRepository;
-import org.apache.jena.ontapi.OntModelFactory;
-import org.apache.jena.ontapi.OntSpecification;
-import org.apache.jena.ontapi.model.OntClass;
-import org.apache.jena.ontapi.model.OntModel;
-import org.apache.jena.rdf.model.Model;
-import org.apache.jena.rdf.model.ModelFactory;
-import org.apache.jena.riot.RDFFormat;
-import org.apache.jena.riot.RDFWriter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * ac:construct() XSLT function that constructs instances for given classes from their constructors.
- * Plugs into the Saxon processor.
- *
- * @author Martynas Jusevičius {@literal }
- * @see Integrated extension functions
- */
-public class ConstructForClass implements ExtensionFunction
-{
-
- private static final Logger log = LoggerFactory.getLogger(ConstructForClass.class);
-
- private final Processor processor;
- private final PrefixGraphRepository repository;
-
- public ConstructForClass(Processor processor, PrefixGraphRepository repository)
- {
- this.processor = processor;
- this.repository = repository;
- }
-
- @Override
- public QName getName()
- {
- return new QName(AC.NS, "construct");
- }
-
- @Override
- public SequenceType getResultType()
- {
- return SequenceType.makeSequenceType(ItemType.DOCUMENT_NODE, OccurrenceIndicator.ZERO_OR_MORE);
- }
-
- @Override
- public SequenceType[] getArgumentTypes()
- {
- return new SequenceType[]
- {
- SequenceType.makeSequenceType(ItemType.ANY_URI, OccurrenceIndicator.ONE),
- SequenceType.makeSequenceType(ItemType.ANY_URI, OccurrenceIndicator.ZERO_OR_MORE),
- SequenceType.makeSequenceType(ItemType.ANY_URI, OccurrenceIndicator.ONE),
- };
- }
-
- @Override
- public XdmValue call(XdmValue[] arguments) throws SaxonApiException
- {
- try
- {
- String ontology = arguments[0].itemAt(0).getStringValue();
- String base = arguments[2].itemAt(0).getStringValue();
-
- Model instances = ModelFactory.createDefaultModel();
- try
- {
- OntModel ontModel = OntModelFactory.createModel(getRepository().get(ontology), OntSpecification.OWL2_FULL_MEM, getRepository());
-
- arguments[1].stream().
- map(forClass -> ontModel.getOntClass(checkURI(forClass.getStringValue()).toString())).
- filter(forClass -> forClass != null).
- forEach(forClass -> new Constructor().construct(forClass, instances, base));
- }
- catch (RuntimeException ex) // ontology or one of its imports could not be loaded — return empty result instead of failing the transform
- {
- if (log.isWarnEnabled()) log.warn("Could not construct instances for ontology '{}': {}", ontology, ex.toString());
- }
-
- return getProcessor().newDocumentBuilder().build(getSource(instances));
- }
- catch (IOException ex)
- {
- throw new SaxonApiException(ex);
- }
- }
-
- public StreamSource getSource(Model model) throws IOException
- {
- if (model == null) throw new IllegalArgumentException("Model cannot be null");
-
- try (ByteArrayOutputStream stream = new ByteArrayOutputStream())
- {
- RDFWriter.create().
- format(RDFFormat.RDFXML_PLAIN).
- source(model).
- output(stream);
- return new StreamSource(new ByteArrayInputStream(stream.toByteArray()));
- }
- }
-
- public Processor getProcessor()
- {
- return processor;
- }
-
- public PrefixGraphRepository getRepository()
- {
- return repository;
- }
-
-}
diff --git a/src/main/resources/com/atomgraph/client/ns.ttl b/src/main/resources/com/atomgraph/client/ns.ttl
index 5074815a..58c13e39 100644
--- a/src/main/resources/com/atomgraph/client/ns.ttl
+++ b/src/main/resources/com/atomgraph/client/ns.ttl
@@ -1,17 +1,15 @@
@base .
@prefix : <#> .
-@prefix rdf: .
@prefix rdfs: .
@prefix xsd: .
@prefix owl: .
@prefix ldt: .
-@prefix foaf: .
# ONTOLOGY
: a owl:Ontology ;
- rdfs:label "Atomgraph Client ontology" ;
+ rdfs:label "AtomGraph Client ontology" ;
owl:versionInfo "2.1.0" .
# PROPERTIES
@@ -93,10 +91,6 @@
# UI keywords
-# rename to :Create?
-:ConstructMode rdfs:label "Create" ;
- rdfs:isDefinedBy : .
-
:Delete rdfs:label "Delete" ;
rdfs:isDefinedBy : .
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
index 2c41f952..39ccb143 100644
--- a/src/main/webapp/WEB-INF/web.xml
+++ b/src/main/webapp/WEB-INF/web.xml
@@ -8,7 +8,7 @@
Generic Linked Data client
https://w3id.org/atomgraph/client#stylesheet
- static/com/atomgraph/client/xsl/bootstrap/2.3.2/external-layout.xsl
+ static/com/atomgraph/client/xsl/external-layout.xsl
https://w3id.org/atomgraph/core#resultLimit
@@ -40,4 +40,27 @@
com.atomgraph.core.util.jena.StartupListener
+
+
+ css
+ text/css;charset=UTF-8
+
+
+ js
+ text/javascript;charset=UTF-8
+
+
+ txt
+ text/plain;charset=UTF-8
+
+
+ xsl
+ text/xsl;charset=UTF-8
+
diff --git a/src/main/webapp/static/com/atomgraph/client/css/bootstrap.css b/src/main/webapp/static/com/atomgraph/client/css/bootstrap.css
deleted file mode 100644
index cfc30ec1..00000000
--- a/src/main/webapp/static/com/atomgraph/client/css/bootstrap.css
+++ /dev/null
@@ -1,19 +0,0 @@
-body { padding-top: 120px; padding-bottom: 40px; }
-.brand img { height: 0.8em; width: auto; }
-form.form-inline { margin: 0; }
-ul.inline { margin-left: 0; max-height: 7em; overflow-y: auto; }
-.inline li { display: inline; }
-.btn-type.btn-primary { font-weight: bold; background: inherit; }
-.well-small { background-color: #FAFAFA; }
-.well-small dl { max-height: 60em; overflow-y: auto; }
-textarea#query-string { font-family: monospace; }
-.thumbnail img { display: block; margin: auto; }
-.thumbnail { min-height: 15em; }
-#map-canvas { height: 35em; width: 100%; }
-ul.typeahead { max-height: 20em; overflow: auto; }
-label.typeahead input { display: block; max-width: 160px; }
-label.typeahead { float: left; width: 160px; }
-
-/* SVG */
-
-g.subject:hover circle { stroke-width: 2; }
\ No newline at end of file
diff --git a/src/main/webapp/static/com/atomgraph/client/css/client.css b/src/main/webapp/static/com/atomgraph/client/css/client.css
new file mode 100644
index 00000000..6227a4a1
--- /dev/null
+++ b/src/main/webapp/static/com/atomgraph/client/css/client.css
@@ -0,0 +1,175 @@
+/* =========================================================================
+ Web-Client browser chrome — composition styles for the stylesheets' own
+ markup: page shell, resource blocks, collections, results table, form rows.
+ Tokens come from colors_and_type.css and the primitives from the core kit;
+ this file never redefines either.
+ ========================================================================= */
+
+@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap');
+
+* { box-sizing: border-box; }
+html, body { margin: 0; padding: 0; }
+body { background: var(--surface-1); color: var(--fg-1); font-family: var(--font-sans); font-size: var(--fs-base); line-height: var(--lh-base); }
+a { color: var(--fg-link); text-decoration: none; }
+a:hover { text-decoration: underline; }
+img { max-width: 100%; }
+pre { background: var(--surface-2); border: 1px solid var(--border-default); border-radius: var(--r-sm); padding: var(--sp-3); overflow-x: auto; font-family: var(--font-mono); font-size: var(--fs-sm); }
+
+/* ---------- page shell ---------- */
+.header { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-3) var(--sp-6); background: var(--surface-0); border-bottom: 1px solid var(--border-default); flex-wrap: wrap; }
+.header .logo { display: inline-flex; align-items: center; flex-shrink: 0; }
+.header .logo img { display: block; max-height: 36px; }
+.header .uri-form { display: flex; align-items: center; gap: var(--sp-2); flex: 1 1 24rem; min-width: 0; margin: 0; }
+.header .uri-form .ac-field { flex: 1 1 auto; min-width: 0; }
+.header .actions { display: flex; align-items: center; gap: var(--sp-4); margin-left: auto; }
+
+.action-bar { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-2) var(--sp-6); background: var(--surface-0); border-bottom: 1px solid var(--border-default); flex-wrap: wrap; }
+.ab-left { flex: 0 0 auto; }
+/* the bar's controls sit at the end of the row. The breadcrumb used to do this as a side effect -
+ it was the only growing child, so it absorbed the free space and pushed everything past it -
+ which left the controls hard left the moment it went. Stating it on the container instead does
+ not depend on what else the bar happens to contain. */
+.ab-main { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-3); flex: 1 1 auto; min-width: 0; }
+.ab-main .actions { display: flex; align-items: center; gap: var(--sp-2); }
+.ab-main .actions form { margin: 0; }
+
+
+.content { display: flex; align-items: flex-start; gap: var(--sp-5); width: 100%; max-width: 1400px; margin: 0 auto; padding: var(--sp-5) var(--sp-6); }
+.main { flex: 1 1 auto; min-width: 0; }
+.aside { flex: 0 0 320px; min-width: 0; }
+
+.footer { padding: var(--sp-5) var(--sp-6); border-top: 1px solid var(--border-default); color: var(--fg-muted); font-size: var(--fs-sm); text-align: center; }
+.footer p { margin: 0; }
+
+/* ---------- menus: -based dropdowns, no script ---------- */
+.menu { position: relative; display: inline-block; }
+.menu > summary { list-style: none; cursor: pointer; }
+.menu > summary::-webkit-details-marker { display: none; }
+.menu > .menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; min-width: 180px; margin: 0; padding: var(--sp-1); list-style: none; background: var(--surface-0); border: 1px solid var(--border-default); border-radius: var(--r-md); box-shadow: var(--shadow-md); }
+.menu-list li a { display: block; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); color: var(--fg-1); white-space: nowrap; }
+.menu-list li a:hover { background: var(--bg-hover); text-decoration: none; }
+.menu-list li.is-active a { background: var(--bg-selected); color: var(--fg-selected); }
+
+/* ---------- resource blocks ---------- */
+.block { background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--r-lg); padding: var(--sp-5); margin-bottom: var(--sp-4); min-width: 0; container-type: inline-size; }
+.block-header { position: relative; }
+.block-header > .actions { position: absolute; top: 0; right: 0; display: flex; gap: var(--sp-2); }
+.block-header > .actions form { margin: 0; }
+.block-header h2 { margin: 0 0 var(--sp-1); font-size: var(--fs-xl); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-snug); overflow-wrap: break-word; }
+.block-header .description { margin: 0 0 var(--sp-2); color: var(--fg-2); max-width: 78ch; }
+.depiction { display: block; margin-bottom: var(--sp-3); }
+.depiction img { display: block; max-height: 200px; border-radius: var(--r-md); }
+
+.types { display: flex; flex-wrap: wrap; gap: var(--sp-2); list-style: none; margin: 0; padding: 0; font-size: var(--fs-sm); }
+.types li { display: inline-flex; min-width: 0; }
+
+/* ---------- read-mode property list ----------
+ One dt can be followed by N dds (multi-valued property; the grouping pass suppresses the repeated
+ terms), so this is float/clear column layout rather than a two-column grid: grid auto-placement
+ cannot keep a run of dds in the value column without per-group wrappers the flat dl does not have */
+/* Its own query container: the list lays out by the width IT has, which is not the viewport's. A
+ property list renders in the document column, in a sidebar and inside a nested resource, and at a
+ 1440px desktop the 300px case left the value 100px against a 200px label. See RESPONSIVE.md in
+ the design system - the stop and the reasoning are shared with the app kit's statement grid. */
+.properties { margin: var(--sp-4) 0 0; container-type: inline-size; }
+.properties::after { content: ""; display: block; clear: both; }
+.properties dt { float: left; clear: left; width: 200px; padding-right: var(--sp-4); box-sizing: border-box; font-weight: var(--fw-medium); color: var(--fg-2); overflow-wrap: break-word; }
+.properties dd { margin: 0 0 var(--sp-1) 200px; min-width: 0; overflow-wrap: break-word; }
+/* Narrow, the label stops being a column and becomes a line above its value. The float has to be
+ released as well as the indent: a floated dt with the dd's margin removed would have the value
+ wrap around it rather than start beneath it. */
+@container (max-width: 520px) {
+ .properties dt { float: none; clear: none; width: auto; padding-right: 0; }
+ .properties dd { margin-left: 0; }
+}
+.properties dd .ac-tag { margin-right: var(--sp-1); }
+
+/* ---------- collections ---------- */
+.resource-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-4); }
+.resource-list > li { position: relative; background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--r-lg); padding: var(--sp-5); min-width: 0; container-type: inline-size; }
+.resource-list > li > .actions { position: absolute; top: var(--sp-4); right: var(--sp-4); display: flex; gap: var(--sp-2); }
+.resource-list > li > .actions form { margin: 0; }
+.resource-list h2 { margin: 0 0 var(--sp-1); font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
+
+.resource-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--sp-4); }
+.resource-grid > li { min-width: 0; display: flex; }
+.resource-grid .ac-card { flex: 1; min-width: 0; }
+.resource-grid .depiction { margin: 0; }
+.resource-grid .depiction img { width: 100%; max-height: 180px; object-fit: cover; border-radius: var(--r-md) var(--r-md) 0 0; }
+.resource-grid h2 { margin: 0 0 var(--sp-1); font-size: var(--fs-base); font-weight: var(--fw-medium); }
+.resource-grid .ac-card-body { position: relative; }
+.resource-grid .ac-card-body > .actions { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-2); }
+.resource-grid .ac-card-body > .actions form { margin: 0; }
+
+/* ---------- results table: native table layout, the column count is data-driven ---------- */
+.results-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); background: var(--surface-0); border: 1px solid var(--border-default); border-radius: var(--r-sm); }
+.results-table th, .results-table td { padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--border-default); text-align: left; vertical-align: middle; }
+.results-table tr:last-child > td { border-bottom: 0; }
+.results-table thead th { font-family: var(--font-mono); font-size: 10px; letter-spacing: var(--tracking-wide); text-transform: uppercase; font-weight: var(--fw-regular); color: var(--fg-hint); background: var(--surface-2); }
+.results-table tbody tr:hover > td { background: var(--surface-1); }
+.results-table td > .values { max-height: 12em; overflow-y: auto; min-width: 0; overflow-wrap: break-word; }
+.results-table td img { max-height: 60px; border-radius: var(--r-xs); vertical-align: middle; }
+
+/* ---------- forms ---------- */
+/* The fieldset is the statement rows' query container - a row cannot query itself, and the fieldset
+ is the one box always between a .statement and whatever surface holds the form. Nested fieldsets
+ (an inlined blank node sits in a value column) therefore give their own rows a narrower container
+ than the outer form's, which is exactly right. */
+fieldset { border: 0; padding: 0; margin: 0 0 var(--sp-5); min-inline-size: 0; container-type: inline-size; }
+legend { padding: 0; margin: 0 0 var(--sp-3); font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--fg-1); }
+fieldset .description { margin: 0 0 var(--sp-4); color: var(--fg-2); }
+
+/* one statement row: predicate label · value controls · term annotations */
+.statement { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; column-gap: var(--sp-4); align-items: start; padding: var(--sp-2) 0; border-bottom: 1px solid var(--border-default); }
+.statement:last-of-type { border-bottom: 0; }
+/* minmax(140px, 220px) resolves to its MAXIMUM next to a 1fr sibling - the flexible track is sized
+ last, so the label takes 220px and the value takes what is left: 106px in a phone's content column
+ and 64px in a 300px container, at any viewport. Narrow, the label takes its own line. */
+@container (max-width: 520px) {
+ .statement { grid-template-columns: minmax(0, 1fr); row-gap: var(--sp-1); }
+ .statement > .values { grid-column: 1; }
+}
+.statement > .ac-label { padding-top: 6px; overflow-wrap: break-word; min-width: 0; }
+/* nowrap keeps the type tag and the statement actions on the field's own line; the field shrinks instead */
+.statement > .values { grid-column: 2; display: flex; flex-wrap: nowrap; align-items: center; gap: var(--sp-2); min-width: 0; }
+.statement > .ac-label ~ .values { grid-column: auto; }
+.statement > .annotations { grid-column: 2; display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-1); }
+.statement .ac-field { flex: 0 1 340px; min-width: 8rem; }
+.statement .values > .ac-tag, .statement .values > .ac-iconbtn { flex-shrink: 0; }
+.statement .ac-field:has(textarea) { flex: 1 1 100%; }
+.statement.is-invalid .ac-field-box { border-color: var(--danger-500); }
+.annotations .ac-field { width: 12ch; flex: 0 0 auto; }
+
+/* statement actions: the ghost icon buttons get a resting affordance here - without hover chrome around
+ them, a bare minus glyph reads as punctuation rather than a control */
+.statement .values > .ac-iconbtn { border: 1px solid var(--border-default); color: var(--fg-hint); }
+
+/* an inlined blank-node resource nests its own fieldset inside the value column: recess it so its rows
+ read as one contained sub-form. The nesting row wraps (the fieldset takes the full row), plain value
+ rows stay nowrap */
+.statement > .values:has(> fieldset) { flex-wrap: wrap; }
+.statement > .values > fieldset { flex: 1 1 100%; margin: 0; padding: var(--sp-3) var(--sp-4); background: var(--surface-1); border: 1px solid var(--border-default); border-radius: var(--r-md); }
+.statement > .values > fieldset legend { font-size: var(--fs-base); }
+
+.form-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-4) 0 0; }
+
+/* ---------- SPARQL editor ---------- */
+.query-form .ac-label { display: block; margin-bottom: var(--sp-1); }
+.query-form .ac-field { margin-bottom: var(--sp-3); }
+
+/* ---------- map ---------- */
+.map-canvas { width: 100%; height: 480px; border-radius: var(--r-md); background: var(--surface-2); }
+
+/* map mode is a full-bleed canvas: the page becomes a viewport-high column and the map takes every
+ pixel below the bars; the footer and the (empty) aside yield. align-items MUST be stretch - the
+ base .content aligns flex-start, which sizes .main to its content, and a map canvas has no
+ intrinsic height, so the whole chain collapsed to 0 */
+.map-view { display: flex; flex-direction: column; height: 100vh; }
+.map-view .header, .map-view .action-bar { flex-shrink: 0; }
+.map-view .content { flex: 1 1 auto; align-items: stretch; min-height: 0; max-width: none; margin: 0; padding: 0; }
+.map-view .main { display: flex; min-width: 0; min-height: 0; }
+.map-view .map-canvas { flex: 1 1 auto; height: auto; border-radius: 0; }
+.map-view .aside, .map-view .footer { display: none; }
+
+/* ---------- alerts fill their column ---------- */
+.main > .ac-alert { margin-bottom: var(--sp-4); }
diff --git a/src/main/webapp/static/com/atomgraph/client/css/colors_and_type.css b/src/main/webapp/static/com/atomgraph/client/css/colors_and_type.css
new file mode 100644
index 00000000..c4bed7f4
--- /dev/null
+++ b/src/main/webapp/static/com/atomgraph/client/css/colors_and_type.css
@@ -0,0 +1,626 @@
+/* =========================================================================
+ LinkedDataHub Design System — Tokens
+ Base palette + typography for the LinkedDataHub Knowledge Graph platform.
+ Remix of the platform's legacy palette and Material UI with Base44-style whitespace,
+ pastel gradients and modern variable-font typography.
+ ========================================================================= */
+
+/* Fonts loaded via Google Fonts — substitutions noted in README. */
+@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300..800&family=Geist+Mono:wght@400..700&family=Instrument+Serif:ital@0;1&display=swap');
+
+:root {
+ /* ---------- Color: Brand / Primary ---------- */
+ /* Pulled from the live product. The blue is the action color, the violet the
+ "structured / semantic" accent (used historically on RDF-typed labels). */
+ --ldh-blue-50: #eef5ff;
+ --ldh-blue-100: #dbeafe;
+ --ldh-blue-200: #b8d3fd;
+ --ldh-blue-300: #8bb7fb;
+ --ldh-blue-400: #4d94f8;
+ --ldh-blue-500: #0f82f5; /* Brand primary — matches legacy product */
+ --ldh-blue-600: #086ad6;
+ --ldh-blue-700: #0a55a8;
+ --ldh-blue-800: #0d4382;
+ --ldh-blue-900: #0a2d57;
+
+ --ldh-violet-50: #faf5ff;
+ --ldh-violet-100: #f1e6fb;
+ --ldh-violet-200: #e1cdf6;
+ --ldh-violet-300: #c9a6ed;
+ --ldh-violet-400: #ad7adf;
+ --ldh-violet-500: #9954bb; /* Brand accent — historical RDF tag color */
+ --ldh-violet-600: #803fa1;
+ --ldh-violet-700: #63307c;
+ --ldh-violet-800: #482358;
+ --ldh-violet-900: #2e1638;
+
+ /* ---------- Color: Pastel surface palette ---------- */
+ /* These wash backgrounds for hero / landing / category surfaces. Always paired
+ with --ink-1 text. Use as `background: var(--surf-lavender)` or composed in
+ a mesh gradient (see Visual Foundations in README). */
+ --surf-lavender: #efeaff;
+ --surf-mint: #e6f6ee;
+ --surf-peach: #ffece1;
+ --surf-sky: #e3f1ff;
+ --surf-blush: #ffe6ee;
+ --surf-sand: #fcf5e7;
+
+ /* Pre-built gradients — used on hero / featured cards. */
+ --grad-aurora: linear-gradient(135deg, #efeaff 0%, #e3f1ff 50%, #e6f6ee 100%); /* @kind color */
+ --grad-dawn: linear-gradient(135deg, #ffece1 0%, #ffe6ee 60%, #efeaff 100%); /* @kind color */
+ --grad-noon: linear-gradient(135deg, #e3f1ff 0%, #ffffff 50%, #efeaff 100%); /* @kind color */
+ --grad-deep: linear-gradient(135deg, #0a2d57 0%, #482358 100%); /* @kind color */
+ --grad-radial-spot: radial-gradient(60% 60% at 30% 20%, #efeaff 0%, transparent 60%),
+ radial-gradient(50% 50% at 80% 70%, #e3f1ff 0%, transparent 65%),
+ #ffffff; /* @kind color */
+
+ /* ---------- Color: Neutrals ---------- */
+ /* Warm-white surfaces, near-black ink. NOT pure greys — slight blue undertone
+ to harmonise with the brand blue. */
+ --ink-1: #0b0e14; /* primary text, headings */
+ --ink-2: #2b3245; /* body text */
+ --ink-3: #545b6e; /* secondary text, meta */
+ --ink-4: #8a91a3; /* tertiary / hint */
+ --ink-5: #b6bccc; /* disabled */
+
+ --surface-0: #ffffff; /* card / dialog */
+ --surface-1: #fafbfd; /* page */
+ --surface-2: #f3f5f9; /* recessed wells, table stripes */
+ --surface-3: #e8ebf2; /* dividers, subtle borders */
+ --line-1: #e2e6ee; /* default border */
+ --line-2: #cdd3df; /* stronger border, focus ring outer */
+
+ /* ---------- Color: Semantic ---------- */
+ --success-500: #14a06a;
+ --success-50: #e6f6ee;
+ --warning-500: #d48a08;
+ --warning-50: #fff4dc;
+ --danger-500: #d63a3a;
+ --danger-600: #b62f2f;
+ --danger-50: #ffe6e6;
+ /* Ink for text/icons sitting ON a --danger-500 fill. A token, not a literal:
+ skins whose danger is a light tint need dark ink here instead of white. */
+ --fg-on-danger: #ffffff;
+ --info-500: var(--ldh-blue-500);
+ --info-50: var(--ldh-blue-50);
+
+ /* ---------- RDF semantic colors ----------
+ Used to colour-code RDF node types in graph / list / table views.
+ Pulled from the live product (force-graph palette). */
+ --rdf-class: #9954bb; /* purple — owl:Class instances */
+ --rdf-resource: #4d94f8; /* blue — generic resources */
+ --rdf-literal: #14a06a; /* green — literals / values */
+ --rdf-blank: #d48a08; /* amber — blank nodes */
+ --rdf-named: #ad7adf; /* light violet — named graphs */
+
+ /* ===========================================================================
+ PALETTE GOVERNANCE — how to choose among the many hues without drift.
+ ---------------------------------------------------------------------------
+ 1. BLUE is the only interaction color. Buttons, links, focus, selected
+ state — all blue. Nothing else means "clickable".
+ 2. VIOLET is decoration ONLY where it overlaps RDF: note that --ldh-violet-500
+ and --rdf-class are the SAME purple by design. Use the violet ramp for
+ chrome accents *sparingly* (it reads as "structured/semantic"); use the
+ --rdf-* tokens whenever the color is ENCODING a node type in data/viz.
+ Never use violet as a second action color — that competes with blue.
+ 3. RDF-* tokens are DATA ENCODING, not decoration. Only use them where the
+ hue carries meaning (graph nodes, type pills, legends).
+ 4. SEMANTIC (success/warning/danger) = status only, never decoration.
+ 5. PASTEL surfaces + GRADIENTS are HERO-ONLY: document intros, landing /
+ category wash, empty-state art. Never behind body content or as a
+ default card background — that's the fastest route to "gradient slop".
+ =========================================================================== */
+
+ /* ---------- Typography: Families ---------- */
+ --font-sans: 'Geist', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
+ --font-mono: 'Geist Mono', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
+ --font-display: 'Instrument Serif', Georgia, 'Times New Roman', serif;
+
+ /* ---------- Typography: Scale ---------- */
+ /* Modular scale ~1.25 (major third). Tuned for dense info-dense UI plus the
+ big-headline pastel hero moments.
+ ROLE MAP (the low end is tight on purpose — assign by role, don't eyeball):
+ --fs-xs 12 mono meta: IRIs, counts, timestamps, eyebrows, tags
+ --fs-sm 13 secondary UI: labels, table cells, buttons, captions
+ --fs-base 15 DEFAULT body & UI text ← start here
+ --fs-md 17 lead paragraphs / emphasised body only
+ --fs-lg+ 20+ headings (use the .ldh-h* classes, not raw sizes)
+ Rule: body/UI is base; drop to sm only for genuinely secondary text; xs is
+ mono-meta only. If you reach for md on plain UI, you probably want base. */
+ --fs-xs: 12px;
+ --fs-sm: 13px;
+ --fs-base: 15px;
+ --fs-md: 17px;
+ --fs-lg: 20px;
+ --fs-xl: 24px;
+ --fs-2xl: 30px;
+ /* The display end is FLUID; the UI end is not. A fixed 88px headline cannot fit a narrow
+ container - it does not shrink, it clips, and a clipped word is unreadable in a way a small
+ one is not (measured: the welcome modal's heading ran 387px inside a 356px body). The floor of
+ each clamp is the step two below it, so a display heading degrades into the scale rather than
+ out of it, and the ceiling is the value each step already had, so nothing moves at desktop.
+ Below 2xl the sizes stay fixed: body and UI text is already at its readable minimum, and
+ scaling it with the viewport is how interfaces end up with 11px labels on a phone. */
+ --fs-3xl: clamp(30px, 6vw, 38px);
+ --fs-4xl: clamp(34px, 7.5vw, 48px);
+ --fs-5xl: clamp(38px, 9vw, 64px);
+ --fs-6xl: clamp(44px, 11vw, 88px);
+
+ /* ---------- Typography: Weights ---------- */
+ --fw-regular: 400; /* @kind font */
+ --fw-medium: 500; /* @kind font */
+ --fw-semibold: 600; /* @kind font */
+ --fw-bold: 700; /* @kind font */
+
+ /* ---------- Typography: Line heights ---------- */
+ --lh-tight: 1.1; /* @kind font */
+ --lh-snug: 1.25; /* @kind font */
+ --lh-base: 1.55; /* @kind font */
+ --lh-relaxed: 1.7; /* @kind font */
+
+ /* ---------- Typography: Letter spacing ---------- */
+ --tracking-tight: -0.03em; /* display */
+ --tracking-snug: -0.015em; /* headings */
+ --tracking-normal: 0;
+ --tracking-wide: 0.04em; /* eyebrows, all-caps labels */
+ --tracking-widest: 0.18em; /* big over-line labels */
+
+ /* ---------- Radius ---------- */
+ --r-xs: 4px;
+ --r-sm: 6px;
+ --r-md: 10px;
+ --r-lg: 16px;
+ --r-xl: 20px;
+ --r-2xl: 28px;
+ --r-pill: 999px;
+
+ /* ---------- Spacing scale (4px base) ---------- */
+ --sp-1: 4px;
+ --sp-2: 8px;
+ --sp-3: 12px;
+ --sp-4: 16px;
+ --sp-5: 20px;
+ --sp-6: 24px;
+ --sp-8: 32px;
+ --sp-10: 40px;
+ --sp-12: 48px;
+ --sp-16: 64px;
+ --sp-20: 80px;
+ --sp-24: 96px;
+ --sp-32: 128px;
+
+ /* ---------- Elevation (shadows) ---------- */
+ /* Soft, low-contrast shadows — Base44 / glass vibe, not Material's harder cast. */
+ --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
+ --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
+ --shadow-md: 0 8px 24px -8px rgba(15, 23, 42, 0.10), 0 2px 4px rgba(15, 23, 42, 0.04);
+ --shadow-lg: 0 24px 48px -16px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.05);
+ --shadow-xl: 0 40px 80px -24px rgba(15, 23, 42, 0.22), 0 8px 16px rgba(15, 23, 42, 0.06);
+ --shadow-glow-blue: 0 0 0 4px rgba(15, 130, 245, 0.18);
+ --shadow-glow-violet: 0 0 0 4px rgba(153, 84, 187, 0.16);
+
+ /* Hairline inset highlight for cards on dark backgrounds */
+ --inset-hairline: inset 0 1px 0 rgba(255,255,255,0.6);
+
+ /* ---------- Motion ---------- */
+ --ease-out-soft: cubic-bezier(0.22, 1, 0.36, 1); /* @kind other */
+ --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1); /* @kind other */
+ --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* @kind other */
+ --dur-fast: 120ms; /* @kind other */
+ --dur-base: 200ms; /* @kind other */
+ --dur-slow: 360ms; /* @kind other */
+ --dur-xslow: 640ms; /* @kind other */
+
+ /* ---------- Layout ---------- */
+ --container-sm: 720px;
+ --container-md: 960px;
+ --container-lg: 1200px;
+ --container-xl: 1440px;
+
+ /* ---------- Layout: the responsive scale ----------
+ THREE STOPS, and which query type each belongs to. Custom properties cannot appear in a media
+ or container condition, so these are documentation and the literals are written out at each
+ use - keep the two in step.
+
+ 520px CONTAINER stop. A component collapses to one column.
+ 768px VIEWPORT stop. The page shell compacts: wordmark to its mark, tighter gutters.
+ 1024px VIEWPORT stop. Two-column page layouts drop the gutter.
+
+ WHICH ONE depends on what the component's container actually is, and getting this wrong is
+ the bug this scale was introduced to fix:
+
+ - The page shell (header, tab strip, action bar, footer, rails) sits directly under the
+ viewport, so the viewport IS its container: @media.
+ - Everything in the content column does not. The same statement grid renders at the
+ document's full width, inside a nested block, inside the 300px content aside and inside a
+ 372px modal body - four widths at ONE viewport. Measured: it got a 36px value column in
+ the aside at a 1440px desktop, worse than the 26px it got on a 390px phone. @container.
+
+ 520 is derived, not picked: the statement grid spends 200px on its label and 64px on its row
+ actions, so three columns need 200 + 240 of readable value + 64 to hold. Three labelled
+ selects need about the same. Two components, one number - which is what makes it a scale
+ rather than a pile of breakpoints. It replaces four one-off values (560, 640, 860, 900) that
+ shared nothing.
+
+ A component queries a container only if one is DECLARED above it. The declaring surfaces are
+ .ac-card (surfaces.css), .ac-modal-body (overlays.css), and .ldh-block / .ldh-nblock /
+ .ldh-content-aside in the app layer. Deliberately NOT .content-body: ldh:ShowModalForm appends
+ .ac-backdrop (position: fixed; inset: 0) to it. */
+ --bp-container: 520px;
+ --bp-shell-sm: 768px;
+ --bp-shell-md: 1024px;
+
+ /* ---------- Semantic: Foreground tokens (consume these in components) ---------- */
+ --fg-1: var(--ink-1);
+ --fg-2: var(--ink-2);
+ --fg-muted: var(--ink-3);
+ /* Hint text: deliberately NOT ink-4 — ink-4 (#8a91a3) is ~3:1 on white and
+ fails WCAG AA for text. ink-4 is reserved for non-text use (icons that pair
+ with a label, hairline borders, disabled glyphs). For actual hint *text*
+ use this AA-safe value (~5.7:1 on the page surface). */
+ --fg-hint: #5f6677;
+ --fg-on-accent: #ffffff;
+ --fg-link: var(--ldh-blue-600);
+
+ --bg-page: var(--surface-1);
+ --bg-card: var(--surface-0);
+ --bg-recess: var(--surface-2);
+ /* Action color for text-bearing fills (filled buttons). blue-500 (#0f82f5)
+ is only ~3.3:1 against white text — it FAILS AA. blue-600 (#086ad6) clears
+ it at ~4.6:1, so the accent fill is pinned to 600, not 500. blue-500 stays
+ available as a primitive for non-text accents (dots, focus glints). */
+ --bg-accent: var(--ldh-blue-600);
+ --bg-accent-hover: var(--ldh-blue-700);
+ --bg-accent-quiet: var(--ldh-blue-50);
+
+ /* Inverse ground — a FIXED white, identical in every theme, for controls that
+ sit on a dark bar or over imagery where the surrounding theme cannot be
+ relied on. Deliberately not --surface-0, which flips with the theme. */
+ --bg-inverse: #ffffff; /* @kind color */
+ --bg-inverse-hover: rgba(255,255,255,0.88); /* @kind color */
+
+ /* ---------- Semantic: Interactive states ----------
+ First-class state tokens so components stop hand-rolling `surface-2` for
+ every hover. Use these for any hoverable/selectable surface. */
+ --bg-hover: var(--surface-2); /* neutral hover (rows, ghost buttons, tabs) */
+ --bg-active: var(--surface-3); /* pressed / held */
+ --bg-selected: var(--bg-accent-quiet); /* current / on / selected surface */
+ --fg-selected: var(--ldh-blue-700); /* text/icon on a selected surface */
+
+ --border-default: var(--line-1);
+ --border-strong: var(--line-2);
+ --focus-ring: var(--shadow-glow-blue);
+}
+
+/* =========================================================================
+ DARK THEME — set [data-theme="dark"] on .
+ The light theme funnels nearly everything through the neutral primitives
+ (ink-*, surface-*, line-*) and a small set of accent tints, so dark mode is
+ mostly a re-mapping of those primitives — the semantic layer and components
+ inherit it automatically. Accent *text* tints (blue/violet 600/700) flip
+ light; accent *fills* are pinned to literals so filled buttons keep AA.
+ ========================================================================= */
+:root[data-theme="dark"] {
+ /* Neutrals — cool dark slate, mirroring the light theme's blue undertone. */
+ --ink-1: #f3f6fc;
+ --ink-2: #cfd6e3;
+ --ink-3: #9aa3b5;
+ --ink-4: #717a8d;
+ --ink-5: #4c5365;
+
+ --surface-0: #171b24; /* card / dialog */
+ --surface-1: #0f131a; /* page */
+ --surface-2: #1e2430; /* recessed wells, hover */
+ --surface-3: #2b323f; /* pressed, dividers */
+ --line-1: #272e3a;
+ --line-2: #39414f;
+
+ /* Accent TEXT tints flip light so they stay legible on dark surfaces. */
+ --ldh-blue-50: #11243d;
+ --ldh-blue-100: #173558;
+ --ldh-blue-200: #1f4d7a;
+ --ldh-blue-600: #6aa6f7;
+ --ldh-blue-700: #93bdfb;
+ --ldh-violet-50: #241836;
+ --ldh-violet-100: #33214d;
+ --ldh-violet-700: #c9a6ed;
+ --success-500: #3ecb8f; --success-50: #102619;
+ --warning-500: #e6a52a; --warning-50: #2c2410;
+ --danger-500: #f06a6a; --danger-600: #d94f4f; --danger-50: #2e1414;
+ --fg-on-danger: #2e0f0f;
+
+ /* Accent FILL stays a literal saturated blue so white button text keeps
+ AA (≈4.6:1) — independent of the now-light blue-600 text primitive. */
+ --bg-accent: #086ad6;
+ --bg-accent-hover: #0a55a8;
+
+ --fg-hint: #8a92a4; /* ~4.8:1 on the dark page */
+
+ /* Shadows need more weight to read on dark surfaces. */
+ --shadow-xs: 0 1px 2px rgba(0,0,0,0.40);
+ --shadow-sm: 0 2px 8px rgba(0,0,0,0.45), 0 1px 2px rgba(0,0,0,0.40);
+ --shadow-md: 0 8px 24px -8px rgba(0,0,0,0.55), 0 2px 4px rgba(0,0,0,0.40);
+ --shadow-lg: 0 24px 48px -16px rgba(0,0,0,0.60), 0 4px 12px rgba(0,0,0,0.45);
+ --shadow-xl: 0 40px 80px -24px rgba(0,0,0,0.66), 0 8px 16px rgba(0,0,0,0.45);
+ --inset-hairline: inset 0 1px 0 rgba(255,255,255,0.06);
+}
+
+/* =========================================================================
+ Semantic typography classes — apply directly, or use as a reference for
+ component-level styles.
+ ========================================================================= */
+
+.ldh-display {
+ font-family: var(--font-display);
+ font-weight: 400;
+ font-size: var(--fs-6xl);
+ line-height: var(--lh-tight);
+ letter-spacing: var(--tracking-tight);
+ color: var(--fg-1);
+ font-style: italic;
+}
+
+.ldh-h1 {
+ font-family: var(--font-sans);
+ font-weight: var(--fw-semibold);
+ font-size: var(--fs-4xl);
+ line-height: var(--lh-tight);
+ letter-spacing: var(--tracking-tight);
+ color: var(--fg-1);
+}
+
+.ldh-h2 {
+ font-family: var(--font-sans);
+ font-weight: var(--fw-semibold);
+ font-size: var(--fs-3xl);
+ line-height: var(--lh-snug);
+ letter-spacing: var(--tracking-snug);
+ color: var(--fg-1);
+}
+
+.ldh-h3 {
+ font-family: var(--font-sans);
+ font-weight: var(--fw-semibold);
+ font-size: var(--fs-2xl);
+ line-height: var(--lh-snug);
+ letter-spacing: var(--tracking-snug);
+ color: var(--fg-1);
+}
+
+.ldh-h4 {
+ font-family: var(--font-sans);
+ font-weight: var(--fw-semibold);
+ font-size: var(--fs-xl);
+ line-height: var(--lh-snug);
+ color: var(--fg-1);
+}
+
+.ldh-h5 {
+ font-family: var(--font-sans);
+ font-weight: var(--fw-medium);
+ font-size: var(--fs-lg);
+ line-height: var(--lh-snug);
+ color: var(--fg-1);
+}
+
+.ldh-body {
+ font-family: var(--font-sans);
+ font-weight: var(--fw-regular);
+ font-size: var(--fs-base);
+ line-height: var(--lh-base);
+ color: var(--fg-2);
+}
+
+.ldh-body-lg {
+ font-family: var(--font-sans);
+ font-weight: var(--fw-regular);
+ font-size: var(--fs-md);
+ line-height: var(--lh-base);
+ color: var(--fg-2);
+}
+
+.ldh-small {
+ font-family: var(--font-sans);
+ font-weight: var(--fw-regular);
+ font-size: var(--fs-sm);
+ line-height: var(--lh-base);
+ color: var(--fg-muted);
+}
+
+.ldh-meta {
+ font-family: var(--font-sans);
+ font-weight: var(--fw-medium);
+ font-size: var(--fs-xs);
+ line-height: var(--lh-snug);
+ letter-spacing: var(--tracking-wide);
+ text-transform: uppercase;
+ color: var(--fg-muted);
+}
+
+.ldh-eyebrow {
+ font-family: var(--font-mono);
+ font-weight: var(--fw-medium);
+ font-size: var(--fs-xs);
+ line-height: var(--lh-snug);
+ letter-spacing: var(--tracking-widest);
+ text-transform: uppercase;
+ color: var(--ldh-blue-600);
+}
+
+.ldh-code {
+ font-family: var(--font-mono);
+ font-weight: var(--fw-regular);
+ font-size: 0.92em;
+ line-height: var(--lh-base);
+ color: var(--ink-2);
+ background: var(--surface-2);
+ padding: 1px 6px;
+ border-radius: var(--r-xs);
+}
+
+/* Inline IRI / URI styling — a recurring element across LDH. */
+.ldh-iri {
+ font-family: var(--font-mono);
+ font-size: 0.94em;
+ color: var(--ldh-blue-700);
+ word-break: break-all;
+}
+
+/* Reset-ish baseline for design previews */
+html, body { background: var(--bg-page); color: var(--fg-1); }
+body {
+ font-family: var(--font-sans);
+ font-size: var(--fs-base);
+ line-height: var(--lh-base);
+ -webkit-font-smoothing: antialiased;
+ text-rendering: optimizeLegibility;
+}
+
+/* =========================================================================
+ LONG-FORM ELEMENTS
+
+ Documentation pages, XHTML content blocks and marketing copy are authored as
+ plain semantic XHTML, so their dress belongs on the ELEMENT. A class earns
+ its place in that markup only when the author is choosing something the tag
+ cannot express — a lede paragraph, a table density — never to restate what
+ the tag already says. already says it is code.
+
+ There is a second reason it has to be the element rather than a class or a
+ wrapper scope. The same literal renders in two places: the documentation
+ site, wrapped in .docs-main, and the product, wrapped in the XHTML block. An
+ element rule is the only form that works in both without either stylesheet
+ having to know the other's wrapper — which is exactly what the docs site's
+ own element layer was standing in for.
+
+ Everything here binds to the .ldh-* roles above rather than inventing values,
+ so the two cannot drift. The classes keep no margin of their own, so they
+ stay usable inline on a component; flow spacing lives on the element.
+
+ NOT covered yet, deliberately: ul/ol/li, because one emitter (the endpoint
+ class list in the search modal) is a bare with no class to outrank a
+ prose rule — a control list wearing list bullets. And p, which renders
+ acceptably on UA margins today; giving it one would hand every alert and card
+ body a trailing margin to undo.
+ ========================================================================= */
+
+h1, h2, h3, h4, h5, h6 {
+ font-family: var(--font-sans);
+ color: var(--fg-1);
+ text-wrap: balance;
+}
+
+/* Sizes match the .ldh-h* role of the same name — the classes are named after
+ the levels, so an h2 that is not .ldh-h2 would make the names lie. */
+h1 {
+ font-size: var(--fs-4xl);
+ font-weight: var(--fw-semibold);
+ line-height: var(--lh-tight);
+ letter-spacing: var(--tracking-tight);
+ margin: 0 0 var(--sp-6);
+}
+h2 {
+ font-size: var(--fs-3xl);
+ font-weight: var(--fw-semibold);
+ line-height: var(--lh-snug);
+ letter-spacing: var(--tracking-snug);
+ margin: var(--sp-10) 0 var(--sp-4);
+}
+h3 {
+ font-size: var(--fs-2xl);
+ font-weight: var(--fw-semibold);
+ line-height: var(--lh-snug);
+ letter-spacing: var(--tracking-snug);
+ margin: var(--sp-8) 0 var(--sp-3);
+}
+h4 {
+ font-size: var(--fs-xl);
+ font-weight: var(--fw-semibold);
+ line-height: var(--lh-snug);
+ margin: var(--sp-6) 0 var(--sp-2);
+}
+h5, h6 {
+ font-size: var(--fs-lg);
+ font-weight: var(--fw-medium);
+ line-height: var(--lh-snug);
+ margin: var(--sp-5) 0 var(--sp-2);
+}
+/* A heading opening its section has nothing above it to be spaced from. */
+h1:first-child, h2:first-child, h3:first-child,
+h4:first-child, h5:first-child, h6:first-child { margin-top: 0; }
+
+/* Inline code, sample output and key caps. The README's content rule — "inline
+ code, file paths and IRIs are set in mono" — applied to the tags that say so.
+ kbd adds the cap edge; samp and code are the same treatment because the
+ distinction between them is semantic, not visual. */
+code, samp, kbd {
+ font-family: var(--font-mono);
+ font-weight: var(--fw-regular);
+ font-size: 0.92em;
+ color: var(--ink-2);
+ background: var(--surface-2);
+ padding: 1px 6px;
+ border-radius: var(--r-xs);
+}
+kbd {
+ border: 1px solid var(--border-default);
+ /* the cap edge is a shadow, not a thicker border — the system has no 2px border */
+ box-shadow: 0 1px 0 var(--border-strong);
+ padding: 1px 5px;
+}
+
+/* Code blocks sit in a recessed well with no border: the fill already separates
+ them, and a border plus a fill reads as two containers. */
+pre {
+ margin: var(--sp-4) 0;
+ padding: var(--sp-3) var(--sp-4);
+ background: var(--surface-2);
+ border-radius: var(--r-sm);
+ font-family: var(--font-mono);
+ font-size: 0.92em;
+ line-height: var(--lh-base);
+ color: var(--ink-2);
+ overflow-x: auto;
+}
+/* Inside a block the chip would be a second well. */
+pre code, pre samp, pre kbd {
+ background: none;
+ padding: 0;
+ border: 0;
+ border-radius: 0;
+ font-size: inherit;
+}
+
+/* Description lists. The app's property lists are a dl too — read mode and the
+ edit form both emit dl.ldh-prop-form > dt.label + dd.ldh-prop-row — and they
+ are immune to these rules by construction: .ldh-prop-form already sets
+ margin: 0 to cancel the UA block margin, .ldh-prop-row is display: contents so
+ it generates no box for a margin to land on, and the label cell is reached at
+ .ldh-prop-group > .label. The graph panels scope their own dl/dt/dd. So what
+ is left for these rules is prose. */
+dl { margin: var(--sp-4) 0; }
+dt { font-weight: var(--fw-medium); color: var(--fg-1); }
+dt:not(:first-child) { margin-top: var(--sp-3); }
+dd { margin: var(--sp-1) 0 0; margin-inline-start: var(--sp-5); color: var(--fg-2); }
+
+/* A term at its point of definition. */
+dfn { font-style: italic; font-weight: var(--fw-medium); color: var(--fg-1); }
+
+/* A highlighted run. Amber rather than the action blue: marking is not a link. */
+mark { background: var(--warning-50); color: var(--fg-1); padding: 0 2px; border-radius: var(--r-xs); }
+
+/* A quotation is set off by a rule and a step down in colour, not by italics —
+ the quoted text sets its own voice. */
+blockquote {
+ margin: var(--sp-4) 0;
+ padding: var(--sp-1) 0 var(--sp-1) var(--sp-4);
+ border-left: 1px solid var(--border-strong);
+ color: var(--fg-muted);
+}
+
+/* A thematic break is the element form of .ac-divider wt-muted. */
+hr {
+ height: 1px;
+ margin: var(--sp-8) 0;
+ border: 0;
+ background: var(--border-default);
+}
diff --git a/src/main/webapp/static/com/atomgraph/client/css/controls.css b/src/main/webapp/static/com/atomgraph/client/css/controls.css
new file mode 100644
index 00000000..4f100b36
--- /dev/null
+++ b/src/main/webapp/static/com/atomgraph/client/css/controls.css
@@ -0,0 +1,372 @@
+/* =========================================================================
+ ui_kits/core/controls.css — form-control primitives
+ Select · Combobox · IconButton · FileInput · CodeField
+
+ Every control here carries the full core contract: default / hover / active /
+ focus-visible / disabled, plus loading and invalid where relevant. Metrics
+ match .ac-field-box exactly (sm 32 / md 40 / lg 48) so a select, a combobox
+ and a text field line up in the same row.
+
+ ONE FOCUS RING. Everything below uses --focus-ring. No control defines its
+ own; no app-layer override defines one either.
+ ========================================================================= */
+
+/* =========================================================================
+ Select — the design-system replacement for a native .
+ Single, multiple (size), grouped (optgroup), and a LOCKED display for the
+ disabled single-option case (the Container/Item subject row): that one reads
+ as a static value with a lock affordance, NOT as a dead dropdown, because a
+ greyed-out control invites clicking at something that can never respond.
+ ========================================================================= */
+.ac-select { position: relative; display: inline-flex; align-items: center; width: 100%; min-width: 0; }
+.ac-select > select {
+ appearance: none; -webkit-appearance: none;
+ width: 100%; min-width: 0; box-sizing: border-box;
+ font-family: var(--font-sans); color: var(--fg-1);
+ background: var(--surface-0);
+ border: 1px solid var(--border-default); border-radius: var(--r-md);
+ cursor: pointer;
+ transition: border-color var(--dur-fast) var(--ease-out-soft), box-shadow var(--dur-fast) var(--ease-out-soft), background var(--dur-fast) var(--ease-out-soft);
+}
+.ac-select.sz-sm > select { height: 32px; padding: 0 30px 0 10px; font-size: var(--fs-sm); }
+.ac-select.sz-md > select { height: 40px; padding: 0 34px 0 12px; font-size: var(--fs-base); }
+.ac-select.sz-lg > select { height: 48px; padding: 0 38px 0 14px; font-size: var(--fs-base); }
+.ac-select > select:hover { border-color: var(--border-strong); }
+.ac-select > select:focus-visible { outline: 0; border-color: var(--ldh-blue-400); box-shadow: var(--focus-ring); }
+.ac-select > select:disabled { background: var(--surface-1); color: var(--fg-hint); cursor: not-allowed; opacity: 0.65; }
+.ac-select > .ac-select-caret { position: absolute; right: 9px; pointer-events: none; color: var(--fg-hint); }
+.ac-select > select:disabled ~ .ac-select-caret { opacity: 0.5; }
+/* Grouped options — optgroup labels take the mono eyebrow treatment where the
+ platform lets us style them. */
+.ac-select optgroup {
+ font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: var(--fw-medium);
+ color: var(--fg-hint); text-transform: uppercase; letter-spacing: var(--tracking-wide);
+}
+.ac-select option { font-family: var(--font-sans); font-size: var(--fs-base); color: var(--fg-1); }
+/* Multiple — a real list box, so it drops the caret and takes its own height. */
+.ac-select.is-multiple > select { height: auto; padding: 4px; cursor: default; }
+.ac-select.is-multiple > .ac-select-caret { display: none; }
+.ac-select.is-multiple option { padding: 5px 8px; border-radius: var(--r-xs); }
+.ac-select.is-multiple option:checked { background: var(--bg-selected); color: var(--fg-selected); }
+/* Invalid — reaches the select, not just inputs. */
+.ac-select.st-invalid > select { border-color: var(--danger-500); }
+.ac-select.st-invalid > select:focus-visible { box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger-500) 18%, transparent); }
+.ac-select.st-valid > select { border-color: var(--success-500); }
+
+/* Locked display — one immutable option. A static value + lock glyph, with the
+ real (disabled) select kept in the DOM for form serialisation. */
+.ac-select-locked {
+ display: inline-flex; align-items: center; gap: var(--sp-2);
+ box-sizing: border-box; min-width: 0;
+ background: var(--surface-2); border: 1px solid transparent; border-radius: var(--r-md);
+ color: var(--fg-2); font-family: var(--font-sans);
+}
+.ac-select-locked.sz-sm { height: 32px; padding: 0 10px; font-size: var(--fs-sm); }
+.ac-select-locked.sz-md { height: 40px; padding: 0 12px; font-size: var(--fs-base); }
+.ac-select-locked > .msi { color: var(--fg-hint); flex-shrink: 0; }
+.ac-select-locked > .lk-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.ac-select-locked > select { display: none; }
+
+/* =========================================================================
+ Combobox / Autocomplete — ONE primitive replacing the three bespoke variants
+ (typeahead result list, resource picker, constructor predicate cell).
+
+ Committed value renders as a TAG with a change affordance, not a button with
+ a chevron: the old chip read as a dropdown trigger when its real meaning is
+ "selected value — click to change".
+ ========================================================================= */
+.ac-combobox { position: relative; display: flex; flex-direction: column; min-width: 0; width: 100%; }
+.ac-cb-box {
+ display: flex; align-items: center; gap: var(--sp-2);
+ box-sizing: border-box; background: var(--surface-0);
+ border: 1px solid var(--border-default); border-radius: var(--r-md);
+ transition: border-color var(--dur-fast) var(--ease-out-soft), box-shadow var(--dur-fast) var(--ease-out-soft);
+}
+.ac-combobox.sz-sm .ac-cb-box { min-height: 32px; padding: 0 8px; }
+.ac-combobox.sz-md .ac-cb-box { min-height: 40px; padding: 0 10px; }
+.ac-combobox.sz-lg .ac-cb-box { min-height: 48px; padding: 0 12px; }
+.ac-cb-box:hover { border-color: var(--border-strong); }
+.ac-cb-box:focus-within { border-color: var(--ldh-blue-400); box-shadow: var(--focus-ring); }
+.ac-combobox.st-invalid .ac-cb-box { border-color: var(--danger-500); }
+.ac-combobox.st-invalid .ac-cb-box:focus-within { box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger-500) 18%, transparent); }
+.ac-combobox.is-disabled .ac-cb-box { background: var(--surface-1); opacity: 0.6; pointer-events: none; }
+.ac-cb-box > .msi { color: var(--fg-hint); flex-shrink: 0; }
+.ac-cb-box > input {
+ flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
+ font-family: var(--font-sans); font-size: var(--fs-sm); color: var(--fg-1); padding: 6px 0;
+}
+.ac-cb-box > input::placeholder { color: var(--fg-hint); }
+/* IRI-valued comboboxes type in mono — the value is machine-readable. */
+.ac-combobox.is-iri .ac-cb-box > input { font-family: var(--font-mono); font-size: var(--fs-xs); }
+.ac-cb-clear {
+ display: inline-flex; align-items: center; justify-content: center;
+ width: 22px; height: 22px; flex-shrink: 0; padding: 0;
+ border: 0; background: transparent; cursor: pointer; color: var(--fg-hint); border-radius: var(--r-xs);
+}
+.ac-cb-clear:hover { background: var(--bg-hover); color: var(--fg-1); }
+.ac-cb-clear:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
+
+/* Result panel */
+.ac-cb-panel {
+ position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40;
+ max-height: 268px; overflow-y: auto;
+ background: var(--surface-0);
+ border: 1px solid var(--border-default); border-radius: var(--r-md);
+ box-shadow: var(--shadow-lg);
+ padding: 4px;
+ animation: ac-cb-in var(--dur-fast) var(--ease-out-soft);
+}
+@keyframes ac-cb-in { from { opacity: 0; transform: translateY(-3px); } }
+.ac-cb-section {
+ padding: 7px 10px 4px;
+ font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: var(--fw-medium);
+ letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--fg-hint);
+}
+.ac-cb-item {
+ display: flex; align-items: center; gap: var(--sp-2); width: 100%;
+ padding: 7px 10px; border: 0; background: transparent; cursor: pointer;
+ text-align: left; border-radius: var(--r-sm);
+ font-family: var(--font-sans); font-size: var(--fs-sm); color: var(--fg-1);
+}
+.ac-cb-item:hover { background: var(--bg-hover); }
+/* Keyboard-active item is a distinct state from hover — the pointer and the
+ arrow keys can be in different places, and only one of them is "active". */
+.ac-cb-item.is-active { background: var(--bg-selected); color: var(--fg-selected); }
+.ac-cb-item[aria-selected="true"] .msi.tick { color: var(--fg-selected); }
+.ac-cb-item > .ac-cb-ic { color: var(--fg-hint); flex-shrink: 0; }
+.ac-cb-item.is-active > .ac-cb-ic { color: var(--fg-selected); }
+.ac-cb-item-body { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
+.ac-cb-item-lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.ac-cb-item-sub { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--fg-hint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.ac-cb-item.is-active .ac-cb-item-sub { color: color-mix(in srgb, var(--fg-selected) 72%, transparent); }
+/* Match highlight — the token the live markup never had. Weight + tint, no
+ background box, so a match inside a long label stays readable. */
+.ac-cb-mark { font-weight: var(--fw-bold); color: var(--fg-selected); background: none; }
+.ac-cb-item.is-active .ac-cb-mark { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
+
+/* Panel states: loading / empty / fetch error. A failed fetch is a designed
+ state here — it used to be a window.alert. */
+.ac-cb-state {
+ display: flex; align-items: center; gap: var(--sp-2);
+ padding: 12px 10px; font-family: var(--font-sans); font-size: var(--fs-sm); color: var(--fg-muted);
+}
+.ac-cb-state.is-error { color: var(--danger-500); flex-wrap: wrap; }
+.ac-cb-state.is-error .msi { color: var(--danger-500); }
+.ac-cb-state .ac-cb-retry {
+ margin-left: auto; border: 0; background: transparent; cursor: pointer;
+ font-family: var(--font-sans); font-size: var(--fs-sm); font-weight: var(--fw-medium);
+ color: var(--fg-link); text-decoration: underline; border-radius: var(--r-xs);
+}
+.ac-cb-state .ac-cb-retry:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
+.ac-cb-skel { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; }
+
+/* Committed value — a tag, with change + clear. Reads as "selected value". */
+.ac-cb-committed { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
+.ac-cb-chip {
+ display: inline-flex; align-items: center; gap: 5px; min-width: 0; max-width: 100%;
+ box-sizing: border-box; height: 26px; padding: 0 4px 0 10px;
+ background: var(--bg-accent-quiet); color: var(--fg-selected);
+ border: 1px solid color-mix(in srgb, var(--fg-selected) 24%, transparent);
+ border-radius: var(--r-pill);
+ font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: var(--fw-medium);
+}
+.ac-cb-chip > .cb-chip-lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.ac-cb-chip > .cb-chip-btn {
+ display: inline-flex; align-items: center; justify-content: center;
+ width: 18px; height: 18px; padding: 0; flex-shrink: 0;
+ border: 0; background: transparent; color: inherit; cursor: pointer; border-radius: 50%;
+}
+.ac-cb-chip > .cb-chip-btn:hover { background: color-mix(in srgb, currentColor 16%, transparent); }
+.ac-cb-chip > .cb-chip-btn:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
+.ac-cb-chip > .cb-chip-btn .msi { font-size: 14px; }
+
+/* =========================================================================
+ IconButton — THE icon button. It replaced the app kit's own .tb / .rb /
+ .ldh-icon-btn classes, which are gone.
+ Sizes 28 / 32 / 34 / 36. Intents neutral /
+ destructive / accent. `is-reveal` is the row-hover behaviour: invisible until
+ its container is hovered or anything inside it takes focus — never
+ display:none, so it keeps its footprint and the row doesn't shift.
+ ========================================================================= */
+.ac-iconbtn {
+ display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
+ padding: 0; box-sizing: border-box;
+ border: 1px solid transparent; border-radius: var(--r-sm);
+ background: transparent; color: var(--fg-muted); cursor: pointer;
+ transition: background var(--dur-fast) var(--ease-out-soft), color var(--dur-fast) var(--ease-out-soft),
+ border-color var(--dur-fast) var(--ease-out-soft), opacity var(--dur-fast) var(--ease-out-soft);
+}
+.ac-iconbtn.sz-xs { width: 28px; height: 28px; }
+.ac-iconbtn.sz-sm { width: 32px; height: 32px; }
+.ac-iconbtn.sz-md { width: 34px; height: 34px; }
+.ac-iconbtn.sz-lg { width: 36px; height: 36px; }
+/* A tally alongside the glyph — the block links button. The button stops being
+ square and pads instead, so the count is inside the same hit target. */
+.ac-iconbtn.has-count { width: auto; padding: 0 8px; gap: 4px; }
+.ac-iconbtn.has-count.sz-xs { min-width: 28px; }
+.ac-iconbtn.has-count.sz-sm { min-width: 32px; }
+.ac-iconbtn.has-count.sz-md { min-width: 34px; }
+.ac-iconbtn-count {
+ font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: var(--fw-semibold);
+ line-height: 1;
+}
+.ac-iconbtn:hover { background: var(--bg-hover); color: var(--fg-1); }
+.ac-iconbtn:active { background: var(--bg-active); }
+.ac-iconbtn:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
+.ac-iconbtn:disabled { cursor: not-allowed; opacity: 0.4; pointer-events: none; }
+.ac-iconbtn.ap-solid { background: var(--surface-0); border-color: var(--border-default); }
+.ac-iconbtn.ap-solid:hover { border-color: var(--border-strong); }
+.ac-iconbtn.in-destructive:hover { background: var(--danger-50); color: var(--danger-500); }
+.ac-iconbtn.in-accent:hover { background: var(--bg-accent-quiet); color: var(--fg-selected); }
+/* On a dark surface (the header bar) the neutral hover tokens are invisible, so
+ this intent tints with white-alpha instead. It exists so the header does not
+ need its own icon-button class. */
+.ac-iconbtn.in-inverse { color: rgba(255, 255, 255, 0.82); }
+.ac-iconbtn.in-inverse:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
+.ac-iconbtn.in-inverse:active { background: rgba(255, 255, 255, 0.18); }
+/* Pressed — the named state the subject bar's pencil toggle lacked. */
+.ac-iconbtn[aria-pressed="true"] { background: var(--bg-selected); color: var(--fg-selected); }
+.ac-iconbtn[aria-pressed="true"]:hover { background: var(--bg-selected); }
+.ac-iconbtn.is-loading { pointer-events: none; }
+/* Reveal-on-hover: opacity only, so layout is stable. Always visible once
+ focused, so keyboard users are never chasing an invisible control. */
+.ac-iconbtn.is-reveal { opacity: 0; }
+:hover > .ac-iconbtn.is-reveal,
+:focus-within > .ac-iconbtn.is-reveal,
+.ac-iconbtn.is-reveal:focus-visible { opacity: 1; }
+/* Transient confirmation (copy-URI): the glyph swaps to a tick and the button
+ flashes positive, then returns. */
+.ac-iconbtn.is-confirmed { background: var(--success-50); color: var(--success-500); }
+
+/* =========================================================================
+ FileInput at VALUE-ROW scale — idle / drag-over / selected / uploading /
+ error. Distinct from .ldh-dropzone, which is the big Imports-flow target;
+ this one has to sit inside a 32px property row.
+ ========================================================================= */
+.ac-fileinput { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
+.ac-file-drop {
+ display: flex; align-items: center; gap: var(--sp-2);
+ box-sizing: border-box; min-height: 32px; padding: 4px 10px;
+ background: var(--surface-0);
+ border: 1px dashed var(--border-strong); border-radius: var(--r-md);
+ cursor: pointer; color: var(--fg-muted);
+ font-family: var(--font-sans); font-size: var(--fs-sm);
+ transition: border-color var(--dur-fast) var(--ease-out-soft), background var(--dur-fast) var(--ease-out-soft), color var(--dur-fast) var(--ease-out-soft);
+}
+.ac-file-drop:hover { border-color: var(--ldh-blue-400); background: var(--bg-accent-quiet); color: var(--fg-2); }
+.ac-file-drop:focus-visible { outline: 0; border-color: var(--ldh-blue-400); box-shadow: var(--focus-ring); }
+.ac-file-drop > .msi { color: var(--fg-hint); flex-shrink: 0; }
+.ac-file-drop .fd-link { color: var(--fg-link); text-decoration: underline; }
+.ac-file-drop input[type="file"] { display: none; }
+/* Drag-over is a solid border + accent wash: a dashed edge under an actively
+ hovering file reads as "still waiting", which is the wrong signal. */
+.ac-fileinput.is-dragover .ac-file-drop {
+ border-style: solid; border-color: var(--ldh-blue-500);
+ background: var(--bg-accent-quiet); color: var(--fg-selected);
+}
+.ac-fileinput.st-invalid .ac-file-drop { border-color: var(--danger-500); background: var(--danger-50); }
+.ac-fileinput.is-disabled { opacity: 0.55; pointer-events: none; }
+/* Selected chip — name, size, remove. Row-scale sibling of .ldh-file-chip. */
+.ac-file-sel {
+ display: flex; align-items: center; gap: var(--sp-2);
+ box-sizing: border-box; min-height: 32px; padding: 4px 6px 4px 10px;
+ background: var(--surface-2); border: 1px solid var(--border-default); border-radius: var(--r-md);
+ min-width: 0;
+}
+.ac-file-sel > .msi { color: var(--fg-muted); flex-shrink: 0; }
+.ac-file-sel .fs-name { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--fg-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.ac-file-sel .fs-size { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--fg-hint); flex-shrink: 0; }
+.ac-file-sel .fs-x { margin-left: auto; flex-shrink: 0; }
+.ac-file-prog { display: flex; align-items: center; gap: var(--sp-2); }
+.ac-file-prog .fp-bar { flex: 1; min-width: 0; }
+
+/* =========================================================================
+ CodeField — EDITABLE, LIGHT, in-a-form-row code surface. Hosts CodeMirror /
+ YASQE for SPARQL-valued properties. Deliberately not .ldh-sparql-*, which is
+ a dark read-only display pane: a dark editable field inside a white form row
+ reads as output, not input.
+ ========================================================================= */
+.ac-codefield {
+ display: flex; min-width: 0; box-sizing: border-box; overflow: hidden;
+ background: var(--surface-0);
+ border: 1px solid var(--border-default); border-radius: var(--r-md);
+ transition: border-color var(--dur-fast) var(--ease-out-soft), box-shadow var(--dur-fast) var(--ease-out-soft);
+}
+.ac-codefield:hover { border-color: var(--border-strong); }
+.ac-codefield:focus-within { border-color: var(--ldh-blue-400); box-shadow: var(--focus-ring); }
+.ac-codefield.st-invalid { border-color: var(--danger-500); }
+.ac-codefield.st-invalid:focus-within { box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger-500) 18%, transparent); }
+.ac-codefield.is-disabled { background: var(--surface-1); opacity: 0.65; pointer-events: none; }
+.ac-cf-gutter {
+ flex-shrink: 0; padding: 8px 8px 8px 10px; text-align: right; user-select: none;
+ background: var(--surface-2); border-right: 1px solid var(--border-default);
+ font-family: var(--font-mono); font-size: var(--fs-xs); line-height: 1.65; color: var(--ink-5);
+}
+.ac-cf-area {
+ flex: 1; min-width: 0; border: 0; background: transparent; outline: none; resize: vertical;
+ padding: 8px 10px; tab-size: 2;
+ font-family: var(--font-mono); font-size: var(--fs-xs); line-height: 1.65; color: var(--fg-1);
+ white-space: pre; overflow-x: auto;
+}
+.ac-cf-area::placeholder { color: var(--fg-hint); }
+/* Light-theme SPARQL tokens, for a highlighted (non-textarea) host. */
+.ac-codefield .t-kw { color: #a33ea3; font-weight: var(--fw-semibold); }
+.ac-codefield .t-fn { color: var(--ldh-blue-700); }
+.ac-codefield .t-var { color: #b06000; }
+.ac-codefield .t-str { color: var(--success-500); }
+.ac-codefield .t-num { color: #b06000; }
+.ac-codefield .t-pn, .ac-codefield .t-op { color: var(--fg-muted); }
+
+
+/* =========================================================================
+ ChoiceButton — a full-width, two-line option button: a title, an optional
+ explanatory sub-line, an optional leading glyph or brand slot, and an
+ optional trailing chevron.
+
+ It exists because a plain Button cannot carry a second line, and the auth
+ screens had grown their own `.ldh-auth-btn` to do it — a fourth button
+ system with its own hover/active/focus rules. This is that need, expressed
+ once, on the same tokens as .ac-btn (same radius, same --focus-ring, same
+ translateY press).
+ ========================================================================= */
+.ac-choicebtn {
+ display: flex; align-items: center; gap: var(--sp-3);
+ width: 100%; box-sizing: border-box; text-align: left;
+ padding: var(--sp-3) var(--sp-4);
+ background: var(--surface-0); color: var(--fg-1);
+ border: 1px solid var(--border-default); border-radius: var(--r-md);
+ cursor: pointer; font-family: var(--font-sans);
+ transition: background var(--dur-fast) var(--ease-out-soft),
+ border-color var(--dur-fast) var(--ease-out-soft),
+ color var(--dur-fast) var(--ease-out-soft),
+ transform var(--dur-fast) var(--ease-out-soft);
+}
+.ac-choicebtn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
+.ac-choicebtn:active { transform: translateY(1px); }
+.ac-choicebtn:focus-visible { outline: 0; border-color: var(--ldh-blue-400); box-shadow: var(--focus-ring); }
+.ac-choicebtn:disabled { cursor: not-allowed; opacity: 0.45; pointer-events: none; }
+.ac-cb-titles { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
+.ac-cb-title { font-size: var(--fs-base); font-weight: var(--fw-semibold); color: inherit; }
+.ac-cb-sub { font-size: var(--fs-xs); color: var(--fg-muted); line-height: var(--lh-base); }
+.ac-choicebtn > .ac-cb-chev { margin-left: auto; flex-shrink: 0; color: var(--fg-hint); }
+.ac-choicebtn > .msi:first-child { flex-shrink: 0; color: var(--fg-muted); }
+/* Primary: the accent fill. Ink comes from --fg-on-accent, which inverts in
+ skins whose accent is pale, so the sub-line is derived from it rather than
+ hardcoded white-alpha. */
+.ac-choicebtn.in-primary {
+ background: var(--bg-accent); border-color: var(--bg-accent); color: var(--fg-on-accent);
+}
+.ac-choicebtn.in-primary:hover { background: var(--bg-accent-hover); border-color: var(--bg-accent-hover); }
+.ac-choicebtn.in-primary .ac-cb-sub { color: color-mix(in srgb, var(--fg-on-accent) 72%, transparent); }
+.ac-choicebtn.in-primary > .msi:first-child,
+.ac-choicebtn.in-primary > .ac-cb-chev { color: var(--fg-on-accent); }
+/* Centred variant for a form's submit, where there is no sub-line to align. */
+.ac-choicebtn.al-center { justify-content: center; text-align: center; }
+.ac-choicebtn.al-center .ac-cb-titles { align-items: center; }
+/* Brand slot — a third-party mark (e.g. Google) on its own white tile, so the
+ logo keeps its own colours whatever the surrounding theme. */
+.ac-cb-brand {
+ width: 30px; height: 30px; flex-shrink: 0; border-radius: var(--r-sm);
+ background: #fff; border: 1px solid var(--border-default);
+ display: inline-flex; align-items: center; justify-content: center;
+}
diff --git a/src/main/webapp/static/com/atomgraph/client/css/core.css b/src/main/webapp/static/com/atomgraph/client/css/core.css
new file mode 100644
index 00000000..0f4703de
--- /dev/null
+++ b/src/main/webapp/static/com/atomgraph/client/css/core.css
@@ -0,0 +1,748 @@
+/* =========================================================================
+ LinkedDataHub Design System — ui_kits/core
+ General-purpose primitives. LDH-native: our tokens, Geist, Material Symbols,
+ the glow-ring focus. No component invents a colour — every intent maps to the
+ semantic set (neutral / informative / positive / warning / negative + accent).
+
+ Cross-cutting conventions encoded here:
+ · Sizing — sm / md / lg (some xs / xl) share one scale so a field, its
+ label, its help text and an adjacent button align at a step.
+ · States — every interactive thing defines default / hover / active /
+ focus-visible / selected / disabled (+ loading / invalid).
+ Focus is ALWAYS a visible ring; never removed.
+ · Inverse — anything that can land on a dark surface has .is-inverse.
+ · Floating — menus/popovers/tooltips share .ac-float positioning.
+
+ INVENTORY (this file, then the two imported below)
+ core.css Icon · Button · UtilityButton · TextLink · Label · HelpText ·
+ VisuallyHidden · TextField · TextArea · Checkbox ·
+ CheckboxGroup · RadioButton · RadioGroup · Toggle · Tag ·
+ Badge · InlineAlert · Disclosure · Toast · ProgressBar ·
+ ProgressCircle · Skeleton · Divider · ContentSwitcher ·
+ Tabs · Tooltip · Toggletip
+ controls.css Select · Combobox · IconButton · FileInput · CodeField
+ overlays.css Menu (+ ActionOverflow) · Popover · Modal
+ surfaces.css Card · DataTable · Avatar · Drawer · Step
+ ========================================================================= */
+
+@import url('controls.css');
+@import url('overlays.css');
+@import url('surfaces.css');
+
+/* ---------- Icon — the Material Symbols primitive ----------
+ Five sizes aligned to the text/control scale; colour inherits from the
+ surrounding text so icons match their labels automatically. Lives in core
+ because every kit needs it; ui_kits/app inherits it from here. */
+/* Material Symbols default sizing */
+.msi {
+ font-family: 'Material Symbols Rounded';
+ font-weight: 400;
+ font-style: normal;
+ font-size: 20px;
+ line-height: 1;
+ letter-spacing: normal;
+ text-transform: none;
+ white-space: nowrap;
+ word-wrap: normal;
+ direction: ltr;
+ -webkit-font-feature-settings: 'liga';
+ font-feature-settings: 'liga';
+ font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
+ user-select: none;
+ vertical-align: middle;
+}
+.msi.sm { font-size: 16px; }
+.msi.lg { font-size: 24px; }
+.msi.outline { font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
+.msi.xs { font-size: 14px; }
+.msi.xl { font-size: 32px; }
+
+/* ---------- shared interactive base ---------- */
+.ac-focusable:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
+[data-ac-disabled="true"], .ac-is-disabled { cursor: not-allowed; opacity: 0.5; pointer-events: none; }
+
+/* =========================================================================
+ ACTIONS — Button
+ intent × appearance matrix. intent sets the colour role; appearance sets
+ whether that role is a fill, a border, or nothing until hover.
+ ========================================================================= */
+/* Button intent variables. These are component INTERNALS, not theme tokens:
+ the appearance × intent matrix works by each intent rebinding them, so they
+ belong on the component and deliberately not on :root. */
+/* Button intent variables live ONLY on the intent rules below. The base has no
+ defaults because it never renders without one: Button always emits
+ `in-` (default "primary"), and every hand-written usage carries one
+ too. Defaults here were dead weight — and one more component-selector scope
+ declaring custom properties. */
+.ac-btn {
+ display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
+ font-family: var(--font-sans); font-weight: var(--fw-medium);
+ /* transparent literal, not a variable: unlike --btn-fg/-bg/-bg-hover, which
+ every intent rebinds, the border colour was never overridden through the
+ variable — each appearance sets `border-color` directly. A variable that
+ varies nothing is just indirection. */
+ border: 1px solid transparent; border-radius: var(--r-md);
+ cursor: pointer; text-decoration: none; white-space: nowrap;
+ position: relative; box-sizing: border-box;
+ transition: background var(--dur-fast) var(--ease-out-soft),
+ border-color var(--dur-fast) var(--ease-out-soft),
+ color var(--dur-fast) var(--ease-out-soft),
+ transform var(--dur-fast) var(--ease-out-soft);
+}
+.ac-btn:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
+.ac-btn:active:not(:disabled) { transform: translateY(1px); }
+.ac-btn:disabled, .ac-btn[aria-disabled="true"] { cursor: not-allowed; opacity: 0.45; pointer-events: none; }
+
+/* sizes — height, padding and text move together */
+.ac-btn.sz-sm { height: 30px; padding: 0 12px; font-size: var(--fs-sm); border-radius: var(--r-sm); }
+.ac-btn.sz-md { height: 36px; padding: 0 16px; font-size: var(--fs-sm); }
+.ac-btn.sz-lg { height: 44px; padding: 0 20px; font-size: var(--fs-base); }
+.ac-btn.sz-xl { height: 52px; padding: 0 26px; font-size: var(--fs-md); border-radius: var(--r-lg); }
+.ac-btn.is-full { width: 100%; }
+/* icon-only: square-ish, label removed (accessible name comes from aria-label) */
+.ac-btn.is-iconly.sz-sm { width: 30px; padding: 0; }
+.ac-btn.is-iconly.sz-md { width: 36px; padding: 0; }
+.ac-btn.is-iconly.sz-lg { width: 44px; padding: 0; }
+.ac-btn.is-iconly.sz-xl { width: 52px; padding: 0; }
+
+/* intents — each declares its colour role once */
+.ac-btn.in-primary { --btn-bg: var(--bg-accent); --btn-bg-hover: var(--bg-accent-hover); --btn-fg: var(--fg-on-accent); }
+.ac-btn.in-neutral { --btn-bg: var(--surface-2); --btn-bg-hover: var(--surface-3); --btn-fg: var(--fg-1); }
+.ac-btn.in-accent { --btn-bg: var(--ldh-violet-600); --btn-bg-hover: var(--ldh-violet-700); --btn-fg: #ffffff; }
+.ac-btn.in-negative { --btn-bg: var(--danger-500); --btn-bg-hover: var(--danger-600); --btn-fg: var(--fg-on-danger); }
+.ac-btn.in-inverse { --btn-bg: var(--bg-inverse); --btn-bg-hover: var(--bg-inverse-hover); --btn-fg: var(--ink-1); }
+
+/* appearance: solid — the intent colour as a fill */
+.ac-btn.ap-solid { background: var(--btn-bg); color: var(--btn-fg); }
+.ac-btn.ap-solid:hover:not(:disabled) { background: var(--btn-bg-hover); }
+.ac-btn.in-neutral.ap-solid { border-color: var(--border-default); }
+.ac-btn.in-neutral.ap-solid:hover:not(:disabled) { border-color: var(--border-strong); }
+
+/* appearance: outline — transparent with the intent colour as border + text */
+.ac-btn.ap-outline { background: transparent; color: var(--btn-bg); border-color: var(--btn-bg); }
+.ac-btn.ap-outline.in-neutral { color: var(--fg-1); border-color: var(--border-strong); }
+.ac-btn.ap-outline:hover:not(:disabled) { background: color-mix(in srgb, var(--btn-bg) 8%, transparent); }
+.ac-btn.ap-outline.in-inverse { color: #fff; border-color: rgba(255,255,255,0.55); }
+.ac-btn.ap-outline.in-inverse:hover:not(:disabled) { background: rgba(255,255,255,0.12); }
+
+/* appearance: ghost — nothing until hover */
+.ac-btn.ap-ghost { background: transparent; color: var(--btn-bg); border-color: transparent; }
+.ac-btn.ap-ghost.in-neutral { color: var(--fg-2); }
+.ac-btn.ap-ghost:hover:not(:disabled) { background: color-mix(in srgb, var(--btn-bg) 10%, transparent); }
+.ac-btn.ap-ghost.in-neutral:hover:not(:disabled) { background: var(--bg-hover); color: var(--fg-1); }
+.ac-btn.ap-ghost.in-inverse { color: #fff; }
+.ac-btn.ap-ghost.in-inverse:hover:not(:disabled) { background: rgba(255,255,255,0.14); }
+
+/* fixed treatments for use over photography, where the theme can't be inferred */
+.ac-btn.ap-fixed-light { background: #ffffff; color: #0b0e14; border-color: transparent; }
+.ac-btn.ap-fixed-light:hover:not(:disabled) { background: rgba(255,255,255,0.88); }
+.ac-btn.ap-fixed-dark { background: #0b0e14; color: #ffffff; border-color: transparent; }
+.ac-btn.ap-fixed-dark:hover:not(:disabled) { background: #1c212e; }
+
+/* loading — spinner replaces or accompanies the label; button goes inert */
+.ac-btn.is-loading { cursor: progress; pointer-events: none; }
+.ac-btn .ac-btn-spin {
+ width: 1em; height: 1em; flex-shrink: 0; border-radius: 50%;
+ border: 2px solid currentColor; border-right-color: transparent;
+ animation: ac-spin 0.7s linear infinite;
+}
+@keyframes ac-spin { to { transform: rotate(360deg); } }
+
+/* ---------- UtilityButton — compact toolbar control ---------- */
+.ac-ubtn {
+ display: inline-flex; align-items: center; gap: 5px;
+ font-family: var(--font-sans); font-size: var(--fs-sm); font-weight: var(--fw-medium);
+ color: var(--fg-2); background: transparent;
+ border: 1px solid transparent; border-radius: var(--r-sm);
+ cursor: pointer; box-sizing: border-box;
+ transition: background var(--dur-fast) var(--ease-out-soft), color var(--dur-fast) var(--ease-out-soft), border-color var(--dur-fast) var(--ease-out-soft);
+}
+.ac-ubtn.sz-sm { height: 26px; padding: 0 7px; }
+.ac-ubtn.sz-md { height: 32px; padding: 0 10px; }
+.ac-ubtn.sz-lg { height: 38px; padding: 0 13px; }
+.ac-ubtn.is-iconly.sz-sm { width: 26px; padding: 0; justify-content: center; }
+.ac-ubtn.is-iconly.sz-md { width: 32px; padding: 0; justify-content: center; }
+.ac-ubtn.is-iconly.sz-lg { width: 38px; padding: 0; justify-content: center; }
+.ac-ubtn.ap-solid { background: var(--surface-2); border-color: var(--border-default); }
+.ac-ubtn:hover:not(:disabled) { background: var(--bg-hover); color: var(--fg-1); }
+.ac-ubtn.ap-solid:hover:not(:disabled) { border-color: var(--border-strong); }
+.ac-ubtn:active:not(:disabled) { background: var(--bg-active); }
+.ac-ubtn:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
+.ac-ubtn:disabled { cursor: not-allowed; opacity: 0.45; pointer-events: none; }
+.ac-ubtn.is-emphasis { color: var(--fg-1); font-weight: var(--fw-semibold); }
+/* toggle mode — persistent selected state */
+.ac-ubtn[aria-pressed="true"] { background: var(--bg-selected); color: var(--fg-selected); }
+.ac-ubtn[aria-pressed="true"]:hover { background: var(--bg-selected); }
+.ac-ubtn .ac-ubtn-lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.ac-ubtn .ac-ubtn-chev { color: var(--fg-hint); margin-left: 1px; }
+
+/* ---------- TextLink ---------- */
+.ac-link {
+ color: var(--fg-link); text-decoration: underline; text-underline-offset: 2px;
+ text-decoration-thickness: 1px; cursor: pointer;
+ border-radius: var(--r-xs);
+ transition: color var(--dur-fast) var(--ease-out-soft), text-decoration-thickness var(--dur-fast) var(--ease-out-soft);
+}
+.ac-link:hover { text-decoration-thickness: 2px; }
+.ac-link:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
+.ac-link:visited { color: var(--ldh-violet-700); }
+.ac-link.is-disabled { color: var(--fg-hint); text-decoration: none; pointer-events: none; }
+.ac-link.dm-inline { font-size: inherit; }
+/* standalone — own line, bolder, no rule until hover; the icon carries direction */
+.ac-link.dm-standalone {
+ display: inline-flex; align-items: center; gap: 6px;
+ font-weight: var(--fw-semibold); text-decoration: none;
+}
+.ac-link.dm-standalone:hover { text-decoration: underline; text-decoration-thickness: 2px; }
+.ac-link.sz-sm { font-size: var(--fs-sm); }
+.ac-link.sz-md { font-size: var(--fs-base); }
+.ac-link.sz-lg { font-size: var(--fs-md); }
+.ac-link.va-emphasis { color: var(--ldh-blue-700); font-weight: var(--fw-semibold); }
+.ac-link.va-inverse, .ac-link.va-fixed-light { color: #ffffff; }
+.ac-link.va-fixed-dark { color: var(--ink-1); }
+
+/* =========================================================================
+ FORM INPUTS
+ ========================================================================= */
+/* ---------- Label ---------- */
+.ac-label {
+ display: flex; align-items: center; gap: 6px;
+ font-family: var(--font-sans); font-weight: var(--fw-medium); color: var(--fg-2);
+}
+.ac-label.sz-sm { font-size: var(--fs-xs); }
+.ac-label.sz-md { font-size: var(--fs-sm); }
+.ac-label.sz-lg { font-size: var(--fs-base); }
+.ac-label .ac-label-aux { margin-left: auto; font-weight: var(--fw-regular); color: var(--fg-hint); font-family: var(--font-mono); font-size: var(--fs-xs); }
+.ac-vh {
+ position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
+ overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
+}
+
+/* ---------- HelpText ---------- */
+.ac-help {
+ display: flex; align-items: flex-start; gap: 5px;
+ font-family: var(--font-sans); color: var(--fg-hint); line-height: var(--lh-base);
+}
+.ac-help.sz-sm { font-size: var(--fs-xs); }
+.ac-help.sz-md { font-size: var(--fs-xs); }
+.ac-help.sz-lg { font-size: var(--fs-sm); }
+.ac-help.va-warning { color: var(--warning-500); }
+.ac-help.va-negative { color: var(--danger-500); }
+.ac-help .msi { font-size: 1.1em; margin-top: 1px; }
+
+/* ---------- TextField / TextArea ---------- */
+.ac-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
+.ac-field-box {
+ display: flex; align-items: center; gap: var(--sp-2);
+ background: var(--surface-0); box-sizing: border-box;
+ border: 1px solid var(--border-default); border-radius: var(--r-md);
+ transition: border-color var(--dur-fast) var(--ease-out-soft), box-shadow var(--dur-fast) var(--ease-out-soft), background var(--dur-fast) var(--ease-out-soft);
+}
+.ac-field-box.sz-sm { min-height: 32px; padding: 0 10px; }
+.ac-field-box.sz-md { min-height: 40px; padding: 0 12px; }
+.ac-field-box.sz-lg { min-height: 48px; padding: 0 14px; }
+.ac-field-box:hover { border-color: var(--border-strong); }
+.ac-field-box:focus-within { border-color: var(--ldh-blue-400); box-shadow: var(--focus-ring); }
+.ac-field-box.st-valid { border-color: var(--success-500); }
+.ac-field-box.st-invalid { border-color: var(--danger-500); }
+.ac-field-box.st-invalid:focus-within { box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger-500) 18%, transparent); }
+.ac-field-box.is-readonly { background: var(--surface-2); border-color: transparent; }
+.ac-field-box.is-disabled { background: var(--surface-1); opacity: 0.6; pointer-events: none; }
+.ac-field-box input, .ac-field-box textarea {
+ flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
+ font-family: var(--font-sans); font-size: var(--fs-base); color: var(--fg-1);
+ padding: 7px 0; resize: none;
+}
+.ac-field-box.sz-sm input { font-size: var(--fs-sm); }
+.ac-field-box input::placeholder, .ac-field-box textarea::placeholder { color: var(--fg-hint); }
+.ac-field-box textarea { padding: 10px 0; line-height: var(--lh-base); }
+.ac-field-box textarea.is-resizable { resize: vertical; }
+.ac-field-box .ac-adorn { display: inline-flex; align-items: center; color: var(--fg-hint); flex-shrink: 0; font-size: var(--fs-sm); }
+.ac-field-box .ac-adorn.is-unit { font-family: var(--font-mono); font-size: var(--fs-xs); }
+.ac-field-box.st-valid .ac-adorn-state { color: var(--success-500); }
+.ac-field-box.st-invalid .ac-adorn-state { color: var(--danger-500); }
+.ac-field-clear, .ac-field-btn {
+ display: inline-flex; align-items: center; justify-content: center;
+ width: 22px; height: 22px; flex-shrink: 0; padding: 0;
+ border: 0; background: transparent; cursor: pointer;
+ color: var(--fg-hint); border-radius: var(--r-xs);
+}
+.ac-field-clear:hover, .ac-field-btn:hover { background: var(--bg-hover); color: var(--fg-1); }
+.ac-field-clear:focus-visible, .ac-field-btn:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
+.ac-field-foot { display: flex; align-items: flex-start; gap: var(--sp-3); }
+.ac-field-count { margin-left: auto; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--fg-hint); white-space: nowrap; }
+.ac-field-count.is-over { color: var(--danger-500); }
+
+/* floating label — sits inside at rest, animates to the top border when active */
+.ac-field.lb-float .ac-field-box { position: relative; }
+.ac-field.lb-float .ac-float-lbl {
+ position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
+ font-family: var(--font-sans); font-size: var(--fs-base); color: var(--fg-hint);
+ pointer-events: none; background: var(--surface-0); padding: 0 4px;
+ transition: top var(--dur-fast) var(--ease-out-soft), font-size var(--dur-fast) var(--ease-out-soft), color var(--dur-fast) var(--ease-out-soft);
+}
+.ac-field.lb-float.is-active .ac-float-lbl {
+ top: 0; font-size: var(--fs-xs); color: var(--ldh-blue-600); transform: translateY(-50%);
+}
+.ac-field.lb-float.is-active.st-invalid .ac-float-lbl { color: var(--danger-500); }
+
+/* ---------- Checkbox / Radio ---------- */
+.ac-choice {
+ display: inline-flex; align-items: flex-start; gap: var(--sp-2);
+ cursor: pointer; font-family: var(--font-sans); font-size: var(--fs-base); color: var(--fg-1);
+ line-height: 1.4;
+}
+.ac-choice.is-disabled { cursor: not-allowed; opacity: 0.5; }
+.ac-choice input { position: absolute; opacity: 0; width: 0; height: 0; }
+.ac-box, .ac-dot {
+ display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
+ width: 18px; height: 18px; margin-top: 1px; box-sizing: border-box;
+ border: 1.5px solid var(--border-strong); background: var(--surface-0);
+ color: transparent;
+ transition: background var(--dur-fast) var(--ease-out-soft), border-color var(--dur-fast) var(--ease-out-soft), color var(--dur-fast) var(--ease-out-soft);
+}
+.ac-box { border-radius: var(--r-xs); }
+.ac-dot { border-radius: 50%; }
+.ac-choice:hover .ac-box, .ac-choice:hover .ac-dot { border-color: var(--ldh-blue-400); }
+.ac-choice input:checked + .ac-box { background: var(--bg-accent); border-color: var(--bg-accent); color: #fff; }
+.ac-choice input:indeterminate + .ac-box { background: var(--bg-accent); border-color: var(--bg-accent); color: #fff; }
+.ac-choice input:checked + .ac-dot { border-color: var(--bg-accent); border-width: 5px; }
+.ac-choice input:focus-visible + .ac-box,
+.ac-choice input:focus-visible + .ac-dot { box-shadow: var(--focus-ring); }
+.ac-choice.is-invalid .ac-box, .ac-choice.is-invalid .ac-dot { border-color: var(--danger-500); }
+.ac-box .msi { font-size: 14px; }
+.ac-choice-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
+.ac-choice-sub { font-size: var(--fs-sm); color: var(--fg-muted); }
+
+.ac-choice-group { display: flex; flex-direction: column; gap: var(--sp-3); }
+.ac-choice-group .ac-choice-list { display: flex; flex-direction: column; gap: var(--sp-2); }
+.ac-choice-group .ac-choice-list.is-inline { flex-direction: row; flex-wrap: wrap; gap: var(--sp-4); }
+.ac-choice-group .ac-selectall { padding-bottom: var(--sp-2); border-bottom: 1px solid var(--border-default); }
+
+/* ---------- Toggle ---------- */
+.ac-toggle { display: inline-flex; gap: var(--sp-2); cursor: pointer; font-family: var(--font-sans); }
+.ac-toggle.lp-above { flex-direction: column; align-items: flex-start; }
+.ac-toggle.lp-beside { flex-direction: row; align-items: center; }
+.ac-toggle.is-disabled { cursor: not-allowed; opacity: 0.5; }
+.ac-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
+.ac-track {
+ position: relative; display: inline-flex; align-items: center; flex-shrink: 0;
+ background: var(--surface-3); border-radius: var(--r-pill);
+ border: 1px solid var(--border-default); box-sizing: border-box;
+ transition: background var(--dur-base) var(--ease-out-soft), border-color var(--dur-base) var(--ease-out-soft);
+}
+.ac-toggle.sz-sm .ac-track { width: 36px; height: 20px; }
+.ac-toggle.sz-md .ac-track { width: 46px; height: 26px; }
+.ac-knob {
+ position: absolute; left: 2px; display: inline-flex; align-items: center; justify-content: center;
+ background: var(--surface-0); border-radius: 50%; box-shadow: var(--shadow-xs);
+ color: var(--fg-hint);
+ transition: transform var(--dur-base) var(--ease-spring), color var(--dur-fast) var(--ease-out-soft);
+}
+.ac-toggle.sz-sm .ac-knob { width: 14px; height: 14px; }
+.ac-toggle.sz-md .ac-knob { width: 20px; height: 20px; }
+.ac-toggle.sz-sm input:checked ~ .ac-track .ac-knob { transform: translateX(16px); }
+.ac-toggle.sz-md input:checked ~ .ac-track .ac-knob { transform: translateX(20px); }
+.ac-toggle input:checked ~ .ac-track { background: var(--bg-accent); border-color: var(--bg-accent); }
+.ac-toggle.va-positive input:checked ~ .ac-track { background: var(--success-500); border-color: var(--success-500); }
+.ac-toggle input:checked ~ .ac-track .ac-knob { color: var(--ldh-blue-600); }
+.ac-toggle input:focus-visible ~ .ac-track { box-shadow: var(--focus-ring); }
+.ac-toggle .ac-knob .msi { font-size: 12px; }
+.ac-toggle-lbl { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--fg-2); }
+.ac-toggle-state { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--fg-hint); }
+
+/* =========================================================================
+ NAVIGATION AND STRUCTURE
+ ========================================================================= */
+/* ---------- ContentSwitcher (segmented control) ---------- */
+.ac-switch {
+ display: inline-flex; align-items: center; gap: 2px; box-sizing: border-box;
+ background: var(--surface-2); border: 1px solid var(--border-default);
+ border-radius: var(--r-md); padding: 3px;
+}
+.ac-switch.wd-fill { display: flex; width: 100%; }
+.ac-switch.wd-fill .ac-switch-seg { flex: 1 1 0; justify-content: center; }
+.ac-switch-seg {
+ display: inline-flex; align-items: center; justify-content: center; gap: 6px;
+ border: 0; background: transparent; cursor: pointer; white-space: nowrap;
+ font-family: var(--font-sans); font-weight: var(--fw-medium); color: var(--fg-muted);
+ border-radius: var(--r-sm);
+ transition: background var(--dur-fast) var(--ease-out-soft), color var(--dur-fast) var(--ease-out-soft);
+}
+.ac-switch.sz-sm .ac-switch-seg { height: 26px; padding: 0 10px; font-size: var(--fs-xs); }
+.ac-switch.sz-md .ac-switch-seg { height: 32px; padding: 0 14px; font-size: var(--fs-sm); }
+.ac-switch.sz-lg .ac-switch-seg { height: 38px; padding: 0 18px; font-size: var(--fs-base); }
+.ac-switch-seg:hover { color: var(--fg-1); background: var(--bg-hover); }
+.ac-switch-seg:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
+.ac-switch-seg[aria-selected="true"], .ac-switch-seg[aria-checked="true"] {
+ background: var(--surface-0); color: var(--fg-selected); box-shadow: var(--shadow-xs);
+}
+.ac-switch.va-emphasis .ac-switch-seg[aria-selected="true"],
+.ac-switch.va-emphasis .ac-switch-seg[aria-checked="true"] {
+ background: var(--bg-accent); color: var(--fg-on-accent); box-shadow: none;
+}
+
+/* ---------- Divider ---------- */
+.ac-divider { border: 0; margin: 0; flex-shrink: 0; }
+.ac-divider.or-horizontal { width: 100%; height: 1px; }
+.ac-divider.or-vertical { width: 1px; align-self: stretch; min-height: 1em; }
+.ac-divider.wt-strong { background: var(--border-strong); }
+.ac-divider.wt-muted { background: var(--border-default); }
+.ac-divider.wt-subtle { background: color-mix(in srgb, var(--border-default) 55%, transparent); }
+.ac-divider.wt-solid-subtle { background: var(--surface-3); }
+.ac-divider.is-inverse { background: rgba(255,255,255,0.22); }
+
+/* =========================================================================
+ FEEDBACK, STATUS AND MESSAGING
+ ========================================================================= */
+/* ---------- Tag ---------- */
+.ac-tag {
+ display: inline-flex; align-items: center; gap: 5px; box-sizing: border-box;
+ border-radius: var(--r-pill); font-family: var(--font-sans); font-weight: var(--fw-medium);
+ border: 1px solid transparent; max-width: 100%;
+}
+/* xs — for a Tag that sits INLINE after a value rather than in a row of its
+ own: a language tag, a datatype. Small enough not to outweigh the value it
+ annotates. */
+.ac-tag.sz-xs { height: 16px; padding: 0 6px; font-size: 10px; }
+.ac-tag.sz-sm { height: 20px; padding: 0 8px; font-size: var(--fs-xs); }
+.ac-tag.sz-md { height: 26px; padding: 0 11px; font-size: var(--fs-sm); }
+.ac-tag .ac-tag-lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.ac-tag .msi { font-size: 1.05em; flex-shrink: 0; }
+.ac-tag.is-disabled { opacity: 0.5; pointer-events: none; }
+/* quiet emphasis (tinted bg, coloured text) */
+.ac-tag.em-quiet.co-neutral { background: var(--surface-2); color: var(--fg-2); }
+.ac-tag.em-quiet.co-primary { background: var(--ldh-blue-50); color: var(--ldh-blue-700); }
+.ac-tag.em-quiet.co-brand { background: var(--ldh-blue-50); color: var(--ldh-blue-800, var(--ldh-blue-700)); }
+.ac-tag.em-quiet.co-accent { background: var(--ldh-violet-100); color: var(--ldh-violet-700); }
+.ac-tag.em-quiet.co-informative { background: var(--bg-accent-quiet); color: var(--ldh-blue-700); }
+.ac-tag.em-quiet.co-positive { background: var(--success-50); color: var(--success-500); }
+.ac-tag.em-quiet.co-warning { background: var(--warning-50); color: var(--warning-500); }
+.ac-tag.em-quiet.co-negative { background: var(--danger-50); color: var(--danger-500); }
+/* strong emphasis (filled) */
+.ac-tag.em-strong { color: #fff; }
+.ac-tag.em-strong.co-neutral { background: var(--ink-3); }
+.ac-tag.em-strong.co-primary,
+.ac-tag.em-strong.co-brand,
+.ac-tag.em-strong.co-informative { background: var(--bg-accent); }
+.ac-tag.em-strong.co-accent { background: var(--ldh-violet-600); }
+.ac-tag.em-strong.co-positive { background: var(--success-500); }
+.ac-tag.em-strong.co-warning { background: var(--warning-500); }
+.ac-tag.em-strong.co-negative { background: var(--danger-500); }
+.ac-tag-x {
+ display: inline-flex; align-items: center; justify-content: center;
+ width: 16px; height: 16px; padding: 0; margin-right: -3px;
+ border: 0; background: transparent; color: inherit; cursor: pointer;
+ border-radius: 50%; opacity: 0;
+ transition: opacity var(--dur-fast) var(--ease-out-soft), background var(--dur-fast) var(--ease-out-soft);
+}
+.ac-tag:hover .ac-tag-x, .ac-tag-x:focus-visible { opacity: 1; }
+.ac-tag-x:hover { background: color-mix(in srgb, currentColor 18%, transparent); }
+.ac-tag-x:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
+.ac-tag-x .msi { font-size: 13px; }
+
+/* ---------- Badge ---------- */
+.ac-badge-wrap { position: relative; display: inline-flex; }
+.ac-badge {
+ display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box;
+ font-family: var(--font-mono); font-weight: var(--fw-bold); line-height: 1;
+ border-radius: var(--r-pill); border: 2px solid var(--surface-0);
+ color: #fff; background: var(--danger-500);
+ transition: transform var(--dur-base) var(--ease-spring), opacity var(--dur-fast) var(--ease-out-soft);
+}
+.ac-badge.sz-sm { min-width: 16px; height: 16px; padding: 0 4px; font-size: 9px; }
+.ac-badge.sz-md { min-width: 20px; height: 20px; padding: 0 6px; font-size: 11px; }
+.ac-badge.is-dot.sz-sm { min-width: 8px; width: 8px; height: 8px; padding: 0; }
+.ac-badge.is-dot.sz-md { min-width: 10px; width: 10px; height: 10px; padding: 0; }
+.ac-badge.co-default { background: var(--danger-500); }
+.ac-badge.co-neutral { background: var(--ink-3); }
+.ac-badge.co-positive { background: var(--success-500); }
+.ac-badge.co-warning { background: var(--warning-500); }
+.ac-badge.co-negative { background: var(--danger-500); }
+.ac-badge.pl-top-right { position: absolute; top: 0; right: 0; transform: translate(40%, -40%); }
+.ac-badge.pl-bottom-right { position: absolute; bottom: 0; right: 0; transform: translate(40%, 40%); }
+.ac-badge.pl-inline { position: static; transform: none; border-width: 0; }
+.ac-badge.is-hidden { opacity: 0; transform: scale(0.4); pointer-events: none; }
+
+/* ---------- InlineAlert ---------- */
+.ac-alert {
+ display: flex; gap: var(--sp-3); box-sizing: border-box;
+ padding: var(--sp-4); border-radius: var(--r-md);
+ border: 1px solid var(--border-default); background: var(--surface-2);
+ font-family: var(--font-sans);
+}
+.ac-alert > .ac-alert-ic { flex-shrink: 0; margin-top: 1px; }
+.ac-alert-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
+/* The body is a flex column with its own gap, so a child's block margin is a
+ second spacing mechanism fighting the first — two paragraphs of alert text
+ came out further apart than the gap says, and the first and last pushed the
+ text off the padding. Consumers were resetting this per surface (the docs
+ site did it for :first-child and :last-child and still double-spaced the
+ middle); it belongs to the component. */
+.ac-alert-body > * { margin-block: 0; }
+.ac-alert-title { font-weight: var(--fw-semibold); font-size: var(--fs-sm); color: var(--fg-1); }
+.ac-alert-text { font-size: var(--fs-sm); color: var(--fg-2); line-height: var(--lh-base); }
+/* the link slot: what could not be reached, on a row of its own so the sentence
+ above it stays a sentence. The recessed mono treatment is stated here rather
+ than borrowed from the type scale's .ldh-code, because every other slot of
+ this alert states its own — and a kit component cannot depend on a brand
+ utility to look right. break-all because the slot holds an IRI. */
+.ac-alert-uri {
+ font-family: var(--font-mono); font-size: 0.92em; line-height: var(--lh-base);
+ color: var(--ink-2); background: var(--surface-2);
+ padding: 1px 6px; border-radius: var(--r-xs);
+ word-break: break-all;
+}
+.ac-alert.va-informative { background: var(--bg-accent-quiet); border-color: color-mix(in srgb, var(--ldh-blue-500) 28%, transparent); }
+.ac-alert.va-informative > .ac-alert-ic { color: var(--ldh-blue-600); }
+.ac-alert.va-success { background: var(--success-50); border-color: color-mix(in srgb, var(--success-500) 30%, transparent); }
+.ac-alert.va-success > .ac-alert-ic { color: var(--success-500); }
+.ac-alert.va-warning { background: var(--warning-50); border-color: color-mix(in srgb, var(--warning-500) 32%, transparent); }
+.ac-alert.va-warning > .ac-alert-ic { color: var(--warning-500); }
+.ac-alert.va-negative { background: var(--danger-50); border-color: color-mix(in srgb, var(--danger-500) 32%, transparent); }
+.ac-alert.va-negative > .ac-alert-ic { color: var(--danger-500); }
+.ac-alert-x {
+ flex-shrink: 0; width: 24px; height: 24px; padding: 0; align-self: flex-start;
+ display: inline-flex; align-items: center; justify-content: center;
+ border: 0; background: transparent; color: var(--fg-muted); cursor: pointer; border-radius: var(--r-xs);
+}
+.ac-alert-x:hover { background: color-mix(in srgb, currentColor 12%, transparent); color: var(--fg-1); }
+.ac-alert-x:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
+.ac-alert.is-out { opacity: 0; transform: translateY(-4px); transition: opacity var(--dur-base) var(--ease-out-soft), transform var(--dur-base) var(--ease-out-soft); }
+
+/* ---------- Disclosure — demoted detail, collapsed by default ----------
+ InlineAlert's companion. An alert states what failed in the reader's terms
+ and refuses to lead with the upstream text; this is where that text goes —
+ never the first thing read, never withheld from whoever needs it. The marker
+ is the msi chevron rather than the browser's triangle, so it reads as part of
+ the kit. */
+.ac-disclosure { border-top: 1px dashed var(--border-default); padding-top: var(--sp-3); }
+.ac-disclosure > summary {
+ display: inline-flex; align-items: center; gap: 5px;
+ cursor: pointer; list-style: none;
+ font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: var(--fw-medium);
+ color: var(--fg-muted); border-radius: var(--r-xs);
+}
+.ac-disclosure > summary::-webkit-details-marker { display: none; }
+.ac-disclosure > summary:hover { color: var(--fg-1); }
+.ac-disclosure > summary:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
+.ac-disclosure > summary .msi { font-size: 15px; transition: transform var(--dur-fast) var(--ease-out-soft); }
+.ac-disclosure[open] > summary .msi { transform: rotate(90deg); }
+/* the recessed well. `border: 0` is stated rather than assumed: a consumer that
+ gives bare a border of its own would otherwise box this one too. */
+.ac-disclosure pre {
+ margin: var(--sp-2) 0 0; padding: var(--sp-3); overflow-x: auto;
+ background: var(--surface-2); border: 0; border-radius: var(--r-sm);
+ font-family: var(--font-mono); font-size: var(--fs-xs); line-height: 1.6;
+ color: var(--fg-muted); white-space: pre-wrap; word-break: break-word;
+}
+
+/* ---------- Toast ---------- */
+.ac-toast-region {
+ position: fixed; z-index: 60; display: flex; flex-direction: column; gap: var(--sp-2);
+ max-width: min(400px, calc(100vw - 32px));
+}
+.ac-toast-region.rg-bottom-right { right: var(--sp-6); bottom: var(--sp-6); }
+.ac-toast-region.rg-top-right { right: var(--sp-6); top: var(--sp-6); }
+.ac-toast {
+ display: flex; gap: var(--sp-3); align-items: flex-start; box-sizing: border-box;
+ padding: var(--sp-3) var(--sp-4);
+ background: var(--surface-0); border: 1px solid var(--border-default);
+ border-radius: var(--r-md); box-shadow: var(--shadow-lg);
+ font-family: var(--font-sans);
+ animation: ac-toast-in var(--dur-base) var(--ease-out-soft);
+}
+@keyframes ac-toast-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
+.ac-toast.is-out { opacity: 0; transform: translateX(12px); transition: opacity var(--dur-base) var(--ease-out-soft), transform var(--dur-base) var(--ease-out-soft); }
+.ac-toast > .ac-toast-ic { flex-shrink: 0; margin-top: 1px; }
+.ac-toast.va-informative > .ac-toast-ic { color: var(--ldh-blue-600); }
+.ac-toast.va-success > .ac-toast-ic { color: var(--success-500); }
+.ac-toast.va-warning > .ac-toast-ic { color: var(--warning-500); }
+.ac-toast.va-negative > .ac-toast-ic { color: var(--danger-500); }
+.ac-toast.va-neutral > .ac-toast-ic { color: var(--fg-muted); }
+.ac-toast-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
+.ac-toast-title { font-weight: var(--fw-semibold); font-size: var(--fs-sm); color: var(--fg-1); }
+.ac-toast-text { font-size: var(--fs-sm); color: var(--fg-muted); line-height: var(--lh-base); }
+
+/* ---------- ProgressBar ---------- */
+.ac-pbar { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
+.ac-pbar-head { display: flex; align-items: center; gap: var(--sp-2); }
+.ac-pbar-lbl { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-sans); font-size: var(--fs-sm); color: var(--fg-2); }
+.ac-pbar-val { margin-left: auto; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--fg-muted); font-variant-numeric: tabular-nums; }
+.ac-pbar-track {
+ position: relative; width: 100%; overflow: hidden;
+ background: var(--surface-3); border-radius: var(--r-pill);
+}
+.ac-pbar.ht-xs .ac-pbar-track { height: 4px; }
+.ac-pbar.ht-sm .ac-pbar-track { height: 6px; }
+.ac-pbar.ht-md .ac-pbar-track { height: 10px; }
+.ac-pbar.ht-lg .ac-pbar-track { height: 16px; }
+.ac-pbar-fill {
+ height: 100%; border-radius: inherit; background: var(--bg-accent);
+ transition: width var(--dur-slow) var(--ease-out-soft);
+ display: flex; align-items: center; justify-content: flex-end;
+}
+.ac-pbar.co-neutral .ac-pbar-fill { background: var(--ink-3); }
+.ac-pbar.co-success .ac-pbar-fill { background: var(--success-500); }
+.ac-pbar.co-warning .ac-pbar-fill { background: var(--warning-500); }
+.ac-pbar.co-negative .ac-pbar-fill { background: var(--danger-500); }
+.ac-pbar.is-shimmer .ac-pbar-fill::after {
+ content: ""; position: absolute; inset: 0;
+ background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
+ animation: ac-shimmer 1.6s linear infinite;
+}
+@keyframes ac-shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
+.ac-pbar.is-indeterminate .ac-pbar-fill {
+ width: 35% !important; animation: ac-indet 1.3s var(--ease-in-out) infinite;
+}
+@keyframes ac-indet { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
+.ac-pbar-inval { font-family: var(--font-mono); font-size: 9px; color: #fff; padding-right: 5px; }
+
+/* ---------- ProgressCircle ---------- */
+.ac-pcircle { display: inline-flex; align-items: center; justify-content: center; position: relative; flex-shrink: 0; }
+.ac-pcircle.sz-xs { width: 16px; height: 16px; }
+.ac-pcircle.sz-sm { width: 22px; height: 22px; }
+.ac-pcircle.sz-md { width: 36px; height: 36px; }
+.ac-pcircle.sz-lg { width: 56px; height: 56px; }
+.ac-pcircle svg { width: 100%; height: 100%; transform: rotate(-90deg); }
+.ac-pcircle .pc-track { stroke: var(--surface-3); }
+.ac-pcircle .pc-fill { stroke: var(--bg-accent); transition: stroke-dashoffset var(--dur-slow) var(--ease-out-soft); }
+.ac-pcircle.is-spin svg { animation: ac-spin 0.9s linear infinite; }
+.ac-pcircle.is-multi .pc-fill { stroke: url(#ac-pc-grad); }
+.ac-pcircle-val { position: absolute; font-family: var(--font-mono); font-size: 10px; color: var(--fg-2); font-variant-numeric: tabular-nums; }
+
+/* ---------- Skeleton ---------- */
+.ac-skel-group { display: flex; flex-direction: column; gap: var(--sp-2); width: 100%; }
+.ac-skel {
+ background: var(--surface-3); border-radius: var(--r-sm);
+ position: relative; overflow: hidden; flex-shrink: 0;
+}
+.ac-skel.sh-circle { border-radius: 50%; }
+.ac-skel.sh-text { border-radius: var(--r-xs); }
+.ac-skel.is-shimmer::after {
+ content: ""; position: absolute; inset: 0;
+ background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface-0) 60%, transparent), transparent);
+ animation: ac-shimmer 1.5s linear infinite;
+}
+
+/* ---------- Tooltip / Toggletip (shared floating surface) ---------- */
+.ac-tip-anchor { position: relative; display: inline-flex; }
+.ac-tip {
+ position: absolute; z-index: 70; box-sizing: border-box;
+ padding: 7px 10px; border-radius: var(--r-sm);
+ font-family: var(--font-sans); font-size: var(--fs-xs); line-height: 1.45;
+ max-width: 240px; width: max-content;
+ background: var(--ink-1); color: #fff; box-shadow: var(--shadow-md);
+ animation: ac-tip-in var(--dur-fast) var(--ease-out-soft);
+}
+@keyframes ac-tip-in { from { opacity: 0; transform: translateY(2px); } }
+.ac-tip.va-neutral { background: var(--surface-0); color: var(--fg-1); border: 1px solid var(--border-default); }
+.ac-tip.sd-top { bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); }
+.ac-tip.sd-bottom { top: calc(100% + 8px); left: 50%; transform: translateX(-50%); }
+.ac-tip.sd-left { right: calc(100% + 8px); top: 50%; transform: translateY(-50%); }
+.ac-tip.sd-right { left: calc(100% + 8px); top: 50%; transform: translateY(-50%); }
+.ac-tip-tip { position: absolute; width: 8px; height: 8px; background: inherit; transform: rotate(45deg); }
+.ac-tip.sd-top .ac-tip-tip { bottom: -4px; left: 50%; margin-left: -4px; }
+.ac-tip.sd-bottom .ac-tip-tip { top: -4px; left: 50%; margin-left: -4px; }
+.ac-tip.sd-left .ac-tip-tip { right: -4px; top: 50%; margin-top: -4px; }
+.ac-tip.sd-right .ac-tip-tip { left: -4px; top: 50%; margin-top: -4px; }
+.ac-tip-title { display: block; font-weight: var(--fw-semibold); font-size: var(--fs-sm); margin-bottom: 3px; }
+.ac-tip a { color: inherit; text-decoration: underline; }
+.ac-tip.va-neutral a { color: var(--fg-link); }
+.ac-toggletip-btn {
+ display: inline-flex; align-items: center; justify-content: center;
+ width: 20px; height: 20px; padding: 0; border: 0; background: transparent;
+ color: var(--fg-hint); cursor: pointer; border-radius: 50%;
+}
+.ac-toggletip-btn:hover { color: var(--fg-1); background: var(--bg-hover); }
+.ac-toggletip-btn:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
+
+/* =========================================================================
+ Tabs — a tablist whose tabs own PANELS. (ContentSwitcher above is the
+ paneless segmented control; the app shell's .ldh-tabs is the dataspace
+ switcher.) Three variants: line (underline), enclosed (card), subtle (pill).
+ ========================================================================= */
+.ac-tabs { display: flex; flex-direction: column; min-width: 0; }
+.ac-tabs.or-vertical { flex-direction: row; gap: var(--sp-5); }
+
+.ac-tablist { display: flex; align-items: stretch; min-width: 0; }
+.ac-tabs.or-horizontal > .ac-tablist { overflow-x: auto; scrollbar-width: none; }
+.ac-tabs.or-horizontal > .ac-tablist::-webkit-scrollbar { display: none; }
+.ac-tabs.or-vertical > .ac-tablist { flex-direction: column; flex-shrink: 0; overflow-x: visible; }
+.ac-tablist.is-fitted { width: 100%; }
+.ac-tablist.is-fitted .ac-tab { flex: 1 1 0; justify-content: center; }
+
+.ac-tab {
+ display: inline-flex; align-items: center; gap: 7px;
+ border: 0; background: transparent; cursor: pointer; white-space: nowrap;
+ font-family: var(--font-sans); font-weight: var(--fw-medium); color: var(--fg-muted);
+ box-sizing: border-box; position: relative;
+ transition: color var(--dur-fast) var(--ease-out-soft),
+ background var(--dur-fast) var(--ease-out-soft),
+ border-color var(--dur-fast) var(--ease-out-soft);
+}
+.ac-tablist.sz-sm .ac-tab { height: 32px; padding: 0 12px; font-size: var(--fs-sm); }
+.ac-tablist.sz-md .ac-tab { height: 40px; padding: 0 16px; font-size: var(--fs-sm); }
+.ac-tablist.sz-lg .ac-tab { height: 48px; padding: 0 20px; font-size: var(--fs-base); }
+.ac-tab:hover:not(:disabled) { color: var(--fg-1); }
+.ac-tab:focus-visible { outline: 0; box-shadow: var(--focus-ring); border-radius: var(--r-sm); z-index: 1; }
+.ac-tab:disabled { color: var(--ink-5); cursor: not-allowed; }
+.ac-tab-lbl { overflow: hidden; text-overflow: ellipsis; }
+.ac-tab-count {
+ display: inline-flex; align-items: center; justify-content: center;
+ min-width: 18px; height: 18px; padding: 0 5px;
+ border-radius: var(--r-pill); background: var(--surface-3); color: var(--fg-muted);
+ font-family: var(--font-mono); font-size: 10px; font-weight: var(--fw-semibold);
+}
+.ac-tab.is-on .ac-tab-count { background: var(--bg-accent-quiet); color: var(--fg-selected); }
+
+/* line — the default. An underline on the active tab, a rule under the list. */
+.ac-tablist.va-line { border-bottom: 1px solid var(--border-default); gap: var(--sp-1); }
+.ac-tabs.or-vertical .ac-tablist.va-line {
+ border-bottom: 0; border-right: 1px solid var(--border-default);
+}
+.ac-tablist.va-line .ac-tab::after {
+ content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
+ background: transparent; border-radius: 2px 2px 0 0;
+ transition: background var(--dur-fast) var(--ease-out-soft);
+}
+.ac-tabs.or-vertical .ac-tablist.va-line .ac-tab {
+ justify-content: flex-start;
+}
+.ac-tabs.or-vertical .ac-tablist.va-line .ac-tab::after {
+ left: auto; right: -1px; top: 0; bottom: 0; width: 2px; height: auto;
+ border-radius: 2px 0 0 2px;
+}
+.ac-tablist.va-line .ac-tab.is-on { color: var(--fg-selected); }
+/* The indicator uses --fg-selected rather than --bg-accent: a skin whose accent
+ is a pale fill (base44's highlighter) would vanish as a 2px rule. */
+.ac-tablist.va-line .ac-tab.is-on::after { background: var(--fg-selected); }
+
+/* enclosed — card tabs sitting on the list rule. */
+.ac-tablist.va-enclosed { border-bottom: 1px solid var(--border-default); gap: 2px; }
+.ac-tablist.va-enclosed .ac-tab {
+ border: 1px solid transparent; border-bottom: 0;
+ border-radius: var(--r-md) var(--r-md) 0 0; margin-bottom: -1px;
+}
+.ac-tablist.va-enclosed .ac-tab:hover:not(:disabled):not(.is-on) { background: var(--bg-hover); }
+.ac-tablist.va-enclosed .ac-tab.is-on {
+ background: var(--surface-0); border-color: var(--border-default);
+ color: var(--fg-1); padding-bottom: 1px;
+}
+
+/* subtle — a pill track, matching the segmented control's resting language. */
+.ac-tablist.va-subtle {
+ gap: 2px; padding: 3px; align-self: flex-start;
+ background: var(--surface-2); border: 1px solid var(--border-default);
+ border-radius: var(--r-md);
+}
+.ac-tablist.va-subtle .ac-tab { border-radius: var(--r-sm); }
+.ac-tablist.va-subtle .ac-tab:hover:not(:disabled):not(.is-on) { background: var(--bg-hover); }
+.ac-tablist.va-subtle .ac-tab.is-on {
+ background: var(--surface-0); color: var(--fg-selected); box-shadow: var(--shadow-xs);
+}
+
+.ac-tabpanel { padding-top: var(--sp-4); min-width: 0; flex: 1; }
+.ac-tabpanel:focus-visible { outline: 0; box-shadow: var(--focus-ring); border-radius: var(--r-sm); }
+.ac-tabs.or-vertical .ac-tabpanel { padding-top: 0; }
+.ac-tabpanel[hidden] { display: none; }
diff --git a/src/main/webapp/static/com/atomgraph/client/css/ol.css b/src/main/webapp/static/com/atomgraph/client/css/ol.css
new file mode 100644
index 00000000..398c6d8f
--- /dev/null
+++ b/src/main/webapp/static/com/atomgraph/client/css/ol.css
@@ -0,0 +1,2 @@
+:host,:root{--ol-background-color:white;--ol-accent-background-color:#F5F5F5;--ol-subtle-background-color:rgba(128, 128, 128, 0.25);--ol-partial-background-color:rgba(255, 255, 255, 0.75);--ol-foreground-color:#333333;--ol-subtle-foreground-color:#666666;--ol-brand-color:#00AAFF}.ol-box{box-sizing:border-box;border-radius:2px;border:1.5px solid var(--ol-background-color);background-color:var(--ol-partial-background-color)}.ol-mouse-position{top:8px;right:8px;position:absolute}.ol-scale-line{background:var(--ol-partial-background-color);border-radius:4px;bottom:8px;left:8px;padding:2px;position:absolute}.ol-scale-line-inner{border:1px solid var(--ol-subtle-foreground-color);border-top:none;color:var(--ol-foreground-color);font-size:10px;text-align:center;margin:1px;will-change:contents,width;transition:all .25s}.ol-scale-bar{position:absolute;bottom:8px;left:8px}.ol-scale-bar-inner{display:flex}.ol-scale-step-marker{width:1px;height:15px;background-color:var(--ol-foreground-color);float:right;z-index:10}.ol-scale-step-text{position:absolute;bottom:-5px;font-size:10px;z-index:11;color:var(--ol-foreground-color);text-shadow:-1.5px 0 var(--ol-partial-background-color),0 1.5px var(--ol-partial-background-color),1.5px 0 var(--ol-partial-background-color),0 -1.5px var(--ol-partial-background-color)}.ol-scale-text{position:absolute;font-size:12px;text-align:center;bottom:25px;color:var(--ol-foreground-color);text-shadow:-1.5px 0 var(--ol-partial-background-color),0 1.5px var(--ol-partial-background-color),1.5px 0 var(--ol-partial-background-color),0 -1.5px var(--ol-partial-background-color)}.ol-scale-singlebar{position:relative;height:10px;z-index:9;box-sizing:border-box;border:1px solid var(--ol-foreground-color)}.ol-scale-singlebar-even{background-color:var(--ol-subtle-foreground-color)}.ol-scale-singlebar-odd{background-color:var(--ol-background-color)}.ol-unsupported{display:none}.ol-unselectable,.ol-viewport{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.ol-viewport canvas{all:unset}.ol-selectable{-webkit-touch-callout:default;-webkit-user-select:text;-moz-user-select:text;user-select:text}.ol-grabbing{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.ol-grab{cursor:move;cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.ol-control{position:absolute;background-color:var(--ol-subtle-background-color);border-radius:4px}.ol-zoom{top:.5em;left:.5em}.ol-rotate{top:.5em;right:.5em;transition:opacity .25s linear,visibility 0s linear}.ol-rotate.ol-hidden{opacity:0;visibility:hidden;transition:opacity .25s linear,visibility 0s linear .25s}.ol-zoom-extent{top:4.643em;left:.5em}.ol-full-screen{right:.5em;top:.5em}.ol-control button{display:block;margin:1px;padding:0;color:var(--ol-subtle-foreground-color);font-weight:700;text-decoration:none;font-size:inherit;text-align:center;height:1.375em;width:1.375em;line-height:.4em;background-color:var(--ol-background-color);border:none;border-radius:2px}.ol-control button::-moz-focus-inner{border:none;padding:0}.ol-zoom-extent button{line-height:1.4em}.ol-compass{display:block;font-weight:400;will-change:transform}.ol-touch .ol-control button{font-size:1.5em}.ol-touch .ol-zoom-extent{top:5.5em}.ol-control button:focus,.ol-control button:hover{text-decoration:none;outline:1px solid var(--ol-subtle-foreground-color);color:var(--ol-foreground-color)}.ol-zoom .ol-zoom-in{border-radius:2px 2px 0 0}.ol-zoom .ol-zoom-out{border-radius:0 0 2px 2px}.ol-attribution{text-align:right;bottom:.5em;right:.5em;max-width:calc(100% - 1.3em);display:flex;flex-flow:row-reverse;align-items:center}.ol-attribution a{color:var(--ol-subtle-foreground-color);text-decoration:none}.ol-attribution ul{margin:0;padding:1px .5em;color:var(--ol-foreground-color);text-shadow:0 0 2px var(--ol-background-color);font-size:12px}.ol-attribution li{display:inline;list-style:none}.ol-attribution li:not(:last-child):after{content:" "}.ol-attribution img{max-height:2em;max-width:inherit;vertical-align:middle}.ol-attribution button{flex-shrink:0}.ol-attribution.ol-collapsed ul{display:none}.ol-attribution:not(.ol-collapsed){background:var(--ol-partial-background-color)}.ol-attribution.ol-uncollapsible{bottom:0;right:0;border-radius:4px 0 0}.ol-attribution.ol-uncollapsible img{margin-top:-.2em;max-height:1.6em}.ol-attribution.ol-uncollapsible button{display:none}.ol-zoomslider{top:4.5em;left:.5em;height:200px}.ol-zoomslider button{position:relative;height:10px}.ol-touch .ol-zoomslider{top:5.5em}.ol-overviewmap{left:.5em;bottom:.5em}.ol-overviewmap.ol-uncollapsible{bottom:0;left:0;border-radius:0 4px 0 0}.ol-overviewmap .ol-overviewmap-map,.ol-overviewmap button{display:block}.ol-overviewmap .ol-overviewmap-map{border:1px solid var(--ol-subtle-foreground-color);height:150px;width:150px}.ol-overviewmap:not(.ol-collapsed) button{bottom:0;left:0;position:absolute}.ol-overviewmap.ol-collapsed .ol-overviewmap-map,.ol-overviewmap.ol-uncollapsible button{display:none}.ol-overviewmap:not(.ol-collapsed){background:var(--ol-subtle-background-color)}.ol-overviewmap-box{border:1.5px dotted var(--ol-subtle-foreground-color)}.ol-overviewmap .ol-overviewmap-box:hover{cursor:move}
+/*# sourceMappingURL=ol.css.map */
\ No newline at end of file
diff --git a/src/main/webapp/static/com/atomgraph/client/css/overlays.css b/src/main/webapp/static/com/atomgraph/client/css/overlays.css
new file mode 100644
index 00000000..5fa9cfe1
--- /dev/null
+++ b/src/main/webapp/static/com/atomgraph/client/css/overlays.css
@@ -0,0 +1,188 @@
+/* =========================================================================
+ ui_kits/core/overlays.css — Menu · Popover · Modal
+
+ All three share one positioning/dismissal model: anchored to a trigger (or
+ centred, for modals), dismissal on outside click and Escape, focus returned
+ to the trigger on close.
+ ========================================================================= */
+
+/* =========================================================================
+ Menu — trigger + surface + items. Item anatomy: icon, label, optional
+ sub-line, danger, disabled. Plus separators and section headers.
+
+ THE OVERFLOW RULE, promoted to a named pattern (it was an unwritten
+ convention inside FormActions):
+ 0 actions → render nothing
+ 1 action → a direct labelled button, no menu (a dropdown holding one
+ item is pure friction)
+ 2+ actions → collapse into this menu
+ Named `.ac-menu-overflow` so call sites can rely on it.
+ ========================================================================= */
+.ac-menu-anchor { position: relative; display: inline-flex; }
+.ac-menu {
+ /* Both bounds yield to the viewport. Placement (the drop-up / drop-left flip) only chooses a
+ side; it cannot make a panel narrower than its own floor, so a floor wider than the screen
+ overflows whichever side it opens into. */
+ position: absolute; z-index: 50;
+ min-width: min(200px, calc(100vw - 2 * var(--sp-4))); max-width: min(340px, calc(100vw - 2 * var(--sp-4)));
+ max-height: 340px; overflow-y: auto;
+ padding: 4px;
+ background: var(--surface-0);
+ border: 1px solid var(--border-default); border-radius: var(--r-md);
+ box-shadow: var(--shadow-lg);
+ /* A floating panel is an independent surface: it pins its own ink so a skin
+ that recolours a region can't bleed into it. */
+ color: var(--fg-1);
+ animation: ac-menu-in var(--dur-fast) var(--ease-out-soft);
+}
+@keyframes ac-menu-in { from { opacity: 0; transform: translateY(-4px) scale(0.99); } }
+.ac-menu.al-start { top: calc(100% + 5px); left: 0; }
+.ac-menu.al-end { top: calc(100% + 5px); right: 0; }
+.ac-menu.al-up-start { bottom: calc(100% + 5px); left: 0; }
+.ac-menu.al-up-end { bottom: calc(100% + 5px); right: 0; }
+
+.ac-menu-item {
+ display: flex; align-items: flex-start; gap: var(--sp-2); width: 100%;
+ padding: 8px 10px; border: 0; background: transparent; cursor: pointer;
+ text-align: left; border-radius: var(--r-sm);
+ font-family: var(--font-sans); font-size: var(--fs-sm); color: var(--fg-1);
+ transition: background var(--dur-fast) var(--ease-out-soft), color var(--dur-fast) var(--ease-out-soft);
+}
+.ac-menu-item:hover { background: var(--bg-hover); }
+.ac-menu-item:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
+.ac-menu-item[aria-checked="true"], .ac-menu-item.is-selected { background: var(--bg-selected); color: var(--fg-selected); }
+.ac-menu-item:disabled, .ac-menu-item[aria-disabled="true"] { cursor: not-allowed; opacity: 0.45; pointer-events: none; }
+.ac-menu-item > .ac-menu-ic { color: var(--fg-hint); flex-shrink: 0; margin-top: 1px; }
+.ac-menu-item:hover > .ac-menu-ic { color: var(--fg-2); }
+.ac-menu-item-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
+.ac-menu-item-lbl { font-weight: var(--fw-medium); }
+.ac-menu-item-sub { font-size: var(--fs-xs); color: var(--fg-hint); line-height: 1.45; }
+.ac-menu-item.is-danger { color: var(--danger-500); }
+.ac-menu-item.is-danger > .ac-menu-ic { color: var(--danger-500); }
+.ac-menu-item.is-danger:hover { background: var(--danger-50); }
+.ac-menu-item.is-danger .ac-menu-item-sub { color: color-mix(in srgb, var(--danger-500) 72%, transparent); }
+.ac-menu-item > .ac-menu-tick { margin-left: auto; flex-shrink: 0; color: var(--fg-selected); }
+.ac-menu-sep { height: 1px; margin: 4px 2px; background: var(--border-default); border: 0; }
+.ac-menu-header {
+ padding: 8px 10px 4px;
+ font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: var(--fw-medium);
+ letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--fg-hint);
+}
+
+/* =========================================================================
+ Popover — a small floating panel holding rich interactive content. Unlike a
+ tooltip it can contain focusable elements, so it opens on click and traps
+ nothing (the page stays usable).
+ ========================================================================= */
+.ac-popover {
+ position: absolute; z-index: 55; box-sizing: border-box;
+ max-width: 320px; padding: var(--sp-4);
+ background: var(--surface-0); color: var(--fg-1);
+ border: 1px solid var(--border-default); border-radius: var(--r-md);
+ box-shadow: var(--shadow-lg);
+ animation: ac-menu-in var(--dur-fast) var(--ease-out-soft);
+}
+.ac-popover.is-flush { padding: 0; overflow: hidden; }
+.ac-popover.va-inverse { background: var(--ink-1); color: #fff; border-color: transparent; }
+.ac-popover.sd-top { bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); }
+.ac-popover.sd-bottom { top: calc(100% + 8px); left: 50%; transform: translateX(-50%); }
+.ac-popover.sd-left { right: calc(100% + 8px); top: 50%; transform: translateY(-50%); }
+.ac-popover.sd-right { left: calc(100% + 8px); top: 50%; transform: translateY(-50%); }
+.ac-popover-tip { position: absolute; width: 9px; height: 9px; background: inherit; border: inherit; transform: rotate(45deg); }
+.ac-popover.sd-top .ac-popover-tip { bottom: -5px; left: 50%; margin-left: -4px; border-top: 0; border-left: 0; }
+.ac-popover.sd-bottom .ac-popover-tip { top: -5px; left: 50%; margin-left: -4px; border-bottom: 0; border-right: 0; }
+.ac-popover-x { position: absolute; top: 6px; right: 6px; }
+
+/* =========================================================================
+ Modal — header / body / footer / backdrop / close.
+
+ STACKING: the constructor dialog opens above the edit modal, so depth is a
+ data attribute rather than a hardcoded z-index. Each level steps the z-index
+ and dims slightly less, so the stack reads as depth instead of mud.
+ ========================================================================= */
+.ac-backdrop {
+ position: fixed; inset: 0; z-index: 100;
+ background: rgba(15, 18, 26, 0.44);
+ -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
+ display: flex; align-items: flex-start; justify-content: center;
+ padding: var(--sp-8) var(--sp-4);
+ overflow-y: auto;
+ animation: ac-fade-in var(--dur-base) var(--ease-out-soft);
+}
+@keyframes ac-fade-in { from { opacity: 0; } }
+.ac-backdrop.pos-center { align-items: center; }
+.ac-backdrop[data-depth="2"] { z-index: 120; background: rgba(15, 18, 26, 0.32); }
+.ac-backdrop[data-depth="3"] { z-index: 140; background: rgba(15, 18, 26, 0.24); }
+
+.ac-modal {
+ position: relative; display: flex; flex-direction: column;
+ width: 100%; box-sizing: border-box; max-height: 100%;
+ background: var(--surface-0); color: var(--fg-1);
+ border: 1px solid var(--border-default); border-radius: var(--r-lg);
+ box-shadow: var(--shadow-xl);
+ animation: ac-modal-in var(--dur-base) var(--ease-spring);
+}
+@keyframes ac-modal-in { from { opacity: 0; transform: translateY(10px) scale(0.985); } }
+.ac-modal.sz-sm { max-width: 420px; }
+.ac-modal.sz-md { max-width: 620px; }
+.ac-modal.sz-lg { max-width: 840px; }
+.ac-modal.sz-xl { max-width: 1080px; }
+
+.ac-modal-head {
+ display: flex; align-items: flex-start; gap: var(--sp-3); flex-shrink: 0;
+ padding: var(--sp-4) var(--sp-5);
+ border-bottom: 1px solid var(--border-default);
+}
+.ac-modal-icon {
+ width: 36px; height: 36px; flex-shrink: 0; border-radius: var(--r-md);
+ display: inline-flex; align-items: center; justify-content: center;
+ background: var(--bg-accent-quiet); color: var(--fg-selected);
+}
+.ac-modal-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
+.ac-modal-eyebrow {
+ font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: var(--fw-medium);
+ letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--fg-hint);
+}
+.ac-modal-title { margin: 0; font-family: var(--font-sans); font-size: var(--fs-lg); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-snug); color: var(--fg-1); }
+.ac-modal-sub { font-size: var(--fs-sm); color: var(--fg-muted); line-height: var(--lh-base); }
+.ac-modal-x { flex-shrink: 0; margin: -2px -4px 0 0; display: flex; align-items: center; gap: var(--sp-1); }
+
+/* Body — scrolls inside a fixed-height dialog with head/foot pinned. The
+ shadows are painted by the scroll container itself (background-attachment
+ trick), so they appear only at an edge that actually has content beyond it. */
+.ac-modal-body {
+ flex: 1; min-height: 0; overflow-y: auto;
+ /* The body is a query container: a sz-sm dialog is 420px wide, so its body is ~372px at ANY
+ viewport, and a component that reads the viewport lays out for 1440px inside it. Measured
+ there before this existed: the statement grid kept its 200px label column and left the value
+ 108px. Declared on the body rather than on .ac-modal so the head and foot - which are pinned,
+ not scrolled, and size to the dialog - are outside the containment. */
+ container-type: inline-size;
+ padding: var(--sp-5);
+ background:
+ linear-gradient(var(--surface-0) 30%, rgba(255,255,255,0)) top / 100% 14px no-repeat,
+ linear-gradient(rgba(255,255,255,0), var(--surface-0) 70%) bottom / 100% 14px no-repeat,
+ radial-gradient(farthest-side at 50% 0, rgba(15,18,26,0.10), rgba(0,0,0,0)) top / 100% 7px no-repeat,
+ radial-gradient(farthest-side at 50% 100%, rgba(15,18,26,0.10), rgba(0,0,0,0)) bottom / 100% 7px no-repeat;
+ background-attachment: local, local, scroll, scroll;
+}
+/* A flush body is a LAYOUT container, not just an unpadded one: its children
+ are pinned/scrolling regions (a search field that must not scroll away, a
+ results view that owns its own scroll box, a toolbar + list). Those recipes
+ are all written with `flex-shrink: 0` / `flex: 1` / `min-height: 0`, which are
+ inert in a block container — so the body scrolled as one piece and the pinned
+ children scrolled away with it. Declaring the column here fixes every flush
+ consumer at once. */
+.ac-modal-body.is-flush { padding: 0; display: flex; flex-direction: column; }
+/* Whole-dialog scroll instead of body scroll. */
+.ac-modal.is-pagescroll { max-height: none; }
+.ac-modal.is-pagescroll .ac-modal-body { overflow: visible; background: none; }
+
+.ac-modal-foot {
+ display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0; flex-wrap: wrap;
+ padding: var(--sp-4) var(--sp-5);
+ border-top: 1px solid var(--border-default);
+ background: var(--surface-1);
+ border-radius: 0 0 var(--r-lg) var(--r-lg);
+}
+.ac-modal-foot > .ac-modal-foot-end { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }
diff --git a/src/main/webapp/static/com/atomgraph/client/css/surfaces.css b/src/main/webapp/static/com/atomgraph/client/css/surfaces.css
new file mode 100644
index 00000000..c15dab40
--- /dev/null
+++ b/src/main/webapp/static/com/atomgraph/client/css/surfaces.css
@@ -0,0 +1,227 @@
+/* =========================================================================
+ ui_kits/core/surfaces.css — Card · DataTable · Avatar · Drawer · Stepper
+
+ These were the last five primitives the app kit had to invent for itself.
+ The table is the reason this file exists: four near-identical grid-per-row
+ implementations (.ldh-data-table, .ldh-mini-table, .ldh-map-table,
+ .ldh-run-list) differing only in column tracks and a couple of cell tints.
+ ========================================================================= */
+
+/* =========================================================================
+ Card — a bordered surface with optional header / body / footer.
+ `interactive` makes the whole surface a link or button target.
+ ========================================================================= */
+.ac-card {
+ display: flex; flex-direction: column; min-width: 0;
+ /* A card is a query container for its contents. A card in a sidebar, a grid cell or a modal is
+ narrow while the viewport is wide, and what it holds has to lay out for the card. */
+ container-type: inline-size;
+ background: var(--bg-card);
+ border: 1px solid var(--border-default);
+ border-radius: var(--r-lg);
+ text-decoration: none; color: inherit;
+}
+.ac-card.ap-elevated { border-color: transparent; box-shadow: var(--shadow-md); }
+.ac-card.ap-ghost { border-color: transparent; background: transparent; }
+.ac-card.sz-sm { border-radius: var(--r-md); }
+.ac-card.is-interactive {
+ cursor: pointer;
+ transition: border-color var(--dur-fast) var(--ease-out-soft), box-shadow var(--dur-fast) var(--ease-out-soft);
+}
+.ac-card.is-interactive:hover { border-color: var(--ldh-blue-300); box-shadow: var(--shadow-sm); text-decoration: none; }
+.ac-card.is-interactive:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
+.ac-card.is-selected { border-color: var(--bg-accent); box-shadow: inset 0 0 0 1px var(--bg-accent); }
+.ac-card-head {
+ display: flex; align-items: center; gap: var(--sp-3);
+ padding: var(--sp-4) var(--sp-4) 0;
+}
+.ac-card-body { padding: var(--sp-4); min-width: 0; }
+.ac-card-foot {
+ display: flex; align-items: center; gap: var(--sp-2);
+ padding: var(--sp-3) var(--sp-4);
+ border-top: 1px solid var(--border-default);
+}
+/* Leading icon tile. `tone` picks a pastel surface — the app kit's category
+ cards had six of these hard-coded per class name. */
+.ac-card-ic {
+ width: 36px; height: 36px; flex-shrink: 0;
+ display: inline-flex; align-items: center; justify-content: center;
+ border-radius: var(--r-sm);
+ background: var(--surface-2); color: var(--fg-muted);
+}
+.ac-card-ic.tn-lavender { background: var(--surf-lavender); color: var(--ldh-violet-600); }
+.ac-card-ic.tn-mint { background: var(--surf-mint); color: var(--success-500); }
+.ac-card-ic.tn-peach { background: var(--surf-peach); color: #c25c00; }
+.ac-card-ic.tn-sky { background: var(--surf-sky); color: var(--ldh-blue-600); }
+.ac-card-ic.tn-blush { background: var(--surf-blush); color: #b03060; }
+.ac-card-ic.tn-sand { background: var(--surf-sand); color: #7a5b0c; }
+.ac-card-titles { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
+.ac-card-title { font-weight: var(--fw-medium); color: var(--fg-1); font-size: var(--fs-sm); }
+.ac-card-meta { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--fg-hint); }
+
+/* =========================================================================
+ DataTable — ONE tabular surface, and it IS the element.
+
+ The base dress is on the element, not on a class: a already says it is
+ a table, so a class restating that is one more thing an author can forget, and
+ one more way the same markup renders differently in two places. The .ac-table
+ class survives as the hook for what a table cannot say about itself — density,
+ ap-plain, is-hoverable, and the behaviour the platform layers on top (sortable
+ headers, sticky head, per-cell value scroll). Cell decorations stay scoped
+ under table: .num and .mono are far too generic to own globally.
+
+ Real markup laid out BY THE TABLE ALGORITHM. Ask for a table and you
+ get table behaviour: columns negotiate their widths across every row, the
+ implicit roles hold so no component re-declares them, and rowspan/colspan
+ work. Column widths are a , which is the native mechanism for
+ exactly this and is what --ac-cols was standing in for. The four bespoke
+ tables this replaced differed by widths, not by structure, so the collapse
+ into one component still holds — the widths simply live where the platform
+ keeps them.
+
+ This file previously set display: block on the table and display: grid on
+ every tr. Per-row grids are independent formatting contexts, so columns could
+ not share intrinsic sizes: measured at 11 columns the head and body stopped
+ lining up, and equal 1fr tracks shredded a UUID column into four lines. Two
+ consumers left the component over it rather than pay the cost.
+ ========================================================================= */
+table {
+ width: 100%;
+ border-collapse: collapse; border-spacing: 0; text-indent: 0;
+ background: var(--surface-0);
+ border: 1px solid var(--border-default);
+ border-radius: var(--r-md);
+}
+table.ap-plain { border: 0; border-radius: 0; background: transparent; }
+caption { caption-side: top; }
+/* border-radius does not clip the corner cells of a border-collapse table, so the corner cells
+ round themselves. overflow: hidden is not the fix and would cost: it makes the table its own
+ scrollport, which leaves a position: sticky header inert — and a result set pinned under a
+ toolbar is exactly where that matters. */
+table > thead > tr:first-child > *:first-child { border-top-left-radius: var(--r-md); }
+table > thead > tr:first-child > *:last-child { border-top-right-radius: var(--r-md); }
+table.ap-plain > thead > tr:first-child > * { border-radius: 0; }
+/* Density is CELL padding now: under table layout a tr is not a box that takes
+ padding, so the row-level rule it used to carry was inert the moment the grid
+ came off. */
+th, td {
+ padding: var(--sp-2) var(--sp-3);
+ vertical-align: middle;
+ font-weight: inherit; text-align: left;
+}
+table.dn-comfy th, table.dn-comfy td { padding: var(--sp-3); }
+table.dn-tight th, table.dn-tight td { padding: 5px var(--sp-3); }
+thead tr {
+ background: var(--surface-2);
+ border-bottom: 1px solid var(--border-default);
+ font-family: var(--font-mono); font-size: 10px;
+ letter-spacing: var(--tracking-wide); text-transform: uppercase;
+ color: var(--fg-hint);
+}
+tbody tr {
+ border-bottom: 1px solid var(--border-default);
+ font-size: var(--fs-sm); color: var(--fg-2);
+}
+tbody tr:last-child { border-bottom: 0; }
+table.is-hoverable tbody tr:hover { background: var(--surface-1); }
+/* A th in the body heads its ROW, not a column: it names the row's subject, so it
+ reads at body weight rather than borrowing the head band's mono caps. */
+tbody th { font-weight: var(--fw-medium); color: var(--fg-1); }
+/* A body th spanning the row is a group heading over the rows beneath it. It takes
+ the recessed-well fill rather than the page fill: against a --surface-0 table the
+ latter is all but invisible, and a band that cannot be seen is not a heading. Same
+ fill as the head band, which does not collide — that one is mono, uppercase and
+ --fg-hint, so the two read as different registers. */
+tbody th[colspan] { background: var(--surface-2); color: var(--fg-2); }
+/* Successive tbodies are row groups; the seam between two of them is the group's
+ rule, which the per-row border cannot draw because the last row of a group
+ suppresses its own. */
+tbody + tbody > tr:first-child > * { border-top: 1px solid var(--border-default); }
+/* Cell decorations, shared by every table rather than redefined per variant. */
+table .num { text-align: right; font-variant-numeric: tabular-nums; }
+th.num { text-align: right; }
+table .muted { color: var(--fg-muted); }
+table .mono { font-family: var(--font-mono); font-size: var(--fs-xs); }
+table .iri {
+ font-family: var(--font-mono); font-size: var(--fs-xs);
+ color: var(--ldh-blue-700); text-decoration: none;
+}
+table .iri:hover { text-decoration: underline; }
+/* A SPARQL variable name in a result-set header. */
+table .var {
+ font-family: var(--font-mono); font-size: var(--fs-xs);
+ color: var(--ldh-violet-700); font-weight: var(--fw-medium);
+}
+
+/* =========================================================================
+ Avatar — initials, image or fallback glyph.
+ A solid accent disc: it sits on the header bar, which is dark under m3 and
+ light under base44, and --bg-accent / --fg-on-accent is the one pair legible
+ on both without a per-skin patch.
+ ========================================================================= */
+.ac-avatar {
+ display: inline-flex; align-items: center; justify-content: center;
+ flex-shrink: 0; padding: 0; overflow: hidden;
+ border: 0; border-radius: 50%;
+ background: var(--bg-accent); color: var(--fg-on-accent);
+ font-family: var(--font-sans); font-weight: var(--fw-semibold);
+ letter-spacing: 0.02em; line-height: 1;
+}
+.ac-avatar.sz-xs { width: 22px; height: 22px; font-size: 9px; }
+.ac-avatar.sz-sm { width: 26px; height: 26px; font-size: 10px; }
+.ac-avatar.sz-md { width: 32px; height: 32px; font-size: var(--fs-xs); }
+.ac-avatar.sz-lg { width: 44px; height: 44px; font-size: var(--fs-base); }
+.ac-avatar.sz-xl { width: 64px; height: 64px; font-size: var(--fs-lg); }
+.ac-avatar > img { width: 100%; height: 100%; object-fit: cover; }
+.ac-avatar.is-button { cursor: pointer; transition: filter var(--dur-fast) var(--ease-out-soft), box-shadow var(--dur-fast) var(--ease-out-soft); }
+.ac-avatar.is-button:hover { filter: brightness(1.08); }
+.ac-avatar.is-button:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
+.ac-avatar.is-open { box-shadow: 0 0 0 2px var(--surface-0), 0 0 0 4px var(--bg-accent); }
+
+/* =========================================================================
+ Drawer — an edge-anchored panel. Square, hairline-bordered, quiet: it is
+ anchored to the viewport edge, not floating, so it takes no radius.
+ ========================================================================= */
+.ac-drawer {
+ position: fixed; top: 0; bottom: 0; z-index: 45;
+ display: flex; flex-direction: column;
+ width: min(360px, 92vw);
+ background: var(--surface-0); color: var(--fg-1);
+ box-shadow: -8px 0 24px -22px rgba(15, 23, 42, 0.16);
+ overflow: hidden;
+}
+.ac-drawer.sd-right { right: 0; border-left: 1px solid var(--border-default); animation: ac-drawer-r var(--dur-base) var(--ease-out-soft); }
+.ac-drawer.sd-left { left: 0; border-right: 1px solid var(--border-default); animation: ac-drawer-l var(--dur-base) var(--ease-out-soft); }
+@keyframes ac-drawer-r { from { transform: translateX(12px); opacity: 0; } }
+@keyframes ac-drawer-l { from { transform: translateX(-12px); opacity: 0; } }
+.ac-drawer.sz-sm { width: min(280px, 92vw); }
+.ac-drawer.sz-lg { width: min(480px, 96vw); }
+.ac-drawer-head {
+ display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0;
+ padding: var(--sp-3) var(--sp-4);
+ border-bottom: 1px solid var(--border-default);
+}
+.ac-drawer-title { flex: 1; min-width: 0; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--fg-1); }
+.ac-drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: var(--sp-3); }
+.ac-drawer-foot {
+ flex-shrink: 0; padding: var(--sp-3) var(--sp-4);
+ border-top: 1px solid var(--border-default);
+}
+
+/* =========================================================================
+ Stepper — numbered steps for a multi-part flow.
+ ========================================================================= */
+.ac-stepper { display: flex; flex-direction: column; gap: var(--sp-5); }
+.ac-step-head { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4); }
+.ac-step-n {
+ width: 24px; height: 24px; flex-shrink: 0;
+ display: inline-flex; align-items: center; justify-content: center;
+ border-radius: var(--r-pill);
+ background: var(--bg-accent); color: var(--fg-on-accent);
+ font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: var(--fw-bold);
+}
+.ac-step-n.is-done { background: var(--success-500); color: #fff; }
+.ac-step-n.is-todo { background: var(--surface-3); color: var(--fg-muted); }
+.ac-step-n.is-error { background: var(--danger-500); color: #fff; }
+.ac-step-title { margin: 0; font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--fg-1); }
+.ac-step-hint { font-size: var(--fs-sm); color: var(--fg-muted); }
diff --git a/src/main/webapp/static/com/atomgraph/client/js/UUID.js b/src/main/webapp/static/com/atomgraph/client/js/UUID.js
deleted file mode 100644
index 49e2bd69..00000000
--- a/src/main/webapp/static/com/atomgraph/client/js/UUID.js
+++ /dev/null
@@ -1,8 +0,0 @@
-function generateUUID()
-{
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c)
- {
- var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
- return v.toString(16);
- });
-}
\ No newline at end of file
diff --git a/src/main/webapp/static/com/atomgraph/client/js/client.js b/src/main/webapp/static/com/atomgraph/client/js/client.js
new file mode 100644
index 00000000..ac6b4d12
--- /dev/null
+++ b/src/main/webapp/static/com/atomgraph/client/js/client.js
@@ -0,0 +1,49 @@
+/* Browser glue for the stylesheets' markup: statement add/remove in edit forms,
+ delete confirmation, and URI-form normalization. Dependency-free. */
+
+document.addEventListener("submit", function(event)
+{
+ var form = event.target.closest(".uri-form");
+ if (form === null) return;
+
+ // a URI pasted into a label-typeahead field navigates directly instead of searching
+ var labelInput = form.querySelector("input[name=label]");
+ if (labelInput !== null && /^https?:\/\//.test(labelInput.value))
+ {
+ form.setAttribute("action", "");
+ labelInput.setAttribute("name", "uri");
+ }
+});
+
+document.addEventListener("click", function(event)
+{
+ var deleteBtn = event.target.closest(".btn-delete");
+ if (deleteBtn !== null)
+ {
+ if (!confirm(deleteBtn.dataset.confirm || "Are you sure?")) event.preventDefault();
+ return;
+ }
+
+ var removeBtn = event.target.closest(".btn-remove-property");
+ if (removeBtn !== null)
+ {
+ removeBtn.closest(".statement").remove();
+ return;
+ }
+
+ var addBtn = event.target.closest(".btn-add");
+ if (addBtn !== null)
+ {
+ var statement = addBtn.closest(".statement");
+ var clone = statement.cloneNode(true);
+ var uuid = "uuid" + crypto.randomUUID();
+ clone.querySelectorAll("input[name=ou], input[name=ob], input[name=ol]").forEach(function(input)
+ {
+ input.id = uuid;
+ input.value = "";
+ });
+ var label = clone.querySelector("label");
+ if (label !== null) label.setAttribute("for", uuid);
+ statement.after(clone);
+ }
+});
diff --git a/src/main/webapp/static/com/atomgraph/client/js/google-maps.js b/src/main/webapp/static/com/atomgraph/client/js/google-maps.js
deleted file mode 100644
index c4128872..00000000
--- a/src/main/webapp/static/com/atomgraph/client/js/google-maps.js
+++ /dev/null
@@ -1,13 +0,0 @@
-var map; // global variable; needs to be accessible later
-
-function initialize()
-{
- var mapOptions =
- {
- center: new google.maps.LatLng(0, 0),
- zoom: 1
- };
- map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
-}
-
-google.maps.event.addDomListener(window, 'load', initialize);
\ No newline at end of file
diff --git a/src/main/webapp/static/com/atomgraph/client/js/jquery.js b/src/main/webapp/static/com/atomgraph/client/js/jquery.js
deleted file mode 100644
index 88672953..00000000
--- a/src/main/webapp/static/com/atomgraph/client/js/jquery.js
+++ /dev/null
@@ -1,52 +0,0 @@
-var onRemoveButtonClick = function()
-{
- return $(this).parent().parent().parent().remove();
-};
-
-var onDropdownClick = function()
-{
- $(this).toggleClass("open");
-
- return true;
-};
-
-$(document).ready(function()
-{
-
- $(".navbar-form").on("submit", function()
- {
- var labelInput = $(this).find("input[name=label]");
- if (labelInput.length) // check whether label input exists
- {
- var uriOrLabel = labelInput.val();
- if (uriOrLabel.indexOf("http://") === 0 || uriOrLabel.indexOf("https://") === 0)
- {
- $(this).attr("action", "");
- $(this).find("input[name=label]").attr("name", "uri");
- }
- }
-
- return true;
- });
-
- $(".btn-delete").on("click", function() // prompt on DELETE
- {
- return confirm('Are you sure?');
- });
-
- $(".btn-remove-property").on("click", onRemoveButtonClick);
-
- $(".btn-group:has(.btn.dropdown-toggle)").on("click", onDropdownClick);
-
- $(".btn-add").on("click", function()
- {
- var clone = $(this).parent().parent().clone(true, true);
- var uuid = "uuid" + generateUUID();
- var input = clone.find("input[name='ou'],input[name='ob'],input[name='ol']");
- input.attr("id", uuid);
- input.val("");
- clone.find("label").attr("for", uuid);
- return $(this).parent().parent().after(clone);
- });
-
-});
\ No newline at end of file
diff --git a/src/main/webapp/static/com/atomgraph/client/js/ol.js b/src/main/webapp/static/com/atomgraph/client/js/ol.js
new file mode 100644
index 00000000..f136f557
--- /dev/null
+++ b/src/main/webapp/static/com/atomgraph/client/js/ol.js
@@ -0,0 +1,3 @@
+/*! For license information please see ol.js.LICENSE.txt */
+!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ol=e():t.ol=e()}(self,(function(){return function(){var t,e={187:function(t){"use strict";function e(t,e,r){r=r||2;var o,h,a,c,f,p,m,v=e&&e.length,g=v?e[0]*r:t.length,y=i(t,0,g,r,!0),w=[];if(!y||y.next===y.prev)return w;if(v&&(y=function(t,e,s,r){var o,h,a,c=[];for(o=0,h=e.length;o80*r){o=a=t[0],h=c=t[1];for(var x=r;xa&&(a=f),p>c&&(c=p);m=0!==(m=Math.max(a-o,c-h))?1/m:0}return s(y,w,r,o,h,m),w}function i(t,e,i,n,s){var r,o;if(s===E(t,e,i,n)>0)for(r=e;r=e;r-=n)o=S(r,t[r],t[r+1],o);return o&&g(o,o.next)&&(P(o),o=o.next),o}function n(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!g(n,n.next)&&0!==v(n.prev,n,n.next))n=n.next;else{if(P(n),(n=e=n.prev)===n.next)break;i=!0}}while(i||n!==e);return e}function s(t,e,i,u,l,c,d){if(t){!d&&c&&function(t,e,i,n){var s=t;do{null===s.z&&(s.z=f(s.x,s.y,e,i,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next}while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,function(t){var e,i,n,s,r,o,h,a,u=1;do{for(i=t,t=null,r=null,o=0;i;){for(o++,n=i,h=0,e=0;e0||a>0&&n;)0!==h&&(0===a||!n||i.z<=n.z)?(s=i,i=i.nextZ,h--):(s=n,n=n.nextZ,a--),r?r.nextZ=s:t=s,s.prevZ=r,r=s;i=n}r.nextZ=null,u*=2}while(o>1)}(s)}(t,u,l,c);for(var p,m,v=t;t.prev!==t.next;)if(p=t.prev,m=t.next,c?o(t,u,l,c):r(t))e.push(p.i/i),e.push(t.i/i),e.push(m.i/i),P(t),t=m.next,v=m.next;else if((t=m)===v){d?1===d?s(t=h(n(t),e,i),e,i,u,l,c,2):2===d&&a(t,e,i,u,l,c):s(n(t),e,i,u,l,c,1);break}}}function r(t){var e=t.prev,i=t,n=t.next;if(v(e,i,n)>=0)return!1;for(var s=t.next.next;s!==t.prev;){if(p(e.x,e.y,i.x,i.y,n.x,n.y,s.x,s.y)&&v(s.prev,s,s.next)>=0)return!1;s=s.next}return!0}function o(t,e,i,n){var s=t.prev,r=t,o=t.next;if(v(s,r,o)>=0)return!1;for(var h=s.xr.x?s.x>o.x?s.x:o.x:r.x>o.x?r.x:o.x,l=s.y>r.y?s.y>o.y?s.y:o.y:r.y>o.y?r.y:o.y,c=f(h,a,e,i,n),d=f(u,l,e,i,n),m=t.prevZ,g=t.nextZ;m&&m.z>=c&&g&&g.z<=d;){if(m!==t.prev&&m!==t.next&&p(s.x,s.y,r.x,r.y,o.x,o.y,m.x,m.y)&&v(m.prev,m,m.next)>=0)return!1;if(m=m.prevZ,g!==t.prev&&g!==t.next&&p(s.x,s.y,r.x,r.y,o.x,o.y,g.x,g.y)&&v(g.prev,g,g.next)>=0)return!1;g=g.nextZ}for(;m&&m.z>=c;){if(m!==t.prev&&m!==t.next&&p(s.x,s.y,r.x,r.y,o.x,o.y,m.x,m.y)&&v(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;g&&g.z<=d;){if(g!==t.prev&&g!==t.next&&p(s.x,s.y,r.x,r.y,o.x,o.y,g.x,g.y)&&v(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function h(t,e,i){var s=t;do{var r=s.prev,o=s.next.next;!g(r,o)&&y(r,s,s.next,o)&&b(r,o)&&b(o,r)&&(e.push(r.i/i),e.push(s.i/i),e.push(o.i/i),P(s),P(s.next),s=t=o),s=s.next}while(s!==t);return n(s)}function a(t,e,i,r,o,h){var a=t;do{for(var u=a.next.next;u!==a.prev;){if(a.i!==u.i&&m(a,u)){var l=M(a,u);return a=n(a,a.next),l=n(l,l.next),s(a,e,i,r,o,h),void s(l,e,i,r,o,h)}u=u.next}a=a.next}while(a!==t)}function u(t,e){return t.x-e.x}function l(t,e){var i=function(t,e){var i,n=e,s=t.x,r=t.y,o=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){var h=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(h<=s&&h>o){if(o=h,h===s){if(r===n.y)return n;if(r===n.next.y)return n.next}i=n.x=n.x&&n.x>=l&&s!==n.x&&p(ri.x||n.x===i.x&&c(i,n)))&&(i=n,d=a)),n=n.next}while(n!==u);return i}(t,e);if(!i)return e;var s=M(i,t),r=n(i,i.next);return n(s,s.next),e===i?r:e}function c(t,e){return v(t.prev,t,e.prev)<0&&v(e.next,t,t.next)<0}function f(t,e,i,n,s){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*s)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*s)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function d(t){var e=t,i=t;do{(e.x=0&&(t-o)*(n-h)-(i-o)*(e-h)>=0&&(i-o)*(r-h)-(s-o)*(n-h)>=0}function m(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&y(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(b(t,e)&&b(e,t)&&function(t,e){var i=t,n=!1,s=(t.x+e.x)/2,r=(t.y+e.y)/2;do{i.y>r!=i.next.y>r&&i.next.y!==i.y&&s<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(v(t.prev,t,e.prev)||v(t,e.prev,e))||g(t,e)&&v(t.prev,t,t.next)>0&&v(e.prev,e,e.next)>0)}function v(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function g(t,e){return t.x===e.x&&t.y===e.y}function y(t,e,i,n){var s=x(v(t,e,i)),r=x(v(t,e,n)),o=x(v(i,n,t)),h=x(v(i,n,e));return s!==r&&o!==h||(!(0!==s||!w(t,i,e))||(!(0!==r||!w(t,n,e))||(!(0!==o||!w(i,t,n))||!(0!==h||!w(i,e,n)))))}function w(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function x(t){return t>0?1:t<0?-1:0}function b(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 M(t,e){var i=new _(t.i,t.x,t.y),n=new _(e.i,e.x,e.y),s=t.next,r=e.prev;return t.next=e,e.prev=t,i.next=s,s.prev=i,n.next=i,i.prev=n,r.next=n,n.prev=r,n}function S(t,e,i,n){var s=new _(t,e,i);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function P(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 _(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function E(t,e,i,n){for(var s=0,r=e,o=i-n;r0&&(n+=t[s-1].length,i.holes.push(n))}return i}},645:function(t,e){e.read=function(t,e,i,n,s){var r,o,h=8*s-n-1,a=(1<>1,l=-7,c=i?s-1:0,f=i?-1:1,d=t[e+c];for(c+=f,r=d&(1<<-l)-1,d>>=-l,l+=h;l>0;r=256*r+t[e+c],c+=f,l-=8);for(o=r&(1<<-l)-1,r>>=-l,l+=n;l>0;o=256*o+t[e+c],c+=f,l-=8);if(0===r)r=1-u;else{if(r===a)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),r-=u}return(d?-1:1)*o*Math.pow(2,r-n)},e.write=function(t,e,i,n,s,r){var o,h,a,u=8*r-s-1,l=(1<>1,f=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:r-1,p=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(h=isNaN(e)?1:0,o=l):(o=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-o))<1&&(o--,a*=2),(e+=o+c>=1?f/a:f*Math.pow(2,1-c))*a>=2&&(o++,a/=2),o+c>=l?(h=0,o=l):o+c>=1?(h=(e*a-1)*Math.pow(2,s),o+=c):(h=e*Math.pow(2,c-1)*Math.pow(2,s),o=0));s>=8;t[i+d]=255&h,d+=p,h/=256,s-=8);for(o=o<0;t[i+d]=255&o,d+=p,o/=256,u-=8);t[i+d-p]|=128*m}},593:function(t,e,i){"use strict";const n=i(411),s=Symbol("max"),r=Symbol("length"),o=Symbol("lengthCalculator"),h=Symbol("allowStale"),a=Symbol("maxAge"),u=Symbol("dispose"),l=Symbol("noDisposeOnSet"),c=Symbol("lruList"),f=Symbol("cache"),d=Symbol("updateAgeOnGet"),p=()=>1;const m=(t,e,i)=>{const n=t[f].get(e);if(n){const e=n.value;if(v(t,e)){if(y(t,n),!t[h])return}else i&&(t[d]&&(n.value.now=Date.now()),t[c].unshiftNode(n));return e.value}},v=(t,e)=>{if(!e||!e.maxAge&&!t[a])return!1;const i=Date.now()-e.now;return e.maxAge?i>e.maxAge:t[a]&&i>t[a]},g=t=>{if(t[r]>t[s])for(let e=t[c].tail;t[r]>t[s]&&null!==e;){const i=e.prev;y(t,e),e=i}},y=(t,e)=>{if(e){const i=e.value;t[u]&&t[u](i.key,i.value),t[r]-=i.length,t[f].delete(i.key),t[c].removeNode(e)}};class w{constructor(t,e,i,n,s){this.key=t,this.value=e,this.length=i,this.now=n,this.maxAge=s||0}}const x=(t,e,i,n)=>{let s=i.value;v(t,s)&&(y(t,i),t[h]||(s=void 0)),s&&e.call(n,s.value,s.key,t)};t.exports=class{constructor(t){if("number"==typeof t&&(t={max:t}),t||(t={}),t.max&&("number"!=typeof t.max||t.max<0))throw new TypeError("max must be a non-negative number");this[s]=t.max||1/0;const e=t.length||p;if(this[o]="function"!=typeof e?p:e,this[h]=t.stale||!1,t.maxAge&&"number"!=typeof t.maxAge)throw new TypeError("maxAge must be a number");this[a]=t.maxAge||0,this[u]=t.dispose,this[l]=t.noDisposeOnSet||!1,this[d]=t.updateAgeOnGet||!1,this.reset()}set max(t){if("number"!=typeof t||t<0)throw new TypeError("max must be a non-negative number");this[s]=t||1/0,g(this)}get max(){return this[s]}set allowStale(t){this[h]=!!t}get allowStale(){return this[h]}set maxAge(t){if("number"!=typeof t)throw new TypeError("maxAge must be a non-negative number");this[a]=t,g(this)}get maxAge(){return this[a]}set lengthCalculator(t){"function"!=typeof t&&(t=p),t!==this[o]&&(this[o]=t,this[r]=0,this[c].forEach((t=>{t.length=this[o](t.value,t.key),this[r]+=t.length}))),g(this)}get lengthCalculator(){return this[o]}get length(){return this[r]}get itemCount(){return this[c].length}rforEach(t,e){e=e||this;for(let i=this[c].tail;null!==i;){const n=i.prev;x(this,t,i,e),i=n}}forEach(t,e){e=e||this;for(let i=this[c].head;null!==i;){const n=i.next;x(this,t,i,e),i=n}}keys(){return this[c].toArray().map((t=>t.key))}values(){return this[c].toArray().map((t=>t.value))}reset(){this[u]&&this[c]&&this[c].length&&this[c].forEach((t=>this[u](t.key,t.value))),this[f]=new Map,this[c]=new n,this[r]=0}dump(){return this[c].map((t=>!v(this,t)&&{k:t.key,v:t.value,e:t.now+(t.maxAge||0)})).toArray().filter((t=>t))}dumpLru(){return this[c]}set(t,e,i){if((i=i||this[a])&&"number"!=typeof i)throw new TypeError("maxAge must be a number");const n=i?Date.now():0,h=this[o](e,t);if(this[f].has(t)){if(h>this[s])return y(this,this[f].get(t)),!1;const o=this[f].get(t).value;return this[u]&&(this[l]||this[u](t,o.value)),o.now=n,o.maxAge=i,o.value=e,this[r]+=h-o.length,o.length=h,this.get(t),g(this),!0}const d=new w(t,e,h,n,i);return d.length>this[s]?(this[u]&&this[u](t,e),!1):(this[r]+=d.length,this[c].unshift(d),this[f].set(t,this[c].head),g(this),!0)}has(t){if(!this[f].has(t))return!1;const e=this[f].get(t).value;return!v(this,e)}get(t){return m(this,t,!0)}peek(t){return m(this,t,!1)}pop(){const t=this[c].tail;return t?(y(this,t),t.value):null}del(t){y(this,this[f].get(t))}load(t){this.reset();const e=Date.now();for(let i=t.length-1;i>=0;i--){const n=t[i],s=n.e||0;if(0===s)this.set(n.k,n.v);else{const t=s-e;t>0&&this.set(n.k,n.v,t)}}}prune(){this[f].forEach(((t,e)=>m(this,e,!1)))}}},614:function(t,e,i){"use strict";t.exports=s;var n=i(645);function s(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}s.Varint=0,s.Fixed64=1,s.Bytes=2,s.Fixed32=5;var r=4294967296,o=1/r,h="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function a(t){return t.type===s.Bytes?t.readVarint()+t.pos:t.pos+1}function u(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function l(t,e,i){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(var s=i.pos-1;s>=t;s--)i.buf[s+n]=i.buf[s]}function c(t,e){for(var i=0;i>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function M(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}s.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos>3,r=this.pos;this.type=7&n,t(s,e,this),this.pos===r&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=x(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=M(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=x(this.buf,this.pos)+x(this.buf,this.pos+4)*r;return this.pos+=8,t},readSFixed64:function(){var t=x(this.buf,this.pos)+M(this.buf,this.pos+4)*r;return this.pos+=8,t},readFloat:function(){var t=n.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=n.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,n=this.buf;return e=127&(i=n[this.pos++]),i<128?e:(e|=(127&(i=n[this.pos++]))<<7,i<128?e:(e|=(127&(i=n[this.pos++]))<<14,i<128?e:(e|=(127&(i=n[this.pos++]))<<21,i<128?e:function(t,e,i){var n,s,r=i.buf;if(s=r[i.pos++],n=(112&s)>>4,s<128)return u(t,n,e);if(s=r[i.pos++],n|=(127&s)<<3,s<128)return u(t,n,e);if(s=r[i.pos++],n|=(127&s)<<10,s<128)return u(t,n,e);if(s=r[i.pos++],n|=(127&s)<<17,s<128)return u(t,n,e);if(s=r[i.pos++],n|=(127&s)<<24,s<128)return u(t,n,e);if(s=r[i.pos++],n|=(1&s)<<31,s<128)return u(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&h?function(t,e,i){return h.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){var n="",s=e;for(;s239?4:a>223?3:a>191?2:1;if(s+l>i)break;1===l?a<128&&(u=a):2===l?128==(192&(r=t[s+1]))&&(u=(31&a)<<6|63&r)<=127&&(u=null):3===l?(r=t[s+1],o=t[s+2],128==(192&r)&&128==(192&o)&&((u=(15&a)<<12|(63&r)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===l&&(r=t[s+1],o=t[s+2],h=t[s+3],128==(192&r)&&128==(192&o)&&128==(192&h)&&((u=(15&a)<<18|(63&r)<<12|(63&o)<<6|63&h)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,l=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),s+=l}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==s.Bytes)return t.push(this.readVarint(e));var i=a(this);for(t=t||[];this.pos127;);else if(e===s.Bytes)this.pos=this.readVarint()+this.pos;else if(e===s.Fixed32)this.pos+=4;else{if(e!==s.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var i,n;t>=0?(i=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,n=n+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,e),function(t,e){var i=(7&t)<<4;if(e.buf[e.pos++]|=i|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,i){for(var n,s,r=0;r55295&&n<57344){if(!s){n>56319||r+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):s=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,s=n;continue}n=s-55296<<10|n-56320|65536,s=null}else s&&(t[i++]=239,t[i++]=191,t[i++]=189,s=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&l(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),n.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),n.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i=128&&l(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,s.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,c,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,f,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,m,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,d,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,p,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,v,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,g,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,y,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,w,e)},writeBytesField:function(t,e){this.writeTag(t,s.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,s.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,s.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,s.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,s.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,s.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,s.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,s.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,s.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,s.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}},582:function(t){t.exports=function(){"use strict";function t(t,n,s,r,o){!function t(i,n,s,r,o){for(;r>s;){if(r-s>600){var h=r-s+1,a=n-s+1,u=Math.log(h),l=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*l*(h-l)/h)*(a-h/2<0?-1:1);t(i,n,Math.max(s,Math.floor(n-a*l/h+c)),Math.min(r,Math.floor(n+(h-a)*l/h+c)),o)}var f=i[n],d=s,p=r;for(e(i,s,n),o(i[r],f)>0&&e(i,s,r);d0;)p--}0===o(i[s],f)?e(i,s,p):e(i,++p,r),p<=n&&(s=p+1),n<=p&&(r=p-1)}}(t,n,s||0,r||t.length-1,o||i)}function e(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function i(t,e){return te?1:0}var n=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function s(t,e,i){if(!i)return e.indexOf(t);for(var n=0;n=t.minX&&e.maxY>=t.minY}function p(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function m(e,i,n,s,r){for(var o=[i,n];o.length;)if(!((n=o.pop())-(i=o.pop())<=s)){var h=i+Math.ceil((n-i)/s/2)*s;t(e,h,i,n,r),o.push(i,h,h,n)}}return n.prototype.all=function(){return this._all(this.data,[])},n.prototype.search=function(t){var e=this.data,i=[];if(!d(t,e))return i;for(var n=this.toBBox,s=[];e;){for(var r=0;r=0&&s[e].children.length>this._maxEntries;)this._split(s,e),e--;this._adjustParentBBoxes(n,s,e)},n.prototype._split=function(t,e){var i=t[e],n=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,n);var o=this._chooseSplitIndex(i,s,n),h=p(i.children.splice(o,i.children.length-o));h.height=i.height,h.leaf=i.leaf,r(i,this.toBBox),r(h,this.toBBox),e?t[e-1].children.push(h):this._splitRoot(i,h)},n.prototype._splitRoot=function(t,e){this.data=p([t,e]),this.data.height=t.height+1,this.data.leaf=!1,r(this.data,this.toBBox)},n.prototype._chooseSplitIndex=function(t,e,i){for(var n,s,r,h,a,u,c,f=1/0,d=1/0,p=e;p<=i-e;p++){var m=o(t,0,p,this.toBBox),v=o(t,p,i,this.toBBox),g=(s=m,r=v,h=void 0,a=void 0,u=void 0,c=void 0,h=Math.max(s.minX,r.minX),a=Math.max(s.minY,r.minY),u=Math.min(s.maxX,r.maxX),c=Math.min(s.maxY,r.maxY),Math.max(0,u-h)*Math.max(0,c-a)),y=l(m)+l(v);g=e;d--){var p=t.children[d];h(a,t.leaf?s(p):p),u+=c(a)}return u},n.prototype._adjustParentBBoxes=function(t,e,i){for(var n=i;n>=0;n--)h(e[n],t)},n.prototype._condense=function(t){for(var e=t.length-1,i=void 0;e>=0;e--)0===t[e].children.length?e>0?(i=t[e-1].children).splice(i.indexOf(t[e]),1):this.clear():r(t[e],this.toBBox)},n}()},635:function(t,e,i){const n=i(622);t.exports=function(t,e,i){const s=i&&i.debug||!1,r=i&&i.startIndex||0;s&&console.log("starting findTagByName with",e," and ",i);const o=n(t,`<${e}[ >]`,r);if(s&&console.log("start:",o),-1===o)return;const h=t.slice(o+e.length);let a=n(h,"[ /]"+e+">",0);const u=-1===a;u&&(a=n(h,"[ /]>",0));const l=o+e.length+a+1+(u?0:e.length)+1;if(s&&console.log("end:",l),-1===l)return;const c=t.slice(o,l);let f;return f=u?null:c.slice(c.indexOf(">")+1,c.lastIndexOf("<")),{inner:f,outer:c,start:o,end:l}}},602:function(t,e,i){const n=i(635);t.exports=function(t,e,i){const s=[],r=i&&i.debug||!1;let o,h=i&&i.startIndex||0;for(;o=n(t,e,{debug:r,startIndex:h});)h=o.end,s.push(o);return r&&console.log("findTagsByName found",s.length,"tags"),s}},330:function(t){t.exports=function(t,e,i){const n=i&&i.debug||!1;n&&console.log("getting "+e+" in "+t);const s="object"==typeof t?t.outer:t,r=`${e}\\="([^"]*)"`;n&&console.log("pattern:",r);const o=new RegExp(r).exec(s);if(n&&console.log("match:",o),o)return o[1]}},622:function(t){t.exports=function(t,e,i){const n=new RegExp(e).exec(t.slice(i));return n?i+n.index:-1}},371:function(t){"use strict";t.exports=function(t){t.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}},411:function(t,e,i){"use strict";function n(t){var e=this;if(e instanceof n||(e=new n),e.tail=null,e.head=null,e.length=0,t&&"function"==typeof t.forEach)t.forEach((function(t){e.push(t)}));else if(arguments.length>0)for(var i=0,s=arguments.length;i1)i=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");n=this.head.next,i=this.head.value}for(var s=0;null!==n;s++)i=t(i,n.value,s),n=n.next;return i},n.prototype.reduceReverse=function(t,e){var i,n=this.tail;if(arguments.length>1)i=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");n=this.tail.prev,i=this.tail.value}for(var s=this.length-1;null!==n;s--)i=t(i,n.value,s),n=n.prev;return i},n.prototype.toArray=function(){for(var t=new Array(this.length),e=0,i=this.head;null!==i;e++)t[e]=i.value,i=i.next;return t},n.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,i=this.tail;null!==i;e++)t[e]=i.value,i=i.prev;return t},n.prototype.slice=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var i=new n;if(ethis.length&&(e=this.length);for(var s=0,r=this.head;null!==r&&sthis.length&&(e=this.length);for(var s=this.length,r=this.tail;null!==r&&s>e;s--)r=r.prev;for(;null!==r&&s>t;s--,r=r.prev)i.push(r.value);return i},n.prototype.splice=function(t,e,...i){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var n=0,r=this.head;null!==r&&n>1),s=+i(t[n],e),s<0?r=n+1:(o=n,h=!s);return h?r:~r}function d(t,e){return t>e?1:t0){for(s=1;s0?s-1:s:t[s-1]-e0||i&&0===r)}))}function w(){return!0}function x(){return!1}function b(){}function M(t){let e,i,n,s=!1;return function(){const r=Array.prototype.slice.call(arguments);return s&&this===n&&g(r,i)||(s=!0,n=this,i=r,e=t.apply(this,arguments)),e}}function S(t){return function(){let e;try{e=t()}catch(t){return Promise.reject(t)}return e instanceof Promise?e:Promise.resolve(e)}()}function P(t){for(const e in t)delete t[e]}function _(t){let e;for(e in t)return!1;return!e}var E=class extends c{constructor(t){super(),this.t=t,this.S=null,this.P=null,this._=null}addEventListener(t,e){if(!t||!e)return;const i=this._||(this._={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e="string"==typeof t,i=e?t:t.type,n=this._&&this._[i];if(!n)return;const s=e?new u(t):t;s.target||(s.target=this.t||this);const r=this.P||(this.P={}),o=this.S||(this.S={});let h;i in r||(r[i]=0,o[i]=0),++r[i];for(let t=0,e=n.length;t0)}removeEventListener(t,e){const i=this._&&this._[t];if(i){const n=i.indexOf(e);-1!==n&&(this.S&&t in this.S?(i[n]=b,++this.S[t]):(i.splice(n,1),0===i.length&&delete this._[t]))}}},T="change",C="error",F="contextmenu",I="click",A="dblclick",k="dragenter",R="dragover",L="drop",N="keydown",O="keypress",z="load",G="resize",j="touchmove",D="wheel";function U(t,e,i,n,s){if(n&&n!==t&&(i=i.bind(n)),s){const n=i;i=function(){t.removeEventListener(e,i),n.apply(this,arguments)}}const r={target:t,type:e,listener:i};return t.addEventListener(e,i),r}function $(t,e,i,n){return U(t,e,i,n,!0)}function B(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),P(t))}class q extends E{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.T=0}changed(){++this.T,this.dispatchEvent(T)}getRevision(){return this.T}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let s=0;s0;)this.pop()}extend(t){for(let e=0,i=t.length;ethis.getLength())throw new Error("Index out of bounds: "+t);this.A&&this.O(e),this.R.splice(t,0,e),this.G(),this.dispatchEvent(new J(W,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.A&&this.O(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.R;for(let i=0,n=e.length;i=this.getLength())return;const e=this.R[t];return this.R.splice(t,1),this.G(),this.dispatchEvent(new J(H,e,t)),e}setAt(t,e){if(t>=this.getLength())return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.A&&this.O(e,t);const i=this.R[t];this.R[t]=e,this.dispatchEvent(new J(H,i,t)),this.dispatchEvent(new J(W,e,t))}G(){this.set(K,this.R.length)}O(t,e){for(let i=0,n=this.R.length;it)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){t()}getAlpha(t,e){if(!this.D)return 1;let i=this.U[t];if(i){if(-1===i)return 1}else i=e,this.U[t]=i;const n=e-i+1e3/60;return n>=this.D?1:rt(n/this.D)}inTransition(t){return!!this.D&&-1!==this.U[t]}endTransition(t){this.D&&(this.U[t]=-1)}};var lt=class extends ut{constructor(t){const e=tt;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.$=t.loader,this.B=null,this.q=null,this.V=t.size||[256,256]}getSize(){return this.V}getData(){return this.B}getError(){return this.q}load(){if(this.state!==tt&&this.state!==nt)return;this.state=et,this.changed();const t=this;this.$().then((function(e){t.B=e,t.state=it,t.changed()})).catch((function(e){t.q=e,t.state=nt,t.changed()}))}};function ct(t,e){if(!t)throw new h(e)}class ft extends V{constructor(t){if(super(),this.on,this.once,this.un,this.W=void 0,this.H="geometry",this.K=null,this.tt=void 0,this.et=null,this.addChangeListener(this.H,this.it),t)if("function"==typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new ft(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const i=this.getStyle();return i&&t.setStyle(i),t}getGeometry(){return this.get(this.H)}getId(){return this.W}getGeometryName(){return this.H}getStyle(){return this.K}getStyleFunction(){return this.tt}nt(){this.changed()}it(){this.et&&(B(this.et),this.et=null);const t=this.getGeometry();t&&(this.et=U(t,T,this.nt,this)),this.changed()}setGeometry(t){this.set(this.H,t)}setStyle(t){this.K=t,this.tt=t?dt(t):void 0,this.changed()}setId(t){this.W=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.H,this.it),this.H=t,this.addChangeListener(this.H,this.it),this.it()}}function dt(t){if("function"==typeof t)return t;{let e;if(Array.isArray(t))e=t;else{ct("function"==typeof t.getZIndex,41);e=[t]}return function(){return e}}}var pt=ft;const mt="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",vt=mt.includes("firefox"),gt=mt.includes("safari")&&!mt.includes("chrom"),yt=gt&&(mt.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(mt)),wt=mt.includes("webkit")&&!mt.includes("edge"),xt=mt.includes("macintosh"),bt="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,Mt="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,St="undefined"!=typeof Image&&Image.prototype.decode,Pt=function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch(t){}return t}(),_t=new Array(6);function Et(){return[1,0,0,1,0,0]}function Tt(t){return Ft(t,1,0,0,1,0,0)}function Ct(t,e){const i=t[0],n=t[1],s=t[2],r=t[3],o=t[4],h=t[5],a=e[0],u=e[1],l=e[2],c=e[3],f=e[4],d=e[5];return t[0]=i*a+s*u,t[1]=n*a+r*u,t[2]=i*l+s*c,t[3]=n*l+r*c,t[4]=i*f+s*d+o,t[5]=n*f+r*d+h,t}function Ft(t,e,i,n,s,r,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=s,t[4]=r,t[5]=o,t}function It(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function At(t,e){const i=e[0],n=e[1];return e[0]=t[0]*i+t[2]*n+t[4],e[1]=t[1]*i+t[3]*n+t[5],e}function kt(t,e){const i=Math.cos(e),n=Math.sin(e);return Ct(t,Ft(_t,i,n,-n,i,0,0))}function Rt(t,e,i){return Ct(t,Ft(_t,e,0,0,i,0,0))}function Lt(t,e,i){return Ft(t,e,0,0,i,0,0)}function Nt(t,e,i){return Ct(t,Ft(_t,1,0,0,1,e,i))}function Ot(t,e,i,n,s,r,o,h){const a=Math.sin(r),u=Math.cos(r);return t[0]=n*u,t[1]=s*a,t[2]=-n*a,t[3]=s*u,t[4]=o*n*u-h*n*a+e,t[5]=o*s*a+h*s*u+i,t}function zt(t,e){const i=Gt(e);ct(0!==i,32);const n=e[0],s=e[1],r=e[2],o=e[3],h=e[4],a=e[5];return t[0]=o/i,t[1]=-s/i,t[2]=-r/i,t[3]=n/i,t[4]=(r*a-o*h)/i,t[5]=-(n*a-s*h)/i,t}function Gt(t){return t[0]*t[3]-t[1]*t[2]}let jt;function Dt(t){const e="matrix("+t.join(", ")+")";if(Mt)return e;const i=jt||(jt=document.createElement("div"));return i.style.transform=e,i.style.transform}var Ut=0,$t=1,Bt=2,qt=4,Xt=8,Yt=16;function Zt(t){const e=ee();for(let i=0,n=t.length;is&&(a|=qt),hr&&(a|=Bt),a===Ut&&(a=$t),a}function ee(){return[1/0,1/0,-1/0,-1/0]}function ie(t,e,i,n,s){return s?(s[0]=t,s[1]=e,s[2]=i,s[3]=n,s):[t,e,i,n]}function ne(t){return ie(1/0,1/0,-1/0,-1/0,t)}function se(t,e){const i=t[0],n=t[1];return ie(i,n,i,n,e)}function re(t,e,i,n,s){return ce(ne(s),t,e,i,n)}function oe(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function he(t,e,i){return Math.abs(t[0]-e[0])t[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function ue(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function le(t,e){for(let i=0,n=e.length;ie[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Ce(t){return t[2]=o&&m<=a),n||!(r&qt)||s&qt||(v=d-(f-a)*p,n=v>=h&&v<=u),n||!(r&Xt)||s&Xt||(m=f-(d-h)/p,n=m>=o&&m<=a),n||!(r&Yt)||s&Yt||(v=d-(f-o)*p,n=v>=h&&v<=u)}return n}function ke(t,e,i,n){let s=[];if(n>1){const e=t[2]-t[0],i=t[3]-t[1];for(let r=0;r=i[2])){const e=Ee(i),s=Math.floor((n[0]-i[0])/e)*e;t[0]-=s,t[2]-=s}return t}function Le(t,e){if(e.canWrapX()){const i=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[i[0],t[1],i[2],t[3]]];Re(t,e);const n=Ee(i);if(Ee(t)>n)return[[i[0],t[1],i[2],t[3]]];if(t[0]i[2])return[[t[0],t[1],i[2],t[3]],[i[0],t[1],t[2]-n,t[3]]]}return[t]}const Ne={9001:"m",9002:"ft",9003:"us-ft",9101:"radians",9102:"degrees"};function Oe(t){return Ne[t]}const ze={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var Ge=class{constructor(t){this.st=t.code,this.rt=t.units,this.ot=void 0!==t.extent?t.extent:null,this.ht=void 0!==t.worldExtent?t.worldExtent:null,this.ut=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.lt=void 0!==t.global&&t.global,this.ct=!(!this.lt||!this.ot),this.dt=t.getPointResolution,this.vt=null,this.gt=t.metersPerUnit}canWrapX(){return this.ct}getCode(){return this.st}getExtent(){return this.ot}getUnits(){return this.rt}getMetersPerUnit(){return this.gt||ze[this.rt]}getWorldExtent(){return this.ht}getAxisOrientation(){return this.ut}isGlobal(){return this.lt}setGlobal(t){this.lt=t,this.ct=!(!t||!this.ot)}getDefaultTileGrid(){return this.vt}setDefaultTileGrid(t){this.vt=t}setExtent(t){this.ot=t,this.ct=!(!this.lt||!t)}setWorldExtent(t){this.ht=t}setGetPointResolution(t){this.dt=t}getPointResolutionFunc(){return this.dt}};const je=6378137,De=Math.PI*je,Ue=[-De,-De,De,De],$e=[-180,-85,180,85],Be=je*Math.log(Math.tan(Math.PI/2));class qe extends Ge{constructor(t){super({code:t,units:"m",extent:Ue,global:!0,worldExtent:$e,getPointResolution:function(t,e){return t/Math.cosh(e[1]/je)}})}}const Xe=[new qe("EPSG:3857"),new qe("EPSG:102100"),new qe("EPSG:102113"),new qe("EPSG:900913"),new qe("http://www.opengis.net/def/crs/EPSG/0/3857"),new qe("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Ye(t,e,i){const n=t.length;i=i>1?i:2,void 0===e&&(e=i>2?t.slice():new Array(n));for(let s=0;sBe?i=Be:i<-Be&&(i=-Be),e[s+1]=i}return e}function Ze(t,e,i){const n=t.length;i=i>1?i:2,void 0===e&&(e=i>2?t.slice():new Array(n));for(let s=0;s1?(i=s,n=r):a>0&&(i+=o*a,n+=h*a)}return ui(t,e,i,n)}function ui(t,e,i,n){const s=i-t,r=n-e;return s*s+r*r}function li(t){const e=t.length;for(let i=0;is&&(s=e,n=r)}if(0===s)return null;const r=t[n];t[n]=t[i],t[i]=r;for(let n=i+1;n=0;n--){i[n]=t[n][e]/t[n][n];for(let s=n-1;s>=0;s--)t[s][e]-=t[s][n]*i[n]}return i}function ci(t){return 180*t/Math.PI}function fi(t){return t*Math.PI/180}function di(t,e){const i=t%e;return i*e<0?i+e:i}function pi(t,e,i){return t+i*(e-t)}function mi(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function vi(t,e){return Math.round(mi(t,e))}function gi(t,e){return Math.floor(mi(t,e))}function yi(t,e){return Math.ceil(mi(t,e))}function wi(t,e,i){const n=void 0!==i?t.toFixed(i):""+t;let s=n.indexOf(".");return s=-1===s?n.length:s,s>e?n:new Array(1+e-s).join("0")+n}function xi(t,e){const i=(""+t).split("."),n=(""+e).split(".");for(let t=0;ts)return 1;if(s>e)return-1}return 0}function bi(t,e){return t[0]+=+e[0],t[1]+=+e[1],t}function Mi(t,e){const i=e.getRadius(),n=e.getCenter(),s=n[0],r=n[1];let o=t[0]-s;const h=t[1]-r;0===o&&0===h&&(o=1);const a=Math.sqrt(o*o+h*h);return[s+i*o/a,r+i*h/a]}function Si(t,e){const i=t[0],n=t[1],s=e[0],r=e[1],o=s[0],h=s[1],a=r[0],u=r[1],l=a-o,c=u-h,f=0===l&&0===c?0:(l*(i-o)+c*(n-h))/(l*l+c*c||0);let d,p;return f<=0?(d=o,p=h):f>=1?(d=a,p=u):(d=o+f*l,p=h+f*c),[d,p]}function Pi(t,e,i){const n=di(e+180,360)-180,s=Math.abs(3600*n),r=i||0;let o=Math.floor(s/3600),h=Math.floor((s-3600*o)/60),a=mi(s-3600*o-60*h,r);a>=60&&(a=0,h+=1),h>=60&&(h=0,o+=1);let u=o+"°";return 0===h&&0===a||(u+=" "+wi(h,2)+"′"),0!==a&&(u+=" "+wi(a,2,r)+"″"),0!==n&&(u+=" "+t.charAt(n<0?1:0)),u}function _i(t,e,i){return t?e.replace("{x}",t[0].toFixed(i)).replace("{y}",t[1].toFixed(i)):""}function Ei(t,e){let i=!0;for(let n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function Ti(t,e){const i=Math.cos(e),n=Math.sin(e),s=t[0]*i-t[1]*n,r=t[1]*i+t[0]*n;return t[0]=s,t[1]=r,t}function Ci(t,e){return t[0]*=e,t[1]*=e,t}function Fi(t,e){const i=t[0]-e[0],n=t[1]-e[1];return i*i+n*n}function Ii(t,e){return Math.sqrt(Fi(t,e))}function Ai(t,e){return Fi(t,Si(t,e))}function ki(t,e){return _i(t,"{x}, {y}",e)}function Ri(t,e){if(e.canWrapX()){const i=Ee(e.getExtent()),n=Li(t,e,i);n&&(t[0]-=n*i)}return t}function Li(t,e,i){const n=e.getExtent();let s=0;return e.canWrapX()&&(t[0]n[2])&&(i=i||Ee(n),s=Math.floor((t[0]-n[0])/i)),s}const Ni=6371008.8;function Oi(t,e,i){i=i||Ni;const n=fi(t[1]),s=fi(e[1]),r=(s-n)/2,o=fi(e[0]-t[0])/2,h=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(s);return 2*i*Math.atan2(Math.sqrt(h),Math.sqrt(1-h))}function zi(t,e){let i=0;for(let n=0,s=t.length;n=o?e[r+t]:s[t]}return i}}function Ji(t,e,i,n){const s=Yi(t),r=Yi(e);ri(s,r,Ki(i)),ri(r,s,Ki(n))}function Qi(t,e){return Ui(),sn(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")}function tn(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();if(t.getCode()===e.getCode())return i;return en(t,e)===$i&&i}function en(t,e){let i=oi(t.getCode(),e.getCode());return i||(i=Bi),i}function nn(t,e){return en(Yi(t),Yi(e))}function sn(t,e,i){return nn(e,i)(t,void 0,t.length)}function rn(t,e,i,n){return ke(t,nn(e,i),void 0,n)}let on=null;function hn(t){on=Yi(t)}function an(){return on}function un(t,e){return on?sn(t,e,on):t}function ln(t,e){return on?sn(t,on,e):(Di&&!Ei(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(Di=!1,console.warn("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t)}function cn(t,e){return on?rn(t,e,on):t}function fn(t,e){return on?rn(t,on,e):t}function dn(t,e){if(!on)return t;const i=Yi(e).getUnits(),n=on.getUnits();return i&&n?t*ze[i]/ze[n]:t}function pn(t,e){if(!on)return t;const i=Yi(e).getUnits(),n=on.getUnits();return i&&n?t*ze[n]/ze[i]:t}function mn(t,e,i){return function(n){let s,r;if(t.canWrapX()){const e=t.getExtent(),o=Ee(e);r=Li(n=n.slice(0),t,o),r&&(n[0]=n[0]-r*o),n[0]=hi(n[0],e[0],e[2]),n[1]=hi(n[1],e[1],e[3]),s=i(n)}else s=i(n);return r&&e.canWrapX()&&(s[0]+=r*Ee(e.getExtent())),s}}function vn(){Vi(Xe),Vi(Je),Wi(Je,Xe,Ye,Ze)}function gn(t,e,i,n,s,r){r=r||[];let o=0;for(let h=e;h1)c=i;else{if(f>0){for(let s=0;ss&&(s=h),r=i,o=n}return s}function Cn(t,e,i,n,s){for(let r=0,o=i.length;r0;){const i=u.pop(),r=u.pop();let o=0;const h=t[r],c=t[r+1],f=t[i],d=t[i+1];for(let e=r+n;eo&&(l=e,o=i)}o>s&&(a[(l-e)/n]=1,r+ns&&(r[o++]=u,r[o++]=l,h=u,a=l);return u==h&&l==a||(r[o++]=u,r[o++]=l),o}function Dn(t,e){return e*Math.round(t/e)}function Un(t,e,i,n,s,r,o){if(e==i)return o;let h,a,u=Dn(t[e],s),l=Dn(t[e+1],s);e+=n,r[o++]=u,r[o++]=l;do{if(h=Dn(t[e],s),a=Dn(t[e+1],s),(e+=n)==i)return r[o++]=h,r[o++]=a,o}while(h==u&&a==l);for(;e0&&p>f)&&(d<0&&m0&&m>d)?(h=i,a=c):(r[o++]=h,r[o++]=a,u=h,l=a,h=i,a=c)}return r[o++]=h,r[o++]=a,o}function $n(t,e,i,n,s,r,o,h){for(let a=0,u=i.length;ar&&(i-h)*(r-a)-(s-h)*(n-a)>0&&o++:n<=r&&(i-h)*(r-a)-(s-h)*(n-a)<0&&o--,h=i,a=n}return 0!==o}function is(t,e,i,n,s,r){if(0===i.length)return!1;if(!es(t,e,i[0],n,s,r))return!1;for(let e=1,o=i.length;ey&&(u=(l+c)/2,is(t,e,i,n,u,m)&&(g=u,y=s)),l=c}return isNaN(g)&&(g=s[r]),o?(o.push(g,m,y),o):[g,m,y]}function rs(t,e,i,n,s){let r=[];for(let o=0,h=i.length;o=s[0]&&r[2]<=s[2]||(r[1]>=s[1]&&r[3]<=s[3]||os(t,e,i,n,(function(t,e){return Ae(s,t,e)})))))}function as(t,e,i,n,s){for(let r=0,o=i.length;r0}function ps(t,e,i,n,s){s=void 0!==s&&s;for(let r=0,o=i.length;r0&&this.Wt[i+2]>t;)i-=3;const n=this.Wt[e+2]-this.Wt[i+2];if(n<1e3/60)return!1;const s=this.Wt[e]-this.Wt[i],r=this.Wt[e+1]-this.Wt[i+1];return this.Ht=Math.atan2(r,s),this.Kt=Math.sqrt(s*s+r*r)/n,this.Kt>this.Zt}getDistance(){return(this.Zt-this.Kt)/this.Yt}getAngle(){return this.Ht}};const ir=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,nr=/^([a-z]*)$|^hsla?\(.*\)$/i;function sr(t){return"string"==typeof t?t:ur(t)}function rr(t){const e=document.createElement("div");if(e.style.color=t,""!==e.style.color){document.body.appendChild(e);const t=getComputedStyle(e).color;return document.body.removeChild(e),t}return""}const or=function(){const t={};let e=0;return function(i){let n;if(t.hasOwnProperty(i))n=t[i];else{if(e>=1024){let i=0;for(const n in t)0==(3&i++)&&(delete t[n],--e)}n=function(t){let e,i,n,s,r;nr.exec(t)&&(t=rr(t));if(ir.exec(t)){const o=t.length-1;let h;h=o<=4?1:2;const a=4===o||8===o;e=parseInt(t.substr(1+0*h,h),16),i=parseInt(t.substr(1+1*h,h),16),n=parseInt(t.substr(1+2*h,h),16),s=a?parseInt(t.substr(1+3*h,h),16):255,1==h&&(e=(e<<4)+e,i=(i<<4)+i,n=(n<<4)+n,a&&(s=(s<<4)+s)),r=[e,i,n,s/255]}else t.startsWith("rgba(")?(r=t.slice(5,-1).split(",").map(Number),ar(r)):t.startsWith("rgb(")?(r=t.slice(4,-1).split(",").map(Number),r.push(1),ar(r)):ct(!1,14);return r}(i),t[i]=n,++e}return n}}();function hr(t){return Array.isArray(t)?t:or(t)}function ar(t){return t[0]=hi(t[0]+.5|0,0,255),t[1]=hi(t[1]+.5|0,0,255),t[2]=hi(t[2]+.5|0,0,255),t[3]=hi(t[3],0,1),t}function ur(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];n!=(0|n)&&(n=n+.5|0);return"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(100*t[3])/100)+")"}function lr(t){return nr.test(t)&&(t=rr(t)),ir.test(t)||t.startsWith("rgba(")||t.startsWith("rgb(")}class cr{constructor(){this.Jt={},this.Qt=0,this.te=32}clear(){this.Jt={},this.Qt=0}canExpireCache(){return this.Qt>this.te}expire(){if(this.canExpireCache()){let t=0;for(const e in this.Jt){const i=this.Jt[e];0!=(3&t++)||i.hasListener()||(delete this.Jt[e],--this.Qt)}}}get(t,e,i){const n=fr(t,e,i);return n in this.Jt?this.Jt[n]:null}set(t,e,i,n){const s=fr(t,e,i);this.Jt[s]=n,++this.Qt}setSize(t){this.te=t,this.expire()}}function fr(t,e,i){return e+":"+t+":"+(i?sr(i):"null")}var dr=cr;const pr=new cr;var mr="opacity",vr="visible",gr="extent",yr="zIndex",wr="maxResolution",xr="minResolution",br="maxZoom",Mr="minZoom",Sr="source",Pr="map";var _r=class extends V{constructor(t){super(),this.on,this.once,this.un,this.ee=t.background;const e=Object.assign({},t);"object"==typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[mr]=void 0!==t.opacity?t.opacity:1,ct("number"==typeof e[mr],64),e[vr]=void 0===t.visible||t.visible,e[yr]=t.zIndex,e[wr]=void 0!==t.maxResolution?t.maxResolution:1/0,e[xr]=void 0!==t.minResolution?t.minResolution:0,e[Mr]=void 0!==t.minZoom?t.minZoom:-1/0,e[br]=void 0!==t.maxZoom?t.maxZoom:1/0,this.ie=void 0!==e.className?e.className:"ol-layer",delete e.className,this.setProperties(e),this.ne=null}getBackground(){return this.ee}getClassName(){return this.ie}getLayerState(t){const e=this.ne||{layer:this,managed:void 0===t||t},i=this.getZIndex();return e.opacity=hi(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i||e.managed?i:1/0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.ne=e,e}getLayersArray(e){return t()}getLayerStatesArray(e){return t()}getExtent(){return this.get(gr)}getMaxResolution(){return this.get(wr)}getMinResolution(){return this.get(xr)}getMinZoom(){return this.get(Mr)}getMaxZoom(){return this.get(br)}getOpacity(){return this.get(mr)}getSourceState(){return t()}getVisible(){return this.get(vr)}getZIndex(){return this.get(yr)}setBackground(t){this.ee=t,this.changed()}setExtent(t){this.set(gr,t)}setMaxResolution(t){this.set(wr,t)}setMinResolution(t){this.set(xr,t)}setMaxZoom(t){this.set(br,t)}setMinZoom(t){this.set(Mr,t)}setOpacity(t){ct("number"==typeof t,64),this.set(mr,t)}setVisible(t){this.set(vr,t)}setZIndex(t){this.set(yr,t)}disposeInternal(){this.ne&&(this.ne.layer=null,this.ne=null),super.disposeInternal()}},Er="prerender",Tr="postrender",Cr="precompose",Fr="postcompose",Ir="rendercomplete";function Ar(t,e){if(!t.visible)return!1;const i=e.resolution;if(i=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}var kr=class extends _r{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.se=null,this.re=null,this.oe=null,this.he=null,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(Sr,this.ae);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return(t=t||[]).push(this),t}getLayerStatesArray(t){return(t=t||[]).push(this.getLayerState()),t}getSource(){return this.get(Sr)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}ue(){this.changed()}ae(){this.oe&&(B(this.oe),this.oe=null);const t=this.getSource();t&&(this.oe=U(t,T,this.ue,this)),this.changed()}getFeatures(t){return this.he?this.he.getFeatures(t):new Promise((t=>t([])))}getData(t){return this.he&&this.rendered?this.he.getData(t):null}render(t,e){const i=this.getRenderer();if(i.prepareFrame(t))return this.rendered=!0,i.renderFrame(t,e)}unrender(){this.rendered=!1}setMapInternal(t){t||this.unrender(),this.set(Pr,t)}getMapInternal(){return this.get(Pr)}setMap(t){this.se&&(B(this.se),this.se=null),t||this.changed(),this.re&&(B(this.re),this.re=null),t&&(this.se=U(t,Cr,(function(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);ct(!e.some((function(t){return t.layer===i.layer})),67),e.push(i)}),this),this.re=U(this,T,t.render,t),this.changed())}setSource(t){this.set(Sr,t)}getRenderer(){return this.he||(this.he=this.createRenderer()),this.he}hasRenderer(){return!!this.he}createRenderer(){return null}disposeInternal(){this.he&&(this.he.dispose(),delete this.he),this.setSource(null),super.disposeInternal()}};function Rr(t,e){pr.expire()}var Lr=class extends c{constructor(t){super(),this.le=t}dispatchRenderEvent(e,i){t()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;Ot(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),zt(n,i)}forEachFeatureAtCoordinate(t,e,i,n,s,r,o,h){let a;const u=e.viewState;function l(t,e,i,n){return s.call(r,e,t?i:null,n)}const c=u.projection,f=Ri(t.slice(),c),d=[[0,0]];if(c.canWrapX()&&n){const t=Ee(c.getExtent());d.push([-t,0],[t,0])}const p=e.layerStatesArray,m=p.length,v=[],g=[];for(let n=0;n=0;--s){const r=p[s],c=r.layer;if(c.hasRenderer()&&Ar(r,u)&&o.call(h,c)){const s=c.getRenderer(),o=c.getSource();if(s&&o){const h=o.getWrapX()?f:t,u=l.bind(null,r.managed);g[0]=h[0]+d[n][0],g[1]=h[1]+d[n][1],a=s.forEachFeatureAtCoordinate(g,e,i,u,v)}if(a)return a}}if(0===v.length)return;const y=1/v.length;return v.forEach(((t,e)=>t.distanceSq+=e*y)),v.sort(((t,e)=>t.distanceSq-e.distanceSq)),v.some((t=>a=t.callback(t.feature,t.layer,t.geometry))),a}hasFeatureAtCoordinate(t,e,i,n,s,r){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,w,this,s,r)}getMap(){return this.le}renderFrame(e){t()}scheduleExpireIconCache(t){pr.canExpireCache()&&t.postRenderFunctions.push(Rr)}};var Nr=class extends u{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}};const Or="ol-hidden",zr="ol-selectable",Gr="ol-unselectable",jr="ol-unsupported",Dr="ol-control",Ur="ol-collapsed",$r=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-z]+?)\\s*$"].join(""),"i"),Br=["style","variant","weight","size","lineHeight","family"],qr=function(t){const e=t.match($r);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let t=0,n=Br.length;tMath.max(e,ao(t,i))),0);return i[e]=n,n}function lo(t,e){const i=[],n=[],s=[];let r=0,o=0,h=0,a=0;for(let u=0,l=e.length;u<=l;u+=2){const c=e[u];if("\n"===c||u===l){r=Math.max(r,o),s.push(o),o=0,h+=a;continue}const f=e[u+1]||t.font,d=ao(f,c);i.push(d),o+=d;const p=oo(f);n.push(p),a=Math.max(a,p)}return{width:r,height:h,widths:i,heights:n,lineWidths:s}}function co(t,e,i,n,s,r,o,h,a,u,l){t.save(),1!==i&&(t.globalAlpha*=i),e&&t.setTransform.apply(t,e),n.contextInstructions?(t.translate(a,u),t.scale(l[0],l[1]),function(t,e){const i=t.contextInstructions;for(let t=0,n=i.length;t=0;--e)n[e].renderDeclutter(t);Qs(this.fe,this.de),this.dispatchRenderEvent(Fr,t),this.pe||(this.fe.style.display="",this.pe=!0),this.scheduleExpireIconCache(t)}};class po extends u{constructor(t,e){super(t),this.layer=e}}const mo="layers";class vo extends _r{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.me=[],this.ve={},this.addChangeListener(mo,this.ge),i?Array.isArray(i)?i=new Q(i.slice(),{unique:!0}):ct("function"==typeof i.getArray,43):i=new Q(void 0,{unique:!0}),this.setLayers(i)}ye(){this.changed()}ge(){this.me.forEach(B),this.me.length=0;const t=this.getLayers();this.me.push(U(t,W,this.we,this),U(t,H,this.xe,this));for(const t in this.ve)this.ve[t].forEach(B);P(this.ve);const e=t.getArray();for(let t=0,i=e.length;tthis.Ae||Math.abs(t.clientY-this.ke.clientY)>this.Ae}disposeInternal(){this.Ge&&(B(this.Ge),this.Ge=null),this.fe.removeEventListener(j,this.De),this.Ne&&(B(this.Ne),this.Ne=null),this.Fe.forEach(B),this.Fe.length=0,this.fe=null,super.disposeInternal()}},Eo="postrender",To="movestart",Co="moveend",Fo="loadstart",Io="loadend",Ao="layergroup",ko="size",Ro="target",Lo="view";const No=1/0;var Oo=class{constructor(t,e){this.Ve=t,this.We=e,this.He=[],this.Ke=[],this.Je={}}clear(){this.He.length=0,this.Ke.length=0,P(this.Je)}dequeue(){const t=this.He,e=this.Ke,i=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.Qe(0));const n=this.We(i);return delete this.Je[n],i}enqueue(t){ct(!(this.We(t)in this.Je),31);const e=this.Ve(t);return e!=No&&(this.He.push(t),this.Ke.push(e),this.Je[this.We(t)]=!0,this.ti(0,this.He.length-1),!0)}getCount(){return this.He.length}ei(t){return 2*t+1}ii(t){return 2*t+2}ni(t){return t-1>>1}si(){let t;for(t=(this.He.length>>1)-1;t>=0;t--)this.Qe(t)}isEmpty(){return 0===this.He.length}isKeyQueued(t){return t in this.Je}isQueued(t){return this.isKeyQueued(this.We(t))}Qe(t){const e=this.He,i=this.Ke,n=e.length,s=e[t],r=i[t],o=t;for(;t>1;){const s=this.ei(t),r=this.ii(t),o=rt;){const t=this.ni(e);if(!(n[t]>r))break;i[e]=i[t],n[e]=n[t],e=t}i[e]=s,n[e]=r}reprioritize(){const t=this.Ve,e=this.He,i=this.Ke;let n=0;const s=e.length;let r,o,h;for(o=0;o0;)n=this.dequeue()[0],s=n.getKey(),i=n.getState(),i!==tt||s in this.ai||(this.ai[s]=!0,++this.hi,++r,n.load())}};function Go(t,e,i,n,s){if(!t||!(i in t.wantedTiles))return No;if(!t.wantedTiles[i][e.getKey()])return No;const r=t.viewState.center,o=n[0]-r[0],h=n[1]-r[1];return 65536*Math.log(s)+Math.sqrt(o*o+h*h)/s}var jo=0,Do=1,Uo={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};const $o=256;function Bo(t,e,i){return function(n,s,r,o,h){if(!n)return;if(!s&&!e)return n;const a=e?0:r[0]*s,u=e?0:r[1]*s,l=h?h[0]:0,c=h?h[1]:0;let f=t[0]+a/2+l,d=t[2]-a/2+l,p=t[1]+u/2+c,m=t[3]-u/2+c;f>d&&(f=(d+f)/2,d=f),p>m&&(p=(m+p)/2,m=p);let v=hi(n[0],f,d),g=hi(n[1],p,m);if(o&&i&&s){const t=30*s;v+=-t*Math.log(1+Math.max(0,f-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-d)/t),g+=-t*Math.log(1+Math.max(0,p-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-m)/t)}return[v,g]}}function qo(t){return t}function Xo(t,e,i,n){const s=Ee(e)/i[0],r=Me(e)/i[1];return n?Math.min(t,Math.max(s,r)):Math.min(t,Math.min(s,r))}function Yo(t,e,i){let n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(n=Math.max(n,i),n/=Math.log(1+50*Math.max(0,i/t-1))/50+1),hi(n,i/2,2*e)}function Zo(t,e,i,n){return e=void 0===e||e,function(s,r,o,h){if(void 0!==s){const a=t[0],u=t[t.length-1],l=i?Xo(a,i,o,n):a;if(h)return e?Yo(s,l,u):hi(s,u,l);const c=Math.min(l,s),f=Math.floor(p(t,c,r));return t[f]>l&&f1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n0}getInteracting(){return this.ui[Do]>0}cancelAnimations(){let t;this.setHint(jo,-this.ui[jo]);for(let e=0,i=this.li.length;e=0;--i){const n=this.li[i];let s=!0;for(let i=0,r=n.length;i0?o/r.duration:1;h>=1?(r.complete=!0,h=1):s=!1;const a=r.easing(h);if(r.sourceCenter){const t=r.sourceCenter[0],e=r.sourceCenter[1],i=r.targetCenter[0],n=r.targetCenter[1];this.yi=r.targetCenter;const s=t+a*(i-t),o=e+a*(n-e);this.mi=[s,o]}if(r.sourceResolution&&r.targetResolution){const t=1===a?r.targetResolution:r.sourceResolution+a*(r.targetResolution-r.sourceResolution);if(r.anchor){const e=this.ki(this.getRotation()),i=this.Fi.resolution(t,0,e,!0);this.mi=this.calculateCenterZoom(i,r.anchor)}this.wi=r.targetResolution,this.vi=t,this.Ri(!0)}if(void 0!==r.sourceRotation&&void 0!==r.targetRotation){const t=1===a?di(r.targetRotation+Math.PI,2*Math.PI)-Math.PI:r.sourceRotation+a*(r.targetRotation-r.sourceRotation);if(r.anchor){const e=this.Fi.rotation(t,!0);this.mi=this.calculateCenterRotate(e,r.anchor)}this.xi=r.targetRotation,this.gi=t}if(this.Ri(!0),e=!0,!r.complete)break}if(s){this.li[i]=null,this.setHint(jo,-1),this.yi=null,this.wi=NaN,this.xi=NaN;const t=n[0].callback;t&&th(t,!0)}}this.li=this.li.filter(Boolean),e&&void 0===this.ci&&(this.ci=requestAnimationFrame(this.Ai.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],Ti(i,t-this.getRotation()),bi(i,e)),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),s=this.getResolution();if(void 0!==n&&void 0!==s){i=[e[0]-t*(e[0]-n[0])/s,e[1]-t*(e[1]-n[1])/s]}return i}ki(t){const e=this.di;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.di=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?un(t,this.getProjection()):t}getCenterInternal(){return this.get(Uo.CENTER)}getConstraints(){return this.Fi}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.ui[0],t[1]=this.ui[1],t):this.ui.slice()}calculateExtent(t){return cn(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.Li();const e=this.getCenterInternal();ct(e,1);const i=this.getResolution();ct(void 0!==i,2);const n=this.getRotation();return ct(void 0!==n,3),xe(e,i,n,t)}getMaxResolution(){return this.Si}getMinResolution(){return this.Pi}getMaxZoom(){return this.getZoomForResolution(this.Pi)}setMaxZoom(t){this.Mi(this.Ii({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.Si)}setMinZoom(t){this.Mi(this.Ii({minZoom:t}))}setConstrainResolution(t){this.Mi(this.Ii({constrainResolution:t}))}getProjection(){return this.fi}getResolution(){return this.get(Uo.RESOLUTION)}getResolutions(){return this.Ei}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(fn(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.Li();const i=Ee(t)/e[0],n=Me(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.Si),i=this.Pi,n=Math.log(e/i)/Math.log(t);return function(i){return e/Math.pow(t,i*n)}}getRotation(){return this.get(Uo.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.Si),n=this.Pi,s=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/s}}Li(t){let e=this.ki(t);const i=this.Ti;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const s=this.Ti;if(s){const t=this.Li();n=rh(n,this.ki(),[t[0]/2+s[3],t[1]/2+s[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.yi,nextResolution:this.wi,nextRotation:this.xi,rotation:i,zoom:this.getZoom()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.Ci||0;if(this.Ei){const s=p(this.Ei,t,1);n=s,e=this.Ei[s],i=s==this.Ei.length-1?2:e/this.Ei[s+1]}else e=this.Si,i=this._i;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.Ei){if(this.Ei.length<=1)return 0;const e=hi(Math.floor(t),0,this.Ei.length-2),i=this.Ei[e]/this.Ei[e+1];return this.Ei[e]/Math.pow(i,hi(t-e,0,1))}return this.Si/Math.pow(this._i,t-this.Ci)}fit(t,e){let i;if(ct(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,24),Array.isArray(t)){ct(!Ce(t),25);i=Ms(fn(t,this.getProjection()))}else if("Circle"===t.getType()){const e=fn(t.getExtent(),this.getProjection());i=Ms(e),i.rotate(this.getRotation(),ye(e))}else{const e=an();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),s=t.getFlatCoordinates(),r=t.getStride();let o=1/0,h=1/0,a=-1/0,u=-1/0;for(let t=0,e=s.length;t0;if(this.pe!=i&&(this.element.style.display=i?"":"none",this.pe=i),!g(e,this.Xi)){Js(this.Oi);for(let t=0,i=e.length;t0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.Hi,easing:ot}):t.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.Ji){const t="rotate("+i+"rad)";if(this.Ki){const t=this.element.classList.contains(Or);t||0!==i?t&&0!==i&&this.element.classList.remove(Or):this.element.classList.add(Or)}this.$i.style.transform=t}this.Ji=i}};var lh=class extends hh{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=void 0!==t.className?t.className:"ol-zoom",i=void 0!==t.delta?t.delta:1,n=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",s=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",r=void 0!==t.zoomInLabel?t.zoomInLabel:"+",o=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",h=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",a=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",u=document.createElement("button");u.className=n,u.setAttribute("type","button"),u.title=h,u.appendChild("string"==typeof r?document.createTextNode(r):r),u.addEventListener(I,this.qi.bind(this,i),!1);const l=document.createElement("button");l.className=s,l.setAttribute("type","button"),l.title=a,l.appendChild("string"==typeof o?document.createTextNode(o):o),l.addEventListener(I,this.qi.bind(this,-i),!1);const c=e+" "+"ol-unselectable "+Dr,f=this.element;f.className=c,f.appendChild(u),f.appendChild(l),this.Hi=void 0!==t.duration?t.duration:250}qi(t,e){e.preventDefault(),this.tn(t)}tn(t){const e=this.getMap().getView();if(!e)return;const i=e.getZoom();if(void 0!==i){const n=e.getConstrainedZoom(i+t);this.Hi>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.Hi,easing:ot})):e.setZoom(n)}}};function ch(t){t=t||{};const e=new Q;(void 0===t.zoom||t.zoom)&&e.push(new lh(t.zoomOptions));(void 0===t.rotate||t.rotate)&&e.push(new uh(t.rotateOptions));return(void 0===t.attribution||t.attribution)&&e.push(new ah(t.attributionOptions)),e}var fh="active";function dh(t,e,i){const n=t.getCenterInternal();if(n){const s=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:at,center:t.getConstrainedCenter(s)})}}function ph(t,e,i,n){const s=t.getZoom();if(void 0===s)return;const r=t.getConstrainedZoom(s+e),o=t.getResolutionForZoom(r);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:i,duration:void 0!==n?n:250,easing:ot})}var mh=class extends V{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.le=null,this.setActive(!0)}getActive(){return this.get(fh)}getMap(){return this.le}handleEvent(t){return!0}setActive(t){this.set(fh,t)}setMap(t){this.le=t}};var vh=class extends mh{constructor(t){super(),t=t||{},this.en=t.delta?t.delta:1,this.Hi=void 0!==t.duration?t.duration:250}handleEvent(t){let e=!1;if(t.type==xo.DBLCLICK){const i=t.originalEvent,n=t.map,s=t.coordinate,r=i.shiftKey?-this.en:this.en;ph(n.getView(),r,s,this.Hi),i.preventDefault(),e=!0}return!e}};function gh(t){const e=t.length;let i=0,n=0;for(let s=0;s0}}else if(t.type==xo.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==xo.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}nn(t){t.activePointers&&(this.targetPointers=t.activePointers)}};function wh(t){const e=arguments;return function(t){let i=!0;for(let n=0,s=e.length;n0&&this.an(t)){const e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.sn&&this.sn.begin(),this.cn=this.targetPointers.length>1,!0}return!1}};var Lh=class extends yh{constructor(t){t=t||{},super({stopDown:x}),this.an=t.condition?t.condition:bh,this.fn=void 0,this.Hi=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!Ah(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===Ho)return;const n=e.getSize(),s=t.pixel,r=Math.atan2(n[1]/2-s[1],s[0]-n[0]/2);if(void 0!==this.fn){const t=r-this.fn;i.adjustRotationInternal(-t)}this.fn=r}handleUpEvent(t){if(!Ah(t))return!0;return t.map.getView().endInteraction(this.Hi),!1}handleDownEvent(t){if(!Ah(t))return!1;if(_h(t)&&this.an(t)){return t.map.getView().beginInteraction(),this.fn=void 0,!0}return!1}};var Nh=class extends c{constructor(t){super(),this.dn=null,this.fe=document.createElement("div"),this.fe.style.position="absolute",this.fe.style.pointerEvents="auto",this.fe.className="ol-box "+t,this.le=null,this.pn=null,this.mn=null}disposeInternal(){this.setMap(null)}vn(){const t=this.pn,e=this.mn,i="px",n=this.fe.style;n.left=Math.min(t[0],e[0])+i,n.top=Math.min(t[1],e[1])+i,n.width=Math.abs(e[0]-t[0])+i,n.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.le){this.le.getOverlayContainer().removeChild(this.fe);const t=this.fe.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.le=t,this.le&&this.le.getOverlayContainer().appendChild(this.fe)}setPixels(t,e){this.pn=t,this.mn=e,this.createOrUpdateGeometry(),this.vn()}createOrUpdateGeometry(){const t=this.pn,e=this.mn,i=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.le.getCoordinateFromPixelInternal,this.le);i[4]=i[0].slice(),this.dn?this.dn.setCoordinates([i]):this.dn=new xs([i])}getGeometry(){return this.dn}};const Oh="boxstart",zh="boxdrag",Gh="boxend",jh="boxcancel";class Dh extends u{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}var Uh=class extends yh{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.gn=new Nh(t.className||"ol-dragbox"),this.yn=void 0!==t.minArea?t.minArea:64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.pn=null,this.an=t.condition?t.condition:_h,this.wn=t.boxEndCondition?t.boxEndCondition:this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const n=i[0]-e[0],s=i[1]-e[1];return n*n+s*s>=this.yn}getGeometry(){return this.gn.getGeometry()}handleDragEvent(t){this.gn.setPixels(this.pn,t.pixel),this.dispatchEvent(new Dh(zh,t.coordinate,t))}handleUpEvent(t){this.gn.setMap(null);const e=this.wn(t,this.pn,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new Dh(e?Gh:jh,t.coordinate,t)),!1}handleDownEvent(t){return!!this.an(t)&&(this.pn=t.pixel,this.gn.setMap(t.map),this.gn.setPixels(this.pn,this.pn),this.dispatchEvent(new Dh(Oh,t.coordinate,t)),!0)}onBoxEnd(t){}};var $h=class extends Uh{constructor(t){super({condition:(t=t||{}).condition?t.condition:Fh,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.Hi=void 0!==t.duration?t.duration:200,this.xn=void 0!==t.out&&t.out}onBoxEnd(t){const e=this.getMap().getView();let i=this.getGeometry();if(this.xn){const t=e.rotatedExtentForGeometry(i),n=e.getResolutionForExtentInternal(t),s=e.getResolution()/n;i=i.clone(),i.scale(s*s)}e.fitInternal(i,{duration:this.Hi,easing:ot})}},Bh=37,qh=38,Xh=39,Yh=40;var Zh=class extends mh{constructor(t){super(),t=t||{},this.bn=function(t){return Ch(t)&&Ih(t)},this.an=void 0!==t.condition?t.condition:this.bn,this.Hi=void 0!==t.duration?t.duration:100,this.Mn=void 0!==t.pixelDelta?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==N){const i=t.originalEvent,n=i.keyCode;if(this.an(t)&&(n==Yh||n==Bh||n==Xh||n==qh)){const s=t.map.getView(),r=s.getResolution()*this.Mn;let o=0,h=0;n==Yh?h=-r:n==Bh?o=-r:n==Xh?o=r:h=r;const a=[o,h];Ti(a,s.getRotation()),dh(s,a,this.Hi),i.preventDefault(),e=!0}}return!e}};var Vh=class extends mh{constructor(t){super(),t=t||{},this.an=t.condition?t.condition:Ih,this.en=t.delta?t.delta:1,this.Hi=void 0!==t.duration?t.duration:100}handleEvent(t){let e=!1;if(t.type==N||t.type==O){const i=t.originalEvent,n=i.charCode;if(this.an(t)&&(n=="+".charCodeAt(0)||n=="-".charCodeAt(0))){const s=t.map,r=n=="+".charCodeAt(0)?this.en:-this.en;ph(s.getView(),r,void 0,this.Hi),i.preventDefault(),e=!0}}return!e}};var Wh=class extends mh{constructor(t){super(t=t||{}),this.Sn=0,this.Pn=0,this.wt=void 0!==t.maxDelta?t.maxDelta:1,this.Hi=void 0!==t.duration?t.duration:250,this._n=void 0!==t.timeout?t.timeout:80,this.En=void 0===t.useAnchor||t.useAnchor,this.Tn=void 0!==t.constrainResolution&&t.constrainResolution;const e=t.condition?t.condition:Ph;this.an=t.onFocusOnly?wh(Sh,e):e,this.Cn=null,this.Fn=void 0,this.In,this.An=void 0,this.kn=400,this.Rn,this.Ln=300}Nn(){this.Rn=void 0;const t=this.getMap();if(!t)return;t.getView().endInteraction(void 0,this.Pn?this.Pn>0?1:-1:0,this.Cn)}handleEvent(t){if(!this.an(t))return!0;if(t.type!==D)return!0;const e=t.map,i=t.originalEvent;let n;if(i.preventDefault(),this.En&&(this.Cn=t.coordinate),t.type==D&&(n=i.deltaY,vt&&i.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(n/=bt),i.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=40)),0===n)return!1;this.Pn=n;const s=Date.now();void 0===this.Fn&&(this.Fn=s),(!this.An||s-this.Fn>this.kn)&&(this.An=Math.abs(n)<4?"trackpad":"wheel");const r=e.getView();if("trackpad"===this.An&&!r.getConstrainResolution()&&!this.Tn)return this.Rn?clearTimeout(this.Rn):(r.getAnimating()&&r.cancelAnimations(),r.beginInteraction()),this.Rn=setTimeout(this.Nn.bind(this),this._n),r.adjustZoom(-n/this.Ln,this.Cn),this.Fn=s,!1;this.Sn+=n;const o=Math.max(this._n-(s-this.Fn),0);return clearTimeout(this.In),this.In=setTimeout(this.On.bind(this,e),o),!1}On(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-hi(this.Sn,-this.wt*this.Ln,this.wt*this.Ln)/this.Ln;(e.getConstrainResolution()||this.Tn)&&(i=i?i>0?1:-1:0),ph(e,i,this.Cn,this.Hi),this.An=void 0,this.Sn=0,this.Cn=null,this.Fn=void 0,this.In=void 0}setMouseAnchor(t){this.En=t,t||(this.Cn=null)}};var Hh=class extends yh{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=x),super(e),this.zn=null,this.fn=void 0,this.Gn=!1,this.jn=0,this.Dn=void 0!==t.threshold?t.threshold:.3,this.Hi=void 0!==t.duration?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],n=this.targetPointers[1],s=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(void 0!==this.fn){const t=s-this.fn;this.jn+=t,!this.Gn&&Math.abs(this.jn)>this.Dn&&(this.Gn=!0),e=t}this.fn=s;const r=t.map,o=r.getView();if(o.getConstraints().rotation===Ho)return;const h=r.getViewport().getBoundingClientRect(),a=gh(this.targetPointers);a[0]-=h.left,a[1]-=h.top,this.zn=r.getCoordinateFromPixelInternal(a),this.Gn&&(r.render(),o.adjustRotationInternal(e,this.zn))}handleUpEvent(t){if(this.targetPointers.length<2){return t.map.getView().endInteraction(this.Hi),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.zn=null,this.fn=void 0,this.Gn=!1,this.jn=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}};var Kh=class extends yh{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=x),super(e),this.zn=null,this.Hi=void 0!==t.duration?t.duration:400,this.Un=void 0,this.$n=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.targetPointers[1],s=i.clientX-n.clientX,r=i.clientY-n.clientY,o=Math.sqrt(s*s+r*r);void 0!==this.Un&&(e=this.Un/o),this.Un=o;const h=t.map,a=h.getView();1!=e&&(this.$n=e);const u=h.getViewport().getBoundingClientRect(),l=gh(this.targetPointers);l[0]-=u.left,l[1]-=u.top,this.zn=h.getCoordinateFromPixelInternal(l),h.render(),a.adjustResolutionInternal(e,this.zn)}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map.getView(),i=this.$n>1?1:-1;return e.endInteraction(this.Hi,i),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.zn=null,this.Un=void 0,this.$n=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}};function Jh(t){t=t||{};const e=new Q,i=new er(-.005,.05,100);(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new Lh);(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new vh({delta:t.zoomDelta,duration:t.zoomDuration}));(void 0===t.dragPan||t.dragPan)&&e.push(new Rh({onFocusOnly:t.onFocusOnly,kinetic:i}));(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new Hh);(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new Kh({duration:t.zoomDuration}));(void 0===t.keyboard||t.keyboard)&&(e.push(new Zh),e.push(new Vh({delta:t.zoomDelta,duration:t.zoomDuration})));(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new Wh({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration}));return(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new $h({duration:t.zoomDuration})),e}function Qh(t,e,i){return void 0===i&&(i=[0,0]),i[0]=t[0]+2*e,i[1]=t[1]+2*e,i}function ta(t){return t[0]>0&&t[1]>0}function ea(t,e,i){return void 0===i&&(i=[0,0]),i[0]=t[0]*e+.5|0,i[1]=t[1]*e+.5|0,i}function ia(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}function na(t){t instanceof kr?t.setMapInternal(null):t instanceof go&&t.getLayers().forEach(na)}function sa(t,e){if(t instanceof kr)t.setMapInternal(e);else if(t instanceof go){const i=t.getLayers().getArray();for(let t=0,n=i.length;t=0;i--){const n=e[i];if(n.getMap()!==this||!n.getActive()||!this.getTargetElement())continue;if(!n.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.Qn,e=this.vs;if(!e.isEmpty()){let i=this.Yn,n=i;if(t){const e=t.viewHints;if(e[jo]||e[Do]){const e=Date.now()-t.time>8;i=e?0:8,n=e?0:2}}e.getTilesLoading(){this.Zn=void 0,this.handlePostRender()}),0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.Es(new po("removelayer",e)),this.set(Ao,t)}setSize(t){this.set(ko,t)}setTarget(t){this.set(Ro,t)}setView(t){if(!t||t instanceof oh)return void this.set(Lo,t);this.set(Lo,new oh);const e=this;t.then((function(t){e.setView(new oh(t))}))}updateSize(){const t=this.getTargetElement();let e;if(t){const i=getComputedStyle(t),n=t.offsetWidth-parseFloat(i.borderLeftWidth)-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight)-parseFloat(i.borderRightWidth),s=t.offsetHeight-parseFloat(i.borderTopWidth)-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom)-parseFloat(i.borderBottomWidth);isNaN(n)||isNaN(s)||(e=[n,s],!ta(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&console.warn("No map visible because the map container's width or height are 0."))}this.setSize(e),this._s()}_s(){const t=this.getView();if(t){let e;const i=getComputedStyle(this.rs);i.width&&i.height&&(e=[parseInt(i.width,10),parseInt(i.height,10)]),t.setViewportSize(e)}}};const oa="element",ha="map",aa="offset",ua="position",la="positioning";var ca=class extends V{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=void 0===t.insertFirst||t.insertFirst,this.stopEvent=void 0===t.stopEvent||t.stopEvent,this.element=document.createElement("div"),this.element.className=void 0!==t.className?t.className:"ol-overlay-container ol-selectable",this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=!0===t.autoPan?{}:t.autoPan||void 0,this.rendered={Tt:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(oa,this.handleElementChanged),this.addChangeListener(ha,this.handleMapChanged),this.addChangeListener(aa,this.handleOffsetChanged),this.addChangeListener(ua,this.handlePositionChanged),this.addChangeListener(la,this.handlePositioningChanged),void 0!==t.element&&this.setElement(t.element),this.setOffset(void 0!==t.offset?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),void 0!==t.position&&this.setPosition(t.position)}getElement(){return this.get(oa)}getId(){return this.id}getMap(){return this.get(ha)||null}getOffset(){return this.get(aa)}getPosition(){return this.get(ua)}getPositioning(){return this.get(la)}handleElementChanged(){Js(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&(Ks(this.element),B(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=U(t,Eo,this.render,this),this.updatePixelPosition();const e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(oa,t)}setMap(t){this.set(ha,t)}setOffset(t){this.set(aa,t)}setPosition(t){this.set(ua,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(ua))return;const i=this.getRect(e.getTargetElement(),e.getSize()),n=this.getElement(),s=this.getRect(n,[Vs(n),Ws(n)]),r=void 0===(t=t||{}).margin?20:t.margin;if(!Jt(i,s)){const n=s[0]-i[0],o=i[2]-s[2],h=s[1]-i[1],a=i[3]-s[3],u=[0,0];if(n<0?u[0]=n-r:o<0&&(u[0]=Math.abs(o)+r),h<0?u[1]=h-r:a<0&&(u[1]=Math.abs(a)+r),0!==u[0]||0!==u[1]){const i=e.getView().getCenterInternal(),n=e.getPixelFromCoordinateInternal(i);if(!n)return;const s=[n[0]+u[0],n[1]+u[1]],r=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(s),duration:r.duration,easing:r.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),n=i.left+window.pageXOffset,s=i.top+window.pageYOffset;return[n,s,n+e[0],s+e[1]]}setPositioning(t){this.set(la,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e)return void this.setVisible(!1);const i=t.getPixelFromCoordinate(e),n=t.getSize();this.updateRenderedPosition(i,n)}updateRenderedPosition(t,e){const i=this.element.style,n=this.getOffset(),s=this.getPositioning();this.setVisible(!0);let r="0%",o="0%";"bottom-right"==s||"center-right"==s||"top-right"==s?r="-100%":"bottom-center"!=s&&"center-center"!=s&&"top-center"!=s||(r="-50%"),"bottom-left"==s||"bottom-center"==s||"bottom-right"==s?o="-100%":"center-left"!=s&&"center-center"!=s&&"center-right"!=s||(o="-50%");const h=`translate(${r}, ${o}) translate(${Math.round(t[0]+n[0])+"px"}, ${Math.round(t[1]+n[1])+"px"})`;this.rendered.Tt!=h&&(this.rendered.Tt=h,i.transform=h)}getOptions(){return this.options}};var fa=class{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.Cs=0,this.Fs={},this.Is=null,this.As=null}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.pop()}clear(){this.Cs=0,this.Fs={},this.Is=null,this.As=null}containsKey(t){return this.Fs.hasOwnProperty(t)}forEach(t){let e=this.Is;for(;e;)t(e.ks,e.Rs,this),e=e.newer}get(t,e){const i=this.Fs[t];return ct(void 0!==i,15),i===this.As||(i===this.Is?(this.Is=this.Is.newer,this.Is.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.As,this.As.newer=i,this.As=i),i.ks}remove(t){const e=this.Fs[t];return ct(void 0!==e,15),e===this.As?(this.As=e.older,this.As&&(this.As.newer=null)):e===this.Is?(this.Is=e.newer,this.Is&&(this.Is.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.Fs[t],--this.Cs,e.ks}getCount(){return this.Cs}getKeys(){const t=new Array(this.Cs);let e,i=0;for(e=this.As;e;e=e.older)t[i++]=e.Rs;return t}getValues(){const t=new Array(this.Cs);let e,i=0;for(e=this.As;e;e=e.older)t[i++]=e.ks;return t}peekLast(){return this.Is.ks}peekLastKey(){return this.Is.Rs}peekFirstKey(){return this.As.Rs}peek(t){if(this.containsKey(t))return this.Fs[t].ks}pop(){const t=this.Is;return delete this.Fs[t.Rs],t.newer&&(t.newer.older=null),this.Is=t.newer,this.Is||(this.As=null),--this.Cs,t.ks}replace(t,e){this.get(t),this.Fs[t].ks=e}set(t,e){ct(!(t in this.Fs),16);const i={Rs:t,newer:null,older:this.As,ks:e};this.As?this.As.newer=i:this.Is=i,this.As=i,this.Fs[t]=i,++this.Cs}setSize(t){this.highWaterMark=t}};function da(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function pa(t,e,i){return t+"/"+e+"/"+i}function ma(t){return pa(t[0],t[1],t[2])}function va(t){const[e,i,n]=t.substring(t.lastIndexOf("/")+1,t.length).split(",").map(Number);return pa(e,i,n)}function ga(t){return t.split("/").map(Number)}function ya(t){return(t[1]<i||i>e.getMaxZoom())return!1;const r=e.getFullTileRange(i);return!r||r.containsXY(n,s)}var xa=class extends fa{clear(){for(;this.getCount()>0;)this.pop().release();super.clear()}expireCache(t){for(;this.canExpireCache();){if(this.peekLast().getKey()in t)break;this.pop().release()}}pruneExceptNewestZ(){if(0===this.getCount())return;const t=ga(this.peekFirstKey())[0];this.forEach(function(e){e.tileCoord[0]!==t&&(this.remove(ma(e.tileCoord)),e.release())}.bind(this))}};class ba{constructor(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}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.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function Ma(t,e,i,n,s){return void 0!==s?(s.minX=t,s.maxX=e,s.minY=i,s.maxY=n,s):new ba(t,e,i,n)}var Sa=ba;const Pa=[];var _a=class extends ut{constructor(t,e,i,n){super(t,e,{transition:0}),this.Ls={},this.executorGroups={},this.declutterExecutorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.Ns={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=n.bind(void 0,this),this.wrappedTileCoord=i}getContext(t){const e=i(t);return e in this.Ls||(this.Ls[e]=Ys(1,1,Pa)),this.Ls[e]}hasContext(t){return i(t)in this.Ls}getImage(t){return this.hasContext(t)?this.getContext(t).canvas:null}getReplayState(t){const e=i(t);return e in this.Ns||(this.Ns[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.Ns[e]}load(){this.getSourceTiles()}release(){for(const t in this.Ls){const e=this.Ls[t];Zs(e),Pa.push(e.canvas),delete this.Ls[t]}super.release()}};var Ea=class extends ut{constructor(t,e,i,n,s,r){super(t,e,r),this.extent=null,this.Os=n,this.zs=null,this.$,this.projection=null,this.resolution,this.Xt=s,this.Gs=i,this.key=i}getFormat(){return this.Os}getFeatures(){return this.zs}load(){this.state==tt&&(this.setState(et),this.Xt(this,this.Gs),this.$&&this.$(this.extent,this.resolution,this.projection))}onLoad(t,e){this.setFeatures(t)}onError(){this.setState(nt)}setFeatures(t){this.zs=t,this.setState(it)}setLoader(t){this.$=t}};function Ta(t){return Array.isArray(t)?ur(t):t}let Ca,Fa=!1;function Ia(t,e,i,n,s,r,o){const h=new XMLHttpRequest;h.open("GET","function"==typeof t?t(i,n,s):t,!0),"arraybuffer"==e.getType()&&(h.responseType="arraybuffer"),h.withCredentials=Fa,h.onload=function(t){if(!h.status||h.status>=200&&h.status<300){const t=e.getType();let n;"json"==t||"text"==t?n=h.responseText:"xml"==t?(n=h.responseXML,n||(n=(new DOMParser).parseFromString(h.responseText,"application/xml"))):"arraybuffer"==t&&(n=h.response),n?r(e.readFeatures(n,{extent:i,featureProjection:s}),e.readProjection(n)):o()}else o()},h.onerror=o,h.send()}function Aa(t,e){return function(i,n,s,r,o){const h=this;Ia(t,e,i,n,s,(function(t,e){h.addFeatures(t),void 0!==r&&r(t)}),o||b)}}function ka(t,e){return[[-1/0,-1/0,1/0,1/0]]}function Ra(t,e,n,s){const r=document.createElement("script"),o="olc_"+i(e);function h(){delete window[o],r.parentNode.removeChild(r)}r.async=!0,r.src=t+(t.includes("?")?"&":"?")+(s||"callback")+"="+o;const a=setTimeout((function(){h(),n&&n()}),1e4);window[o]=function(t){clearTimeout(a),h(),e(t)},document.head.appendChild(r)}class La extends Error{constructor(t){super("Unexpected response status: "+t.status),this.name="ResponseError",this.response=t}}class Na extends Error{constructor(t){super("Failed to issue request"),this.name="ClientError",this.client=t}}function Oa(t){return new Promise((function(e,i){const n=new XMLHttpRequest;n.addEventListener("load",(function(t){const n=t.target;if(!n.status||n.status>=200&&n.status<300){let t;try{t=JSON.parse(n.responseText)}catch(t){const e="Error parsing response text as JSON: "+t.message;return void i(new Error(e))}e(t)}else i(new La(n))})),n.addEventListener("error",(function(t){i(new Na(t.target))})),n.open("GET",t),n.setRequestHeader("Accept","application/json"),n.send()}))}function za(t,e){return e.includes("://")?e:new URL(e,t).href}var Ga=class{drawCustom(t,e,i,n){}drawGeometry(t){}setStyle(t){}drawCircle(t,e){}drawFeature(t,e){}drawGeometryCollection(t,e){}drawLineString(t,e){}drawMultiLineString(t,e){}drawMultiPoint(t,e){}drawMultiPolygon(t,e){}drawPoint(t,e){}drawPolygon(t,e){}drawText(t,e){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}};var ja=class extends Ga{constructor(t,e,i,n,s,r,o){super(),this.Ls=t,this.Lt=e,this.ot=i,this.Tt=n,this.js=s,this.Ds=r,this.Us=o,this.$s=null,this.Bs=null,this.qs=null,this.Xs=null,this.Ys=null,this.Ot=null,this.Zs=0,this.Vs=0,this.Ws=0,this.Hs=0,this.Ks=0,this.Js=0,this.Qs=!1,this.tr=0,this.er=[0,0],this.ir=0,this.nr="",this.sr=0,this.rr=0,this.hr=!1,this.ar=0,this.ur=[0,0],this.lr=null,this.cr=null,this.dr=null,this.pr=[],this.mr=[1,0,0,1,0,0]}vr(t,e,i,n){if(!this.Ot)return;const s=gn(t,e,i,n,this.Tt,this.pr),r=this.Ls,o=this.mr,h=r.globalAlpha;1!=this.Hs&&(r.globalAlpha=h*this.Hs);let a=this.tr;this.Qs&&(a+=this.js);for(let t=0,e=s.length;tt*this.Lt)),lineDashOffset:(s||0)*this.Lt,lineJoin:void 0!==r?r:Wr,lineWidth:(void 0!==o?o:1)*this.Lt,miterLimit:void 0!==h?h:Hr,strokeStyle:Ta(t||Kr)}}else this.Ys=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.Ot=null);const i=t.getPixelRatio(this.Lt),n=t.getAnchor(),s=t.getOrigin();this.Ot=t.getImage(this.Lt),this.Zs=n[0]*i,this.Vs=n[1]*i,this.Ws=e[1]*i,this.Hs=t.getOpacity(),this.Ks=s[0],this.Js=s[1],this.Qs=t.getRotateWithView(),this.tr=t.getRotation();const r=t.getScaleArray();this.er=[r[0]*this.Lt/i,r[1]*this.Lt/i],this.ir=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.lr={fillStyle:Ta(t||Yr)}}else this.lr=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),s=i.getLineDashOffset(),r=i.getLineJoin(),o=i.getWidth(),h=i.getMiterLimit();this.cr={lineCap:void 0!==e?e:Zr,lineDash:n||Vr,lineDashOffset:s||0,lineJoin:void 0!==r?r:Wr,lineWidth:void 0!==o?o:1,miterLimit:void 0!==h?h:Hr,strokeStyle:Ta(t||Kr)}}else this.cr=null;const n=t.getFont(),s=t.getOffsetX(),r=t.getOffsetY(),o=t.getRotateWithView(),h=t.getRotation(),a=t.getScaleArray(),u=t.getText(),l=t.getTextAlign(),c=t.getTextBaseline();this.dr={font:void 0!==n?n:Xr,textAlign:void 0!==l?l:Jr,textBaseline:void 0!==c?c:Qr},this.nr=void 0!==u?Array.isArray(u)?u.reduce(((t,e,i)=>t+(i%2?" ":e)),""):u:"",this.sr=void 0!==s?this.Lt*s:0,this.rr=void 0!==r?this.Lt*r:0,this.hr=void 0!==o&&o,this.ar=void 0!==h?h:0,this.ur=[this.Lt*a[0],this.Lt*a[1]]}else this.nr=""}};const Da={Point:function(t,e,i,n,s){const r=i.getImage(),o=i.getText();let h;if(r){if(r.getImageState()!=Ds)return;let a=t;if(s){const u=r.getDeclutterMode();if("none"!==u)if(a=s,"obstacle"===u){const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(r,h),s.drawPoint(e,n)}else o&&o.getText()&&(h={})}const u=a.getBuilder(i.getZIndex(),"Image");u.setImageStyle(r,h),u.drawPoint(e,n)}if(o&&o.getText()){let r=t;s&&(r=s);const a=r.getBuilder(i.getZIndex(),"Text");a.setTextStyle(o,h),a.drawText(e,n)}},LineString:function(t,e,i,n,s){const r=i.getStroke();if(r){const s=t.getBuilder(i.getZIndex(),"LineString");s.setFillStrokeStyle(null,r),s.drawLineString(e,n)}const o=i.getText();if(o&&o.getText()){const r=(s||t).getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,n)}},Polygon:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(r||o){const s=t.getBuilder(i.getZIndex(),"Polygon");s.setFillStrokeStyle(r,o),s.drawPolygon(e,n)}const h=i.getText();if(h&&h.getText()){const r=(s||t).getBuilder(i.getZIndex(),"Text");r.setTextStyle(h),r.drawText(e,n)}},MultiPoint:function(t,e,i,n,s){const r=i.getImage(),o=i.getText();let h;if(r){if(r.getImageState()!=Ds)return;let a=t;if(s){const u=r.getDeclutterMode();if("none"!==u)if(a=s,"obstacle"===u){const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(r,h),s.drawMultiPoint(e,n)}else o&&o.getText()&&(h={})}const u=a.getBuilder(i.getZIndex(),"Image");u.setImageStyle(r,h),u.drawMultiPoint(e,n)}if(o&&o.getText()){let r=t;s&&(r=s);const a=r.getBuilder(i.getZIndex(),"Text");a.setTextStyle(o,h),a.drawText(e,n)}},MultiLineString:function(t,e,i,n,s){const r=i.getStroke();if(r){const s=t.getBuilder(i.getZIndex(),"LineString");s.setFillStrokeStyle(null,r),s.drawMultiLineString(e,n)}const o=i.getText();if(o&&o.getText()){const r=(s||t).getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,n)}},MultiPolygon:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(o||r){const s=t.getBuilder(i.getZIndex(),"Polygon");s.setFillStrokeStyle(r,o),s.drawMultiPolygon(e,n)}const h=i.getText();if(h&&h.getText()){const r=(s||t).getBuilder(i.getZIndex(),"Text");r.setTextStyle(h),r.drawText(e,n)}},GeometryCollection:function(t,e,i,n,s){const r=e.getGeometriesArray();let o,h;for(o=0,h=r.length;o2||Math.abs(t[4*e+3]-191.25)>2}function Ka(t,e,i,n){const s=sn(i,e,t);let r=Zi(e,n,i);const o=e.getMetersPerUnit();void 0!==o&&(r*=o);const h=t.getMetersPerUnit();void 0!==h&&(r/=h);const a=t.getExtent();if(!a||Kt(a,s)){const e=Zi(t,r,s)/r;isFinite(e)&&e>0&&(r/=e)}return r}function Ja(t,e,i,n){const s=ye(i);let r=Ka(t,e,s,n);return(!isFinite(r)||r<=0)&&pe(i,(function(i){return r=Ka(t,e,i,n),isFinite(r)&&r>0})),r}function Qa(t,e,i,n,s,r,o,h,a,u,l,c){const f=Ys(Math.round(i*t),Math.round(i*e),Va);if(c||(f.imageSmoothingEnabled=!1),0===a.length)return f.canvas;function d(t){return Math.round(t*i)/i}f.scale(i,i),f.globalCompositeOperation="lighter";const p=[1/0,1/0,-1/0,-1/0];a.forEach((function(t,e,i){ae(p,t.extent)}));const m=Ee(p),v=Me(p),g=Ys(Math.round(i*m/n),Math.round(i*v/n));c||(g.imageSmoothingEnabled=!1);const y=i/n;a.forEach((function(t,e,i){const n=t.extent[0]-p[0],s=-(t.extent[3]-p[3]),r=Ee(t.extent),o=Me(t.extent);t.image.width>0&&t.image.height>0&&g.drawImage(t.image,u,u,t.image.width-2*u,t.image.height-2*u,n*y,s*y,r*y,o*y)}));const w=Pe(o);return h.getTriangles().forEach((function(t,e,s){const o=t.source,h=t.target;let a=o[0][0],u=o[0][1],l=o[1][0],m=o[1][1],v=o[2][0],y=o[2][1];const x=d((h[0][0]-w[0])/r),b=d(-(h[0][1]-w[1])/r),M=d((h[1][0]-w[0])/r),S=d(-(h[1][1]-w[1])/r),P=d((h[2][0]-w[0])/r),_=d(-(h[2][1]-w[1])/r),E=a,T=u;a=0,u=0,l-=E,m-=T,v-=E,y-=T;const C=li([[l,m,0,0,M-x],[v,y,0,0,P-x],[0,0,l,m,S-b],[0,0,v,y,_-b]]);if(C){if(f.save(),f.beginPath(),function(){if(void 0===Za){const t=document.createElement("canvas").getContext("2d");t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",Wa(t,4,5,4,0),Wa(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;Za=Ha(e,0)||Ha(e,4)||Ha(e,8)}return Za}()||!c){f.moveTo(M,S);const t=4,e=x-M,i=b-S;for(let n=0;n=this.minZoom;){if(2===this._i?(r=Math.floor(r/2),o=Math.floor(o/2),s=Ma(r,r,o,o,i)):s=this.getTileRangeForExtentAndZ(h,a,i),e(a,s))return!0;--a}return!1}getExtent(){return this.ot}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.Pr?this.Pr:this._r[t]}getResolution(t){return this.Ei[t]}getResolutions(){return this.Ei}getTileCoordChildTileRange(t,e,i){if(t[0]this.maxZoom||e0?n:Math.max(r/i[0],s/i[1]);const o=e+1,h=new Array(o);for(let t=0;t0)return;const i=bu(e.canvas).getExtension("WEBGL_lose_context");i&&i.loseContext(),delete fl[t]}(this.Wr),delete this.Lr,delete this.$t}prepareDraw(t,e){const i=this.getGL(),n=this.getCanvas(),s=t.size,r=t.pixelRatio;n.width=s[0]*r,n.height=s[1]*r,n.style.width=s[0]+"px",n.style.height=s[1]+"px";for(let e=this.ro.length-1;e>=0;e--)this.ro[e].init(t);i.bindTexture(i.TEXTURE_2D,null),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.enable(i.BLEND),i.blendFunc(i.ONE,e?i.ZERO:i.ONE_MINUS_SRC_ALPHA)}prepareDrawToRenderTarget(t,e,i){const n=this.getGL(),s=e.getSize();n.bindFramebuffer(n.FRAMEBUFFER,e.getFramebuffer()),n.viewport(0,0,s[0],s[1]),n.bindTexture(n.TEXTURE_2D,e.getTexture()),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.ONE,i?n.ZERO:n.ONE_MINUS_SRC_ALPHA)}drawElements(t,e){const i=this.getGL();this.getExtension("OES_element_index_uint");const n=i.UNSIGNED_INT,s=e-t,r=4*t;i.drawElements(i.TRIANGLES,s,n,r)}finalizeDraw(t,e,i){for(let n=0,s=this.ro.length;nthis.V[0]||e>=this.V[1])return wl[0]=0,wl[1]=0,wl[2]=0,wl[3]=0,wl;this.readAll();const i=Math.floor(t)+(this.V[1]-Math.floor(e)-1)*this.V[0];return wl[0]=this.B[4*i],wl[1]=this.B[4*i+1],wl[2]=this.B[4*i+2],wl[3]=this.B[4*i+3],wl}getTexture(){return this.ao}getFramebuffer(){return this.lo}fo(){const t=this.V,e=this.uo.getGL();this.ao=this.uo.createTexture(t,null,this.ao),e.bindFramebuffer(e.FRAMEBUFFER,this.lo),e.viewport(0,0,t[0],t[1]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.ao,0),this.B=new Uint8Array(t[0]*t[1]*4)}};var bl=class{constructor(t,e,i,n,s,r){this.do=t,this.po=e;let o={};const h=nn(this.po,this.do);this.mo=function(t){const e=t[0]+"/"+t[1];return o[e]||(o[e]=h(t)),o[e]},this.vo=n,this.yo=s*s,this.wo=[],this.xo=!1,this.bo=this.do.canWrapX()&&!!n&&!!this.do.getExtent()&&Ee(n)==Ee(this.do.getExtent()),this.Mo=this.do.getExtent()?Ee(this.do.getExtent()):null,this.So=this.po.getExtent()?Ee(this.po.getExtent()):null;const a=Pe(i),u=_e(i),l=ge(i),c=ve(i),f=this.mo(a),d=this.mo(u),p=this.mo(l),m=this.mo(c),v=10+(r?Math.max(0,Math.ceil(Math.log2(me(i)/(r*r*256*256)))):0);if(this.Po(a,u,l,c,f,d,p,m,v),this.xo){let t=1/0;this.wo.forEach((function(e,i,n){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])})),this.wo.forEach(function(e){if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.Mo/2){const i=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];i[0][0]-t>this.Mo/2&&(i[0][0]-=this.Mo),i[1][0]-t>this.Mo/2&&(i[1][0]-=this.Mo),i[2][0]-t>this.Mo/2&&(i[2][0]-=this.Mo);const n=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-n.5&&l<1;let d=!1;if(a>0){if(this.po.isGlobal()&&this.So){d=Ee(Zt([t,e,i,n]))/this.So>.25||d}!f&&this.do.isGlobal()&&l&&(d=l>.25||d)}if(!d&&this.vo&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3])&&!Te(u,this.vo))return;let p=0;if(!(d||isFinite(s[0])&&isFinite(s[1])&&isFinite(r[0])&&isFinite(r[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(h[0])&&isFinite(h[1])))if(a>0)d=!0;else if(p=(isFinite(s[0])&&isFinite(s[1])?0:8)+(isFinite(r[0])&&isFinite(r[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(h[0])&&isFinite(h[1])?0:1),1!=p&&2!=p&&4!=p&&8!=p)return;if(a>0){if(!d){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],n=this.mo(e);let r;if(f){r=(di(s[0],c)+di(o[0],c))/2-di(n[0],c)}else r=(s[0]+o[0])/2-n[0];const h=(s[1]+o[1])/2-n[1];d=r*r+h*h>this.yo}if(d){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const u=[(e[0]+i[0])/2,(e[1]+i[1])/2],l=this.mo(u),c=[(n[0]+t[0])/2,(n[1]+t[1])/2],f=this.mo(c);this.Po(t,e,u,c,s,r,l,f,a-1),this.Po(c,u,i,n,f,l,o,h,a-1)}else{const u=[(t[0]+e[0])/2,(t[1]+e[1])/2],l=this.mo(u),c=[(i[0]+n[0])/2,(i[1]+n[1])/2],f=this.mo(c);this.Po(t,u,c,n,s,l,f,h,a-1),this.Po(u,e,i,c,l,r,o,f,a-1)}return}}if(f){if(!this.bo)return;this.xo=!0}0==(11&p)&&this._o(t,i,n,s,o,h),0==(14&p)&&this._o(t,i,e,s,o,r),p&&(0==(13&p)&&this._o(e,n,t,r,h,s),0==(7&p)&&this._o(e,n,i,r,h,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.wo.forEach((function(e,i,n){const s=e.source;ue(t,s[0]),ue(t,s[1]),ue(t,s[2])})),t}getTriangles(){return this.wo}};var Ml=class extends ut{constructor(t,e,i,n,s,r,o,h,a,u,l,c){super(s,tt,{interpolate:!!c}),this.Eo=void 0!==l&&l,this.Lt=o,this.To=h,this.$t=null,this.Co=e,this.Fo=n,this.Io=r||s,this.Ao=[],this.ko=null,this.Ro=0;const f=n.getTileCoordExtent(this.Io),d=this.Fo.getExtent();let p=this.Co.getExtent();const m=d?Se(f,d):f;if(0===me(m))return void(this.state=st);const v=t.getExtent();v&&(p=p?Se(p,v):v);const g=n.getResolution(this.Io[0]),y=Ja(t,i,m,g);if(!isFinite(y)||y<=0)return void(this.state=st);const w=void 0!==u?u:.5;if(this.Lo=new bl(t,i,m,p,y*w,g),0===this.Lo.getTriangles().length)return void(this.state=st);this.Ro=e.getZForResolution(y);let x=this.Lo.calculateSourceExtent();if(p&&(t.canWrapX()?(x[1]=hi(x[1],p[1],p[3]),x[3]=hi(x[3],p[1],p[3])):x=Se(x,p)),me(x)){const t=e.getTileRangeForExtentAndZ(x,this.Ro);for(let e=t.minX;e<=t.maxX;e++)for(let i=t.minY;i<=t.maxY;i++){const t=a(this.Ro,e,i,o);t&&this.Ao.push(t)}0===this.Ao.length&&(this.state=st)}else this.state=st}getImage(){return this.$t}No(){const t=[];if(this.Ao.forEach(function(e,i,n){e&&e.getState()==it&&t.push({extent:this.Co.getTileCoordExtent(e.tileCoord),image:e.getImage()})}.bind(this)),this.Ao.length=0,0===t.length)this.state=nt;else{const e=this.Io[0],i=this.Fo.getTileSize(e),n="number"==typeof i?i:i[0],s="number"==typeof i?i:i[1],r=this.Fo.getResolution(e),o=this.Co.getResolution(this.Ro),h=this.Fo.getTileCoordExtent(this.Io);this.$t=Qa(n,s,this.Lt,o,this.Co.getExtent(),r,h,this.Lo,t,this.To,this.Eo,this.interpolate),this.state=it}this.changed()}load(){if(this.state==tt){this.state=et,this.changed();let t=0;this.ko=[],this.Ao.forEach(function(e,i,n){const s=e.getState();if(s==tt||s==et){t++;const i=U(e,T,(function(n){const s=e.getState();s!=it&&s!=nt&&s!=st||(B(i),t--,0===t&&(this.Oo(),this.No()))}),this);this.ko.push(i)}}.bind(this)),0===t?setTimeout(this.No.bind(this),0):this.Ao.forEach((function(t,e,i){t.getState()==tt&&t.load()}))}}Oo(){this.ko.forEach(B),this.ko=null}release(){this.$t&&(Zs(this.$t.getContext("2d")),Va.push(this.$t),this.$t=null),super.release()}};function Sl(t,e,i){const n=i?t.LINEAR:t.NEAREST;t.bindTexture(t.TEXTURE_2D,e),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.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,n)}function Pl(t,e,i,n,s,r){const o=t.getGL();let h,a;if(i instanceof Float32Array){h=o.FLOAT,t.getExtension("OES_texture_float");a=null!==t.getExtension("OES_texture_float_linear")}else h=o.UNSIGNED_BYTE,a=!0;Sl(o,e,r&&a);const u=i.byteLength/n[1];let l,c=1;switch(u%8==0?c=8:u%4==0?c=4:u%2==0&&(c=2),s){case 1:l=o.LUMINANCE;break;case 2:l=o.LUMINANCE_ALPHA;break;case 3:l=o.RGB;break;case 4:l=o.RGBA;break;default:throw new Error(`Unsupported number of bands: ${s}`)}const f=o.getParameter(o.UNPACK_ALIGNMENT);o.pixelStorei(o.UNPACK_ALIGNMENT,c),o.texImage2D(o.TEXTURE_2D,0,l,n[0],n[1],0,l,h,i),o.pixelStorei(o.UNPACK_ALIGNMENT,f)}let _l=null;var El=class extends E{constructor(t){super(),this.tile,this.textures=[],this.gs=this.gs.bind(this),this.zo=ia(t.grid.getTileSize(t.tile.tileCoord[0])),this.To=t.gutter||0,this.bandCount=NaN,this.uo=t.helper;const e=new Ku(mu,gu);e.fromArray([0,1,1,1,1,0,0,0]),this.uo.flushBufferData(e),this.coords=e,this.setTile(t.tile)}setTile(t){if(t!==this.tile)if(this.tile&&this.tile.removeEventListener(T,this.gs),this.tile=t,this.textures.length=0,this.loaded=t.getState()===it,this.loaded)this.Go();else{if(t instanceof tr){const e=t.getImage();e instanceof Image&&!e.crossOrigin&&(e.crossOrigin="anonymous")}t.addEventListener(T,this.gs)}}Go(){const t=this.uo,e=t.getGL(),i=this.tile;if(i instanceof tr||i instanceof Ml){const t=e.createTexture();return this.textures.push(t),this.bandCount=4,void function(t,e,i,n){Sl(t,e,n),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,i)}(e,t,i.getImage(),i.interpolate)}const n=i.getSize(),s=[n[0]+2*this.To,n[1]+2*this.To],r=i.getData(),o=r instanceof Float32Array,h=s[0]*s[1],a=o?Float32Array:Uint8Array,u=a.BYTES_PER_ELEMENT,l=r.byteLength/s[1];this.bandCount=Math.floor(l/u/s[0]);const c=Math.ceil(this.bandCount/4);if(1===c){const n=e.createTexture();return this.textures.push(n),void Pl(t,n,r,s,this.bandCount,i.interpolate)}const f=new Array(c);for(let t=0;t=d;--i){const n=a.getTileRangeForExtentAndZ(e,i,this.Vo),o=a.getResolution(i);for(let e=n.minX;e<=n.maxX;++e)for(let d=n.minY;d<=n.maxY;++d){const n=da(i,e,d,this.Wo),p=zl(h,n);let m,v;if(f.containsKey(p)&&(m=f.get(p),v=m.tile),!m||m.tile.key!==h.getKey())if(v=h.getTile(i,e,d,t.pixelRatio,r.projection),m)if(this.nh(v))m.setTile(v);else{const t=v.getInterimTile();m.setTile(t)}else m=new El({tile:v,grid:a,helper:this.helper,gutter:u}),f.set(p,m);Nl(s,m,i);const g=v.getKey();c[g]=!0,v.getState()===tt&&(t.tileQueue.isKeyQueued(g)||t.tileQueue.enqueue([v,l,a.getTileCoordCenter(n),o]))}}}renderFrame(t){this.Qn=t,this.renderComplete=!0;const e=this.helper.getGL();this.preRender(e,t);const n=t.viewState,s=this.getLayer().getRenderSource(),r=s.getTileGridForProjection(n.projection),o=s.getGutterForProjection(n.projection),h=Ol(t,t.extent),a=r.getZForResolution(n.resolution,s.zDirection),u={};if(t.nextExtent){const e=r.getZForResolution(n.nextResolution,s.zDirection),i=Ol(t,t.nextExtent);this.enqueueTiles(t,i,e,u)}this.enqueueTiles(t,h,a,u);const l={},c=i(this),f=t.time;let p=!1;const m=u[a];for(let t=0,e=m.length;t=s;--t){if(this.sh(r,n,t,u))break}}this.helper.useProgram(this.Ko,t),this.helper.prepareDraw(t,!p);const v=Object.keys(u).map(Number).sort(d),g=n.center[0],y=n.center[1];for(let i=0,s=v.length;i0&&(E=r.getTileCoordExtent(u),Se(E,h,E)),this.helper.setUniformFloatVec4(Il.RENDER_EXTENT,E),this.helper.setUniformFloatValue(Il.RESOLUTION,n.resolution),this.helper.setUniformFloatValue(Il.ZOOM,n.zoom),this.helper.drawElements(0,this.th.getSize())}}this.helper.finalizeDraw(t,this.dispatchPreComposeEvent,this.dispatchPostComposeEvent);const w=this.helper.getCanvas(),x=this.eh;for(;x.canExpireCache();){x.pop().dispose()}return t.postRenderFunctions.push((function(t,e){s.updateCacheSize(.1,e.viewState.projection),s.expireCache(e.viewState.projection,Rl)})),this.postRender(e,t),w}getData(t){if(!this.helper.getGL())return null;const e=this.Qn;if(!e)return null;const i=this.getLayer(),n=At(e.pixelToCoordinateTransform,t.slice()),s=e.viewState,r=i.getExtent();if(r&&!Kt(fn(r,s.projection),n))return null;const o=i.getSources(Zt([n]),s.resolution);let h,a,u;for(h=o.length-1;h>=0;--h)if(a=o[h],"ready"===a.getState()){if(u=a.getTileGridForProjection(s.projection),a.getWrapX())break;const t=u.getExtent();if(!t||Kt(t,n))break}if(h<0)return null;const l=this.eh;for(let t=u.getZForResolution(s.resolution);t>=u.getMinZoom();--t){const e=u.getTileCoordForCoordAndZ(n,t),i=zl(a,e);if(!l.containsKey(i))continue;const s=l.get(i);if(!s.loaded)continue;const r=u.getOrigin(t),o=ia(u.getTileSize(t)),h=u.getResolution(t),c=(n[0]-r[0])/h-e[1]*o[0],f=(r[1]-n[1])/h-e[2]*o[1];return s.getPixelData(c,f)}return null}sh(t,e,i,n){const s=t.getTileRangeForTileCoordAndZ(e,i,this.Vo);if(!s)return!1;let r=!0;const o=this.eh,h=this.getLayer().getRenderSource();for(let t=s.minX;t<=s.maxX;++t)for(let e=s.minY;e<=s.maxY;++e){const s=zl(h,[i,t,e]);let a=!1;if(o.containsKey(s)){const t=o.get(s);t.loaded&&(Nl(n,t,i),a=!0)}a||(r=!1)}return r}removeHelper(){if(this.helper){const t=this.eh;t.forEach((t=>t.dispose())),t.clear()}super.removeHelper()}disposeInternal(){const t=this.helper;if(t){t.getGL().deleteProgram(this.Ko),delete this.Ko,t.deleteBuffer(this.th)}super.disposeInternal(),delete this.th,delete this.eh,delete this.Qn}};const jl=1,Dl=2,Ul=4,$l=8,Bl=16,ql=31,Xl=0,Yl={};function Zl(t){if("number"==typeof t)return jl;if("boolean"==typeof t)return $l;if("string"==typeof t)return lr(t)?Ul|Dl:Dl;if(!Array.isArray(t))throw new Error(`Unhandled value type: ${JSON.stringify(t)}`);const e=t;if(e.every((function(t){return"number"==typeof t})))return 3===e.length||4===e.length?Ul|Bl:Bl;if("string"!=typeof e[0])throw new Error(`Expected an expression operator but received: ${JSON.stringify(e)}`);const i=Yl[e[0]];if(void 0===i)throw new Error(`Unrecognized expression operator: ${JSON.stringify(e)}`);return i.getReturnType(e.slice(1))}function Vl(t){return Math.log2(t)%1==0}function Wl(t){const e=t.toString();return e.includes(".")?e:e+".0"}function Hl(t){if(t.length<2||t.length>4)throw new Error("`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.");return`vec${t.length}(${t.map(Wl).join(", ")})`}function Kl(t){const e=hr(t).slice();return e.length<4&&e.push(1),Hl(e.map((function(t,e){return e<3?t/255:t})))}function Jl(t,e){return void 0===t.stringLiteralsMap[e]&&(t.stringLiteralsMap[e]=Object.keys(t.stringLiteralsMap).length),t.stringLiteralsMap[e]}function Ql(t,e){return Wl(Jl(t,e))}function tc(t,e,i){if(Array.isArray(e)&&"string"==typeof e[0]){const n=Yl[e[0]];if(void 0===n)throw new Error(`Unrecognized expression operator: ${JSON.stringify(e)}`);return n.toGlsl(t,e.slice(1),i)}const n=Zl(e);if((n&jl)>0)return Wl(e);if((n&$l)>0)return e.toString();if((n&Dl)>0&&(void 0===i||i==Dl))return Ql(t,e.toString());if((n&Ul)>0&&(void 0===i||i==Ul))return Kl(e);if((n&Bl)>0)return Hl(e);throw new Error(`Unexpected expression ${e} (expected type ${i})`)}function ec(t){if(!(Zl(t)&jl))throw new Error(`A numeric value was expected, got ${JSON.stringify(t)} instead`)}function ic(t){for(let e=0;ee)throw new Error(`At most ${e} arguments were expected, got ${t.length} instead`)}function ac(t){if(t.length%2!=0)throw new Error(`An even amount of arguments was expected, got ${t} instead`)}function uc(t,e){if(!Vl(e))throw new Error(`Could not infer only one type from the following expression: ${JSON.stringify(t)}`)}function lc(t){return"u_var_"+t}Yl.get={getReturnType:function(t){return ql},toGlsl:function(t,e){rc(e,1),nc(e[0]);const i=e[0].toString();t.attributes.includes(i)||t.attributes.push(i);return(t.inFragmentShader?"v_":"a_")+i}},Yl.var={getReturnType:function(t){return ql},toGlsl:function(t,e){rc(e,1),nc(e[0]);const i=e[0].toString();return t.variables.includes(i)||t.variables.push(i),lc(i)}};const cc="u_paletteTextures";Yl.palette={getReturnType:function(t){return Ul},toGlsl:function(t,e){rc(e,2),ec(e[0]);const i=tc(t,e[0]),n=e[1];if(!Array.isArray(n))throw new Error("The second argument of palette must be an array");const s=n.length,r=new Uint8Array(4*s);for(let t=0;ttc(e,t))).join(` ${t} `),n=`(${n})`,n}}}Yl.band={getReturnType:function(t){return jl},toGlsl:function(t,e){oc(e,1),hc(e,3);const i=e[0];if(!(fc in t.functions)){let e="";const i=t.bandCount||1;for(let t=0;t"]={getReturnType:function(t){return $l},toGlsl:function(t,e){return rc(e,2),ic(e),`(${tc(t,e[0])} > ${tc(t,e[1])})`}},Yl[">="]={getReturnType:function(t){return $l},toGlsl:function(t,e){return rc(e,2),ic(e),`(${tc(t,e[0])} >= ${tc(t,e[1])})`}},Yl["<"]={getReturnType:function(t){return $l},toGlsl:function(t,e){return rc(e,2),ic(e),`(${tc(t,e[0])} < ${tc(t,e[1])})`}},Yl["<="]={getReturnType:function(t){return $l},toGlsl:function(t,e){return rc(e,2),ic(e),`(${tc(t,e[0])} <= ${tc(t,e[1])})`}},Yl["=="]=dc("=="),Yl["!="]=dc("!="),Yl["!"]={getReturnType:function(t){return $l},toGlsl:function(t,e){return rc(e,1),sc(e[0]),`(!${tc(t,e[0])})`}},Yl.all=pc("&&"),Yl.any=pc("||"),Yl.between={getReturnType:function(t){return $l},toGlsl:function(t,e){rc(e,3),ic(e);const i=tc(t,e[1]),n=tc(t,e[2]),s=tc(t,e[0]);return`(${s} >= ${i} && ${s} <= ${n})`}},Yl.array={getReturnType:function(t){return Bl},toGlsl:function(t,e){oc(e,2),hc(e,4),ic(e);const i=e.map((function(e){return tc(t,e,jl)}));return`vec${e.length}(${i.join(", ")})`}},Yl.color={getReturnType:function(t){return Ul},toGlsl:function(t,e){oc(e,3),hc(e,4),ic(e);const i=e;3===e.length&&i.push(1);const n=e.map((function(e,i){return tc(t,e,jl)+(i<3?" / 255.0":"")}));return`vec${e.length}(${n.join(", ")})`}},Yl.interpolate={getReturnType:function(t){let e=Ul|jl;for(let i=3;i=1;i-=2){o=`(${s} == ${tc(t,e[i])} ? ${tc(t,e[i+1],n)} : ${o||r})`}return o}},Yl.case={getReturnType:function(t){let e=ql;for(let i=1;i=0;i-=2){r=`(${tc(t,e[i])} ? ${tc(t,e[i+1],n)} : ${r||s})`}return r}};class mc{constructor(){this.uniforms=[],this.attributes=[],this.varyings=[],this.sizeExpression="vec2(1.0)",this.rotationExpression="0.0",this.offsetExpression="vec2(0.0)",this.colorExpression="vec4(1.0)",this.texCoordExpression="vec4(0.0, 0.0, 1.0, 1.0)",this.discardExpression="false",this.rotateWithView=!1}addUniform(t){return this.uniforms.push(t),this}addAttribute(t){return this.attributes.push(t),this}addVarying(t,e,i){return this.varyings.push({name:t,type:e,expression:i}),this}setSizeExpression(t){return this.sizeExpression=t,this}setRotationExpression(t){return this.rotationExpression=t,this}setSymbolOffsetExpression(t){return this.offsetExpression=t,this}setColorExpression(t){return this.colorExpression=t,this}setTextureCoordinateExpression(t){return this.texCoordExpression=t,this}setFragmentDiscardExpression(t){return this.discardExpression=t,this}setSymbolRotateWithView(t){return this.rotateWithView=t,this}getSizeExpression(){return this.sizeExpression}getOffsetExpression(){return this.offsetExpression}getColorExpression(){return this.colorExpression}getTextureCoordinateExpression(){return this.texCoordExpression}getFragmentDiscardExpression(){return this.discardExpression}getSymbolVertexShader(t){const e=this.rotateWithView?"u_offsetScaleMatrix * u_offsetRotateMatrix":"u_offsetScaleMatrix";let i=this.attributes,n=this.varyings;return t&&(i=i.concat("vec4 a_hitColor"),n=n.concat({name:"v_hitColor",type:"vec4",expression:"a_hitColor"})),`precision mediump float;\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\nuniform float u_time;\nuniform float u_zoom;\nuniform float u_resolution;\n${this.uniforms.map((function(t){return"uniform "+t+";"})).join("\n")}\nattribute vec2 a_position;\nattribute float a_index;\n${i.map((function(t){return"attribute "+t+";"})).join("\n")}\nvarying vec2 v_texCoord;\nvarying vec2 v_quadCoord;\n${n.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\nvoid main(void) {\n mat4 offsetMatrix = ${e};\n vec2 halfSize = ${this.sizeExpression} * 0.5;\n vec2 offset = ${this.offsetExpression};\n float angle = ${this.rotationExpression};\n float offsetX;\n float offsetY;\n if (a_index == 0.0) {\n offsetX = (offset.x - halfSize.x) * cos(angle) + (offset.y - halfSize.y) * sin(angle);\n offsetY = (offset.y - halfSize.y) * cos(angle) - (offset.x - halfSize.x) * sin(angle);\n } else if (a_index == 1.0) {\n offsetX = (offset.x + halfSize.x) * cos(angle) + (offset.y - halfSize.y) * sin(angle);\n offsetY = (offset.y - halfSize.y) * cos(angle) - (offset.x + halfSize.x) * sin(angle);\n } else if (a_index == 2.0) {\n offsetX = (offset.x + halfSize.x) * cos(angle) + (offset.y + halfSize.y) * sin(angle);\n offsetY = (offset.y + halfSize.y) * cos(angle) - (offset.x + halfSize.x) * sin(angle);\n } else {\n offsetX = (offset.x - halfSize.x) * cos(angle) + (offset.y + halfSize.y) * sin(angle);\n offsetY = (offset.y + halfSize.y) * cos(angle) - (offset.x - halfSize.x) * sin(angle);\n }\n vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n vec4 texCoord = ${this.texCoordExpression};\n float u = a_index == 0.0 || a_index == 3.0 ? texCoord.s : texCoord.p;\n float v = a_index == 2.0 || a_index == 3.0 ? texCoord.t : texCoord.q;\n v_texCoord = vec2(u, v);\n u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;\n v = a_index == 2.0 || a_index == 3.0 ? 0.0 : 1.0;\n v_quadCoord = vec2(u, v);\n${n.map((function(t){return" "+t.name+" = "+t.expression+";"})).join("\n")}\n}`}getSymbolFragmentShader(t){const e=t?" if (gl_FragColor.a < 0.1) { discard; } gl_FragColor = v_hitColor;":"";let i=this.varyings;return t&&(i=i.concat({name:"v_hitColor",type:"vec4",expression:"a_hitColor"})),`precision mediump float;\nuniform float u_time;\nuniform float u_zoom;\nuniform float u_resolution;\n${this.uniforms.map((function(t){return"uniform "+t+";"})).join("\n")}\nvarying vec2 v_texCoord;\nvarying vec2 v_quadCoord;\n${i.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\nvoid main(void) {\n if (${this.discardExpression}) { discard; }\n gl_FragColor = ${this.colorExpression};\n gl_FragColor.rgb *= gl_FragColor.a;\n${e}\n}`}}function vc(t){const e=t.symbol,i=void 0!==e.size?e.size:1,n=e.color||"white",s=e.textureCoord||[0,0,1,1],r=e.offset||[0,0],o=void 0!==e.opacity?e.opacity:1,h=void 0!==e.rotation?e.rotation:0,a={inFragmentShader:!1,variables:[],attributes:[],stringLiteralsMap:{},functions:{}},u=tc(a,i,Bl|jl),l=tc(a,r,Bl),c=tc(a,s,Bl),f=tc(a,h,jl),d={inFragmentShader:!0,variables:a.variables,attributes:[],stringLiteralsMap:a.stringLiteralsMap,functions:{}},p=tc(d,n,Ul),m=tc(d,o,jl);let v="1.0";const g=`vec2(${tc(d,i,Bl|jl)}).x`;switch(e.symbolType){case"square":case"image":break;case"circle":v=`(1.0-smoothstep(1.-4./${g},1.,dot(v_quadCoord-.5,v_quadCoord-.5)*4.))`;break;case"triangle":const t="(v_quadCoord*2.-1.)",i=`(atan(${t}.x,${t}.y))`;v=`(1.0-smoothstep(.5-3./${g},.5,cos(floor(.5+${i}/2.094395102)*2.094395102-${i})*length(${t})))`;break;default:throw new Error("Unexpected symbol type: "+e.symbolType)}const y=(new mc).setSizeExpression(`vec2(${u})`).setRotationExpression(f).setSymbolOffsetExpression(l).setTextureCoordinateExpression(c).setSymbolRotateWithView(!!e.rotateWithView).setColorExpression(`vec4(${p}.rgb, ${p}.a * ${m} * ${v})`);if(t.filter){const e=tc(d,t.filter,$l);y.setFragmentDiscardExpression(`!${e}`)}const w={};if(d.variables.forEach((function(e){const i=lc(e);y.addUniform(`float ${i}`),w[i]=function(){if(!t.variables||void 0===t.variables[e])throw new Error(`The following variable is missing from the style: ${e}`);let i=t.variables[e];return"string"==typeof i&&(i=Jl(a,i)),void 0!==i?i:-9999999}})),"image"===e.symbolType&&e.src){const t=new Image;t.crossOrigin=void 0===e.crossOrigin?"anonymous":e.crossOrigin,t.src=e.src,y.addUniform("sampler2D u_texture").setColorExpression(y.getColorExpression()+" * texture2D(u_texture, v_texCoord)"),w.u_texture=t}return d.attributes.forEach((function(t){a.attributes.includes(t)||a.attributes.push(t),y.addVarying(`v_${t}`,"float",`a_${t}`)})),a.attributes.forEach((function(t){y.addAttribute(`float a_${t}`)})),{builder:y,attributes:a.attributes.map((function(t){return{name:t,callback:function(e,i){let n=i[t];return"string"==typeof n&&(n=Jl(a,n)),void 0!==n?n:-9999999}}})),uniforms:w}}class gc extends eu{constructor(t){super({extent:t.extent,origin:t.origin,origins:t.origins,resolutions:t.resolutions,tileSize:t.tileSize,tileSizes:t.tileSizes,sizes:t.sizes}),this.rh=t.matrixIds}getMatrixId(t){return this.rh[t]}getMatrixIds(){return this.rh}}var yc=gc;function wc(t,e,i){const n=[],s=[],r=[],o=[],h=[];i=void 0!==i?i:[];const a=Yi(t.SupportedCRS),u=a.getMetersPerUnit(),l="ne"==a.getAxisOrientation().substr(0,2);return t.TileMatrix.sort((function(t,e){return e.ScaleDenominator-t.ScaleDenominator})),t.TileMatrix.forEach((function(e){let a;if(a=!(i.length>0)||i.find((function(i){return e.Identifier==i.TileMatrix||!e.Identifier.includes(":")&&t.Identifier+":"+e.Identifier===i.TileMatrix})),a){s.push(e.Identifier);const t=28e-5*e.ScaleDenominator/u,i=e.TileWidth,a=e.TileHeight;l?r.push([e.TopLeftCorner[1],e.TopLeftCorner[0]]):r.push(e.TopLeftCorner),n.push(t),o.push(i==a?i:[i,a]),h.push([e.MatrixWidth,e.MatrixHeight])}})),new gc({extent:e,origins:r,resolutions:n,matrixIds:s,tileSizes:o,sizes:h})}class xc{constructor(t){this.oh=t.opacity,this.hh=t.rotateWithView,this.Ji=t.rotation,this.ah=t.scale,this.uh=ia(t.scale),this.lh=t.displacement,this.fh=t.declutterMode}clone(){const t=this.getScale();return new xc({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.oh}getRotateWithView(){return this.hh}getRotation(){return this.Ji}getScale(){return this.ah}getScaleArray(){return this.uh}getDisplacement(){return this.lh}getDeclutterMode(){return this.fh}getAnchor(){return t()}getImage(e){return t()}getHitDetectionImage(){return t()}getPixelRatio(t){return 1}getImageState(){return t()}getImageSize(){return t()}getOrigin(){return t()}getSize(){return t()}setDisplacement(t){this.lh=t}setOpacity(t){this.oh=t}setRotateWithView(t){this.hh=t}setRotation(t){this.Ji=t}setScale(t){this.ah=t,this.uh=ia(t)}listenImageChange(e){t()}load(){t()}unlistenImageChange(e){t()}}var bc=xc;class Mc extends bc{constructor(t){super({opacity:1,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,rotation:void 0!==t.rotation?t.rotation:0,scale:void 0!==t.scale?t.scale:1,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode}),this.$t=void 0,this.dh=null,this.ph=void 0!==t.fill?t.fill:null,this.Pr=[0,0],this.Wt=t.points,this.mh=void 0!==t.radius?t.radius:t.radius1,this.gh=t.radius2,this.Ht=void 0!==t.angle?t.angle:0,this.yh=void 0!==t.stroke?t.stroke:null,this.V=null,this.wh=null,this.render()}clone(){const t=this.getScale(),e=new Mc({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.V;if(!t)return null;const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.Ht}getFill(){return this.ph}setFill(t){this.ph=t,this.render()}getHitDetectionImage(){return this.dh||this.xh(this.wh),this.dh}getImage(t){let e=this.$t[t];if(!e){const i=this.wh,n=Ys(i.size*t,i.size*t);this.bh(i,n,t),e=n.canvas,this.$t[t]=e}return e}getPixelRatio(t){return t}getImageSize(){return this.V}getImageState(){return Ds}getOrigin(){return this.Pr}getPoints(){return this.Wt}getRadius(){return this.mh}getRadius2(){return this.gh}getSize(){return this.V}getStroke(){return this.yh}setStroke(t){this.yh=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}Mh(t,e,i){if(0===e||this.Wt===1/0||"bevel"!==t&&"miter"!==t)return e;let n=this.mh,s=void 0===this.gh?n:this.gh;if(n0,6);const a=void 0!==t.src?Gs:Ds;this._h=void 0!==t.color?hr(t.color):null,this.Gh=Ic(o,h,void 0!==this.zh?this.zh:null,this.qt,a,this._h),this.jh=void 0!==t.offset?t.offset:[0,0],this.Dh=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.Pr=null,this.V=void 0!==t.size?t.size:null}clone(){const t=this.getScale();return new kc({anchor:this.zn.slice(),anchorOrigin:this.Lh,anchorXUnits:this.Nh,anchorYUnits:this.Oh,color:this._h&&this._h.slice?this._h.slice():this._h||void 0,crossOrigin:this.qt,imgSize:this.zh,offset:this.jh.slice(),offsetOrigin:this.Dh,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:Array.isArray(t)?t.slice():t,size:null!==this.V?this.V.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.Rh;if(!t){t=this.zn;const e=this.getSize();if("fraction"==this.Nh||"fraction"==this.Oh){if(!e)return null;t=this.zn.slice(),"fraction"==this.Nh&&(t[0]*=e[0]),"fraction"==this.Oh&&(t[1]*=e[1])}if("top-left"!=this.Lh){if(!e)return null;t===this.zn&&(t=this.zn.slice()),"top-right"!=this.Lh&&"bottom-right"!=this.Lh||(t[0]=-t[0]+e[0]),"bottom-left"!=this.Lh&&"bottom-right"!=this.Lh||(t[1]=-t[1]+e[1])}this.Rh=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.zn=t,this.Rh=null}getColor(){return this._h}getImage(t){return this.Gh.getImage(t)}getPixelRatio(t){return this.Gh.getPixelRatio(t)}getImageSize(){return this.Gh.getSize()}getImageState(){return this.Gh.getImageState()}getHitDetectionImage(){return this.Gh.getHitDetectionImage()}getOrigin(){if(this.Pr)return this.Pr;let t=this.jh;if("top-left"!=this.Dh){const e=this.getSize(),i=this.Gh.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.Dh&&"bottom-right"!=this.Dh||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.Dh&&"bottom-right"!=this.Dh||(t[1]=i[1]-e[1]-t[1])}return this.Pr=t,this.Pr}getSrc(){return this.Gh.getSrc()}getSize(){return this.V?this.V:this.Gh.getSize()}listenImageChange(t){this.Gh.addEventListener(T,t)}load(){this.Gh.load()}unlistenImageChange(t){this.Gh.removeEventListener(T,t)}}var Rc=kc;class Lc{constructor(t){t=t||{},this._h=void 0!==t.color?t.color:null,this.Uh=t.lineCap,this.$h=void 0!==t.lineDash?t.lineDash:null,this.Bh=t.lineDashOffset,this.qh=t.lineJoin,this.Xh=t.miterLimit,this.Yh=t.width}clone(){const t=this.getColor();return new Lc({color:Array.isArray(t)?t.slice():t||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._h}getLineCap(){return this.Uh}getLineDash(){return this.$h}getLineDashOffset(){return this.Bh}getLineJoin(){return this.qh}getMiterLimit(){return this.Xh}getWidth(){return this.Yh}setColor(t){this._h=t}setLineCap(t){this.Uh=t}setLineDash(t){this.$h=t}setLineDashOffset(t){this.Bh=t}setLineJoin(t){this.qh=t}setMiterLimit(t){this.Xh=t}setWidth(t){this.Yh=t}}var Nc=Lc;class Oc{constructor(t){t=t||{},this.dn=null,this.Zh=Uc,void 0!==t.geometry&&this.setGeometry(t.geometry),this.ph=void 0!==t.fill?t.fill:null,this.Ot=void 0!==t.image?t.image:null,this.he=void 0!==t.renderer?t.renderer:null,this.Vh=void 0!==t.hitDetectionRenderer?t.hitDetectionRenderer:null,this.yh=void 0!==t.stroke?t.stroke:null,this.nr=void 0!==t.text?t.text:null,this.Wh=t.zIndex}clone(){let t=this.getGeometry();return t&&"object"==typeof t&&(t=t.clone()),new Oc({geometry:t,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer(),stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.he}setRenderer(t){this.he=t}setHitDetectionRenderer(t){this.Vh=t}getHitDetectionRenderer(){return this.Vh}getGeometry(){return this.dn}getGeometryFunction(){return this.Zh}getFill(){return this.ph}setFill(t){this.ph=t}getImage(){return this.Ot}setImage(t){this.Ot=t}getStroke(){return this.yh}setStroke(t){this.yh=t}getText(){return this.nr}setText(t){this.nr=t}getZIndex(){return this.Wh}setGeometry(t){"function"==typeof t?this.Zh=t:"string"==typeof t?this.Zh=function(e){return e.get(t)}:t?void 0!==t&&(this.Zh=function(){return t}):this.Zh=Uc,this.dn=t}setZIndex(t){this.Wh=t}}function zc(t){let e;if("function"==typeof t)e=t;else{let i;if(Array.isArray(t))i=t;else{ct("function"==typeof t.getZIndex,41);i=[t]}e=function(){return i}}return e}let Gc=null;function jc(t,e){if(!Gc){const t=new Tc({color:"rgba(255,255,255,0.4)"}),e=new Nc({color:"#3399CC",width:1.25});Gc=[new Oc({image:new _c({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return Gc}function Dc(){const t={},e=[255,255,255,1],i=[0,153,255,1];return t.Polygon=[new Oc({fill:new Tc({color:[255,255,255,.5]})})],t.MultiPolygon=t.Polygon,t.LineString=[new Oc({stroke:new Nc({color:e,width:5})}),new Oc({stroke:new Nc({color:i,width:3})})],t.MultiLineString=t.LineString,t.Circle=t.Polygon.concat(t.LineString),t.Point=[new Oc({image:new _c({radius:6,fill:new Tc({color:i}),stroke:new Nc({color:e,width:1.5})}),zIndex:1/0})],t.MultiPoint=t.Point,t.GeometryCollection=t.Polygon.concat(t.LineString,t.Point),t}function Uc(t){return t.getGeometry()}var $c=Oc;class Bc{constructor(t){t=t||{},this.Hh=t.font,this.Ji=t.rotation,this.hh=t.rotateWithView,this.ah=t.scale,this.uh=ia(void 0!==t.scale?t.scale:1),this.nr=t.text,this.Kh=t.textAlign,this.Jh=t.justify,this.Qh=t.textBaseline,this.ph=void 0!==t.fill?t.fill:new Tc({color:"#333"}),this.ta=void 0!==t.maxAngle?t.maxAngle:Math.PI/4,this.ea=void 0!==t.placement?t.placement:"point",this.ia=!!t.overflow,this.yh=void 0!==t.stroke?t.stroke:null,this.na=void 0!==t.offsetX?t.offsetX:0,this.sa=void 0!==t.offsetY?t.offsetY:0,this.ra=t.backgroundFill?t.backgroundFill:null,this.oa=t.backgroundStroke?t.backgroundStroke:null,this.Ti=void 0===t.padding?null:t.padding}clone(){const t=this.getScale();return new Bc({font:this.getFont(),placement:this.getPlacement(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,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})}getOverflow(){return this.ia}getFont(){return this.Hh}getMaxAngle(){return this.ta}getPlacement(){return this.ea}getOffsetX(){return this.na}getOffsetY(){return this.sa}getFill(){return this.ph}getRotateWithView(){return this.hh}getRotation(){return this.Ji}getScale(){return this.ah}getScaleArray(){return this.uh}getStroke(){return this.yh}getText(){return this.nr}getTextAlign(){return this.Kh}getJustify(){return this.Jh}getTextBaseline(){return this.Qh}getBackgroundFill(){return this.ra}getBackgroundStroke(){return this.oa}getPadding(){return this.Ti}setOverflow(t){this.ia=t}setFont(t){this.Hh=t}setMaxAngle(t){this.ta=t}setOffsetX(t){this.na=t}setOffsetY(t){this.sa=t}setPlacement(t){this.ea=t}setRotateWithView(t){this.hh=t}setFill(t){this.ph=t}setRotation(t){this.Ji=t}setScale(t){this.ah=t,this.uh=ia(void 0!==t?t:1)}setStroke(t){this.yh=t}setText(t){this.nr=t}setTextAlign(t){this.Kh=t}setJustify(t){this.Jh=t}setTextBaseline(t){this.Qh=t}setBackgroundFill(t){this.ra=t}setBackgroundStroke(t){this.oa=t}setPadding(t){this.Ti=t}}var qc=Bc;function Xc(t){return new $c({fill:Yc(t,""),stroke:Zc(t,""),text:Vc(t),image:Wc(t)})}function Yc(t,e){const i=t[e+"fill-color"];if(i)return new Tc({color:i})}function Zc(t,e){const i=t[e+"stroke-width"],n=t[e+"stroke-color"];if(i||n)return new Nc({width:i,color:n,lineCap:t[e+"stroke-line-cap"],lineJoin:t[e+"stroke-line-join"],lineDash:t[e+"stroke-line-dash"],lineDashOffset:t[e+"stroke-line-dash-offset"],miterLimit:t[e+"stroke-miter-limit"]})}function Vc(t){const e=t["text-value"];if(!e)return;return new qc({text:e,font:t["text-font"],maxAngle:t["text-max-angle"],offsetX:t["text-offset-x"],offsetY:t["text-offset-y"],overflow:t["text-overflow"],placement:t["text-placement"],scale:t["text-scale"],rotateWithView:t["text-rotate-with-view"],rotation:t["text-rotation"],textAlign:t["text-align"],justify:t["text-justify"],textBaseline:t["text-baseline"],padding:t["text-padding"],fill:Yc(t,"text-"),backgroundFill:Yc(t,"text-background-"),stroke:Zc(t,"text-"),backgroundStroke:Zc(t,"text-background-")})}function Wc(t){const e=t["icon-src"],i=t["icon-img"];if(e||i){return new Rc({src:e,img:i,imgSize:t["icon-img-size"],anchor:t["icon-anchor"],anchorOrigin:t["icon-anchor-origin"],anchorXUnits:t["icon-anchor-x-units"],anchorYUnits:t["icon-anchor-y-units"],color:t["icon-color"],crossOrigin:t["icon-cross-origin"],offset:t["icon-offset"],displacement:t["icon-displacement"],opacity:t["icon-opacity"],scale:t["icon-scale"],rotation:t["icon-rotation"],rotateWithView:t["icon-rotate-with-view"],size:t["icon-size"],declutterMode:t["icon-declutter-mode"]})}const n=t["shape-points"];if(n){const e="shape-";return new Sc({points:n,fill:Yc(t,e),stroke:Zc(t,e),radius:t["shape-radius"],radius1:t["shape-radius1"],radius2:t["shape-radius2"],angle:t["shape-angle"],displacement:t["shape-displacement"],rotation:t["shape-rotation"],rotateWithView:t["shape-rotate-with-view"],scale:t["shape-scale"],declutterMode:t["shape-declutter-mode"]})}const s=t["circle-radius"];if(s){const e="circle-";return new _c({radius:s,fill:Yc(t,e),stroke:Zc(t,e),displacement:t["circle-displacement"],scale:t["circle-scale"],rotation:t["circle-rotation"],rotateWithView:t["circle-rotate-with-view"],declutterMode:t["circle-declutter-mode"]})}}var Hc=class{constructor(t){this.ha,this.aa,this.ua,this.la=void 0===t||t,this.ca=0}insertItem(t){const e={prev:void 0,next:void 0,data:t},i=this.ua;if(i){const t=i.next;e.prev=i,e.next=t,i.next=e,t&&(t.prev=e),i===this.aa&&(this.aa=e)}else this.ha=e,this.aa=e,this.la&&(e.next=e,e.prev=e);this.ua=e,this.ca++}removeItem(){const t=this.ua;if(t){const e=t.next,i=t.prev;e&&(e.prev=i),i&&(i.next=e),this.ua=e||i,this.ha===this.aa?(this.ua=void 0,this.ha=void 0,this.aa=void 0):this.ha===t?this.ha=this.ua:this.aa===t&&(this.aa=i?this.ua.prev:this.ua),this.ca--}}firstItem(){if(this.ua=this.ha,this.ua)return this.ua.data}lastItem(){if(this.ua=this.aa,this.ua)return this.ua.data}nextItem(){if(this.ua&&this.ua.next)return this.ua=this.ua.next,this.ua.data}getNextItem(){if(this.ua&&this.ua.next)return this.ua.next.data}prevItem(){if(this.ua&&this.ua.prev)return this.ua=this.ua.prev,this.ua.data}getPrevItem(){if(this.ua&&this.ua.prev)return this.ua.prev.data}getCurrItem(){if(this.ua)return this.ua.data}setFirstItem(){this.la&&this.ua&&(this.ha=this.ua,this.aa=this.ua.prev)}concat(t){if(t.ua){if(this.ua){const e=this.ua.next;this.ua.next=t.ha,t.ha.prev=this.ua,e.prev=t.aa,t.aa.next=e,this.ca+=t.ca}else this.ua=t.ua,this.ha=t.ha,this.aa=t.aa,this.ca=t.ca;t.ua=void 0,t.ha=void 0,t.aa=void 0,t.ca=0}}getLength(){return this.ca}},Kc=n(582);var Jc=class{constructor(t){this.fa=new Kc(t),this.da={}}insert(t,e){const n={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.fa.insert(n),this.da[i(e)]=n}load(t,e){const n=new Array(e.length);for(let s=0,r=e.length;si.highWaterMark&&(i.highWaterMark=t)}useTile(t,e,i,n){}};class hf extends of{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.Ma=this.tileUrlFunction===hf.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.Sa={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,n=i(e),s=e.getState();let r;s==et?(this.Sa[n]=!0,r=Qc):n in this.Sa&&(delete this.Sa[n],r=s==nt?ef:s==it?tf:void 0),null!=r&&this.dispatchEvent(new rf(r,e))}setTileLoadFunction(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),void 0!==e?this.setKey(e):this.changed()}setUrl(t){const e=du(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.Ma?this.setTileUrlFunction(lu(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}useTile(t,e,i){const n=pa(t,e,i);this.tileCache.containsKey(n)&&this.tileCache.get(n)}}var af=hf;function uf(t,e){t.getImage().src=e}var lf=class extends af{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:uf,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:void 0===t.interpolate||t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=void 0!==t.crossOrigin?t.crossOrigin:null,this.tileClass=void 0!==t.tileClass?t.tileClass:tr,this.tileCacheForProjection={},this.tileGridForProjection={},this.Pa=t.reprojectionErrorThreshold,this._a=!1}canExpireCache(){if(this.tileCache.canExpireCache())return!0;for(const t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1}expireCache(t,e){const i=this.getTileCacheForProjection(t);this.tileCache.expireCache(this.tileCache==i?e:{});for(const t in this.tileCacheForProjection){const n=this.tileCacheForProjection[t];n.expireCache(n==i?e:{})}}getGutterForProjection(t){return this.getProjection()&&t&&!tn(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getOpaque(t){return!(this.getProjection()&&t&&!tn(this.getProjection(),t))&&super.getOpaque(t)}getTileGridForProjection(t){const e=this.getProjection();if(!this.tileGrid||e&&!tn(e,t)){const e=i(t);return e in this.tileGridForProjection||(this.tileGridForProjection[e]=iu(t)),this.tileGridForProjection[e]}return this.tileGrid}getTileCacheForProjection(t){const e=this.getProjection();if(!e||tn(e,t))return this.tileCache;{const e=i(t);return e in this.tileCacheForProjection||(this.tileCacheForProjection[e]=new xa(this.tileCache.highWaterMark)),this.tileCacheForProjection[e]}}Ea(t,e,i,n,s,r){const o=[t,e,i],h=this.getTileCoordForTileUrlFunction(o,s),a=h?this.tileUrlFunction(h,n,s):void 0,u=new this.tileClass(o,void 0!==a?tt:st,void 0!==a?a:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return u.key=r,u.addEventListener(T,this.handleTileChange.bind(this)),u}getTile(t,e,i,n,s){const r=this.getProjection();if(r&&s&&!tn(r,s)){const o=this.getTileCacheForProjection(s),h=[t,e,i];let a;const u=ma(h);o.containsKey(u)&&(a=o.get(u));const l=this.getKey();if(a&&a.key==l)return a;{const t=this.getTileGridForProjection(r),e=this.getTileGridForProjection(s),i=this.getTileCoordForTileUrlFunction(h,s),c=new Ml(r,t,s,e,h,i,this.getTilePixelRatio(n),this.getGutter(),function(t,e,i,n){return this.getTileInternal(t,e,i,n,r)}.bind(this),this.Pa,this._a,this.getInterpolate());return c.key=l,a?(c.interimTile=a,c.refreshInterimChain(),o.replace(u,c)):o.set(u,c),c}}return this.getTileInternal(t,e,i,n,r||s)}getTileInternal(t,e,i,n,s){let r=null;const o=pa(t,e,i),h=this.getKey();if(this.tileCache.containsKey(o)){if(r=this.tileCache.get(o),r.key!=h){const a=r;r=this.Ea(t,e,i,n,s,h),a.getState()==tt?r.interimTile=a.interimTile:r.interimTile=a,r.refreshInterimChain(),this.tileCache.replace(o,r)}}else r=this.Ea(t,e,i,n,s,h),this.tileCache.set(o,r);return r}setRenderReprojectionEdges(t){if(this._a!=t){this._a=t;for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear();this.changed()}}setTileGridForProjection(t,e){const n=Yi(t);if(n){const t=i(n);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}clear(){super.clear();for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear()}};function cf(t){const e=t[0],i=new Array(e);let n,s,r=1<>=1;return i.join("")}var ff=class extends lf{constructor(t){const e=void 0!==t.hidpi&&t.hidpi;super({cacheSize:t.cacheSize,crossOrigin:"anonymous",interpolate:t.interpolate,opaque:!0,projection:Yi("EPSG:3857"),reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,tilePixelRatio:e?2:1,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.Ta=e,this.Ca=void 0!==t.culture?t.culture:"en-us",this.Fa=void 0!==t.maxZoom?t.maxZoom:-1,this.Ia=t.key,this.Aa=t.imagerySet;Ra("https://dev.virtualearth.net/REST/v1/Imagery/Metadata/"+this.Aa+"?uriScheme=https&include=ImageryProviders&key="+this.Ia+"&c="+this.Ca,this.handleImageryMetadataResponse.bind(this),void 0,"jsonp")}getApiKey(){return this.Ia}getImagerySet(){return this.Aa}handleImageryMetadataResponse(t){if(200!=t.statusCode||"OK"!=t.statusDescription||"ValidCredentials"!=t.authenticationResultCode||1!=t.resourceSets.length||1!=t.resourceSets[0].resources.length)return void this.setState("error");const e=t.resourceSets[0].resources[0],i=-1==this.Fa?e.zoomMax:this.Fa,n=au(this.getProjection()),s=this.Ta?2:1,r=e.imageWidth==e.imageHeight?e.imageWidth/s:[e.imageWidth/s,e.imageHeight/s],o=ru({extent:n,minZoom:e.zoomMin,maxZoom:i,tileSize:r});this.tileGrid=o;const h=this.Ca,a=this.Ta;if(this.tileUrlFunction=cu(e.imageUrlSubdomains.map((function(t){const i=[0,0,0],n=e.imageUrl.replace("{subdomain}",t).replace("{culture}",h);return function(t,e,s){if(t){da(t[0],t[1],t[2],i);let e=n;return a&&(e+="&dpi=d1&device=mobile"),e.replace("{quadkey}",cf(i))}}}))),e.imageryProviders){const t=en(Yi("EPSG:4326"),this.getProjection());this.setAttributions(function(i){const n=[],s=i.viewState,r=this.getTileGrid(),o=r.getZForResolution(s.resolution,this.zDirection),h=r.getTileCoordForCoordAndZ(s.center,o)[0];return e.imageryProviders.map((function(e){let s=!1;const r=e.coverageAreas;for(let e=0,n=r.length;e=n.zoomMin&&h<=n.zoomMax){const e=n.bbox;if(Te(ke([e[1],e[0],e[3],e[2]],t),i.extent)){s=!0;break}}}s&&n.push(e.attribution)})),n.push('Terms of Use '),n}.bind(this))}this.setState("ready")}};var df=class extends lf{constructor(t){const e=void 0!==(t=t||{}).projection?t.projection:"EPSG:3857",i=void 0!==t.tileGrid?t.tileGrid:ru({extent:au(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,opaque:t.opaque,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.To=void 0!==t.gutter?t.gutter:0}getGutter(){return this.To}};var pf=class extends df{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,maxZoom:void 0!==t.maxZoom?t.maxZoom:18,minZoom:t.minZoom,projection:t.projection,transition:t.transition,wrapX:t.wrapX,zDirection:t.zDirection}),this.ka=t.account,this.Ra=t.map||"",this.La=t.config||{},this.Na={},this.Oa()}getConfig(){return this.La}updateConfig(t){Object.assign(this.La,t),this.Oa()}setConfig(t){this.La=t||{},this.Oa()}Oa(){const t=JSON.stringify(this.La);if(this.Na[t])return void this.za(this.Na[t]);let e="https://"+this.ka+".carto.com/api/v1/map";this.Ra&&(e+="/named/"+this.Ra);const i=new XMLHttpRequest;i.addEventListener("load",this.Ga.bind(this,t)),i.addEventListener("error",this.ja.bind(this)),i.open("POST",e),i.setRequestHeader("Content-type","application/json"),i.send(JSON.stringify(this.La))}Ga(t,e){const i=e.target;if(!i.status||i.status>=200&&i.status<300){let e;try{e=JSON.parse(i.responseText)}catch(t){return void this.setState("error")}this.za(e),this.Na[t]=e,this.setState("ready")}else this.setState("error")}ja(t){this.setState("error")}za(t){const e="https://"+t.cdn_url.https+"/"+this.ka+"/api/v1/map/"+t.layergroupid+"/{z}/{x}/{y}.png";this.setUrl(e)}},mf="addfeature",vf="changefeature",gf="clear",yf="removefeature",wf="featuresloadstart",xf="featuresloadend",bf="featuresloaderror";class Mf extends u{constructor(t,e,i){super(t),this.feature=e,this.features=i}}var Sf=class extends sf{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.on,this.once,this.un,this.$=b,this.Os=t.format,this.Da=void 0===t.overlaps||t.overlaps,this.Gs=t.url,void 0!==t.loader?this.$=t.loader:void 0!==this.Gs&&(ct(this.Os,7),this.$=Aa(this.Gs,this.Os)),this.Ua=void 0!==t.strategy?t.strategy:ka;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,n;this.$a=e?new Jc:null,this.Ba=new Jc,this.qa=0,this.Xa={},this.Ya={},this.Za={},this.Va={},this.Wa=null,Array.isArray(t.features)?n=t.features:t.features&&(i=t.features,n=i.getArray()),e||void 0!==i||(i=new Q(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==i&&this.Ha(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=i(t);if(!this.Ka(e,t))return void(this.Wa&&this.Wa.remove(t));this.Ja(e,t);const n=t.getGeometry();if(n){const e=n.getExtent();this.$a&&this.$a.insert(e,t)}else this.Xa[e]=t;this.dispatchEvent(new Mf(mf,t))}Ja(t,e){this.Va[t]=[U(e,T,this.Qa,this),U(e,l,this.Qa,this)]}Ka(t,e){let i=!0;const n=e.getId();return void 0!==n&&(n.toString()in this.Ya?i=!1:this.Ya[n.toString()]=e),i&&(ct(!(t in this.Za),30),this.Za[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],n=[],s=[];for(let e=0,s=t.length;ethis.$a.getInExtent(t))))}return this.Wa?this.Wa.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let s=null;const r=[NaN,NaN];let o=1/0;const h=[-1/0,-1/0,1/0,1/0];return e=e||w,this.$a.forEachInExtent(h,(function(t){if(e(t)){const e=t.getGeometry(),a=o;if(o=e.closestPointXY(i,n,r,o),o0}refresh(){this.clear(!0),this.Ba.clear(),super.refresh()}removeLoadedExtent(t){const e=this.Ba;let i;e.forEachInExtent(t,(function(e){if(oe(e.extent,t))return i=e,!0})),i&&e.remove(i)}removeFeature(t){if(!t)return;const e=i(t);e in this.Xa?delete this.Xa[e]:this.$a&&this.$a.remove(t);this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=i(t),n=this.Va[e];if(!n)return;n.forEach(B),delete this.Va[e];const s=t.getId();return void 0!==s&&delete this.Ya[s.toString()],delete this.Za[e],this.dispatchEvent(new Mf(yf,t)),t}tu(t){let e=!1;for(const i in this.Ya)if(this.Ya[i]===t){delete this.Ya[i],e=!0;break}return e}setLoader(t){this.$=t}setUrl(t){ct(this.Os,7),this.Gs=t,this.setLoader(Aa(t,this.Os))}};var Pf=class extends Sf{constructor(t){super({attributions:t.attributions,wrapX:t.wrapX}),this.resolution=void 0,this.distance=void 0!==t.distance?t.distance:20,this.minDistance=t.minDistance||0,this.interpolationRatio=0,this.features=[],this.geometryFunction=t.geometryFunction||function(t){const e=t.getGeometry();return ct("Point"==e.getType(),10),e},this.eu=t.createCluster,this.source=null,this.iu=this.refresh.bind(this),this.updateDistance(this.distance,this.minDistance),this.setSource(t.source||null)}clear(t){this.features.length=0,super.clear(t)}getDistance(){return this.distance}getSource(){return this.source}loadFeatures(t,e,i){this.source.loadFeatures(t,e,i),e!==this.resolution&&(this.resolution=e,this.refresh())}setDistance(t){this.updateDistance(t,this.minDistance)}setMinDistance(t){this.updateDistance(this.distance,t)}getMinDistance(){return this.minDistance}setSource(t){this.source&&this.source.removeEventListener(T,this.iu),this.source=t,t&&t.addEventListener(T,this.iu),this.refresh()}refresh(){this.clear(),this.cluster(),this.addFeatures(this.features)}updateDistance(t,e){const i=0===t?0:Math.min(e,t)/t,n=t!==this.distance||this.interpolationRatio!==i;this.distance=t,this.minDistance=e,this.interpolationRatio=i,n&&this.refresh()}cluster(){if(void 0===this.resolution||!this.source)return;const t=[1/0,1/0,-1/0,-1/0],e=this.distance*this.resolution,n=this.source.getFeatures(),s={};for(let r=0,o=n.length;r=0;--e){const n=this.geometryFunction(t[e]);n?bi(i,n.getCoordinates()):t.splice(e,1)}Ci(i,1/t.length);const n=ye(e),s=this.interpolationRatio,r=new Qn([i[0]*(1-s)+n[0]*s,i[1]*(1-s)+n[1]*s]);return this.eu?this.eu(r,t):new pt({geometry:r,features:t})}};var _f=class extends of{constructor(t){const e=void 0===t.projection?"EPSG:3857":t.projection;let i=t.tileGrid;void 0===i&&e&&(i=ru({extent:au(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize})),super({cacheSize:.1,attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:e,tileGrid:i,opaque:t.opaque,state:t.state,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate}),this.To=void 0!==t.gutter?t.gutter:0,this.Tr=t.tileSize?ia(t.tileSize):null,this.Er=null,this.Sa={},this.$=t.loader,this.gs=this.gs.bind(this),this.bandCount=void 0===t.bandCount?4:t.bandCount}setTileSizes(t){this.Er=t}getTileSize(t){if(this.Er)return this.Er[t];if(this.Tr)return this.Tr;const e=this.getTileGrid();return e?ia(e.getTileSize(t)):[256,256]}getGutterForProjection(t){return this.To}setLoader(t){this.$=t}getTile(t,e,i,n,s){const r=this.getTileSize(t),o=pa(t,e,i);if(this.tileCache.containsKey(o))return this.tileCache.get(o);const h=this.$;const a=Object.assign({tileCoord:[t,e,i],loader:function(){return S((function(){return h(t,e,i)}))},size:r},this.tileOptions),u=new lt(a);return u.key=this.getKey(),u.addEventListener(T,this.gs),this.tileCache.set(o,u),u}gs(t){const e=t.target,n=i(e),s=e.getState();let r;s==et?(this.Sa[n]=!0,r=Qc):n in this.Sa&&(delete this.Sa[n],r=s==nt?ef:s==it?tf:void 0),r&&this.dispatchEvent(new rf(r,e))}};const Ef=new Map;function Tf(t,e){Array.isArray(t)||(t=[t]),t.forEach((t=>Ef.set(t,e)))}async function Cf(t){const e=Ef.get(t.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${t.Compression}`);return new(await e())(t)}Tf([void 0,1],(()=>n.e(321).then(n.bind(n,321)).then((t=>t.default)))),Tf(5,(()=>n.e(672).then(n.bind(n,672)).then((t=>t.default)))),Tf(6,(()=>{throw new Error("old style JPEG compression is not supported.")})),Tf(7,(()=>n.e(347).then(n.bind(n,347)).then((t=>t.default)))),Tf([8,32946],(()=>Promise.all([n.e(497),n.e(522)]).then(n.bind(n,522)).then((t=>t.default)))),Tf(32773,(()=>n.e(411).then(n.bind(n,878)).then((t=>t.default)))),Tf(34887,(()=>Promise.all([n.e(497),n.e(173)]).then(n.bind(n,173)).then((t=>t.default)))),Tf(50001,(()=>n.e(588).then(n.bind(n,588)).then((t=>t.default))));const Ff="undefined"!=typeof navigator&&navigator.hardwareConcurrency||2;var If=class{constructor(t=Ff,e){this.workers=null,this._awaitingDecoder=null,this.size=t,this.messageId=0,t&&(this._awaitingDecoder=e?Promise.resolve(e):new Promise((t=>{n.e(831).then(n.bind(n,831)).then((e=>{t(e.create)}))})),this._awaitingDecoder.then((e=>{this._awaitingDecoder=null,this.workers=[];for(let i=0;ii.decode(t,e))):new Promise((i=>{const n=this.workers.find((t=>t.idle))||this.workers[Math.floor(Math.random()*this.size)];n.idle=!1;const s=this.messageId++,r=t=>{t.data.id===s&&(n.idle=!0,i(t.data.decoded),n.worker.removeEventListener("message",r))};n.worker.addEventListener("message",r),n.worker.postMessage({fileDirectory:t,buffer:e,id:s},[e])}))}destroy(){this.workers&&(this.workers.forEach((t=>{t.worker.terminate()})),this.workers=null)}};const Af=new ArrayBuffer(4),kf=new Float32Array(Af),Rf=new Uint32Array(Af),Lf=new Uint32Array(512),Nf=new Uint32Array(512);for(let t=0;t<256;++t){const e=t-127;e<-27?(Lf[t]=0,Lf[256|t]=32768,Nf[t]=24,Nf[256|t]=24):e<-14?(Lf[t]=1024>>-e-14,Lf[256|t]=1024>>-e-14|32768,Nf[t]=-e-1,Nf[256|t]=-e-1):e<=15?(Lf[t]=e+15<<10,Lf[256|t]=e+15<<10|32768,Nf[t]=13,Nf[256|t]=13):e<128?(Lf[t]=31744,Lf[256|t]=64512,Nf[t]=24,Nf[256|t]=24):(Lf[t]=31744,Lf[256|t]=64512,Nf[t]=13,Nf[256|t]=13)}const Of=new Uint32Array(2048),zf=new Uint32Array(64),Gf=new Uint32Array(64);Of[0]=0;for(let t=1;t<1024;++t){let e=t<<13,i=0;for(;0==(8388608&e);)i-=8388608,e<<=1;e&=-8388609,i+=947912704,Of[t]=e|i}for(let t=1024;t<2048;++t)Of[t]=939524096+(t-1024<<13);zf[0]=0;for(let t=1;t<31;++t)zf[t]=t<<23;zf[31]=1199570944,zf[32]=2147483648;for(let t=33;t<63;++t)zf[t]=2147483648+(t-32<<23);zf[63]=3347054592,Gf[0]=0;for(let t=1;t<64;++t)Gf[t]=32===t?0:1024;const jf=Reflect.getPrototypeOf(Uint8Array).prototype,Df=Reflect.getOwnPropertyDescriptor(jf,Symbol.toStringTag).get;function Uf(t){return void 0!==Df.call(t)}const $f=Object.prototype.toString;function Bf(t,e,...i){if(n=t,!ArrayBuffer.isView(n)||Uf(n)||"[object DataView]"!==$f.call(n))throw new TypeError("First argument to getFloat16 function must be a DataView");var n;return function(t){const e=t>>10;return Rf[0]=Of[Gf[e]+(1023&t)]+zf[e],kf[0]}(t.getUint16(e,...i))}var qf=n(330),Xf=n(602),Yf=n(499);function Zf(t,e,i,n=1){return new(Object.getPrototypeOf(t).constructor)(e*i*n)}function Vf(t,e,i){return(1-i)*t+i*e}function Wf(t,e,i,n,s,r="nearest"){switch(r.toLowerCase()){case"nearest":return function(t,e,i,n,s){const r=e/n,o=i/s;return t.map((t=>{const h=Zf(t,n,s);for(let a=0;a{const h=Zf(t,n,s);for(let a=0;a=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${t} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[t]/8)}getReaderForSample(t){const e=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[t]:1,i=this.fileDirectory.BitsPerSample[t];switch(e){case 1:if(i<=8)return DataView.prototype.getUint8;if(i<=16)return DataView.prototype.getUint16;if(i<=32)return DataView.prototype.getUint32;break;case 2:if(i<=8)return DataView.prototype.getInt8;if(i<=16)return DataView.prototype.getInt16;if(i<=32)return DataView.prototype.getInt32;break;case 3:switch(i){case 16:return function(t,e){return Bf(this,t,e)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(t=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[t]:1}getBitsPerSample(t=0){return this.fileDirectory.BitsPerSample[t]}getArrayForSample(t,e){return Jf(this.getSampleFormat(t),this.getBitsPerSample(t),e)}async getTileOrStrip(t,e,i,n,s){const r=Math.ceil(this.getWidth()/this.getTileWidth()),o=Math.ceil(this.getHeight()/this.getTileHeight());let h;const{tiles:a}=this;let u,l;1===this.planarConfiguration?h=e*r+t:2===this.planarConfiguration&&(h=i*r*o+e*r+t),this.isTiled?(u=this.fileDirectory.TileOffsets[h],l=this.fileDirectory.TileByteCounts[h]):(u=this.fileDirectory.StripOffsets[h],l=this.fileDirectory.StripByteCounts[h]);const c=(await this.source.fetch([{offset:u,length:l}],s))[0];let f;return null!==a&&a[h]?f=a[h]:(f=(async()=>{let t=await n.decode(this.fileDirectory,c);const i=this.getSampleFormat(),s=this.getBitsPerSample();return function(t,e){return(1!==t&&2!==t||!(e<=32)||e%8!=0)&&(3!==t||16!==e&&32!==e&&64!==e)}(i,s)&&(t=function(t,e,i,n,s,r,o){const h=new DataView(t),a=2===i?1:n,u=Jf(e,s,2===i?o*r:o*r*n),l=parseInt("1".repeat(s),2);if(1===e){let t;t=1===i?n*s:s;let e=r*t;0!=(7&e)&&(e=e+7&-8);for(let t=0;t>8-s-d&l;else if(d+s<=16)u[c]=h.getUint16(f)>>16-s-d&l;else if(d+s<=24){const t=h.getUint16(f)<<8|h.getUint8(f+2);u[c]=t>>24-s-d&l}else u[c]=h.getUint32(f)>>32-s-d&l}}}}return u.buffer}(t,i,this.planarConfiguration,this.getSamplesPerPixel(),s,this.getTileWidth(),this.getBlockHeight(e))),t})(),null!==a&&(a[h]=f)),{x:t,y:e,sample:i,data:await f}}async _readRaster(t,e,i,n,s,r,o,h,a){const u=this.getTileWidth(),l=this.getTileHeight(),c=this.getWidth(),f=this.getHeight(),d=Math.max(Math.floor(t[0]/u),0),p=Math.min(Math.ceil(t[2]/u),Math.ceil(c/u)),m=Math.max(Math.floor(t[1]/l),0),v=Math.min(Math.ceil(t[3]/l),Math.ceil(f/l)),g=t[2]-t[0];let y=this.getBytesPerPixel();const w=[],x=[];for(let t=0;t{const r=s.data,o=new DataView(r),h=this.getBlockHeight(s.y),a=s.y*l,p=s.x*u,m=a+h,v=(s.x+1)*u,b=x[d],S=Math.min(h,h-(m-t[3]),f-a),P=Math.min(u,u-(v-t[2]),c-p);for(let s=Math.max(0,t[1]-a);su[2]||u[1]>u[3])throw new Error("Invalid subsets");const l=(u[2]-u[0])*(u[3]-u[1]),c=this.getSamplesPerPixel();if(e&&e.length){for(let t=0;t=c)return Promise.reject(new RangeError(`Invalid sample index '${e[t]}'.`))}else for(let t=0;ta[2]||a[1]>a[3])throw new Error("Invalid subsets");const u=this.fileDirectory.PhotometricInterpretation;if(u===Yf.Ie.RGB){let a=[0,1,2];if(this.fileDirectory.ExtraSamples!==Yf.pd.Unspecified&&o){a=[];for(let t=0;t>24)/500+h,u=h-(t[e+2]<<24>>24)/200;a=.95047*(a*a*a>.008856?a*a*a:(a-16/116)/7.787),h=1*(h*h*h>.008856?h*h*h:(h-16/116)/7.787),u=1.08883*(u*u*u>.008856?u*u*u:(u-16/116)/7.787),s=3.2406*a+-1.5372*h+-.4986*u,r=-.9689*a+1.8758*h+.0415*u,o=.0557*a+-.204*h+1.057*u,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,n[i]=255*Math.max(0,Math.min(1,s)),n[i+1]=255*Math.max(0,Math.min(1,r)),n[i+2]=255*Math.max(0,Math.min(1,o))}return n}(d);break;default:throw new Error("Unsupported photometric interpretation.")}if(!e){const t=new Uint8Array(m.length/3),e=new Uint8Array(m.length/3),i=new Uint8Array(m.length/3);for(let n=0,s=0;nvoid 0===qf(t,"sample"))):n.filter((e=>Number(qf(e,"sample"))===t));for(let t=0;t0;let s=!0;for(let r=0;r<8;r++){let o=this._dataView.getUint8(t+(e?r:7-r));n&&(s?0!==o&&(o=255&~(o-1),s=!1):o=255&~o),i+=o*256**r}return n&&(i=-i),i}getUint8(t,e){return this._dataView.getUint8(t,e)}getInt8(t,e){return this._dataView.getInt8(t,e)}getUint16(t,e){return this._dataView.getUint16(t,e)}getInt16(t,e){return this._dataView.getInt16(t,e)}getUint32(t,e){return this._dataView.getUint32(t,e)}getInt32(t,e){return this._dataView.getInt32(t,e)}getFloat16(t,e){return Bf(this._dataView,t,e)}getFloat32(t,e){return this._dataView.getFloat32(t,e)}getFloat64(t,e){return this._dataView.getFloat64(t,e)}}class ed{constructor(t,e,i,n){this._dataView=new DataView(t),this._sliceOffset=e,this._littleEndian=i,this._bigTiff=n}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(t,e){return this.sliceOffset<=t&&this.sliceTop>=t+e}readUint8(t){return this._dataView.getUint8(t-this._sliceOffset,this._littleEndian)}readInt8(t){return this._dataView.getInt8(t-this._sliceOffset,this._littleEndian)}readUint16(t){return this._dataView.getUint16(t-this._sliceOffset,this._littleEndian)}readInt16(t){return this._dataView.getInt16(t-this._sliceOffset,this._littleEndian)}readUint32(t){return this._dataView.getUint32(t-this._sliceOffset,this._littleEndian)}readInt32(t){return this._dataView.getInt32(t-this._sliceOffset,this._littleEndian)}readFloat32(t){return this._dataView.getFloat32(t-this._sliceOffset,this._littleEndian)}readFloat64(t){return this._dataView.getFloat64(t-this._sliceOffset,this._littleEndian)}readUint64(t){const e=this.readUint32(t),i=this.readUint32(t+4);let n;if(this._littleEndian){if(n=e+2**32*i,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}if(n=2**32*e+i,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}readInt64(t){let e=0;const i=(128&this._dataView.getUint8(t+(this._littleEndian?7:0)))>0;let n=!0;for(let s=0;s<8;s++){let r=this._dataView.getUint8(t+(this._littleEndian?s:7-s));i&&(n?0!==r&&(r=255&~(r-1),n=!1):r=255&~r),e+=r*256**s}return i&&(e=-e),e}readOffset(t){return this._bigTiff?this.readUint64(t):this.readUint32(t)}}const id="\r\n\r\n";function nd(t){if(void 0!==Object.fromEntries)return Object.fromEntries(t);const e={};for(const[i,n]of t)e[i.toLowerCase()]=n;return e}function sd(t){const e=t.split("\r\n").map((t=>{const e=t.split(":").map((t=>t.trim()));return e[0]=e[0].toLowerCase(),e}));return nd(e)}function rd(t){let e,i,n;return t&&([,e,i,n]=t.match(/bytes (\d+)-(\d+)\/(\d+)/),e=parseInt(e,10),i=parseInt(i,10),n=parseInt(n,10)),{start:e,end:i,total:n}}class od{async fetch(t,e){return Promise.all(t.map((t=>this.fetchSlice(t,e))))}async fetchSlice(t){throw new Error(`fetching of slice ${t} not possible, not implemented`)}get fileSize(){return null}async close(){}}var hd=n(593);function ad(t,e){const i=Array.isArray(t)?t:Array.from(t),n=Array.isArray(e)?e:Array.from(e);return i.map(((t,e)=>[t,n[e]]))}class ud extends Error{constructor(t){super(t),Error.captureStackTrace&&Error.captureStackTrace(this,ud),this.name="AbortError"}}class ld extends Error{constructor(t,e){super(e),this.errors=t,this.message=e,this.name="AggregateError"}}const cd=ld;class fd{constructor(t,e,i=null){this.offset=t,this.length=e,this.data=i}get top(){return this.offset+this.length}}class dd{constructor(t,e,i){this.offset=t,this.length=e,this.blockIds=i}}class pd extends od{constructor(t,{blockSize:e=65536,cacheSize:i=100}={}){super(),this.source=t,this.blockSize=e,this.blockCache=new hd({max:i}),this.blockRequests=new Map,this.blockIdsToFetch=new Set}get fileSize(){return this.source.fileSize}async fetch(t,e){const i=new Map,n=new Map,s=new Set;for(const{offset:e,length:r}of t){let t=e+r;const{fileSize:o}=this;null!==o&&(t=Math.min(t,o));for(let r=Math.floor(e/this.blockSize)*this.blockSize;rsetTimeout(e,t)))}(),this.fetchBlocks(e);for(const t of s){const e=this.blockRequests.get(t),s=this.blockCache.get(t);if(e)n.set(t,e);else{if(!s)throw new Error(`Block ${t} is not in the block requests`);i.set(t,s)}}let r=await Promise.allSettled(Array.from(n.values()));if(r.some((t=>"rejected"===t.status))){const t=new Set;for(const[i,s]of ad(n.keys(),r)){const{rejected:n,reason:r}=s;n&&"AbortError"===r.name&&r.signal!==e&&(this.blockIdsToFetch.add(i),t.add(i))}if(this.blockIdsToFetch.length>0){this.fetchBlocks(e);for(const e of t){const t=this.blockRequests.get(e);if(!t)throw new Error(`Block ${e} is not in the block requests`);n.set(e,t)}r=await Promise.allSettled(Array.from(n.values()))}}if(r.some((t=>"rejected"===t.status))){if(e&&e.aborted)throw new ud("Request was aborted");throw new cd(r.filter((t=>"rejected"===t.status)).map((t=>t.reason)),"Request failed")}const o=r.map((t=>t.value)),h=new Map(ad(Array.from(n.keys()),o));for(const[t,e]of i)h.set(t,e);return this.readSliceData(t,h)}fetchBlocks(t){if(this.blockIdsToFetch.size>0){const e=this.groupBlocks(this.blockIdsToFetch),i=this.source.fetch(e,t);for(let n=0;n{try{const t=(await i)[n],s=e*this.blockSize,r=s-t.offset,o=Math.min(r+this.blockSize,t.data.byteLength),h=t.data.slice(r,o),a=new fd(s,h.byteLength,h);return this.blockCache.set(e,a),a}catch(e){throw"AbortError"===e.name&&(e.signal=t),e}finally{this.blockRequests.delete(e)}})();this.blockRequests.set(e,s)}}this.blockIdsToFetch.clear()}}groupBlocks(t){const e=Array.from(t).sort(((t,e)=>t-e));if(0===e.length)return[];let i=[],n=null;const s=[];for(const t of e)null===n||n+1===t?(i.push(t),n=t):(s.push(new dd(i[0]*this.blockSize,i.length*this.blockSize,i)),i=[t],n=t);return s.push(new dd(i[0]*this.blockSize,i.length*this.blockSize,i)),s}readSliceData(t,e){return t.map((t=>{const i=t.offset+t.length,n=Math.floor(t.offset/this.blockSize),s=Math.floor((t.offset+t.length)/this.blockSize),r=new ArrayBuffer(t.length),o=new Uint8Array(r);for(let r=n;r<=s;++r){const n=e.get(r),s=n.offset-t.offset,h=n.top-i;let a,u=0,l=0;s<0?u=-s:s>0&&(l=s),a=h<0?n.length-u:i-n.offset-u;const c=new Uint8Array(n.data,u,a);o.set(c,l)}return r}))}}class md{get ok(){return this.status>=200&&this.status<=299}get status(){throw new Error("not implemented")}getHeader(t){throw new Error("not implemented")}async getData(){throw new Error("not implemented")}}class vd{constructor(t){this.url=t}async request({headers:t,credentials:e,signal:i}={}){throw new Error("request is not implemented")}}class gd extends md{constructor(t){super(),this.response=t}get status(){return this.response.status}getHeader(t){return this.response.headers.get(t)}async getData(){return this.response.arrayBuffer?await this.response.arrayBuffer():(await this.response.buffer()).buffer}}class yd extends vd{constructor(t,e){super(t),this.credentials=e}async request({headers:t,credentials:e,signal:i}={}){const n=await fetch(this.url,{headers:t,credentials:e,signal:i});return new gd(n)}}class wd extends md{constructor(t,e){super(),this.xhr=t,this.data=e}get status(){return this.xhr.status}getHeader(t){return this.xhr.getResponseHeader(t)}async getData(){return this.data}}class xd extends vd{constructRequest(t,e){return new Promise(((i,n)=>{const s=new XMLHttpRequest;s.open("GET",this.url),s.responseType="arraybuffer";for(const[e,i]of Object.entries(t))s.setRequestHeader(e,i);s.onload=()=>{const t=s.response;i(new wd(s,t))},s.onerror=n,s.onabort=()=>n(new ud("Request aborted")),s.send(),e&&(e.aborted&&s.abort(),e.addEventListener("abort",(()=>s.abort())))}))}async request({headers:t,signal:e}={}){return await this.constructRequest(t,e)}}var bd=n(752),Md=n(640),Sd=n(630);class Pd extends md{constructor(t,e){super(),this.response=t,this.dataPromise=e}get status(){return this.response.statusCode}getHeader(t){return this.response.headers[t]}async getData(){return await this.dataPromise}}class _d extends vd{constructor(t){super(t),this.parsedUrl=Sd.parse(this.url),this.httpApi="http:"===this.parsedUrl.protocol?bd:Md}constructRequest(t,e){return new Promise(((i,n)=>{const s=this.httpApi.get({...this.parsedUrl,headers:t},(t=>{const e=new Promise((e=>{const i=[];t.on("data",(t=>{i.push(t)})),t.on("end",(()=>{const t=Buffer.concat(i).buffer;e(t)})),t.on("error",n)}));i(new Pd(t,e))}));s.on("error",n),e&&(e.aborted&&s.destroy(new ud("Request aborted")),e.addEventListener("abort",(()=>s.destroy(new ud("Request aborted")))))}))}async request({headers:t,signal:e}={}){return await this.constructRequest(t,e)}}class Ed extends od{constructor(t,e,i,n){super(),this.client=t,this.headers=e,this.maxRanges=i,this.allowFullFile=n,this._fileSize=null}async fetch(t,e){return this.maxRanges>=t.length?this.fetchSlices(t,e):(this.maxRanges>0&&t.length,Promise.all(t.map((t=>this.fetchSlice(t,e)))))}async fetchSlices(t,e){const i=await this.client.request({headers:{...this.headers,Range:`bytes=${t.map((({offset:t,length:e})=>`${t}-${t+e}`)).join(",")}`},signal:e});if(i.ok){if(206===i.status){const{type:n,params:s}=function(t){const[e,...i]=t.split(";").map((t=>t.trim()));return{type:e,params:nd(i.map((t=>t.split("="))))}}(i.getHeader("content-type"));if("multipart/byteranges"===n){const t=function(t,e){let i=null;const n=new TextDecoder("ascii"),s=[],r=`--${e}`,o=`${r}--`;for(let e=0;e<10;++e)n.decode(new Uint8Array(t,e,r.length))===r&&(i=e);if(null===i)throw new Error("Could not find initial boundary");for(;i1){const i=await Promise.all(t.slice(1).map((t=>this.fetchSlice(t,e))));return u.concat(i)}return u}{if(!this.allowFullFile)throw new Error("Server responded with full file");const t=await i.getData();return this._fileSize=t.byteLength,[{data:t,offset:0,length:t.byteLength}]}}throw new Error("Error fetching data.")}async fetchSlice(t,e){const{offset:i,length:n}=t,s=await this.client.request({headers:{...this.headers,Range:`bytes=${i}-${i+n}`},signal:e});if(s.ok){if(206===s.status){const t=await s.getData(),{total:e}=rd(s.getHeader("content-range"));return this._fileSize=e||null,{data:t,offset:i,length:n}}{if(!this.allowFullFile)throw new Error("Server responded with full file");const t=await s.getData();return this._fileSize=t.byteLength,{data:t,offset:0,length:t.byteLength}}}throw new Error("Error fetching data.")}get fileSize(){return this._fileSize}}function Td(t,{blockSize:e,cacheSize:i}){return null===e?t:new pd(t,e,i)}function Cd(t,{forceXHR:e=!1,...i}={}){return"function"!=typeof fetch||e?"undefined"!=typeof XMLHttpRequest?function(t,{headers:e={},maxRanges:i=0,allowFullFile:n=!1,...s}={}){const r=new xd(t);return Td(new Ed(r,e,i,n),s)}(t,i):function(t,{headers:e={},maxRanges:i=0,allowFullFile:n=!1,...s}={}){const r=new _d(t);return Td(new Ed(r,e,i,n),s)}(t,i):function(t,{headers:e={},credentials:i,maxRanges:n=0,allowFullFile:s=!1,...r}={}){const o=new yd(t,i);return Td(new Ed(o,e,n,s),r)}(t,i)}class Fd extends od{constructor(t){super(),this.file=t}async fetchSlice(t,e){return new Promise(((i,n)=>{const s=this.file.slice(t.offset,t.offset+t.length),r=new FileReader;r.onload=t=>i(t.target.result),r.onerror=n,r.onabort=n,r.readAsArrayBuffer(s),e&&e.addEventListener("abort",(()=>r.abort()))}))}}function Id(t){switch(t){case Yf.sf.BYTE:case Yf.sf.ASCII:case Yf.sf.SBYTE:case Yf.sf.UNDEFINED:return 1;case Yf.sf.SHORT:case Yf.sf.SSHORT:return 2;case Yf.sf.LONG:case Yf.sf.SLONG:case Yf.sf.FLOAT:case Yf.sf.IFD:return 4;case Yf.sf.RATIONAL:case Yf.sf.SRATIONAL:case Yf.sf.DOUBLE:case Yf.sf.LONG8:case Yf.sf.SLONG8:case Yf.sf.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${t}`)}}function Ad(t,e,i,n){let s=null,r=null;const o=Id(e);switch(e){case Yf.sf.BYTE:case Yf.sf.ASCII:case Yf.sf.UNDEFINED:s=new Uint8Array(i),r=t.readUint8;break;case Yf.sf.SBYTE:s=new Int8Array(i),r=t.readInt8;break;case Yf.sf.SHORT:s=new Uint16Array(i),r=t.readUint16;break;case Yf.sf.SSHORT:s=new Int16Array(i),r=t.readInt16;break;case Yf.sf.LONG:case Yf.sf.IFD:s=new Uint32Array(i),r=t.readUint32;break;case Yf.sf.SLONG:s=new Int32Array(i),r=t.readInt32;break;case Yf.sf.LONG8:case Yf.sf.IFD8:s=new Array(i),r=t.readUint64;break;case Yf.sf.SLONG8:s=new Array(i),r=t.readInt64;break;case Yf.sf.RATIONAL:s=new Uint32Array(2*i),r=t.readUint32;break;case Yf.sf.SRATIONAL:s=new Int32Array(2*i),r=t.readInt32;break;case Yf.sf.FLOAT:s=new Float32Array(i),r=t.readFloat32;break;case Yf.sf.DOUBLE:s=new Float64Array(i),r=t.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e!==Yf.sf.RATIONAL&&e!==Yf.sf.SRATIONAL)for(let e=0;et.getWidth()-e.getWidth()));for(let e=0;en||r&&r>o)break}}let c=e;if(o){const[t,e]=h.getOrigin(),[i,n]=a.getResolution(h);c=[Math.round((o[0]-t)/i),Math.round((o[1]-e)/n),Math.round((o[2]-t)/i),Math.round((o[3]-e)/n)],c=[Math.min(c[0],c[2]),Math.min(c[1],c[3]),Math.max(c[0],c[2]),Math.max(c[1],c[3])]}return a.readRasters({...t,window:c})}}class Nd extends Ld{constructor(t,e,i,n,s={}){super(),this.source=t,this.littleEndian=e,this.bigTiff=i,this.firstIFDOffset=n,this.cache=s.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(t,e){const i=this.bigTiff?4048:1024;return new ed((await this.source.fetch([{offset:t,length:void 0!==e?e:i}]))[0],t,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(t){const e=this.bigTiff?20:12,i=this.bigTiff?8:2;let n=await this.getSlice(t);const s=this.bigTiff?n.readUint64(t):n.readUint16(t),r=s*e+(this.bigTiff?16:6);n.covers(t,r)||(n=await this.getSlice(t,r));const o={};let h=t+(this.bigTiff?8:2);for(let t=0;t{const e=await this.ifdRequests[t-1];if(0===e.nextIFDByteOffset)throw new Rd(t);return this.parseFileDirectoryAt(e.nextIFDByteOffset)})(),this.ifdRequests[t]}async getImage(t=0){const e=await this.requestIFD(t);return new Qf(e.fileDirectory,e.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let t=0,e=!0;for(;e;)try{await this.requestIFD(t),++t}catch(t){if(!(t instanceof Rd))throw t;e=!1}return t}async getGhostValues(){const t=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const e="GDAL_STRUCTURAL_METADATA_SIZE=",i=e.length+100;let n=await this.getSlice(t,i);if(e===Ad(n,Yf.sf.ASCII,e.length,t)){const e=Ad(n,Yf.sf.ASCII,i,t).split("\n")[0],s=Number(e.split("=")[1].split(" ")[0])+e.length;s>i&&(n=await this.getSlice(t,s));const r=Ad(n,Yf.sf.ASCII,s,t);this.ghostValues={},r.split("\n").filter((t=>t.length>0)).map((t=>t.split("="))).forEach((([t,e])=>{this.ghostValues[t]=e}))}return this.ghostValues}static async fromSource(t,e,i){const n=(await t.fetch([{offset:0,length:1024}],i))[0],s=new td(n),r=s.getUint16(0,0);let o;if(18761===r)o=!0;else{if(19789!==r)throw new TypeError("Invalid byte order value.");o=!1}const h=s.getUint16(2,o);let a;if(42===h)a=!1;else{if(43!==h)throw new TypeError("Invalid magic number.");a=!0;if(8!==s.getUint16(4,o))throw new Error("Unsupported offset byte-size.")}const u=a?s.getUint64(8,o):s.getUint32(4,o);return new Nd(t,o,a,u,e)}close(){return"function"==typeof this.source.close&&this.source.close()}}class Od extends Ld{constructor(t,e){super(),this.mainFile=t,this.overviewFiles=e,this.imageFiles=[t].concat(e),this.fileDirectoriesPerFile=null,this.fileDirectoriesPerFileParsing=null,this.imageCount=null}async parseFileDirectoriesPerFile(){const t=[this.mainFile.parseFileDirectoryAt(this.mainFile.firstIFDOffset)].concat(this.overviewFiles.map((t=>t.parseFileDirectoryAt(t.firstIFDOffset))));return this.fileDirectoriesPerFile=await Promise.all(t),this.fileDirectoriesPerFile}async getImage(t=0){await this.getImageCount(),await this.parseFileDirectoriesPerFile();let e=0,i=0;for(let n=0;nt.getImageCount())));return this.imageCounts=await Promise.all(t),this.imageCount=this.imageCounts.reduce(((t,e)=>t+e),0),this.imageCount}}async function zd(t,e){return Nd.fromSource(new Fd(t),e)}const Gd="STATISTICS_MAXIMUM",jd="STATISTICS_MINIMUM";let Dd;function Ud(t){try{return t.getBoundingBox()}catch(e){const i=t.fileDirectory;return[0,0,i.ImageWidth,i.ImageLength]}}function $d(t){try{return t.getOrigin().slice(0,2)}catch(e){return[0,t.fileDirectory.ImageLength]}}function Bd(t,e){try{return t.getResolution(e)}catch(i){return[e.fileDirectory.ImageWidth/t.fileDirectory.ImageWidth,e.fileDirectory.ImageHeight/t.fileDirectory.ImageHeight]}}function qd(t){const e=t.geoKeys;if(!e)return null;if(e.ProjectedCSTypeGeoKey){const t="EPSG:"+e.ProjectedCSTypeGeoKey;let i=Yi(t);if(!i){const n=Oe(e.ProjLinearUnitsGeoKey);n&&(i=new Ge({code:t,units:n}))}return i}if(e.GeographicTypeGeoKey){const t="EPSG:"+e.GeographicTypeGeoKey;let i=Yi(t);if(!i){const n=Oe(e.GeogAngularUnitsGeoKey);n&&(i=new Ge({code:t,units:n}))}return i}return null}function Xd(t){return t.getImageCount().then((function(e){const i=new Array(e);for(let n=0;nNd.fromSource(Cd(t,i)))));return new Od(s,r)}(t.url,t.overviews,e):async function(t,e={},i){return Nd.fromSource(Cd(t,e),i)}(t.url,e),i.then(Xd)}function Zd(t,e,i,n,s){if(Array.isArray(t)){const r=t.length;if(!Array.isArray(e)||r!=e.length){const t=new Error(n);throw s(t),t}for(let o=0;oi*t)throw new Error(n)}function Vd(t){return t instanceof Int8Array?-128:t instanceof Int16Array?-32768:t instanceof Int32Array?-2147483648:t instanceof Float32Array?12e-39:0}function Wd(t){return t instanceof Int8Array?127:t instanceof Uint8Array||t instanceof Uint8ClampedArray?255:t instanceof Int16Array?32767:t instanceof Uint16Array?65535:t instanceof Int32Array?2147483647:t instanceof Uint32Array?4294967295:t instanceof Float32Array?34e37:255}class Hd extends _f{constructor(t){super({state:"loading",tileGrid:null,projection:null,opaque:t.opaque,transition:t.transition,interpolate:!1!==t.interpolate,wrapX:t.wrapX}),this.nu=t.sources;const e=this.nu.length;this.su=t.sourceOptions,this.ru=new Array(e),this.ou=new Array(e),this.hu,this.au,this.uu,this.lu=!1!==t.normalize,this.cu=!1,this.q=null,this.fu=t.convertToRGB?"readRGB":"readRasters",this.setKey(this.nu.map((t=>t.url)).join(","));const i=this,n=new Array(e);for(let t=0;tg.length&&(u=r.length-g.length);const t=r[r.length-1]/g[g.length-1];this.ou[c]=t;const e=g.map((e=>e*t)),i=`Resolution mismatch for source ${c}, got [${e}] but expected [${r}]`;Zd(r.slice(u,r.length),e,.02,i,this.viewRejector)}else r=g,this.ou[c]=1;n?Zd(n.slice(u,n.length),v,.01,`Tile size mismatch for source ${c}`,this.viewRejector):n=v,s?Zd(s.slice(u,s.length),m,0,`Tile size mismatch for source ${c}`,this.viewRejector):s=m,this.ru[c]=l.reverse()}for(let t=0,e=this.ru.length;t=0;--t){const i=qd(e[t]);if(i){this.projection=i;break}}}this.hu=o,this.au=h,this.uu=a;t:for(let t=0;tt+=e),0)+c;const f=new eu({extent:e,minZoom:u,origin:i,resolutions:r,tileSizes:n});this.tileGrid=f,this.setTileSizes(s),this.setLoader(this.pu.bind(this)),this.setState("ready"),this.viewResolver({projection:this.projection,resolutions:r,center:un(ye(e),this.projection),extent:cn(e,this.projection),zoom:0})}pu(t,e,i){const n=this.getTileSize(t),s=this.ru.length,r=new Array(s),o=this.cu,h=this.bandCount,a=this.hu,u=this.au,l=this.nu;for(let o=0;oa||r>a;)o.push([Math.ceil(s/a),Math.ceil(r/a)]),a+=a;break;case"truncated":let t=s,e=r;for(;t>a||e>a;)o.push([Math.ceil(t/a),Math.ceil(e/a)]),t>>=1,e>>=1;break;default:ct(!1,53)}o.push([1,1]),o.reverse();const u=[n],l=[0];for(let t=1,e=o.length;t1,n=i&&t.imageInfo.profile[1].supports?t.imageInfo.profile[1].supports:[],s=i&&t.imageInfo.profile[1].formats?t.imageInfo.profile[1].formats:[],r=i&&t.imageInfo.profile[1].qualities?t.imageInfo.profile[1].qualities:[];return{url:t.imageInfo["@id"].replace(/\/?(?:info\.json)?$/g,""),sizes:void 0===t.imageInfo.sizes?void 0:t.imageInfo.sizes.map((function(t){return[t.width,t.height]})),tileSize:void 0===t.imageInfo.tiles?void 0:[t.imageInfo.tiles.map((function(t){return t.width}))[0],t.imageInfo.tiles.map((function(t){return void 0===t.height?t.width:t.height}))[0]],resolutions:void 0===t.imageInfo.tiles?void 0:t.imageInfo.tiles.map((function(t){return t.scaleFactors}))[0],supports:[...e.supports,...n],formats:[...e.formats,...s],qualities:[...e.qualities,...r]}},hp[ip]=function(t){const e=t.getComplianceLevelSupportedFeatures(),i=void 0===t.imageInfo.extraFormats?e.formats:[...e.formats,...t.imageInfo.extraFormats],n=void 0!==t.imageInfo.preferredFormats&&Array.isArray(t.imageInfo.preferredFormats)&&t.imageInfo.preferredFormats.length>0?t.imageInfo.preferredFormats.filter((function(t){return["jpg","png","gif"].includes(t)})).reduce((function(t,e){return void 0===t&&i.includes(e)?e:t}),void 0):void 0;return{url:t.imageInfo.id,sizes:void 0===t.imageInfo.sizes?void 0:t.imageInfo.sizes.map((function(t){return[t.width,t.height]})),tileSize:void 0===t.imageInfo.tiles?void 0:[t.imageInfo.tiles.map((function(t){return t.width}))[0],t.imageInfo.tiles.map((function(t){return t.height}))[0]],resolutions:void 0===t.imageInfo.tiles?void 0:t.imageInfo.tiles.map((function(t){return t.scaleFactors}))[0],supports:void 0===t.imageInfo.extraFeatures?e.supports:[...e.supports,...t.imageInfo.extraFeatures],formats:i,qualities:void 0===t.imageInfo.extraQualities?e.qualities:[...e.qualities,...t.imageInfo.extraQualities],preferredFormat:n}};var ap=class{constructor(t){this.setImageInfo(t)}setImageInfo(t){this.imageInfo="string"==typeof t?JSON.parse(t):t}getImageApiVersion(){if(void 0===this.imageInfo)return;let t=this.imageInfo["@context"]||"ol-no-context";"string"==typeof t&&(t=[t]);for(let e=0;e0&&"string"==typeof this.imageInfo.profile[0]&&rp.test(this.imageInfo.profile[0]))return this.imageInfo.profile[0]}}getComplianceLevelFromProfile(t){const e=this.getComplianceLevelEntryFromProfile(t);if(void 0===e)return;const i=e.match(/level[0-2](?:\.json)?$/g);return Array.isArray(i)?i[0].replace(".json",""):void 0}getComplianceLevelSupportedFeatures(){if(void 0===this.imageInfo)return;const t=this.getImageApiVersion(),e=this.getComplianceLevelFromProfile(t);return void 0===e?np.none.none:np[t][e]}getTileSourceOptions(t){const e=t||{},i=this.getImageApiVersion();if(void 0===i)return;const n=void 0===i?void 0:hp[i](this);return void 0!==n?{url:n.url,version:i,size:[this.imageInfo.width,this.imageInfo.height],sizes:n.sizes,format:void 0!==e.format&&n.formats.includes(e.format)?e.format:void 0!==n.preferredFormat?n.preferredFormat:"jpg",supports:n.supports,quality:e.quality&&n.qualities.includes(e.quality)?e.quality:n.qualities.includes("native")?"native":"default",resolutions:Array.isArray(n.resolutions)?n.resolutions.sort((function(t,e){return e-t})):void 0,tileSize:n.tileSize}:void 0}};function up(t){return t.toLocaleString("en",{maximumFractionDigits:10})}var lp=class extends lf{constructor(t){const e=t||{};let i=e.url||"";i+=i.lastIndexOf("/")===i.length-1||""===i?"":"/";const n=e.version||ep,s=e.sizes||[],r=e.size;ct(null!=r&&Array.isArray(r)&&2==r.length&&!isNaN(r[0])&&r[0]>0&&!isNaN(r[1])&&r[1]>0,60);const o=r[0],h=r[1],a=e.tileSize,u=e.tilePixelRatio||1,l=e.format||"jpg",c=e.quality||(e.version==tp?"native":"default");let f=e.resolutions||[];const d=e.supports||[],p=e.extent||[0,-h,o,0],m=null!=s&&Array.isArray(s)&&s.length>0,v=void 0!==a&&("number"==typeof a&&Number.isInteger(a)&&a>0||Array.isArray(a)&&a.length>0),g=null!=d&&Array.isArray(d)&&(d.includes("regionByPx")||d.includes("regionByPct"))&&(d.includes("sizeByWh")||d.includes("sizeByH")||d.includes("sizeByW")||d.includes("sizeByPct"));let y,w,x;if(f.sort((function(t,e){return e-t})),v||g)if(null!=a&&("number"==typeof a&&Number.isInteger(a)&&a>0?(y=a,w=a):Array.isArray(a)&&a.length>0&&((1==a.length||null==a[1]&&Number.isInteger(a[0]))&&(y=a[0],w=a[0]),2==a.length&&(Number.isInteger(a[0])&&Number.isInteger(a[1])?(y=a[0],w=a[1]):null==a[0]&&Number.isInteger(a[1])&&(y=a[1],w=a[1])))),void 0!==y&&void 0!==w||(y=$o,w=$o),0==f.length){x=Math.max(Math.ceil(Math.log(o/y)/Math.LN2),Math.ceil(Math.log(h/w)/Math.LN2));for(let t=x;t>=0;t--)f.push(Math.pow(2,t))}else{const t=Math.max(...f);x=Math.round(Math.log(t)/Math.LN2)}else if(y=o,w=h,f=[],m){s.sort((function(t,e){return t[0]-e[0]})),x=-1;const t=[];for(let e=0;e0&&f[f.length-1]==i?t.push(e):(f.push(i),x++)}if(t.length>0)for(let e=0;ex)return;const b=t[1],M=t[2],S=f[p];if(!(void 0===b||void 0===M||void 0===S||b<0||Math.ceil(o/S/y)<=b||M<0||Math.ceil(h/S/w)<=M)){if(g||v){const t=b*y*S,e=M*w*S;let i=y*S,s=w*S,r=y,l=w;if(t+i>o&&(i=o-t),e+s>h&&(s=h-e),t+y*S>o&&(r=Math.floor((o-t+S-1)/S)),e+w*S>h&&(l=Math.floor((h-e+S-1)/S)),0==t&&i==o&&0==e&&s==h)a="full";else if(!g||d.includes("regionByPx"))a=t+","+e+","+i+","+s;else if(d.includes("regionByPct")){a="pct:"+up(t/o*100)+","+up(e/h*100)+","+up(i/o*100)+","+up(s/h*100)}n!=ip||g&&!d.includes("sizeByWh")?!g||d.includes("sizeByW")?u=r+",":d.includes("sizeByH")?u=","+l:d.includes("sizeByWh")?u=r+","+l:d.includes("sizeByPct")&&(u="pct:"+up(100/S)):u=r+","+l}else if(a="full",m){const t=s[p][0],e=s[p][1];u=n==ip?t==o&&e==h?"max":t+","+e:t==o?"full":t+","}else u=n==ip?"max":"full";return i+a+"/"+u+"/0/"+c+"."+l}},transition:e.transition}),this.zDirection=e.zDirection}};var cp=class extends zs{constructor(t,e,i,n,s,r,o){const h=t.getExtent(),a=e.getExtent(),u=a?Se(i,a):i,l=Ka(t,e,ye(u),n),c=new bl(t,e,u,h,.5*l,n),f=r(c.calculateSourceExtent(),l,s),d=f?Gs:$s,p=f?f.getPixelRatio():1;super(i,n,p,d),this.po=e,this.vo=h,this.Lo=c,this.vi=n,this.vu=i,this.gu=f,this.yu=p,this.ya=o,this.$t=null,this.wu=null}disposeInternal(){this.state==js&&this.xu(),super.disposeInternal()}getImage(){return this.$t}getProjection(){return this.po}No(){const t=this.gu.getState();if(t==Ds){const t=Ee(this.vu)/this.vi,e=Me(this.vu)/this.vi;this.$t=Qa(t,e,this.yu,this.gu.getResolution(),this.vo,this.vi,this.vu,this.Lo,[{extent:this.gu.getExtent(),image:this.gu.getImage()}],0,void 0,this.ya)}this.state=t,this.changed()}load(){if(this.state==Gs){this.state=js,this.changed();const t=this.gu.getState();t==Ds||t==Us?this.No():(this.wu=U(this.gu,T,(function(t){const e=this.gu.getState();e!=Ds&&e!=Us||(this.xu(),this.No())}),this),this.gu.load())}}xu(){B(this.wu),this.wu=null}};const fp="imageloadstart",dp="imageloadend",pp="imageloaderror";class mp extends u{constructor(t,e){super(t),this.image=e}}function vp(t,e){t.getImage().src=e}var gp=class extends sf{constructor(t){super({attributions:t.attributions,projection:t.projection,state:t.state,interpolate:void 0===t.interpolate||t.interpolate}),this.on,this.once,this.un,this.Ei=void 0!==t.resolutions?t.resolutions:null,this.bu=null,this.Mu=0}getResolutions(){return this.Ei}findNearestResolution(t){if(this.Ei){const e=p(this.Ei,t,0);t=this.Ei[e]}return t}getImage(t,e,i,n){const s=this.getProjection();if(s&&n&&!tn(s,n)){if(this.bu){if(this.Mu==this.getRevision()&&tn(this.bu.getProjection(),n)&&this.bu.getResolution()==e&&oe(this.bu.getExtent(),t))return this.bu;this.bu.dispose(),this.bu=null}return this.bu=new cp(s,n,t,e,i,function(t,e,i){return this.getImageInternal(t,e,i,s)}.bind(this),this.getInterpolate()),this.Mu=this.getRevision(),this.bu}return s&&(n=s),this.getImageInternal(t,e,i,n)}getImageInternal(e,i,n,s){return t()}handleImageChange(t){const e=t.target;let i;switch(e.getState()){case js:this.loading=!0,i=fp;break;case Ds:this.loading=!1,i=dp;break;case Us:this.loading=!1,i=pp;break;default:return}this.hasListener(i)&&this.dispatchEvent(new mp(i,e))}};var yp=class extends gp{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.qt=void 0!==t.crossOrigin?t.crossOrigin:null,this.Ta=void 0===t.hidpi||t.hidpi,this.Gs=t.url,this.Gt=void 0!==t.imageLoadFunction?t.imageLoadFunction:vp,this.Su=t.params||{},this.Ot=null,this.Pu=[0,0],this._u=0,this.Eu=void 0!==t.ratio?t.ratio:1.5}getParams(){return this.Su}getImageInternal(t,e,i,n){if(void 0===this.Gs)return null;e=this.findNearestResolution(e),i=this.Ta?i:1;const s=this.Ot;if(s&&this._u==this.getRevision()&&s.getResolution()==e&&s.getPixelRatio()==i&&Jt(s.getExtent(),t))return s;const r={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};Object.assign(r,this.Su);const o=((t=t.slice())[0]+t[2])/2,h=(t[1]+t[3])/2;if(1!=this.Eu){const e=this.Eu*Ee(t)/2,i=this.Eu*Me(t)/2;t[0]=o-e,t[1]=h-i,t[2]=o+e,t[3]=h+i}const a=e/i,u=Math.ceil(Ee(t)/a),l=Math.ceil(Me(t)/a);t[0]=o-a*u/2,t[2]=o+a*u/2,t[1]=h-a*l/2,t[3]=h+a*l/2,this.Pu[0]=u,this.Pu[1]=l;const c=this.Tu(t,this.Pu,i,n,r);return this.Ot=new qs(t,e,i,c,this.qt,this.Gt),this._u=this.getRevision(),this.Ot.addEventListener(T,this.handleImageChange.bind(this)),this.Ot}getImageLoadFunction(){return this.Gt}Tu(t,e,i,n,s){const r=n.getCode().split(/:(?=\d+$)/).pop();s.SIZE=e[0]+","+e[1],s.BBOX=t.join(","),s.BBOXSR=r,s.IMAGESR=r,s.DPI=Math.round(90*i);const o=this.Gs,h=o.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage");return h==o&&ct(!1,50),pu(h,s)}getUrl(){return this.Gs}setImageLoadFunction(t){this.Ot=null,this.Gt=t,this.changed()}setUrl(t){t!=this.Gs&&(this.Gs=t,this.Ot=null,this.changed())}updateParams(t){Object.assign(this.Su,t),this.Ot=null,this.changed()}};var wp=class extends gp{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions,state:t.state}),this.Cu=t.canvasFunction,this.$t=null,this._u=0,this.Eu=void 0!==t.ratio?t.ratio:1.5}getImageInternal(t,e,i,n){e=this.findNearestResolution(e);let s=this.$t;if(s&&this._u==this.getRevision()&&s.getResolution()==e&&s.getPixelRatio()==i&&Jt(s.getExtent(),t))return s;Ie(t=t.slice(),this.Eu);const r=[Ee(t)/e*i,Me(t)/e*i],o=this.Cu.call(this,t,e,i,r,n);return o&&(s=new Xs(t,e,i,o)),this.$t=s,this._u=this.getRevision(),s}};var xp=class extends gp{constructor(t){super({interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.qt=void 0!==t.crossOrigin?t.crossOrigin:null,this.Fu=void 0!==t.displayDpi?t.displayDpi:96,this.Su=t.params||{},this.Gs=t.url,this.Gt=void 0!==t.imageLoadFunction?t.imageLoadFunction:vp,this.Ta=void 0===t.hidpi||t.hidpi,this.gt=void 0!==t.metersPerUnit?t.metersPerUnit:1,this.Eu=void 0!==t.ratio?t.ratio:1,this.Iu=void 0!==t.useOverlay&&t.useOverlay,this.Ot=null,this._u=0}getParams(){return this.Su}getImageInternal(t,e,i,n){e=this.findNearestResolution(e),i=this.Ta?i:1;let s=this.Ot;if(s&&this._u==this.getRevision()&&s.getResolution()==e&&s.getPixelRatio()==i&&Jt(s.getExtent(),t))return s;1!=this.Eu&&Ie(t=t.slice(),this.Eu);const r=[Ee(t)/e*i,Me(t)/e*i];if(void 0!==this.Gs){const o=this.getUrl(this.Gs,this.Su,t,r,n);s=new qs(t,e,i,o,this.qt,this.Gt),s.addEventListener(T,this.handleImageChange.bind(this))}else s=null;return this.Ot=s,this._u=this.getRevision(),s}getImageLoadFunction(){return this.Gt}updateParams(t){Object.assign(this.Su,t),this.changed()}getUrl(t,e,i,n,s){const r=function(t,e,i,n){const s=Ee(t),r=Me(t),o=e[0],h=e[1],a=.0254/n;return h*s>o*r?s*i/(o*a):r*i/(h*a)}(i,n,this.gt,this.Fu),o=ye(i),h={OPERATION:this.Iu?"GETDYNAMICMAPOVERLAYIMAGE":"GETMAPIMAGE",VERSION:"2.0.0",LOCALE:"en",CLIENTAGENT:"ol/source/ImageMapGuide source",CLIP:"1",SETDISPLAYDPI:this.Fu,SETDISPLAYWIDTH:Math.round(n[0]),SETDISPLAYHEIGHT:Math.round(n[1]),SETVIEWSCALE:r,SETVIEWCENTERX:o[0],SETVIEWCENTERY:o[1]};return Object.assign(h,e),pu(t,h)}setImageLoadFunction(t){this.Ot=null,this.Gt=t,this.changed()}};var bp=class extends gp{constructor(t){const e=void 0!==t.crossOrigin?t.crossOrigin:null,i=void 0!==t.imageLoadFunction?t.imageLoadFunction:vp;super({attributions:t.attributions,interpolate:t.interpolate,projection:Yi(t.projection)}),this.Gs=t.url,this.Au=t.imageExtent,this.Ot=new qs(this.Au,void 0,1,this.Gs,e,i),this.Pu=t.imageSize?t.imageSize:null,this.Ot.addEventListener(T,this.handleImageChange.bind(this))}getImageExtent(){return this.Au}getImageInternal(t,e,i,n){return Te(t,this.Ot.getExtent())?this.Ot:null}getUrl(){return this.Gs}handleImageChange(t){if(this.Ot.getState()==Ds){const t=this.Ot.getExtent(),e=this.Ot.getImage();let i,n;this.Pu?(i=this.Pu[0],n=this.Pu[1]):(i=e.width,n=e.height);const s=Ee(t),r=Me(t),o=s/i,h=r/n;let a=i,u=n;if(o>h?a=Math.round(s/h):u=Math.round(r/o),a!==i||u!==n){const t=Ys(a,u);this.getInterpolate()||(t.imageSmoothingEnabled=!1);const s=t.canvas;t.drawImage(e,0,0,i,n,0,0,s.width,s.height),this.Ot.setImage(s)}}super.handleImageChange(t)}};const Mp="1.3.0",Sp=[101,101];var Pp=class extends gp{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.qt=void 0!==t.crossOrigin?t.crossOrigin:null,this.Gs=t.url,this.Gt=void 0!==t.imageLoadFunction?t.imageLoadFunction:vp,this.Su=t.params||{},this.ku=!0,this.Ru(),this.Lu=t.serverType,this.Ta=void 0===t.hidpi||t.hidpi,this.Ot=null,this.Pu=[0,0],this._u=0,this.Eu=void 0!==t.ratio?t.ratio:1.5}getFeatureInfoUrl(t,e,i,n){if(void 0===this.Gs)return;const s=Yi(i),r=this.getProjection();r&&r!==s&&(e=Ka(r,s,t,e),t=sn(t,s,r));const o=xe(t,e,0,Sp),h={SERVICE:"WMS",VERSION:Mp,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.Su.LAYERS};Object.assign(h,this.Su,n);const a=gi((t[0]-o[0])/e,4),u=gi((o[3]-t[1])/e,4);return h[this.ku?"I":"X"]=a,h[this.ku?"J":"Y"]=u,this.Tu(o,Sp,1,r||s,h)}getLegendUrl(t,e){if(void 0===this.Gs)return;const i={SERVICE:"WMS",VERSION:Mp,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){const t=this.Su.LAYERS;if(!(!Array.isArray(t)||1===t.length))return;i.LAYER=t}if(void 0!==t){const e=this.getProjection()?this.getProjection().getMetersPerUnit():1,n=28e-5;i.SCALE=t*e/n}return Object.assign(i,e),pu(this.Gs,i)}getParams(){return this.Su}getImageInternal(t,e,i,n){if(void 0===this.Gs)return null;e=this.findNearestResolution(e),1==i||this.Ta&&void 0!==this.Lu||(i=1);const s=e/i,r=ye(t),o=xe(r,s,0,[yi(Ee(t)/s,4),yi(Me(t)/s,4)]),h=xe(r,s,0,[yi(this.Eu*Ee(t)/s,4),yi(this.Eu*Me(t)/s,4)]),a=this.Ot;if(a&&this._u==this.getRevision()&&a.getResolution()==e&&a.getPixelRatio()==i&&Jt(a.getExtent(),o))return a;const u={SERVICE:"WMS",VERSION:Mp,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};Object.assign(u,this.Su),this.Pu[0]=vi(Ee(h)/s,4),this.Pu[1]=vi(Me(h)/s,4);const l=this.Tu(h,this.Pu,i,n,u);return this.Ot=new qs(h,e,i,l,this.qt,this.Gt),this._u=this.getRevision(),this.Ot.addEventListener(T,this.handleImageChange.bind(this)),this.Ot}getImageLoadFunction(){return this.Gt}Tu(t,e,i,n,s){if(ct(void 0!==this.Gs,9),s[this.ku?"CRS":"SRS"]=n.getCode(),"STYLES"in this.Su||(s.STYLES=""),1!=i)switch(this.Lu){case"geoserver":const t=90*i+.5|0;"FORMAT_OPTIONS"in s?s.FORMAT_OPTIONS+=";dpi:"+t:s.FORMAT_OPTIONS="dpi:"+t;break;case"mapserver":s.MAP_RESOLUTION=90*i;break;case"carmentaserver":case"qgis":s.DPI=90*i;break;default:ct(!1,8)}s.WIDTH=e[0],s.HEIGHT=e[1];const r=n.getAxisOrientation();let o;return o=this.ku&&"ne"==r.substr(0,2)?[t[1],t[0],t[3],t[2]]:t,s.BBOX=o.join(","),pu(this.Gs,s)}getUrl(){return this.Gs}setImageLoadFunction(t){this.Ot=null,this.Gt=t,this.changed()}setUrl(t){t!=this.Gs&&(this.Gs=t,this.Ot=null,this.changed())}updateParams(t){Object.assign(this.Su,t),this.Ru(),this.Ot=null,this.changed()}Ru(){const t=this.Su.VERSION||Mp;this.ku=xi(t,"1.3")>=0}};const _p={"image/png":!0,"image/jpeg":!0,"image/gif":!0,"image/webp":!0},Ep={"application/vnd.mapbox-vector-tile":!0,"application/geo+json":!0};function Tp(t,e){let i,n;for(let s=0;st.maxTileCol||c.tileRowt.maxTileRow)return}Object.assign(c,g);const f=i.replace(/\{(\w+?)\}/g,(function(t,e){return c[e]}));return za(y,f)}}}function Ip(t){return Oa(t.url).then((function(e){return function(t,e){const i=e.tileMatrixSetLimits;let n;if("map"===e.dataType)n=Tp(e.links,t.mediaType);else{if("vector"!==e.dataType)throw new Error('Expected tileset data type to be "map" or "vector"');n=Cp(e.links,t.mediaType,t.supportedMediaTypes)}if(e.tileMatrixSet)return Fp(t,e.tileMatrixSet,n,i);const s=e.links.find((t=>"http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme"===t.rel));if(!s)throw new Error("Expected http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme link or tileMatrixSet");const r=s.href;return Oa(za(t.url,r)).then((function(e){return Fp(t,e,n,i)}))}(t,e)}))}var Ap=class extends lf{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition});Ip({url:t.url,projection:this.getProjection(),mediaType:t.mediaType,context:t.context||null}).then(this.Nu.bind(this)).catch(this.Ou.bind(this))}Nu(t){this.tileGrid=t.grid,this.setTileUrlFunction(t.urlFunction,t.urlTemplate),this.setState("ready")}Ou(t){console.error(t),this.setState("error")}};var kp=class extends af{constructor(t){const e=t.projection||"EPSG:3857",i=t.extent||au(e),n=t.tileGrid||ru({extent:i,maxResolution:t.maxResolution,maxZoom:void 0!==t.maxZoom?t.maxZoom:22,minZoom:t.minZoom,tileSize:t.tileSize||512});super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,interpolate:!0,opaque:!1,projection:e,state:t.state,tileGrid:n,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:Rp,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:void 0===t.zDirection?1:t.zDirection}),this.Os=t.format?t.format:null,this.sourceTileCache=new xa(this.tileCache.highWaterMark),this.Da=null==t.overlaps||t.overlaps,this.tileClass=t.tileClass?t.tileClass:Ea,this.zu={}}getFeaturesInExtent(t){const e=[],i=this.tileCache;if(0===i.getCount())return e;const n=ga(i.peekFirstKey())[0],s=this.tileGrid;return i.forEach((function(i){if(i.tileCoord[0]!==n||i.getState()!==it)return;const r=i.getSourceTiles();for(let i=0,n=r.length;i{const n=va(e),s=i.peek(n);if(s){const e=s.sourceTiles;for(let i=0,n=e.length;i{const s=this.tileUrlFunction(n,t,e),r=this.sourceTileCache.containsKey(s)?this.sourceTileCache.get(s):new this.tileClass(n,s?tt:st,s,this.Os,this.tileLoadFunction);i.sourceTiles.push(r);const o=r.getState();if(o{this.handleTileChange(e);const n=r.getState();if(n===it||n===nt){const e=r.getKey();e in i.errorTileKeys?r.getState()===it&&delete i.errorTileKeys[e]:i.loadingSourceTiles--,n===nt?i.errorTileKeys[e]=!0:r.removeEventListener(T,t),0===i.loadingSourceTiles&&i.setState(_(i.errorTileKeys)?it:nt)}};r.addEventListener(T,t),i.loadingSourceTiles++}o===tt&&(r.extent=a.getTileCoordExtent(n),r.projection=e,r.resolution=a.getResolution(n[0]),this.sourceTileCache.set(s,r),r.load())})),i.loadingSourceTiles||i.setState(i.sourceTiles.some((t=>t.getState()===nt))?nt:it)}return i.sourceTiles}getTile(t,e,i,n,s){const r=pa(t,e,i),o=this.getKey();let h;if(this.tileCache.containsKey(r)&&(h=this.tileCache.get(r),h.key===o))return h;const a=[t,e,i];let u=this.getTileCoordForTileUrlFunction(a,s);const l=this.getTileGrid().getExtent(),c=this.getTileGridForProjection(s);if(u&&l){const e=c.getTileCoordExtent(u);Vt(e,-c.getResolution(t),e),Te(l,e)||(u=null)}let f=!0;if(null!==u){const e=this.tileGrid,i=c.getResolution(t),r=e.getZForResolution(i,1),o=c.getTileCoordExtent(u);Vt(o,-i,o),e.forEachTileCoord(o,r,function(t){f=f&&!this.tileUrlFunction(t,n,s)}.bind(this))}const d=new _a(a,f?st:tt,u,this.getSourceTiles.bind(this,n,s));return d.key=o,h?(d.interimTile=h,d.refreshInterimChain(),this.tileCache.replace(r,d)):this.tileCache.set(r,d),d}getTileGridForProjection(t){const e=t.getCode();let i=this.zu[e];if(!i){const t=this.tileGrid,n=t.getResolutions().slice(),s=n.map((function(e,i){return t.getOrigin(i)})),r=n.map((function(e,i){return t.getTileSize(i)})),o=43;for(let t=n.length;t=o.width)return null;const u=Me(r),l=Math.floor(o.height*((r[3]-n[1])/u));return l<0||l>=o.height?null:this.getImageData(o,a,l)}renderFrame(t,e){const i=this.Ot,n=i.getExtent(),s=i.getResolution(),r=i.getPixelRatio(),o=t.layerStatesArray[t.layerIndex],h=t.pixelRatio,a=t.viewState,u=a.center,l=h*s/(a.resolution*r),c=t.extent,f=a.resolution,d=a.rotation,p=Math.round(Ee(c)/f*h),m=Math.round(Me(c)/f*h);Ot(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/h,1/h,d,-p/2,-m/2),zt(this.inversePixelTransform,this.pixelTransform);const v=Dt(this.pixelTransform);this.useContainer(e,v,this.getBackground(t));const g=this.context,y=g.canvas;y.width!=p||y.height!=m?(y.width=p,y.height=m):this.containerReused||g.clearRect(0,0,p,m);let w=!1,x=!0;if(o.extent){const e=fn(o.extent,a.projection);x=Te(e,t.extent),w=x&&!Jt(e,t.extent),w&&this.clipUnrotated(g,t,e)}const b=i.getImage(),M=Ot(this.tempTransform,p/2,m/2,l,l,0,r*(n[0]-u[0])/s,r*(u[1]-n[3])/s);this.renderedResolution=s*h/r;const S=b.width*M[0],P=b.height*M[3];if(this.getLayer().getSource().getInterpolate()||(g.imageSmoothingEnabled=!1),this.preRender(g,t),x&&S>=.5&&P>=.5){const t=M[4],e=M[5],i=o.opacity;let n;1!==i&&(n=g.globalAlpha,g.globalAlpha=i),g.drawImage(b,0,0,+b.width,+b.height,t,e,S,P),1!==i&&(g.globalAlpha=n)}return this.postRender(g,t),w&&g.restore(),g.imageSmoothingEnabled=!0,v!==y.style.transform&&(y.style.transform=v),this.container}};var $p=class extends zp{constructor(t){super(t)}createRenderer(){return new Up(this)}getData(t){return super.getData(t)}},Bp="preload",qp="useInterimTilesOnError";var Xp=class extends kr{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.setPreload(void 0!==t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError)}getPreload(){return this.get(Bp)}setPreload(t){this.set(Bp,t)}getUseInterimTilesOnError(){return this.get(qp)}setUseInterimTilesOnError(t){this.set(qp,t)}getData(t){return super.getData(t)}};var Yp=class extends Dp{constructor(t){super(t),this.extentChanged=!0,this.Gu=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.ju=!1,this.tmpExtent=[1/0,1/0,-1/0,-1/0],this.Du=new Sa(0,0,0,0)}isDrawableTile(t){const e=this.getLayer(),i=t.getState(),n=e.getUseInterimTilesOnError();return i==it||i==st||i==nt&&!n}getTile(t,e,i,n){const s=n.pixelRatio,r=n.viewState.projection,o=this.getLayer();let h=o.getSource().getTile(t,e,i,s,r);return h.getState()==nt&&o.getUseInterimTilesOnError()&&o.getPreload()>0&&(this.ju=!0),this.isDrawableTile(h)||(h=h.getInterimTile()),h}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=At(e.pixelToCoordinateTransform,t.slice()),s=i.getExtent();if(s&&!Kt(s,n))return null;const r=e.pixelRatio,o=e.viewState.projection,h=e.viewState,a=i.getRenderSource(),u=a.getTileGridForProjection(h.projection),l=a.getTilePixelRatio(e.pixelRatio);for(let t=u.getZForResolution(h.resolution);t>=u.getMinZoom();--t){const e=u.getTileCoordForCoordAndZ(n,t),i=a.getTile(t,e[1],e[2],r,o);if(!(i instanceof tr||i instanceof Ml))return null;if(i.getState()!==it)continue;const s=u.getOrigin(t),c=ia(u.getTileSize(t)),f=u.getResolution(t),d=Math.floor(l*((n[0]-s[0])/f-e[1]*c[0])),p=Math.floor(l*((s[1]-n[1])/f-e[2]*c[1])),m=Math.round(l*a.getGutterForProjection(h.projection));return this.getImageData(i.getImage(),d+m,p+m)}return null}loadedTileCallback(t,e,i){return!!this.isDrawableTile(i)&&super.loadedTileCallback(t,e,i)}prepareFrame(t){return!!this.getLayer().getSource()}renderFrame(t,e){const n=t.layerStatesArray[t.layerIndex],s=t.viewState,r=s.projection,o=s.resolution,h=s.center,a=s.rotation,u=t.pixelRatio,l=this.getLayer(),c=l.getSource(),f=c.getRevision(),p=c.getTileGridForProjection(r),m=p.getZForResolution(o,c.zDirection),v=p.getResolution(m);let g=t.extent;const y=t.viewState.resolution,w=c.getTilePixelRatio(u),x=Math.round(Ee(g)/y*u),b=Math.round(Me(g)/y*u),M=n.extent&&fn(n.extent,r);M&&(g=Se(g,fn(n.extent,r)));const S=v*x/2/w,P=v*b/2/w,_=[h[0]-S,h[1]-P,h[0]+S,h[1]+P],E=p.getTileRangeForExtentAndZ(g,m),T={};T[m]={};const C=this.createLoadedTileFinder(c,r,T),F=this.tmpExtent,I=this.Du;this.ju=!1;const A=a?be(s.center,y,a,t.size):void 0;for(let e=E.minX;e<=E.maxX;++e)for(let s=E.minY;s<=E.maxY;++s){if(a&&!p.tileCoordIntersectsViewport([m,e,s],A))continue;const r=this.getTile(m,e,s,t);if(this.isDrawableTile(r)){const e=i(this);if(r.getState()==it){T[m][r.tileCoord.toString()]=r;let t=r.inTransition(e);t&&1!==n.opacity&&(r.endTransition(e),t=!1),this.ju||!t&&this.renderedTiles.includes(r)||(this.ju=!0)}if(1===r.getAlpha(e,t.time))continue}const o=p.getTileCoordChildTileRange(r.tileCoord,I,F);let h=!1;o&&(h=C(m+1,o)),h||p.forEachTileCoordParentTileRange(r.tileCoord,C,I,F)}const k=v/o*u/w;Ot(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/u,1/u,a,-x/2,-b/2);const R=Dt(this.pixelTransform);this.useContainer(e,R,this.getBackground(t));const L=this.context,N=L.canvas;zt(this.inversePixelTransform,this.pixelTransform),Ot(this.tempTransform,x/2,b/2,k,k,0,-x/2,-b/2),N.width!=x||N.height!=b?(N.width=x,N.height=b):this.containerReused||L.clearRect(0,0,x,b),M&&this.clipUnrotated(L,t,M),c.getInterpolate()||(L.imageSmoothingEnabled=!1),this.preRender(L,t),this.renderedTiles.length=0;let O,z,G,j=Object.keys(T).map(Number);j.sort(d),1!==n.opacity||this.containerReused&&!c.getOpaque(t.viewState.projection)?(O=[],z=[]):j=j.reverse();for(let e=j.length-1;e>=0;--e){const n=j[e],s=c.getTilePixelSize(n,u,r),o=p.getResolution(n)/v,h=s[0]*o*k,a=s[1]*o*k,l=p.getTileCoordForCoordAndZ(Pe(_),n),f=p.getTileCoordExtent(l),d=At(this.tempTransform,[w*(f[0]-_[0])/v,w*(_[3]-f[3])/v]),g=w*c.getGutterForProjection(r),y=T[n];for(const e in y){const s=y[e],r=s.tileCoord,o=l[1]-r[1],u=Math.round(d[0]-(o-1)*h),f=l[2]-r[2],p=Math.round(d[1]-(f-1)*a),v=Math.round(d[0]-o*h),w=Math.round(d[1]-f*a),x=u-v,b=p-w,M=m===n,S=M&&1!==s.getAlpha(i(this),t.time);let P=!1;if(!S)if(O){G=[v,w,v+x,w,v+x,w+b,v,w+b];for(let t=0,e=O.length;tthis._maxQueueLength;)this._queue.shift().callback(null,null)}_dispatch(){if(this._running||0===this._queue.length)return;const t=this._queue.shift();this._job=t;const e=t.inputs[0].width,i=t.inputs[0].height,n=t.inputs.map((function(t){return t.data.buffer})),s=this._workers.length;if(this._running=s,1===s)return void this._workers[0].postMessage({buffers:n,meta:t.meta,imageOps:this._imageOps,width:e,height:i},n);const r=t.inputs[0].data.length,o=4*Math.ceil(r/4/s);for(let r=0;rStamen Design , under CC BY 3.0 .',Np],um={terrain:{extension:"jpg",opaque:!0},"terrain-background":{extension:"jpg",opaque:!0},"terrain-labels":{extension:"png",opaque:!1},"terrain-lines":{extension:"png",opaque:!1},"toner-background":{extension:"png",opaque:!0},toner:{extension:"png",opaque:!0},"toner-hybrid":{extension:"png",opaque:!1},"toner-labels":{extension:"png",opaque:!1},"toner-lines":{extension:"png",opaque:!1},"toner-lite":{extension:"png",opaque:!0},watercolor:{extension:"jpg",opaque:!0}},lm={terrain:{minZoom:0,maxZoom:18},toner:{minZoom:0,maxZoom:20},watercolor:{minZoom:0,maxZoom:18}};var cm=class extends df{constructor(t){const e=t.layer.indexOf("-"),i=-1==e?t.layer:t.layer.slice(0,e),n=lm[i],s=um[t.layer],r=void 0!==t.url?t.url:"https://stamen-tiles-{a-d}.a.ssl.fastly.net/"+t.layer+"/{z}/{x}/{y}."+s.extension;super({attributions:am,cacheSize:t.cacheSize,crossOrigin:"anonymous",interpolate:t.interpolate,maxZoom:null!=t.maxZoom?t.maxZoom:n.maxZoom,minZoom:null!=t.minZoom?t.minZoom:n.minZoom,opaque:s.opaque,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:t.tileLoadFunction,transition:t.transition,url:r,wrapX:t.wrapX,zDirection:t.zDirection})}};var fm=class extends lf{constructor(t){super({attributions:(t=t||{}).attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.Su=t.params||{},this.Ta=void 0===t.hidpi||t.hidpi,this.Ir=[1/0,1/0,-1/0,-1/0],this.setKey(this.Ku())}Ku(){let t=0;const e=[];for(const i in this.Su)e[t++]=i+"-"+this.Su[i];return e.join("/")}getParams(){return this.Su}Tu(t,e,i,n,s,r){const o=this.urls;if(!o)return;const h=s.getCode().split(/:(?=\d+$)/).pop();let a;if(r.SIZE=e[0]+","+e[1],r.BBOX=i.join(","),r.BBOXSR=h,r.IMAGESR=h,r.DPI=Math.round(r.DPI?r.DPI*n:90*n),1==o.length)a=o[0];else{a=o[di(ya(t),o.length)]}return pu(a.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage"),r)}getTilePixelRatio(t){return this.Ta?t:1}updateParams(t){Object.assign(this.Su,t),this.setKey(this.Ku())}tileUrlFunction(t,e,i){let n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(i)),n.getResolutions().length<=t[0])return;1==e||this.Ta||(e=1);const s=n.getTileCoordExtent(t,this.Ir);let r=ia(n.getTileSize(t[0]),this.tmpSize);1!=e&&(r=ea(r,e,this.tmpSize));const o={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};return Object.assign(o,this.Su),this.Tu(t,r,s,e,i,o)}};var dm=class extends df{constructor(t){super({opaque:!1,projection:(t=t||{}).projection,tileGrid:t.tileGrid,wrapX:void 0===t.wrapX||t.wrapX,zDirection:t.zDirection,url:t.template||"z:{z} x:{x} y:{y}",tileLoadFunction:(t,e)=>{const i=t.getTileCoord()[0],n=ia(this.tileGrid.getTileSize(i)),s=Ys(n[0],n[1]);s.strokeStyle="grey",s.strokeRect(.5,.5,n[0]+.5,n[1]+.5),s.fillStyle="grey",s.strokeStyle="white",s.textAlign="center",s.textBaseline="middle",s.font="24px sans-serif",s.lineWidth=4,s.strokeText(e,n[0]/2,n[1]/2,n[0]),s.fillText(e,n[0]/2,n[1]/2,n[0]),t.setImage(s.canvas)}})}};var pm=class extends lf{constructor(t){if(super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:Yi("EPSG:3857"),reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.Ju=null,this.Tr=t.tileSize,t.url)if(t.jsonp)Ra(t.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const e=new XMLHttpRequest;e.addEventListener("load",this.Qu.bind(this)),e.addEventListener("error",this.tl.bind(this)),e.open("GET",t.url),e.send()}else t.tileJSON?this.handleTileJSONResponse(t.tileJSON):ct(!1,51)}Qu(t){const e=t.target;if(!e.status||e.status>=200&&e.status<300){let t;try{t=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(t)}else this.handleTileJSONError()}tl(t){this.handleTileJSONError()}getTileJSON(){return this.Ju}handleTileJSONResponse(t){const e=Yi("EPSG:4326"),i=this.getProjection();let n;if(void 0!==t.bounds){const s=en(e,i);n=ke(t.bounds,s)}const s=au(i),r=t.minzoom||0,o=ru({extent:s,maxZoom:t.maxzoom||22,minZoom:r,tileSize:this.Tr});if(this.tileGrid=o,this.tileUrlFunction=lu(t.tiles,o),void 0!==t.attribution&&!this.getAttributions()){const e=void 0!==n?n:s;this.setAttributions((function(i){return Te(e,i.extent)?[t.attribution]:null}))}this.Ju=t,this.setState("ready")}handleTileJSONError(){this.setState("error")}};var mm=class extends lf{constructor(t){const e=(t=t||{}).params||{},i=!("TRANSPARENT"in e)||e.TRANSPARENT;super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,opaque:!i,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.To=void 0!==t.gutter?t.gutter:0,this.Su=e,this.ku=!0,this.Lu=t.serverType,this.Ta=void 0===t.hidpi||t.hidpi,this.Ir=[1/0,1/0,-1/0,-1/0],this.Ru(),this.setKey(this.Ku())}getFeatureInfoUrl(t,e,i,n){const s=Yi(i),r=this.getProjection();let o=this.getTileGrid();o||(o=this.getTileGridForProjection(s));const h=o.getZForResolution(e,this.zDirection),a=o.getTileCoordForCoordAndZ(t,h);if(o.getResolutions().length<=a[0])return;let u=o.getResolution(a[0]),l=o.getTileCoordExtent(a,this.Ir),c=ia(o.getTileSize(a[0]),this.tmpSize);const f=this.To;0!==f&&(c=Qh(c,f,this.tmpSize),l=Vt(l,u*f,l)),r&&r!==s&&(u=Ka(r,s,t,u),l=rn(l,s,r),t=sn(t,s,r));const d={SERVICE:"WMS",VERSION:Mp,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.Su.LAYERS};Object.assign(d,this.Su,n);const p=Math.floor((t[0]-l[0])/u),m=Math.floor((l[3]-t[1])/u);return d[this.ku?"I":"X"]=p,d[this.ku?"J":"Y"]=m,this.Tu(a,c,l,1,r||s,d)}getLegendUrl(t,e){if(void 0===this.urls[0])return;const i={SERVICE:"WMS",VERSION:Mp,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){const t=this.Su.LAYERS;if(!(!Array.isArray(t)||1===t.length))return;i.LAYER=t}if(void 0!==t){const e=this.getProjection()?this.getProjection().getMetersPerUnit():1,n=28e-5;i.SCALE=t*e/n}return Object.assign(i,e),pu(this.urls[0],i)}getGutter(){return this.To}getParams(){return this.Su}Tu(t,e,i,n,s,r){const o=this.urls;if(!o)return;if(r.WIDTH=e[0],r.HEIGHT=e[1],r[this.ku?"CRS":"SRS"]=s.getCode(),"STYLES"in this.Su||(r.STYLES=""),1!=n)switch(this.Lu){case"geoserver":const t=90*n+.5|0;"FORMAT_OPTIONS"in r?r.FORMAT_OPTIONS+=";dpi:"+t:r.FORMAT_OPTIONS="dpi:"+t;break;case"mapserver":r.MAP_RESOLUTION=90*n;break;case"carmentaserver":case"qgis":r.DPI=90*n;break;default:ct(!1,52)}const h=s.getAxisOrientation(),a=i;if(this.ku&&"ne"==h.substr(0,2)){let t;t=i[0],a[0]=i[1],a[1]=t,t=i[2],a[2]=i[3],a[3]=t}let u;if(r.BBOX=a.join(","),1==o.length)u=o[0];else{u=o[di(ya(t),o.length)]}return pu(u,r)}getTilePixelRatio(t){return this.Ta&&void 0!==this.Lu?t:1}Ku(){let t=0;const e=[];for(const i in this.Su)e[t++]=i+"-"+this.Su[i];return e.join("/")}updateParams(t){Object.assign(this.Su,t),this.Ru(),this.setKey(this.Ku())}Ru(){const t=this.Su.VERSION||Mp;this.ku=xi(t,"1.3")>=0}tileUrlFunction(t,e,i){let n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(i)),n.getResolutions().length<=t[0])return;1==e||this.Ta&&void 0!==this.Lu||(e=1);const s=n.getResolution(t[0]);let r=n.getTileCoordExtent(t,this.Ir),o=ia(n.getTileSize(t[0]),this.tmpSize);const h=this.To;0!==h&&(o=Qh(o,h,this.tmpSize),r=Vt(r,s*h,r)),1!=e&&(o=ea(o,e,this.tmpSize));const a={SERVICE:"WMS",VERSION:Mp,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};return Object.assign(a,this.Su),this.Tu(t,o,r,e,i,a)}};class vm extends ut{constructor(t,e,i,n,s,r){super(t,e),this.Nt=i,this.ot=n,this.el=s,this.il=null,this.nl=null,this.B=null,this.sl=r}getImage(){return null}getData(t){if(!this.il||!this.nl)return null;const e=(t[0]-this.ot[0])/(this.ot[2]-this.ot[0]),i=(t[1]-this.ot[1])/(this.ot[3]-this.ot[1]),n=this.il[Math.floor((1-i)*this.il.length)];if("string"!=typeof n)return null;let s=n.charCodeAt(Math.floor(e*n.length));s>=93&&s--,s>=35&&s--,s-=32;let r=null;if(s in this.nl){const t=this.nl[s];r=this.B&&t in this.B?this.B[t]:t}return r}forDataAtCoordinate(t,e,i){this.state==st&&!0===i?(this.state=tt,$(this,T,(function(i){e(this.getData(t))}),this),this.rl()):!0===i?setTimeout(function(){e(this.getData(t))}.bind(this),0):e(this.getData(t))}getKey(){return this.Nt}Ou(){this.state=nt,this.changed()}Bt(t){this.il=t.grid,this.nl=t.keys,this.B=t.data,this.state=it,this.changed()}rl(){if(this.state==tt)if(this.state=et,this.sl)Ra(this.Nt,this.Bt.bind(this),this.Ou.bind(this));else{const t=new XMLHttpRequest;t.addEventListener("load",this.Qu.bind(this)),t.addEventListener("error",this.tl.bind(this)),t.open("GET",this.Nt),t.send()}}Qu(t){const e=t.target;if(!e.status||e.status>=200&&e.status<300){let t;try{t=JSON.parse(e.responseText)}catch(t){return void this.Ou()}this.Bt(t)}else this.Ou()}tl(t){this.Ou()}load(){this.el?this.rl():this.setState(st)}}var gm=class extends of{constructor(t){if(super({projection:Yi("EPSG:3857"),state:"loading",zDirection:t.zDirection}),this.el=void 0===t.preemptive||t.preemptive,this.hl=fu,this.al=void 0,this.sl=t.jsonp||!1,t.url)if(this.sl)Ra(t.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const e=new XMLHttpRequest;e.addEventListener("load",this.Qu.bind(this)),e.addEventListener("error",this.tl.bind(this)),e.open("GET",t.url),e.send()}else t.tileJSON?this.handleTileJSONResponse(t.tileJSON):ct(!1,51)}Qu(t){const e=t.target;if(!e.status||e.status>=200&&e.status<300){let t;try{t=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(t)}else this.handleTileJSONError()}tl(t){this.handleTileJSONError()}getTemplate(){return this.al}forDataAtCoordinateAndResolution(t,e,i,n){if(this.tileGrid){const s=this.tileGrid.getZForResolution(e,this.zDirection),r=this.tileGrid.getTileCoordForCoordAndZ(t,s);this.getTile(r[0],r[1],r[2],1,this.getProjection()).forDataAtCoordinate(t,i,n)}else!0===n?setTimeout((function(){i(null)}),0):i(null)}handleTileJSONError(){this.setState("error")}handleTileJSONResponse(t){const e=Yi("EPSG:4326"),i=this.getProjection();let n;if(void 0!==t.bounds){const s=en(e,i);n=ke(t.bounds,s)}const s=au(i),r=t.minzoom||0,o=ru({extent:s,maxZoom:t.maxzoom||22,minZoom:r});this.tileGrid=o,this.al=t.template;const h=t.grids;if(h){if(this.hl=lu(h,o),void 0!==t.attribution){const e=void 0!==n?n:s;this.setAttributions((function(i){return Te(e,i.extent)?[t.attribution]:null}))}this.setState("ready")}else this.setState("error")}getTile(t,e,i,n,s){const r=pa(t,e,i);if(this.tileCache.containsKey(r))return this.tileCache.get(r);{const o=[t,e,i],h=this.getTileCoordForTileUrlFunction(o,s),a=this.hl(h,n,s),u=new vm(o,void 0!==a?tt:st,void 0!==a?a:"",this.tileGrid.getTileCoordExtent(o),this.el,this.sl);return this.tileCache.set(r,u),u}}useTile(t,e,i){const n=pa(t,e,i);this.tileCache.containsKey(n)&&this.tileCache.get(n)}};var ym=class extends lf{constructor(t){const e=void 0!==t.requestEncoding?t.requestEncoding:"KVP",i=t.tileGrid;let n=t.urls;void 0===n&&void 0!==t.url&&(n=du(t.url)),super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,urls:n,wrapX:void 0!==t.wrapX&&t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.ul=void 0!==t.version?t.version:"1.0.0",this.Os=void 0!==t.format?t.format:"image/jpeg",this.ll=void 0!==t.dimensions?t.dimensions:{},this.Uo=t.layer,this.cl=t.matrixSet,this.K=t.style,this.fl=e,this.setKey(this.dl()),n&&n.length>0&&(this.tileUrlFunction=cu(n.map(this.createFromWMTSTemplate.bind(this))))}setUrls(t){this.urls=t;const e=t.join("\n");this.setTileUrlFunction(cu(t.map(this.createFromWMTSTemplate.bind(this))),e)}getDimensions(){return this.ll}getFormat(){return this.Os}getLayer(){return this.Uo}getMatrixSet(){return this.cl}getRequestEncoding(){return this.fl}getStyle(){return this.K}getVersion(){return this.ul}dl(){let t=0;const e=[];for(const i in this.ll)e[t++]=i+"-"+this.ll[i];return e.join("/")}updateDimensions(t){Object.assign(this.ll,t),this.setKey(this.dl())}createFromWMTSTemplate(t){const e=this.fl,i={layer:this.Uo,style:this.K,tilematrixset:this.cl};"KVP"==e&&Object.assign(i,{Service:"WMTS",Request:"GetTile",Version:this.ul,Format:this.Os}),t="KVP"==e?pu(t,i):t.replace(/\{(\w+?)\}/g,(function(t,e){return e.toLowerCase()in i?i[e.toLowerCase()]:t}));const n=this.tileGrid,s=this.ll;return function(i,r,o){if(i){const r={TileMatrix:n.getMatrixId(i[0]),TileCol:i[1],TileRow:i[2]};Object.assign(r,s);let o=t;return o="KVP"==e?pu(o,r):o.replace(/\{(\w+?)\}/g,(function(t,e){return r[e]})),o}}}};const wm="renderOrder";var xm=class extends kr{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.pl=void 0!==t.declutter&&t.declutter,this.ml=void 0!==t.renderBuffer?t.renderBuffer:100,this.K=null,this.tt=void 0,this.setStyle(t.style),this.vl=void 0!==t.updateWhileAnimating&&t.updateWhileAnimating,this.gl=void 0!==t.updateWhileInteracting&&t.updateWhileInteracting}getDeclutter(){return this.pl}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.ml}getRenderOrder(){return this.get(wm)}getStyle(){return this.K}getStyleFunction(){return this.tt}getUpdateWhileAnimating(){return this.vl}getUpdateWhileInteracting(){return this.gl}renderDeclutter(t){t.declutterTree||(t.declutterTree=new Kc(9)),this.getRenderer().renderDeclutter(t)}setRenderOrder(t){this.set(wm,t)}setStyle(t){let e;if(void 0===t)e=jc;else if(null===t)e=null;else if("function"==typeof t)e=t;else if(t instanceof $c)e=t;else if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let e=0;ethis.Bl(t,e)));break;case"MultiPolygon":t.getPolygons().map((t=>this.Bl(t,e)));break;case"MultiLineString":t.getLineStrings().map((t=>this.Bl(t,e)));break;case"MultiPoint":t.getPoints().map((t=>this.Bl(t,e)));break;case"Polygon":const r=t;s=this.Yl(e),i=r.getFlatCoordinates(),n=i.length/2;const o=r.getLinearRingCount(),h=r.getEnds().map(((t,e,i)=>e>0?(t-i[e-1])/2:t/2));this.polygonBatch.verticesCount+=n,this.polygonBatch.ringsCount+=o,this.polygonBatch.geometriesCount++,s.flatCoordss.push(i),s.ringsVerticesCounts.push(h),s.verticesCount+=n,s.ringsCount+=o,r.getLinearRings().map((t=>this.Bl(t,e)));break;case"Point":const a=t;s=this.ql(e),i=a.getFlatCoordinates(),this.pointBatch.geometriesCount++,s.flatCoordss.push(i);break;case"LineString":case"LinearRing":const u=t;s=this.Xl(e),i=u.getFlatCoordinates(),n=i.length/2,this.lineStringBatch.verticesCount+=n,this.lineStringBatch.geometriesCount++,s.flatCoordss.push(i),s.verticesCount+=n}}changeFeature(t){this.Zl(t),this.Wl(t),this.Vl(t);const e=t.getGeometry();e&&this.Bl(e,t)}removeFeature(t){this.Zl(t),this.Wl(t),this.Vl(t)}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}};const zm={POSITION:"a_position",INDEX:"a_index"};var Gm=class extends Rm{constructor(t,e,i,n,s){super(t,e,i,n,s),this.attributes=[{name:zm.POSITION,size:2,type:cl.FLOAT},{name:zm.INDEX,size:1,type:cl.FLOAT}].concat(s.map((function(t){return{name:"a_"+t.name,size:1,type:cl.FLOAT}})))}generateRenderInstructions(t){const e=(2+this.customAttributes.length)*t.geometriesCount;let i;t.renderInstructions&&t.renderInstructions.length===e||(t.renderInstructions=new Float32Array(e));const n=[];let s,r=0;for(const e in t.entries){i=t.entries[e];for(let e=0,o=i.flatCoordss.length;e 0.93) return normalPx - tangentPx;\n float halfAngle = joinAngle / 2.0;\n vec2 angleBisectorNormal = vec2(\n sin(halfAngle) * normalPx.x + cos(halfAngle) * normalPx.y,\n -cos(halfAngle) * normalPx.x + sin(halfAngle) * normalPx.y\n );\n float length = 1.0 / sin(halfAngle);\n return angleBisectorNormal * length;\n }\n\n void main(void) {\n float anglePrecision = 1500.0;\n float paramShift = 10000.0;\n v_angleStart = fract(a_parameters / paramShift) * paramShift / anglePrecision;\n v_angleEnd = fract(floor(a_parameters / paramShift + 0.5) / paramShift) * paramShift / anglePrecision;\n float vertexNumber = floor(a_parameters / paramShift / paramShift + 0.0001);\n vec2 tangentPx = worldToPx(a_segmentEnd) - worldToPx(a_segmentStart);\n tangentPx = normalize(tangentPx);\n vec2 normalPx = vec2(-tangentPx.y, tangentPx.x);\n float normalDir = vertexNumber < 0.5 || (vertexNumber > 1.5 && vertexNumber < 2.5) ? 1.0 : -1.0;\n float tangentDir = vertexNumber < 1.5 ? 1.0 : -1.0;\n float angle = vertexNumber < 1.5 ? v_angleStart : v_angleEnd;\n vec2 offsetPx = getOffsetDirection(normalPx * normalDir, tangentDir * tangentPx, angle) * a_width * 0.5;\n vec2 position = vertexNumber < 1.5 ? a_segmentStart : a_segmentEnd;\n gl_Position = u_projectionMatrix * vec4(position, 0.0, 1.0) + pxToScreen(offsetPx);\n v_segmentStart = worldToPx(a_segmentStart);\n v_segmentEnd = worldToPx(a_segmentEnd);\n v_color = ${$m}\n v_opacity = a_opacity;\n v_width = a_width;\n }`,Ym="\n precision mediump float;\n uniform float u_pixelRatio;\n varying vec2 v_segmentStart;\n varying vec2 v_segmentEnd;\n varying float v_angleStart;\n varying float v_angleEnd;\n varying vec3 v_color;\n varying float v_opacity;\n varying float v_width;\n\n float segmentDistanceField(vec2 point, vec2 start, vec2 end, float radius) {\n vec2 startToPoint = point - start;\n vec2 startToEnd = end - start;\n float ratio = clamp(dot(startToPoint, startToEnd) / dot(startToEnd, startToEnd), 0.0, 1.0);\n float dist = length(startToPoint - ratio * startToEnd);\n return 1.0 - smoothstep(radius - 1.0, radius, dist);\n }\n\n void main(void) {\n vec2 v_currentPoint = gl_FragCoord.xy / u_pixelRatio;\n gl_FragColor = vec4(v_color, 1.0) * v_opacity;\n gl_FragColor *= segmentDistanceField(v_currentPoint, v_segmentStart, v_segmentEnd, v_width);\n }",Zm=`\n precision mediump float;\n uniform mat4 u_projectionMatrix;\n uniform mat4 u_offsetScaleMatrix;\n attribute vec2 a_position;\n attribute float a_index;\n attribute float a_color;\n attribute float a_opacity;\n varying vec2 v_texCoord;\n varying vec3 v_color;\n varying float v_opacity;\n\n void main(void) {\n mat4 offsetMatrix = u_offsetScaleMatrix;\n float size = 6.0;\n float offsetX = a_index == 0.0 || a_index == 3.0 ? -size / 2.0 : size / 2.0;\n float offsetY = a_index == 0.0 || a_index == 1.0 ? -size / 2.0 : size / 2.0;\n vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n float u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;\n float v = a_index == 0.0 || a_index == 1.0 ? 0.0 : 1.0;\n v_texCoord = vec2(u, v);\n v_color = ${$m}\n v_opacity = a_opacity;\n }`,Vm="\n precision mediump float;\n varying vec3 v_color;\n varying float v_opacity;\n\n void main(void) {\n gl_FragColor = vec4(v_color, 1.0) * v_opacity;\n }";function Wm(t){return Object.keys(t).map((e=>({name:e,callback:t[e]})))}var Hm=class extends Fl{constructor(t,e){const i=e.uniforms||{},n=[1,0,0,1,0,0];i[nl]=n,super(t,{uniforms:i,postProcesses:e.postProcesses}),this.yl=-1,this.ts=[1/0,1/0,-1/0,-1/0],this.El=n;const s={color:function(){return Um("#ddd")},opacity:function(){return 1},...e.fill&&e.fill.attributes},r={color:function(){return Um("#eee")},opacity:function(){return 1},width:function(){return 1.5},...e.stroke&&e.stroke.attributes},o={color:function(){return Um("#eee")},opacity:function(){return 1},...e.point&&e.point.attributes};this.Hl=e.fill&&e.fill.vertexShader||Bm,this.Kl=e.fill&&e.fill.fragmentShader||qm,this.Jl=Wm(s),this.Ql=e.stroke&&e.stroke.vertexShader||Xm,this.tc=e.stroke&&e.stroke.fragmentShader||Ym,this.ec=Wm(r),this.ic=e.point&&e.point.vertexShader||Zm,this.sc=e.point&&e.point.fragmentShader||Vm,this.rc=Wm(o),this.Rl=Im(),this.oc=new Om;const h=this.getLayer().getSource();this.oc.addFeatures(h.getFeatures()),this.Ol=[U(h,mf,this.zl,this),U(h,vf,this.Gl,this),U(h,yf,this.jl,this),U(h,gf,this.Dl,this)]}afterHelperCreated(){this.hc=new Dm(this.helper,this.Rl,this.Hl,this.Kl,this.Jl),this.ac=new Gm(this.helper,this.Rl,this.ic,this.sc,this.rc),this.uc=new Nm(this.helper,this.Rl,this.Ql,this.tc,this.ec)}zl(t){const e=t.feature;this.oc.addFeature(e)}Gl(t){const e=t.feature;this.oc.changeFeature(e)}jl(t){const e=t.feature;this.oc.removeFeature(e)}Dl(){this.oc.clear()}renderFrame(t){const e=this.helper.getGL();this.preRender(e,t);const i=this.getLayer().getSource(),n=t.viewState.projection,s=i.getWrapX()&&n.canWrapX(),r=n.getExtent(),o=t.extent,h=s?Ee(r):null,a=s?Math.ceil((o[2]-r[2])/h)+1:1;let u=s?Math.floor((o[0]-r[0])/h):0;do{this.hc.render(this.oc.polygonBatch,this.El,t,u*h),this.uc.render(this.oc.lineStringBatch,this.El,t,u*h),this.ac.render(this.oc.pointBatch,this.El,t,u*h)}while(++u{a--,this.ready=a<=0,this.getLayer().changed()};this.hc.rebuild(this.oc.polygonBatch,t,"Polygon",u),this.uc.rebuild(this.oc.lineStringBatch,t,"LineString",u),this.ac.rebuild(this.oc.pointBatch,t,"Point",u),this.ts=t.extent.slice()}return this.helper.makeProjectionTransform(t,this.El),this.helper.prepareDraw(t),!0}forEachFeatureAtCoordinate(t,e,i,n,s){}disposeInternal(){this.Rl.terminate(),this.Uo=null,this.Ol.forEach((function(t){B(t)})),this.Ol=null,super.disposeInternal()}};const Km={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},Jm=[Km.FILL],Qm=[Km.STROKE],tv=[Km.BEGIN_PATH],ev=[Km.CLOSE_PATH];var iv=Km;var nv=class extends Ga{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.lc=null,this.cc=null,this.fc=null,this.instructions=[],this.coordinates=[],this.dc=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return 1==e?t:t.map((function(t){return t*e}))}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.dc,s=this.coordinates;let r=s.length;for(let o=0,h=t.length;oo&&(this.instructions.push([iv.CUSTOM,o,a,t,i,qn]),this.hitDetectionInstructions.push([iv.CUSTOM,o,a,t,n||i,qn]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),a=this.coordinates.length,this.instructions.push([iv.CUSTOM,o,a,t,i]),this.hitDetectionInstructions.push([iv.CUSTOM,o,a,t,n||i])}this.endGeometry(e)}beginGeometry(t,e){this.lc=[iv.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.lc),this.cc=[iv.BEGIN_GEOMETRY,e,0,t],this.hitDetectionInstructions.push(this.cc)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let n,s,r=-1;for(e=0;ethis.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.fc=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0}createFill(t){const e=t.fillStyle,i=[iv.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(!0),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[iv.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;"string"==typeof i&&t.currentFillStyle==i||(void 0!==i&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,s=t.lineDash,r=t.lineDashOffset,o=t.lineJoin,h=t.lineWidth,a=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||s!=t.currentLineDash&&!g(t.currentLineDash,s)||t.currentLineDashOffset!=r||t.currentLineJoin!=o||t.currentLineWidth!=h||t.currentMiterLimit!=a)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=s,t.currentLineDashOffset=r,t.currentLineJoin=o,t.currentLineWidth=h,t.currentMiterLimit=a)}endGeometry(t){this.lc[2]=this.instructions.length,this.lc=null,this.cc[2]=this.hitDetectionInstructions.length,this.cc=null;const e=[iv.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.fc&&(this.fc=Wt(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;Vt(this.fc,t,this.fc)}return this.fc}};var sv=class extends nv{constructor(t,e,i,n){super(t,e,i,n),this.Eh=null,this.Ot=null,this.vc=void 0,this.gc=void 0,this.yc=void 0,this.wc=void 0,this.oh=void 0,this.xc=void 0,this.bc=void 0,this.hh=void 0,this.Ji=void 0,this.ah=void 0,this.Yh=void 0,this.fh=void 0,this.Mc=void 0}drawPoint(t,e){if(!this.Ot)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),s=this.coordinates.length,r=this.appendFlatPointCoordinates(i,n);this.instructions.push([iv.DRAW_IMAGE,s,r,this.Ot,this.gc*this.vc,this.yc*this.vc,Math.ceil(this.wc*this.vc),this.oh,this.xc*this.vc,this.bc*this.vc,this.hh,this.Ji,[this.ah[0]*this.pixelRatio/this.vc,this.ah[1]*this.pixelRatio/this.vc],Math.ceil(this.Yh*this.vc),this.fh,this.Mc]),this.hitDetectionInstructions.push([iv.DRAW_IMAGE,s,r,this.Eh,this.gc,this.yc,this.wc,this.oh,this.xc,this.bc,this.hh,this.Ji,this.ah,this.Yh,this.fh,this.Mc]),this.endGeometry(e)}drawMultiPoint(t,e){if(!this.Ot)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),s=this.coordinates.length,r=this.appendFlatPointCoordinates(i,n);this.instructions.push([iv.DRAW_IMAGE,s,r,this.Ot,this.gc*this.vc,this.yc*this.vc,Math.ceil(this.wc*this.vc),this.oh,this.xc*this.vc,this.bc*this.vc,this.hh,this.Ji,[this.ah[0]*this.pixelRatio/this.vc,this.ah[1]*this.pixelRatio/this.vc],Math.ceil(this.Yh*this.vc),this.fh,this.Mc]),this.hitDetectionInstructions.push([iv.DRAW_IMAGE,s,r,this.Eh,this.gc,this.yc,this.wc,this.oh,this.xc,this.bc,this.hh,this.Ji,this.ah,this.Yh,this.fh,this.Mc]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.gc=void 0,this.yc=void 0,this.Eh=null,this.Ot=null,this.vc=void 0,this.wc=void 0,this.ah=void 0,this.oh=void 0,this.xc=void 0,this.bc=void 0,this.hh=void 0,this.Ji=void 0,this.Yh=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),n=t.getSize(),s=t.getOrigin();this.vc=t.getPixelRatio(this.pixelRatio),this.gc=i[0],this.yc=i[1],this.Eh=t.getHitDetectionImage(),this.Ot=t.getImage(this.pixelRatio),this.wc=n[1],this.oh=t.getOpacity(),this.xc=s[0],this.bc=s[1],this.hh=t.getRotateWithView(),this.Ji=t.getRotation(),this.ah=t.getScaleArray(),this.Yh=n[0],this.fh=t.getDeclutterMode(),this.Mc=e}};var rv=class extends nv{constructor(t,e,i,n){super(t,e,i,n)}Sc(t,e,i,n){const s=this.coordinates.length,r=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),o=[iv.MOVE_TO_LINE_TO,s,r];return this.instructions.push(o),this.hitDetectionInstructions.push(o),i}drawLineString(t,e){const i=this.state,n=i.strokeStyle,s=i.lineWidth;if(void 0===n||void 0===s)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([iv.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,Vr,0],tv);const r=t.getFlatCoordinates(),o=t.getStride();this.Sc(r,0,r.length,o),this.hitDetectionInstructions.push(Qm),this.endGeometry(e)}drawMultiLineString(t,e){const i=this.state,n=i.strokeStyle,s=i.lineWidth;if(void 0===n||void 0===s)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([iv.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],tv);const r=t.getEnds(),o=t.getFlatCoordinates(),h=t.getStride();let a=0;for(let t=0,e=r.length;tt&&(y>g&&(g=y,m=w,v=o),y=0,w=o-s)),h=a,c=d,f=p),u=i,l=n}return y+=a,y>g?[w,o]:[m,v]}const av={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};var uv=class extends nv{constructor(t,e,i,n){super(t,e,i,n),this.Ec=null,this.nr="",this.sr=0,this.rr=0,this.hr=void 0,this.ar=0,this.lr=null,this.fillStates={},this.cr=null,this.strokeStates={},this.dr={},this.textStates={},this.Tc="",this.Cc="",this.Fc="",this.Mc=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e){const i=this.lr,n=this.cr,s=this.dr;if(""===this.nr||!s||!i&&!n)return;const r=this.coordinates;let o=r.length;const h=t.getType();let a=null,u=t.getStride();if("line"!==s.placement||"LineString"!=h&&"MultiLineString"!=h&&"Polygon"!=h&&"MultiPolygon"!=h){let i=s.overflow?null:[];switch(h){case"Point":case"MultiPoint":a=t.getFlatCoordinates();break;case"LineString":a=t.getFlatMidpoint();break;case"Circle":a=t.getCenter();break;case"MultiLineString":a=t.getFlatMidpoints(),u=2;break;case"Polygon":a=t.getFlatInteriorPoint(),s.overflow||i.push(a[2]/this.resolution),u=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();a=[];for(let t=0,n=e.length;t{const n=r[2*(t+i)]===a[i*u]&&r[2*(t+i)+1]===a[i*u+1];return n||--t,n}))}this.Ic(),(s.backgroundFill||s.backgroundStroke)&&(this.setFillStrokeStyle(s.backgroundFill,s.backgroundStroke),s.backgroundFill&&(this.updateFillStyle(this.state,this.createFill),this.hitDetectionInstructions.push(this.createFill(this.state))),s.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,e);let l=s.padding;if(l!=to&&(s.scale[0]<0||s.scale[1]<0)){let t=s.padding[0],e=s.padding[1],i=s.padding[2],n=s.padding[3];s.scale[0]<0&&(e=-e,n=-n),s.scale[1]<0&&(t=-t,i=-i),l=[t,e,i,n]}const c=this.pixelRatio;this.instructions.push([iv.DRAW_IMAGE,o,n,null,NaN,NaN,NaN,1,0,0,this.hr,this.ar,[1,1],NaN,void 0,this.Mc,l==to?to:l.map((function(t){return t*c})),!!s.backgroundFill,!!s.backgroundStroke,this.nr,this.Tc,this.Fc,this.Cc,this.sr,this.rr,i]);const f=1/c;this.hitDetectionInstructions.push([iv.DRAW_IMAGE,o,n,null,NaN,NaN,NaN,1,0,0,this.hr,this.ar,[f,f],NaN,void 0,this.Mc,l,!!s.backgroundFill,!!s.backgroundStroke,this.nr,this.Tc,this.Fc,this.Cc,this.sr,this.rr,i]),this.endGeometry(e)}else{if(!Te(this.getBufferedMaxExtent(),t.getExtent()))return;let i;if(a=t.getFlatCoordinates(),"LineString"==h)i=[a.length];else if("MultiLineString"==h)i=t.getEnds();else if("Polygon"==h)i=t.getEnds().slice(0,1);else if("MultiPolygon"==h){const e=t.getEndss();i=[];for(let t=0,n=e.length;tt[2]}else T=x>_;const C=Math.PI,F=[],I=M+n===e;let A;if(v=0,g=S,f=t[e=M],d=t[e+1],I){y(),A=Math.atan2(d-m,f-p),T&&(A+=A>0?-C:C);const t=(_+x)/2,e=(E+b)/2;return F[0]=[t,e,(P-r)/2,A,s],F}for(let t=0,c=(s=s.replace(/\n/g," ")).length;t0?-C:C),void 0!==A){let t=x-A;if(t+=t>C?-2*C:t<-C?2*C:0,Math.abs(t)>o)return null}A=x;const b=t;let M=0;for(;t0&&t.push("\n",""),t.push(e,""),t}var Sv=class{constructor(t,e,i,n){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.Oc,this.instructions=n.instructions,this.coordinates=n.coordinates,this.zc={},this.Gc=[1,0,0,1,0,0],this.hitDetectionInstructions=n.hitDetectionInstructions,this.pr=null,this.js=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.jc={},this.Ec={}}createLabel(t,e,i,n){const s=t+e+i+n;if(this.Ec[s])return this.Ec[s];const r=n?this.strokeStates[n]:null,o=i?this.fillStates[i]:null,h=this.textStates[e],a=this.pixelRatio,u=[h.scale[0]*a,h.scale[1]*a],l=Array.isArray(t),c=h.justify?av[h.justify]:bv(Array.isArray(t)?t[0]:t,h.textAlign||Jr),f=n&&r.lineWidth?r.lineWidth:0,d=l?t:t.split("\n").reduce(Mv,[]),{width:p,height:m,widths:v,heights:g,lineWidths:y}=lo(h,d),w=p+f,x=[],b=(w+2)*u[0],M=(m+f)*u[1],S={width:b<0?Math.floor(b):Math.ceil(b),height:M<0?Math.floor(M):Math.ceil(M),contextInstructions:x};1==u[0]&&1==u[1]||x.push("scale",u),n&&(x.push("strokeStyle",r.strokeStyle),x.push("lineWidth",f),x.push("lineCap",r.lineCap),x.push("lineJoin",r.lineJoin),x.push("miterLimit",r.miterLimit),x.push("setLineDash",[r.lineDash]),x.push("lineDashOffset",r.lineDashOffset)),i&&x.push("fillStyle",o.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const P=.5-c;let _=c*w+P*f;const E=[],T=[];let C,F=0,I=0,A=0,k=0;for(let t=0,e=d.length;tt?t-a:s,w=r+u>e?e-u:r,x=d[3]+y*c[0]+d[1],b=d[0]+w*c[1]+d[2],M=v-d[3],S=g-d[0];let P;return(p||0!==l)&&(mv[0]=M,yv[0]=M,mv[1]=S,vv[1]=S,vv[0]=M+x,gv[0]=vv[0],gv[1]=S+b,yv[1]=gv[1]),0!==l?(P=Ot([1,0,0,1,0,0],i,n,1,1,l,-i,-n),At(P,mv),At(P,vv),At(P,gv),At(P,yv),ie(Math.min(mv[0],vv[0],gv[0],yv[0]),Math.min(mv[1],vv[1],gv[1],yv[1]),Math.max(mv[0],vv[0],gv[0],yv[0]),Math.max(mv[1],vv[1],gv[1],yv[1]),pv)):ie(Math.min(M,M+x),Math.min(S,S+b),Math.max(M,M+x),Math.max(S,S+b),pv),f&&(v=Math.round(v),g=Math.round(g)),{drawImageX:v,drawImageY:g,drawImageW:y,drawImageH:w,originX:a,originY:u,declutterBox:{minX:pv[0],minY:pv[1],maxX:pv[2],maxY:pv[3],value:m},canvasTransform:P,scale:c}}Bc(t,e,i,n,s,r,o){const h=!(!r&&!o),a=n.declutterBox,u=t.canvas,l=o?o[2]*n.scale[0]/2:0;return a.minX-l<=u.width/e&&a.maxX+l>=0&&a.minY-l<=u.height/e&&a.maxY+l>=0&&(h&&this.Dc(t,mv,vv,gv,yv,r,o),co(t,n.canvasTransform,s,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}ph(t){if(this.Oc){const e=At(this.Gc,[0,0]),i=512*this.pixelRatio;t.save(),t.translate(e[0]%i,e[1]%i),t.rotate(this.js)}t.fill(),this.Oc&&t.restore()}Uc(t,e){t.strokeStyle=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])}qc(t,e,i,n){const s=this.textStates[e],r=this.createLabel(t,e,n,i),o=this.strokeStates[i],h=this.pixelRatio,a=bv(Array.isArray(t)?t[0]:t,s.textAlign||Jr),u=av[s.textBaseline||Qr],l=o&&o.lineWidth?o.lineWidth:0;return{label:r,anchorX:a*(r.width/h-2*s.scale[0])+2*(.5-a)*l,anchorY:u*r.height/h+2*(.5-u)*l}}Xc(t,e,i,n,s,r,o,h){let a;this.pr&&g(i,this.Gc)?a=this.pr:(this.pr||(this.pr=[]),a=gn(this.coordinates,0,this.coordinates.length,2,i,this.pr),It(this.Gc,i));let u=0;const l=n.length;let c,f,d,p,m,v,y,w,x,b,M,S,P=0,_=0,E=0,T=null,C=null;const F=this.zc,I=this.js,A=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,k={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:I},R=this.instructions!=n||this.overlaps?0:200;let L,N,O,z;for(;uR&&(this.ph(t),_=0),E>R&&(t.stroke(),E=0),_||E||(t.beginPath(),p=NaN,m=NaN),++u;break;case iv.CIRCLE:P=i[1];const n=a[P],l=a[P+1],g=a[P+2]-n,G=a[P+3]-l,j=Math.sqrt(g*g+G*G);t.moveTo(n+j,l),t.arc(n,l,j,0,2*Math.PI,!0),++u;break;case iv.CLOSE_PATH:t.closePath(),++u;break;case iv.CUSTOM:P=i[1],c=i[2];const D=i[3],U=i[4],$=6==i.length?i[5]:void 0;k.geometry=D,k.feature=L,u in F||(F[u]=[]);const B=F[u];$?$(a,P,c,2,B):(B[0]=a[P],B[1]=a[P+1],B.length=2),U(B,k),++u;break;case iv.DRAW_IMAGE:P=i[1],c=i[2],w=i[3],f=i[4],d=i[5];let q=i[6];const X=i[7],Y=i[8],Z=i[9],V=i[10];let W=i[11];const H=i[12];let K=i[13];const J=i[14],Q=i[15];if(!w&&i.length>=20){x=i[19],b=i[20],M=i[21],S=i[22];const t=this.qc(x,b,M,S);w=t.label,i[3]=w;const e=i[23];f=(t.anchorX-e)*this.pixelRatio,i[4]=f;const n=i[24];d=(t.anchorY-n)*this.pixelRatio,i[5]=d,q=w.height,i[6]=q,K=w.width,i[13]=K}let tt,et,it,nt;i.length>25&&(tt=i[25]),i.length>17?(et=i[16],it=i[17],nt=i[18]):(et=to,it=!1,nt=!1),V&&A?W+=I:V||A||(W-=I);let st=0;for(;Pi)break;let h=n[o];h||(h=[],n[o]=h),h.push(4*((t+s)*e+(t+r))+3),s>0&&h.push(4*((t-s)*e+(t+r))+3),r>0&&(h.push(4*((t+s)*e+(t-r))+3),s>0&&h.push(4*((t-s)*e+(t-r))+3))}const s=[];for(let t=0,e=n.length;t0){if(!r||"Image"!==f&&"Text"!==f||r.includes(t)){const i=(c[h]-3)/4,r=n-i%o,a=n-(i/o|0),u=s(t,e,r*r+a*a);if(u)return u}u.clearRect(0,0,o,o);break}}const m=Object.keys(this.Yc).map(Number);let v,g,y,w,x;for(m.sort(d),v=m.length-1;v>=0;--v){const t=m[v].toString();for(y=this.Yc[t],g=Pv.length-1;g>=0;--g)if(f=Pv[g],w=y[f],void 0!==w&&(x=w.executeHitDetection(u,h,i,p,l),x))return x}}getClipCoords(t){const e=this.Rc;if(!e)return null;const i=e[0],n=e[1],s=e[2],r=e[3],o=[i,n,i,r,s,r,s,n];return gn(o,0,8,2,t,o),o}isEmpty(){return _(this.Yc)}execute(t,e,i,n,s,r,o){const h=Object.keys(this.Yc).map(Number);let a,u,l,c,f,p;for(h.sort(d),this.Rc&&(t.save(),this.clip(t,i)),r=r||Pv,o&&h.reverse(),a=0,u=h.length;ac[2];)++l,o=s*l,h.push(this.getRenderTransform(e,i,n,Cv,a,u,o).slice()),t-=s}this.Qc=Fv(t,h,this.tf,o.getStyleFunction(),r,i,n)}e(Iv(t,this.tf,this.Qc))}.bind(this))}forEachFeatureAtCoordinate(t,e,n,s,r){if(!this.uf)return;const o=e.viewState.resolution,h=e.viewState.rotation,a=this.getLayer(),u={},l=function(t,e,n){const o=i(t),h=u[o];if(h){if(!0!==h&&nc=i.forEachFeatureAtCoordinate(t,o,h,n,l,i===this.declutterExecutorGroup&&e.declutterTree?e.declutterTree.all().map((t=>t.value)):null))),c}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.uf&&t.changed()}Kc(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[jo],s=t.viewHints[Do],r=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!r&&n||!o&&s)return this.Jc=!0,!0;this.Jc=!1;const h=t.extent,a=t.viewState,u=a.projection,l=a.resolution,c=t.pixelRatio,f=e.getRevision(),d=e.getRenderBuffer();let p=e.getRenderOrder();void 0===p&&(p=Ua);const m=a.center.slice(),v=Vt(h,d*l),y=v.slice(),w=[v.slice()],x=u.getExtent();if(i.getWrapX()&&u.canWrapX()&&!Jt(x,t.extent)){const t=Ee(x),e=Math.max(Ee(v)/2,t);v[0]=x[0]-e,v[2]=x[2]+e,Ri(m,u);const i=Re(w[0],u);i[0]x[0]&&i[2]>x[2]&&w.push([i[0]-t,i[1],i[2]-t,i[3]])}if(this.ready&&this.ef==l&&this._u==f&&this.af==p&&Jt(this.if,v))return g(this.Gu,y)||(this.Qc=null,this.Gu=y),this.rf=m,this.replayGroupChanged=!1,!0;this.uf=null;const b=new cv(Ba(l,c),v,l,c);let M;this.getLayer().getDeclutter()&&(M=new cv(Ba(l,c),v,l,c));const S=an();let P;if(S){for(let t=0,e=w.length;tt([])));const e=At(this.mf,At(this.vf,t.slice()));return this.df.getFeatures(e)}handleFontsChanged(){this.df.handleFontsChanged()}prepareFrame(t){const e=t.pixelRatio,i=t.viewState,n=i.resolution,s=t.viewHints,r=this.df;let o=t.extent;1!==this.pf&&(o=o.slice(0),Ie(o,this.pf));const h=Ee(o)/n,a=Me(o)/n;if(!s[jo]&&!s[Do]&&!Ce(o)){r.useContainer(null,null);const s=r.context,u=t.layerStatesArray[t.layerIndex];s.globalAlpha=u.opacity;const l=Object.assign({},u,{opacity:1}),c=Object.assign({},t,{declutterTree:new Kc(9),extent:o,size:[h,a],viewState:Object.assign({},t.viewState,{rotation:0}),layerStatesArray:[l],layerIndex:0});let f=!0;const d=new Xs(o,n,e,s.canvas,(function(t){r.prepareFrame(c)&&r.replayGroupChanged&&(r.clipping=!1,r.renderFrame(c,null)&&(r.renderDeclutter(c),f=!1),t())}));d.addEventListener(T,function(){if(d.getState()!==Ds)return;this.Ot=f?null:d;const t=d.getResolution(),n=d.getPixelRatio(),s=t*e/n;this.renderedResolution=s,this.mf=Ot(this.mf,h/2,a/2,1/s,-1/s,0,-i.center[0],-i.center[1])}.bind(this)),d.load()}return this.Ot&&(this.vf=t.pixelToCoordinateTransform.slice()),!!this.Ot}preRender(){}postRender(){}renderDeclutter(){}forEachFeatureAtCoordinate(t,e,i,n,s){return this.df?this.df.forEachFeatureAtCoordinate(t,e,i,n,s):super.forEachFeatureAtCoordinate(t,e,i,n,s)}};const Rv={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},Lv={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};var Nv=class extends Yp{constructor(t){super(t),this.Hc=this.Kc.bind(this),this.gf,this.vf=null,this.nf,this.yf=[1,0,0,1,0,0]}prepareTile(t,e,i){let n;const s=t.getState();return s!==it&&s!==nt||(this.wf(t,e,i),this.xf(t)&&(n=!0)),n}getTile(t,e,i,n){const s=n.pixelRatio,r=n.viewState,o=r.resolution,h=r.projection,a=this.getLayer(),u=a.getSource().getTile(t,e,i,s,h),l=n.viewHints,c=!(l[jo]||l[Do]);!c&&u.wantedResolution||(u.wantedResolution=o);return this.prepareTile(u,s,h)&&(c||Date.now()-n.time<8)&&"vector"!==a.getRenderMode()&&this.bf(u,n),super.getTile(t,e,i,n)}isDrawableTile(t){const e=this.getLayer();return super.isDrawableTile(t)&&("vector"===e.getRenderMode()?i(e)in t.executorGroups:t.hasContext(e))}getTileImage(t){return t.getImage(this.getLayer())}prepareFrame(t){const e=this.getLayer().getRevision();return this.gf!==e&&(this.gf=e,this.renderedTiles.length=0),super.prepareFrame(t)}wf(t,e,n){const s=this.getLayer(),r=s.getRevision(),o=s.getRenderOrder()||null,h=t.wantedResolution,a=t.getReplayState(s);if(!a.dirty&&a.renderedResolution===h&&a.renderedRevision==r&&a.renderedRenderOrder==o)return;const u=s.getSource(),l=s.getDeclutter(),c=u.getTileGrid(),f=u.getTileGridForProjection(n).getTileCoordExtent(t.wrappedTileCoord),d=u.getSourceTiles(e,n,t),p=i(s);delete t.hitDetectionImageData[p],t.executorGroups[p]=[],l&&(t.declutterExecutorGroups[p]=[]),a.dirty=!1;for(let i=0,n=d.length;i{const s=i===v?e.declutterTree.all().map((t=>t.value)):null;for(let e=0,r=i.length;e0)return void e([]);const p=Pe(l.getTileCoordExtent(d.wrappedTileCoord)),m=[(c[0]-p[0])/u,(p[1]-c[1])/u],v=d.getSourceTiles().reduce((function(t,e){return t.concat(e.getFeatures())}),[]);let g=d.hitDetectionImageData[r];if(!g&&!this.Jc){const t=ia(l.getTileSize(l.getZForResolution(u,o.zDirection))),e=this.nf;g=Fv(t,[this.getRenderTransform(l.getTileCoordCenter(d.wrappedTileCoord),u,0,Cv,t[0]*Cv,t[1]*Cv,0)],v,s.getStyleFunction(),l.getTileCoordExtent(d.wrappedTileCoord),d.getReplayState(s).renderedResolution,e),d.hitDetectionImageData[r]=g}e(Iv(m,v,g))}.bind(this))}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&void 0!==this.gf&&t.changed()}Kc(t){this.renderIfReadyAndVisible()}renderDeclutter(t){const e=this.context,n=e.globalAlpha;e.globalAlpha=this.getLayer().getOpacity();const s=t.viewHints,r=!(s[jo]||s[Do]),o=this.renderedTiles;for(let e=0,n=o.length;e=0;--e)s[e].execute(this.context,1,this.getTileRenderTransform(n,t),t.viewState.rotation,r,void 0,t.declutterTree)}e.globalAlpha=n}getTileRenderTransform(t,e){const i=e.pixelRatio,n=e.viewState,s=n.center,r=n.resolution,o=n.rotation,h=e.size,a=Math.round(h[0]*i),u=Math.round(h[1]*i),l=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),c=t.tileCoord,f=l.getTileCoordExtent(t.wrappedTileCoord),d=l.getTileCoordExtent(c,this.tmpExtent)[0]-f[0];return Ct(Rt(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(s,r,o,i,a,u,d))}postRender(t,e){const n=e.viewHints,s=!(n[jo]||n[Do]);this.vf=e.pixelToCoordinateTransform.slice(),this.nf=e.viewState.rotation;const r=this.getLayer(),o=r.getRenderMode(),h=t.globalAlpha;t.globalAlpha=r.getOpacity();const a=Lv[o],u=e.viewState,l=u.rotation,c=r.getSource(),f=c.getTileGridForProjection(u.projection).getZForResolution(u.resolution,c.zDirection),d=this.renderedTiles,p=[],m=[];let v=!0;for(let n=d.length-1;n>=0;--n){const o=d[n];v=v&&!o.getReplayState(r).dirty;const h=o.executorGroups[i(r)].filter((t=>t.hasExecutors(a)));if(0===h.length)continue;const u=this.getTileRenderTransform(o,e),c=o.tileCoord[0];let g=!1;const y=h[0].getClipCoords(u);if(y){for(let e=0,i=p.length;e1?o:2,r=r||new Array(o);for(let e=0;e>1;s1?new Zv(i,"XY",s):new xs(i,"XY",n);default:throw new Error("Invalid geometry type:"+e)}}Wv.prototype.getEndss=Wv.prototype.getEnds,Wv.prototype.getFlatCoordinates=Wv.prototype.getOrientedFlatCoordinates;var Kv=Wv;var Jv=class extends xm{constructor(t){super(t)}createRenderer(){return new Av(this)}};function Qv(t,e,i){const n=[];let s=t(0),r=t(1),o=e(s),h=e(r);const a=[r,s],u=[h,o],l=[1,0],c={};let f,d,p,m,v,g,y=1e5;for(;--y>0&&l.length>0;)p=l.pop(),s=a.pop(),o=u.pop(),g=p.toString(),g in c||(n.push(o[0],o[1]),c[g]=!0),m=l.pop(),r=a.pop(),h=u.pop(),v=(p+m)/2,f=t(v),d=e(f),ai(d[0],d[1],o[0],o[1],h[0],h[1])this.fd.length;)h=new pt,this.fd.push(h);const u=n.getFeaturesCollection();u.clear();let l,c,f=0;for(l=0,c=this.Uf.length;lMath.PI/2}const f=Ya(t);for(let t=h;t<=a;++t){let i,n,l,d,p=this.Uf.length+this.$f.length;if(this.Kf)for(n=0,l=this.Kf.length;n=h?(t[0]=o[0],t[2]=o[2]):r=!0);const a=[hi(e[0],this.zf,this.Nf),hi(e[1],this.Gf,this.Of)],u=this.Xf(a);isNaN(u[1])&&(u[1]=Math.abs(this.Af)>=Math.abs(this.Rf)?this.Af:this.Rf);let l=hi(u[0],this.Lf,this.kf),c=hi(u[1],this.Rf,this.Af);const f=this.Df;let d,p,m,v,g=t;r||(g=[hi(t[0],this.zf,this.Nf),hi(t[1],this.Gf,this.Of),hi(t[2],this.zf,this.Nf),hi(t[3],this.Gf,this.Of)]);const y=ke(g,this.Xf,void 0,8);let w=y[3],x=y[2],b=y[1],M=y[0];if(r||(Kt(g,this.Zf)&&(M=this.Lf,b=this.Rf),Kt(g,this.Vf)&&(x=this.kf,b=this.Rf),Kt(g,this.Wf)&&(M=this.Lf,w=this.Af),Kt(g,this.Hf)&&(x=this.kf,w=this.Af),w=hi(w,c,this.Af),x=hi(x,l,this.kf),b=hi(b,this.Rf,c),M=hi(M,this.Lf,l)),l=Math.floor(l/s)*s,v=hi(l,this.Lf,this.kf),p=this.yd(v,b,w,n,t,0),d=0,r)for(;(v-=s)>=M&&d++n[r]&&(s=r,r=1);const o=Math.max(e[1],n[s]),h=Math.min(e[3],n[r]),a=hi(e[1]+Math.abs(e[1]-e[3])*this.ed,o,h),u=[n[s-1]+(n[r-1]-n[s-1])*(a-n[s])/(n[r]-n[s]),a],l=this.Kf[i].geom;return l.setCoordinates(u),l}getMeridians(){return this.Uf}bd(t,e,i,n,s){const r=eg(t,e,i,this.fi,n);let o=this.$f[s];return o?(o.setFlatCoordinates("XY",r),o.changed()):o=new $v(r,"XY"),o}Sd(t,e,i){const n=t.getFlatCoordinates();let s=0,r=n.length-2;n[s]>n[r]&&(s=r,r=0);const o=Math.max(e[0],n[s]),h=Math.min(e[2],n[r]),a=hi(e[0]+Math.abs(e[0]-e[2])*this.sd,o,h),u=[a,n[s+1]+(n[r+1]-n[s+1])*(a-n[s])/(n[r]-n[s])],l=this.Jf[i].geom;return l.setCoordinates(u),l}getParallels(){return this.$f}vd(t){const e=Yi("EPSG:4326"),i=t.getWorldExtent();this.Af=i[3],this.kf=i[2],this.Rf=i[1],this.Lf=i[0];const n=nn(t,e);if(this.Lf=Math.abs(this.Rf)?this.Af:this.Rf),this.fi=t}};const rg="blur",og="gradient",hg="radius",ag=["#00f","#0ff","#0f0","#ff0","#f00"];var ug=class extends xm{constructor(t){t=t||{};const e=Object.assign({},t);delete e.gradient,delete e.radius,delete e.blur,delete e.weight,super(e),this._d=null,this.addChangeListener(og,this.Ed),this.setGradient(t.gradient?t.gradient:ag),this.setBlur(void 0!==t.blur?t.blur:15),this.setRadius(void 0!==t.radius?t.radius:8);const i=t.weight?t.weight:"weight";this.Td="string"==typeof i?function(t){return t.get(i)}:i,this.setRenderOrder(null)}getBlur(){return this.get(rg)}getGradient(){return this.get(og)}getRadius(){return this.get(hg)}Ed(){this._d=function(t){const e=1,i=256,n=Ys(e,i),s=n.createLinearGradient(0,0,e,i),r=1/(t.length-1);for(let e=0,i=t.length;e>3)?i.readString():2===t?i.readFloat():3===t?i.readDouble():4===t?i.readVarint64():5===t?i.readVarint():6===t?i.readSVarint():7===t?i.readBoolean():null;e.values.push(n)}}function vg(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t){const t=i.readVarint()+i.pos;for(;i.pos>3}o--,1===r||2===r?(h+=t.readSVarint(),a+=t.readSVarint(),1===r&&u>l&&(n.push(u),l=u),i.push(h,a),u+=2):7===r?u>l&&(i.push(i[l],i[l+1]),u+=2):ct(!1,59)}u>l&&(n.push(u),l=u)}kd(t,e,i){const n=e.type;if(0===n)return null;let s;const r=e.properties;let o;this.Id?(o=r[this.Id],delete r[this.Id]):o=e.id,r[this.Fd]=e.layer.name;const h=[],a=[];this.Ad(t,e,h,a);const u=function(t,e){let i;1===t?i=1===e?"Point":"MultiPoint":2===t?i=1===e?"LineString":"MultiLineString":3===t&&(i="Polygon");return i}(n,a.length);if(this.Cd===Kv)s=new this.Cd(u,h,a,r,o),s.transform(i.dataProjection);else{let t;if("Polygon"==u){const e=ys(h,a);t=e.length>1?new Zv(h,"XY",e):new xs(h,"XY",a)}else t="Point"===u?new Qn(h,"XY"):"LineString"===u?new $v(h,"XY"):"MultiPoint"===u?new zv(h,"XY"):"MultiLineString"===u?new qv(h,"XY",a):null;s=new(0,this.Cd),this.H&&s.setGeometryName(this.H);const e=cg(t,!1,i);s.setGeometry(e),void 0!==o&&s.setId(o),s.setProperties(r,!0)}return s}getType(){return"arraybuffer"}readFeatures(t,e){const i=this.qu,n=Yi((e=this.adaptOptions(e)).dataProjection);n.setWorldExtent(e.extent),e.dataProjection=n;const s=new dg(t),r=s.readFields(pg,{}),o=[];for(const t in r){if(i&&!i.includes(t))continue;const h=r[t],a=h?[0,0,h.extent,h.extent]:null;n.setExtent(a);for(let t=0,i=h.length;t255?255:t}function Ag(t){return t<0?0:t>1?1:t}function kg(t){return"%"===t[t.length-1]?Ig(parseFloat(t)/100*255):Ig(parseInt(t))}function Rg(t){return"%"===t[t.length-1]?Ag(parseFloat(t)/100):Ag(parseFloat(t))}function Lg(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}try{Tg={}.parseCSSColor=function(t){var e,i=t.replace(/ /g,"").toLowerCase();if(i in Fg)return Fg[i].slice();if("#"===i[0])return 4===i.length?(e=parseInt(i.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===i.length&&(e=parseInt(i.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var n=i.indexOf("("),s=i.indexOf(")");if(-1!==n&&s+1===i.length){var r=i.substr(0,n),o=i.substr(n+1,s-(n+1)).split(","),h=1;switch(r){case"rgba":if(4!==o.length)return null;h=Rg(o.pop());case"rgb":return 3!==o.length?null:[kg(o[0]),kg(o[1]),kg(o[2]),h];case"hsla":if(4!==o.length)return null;h=Rg(o.pop());case"hsl":if(3!==o.length)return null;var a=(parseFloat(o[0])%360+360)%360/360,u=Rg(o[1]),l=Rg(o[2]),c=l<=.5?l*(u+1):l+u-l*u,f=2*l-c;return[Ig(255*Lg(f,c,a+1/3)),Ig(255*Lg(f,c,a)),Ig(255*Lg(f,c,a-1/3)),h];default:return null}}return null}}catch(t){}var Ng=function(t,e,i,n){void 0===n&&(n=1),this.r=t,this.g=e,this.b=i,this.a=n};function Og(t){return"object"==typeof t?["literal",t]:t}function zg(t,e){var i=t.stops;if(!i)return function(t,e){var i=["get",t.property];if(void 0===t.default)return"string"===e.type?["string",i]:i;if("enum"===e.type)return["match",i,Object.keys(e.values),i,t.default];var n=["color"===e.type?"to-color":e.type,i,Og(t.default)];return"array"===e.type&&n.splice(1,0,e.value,e.length||null),n}(t,e);var n=i&&"object"==typeof i[0][0],s=n||void 0!==t.property,r=n||!s;return i=i.map((function(t){return!s&&e.tokens&&"string"==typeof t[1]?[t[0],qg(t[1])]:[t[0],Og(t[1])]})),n?function(t,e,i){for(var n={},s={},r=[],o=0;o3&&e===t[t.length-2]||(n&&2===t.length||t.push(e),t.push(i))}function Bg(t,e){return t.type?t.type:e.expression.interpolated?"exponential":"interval"}function qg(t){for(var e=["concat"],i=/{([^{}]+)}/g,n=0,s=i.exec(t);null!==s;s=i.exec(t)){var r=t.slice(n,i.lastIndex-s[0].length);n=i.lastIndex,r.length>0&&e.push(r),e.push(["get",s[1]])}if(1===e.length)return t;if(n":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var ry=[Zg,Vg,Wg,Hg,Kg,ey,Jg,ny(Qg),iy];function oy(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!oy(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(var i=0,n=ry;i=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:"Invalid rgba value ["+[t,e,i,n].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof n?[t,e,i,n]:[t,e,i]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function py(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof Ng)return!0;if(t instanceof uy)return!0;if(t instanceof cy)return!0;if(t instanceof fy)return!0;if(Array.isArray(t)){for(var e=0,i=t;e2){var h=t[1];if("string"!=typeof h||!(h in wy)||"object"===h)return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=wy[h],n++}else r=Qg;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);o=t[2],n++}i=ny(r,o)}else i=wy[s];for(var a=[];n1)&&e.push(n)}}return e.concat(this.args.map((function(t){return t.serialize()})))};var by=function(t){this.type=ey,this.sections=t};by.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");for(var n=[],s=!1,r=1;r<=t.length-1;++r){var o=t[r];if(s&&"object"==typeof o&&!Array.isArray(o)){s=!1;var h=null;if(o["font-scale"]&&!(h=e.parse(o["font-scale"],1,Vg)))return null;var a=null;if(o["text-font"]&&!(a=e.parse(o["text-font"],1,ny(Wg))))return null;var u=null;if(o["text-color"]&&!(u=e.parse(o["text-color"],1,Kg)))return null;var l=n[n.length-1];l.scale=h,l.font=a,l.textColor=u}else{var c=e.parse(t[r],1,Qg);if(!c)return null;var f=c.type.kind;if("string"!==f&&"value"!==f&&"null"!==f&&"resolvedImage"!==f)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");s=!0,n.push({content:c,scale:null,font:null,textColor:null})}}return new by(n)},by.prototype.evaluate=function(t){return new cy(this.sections.map((function(e){var i=e.content.evaluate(t);return my(i)===iy?new ly("",i,null,null,null):new ly(vy(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))},by.prototype.eachChild=function(t){for(var e=0,i=this.sections;e-1),i},My.prototype.eachChild=function(t){t(this.input)},My.prototype.outputDefined=function(){return!1},My.prototype.serialize=function(){return["image",this.input.serialize()]};var Sy={"to-boolean":Hg,"to-color":Kg,"to-number":Vg,"to-string":Wg},Py=function(t,e){this.type=t,this.args=e};Py.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var i=t[0];if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");for(var n=Sy[i],s=[],r=1;r4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":dy(e[0],e[1],e[2],e[3])))return new Ng(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new yy(i||"Could not parse color from value '"+("string"==typeof e?e:String(JSON.stringify(e)))+"'")}if("number"===this.type.kind){for(var o=null,h=0,a=this.args;h=e[2])&&(!(t[1]<=e[1])&&!(t[3]>=e[3])))}function ky(t,e){var i,n=(180+t[0])/360,s=(i=t[1],(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360),r=Math.pow(2,e.z);return[Math.round(n*r*Fy),Math.round(s*r*Fy)]}function Ry(t,e,i){var n=t[0]-e[0],s=t[1]-e[1],r=t[0]-i[0],o=t[1]-i[1];return n*o-r*s==0&&n*r<=0&&s*o<=0}function Ly(t,e,i){return e[1]>t[1]!=i[1]>t[1]&&t[0]<(i[0]-e[0])*(t[1]-e[1])/(i[1]-e[1])+e[0]}function Ny(t,e){for(var i=!1,n=0,s=e.length;n0&&c<0||l<0&&c>0}function Gy(t,e,i){for(var n=0,s=i;ni[2]){var s=.5*n,r=t[0]-i[0]>s?-n:i[0]-t[0]>s?n:0;0===r&&(r=t[0]-i[2]>s?-n:i[2]-t[0]>s?n:0),t[0]+=r}Iy(e,t)}function qy(t,e,i,n){var s=Math.pow(2,n.z)*Fy,r=[n.x*Fy,n.y*Fy],o=[];if(!t)return o;for(var h=0,a=t;h=0)return!1;var i=!0;return t.eachChild((function(t){i&&!Wy(t,e)&&(i=!1)})),i}Yy.parse=function(t,e){if(2!==t.length)return e.error("'within' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(py(t[1])){var i=t[1];if("FeatureCollection"===i.type)for(var n=0;ne))throw new yy("Input is not a number.");o=h-1}return 0}Ky.prototype.parse=function(t,e,i,n,s){return void 0===s&&(s={}),e?this.concat(e,i,n)._parse(t,s):this._parse(t,s)},Ky.prototype._parse=function(t,e){function i(t,e,i){return"assert"===i?new xy(e,[t]):"coerce"===i?new Py(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var n=t[0];if("string"!=typeof n)return this.error("Expression name must be a string, but found "+typeof n+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var s=this.registry[n];if(s){var r=s.parse(t,this);if(!r)return null;if(this.expectedType){var o=this.expectedType,h=r.type;if("string"!==o.kind&&"number"!==o.kind&&"boolean"!==o.kind&&"object"!==o.kind&&"array"!==o.kind||"value"!==h.kind)if("color"!==o.kind&&"formatted"!==o.kind&&"resolvedImage"!==o.kind||"value"!==h.kind&&"string"!==h.kind){if(this.checkSubtype(o,h))return null}else r=i(r,o,e.typeAnnotation||"coerce");else r=i(r,o,e.typeAnnotation||"assert")}if(!(r instanceof gy)&&"resolvedImage"!==r.type.kind&&Jy(r)){var a=new Ey;try{r=new gy(r.type,r.evaluate(a))}catch(t){return this.error(t.message),null}}return r}return this.error('Unknown expression "'+n+'". If you wanted a literal array, use ["literal", [...]].',0)}return void 0===t?this.error("'undefined' value invalid. Use null instead."):"object"==typeof t?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error("Expected an array, but found "+typeof t+" instead.")},Ky.prototype.concat=function(t,e,i){var n="number"==typeof t?this.path.concat(t):this.path,s=i?this.scope.concat(i):this.scope;return new Ky(this.registry,n,e||null,s,this.errors)},Ky.prototype.error=function(t){for(var e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];var n=""+this.key+e.map((function(t){return"["+t+"]"})).join("");this.errors.push(new Xg(n,t))},Ky.prototype.checkSubtype=function(t,e){var i=oy(t,e);return i&&this.error(i),i};var tw=function(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var n=0,s=i;n=o)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);var l=e.parse(h,u,s);if(!l)return null;s=s||l.type,n.push([o,l])}return new tw(s,i,n)},tw.prototype.evaluate=function(t){var e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);var s=e.length;return n>=e[s-1]?i[s-1].evaluate(t):i[Qy(e,n)].evaluate(t)},tw.prototype.eachChild=function(t){t(this.input);for(var e=0,i=this.outputs;e0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t};var ew=iw;function iw(t,e,i,n){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=i,this.p2y=n}function nw(t,e,i){return t*(1-i)+e*i}iw.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},iw.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},iw.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},iw.prototype.solveCurveX=function(t,e){var i,n,s,r,o;for(void 0===e&&(e=1e-6),s=t,o=0;o<8;o++){if(r=this.sampleCurveX(s)-t,Math.abs(r)(n=1))return n;for(;ir?i=s:n=s,s=.5*(n-i)+i}return s},iw.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var sw=Object.freeze({__proto__:null,number:nw,color:function(t,e,i){return new Ng(nw(t.r,e.r,i),nw(t.g,e.g,i),nw(t.b,e.b,i),nw(t.a,e.a,i))},array:function(t,e,i){return t.map((function(t,n){return nw(t,e[n],i)}))}}),rw=.95047,ow=1.08883,hw=4/29,aw=6/29,uw=3*aw*aw,lw=Math.PI/180,cw=180/Math.PI;function fw(t){return t>.008856451679035631?Math.pow(t,1/3):t/uw+hw}function dw(t){return t>aw?t*t*t:uw*(t-hw)}function pw(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function mw(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function vw(t){var e=mw(t.r),i=mw(t.g),n=mw(t.b),s=fw((.4124564*e+.3575761*i+.1804375*n)/rw),r=fw((.2126729*e+.7151522*i+.072175*n)/1);return{l:116*r-16,a:500*(s-r),b:200*(r-fw((.0193339*e+.119192*i+.9503041*n)/ow)),alpha:t.a}}function gw(t){var e=(t.l+16)/116,i=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*dw(e),i=rw*dw(i),n=ow*dw(n),new Ng(pw(3.2404542*i-1.5371385*e-.4985314*n),pw(-.969266*i+1.8760108*e+.041556*n),pw(.0556434*i-.2040259*e+1.0572252*n),t.alpha)}function yw(t,e,i){var n=e-t;return t+i*(n>180||n<-180?n-360*Math.round(n/360):n)}var ww={forward:vw,reverse:gw,interpolate:function(t,e,i){return{l:nw(t.l,e.l,i),a:nw(t.a,e.a,i),b:nw(t.b,e.b,i),alpha:nw(t.alpha,e.alpha,i)}}},xw={forward:function(t){var e=vw(t),i=e.l,n=e.a,s=e.b,r=Math.atan2(s,n)*cw;return{h:r<0?r+360:r,c:Math.sqrt(n*n+s*s),l:i,alpha:t.a}},reverse:function(t){var e=t.h*lw,i=t.c;return gw({l:t.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:t.alpha})},interpolate:function(t,e,i){return{h:yw(t.h,e.h,i),c:nw(t.c,e.c,i),l:nw(t.l,e.l,i),alpha:nw(t.alpha,e.alpha,i)}}},bw=function(t,e,i,n,s){this.type=t,this.operator=e,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(var r=0,o=s;r1})))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:h}}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(s=e.parse(s,2,Vg)))return null;var a=[],u=null;"interpolate-hcl"===i||"interpolate-lab"===i?u=Kg:e.expectedType&&"value"!==e.expectedType.kind&&(u=e.expectedType);for(var l=0;l=c)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',d);var m=e.parse(f,p,u);if(!m)return null;u=u||m.type,a.push([c,m])}return"number"===u.kind||"color"===u.kind||"array"===u.kind&&"number"===u.itemType.kind&&"number"==typeof u.N?new bw(u,i,n,s,a):e.error("Type "+sy(u)+" is not interpolatable.")},bw.prototype.evaluate=function(t){var e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);var s=e.length;if(n>=e[s-1])return i[s-1].evaluate(t);var r=Qy(e,n),o=e[r],h=e[r+1],a=bw.interpolationFactor(this.interpolation,n,o,h),u=i[r].evaluate(t),l=i[r+1].evaluate(t);return"interpolate"===this.operator?sw[this.type.kind.toLowerCase()](u,l,a):"interpolate-hcl"===this.operator?xw.reverse(xw.interpolate(xw.forward(u),xw.forward(l),a)):ww.reverse(ww.interpolate(ww.forward(u),ww.forward(l),a))},bw.prototype.eachChild=function(t){t(this.input);for(var e=0,i=this.outputs;e=i.length)throw new yy("Array index out of bounds: "+e+" > "+(i.length-1)+".");if(e!==Math.floor(e))throw new yy("Array index must be an integer, but found "+e+" instead.");return i[e]},_w.prototype.eachChild=function(t){t(this.index),t(this.input)},_w.prototype.outputDefined=function(){return!1},_w.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var Ew=function(t,e){this.type=Hg,this.needle=t,this.haystack=e};Ew.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var i=e.parse(t[1],1,Qg),n=e.parse(t[2],2,Qg);return i&&n?hy(i.type,[Hg,Wg,Vg,Zg,Qg])?new Ew(i,n):e.error("Expected first argument to be of type boolean, string, number or null, but found "+sy(i.type)+" instead"):null},Ew.prototype.evaluate=function(t){var e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(null==i)return!1;if(!ay(e,["boolean","string","number","null"]))throw new yy("Expected first argument to be of type boolean, string, number or null, but found "+sy(my(e))+" instead.");if(!ay(i,["string","array"]))throw new yy("Expected second argument to be of type array or string, but found "+sy(my(i))+" instead.");return i.indexOf(e)>=0},Ew.prototype.eachChild=function(t){t(this.needle),t(this.haystack)},Ew.prototype.outputDefined=function(){return!0},Ew.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var Tw=function(t,e,i){this.type=Vg,this.needle=t,this.haystack=e,this.fromIndex=i};Tw.parse=function(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var i=e.parse(t[1],1,Qg),n=e.parse(t[2],2,Qg);if(!i||!n)return null;if(!hy(i.type,[Hg,Wg,Vg,Zg,Qg]))return e.error("Expected first argument to be of type boolean, string, number or null, but found "+sy(i.type)+" instead");if(4===t.length){var s=e.parse(t[3],3,Vg);return s?new Tw(i,n,s):null}return new Tw(i,n)},Tw.prototype.evaluate=function(t){var e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!ay(e,["boolean","string","number","null"]))throw new yy("Expected first argument to be of type boolean, string, number or null, but found "+sy(my(e))+" instead.");if(!ay(i,["string","array"]))throw new yy("Expected second argument to be of type array or string, but found "+sy(my(i))+" instead.");if(this.fromIndex){var n=this.fromIndex.evaluate(t);return i.indexOf(e,n)}return i.indexOf(e)},Tw.prototype.eachChild=function(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)},Tw.prototype.outputDefined=function(){return!1},Tw.prototype.serialize=function(){if(null!=this.fromIndex&&void 0!==this.fromIndex){var t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]};var Cw=function(t,e,i,n,s,r){this.inputType=t,this.type=e,this.input=i,this.cases=n,this.outputs=s,this.otherwise=r};Cw.parse=function(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if(t.length%2!=1)return e.error("Expected an even number of arguments.");var i,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(var s={},r=[],o=2;oNumber.MAX_SAFE_INTEGER)return u.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof f&&Math.floor(f)!==f)return u.error("Numeric branch labels must be integer values.");if(i){if(u.checkSubtype(i,my(f)))return null}else i=my(f);if(void 0!==s[String(f)])return u.error("Branch labels must be unique.");s[String(f)]=r.length}var d=e.parse(a,o,n);if(!d)return null;n=n||d.type,r.push(d)}var p=e.parse(t[1],1,Qg);if(!p)return null;var m=e.parse(t[t.length-1],t.length-1,n);return m?"value"!==p.type.kind&&e.concat(1).checkSubtype(i,p.type)?null:new Cw(i,n,p,s,r,m):null},Cw.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(my(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},Cw.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},Cw.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))&&this.otherwise.outputDefined()},Cw.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],i=[],n={},s=0,r=Object.keys(this.cases).sort();s=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var i=e.parse(t[1],1,Qg),n=e.parse(t[2],2,Vg);if(!i||!n)return null;if(!hy(i.type,[ny(Qg),Wg,Qg]))return e.error("Expected first argument to be of type array or string, but found "+sy(i.type)+" instead");if(4===t.length){var s=e.parse(t[3],3,Vg);return s?new Iw(i.type,i,n,s):null}return new Iw(i.type,i,n)},Iw.prototype.evaluate=function(t){var e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!ay(e,["string","array"]))throw new yy("Expected first argument to be of type array or string, but found "+sy(my(e))+" instead.");if(this.endIndex){var n=this.endIndex.evaluate(t);return e.slice(i,n)}return e.slice(i)},Iw.prototype.eachChild=function(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)},Iw.prototype.outputDefined=function(){return!1},Iw.prototype.serialize=function(){if(null!=this.endIndex&&void 0!==this.endIndex){var t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]};var Lw=Rw("==",(function(t,e,i){return e===i}),kw),Nw=Rw("!=",(function(t,e,i){return e!==i}),(function(t,e,i,n){return!kw(0,e,i,n)})),Ow=Rw("<",(function(t,e,i){return e",(function(t,e,i){return e>i}),(function(t,e,i,n){return n.compare(e,i)>0})),Gw=Rw("<=",(function(t,e,i){return e<=i}),(function(t,e,i,n){return n.compare(e,i)<=0})),jw=Rw(">=",(function(t,e,i){return e>=i}),(function(t,e,i,n){return n.compare(e,i)>=0})),Dw=function(t,e,i,n,s){this.type=Wg,this.number=t,this.locale=e,this.currency=i,this.minFractionDigits=n,this.maxFractionDigits=s};Dw.parse=function(t,e){if(3!==t.length)return e.error("Expected two arguments.");var i=e.parse(t[1],1,Vg);if(!i)return null;var n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");var s=null;if(n.locale&&!(s=e.parse(n.locale,1,Wg)))return null;var r=null;if(n.currency&&!(r=e.parse(n.currency,1,Wg)))return null;var o=null;if(n["min-fraction-digits"]&&!(o=e.parse(n["min-fraction-digits"],1,Vg)))return null;var h=null;return n["max-fraction-digits"]&&!(h=e.parse(n["max-fraction-digits"],1,Vg))?null:new Dw(i,s,r,o,h)},Dw.prototype.evaluate=function(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))},Dw.prototype.eachChild=function(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)},Dw.prototype.outputDefined=function(){return!1},Dw.prototype.serialize=function(){var t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]};var Uw=function(t){this.type=Vg,this.input=t};Uw.parse=function(t,e){if(2!==t.length)return e.error("Expected 1 argument, but found "+(t.length-1)+" instead.");var i=e.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?e.error("Expected argument of type string or array, but found "+sy(i.type)+" instead."):new Uw(i):null},Uw.prototype.evaluate=function(t){var e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new yy("Expected value to be of type string or array, but found "+sy(my(e))+" instead.")},Uw.prototype.eachChild=function(t){t(this.input)},Uw.prototype.outputDefined=function(){return!1},Uw.prototype.serialize=function(){var t=["length"];return this.eachChild((function(e){t.push(e.serialize())})),t};var $w={"==":Lw,"!=":Nw,">":zw,"<":Ow,">=":jw,"<=":Gw,array:xy,at:_w,boolean:xy,case:Fw,coalesce:Sw,collator:Cy,format:by,image:My,in:Ew,"index-of":Tw,interpolate:bw,"interpolate-hcl":bw,"interpolate-lab":bw,length:Uw,let:Pw,literal:gy,match:Cw,number:xy,"number-format":Dw,object:xy,slice:Iw,step:tw,string:xy,"to-boolean":Py,"to-color":Py,"to-number":Py,"to-string":Py,var:Hy,within:Yy};function Bw(t,e){var i=e[0],n=e[1],s=e[2],r=e[3];i=i.evaluate(t),n=n.evaluate(t),s=s.evaluate(t);var o=r?r.evaluate(t):1,h=dy(i,n,s,o);if(h)throw new yy(h);return new Ng(i/255*o,n/255*o,s/255*o,o)}function qw(t,e){return t in e}function Xw(t,e){var i=e[t];return void 0===i?null:i}function Yw(t){return{type:t}}function Zw(t){return{result:"success",value:t}}function Vw(t){return{result:"error",value:t}}function Ww(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}Ty.register($w,{error:[{kind:"error"},[Wg],function(t,e){var i=e[0];throw new yy(i.evaluate(t))}],typeof:[Wg,[Qg],function(t,e){return sy(my(e[0].evaluate(t)))}],"to-rgba":[ny(Vg,4),[Kg],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[Kg,[Vg,Vg,Vg],Bw],rgba:[Kg,[Vg,Vg,Vg,Vg],Bw],has:{type:Hg,overloads:[[[Wg],function(t,e){return qw(e[0].evaluate(t),t.properties())}],[[Wg,Jg],function(t,e){var i=e[0],n=e[1];return qw(i.evaluate(t),n.evaluate(t))}]]},get:{type:Qg,overloads:[[[Wg],function(t,e){return Xw(e[0].evaluate(t),t.properties())}],[[Wg,Jg],function(t,e){var i=e[0],n=e[1];return Xw(i.evaluate(t),n.evaluate(t))}]]},"feature-state":[Qg,[Wg],function(t,e){return Xw(e[0].evaluate(t),t.featureState||{})}],properties:[Jg,[],function(t){return t.properties()}],"geometry-type":[Wg,[],function(t){return t.geometryType()}],id:[Qg,[],function(t){return t.id()}],zoom:[Vg,[],function(t){return t.globals.zoom}],pitch:[Vg,[],function(t){return t.globals.pitch||0}],"distance-from-center":[Vg,[],function(t){return t.distanceFromCenter()}],"heatmap-density":[Vg,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[Vg,[],function(t){return t.globals.lineProgress||0}],"sky-radial-progress":[Vg,[],function(t){return t.globals.skyRadialProgress||0}],accumulated:[Qg,[],function(t){return void 0===t.globals.accumulated?null:t.globals.accumulated}],"+":[Vg,Yw(Vg),function(t,e){for(var i=0,n=0,s=e;n":[Hg,[Wg,Qg],function(t,e){var i=e[0],n=e[1],s=t.properties()[i.value],r=n.value;return typeof s==typeof r&&s>r}],"filter-id->":[Hg,[Qg],function(t,e){var i=e[0],n=t.id(),s=i.value;return typeof n==typeof s&&n>s}],"filter-<=":[Hg,[Wg,Qg],function(t,e){var i=e[0],n=e[1],s=t.properties()[i.value],r=n.value;return typeof s==typeof r&&s<=r}],"filter-id-<=":[Hg,[Qg],function(t,e){var i=e[0],n=t.id(),s=i.value;return typeof n==typeof s&&n<=s}],"filter->=":[Hg,[Wg,Qg],function(t,e){var i=e[0],n=e[1],s=t.properties()[i.value],r=n.value;return typeof s==typeof r&&s>=r}],"filter-id->=":[Hg,[Qg],function(t,e){var i=e[0],n=t.id(),s=i.value;return typeof n==typeof s&&n>=s}],"filter-has":[Hg,[Qg],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[Hg,[],function(t){return null!==t.id()&&void 0!==t.id()}],"filter-type-in":[Hg,[ny(Wg)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[Hg,[ny(Qg)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[Hg,[Wg,ny(Qg)],function(t,e){var i=e[0];return e[1].value.indexOf(t.properties()[i.value])>=0}],"filter-in-large":[Hg,[Wg,ny(Qg)],function(t,e){var i=e[0],n=e[1];return function(t,e,i,n){for(;i<=n;){var s=i+n>>1;if(e[s]===t)return!0;e[s]>t?n=s-1:i=s+1}return!1}(t.properties()[i.value],n.value,0,n.value.length-1)}],all:{type:Hg,overloads:[[[Hg,Hg],function(t,e){var i=e[0],n=e[1];return i.evaluate(t)&&n.evaluate(t)}],[Yw(Hg),function(t,e){for(var i=0,n=e;i-1}(e))return Vw([new Xg("","zoom expressions not supported")]);var r=ex(i);if(!r&&!s)return Vw([new Xg("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(r instanceof Xg)return Vw([r]);if(r instanceof bw&&!function(t){return!!t.expression&&t.expression.interpolated}(e))return Vw([new Xg("",'"interpolate" expressions cannot be used with this property')]);if(!r)return Zw(new Jw(n?"constant":"source",t.value));var o=r instanceof bw?r.interpolation:void 0;return Zw(new Qw(n?"camera":"composite",t.value,r.labels,o))}function ex(t){var e=null;if(t instanceof Pw)e=ex(t.result);else if(t instanceof Sw)for(var i=0,n=t.args;i":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},expression_name:{type:"enum",values:{let:{group:"Variable binding"},var:{group:"Variable binding"},literal:{group:"Types"},array:{group:"Types"},at:{group:"Lookup"},in:{group:"Lookup"},"index-of":{group:"Lookup"},slice:{group:"Lookup"},case:{group:"Decision"},match:{group:"Decision"},coalesce:{group:"Decision"},step:{group:"Ramps, scales, curves"},interpolate:{group:"Ramps, scales, curves"},"interpolate-hcl":{group:"Ramps, scales, curves"},"interpolate-lab":{group:"Ramps, scales, curves"},ln2:{group:"Math"},pi:{group:"Math"},e:{group:"Math"},typeof:{group:"Types"},string:{group:"Types"},number:{group:"Types"},boolean:{group:"Types"},object:{group:"Types"},collator:{group:"Types"},format:{group:"Types"},image:{group:"Types"},"number-format":{group:"Types"},"to-string":{group:"Types"},"to-number":{group:"Types"},"to-boolean":{group:"Types"},"to-rgba":{group:"Color"},"to-color":{group:"Types"},rgb:{group:"Color"},rgba:{group:"Color"},get:{group:"Lookup"},has:{group:"Lookup"},length:{group:"Lookup"},properties:{group:"Feature data"},"feature-state":{group:"Feature data"},"geometry-type":{group:"Feature data"},id:{group:"Feature data"},zoom:{group:"Camera"},pitch:{group:"Camera"},"distance-from-center":{group:"Camera"},"heatmap-density":{group:"Heatmap"},"line-progress":{group:"Feature data"},"sky-radial-progress":{group:"sky"},accumulated:{group:"Feature data"},"+":{group:"Math"},"*":{group:"Math"},"-":{group:"Math"},"/":{group:"Math"},"%":{group:"Math"},"^":{group:"Math"},sqrt:{group:"Math"},log10:{group:"Math"},ln:{group:"Math"},log2:{group:"Math"},sin:{group:"Math"},cos:{group:"Math"},tan:{group:"Math"},asin:{group:"Math"},acos:{group:"Math"},atan:{group:"Math"},min:{group:"Math"},max:{group:"Math"},round:{group:"Math"},abs:{group:"Math"},ceil:{group:"Math"},floor:{group:"Math"},distance:{group:"Math"},"==":{group:"Decision"},"!=":{group:"Decision"},">":{group:"Decision"},"<":{group:"Decision"},">=":{group:"Decision"},"<=":{group:"Decision"},all:{group:"Decision"},any:{group:"Decision"},"!":{group:"Decision"},within:{group:"Decision"},"is-supported-script":{group:"String"},upcase:{group:"String"},downcase:{group:"String"},concat:{group:"String"},"resolved-locale":{group:"String"}}},fog:{range:{type:"array",default:[.5,10],minimum:-20,maximum:20,length:2,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"high-color":{type:"color","property-type":"data-constant",default:"#245cdf",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"space-color":{type:"color","property-type":"data-constant",default:["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-blend":{type:"number","property-type":"data-constant",default:["interpolate",["linear"],["zoom"],4,.2,7,.1],minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"star-intensity":{type:"number","property-type":"data-constant",default:["interpolate",["linear"],["zoom"],5,.35,6,0],minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},projection:{name:{type:"enum",values:{albers:{},equalEarth:{},equirectangular:{},lambertConformalConic:{},mercator:{},naturalEarth:{},winkelTripel:{},globe:{}},default:"mercator",required:!0},center:{type:"array",length:2,value:"number","property-type":"data-constant",minimum:[-180,-90],maximum:[180,90],transition:!1,requires:[{name:["albers","lambertConformalConic"]}]},parallels:{type:"array",length:2,value:"number","property-type":"data-constant",minimum:[-90,-90],maximum:[90,90],transition:!1,requires:[{name:["albers","lambertConformalConic"]}]}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number","property-type":"data-constant",default:1,minimum:0,maximum:1e3,expression:{interpolated:!0,parameters:["zoom"]},transition:!0,requires:["source"]}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{type:"array",value:"number",length:2,default:[0,0],minimum:[0,0],maximum:[1,1],transition:!1,requires:[{source:"geojson",has:{lineMetrics:!0}}],"property-type":"constant"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_sky:{"sky-type":{type:"enum",values:{gradient:{},atmosphere:{}},default:"atmosphere",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{type:"array",value:"number",length:2,units:"degrees",minimum:[0,0],maximum:[360,180],transition:!1,requires:[{"sky-type":"atmosphere"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{type:"number",requires:[{"sky-type":"atmosphere"}],default:10,minimum:0,maximum:100,transition:!1,"property-type":"data-constant"},"sky-gradient-center":{type:"array",requires:[{"sky-type":"gradient"}],value:"number",default:[0,0],length:2,units:"degrees",minimum:[0,0],maximum:[360,180],transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{type:"number",requires:[{"sky-type":"gradient"}],default:90,minimum:0,maximum:180,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-gradient":{type:"color",default:["interpolate",["linear"],["sky-radial-progress"],.8,"#87ceeb",1,"white"],transition:!1,requires:[{"sky-type":"gradient"}],expression:{interpolated:!0,parameters:["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{type:"color",default:"white",transition:!1,requires:[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{type:"color",default:"white",transition:!1,requires:[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};function sx(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(var e=0,i=t.slice(1);e",">=","<","<=","to-boolean"]);function lx(t,e){return te?1:0}function cx(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(var e=1;e"===i||"<="===i||">="===i?dx(t[1],t[2],i):"any"===i?(e=t.slice(1),["any"].concat(e.map(fx))):"all"===i?["all"].concat(t.slice(1).map(fx)):"none"===i?["all"].concat(t.slice(1).map(fx).map(vx)):"in"===i?px(t[1],t.slice(2)):"!in"===i?vx(px(t[1],t.slice(2))):"has"===i?mx(t[1]):"!has"===i?vx(mx(t[1])):"within"!==i||t}function dx(t,e,i){switch(t){case"$type":return["filter-type-"+i,e];case"$id":return["filter-id-"+i,e];default:return["filter-"+i,t,e]}}function px(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((function(t){return typeof t!=typeof e[0]}))?["filter-in-large",t,["literal",e.sort(lx)]]:["filter-in-small",t,["literal",e]]}}function mx(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function vx(t){return["!",t]}var gx=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function yx(t,e){var i={};for(var n in t)"ref"!==n&&(i[n]=t[n]);return gx.forEach((function(t){t in e&&(i[t]=e[t])})),i}var wx={thin:100,hairline:100,"ultra-light":100,"extra-light":100,light:200,book:300,regular:400,normal:400,plain:400,roman:400,standard:400,medium:500,"semi-bold":600,"demi-bold":600,bold:700,heavy:800,black:800,"extra-bold":800,"ultra-black":900,"extra-black":900,"ultra-bold":900,"heavy-black":900,fat:900,poster:900},xx=" ",bx=/(italic|oblique)$/i,Mx={},Sx=function(t,e,i){var n=Mx[t];if(!n){Array.isArray(t)||(t=[t]);for(var s=400,r="normal",o=[],h=0,a=t.length;h1?u[u.length-2].toLowerCase():"";if(l==c||l==c.replace("-","")||f+"-"+l==c){s=wx[c],u.pop(),f&&c.startsWith(f)&&u.pop();break}}"number"==typeof l&&(s=l);var d=u.join(xx).replace("Klokantech Noto Sans","Noto Sans");-1!==d.indexOf(xx)&&(d='"'+d+'"'),o.push(d)}n=Mx[t]=[r,s,o]}return n[0]+xx+n[1]+xx+e+"px"+(i?"/"+i:"")+xx+n[2]},Px="https://api.mapbox.com";function _x(t){var e="mapbox://";return 0!==t.indexOf(e)?"":t.slice(e.length)}function Ex(t,e){var i=_x(t);if(!i)return decodeURI(new URL(t,location.href).href);var n="styles/";if(0!==i.indexOf(n))throw new Error("unexpected style url: "+t);var s=i.slice(n.length);return Px+"/styles/v1/"+s+"?&access_token="+e}function Tx(t,e,i,n){var s=new URL(t,n),r=_x(t);return r?"https://{a-d}.tiles.mapbox.com/v4/"+r+"/{z}/{x}/{y}.vector.pbf?access_token="+e:e?(s.searchParams.set(i,e),decodeURI(s.href)):decodeURI(s.href)}function Cx(t){return t*Math.PI/180}var Fx=function(){for(var t=[],e=78271.51696402048;t.length<=24;e/=2)t.push(e);return t}();function Ix(t,e){if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(t,e);var i=document.createElement("canvas");return i.width=t,i.height=e,i}var Ax={};function kx(t,e,i){if(void 0===i&&(i={}),e in Ax)return Ax[e];var n=i.transformRequest&&i.transformRequest(e,t)||new Request(e);n.headers.get("Accept")||n.headers.set("Accept","application/json");var s=fetch(n).then((function(t){return delete Ax[e],t.ok?t.json():Promise.reject(new Error("Error fetching source "+e))})).catch((function(t){return delete Ax[e],Promise.reject(new Error("Error fetching source "+e))}));return Ax[e]=s,s}function Rx(t,e){if("string"!=typeof t)return Promise.resolve(t);if(!t.trim().startsWith("{"))return kx("Style",t=Ex(t,e.accessToken),e);try{var i=JSON.parse(t);return Promise.resolve(i)}catch(t){return Promise.reject(t)}}var Lx={};function Nx(t,e,i){void 0===i&&(i={});var n=[e,JSON.stringify(t)].toString(),s=Lx[n];if(!s||i.transformRequest){var r=t.url;if(r&&!t.tiles){var o=Tx(r,i.accessToken,i.accessTokenParam||"access_token",e||location.href);s=r.startsWith("mapbox://")?Promise.resolve(Object.assign({},t,{url:void 0,tiles:o})):kx("Source",o,i).then((function(t){for(var e=0,n=t.tiles.length;e=.05){for(var i="",n=t.split("\n"),s=zx.slice(0,Math.round(e/.1)),r=0,o=n.length;r0&&(i+="\n"),i+=n[r].split("").join(s);return i}return t}function jx(){return Ox||(Ox=Ix(1,1).getContext("2d")),Ox}function Dx(t,e){return jx().measureText(t).width+(t.length-1)*e}var Ux={};function $x(t,e,i,n){if(-1!==t.indexOf("\n")){for(var s=t.split("\n"),r=[],o=0,h=s.length;o1){var c=jx();c.font=e;for(var f=c.measureText("M").width*i,d="",p=[],m=0,v=l.length;m1;++w){var b=p[w];if(Dx(b,n)<.35*f){var M=w>0?Dx(p[w-1],n):1/0,S=w.7*f&&Dx(T,n)<.6*f){var C=E.split(" "),F=C.pop();Dx(F,n)<.2*f&&(p[P]=C.join(" "),p[P+1]=F+" "+T),_-=1}}u=p.join("\n")}else u=t;u=Gx(u,n),Ux[a]=u}return u}var Bx,qx=/font-family: ?([^;]*);/,Xx=/("|')/g;function Yx(t){if(!Bx){Bx={};for(var e=document.styleSheets,i=0,n=e.length;i0&&"string"==typeof a[0]&&a[0]in $w);if(!f&&Ww(l)&&(l=zg(l,c),f=!0),f){var d=function(t,e){var i=tx(t,e);if("error"===i.result)throw new Error(i.value.map((function(t){return t.key+": "+t.message})).join(", "));return i.value}(l,c);u[i]=d.evaluate.bind(d)}else"color"==c.type&&(l=Ng.parse(l)),u[i]=function(){return l}}return tb.zoom=n,u[i](tb,s,o)}function ib(t,e,i,n){return eb(t,"layout","icon-allow-overlap",e,i,n)?eb(t,"layout","icon-ignore-placement",e,i,n)?"none":"obstacle":"declutter"}function nb(t,e,i,n,s){return s||console.warn("No filterCache provided to evaluateFilter()"),t in s||(s[t]=rx(e).filter),tb.zoom=n,s[t](tb,i)}var sb=!1;function rb(t,e){if(t){if(!sb&&(0===t.a||0===e))return;var i=t.a;return e=void 0===e?1:e,0===i?"transparent":"rgba("+Math.round(255*t.r/i)+","+Math.round(255*t.g/i)+","+Math.round(255*t.b/i)+","+i*e+")"}return t}var ob=/\{[^{}}]*\}/g;function hb(t,e){return t.replace(ob,(function(t){return e[t.slice(1,-1)]||""}))}var ab=!1;function ub(t,e,i,n,s,r,o){if(void 0===n&&(n=Fx),void 0===s&&(s=void 0),void 0===r&&(r=void 0),void 0===o&&(o=void 0),"string"==typeof e&&(e=JSON.parse(e)),8!=e.version)throw new Error("glStyle version 8 required.");var h,a;if(r)if("undefined"!=typeof Image){var u=new Image;u.crossOrigin="anonymous",u.onload=function(){h=u,a=[u.width,u.height],t.changed(),u.onload=null},u.src=r}else if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){var l=self;l.postMessage({action:"loadImage",src:r}),l.addEventListener("message",(function(t){"imageLoaded"===t.data.action&&t.data.src===r&&(h=t.data.image,a=[h.width,h.height])}))}for(var c,f=function(t){t=t.slice();for(var e=Object.create(null),i=0;i=P.maxzoom)){var A=P.filter;if(!A||nb(_,A,p,l,y)){c=P;var k=void 0,R=void 0,L=void 0,N=void 0,O=void 0,z=void 0,G=S.index;if(3==f&&("fill"==P.type||"fill-extrusion"==P.type))if(R=eb(P,"paint",P.type+"-opacity",l,p,g,w),P.type+"-pattern"in I){var j=eb(P,"paint",P.type+"-pattern",l,p,g,w);if(j){var D="string"==typeof j?hb(j,r):j.toString();if(h&&s&&s[D]){++x,(z=F[x])&&z.getFill()&&!z.getStroke()&&!z.getText()||(z=new $c({fill:new Tc}),F[x]=z),L=z.getFill(),z.setZIndex(G);var U=D+"."+R,$=v[U];if(!$){var B=s[D],q=Ix(B.width,B.height),X=q.getContext("2d");X.globalAlpha=R,X.drawImage(h,B.x,B.y,B.width,B.height,0,0,B.width,B.height),$=X.createPattern(q,"repeat"),v[U]=$}L.setColor($)}}}else k=rb(eb(P,"paint",P.type+"-color",l,p,g,w),R),P.type+"-outline-color"in I&&(O=rb(eb(P,"paint",P.type+"-outline-color",l,p,g,w),R)),O||(O=k),(k||O)&&(++x,(!(z=F[x])||k&&!z.getFill()||!k&&z.getFill()||O&&!z.getStroke()||!O&&z.getStroke()||z.getText())&&(z=new $c({fill:k?new Tc:void 0,stroke:O?new Nc:void 0}),F[x]=z),k&&(L=z.getFill()).setColor(k),O&&((N=z.getStroke()).setColor(O),N.setWidth(.5)),z.setZIndex(G));if(1!=f&&"line"==P.type){k=!("line-pattern"in I)&&"line-color"in I?rb(eb(P,"paint","line-color",l,p,g,w),eb(P,"paint","line-opacity",l,p,g,w)):void 0;var Y=eb(P,"paint","line-width",l,p,g,w);k&&Y>0&&(++x,(z=F[x])&&z.getStroke()&&!z.getFill()&&!z.getText()||(z=new $c({stroke:new Nc}),F[x]=z),(N=z.getStroke()).setLineCap(eb(P,"layout","line-cap",l,p,g,w)),N.setLineJoin(eb(P,"layout","line-join",l,p,g,w)),N.setMiterLimit(eb(P,"layout","line-miter-limit",l,p,g,w)),N.setColor(k),N.setWidth(Y),N.setLineDash(I["line-dasharray"]?eb(P,"paint","line-dasharray",l,p,g,w).map((function(t){return t*Y})):null),z.setZIndex(G))}var Z=!1,V=null,W=0,H=void 0,K=void 0,J=void 0;if((1==f||2==f)&&"icon-image"in E){var Q=eb(P,"layout","icon-image",l,p,g,w);if(Q){H="string"==typeof Q?hb(Q,r):Q.toString();var tt=void 0;if(h&&s&&s[H]){var et=eb(P,"layout","icon-rotation-alignment",l,p,g,w);if(2==f){var it=e.getGeometry();if(it.getFlatMidpoint||it.getFlatMidpoints){var nt=it.getExtent();if(Math.sqrt(Math.max(Math.pow((nt[2]-nt[0])/i,2),Math.pow((nt[3]-nt[1])/i,2)))>150){var st="MultiLineString"===it.getType()?it.getFlatMidpoints():it.getFlatMidpoint();if(Hx||(Hx=new Kv("Point",Wx=[NaN,NaN],[],{},null)),tt=Hx,Wx[0]=st[0],Wx[1]=st[1],"line"===eb(P,"layout","symbol-placement",l,p,g,w)&&"map"===et)for(var rt=it.getStride(),ot=it.getFlatCoordinates(),ht=0,at=ot.length-rt;ht=dt&&st[0]<=mt&&st[1]>=pt&&st[1]<=vt){W=Math.atan2(lt-ft,ct-ut);break}}}}}if(2!==f||tt){var gt=eb(P,"layout","icon-size",l,p,g,w),yt=void 0!==I["icon-color"]?eb(P,"paint","icon-color",l,p,g,w):null;if(!yt||0!==yt.a){var wt=H+"."+gt;if(null!==yt&&(wt+="."+yt),!(K=m[wt])){var xt=s[H],bt=ib(P,l,p,g),Mt=void 0;"icon-offset"in E&&((Mt=eb(P,"layout","icon-offset",l,p,g,w))[1]*=-1),K=new Rc({color:yt?[255*yt.r,255*yt.g,255*yt.b,yt.a]:void 0,img:h,imgSize:a,size:[xt.width,xt.height],offset:[xt.x,xt.y],rotateWithView:"map"===et,scale:gt/xt.pixelRatio,displacement:Mt,declutterMode:bt}),m[wt]=K}}K&&(++x,(z=F[x])&&z.getImage()&&!z.getFill()&&!z.getStroke()||(z=new $c,F[x]=z),z.setGeometry(tt),K.setRotation(W+Cx(eb(P,"layout","icon-rotate",l,p,g,w))),K.setOpacity(eb(P,"paint","icon-opacity",l,p,g,w)),K.setAnchor(Jx[eb(P,"layout","icon-anchor",l,p,g,w)]),z.setImage(K),V=z.getText(),z.setText(void 0),z.setZIndex(G),Z=!0,J=!1)}else J=!0}}}if(1==f&&"circle"===P.type){++x,(z=F[x])&&z.getImage()&&!z.getFill()&&!z.getStroke()||(z=new $c,F[x]=z);var St="circle-radius"in I?eb(P,"paint","circle-radius",l,p,g,w):5,Pt=rb(eb(P,"paint","circle-stroke-color",l,p,g,w),eb(P,"paint","circle-stroke-opacity",l,p,g,w)),_t=rb(eb(P,"paint","circle-color",l,p,g,w),eb(P,"paint","circle-opacity",l,p,g,w)),Et=eb(P,"paint","circle-stroke-width",l,p,g,w),Tt=St+"."+Pt+"."+_t+"."+Et;(K=m[Tt])||(K=new _c({radius:St,stroke:Pt&&Et>0?new Nc({width:Et,color:Pt}):void 0,fill:_t?new Tc({color:_t}):void 0,declutterMode:"none"}),m[Tt]=K),z.setImage(K),V=z.getText(),z.setText(void 0),z.setGeometry(void 0),z.setZIndex(G),Z=!0}var Ct=void 0,Ft=void 0,It=void 0,At=void 0,kt=void 0,Rt=void 0;if("text-field"in E){At=Math.round(eb(P,"layout","text-size",l,p,g,w));var Lt=eb(P,"layout","text-font",l,p,g,w);It=eb(P,"layout","text-line-height",l,p,g,w),(Ft=Sx(o?o(Lt):Lt,At,It)).includes("sans-serif")||(Ft+=",sans-serif"),kt=eb(P,"layout","text-letter-spacing",l,p,g,w),Rt=eb(P,"layout","text-max-width",l,p,g,w);var Nt=eb(P,"layout","text-field",l,p,g,w);Ct="object"==typeof Nt&&Nt.sections?1===Nt.sections.length?Nt.toString():Nt.sections.reduce((function(t,e,i){var n=e.fontStack?e.fontStack.split(","):Lt,s=Sx(o?o(n):n,At*(e.scale||1),It),r=e.text;if("\n"===r)return t.push("\n",""),t;if(2!=f){for(var h=0,a=(r=$x(r,s,Rt,kt).split("\n")).length;h0&&t.push("\n",""),t.push(r[h],s);return t}t.push(Gx(r,kt),s)}),[]):hb(Nt,r).trim(),R=eb(P,"paint","text-opacity",l,p,g,w)}if(Ct&&R&&!J){Z||(++x,(z=F[x])&&z.getText()&&!z.getFill()&&!z.getStroke()||(z=new $c,F[x]=z),z.setImage(void 0),z.setGeometry(void 0)),z.getText()||z.setText(V||new qc({padding:[2,2,2,2]})),V=z.getText();var Ot=E["text-transform"];"uppercase"==Ot?Ct=Array.isArray(Ct)?Ct.map((function(t,e){return e%2?t:t.toUpperCase()})):Ct.toUpperCase():"lowercase"==Ot&&(Ct=Array.isArray(Ct)?Ct.map((function(t,e){return e%2?t:t.toLowerCase()})):Ct.toLowerCase());var zt=Array.isArray(Ct)?Ct:2==f?Gx(Ct,kt):$x(Ct,Ft,Rt,kt);V.setText(zt),V.setFont(Ft),V.setRotation(Cx(eb(P,"layout","text-rotate",l,p,g,w)));var Gt=eb(P,"layout","text-anchor",l,p,g,w),jt=Z||1==f?"point":eb(P,"layout","symbol-placement",l,p,g,w);V.setPlacement(jt),V.setOverflow("point"===jt);var Dt=eb(P,"paint","text-halo-width",l,p,g,w),Ut=eb(P,"layout","text-offset",l,p,g,w),$t=eb(P,"paint","text-translate",l,p,g,w),Bt=0,qt=0;if("point"==jt){var Xt="center";-1!==Gt.indexOf("left")?(Xt="left",qt=Dt):-1!==Gt.indexOf("right")&&(Xt="right",qt=-Dt),V.setTextAlign(Xt);var Yt=eb(P,"layout","text-rotation-alignment",l,p,g,w);V.setRotateWithView("map"==Yt)}else V.setMaxAngle(Cx(eb(P,"layout","text-max-angle",l,p,g,w))*Ct.length/zt.length),V.setTextAlign(),V.setRotateWithView(!1);var Zt="middle";0==Gt.indexOf("bottom")?(Zt="bottom",Bt=-Dt-.5*(It-1)*At):0==Gt.indexOf("top")&&(Zt="top",Bt=Dt+.5*(It-1)*At),V.setTextBaseline(Zt);var Vt=eb(P,"layout","text-justify",l,p,g,w);V.setJustify("auto"===Vt?void 0:Vt),V.setOffsetX(Ut[0]*At+qt+$t[0]),V.setOffsetY(Ut[1]*At+Bt+$t[1]),C.setColor(rb(eb(P,"paint","text-color",l,p,g,w),R)),V.setFill(C);var Wt=rb(eb(P,"paint","text-halo-color",l,p,g,w),R);if(Wt){T.setColor(Wt),Dt*=2;var Ht=.5*At;T.setWidth(Dt<=Ht?Dt:Ht),V.setStroke(T)}else V.setStroke(void 0);var Kt=eb(P,"layout","text-padding",l,p,g,w),Jt=V.getPadding();Kt!==Jt[0]&&(Jt[0]=Kt,Jt[1]=Kt,Jt[2]=Kt,Jt[3]=Kt),z.setZIndex(G)}}}}return x>-1?(F.length=x+1,ab&&("function"==typeof e.set?e.set("mapbox-layer",c):e.getProperties()["mapbox-layer"]=c),F):void 0}};return t.setStyle(I),t.set("mapbox-source",c),t.set("mapbox-layers",p),t.set("mapbox-featurestate",{}),I}function lb(t,e){e.accessToken||(e=Object.assign({},e),new URL(t).searchParams.forEach((function(t,i){e.accessToken=t,e.accessTokenParam=i})));return e}function cb(t,e,i,n,s){var r,o,h;return void 0===i&&(i=""),void 0===n&&(n={}),void 0===s&&(s=void 0),"string"==typeof n?(r=n,h={}):(r=n.styleUrl,h=n),s||(s=h.resolutions),r||"string"!=typeof e||e.trim().startsWith("{")||(r=e),r&&(r=r.startsWith("data:")?location.href:Ex(r,h.accessToken),h=lb(r,h)),new Promise((function(n,a){Rx(e,h).then((function(e){if(8!=e.version)return a(new Error("glStyle version 8 required."));if(!(t instanceof Jv||t instanceof wg))return a(new Error("Can only apply to VectorLayer or VectorTileLayer"));var u,l,c,f=t instanceof wg?"vector":"geojson";if(i?o=Array.isArray(i)?e.layers.find((function(t){return t.id===i[0]})).source:i:(o=Object.keys(e.sources).find((function(t){return e.sources[t].type===f})),i=o),!o)return a(new Error("No "+f+" source found in the glStyle."));function d(){if(t instanceof wg)return vb(e.sources[o],r,h).then((function(e){var i=t.getSource();if(i?e!==i&&(i.setTileUrlFunction(e.getTileUrlFunction()),i.Os||(i.Os=e.Os),i.getAttributions()||i.setAttributions(e.getAttributions()),i.getTileLoadFunction()===Rp&&i.setTileLoadFunction(e.getTileLoadFunction()),tn(i.getProjection(),e.getProjection())&&(i.tileGrid=e.getTileGrid())):t.setSource(e),!isFinite(t.getMaxResolution())&&!isFinite(t.getMinZoom())){var n=t.getSource().getTileGrid();t.setMaxResolution(n.getResolution(n.getMinZoom()))}}));var i=e.sources[o],n=t.getSource();n&&n.get("mapbox-source")===i||(n=yb(i,r,h));var s=t.getSource();return s?n!==s&&(s.getAttributions()||s.setAttributions(n.getAttributions()),s.Os||(s.Os=n.getFormat()),s.Gs=n.getUrl()):t.setSource(n),Promise.resolve()}function p(){c||e.sprite&&!u?c?(t.setStyle(c),d().then(n).catch(a)):a(new Error("Something went wrong trying to apply style.")):(c=ub(t,e,i,s,u,l,Vx),t.getStyle()?d().then(n).catch(a):a(new Error("Nothing to show for source ["+o+"]")))}if(e.sprite){var m=new URL(function(t,e,i){var n=_x(t);if(!n)return decodeURI(new URL(t,i).href);var s="sprites/";if(0!==n.indexOf(s))throw new Error("unexpected sprites url: "+t);var r=n.slice(s.length);return Px+"/styles/v1/"+r+"/sprite?access_token="+e}(e.sprite,h.accessToken,r||location.href)),v=.5==(window.devicePixelRatio>=1.5?.5:1)?"@2x":"",g=m.origin+m.pathname+v+".json"+m.search;new Promise((function(t,e){kx("Sprite",g,h).then(t).catch((function(i){kx("Sprite",g=m.origin+m.pathname+".json"+m.search,h).then(t).catch(e)}))})).then((function(t){if(void 0===t&&a(new Error("No sprites found.")),u=t,l=m.origin+m.pathname+v+".png"+m.search,h.transformRequest){var e=h.transformRequest(l,"SpriteImage");e instanceof Request&&(l=encodeURI(e.url))}p()})).catch((function(t){a(new Error("Sprites cannot be loaded: "+g+": "+t.message))}))}else p()})).catch(a)}))}var fb={};function db(t,e){var i={id:e.id,type:e.type},n={};function s(s){var r=e.layout||{},o=e.paint||{};i.paint=o;var h,a,u="function"==typeof t.getSource?t.getSource().getTileGrid().getZForResolution(s):t.getView().getZoom(),l="function"==typeof t.getTargetElement?t.getTargetElement():void 0;if(void 0!==o["background-color"]&&(h=eb(i,"paint","background-color",u,fb,n),l&&(l.style.background=Ng.parse(h).toString())),void 0!==o["background-opacity"]&&(a=eb(i,"paint","background-opacity",u,fb,n),l&&(l.style.opacity=a)),"none"!=r.visibility)return rb(h,a);l&&(l.style.backgroundColor="",l.style.opacity="")}if("function"==typeof t.getTargetElement)t.getTargetElement()&&s(),t.on(["change:resolution","change:target"],s);else{if("function"!=typeof t.setBackground)throw new Error("Unable to apply background.");t.setBackground(s)}}function pb(t,e){e.layers.some((function(e){if("background"===e.type)return db(t,e),!0}))}function mb(t){var e=t.bounds;if(e){var i=Qi([e[0],e[1]]),n=Qi([e[2],e[3]]);return[i[0],i[1],n[0],n[1]]}}function vb(t,e,i){return new Promise((function(n,s){Nx(t,e,i).then((function(t){var e=new pm({tileJSON:t}),i=e.getTileJSON(),s=e.getTileGrid(),r=mb(i),o=i.minzoom||0,h=i.maxzoom||22,a={attributions:e.getAttributions(),format:new yg,tileGrid:new eu({origin:s.getOrigin(0),extent:r||s.getExtent(),minZoom:o,resolutions:Fx.slice(0,h+1),tileSize:512})};Array.isArray(i.tiles)?a.urls=i.tiles:a.url=i.tiles,t.olSourceOptions&&Object.assign(a,t.olSourceOptions),n(new kp(a))})).catch(s)}))}var gb=new Cg;function yb(t,e,i){var n=t.data,s={};if("string"==typeof n){var r=Tx(n,i.accessToken,i.accessTokenParam||"access_token",e||location.href);if(i.transformRequest){var o=i.transformRequest(r,"GeoJSON");o instanceof Request&&(r=encodeURI(o.url))}s.url=r}else s.features=gb.readFeatures(n,{featureProjection:an()||"EPSG:3857"});var h=new Sf(Object.assign({attributions:t.attribution,format:gb},s));return h.set("mapbox-source",t),h}class wb extends u{constructor(t){super(C),this.error=t}}var xb=class extends wg{constructor(t){const e=!("declutter"in t)||t.declutter,i=new kp({state:"loading",format:new yg});super({source:i,background:t.background,declutter:e,className:t.className,opacity:t.opacity,visible:t.visible,zIndex:t.zIndex,minResolution:t.minResolution,maxResolution:t.maxResolution,minZoom:t.minZoom,maxZoom:t.maxZoom,renderOrder:t.renderOrder,renderBuffer:t.renderBuffer,renderMode:t.renderMode,map:t.map,updateWhileAnimating:t.updateWhileAnimating,updateWhileInteracting:t.updateWhileInteracting,preload:t.preload,useInterimTilesOnError:t.useInterimTilesOnError,properties:t.properties}),t.accessToken&&(this.accessToken=t.accessToken);cb(this,t.styleUrl,t.layers||t.source,{accessToken:this.accessToken}).then((()=>{i.setState("ready")})).catch((t=>{this.dispatchEvent(new wb(t));this.getSource().setState("error")})),void 0===this.getBackground()&&function(t,e,i){void 0===i&&(i={}),"object"==typeof e?(pb(t,e),Promise.resolve()):Rx(e,i).then((function(e){pb(t,e)}))}(this,t.styleUrl,{accessToken:this.accessToken})}};var bb=class extends xm{constructor(t){t=t||{};const e=Object.assign({},t);delete e.imageRatio,super(e),this.jd=void 0!==t.imageRatio?t.imageRatio:1}getImageRatio(){return this.jd}createRenderer(){return new kv(this)}};var Mb=class extends kr{constructor(t){super(Object.assign({},t)),this.Dd=vc(t.style),this.Ud=t.style.variables||{},this.$d=!!t.disableHitDetection}createRenderer(){return new Am(this,{vertexShader:this.Dd.builder.getSymbolVertexShader(),fragmentShader:this.Dd.builder.getSymbolFragmentShader(),hitVertexShader:!this.$d&&this.Dd.builder.getSymbolVertexShader(!0),hitFragmentShader:!this.$d&&this.Dd.builder.getSymbolFragmentShader(!0),uniforms:this.Dd.uniforms,attributes:this.Dd.attributes})}updateStyleVariables(t){Object.assign(this.Ud,t),this.changed()}};function Sb(t,e){const i=`\n attribute vec2 ${Al.TEXTURE_COORD};\n uniform mat4 ${Il.TILE_TRANSFORM};\n uniform float ${Il.TEXTURE_PIXEL_WIDTH};\n uniform float ${Il.TEXTURE_PIXEL_HEIGHT};\n uniform float ${Il.TEXTURE_RESOLUTION};\n uniform float ${Il.TEXTURE_ORIGIN_X};\n uniform float ${Il.TEXTURE_ORIGIN_Y};\n uniform float ${Il.DEPTH};\n\n varying vec2 v_textureCoord;\n varying vec2 v_mapCoord;\n\n void main() {\n v_textureCoord = ${Al.TEXTURE_COORD};\n v_mapCoord = vec2(\n ${Il.TEXTURE_ORIGIN_X} + ${Il.TEXTURE_RESOLUTION} * ${Il.TEXTURE_PIXEL_WIDTH} * v_textureCoord[0],\n ${Il.TEXTURE_ORIGIN_Y} - ${Il.TEXTURE_RESOLUTION} * ${Il.TEXTURE_PIXEL_HEIGHT} * v_textureCoord[1]\n );\n gl_Position = ${Il.TILE_TRANSFORM} * vec4(${Al.TEXTURE_COORD}, ${Il.DEPTH}, 1.0);\n }\n `,n={inFragmentShader:!0,variables:[],attributes:[],stringLiteralsMap:{},functions:{},bandCount:e},s=[];if(void 0!==t.color){const e=tc(n,t.color,Ul);s.push(`color = ${e};`)}if(void 0!==t.contrast){const e=tc(n,t.contrast,jl);s.push(`color.rgb = clamp((${e} + 1.0) * color.rgb - (${e} / 2.0), vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}if(void 0!==t.exposure){const e=tc(n,t.exposure,jl);s.push(`color.rgb = clamp((${e} + 1.0) * color.rgb, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}if(void 0!==t.saturation){const e=tc(n,t.saturation,jl);s.push(`\n float saturation = ${e} + 1.0;\n float sr = (1.0 - saturation) * 0.2126;\n float sg = (1.0 - saturation) * 0.7152;\n float sb = (1.0 - saturation) * 0.0722;\n mat3 saturationMatrix = mat3(\n sr + saturation, sr, sr,\n sg, sg + saturation, sg,\n sb, sb, sb + saturation\n );\n color.rgb = clamp(saturationMatrix * color.rgb, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));\n `)}if(void 0!==t.gamma){const e=tc(n,t.gamma,jl);s.push(`color.rgb = pow(color.rgb, vec3(1.0 / ${e}));`)}if(void 0!==t.brightness){const e=tc(n,t.brightness,jl);s.push(`color.rgb = clamp(color.rgb + ${e}, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}const r={},o=n.variables.length;if(o>1&&!t.variables)throw new Error(`Missing variables in style (expected ${n.variables})`);for(let e=0;e ${Il.RENDER_EXTENT}[2] ||\n v_mapCoord[1] > ${Il.RENDER_EXTENT}[3]\n ) {\n discard;\n }\n\n vec4 color = texture2D(${Il.TILE_TEXTURE_ARRAY}[0], v_textureCoord);\n\n ${s.join("\n")}\n\n if (color.a == 0.0) {\n discard;\n }\n\n gl_FragColor = color;\n gl_FragColor.rgb *= gl_FragColor.a;\n gl_FragColor *= ${Il.TRANSITION_ALPHA};\n }`,uniforms:r,paletteTextures:n.paletteTextures}}class Pb extends Xp{constructor(t){const e=(t=t?Object.assign({},t):{}).style||{};delete t.style;const i=t.cacheSize;delete t.cacheSize,super(t),this.Bd=t.sources,this.qd=null,this.ef=NaN,this.K=e,this.Qt=i,this.Ud=this.K.variables||{},this.addChangeListener(Sr,this.Xd)}getSources(t,e){const i=this.getSource();return this.Bd?"function"==typeof this.Bd?this.Bd(t,e):this.Bd:i?[i]:[]}getRenderSource(){return this.qd||this.getSource()}getSourceState(){const t=this.getRenderSource();return t?t.getState():"undefined"}Xd(){this.getSource()&&this.setStyle(this.K)}Yd(){const t=Number.MAX_SAFE_INTEGER,e=this.getSources([-t,-t,t,t],t);return e&&e.length&&"bandCount"in e[0]?e[0].bandCount:4}createRenderer(){const t=Sb(this.K,this.Yd());return new Gl(this,{vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms,cacheSize:this.Qt,paletteTextures:t.paletteTextures})}renderSources(t,e){const i=this.getRenderer();let n;for(let s=0,r=e.length;s{"ready"==e.getState()&&(e.removeEventListener("change",t),this.changed())};e.addEventListener("change",t)}s=s&&"ready"==i}const r=this.renderSources(t,n);if(this.getRenderer().renderComplete&&s)return this.ef=i.resolution,r;if(this.ef>.5*i.resolution){const e=this.getSources(t.extent,this.ef).filter((t=>!n.includes(t)));if(e.length>0)return this.renderSources(t,e)}return r}setStyle(t){this.Ud=t.variables||{},this.K=t;const e=Sb(this.K,this.Yd());this.getRenderer().reset({vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,uniforms:e.uniforms,paletteTextures:e.paletteTextures}),this.changed()}updateStyleVariables(t){Object.assign(this.Ud,t),this.changed()}}Pb.prototype.dispose;var _b=Pb;const Eb="addfeatures";class Tb extends u{constructor(t,e,i,n){super(t),this.features=i,this.file=e,this.projection=n}}var Cb=class extends mh{constructor(t){t=t||{},super({handleEvent:w}),this.on,this.once,this.un,this.Zd=!1,this.Vd=[];const e=t.formatConstructors?t.formatConstructors:[];for(let t=0,i=e.length;t0){this.Hd&&(this.Hd.clear(),this.Hd.addFeatures(a)),this.dispatchEvent(new Tb(Eb,t,a,r));break}}}Qd(){const t=this.getMap();if(t){const e=this.target?this.target:t.getViewport();this.Wd=[U(e,L,this.handleDrop,this),U(e,k,this.handleStop,this),U(e,R,this.handleStop,this),U(e,L,this.handleStop,this)]}}setActive(t){!this.getActive()&&t&&this.Qd(),this.getActive()&&!t&&this.tp(),super.setActive(t)}setMap(t){this.tp(),super.setMap(t),this.getActive()&&this.Qd()}Jd(t,e,i){try{return t.readFeatures(e,i)}catch(t){return null}}tp(){this.Wd&&(this.Wd.forEach(B),this.Wd=null)}handleDrop(t){const e=t.dataTransfer.files;for(let t=0,i=e.length;t1?1:-1;return e.endInteraction(this.Hi,i),this.$n=0,!1}handleDownEvent(t){return!!Ah(t)&&(!!this.an(t)&&(t.map.getView().beginInteraction(),this.fn=void 0,this.ep=void 0,!0))}};class Ib extends _n{constructor(t,e,i){super(),void 0!==i&&void 0===e?this.setFlatCoordinates(i,t):(e=e||0,this.setCenterAndRadius(t,e,i))}clone(){const t=new Ib(this.flatCoordinates.slice(),void 0,this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const s=this.flatCoordinates,r=t-s[0],o=e-s[1],h=r*r+o*o;if(h=e[0]||(t[1]<=e[1]&&t[3]>=e[1]||pe(t,this.intersectsCoordinate.bind(this)))}return!1}setCenter(t){const e=this.stride,i=this.flatCoordinates[e]-this.flatCoordinates[0],n=t.slice();n[e]=n[0]+i;for(let i=1;i=this.mp?(this.sp=t.pixel,this.np=!this.ap,e=!0):this.op=void 0,this.np&&void 0!==this.rp&&(clearTimeout(this.rp),this.rp=void 0)}return this.ap&&t.type===xo.POINTERDRAG&&null!==this.gp?(this.Ep(t.coordinate),i=!1):this.ap&&t.type===xo.POINTERDOWN?i=!1:e&&this.getPointerCount()<2?(i=t.type===xo.POINTERMOVE,i&&this.ap?(this.Ye(t),this.np&&t.originalEvent.preventDefault()):("mouse"===t.originalEvent.pointerType||t.type===xo.POINTERDRAG&&void 0===this.rp)&&this.Ye(t)):t.type===xo.DBLCLICK&&(i=!1),super.handleEvent(t)&&i}handleDownEvent(t){return this.np=!this.ap,this.ap?(this.sp=t.pixel,this.vp||this.Tp(t.coordinate),!0):this.an(t)?(this.op=Date.now(),this.rp=setTimeout(function(){this.Ye(new wo(xo.POINTERMOVE,t.map,t.originalEvent,!1,t.frameState))}.bind(this),this.mp),this.sp=t.pixel,!0):(this.op=void 0,!1)}handleUpEvent(t){let e=!0;if(0===this.getPointerCount())if(this.rp&&(clearTimeout(this.rp),this.rp=void 0),this.Ye(t),this.np){const i=!this.vp;i&&this.Tp(t.coordinate),!i&&this.ap?this.finishDrawing():this.ap||i&&"Point"!==this.An||(this.Cp(t.pixel)?this.dp(t)&&this.finishDrawing():this.Ep(t.coordinate)),e=!1}else this.ap&&this.abortDrawing();return!e&&this.lp&&t.preventDefault(),e}Ye(t){if(this.hp=t.originalEvent.pointerType,this.sp&&(!this.ap&&this.np||this.ap&&!this.np)){const e=this.sp,i=t.pixel,n=e[0]-i[0],s=e[1]-i[1],r=n*n+s*s;if(this.np=this.ap?r>this.Mp:r<=this.Mp,!this.np)return}this.vp?this.Fp(t.coordinate):this.Ip(t.coordinate.slice())}Cp(t){let e=!1;if(this.gp){let i=!1,n=[this.vp];const s=this.An;if("Point"===s)e=!0;else if("Circle"===s)e=2===this.wp.length;else if("LineString"===s)i=this.wp.length>this.cp;else if("Polygon"===s){const t=this.wp;i=t[0].length>this.cp,n=[t[0][0],t[0][t[0].length-2]]}if(i){const i=this.getMap();for(let s=0,r=n.length;s=this.fp&&(this.ap?s.pop():n=!0),s.push(t.slice()),this.Zh(s,e,i)):"Polygon"===r&&(s=this.wp[0],s.length>=this.fp&&(this.ap?s.pop():n=!0),s.push(t.slice()),n&&(this.vp=s[0]),this.Zh(this.wp,e,i)),this.Ip(t.slice()),this.Ap(),n&&this.finishDrawing()}removeLastPoint(){if(!this.gp)return;const t=this.gp.getGeometry(),e=this.getMap().getView().getProjection();let i;const n=this.An;if("LineString"===n||"Circle"===n){if(i=this.wp,i.splice(-2,1),i.length>=2){this.vp=i[i.length-2].slice();const t=this.vp.slice();i[i.length-1]=t,this.Ip(t)}this.Zh(i,t,e),"Polygon"===t.getType()&&this.xp&&this.kp(t)}else if("Polygon"===n){i=this.wp[0],i.splice(-2,1);const n=this.xp.getGeometry();if(i.length>=2){const t=i[i.length-2].slice();i[i.length-1]=t,this.Ip(t)}n.setCoordinates(i),this.Zh(this.wp,t,e)}1===i.length&&this.abortDrawing(),this.Ap()}finishDrawing(){const t=this.Rp();if(!t)return;let e=this.wp;const i=t.getGeometry(),n=this.getMap().getView().getProjection();"LineString"===this.An?(e.pop(),this.Zh(e,i,n)):"Polygon"===this.An&&(e[0].pop(),this.Zh(e,i,n),e=i.getCoordinates()),"MultiPoint"===this.Tf?t.setGeometry(new zv([e])):"MultiLineString"===this.Tf?t.setGeometry(new qv([e])):"MultiPolygon"===this.Tf&&t.setGeometry(new Zv([e])),this.dispatchEvent(new Nb(Rb,t)),this.zs&&this.zs.push(t),this.Hd&&this.Hd.addFeature(t)}Rp(){this.vp=null;const t=this.gp;return this.gp=null,this.yp=null,this.xp=null,this.Sp.getSource().clear(!0),t}abortDrawing(){const t=this.Rp();t&&this.dispatchEvent(new Nb(Lb,t))}appendCoordinates(t){const e=this.An,i=!this.gp;let n;if(i&&this.Tp(t[0]),"LineString"===e||"Circle"===e)n=this.wp;else{if("Polygon"!==e)return;n=this.wp&&this.wp.length?this.wp[0]:[]}i&&n.shift(),n.pop();for(let e=0;es?o[1]:o[0]),h}}return null}Ye(t){const e=t.pixel,i=t.map;let n=this.Up(e,i);n||(n=i.getCoordinateFromPixelInternal(e)),this.$p(n)}Bp(t){let e=this.zp;return e?t?e.setGeometry(Ms(t)):e.setGeometry(void 0):(e=new pt(t?Ms(t):{}),this.zp=e,this.jp.getSource().addFeature(e)),e}$p(t){let e=this.Gp;if(e){e.getGeometry().setCoordinates(t)}else e=new pt(new Qn(t)),this.Gp=e,this.Dp.getSource().addFeature(e);return e}handleEvent(t){return!t.originalEvent||!this.an(t)||(t.type!=xo.POINTERMOVE||this.handlingDownUpSequence||this.Ye(t),super.handleEvent(t),!1)}handleDownEvent(t){const e=t.pixel,i=t.map,n=this.getExtentInternal();let s=this.Up(e,i);const r=function(t){let e=null,i=null;return t[0]==n[0]?e=n[2]:t[0]==n[2]&&(e=n[0]),t[1]==n[1]?i=n[3]:t[1]==n[3]&&(i=n[1]),null!==e&&null!==i?[e,i]:null};if(s&&n){const t=s[0]==n[0]||s[0]==n[2]?s[0]:null,e=s[1]==n[1]||s[1]==n[3]?s[1]:null;null!==t&&null!==e?this.Lp=$b(r(s)):null!==t?this.Lp=Bb(r([t,n[1]]),r([t,n[3]])):null!==e&&(this.Lp=Bb(r([n[0],e]),r([n[2],e])))}else s=i.getCoordinateFromPixelInternal(e),this.setExtent([s[0],s[1],s[0],s[1]]),this.Lp=$b(s);return!0}handleDragEvent(t){if(this.Lp){const e=t.coordinate;this.setExtent(this.Lp(e)),this.$p(e)}}handleUpEvent(t){this.Lp=null;const e=this.getExtentInternal();return e&&0!==me(e)||this.setExtent(null),!1}setMap(t){this.jp.setMap(t),this.Dp.setMap(t),super.setMap(t)}getExtent(){return cn(this.getExtentInternal(),this.getMap().getView().getProjection())}getExtentInternal(){return this.ot}setExtent(t){this.ot=t||null,this.Bp(t),this.dispatchEvent(new jb(this.ot))}};function Xb(t){return parseFloat(t)}function Yb(t){return function(t){return mi(t,5)}(t).toString()}function Zb(t,e){return!isNaN(t)&&t!==Xb(Yb(e))}var Vb=class extends mh{constructor(t){let e;super(),e=!0===(t=Object.assign({animate:!0,replace:!1,prefix:""},t||{})).animate?{duration:250}:t.animate?t.animate:null,this.qp=e,this.Xp=t.replace,this.Yp=t.prefix,this.ve=[],this.Zp=!0,this._p=this._p.bind(this)}Vp(t){return this.Yp?this.Yp+t:t}Wp(t,e){return t.get(this.Vp(e))}Hp(t,e,i){t.set(this.Vp(e),i)}Kp(t,e){t.delete(this.Vp(e))}setMap(t){const e=this.getMap();super.setMap(t),t!==e&&(e&&this.tp(e),t&&(this.Zp=!0,this._p(),this.Qd(t)))}Qd(t){this.ve.push(U(t,Co,this.Jp,this),U(t.getLayerGroup(),T,this.Jp,this),U(t,"change:layergroup",this.Qp,this)),this.Xp||addEventListener("popstate",this._p)}tp(t){for(let t=0,e=this.ve.length;t=0;--t){const n=i[t];for(let t=this.fm.length-1;t>=0;--t)this.fm[t][0]===n&&this.fm.splice(t,1);e.remove(n)}}setActive(t){this.Gp&&!t&&(this.Sp.getSource().removeFeature(this.Gp),this.Gp=null),super.setActive(t)}setMap(t){this.Sp.setMap(t),super.setMap(t)}getOverlay(){return this.Sp}Pm(t){t.feature&&this.zs.push(t.feature)}_m(t){t.feature&&this.zs.remove(t.feature)}Tm(t){this.Em(t.element)}Qa(t){if(!this.lm){const e=t.target;this.Rm(e),this.Em(e)}}Cm(t){this.Rm(t.element)}pm(t,e){const i=e.getCoordinates(),n={feature:t,geometry:e,segment:[i,i]};this.um.insert(e.getExtent(),n)}ym(t,e){const i=e.getCoordinates();for(let n=0,s=i.length;n=0;--t)this.zm(r[t],o)}return!!this.Gp}handleUpEvent(t){for(let e=this.fm.length-1;e>=0;--e){const i=this.fm[e][0],n=i.geometry;if("Circle"===n.getType()){const e=n.getCenter(),s=i.featureSegments[0],r=i.featureSegments[1];s.segment[0]=e,s.segment[1]=e,r.segment[0]=e,r.segment[1]=e,this.um.update(se(e),s);let o=n;const h=an();if(h){const e=t.map.getView().getProjection();o=o.clone().transform(h,e),o=Ss(o).transform(e,h)}this.um.update(o.getExtent(),r)}else this.um.update(Zt(i.segment),i)}return this.am&&(this.dispatchEvent(new Qb(Jb,this.am,t)),this.am=null),!1}Ye(t){this.om=t.pixel,this.Am(t.pixel,t.map,t.coordinate)}Am(t,e,n){const s=n||e.getCoordinateFromPixel(t),r=e.getView().getProjection(),o=function(t,e){return eM(s,t,r)-eM(s,e,r)};let h,a;if(this.Sm){const i="object"==typeof this.Sm?t=>t===this.Sm:void 0;e.forEachFeatureAtPixel(t,((t,e,i)=>{if("Point"===(i=i||t.getGeometry()).getType()&&this.zs.getArray().includes(t)){a=i;const e=i.getFlatCoordinates().slice(0,2);h=[{feature:t,geometry:i,segment:[e,e]}]}return!0}),{layerFilter:i})}if(!h){const t=cn(Vt(fn(se(s,Wb),r),e.getView().getResolution()*this.Np,Wb),r);h=this.um.getInExtent(t)}if(h&&h.length>0){const n=h.sort(o)[0],u=n.segment;let l=iM(s,n,r);const c=e.getPixelFromCoordinate(l);let f=Ii(t,c);if(a||f<=this.Np){const t={};if(t[i(u)]=!0,this.Im||(this.en[0]=l[0]-s[0],this.en[1]=l[1]-s[1]),"Circle"===n.geometry.getType()&&1===n.index)this.Op=!0,this.Nm(l,[n.feature],[n.geometry]);else{const s=e.getPixelFromCoordinate(u[0]),r=e.getPixelFromCoordinate(u[1]),o=Fi(c,s),a=Fi(c,r);f=Math.sqrt(Math.min(o,a)),this.Op=f<=this.Np,this.Op&&(l=o>a?u[1]:u[0]),this.Nm(l,[n.feature],[n.geometry]);const d={};d[i(n.geometry)]=!0;for(let e=1,n=h.length;e=0;--h)r=t[h],f=r[0],d=i(f.feature),f.depth&&(d+="-"+f.depth.join("-")),d in e||(e[d]={}),0===r[1]?(e[d].right=f,e[d].index=f.index):1==r[1]&&(e[d].left=f,e[d].index=f.index+1);for(d in e){switch(c=e[d].right,u=e[d].left,a=e[d].index,l=a-1,f=void 0!==u?u:c,l<0&&(l=0),o=f.geometry,s=o.getCoordinates(),n=s,p=!1,o.getType()){case"MultiLineString":s[f.depth[0]].length>2&&(s[f.depth[0]].splice(a,1),p=!0);break;case"LineString":s.length>2&&(s.splice(a,1),p=!0);break;case"MultiPolygon":n=n[f.depth[1]];case"Polygon":n=n[f.depth[0]],n.length>4&&(a==n.length-1&&(a=0),n.splice(a,1),p=!0,0===a&&(n.pop(),n.push(n[0]),l=n.length-1))}if(p){this.Om(o,s);const e=[];if(void 0!==u&&(this.um.remove(u),e.push(u.segment[0])),void 0!==c&&(this.um.remove(c),e.push(c.segment[1])),void 0!==u&&void 0!==c){const t={depth:f.depth,feature:f.feature,geometry:f.geometry,index:l,segment:e};this.um.insert(Zt(t.segment),t)}this.Gm(o,a,f.depth,-1),this.Gp&&(this.Sp.getSource().removeFeature(this.Gp),this.Gp=null),t.length=0}}return p}Om(t,e){this.lm=!0,t.setCoordinates(e),this.lm=!1}Gm(t,e,i,n){this.um.forEachInExtent(t.getExtent(),(function(s){s.geometry===t&&(void 0===i||void 0===s.depth||g(s.depth,i))&&s.index>e&&(s.index+=n)}))}};const rM="select";class oM extends u{constructor(t,e,i,n){super(t),this.selected=e,this.deselected=i,this.mapBrowserEvent=n}}const hM={};class aM extends mh{constructor(t){let e;if(super(),this.on,this.once,this.un,t=t||{},this.Dm=this.Em.bind(this),this.Um=this.Rm.bind(this),this.an=t.condition?t.condition:Th,this.$m=t.addCondition?t.addCondition:Eh,this.Bm=t.removeCondition?t.removeCondition:Eh,this.qm=t.toggleCondition?t.toggleCondition:Fh,this.Xm=!!t.multi&&t.multi,this.Ym=t.filter?t.filter:w,this.Zm=t.hitTolerance?t.hitTolerance:0,this.K=void 0!==t.style?t.style:function(){const t=Dc();return v(t.Polygon,t.LineString),v(t.GeometryCollection,t.LineString),function(e){return e.getGeometry()?t[e.getGeometry().getType()]:null}}(),this.zs=t.features||new Q,t.layers)if("function"==typeof t.layers)e=t.layers;else{const i=t.layers;e=function(t){return i.includes(t)}}else e=w;this.Vm=e,this.Wm={}}Hm(t,e){this.Wm[i(t)]=e}getFeatures(){return this.zs}getHitTolerance(){return this.Zm}getLayer(t){return this.Wm[i(t)]}setHitTolerance(t){this.Zm=t}setMap(t){this.getMap()&&this.K&&this.zs.forEach(this.Km.bind(this)),super.setMap(t),t?(this.zs.addEventListener(W,this.Dm),this.zs.addEventListener(H,this.Um),this.K&&this.zs.forEach(this.Jm.bind(this))):(this.zs.removeEventListener(W,this.Dm),this.zs.removeEventListener(H,this.Um))}Em(t){const e=t.element;if(this.K&&this.Jm(e),!this.getLayer(e)){const t=this.getMap().getAllLayers().find((function(t){if(t instanceof Jv&&t.getSource()&&t.getSource().hasFeature(e))return t}));t&&this.Hm(e,t)}}Rm(t){this.K&&this.Km(t.element)}getStyle(){return this.K}Jm(t){const e=i(t);e in hM||(hM[e]=t.getStyle()),t.setStyle(this.K)}Km(t){const e=this.getMap().getInteractions().getArray();for(let i=e.length-1;i>=0;--i){const n=e[i];if(n!==this&&n instanceof aM&&n.getStyle()&&-1!==n.getFeatures().getArray().lastIndexOf(t))return void t.setStyle(n.getStyle())}const n=i(t);t.setStyle(hM[n]),delete hM[n]}Qm(t){delete this.Wm[i(t)]}handleEvent(t){if(!this.an(t))return!0;const e=this.$m(t),i=this.Bm(t),n=this.qm(t),s=!e&&!i&&!n,r=t.map,o=this.getFeatures(),h=[],a=[];if(s){P(this.Wm),r.forEachFeatureAtPixel(t.pixel,function(t,e){if(t instanceof pt&&this.Ym(t,e))return this.Hm(t,e),a.push(t),!this.Xm}.bind(this),{layerFilter:this.Vm,hitTolerance:this.Zm});for(let t=o.getLength()-1;t>=0;--t){const e=o.item(t),i=a.indexOf(e);i>-1?a.splice(i,1):(o.remove(e),h.push(e))}0!==a.length&&o.extend(a)}else{r.forEachFeatureAtPixel(t.pixel,function(t,s){if(t instanceof pt&&this.Ym(t,s))return!e&&!n||o.getArray().includes(t)?(i||n)&&o.getArray().includes(t)&&(h.push(t),this.Qm(t)):(this.Hm(t,s),a.push(t)),!this.Xm}.bind(this),{layerFilter:this.Vm,hitTolerance:this.Zm});for(let t=h.length-1;t>=0;--t)o.remove(h[t]);o.extend(a)}return(a.length>0||h.length>0)&&this.dispatchEvent(new oM(rM,a,h,t)),!0}}var uM=aM;function lM(t){return t.feature?t.feature:t.element?t.element:void 0}const cM=[];var fM=class extends yh{constructor(t){const e=t=t||{};e.handleDownEvent||(e.handleDownEvent=w),e.stopDown||(e.stopDown=x),super(e),this.Hd=t.source?t.source:null,this.tv=void 0===t.vertex||t.vertex,this.ev=void 0===t.edge||t.edge,this.zs=t.features?t.features:null,this.iv=[],this.nv={},this.sv={},this.rv={},this.Np=void 0!==t.pixelTolerance?t.pixelTolerance:10,this.um=new Jc,this.ov={Point:this.hv.bind(this),LineString:this.av.bind(this),LinearRing:this.av.bind(this),Polygon:this.uv.bind(this),MultiPoint:this.lv.bind(this),MultiLineString:this.cv.bind(this),MultiPolygon:this.fv.bind(this),GeometryCollection:this.dv.bind(this),Circle:this.pv.bind(this)}}addFeature(t,e){e=void 0===e||e;const n=i(t),s=t.getGeometry();if(s){const e=this.ov[s.getType()];if(e){this.sv[n]=s.getExtent([1/0,1/0,-1/0,-1/0]);const i=[];if(e(i,s),1===i.length)this.um.insert(Zt(i[0]),{feature:t,segment:i[0]});else if(i.length>1){const e=i.map((t=>Zt(t))),n=i.map((e=>({feature:t,segment:e})));this.um.load(e,n)}}}e&&(this.nv[n]=U(t,T,this.Qa,this))}mv(t){this.addFeature(t)}vv(t){this.removeFeature(t)}gv(){let t;return this.zs?t=this.zs:this.Hd&&(t=this.Hd.getFeatures()),t}handleEvent(t){const e=this.snapTo(t.pixel,t.coordinate,t.map);return e&&(t.coordinate=e.vertex.slice(0,2),t.pixel=e.vertexPixel),super.handleEvent(t)}Tm(t){const e=lM(t);this.addFeature(e)}Cm(t){const e=lM(t);this.removeFeature(e)}Qa(t){const e=t.target;if(this.handlingDownUpSequence){const t=i(e);t in this.rv||(this.rv[t]=e)}else this.yv(e)}handleUpEvent(t){const e=Object.values(this.rv);return e.length&&(e.forEach(this.yv.bind(this)),this.rv={}),!1}removeFeature(t,e){const n=void 0===e||e,s=i(t),r=this.sv[s];if(r){const e=this.um,i=[];e.forEachInExtent(r,(function(e){t===e.feature&&i.push(e)}));for(let t=i.length-1;t>=0;--t)e.remove(i[t])}n&&(B(this.nv[s]),delete this.nv[s])}setMap(t){const e=this.getMap(),i=this.iv,n=this.gv();e&&(i.forEach(B),i.length=0,n.forEach(this.vv.bind(this))),super.setMap(t),t&&(this.zs?i.push(U(this.zs,W,this.Tm,this),U(this.zs,H,this.Cm,this)):this.Hd&&i.push(U(this.Hd,mf,this.Tm,this),U(this.Hd,yf,this.Cm,this)),n.forEach(this.mv.bind(this)))}snapTo(t,e,i){const n=Zt([i.getCoordinateFromPixel([t[0]-this.Np,t[1]+this.Np]),i.getCoordinateFromPixel([t[0]+this.Np,t[1]-this.Np])]),s=this.um.getInExtent(n),r=s.length;if(0===r)return null;const o=i.getView().getProjection(),h=ln(e,o);let a,u=1/0;const l=this.Np*this.Np,c=()=>{if(a){const e=i.getPixelFromCoordinate(a);if(Fi(t,e)<=l)return{vertex:a,vertexPixel:[Math.round(e[0]),Math.round(e[1])]}}return null};if(this.tv){for(let t=0;t{const e=ln(t,o),i=Fi(h,e);i{t.push([e])}))}fv(t,e){const i=e.getCoordinates();for(let e=0,n=i.length;e=0;e--)s.push(n[t][e]);return{hasZ:i.hasZ,hasM:i.hasM,rings:s}}};function bM(t,e){if(!t)return null;let i;if("number"==typeof t.x&&"number"==typeof t.y)i="Point";else if(t.points)i="MultiPoint";else if(t.paths){i=1===t.paths.length?"LineString":"MultiLineString"}else if(t.rings){const e=t,n=MM(e),s=function(t,e){const i=[],n=[],s=[];let r,o;for(r=0,o=t.length;r=0;r--){const i=n[r][0];if(Jt(new Kn(i).getExtent(),new Kn(t).getExtent())){n[r].push(t),e=!0;break}}e||n.push([t.reverse()])}return n}(e.rings,n);1===s.length?(i="Polygon",t=Object.assign({},t,{rings:s[0]})):(i="MultiPolygon",t=Object.assign({},t,{rings:s}))}return cg((0,wM[i])(t),!1,e)}function MM(t){let e="XY";return!0===t.hasZ&&!0===t.hasM?e="XYZM":!0===t.hasZ?e="XYZ":!0===t.hasM&&(e="XYM"),e}function SM(t){const e=t.getLayout();return{hasZ:"XYZ"===e||"XYZM"===e,hasM:"XYM"===e||"XYZM"===e}}function PM(t,e){return(0,xM[t.getType()])(cg(t,!0,e),e)}var _M=class extends Pg{constructor(t){t=t||{},super(),this.H=t.geometryName}readFeatureFromObject(t,e,i){const n=t,s=bM(n.geometry,e),r=new pt;if(this.H&&r.setGeometryName(this.H),r.setGeometry(s),n.attributes){r.setProperties(n.attributes,!0);const t=n.attributes[i];void 0!==t&&r.setId(t)}return r}readFeaturesFromObject(t,e){if(e=e||{},t.features){const i=[],n=t.features;for(let s=0,r=n.length;s0?i[0]:null}readFeatureFromNode(t,e){return null}readFeatures(t,e){if(t){if("string"==typeof t){const i=Fu(t);return this.readFeaturesFromDocument(i,e)}return Tu(t)?this.readFeaturesFromDocument(t,e):this.readFeaturesFromNode(t,e)}return[]}readFeaturesFromDocument(t,e){const i=[];for(let n=t.firstChild;n;n=n.nextSibling)n.nodeType==Node.ELEMENT_NODE&&v(i,this.readFeaturesFromNode(n,e));return i}readFeaturesFromNode(e,i){return t()}readGeometry(t,e){if(t){if("string"==typeof t){const i=Fu(t);return this.readGeometryFromDocument(i,e)}return Tu(t)?this.readGeometryFromDocument(t,e):this.readGeometryFromNode(t,e)}return null}readGeometryFromDocument(t,e){return null}readGeometryFromNode(t,e){return null}readProjection(t){if(t){if("string"==typeof t){const e=Fu(t);return this.readProjectionFromDocument(e)}return Tu(t)?this.readProjectionFromDocument(t):this.readProjectionFromNode(t)}return null}readProjectionFromDocument(t){return this.dataProjection}readProjectionFromNode(t){return this.dataProjection}writeFeature(t,e){const i=this.writeFeatureNode(t,e);return this.Pv.serializeToString(i)}writeFeatureNode(t,e){return null}writeFeatures(t,e){const i=this.writeFeaturesNode(t,e);return this.Pv.serializeToString(i)}writeFeaturesNode(t,e){return null}writeGeometry(t,e){const i=this.writeGeometryNode(t,e);return this.Pv.serializeToString(i)}writeGeometryNode(t,e){return null}};const TM="http://www.opengis.net/gml",CM=/^\s*$/;class FM extends EM{constructor(t){super(),t=t||{},this.featureType=t.featureType,this.featureNS=t.featureNS,this.srsName=t.srsName,this.schemaLocation="",this.FEATURE_COLLECTION_PARSERS={},this.FEATURE_COLLECTION_PARSERS[this.namespace]={featureMember:Au(this.readFeaturesInternal),featureMembers:ku(this.readFeaturesInternal)},this.supportedMediaTypes=["application/gml+xml"]}readFeaturesInternal(t,e){const i=t.localName;let n=null;if("FeatureCollection"==i)n=$u([],this.FEATURE_COLLECTION_PARSERS,t,e,this);else if("featureMembers"==i||"featureMember"==i||"member"==i){const s=e[0];let r=s.featureType,o=s.featureNS;const h="p",a="p0";if(!r&&t.childNodes){r=[],o={};for(let e=0,i=t.childNodes.length;e0){t={_v:t};for(let e=0;e0){e[e.length-1].push(...i)}},outerBoundaryIs:function(t,e){const i=$u(void 0,t_,t,e);if(i){e[e.length-1][0]=i}}});function UP(t,e){const i=$u({},LP,t,e),n=$u([null],DP,t,e);if(n&&n[0]){const t=n[0],e=[t.length];for(let i=1,s=n.length;i0;let o;const h=s.href;let a,u,l;h?o=h:r&&(o=iP);let c="bottom-left";const f=i.hotSpot;let d;f?(a=[f.x,f.y],u=f.xunits,l=f.yunits,c=f.origin):/^https?:\/\/maps\.(?:google|gstatic)\.com\//.test(o)&&(o.includes("pushpin")?(a=JS,u=QS,l=tP):o.includes("arrow-reverse")?(a=[54,42],u=QS,l=tP):o.includes("paddle")&&(a=[32,1],u=QS,l=tP));const p=s.x,m=s.y;let v;void 0!==p&&void 0!==m&&(d=[p,m]);const g=s.w,y=s.h;let w;void 0!==g&&void 0!==y&&(v=[g,y]);const x=i.heading;void 0!==x&&(w=fi(x));const b=i.scale,M=i.color;if(r){o==iP&&(v=eP);const t=new Rc({anchor:a,anchorOrigin:c,anchorXUnits:u,anchorYUnits:l,crossOrigin:this.qt,offset:d,offsetOrigin:"bottom-left",rotation:w,scale:b,size:v,src:this.Yv(o),color:M}),e=t.getScaleArray()[0],i=t.getSize();if(null===i){const i=t.getImageState();if(i===Gs||i===js){const n=function(){const i=t.getImageState();if(i!==Gs&&i!==js){const i=t.getSize();if(i&&2==i.length){const n=fP(i);t.setScale(e*n)}t.unlistenImageChange(n)}};t.listenImageChange(n),i===Gs&&t.load()}}else if(2==i.length){const n=fP(i);t.setScale(e*n)}n.imageStyle=t}else n.imageStyle=sP},LabelStyle:function(t,e){const i=$u({},SP,t,e);if(!i)return;const n=e[e.length-1],s=new qc({fill:new Tc({color:"color"in i?i.color:KS}),scale:i.scale});n.textStyle=s},LineStyle:function(t,e){const i=$u({},PP,t,e);if(!i)return;const n=e[e.length-1],s=new Nc({color:"color"in i?i.color:KS,width:"width"in i?i.width:1});n.strokeStyle=s},PolyStyle:function(t,e){const i=$u({},_P,t,e);if(!i)return;const n=e[e.length-1],s=new Tc({color:"color"in i?i.color:KS});n.fillStyle=s;const r=i.fill;void 0!==r&&(n.fill=r);const o=i.outline;void 0!==o&&(n.outline=o)}});function BP(t,e){const i=$u({},$P,t,e,this);if(!i)return null;let n="fillStyle"in i?i.fillStyle:nP;const s=i.fill;let r;void 0===s||s||(n=null),"imageStyle"in i?i.imageStyle!=sP&&(r=i.imageStyle):r=rP;const o="textStyle"in i?i.textStyle:aP,h="strokeStyle"in i?i.strokeStyle:hP,a=i.outline;return void 0===a||a?[new $c({fill:n,image:r,stroke:h,text:o,zIndex:void 0})]:[new $c({geometry:function(t){const e=t.getGeometry(),i=e.getType();if("GeometryCollection"===i){return new Mg(e.getGeometriesArrayRecursive().filter((function(t){const e=t.getType();return"Polygon"!==e&&"MultiPolygon"!==e})))}if("Polygon"!==i&&"MultiPolygon"!==i)return e},fill:n,image:r,stroke:h,text:o,zIndex:void 0}),new $c({geometry:function(t){const e=t.getGeometry(),i=e.getType();if("GeometryCollection"===i){return new Mg(e.getGeometriesArrayRecursive().filter((function(t){const e=t.getType();return"Polygon"===e||"MultiPolygon"===e})))}if("Polygon"===i||"MultiPolygon"===i)return e},fill:n,stroke:null,zIndex:void 0})]}function qP(t,e){const i=e.length,n=new Array(e.length),s=new Array(e.length),r=new Array(e.length);let o,h,a;o=!1,h=!1,a=!1;for(let t=0;t0){const t=ju(s,o);qu(n,__,T_,[{names:o,values:t}],i)}const c=i[0];let f=e.getGeometry();f&&(f=cg(f,!0,c)),qu(n,__,v_,[f],i)}const F_=Du(BS,["extrude","tessellate","altitudeMode","coordinates"]),I_=Du(BS,{extrude:Nu(jM),tessellate:Nu(jM),altitudeMode:Nu(qM),coordinates:Nu((function(t,e,i){const n=i[i.length-1],s=n.layout,r=n.stride;let o;"XY"==s||"XYM"==s?o=2:"XYZ"==s||"XYZM"==s?o=3:ct(!1,34);const h=e.length;let a="";if(h>0){a+=e[0];for(let t=1;t0;else{const e=t.getType();h="Point"===e||"MultiPoint"===e}}h&&(a=r.get("name"),h=h&&!!a,h&&/&[^&]+;/.test(a)&&(lP||(lP=document.createElement("textarea")),lP.innerHTML=a,a=lP.value));let l=i;if(t?l=t:e&&(l=pP(e,i,n)),h){const t=function(t,e){const i=[0,0];let n="start";const s=t.getImage();if(s){const t=s.getSize();if(t&&2==t.length){const e=s.getScaleArray(),r=s.getAnchor();i[0]=e[0]*(t[0]-r[0]),i[1]=e[1]*(t[1]/2-r[1]),n="left"}}let r=t.getText();r?(r=r.clone(),r.setFont(r.getFont()||aP.getFont()),r.setScale(r.getScale()||aP.getScale()),r.setFill(r.getFill()||aP.getFill()),r.setStroke(r.getStroke()||oP)):r=aP.clone();r.setText(e),r.setOffsetX(i[0]),r.setOffsetY(i[1]),r.setTextAlign(n);return new $c({image:s,text:r})}(l[0],a);if(u.length>0){t.setGeometry(new Mg(u));return[t,new $c({geometry:l[0].getGeometry(),image:null,fill:l[0].getFill(),stroke:l[0].getStroke(),text:null})].concat(l.slice(1))}return t}return l}}(i.Style,i.styleUrl,this.Vv,this.Hv,this.Kv);n.setStyle(t)}return delete i.Style,n.setProperties(i,!0),n}tg(t,e){const i=t.getAttribute("id");if(null!==i){const n=BP.call(this,t,e);if(n){let e,s=t.baseURI;if(s&&"about:blank"!=s||(s=window.location.href),s){e=new URL("#"+i,s).href}else e="#"+i;this.Hv[e]=n}}}eg(t,e){const i=t.getAttribute("id");if(null===i)return;const n=bP.call(this,t,e);if(!n)return;let s,r=t.baseURI;if(r&&"about:blank"!=r||(r=window.location.href),r){s=new URL("#"+i,r).href}else s="#"+i;this.Hv[s]=n}readFeatureFromNode(t,e){if(!BS.includes(t.namespaceURI))return null;const i=this.Qv(t,[this.getReadOptions(t,e)]);return i||null}readFeaturesFromNode(t,e){if(!BS.includes(t.namespaceURI))return[];let i;const n=t.localName;if("Document"==n||"Folder"==n)return i=this.Jv(t,[this.getReadOptions(t,e)]),i||[];if("Placemark"==n){const i=this.Qv(t,[this.getReadOptions(t,e)]);return i?[i]:[]}if("kml"==n){i=[];for(let n=t.firstElementChild;n;n=n.nextElementSibling){const t=this.readFeaturesFromNode(n,e);t&&v(i,t)}return i}return[]}readName(t){if(t){if("string"==typeof t){const e=Fu(t);return this.readNameFromDocument(e)}return Tu(t)?this.readNameFromDocument(t):this.readNameFromNode(t)}}readNameFromDocument(t){for(let e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE){const t=this.readNameFromNode(e);if(t)return t}}readNameFromNode(t){for(let e=t.firstElementChild;e;e=e.nextElementSibling)if(BS.includes(e.namespaceURI)&&"name"==e.localName)return GM(e);for(let e=t.firstElementChild;e;e=e.nextElementSibling){const t=e.localName;if(BS.includes(e.namespaceURI)&&("Document"==t||"Folder"==t||"Placemark"==t||"kml"==t)){const t=this.readNameFromNode(e);if(t)return t}}}readNetworkLinks(t){const e=[];if("string"==typeof t){const i=Fu(t);v(e,this.readNetworkLinksFromDocument(i))}else Tu(t)?v(e,this.readNetworkLinksFromDocument(t)):v(e,this.readNetworkLinksFromNode(t));return e}readNetworkLinksFromDocument(t){const e=[];for(let i=t.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&v(e,this.readNetworkLinksFromNode(i));return e}readNetworkLinksFromNode(t){const e=[];for(let i=t.firstElementChild;i;i=i.nextElementSibling)if(BS.includes(i.namespaceURI)&&"NetworkLink"==i.localName){const t=$u({},YS,i,[]);e.push(t)}for(let i=t.firstElementChild;i;i=i.nextElementSibling){const t=i.localName;!BS.includes(i.namespaceURI)||"Document"!=t&&"Folder"!=t&&"kml"!=t||v(e,this.readNetworkLinksFromNode(i))}return e}readRegion(t){const e=[];if("string"==typeof t){const i=Fu(t);v(e,this.readRegionFromDocument(i))}else Tu(t)?v(e,this.readRegionFromDocument(t)):v(e,this.readRegionFromNode(t));return e}readRegionFromDocument(t){const e=[];for(let i=t.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&v(e,this.readRegionFromNode(i));return e}readRegionFromNode(t){const e=[];for(let i=t.firstElementChild;i;i=i.nextElementSibling)if(BS.includes(i.namespaceURI)&&"Region"==i.localName){const t=$u({},VS,i,[]);e.push(t)}for(let i=t.firstElementChild;i;i=i.nextElementSibling){const t=i.localName;!BS.includes(i.namespaceURI)||"Document"!=t&&"Folder"!=t&&"kml"!=t||v(e,this.readRegionFromNode(i))}return e}writeFeaturesNode(t,e){e=this.adaptOptions(e);const i=Pu(BS[4],"kml"),n="http://www.w3.org/2000/xmlns/";i.setAttributeNS(n,"xmlns:gx",$S[0]),i.setAttributeNS(n,"xmlns:xsi",Su),i.setAttributeNS(Su,"xsi:schemaLocation","http://www.opengis.net/kml/2.2 https://developers.google.com/kml/schema/kml22gx.xsd");const s={node:i},r={};t.length>1?r.Document=t:1==t.length&&(r.Placemark=t[0]);const o=WS[i.namespaceURI],h=ju(r,o);return qu(s,HS,Gu,h,[e],o,this),i}};const $_=[null],B_=Du($_,{nd:function(t,e){e[e.length-1].ndrefs.push(t.getAttribute("ref"))},tag:Y_}),q_=Du($_,{node:function(t,e){const i=e[0],n=e[e.length-1],s=t.getAttribute("id"),r=[parseFloat(t.getAttribute("lon")),parseFloat(t.getAttribute("lat"))];n.nodes[s]=r;const o=$u({tags:{}},X_,t,e);if(!_(o.tags)){const t=new Qn(r);cg(t,!1,i);const e=new pt(t);void 0!==s&&e.setId(s),e.setProperties(o.tags,!0),n.features.push(e)}},way:function(t,e){const i=$u({id:t.getAttribute("id"),ndrefs:[],tags:{}},B_,t,e);e[e.length-1].ways.push(i)}});const X_=Du($_,{tag:Y_});function Y_(t,e){e[e.length-1].tags[t.getAttribute("k")]=t.getAttribute("v")}var Z_=class extends EM{constructor(){super(),this.dataProjection=Yi("EPSG:4326")}readFeaturesFromNode(t,e){if(e=this.getReadOptions(t,e),"osm"==t.localName){const i=$u({nodes:{},ways:[],features:[]},q_,t,[e]);for(let t=0;t>1):i>>1}return e}function yE(t){let e="";for(let i=0,n=t.length;i=32;)e=63+(32|31&t),i+=String.fromCharCode(e),t>>=5;return e=t+63,i+=String.fromCharCode(e),i}var bE=class extends OS{constructor(t){super(),t=t||{},this.dataProjection=Yi("EPSG:4326"),this.ig=t.factor?t.factor:1e5,this.pp=t.geometryLayout?t.geometryLayout:"XY"}readFeatureFromText(t,e){const i=this.readGeometryFromText(t,e);return new pt(i)}readFeaturesFromText(t,e){return[this.readFeatureFromText(t,e)]}readGeometryFromText(t,e){const i=Sn(this.pp),n=dE(t,i,this.ig);yM(n,0,n.length,i,n);const s=qn(n,0,n.length,i);return cg(new $v(s,this.pp),!1,this.adaptOptions(e))}writeFeatureText(t,e){const i=t.getGeometry();return i?this.writeGeometryText(i,e):(ct(!1,40),"")}writeFeaturesText(t,e){return this.writeFeatureText(t[0],e)}writeGeometryText(t,e){const i=(t=cg(t,!0,this.adaptOptions(e))).getFlatCoordinates(),n=t.getStride();return yM(i,0,i.length,n,i),fE(i,n,this.ig)}};const ME={Point:function(t,e,i){const n=t.coordinates;e&&i&&TE(n,e,i);return new Qn(n)},LineString:function(t,e){const i=SE(t.arcs,e);return new $v(i)},Polygon:function(t,e){const i=[];for(let n=0,s=t.arcs.length;n0&&i.pop(),n>=0){const t=e[n];for(let e=0,n=t.length;e