back-testing-react 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/cjs/index.js +132 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/esm/index.js +132 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/types.d.ts +2 -0
- package/package.json +49 -0
- package/rollup.config.js +42 -0
- package/src/components/back-testing-cat-legend/back-testing-cat-legend.css +36 -0
- package/src/components/back-testing-cat-legend/back-testing-cat-legend.stories.tsx +12 -0
- package/src/components/back-testing-cat-legend/back-testing-cat-legend.tsx +23 -0
- package/src/components/back-testing-cat-legend/back-testing-cat-legend.types.ts +3 -0
- package/src/components/back-testing-cat-legend/index.ts +1 -0
- package/src/components/back-testing-map/back-testing-map.css +39 -0
- package/src/components/back-testing-map/back-testing-map.service.ts +63 -0
- package/src/components/back-testing-map/back-testing-map.stories.tsx +427 -0
- package/src/components/back-testing-map/back-testing-map.tsx +503 -0
- package/src/components/back-testing-map/back-testing-map.types.ts +176 -0
- package/src/components/back-testing-map/index.ts +1 -0
- package/src/components/back-testing-storm-legend/back-testing-storm-legend.css +3 -0
- package/src/components/back-testing-storm-legend/back-testing-storm-legend.stories.tsx +98 -0
- package/src/components/back-testing-storm-legend/back-testing-storm-legend.tsx +28 -0
- package/src/components/back-testing-storm-legend/back-testing-storm-legend.types.ts +6 -0
- package/src/components/back-testing-storm-legend/index.ts +1 -0
- package/src/components/index.ts +3 -0
- package/src/index.ts +1 -0
- package/src/stories/Button.stories.ts +53 -0
- package/src/stories/Button.tsx +37 -0
- package/src/stories/Configure.mdx +364 -0
- package/src/stories/Header.stories.ts +33 -0
- package/src/stories/Header.tsx +56 -0
- package/src/stories/Page.stories.ts +32 -0
- package/src/stories/Page.tsx +73 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/stories/button.css +30 -0
- package/src/stories/header.css +32 -0
- package/src/stories/page.css +69 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import*as e from"react";import t,{forwardRef as r,useContext as i,Children as n,isValidElement as o,cloneElement as s,useRef as a,useState as l,useImperativeHandle as c,useEffect as u}from"react";import*as h from"react-dom";import d from"react-dom";function p(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var f,m={exports:{}},_={};var g,y,x={};
|
|
2
|
+
/**
|
|
3
|
+
* @license React
|
|
4
|
+
* react-jsx-runtime.development.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/function v(){return g||(g=1,"production"!==process.env.NODE_ENV&&function(){var e=t,r=Symbol.for("react.element"),i=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),m=Symbol.iterator;var _=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];!function(e,t,r){var i=_.ReactDebugCurrentFrame,n=i.getStackAddendum();""!==n&&(t+="%s",r=r.concat([n]));var o=r.map((function(e){return String(e)}));o.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,o)}("error",e,r)}var y;function v(e){return e.displayName||"Context"}function b(e){if(null==e)return null;if("number"==typeof e.tag&&g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case n:return"Fragment";case i:return"Portal";case s:return"Profiler";case o:return"StrictMode";case u:return"Suspense";case h:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case l:return v(e)+".Consumer";case a:return v(e._context)+".Provider";case c:return function(e,t,r){var i=e.displayName;if(i)return i;var n=t.displayName||t.name||"";return""!==n?r+"("+n+")":r}(e,e.render,"ForwardRef");case d:var t=e.displayName||null;return null!==t?t:b(e.type)||"Memo";case p:var r=e,f=r._payload,m=r._init;try{return b(m(f))}catch(e){return null}}return null}y=Symbol.for("react.module.reference");var w,T,S,E,M,A,C,I=Object.assign,P=0;function R(){}R.__reactDisabledLog=!0;var z,D=_.ReactCurrentDispatcher;function k(e,t,r){if(void 0===z)try{throw Error()}catch(e){var i=e.stack.trim().match(/\n( *(at )?)/);z=i&&i[1]||""}return"\n"+z+e}var O,L=!1,B="function"==typeof WeakMap?WeakMap:Map;function F(e,t){if(!e||L)return"";var r,i=O.get(e);if(void 0!==i)return i;L=!0;var n,o=Error.prepareStackTrace;Error.prepareStackTrace=void 0,n=D.current,D.current=null,function(){if(0===P){w=console.log,T=console.info,S=console.warn,E=console.error,M=console.group,A=console.groupCollapsed,C=console.groupEnd;var e={configurable:!0,enumerable:!0,value:R,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}P++}();try{if(t){var s=function(){throw Error()};if(Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(s,[])}catch(e){r=e}Reflect.construct(e,[],s)}else{try{s.call()}catch(e){r=e}e.call(s.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&"string"==typeof t.stack){for(var a=t.stack.split("\n"),l=r.stack.split("\n"),c=a.length-1,u=l.length-1;c>=1&&u>=0&&a[c]!==l[u];)u--;for(;c>=1&&u>=0;c--,u--)if(a[c]!==l[u]){if(1!==c||1!==u)do{if(c--,--u<0||a[c]!==l[u]){var h="\n"+a[c].replace(" at new "," at ");return e.displayName&&h.includes("<anonymous>")&&(h=h.replace("<anonymous>",e.displayName)),"function"==typeof e&&O.set(e,h),h}}while(c>=1&&u>=0);break}}}finally{L=!1,D.current=n,function(){if(0==--P){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:I({},e,{value:w}),info:I({},e,{value:T}),warn:I({},e,{value:S}),error:I({},e,{value:E}),group:I({},e,{value:M}),groupCollapsed:I({},e,{value:A}),groupEnd:I({},e,{value:C})})}P<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=o}var d=e?e.displayName||e.name:"",p=d?k(d):"";return"function"==typeof e&&O.set(e,p),p}function N(e,t,r){if(null==e)return"";if("function"==typeof e)return F(e,!(!(i=e.prototype)||!i.isReactComponent));var i;if("string"==typeof e)return k(e);switch(e){case u:return k("Suspense");case h:return k("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case c:return F(e.render,!1);case d:return N(e.type,t,r);case p:var n=e,o=n._payload,s=n._init;try{return N(s(o),t,r)}catch(e){}}return""}O=new B;var V=Object.prototype.hasOwnProperty,j={},U=_.ReactDebugCurrentFrame;function $(e){if(e){var t=e._owner,r=N(e.type,e._source,t?t.type:null);U.setExtraStackFrame(r)}else U.setExtraStackFrame(null)}var G=Array.isArray;function q(e){return G(e)}function H(e){return""+e}function W(e){if(function(e){try{return H(e),!1}catch(e){return!0}}(e))return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),H(e)}var Z,X,Y,J=_.ReactCurrentOwner,K={key:!0,ref:!0,__self:!0,__source:!0};Y={};function Q(e,t,i,n,o){var s,a={},l=null,c=null;for(s in void 0!==i&&(W(i),l=""+i),function(e){if(V.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(W(t.key),l=""+t.key),function(e){if(V.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}(t)&&(c=t.ref,function(e,t){if("string"==typeof e.ref&&J.current&&t&&J.current.stateNode!==t){var r=b(J.current.type);Y[r]||(g('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',b(J.current.type),e.ref),Y[r]=!0)}}(t,o)),t)V.call(t,s)&&!K.hasOwnProperty(s)&&(a[s]=t[s]);if(e&&e.defaultProps){var u=e.defaultProps;for(s in u)void 0===a[s]&&(a[s]=u[s])}if(l||c){var h="function"==typeof e?e.displayName||e.name||"Unknown":e;l&&function(e,t){var r=function(){Z||(Z=!0,g("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"key",{get:r,configurable:!0})}(a,h),c&&function(e,t){var r=function(){X||(X=!0,g("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"ref",{get:r,configurable:!0})}(a,h)}return function(e,t,i,n,o,s,a){var l={$$typeof:r,type:e,key:t,ref:i,props:a,_owner:s,_store:{}};return Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(l,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(l,"_source",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l}(e,l,c,o,n,J.current,a)}var ee,te=_.ReactCurrentOwner,re=_.ReactDebugCurrentFrame;function ie(e){if(e){var t=e._owner,r=N(e.type,e._source,t?t.type:null);re.setExtraStackFrame(r)}else re.setExtraStackFrame(null)}function ne(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}function oe(){if(te.current){var e=b(te.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}ee=!1;var se={};function ae(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var r=function(e){var t=oe();if(!t){var r="string"==typeof e?e:e.displayName||e.name;r&&(t="\n\nCheck the top-level render call using <"+r+">.")}return t}(t);if(!se[r]){se[r]=!0;var i="";e&&e._owner&&e._owner!==te.current&&(i=" It was passed a child from "+b(e._owner.type)+"."),ie(e),g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,i),ie(null)}}}function le(e,t){if("object"==typeof e)if(q(e))for(var r=0;r<e.length;r++){var i=e[r];ne(i)&&ae(i,t)}else if(ne(e))e._store&&(e._store.validated=!0);else if(e){var n=function(e){if(null===e||"object"!=typeof e)return null;var t=m&&e[m]||e["@@iterator"];return"function"==typeof t?t:null}(e);if("function"==typeof n&&n!==e.entries)for(var o,s=n.call(e);!(o=s.next()).done;)ne(o.value)&&ae(o.value,t)}}function ce(e){var t,r=e.type;if(null!=r&&"string"!=typeof r){if("function"==typeof r)t=r.propTypes;else{if("object"!=typeof r||r.$$typeof!==c&&r.$$typeof!==d)return;t=r.propTypes}if(t){var i=b(r);!function(e,t,r,i,n){var o=Function.call.bind(V);for(var s in e)if(o(e,s)){var a=void 0;try{if("function"!=typeof e[s]){var l=Error((i||"React class")+": "+r+" type `"+s+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[s]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw l.name="Invariant Violation",l}a=e[s](t,s,i,r,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){a=e}!a||a instanceof Error||($(n),g("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",i||"React class",r,s,typeof a),$(null)),a instanceof Error&&!(a.message in j)&&(j[a.message]=!0,$(n),g("Failed %s type: %s",r,a.message),$(null))}}(t,e.props,"prop",i,e)}else if(void 0!==r.PropTypes&&!ee){ee=!0,g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",b(r)||"Unknown")}"function"!=typeof r.getDefaultProps||r.getDefaultProps.isReactClassApproved||g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}var ue={};function he(e,t,i,m,_,x){var v=function(e){return"string"==typeof e||"function"==typeof e||e===n||e===s||e===o||e===u||e===h||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===p||e.$$typeof===d||e.$$typeof===a||e.$$typeof===l||e.$$typeof===c||e.$$typeof===y||void 0!==e.getModuleId)}(e);if(!v){var w="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(w+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var T;w+=oe(),null===e?T="null":q(e)?T="array":void 0!==e&&e.$$typeof===r?(T="<"+(b(e.type)||"Unknown")+" />",w=" Did you accidentally export a JSX literal instead of a component?"):T=typeof e,g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",T,w)}var S=Q(e,t,i,_,x);if(null==S)return S;if(v){var E=t.children;if(void 0!==E)if(m)if(q(E)){for(var M=0;M<E.length;M++)le(E[M],e);Object.freeze&&Object.freeze(E)}else g("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else le(E,e)}if(V.call(t,"key")){var A=b(e),C=Object.keys(t).filter((function(e){return"key"!==e})),I=C.length>0?"{key: someKey, "+C.join(": ..., ")+": ...}":"{key: someKey}";if(!ue[A+I])g('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',I,A,C.length>0?"{"+C.join(": ..., ")+": ...}":"{}",A),ue[A+I]=!0}return e===n?function(e){for(var t=Object.keys(e.props),r=0;r<t.length;r++){var i=t[r];if("children"!==i&&"key"!==i){ie(e),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",i),ie(null);break}}null!==e.ref&&(ie(e),g("Invalid attribute `ref` supplied to `React.Fragment`."),ie(null))}(S):ce(S),S}var de=function(e,t,r){return he(e,t,r,!1)},pe=function(e,t,r){return he(e,t,r,!0)};x.Fragment=n,x.jsx=de,x.jsxs=pe}()),x}var b,w,T=(y||(y=1,"production"===process.env.NODE_ENV?m.exports=function(){if(f)return _;f=1;var e=t,r=Symbol.for("react.element"),i=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function a(e,t,i){var a,l={},c=null,u=null;for(a in void 0!==i&&(c=""+i),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)n.call(t,a)&&!s.hasOwnProperty(a)&&(l[a]=t[a]);if(e&&e.defaultProps)for(a in t=e.defaultProps)void 0===l[a]&&(l[a]=t[a]);return{$$typeof:r,type:e,key:c,ref:u,props:l,_owner:o.current}}return _.Fragment=i,_.jsx=a,_.jsxs=a,_}():m.exports=v()),m.exports);!function(e){e.CAT_INTENSITY="__cat_view",e.STORMS="__storms_view"}(b||(b={})),function(e){e.COLOR_CAT_5="rgba(252, 92, 13, 1)",e.COLOR_CAT_5_MUTED="rgba(255, 255, 255, 0.5)",e.COLOR_CAT_4="rgba(250, 141, 14, 1)",e.COLOR_CAT_4_MUTED="rgba(255, 255, 255, 0.5)",e.COLOR_CAT_3="rgba(247, 190, 15, 1)",e.COLOR_CAT_3_MUTED="rgba(255, 255, 255, 0.5)",e.COLOR_CAT_2="rgba(246, 215, 15, 1)",e.COLOR_CAT_2_MUTED="rgba(255, 255, 255, 0.5)",e.COLOR_CAT_1="rgba(192, 232, 38, 1)",e.COLOR_CAT_1_MUTED="rgba(255, 255, 255, 0.5)",e.COLOR_TROPICAL_STORM="rgba(156, 244, 53, 1)",e.COLOR_TROPICAL_STORM_MUTED="rgba(255, 255, 255, 0.5)",e.COLOR_TROPICAL_DEPRESSION="rgba(120, 255, 68,1)",e.COLOR_TROPICAL_DEPRESSION_MUTED="rgba(255, 255, 255, 0.5)",e.COLOR_TROPICAL_EXPRESSION="rgba(120, 255, 68,1)",e.COLOR_TROPICAL_EXPRESSION_MUTED="rgba(255, 255, 255, 0.5)",e.COLOR_MUTED="rgba(255, 255, 255, 0.5)"}(w||(w={}));var S=[-70.9,42.35],E="__ciac_data",M="__tropical_storms_data",A="__tropical_storm_tracks_data",C="__tropical_storms_layer";function I(e){switch(e){case 5:return w.COLOR_CAT_5;case 4:return w.COLOR_CAT_4;case 3:return w.COLOR_CAT_3;case 2:return w.COLOR_CAT_2;case 1:return w.COLOR_CAT_1;case 0:return w.COLOR_TROPICAL_STORM;case-1:return w.COLOR_TROPICAL_DEPRESSION;default:return w.COLOR_TROPICAL_EXPRESSION}}function P(e){var t=120*Math.floor(e)+30*Math.round(120*e/360);return"hsla(".concat(t,", 90%, 60%, 1)")}function R(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===r&&i.firstChild?i.insertBefore(n,i.firstChild):i.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}R(".mapboxgl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0)}.mapboxgl-canvas{left:0;position:absolute;top:0}.mapboxgl-map:-webkit-full-screen{height:100%;width:100%}.mapboxgl-canary{background-color:salmon}.mapboxgl-canvas-container.mapboxgl-interactive,.mapboxgl-ctrl-group button.mapboxgl-ctrl-compass{cursor:grab;-webkit-user-select:none;user-select:none}.mapboxgl-canvas-container.mapboxgl-interactive.mapboxgl-track-pointer{cursor:pointer}.mapboxgl-canvas-container.mapboxgl-interactive:active,.mapboxgl-ctrl-group button.mapboxgl-ctrl-compass:active{cursor:grabbing}.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate,.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate .mapboxgl-canvas{touch-action:pan-x pan-y}.mapboxgl-canvas-container.mapboxgl-touch-drag-pan,.mapboxgl-canvas-container.mapboxgl-touch-drag-pan .mapboxgl-canvas{touch-action:pinch-zoom}.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan,.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan .mapboxgl-canvas{touch-action:none}.mapboxgl-ctrl-bottom,.mapboxgl-ctrl-bottom-left,.mapboxgl-ctrl-bottom-right,.mapboxgl-ctrl-left,.mapboxgl-ctrl-right,.mapboxgl-ctrl-top,.mapboxgl-ctrl-top-left,.mapboxgl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.mapboxgl-ctrl-top-left{left:0;top:0}.mapboxgl-ctrl-top{left:50%;top:0;transform:translateX(-50%)}.mapboxgl-ctrl-top-right{right:0;top:0}.mapboxgl-ctrl-right{right:0;top:50%;transform:translateY(-50%)}.mapboxgl-ctrl-bottom-right{bottom:0;right:0}.mapboxgl-ctrl-bottom{bottom:0;left:50%;transform:translateX(-50%)}.mapboxgl-ctrl-bottom-left{bottom:0;left:0}.mapboxgl-ctrl-left{left:0;top:50%;transform:translateY(-50%)}.mapboxgl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.mapboxgl-ctrl-top-left .mapboxgl-ctrl{float:left;margin:10px 0 0 10px}.mapboxgl-ctrl-top .mapboxgl-ctrl{float:left;margin:10px 0}.mapboxgl-ctrl-top-right .mapboxgl-ctrl{float:right;margin:10px 10px 0 0}.mapboxgl-ctrl-bottom-right .mapboxgl-ctrl,.mapboxgl-ctrl-right .mapboxgl-ctrl{float:right;margin:0 10px 10px 0}.mapboxgl-ctrl-bottom .mapboxgl-ctrl{float:left;margin:10px 0}.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl,.mapboxgl-ctrl-left .mapboxgl-ctrl{float:left;margin:0 0 10px 10px}.mapboxgl-ctrl-group{background:#fff;border-radius:4px}.mapboxgl-ctrl-group:not(:empty){box-shadow:0 0 0 2px rgba(0,0,0,.1)}@media (-ms-high-contrast:active){.mapboxgl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.mapboxgl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;overflow:hidden;padding:0;width:29px}.mapboxgl-ctrl-group button+button{border-top:1px solid #ddd}.mapboxgl-ctrl button .mapboxgl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (-ms-high-contrast:active){.mapboxgl-ctrl-icon{background-color:transparent}.mapboxgl-ctrl-group button+button{border-top:1px solid ButtonText}}.mapboxgl-ctrl-attrib-button:focus,.mapboxgl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.mapboxgl-ctrl button:disabled{cursor:not-allowed}.mapboxgl-ctrl button:disabled .mapboxgl-ctrl-icon{opacity:.25}.mapboxgl-ctrl-group button:first-child{border-radius:4px 4px 0 0}.mapboxgl-ctrl-group button:last-child{border-radius:0 0 4px 4px}.mapboxgl-ctrl-group button:only-child{border-radius:inherit}.mapboxgl-ctrl button:not(:disabled):hover{background-color:rgb(0 0 0/5%)}.mapboxgl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.mapboxgl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E\")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E\")}}.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E\")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E\")}}.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath id='south' d='M10.5 16l4 8 4-8h-8z' fill='%23ccc'/%3E%3C/svg%3E\")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath id='south' d='M10.5 16l4 8 4-8h-8z' fill='%23999'/%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' viewBox='0 0 29 29'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath id='south' d='M10.5 16l4 8 4-8h-8z' fill='%23ccc'/%3E%3C/svg%3E\")}}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23aaa'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' fill='%23f00'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active-error .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e58978'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background-error .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e54e33'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-waiting .mapboxgl-ctrl-icon{animation:mapboxgl-spin 2s linear infinite}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23999'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' fill='%23f00'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active-error .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e58978'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background-error .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e54e33'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23000'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23666'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' fill='%23f00'/%3E%3C/svg%3E\")}}@keyframes mapboxgl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.mapboxgl-ctrl-logo{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd' viewBox='0 0 88 23'%3E%3Cdefs%3E%3Cpath id='logo' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 013.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='text' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 00-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 004.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 01-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 01.3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 01-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='clip'%3E%3Crect x='0' y='0' width='100%25' height='100%25' fill='white'/%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/mask%3E%3Cg id='outline' opacity='0.3' stroke='%23000' stroke-width='3'%3E%3Ccircle mask='url(%23clip)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23text' mask='url(%23clip)'/%3E%3C/g%3E%3Cg id='fill' opacity='0.9' fill='%23fff'%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/g%3E%3C/svg%3E\");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.mapboxgl-ctrl-logo.mapboxgl-compact{width:23px}@media (-ms-high-contrast:active){a.mapboxgl-ctrl-logo{background-color:transparent;background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd' viewBox='0 0 88 23'%3E%3Cdefs%3E%3Cpath id='logo' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 013.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='text' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 00-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 004.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 01-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 01.3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 01-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='clip'%3E%3Crect x='0' y='0' width='100%25' height='100%25' fill='white'/%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/mask%3E%3Cg id='outline' opacity='1' stroke='%23000' stroke-width='3'%3E%3Ccircle mask='url(%23clip)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23text' mask='url(%23clip)'/%3E%3C/g%3E%3Cg id='fill' opacity='1' fill='%23fff'%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/g%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){a.mapboxgl-ctrl-logo{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd' viewBox='0 0 88 23'%3E%3Cdefs%3E%3Cpath id='logo' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 013.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='text' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 00-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 004.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 01-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 01.3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 01-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='clip'%3E%3Crect x='0' y='0' width='100%25' height='100%25' fill='white'/%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/mask%3E%3Cg id='outline' opacity='1' stroke='%23fff' stroke-width='3' fill='%23fff'%3E%3Ccircle mask='url(%23clip)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23text' mask='url(%23clip)'/%3E%3C/g%3E%3Cg id='fill' opacity='1' fill='%23000'%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/g%3E%3C/svg%3E\")}}.mapboxgl-ctrl.mapboxgl-ctrl-attrib{background-color:hsla(0,0%,100%,.5);margin:0;padding:0 5px}@media screen{.mapboxgl-ctrl-attrib.mapboxgl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.mapboxgl-ctrl-attrib.mapboxgl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.mapboxgl-ctrl-bottom-left>.mapboxgl-ctrl-attrib.mapboxgl-compact-show,.mapboxgl-ctrl-left>.mapboxgl-ctrl-attrib.mapboxgl-compact-show,.mapboxgl-ctrl-top-left>.mapboxgl-ctrl-attrib.mapboxgl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.mapboxgl-ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-inner{display:none}.mapboxgl-ctrl-attrib-button{background-color:hsla(0,0%,100%,.5);background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl-attrib-button,.mapboxgl-ctrl-left .mapboxgl-ctrl-attrib-button,.mapboxgl-ctrl-top-left .mapboxgl-ctrl-attrib-button{left:0}.mapboxgl-ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-button,.mapboxgl-ctrl-attrib.mapboxgl-compact-show .mapboxgl-ctrl-attrib-inner{display:block}.mapboxgl-ctrl-attrib.mapboxgl-compact-show .mapboxgl-ctrl-attrib-button{background-color:rgb(0 0 0/5%)}.mapboxgl-ctrl-bottom-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{bottom:0;right:0}.mapboxgl-ctrl-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{right:0}.mapboxgl-ctrl-top-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{right:0;top:0}.mapboxgl-ctrl-top-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{left:0;top:0}.mapboxgl-ctrl-bottom-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{bottom:0;left:0}.mapboxgl-ctrl-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{left:0}}@media screen and (-ms-high-contrast:active){.mapboxgl-ctrl-attrib.mapboxgl-compact:after{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd' fill='%23fff'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\")}}@media screen and (-ms-high-contrast:black-on-white){.mapboxgl-ctrl-attrib.mapboxgl-compact:after{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\")}}.mapboxgl-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.mapboxgl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.mapboxgl-ctrl-attrib .mapbox-improve-map{font-weight:700;margin-left:2px}.mapboxgl-attrib-empty{display:none}.mapboxgl-ctrl-scale{background-color:hsla(0,0%,100%,.75);border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px;white-space:nowrap}.mapboxgl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.mapboxgl-popup-anchor-top,.mapboxgl-popup-anchor-top-left,.mapboxgl-popup-anchor-top-right{flex-direction:column}.mapboxgl-popup-anchor-bottom,.mapboxgl-popup-anchor-bottom-left,.mapboxgl-popup-anchor-bottom-right{flex-direction:column-reverse}.mapboxgl-popup-anchor-left{flex-direction:row}.mapboxgl-popup-anchor-right{flex-direction:row-reverse}.mapboxgl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.mapboxgl-popup-anchor-top .mapboxgl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.mapboxgl-popup-anchor-top-left .mapboxgl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.mapboxgl-popup-anchor-top-right .mapboxgl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.mapboxgl-popup-anchor-left .mapboxgl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.mapboxgl-popup-anchor-right .mapboxgl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.mapboxgl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.mapboxgl-popup-close-button:hover{background-color:rgb(0 0 0/5%)}.mapboxgl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:10px 10px 15px;pointer-events:auto;position:relative}.mapboxgl-popup-anchor-top-left .mapboxgl-popup-content{border-top-left-radius:0}.mapboxgl-popup-anchor-top-right .mapboxgl-popup-content{border-top-right-radius:0}.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-content{border-bottom-left-radius:0}.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-content{border-bottom-right-radius:0}.mapboxgl-popup-track-pointer{display:none}.mapboxgl-popup-track-pointer *{pointer-events:none;user-select:none}.mapboxgl-map:hover .mapboxgl-popup-track-pointer{display:flex}.mapboxgl-map:active .mapboxgl-popup-track-pointer{display:none}.mapboxgl-marker{left:0;opacity:1;position:absolute;top:0;transition:opacity .2s;will-change:transform}.mapboxgl-user-location-dot,.mapboxgl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.mapboxgl-user-location-dot:before{animation:mapboxgl-user-location-dot-pulse 2s infinite;content:\"\";position:absolute}.mapboxgl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px rgba(0,0,0,.35);box-sizing:border-box;content:\"\";height:19px;left:-2px;position:absolute;top:-2px;width:19px}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading{height:0;width:0}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:after,.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:before{border-bottom:7.5px solid #4aa1eb;content:\"\";position:absolute}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:before{border-left:7.5px solid transparent;transform:translateY(-28px) skewY(-20deg)}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:after{border-right:7.5px solid transparent;transform:translate(7.5px,-28px) skewY(20deg)}@keyframes mapboxgl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.mapboxgl-user-location-dot-stale{background-color:#aaa}.mapboxgl-user-location-dot-stale:after{display:none}.mapboxgl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.mapboxgl-crosshair,.mapboxgl-crosshair .mapboxgl-interactive,.mapboxgl-crosshair .mapboxgl-interactive:active{cursor:crosshair}.mapboxgl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}@media print{.mapbox-improve-map{display:none}}.mapboxgl-scroll-zoom-blocker,.mapboxgl-touch-pan-blocker{align-items:center;background:rgba(0,0,0,.7);color:#fff;display:flex;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif;height:100%;justify-content:center;left:0;opacity:0;pointer-events:none;position:absolute;text-align:center;top:0;transition:opacity .75s ease-in-out;transition-delay:1s;width:100%}.mapboxgl-scroll-zoom-blocker-show,.mapboxgl-touch-pan-blocker-show{opacity:1;transition:opacity .1s ease-in-out}.mapboxgl-canvas-container.mapboxgl-touch-pan-blocker-override.mapboxgl-scrollable-page,.mapboxgl-canvas-container.mapboxgl-touch-pan-blocker-override.mapboxgl-scrollable-page .mapboxgl-canvas{touch-action:pan-x pan-y}");R("body{\r\n padding: 0;\r\n margin: 0;\r\n}\r\n\r\n.map__wrapper{\r\n width: 100%;\r\n height: 100vh;\r\n display: grid;\r\n grid-template-columns: 1fr;\r\n}\r\n\r\n.map__wrapper > div {\r\n position: relative;\r\n grid-row-start: 1;\r\n grid-column-start: 1;\r\n}\r\n\r\n.map__wrapper > div.map__views {\r\n position: relative;\r\n width: fit-content;\r\n height: fit-content;\r\n margin-left: auto;\r\n right: 20px;\r\n top: 15px;\r\n}\r\n\r\n.map__wrapper .cat__legend{\r\n top: 15px;\r\n margin-left: calc( calc( 100% - 250px)/2);\r\n}\r\n\r\n.map__wrapper div.mapboxgl-ctrl-attrib-inner{\r\n display:none;\r\n}\r\n\r\n.map__wrapper div.mapboxgl-ctrl-bottom-left{\r\n display:none;\r\n}\r\n");var z,D={exports:{}};var k=(z||(z=1,D.exports=function(){var e,t,r;function i(i,n){if(e)if(t){var o="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+e+")(sharedChunk); ("+t+")(sharedChunk); self.onerror = null;",s={};e(s),r=n(s),"undefined"!=typeof window&&window&&window.URL&&window.URL.createObjectURL&&(r.workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"})))}else t=n;else e=n}i(["exports"],(function(e){function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r,i={},n={};function o(){if(r)return n;r=1,Object.defineProperty(n,"__esModule",{value:!0}),n.setMatrixArrayType=function(e){n.ARRAY_TYPE=t=e},n.toRadian=function(e){return e*o},n.equals=function(t,r){return Math.abs(t-r)<=e*Math.max(1,Math.abs(t),Math.abs(r))},n.RANDOM=n.ARRAY_TYPE=n.EPSILON=void 0;var e=1e-6;n.EPSILON=e;var t="undefined"!=typeof Float32Array?Float32Array:Array;n.ARRAY_TYPE=t;var i=Math.random;n.RANDOM=i;var o=Math.PI/180;return Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)}),n}var s,a={};function l(){if(s)return a;function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}s=1,Object.defineProperty(a,"__esModule",{value:!0}),a.create=function(){var e=new t.ARRAY_TYPE(4);return t.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e},a.clone=function(e){var r=new t.ARRAY_TYPE(4);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r},a.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},a.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e},a.fromValues=function(e,r,i,n){var o=new t.ARRAY_TYPE(4);return o[0]=e,o[1]=r,o[2]=i,o[3]=n,o},a.set=function(e,t,r,i,n){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e},a.transpose=function(e,t){if(e===t){var r=t[1];e[1]=t[2],e[2]=r}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e},a.invert=function(e,t){var r=t[0],i=t[1],n=t[2],o=t[3],s=r*o-n*i;return s?(e[0]=o*(s=1/s),e[1]=-i*s,e[2]=-n*s,e[3]=r*s,e):null},a.adjoint=function(e,t){var r=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=r,e},a.determinant=function(e){return e[0]*e[3]-e[2]*e[1]},a.multiply=i,a.rotate=function(e,t,r){var i=t[0],n=t[1],o=t[2],s=t[3],a=Math.sin(r),l=Math.cos(r);return e[0]=i*l+o*a,e[1]=n*l+s*a,e[2]=i*-a+o*l,e[3]=n*-a+s*l,e},a.scale=function(e,t,r){var i=t[1],n=t[2],o=t[3],s=r[0],a=r[1];return e[0]=t[0]*s,e[1]=i*s,e[2]=n*a,e[3]=o*a,e},a.fromRotation=function(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=-r,e[3]=i,e},a.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e},a.str=function(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},a.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3])},a.LDU=function(e,t,r,i){return e[2]=i[2]/i[0],r[0]=i[0],r[1]=i[1],r[3]=i[3]-e[2]*r[1],[e,t,r]},a.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e},a.subtract=n,a.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},a.equals=function(e,r){var i=e[0],n=e[1],o=e[2],s=e[3],a=r[0],l=r[1],c=r[2],u=r[3];return Math.abs(i-a)<=t.EPSILON*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(n-l)<=t.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(o-c)<=t.EPSILON*Math.max(1,Math.abs(o),Math.abs(c))&&Math.abs(s-u)<=t.EPSILON*Math.max(1,Math.abs(s),Math.abs(u))},a.multiplyScalar=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e},a.multiplyScalarAndAdd=function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e},a.sub=a.mul=void 0;var t=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==e(t)&&"function"!=typeof t)return{default:t};var i=r(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=o?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s]}return n.default=t,i&&i.set(t,n),n}(o());function r(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,i=new WeakMap;return(r=function(e){return e?i:t})(e)}function i(e,t,r){var i=t[0],n=t[1],o=t[2],s=t[3],a=r[0],l=r[1],c=r[2],u=r[3];return e[0]=i*a+o*l,e[1]=n*a+s*l,e[2]=i*c+o*u,e[3]=n*c+s*u,e}function n(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e}return a.mul=i,a.sub=n,a}var c,u={};function h(){if(c)return u;function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}c=1,Object.defineProperty(u,"__esModule",{value:!0}),u.create=function(){var e=new t.ARRAY_TYPE(6);return t.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[4]=0,e[5]=0),e[0]=1,e[3]=1,e},u.clone=function(e){var r=new t.ARRAY_TYPE(6);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r},u.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},u.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e},u.fromValues=function(e,r,i,n,o,s){var a=new t.ARRAY_TYPE(6);return a[0]=e,a[1]=r,a[2]=i,a[3]=n,a[4]=o,a[5]=s,a},u.set=function(e,t,r,i,n,o,s){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e[4]=o,e[5]=s,e},u.invert=function(e,t){var r=t[0],i=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=r*o-i*n;return l?(e[0]=o*(l=1/l),e[1]=-i*l,e[2]=-n*l,e[3]=r*l,e[4]=(n*a-o*s)*l,e[5]=(i*s-r*a)*l,e):null},u.determinant=function(e){return e[0]*e[3]-e[1]*e[2]},u.multiply=i,u.rotate=function(e,t,r){var i=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=Math.sin(r),u=Math.cos(r);return e[0]=i*u+o*c,e[1]=n*u+s*c,e[2]=i*-c+o*u,e[3]=n*-c+s*u,e[4]=a,e[5]=l,e},u.scale=function(e,t,r){var i=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=r[0],c=r[1];return e[0]=t[0]*l,e[1]=i*l,e[2]=n*c,e[3]=o*c,e[4]=s,e[5]=a,e},u.translate=function(e,t,r){var i=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=r[0],u=r[1];return e[0]=i,e[1]=n,e[2]=o,e[3]=s,e[4]=i*c+o*u+a,e[5]=n*c+s*u+l,e},u.fromRotation=function(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=-r,e[3]=i,e[4]=0,e[5]=0,e},u.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e[4]=0,e[5]=0,e},u.fromTranslation=function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=t[0],e[5]=t[1],e},u.str=function(e){return"mat2d("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+")"},u.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],1)},u.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e},u.subtract=n,u.multiplyScalar=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e},u.multiplyScalarAndAdd=function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e[4]=t[4]+r[4]*i,e[5]=t[5]+r[5]*i,e},u.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]},u.equals=function(e,r){var i=e[0],n=e[1],o=e[2],s=e[3],a=e[4],l=e[5],c=r[0],u=r[1],h=r[2],d=r[3],p=r[4],f=r[5];return Math.abs(i-c)<=t.EPSILON*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(n-u)<=t.EPSILON*Math.max(1,Math.abs(n),Math.abs(u))&&Math.abs(o-h)<=t.EPSILON*Math.max(1,Math.abs(o),Math.abs(h))&&Math.abs(s-d)<=t.EPSILON*Math.max(1,Math.abs(s),Math.abs(d))&&Math.abs(a-p)<=t.EPSILON*Math.max(1,Math.abs(a),Math.abs(p))&&Math.abs(l-f)<=t.EPSILON*Math.max(1,Math.abs(l),Math.abs(f))},u.sub=u.mul=void 0;var t=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==e(t)&&"function"!=typeof t)return{default:t};var i=r(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=o?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s]}return n.default=t,i&&i.set(t,n),n}(o());function r(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,i=new WeakMap;return(r=function(e){return e?i:t})(e)}function i(e,t,r){var i=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=r[0],u=r[1],h=r[2],d=r[3],p=r[4],f=r[5];return e[0]=i*c+o*u,e[1]=n*c+s*u,e[2]=i*h+o*d,e[3]=n*h+s*d,e[4]=i*p+o*f+a,e[5]=n*p+s*f+l,e}function n(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e}return u.mul=i,u.sub=n,u}var d,p={};function f(){if(d)return p;function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}d=1,Object.defineProperty(p,"__esModule",{value:!0}),p.create=function(){var e=new t.ARRAY_TYPE(9);return t.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e},p.fromMat4=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e},p.clone=function(e){var r=new t.ARRAY_TYPE(9);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r},p.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},p.fromValues=function(e,r,i,n,o,s,a,l,c){var u=new t.ARRAY_TYPE(9);return u[0]=e,u[1]=r,u[2]=i,u[3]=n,u[4]=o,u[5]=s,u[6]=a,u[7]=l,u[8]=c,u},p.set=function(e,t,r,i,n,o,s,a,l,c){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e[4]=o,e[5]=s,e[6]=a,e[7]=l,e[8]=c,e},p.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},p.transpose=function(e,t){if(e===t){var r=t[1],i=t[2],n=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=i,e[7]=n}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e},p.invert=function(e,t){var r=t[0],i=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=u*s-a*c,d=-u*o+a*l,p=c*o-s*l,f=r*h+i*d+n*p;return f?(e[0]=h*(f=1/f),e[1]=(-u*i+n*c)*f,e[2]=(a*i-n*s)*f,e[3]=d*f,e[4]=(u*r-n*l)*f,e[5]=(-a*r+n*o)*f,e[6]=p*f,e[7]=(-c*r+i*l)*f,e[8]=(s*r-i*o)*f,e):null},p.adjoint=function(e,t){var r=t[0],i=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8];return e[0]=s*u-a*c,e[1]=n*c-i*u,e[2]=i*a-n*s,e[3]=a*l-o*u,e[4]=r*u-n*l,e[5]=n*o-r*a,e[6]=o*c-s*l,e[7]=i*l-r*c,e[8]=r*s-i*o,e},p.determinant=function(e){var t=e[3],r=e[4],i=e[5],n=e[6],o=e[7],s=e[8];return e[0]*(s*r-i*o)+e[1]*(-s*t+i*n)+e[2]*(o*t-r*n)},p.multiply=i,p.translate=function(e,t,r){var i=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=r[0],p=r[1];return e[0]=i,e[1]=n,e[2]=o,e[3]=s,e[4]=a,e[5]=l,e[6]=d*i+p*s+c,e[7]=d*n+p*a+u,e[8]=d*o+p*l+h,e},p.rotate=function(e,t,r){var i=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=Math.sin(r),p=Math.cos(r);return e[0]=p*i+d*s,e[1]=p*n+d*a,e[2]=p*o+d*l,e[3]=p*s-d*i,e[4]=p*a-d*n,e[5]=p*l-d*o,e[6]=c,e[7]=u,e[8]=h,e},p.scale=function(e,t,r){var i=r[0],n=r[1];return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=n*t[3],e[4]=n*t[4],e[5]=n*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},p.fromTranslation=function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e},p.fromRotation=function(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=0,e[3]=-r,e[4]=i,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},p.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},p.fromMat2d=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e},p.fromQuat=function(e,t){var r=t[0],i=t[1],n=t[2],o=t[3],s=r+r,a=i+i,l=n+n,c=r*s,u=i*s,h=i*a,d=n*s,p=n*a,f=n*l,m=o*s,_=o*a,g=o*l;return e[0]=1-h-f,e[3]=u-g,e[6]=d+_,e[1]=u+g,e[4]=1-c-f,e[7]=p-m,e[2]=d-_,e[5]=p+m,e[8]=1-c-h,e},p.normalFromMat4=function(e,t){var r=t[0],i=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],p=t[11],f=t[12],m=t[13],_=t[14],g=t[15],y=r*a-i*s,x=r*l-n*s,v=r*c-o*s,b=i*l-n*a,w=i*c-o*a,T=n*c-o*l,S=u*m-h*f,E=u*_-d*f,M=u*g-p*f,A=h*_-d*m,C=h*g-p*m,I=d*g-p*_,P=y*I-x*C+v*A+b*M-w*E+T*S;return P?(e[0]=(a*I-l*C+c*A)*(P=1/P),e[1]=(l*M-s*I-c*E)*P,e[2]=(s*C-a*M+c*S)*P,e[3]=(n*C-i*I-o*A)*P,e[4]=(r*I-n*M+o*E)*P,e[5]=(i*M-r*C-o*S)*P,e[6]=(m*T-_*w+g*b)*P,e[7]=(_*v-f*T-g*x)*P,e[8]=(f*w-m*v+g*y)*P,e):null},p.projection=function(e,t,r){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/r,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e},p.str=function(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"},p.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},p.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e},p.subtract=n,p.multiplyScalar=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e},p.multiplyScalarAndAdd=function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e[4]=t[4]+r[4]*i,e[5]=t[5]+r[5]*i,e[6]=t[6]+r[6]*i,e[7]=t[7]+r[7]*i,e[8]=t[8]+r[8]*i,e},p.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},p.equals=function(e,r){var i=e[0],n=e[1],o=e[2],s=e[3],a=e[4],l=e[5],c=e[6],u=e[7],h=e[8],d=r[0],p=r[1],f=r[2],m=r[3],_=r[4],g=r[5],y=r[6],x=r[7],v=r[8];return Math.abs(i-d)<=t.EPSILON*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(n-p)<=t.EPSILON*Math.max(1,Math.abs(n),Math.abs(p))&&Math.abs(o-f)<=t.EPSILON*Math.max(1,Math.abs(o),Math.abs(f))&&Math.abs(s-m)<=t.EPSILON*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(a-_)<=t.EPSILON*Math.max(1,Math.abs(a),Math.abs(_))&&Math.abs(l-g)<=t.EPSILON*Math.max(1,Math.abs(l),Math.abs(g))&&Math.abs(c-y)<=t.EPSILON*Math.max(1,Math.abs(c),Math.abs(y))&&Math.abs(u-x)<=t.EPSILON*Math.max(1,Math.abs(u),Math.abs(x))&&Math.abs(h-v)<=t.EPSILON*Math.max(1,Math.abs(h),Math.abs(v))},p.sub=p.mul=void 0;var t=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==e(t)&&"function"!=typeof t)return{default:t};var i=r(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=o?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s]}return n.default=t,i&&i.set(t,n),n}(o());function r(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,i=new WeakMap;return(r=function(e){return e?i:t})(e)}function i(e,t,r){var i=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=r[0],p=r[1],f=r[2],m=r[3],_=r[4],g=r[5],y=r[6],x=r[7],v=r[8];return e[0]=d*i+p*s+f*c,e[1]=d*n+p*a+f*u,e[2]=d*o+p*l+f*h,e[3]=m*i+_*s+g*c,e[4]=m*n+_*a+g*u,e[5]=m*o+_*l+g*h,e[6]=y*i+x*s+v*c,e[7]=y*n+x*a+v*u,e[8]=y*o+x*l+v*h,e}function n(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e}return p.mul=i,p.sub=n,p}var m,_={};function g(){if(m)return _;function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}m=1,Object.defineProperty(_,"__esModule",{value:!0}),_.create=function(){var e=new t.ARRAY_TYPE(16);return t.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},_.clone=function(e){var r=new t.ARRAY_TYPE(16);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},_.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},_.fromValues=function(e,r,i,n,o,s,a,l,c,u,h,d,p,f,m,_){var g=new t.ARRAY_TYPE(16);return g[0]=e,g[1]=r,g[2]=i,g[3]=n,g[4]=o,g[5]=s,g[6]=a,g[7]=l,g[8]=c,g[9]=u,g[10]=h,g[11]=d,g[12]=p,g[13]=f,g[14]=m,g[15]=_,g},_.set=function(e,t,r,i,n,o,s,a,l,c,u,h,d,p,f,m,_){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e[4]=o,e[5]=s,e[6]=a,e[7]=l,e[8]=c,e[9]=u,e[10]=h,e[11]=d,e[12]=p,e[13]=f,e[14]=m,e[15]=_,e},_.identity=i,_.transpose=function(e,t){if(e===t){var r=t[1],i=t[2],n=t[3],o=t[6],s=t[7],a=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=i,e[9]=o,e[11]=t[14],e[12]=n,e[13]=s,e[14]=a}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e},_.invert=function(e,t){var r=t[0],i=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],p=t[11],f=t[12],m=t[13],_=t[14],g=t[15],y=r*a-i*s,x=r*l-n*s,v=r*c-o*s,b=i*l-n*a,w=i*c-o*a,T=n*c-o*l,S=u*m-h*f,E=u*_-d*f,M=u*g-p*f,A=h*_-d*m,C=h*g-p*m,I=d*g-p*_,P=y*I-x*C+v*A+b*M-w*E+T*S;return P?(e[0]=(a*I-l*C+c*A)*(P=1/P),e[1]=(n*C-i*I-o*A)*P,e[2]=(m*T-_*w+g*b)*P,e[3]=(d*w-h*T-p*b)*P,e[4]=(l*M-s*I-c*E)*P,e[5]=(r*I-n*M+o*E)*P,e[6]=(_*v-f*T-g*x)*P,e[7]=(u*T-d*v+p*x)*P,e[8]=(s*C-a*M+c*S)*P,e[9]=(i*M-r*C-o*S)*P,e[10]=(f*w-m*v+g*y)*P,e[11]=(h*v-u*w-p*y)*P,e[12]=(a*E-s*A-l*S)*P,e[13]=(r*A-i*E+n*S)*P,e[14]=(m*x-f*b-_*y)*P,e[15]=(u*b-h*x+d*y)*P,e):null},_.adjoint=function(e,t){var r=t[0],i=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],p=t[11],f=t[12],m=t[13],_=t[14],g=t[15];return e[0]=a*(d*g-p*_)-h*(l*g-c*_)+m*(l*p-c*d),e[1]=-(i*(d*g-p*_)-h*(n*g-o*_)+m*(n*p-o*d)),e[2]=i*(l*g-c*_)-a*(n*g-o*_)+m*(n*c-o*l),e[3]=-(i*(l*p-c*d)-a*(n*p-o*d)+h*(n*c-o*l)),e[4]=-(s*(d*g-p*_)-u*(l*g-c*_)+f*(l*p-c*d)),e[5]=r*(d*g-p*_)-u*(n*g-o*_)+f*(n*p-o*d),e[6]=-(r*(l*g-c*_)-s*(n*g-o*_)+f*(n*c-o*l)),e[7]=r*(l*p-c*d)-s*(n*p-o*d)+u*(n*c-o*l),e[8]=s*(h*g-p*m)-u*(a*g-c*m)+f*(a*p-c*h),e[9]=-(r*(h*g-p*m)-u*(i*g-o*m)+f*(i*p-o*h)),e[10]=r*(a*g-c*m)-s*(i*g-o*m)+f*(i*c-o*a),e[11]=-(r*(a*p-c*h)-s*(i*p-o*h)+u*(i*c-o*a)),e[12]=-(s*(h*_-d*m)-u*(a*_-l*m)+f*(a*d-l*h)),e[13]=r*(h*_-d*m)-u*(i*_-n*m)+f*(i*d-n*h),e[14]=-(r*(a*_-l*m)-s*(i*_-n*m)+f*(i*l-n*a)),e[15]=r*(a*d-l*h)-s*(i*d-n*h)+u*(i*l-n*a),e},_.determinant=function(e){var t=e[0],r=e[1],i=e[2],n=e[3],o=e[4],s=e[5],a=e[6],l=e[7],c=e[8],u=e[9],h=e[10],d=e[11],p=e[12],f=e[13],m=e[14],_=e[15];return(t*s-r*o)*(h*_-d*m)-(t*a-i*o)*(u*_-d*f)+(t*l-n*o)*(u*m-h*f)+(r*a-i*s)*(c*_-d*p)-(r*l-n*s)*(c*m-h*p)+(i*l-n*a)*(c*f-u*p)},_.multiply=n,_.translate=function(e,t,r){var i,n,o,s,a,l,c,u,h,d,p,f,m=r[0],_=r[1],g=r[2];return t===e?(e[12]=t[0]*m+t[4]*_+t[8]*g+t[12],e[13]=t[1]*m+t[5]*_+t[9]*g+t[13],e[14]=t[2]*m+t[6]*_+t[10]*g+t[14],e[15]=t[3]*m+t[7]*_+t[11]*g+t[15]):(n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],e[0]=i=t[0],e[1]=n,e[2]=o,e[3]=s,e[4]=a,e[5]=l,e[6]=c,e[7]=u,e[8]=h,e[9]=d,e[10]=p,e[11]=f,e[12]=i*m+a*_+h*g+t[12],e[13]=n*m+l*_+d*g+t[13],e[14]=o*m+c*_+p*g+t[14],e[15]=s*m+u*_+f*g+t[15]),e},_.scale=function(e,t,r){var i=r[0],n=r[1],o=r[2];return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},_.rotate=function(e,r,i,n){var o,s,a,l,c,u,h,d,p,f,m,_,g,y,x,v,b,w,T,S,E,M,A,C,I=n[0],P=n[1],R=n[2],z=Math.hypot(I,P,R);return z<t.EPSILON?null:(I*=z=1/z,P*=z,R*=z,o=Math.sin(i),s=Math.cos(i),c=r[1],u=r[2],h=r[3],p=r[5],f=r[6],m=r[7],g=r[9],y=r[10],x=r[11],v=I*I*(a=1-s)+s,T=I*P*a-R*o,S=P*P*a+s,E=R*P*a+I*o,M=I*R*a+P*o,A=P*R*a-I*o,C=R*R*a+s,e[0]=(l=r[0])*v+(d=r[4])*(b=P*I*a+R*o)+(_=r[8])*(w=R*I*a-P*o),e[1]=c*v+p*b+g*w,e[2]=u*v+f*b+y*w,e[3]=h*v+m*b+x*w,e[4]=l*T+d*S+_*E,e[5]=c*T+p*S+g*E,e[6]=u*T+f*S+y*E,e[7]=h*T+m*S+x*E,e[8]=l*M+d*A+_*C,e[9]=c*M+p*A+g*C,e[10]=u*M+f*A+y*C,e[11]=h*M+m*A+x*C,r!==e&&(e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e)},_.rotateX=function(e,t,r){var i=Math.sin(r),n=Math.cos(r),o=t[4],s=t[5],a=t[6],l=t[7],c=t[8],u=t[9],h=t[10],d=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*n+c*i,e[5]=s*n+u*i,e[6]=a*n+h*i,e[7]=l*n+d*i,e[8]=c*n-o*i,e[9]=u*n-s*i,e[10]=h*n-a*i,e[11]=d*n-l*i,e},_.rotateY=function(e,t,r){var i=Math.sin(r),n=Math.cos(r),o=t[0],s=t[1],a=t[2],l=t[3],c=t[8],u=t[9],h=t[10],d=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*n-c*i,e[1]=s*n-u*i,e[2]=a*n-h*i,e[3]=l*n-d*i,e[8]=o*i+c*n,e[9]=s*i+u*n,e[10]=a*i+h*n,e[11]=l*i+d*n,e},_.rotateZ=function(e,t,r){var i=Math.sin(r),n=Math.cos(r),o=t[0],s=t[1],a=t[2],l=t[3],c=t[4],u=t[5],h=t[6],d=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*n+c*i,e[1]=s*n+u*i,e[2]=a*n+h*i,e[3]=l*n+d*i,e[4]=c*n-o*i,e[5]=u*n-s*i,e[6]=h*n-a*i,e[7]=d*n-l*i,e},_.fromTranslation=function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e},_.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},_.fromRotation=function(e,r,i){var n,o,s,a=i[0],l=i[1],c=i[2],u=Math.hypot(a,l,c);return u<t.EPSILON?null:(a*=u=1/u,l*=u,c*=u,n=Math.sin(r),o=Math.cos(r),e[0]=a*a*(s=1-o)+o,e[1]=l*a*s+c*n,e[2]=c*a*s-l*n,e[3]=0,e[4]=a*l*s-c*n,e[5]=l*l*s+o,e[6]=c*l*s+a*n,e[7]=0,e[8]=a*c*s+l*n,e[9]=l*c*s-a*n,e[10]=c*c*s+o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)},_.fromXRotation=function(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=r,e[7]=0,e[8]=0,e[9]=-r,e[10]=i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},_.fromYRotation=function(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=0,e[2]=-r,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=r,e[9]=0,e[10]=i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},_.fromZRotation=function(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=0,e[3]=0,e[4]=-r,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},_.fromRotationTranslation=s,_.fromQuat2=function(e,r){var i=new t.ARRAY_TYPE(3),n=-r[0],o=-r[1],a=-r[2],l=r[3],c=r[4],u=r[5],h=r[6],d=r[7],p=n*n+o*o+a*a+l*l;return p>0?(i[0]=2*(c*l+d*n+u*a-h*o)/p,i[1]=2*(u*l+d*o+h*n-c*a)/p,i[2]=2*(h*l+d*a+c*o-u*n)/p):(i[0]=2*(c*l+d*n+u*a-h*o),i[1]=2*(u*l+d*o+h*n-c*a),i[2]=2*(h*l+d*a+c*o-u*n)),s(e,r,i),e},_.getTranslation=function(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e},_.getScaling=a,_.getRotation=function(e,r){var i=new t.ARRAY_TYPE(3);a(i,r);var n=1/i[0],o=1/i[1],s=1/i[2],l=r[0]*n,c=r[1]*o,u=r[2]*s,h=r[4]*n,d=r[5]*o,p=r[6]*s,f=r[8]*n,m=r[9]*o,_=r[10]*s,g=l+d+_,y=0;return g>0?(y=2*Math.sqrt(g+1),e[3]=.25*y,e[0]=(p-m)/y,e[1]=(f-u)/y,e[2]=(c-h)/y):l>d&&l>_?(y=2*Math.sqrt(1+l-d-_),e[3]=(p-m)/y,e[0]=.25*y,e[1]=(c+h)/y,e[2]=(f+u)/y):d>_?(y=2*Math.sqrt(1+d-l-_),e[3]=(f-u)/y,e[0]=(c+h)/y,e[1]=.25*y,e[2]=(p+m)/y):(y=2*Math.sqrt(1+_-l-d),e[3]=(c-h)/y,e[0]=(f+u)/y,e[1]=(p+m)/y,e[2]=.25*y),e},_.fromRotationTranslationScale=function(e,t,r,i){var n=t[0],o=t[1],s=t[2],a=t[3],l=n+n,c=o+o,u=s+s,h=n*l,d=n*c,p=n*u,f=o*c,m=o*u,_=s*u,g=a*l,y=a*c,x=a*u,v=i[0],b=i[1],w=i[2];return e[0]=(1-(f+_))*v,e[1]=(d+x)*v,e[2]=(p-y)*v,e[3]=0,e[4]=(d-x)*b,e[5]=(1-(h+_))*b,e[6]=(m+g)*b,e[7]=0,e[8]=(p+y)*w,e[9]=(m-g)*w,e[10]=(1-(h+f))*w,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e},_.fromRotationTranslationScaleOrigin=function(e,t,r,i,n){var o=t[0],s=t[1],a=t[2],l=t[3],c=o+o,u=s+s,h=a+a,d=o*c,p=o*u,f=o*h,m=s*u,_=s*h,g=a*h,y=l*c,x=l*u,v=l*h,b=i[0],w=i[1],T=i[2],S=n[0],E=n[1],M=n[2],A=(1-(m+g))*b,C=(p+v)*b,I=(f-x)*b,P=(p-v)*w,R=(1-(d+g))*w,z=(_+y)*w,D=(f+x)*T,k=(_-y)*T,O=(1-(d+m))*T;return e[0]=A,e[1]=C,e[2]=I,e[3]=0,e[4]=P,e[5]=R,e[6]=z,e[7]=0,e[8]=D,e[9]=k,e[10]=O,e[11]=0,e[12]=r[0]+S-(A*S+P*E+D*M),e[13]=r[1]+E-(C*S+R*E+k*M),e[14]=r[2]+M-(I*S+z*E+O*M),e[15]=1,e},_.fromQuat=function(e,t){var r=t[0],i=t[1],n=t[2],o=t[3],s=r+r,a=i+i,l=n+n,c=r*s,u=i*s,h=i*a,d=n*s,p=n*a,f=n*l,m=o*s,_=o*a,g=o*l;return e[0]=1-h-f,e[1]=u+g,e[2]=d-_,e[3]=0,e[4]=u-g,e[5]=1-c-f,e[6]=p+m,e[7]=0,e[8]=d+_,e[9]=p-m,e[10]=1-c-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},_.frustum=function(e,t,r,i,n,o,s){var a=1/(r-t),l=1/(n-i),c=1/(o-s);return e[0]=2*o*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*o*l,e[6]=0,e[7]=0,e[8]=(r+t)*a,e[9]=(n+i)*l,e[10]=(s+o)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=s*o*2*c,e[15]=0,e},_.perspectiveNO=l,_.perspectiveZO=function(e,t,r,i,n){var o,s=1/Math.tan(t/2);return e[0]=s/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0?(e[10]=n*(o=1/(i-n)),e[14]=n*i*o):(e[10]=-1,e[14]=-i),e},_.perspectiveFromFieldOfView=function(e,t,r,i){var n=Math.tan(t.upDegrees*Math.PI/180),o=Math.tan(t.downDegrees*Math.PI/180),s=Math.tan(t.leftDegrees*Math.PI/180),a=Math.tan(t.rightDegrees*Math.PI/180),l=2/(s+a),c=2/(n+o);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=-(s-a)*l*.5,e[9]=(n-o)*c*.5,e[10]=i/(r-i),e[11]=-1,e[12]=0,e[13]=0,e[14]=i*r/(r-i),e[15]=0,e},_.orthoNO=c,_.orthoZO=function(e,t,r,i,n,o,s){var a=1/(t-r),l=1/(i-n),c=1/(o-s);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=c,e[11]=0,e[12]=(t+r)*a,e[13]=(n+i)*l,e[14]=o*c,e[15]=1,e},_.lookAt=function(e,r,n,o){var s,a,l,c,u,h,d,p,f,m,_=r[0],g=r[1],y=r[2],x=o[0],v=o[1],b=o[2],w=n[0],T=n[1],S=n[2];return Math.abs(_-w)<t.EPSILON&&Math.abs(g-T)<t.EPSILON&&Math.abs(y-S)<t.EPSILON?i(e):(d=_-w,p=g-T,f=y-S,s=v*(f*=m=1/Math.hypot(d,p,f))-b*(p*=m),a=b*(d*=m)-x*f,l=x*p-v*d,(m=Math.hypot(s,a,l))?(s*=m=1/m,a*=m,l*=m):(s=0,a=0,l=0),c=p*l-f*a,u=f*s-d*l,h=d*a-p*s,(m=Math.hypot(c,u,h))?(c*=m=1/m,u*=m,h*=m):(c=0,u=0,h=0),e[0]=s,e[1]=c,e[2]=d,e[3]=0,e[4]=a,e[5]=u,e[6]=p,e[7]=0,e[8]=l,e[9]=h,e[10]=f,e[11]=0,e[12]=-(s*_+a*g+l*y),e[13]=-(c*_+u*g+h*y),e[14]=-(d*_+p*g+f*y),e[15]=1,e)},_.targetTo=function(e,t,r,i){var n=t[0],o=t[1],s=t[2],a=i[0],l=i[1],c=i[2],u=n-r[0],h=o-r[1],d=s-r[2],p=u*u+h*h+d*d;p>0&&(u*=p=1/Math.sqrt(p),h*=p,d*=p);var f=l*d-c*h,m=c*u-a*d,_=a*h-l*u;return(p=f*f+m*m+_*_)>0&&(f*=p=1/Math.sqrt(p),m*=p,_*=p),e[0]=f,e[1]=m,e[2]=_,e[3]=0,e[4]=h*_-d*m,e[5]=d*f-u*_,e[6]=u*m-h*f,e[7]=0,e[8]=u,e[9]=h,e[10]=d,e[11]=0,e[12]=n,e[13]=o,e[14]=s,e[15]=1,e},_.str=function(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"},_.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},_.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e[9]=t[9]+r[9],e[10]=t[10]+r[10],e[11]=t[11]+r[11],e[12]=t[12]+r[12],e[13]=t[13]+r[13],e[14]=t[14]+r[14],e[15]=t[15]+r[15],e},_.subtract=u,_.multiplyScalar=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12]*r,e[13]=t[13]*r,e[14]=t[14]*r,e[15]=t[15]*r,e},_.multiplyScalarAndAdd=function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e[4]=t[4]+r[4]*i,e[5]=t[5]+r[5]*i,e[6]=t[6]+r[6]*i,e[7]=t[7]+r[7]*i,e[8]=t[8]+r[8]*i,e[9]=t[9]+r[9]*i,e[10]=t[10]+r[10]*i,e[11]=t[11]+r[11]*i,e[12]=t[12]+r[12]*i,e[13]=t[13]+r[13]*i,e[14]=t[14]+r[14]*i,e[15]=t[15]+r[15]*i,e},_.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]},_.equals=function(e,r){var i=e[0],n=e[1],o=e[2],s=e[3],a=e[4],l=e[5],c=e[6],u=e[7],h=e[8],d=e[9],p=e[10],f=e[11],m=e[12],_=e[13],g=e[14],y=e[15],x=r[0],v=r[1],b=r[2],w=r[3],T=r[4],S=r[5],E=r[6],M=r[7],A=r[8],C=r[9],I=r[10],P=r[11],R=r[12],z=r[13],D=r[14],k=r[15];return Math.abs(i-x)<=t.EPSILON*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(n-v)<=t.EPSILON*Math.max(1,Math.abs(n),Math.abs(v))&&Math.abs(o-b)<=t.EPSILON*Math.max(1,Math.abs(o),Math.abs(b))&&Math.abs(s-w)<=t.EPSILON*Math.max(1,Math.abs(s),Math.abs(w))&&Math.abs(a-T)<=t.EPSILON*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(l-S)<=t.EPSILON*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(c-E)<=t.EPSILON*Math.max(1,Math.abs(c),Math.abs(E))&&Math.abs(u-M)<=t.EPSILON*Math.max(1,Math.abs(u),Math.abs(M))&&Math.abs(h-A)<=t.EPSILON*Math.max(1,Math.abs(h),Math.abs(A))&&Math.abs(d-C)<=t.EPSILON*Math.max(1,Math.abs(d),Math.abs(C))&&Math.abs(p-I)<=t.EPSILON*Math.max(1,Math.abs(p),Math.abs(I))&&Math.abs(f-P)<=t.EPSILON*Math.max(1,Math.abs(f),Math.abs(P))&&Math.abs(m-R)<=t.EPSILON*Math.max(1,Math.abs(m),Math.abs(R))&&Math.abs(_-z)<=t.EPSILON*Math.max(1,Math.abs(_),Math.abs(z))&&Math.abs(g-D)<=t.EPSILON*Math.max(1,Math.abs(g),Math.abs(D))&&Math.abs(y-k)<=t.EPSILON*Math.max(1,Math.abs(y),Math.abs(k))},_.sub=_.mul=_.ortho=_.perspective=void 0;var t=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==e(t)&&"function"!=typeof t)return{default:t};var i=r(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=o?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s]}return n.default=t,i&&i.set(t,n),n}(o());function r(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,i=new WeakMap;return(r=function(e){return e?i:t})(e)}function i(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function n(e,t,r){var i=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],m=t[12],_=t[13],g=t[14],y=t[15],x=r[0],v=r[1],b=r[2],w=r[3];return e[0]=x*i+v*a+b*h+w*m,e[1]=x*n+v*l+b*d+w*_,e[2]=x*o+v*c+b*p+w*g,e[3]=x*s+v*u+b*f+w*y,e[4]=(x=r[4])*i+(v=r[5])*a+(b=r[6])*h+(w=r[7])*m,e[5]=x*n+v*l+b*d+w*_,e[6]=x*o+v*c+b*p+w*g,e[7]=x*s+v*u+b*f+w*y,e[8]=(x=r[8])*i+(v=r[9])*a+(b=r[10])*h+(w=r[11])*m,e[9]=x*n+v*l+b*d+w*_,e[10]=x*o+v*c+b*p+w*g,e[11]=x*s+v*u+b*f+w*y,e[12]=(x=r[12])*i+(v=r[13])*a+(b=r[14])*h+(w=r[15])*m,e[13]=x*n+v*l+b*d+w*_,e[14]=x*o+v*c+b*p+w*g,e[15]=x*s+v*u+b*f+w*y,e}function s(e,t,r){var i=t[0],n=t[1],o=t[2],s=t[3],a=i+i,l=n+n,c=o+o,u=i*a,h=i*l,d=i*c,p=n*l,f=n*c,m=o*c,_=s*a,g=s*l,y=s*c;return e[0]=1-(p+m),e[1]=h+y,e[2]=d-g,e[3]=0,e[4]=h-y,e[5]=1-(u+m),e[6]=f+_,e[7]=0,e[8]=d+g,e[9]=f-_,e[10]=1-(u+p),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function a(e,t){var r=t[4],i=t[5],n=t[6],o=t[8],s=t[9],a=t[10];return e[0]=Math.hypot(t[0],t[1],t[2]),e[1]=Math.hypot(r,i,n),e[2]=Math.hypot(o,s,a),e}function l(e,t,r,i,n){var o,s=1/Math.tan(t/2);return e[0]=s/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0?(e[10]=(n+i)*(o=1/(i-n)),e[14]=2*n*i*o):(e[10]=-1,e[14]=-2*i),e}function c(e,t,r,i,n,o,s){var a=1/(t-r),l=1/(i-n),c=1/(o-s);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+r)*a,e[13]=(n+i)*l,e[14]=(s+o)*c,e[15]=1,e}function u(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e[9]=t[9]-r[9],e[10]=t[10]-r[10],e[11]=t[11]-r[11],e[12]=t[12]-r[12],e[13]=t[13]-r[13],e[14]=t[14]-r[14],e[15]=t[15]-r[15],e}return _.perspective=l,_.ortho=c,_.mul=n,_.sub=u,_}var y,x={},v={};function b(){if(y)return v;function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}y=1,Object.defineProperty(v,"__esModule",{value:!0}),v.create=i,v.clone=function(e){var r=new t.ARRAY_TYPE(3);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r},v.length=n,v.fromValues=function(e,r,i){var n=new t.ARRAY_TYPE(3);return n[0]=e,n[1]=r,n[2]=i,n},v.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},v.set=function(e,t,r,i){return e[0]=t,e[1]=r,e[2]=i,e},v.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e},v.subtract=s,v.multiply=a,v.divide=l,v.ceil=function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e},v.floor=function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e},v.min=function(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e},v.max=function(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e},v.round=function(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e},v.scale=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e},v.scaleAndAdd=function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e},v.distance=c,v.squaredDistance=u,v.squaredLength=h,v.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e},v.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e},v.normalize=function(e,t){var r=t[0],i=t[1],n=t[2],o=r*r+i*i+n*n;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e},v.dot=d,v.cross=function(e,t,r){var i=t[0],n=t[1],o=t[2],s=r[0],a=r[1],l=r[2];return e[0]=n*l-o*a,e[1]=o*s-i*l,e[2]=i*a-n*s,e},v.lerp=function(e,t,r,i){var n=t[0],o=t[1],s=t[2];return e[0]=n+i*(r[0]-n),e[1]=o+i*(r[1]-o),e[2]=s+i*(r[2]-s),e},v.hermite=function(e,t,r,i,n,o){var s=o*o,a=s*(2*o-3)+1,l=s*(o-2)+o,c=s*(o-1),u=s*(3-2*o);return e[0]=t[0]*a+r[0]*l+i[0]*c+n[0]*u,e[1]=t[1]*a+r[1]*l+i[1]*c+n[1]*u,e[2]=t[2]*a+r[2]*l+i[2]*c+n[2]*u,e},v.bezier=function(e,t,r,i,n,o){var s=1-o,a=s*s,l=o*o,c=a*s,u=3*o*a,h=3*l*s,d=l*o;return e[0]=t[0]*c+r[0]*u+i[0]*h+n[0]*d,e[1]=t[1]*c+r[1]*u+i[1]*h+n[1]*d,e[2]=t[2]*c+r[2]*u+i[2]*h+n[2]*d,e},v.random=function(e,r){r=r||1;var i=2*t.RANDOM()*Math.PI,n=2*t.RANDOM()-1,o=Math.sqrt(1-n*n)*r;return e[0]=Math.cos(i)*o,e[1]=Math.sin(i)*o,e[2]=n*r,e},v.transformMat4=function(e,t,r){var i=t[0],n=t[1],o=t[2],s=r[3]*i+r[7]*n+r[11]*o+r[15];return e[0]=(r[0]*i+r[4]*n+r[8]*o+r[12])/(s=s||1),e[1]=(r[1]*i+r[5]*n+r[9]*o+r[13])/s,e[2]=(r[2]*i+r[6]*n+r[10]*o+r[14])/s,e},v.transformMat3=function(e,t,r){var i=t[0],n=t[1],o=t[2];return e[0]=i*r[0]+n*r[3]+o*r[6],e[1]=i*r[1]+n*r[4]+o*r[7],e[2]=i*r[2]+n*r[5]+o*r[8],e},v.transformQuat=function(e,t,r){var i=r[0],n=r[1],o=r[2],s=t[0],a=t[1],l=t[2],c=n*l-o*a,u=o*s-i*l,h=i*a-n*s,d=n*h-o*u,p=o*c-i*h,f=i*u-n*c,m=2*r[3];return u*=m,h*=m,p*=2,f*=2,e[0]=s+(c*=m)+(d*=2),e[1]=a+u+p,e[2]=l+h+f,e},v.rotateX=function(e,t,r,i){var n=[],o=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],o[0]=n[0],o[1]=n[1]*Math.cos(i)-n[2]*Math.sin(i),o[2]=n[1]*Math.sin(i)+n[2]*Math.cos(i),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e},v.rotateY=function(e,t,r,i){var n=[],o=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],o[0]=n[2]*Math.sin(i)+n[0]*Math.cos(i),o[1]=n[1],o[2]=n[2]*Math.cos(i)-n[0]*Math.sin(i),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e},v.rotateZ=function(e,t,r,i){var n=[],o=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],o[0]=n[0]*Math.cos(i)-n[1]*Math.sin(i),o[1]=n[0]*Math.sin(i)+n[1]*Math.cos(i),o[2]=n[2],e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e},v.angle=function(e,t){var r=e[0],i=e[1],n=e[2],o=t[0],s=t[1],a=t[2],l=Math.sqrt(r*r+i*i+n*n)*Math.sqrt(o*o+s*s+a*a),c=l&&d(e,t)/l;return Math.acos(Math.min(Math.max(c,-1),1))},v.zero=function(e){return e[0]=0,e[1]=0,e[2]=0,e},v.str=function(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"},v.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]},v.equals=function(e,r){var i=e[0],n=e[1],o=e[2],s=r[0],a=r[1],l=r[2];return Math.abs(i-s)<=t.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(n-a)<=t.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(o-l)<=t.EPSILON*Math.max(1,Math.abs(o),Math.abs(l))},v.forEach=v.sqrLen=v.len=v.sqrDist=v.dist=v.div=v.mul=v.sub=void 0;var t=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==e(t)&&"function"!=typeof t)return{default:t};var i=r(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=o?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s]}return n.default=t,i&&i.set(t,n),n}(o());function r(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,i=new WeakMap;return(r=function(e){return e?i:t})(e)}function i(){var e=new t.ARRAY_TYPE(3);return t.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function n(e){return Math.hypot(e[0],e[1],e[2])}function s(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function a(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function l(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function c(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2])}function u(e,t){var r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2];return r*r+i*i+n*n}function h(e){var t=e[0],r=e[1],i=e[2];return t*t+r*r+i*i}function d(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}v.sub=s,v.mul=a,v.div=l,v.dist=c,v.sqrDist=u,v.len=n,v.sqrLen=h;var p,f=(p=i(),function(e,t,r,i,n,o){var s,a;for(t||(t=3),r||(r=0),a=i?Math.min(i*t+r,e.length):e.length,s=r;s<a;s+=t)p[0]=e[s],p[1]=e[s+1],p[2]=e[s+2],n(p,p,o),e[s]=p[0],e[s+1]=p[1],e[s+2]=p[2];return e});return v.forEach=f,v}var w,T,S={};function E(){if(w)return S;function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}w=1,Object.defineProperty(S,"__esModule",{value:!0}),S.create=i,S.clone=function(e){var r=new t.ARRAY_TYPE(4);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r},S.fromValues=function(e,r,i,n){var o=new t.ARRAY_TYPE(4);return o[0]=e,o[1]=r,o[2]=i,o[3]=n,o},S.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},S.set=function(e,t,r,i,n){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e},S.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e},S.subtract=n,S.multiply=s,S.divide=a,S.ceil=function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e},S.floor=function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e},S.min=function(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e[3]=Math.min(t[3],r[3]),e},S.max=function(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e[3]=Math.max(t[3],r[3]),e},S.round=function(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e[3]=Math.round(t[3]),e},S.scale=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e},S.scaleAndAdd=function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e},S.distance=l,S.squaredDistance=c,S.length=u,S.squaredLength=h,S.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e},S.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e},S.normalize=function(e,t){var r=t[0],i=t[1],n=t[2],o=t[3],s=r*r+i*i+n*n+o*o;return s>0&&(s=1/Math.sqrt(s)),e[0]=r*s,e[1]=i*s,e[2]=n*s,e[3]=o*s,e},S.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},S.cross=function(e,t,r,i){var n=r[0]*i[1]-r[1]*i[0],o=r[0]*i[2]-r[2]*i[0],s=r[0]*i[3]-r[3]*i[0],a=r[1]*i[2]-r[2]*i[1],l=r[1]*i[3]-r[3]*i[1],c=r[2]*i[3]-r[3]*i[2],u=t[0],h=t[1],d=t[2],p=t[3];return e[0]=h*c-d*l+p*a,e[1]=-u*c+d*s-p*o,e[2]=u*l-h*s+p*n,e[3]=-u*a+h*o-d*n,e},S.lerp=function(e,t,r,i){var n=t[0],o=t[1],s=t[2],a=t[3];return e[0]=n+i*(r[0]-n),e[1]=o+i*(r[1]-o),e[2]=s+i*(r[2]-s),e[3]=a+i*(r[3]-a),e},S.random=function(e,r){var i,n,o,s,a,l;r=r||1;do{a=(i=2*t.RANDOM()-1)*i+(n=2*t.RANDOM()-1)*n}while(a>=1);do{l=(o=2*t.RANDOM()-1)*o+(s=2*t.RANDOM()-1)*s}while(l>=1);var c=Math.sqrt((1-a)/l);return e[0]=r*i,e[1]=r*n,e[2]=r*o*c,e[3]=r*s*c,e},S.transformMat4=function(e,t,r){var i=t[0],n=t[1],o=t[2],s=t[3];return e[0]=r[0]*i+r[4]*n+r[8]*o+r[12]*s,e[1]=r[1]*i+r[5]*n+r[9]*o+r[13]*s,e[2]=r[2]*i+r[6]*n+r[10]*o+r[14]*s,e[3]=r[3]*i+r[7]*n+r[11]*o+r[15]*s,e},S.transformQuat=function(e,t,r){var i=t[0],n=t[1],o=t[2],s=r[0],a=r[1],l=r[2],c=r[3],u=c*i+a*o-l*n,h=c*n+l*i-s*o,d=c*o+s*n-a*i,p=-s*i-a*n-l*o;return e[0]=u*c+p*-s+h*-l-d*-a,e[1]=h*c+p*-a+d*-s-u*-l,e[2]=d*c+p*-l+u*-a-h*-s,e[3]=t[3],e},S.zero=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e},S.str=function(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},S.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},S.equals=function(e,r){var i=e[0],n=e[1],o=e[2],s=e[3],a=r[0],l=r[1],c=r[2],u=r[3];return Math.abs(i-a)<=t.EPSILON*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(n-l)<=t.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(o-c)<=t.EPSILON*Math.max(1,Math.abs(o),Math.abs(c))&&Math.abs(s-u)<=t.EPSILON*Math.max(1,Math.abs(s),Math.abs(u))},S.forEach=S.sqrLen=S.len=S.sqrDist=S.dist=S.div=S.mul=S.sub=void 0;var t=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==e(t)&&"function"!=typeof t)return{default:t};var i=r(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=o?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s]}return n.default=t,i&&i.set(t,n),n}(o());function r(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,i=new WeakMap;return(r=function(e){return e?i:t})(e)}function i(){var e=new t.ARRAY_TYPE(4);return t.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function n(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e}function s(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e[3]=t[3]*r[3],e}function a(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e[3]=t[3]/r[3],e}function l(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2],t[3]-e[3])}function c(e,t){var r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2],o=t[3]-e[3];return r*r+i*i+n*n+o*o}function u(e){return Math.hypot(e[0],e[1],e[2],e[3])}function h(e){var t=e[0],r=e[1],i=e[2],n=e[3];return t*t+r*r+i*i+n*n}S.sub=n,S.mul=s,S.div=a,S.dist=l,S.sqrDist=c,S.len=u,S.sqrLen=h;var d,p=(d=i(),function(e,t,r,i,n,o){var s,a;for(t||(t=4),r||(r=0),a=i?Math.min(i*t+r,e.length):e.length,s=r;s<a;s+=t)d[0]=e[s],d[1]=e[s+1],d[2]=e[s+2],d[3]=e[s+3],n(d,d,o),e[s]=d[0],e[s+1]=d[1],e[s+2]=d[2],e[s+3]=d[3];return e});return S.forEach=p,S}function M(){if(T)return x;function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}T=1,Object.defineProperty(x,"__esModule",{value:!0}),x.create=l,x.identity=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},x.setAxisAngle=c,x.getAxisAngle=function(e,r){var i=2*Math.acos(r[3]),n=Math.sin(i/2);return n>t.EPSILON?(e[0]=r[0]/n,e[1]=r[1]/n,e[2]=r[2]/n):(e[0]=1,e[1]=0,e[2]=0),i},x.getAngle=function(e,t){var r=g(e,t);return Math.acos(2*r*r-1)},x.multiply=u,x.rotateX=function(e,t,r){r*=.5;var i=t[0],n=t[1],o=t[2],s=t[3],a=Math.sin(r),l=Math.cos(r);return e[0]=i*l+s*a,e[1]=n*l+o*a,e[2]=o*l-n*a,e[3]=s*l-i*a,e},x.rotateY=function(e,t,r){r*=.5;var i=t[0],n=t[1],o=t[2],s=t[3],a=Math.sin(r),l=Math.cos(r);return e[0]=i*l-o*a,e[1]=n*l+s*a,e[2]=o*l+i*a,e[3]=s*l-n*a,e},x.rotateZ=function(e,t,r){r*=.5;var i=t[0],n=t[1],o=t[2],s=t[3],a=Math.sin(r),l=Math.cos(r);return e[0]=i*l+n*a,e[1]=n*l-i*a,e[2]=o*l+s*a,e[3]=s*l-o*a,e},x.calculateW=function(e,t){var r=t[0],i=t[1],n=t[2];return e[0]=r,e[1]=i,e[2]=n,e[3]=Math.sqrt(Math.abs(1-r*r-i*i-n*n)),e},x.exp=h,x.ln=d,x.pow=function(e,t,r){return d(e,t),_(e,e,r),h(e,e),e},x.slerp=p,x.random=function(e){var r=t.RANDOM(),i=t.RANDOM(),n=t.RANDOM(),o=Math.sqrt(1-r),s=Math.sqrt(r);return e[0]=o*Math.sin(2*Math.PI*i),e[1]=o*Math.cos(2*Math.PI*i),e[2]=s*Math.sin(2*Math.PI*n),e[3]=s*Math.cos(2*Math.PI*n),e},x.invert=function(e,t){var r=t[0],i=t[1],n=t[2],o=t[3],s=r*r+i*i+n*n+o*o,a=s?1/s:0;return e[0]=-r*a,e[1]=-i*a,e[2]=-n*a,e[3]=o*a,e},x.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},x.fromMat3=m,x.fromEuler=function(e,t,r,i){var n=.5*Math.PI/180;t*=n,r*=n,i*=n;var o=Math.sin(t),s=Math.cos(t),a=Math.sin(r),l=Math.cos(r),c=Math.sin(i),u=Math.cos(i);return e[0]=o*l*u-s*a*c,e[1]=s*a*u+o*l*c,e[2]=s*l*c-o*a*u,e[3]=s*l*u+o*a*c,e},x.str=function(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},x.setAxes=x.sqlerp=x.rotationTo=x.equals=x.exactEquals=x.normalize=x.sqrLen=x.squaredLength=x.len=x.length=x.lerp=x.dot=x.scale=x.mul=x.add=x.set=x.copy=x.fromValues=x.clone=void 0;var t=a(o()),r=a(f()),i=a(b()),n=a(E());function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(s=function(e){return e?r:t})(e)}function a(t,r){if(t&&t.__esModule)return t;if(null===t||"object"!==e(t)&&"function"!=typeof t)return{default:t};var i=s(r);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if("default"!==a&&Object.prototype.hasOwnProperty.call(t,a)){var l=o?Object.getOwnPropertyDescriptor(t,a):null;l&&(l.get||l.set)?Object.defineProperty(n,a,l):n[a]=t[a]}return n.default=t,i&&i.set(t,n),n}function l(){var e=new t.ARRAY_TYPE(4);return t.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function c(e,t,r){r*=.5;var i=Math.sin(r);return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=Math.cos(r),e}function u(e,t,r){var i=t[0],n=t[1],o=t[2],s=t[3],a=r[0],l=r[1],c=r[2],u=r[3];return e[0]=i*u+s*a+n*c-o*l,e[1]=n*u+s*l+o*a-i*c,e[2]=o*u+s*c+i*l-n*a,e[3]=s*u-i*a-n*l-o*c,e}function h(e,t){var r=t[0],i=t[1],n=t[2],o=t[3],s=Math.sqrt(r*r+i*i+n*n),a=Math.exp(o),l=s>0?a*Math.sin(s)/s:0;return e[0]=r*l,e[1]=i*l,e[2]=n*l,e[3]=a*Math.cos(s),e}function d(e,t){var r=t[0],i=t[1],n=t[2],o=t[3],s=Math.sqrt(r*r+i*i+n*n),a=s>0?Math.atan2(s,o)/s:0;return e[0]=r*a,e[1]=i*a,e[2]=n*a,e[3]=.5*Math.log(r*r+i*i+n*n+o*o),e}function p(e,r,i,n){var o,s,a,l,c,u=r[0],h=r[1],d=r[2],p=r[3],f=i[0],m=i[1],_=i[2],g=i[3];return(s=u*f+h*m+d*_+p*g)<0&&(s=-s,f=-f,m=-m,_=-_,g=-g),1-s>t.EPSILON?(o=Math.acos(s),a=Math.sin(o),l=Math.sin((1-n)*o)/a,c=Math.sin(n*o)/a):(l=1-n,c=n),e[0]=l*u+c*f,e[1]=l*h+c*m,e[2]=l*d+c*_,e[3]=l*p+c*g,e}function m(e,t){var r,i=t[0]+t[4]+t[8];if(i>0)r=Math.sqrt(i+1),e[3]=.5*r,e[0]=(t[5]-t[7])*(r=.5/r),e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{var n=0;t[4]>t[0]&&(n=1),t[8]>t[3*n+n]&&(n=2);var o=(n+1)%3,s=(n+2)%3;r=Math.sqrt(t[3*n+n]-t[3*o+o]-t[3*s+s]+1),e[n]=.5*r,e[3]=(t[3*o+s]-t[3*s+o])*(r=.5/r),e[o]=(t[3*o+n]+t[3*n+o])*r,e[s]=(t[3*s+n]+t[3*n+s])*r}return e}x.clone=n.clone,x.fromValues=n.fromValues,x.copy=n.copy,x.set=n.set,x.add=n.add,x.mul=u;var _=n.scale;x.scale=_;var g=n.dot;x.dot=g,x.lerp=n.lerp;var y=n.length;x.length=y,x.len=y;var v=n.squaredLength;x.squaredLength=v,x.sqrLen=v;var w=n.normalize;x.normalize=w,x.exactEquals=n.exactEquals,x.equals=n.equals;var S,M,A,C=(S=i.create(),M=i.fromValues(1,0,0),A=i.fromValues(0,1,0),function(e,t,r){var n=i.dot(t,r);return n<-.999999?(i.cross(S,M,t),i.len(S)<1e-6&&i.cross(S,A,t),i.normalize(S,S),c(e,S,Math.PI),e):n>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(i.cross(S,t,r),e[0]=S[0],e[1]=S[1],e[2]=S[2],e[3]=1+n,w(e,e))});x.rotationTo=C;var I,P,R=(I=l(),P=l(),function(e,t,r,i,n,o){return p(I,t,n,o),p(P,r,i,o),p(e,I,P,2*o*(1-o)),e});x.sqlerp=R;var z,D=(z=r.create(),function(e,t,r,i){return z[0]=r[0],z[3]=r[1],z[6]=r[2],z[1]=i[0],z[4]=i[1],z[7]=i[2],z[2]=-t[0],z[5]=-t[1],z[8]=-t[2],w(e,m(e,z))});return x.setAxes=D,x}var A,C={};function I(){if(A)return C;function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}A=1,Object.defineProperty(C,"__esModule",{value:!0}),C.create=function(){var e=new t.ARRAY_TYPE(8);return t.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[4]=0,e[5]=0,e[6]=0,e[7]=0),e[3]=1,e},C.clone=function(e){var r=new t.ARRAY_TYPE(8);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r},C.fromValues=function(e,r,i,n,o,s,a,l){var c=new t.ARRAY_TYPE(8);return c[0]=e,c[1]=r,c[2]=i,c[3]=n,c[4]=o,c[5]=s,c[6]=a,c[7]=l,c},C.fromRotationTranslationValues=function(e,r,i,n,o,s,a){var l=new t.ARRAY_TYPE(8);l[0]=e,l[1]=r,l[2]=i,l[3]=n;var c=.5*o,u=.5*s,h=.5*a;return l[4]=c*n+u*i-h*r,l[5]=u*n+h*e-c*i,l[6]=h*n+c*r-u*e,l[7]=-c*e-u*r-h*i,l},C.fromRotationTranslation=a,C.fromTranslation=function(e,t){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=.5*t[0],e[5]=.5*t[1],e[6]=.5*t[2],e[7]=0,e},C.fromRotation=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=0,e[5]=0,e[6]=0,e[7]=0,e},C.fromMat4=function(e,n){var o=r.create();i.getRotation(o,n);var s=new t.ARRAY_TYPE(3);return i.getTranslation(s,n),a(e,o,s),e},C.copy=l,C.identity=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e},C.set=function(e,t,r,i,n,o,s,a,l){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e[4]=o,e[5]=s,e[6]=a,e[7]=l,e},C.getDual=function(e,t){return e[0]=t[4],e[1]=t[5],e[2]=t[6],e[3]=t[7],e},C.setDual=function(e,t){return e[4]=t[0],e[5]=t[1],e[6]=t[2],e[7]=t[3],e},C.getTranslation=function(e,t){var r=t[4],i=t[5],n=t[6],o=t[7],s=-t[0],a=-t[1],l=-t[2],c=t[3];return e[0]=2*(r*c+o*s+i*l-n*a),e[1]=2*(i*c+o*a+n*s-r*l),e[2]=2*(n*c+o*l+r*a-i*s),e},C.translate=function(e,t,r){var i=t[0],n=t[1],o=t[2],s=t[3],a=.5*r[0],l=.5*r[1],c=.5*r[2],u=t[4],h=t[5],d=t[6],p=t[7];return e[0]=i,e[1]=n,e[2]=o,e[3]=s,e[4]=s*a+n*c-o*l+u,e[5]=s*l+o*a-i*c+h,e[6]=s*c+i*l-n*a+d,e[7]=-i*a-n*l-o*c+p,e},C.rotateX=function(e,t,i){var n=-t[0],o=-t[1],s=-t[2],a=t[3],l=t[4],c=t[5],u=t[6],h=t[7],d=l*a+h*n+c*s-u*o,p=c*a+h*o+u*n-l*s,f=u*a+h*s+l*o-c*n,m=h*a-l*n-c*o-u*s;return r.rotateX(e,t,i),e[4]=d*(a=e[3])+m*(n=e[0])+p*(s=e[2])-f*(o=e[1]),e[5]=p*a+m*o+f*n-d*s,e[6]=f*a+m*s+d*o-p*n,e[7]=m*a-d*n-p*o-f*s,e},C.rotateY=function(e,t,i){var n=-t[0],o=-t[1],s=-t[2],a=t[3],l=t[4],c=t[5],u=t[6],h=t[7],d=l*a+h*n+c*s-u*o,p=c*a+h*o+u*n-l*s,f=u*a+h*s+l*o-c*n,m=h*a-l*n-c*o-u*s;return r.rotateY(e,t,i),e[4]=d*(a=e[3])+m*(n=e[0])+p*(s=e[2])-f*(o=e[1]),e[5]=p*a+m*o+f*n-d*s,e[6]=f*a+m*s+d*o-p*n,e[7]=m*a-d*n-p*o-f*s,e},C.rotateZ=function(e,t,i){var n=-t[0],o=-t[1],s=-t[2],a=t[3],l=t[4],c=t[5],u=t[6],h=t[7],d=l*a+h*n+c*s-u*o,p=c*a+h*o+u*n-l*s,f=u*a+h*s+l*o-c*n,m=h*a-l*n-c*o-u*s;return r.rotateZ(e,t,i),e[4]=d*(a=e[3])+m*(n=e[0])+p*(s=e[2])-f*(o=e[1]),e[5]=p*a+m*o+f*n-d*s,e[6]=f*a+m*s+d*o-p*n,e[7]=m*a-d*n-p*o-f*s,e},C.rotateByQuatAppend=function(e,t,r){var i=r[0],n=r[1],o=r[2],s=r[3],a=t[0],l=t[1],c=t[2],u=t[3];return e[0]=a*s+u*i+l*o-c*n,e[1]=l*s+u*n+c*i-a*o,e[2]=c*s+u*o+a*n-l*i,e[3]=u*s-a*i-l*n-c*o,e[4]=(a=t[4])*s+(u=t[7])*i+(l=t[5])*o-(c=t[6])*n,e[5]=l*s+u*n+c*i-a*o,e[6]=c*s+u*o+a*n-l*i,e[7]=u*s-a*i-l*n-c*o,e},C.rotateByQuatPrepend=function(e,t,r){var i=t[0],n=t[1],o=t[2],s=t[3],a=r[0],l=r[1],c=r[2],u=r[3];return e[0]=i*u+s*a+n*c-o*l,e[1]=n*u+s*l+o*a-i*c,e[2]=o*u+s*c+i*l-n*a,e[3]=s*u-i*a-n*l-o*c,e[4]=i*(u=r[7])+s*(a=r[4])+n*(c=r[6])-o*(l=r[5]),e[5]=n*u+s*l+o*a-i*c,e[6]=o*u+s*c+i*l-n*a,e[7]=s*u-i*a-n*l-o*c,e},C.rotateAroundAxis=function(e,r,i,n){if(Math.abs(n)<t.EPSILON)return l(e,r);var o=Math.hypot(i[0],i[1],i[2]);n*=.5;var s=Math.sin(n),a=s*i[0]/o,c=s*i[1]/o,u=s*i[2]/o,h=Math.cos(n),d=r[0],p=r[1],f=r[2],m=r[3];e[0]=d*h+m*a+p*u-f*c,e[1]=p*h+m*c+f*a-d*u,e[2]=f*h+m*u+d*c-p*a,e[3]=m*h-d*a-p*c-f*u;var _=r[4],g=r[5],y=r[6],x=r[7];return e[4]=_*h+x*a+g*u-y*c,e[5]=g*h+x*c+y*a-_*u,e[6]=y*h+x*u+_*c-g*a,e[7]=x*h-_*a-g*c-y*u,e},C.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e},C.multiply=c,C.scale=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e},C.lerp=function(e,t,r,i){var n=1-i;return u(t,r)<0&&(i=-i),e[0]=t[0]*n+r[0]*i,e[1]=t[1]*n+r[1]*i,e[2]=t[2]*n+r[2]*i,e[3]=t[3]*n+r[3]*i,e[4]=t[4]*n+r[4]*i,e[5]=t[5]*n+r[5]*i,e[6]=t[6]*n+r[6]*i,e[7]=t[7]*n+r[7]*i,e},C.invert=function(e,t){var r=d(t);return e[0]=-t[0]/r,e[1]=-t[1]/r,e[2]=-t[2]/r,e[3]=t[3]/r,e[4]=-t[4]/r,e[5]=-t[5]/r,e[6]=-t[6]/r,e[7]=t[7]/r,e},C.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=t[7],e},C.normalize=function(e,t){var r=d(t);if(r>0){r=Math.sqrt(r);var i=t[0]/r,n=t[1]/r,o=t[2]/r,s=t[3]/r,a=t[4],l=t[5],c=t[6],u=t[7],h=i*a+n*l+o*c+s*u;e[0]=i,e[1]=n,e[2]=o,e[3]=s,e[4]=(a-i*h)/r,e[5]=(l-n*h)/r,e[6]=(c-o*h)/r,e[7]=(u-s*h)/r}return e},C.str=function(e){return"quat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+")"},C.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]},C.equals=function(e,r){var i=e[0],n=e[1],o=e[2],s=e[3],a=e[4],l=e[5],c=e[6],u=e[7],h=r[0],d=r[1],p=r[2],f=r[3],m=r[4],_=r[5],g=r[6],y=r[7];return Math.abs(i-h)<=t.EPSILON*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(n-d)<=t.EPSILON*Math.max(1,Math.abs(n),Math.abs(d))&&Math.abs(o-p)<=t.EPSILON*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(s-f)<=t.EPSILON*Math.max(1,Math.abs(s),Math.abs(f))&&Math.abs(a-m)<=t.EPSILON*Math.max(1,Math.abs(a),Math.abs(m))&&Math.abs(l-_)<=t.EPSILON*Math.max(1,Math.abs(l),Math.abs(_))&&Math.abs(c-g)<=t.EPSILON*Math.max(1,Math.abs(c),Math.abs(g))&&Math.abs(u-y)<=t.EPSILON*Math.max(1,Math.abs(u),Math.abs(y))},C.sqrLen=C.squaredLength=C.len=C.length=C.dot=C.mul=C.setReal=C.getReal=void 0;var t=s(o()),r=s(M()),i=s(g());function n(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(n=function(e){return e?r:t})(e)}function s(t,r){if(t&&t.__esModule)return t;if(null===t||"object"!==e(t)&&"function"!=typeof t)return{default:t};var i=n(r);if(i&&i.has(t))return i.get(t);var o={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if("default"!==a&&Object.prototype.hasOwnProperty.call(t,a)){var l=s?Object.getOwnPropertyDescriptor(t,a):null;l&&(l.get||l.set)?Object.defineProperty(o,a,l):o[a]=t[a]}return o.default=t,i&&i.set(t,o),o}function a(e,t,r){var i=.5*r[0],n=.5*r[1],o=.5*r[2],s=t[0],a=t[1],l=t[2],c=t[3];return e[0]=s,e[1]=a,e[2]=l,e[3]=c,e[4]=i*c+n*l-o*a,e[5]=n*c+o*s-i*l,e[6]=o*c+i*a-n*s,e[7]=-i*s-n*a-o*l,e}function l(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e}function c(e,t,r){var i=t[0],n=t[1],o=t[2],s=t[3],a=r[4],l=r[5],c=r[6],u=r[7],h=t[4],d=t[5],p=t[6],f=t[7],m=r[0],_=r[1],g=r[2],y=r[3];return e[0]=i*y+s*m+n*g-o*_,e[1]=n*y+s*_+o*m-i*g,e[2]=o*y+s*g+i*_-n*m,e[3]=s*y-i*m-n*_-o*g,e[4]=i*u+s*a+n*c-o*l+h*y+f*m+d*g-p*_,e[5]=n*u+s*l+o*a-i*c+d*y+f*_+p*m-h*g,e[6]=o*u+s*c+i*l-n*a+p*y+f*g+h*_-d*m,e[7]=s*u-i*a-n*l-o*c+f*y-h*m-d*_-p*g,e}C.getReal=r.copy,C.setReal=r.copy,C.mul=c;var u=r.dot;C.dot=u;var h=r.length;C.length=h,C.len=h;var d=r.squaredLength;return C.squaredLength=d,C.sqrLen=d,C}var P,R,z={};function D(){if(P)return z;function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}P=1,Object.defineProperty(z,"__esModule",{value:!0}),z.create=i,z.clone=function(e){var r=new t.ARRAY_TYPE(2);return r[0]=e[0],r[1]=e[1],r},z.fromValues=function(e,r){var i=new t.ARRAY_TYPE(2);return i[0]=e,i[1]=r,i},z.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e},z.set=function(e,t,r){return e[0]=t,e[1]=r,e},z.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e},z.subtract=n,z.multiply=s,z.divide=a,z.ceil=function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e},z.floor=function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e},z.min=function(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e},z.max=function(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e},z.round=function(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e},z.scale=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e},z.scaleAndAdd=function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e},z.distance=l,z.squaredDistance=c,z.length=u,z.squaredLength=h,z.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e},z.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e},z.normalize=function(e,t){var r=t[0],i=t[1],n=r*r+i*i;return n>0&&(n=1/Math.sqrt(n)),e[0]=t[0]*n,e[1]=t[1]*n,e},z.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]},z.cross=function(e,t,r){var i=t[0]*r[1]-t[1]*r[0];return e[0]=e[1]=0,e[2]=i,e},z.lerp=function(e,t,r,i){var n=t[0],o=t[1];return e[0]=n+i*(r[0]-n),e[1]=o+i*(r[1]-o),e},z.random=function(e,r){r=r||1;var i=2*t.RANDOM()*Math.PI;return e[0]=Math.cos(i)*r,e[1]=Math.sin(i)*r,e},z.transformMat2=function(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[2]*n,e[1]=r[1]*i+r[3]*n,e},z.transformMat2d=function(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[2]*n+r[4],e[1]=r[1]*i+r[3]*n+r[5],e},z.transformMat3=function(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[3]*n+r[6],e[1]=r[1]*i+r[4]*n+r[7],e},z.transformMat4=function(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[4]*n+r[12],e[1]=r[1]*i+r[5]*n+r[13],e},z.rotate=function(e,t,r,i){var n=t[0]-r[0],o=t[1]-r[1],s=Math.sin(i),a=Math.cos(i);return e[0]=n*a-o*s+r[0],e[1]=n*s+o*a+r[1],e},z.angle=function(e,t){var r=e[0],i=e[1],n=t[0],o=t[1],s=Math.sqrt(r*r+i*i)*Math.sqrt(n*n+o*o);return Math.acos(Math.min(Math.max(s&&(r*n+i*o)/s,-1),1))},z.zero=function(e){return e[0]=0,e[1]=0,e},z.str=function(e){return"vec2("+e[0]+", "+e[1]+")"},z.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]},z.equals=function(e,r){var i=e[0],n=e[1],o=r[0],s=r[1];return Math.abs(i-o)<=t.EPSILON*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(n-s)<=t.EPSILON*Math.max(1,Math.abs(n),Math.abs(s))},z.forEach=z.sqrLen=z.sqrDist=z.dist=z.div=z.mul=z.sub=z.len=void 0;var t=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==e(t)&&"function"!=typeof t)return{default:t};var i=r(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=o?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s]}return n.default=t,i&&i.set(t,n),n}(o());function r(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,i=new WeakMap;return(r=function(e){return e?i:t})(e)}function i(){var e=new t.ARRAY_TYPE(2);return t.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0),e}function n(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e}function s(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e}function a(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e}function l(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1])}function c(e,t){var r=t[0]-e[0],i=t[1]-e[1];return r*r+i*i}function u(e){return Math.hypot(e[0],e[1])}function h(e){var t=e[0],r=e[1];return t*t+r*r}z.len=u,z.sub=n,z.mul=s,z.div=a,z.dist=l,z.sqrDist=c,z.sqrLen=h;var d,p=(d=i(),function(e,t,r,i,n,o){var s,a;for(t||(t=2),r||(r=0),a=i?Math.min(i*t+r,e.length):e.length,s=r;s<a;s+=t)d[0]=e[s],d[1]=e[s+1],n(d,d,o),e[s]=d[0],e[s+1]=d[1];return e});return z.forEach=p,z}function k(){if(R)return i;function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}R=1,Object.defineProperty(i,"__esModule",{value:!0}),i.vec4=i.vec3=i.vec2=i.quat2=i.quat=i.mat4=i.mat3=i.mat2d=i.mat2=i.glMatrix=void 0;var t=y(o());i.glMatrix=t;var r=y(l());i.mat2=r;var n=y(h());i.mat2d=n;var s=y(f());i.mat3=s;var a=y(g());i.mat4=a;var c=y(M());i.quat=c;var u=y(I());i.quat2=u;var d=y(D());i.vec2=d;var p=y(b());i.vec3=p;var m=y(E());function _(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(_=function(e){return e?r:t})(e)}function y(t,r){if(t&&t.__esModule)return t;if(null===t||"object"!==e(t)&&"function"!=typeof t)return{default:t};var i=_(r);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=o?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s]}return n.default=t,i&&i.set(t,n),n}return i.vec4=m,i}var O,L,B,F,N=k(),V=function(){if(L)return O;function e(e,t,r,i){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(i-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=r,this.p2y=i}return L=1,O=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var r=e,i=0;i<8;i++){var n=this.sampleCurveX(r)-e;if(Math.abs(n)<t)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r-=n/o}var s=0,a=1;for(r=e,i=0;i<20&&(n=this.sampleCurveX(r),!(Math.abs(n-e)<t));i++)e>n?s=r:a=r,r=.5*(a-s)+s;return r},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},O}(),j=t(V);function U(){if(F)return B;function e(e,t){this.x=e,this.y=t}return F=1,B=e,e.prototype={clone:function(){return new e(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,r=e.y-this.y;return t*t+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),r=Math.sin(e),i=r*this.x+t*this.y;return this.x=t*this.x-r*this.y,this.y=i,this},_rotateAround:function(e,t){var r=Math.cos(e),i=Math.sin(e),n=t.y+i*(this.x-t.x)+r*(this.y-t.y);return this.x=t.x+r*(this.x-t.x)-i*(this.y-t.y),this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},e.convert=function(t){return t instanceof e?t:Array.isArray(t)?new e(t[0],t[1]):t},B}var $=t(U());function G(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!G(e[r],t[r]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==t){if("object"!=typeof t)return!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(!G(e[r],t[r]))return!1;return!0}return e===t}const q=Math.PI/180,H=180/Math.PI;function W(e){return e*q}function Z(e){return e*H}const X=[[0,0],[1,0],[1,1],[0,1]];function Y(e){if(e<=0)return 0;if(e>=1)return 1;const t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}function J(e,t,r,i){const n=new j(e,t,r,i);return function(e){return n.solve(e)}}const K=J(.25,.1,.25,1);function Q(e,t,r){return Math.min(r,Math.max(t,e))}function ee(e,t,r){return(r=Q((r-e)/(t-e),0,1))*r*(3-2*r)}function te(e,t,r){const i=r-t,n=((e-t)%i+i)%i+t;return n===t?r:n}function re(e,t,r){if(!e.length)return r(null,[]);let i=e.length;const n=new Array(e.length);let o=null;e.forEach(((e,s)=>{t(e,((e,t)=>{e&&(o=e),n[s]=t,0==--i&&r(o,n)}))}))}function ie(e,...t){for(const r of t)for(const t in r)e[t]=r[t];return e}let ne=1;function oe(){return ne++}function se(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function ae(e,t){e.forEach((e=>{t[e]&&(t[e]=t[e].bind(t))}))}function le(e,t){return-1!==e.indexOf(t,e.length-t.length)}function ce(e,t,r){const i={};for(const r in e)i[r]=t.call(this,e[r],r,e);return i}function ue(e,t,r){const i={};for(const r in e)t.call(this,e[r],r,e)&&(i[r]=e[r]);return i}function he(e){return Array.isArray(e)?e.map(he):"object"==typeof e&&e?ce(e,he):e}const de={};function pe(e){de[e]||("undefined"!=typeof console&&console.warn(e),de[e]=!0)}function fe(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}function me(e){let t=0;for(let r,i,n=0,o=e.length,s=o-1;n<o;s=n++)r=e[n],i=e[s],t+=(i.x-r.x)*(r.y+i.y);return t}function _e([e,t,r]){const i=W(t+90),n=W(r);return{x:e*Math.cos(i)*Math.sin(n),y:e*Math.sin(i)*Math.sin(n),z:e*Math.cos(n),azimuthal:t,polar:r}}function ge(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function ye(e){const t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((e,r,i,n)=>{const o=i||n;return t[r]=!o||o.toLowerCase(),""})),t["max-age"]){const e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t}let xe=null;function ve(e,t){return[e[4*t],e[4*t+1],e[4*t+2],e[4*t+3]]}function be(e,t,r,i){for(;t<r;){const n=t+r>>1;e[n]<i?t=n+1:r=n}return t}function we(e,t,r,i){for(;t<r;){const n=t+r>>1;e[n]<=i?t=n+1:r=n}return t}function Te(e){return e>0?1/(1.001-e):1+e}function Se(e){return e>0?1-1/(1.001-e):-e}const Ee={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!Ee.API_URL)return null;try{const e=new URL(Ee.API_URL);return"api.mapbox.cn"===e.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===e.hostname?"https://events.mapbox.com/events/v2":null}catch(e){return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function Me(e){return Ee.API_URL_REGEX.test(e)}function Ae(e){return Ee.API_SPRITE_REGEX.test(e)}let Ce,Ie,Pe,Re,ze,De;function ke(){return null==Ce&&(Ce=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),Ce}const Oe={now:()=>void 0!==Re?Re:performance.now(),setNow(e){Re=e},restoreNow(){Re=void 0},frame(e){const t=requestAnimationFrame(e);return{cancel:()=>cancelAnimationFrame(t)}},getImageData(e,t=0){const{width:r,height:i}=e;ze||(ze=document.createElement("canvas"));const n=ze.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return(r>ze.width||i>ze.height)&&(ze.width=r,ze.height=i),n.clearRect(-t,-t,r+2*t,i+2*t),n.drawImage(e,0,0,r,i),n.getImageData(-t,-t,r+2*t,i+2*t)},resolveURL:e=>(Ie||(Ie=document.createElement("a")),Ie.href=e,Ie.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(null==Pe&&(Pe=window.matchMedia("(prefers-reduced-motion: reduce)")),Pe.matches)},hasCanvasFingerprintNoise(){if(void 0!==De)return De;if(!ke())return De=!1,!1;const e=new OffscreenCanvas(85,1),t=e.getContext("2d",{willReadFrequently:!0});let r=0;for(let i=0;i<e.width;++i)t.fillStyle=`rgba(${r++},${r++},${r++}, 255)`,t.fillRect(i,0,1,1);const i=t.getImageData(0,0,e.width,e.height);r=0;for(let e=0;e<i.data.length;++e)if(e%4!=3&&r++!==i.data[e])return De=!0,!0;return De=!1,!1}};function Le(e,t){const r=e.indexOf("?");if(r<0)return`${e}?${new URLSearchParams(t).toString()}`;const i=new URLSearchParams(e.slice(r));for(const e in t)i.set(e,t[e]);return`${e.slice(0,r)}?${i.toString()}`}function Be(e,t={persistentParams:[]}){const r=e.indexOf("?");if(r<0)return e;const i=new URLSearchParams,n=new URLSearchParams(e.slice(r));for(const e of t.persistentParams){const t=n.get(e);t&&i.set(e,t)}const o=i.toString();return`${e.slice(0,r)}${o.length>0?`?${o}`:""}`}const Fe="mapbox-tiles";let Ne=500,Ve=50;const je=["language","worldview","jobid"];let Ue,$e;function Ge(){try{return caches}catch(e){}}function qe(){const e=Ge();e&&null==Ue&&(Ue=e.open(Fe))}let He=1/0;const We={supported:!1,testSupport:function(e){!Ye&&Xe&&(Je?Qe(e):Ze=e)}};let Ze,Xe,Ye=!1,Je=!1;const Ke="undefined"!=typeof self?self:{};function Qe(e){const t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,Xe),e.isContextLost())return;We.supported=!0}catch(e){}e.deleteTexture(t),Ye=!0}Ke.document&&(Xe=Ke.document.createElement("img"),Xe.onload=function(){Ze&&Qe(Ze),Ze=null,Je=!0},Xe.onerror=function(){Ye=!0,Ze=null},Xe.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const et={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image",Model:"Model"};"function"==typeof Object.freeze&&Object.freeze(et);class tt extends Error{constructor(e,t,r){401===t&&Me(r)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=t,this.url=r}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const rt=ge()?()=>self.worker&&self.worker.referrer:()=>("blob:"===location.protocol?parent:self).location.href,it=function(e,t){if(!(/^file:/.test(r=e.url)||/^file:/.test(rt())&&!/^\w+:/.test(r))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(e,t){const r=new AbortController,i=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:rt(),referrerPolicy:e.referrerPolicy,signal:r.signal});let n=!1,o=!1;const s=(a=i.url).indexOf("sku=")>0&&Me(a);var a;"json"===e.type&&i.headers.set("Accept","application/json");const l=(r,n,a)=>{if(o)return;if(r&&"SecurityError"!==r.message&&pe(r.toString()),n&&a)return c(n);const l=Date.now();fetch(i).then((r=>{if(r.ok){const e=s?r.clone():null;return c(r,e,l)}return t(new tt(r.statusText,r.status,e.url))})).catch((r=>{"AbortError"!==r.name&&t(new Error(`${r.message} ${e.url}`))}))},c=(r,s,a)=>{("arrayBuffer"===e.type?r.arrayBuffer():"json"===e.type?r.json():r.text()).then((e=>{o||(s&&a&&function(e,t,r){if(qe(),null==Ue)return;const i=ye(t.headers.get("Cache-Control")||"");if(i["no-store"])return;const n={status:t.status,statusText:t.statusText,headers:new Headers};t.headers.forEach(((e,t)=>n.headers.set(t,e))),i["max-age"]&&n.headers.set("Expires",new Date(r+1e3*i["max-age"]).toUTCString());const o=n.headers.get("Expires");if(!o)return;if(new Date(o).getTime()-r<42e4)return;let s=Be(e.url,{persistentParams:je});if(206===t.status){const t=e.headers.get("Range");if(!t)return;n.status=200,s=Le(s,{range:t})}!function(e,t){if(void 0===$e)try{new Response(new ReadableStream),$e=!0}catch(e){$e=!1}$e?t(e.body):e.blob().then(t)}(t,(e=>{const r=new Response(200!==(i=t.status)&&404!==i&&[101,103,204,205,304].includes(i)?null:e,n);var i;qe(),null!=Ue&&Ue.then((e=>e.put(s,r))).catch((e=>pe(e.message)))}))}(i,s,a),n=!0,t(null,e,r.headers.get("Cache-Control"),r.headers.get("Expires")))})).catch((e=>{o||t(new Error(e.message))}))};return s?function(e,t){if(qe(),null==Ue)return t(null);Ue.then((r=>{let i=Be(e.url,{persistentParams:je});const n=e.headers.get("Range");n&&(i=Le(i,{range:n})),r.match(i).then((e=>{const n=function(e){if(!e)return!1;const t=new Date(e.headers.get("Expires")||0),r=ye(e.headers.get("Cache-Control")||"");return t>Date.now()&&!r["no-cache"]}(e);r.delete(i),n&&r.put(i,e.clone()),t(null,e,n)})).catch(t)})).catch(t)}(i,l):l(null,null),{cancel:()=>{o=!0,n||r.abort()}}}(e,t);if(ge()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,t,void 0,!0)}var r;return function(e,t){const r=new XMLHttpRequest;r.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(r.responseType="arraybuffer");for(const t in e.headers)r.setRequestHeader(t,e.headers[t]);return"json"===e.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===e.credentials,r.onerror=()=>{t(new Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let i=r.response;if("json"===e.type)try{i=JSON.parse(r.response)}catch(e){return t(e)}t(null,i,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else t(new tt(r.statusText,r.status,e.url))},r.send(e.body),{cancel:()=>r.abort()}}(e,t)},nt=function(e,t){return it(ie(e,{type:"arrayBuffer"}),t)};function ot(e){const t=document.createElement("a");return t.href=e,t.protocol===location.protocol&&t.host===location.host}const st="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let at,lt;at=[],lt=0;const ct=function(e,t){if(We.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),lt>=Ee.MAX_PARALLEL_IMAGE_REQUESTS){const r={requestParameters:e,callback:t,cancelled:!1,cancel(){this.cancelled=!0}};return at.push(r),r}lt++;let r=!1;const i=()=>{if(!r)for(r=!0,lt--;at.length&<<Ee.MAX_PARALLEL_IMAGE_REQUESTS;){const e=at.shift(),{requestParameters:t,callback:r,cancelled:i}=e;i||(e.cancel=ct(t,r).cancel)}},n=nt(e,((e,r,n,o)=>{i(),e?t(e):r&&(self.createImageBitmap?function(e,t){const r=new Blob([new Uint8Array(e)],{type:"image/png"});createImageBitmap(r).then((e=>{t(null,e)})).catch((e=>{t(new Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))}))}(r,((e,r)=>t(e,r,n,o))):function(e,t){const r=new Image;r.onload=()=>{t(null,r),URL.revokeObjectURL(r.src),r.onload=null,requestAnimationFrame((()=>{r.src=st}))},r.onerror=()=>t(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const i=new Blob([new Uint8Array(e)],{type:"image/png"});r.src=e.byteLength?URL.createObjectURL(i):st}(r,((e,r)=>t(e,r,n,o))))}));return{cancel:()=>{n.cancel(),i()}}};var ut,ht,dt,pt={exports:{}},ft={exports:{}},mt={exports:{}},_t=function(){if(dt)return pt.exports;dt=1;var e=(ut||(ut=1,ft.exports=function(e,t){var r,i,n,o,s,a,l,c;for(i=e.length-(r=3&e.length),n=t,s=3432918353,a=461845907,c=0;c<i;)l=255&e.charCodeAt(c)|(255&e.charCodeAt(++c))<<8|(255&e.charCodeAt(++c))<<16|(255&e.charCodeAt(++c))<<24,++c,n=27492+(65535&(o=5*(65535&(n=(n^=l=(65535&(l=(l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&e.charCodeAt(c+2))<<16;case 2:l^=(255&e.charCodeAt(c+1))<<8;case 1:n^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(c)))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return n^=e.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0}),ft.exports),t=(ht||(ht=1,mt.exports=function(e,t){for(var r,i=e.length,n=t^i,o=0;i>=4;)r=1540483477*(65535&(r=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+((1540483477*(r>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),i-=4,++o;switch(i){case 3:n^=(255&e.charCodeAt(o+2))<<16;case 2:n^=(255&e.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}),mt.exports);return pt.exports=e,pt.exports.murmur3=e,pt.exports.murmur2=t,pt.exports}(),gt=t(_t);class yt{constructor(e,...t){ie(this,t[0]||{}),this.type=e}}class xt extends yt{constructor(e,t={}){super("error",ie({error:e},t))}}function vt(e,t,r){r[e]&&-1!==r[e].indexOf(t)||(r[e]=r[e]||[],r[e].push(t))}function bt(e,t,r){if(r&&r[e]){const i=r[e].indexOf(t);-1!==i&&r[e].splice(i,1)}}class wt{on(e,t){return this._listeners=this._listeners||{},vt(e,t,this._listeners),this}off(e,t){return bt(e,t,this._listeners),bt(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},vt(e,t,this._oneTimeListeners),this):new Promise((t=>this.once(e,t)))}fire(e,t){const r="string"==typeof e?new yt(e,t):e,i=r.type;if(this.listens(i)){r.target=this;const e=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(const t of e)t.call(this,r);const t=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(const e of t)bt(i,e,this._oneTimeListeners),e.call(this,r);const n=this._eventedParent;n&&(ie(r,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),n.fire(r))}else r instanceof xt&&console.error(r.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}var Tt,St={},Et=function(){if(Tt)return St;Tt=1;var e={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function t(e){return(e=Math.round(e))<0?0:e>255?255:e}function r(e){return t("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function i(e){return(t="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))<0?0:t>1?1:t;var t}function n(e,t,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?e+(t-e)*r*6:2*r<1?t:3*r<2?e+(t-e)*(2/3-r)*6:e}try{St.parseCSSColor=function(o){var s,a=o.replace(/ /g,"").toLowerCase();if(a in e)return e[a].slice();if("#"===a[0])return 4===a.length?(s=parseInt(a.substr(1),16))>=0&&s<=4095?[(3840&s)>>4|(3840&s)>>8,240&s|(240&s)>>4,15&s|(15&s)<<4,1]:null:7===a.length&&(s=parseInt(a.substr(1),16))>=0&&s<=16777215?[(16711680&s)>>16,(65280&s)>>8,255&s,1]:null;var l=a.indexOf("("),c=a.indexOf(")");if(-1!==l&&c+1===a.length){var u=a.substr(0,l),h=a.substr(l+1,c-(l+1)).split(","),d=1;switch(u){case"rgba":if(4!==h.length)return null;d=i(h.pop());case"rgb":return 3!==h.length?null:[r(h[0]),r(h[1]),r(h[2]),d];case"hsla":if(4!==h.length)return null;d=i(h.pop());case"hsl":if(3!==h.length)return null;var p=(parseFloat(h[0])%360+360)%360/360,f=i(h[1]),m=i(h[2]),_=m<=.5?m*(f+1):m+f-m*f,g=2*m-_;return[t(255*n(g,_,p+1/3)),t(255*n(g,_,p)),t(255*n(g,_,p-1/3)),d];default:return null}}return null}}catch(e){}return St}();class Mt{constructor(e,t,r,i=1){this.r=e,this.g=t,this.b=r,this.a=i}static parse(e){if(!e)return;if(e instanceof Mt)return e;if("string"!=typeof e)return;const t=Et.parseCSSColor(e);return t?new Mt(t[0]/255*t[3],t[1]/255*t[3],t[2]/255*t[3],t[3]):void 0}toString(){const[e,t,r,i]=0===this.a?[0,0,0,0]:[255*this.r/this.a,255*this.g/this.a,255*this.b/this.a,this.a];return`rgba(${Math.round(e)},${Math.round(t)},${Math.round(r)},${i})`}toRenderColor(e){const{r:t,g:r,b:i,a:n}=this;return new At(e,t,r,i,n)}}class At{constructor(e,t,r,i,n){if(e){const o=e.image.height,s=o*o;t=0===n?0:t/n*(o-1),r=0===n?0:r/n*(o-1),i=0===n?0:i/n*(o-1);const a=Math.floor(t),l=Math.floor(r),c=Math.floor(i),u=Math.ceil(t),h=Math.ceil(r),d=Math.ceil(i),p=t-a,f=r-l,m=i-c,_=e.image.data,g=4*(a+l*s+c*o),y=4*(a+l*s+d*o),x=4*(a+h*s+c*o),v=4*(a+h*s+d*o),b=4*(u+l*s+c*o),w=4*(u+l*s+d*o),T=4*(u+h*s+c*o),S=4*(u+h*s+d*o);if(g<0||S>=_.length)throw new Error("out of range");this.r=Ct(Ct(Ct(_[g],_[y],m),Ct(_[x],_[v],m),f),Ct(Ct(_[b],_[w],m),Ct(_[T],_[S],m),f),p)/255*n,this.g=Ct(Ct(Ct(_[g+1],_[y+1],m),Ct(_[x+1],_[v+1],m),f),Ct(Ct(_[b+1],_[w+1],m),Ct(_[T+1],_[S+1],m),f),p)/255*n,this.b=Ct(Ct(Ct(_[g+2],_[y+2],m),Ct(_[x+2],_[v+2],m),f),Ct(Ct(_[b+2],_[w+2],m),Ct(_[T+2],_[S+2],m),f),p)/255*n,this.a=n}else this.r=t,this.g=r,this.b=i,this.a=n}toArray(){const{r:e,g:t,b:r,a:i}=this;return 0===i?[0,0,0,0]:[255*e/i,255*t/i,255*r/i,i]}toArray01(){const{r:e,g:t,b:r,a:i}=this;return 0===i?[0,0,0,0]:[e/i,t/i,r/i,i]}toArray01Scaled(e){const{r:t,g:r,b:i,a:n}=this;return 0===n?[0,0,0]:[t/n*e,r/n*e,i/n*e]}toArray01PremultipliedAlpha(){const{r:e,g:t,b:r,a:i}=this;return[e,t,r,i]}toArray01Linear(){const{r:e,g:t,b:r,a:i}=this;return 0===i?[0,0,0,0]:[Math.pow(e/i,2.2),Math.pow(t/i,2.2),Math.pow(r/i,2.2),i]}}function Ct(e,t,r){return e*(1-r)+t*r}function It(e,t,r){return e.map(((e,i)=>Ct(e,t[i],r)))}Mt.black=new Mt(0,0,0,1),Mt.white=new Mt(1,1,1,1),Mt.transparent=new Mt(0,0,0,0),Mt.red=new Mt(1,0,0,1),Mt.blue=new Mt(0,0,1,1);var Pt=Object.freeze({__proto__:null,array:It,color:function(e,t,r){return new Mt(Ct(e.r,t.r,r),Ct(e.g,t.g,r),Ct(e.b,t.b,r),Ct(e.a,t.a,r))},number:Ct});function Rt(e,...t){for(const r of t)for(const t in r)e[t]=r[t];return e}class zt extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class Dt{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[e,r]of t)this.bindings[e]=r}concat(e){return new Dt(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const kt={kind:"null"},Ot={kind:"number"},Lt={kind:"string"},Bt={kind:"boolean"},Ft={kind:"color"},Nt={kind:"object"},Vt={kind:"value"},jt={kind:"collator"},Ut={kind:"formatted"},$t={kind:"resolvedImage"};function Gt(e,t){return{kind:"array",itemType:e,N:t}}function qt(e){if("array"===e.kind){const t=qt(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const Ht=[kt,Ot,Lt,Bt,Ft,Ut,Nt,Gt(Vt),$t];function Wt(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!Wt(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of Ht)if(!Wt(e,t))return null}return`Expected ${qt(e)} but found ${qt(t)} instead.`}function Zt(e,t){return t.some((t=>t.kind===e.kind))}function Xt(e,t){return t.some((t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e))}class Yt{constructor(e,t,r){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Jt{constructor(e,t,r,i,n){this.text=e.normalize?e.normalize():e,this.image=t,this.scale=r,this.fontStack=i,this.textColor=n}}class Kt{constructor(e){this.sections=e}static fromString(e){return new Kt([new Jt(e,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((e=>0!==e.text.length||e.image&&0!==e.image.namePrimary.length))}static factory(e){return e instanceof Kt?e:Kt.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map((e=>e.text)).join("")}serialize(){const e=["format"];for(const t of this.sections){if(t.image){e.push(["image",t.image.namePrimary]);continue}e.push(t.text);const r={};t.fontStack&&(r["text-font"]=["literal",t.fontStack.split(",")]),t.scale&&(r["font-scale"]=t.scale),t.textColor&&(r["text-color"]=["rgba"].concat(t.textColor.toRenderColor(null).toArray())),e.push(r)}return e}}class Qt{constructor(e){this.namePrimary=e.namePrimary,e.nameSecondary&&(this.nameSecondary=e.nameSecondary),this.available=e.available}toString(){return this.nameSecondary?`[${this.namePrimary},${this.nameSecondary}]`:this.namePrimary}static fromString(e,t){return e?new Qt({namePrimary:e,nameSecondary:t,available:!1}):null}serialize(){return this.nameSecondary?["image",this.namePrimary,this.nameSecondary]:["image",this.namePrimary]}}function er(e,t,r,i){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===i||"number"==typeof i&&i>=0&&i<=1?null:`Invalid rgba value [${[e,t,r,i].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof i?[e,t,r,i]:[e,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function tr(e){if(null===e)return!0;if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof Mt)return!0;if(e instanceof Yt)return!0;if(e instanceof Kt)return!0;if(e instanceof Qt)return!0;if(Array.isArray(e)){for(const t of e)if(!tr(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!tr(e[t]))return!1;return!0}return!1}function rr(e){if(null===e)return kt;if("string"==typeof e)return Lt;if("boolean"==typeof e)return Bt;if("number"==typeof e)return Ot;if(e instanceof Mt)return Ft;if(e instanceof Yt)return jt;if(e instanceof Kt)return Ut;if(e instanceof Qt)return $t;if(Array.isArray(e)){const t=e.length;let r;for(const t of e){const e=rr(t);if(r){if(r===e)continue;r=Vt;break}r=e}return Gt(r||Vt,t)}return Nt}function ir(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof Mt||e instanceof Kt||e instanceof Qt?e.toString():JSON.stringify(e)}class nr{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!tr(e[1]))return t.error("invalid value");const r=e[1];let i=rr(r);const n=t.expectedType;return"array"!==i.kind||0!==i.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(i=n),new nr(i,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof Mt?["rgba"].concat(this.value.toRenderColor(null).toArray()):this.value instanceof Kt?this.value.serialize():this.value}}class or{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const sr={string:Lt,number:Ot,boolean:Bt,object:Nt};class ar{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let r,i=1;const n=e[0];if("array"===n){let n,o;if(e.length>2){const r=e[1];if("string"!=typeof r||!(r in sr)||"object"===r)return t.error('The item type argument of "array" must be one of string, number, boolean',1);n=sr[r],i++}else n=Vt;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);o=e[2],i++}r=Gt(n,o)}else r=sr[n];const o=[];for(;i<e.length;i++){const r=t.parse(e[i],i,Vt);if(!r)return null;o.push(r)}return new ar(r,o)}evaluate(e){for(let t=0;t<this.args.length;t++){const r=this.args[t].evaluate(e);if(!Wt(this.type,rr(r)))return r;if(t===this.args.length-1)throw new or(`The expression ${JSON.stringify(this.args[t].serialize())} evaluated to ${qt(rr(r))} but was expected to be of type ${qt(this.type)}.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}serialize(){const e=this.type,t=[e.kind];if("array"===e.kind){const r=e.itemType;if("string"===r.kind||"number"===r.kind||"boolean"===r.kind){t.push(r.kind);const i=e.N;("number"==typeof i||this.args.length>1)&&t.push(i)}}return t.concat(this.args.map((e=>e.serialize())))}}class lr{constructor(e){this.type=Ut,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const r=e[1];if(!Array.isArray(r)&&"object"==typeof r)return t.error("First argument must be an image or text section.");const i=[];let n=!1;for(let r=1;r<=e.length-1;++r){const o=e[r];if(n&&"object"==typeof o&&!Array.isArray(o)){n=!1;let e=null;if(o["font-scale"]&&(e=t.parseObjectValue(o["font-scale"],r,"font-scale",Ot),!e))return null;let s=null;if(o["text-font"]&&(s=t.parseObjectValue(o["text-font"],r,"text-font",Gt(Lt)),!s))return null;let a=null;if(o["text-color"]&&(a=t.parseObjectValue(o["text-color"],r,"text-color",Ft),!a))return null;const l=i[i.length-1];l.scale=e,l.font=s,l.textColor=a}else{const o=t.parse(e[r],r,Vt);if(!o)return null;const s=o.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,i.push({content:o,scale:null,font:null,textColor:null})}}return new lr(i)}evaluate(e){return new Kt(this.sections.map((t=>{const r=t.content.evaluate(e);return rr(r)===$t?new Jt("",r,null,null,null):new Jt(ir(r),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null)})))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const t of this.sections){e.push(t.content.serialize());const r={};t.scale&&(r["font-scale"]=t.scale.serialize()),t.font&&(r["text-font"]=t.font.serialize()),t.textColor&&(r["text-color"]=t.textColor.serialize()),e.push(r)}return e}}class cr{constructor(e,t){this.type=$t,this.inputPrimary=e,this.inputSecondary=t}static parse(e,t){if(e.length<2)return t.error("Expected two or more arguments.");const r=t.parse(e[1],1,Lt);if(!r)return t.error("No image name provided.");if(2===e.length)return new cr(r);const i=t.parse(e[2],1,Lt);return i?new cr(r,i):t.error("Secondary image variant is not a string.")}evaluate(e){const t=Qt.fromString(this.inputPrimary.evaluate(e),this.inputSecondary?this.inputSecondary.evaluate(e):void 0);return t&&e.availableImages&&(t.available=e.availableImages.indexOf(t.namePrimary)>-1,t.nameSecondary&&t.available&&e.availableImages&&(t.available=e.availableImages.indexOf(t.nameSecondary)>-1)),t}eachChild(e){e(this.inputPrimary),this.inputSecondary&&e(this.inputSecondary)}outputDefined(){return!1}serialize(){return this.inputSecondary?["image",this.inputPrimary.serialize(),this.inputSecondary.serialize()]:["image",this.inputPrimary.serialize()]}}function ur(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}const hr={"to-boolean":Bt,"to-color":Ft,"to-number":Ot,"to-string":Lt};class dr{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const r=e[0],i=[];let n=kt;if("to-array"===r){if(!Array.isArray(e[1]))return null;const r=e[1].length;if(t.expectedType){if("array"!==t.expectedType.kind)return t.error(`Expected ${t.expectedType.kind} but found array.`);n=Gt(t.expectedType.itemType,r)}else{if(!(r>0&&tr(e[1][0])))return null;n=Gt(rr(e[1][0]),r)}for(let o=0;o<r;o++){const r=e[1][o];let s;if("array"===ur(r))s=t.parse(r,void 0,n.itemType);else{const e=ur(r);if(e!==n.itemType.kind)return t.error(`Expected ${n.itemType.kind} but found ${e}.`);s=t.registry.literal.parse(["literal",void 0===r?null:r],t)}if(!s)return null;i.push(s)}}else{if(("to-boolean"===r||"to-string"===r)&&2!==e.length)return t.error("Expected one argument.");n=hr[r];for(let r=1;r<e.length;r++){const n=t.parse(e[r],r,Vt);if(!n)return null;i.push(n)}}return new dr(n,i)}evaluate(e){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(e));if("color"===this.type.kind){let t,r;for(const i of this.args){if(t=i.evaluate(e),r=null,t instanceof Mt)return t;if("string"==typeof t){const r=e.parseColor(t);if(r)return r}else if(Array.isArray(t)&&(r=t.length<3||t.length>4?`Invalid rbga value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:er(t[0],t[1],t[2],t[3]),!r))return new Mt(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new or(r||`Could not parse color from value '${"string"==typeof t?t:String(JSON.stringify(t))}'`)}if("number"===this.type.kind){let t=null;for(const r of this.args){if(t=r.evaluate(e),null===t)return 0;const i=Number(t);if(!isNaN(i))return i}throw new or(`Could not convert ${JSON.stringify(t)} to number.`)}return"formatted"===this.type.kind?Kt.fromString(ir(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?Qt.fromString(ir(this.args[0].evaluate(e))):"array"===this.type.kind?this.args.map((t=>t.evaluate(e))):ir(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new lr([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new cr(this.args[0]).serialize();const e="array"===this.type.kind?[]:[`to-${this.type.kind}`];return this.eachChild((t=>{e.push(t.serialize())})),e}}const pr=["Unknown","Point","LineString","Polygon"];class fr{constructor(e,t){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=t}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?pr[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,t=this.featureDistanceData.scale,{x:r,y:i}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(r*t-e[0])+this.featureDistanceData.bearing[1]*(i*t-e[1])}return 0}parseColor(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=Mt.parse(e)),t}getConfig(e){return this.options?this.options.get(e):null}}class mr{constructor(e,t,r,i,n){this.name=e,this.type=t,this._evaluate=r,this.args=i,this._overloadIndex=n}evaluate(e){if(!this._evaluate){const e=mr.definitions[this.name];this._evaluate=Array.isArray(e)?e[2]:e.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((e=>e.serialize())))}static parse(e,t){const r=e[0],i=mr.definitions[r];if(!i)return t.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const n=Array.isArray(i)?i[0]:i.type,o=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,s=[];let a=null,l=-1;for(const[i,c]of o){if(Array.isArray(i)&&i.length!==e.length-1)continue;s.push(i),l++,a=new Oi(t.registry,t.path,null,t.scope,void 0,t._scope,t.options);const o=[];let u=!1;for(let t=1;t<e.length;t++){const r=e[t],n=Array.isArray(i)?i[t-1]:i.type,s=a.parse(r,1+o.length,n);if(!s){u=!0;break}o.push(s)}if(!u)if(Array.isArray(i)&&i.length!==o.length)a.error(`Expected ${i.length} arguments, but found ${o.length} instead.`);else{for(let e=0;e<o.length;e++){const t=Array.isArray(i)?i[e]:i.type,r=o[e];a.concat(e+1).checkSubtype(t,r.type)}if(0===a.errors.length)return new mr(r,n,c,o,l)}}if(1===s.length)t.errors.push(...a.errors);else{const r=(s.length?s:o.map((([e])=>e))).map(_r).join(" | "),i=[];for(let r=1;r<e.length;r++){const n=t.parse(e[r],1+i.length);if(!n)return null;i.push(qt(n.type))}t.error(`Expected arguments of type ${r}, but found (${i.join(", ")}) instead.`)}return null}static register(e,t){mr.definitions=t;for(const r in t)e[r]=mr}}function _r(e){return Array.isArray(e)?`(${e.map(qt).join(", ")})`:`(${qt(e.type)}...)`}class gr{constructor(e,t,r){this.type=jt,this.locale=r,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(2!==e.length)return t.error("Expected one argument.");const r=e[1];if("object"!=typeof r||Array.isArray(r))return t.error("Collator options argument must be an object.");const i=void 0===r["case-sensitive"]?t.parse(!1,1,Bt):t.parseObjectValue(r["case-sensitive"],1,"case-sensitive",Bt);if(!i)return null;const n=void 0===r["diacritic-sensitive"]?t.parse(!1,1,Bt):t.parseObjectValue(r["diacritic-sensitive"],1,"diacritic-sensitive",Bt);if(!n)return null;let o=null;return r.locale&&(o=t.parseObjectValue(r.locale,1,"locale",Lt),!o)?null:new gr(i,n,o)}evaluate(e){return new Yt(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}serialize(){const e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}function yr(e,t,r=0,i=e.length-1,n=vr){for(;i>r;){if(i-r>600){const o=i-r+1,s=t-r+1,a=Math.log(o),l=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1);yr(e,t,Math.max(r,Math.floor(t-s*l/o+c)),Math.min(i,Math.floor(t+(o-s)*l/o+c)),n)}const o=e[t];let s=r,a=i;for(xr(e,r,t),n(e[i],o)>0&&xr(e,r,i);s<a;){for(xr(e,s,a),s++,a--;n(e[s],o)<0;)s++;for(;n(e[a],o)>0;)a--}0===n(e[r],o)?xr(e,r,a):(a++,xr(e,a,i)),a<=t&&(r=a+1),t<=a&&(i=a-1)}}function xr(e,t,r){const i=e[t];e[t]=e[r],e[r]=i}function vr(e,t){return e<t?-1:e>t?1:0}function br(e){let t=0;for(let r,i,n=0,o=e.length,s=o-1;n<o;s=n++)r=e[n],i=e[s],t+=(i.x-r.x)*(r.y+i.y);return t}function wr(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Tr(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function Sr(e,t,r){const i=e[0]-t[0],n=e[1]-t[1],o=e[0]-r[0],s=e[1]-r[1];return i*s-o*n==0&&i*o<=0&&n*s<=0}function Er(e,t,r=!1){let i=!1;for(let a=0,l=t.length;a<l;a++){const l=t[a];for(let t=0,a=l.length,c=a-1;t<a;c=t++){const a=l[c],u=l[t];if(Sr(e,a,u))return r;(o=a)[1]>(n=e)[1]!=(s=u)[1]>n[1]&&n[0]<(s[0]-o[0])*(n[1]-o[1])/(s[1]-o[1])+o[0]&&(i=!i)}}var n,o,s;return i}function Mr(e,t,r,i){const n=i[0]-r[0],o=i[1]-r[1],s=(e[0]-r[0])*o-n*(e[1]-r[1]),a=(t[0]-r[0])*o-n*(t[1]-r[1]);return s>0&&a<0||s<0&&a>0}function Ar(e,t,r,i){return 0!=(n=[i[0]-r[0],i[1]-r[1]])[0]*(o=[t[0]-e[0],t[1]-e[1]])[1]-n[1]*o[0]&&!(!Mr(e,t,r,i)||!Mr(r,i,e,t));var n,o}const Cr=8192;function Ir(e,t){const r=(180+e[0])/360,i=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,n=Math.pow(2,t.z);return[Math.round(r*n*Cr),Math.round(i*n*Cr)]}function Pr(e,t){for(let r=0;r<t.length;r++)if(Er(e,t[r]))return!0;return!1}function Rr(e,t,r){for(const i of r)for(let r=0,n=i.length,o=n-1;r<n;o=r++)if(Ar(e,t,i[o],i[r]))return!0;return!1}function zr(e,t){for(let r=0;r<e.length;++r)if(!Er(e[r],t))return!1;for(let r=0;r<e.length-1;++r)if(Rr(e[r],e[r+1],t))return!1;return!0}function Dr(e,t){for(let r=0;r<t.length;r++)if(zr(e,t[r]))return!0;return!1}function kr(e,t,r){const i=[];for(let n=0;n<e.length;n++){const o=[];for(let i=0;i<e[n].length;i++){const s=Ir(e[n][i],r);wr(t,s),o.push(s)}i.push(o)}return i}function Or(e,t,r){const i=[];for(let n=0;n<e.length;n++){const o=kr(e[n],t,r);i.push(o)}return i}function Lr(e,t,r,i){if(e[0]<r[0]||e[0]>r[2]){const t=.5*i;let n=e[0]-r[0]>t?-i:r[0]-e[0]>t?i:0;0===n&&(n=e[0]-r[2]>t?-i:r[2]-e[0]>t?i:0),e[0]+=n}wr(t,e)}function Br(e,t,r,i){const n=Math.pow(2,i.z)*Cr,o=[i.x*Cr,i.y*Cr],s=[];if(!e)return s;for(const i of e)for(const e of i){const i=[e.x+o[0],e.y+o[1]];Lr(i,t,r,n),s.push(i)}return s}function Fr(e,t,r,i){const n=Math.pow(2,i.z)*Cr,o=[i.x*Cr,i.y*Cr],s=[];if(!e)return s;for(const r of e){const e=[];for(const i of r){const r=[i.x+o[0],i.y+o[1]];wr(t,r),e.push(r)}s.push(e)}if(t[2]-t[0]<=n/2){(a=t)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const e of s)for(const i of e)Lr(i,t,r,n)}var a;return s}class Nr{constructor(e,t){this.type=Bt,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(tr(e[1])){const t=e[1];if("FeatureCollection"===t.type)for(let e=0;e<t.features.length;++e){const r=t.features[e].geometry.type;if("Polygon"===r||"MultiPolygon"===r)return new Nr(t,t.features[e].geometry)}else if("Feature"===t.type){const e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new Nr(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new Nr(t,t)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(!n)return!1;if("Polygon"===t.type){const o=kr(t.coordinates,i,n),s=Br(e.geometry(),r,i,n);if(!Tr(r,i))return!1;for(const e of s)if(!Er(e,o))return!1}if("MultiPolygon"===t.type){const o=Or(t.coordinates,i,n),s=Br(e.geometry(),r,i,n);if(!Tr(r,i))return!1;for(const e of s)if(!Pr(e,o))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(!n)return!1;if("Polygon"===t.type){const o=kr(t.coordinates,i,n),s=Fr(e.geometry(),r,i,n);if(!Tr(r,i))return!1;for(const e of s)if(!zr(e,o))return!1}if("MultiPolygon"===t.type){const o=Or(t.coordinates,i,n),s=Fr(e.geometry(),r,i,n);if(!Tr(r,i))return!1;for(const e of s)if(!Dr(e,o))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const Vr={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},jr=1/298.257223563,Ur=jr*(2-jr),$r=Math.PI/180;class Gr{static fromTile(e,t,r){const i=Math.PI*(1-2*(e+.5)/Math.pow(2,t)),n=Math.atan(.5*(Math.exp(i)-Math.exp(-i)))/$r;return new Gr(n,r)}static get units(){return Vr}constructor(e,t){if(void 0===e)throw new Error("No latitude given.");if(t&&!Vr[t])throw new Error(`Unknown unit ${t}. Use one of: ${Object.keys(Vr).join(", ")}`);const r=6378.137*$r*(t?Vr[t]:1),i=Math.cos(e*$r),n=1/(1-Ur*(1-i*i)),o=Math.sqrt(n);this.kx=r*o*i,this.ky=r*o*n*(1-Ur)}distance(e,t){const r=Wr(e[0]-t[0])*this.kx,i=(e[1]-t[1])*this.ky;return Math.sqrt(r*r+i*i)}bearing(e,t){const r=Wr(t[0]-e[0])*this.kx;return Math.atan2(r,(t[1]-e[1])*this.ky)/$r}destination(e,t,r){const i=r*$r;return this.offset(e,Math.sin(i)*t,Math.cos(i)*t)}offset(e,t,r){return[e[0]+t/this.kx,e[1]+r/this.ky]}lineDistance(e){let t=0;for(let r=0;r<e.length-1;r++)t+=this.distance(e[r],e[r+1]);return t}area(e){let t=0;for(let r=0;r<e.length;r++){const i=e[r];for(let e=0,n=i.length,o=n-1;e<n;o=e++)t+=Wr(i[e][0]-i[o][0])*(i[e][1]+i[o][1])*(r?-1:1)}return Math.abs(t)/2*this.kx*this.ky}along(e,t){let r=0;if(t<=0)return e[0];for(let i=0;i<e.length-1;i++){const n=e[i],o=e[i+1],s=this.distance(n,o);if(r+=s,r>t)return Hr(n,o,(t-(r-s))/s)}return e[e.length-1]}pointToSegmentDistance(e,t,r){let[i,n]=t,o=Wr(r[0]-i)*this.kx,s=(r[1]-n)*this.ky;if(0!==o||0!==s){const t=(Wr(e[0]-i)*this.kx*o+(e[1]-n)*this.ky*s)/(o*o+s*s);t>1?(i=r[0],n=r[1]):t>0&&(i+=o/this.kx*t,n+=s/this.ky*t)}return o=Wr(e[0]-i)*this.kx,s=(e[1]-n)*this.ky,Math.sqrt(o*o+s*s)}pointOnLine(e,t){let r=1/0,i=e[0][0],n=e[0][1],o=0,s=0;for(let a=0;a<e.length-1;a++){let l=e[a][0],c=e[a][1],u=Wr(e[a+1][0]-l)*this.kx,h=(e[a+1][1]-c)*this.ky,d=0;0===u&&0===h||(d=(Wr(t[0]-l)*this.kx*u+(t[1]-c)*this.ky*h)/(u*u+h*h),d>1?(l=e[a+1][0],c=e[a+1][1]):d>0&&(l+=u/this.kx*d,c+=h/this.ky*d)),u=Wr(t[0]-l)*this.kx,h=(t[1]-c)*this.ky;const p=u*u+h*h;p<r&&(r=p,i=l,n=c,o=a,s=d)}return{point:[i,n],index:o,t:Math.max(0,Math.min(1,s))}}lineSlice(e,t,r){let i=this.pointOnLine(r,e),n=this.pointOnLine(r,t);if(i.index>n.index||i.index===n.index&&i.t>n.t){const e=i;i=n,n=e}const o=[i.point],s=i.index+1,a=n.index;!qr(r[s],o[0])&&s<=a&&o.push(r[s]);for(let e=s+1;e<=a;e++)o.push(r[e]);return qr(r[a],n.point)||o.push(n.point),o}lineSliceAlong(e,t,r){let i=0;const n=[];for(let o=0;o<r.length-1;o++){const s=r[o],a=r[o+1],l=this.distance(s,a);if(i+=l,i>e&&0===n.length&&n.push(Hr(s,a,(e-(i-l))/l)),i>=t)return n.push(Hr(s,a,(t-(i-l))/l)),n;i>e&&n.push(a)}return n}bufferPoint(e,t){const r=t/this.ky,i=t/this.kx;return[e[0]-i,e[1]-r,e[0]+i,e[1]+r]}bufferBBox(e,t){const r=t/this.ky,i=t/this.kx;return[e[0]-i,e[1]-r,e[2]+i,e[3]+r]}insideBBox(e,t){return Wr(e[0]-t[0])>=0&&Wr(e[0]-t[2])<=0&&e[1]>=t[1]&&e[1]<=t[3]}}function qr(e,t){return e[0]===t[0]&&e[1]===t[1]}function Hr(e,t,r){const i=Wr(t[0]-e[0]);return[e[0]+i*r,e[1]+(t[1]-e[1])*r]}function Wr(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}class Zr{constructor(e=[],t=(e,t)=>e<t?-1:e>t?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:r}=this,i=t[e];for(;e>0;){const n=e-1>>1,o=t[n];if(r(i,o)>=0)break;t[e]=o,e=n}t[e]=i}_down(e){const{data:t,compare:r}=this,i=this.length>>1,n=t[e];for(;e<i;){let i=1+(e<<1);const o=i+1;if(o<this.length&&r(t[o],t[i])<0&&(i=o),r(t[i],n)>=0)break;t[e]=t[i],e=i}t[e]=n}}var Xr=8192;function Yr(e,t){return t.dist-e.dist}const Jr=100,Kr=50;function Qr(e){const t=[1/0,1/0,-1/0,-1/0];if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function ei(e){return e[1]-e[0]+1}function ti(e,t){const r=e[1]>=e[0]&&e[1]<t;return r||console.warn("Distance Expression: Index is out of range"),r}function ri(e,t){if(e[0]>e[1])return[null,null];const r=ei(e);if(t){if(2===r)return[e,null];const t=Math.floor(r/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}{if(1===r)return[e,null];const t=Math.floor(r/2)-1;return[[e[0],e[0]+t],[e[0]+t+1,e[1]]]}}function ii(e,t){const r=[1/0,1/0,-1/0,-1/0];if(!ti(t,e.length))return r;for(let i=t[0];i<=t[1];++i)wr(r,e[i]);return r}function ni(e){const t=[1/0,1/0,-1/0,-1/0];for(let r=0;r<e.length;++r)for(let i=0;i<e[r].length;++i)wr(t,e[r][i]);return t}function oi(e,t,r){if(Qr(e)||Qr(t))return NaN;let i=0,n=0;return e[2]<t[0]&&(i=t[0]-e[2]),e[0]>t[2]&&(i=e[0]-t[2]),e[1]>t[3]&&(n=e[1]-t[3]),e[3]<t[1]&&(n=t[1]-e[3]),r.distance([0,0],[i,n])}function si(e){return 360*e-180}function ai(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function li(e,t){const r=Math.pow(2,t.z),i=(e.y/Xr+t.y)/r;return[si((e.x/Xr+t.x)/r),ai(i)]}function ci(e,t){const r=[];for(let i=0;i<e.length;++i)r.push(li(e[i],t));return r}function ui(e,t,r){const i=r.pointOnLine(t,e).point;return r.distance(e,i)}function hi(e,t,r,i,n){const o=r.slice(i[0],i[1]+1);let s=1/0;for(let r=t[0];r<=t[1];++r)if(0===(s=Math.min(s,ui(e[r],o,n))))return 0;return s}function di(e,t,r,i,n){const o=Math.min(n.pointToSegmentDistance(e,r,i),n.pointToSegmentDistance(t,r,i)),s=Math.min(n.pointToSegmentDistance(r,e,t),n.pointToSegmentDistance(i,e,t));return Math.min(o,s)}function pi(e,t,r,i,n){if(!ti(t,e.length)||!ti(i,r.length))return NaN;let o=1/0;for(let s=t[0];s<t[1];++s)for(let t=i[0];t<i[1];++t){if(Ar(e[s],e[s+1],r[t],r[t+1]))return 0;o=Math.min(o,di(e[s],e[s+1],r[t],r[t+1],n))}return o}function fi(e,t,r,i,n){if(!ti(t,e.length)||!ti(i,r.length))return NaN;let o=1/0;for(let s=t[0];s<=t[1];++s)for(let t=i[0];t<=i[1];++t)if(0===(o=Math.min(o,n.distance(e[s],r[t]))))return o;return o}function mi(e,t,r){if(Er(e,t,!0))return 0;let i=1/0;for(const n of t){const t=n.length;if(t<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(n[0]!==n[t-1]&&0===(i=Math.min(i,r.pointToSegmentDistance(e,n[t-1],n[0]))))return i;if(0===(i=Math.min(i,ui(e,n,r))))return i}return i}function _i(e,t,r,i){if(!ti(t,e.length))return NaN;for(let i=t[0];i<=t[1];++i)if(Er(e[i],r,!0))return 0;let n=1/0;for(let o=t[0];o<t[1];++o)for(const t of r)for(let r=0,s=t.length,a=s-1;r<s;a=r++){if(Ar(e[o],e[o+1],t[a],t[r]))return 0;n=Math.min(n,di(e[o],e[o+1],t[a],t[r],i))}return n}function gi(e,t){for(const r of e)for(let e=0;e<=r.length-1;++e)if(Er(r[e],t,!0))return!0;return!1}function yi(e,t,r,i=1/0){const n=ni(e),o=ni(t);if(i!==1/0&&oi(n,o,r)>=i)return i;if(Tr(n,o)){if(gi(e,t))return 0}else if(gi(t,e))return 0;let s=i;for(const i of e)for(let e=0,n=i.length,o=n-1;e<n;o=e++)for(const n of t)for(let t=0,a=n.length,l=a-1;t<a;l=t++){if(Ar(i[o],i[e],n[l],n[t]))return 0;s=Math.min(s,di(i[o],i[e],n[l],n[t],r))}return s}function xi(e,t,r,i,n,o,s){if(null===o||null===s)return;const a=oi(ii(i,o),ii(n,s),r);a<t&&e.push({dist:a,range1:o,range2:s})}function vi(e,t,r,i,n=1/0){let o=Math.min(i.distance(e[0],r[0][0]),n);if(0===o)return o;const s=new Zr([{dist:0,range1:[0,e.length-1],range2:[0,0]}],Yr),a=t?Kr:Jr,l=ni(r);for(;s.length;){const n=s.pop();if(n.dist>=o)continue;const c=n.range1;if(ei(c)<=a){if(!ti(c,e.length))return NaN;if(t){const t=_i(e,c,r,i);if(0===(o=Math.min(o,t)))return o}else for(let t=c[0];t<=c[1];++t){const n=mi(e[t],r,i);if(0===(o=Math.min(o,n)))return o}}else{const r=ri(c,t);if(null!==r[0]){const t=oi(ii(e,r[0]),l,i);t<o&&s.push({dist:t,range1:r[0],range2:[0,0]})}if(null!==r[1]){const t=oi(ii(e,r[1]),l,i);t<o&&s.push({dist:t,range1:r[1],range2:[0,0]})}}}return o}function bi(e,t,r,i,n,o=1/0){let s=Math.min(o,n.distance(e[0],r[0]));if(0===s)return s;const a=new Zr([{dist:0,range1:[0,e.length-1],range2:[0,r.length-1]}],Yr),l=t?Kr:Jr,c=i?Kr:Jr;for(;a.length;){const o=a.pop();if(o.dist>=s)continue;const u=o.range1,h=o.range2;if(ei(u)<=l&&ei(h)<=c){if(!ti(u,e.length)||!ti(h,r.length))return NaN;if(t&&i?s=Math.min(s,pi(e,u,r,h,n)):t||i?t&&!i?s=Math.min(s,hi(r,h,e,u,n)):!t&&i&&(s=Math.min(s,hi(e,u,r,h,n))):s=Math.min(s,fi(e,u,r,h,n)),0===s)return s}else{const o=ri(u,t),l=ri(h,i);xi(a,s,n,e,r,o[0],l[0]),xi(a,s,n,e,r,o[0],l[1]),xi(a,s,n,e,r,o[1],l[0]),xi(a,s,n,e,r,o[1],l[1])}}return s}function wi(e,t,r,i,n=1/0){let o=n;const s=ii(e,[0,e.length-1]);for(const n of r)if(!(o!==1/0&&oi(s,ii(n,[0,n.length-1]),i)>=o)&&(o=Math.min(o,bi(e,t,n,!0,i,o)),0===o))return o;return o}function Ti(e,t,r,i,n=1/0){let o=n;const s=ii(e,[0,e.length-1]);for(const n of r){if(o!==1/0&&oi(s,ni(n),i)>=o)continue;const r=vi(e,t,n,i,o);if(isNaN(r))return r;if(0===(o=Math.min(o,r)))return o}return o}function Si(e){return"Point"===e||"MultiPoint"===e||"LineString"===e||"MultiLineString"===e||"Polygon"===e||"MultiPolygon"===e}class Ei{constructor(e,t){this.type=Ot,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(tr(e[1])){const t=e[1];if("FeatureCollection"===t.type){for(let e=0;e<t.features.length;++e)if(Si(t.features[e].geometry.type))return new Ei(t,t.features[e].geometry)}else if("Feature"===t.type){if(Si(t.geometry.type))return new Ei(t,t.geometry)}else if(Si(t.type))return new Ei(t,t)}return t.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const t=e.geometry(),r=e.canonicalID();if(null!=t&&null!=r){if("Point"===e.geometryType())return function(e,t,r){const i=[];for(const r of e)for(const e of r)i.push(li(e,t));const n=new Gr(i[0][1],"meters");return"Point"===r.type||"MultiPoint"===r.type||"LineString"===r.type?bi(i,!1,"Point"===r.type?[r.coordinates]:r.coordinates,"LineString"===r.type,n):"MultiLineString"===r.type?wi(i,!1,r.coordinates,n):"Polygon"===r.type||"MultiPolygon"===r.type?Ti(i,!1,"Polygon"===r.type?[r.coordinates]:r.coordinates,n):null}(t,r,this.geometries);if("LineString"===e.geometryType())return function(e,t,r){const i=[];for(const r of e){const e=[];for(const i of r)e.push(li(i,t));i.push(e)}const n=new Gr(i[0][0][1],"meters");if("Point"===r.type||"MultiPoint"===r.type||"LineString"===r.type)return wi("Point"===r.type?[r.coordinates]:r.coordinates,"LineString"===r.type,i,n);if("MultiLineString"===r.type){let e=1/0;for(let t=0;t<r.coordinates.length;t++){const o=wi(r.coordinates[t],!0,i,n,e);if(isNaN(o))return o;if(0===(e=Math.min(e,o)))return e}return e}if("Polygon"===r.type||"MultiPolygon"===r.type){let e=1/0;for(let t=0;t<i.length;t++){const o=Ti(i[t],!0,"Polygon"===r.type?[r.coordinates]:r.coordinates,n,e);if(isNaN(o))return o;if(0===(e=Math.min(e,o)))return e}return e}return null}(t,r,this.geometries);if("Polygon"===e.geometryType())return function(e,t,r){const i=[];for(const r of function(e){const t=e.length;if(t<=1)return[e];const r=[];let i,n;for(let o=0;o<t;o++){const t=br(e[o]);0!==t&&(e[o].area=Math.abs(t),void 0===n&&(n=t<0),n===t<0?(i&&r.push(i),i=[e[o]]):i.push(e[o]))}return i&&r.push(i),r}(e)){const e=[];for(let i=0;i<r.length;++i)e.push(ci(r[i],t));i.push(e)}const n=new Gr(i[0][0][0][1],"meters");if("Point"===r.type||"MultiPoint"===r.type||"LineString"===r.type)return Ti("Point"===r.type?[r.coordinates]:r.coordinates,"LineString"===r.type,i,n);if("MultiLineString"===r.type){let e=1/0;for(let t=0;t<r.coordinates.length;t++){const o=Ti(r.coordinates[t],!0,i,n,e);if(isNaN(o))return o;if(0===(e=Math.min(e,o)))return e}return e}return"Polygon"===r.type||"MultiPolygon"===r.type?function(e,t,r){let i=1/0;for(const n of e)for(const e of t){const t=yi(n,e,r,i);if(isNaN(t))return t;if(0===(i=Math.min(i,t)))return i}return i}("Polygon"===r.type?[r.coordinates]:r.coordinates,i,n):null}(t,r,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requirs valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function Mi(e,t){switch(e){case"string":return ir(t);case"number":return+t;case"boolean":return!!t;case"color":return Mt.parse(t);case"formatted":return Kt.fromString(ir(t));case"resolvedImage":return Qt.fromString(ir(t))}return t}function Ai(e,t,r,i){return void 0!==i&&(e=i*Math.round(e/i)),void 0!==t&&e<t&&(e=t),void 0!==r&&e>r&&(e=r),e}class Ci{constructor(e,t,r){this.type=e,this.key=t,this.scope=r}static parse(e,t){let r=t.expectedType;if(null==r&&(r=Vt),e.length<2||e.length>3)return t.error("Invalid number of arguments for 'config' expression.");const i=t.parse(e[1],1);if(!(i instanceof nr))return t.error("Key name of 'config' expression must be a string literal.");if(e.length>=3){const n=t.parse(e[2],2);return n instanceof nr?new Ci(r,ir(i.value),ir(n.value)):t.error("Scope of 'config' expression must be a string literal.")}return new Ci(r,ir(i.value))}evaluate(e){const t=[this.key,this.scope,e.scope].filter(Boolean).join(""),r=e.getConfig(t);if(!r)return null;const{type:i,value:n,values:o,minValue:s,maxValue:a,stepValue:l}=r,c=r.default.evaluate(e);let u=c;if(n){const t=e.scope;e.scope=(t||"").split("").slice(1).join(""),u=n.evaluate(e),e.scope=t}return i&&(u=Mi(i,u)),void 0===u||void 0===s&&void 0===a&&void 0===l||("number"==typeof u?u=Ai(u,s,a,l):Array.isArray(u)&&(u=u.map((e=>"number"==typeof e?Ai(e,s,a,l):e)))),void 0!==n&&void 0!==u&&o&&!o.includes(u)&&(u=c,i&&(u=Mi(i,u))),(i&&i!==this.type||void 0!==u&&rr(u)!==this.type)&&(u=Mi(this.type.kind,u)),u}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.key),e}}function Ii(e){if(e instanceof mr){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof Nr)return!1;if(e instanceof Ei)return!1;let t=!0;return e.eachChild((e=>{t&&!Ii(e)&&(t=!1)})),t}function Pi(e){if(e instanceof mr&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild((e=>{t&&!Pi(e)&&(t=!1)})),t}function Ri(e){if(e instanceof Ci)return new Set([e.key]);let t=new Set;return e.eachChild((e=>{t=new Set([...t,...Ri(e)])})),t}function zi(e,t){if(e instanceof mr&&t.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild((e=>{r&&!zi(e,t)&&(r=!1)})),r}class Di{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("'var' expression requires exactly one string literal argument.");const r=e[1];return t.scope.has(r)?new Di(r,t.scope.get(r)):t.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class ki{constructor(e,t=[],r,i=new Dt,n=[],o,s){this.registry=e,this.path=t,this.key=t.map((e=>"string"==typeof e?`['${e}']`:`[${e}]`)).join(""),this.scope=i,this.errors=n,this.expectedType=r,this._scope=o,this.options=s}parse(e,t,r,i,n={}){return t||r?this.concat(t,null,r,i)._parse(e,n):this._parse(e,n)}parseObjectValue(e,t,r,i,n,o={}){return this.concat(t,r,i,n)._parse(e,o)}_parse(e,t){function r(e,t,r){return"assert"===r?new ar(t,[e]):"coerce"===r?new dr(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const i="string"==typeof e[0]?this.registry[e[0]]:void 0;if(i){let n=i.parse(e,this);if(!n)return null;if(this.expectedType){const e=this.expectedType,i=n.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==i.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==i.kind&&"string"!==i.kind){if(this.checkSubtype(e,i))return null}else n=r(n,e,t.typeAnnotation||"coerce");else n=r(n,e,t.typeAnnotation||"assert")}if(!(n instanceof nr)&&"resolvedImage"!==n.type.kind&&Li(n)){const t=new fr(this._scope,this.options);try{n=new nr(n.type,n.evaluate(t))}catch(e){return this.error(e.message),null}}return n}return dr.parse(["to-array",e],this)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,t,r,i){let n="number"==typeof e?this.path.concat(e):this.path;n="string"==typeof t?n.concat(t):n;const o=i?this.scope.concat(i):this.scope;return new ki(this.registry,n,r||null,o,this.errors,this._scope,this.options)}error(e,...t){const r=`${this.key}${t.map((e=>`[${e}]`)).join("")}`;this.errors.push(new zt(r,e))}checkSubtype(e,t){const r=Wt(e,t);return r&&this.error(r),r}}var Oi=ki;function Li(e){if(e instanceof Di)return Li(e.boundExpression);if(e instanceof mr&&"error"===e.name)return!1;if(e instanceof gr)return!1;if(e instanceof Nr)return!1;if(e instanceof Ei)return!1;if(e instanceof Ci)return!1;const t=e instanceof dr||e instanceof ar;let r=!0;return e.eachChild((e=>{r=t?r&&Li(e):r&&e instanceof nr})),!!r&&Ii(e)&&zi(e,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function Bi(e,t){const r=e.length-1;let i,n,o=0,s=r,a=0;for(;o<=s;)if(a=Math.floor((o+s)/2),i=e[a],n=e[a+1],i<=t){if(a===r||t<n)return a;o=a+1}else{if(!(i>t))throw new or("Input is not a number.");s=a-1}return 0}class Fi{constructor(e,t,r){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[e,t]of r)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const r=t.parse(e[1],1,Ot);if(!r)return null;const i=[];let n=null;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);for(let r=1;r<e.length;r+=2){const o=1===r?-1/0:e[r],s=e[r+1],a=r,l=r+1;if("number"!=typeof o)return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(i.length&&i[i.length-1][0]>=o)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=t.parse(s,l,n);if(!c)return null;n=n||c.type,i.push([o,c])}return new Fi(n,r,i)}evaluate(e){const t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);const i=this.input.evaluate(e);if(i<=t[0])return r[0].evaluate(e);const n=t.length;return i>=t[n-1]?r[n-1].evaluate(e):r[Bi(t,i)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}serialize(){const e=["step",this.input.serialize()];for(let t=0;t<this.labels.length;t++)t>0&&e.push(this.labels[t]),e.push(this.outputs[t].serialize());return e}}const Ni=.95047,Vi=1.08883,ji=4/29,Ui=6/29,$i=3*Ui*Ui,Gi=Ui*Ui*Ui,qi=Math.PI/180,Hi=180/Math.PI;function Wi(e){return e>Gi?Math.pow(e,1/3):e/$i+ji}function Zi(e){return e>Ui?e*e*e:$i*(e-ji)}function Xi(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Yi(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Ji(e){const t=Yi(e.r),r=Yi(e.g),i=Yi(e.b),n=Wi((.4124564*t+.3575761*r+.1804375*i)/Ni),o=Wi((.2126729*t+.7151522*r+.072175*i)/1);return{l:116*o-16,a:500*(n-o),b:200*(o-Wi((.0193339*t+.119192*r+.9503041*i)/Vi)),alpha:e.a}}function Ki(e){let t=(e.l+16)/116,r=isNaN(e.a)?t:t+e.a/500,i=isNaN(e.b)?t:t-e.b/200;return t=1*Zi(t),r=Ni*Zi(r),i=Vi*Zi(i),new Mt(Xi(3.2404542*r-1.5371385*t-.4985314*i),Xi(-.969266*r+1.8760108*t+.041556*i),Xi(.0556434*r-.2040259*t+1.0572252*i),e.alpha)}function Qi(e,t,r){const i=t-e;return e+r*(i>180||i<-180?i-360*Math.round(i/360):i)}const en={forward:Ji,reverse:Ki,interpolate:function(e,t,r){return{l:Ct(e.l,t.l,r),a:Ct(e.a,t.a,r),b:Ct(e.b,t.b,r),alpha:Ct(e.alpha,t.alpha,r)}}},tn={forward:function(e){const{l:t,a:r,b:i}=Ji(e),n=Math.atan2(i,r)*Hi;return{h:n<0?n+360:n,c:Math.sqrt(r*r+i*i),l:t,alpha:e.a}},reverse:function(e){const t=e.h*qi,r=e.c;return Ki({l:e.l,a:Math.cos(t)*r,b:Math.sin(t)*r,alpha:e.alpha})},interpolate:function(e,t,r){return{h:Qi(e.h,t.h,r),c:Ct(e.c,t.c,r),l:Ct(e.l,t.l,r),alpha:Ct(e.alpha,t.alpha,r)}}};var rn=Object.freeze({__proto__:null,hcl:tn,lab:en});class nn{constructor(e,t,r,i,n){this.type=e,this.operator=t,this.interpolation=r,this.input=i,this.labels=[],this.outputs=[];for(const[e,t]of n)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,r,i){let n=0;if("exponential"===e.name)n=on(t,e.base,r,i);else if("linear"===e.name)n=on(t,1,r,i);else if("cubic-bezier"===e.name){const o=e.controlPoints;n=new j(o[0],o[1],o[2],o[3]).solve(on(t,1,r,i))}return n}static parse(e,t){let[r,i,n,...o]=e;if(!Array.isArray(i)||0===i.length)return t.error("Expected an interpolation type expression.",1);if("linear"===i[0])i={name:"linear"};else if("exponential"===i[0]){const e=i[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:e}}else{if("cubic-bezier"!==i[0])return t.error(`Unknown interpolation type ${String(i[0])}`,1,0);{const e=i.slice(1);if(4!==e.length||e.some((e=>"number"!=typeof e||e<0||e>1)))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(n=t.parse(n,2,Ot),!n)return null;const s=[];let a=null;"interpolate-hcl"===r||"interpolate-lab"===r?a=Ft:t.expectedType&&"value"!==t.expectedType.kind&&(a=t.expectedType);for(let e=0;e<o.length;e+=2){const r=o[e],i=o[e+1],n=e+3,l=e+4;if("number"!=typeof r)return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',n);if(s.length&&s[s.length-1][0]>=r)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);const c=t.parse(i,l,a);if(!c)return null;a=a||c.type,s.push([r,c])}return"number"===a.kind||"color"===a.kind||"array"===a.kind&&"number"===a.itemType.kind&&"number"==typeof a.N?new nn(a,r,i,n,s):t.error(`Type ${qt(a)} is not interpolatable.`)}evaluate(e){const t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);const i=this.input.evaluate(e);if(i<=t[0])return r[0].evaluate(e);const n=t.length;if(i>=t[n-1])return r[n-1].evaluate(e);const o=Bi(t,i),s=nn.interpolationFactor(this.interpolation,i,t[o],t[o+1]),a=r[o].evaluate(e),l=r[o+1].evaluate(e);return"interpolate"===this.operator?Pt[this.type.kind.toLowerCase()](a,l,s):"interpolate-hcl"===this.operator?tn.reverse(tn.interpolate(tn.forward(a),tn.forward(l),s)):en.reverse(en.interpolate(en.forward(a),en.forward(l),s))}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}serialize(){let e;e="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const t=[this.operator,e,this.input.serialize()];for(let e=0;e<this.labels.length;e++)t.push(this.labels[e],this.outputs[e].serialize());return t}}function on(e,t,r,i){const n=i-r,o=e-r;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}class sn{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expectected at least one argument.");let r=null;const i=t.expectedType;i&&"value"!==i.kind&&(r=i);const n=[];for(const i of e.slice(1)){const e=t.parse(i,1+n.length,r,void 0,{typeAnnotation:"omit"});if(!e)return null;r=r||e.type,n.push(e)}const o=i&&n.some((e=>Wt(i,e.type)));return new sn(o?Vt:r,n)}evaluate(e){let t,r=null,i=0;for(const n of this.args){if(i++,r=n.evaluate(e),r&&r instanceof Qt&&!r.available&&(t||(t=r),r=null,i===this.args.length))return t;if(null!==r)break}return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}serialize(){const e=["coalesce"];return this.eachChild((t=>{e.push(t.serialize())})),e}}class an{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const r=[];for(let i=1;i<e.length-1;i+=2){const n=e[i];if("string"!=typeof n)return t.error(`Expected string, but found ${typeof n} instead.`,i);if(/[^a-zA-Z0-9_]/.test(n))return t.error("Variable names must contain only alphanumeric characters or '_'.",i);const o=t.parse(e[i+1],i+1);if(!o)return null;r.push([n,o])}const i=t.parse(e[e.length-1],e.length-1,t.expectedType,r);return i?new an(r,i):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[t,r]of this.bindings)e.push(t,r.serialize());return e.push(this.result.serialize()),e}}class ln{constructor(e,t,r){this.type=e,this.index=t,this.input=r}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,Ot),i=t.parse(e[2],2,Gt(t.expectedType||Vt));return r&&i?new ln(i.type.itemType,r,i):null}evaluate(e){const t=this.index.evaluate(e),r=this.input.evaluate(e);if(t<0)throw new or(`Array index out of bounds: ${t} < 0.`);if(t>r.length-1)throw new or(`Array index out of bounds: ${t} > ${r.length-1}.`);if(t===Math.floor(t))return r[t];const i=Math.floor(t),n=Math.ceil(t),o=r[i],s=r[n];if("number"!=typeof o||"number"!=typeof s)throw new or(`Cannot interpolate between non-number values at index ${t}.`);const a=t-i;return o*(1-a)+s*a}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class cn{constructor(e,t){this.type=Bt,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,Vt),i=t.parse(e[2],2,Vt);return r&&i?Zt(r.type,[Bt,Lt,Ot,kt,Vt])?new cn(r,i):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${qt(r.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(null==r)return!1;if(!Xt(t,["boolean","string","number","null"]))throw new or(`Expected first argument to be of type boolean, string, number or null, but found ${qt(rr(t))} instead.`);if(!Xt(r,["string","array"]))throw new or(`Expected second argument to be of type array or string, but found ${qt(rr(r))} instead.`);return r.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class un{constructor(e,t,r){this.type=Ot,this.needle=e,this.haystack=t,this.fromIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,Vt),i=t.parse(e[2],2,Vt);if(!r||!i)return null;if(!Zt(r.type,[Bt,Lt,Ot,kt,Vt]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${qt(r.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,Ot);return n?new un(r,i,n):null}return new un(r,i)}evaluate(e){const t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!Xt(t,["boolean","string","number","null"]))throw new or(`Expected first argument to be of type boolean, string, number or null, but found ${qt(rr(t))} instead.`);if(!Xt(r,["string","array"]))throw new or(`Expected second argument to be of type array or string, but found ${qt(rr(r))} instead.`);if(this.fromIndex){const i=this.fromIndex.evaluate(e);return r.indexOf(t,i)}return r.indexOf(t)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class hn{constructor(e,t,r,i,n,o){this.inputType=e,this.type=t,this.input=r,this.cases=i,this.outputs=n,this.otherwise=o}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let r,i;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);const n={},o=[];for(let s=2;s<e.length-1;s+=2){let a=e[s];const l=e[s+1];Array.isArray(a)||(a=[a]);const c=t.concat(s);if(0===a.length)return c.error("Expected at least one branch label.");for(const e of a){if("number"!=typeof e&&"string"!=typeof e)return c.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return c.error("Numeric branch labels must be integer values.");if(r){if(c.checkSubtype(r,rr(e)))return null}else r=rr(e);if(void 0!==n[String(e)])return c.error("Branch labels must be unique.");n[String(e)]=o.length}const u=t.parse(l,s,i);if(!u)return null;i=i||u.type,o.push(u)}const s=t.parse(e[1],1,Vt);if(!s)return null;const a=t.parse(e[e.length-1],e.length-1,i);return a?"value"!==s.type.kind&&t.concat(1).checkSubtype(r,s.type)?null:new hn(r,i,s,n,o,a):null}evaluate(e){const t=this.input.evaluate(e);return(rr(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],t=Object.keys(this.cases).sort(),r=[],i={};for(const e of t){const t=i[this.cases[e]];void 0===t?(i[this.cases[e]]=r.length,r.push([this.cases[e],[e]])):r[t][1].push(e)}const n=e=>"number"===this.inputType.kind?Number(e):e;for(const[t,i]of r)e.push(1===i.length?n(i[0]):i.map(n)),e.push(this.outputs[t].serialize());return e.push(this.otherwise.serialize()),e}}class dn{constructor(e,t,r){this.type=e,this.branches=t,this.otherwise=r}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error("Expected an odd number of arguments.");let r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);const i=[];for(let n=1;n<e.length-1;n+=2){const o=t.parse(e[n],n,Bt);if(!o)return null;const s=t.parse(e[n+1],n+1,r);if(!s)return null;i.push([o,s]),r=r||s.type}const n=t.parse(e[e.length-1],e.length-1,r);return n?new dn(r,i,n):null}evaluate(e){for(const[t,r]of this.branches)if(t.evaluate(e))return r.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,r]of this.branches)e(t),e(r);e(this.otherwise)}outputDefined(){return this.branches.every((([e,t])=>t.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild((t=>{e.push(t.serialize())})),e}}class pn{constructor(e,t,r,i){this.type=e,this.input=t,this.beginIndex=r,this.endIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,Vt),i=t.parse(e[2],2,Ot);if(!r||!i)return null;if(!Zt(r.type,[Gt(Vt),Lt,Vt]))return t.error(`Expected first argument to be of type array or string, but found ${qt(r.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,Ot);return n?new pn(r.type,r,i,n):null}return new pn(r.type,r,i)}evaluate(e){const t=this.input.evaluate(e),r=this.beginIndex.evaluate(e);if(!Xt(t,["string","array"]))throw new or(`Expected first argument to be of type array or string, but found ${qt(rr(t))} instead.`);if(this.endIndex){const i=this.endIndex.evaluate(e);return t.slice(r,i)}return t.slice(r)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function fn(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function mn(e,t,r,i){return 0===i.compare(t,r)}function _n(e,t,r){const i="=="!==e&&"!="!==e;return class n{constructor(e,t,r){this.type=Bt,this.lhs=e,this.rhs=t,this.collator=r,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const r=e[0];let o=t.parse(e[1],1,Vt);if(!o)return null;if(!fn(r,o.type))return t.concat(1).error(`"${r}" comparisons are not supported for type '${qt(o.type)}'.`);let s=t.parse(e[2],2,Vt);if(!s)return null;if(!fn(r,s.type))return t.concat(2).error(`"${r}" comparisons are not supported for type '${qt(s.type)}'.`);if(o.type.kind!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return t.error(`Cannot compare types '${qt(o.type)}' and '${qt(s.type)}'.`);i&&("value"===o.type.kind&&"value"!==s.type.kind?o=new ar(s.type,[o]):"value"!==o.type.kind&&"value"===s.type.kind&&(s=new ar(o.type,[s])));let a=null;if(4===e.length){if("string"!==o.type.kind&&"string"!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return t.error("Cannot use collator to compare non-string types.");if(a=t.parse(e[3],3,jt),!a)return null}return new n(o,s,a)}evaluate(n){const o=this.lhs.evaluate(n),s=this.rhs.evaluate(n);if(i&&this.hasUntypedArgument){const t=rr(o),r=rr(s);if(t.kind!==r.kind||"string"!==t.kind&&"number"!==t.kind)throw new or(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${r.kind}) instead.`)}if(this.collator&&!i&&this.hasUntypedArgument){const e=rr(o),r=rr(s);if("string"!==e.kind||"string"!==r.kind)return t(n,o,s)}return this.collator?r(n,o,s,this.collator.evaluate(n)):t(n,o,s)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}serialize(){const t=[e];return this.eachChild((e=>{t.push(e.serialize())})),t}}}const gn=_n("==",(function(e,t,r){return t===r}),mn),yn=_n("!=",(function(e,t,r){return t!==r}),(function(e,t,r,i){return!mn(0,t,r,i)})),xn=_n("<",(function(e,t,r){return t<r}),(function(e,t,r,i){return i.compare(t,r)<0})),vn=_n(">",(function(e,t,r){return t>r}),(function(e,t,r,i){return i.compare(t,r)>0})),bn=_n("<=",(function(e,t,r){return t<=r}),(function(e,t,r,i){return i.compare(t,r)<=0})),wn=_n(">=",(function(e,t,r){return t>=r}),(function(e,t,r,i){return i.compare(t,r)>=0}));class Tn{constructor(e,t,r,i,n,o){this.type=Lt,this.number=e,this.locale=t,this.currency=r,this.unit=i,this.minFractionDigits=n,this.maxFractionDigits=o}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const r=t.parse(e[1],1,Ot);if(!r)return null;const i=e[2];if("object"!=typeof i||Array.isArray(i))return t.error("NumberFormat options argument must be an object.");let n=null;if(i.locale&&(n=t.parseObjectValue(i.locale,2,"locale",Lt),!n))return null;let o=null;if(i.currency&&(o=t.parseObjectValue(i.currency,2,"currency",Lt),!o))return null;let s=null;if(i.unit&&(s=t.parseObjectValue(i.unit,2,"unit",Lt),!s))return null;let a=null;if(i["min-fraction-digits"]&&(a=t.parseObjectValue(i["min-fraction-digits"],2,"min-fraction-digits",Ot),!a))return null;let l=null;return i["max-fraction-digits"]&&(l=t.parseObjectValue(i["max-fraction-digits"],2,"max-fraction-digits",Ot),!l)?null:new Tn(r,n,o,s,a,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class Sn{constructor(e){this.type=Ot,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const r=t.parse(e[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?t.error(`Expected argument of type string or array, but found ${qt(r.type)} instead.`):new Sn(r):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return t.length;if(Array.isArray(t))return t.length;throw new or(`Expected value to be of type string or array, but found ${qt(rr(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild((t=>{e.push(t.serialize())})),e}}function En(e){return function(){e=1831565813+(e|=0)|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}const Mn={"==":gn,"!=":yn,">":vn,"<":xn,">=":wn,"<=":bn,array:ar,at:ln,boolean:ar,case:dn,coalesce:sn,collator:gr,format:lr,image:cr,in:cn,"index-of":un,interpolate:nn,"interpolate-hcl":nn,"interpolate-lab":nn,length:Sn,let:an,literal:nr,match:hn,number:ar,"number-format":Tn,object:ar,slice:pn,step:Fi,string:ar,"to-boolean":dr,"to-color":dr,"to-number":dr,"to-string":dr,var:Di,within:Nr,distance:Ei,config:Ci};function An(e,[t,r,i,n]){t=t.evaluate(e),r=r.evaluate(e),i=i.evaluate(e);const o=n?n.evaluate(e):1,s=er(t,r,i,o);if(s)throw new or(s);return new Mt(t/255*o,r/255*o,i/255*o,o)}function Cn(e,[t,r,i,n]){t=t.evaluate(e),r=r.evaluate(e),i=i.evaluate(e);const o=n?n.evaluate(e):1,s=function(e,t,r,i){return"number"==typeof e&&e>=0&&e<=360?"number"==typeof t&&t>=0&&t<=100&&"number"==typeof r&&r>=0&&r<=100?void 0===i||"number"==typeof i&&i>=0&&i<=1?null:`Invalid hsla value [${[e,t,r,i].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${("number"==typeof i?[e,t,r,i]:[e,t,r]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${("number"==typeof i?[e,t,r,i]:[e,t,r]).join(", ")}]: 'h' must be between 0 and 360.`}(t,r,i,o);if(s)throw new or(s);const a=`hsla(${t}, ${r}%, ${i}%, ${o})`,l=Mt.parse(a);if(!l)throw new or(`Failed to parse HSLA color: ${a}`);return l}function In(e,t){return e in t}function Pn(e,t){const r=t[e];return void 0===r?null:r}function Rn(e){return{type:e}}function zn(e){return{result:"success",value:e}}function Dn(e){return{result:"error",value:e}}function kn(e,t){return!!e&&!!e.parameters&&e.parameters.indexOf(t)>-1}function On(e){return"data-driven"===e["property-type"]}function Ln(e){return kn(e.expression,"measure-light")}function Bn(e){return kn(e.expression,"zoom")}function Fn(e){return!!e.expression&&e.expression.interpolated}function Nn(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Vn(e){return e}function jn(e,t){const r="color"===t.type,i=e.stops&&"object"==typeof e.stops[0][0],n=i||!(i||void 0!==e.property),o=e.type||(Fn(t)?"exponential":"interval");if(r&&((e=Rt({},e)).stops&&(e.stops=e.stops.map((e=>[e[0],Mt.parse(e[1])]))),e.default=Mt.parse(e.default?e.default:t.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!rn[e.colorSpace])throw new Error(`Unknown color space: ${e.colorSpace}`);let s,a,l;if("exponential"===o)s=qn;else if("interval"===o)s=Gn;else if("categorical"===o){s=$n,a=Object.create(null);for(const t of e.stops)a[t[0]]=t[1];l=typeof e.stops[0][0]}else{if("identity"!==o)throw new Error(`Unknown function type "${o}"`);s=Hn}if(i){const r={},i=[];for(let t=0;t<e.stops.length;t++){const n=e.stops[t],o=n[0].zoom;void 0===r[o]&&(r[o]={zoom:o,type:e.type,property:e.property,default:e.default,stops:[]},i.push(o)),r[o].stops.push([n[0].value,n[1]])}const n=[];for(const e of i)n.push([r[e].zoom,jn(r[e],t)]);const o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:nn.interpolationFactor.bind(void 0,o),zoomStops:n.map((e=>e[0])),evaluate:({zoom:r},i)=>qn({stops:n,base:e.base},t,r).evaluate(r,i)}}if(n){const r="exponential"===o?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:r,interpolationFactor:nn.interpolationFactor.bind(void 0,r),zoomStops:e.stops.map((e=>e[0])),evaluate:({zoom:r})=>s(e,t,r,a,l)}}return{kind:"source",evaluate(r,i){const n=i&&i.properties?i.properties[e.property]:void 0;return void 0===n?Un(e.default,t.default):s(e,t,n,a,l)}}}function Un(e,t,r){return void 0!==e?e:void 0!==t?t:void 0!==r?r:void 0}function $n(e,t,r,i,n){return Un(typeof r===n?i[r]:void 0,e.default,t.default)}function Gn(e,t,r){if("number"!==ur(r))return Un(e.default,t.default);const i=e.stops.length;if(1===i)return e.stops[0][1];if(r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[i-1][0])return e.stops[i-1][1];const n=Bi(e.stops.map((e=>e[0])),r);return e.stops[n][1]}function qn(e,t,r){const i=void 0!==e.base?e.base:1;if("number"!==ur(r))return Un(e.default,t.default);const n=e.stops.length;if(1===n)return e.stops[0][1];if(r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[n-1][0])return e.stops[n-1][1];const o=Bi(e.stops.map((e=>e[0])),r),s=function(e,t,r,i){const n=i-r,o=e-r;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}(r,i,e.stops[o][0],e.stops[o+1][0]),a=e.stops[o][1],l=e.stops[o+1][1];let c=Pt[t.type]||Vn;if(e.colorSpace&&"rgb"!==e.colorSpace){const t=rn[e.colorSpace];c=(e,r)=>t.reverse(t.interpolate(t.forward(e),t.forward(r),s))}return"function"==typeof a.evaluate?{evaluate(...e){const t=a.evaluate.apply(void 0,e),r=l.evaluate.apply(void 0,e);if(void 0!==t&&void 0!==r)return c(t,r,s)}}:c(a,l,s)}function Hn(e,t,r){return"color"===t.type?r=Mt.parse(r):"formatted"===t.type?r=Kt.fromString(r.toString()):"resolvedImage"===t.type?r=Qt.fromString(r.toString()):ur(r)===t.type||"enum"===t.type&&t.values[r]||(r=void 0),Un(r,e.default,t.default)}mr.register(Mn,{error:[{kind:"error"},[Lt],(e,[t])=>{throw new or(t.evaluate(e))}],typeof:[Lt,[Vt],(e,[t])=>qt(rr(t.evaluate(e)))],"to-rgba":[Gt(Ot,4),[Ft],(e,[t])=>t.evaluate(e).toRenderColor(null).toArray()],rgb:[Ft,[Ot,Ot,Ot],An],rgba:[Ft,[Ot,Ot,Ot,Ot],An],hsl:[Ft,[Ot,Ot,Ot],Cn],hsla:[Ft,[Ot,Ot,Ot,Ot],Cn],has:{type:Bt,overloads:[[[Lt],(e,[t])=>In(t.evaluate(e),e.properties())],[[Lt,Nt],(e,[t,r])=>In(t.evaluate(e),r.evaluate(e))]]},get:{type:Vt,overloads:[[[Lt],(e,[t])=>Pn(t.evaluate(e),e.properties())],[[Lt,Nt],(e,[t,r])=>Pn(t.evaluate(e),r.evaluate(e))]]},"feature-state":[Vt,[Lt],(e,[t])=>Pn(t.evaluate(e),e.featureState||{})],properties:[Nt,[],e=>e.properties()],"geometry-type":[Lt,[],e=>e.geometryType()],id:[Vt,[],e=>e.id()],zoom:[Ot,[],e=>e.globals.zoom],pitch:[Ot,[],e=>e.globals.pitch||0],"distance-from-center":[Ot,[],e=>e.distanceFromCenter()],"measure-light":[Ot,[Lt],(e,[t])=>e.measureLight(t.evaluate(e))],"heatmap-density":[Ot,[],e=>e.globals.heatmapDensity||0],"line-progress":[Ot,[],e=>e.globals.lineProgress||0],"raster-value":[Ot,[],e=>e.globals.rasterValue||0],"raster-particle-speed":[Ot,[],e=>e.globals.rasterParticleSpeed||0],"sky-radial-progress":[Ot,[],e=>e.globals.skyRadialProgress||0],accumulated:[Vt,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[Ot,Rn(Ot),(e,t)=>{let r=0;for(const i of t)r+=i.evaluate(e);return r}],"*":[Ot,Rn(Ot),(e,t)=>{let r=1;for(const i of t)r*=i.evaluate(e);return r}],"-":{type:Ot,overloads:[[[Ot,Ot],(e,[t,r])=>t.evaluate(e)-r.evaluate(e)],[[Ot],(e,[t])=>-t.evaluate(e)]]},"/":[Ot,[Ot,Ot],(e,[t,r])=>t.evaluate(e)/r.evaluate(e)],"%":[Ot,[Ot,Ot],(e,[t,r])=>t.evaluate(e)%r.evaluate(e)],ln2:[Ot,[],()=>Math.LN2],pi:[Ot,[],()=>Math.PI],e:[Ot,[],()=>Math.E],"^":[Ot,[Ot,Ot],(e,[t,r])=>Math.pow(t.evaluate(e),r.evaluate(e))],sqrt:[Ot,[Ot],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[Ot,[Ot],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[Ot,[Ot],(e,[t])=>Math.log(t.evaluate(e))],log2:[Ot,[Ot],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[Ot,[Ot],(e,[t])=>Math.sin(t.evaluate(e))],cos:[Ot,[Ot],(e,[t])=>Math.cos(t.evaluate(e))],tan:[Ot,[Ot],(e,[t])=>Math.tan(t.evaluate(e))],asin:[Ot,[Ot],(e,[t])=>Math.asin(t.evaluate(e))],acos:[Ot,[Ot],(e,[t])=>Math.acos(t.evaluate(e))],atan:[Ot,[Ot],(e,[t])=>Math.atan(t.evaluate(e))],min:[Ot,Rn(Ot),(e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],max:[Ot,Rn(Ot),(e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],abs:[Ot,[Ot],(e,[t])=>Math.abs(t.evaluate(e))],round:[Ot,[Ot],(e,[t])=>{const r=t.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ot,[Ot],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[Ot,[Ot],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[Bt,[Lt,Vt],(e,[t,r])=>e.properties()[t.value]===r.value],"filter-id-==":[Bt,[Vt],(e,[t])=>e.id()===t.value],"filter-type-==":[Bt,[Lt],(e,[t])=>e.geometryType()===t.value],"filter-<":[Bt,[Lt,Vt],(e,[t,r])=>{const i=e.properties()[t.value],n=r.value;return typeof i==typeof n&&i<n}],"filter-id-<":[Bt,[Vt],(e,[t])=>{const r=e.id(),i=t.value;return typeof r==typeof i&&r<i}],"filter->":[Bt,[Lt,Vt],(e,[t,r])=>{const i=e.properties()[t.value],n=r.value;return typeof i==typeof n&&i>n}],"filter-id->":[Bt,[Vt],(e,[t])=>{const r=e.id(),i=t.value;return typeof r==typeof i&&r>i}],"filter-<=":[Bt,[Lt,Vt],(e,[t,r])=>{const i=e.properties()[t.value],n=r.value;return typeof i==typeof n&&i<=n}],"filter-id-<=":[Bt,[Vt],(e,[t])=>{const r=e.id(),i=t.value;return typeof r==typeof i&&r<=i}],"filter->=":[Bt,[Lt,Vt],(e,[t,r])=>{const i=e.properties()[t.value],n=r.value;return typeof i==typeof n&&i>=n}],"filter-id->=":[Bt,[Vt],(e,[t])=>{const r=e.id(),i=t.value;return typeof r==typeof i&&r>=i}],"filter-has":[Bt,[Vt],(e,[t])=>t.value in e.properties()],"filter-has-id":[Bt,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[Bt,[Gt(Lt)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[Bt,[Gt(Vt)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[Bt,[Lt,Gt(Vt)],(e,[t,r])=>r.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[Bt,[Lt,Gt(Vt)],(e,[t,r])=>function(e,t,r,i){for(;r<=i;){const n=r+i>>1;if(t[n]===e)return!0;t[n]>e?i=n-1:r=n+1}return!1}(e.properties()[t.value],r.value,0,r.value.length-1)],all:{type:Bt,overloads:[[[Bt,Bt],(e,[t,r])=>t.evaluate(e)&&r.evaluate(e)],[Rn(Bt),(e,t)=>{for(const r of t)if(!r.evaluate(e))return!1;return!0}]]},any:{type:Bt,overloads:[[[Bt,Bt],(e,[t,r])=>t.evaluate(e)||r.evaluate(e)],[Rn(Bt),(e,t)=>{for(const r of t)if(r.evaluate(e))return!0;return!1}]]},"!":[Bt,[Bt],(e,[t])=>!t.evaluate(e)],"is-supported-script":[Bt,[Lt],(e,[t])=>{const r=e.globals&&e.globals.isSupportedScript;return!r||r(t.evaluate(e))}],upcase:[Lt,[Lt],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[Lt,[Lt],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[Lt,Rn(Vt),(e,t)=>t.map((t=>ir(t.evaluate(e)))).join("")],"resolved-locale":[Lt,[jt],(e,[t])=>t.evaluate(e).resolvedLocale()],random:[Ot,[Ot,Ot,Vt],(e,t)=>{const[r,i,n]=t.map((t=>t.evaluate(e)));if(r>i)return r;if(r===i)return r;let o;if("string"==typeof n)o=function(e){let t=0;if(0===e.length)return t;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return t}(n);else{if("number"!=typeof n)throw new or(`Invalid seed input: ${n}`);o=n}return r+En(o)()*(i-r)}]});class Wn{constructor(e,t,r,i){this.expression=e,this._warningHistory={},this._evaluator=new fr(r,i),this._defaultValue=t?function(e){return"color"===e.type&&(Nn(e.default)||Array.isArray(e.default))?new Mt(0,0,0,0):"color"===e.type?Mt.parse(e.default)||null:void 0===e.default?null:e.default}(t):null,this._enumValues=t&&"enum"===t.type?t.values:null,this.configDependencies=Ri(e)}evaluateWithoutErrorHandling(e,t,r,i,n,o,s,a){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=r,this._evaluator.canonical=i||null,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this._evaluator.featureTileCoord=s||null,this._evaluator.featureDistanceData=a||null,this.expression.evaluate(this._evaluator)}evaluate(e,t,r,i,n,o,s,a){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=r||null,this._evaluator.canonical=i||null,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||null,this._evaluator.featureTileCoord=s||null,this._evaluator.featureDistanceData=a||null;try{const e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new or(`Expected value to be one of ${Object.keys(this._enumValues).map((e=>JSON.stringify(e))).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${e.message}`)),this._defaultValue}}}function Zn(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in Mn}function Xn(e,t,r,i){const n=new Oi(Mn,[],t?function(e){const t={color:Ft,string:Lt,number:Ot,enum:Lt,boolean:Bt,formatted:Ut,resolvedImage:$t};return"array"===e.type?Gt(t[e.value]||Vt,e.length):t[e.type]}(t):void 0,void 0,void 0,r,i),o=n.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return o?zn(new Wn(o,t,r,i)):Dn(n.errors)}class Yn{constructor(e,t,r){this.kind=e,this._styleExpression=t,this.isLightConstant=r,this.isStateDependent="constant"!==e&&!Pi(t.expression),this.configDependencies=Ri(t.expression)}evaluateWithoutErrorHandling(e,t,r,i,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,r,i,n,o)}evaluate(e,t,r,i,n,o){return this._styleExpression.evaluate(e,t,r,i,n,o)}}class Jn{constructor(e,t,r,i,n){this.kind=e,this.zoomStops=r,this._styleExpression=t,this.isStateDependent="camera"!==e&&!Pi(t.expression),this.isLightConstant=n,this.configDependencies=Ri(t.expression),this.interpolationType=i}evaluateWithoutErrorHandling(e,t,r,i,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,r,i,n,o)}evaluate(e,t,r,i,n,o){return this._styleExpression.evaluate(e,t,r,i,n,o)}interpolationFactor(e,t,r){return this.interpolationType?nn.interpolationFactor(this.interpolationType,e,t,r):0}}function Kn(e,t,r,i){if("error"===(e=Xn(e,t,r,i)).result)return e;const n=e.value.expression,o=Ii(n);if(!o&&!On(t))return Dn([new zt("","data expressions not supported")]);const s=zi(n,["zoom","pitch","distance-from-center"]);if(!s&&!Bn(t))return Dn([new zt("","zoom expressions not supported")]);const a=zi(n,["measure-light"]);if(!a&&!Ln(t))return Dn([new zt("","measure-light expression not supported")]);const l=zi(n,["line-progress"]);if(!l&&!function(e){return kn(e.expression,"line-progress")}(t))return Dn([new zt("","line-progress expression not supported")]);const c=t.expression&&t.expression.relaxZoomRestriction,u=eo(n);return u||s||c?u instanceof zt?Dn([u]):u instanceof nn&&!Fn(t)?Dn([new zt("",'"interpolate" expressions cannot be used with this property')]):zn(u?new Jn(o&&l?"camera":"composite",e.value,u.labels,u instanceof nn?u.interpolation:void 0,a):new Yn(o&&l?"constant":"source",e.value,a)):Dn([new zt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Qn{constructor(e,t){this._parameters=e,this._specification=t,Rt(this,jn(this._parameters,this._specification))}static deserialize(e){return new Qn(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function eo(e){let t=null;if(e instanceof an)t=eo(e.result);else if(e instanceof sn){for(const r of e.args)if(t=eo(r),t)break}else(e instanceof Fi||e instanceof nn)&&e.input instanceof mr&&"zoom"===e.input.name&&(t=e);return t instanceof zt||e.eachChild((e=>{const r=eo(e);r instanceof zt?t=r:t&&r&&t!==r&&(t=new zt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}var to,ro,io=function(){if(ro)return to;ro=1,to=t;var e=3;function t(t,r,i){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var o=new Int32Array(this.arrayBuffer);t=o[0],this.d=(r=o[1])+2*(i=o[2]);for(var s=0;s<this.d*this.d;s++){var a=o[e+s],l=o[e+s+1];n.push(a===l?null:o.subarray(a,l))}var c=o[e+n.length+1];this.keys=o.subarray(o[e+n.length],c),this.bboxes=o.subarray(c),this.insert=this._insertReadonly}else{this.d=r+2*i;for(var u=0;u<this.d*this.d;u++)n.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=i,this.scale=r/t,this.uid=0;var h=i/r*t;this.min=-h,this.max=t+h}return t.prototype.insert=function(e,t,r,i,n){this._forEachCell(t,r,i,n,this._insertCell,this.uid++),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(n)},t.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},t.prototype._insertCell=function(e,t,r,i,n,o){this.cells[n].push(o)},t.prototype.query=function(e,t,r,i,n){var o=this.min,s=this.max;if(e<=o&&t<=o&&s<=r&&s<=i&&!n)return Array.prototype.slice.call(this.keys);var a=[];return this._forEachCell(e,t,r,i,this._queryCell,a,{},n),a},t.prototype._queryCell=function(e,t,r,i,n,o,s,a){var l=this.cells[n];if(null!==l)for(var c=this.keys,u=this.bboxes,h=0;h<l.length;h++){var d=l[h];if(void 0===s[d]){var p=4*d;(a?a(u[p+0],u[p+1],u[p+2],u[p+3]):e<=u[p+2]&&t<=u[p+3]&&r>=u[p+0]&&i>=u[p+1])?(s[d]=!0,o.push(c[d])):s[d]=!1}}},t.prototype._forEachCell=function(e,t,r,i,n,o,s,a){for(var l=this._convertToCellCoord(e),c=this._convertToCellCoord(t),u=this._convertToCellCoord(r),h=this._convertToCellCoord(i),d=l;d<=u;d++)for(var p=c;p<=h;p++){var f=this.d*p+d;if((!a||a(this._convertFromCellCoord(d),this._convertFromCellCoord(p),this._convertFromCellCoord(d+1),this._convertFromCellCoord(p+1)))&&n.call(this,e,t,r,i,f,o,s,a))return}},t.prototype._convertFromCellCoord=function(e){return(e-this.padding)/this.scale},t.prototype._convertToCellCoord=function(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))},t.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,r=e+this.cells.length+1+1,i=0,n=0;n<this.cells.length;n++)i+=this.cells[n].length;var o=new Int32Array(r+i+this.keys.length+this.bboxes.length);o[0]=this.extent,o[1]=this.n,o[2]=this.padding;for(var s=r,a=0;a<t.length;a++){var l=t[a];o[e+a]=s,o.set(l,s),s+=l.length}return o[e+t.length]=s,o.set(this.keys,s),o[e+t.length+1]=s+=this.keys.length,o.set(this.bboxes,s),s+=this.bboxes.length,o.buffer},to}(),no=t(io);const oo={};function so(e,t,r={}){Object.defineProperty(e,"_classRegistryKey",{value:t,writable:!1}),oo[t]={klass:e,omit:r.omit||[]}}so(Object,"Object"),no.serialize=function(e,t){const r=e.toArrayBuffer();return t&&t.add(r),{buffer:r}},no.deserialize=function(e){return new no(e.buffer)},Object.defineProperty(no,"name",{value:"Grid"}),so(no,"Grid"),so(Mt,"Color"),so(Error,"Error"),so(Kt,"Formatted"),so(Jt,"FormattedSection"),so(tt,"AJAXError"),so(Qt,"ResolvedImage"),so(Qn,"StylePropertyFunction"),so(Wn,"StyleExpression",{omit:["_evaluator"]}),so(Jn,"ZoomDependentExpression"),so(Yn,"ZoomConstantExpression"),so(mr,"CompoundExpression",{omit:["_evaluate"]});for(const e in Mn)oo[Mn[e]._classRegistryKey]||so(Mn[e],`Expression${e}`);function ao(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function lo(e){return self.ImageBitmap&&e instanceof ImageBitmap}function co(e,t){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp)return e;if(ao(e)||lo(e))return t&&t.add(e),e;if(ArrayBuffer.isView(e)){const r=e;return t&&t.add(r.buffer),r}if(e instanceof ImageData)return t&&t.add(e.data.buffer),e;if(Array.isArray(e)){const r=[];for(const i of e)r.push(co(i,t));return r}if(e instanceof Map){const t={$name:"Map"};for(const[r,i]of e.entries())t[r]=co(i);return t}if(e instanceof Set){const t={$name:"Set"};let r=0;for(const i of e.values())t[++r]=co(i);return t}if("object"==typeof e){const r=e.constructor,i=r._classRegistryKey;if(!i)throw new Error(`can't serialize object of unregistered class ${i}`);const n=r.serialize?r.serialize(e,t):{};if(!r.serialize){for(const r in e)e.hasOwnProperty(r)&&(oo[i].omit.indexOf(r)>=0||(n[r]=co(e[r],t)));e instanceof Error&&(n.message=e.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==i&&(n.$name=i),n}throw new Error("can't serialize object of type "+typeof e)}function uo(e){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||ao(e)||lo(e)||ArrayBuffer.isView(e)||e instanceof ImageData)return e;if(Array.isArray(e))return e.map(uo);if("object"==typeof e){const t=e.$name||"Object";if("Map"===t){const t=new Map;for(const r of Object.keys(e))"$name"!==r&&t.set(r,uo(e[r]));return t}if("Set"===t){const t=new Set;for(const r of Object.keys(e))"$name"!==r&&t.add(uo(e[r]));return t}const{klass:r}=oo[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(e);const i=Object.create(r.prototype);for(const t of Object.keys(e))"$name"!==t&&(i[t]=uo(e[t]));return i}throw new Error("can't deserialize object of type "+typeof e)}const ho={"Latin-1 Supplement":e=>e>=128&&e<=255,Arabic:e=>e>=1536&&e<=1791,"Arabic Supplement":e=>e>=1872&&e<=1919,"Arabic Extended-A":e=>e>=2208&&e<=2303,"Hangul Jamo":e=>e>=4352&&e<=4607,"Unified Canadian Aboriginal Syllabics":e=>e>=5120&&e<=5759,Khmer:e=>e>=6016&&e<=6143,"Unified Canadian Aboriginal Syllabics Extended":e=>e>=6320&&e<=6399,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"CJK Radicals Supplement":e=>e>=11904&&e<=12031,"Kangxi Radicals":e=>e>=12032&&e<=12255,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Bopomofo:e=>e>=12544&&e<=12591,"Hangul Compatibility Jamo":e=>e>=12592&&e<=12687,Kanbun:e=>e>=12688&&e<=12703,"Bopomofo Extended":e=>e>=12704&&e<=12735,"CJK Strokes":e=>e>=12736&&e<=12783,"Katakana Phonetic Extensions":e=>e>=12784&&e<=12799,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"CJK Unified Ideographs Extension A":e=>e>=13312&&e<=19903,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Yi Syllables":e=>e>=40960&&e<=42127,"Yi Radicals":e=>e>=42128&&e<=42191,"Hangul Jamo Extended-A":e=>e>=43360&&e<=43391,"Hangul Syllables":e=>e>=44032&&e<=55215,"Hangul Jamo Extended-B":e=>e>=55216&&e<=55295,"Private Use Area":e=>e>=57344&&e<=63743,"CJK Compatibility Ideographs":e=>e>=63744&&e<=64255,"Arabic Presentation Forms-A":e=>e>=64336&&e<=65023,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Arabic Presentation Forms-B":e=>e>=65136&&e<=65279,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519,Osage:e=>e>=66736&&e<=66815,"CJK Unified Ideographs Extension B":e=>e>=131072&&e<=173791};function po(e){for(const t of e)if(_o(t.charCodeAt(0)))return!0;return!1}function fo(e){for(const t of e)if(!mo(t.charCodeAt(0)))return!1;return!0}function mo(e){return!(ho.Arabic(e)||ho["Arabic Supplement"](e)||ho["Arabic Extended-A"](e)||ho["Arabic Presentation Forms-A"](e)||ho["Arabic Presentation Forms-B"](e))}function _o(e){return!(746!==e&&747!==e&&(e<4352||!(ho["Bopomofo Extended"](e)||ho.Bopomofo(e)||ho["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||ho["CJK Compatibility Ideographs"](e)||ho["CJK Compatibility"](e)||ho["CJK Radicals Supplement"](e)||ho["CJK Strokes"](e)||!(!ho["CJK Symbols and Punctuation"](e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||ho["CJK Unified Ideographs Extension A"](e)||ho["CJK Unified Ideographs"](e)||ho["Enclosed CJK Letters and Months"](e)||ho["Hangul Compatibility Jamo"](e)||ho["Hangul Jamo Extended-A"](e)||ho["Hangul Jamo Extended-B"](e)||ho["Hangul Jamo"](e)||ho["Hangul Syllables"](e)||ho.Hiragana(e)||ho["Ideographic Description Characters"](e)||ho.Kanbun(e)||ho["Kangxi Radicals"](e)||ho["Katakana Phonetic Extensions"](e)||ho.Katakana(e)&&12540!==e||!(!ho["Halfwidth and Fullwidth Forms"](e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)||!(!ho["Small Form Variants"](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||ho["Unified Canadian Aboriginal Syllabics"](e)||ho["Unified Canadian Aboriginal Syllabics Extended"](e)||ho["Vertical Forms"](e)||ho["Yijing Hexagram Symbols"](e)||ho["Yi Syllables"](e)||ho["Yi Radicals"](e))))}function go(e){return!(_o(e)||function(e){return!!(ho["Latin-1 Supplement"](e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||ho["General Punctuation"](e)&&(8214===e||8224===e||8225===e||8240===e||8241===e||8251===e||8252===e||8258===e||8263===e||8264===e||8265===e||8273===e)||ho["Letterlike Symbols"](e)||ho["Number Forms"](e)||ho["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||9003===e||e>=9085&&e<=9114||e>=9150&&e<=9165||9167===e||e>=9169&&e<=9179||e>=9186&&e<=9215)||ho["Control Pictures"](e)&&9251!==e||ho["Optical Character Recognition"](e)||ho["Enclosed Alphanumerics"](e)||ho["Geometric Shapes"](e)||ho["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||ho["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||ho["CJK Symbols and Punctuation"](e)||ho.Katakana(e)||ho["Private Use Area"](e)||ho["CJK Compatibility Forms"](e)||ho["Small Form Variants"](e)||ho["Halfwidth and Fullwidth Forms"](e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}(e))}function yo(e){return e>=1424&&e<=2303||ho["Arabic Presentation Forms-A"](e)||ho["Arabic Presentation Forms-B"](e)}function xo(e,t){return!(!t&&yo(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||ho.Khmer(e))}function vo(e){for(const t of e)if(yo(t.charCodeAt(0)))return!0;return!1}const bo="deferred",wo="loading",To="loaded";let So=null,Eo="unavailable",Mo=null;const Ao=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(Eo="error"),So&&So(e)};function Co(){Io.fire(new yt("pluginStateChange",{pluginStatus:Eo,pluginURL:Mo}))}const Io=new wt,Po=function(){return Eo},Ro=function(){if(Eo!==bo||!Mo)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Eo=wo,Co(),Mo&&nt({url:Mo},(e=>{e?Ao(e):(Eo=To,Co())}))},zo={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Eo===To||null!=zo.applyArabicShaping,isLoading:()=>Eo===wo,setState(e){Eo=e.pluginStatus,Mo=e.pluginURL},isParsed:()=>null!=zo.applyArabicShaping&&null!=zo.processBidirectionalText&&null!=zo.processStyledBidirectionalText,getPluginURL:()=>Mo};class Do{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.transition=t.transition,this.pitch=t.pitch,this.brightness=t.brightness):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(e,t){for(const r of e)if(!xo(r.charCodeAt(0),t))return!1;return!0}(e,zo.isLoaded())}}class ko{constructor(e,t,r,i){this.property=e,this.value=t,this.expression=function(e,t,r,i){if(Nn(e))return new Qn(e,t);if(Zn(e)||Array.isArray(e)&&e.length>0){const n=Kn(e,t,r,i);if("error"===n.result)throw new Error(n.value.map((e=>`${e.key}: ${e.message}`)).join(", "));return n.value}{let r=e;return"string"==typeof e&&"color"===t.type&&(r=Mt.parse(e)),{kind:"constant",configDependencies:new Set,evaluate:()=>r}}}(void 0===t?e.specification.default:t,e.specification,r,i)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,t,r){return this.property.possiblyEvaluate(this,e,t,r)}}class Oo{constructor(e,t,r){this.property=e,this.value=new ko(e,void 0,t,r)}transitioned(e,t){return new Bo(this.property,this.value,t,ie({},e.transition,this.transition),e.now)}untransitioned(){return new Bo(this.property,this.value,null,{},0)}}class Lo{constructor(e,t,r){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=t,this._options=r,this.configDependencies=new Set}getValue(e){return he(this._values[e].value.value)}setValue(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new Oo(this._values[e].property,this._scope,this._options)),this._values[e].value=new ko(this._values[e].property,null===t?void 0:he(t),this._scope,this._options),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]))}setTransitionOrValue(e,t){t&&(this._options=t);const r=this._properties.properties;if(e)for(const t in e){const i=e[t];if(le(t,"-transition")){const e=t.slice(0,-11);r[e]&&this.setTransition(e,i)}else r.hasOwnProperty(t)&&this.setValue(t,i)}}getTransition(e){return he(this._values[e].transition)}setTransition(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new Oo(this._values[e].property)),this._values[e].transition=he(t)||void 0}serialize(){const e={};for(const t of Object.keys(this._values)){const r=this.getValue(t);void 0!==r&&(e[t]=r);const i=this.getTransition(t);void 0!==i&&(e[`${t}-transition`]=i)}return e}transitioned(e,t){const r=new Fo(this._properties);for(const i of Object.keys(this._values))r._values[i]=this._values[i].transitioned(e,t._values[i]);return r}untransitioned(){const e=new Fo(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class Bo{constructor(e,t,r,i,n){const o=i.delay||0,s=i.duration||0;n=n||0,this.property=e,this.value=t,this.begin=n+o,this.end=this.begin+s,e.specification.transition&&(i.delay||i.duration)&&(this.prior=r)}possiblyEvaluate(e,t,r){const i=e.now||0,n=this.value.possiblyEvaluate(e,t,r),o=this.prior;if(o){if(i>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(i<this.begin)return o.possiblyEvaluate(e,t,r);{const s=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(e,t,r),n,Y(s))}}return n}}class Fo{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,r){const i=new jo(this._properties);for(const n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(e,t,r);return i}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class No{constructor(e,t,r){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=t,this._options=r,this.configDependencies=new Set}getValue(e){return he(this._values[e].value)}setValue(e,t){this._values[e]=new ko(this._values[e].property,null===t?void 0:he(t),this._scope,this._options),this._values[e].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].expression.configDependencies]))}serialize(){const e={};for(const t of Object.keys(this._values)){const r=this.getValue(t);void 0!==r&&(e[t]=r)}return e}possiblyEvaluate(e,t,r){const i=new jo(this._properties);for(const n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(e,t,r);return i}}class Vo{constructor(e,t,r){this.property=e,this.value=t,this.parameters=r}isConstant(){return"constant"===this.value.kind}constantOr(e){return"constant"===this.value.kind?this.value.value:e}evaluate(e,t,r,i){return this.property.evaluate(this.value,this.parameters,e,t,r,i)}}class jo{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Uo{constructor(e){this.specification=e}possiblyEvaluate(e,t){return e.expression.evaluate(t)}interpolate(e,t,r){const i=Pt[this.specification.type];return i?i(e,t,r):e}}class $o{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,r,i){return new Vo(this,"constant"===e.expression.kind||"camera"===e.expression.kind?{kind:"constant",value:e.expression.evaluate(t,null,{},r,i)}:e.expression,t)}interpolate(e,t,r){if("constant"!==e.value.kind||"constant"!==t.value.kind)return e;if(void 0===e.value.value||void 0===t.value.value)return new Vo(this,{kind:"constant",value:void 0},e.parameters);const i=Pt[this.specification.type];return i?new Vo(this,{kind:"constant",value:i(e.value.value,t.value.value,r)},e.parameters):e}evaluate(e,t,r,i,n,o){return"constant"===e.kind?e.value:e.evaluate(t,r,i,n,o)}}class Go{constructor(e){this.specification=e}possiblyEvaluate(e,t,r,i){return!!e.expression.evaluate(t,null,{},r,i)}interpolate(){return!1}}class qo{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const t=new Do(0,{});for(const r in e){const i=e[r];i.specification.overridable&&this.overridableProperties.push(r);const n=this.defaultPropertyValues[r]=new ko(i,void 0),o=this.defaultTransitionablePropertyValues[r]=new Oo(i);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=n.possiblyEvaluate(t)}}}so($o,"DataDrivenProperty"),so(Uo,"DataConstantProperty"),so(Go,"ColorRampProperty");var Ho=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"required":false,"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"imports":{"type":"array","value":"import"},"schema":{"type":"schema"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"experimental":true,"type":"featuresets"}},"featuresets":{"experimental":true,"*":{"type":"featureset"}},"featureset":{"experimental":true,"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"experimental":true,"layer":{"type":"string","required":true},"properties":{"type":"selectorProperty","required":false},"featureNamespace":{"type":"string","required":false}},"selectorProperty":{"experimental":true,"*":{"type":"*"}},"model":{"type":"string","required":true},"import":{"id":{"type":"string","required":true},"url":{"type":"string","required":true},"config":{"type":"config"},"data":{"type":"$root"}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","property-type":"data-constant","expression":{},"required":true},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string","required":true},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false,"property-type":"data-constant"},"shadow-intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_ambient":{"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"experimental":true,"type":{"required":true,"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":1}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":1}},"url":{"required":false,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_model":{"type":{"required":true,"type":"enum","values":{"model":1,"batched-model":1}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"raster-particle":{"experimental":true},"hillshade":{},"model":{"experimental":true},"background":{},"sky":{},"slot":{},"clip":{}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{},"property-type":"data-constant","experimental":true},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{},"property-type":"data-constant","experimental":true}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"fill-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"default":"none","experimental":true,"private":true,"expression":{},"property-type":"data-constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"fill-extrusion-edge-radius":{"type":"number","experimental":true,"default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","experimental":true,"default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","experimental":true,"expression":{},"property-type":"data-constant"},"line-cross-slope":{"type":"number","experimental":true,"expression":{},"property-type":"constant"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","experimental":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"experimental":true,"private":true,"expression":{},"property-type":"data-constant"},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"experimental":true,"private":true,"expression":{},"property-type":"data-constant"},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"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":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"opacity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","property-type":"data-constant","default":0,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"centerThinning":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,90],"minimum":0,"maximum":360,"length":2,"value":"number","property-type":"data-constant","transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"rain":{"density":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"opacity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","property-type":"data-constant","default":0,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"centerThinning":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","property-type":"data-constant","transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective","property-type":"data-constant"}},"colorTheme":{"data":{"type":"string","property-type":"data-constant","expression":{}}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","experimental":true,"values":{"terrain":1,"flat":1},"default":"flat","property-type":"data-constant"},"fill-extrusion-base-alignment":{"type":"enum","experimental":true,"values":{"terrain":1,"flat":1},"default":"terrain","property-type":"data-constant"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"property-type":"data-constant","type":"number","experimental":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"property-type":"data-constant","type":"number","experimental":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"property-type":"data-constant","type":"number","experimental":true,"default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"property-type":"data-constant","type":"color","experimental":true,"default":"#ffffff","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"property-type":"data-constant","type":"number","experimental":true,"default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","experimental":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","experimental":true,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"property-type":"data-constant","type":"number","experimental":true,"default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"property-type":"data-constant","type":"number","experimental":true,"default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"property-type":"data-constant","type":"boolean","default":true,"experimental":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true,"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","expression":{"interpolated":true,"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],"property-type":"constant"},"line-trim-fade-range":{"type":"array","value":"number","experimental":true,"length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-trim-color":{"type":"color","experimental":true,"default":"transparent","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-border-width":{"type":"number","private":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","private":true,"default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"property-type":"data-constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-image-cross-fade":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"transition":true},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-value"]},"property-type":"color-ramp"},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"raster-array-band":{"type":"string","required":false,"experimental":true,"property-type":"data-constant"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string","required":false,"property-type":"data-constant"},"raster-particle-count":{"type":"number","default":512,"minimum":1,"property-type":"data-constant"},"raster-particle-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-particle-speed"]},"property-type":"color-ramp"},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1,"property-type":"data-constant"},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1,"property-type":"data-constant"},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]},"property-type":"data-constant"},"background-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d","property-type":"data-constant"},"model-cast-shadows":{"type":"boolean","default":true,"property-type":"data-constant"},"model-receive-shadows":{"type":"boolean","default":true,"property-type":"data-constant"},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant","transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"model-front-cutoff":{"type":"array","private":true,"value":"number","property-type":"data-constant","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"property-type":{"data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');function Wo(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Zo(e){if(Array.isArray(e))return e.map(Zo);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const r in e)t[r]=Zo(e[r]);return t}return Wo(e)}function Xo(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!Xo(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}function Yo(e,t="",r=null,i="fill"){if(null==e)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Xo(e)||(e=is(e));const n=e;let o=!0;try{o=function(e){if(!Qo(e))return e;let t=Zo(e);return Ko(t),t=Jo(t),t}(n)}catch(e){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n${JSON.stringify(n,null,2)}\n `)}let s=null,a=null;if("background"!==i&&"sky"!==i&&"slot"!==i){a=Ho[`filter_${i}`];const e=Xn(o,a,t,r);if("error"===e.result)throw new Error(e.value.map((e=>`${e.key}: ${e.message}`)).join(", "));s=(t,r,i)=>e.value.evaluate(t,r,{},i)}let l=null,c=null;if(o!==n){const e=Xn(n,a,t,r);if("error"===e.result)throw new Error(e.value.map((e=>`${e.key}: ${e.message}`)).join(", "));l=(t,r,i,n,o)=>e.value.evaluate(t,r,{},i,void 0,void 0,n,o),c=!Ii(e.value.expression)}return{filter:s,dynamicFilter:l||void 0,needGeometry:rs(o),needFeature:!!c}}function Jo(e){if(!Array.isArray(e))return e;const t=function(e){if(es.has(e[0]))for(let t=1;t<e.length;t++)if(Qo(e[t]))return!0;return e}(e);return!0===t?t:t.map((e=>Jo(e)))}function Ko(e){let t=!1;const r=[];if("case"===e[0]){for(let i=1;i<e.length-1;i+=2)t=t||Qo(e[i]),r.push(e[i+1]);r.push(e[e.length-1])}else if("match"===e[0]){t=t||Qo(e[1]);for(let t=2;t<e.length-1;t+=2)r.push(e[t+1]);r.push(e[e.length-1])}else if("step"===e[0]){t=t||Qo(e[1]);for(let t=1;t<e.length-1;t+=2)r.push(e[t+1])}t&&(e.length=0,e.push("any",...r));for(let t=1;t<e.length;t++)Ko(e[t])}function Qo(e){if(!Array.isArray(e))return!1;if("pitch"===(t=e[0])||"distance-from-center"===t)return!0;var t;for(let t=1;t<e.length;t++)if(Qo(e[t]))return!0;return!1}const es=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function ts(e,t){return e<t?-1:e>t?1:0}function rs(e){if(!Array.isArray(e))return!1;if("within"===e[0]||"distance"===e[0])return!0;for(let t=1;t<e.length;t++)if(rs(e[t]))return!0;return!1}function is(e){if(!e)return!0;const t=e[0];return e.length<=1?"any"!==t:"=="===t?ns(e[1],e[2],"=="):"!="===t?as(ns(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?ns(e[1],e[2],t):"any"===t?(r=e.slice(1),["any"].concat(r.map(is))):"all"===t?["all"].concat(e.slice(1).map(is)):"none"===t?["all"].concat(e.slice(1).map(is).map(as)):"in"===t?os(e[1],e.slice(2)):"!in"===t?as(os(e[1],e.slice(2))):"has"===t?ss(e[1]):"!has"!==t||as(ss(e[1]));var r}function ns(e,t,r){switch(e){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,e,t]}}function os(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some((e=>typeof e!=typeof t[0]))?["filter-in-large",e,["literal",t.sort(ts)]]:["filter-in-small",e,["literal",t]]}}function ss(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function as(e){return["!",e]}const ls="";function cs(e,t){return t?`${e}${ls}${t}`:e}const us="-transition",hs=new Set(["fill","line","background","hillshade","raster"]);class ds extends wt{constructor(e,t,r,i,n){if(super(),this.id=e.id,this.fqid=cs(this.id,r),this.type=e.type,this.scope=r,this.lut=i,this.options=n,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.configDependencies=new Set,"custom"!==e.type){if(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&"background"!==e.type&&"sky"!==e.type&&"slot"!==e.type){this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter;const t=Xn(this.filter,Ho[`filter_${e.type}`]);"error"!==t.result&&(this.configDependencies=new Set([...this.configDependencies,...t.value.configDependencies]))}if(e.slot&&(this.slot=e.slot),t.layout&&(this._unevaluatedLayout=new No(t.layout,this.scope,n),this.configDependencies=new Set([...this.configDependencies,...this._unevaluatedLayout.configDependencies])),t.paint){this._transitionablePaint=new Lo(t.paint,this.scope,n);for(const t in e.paint)this.setPaintProperty(t,e.paint[t]);for(const t in e.layout)this.setLayoutProperty(t,e.layout[t]);this.configDependencies=new Set([...this.configDependencies,...this._transitionablePaint.configDependencies]),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new jo(t.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D()&&hs.has(this.type)}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t){if("custom"===this.type&&"visibility"===e)return void(this.visibility=t);const r=this._unevaluatedLayout;r._properties.properties[e]&&(r.setValue(e,t),this.configDependencies=new Set([...this.configDependencies,...r.configDependencies]),"visibility"===e&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return le(e,us)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t){const r=this._transitionablePaint,i=r._properties.properties;if(le(e,us)){const n=e.slice(0,-11);return i[n]&&r.setTransition(n,t||void 0),!1}if(!i[e])return!1;const n=r._values[e],o=n.value.isDataDriven(),s=n.value;r.setValue(e,t),this.configDependencies=new Set([...this.configDependencies,...r.configDependencies]),this._handleSpecialPaintPropertyUpdate(e);const a=r._values[e].value,l=a.isDataDriven(),c=le(e,"pattern")||"line-dasharray"===e;return l||o||c||this._handleOverridablePaintPropertyUpdate(e,s,a)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,t,r){return null}_handleOverridablePaintPropertyUpdate(e,t,r){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){return ue({id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()},((e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length)))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}isStateDependent(){for(const e in this.paint._values){const t=this.paint.get(e);if(t instanceof Vo&&On(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=Yo(this.filter,this.scope,e),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&("shadow"===e.renderPass?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}queryRadius(e){}queryIntersectsFeature(e,t,r,i,n,o,s,a,l){}queryIntersectsMatchingFeature(e,t,r,i){}}const ps={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class fs{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ms{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.add(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function _s(e,t=1){let r=0,i=0;return{members:e.map((e=>{const n=ps[e.type].BYTES_PER_ELEMENT,o=r=gs(r,Math.max(t,n)),s=e.components||1;return i=Math.max(i,n),r+=n*s,{name:e.name,type:e.type,components:s,offset:o}})),size:gs(r,Math.max(i,t)),alignment:t}}function gs(e,t){return Math.ceil(e/t)*t}class ys extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){const r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){const i=2*e;return this.int16[i+0]=t,this.int16[i+1]=r,e}}ys.prototype.bytesPerElement=4,so(ys,"StructArrayLayout2i4");class xs extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){const n=3*e;return this.int16[n+0]=t,this.int16[n+1]=r,this.int16[n+2]=i,e}}xs.prototype.bytesPerElement=6,so(xs,"StructArrayLayout3i6");class vs extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,r,i)}emplace(e,t,r,i,n){const o=4*e;return this.int16[o+0]=t,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,e}}vs.prototype.bytesPerElement=8,so(vs,"StructArrayLayout4i8");class bs extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,r,i,n)}emplace(e,t,r,i,n,o){const s=5*e;return this.int16[s+0]=t,this.int16[s+1]=r,this.int16[s+2]=i,this.int16[s+3]=n,this.int16[s+4]=o,e}}bs.prototype.bytesPerElement=10,so(bs,"StructArrayLayout5i10");class ws extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,i,n,o,s)}emplace(e,t,r,i,n,o,s,a){const l=6*e,c=12*e,u=3*e;return this.int16[l+0]=t,this.int16[l+1]=r,this.uint8[c+4]=i,this.uint8[c+5]=n,this.uint8[c+6]=o,this.uint8[c+7]=s,this.float32[u+2]=a,e}}ws.prototype.bytesPerElement=12,so(ws,"StructArrayLayout2i4ub1f12");class Ts extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,r,i)}emplace(e,t,r,i,n){const o=4*e;return this.float32[o+0]=t,this.float32[o+1]=r,this.float32[o+2]=i,this.float32[o+3]=n,e}}Ts.prototype.bytesPerElement=16,so(Ts,"StructArrayLayout4f16");class Ss extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){const n=3*e;return this.float32[n+0]=t,this.float32[n+1]=r,this.float32[n+2]=i,e}}Ss.prototype.bytesPerElement=12,so(Ss,"StructArrayLayout3f12");class Es extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,r,i,n)}emplace(e,t,r,i,n,o){const s=6*e,a=3*e;return this.uint16[s+0]=t,this.uint16[s+1]=r,this.uint16[s+2]=i,this.uint16[s+3]=n,this.float32[a+2]=o,e}}Es.prototype.bytesPerElement=12,so(Es,"StructArrayLayout4ui1f12");class Ms extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,r,i)}emplace(e,t,r,i,n){const o=4*e;return this.uint16[o+0]=t,this.uint16[o+1]=r,this.uint16[o+2]=i,this.uint16[o+3]=n,e}}Ms.prototype.bytesPerElement=8,so(Ms,"StructArrayLayout4ui8");class As extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,i,n,o)}emplace(e,t,r,i,n,o,s){const a=6*e;return this.int16[a+0]=t,this.int16[a+1]=r,this.int16[a+2]=i,this.int16[a+3]=n,this.int16[a+4]=o,this.int16[a+5]=s,e}}As.prototype.bytesPerElement=12,so(As,"StructArrayLayout6i12");class Cs extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o,s,a,l,c,u,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,t,r,i,n,o,s,a,l,c,u,h)}emplace(e,t,r,i,n,o,s,a,l,c,u,h,d){const p=12*e;return this.int16[p+0]=t,this.int16[p+1]=r,this.int16[p+2]=i,this.int16[p+3]=n,this.uint16[p+4]=o,this.uint16[p+5]=s,this.uint16[p+6]=a,this.uint16[p+7]=l,this.int16[p+8]=c,this.int16[p+9]=u,this.int16[p+10]=h,this.int16[p+11]=d,e}}Cs.prototype.bytesPerElement=24,so(Cs,"StructArrayLayout4i4ui4i24");class Is extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,i,n,o)}emplace(e,t,r,i,n,o,s){const a=10*e,l=5*e;return this.int16[a+0]=t,this.int16[a+1]=r,this.int16[a+2]=i,this.float32[l+2]=n,this.float32[l+3]=o,this.float32[l+4]=s,e}}Is.prototype.bytesPerElement=20,so(Is,"StructArrayLayout3i3f20");class Ps extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}Ps.prototype.bytesPerElement=4,so(Ps,"StructArrayLayout1ul4");class Rs extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){const r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){const i=2*e;return this.uint16[i+0]=t,this.uint16[i+1]=r,e}}Rs.prototype.bytesPerElement=4,so(Rs,"StructArrayLayout2ui4");class zs extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o,s,a,l,c,u,h,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,r,i,n,o,s,a,l,c,u,h,d)}emplace(e,t,r,i,n,o,s,a,l,c,u,h,d,p){const f=20*e,m=10*e;return this.int16[f+0]=t,this.int16[f+1]=r,this.int16[f+2]=i,this.int16[f+3]=n,this.int16[f+4]=o,this.float32[m+3]=s,this.float32[m+4]=a,this.float32[m+5]=l,this.float32[m+6]=c,this.int16[f+14]=u,this.uint32[m+8]=h,this.uint16[f+18]=d,this.uint16[f+19]=p,e}}zs.prototype.bytesPerElement=40,so(zs,"StructArrayLayout5i4f1i1ul2ui40");class Ds extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,i,n,o,s)}emplace(e,t,r,i,n,o,s,a){const l=8*e;return this.int16[l+0]=t,this.int16[l+1]=r,this.int16[l+2]=i,this.int16[l+4]=n,this.int16[l+5]=o,this.int16[l+6]=s,this.int16[l+7]=a,e}}Ds.prototype.bytesPerElement=16,so(Ds,"StructArrayLayout3i2i2i16");class ks extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,r,i,n)}emplace(e,t,r,i,n,o){const s=4*e,a=8*e;return this.float32[s+0]=t,this.float32[s+1]=r,this.float32[s+2]=i,this.int16[a+6]=n,this.int16[a+7]=o,e}}ks.prototype.bytesPerElement=16,so(ks,"StructArrayLayout2f1f2i16");class Os extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,i,n,o)}emplace(e,t,r,i,n,o,s){const a=20*e,l=5*e;return this.uint8[a+0]=t,this.uint8[a+1]=r,this.float32[l+1]=i,this.float32[l+2]=n,this.float32[l+3]=o,this.float32[l+4]=s,e}}Os.prototype.bytesPerElement=20,so(Os,"StructArrayLayout2ub4f20");class Ls extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){const n=3*e;return this.uint16[n+0]=t,this.uint16[n+1]=r,this.uint16[n+2]=i,e}}Ls.prototype.bytesPerElement=6,so(Ls,"StructArrayLayout3ui6");class Bs extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o,s,a,l,c,u,h,d,p,f,m,_,g,y,x,v){const b=this.length;return this.resize(b+1),this.emplace(b,e,t,r,i,n,o,s,a,l,c,u,h,d,p,f,m,_,g,y,x,v)}emplace(e,t,r,i,n,o,s,a,l,c,u,h,d,p,f,m,_,g,y,x,v,b){const w=30*e,T=15*e,S=60*e;return this.int16[w+0]=t,this.int16[w+1]=r,this.int16[w+2]=i,this.float32[T+2]=n,this.float32[T+3]=o,this.uint16[w+8]=s,this.uint16[w+9]=a,this.uint32[T+5]=l,this.uint32[T+6]=c,this.uint32[T+7]=u,this.uint16[w+16]=h,this.uint16[w+17]=d,this.uint16[w+18]=p,this.float32[T+10]=f,this.float32[T+11]=m,this.uint8[S+48]=_,this.uint8[S+49]=g,this.uint8[S+50]=y,this.uint32[T+13]=x,this.int16[w+28]=v,this.uint8[S+58]=b,e}}Bs.prototype.bytesPerElement=60,so(Bs,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class Fs extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o,s,a,l,c,u,h,d,p,f,m,_,g,y,x,v,b,w,T,S,E,M,A,C,I,P,R){const z=this.length;return this.resize(z+1),this.emplace(z,e,t,r,i,n,o,s,a,l,c,u,h,d,p,f,m,_,g,y,x,v,b,w,T,S,E,M,A,C,I,P,R)}emplace(e,t,r,i,n,o,s,a,l,c,u,h,d,p,f,m,_,g,y,x,v,b,w,T,S,E,M,A,C,I,P,R,z){const D=20*e,k=40*e,O=80*e;return this.float32[D+0]=t,this.float32[D+1]=r,this.int16[k+4]=i,this.int16[k+5]=n,this.int16[k+6]=o,this.int16[k+7]=s,this.int16[k+8]=a,this.int16[k+9]=l,this.int16[k+10]=c,this.int16[k+11]=u,this.int16[k+12]=h,this.uint16[k+13]=d,this.uint16[k+14]=p,this.uint16[k+15]=f,this.uint16[k+16]=m,this.uint16[k+17]=_,this.uint16[k+18]=g,this.uint16[k+19]=y,this.uint16[k+20]=x,this.uint16[k+21]=v,this.uint16[k+22]=b,this.uint16[k+23]=w,this.uint16[k+24]=T,this.uint16[k+25]=S,this.uint16[k+26]=E,this.uint16[k+27]=M,this.uint32[D+14]=A,this.float32[D+15]=C,this.float32[D+16]=I,this.float32[D+17]=P,this.float32[D+18]=R,this.uint8[O+76]=z,e}}Fs.prototype.bytesPerElement=80,so(Fs,"StructArrayLayout2f9i15ui1ul4f1ub80");class Ns extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}Ns.prototype.bytesPerElement=4,so(Ns,"StructArrayLayout1f4");class Vs extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,r,i,n)}emplace(e,t,r,i,n,o){const s=5*e;return this.float32[s+0]=t,this.float32[s+1]=r,this.float32[s+2]=i,this.float32[s+3]=n,this.float32[s+4]=o,e}}Vs.prototype.bytesPerElement=20,so(Vs,"StructArrayLayout5f20");class js extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,i,n,o,s)}emplace(e,t,r,i,n,o,s,a){const l=7*e;return this.float32[l+0]=t,this.float32[l+1]=r,this.float32[l+2]=i,this.float32[l+3]=n,this.float32[l+4]=o,this.float32[l+5]=s,this.float32[l+6]=a,e}}js.prototype.bytesPerElement=28,so(js,"StructArrayLayout7f28");class Us extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o,s,a,l,c,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,t,r,i,n,o,s,a,l,c,u)}emplace(e,t,r,i,n,o,s,a,l,c,u,h){const d=11*e;return this.float32[d+0]=t,this.float32[d+1]=r,this.float32[d+2]=i,this.float32[d+3]=n,this.float32[d+4]=o,this.float32[d+5]=s,this.float32[d+6]=a,this.float32[d+7]=l,this.float32[d+8]=c,this.float32[d+9]=u,this.float32[d+10]=h,e}}Us.prototype.bytesPerElement=44,so(Us,"StructArrayLayout11f44");class $s extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o,s,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,r,i,n,o,s,a,l)}emplace(e,t,r,i,n,o,s,a,l,c){const u=9*e;return this.float32[u+0]=t,this.float32[u+1]=r,this.float32[u+2]=i,this.float32[u+3]=n,this.float32[u+4]=o,this.float32[u+5]=s,this.float32[u+6]=a,this.float32[u+7]=l,this.float32[u+8]=c,e}}$s.prototype.bytesPerElement=36,so($s,"StructArrayLayout9f36");class Gs extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,r,i)}emplace(e,t,r,i,n){const o=6*e;return this.uint32[3*e+0]=t,this.uint16[o+2]=r,this.uint16[o+3]=i,this.uint16[o+4]=n,e}}Gs.prototype.bytesPerElement=12,so(Gs,"StructArrayLayout1ul3ui12");class qs extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}qs.prototype.bytesPerElement=2,so(qs,"StructArrayLayout1ui2");class Hs extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){const r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){const i=2*e;return this.float32[i+0]=t,this.float32[i+1]=r,e}}Hs.prototype.bytesPerElement=8,so(Hs,"StructArrayLayout2f8");class Ws extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o,s,a,l,c,u,h,d,p,f,m){const _=this.length;return this.resize(_+1),this.emplace(_,e,t,r,i,n,o,s,a,l,c,u,h,d,p,f,m)}emplace(e,t,r,i,n,o,s,a,l,c,u,h,d,p,f,m,_){const g=16*e;return this.float32[g+0]=t,this.float32[g+1]=r,this.float32[g+2]=i,this.float32[g+3]=n,this.float32[g+4]=o,this.float32[g+5]=s,this.float32[g+6]=a,this.float32[g+7]=l,this.float32[g+8]=c,this.float32[g+9]=u,this.float32[g+10]=h,this.float32[g+11]=d,this.float32[g+12]=p,this.float32[g+13]=f,this.float32[g+14]=m,this.float32[g+15]=_,e}}Ws.prototype.bytesPerElement=64,so(Ws,"StructArrayLayout16f64");class Zs extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,i,n,o,s)}emplace(e,t,r,i,n,o,s,a){const l=10*e,c=5*e;return this.uint16[l+0]=t,this.uint16[l+1]=r,this.uint16[l+2]=i,this.uint16[l+3]=n,this.float32[c+2]=o,this.float32[c+3]=s,this.float32[c+4]=a,e}}Zs.prototype.bytesPerElement=20,so(Zs,"StructArrayLayout4ui3f20");class Xs extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.int16[1*e+0]=t,e}}Xs.prototype.bytesPerElement=2,so(Xs,"StructArrayLayout1i2");class Ys extends ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint8[1*e+0]=t,e}}Ys.prototype.bytesPerElement=1,so(Ys,"StructArrayLayout1ub1");class Js extends fs{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}Js.prototype.size=40;class Ks extends zs{get(e){return new Js(this,e)}}so(Ks,"CollisionBoxArray");class Qs extends fs{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}Qs.prototype.size=60;class ea extends Bs{get(e){return new Qs(this,e)}}so(ea,"PlacedSymbolArray");class ta extends fs{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}}ta.prototype.size=80;class ra extends Fs{get(e){return new ta(this,e)}}so(ra,"SymbolInstanceArray");class ia extends Ns{getoffsetX(e){return this.float32[1*e+0]}}so(ia,"GlyphOffsetArray");class na extends ys{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}so(na,"SymbolLineVertexArray");class oa extends fs{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}oa.prototype.size=12;class sa extends Gs{get(e){return new oa(this,e)}}so(sa,"FeatureIndexArray");class aa extends Rs{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}so(aa,"FillExtrusionCentroidArray");class la extends fs{get a_join_normal_inside0(){return this._structArray.int16[this._pos2+0]}get a_join_normal_inside1(){return this._structArray.int16[this._pos2+1]}get a_join_normal_inside2(){return this._structArray.int16[this._pos2+2]}}la.prototype.size=6;class ca extends xs{get(e){return new la(this,e)}}so(ca,"FillExtrusionWallArray");const ua=_s([{name:"a_pos",components:2,type:"Int16"}],4),ha=_s([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class da{constructor(e=[]){this.segments=e}_prepareSegment(e,t,r,i){let n=this.segments[this.segments.length-1];return e>da.MAX_VERTEX_ARRAY_LENGTH&&pe(`Max vertices per segment is ${da.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!n||n.vertexLength+e>da.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==i)&&(n={vertexOffset:t,primitiveOffset:r,vertexLength:0,primitiveLength:0},void 0!==i&&(n.sortKey=i),this.segments.push(n)),n}prepareSegment(e,t,r,i){return this._prepareSegment(e,t.length,r.length,i)}get(){return this.segments}destroy(){for(const e of this.segments)for(const t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,r,i){return new da([{vertexOffset:e,primitiveOffset:t,vertexLength:r,primitiveLength:i,vaos:{},sortKey:0}])}}function pa(e,t){return 256*(e=Q(Math.floor(e),0,255))+Q(Math.floor(t),0,255)}da.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,so(da,"SegmentVector");const fa=_s([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),ma=_s([{name:"a_dash",components:4,type:"Uint16"}]);class _a{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,t,r,i){this.ids.push(ga(e)),this.positions.push(t,r,i)}eachPosition(e,t){const r=ga(e);let i=0,n=this.ids.length-1;for(;i<n;){const e=i+n>>1;this.ids[e]>=r?n=e:i=e+1}for(;this.ids[i]===r;)t(this.positions[3*i],this.positions[3*i+1],this.positions[3*i+2]),i++}static serialize(e,t){const r=new Float64Array(e.ids),i=new Uint32Array(e.positions);return ya(r,i,0,r.length-1),t&&(t.add(r.buffer),t.add(i.buffer)),{ids:r,positions:i}}static deserialize(e){const t=new _a;let r;t.ids=e.ids,t.positions=e.positions;for(const e of t.ids)e!==r&&t.uniqueIds.push(e),r=e;return t.indexed=!0,t}}function ga(e){const t=+e;return!isNaN(t)&&Number.MIN_SAFE_INTEGER<=t&&t<=Number.MAX_SAFE_INTEGER?t:gt(String(e))}function ya(e,t,r,i){for(;r<i;){const n=e[r+i>>1];let o=r-1,s=i+1;for(;;){do{o++}while(e[o]<n);do{s--}while(e[s]>n);if(o>=s)break;xa(e,o,s),xa(t,3*o,3*s),xa(t,3*o+1,3*s+1),xa(t,3*o+2,3*s+2)}s-r<i-s?(ya(e,t,r,s),r=s+1):(ya(e,t,s+1,i),i=s)}}function xa(e,t,r){const i=e[t];e[t]=e[r],e[r]=i}so(_a,"FeaturePositionMap");class va{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,t){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,t),this.initialized=!0),!!this.location}set(e,t,r){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class ba extends va{constructor(e){super(e),this.current=0}set(e,t,r){this.fetchUniformLocation(e,t)&&this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}}class wa extends va{constructor(e){super(e),this.current=0}set(e,t,r){this.fetchUniformLocation(e,t)&&this.current!==r&&(this.current=r,this.gl.uniform1f(this.location,r))}}class Ta extends va{constructor(e){super(e),this.current=[0,0]}set(e,t,r){this.fetchUniformLocation(e,t)&&(r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1])))}}class Sa extends va{constructor(e){super(e),this.current=[0,0,0]}set(e,t,r){this.fetchUniformLocation(e,t)&&(r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2])))}}class Ea extends va{constructor(e){super(e),this.current=[0,0,0,0]}set(e,t,r){this.fetchUniformLocation(e,t)&&(r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]&&r[3]===this.current[3]||(this.current=r,this.gl.uniform4f(this.location,r[0],r[1],r[2],r[3])))}}class Ma extends va{constructor(e){super(e),this.current=Mt.transparent.toRenderColor(null)}set(e,t,r){this.fetchUniformLocation(e,t)&&(r.r===this.current.r&&r.g===this.current.g&&r.b===this.current.b&&r.a===this.current.a||(this.current=r,this.gl.uniform4f(this.location,r.r,r.g,r.b,r.a)))}}const Aa=new Float32Array(16);class Ca extends va{constructor(e){super(e),this.current=Aa}set(e,t,r){if(this.fetchUniformLocation(e,t)){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let e=1;e<16;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}}}const Ia=new Float32Array(9),Pa=new Float32Array(4);class Ra extends va{constructor(e){super(e),this.current=Pa}set(e,t,r){if(this.fetchUniformLocation(e,t))for(let e=0;e<4;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix2fv(this.location,!1,r);break}}}function za(e){return[pa(255*e.r,255*e.g),pa(255*e.b,255*e.a)]}class Da{constructor(e,t,r,i){this.value=e,this.uniformNames=t.map((e=>`u_${e}`)),this.type=r,this.context=i}setUniform(e,t,r,i,n){const o=i.constantOr(this.value);t.set(e,n,o instanceof Mt?o.toRenderColor(this.context.lut):o)}getBinding(e,t){return"color"===this.type?new Ma(e):new wa(e)}}class ka{constructor(e,t){this.uniformNames=t.map((e=>`u_${e}`)),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(e){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br)}setUniform(e,t,r,i,n){const o="u_pattern"===n||"u_dash"===n?this.pattern:"u_pixel_ratio"===n?this.pixelRatio:null;o&&t.set(e,n,o)}getBinding(e,t){return"u_pattern"===t||"u_dash"===t?new Ea(e):new wa(e)}}class Oa{constructor(e,t,r,i){this.expression=e,this.type=r,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===r?2:1,offset:0}))),this.paintVertexArray=new i}populatePaintArray(e,t,r,i,n,o,s){const a=this.paintVertexArray.length,l=this.expression.evaluate(new Do(0,{brightness:o}),t,{},n,i,s);this.paintVertexArray.resize(e),this._setPaintValue(a,e,l,this.context)}updatePaintArray(e,t,r,i,n,o,s){const a=this.expression.evaluate({zoom:0,brightness:s},r,i,void 0,n);this._setPaintValue(e,t,a,this.context)}_setPaintValue(e,t,r,i){if("color"===this.type){const n=za(r.toRenderColor(i.lut));for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,n[0],n[1])}else{for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class La{constructor(e,t,r,i,n,o){this.expression=e,this.uniformNames=t.map((e=>`u_${e}_t`)),this.type=r,this.useIntegerZoom=i,this.context=n,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===r?4:2,offset:0}))),this.paintVertexArray=new o}populatePaintArray(e,t,r,i,n,o,s){const a=this.expression.evaluate(new Do(this.context.zoom,{brightness:o}),t,{},n,i,s),l=this.expression.evaluate(new Do(this.context.zoom+1,{brightness:o}),t,{},n,i,s),c=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(c,e,a,l,this.context)}updatePaintArray(e,t,r,i,n,o,s){const a=this.expression.evaluate({zoom:this.context.zoom,brightness:s},r,i,void 0,n),l=this.expression.evaluate({zoom:this.context.zoom+1,brightness:s},r,i,void 0,n);this._setPaintValue(e,t,a,l,this.context)}_setPaintValue(e,t,r,i,n){if("color"===this.type){const i=za(r.toRenderColor(n.lut)),o=za(r.toRenderColor(n.lut));for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,i[0],i[1],o[0],o[1])}else{for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,r,i);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(i))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t,r,i,n){const o=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,s=Q(this.expression.interpolationFactor(o,this.context.zoom,this.context.zoom+1),0,1);t.set(e,n,s)}getBinding(e,t){return new wa(e)}}class Ba{constructor(e,t,r,i,n){this.expression=e,this.layerId=n,this.paintVertexAttributes=("array"===r?ma:fa).members;for(let e=0;e<t.length;++e);this.paintVertexArray=new i}populatePaintArray(e,t,r,i){const n=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(n,e,t.patterns&&t.patterns[this.layerId],r)}updatePaintArray(e,t,r,i,n,o,s){this._setPaintValues(e,t,r.patterns&&r.patterns[this.layerId],o)}_setPaintValues(e,t,r,i){if(!i||!r)return;const n=i[r];if(!n)return;const{tl:o,br:s,pixelRatio:a}=n;for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,o[0],o[1],s[0],s[1],a)}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Fa{constructor(e,t,r=()=>!0){this.binders={},this._buffers=[],this.context=t;const i=[];for(const n in e.paint._values){const o=e.paint.get(n);if(!r(n))continue;if(!(o instanceof Vo&&On(o.property.specification)))continue;const s=ja(n,e.type),a=o.value,l=o.property.specification.type,c=!!o.property.useIntegerZoom,u="line-dasharray"===n||n.endsWith("pattern"),h="line-dasharray"===n&&"constant"!==e.layout.get("line-cap").value.kind;if("constant"!==a.kind||h)if("source"===a.kind||h||u){const t=Ga(n,l,"source");this.binders[n]=u?new Ba(a,s,l,t,e.id):new Oa(a,s,l,t),i.push(`/a_${n}`)}else{const e=Ga(n,l,"composite");this.binders[n]=new La(a,s,l,c,t,e),i.push(`/z_${n}`)}else this.binders[n]=u?new ka(a.value,s):new Da(a.value,s,l,t),i.push(`/u_${n}`)}this.cacheKey=i.sort().join("")}getMaxValue(e){const t=this.binders[e];return t instanceof Oa||t instanceof La?t.maxValue:0}populatePaintArrays(e,t,r,i,n,o,s){for(const a in this.binders){const l=this.binders[a];l.context=this.context,(l instanceof Oa||l instanceof La||l instanceof Ba)&&l.populatePaintArray(e,t,r,i,n,o,s)}}setConstantPatternPositions(e){for(const t in this.binders){const r=this.binders[t];r instanceof ka&&r.setConstantPatternPositions(e)}}updatePaintArrays(e,t,r,i,n,o,s,a){let l=!1;const c=Object.keys(e),u=0!==c.length,h=u?c:t.uniqueIds;this.context.lut=n.lut;for(const c in this.binders){const d=this.binders[c];if(d.context=this.context,(d instanceof Oa||d instanceof La||d instanceof Ba)&&(!0===d.expression.isStateDependent||!1===d.expression.isLightConstant)){const p=n.paint.get(c);d.expression=p.value;for(const r of h){const n=e[r.toString()];t.eachPosition(r,((e,t,r)=>{const l=i.feature(e);d.updatePaintArray(t,r,l,n,o,s,a)}))}if(!u)for(const t of r.uniqueIds){const n=e[t.toString()];r.eachPosition(t,((e,t,r)=>{const l=i.feature(e);d.updatePaintArray(t,r,l,n,o,s,a)}))}l=!0}}return l}defines(){const e=[];for(const t in this.binders){const r=this.binders[t];(r instanceof Da||r instanceof ka)&&e.push(...r.uniformNames.map((e=>`#define HAS_UNIFORM_${e}`)))}return e}getBinderAttributes(){const e=[];for(const t in this.binders){const r=this.binders[t];if(r instanceof Oa||r instanceof La||r instanceof Ba)for(let t=0;t<r.paintVertexAttributes.length;t++)e.push(r.paintVertexAttributes[t].name)}return e}getBinderUniforms(){const e=[];for(const t in this.binders){const r=this.binders[t];if(r instanceof Da||r instanceof ka||r instanceof La)for(const t of r.uniformNames)e.push(t)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const t=[];for(const r in this.binders){const i=this.binders[r];if(i instanceof Da||i instanceof ka||i instanceof La)for(const n of i.uniformNames)t.push({name:n,property:r,binding:i.getBinding(e,n)})}return t}setUniforms(e,t,r,i,n){for(const{name:t,property:o,binding:s}of r)this.binders[o].setUniform(e,s,n,i.get(o),t)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const t=this.binders[e];(t instanceof Oa||t instanceof La||t instanceof Ba)&&t.paintVertexBuffer&&this._buffers.push(t.paintVertexBuffer)}}upload(e){for(const t in this.binders){const r=this.binders[t];(r instanceof Oa||r instanceof La||r instanceof Ba)&&r.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const t=this.binders[e];(t instanceof Oa||t instanceof La||t instanceof Ba)&&t.destroy()}}}class Na{constructor(e,t,r=()=>!0){this.programConfigurations={};for(const i of e)this.programConfigurations[i.id]=new Fa(i,t,r);this.needsUpload=!1,this._featureMap=new _a,this._featureMapWithoutIds=new _a,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,t,r,i,n,o,s,a){for(const r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(e,t,i,n,o,s,a);void 0!==t.id?this._featureMap.add(t.id,r,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,r,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,r,i,n,o){for(const s of r)this.needsUpload=this.programConfigurations[s.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,t,s,i,n,o||0)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const Va={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"symbol-z-offset":["z_offset"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]};function ja(e,t){return Va[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}const Ua={"line-pattern":{source:Es,composite:Es},"fill-pattern":{source:Es,composite:Es},"fill-extrusion-pattern":{source:Es,composite:Es},"line-dasharray":{source:Ms,composite:Ms}},$a={color:{source:Hs,composite:Ts},number:{source:Ns,composite:Hs}};function Ga(e,t,r){const i=Ua[e];return i&&i[r]||$a[t][r]}so(Da,"ConstantBinder"),so(ka,"PatternConstantBinder"),so(Oa,"SourceExpressionBinder"),so(Ba,"PatternCompositeBinder"),so(La,"CompositeExpressionBinder"),so(Fa,"ProgramConfiguration",{omit:["_buffers"]}),so(Na,"ProgramConfigurationSet");const qa=Xr/Math.PI/2,Ha=5,Wa=6,Za=16383,Xa=64,Ya=[Xa,32,16],Ja=-qa,Ka=qa;function Qa(e,t,r,i=qa){return r=W(r),[e*Math.sin(r)*i,-t*i,e*Math.cos(r)*i]}function el(e,t,r){return Qa(Math.cos(W(e)),Math.sin(W(e)),t,r)}const tl=6371008.8,rl=2*Math.PI*tl;class il{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new il(te(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const t=Math.PI/180,r=this.lat*t,i=e.lat*t,n=Math.sin(r)*Math.sin(i)+Math.cos(r)*Math.cos(i)*Math.cos((e.lng-this.lng)*t);return tl*Math.acos(Math.min(n,1))}toBounds(e=0){const t=360*e/40075017,r=t/Math.cos(Math.PI/180*this.lat);return new nl({lng:this.lng-r,lat:this.lat-t},{lng:this.lng+r,lat:this.lat+t})}toEcef(e){return el(this.lat,this.lng,qa+e*qa/tl)}static convert(e){if(e instanceof il)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new il(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new il(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class nl{constructor(e,t){if(e)if(t)this.setSouthWest(e).setNorthEast(t);else if(4===e.length){const t=e;this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]])}else{const t=e;this.setSouthWest(t[0]).setNorthEast(t[1])}}setNorthEast(e){return this._ne=e instanceof il?new il(e.lng,e.lat):il.convert(e),this}setSouthWest(e){return this._sw=e instanceof il?new il(e.lng,e.lat):il.convert(e),this}extend(e){const t=this._sw,r=this._ne;let i,n;if(e instanceof il)i=e,n=e;else{if(!(e instanceof nl))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(nl.convert(e)):this.extend(il.convert(e)):"object"==typeof e&&null!==e&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(il.convert(e)):this;if(i=e._sw,n=e._ne,!i||!n)return this}return t||r?(t.lng=Math.min(i.lng,t.lng),t.lat=Math.min(i.lat,t.lat),r.lng=Math.max(n.lng,r.lng),r.lat=Math.max(n.lat,r.lat)):(this._sw=new il(i.lng,i.lat),this._ne=new il(n.lng,n.lat)),this}getCenter(){return new il((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new il(this.getWest(),this.getNorth())}getSouthEast(){return new il(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:t,lat:r}=il.convert(e);let i=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(i=this._sw.lng>=t&&t>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&i}static convert(e){if(e)return e instanceof nl?e:new nl(e)}}const ol=0,sl=25.5;function al(e){return rl*Math.cos(e*Math.PI/180)}function ll(e){return(180+e)/360}function cl(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function ul(e,t){return e/al(t)}function hl(e){return 360*e-180}function dl(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function pl(e,t){return e*al(dl(t))}const fl=85.051129;function ml(e){return Math.cos(W(Q(e,-fl,fl)))}function _l(e,t){const r=Q(t,ol,sl),i=Math.pow(2,r);return ml(e)*rl/(512*i)}function gl(e){return 1/Math.cos(e*Math.PI/180)}function yl(e,t=0){const r=Math.exp(Math.PI*(1-(e.y+t/Xr)/(1<<e.z)*2));return 80150034*r/(r*r+1)/Xr/(1<<e.z)}class xl{constructor(e,t,r=0){this.x=+e,this.y=+t,this.z=+r}static fromLngLat(e,t=0){const r=il.convert(e);return new xl(ll(r.lng),cl(r.lat),ul(t,r.lat))}toLngLat(){return new il(hl(this.x),dl(this.y))}toAltitude(){return pl(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/rl*gl(dl(this.y))}}function vl(e,t,r,i,n,o,s,a,l){const c=(t+i)/2,u=(r+n)/2,h=new $(c,u);a(h),function(e,t,r,i,n,o){const s=r-n,a=i-o;return Math.abs((i-t)*s-(r-e)*a)/Math.hypot(s,a)}(h.x,h.y,o.x,o.y,s.x,s.y)>=l?(vl(e,t,r,c,u,o,h,a,l),vl(e,c,u,i,n,h,s,a,l)):e.push(s)}function bl(e,t,r){let i=e[0],n=i.x,o=i.y;t(i);const s=[i];for(let a=1;a<e.length;a++){const l=e[a],{x:c,y:u}=l;t(l),vl(s,n,o,c,u,i,l,t,r),n=c,o=u,i=l}return s}function wl(e,t,r,i){if(i(t,r)){const n=t.add(r)._mult(.5);wl(e,t,n,i),wl(e,n,r,i)}else e.push(r)}function Tl(e,t){let r=e[0];const i=[r];for(let n=1;n<e.length;n++){const o=e[n];wl(i,r,o,t),r=o}return i}const Sl=Math.pow(2,14)-1,El=-Sl-1;function Ml(e,t){const r=Math.round(e.x*t),i=Math.round(e.y*t);return e.x=Q(r,El,Sl),e.y=Q(i,El,Sl),(r<e.x||r>e.x+1||i<e.y||i>e.y+1)&&pe("Geometry exceeds allowed extent, reduce your vector tile buffer size"),e}function Al(e,t,r){const i=e.loadGeometry(),n=e.extent,o=Xr/n;if(t&&r&&r.projection.isReprojectedInTileSpace){const o=1<<t.z,{scale:s,x:a,y:l,projection:c}=r,u=e=>{const r=hl((t.x+e.x/n)/o),i=dl((t.y+e.y/n)/o),u=c.project(r,i);e.x=(u.x*s-a)*n,e.y=(u.y*s-l)*n};for(let t=0;t<i.length;t++)if(1!==e.type)i[t]=bl(i[t],u,1);else{const e=[];for(const r of i[t])r.x<0||r.x>=n||r.y<0||r.y>=n||(u(r),e.push(r));i[t]=e}}for(const e of i)for(const t of e)Ml(t,o);return i}function Cl(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Al(e):[]}}function Il(e,t,r,i,n){e.emplaceBack(2*t+(i+1)/2,2*r+(n+1)/2)}function Pl(e,t,r){const i=16384;e.emplaceBack(t.x,t.y,t.z,r[0]*i,r[1]*i,r[2]*i)}class Rl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.fqid)),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new ys,this.indexArray=new Ls,this.segments=new da,this.programConfigurations=new Na(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}updateFootprints(e,t){}populate(e,t,r,i){const n=this.layers[0],o=[];let s=null;"circle"===n.type&&(s=n.layout.get("circle-sort-key"));for(const{feature:t,id:n,index:a,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=Cl(t,e);if(!this.layers[0]._featureFilter.filter(new Do(this.zoom),c,r))continue;const u=s?s.evaluate(c,{},r):void 0,h={id:n,properties:t.properties,type:t.type,sourceLayerIndex:l,index:a,geometry:e?c.geometry:Al(t,r,i),patterns:{},sortKey:u};o.push(h)}s&&o.sort(((e,t)=>e.sortKey-t.sortKey));let a=null;"globe"===i.projection.name&&(this.globeExtVertexArray=new As,a=i.projection);for(const i of o){const{geometry:n,index:o,sourceLayerIndex:s}=i,l=e[o].feature;this.addFeature(i,n,o,t.availableImages,r,a,t.brightness),t.featureIndex.insert(l,n,o,s,this.index)}}update(e,t,r,i,n){const o=0!==Object.keys(e).length;o&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,t,o?this.stateDependentLayers:this.layers,r,i,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ua.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,ha.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(e,t,r,i,n,o,s){for(const r of t)for(const t of r){const r=t.x,i=t.y;if(r<0||r>=Xr||i<0||i>=Xr)continue;if(o){const e=o.projectTilePoint(r,i,n),t=o.upVector(n,r,i),s=this.globeExtVertexArray;Pl(s,e,t),Pl(s,e,t),Pl(s,e,t),Pl(s,e,t)}const s=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),a=s.vertexLength;Il(this.layoutVertexArray,r,i,-1,-1),Il(this.layoutVertexArray,r,i,1,-1),Il(this.layoutVertexArray,r,i,1,1),Il(this.layoutVertexArray,r,i,-1,1),this.indexArray.emplaceBack(a,a+1,a+2),this.indexArray.emplaceBack(a,a+2,a+3),s.vertexLength+=4,s.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{},i,n,s)}}function zl(e,t){for(let r=0;r<e.length;r++)if(jl(t,e[r]))return!0;for(let r=0;r<t.length;r++)if(jl(e,t[r]))return!0;return!!Ll(e,t)}function Dl(e,t,r){return!!jl(e,t)||!!Fl(t,e,r)}function kl(e,t){if(1===e.length)return Vl(t,e[0]);for(let r=0;r<t.length;r++){const i=t[r];for(let t=0;t<i.length;t++)if(jl(e,i[t]))return!0}for(let r=0;r<e.length;r++)if(Vl(t,e[r]))return!0;for(let r=0;r<t.length;r++)if(Ll(e,t[r]))return!0;return!1}function Ol(e,t,r){if(e.length>1){if(Ll(e,t))return!0;for(let i=0;i<t.length;i++)if(Fl(t[i],e,r))return!0}for(let i=0;i<e.length;i++)if(Fl(e[i],t,r))return!0;return!1}function Ll(e,t){if(0===e.length||0===t.length)return!1;for(let r=0;r<e.length-1;r++){const i=e[r],n=e[r+1];for(let e=0;e<t.length-1;e++)if(Bl(i,n,t[e],t[e+1]))return!0}return!1}function Bl(e,t,r,i){return fe(e,r,i)!==fe(t,r,i)&&fe(e,t,r)!==fe(e,t,i)}function Fl(e,t,r){const i=r*r;if(1===t.length)return e.distSqr(t[0])<i;for(let r=1;r<t.length;r++)if(Nl(e,t[r-1],t[r])<i)return!0;return!1}function Nl(e,t,r){const i=t.distSqr(r);if(0===i)return e.distSqr(t);const n=((e.x-t.x)*(r.x-t.x)+(e.y-t.y)*(r.y-t.y))/i;return e.distSqr(n<0?t:n>1?r:r.sub(t)._mult(n)._add(t))}function Vl(e,t){let r,i,n,o=!1;for(let s=0;s<e.length;s++){r=e[s];for(let e=0,s=r.length-1;e<r.length;s=e++)i=r[e],n=r[s],i.y>t.y!=n.y>t.y&&t.x<(n.x-i.x)*(t.y-i.y)/(n.y-i.y)+i.x&&(o=!o)}return o}function jl(e,t){let r=!1;for(let i=0,n=e.length-1;i<e.length;n=i++){const o=e[i],s=e[n];o.y>t.y!=s.y>t.y&&t.x<(s.x-o.x)*(t.y-o.y)/(s.y-o.y)+o.x&&(r=!r)}return r}function Ul(e,t,r,i,n){for(const o of e)if(t<=o.x&&r<=o.y&&i>=o.x&&n>=o.y)return!0;const o=[new $(t,r),new $(t,n),new $(i,n),new $(i,r)];if(e.length>2)for(const t of o)if(jl(e,t))return!0;for(let t=0;t<e.length-1;t++)if($l(e[t],e[t+1],o))return!0;return!1}function $l(e,t,r){const i=r[0],n=r[2];if(e.x<i.x&&t.x<i.x||e.x>n.x&&t.x>n.x||e.y<i.y&&t.y<i.y||e.y>n.y&&t.y>n.y)return!1;const o=fe(e,t,r[0]);return o!==fe(e,t,r[1])||o!==fe(e,t,r[2])||o!==fe(e,t,r[3])}function Gl(e,t,r,i,n,o){let s=t.y-e.y,a=e.x-t.x;if(o=o||0){const e=s*s+a*a;if(0===e)return!0;const t=Math.sqrt(e);s/=t,a/=t}return!((r.x-e.x)*s+(r.y-e.y)*a-o<0||(i.x-e.x)*s+(i.y-e.y)*a-o<0||(n.x-e.x)*s+(n.y-e.y)*a-o<0)}function ql(e,t,r,i,n,o,s){return!(Gl(e,t,i,n,o,s)||Gl(t,r,i,n,o,s)||Gl(r,e,i,n,o,s)||Gl(i,n,e,t,r,s)||Gl(n,o,e,t,r,s)||Gl(o,i,e,t,r,s))}function Hl(e,t,r){const i=t.paint.get(e).value;return"constant"===i.kind?i.value:r.programConfigurations.get(t.id).getMaxValue(e)}function Wl(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Zl(e,t,r,i,n){if(!t[0]&&!t[1])return e;const o=$.convert(t)._mult(n);"viewport"===r&&o._rotate(-i);const s=[];for(let t=0;t<e.length;t++)s.push(e[t].sub(o));return s}function Xl(e,t,r,i){const n=$.convert(e)._mult(i);return"viewport"===t&&n._rotate(-r),n}let Yl,Jl;so(Rl,"CircleBucket",{omit:["layers"]});var Kl,Ql={exports:{}},ec=(Kl||(Kl=1,function(e,t){!function(e){function t(e,t,i){var n=r(256*e,256*(t=Math.pow(2,i)-t-1),i),o=r(256*(e+1),256*(t+1),i);return n[0]+","+n[1]+","+o[0]+","+o[1]}function r(e,t,r){var i=2*Math.PI*6378137/256/Math.pow(2,r);return[e*i-2*Math.PI*6378137/2,t*i-2*Math.PI*6378137/2]}e.getURL=function(e,r,i,n,o,s){return s=s||{},e+"?"+["bbox="+t(i,n,o),"format="+(s.format||"image/png"),"service="+(s.service||"WMS"),"version="+(s.version||"1.1.1"),"request="+(s.request||"GetMap"),"srs="+(s.srs||"EPSG:3857"),"width="+(s.width||256),"height="+(s.height||256),"layers="+r].join("&")},e.getTileBBox=t,e.getMercCoords=r,Object.defineProperty(e,"__esModule",{value:!0})}(t)}(0,Ql.exports)),Ql.exports);class tc{constructor(e,t,r){this.z=e,this.x=t,this.y=r,this.key=nc(0,e,e,t,r)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t){const r=ec.getTileBBox(this.x,this.y,this.z),i=function(e,t,r){let i,n="";for(let o=e;o>0;o--)i=1<<o-1,n+=(t&i?1:0)+(r&i?2:0);return n}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===t?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",i).replace("{bbox-epsg-3857}",r)}toString(){return`${this.z}/${this.x}/${this.y}`}}class rc{constructor(e,t){this.wrap=e,this.canonical=t,this.key=nc(e,t.z,t.z,t.x,t.y)}}class ic{constructor(e,t,r,i,n){this.overscaledZ=e,this.wrap=t,this.canonical=new tc(r,+i,+n),this.key=0===t&&e===r?this.canonical.key:nc(t,e,r,i,n)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const t=this.canonical.z-e;return e>this.canonical.z?new ic(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ic(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t=!0){if(this.overscaledZ===e&&t)return this.key;if(e>this.canonical.z)return nc(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y);{const r=this.canonical.z-e;return nc(this.wrap*+t,e,e,this.canonical.x>>r,this.canonical.y>>r)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const t=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new ic(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,r=2*this.canonical.x,i=2*this.canonical.y;return[new ic(t,this.wrap,t,r,i),new ic(t,this.wrap,t,r+1,i),new ic(t,this.wrap,t,r,i+1),new ic(t,this.wrap,t,r+1,i+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new ic(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new ic(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new rc(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function nc(e,t,r,i,n){const o=1<<Math.min(r,22);let s=o*(n%o)+i%o;return e&&r<22&&(s+=o*o*((e<0?-2*e-1:2*e)%(1<<2*(22-r)))),16*(32*s+r)+(t-r)}const oc=[e=>{let t=e.canonical.x-1,r=e.wrap;return t<0&&(t=(1<<e.canonical.z)-1,r--),new ic(e.overscaledZ,r,e.canonical.z,t,e.canonical.y)},e=>{let t=e.canonical.x+1,r=e.wrap;return t===1<<e.canonical.z&&(t=0,r++),new ic(e.overscaledZ,r,e.canonical.z,t,e.canonical.y)},e=>new ic(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,(0===e.canonical.y?1<<e.canonical.z:e.canonical.y)-1),e=>new ic(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y===(1<<e.canonical.z)-1?0:e.canonical.y+1)];so(tc,"CanonicalTileID"),so(ic,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const sc=_s([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:ac}=sc,lc=_s([{name:"a_pos_3",components:3,type:"Int16"}]);var cc=_s([{name:"a_pos",type:"Int16",components:2}]);class uc{constructor(e,t){this.pos=e,this.dir=t}intersectsPlane(e,t,r){const i=N.vec3.dot(t,this.dir);if(Math.abs(i)<1e-6)return!1;const n=((e[0]-this.pos[0])*t[0]+(e[1]-this.pos[1])*t[1]+(e[2]-this.pos[2])*t[2])/i;return r[0]=this.pos[0]+this.dir[0]*n,r[1]=this.pos[1]+this.dir[1]*n,r[2]=this.pos[2]+this.dir[2]*n,!0}closestPointOnSphere(e,t,r){if(N.vec3.equals(this.pos,e)||0===t)return r[0]=r[1]=r[2]=0,!1;const[i,n,o]=this.dir,s=this.pos[0]-e[0],a=this.pos[1]-e[1],l=this.pos[2]-e[2],c=i*i+n*n+o*o,u=2*(s*i+a*n+l*o),h=u*u-4*c*(s*s+a*a+l*l-t*t);if(h<0){const e=Math.max(-u/2,0),c=s+i*e,h=a+n*e,d=l+o*e,p=Math.hypot(c,h,d);return r[0]=c*t/p,r[1]=h*t/p,r[2]=d*t/p,!1}{const e=(-u-Math.sqrt(h))/(2*c);if(e<0){const e=Math.hypot(s,a,l);return r[0]=s*t/e,r[1]=a*t/e,r[2]=l*t/e,!1}return r[0]=s+i*e,r[1]=a+n*e,r[2]=l+o*e,!0}}}class hc{constructor(e,t,r,i,n){this.TL=e,this.TR=t,this.BR=r,this.BL=i,this.horizon=n}static fromInvProjectionMatrix(e,t,r){const i=[-1,1,1],n=[1,1,1],o=[1,-1,1],s=[-1,-1,1],a=N.vec3.transformMat4(i,i,e),l=N.vec3.transformMat4(n,n,e),c=N.vec3.transformMat4(o,o,e),u=N.vec3.transformMat4(s,s,e);return new hc(a,l,c,u,t/r)}}function dc(e,t,r){let i=1/0,n=-1/0;const o=[];for(const s of e){N.vec3.sub(o,s,t);const e=N.vec3.dot(o,r);i=Math.min(i,e),n=Math.max(n,e)}return[i,n]}function pc(e,t){let r=!0;for(let i=0;i<e.planes.length;i++){const n=e.planes[i];let o=0;for(let e=0;e<t.length;e++)o+=N.vec3.dot(n,t[e])+n[3]>=0;if(0===o)return 0;o!==t.length&&(r=!1)}return r?2:1}function fc(e,t){for(const r of e.projections){const i=dc(t,e.points[0],r.axis);if(r.projection[1]<i[0]||r.projection[0]>i[1])return 0}return 1}function mc(e,t){let r=0;const i=[0,0,0,0];for(let n=0;n<e.length;n++)i[0]=e[n][0],i[1]=e[n][1],i[2]=e[n][2],i[3]=1,N.vec4.dot(i,t)>=0&&r++;return r}class _c{constructor(e,t){this.points=e||new Array(8).fill([0,0,0]),this.planes=t||new Array(6).fill([0,0,0,0]),this.bounds=gc.fromPoints(this.points),this.projections=[],this.frustumEdges=[N.vec3.sub([],this.points[2],this.points[3]),N.vec3.sub([],this.points[0],this.points[3]),N.vec3.sub([],this.points[4],this.points[0]),N.vec3.sub([],this.points[5],this.points[1]),N.vec3.sub([],this.points[6],this.points[2]),N.vec3.sub([],this.points[7],this.points[3])];for(const e of this.frustumEdges){const t=[0,-e[2],e[1]],r=[e[2],0,-e[0]];this.projections.push({axis:t,projection:dc(this.points,this.points[0],t)}),this.projections.push({axis:r,projection:dc(this.points,this.points[0],r)})}}static fromInvProjectionMatrix(e,t,r,i){const n=Math.pow(2,r),o=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((r=>{const o=N.vec4.transformMat4([],r,e),s=1/o[3]/t*n;return N.vec4.mul(o,o,[s,s,i?1/o[3]:s,s])})),s=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((e=>{const t=N.vec3.sub([],o[e[0]],o[e[1]]),r=N.vec3.sub([],o[e[2]],o[e[1]]),i=N.vec3.normalize([],N.vec3.cross([],t,r)),n=-N.vec3.dot(i,o[e[1]]);return i.concat(n)})),a=[];for(let e=0;e<o.length;e++)a.push([o[e][0],o[e][1],o[e][2]]);return new _c(a,s)}intersectsPrecise(e,t,r){for(let r=0;r<t.length;r++)if(!mc(e,t[r]))return 0;for(let t=0;t<this.planes.length;t++)if(!mc(e,this.planes[t]))return 0;for(const t of r)for(const r of this.frustumEdges){const i=N.vec3.cross([],t,r),n=N.vec3.length(i);if(0===n)continue;N.vec3.scale(i,i,1/n);const o=dc(this.points,this.points[0],i),s=dc(e,this.points[0],i);if(o[0]>s[1]||s[0]>o[1])return 0}return 1}containsPoint(e){for(const t of this.planes){const r=t[3];if(N.vec3.dot([t[0],t[1],t[2]],e)+r<0)return!1}return!0}}class gc{static fromPoints(e){const t=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];for(const i of e)N.vec3.min(t,t,i),N.vec3.max(r,r,i);return new gc(t,r)}static fromTileIdAndHeight(e,t,r){const i=1<<e.canonical.z,n=e.canonical.x,o=e.canonical.y;return new gc([n/i,o/i,t],[(n+1)/i,(o+1)/i,r])}static applyTransform(e,t){const r=e.getCorners();for(let e=0;e<r.length;++e)N.vec3.transformMat4(r[e],r[e],t);return gc.fromPoints(r)}static applyTransformFast(e,t){const r=[t[12],t[13],t[14]],i=[...r];for(let n=0;n<3;n++)for(let o=0;o<3;o++){const s=t[4*o+n],a=s*e.min[o],l=s*e.max[o];r[n]+=Math.min(a,l),i[n]+=Math.max(a,l)}return new gc(r,i)}static projectAabbCorners(e,t){const r=e.getCorners();for(let e=0;e<r.length;++e)N.vec3.transformMat4(r[e],r[e],t);return r}constructor(e,t){this.min=e,this.max=t,this.center=N.vec3.scale([],N.vec3.add([],this.min,this.max),.5)}quadrant(e){const t=[e%2==0,e<2],r=N.vec3.clone(this.min),i=N.vec3.clone(this.max);for(let e=0;e<t.length;e++)r[e]=t[e]?this.min[e]:this.center[e],i[e]=t[e]?this.center[e]:this.max[e];return i[2]=this.max[2],new gc(r,i)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){const e=this.min,t=this.max;return[[e[0],e[1],e[2]],[t[0],e[1],e[2]],[t[0],t[1],e[2]],[e[0],t[1],e[2]],[e[0],e[1],t[2]],[t[0],e[1],t[2]],[t[0],t[1],t[2]],[e[0],t[1],t[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?pc(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?pc(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(e,t){return t||this.intersects(e)?fc(e,this.getCorners()):0}intersectsPreciseFlat(e,t){return t||this.intersectsFlat(e)?fc(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(e){for(let t=0;t<3;++t)if(this.min[t]>e.max[t]||e.min[t]>this.max[t])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let t=0;t<3;t++)this.min[t]=Math.min(this.min[t],e.min[t]),this.max[t]=Math.max(this.max[t],e.max[t])}encapsulatePoint(e){for(let t=0;t<3;t++)this.min[t]=Math.min(this.min[t],e[t]),this.max[t]=Math.max(this.max[t],e[t])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}function yc(e){return e*qa/tl}so(gc,"Aabb");const xc=[new gc([Ja,Ja,Ja],[Ka,Ka,Ka]),new gc([Ja,Ja,Ja],[0,0,Ka]),new gc([0,Ja,Ja],[Ka,0,Ka]),new gc([Ja,0,Ja],[0,Ka,Ka]),new gc([0,0,Ja],[Ka,Ka,Ka])];function vc(e,t,r,i=!0){const n=N.vec3.scale([],e._camera.position,e.worldSize),o=[t,r,1,1];N.vec4.transformMat4(o,o,e.pixelMatrixInverse),N.vec4.scale(o,o,1/o[3]);const s=N.vec3.sub([],o,n),a=N.vec3.normalize([],s),l=e.globeMatrix,c=[l[12],l[13],l[14]],u=N.vec3.sub([],c,n),h=N.vec3.length(u),d=N.vec3.normalize([],u),p=e.worldSize/(2*Math.PI),f=N.vec3.dot(d,a),m=Math.asin(p/h);if(m<Math.acos(f)){if(!i)return null;const e=[],t=[];N.vec3.scale(e,a,h/f),N.vec3.normalize(t,N.vec3.sub(t,e,u)),N.vec3.normalize(a,N.vec3.add(a,u,N.vec3.scale(a,t,Math.tan(m)*h)))}const _=[];new uc(n,a).closestPointOnSphere(c,p,_);const g=N.vec3.normalize([],ve(l,0)),y=N.vec3.normalize([],ve(l,1)),x=N.vec3.normalize([],ve(l,2)),v=N.vec3.dot(g,_),b=N.vec3.dot(y,_),w=N.vec3.dot(x,_),T=Z(Math.asin(-b/p));let S=Z(Math.atan2(v,w));S=e.center.lng+function(e,t){const r=(t-e+180)%360-180;return r<-180?r+360:r}(e.center.lng,S);const E=ll(S),M=Q(cl(T),0,1);return new xl(E,M)}class bc{constructor(e,t,r){this.a=N.vec3.sub([],e,r),this.b=N.vec3.sub([],t,r),this.center=r;const i=N.vec3.normalize([],this.a),n=N.vec3.normalize([],this.b);this.angle=Math.acos(N.vec3.dot(i,n))}}function wc(e,t){if(0===e.angle)return null;let r;return r=0===e.a[t]?1/e.angle*.5*Math.PI:1/e.angle*Math.atan(e.b[t]/e.a[t]/Math.sin(e.angle)-1/Math.tan(e.angle)),r<0||r>1?null:function(e,t,r,i){const n=Math.sin(r);return e*(Math.sin((1-i)*r)/n)+t*(Math.sin(i*r)/n)}(e.a[t],e.b[t],e.angle,Q(r,0,1))+e.center[t]}function Tc(e){if(e.z<=1)return xc[e.z+2*e.y+e.x];const t=Cc(Ac(e));return gc.fromPoints(t)}function Sc(e,t,r){return N.vec3.scale(e,e,1-r),N.vec3.scaleAndAdd(e,e,t,r)}function Ec(e,t,r){for(const i of e)N.vec3.transformMat4(i,i,t),N.vec3.scale(i,i,r)}function Mc(e,t,r,i){const n=t/e.worldSize,o=e.globeMatrix;if(r.z<=1){const e=Tc(r).getCorners();return Ec(e,o,n),gc.fromPoints(e)}const s=Ac(r,i),a=Cc(s,qa+yc(e._tileCoverLift));Ec(a,o,n);const l=Number.MAX_VALUE,c=[-l,-l,-l],u=[l,l,l];if(s.contains(e.center)){for(const e of a)N.vec3.min(u,u,e),N.vec3.max(c,c,e);c[2]=0;const t=e.point,r=[t.x*n,t.y*n,0];return N.vec3.min(u,u,r),N.vec3.max(c,c,r),new gc(u,c)}if(e._tileCoverLift>0){for(const e of a)N.vec3.min(u,u,e),N.vec3.max(c,c,e);return new gc(u,c)}const h=[o[12]*n,o[13]*n,o[14]*n],d=s.getCenter(),p=Q(e.center.lat,-fl,fl),f=Q(d.lat,-fl,fl),m=ll(e.center.lng),_=cl(p);let g=m-ll(d.lng);const y=_-cl(f);g>.5?g-=1:g<-.5&&(g+=1);let x=0;if(Math.abs(g)>Math.abs(y))x=g>=0?1:3;else{x=y>=0?0:2;const e=[o[4]*n,o[5]*n,o[6]*n],t=-Math.sin(W(y>=0?s.getSouth():s.getNorth()))*qa;N.vec3.scaleAndAdd(h,h,e,t)}const v=a[x],b=a[(x+1)%4],w=new bc(v,b,h),T=[wc(w,0)||v[0],wc(w,1)||v[1],wc(w,2)||v[2]],S=Bc(e.zoom);if(S>0){const i=function({x:e,y:t,z:r},i,n,o,s){const a=1/(1<<r);let l=e*a,c=l+a,u=t*a,h=u+a,d=0;const p=(l+c)/2-o;return p>.5?d=-1:p<-.5&&(d=1),l=((l+d)*i-(o*=i))*n+o,c=((c+d)*i-o)*n+o,u=(u*i-(s*=i))*n+s,h=(h*i-s)*n+s,[[l,h,0],[c,h,0],[c,u,0],[l,u,0]]}(r,t,e._pixelsPerMercatorPixel,m,_);for(let e=0;e<a.length;e++)Sc(a[e],i[e],S);const n=N.vec3.add([],i[x],i[(x+1)%4]);N.vec3.scale(n,n,.5),Sc(T,n,S)}for(const e of a)N.vec3.min(u,u,e),N.vec3.max(c,c,e);return u[2]=Math.min(v[2],b[2]),N.vec3.min(u,u,T),N.vec3.max(c,c,T),new gc(u,c)}function Ac({x:e,y:t,z:r},i=!1){const n=1/(1<<r),o=new il(hl(e*n),t===(1<<r)-1&&i?-90:dl((t+1)*n)),s=new il(hl((e+1)*n),0===t&&i?90:dl(t*n));return new nl(o,s)}function Cc(e,t=qa){const r=W(e.getNorth()),i=W(e.getSouth()),n=Math.cos(r),o=Math.cos(i),s=Math.sin(r),a=Math.sin(i),l=e.getWest(),c=e.getEast();return[Qa(o,a,l,t),Qa(o,a,c,t),Qa(n,s,c,t),Qa(n,s,l,t)]}function Ic(e,t,r,i){const n=1<<r.z,o=(e/Xr+r.x)/n;return el(dl((t/Xr+r.y)/n),hl(o),i)}function Pc({min:e,max:t}){return Za/Math.max(t[0]-e[0],t[1]-e[1],t[2]-e[2])}const Rc=new Float64Array(16);function zc(e){const t=Pc(e),r=N.mat4.fromScaling(Rc,[t,t,t]);return N.mat4.translate(r,r,N.vec3.negate([],e.min))}function Dc(e){const t=N.mat4.fromTranslation(Rc,e.min),r=1/Pc(e);return N.mat4.scale(t,t,[r,r,r])}function kc(e){const t=Xr/(2*Math.PI);return e/(2*Math.PI)/t}function Oc(e,t){return Xr/(512*Math.pow(2,e))*Pc(Tc(t))}function Lc(e,t,r,i,n){const o=kc(r),s=[e,t,-r/(2*Math.PI)],a=N.mat4.identity(new Float64Array(16));return N.mat4.translate(a,a,s),N.mat4.scale(a,a,[o,o,o]),N.mat4.rotateX(a,a,W(-n)),N.mat4.rotateY(a,a,W(-i)),a}function Bc(e){return ee(Ha,Wa,e)}function Fc(e,t){const r=el(t.lat,t.lng),i=function(e){const t=el(e._center.lat,e._center.lng),r=N.vec3.fromValues(0,1,0);let i=N.vec3.cross([],r,t);const n=N.mat4.fromRotation([],-e.angle,t);i=N.vec3.transformMat4(i,i,n),N.mat4.fromRotation(n,-e._pitch,i);const o=N.vec3.normalize([],t);return N.vec3.scale(o,o,yc(e.cameraToCenterDistance/e.pixelsPerMeter)),N.vec3.transformMat4(o,o,n),N.vec3.add([],t,o)}(e),n=N.vec3.subtract([],i,r);return N.vec3.angle(n,r)}function Nc(e,t){return Fc(e,t)>Math.PI/2*1.01}const Vc=W(85),jc=Math.cos(Vc),Uc=Math.sin(Vc),$c=N.mat4.create(),Gc=e=>{const t=[];return"map"===e.paint.get("circle-pitch-alignment")&&t.push("PITCH_WITH_MAP"),"map"===e.paint.get("circle-pitch-scale")&&t.push("SCALE_WITH_MAP"),t};function qc(e,t,r,i,n,o,s,a,l){if(o&&e.queryGeometry.isAboveHorizon)return!1;o&&(l*=e.pixelToTileUnitsFactor);const c=e.tileID.canonical,u=r.projection.upVectorScale(c,r.center.lat,r.worldSize).metersToTile;for(const h of t)for(const t of h){const h=t.add(a),d=n&&r.elevation?r.elevation.exaggeration()*n.getElevationAt(h.x,h.y,!0):0,p=r.projection.projectTilePoint(h.x,h.y,c);if(d>0){const e=r.projection.upVector(c,h.x,h.y);p.x+=e[0]*u*d,p.y+=e[1]*u*d,p.z+=e[2]*u*d}const f=o?h:Hc(p.x,p.y,p.z,i),m=o?e.tilespaceRays.map((e=>Xc(e,d))):e.queryGeometry.screenGeometry,_=N.vec4.transformMat4([],[p.x,p.y,p.z,1],i);if(!s&&o?l*=_[3]/r.cameraToCenterDistance:s&&!o&&(l*=r.cameraToCenterDistance/_[3]),o){const e=dl((t.y/Xr+c.y)/(1<<c.z));l/=r.projection.pixelsPerMeter(e,1)/ul(1,e)}if(Dl(m,f,l))return!0}return!1}function Hc(e,t,r,i){const n=N.vec4.transformMat4([],[e,t,r,1],i);return new $(n[0]/n[3],n[1]/n[3])}const Wc=N.vec3.fromValues(0,0,0),Zc=N.vec3.fromValues(0,0,1);function Xc(e,t){const r=N.vec3.create();return Wc[2]=t,e.intersectsPlane(Wc,Zc,r),new $(r[0],r[1])}class Yc extends Rl{}let Jc,Kc,Qc,eu;function tu(e,{width:t,height:r},i,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==t*r*i)throw new RangeError("mismatched image size")}else n=new Uint8Array(t*r*i);return e.width=t,e.height=r,e.data=n,e}function ru(e,t,r){const{width:i,height:n}=t;i===e.width&&n===e.height||(iu(e,t,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,i),height:Math.min(e.height,n)},r,null),e.width=i,e.height=n,e.data=t.data)}function iu(e,t,r,i,n,o,s,a){if(0===n.width||0===n.height)return t;if(n.width>e.width||n.height>e.height||r.x>e.width-n.width||r.y>e.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>t.width||n.height>t.height||i.x>t.width-n.width||i.y>t.height-n.height)throw new RangeError("out of range destination coordinates for image copy");const l=e.data,c=t.data,u=4===o&&a;for(let a=0;a<n.height;a++){const h=((r.y+a)*e.width+r.x)*o,d=((i.y+a)*t.width+i.x)*o;if(u)for(let e=0;e<n.width;e++){const t=h+e*o+3,r=d+e*o;c[r+0]=255,c[r+1]=255,c[r+2]=255,c[r+3]=l[t]}else if(s)for(let e=0;e<n.width;e++){const t=h+e*o,r=d+e*o,i=l[t+3],n=new Mt(l[t+0]/255*i,l[t+1]/255*i,l[t+2]/255*i,i).toRenderColor(s).toArray();c[r+0]=n[0],c[r+1]=n[1],c[r+2]=n[2],c[r+3]=n[3]}else for(let e=0;e<n.width*o;e++)c[d+e]=l[h+e]}return t}so(Yc,"HeatmapBucket",{omit:["layers"]});class nu{constructor(e,t){tu(this,e,1,t)}resize(e){ru(this,new nu(e),1)}clone(){return new nu({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,r,i,n){iu(e,t,r,i,n,1,null)}}class ou{constructor(e,t){tu(this,e,4,t)}resize(e){ru(this,new ou(e),4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new ou({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,r,i,n,o,s){iu(e,t,r,i,n,4,o,s)}}class su{constructor(e,t){this.width=e.width,this.height=e.height,this.data=t instanceof Uint8Array?new Float32Array(t.buffer):t}}function au(e){const t={},r=e.resolution||256,i=e.clips?e.clips.length:1,n=e.image||new ou({width:r,height:i}),o=(r,i,o)=>{t[e.evaluationKey]=o;const s=e.expression.evaluate(t);s&&(n.data[r+i+0]=Math.floor(255*s.r/s.a),n.data[r+i+1]=Math.floor(255*s.g/s.a),n.data[r+i+2]=Math.floor(255*s.b/s.a),n.data[r+i+3]=Math.floor(255*s.a))};if(e.clips)for(let t=0,n=0;t<i;++t,n+=4*r)for(let i=0,s=0;i<r;i++,s+=4){const a=i/(r-1),{start:l,end:c}=e.clips[t];o(n,s,l*(1-a)+c*a)}else for(let e=0,t=0;e<r;e++,t+=4)o(0,t,e/(r-1));return n}so(nu,"AlphaImage"),so(ou,"RGBAImage");const lu=_s([{name:"a_pos",components:2,type:"Int16"}],4),{members:cu}=lu;function uu(e,t,r=2){const i=t&&t.length,n=i?t[0]*r:e.length;let o=hu(e,0,n,r,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,c;if(i&&(o=function(e,t,r,i){const n=[];for(let r=0,o=t.length;r<o;r++){const s=hu(e,t[r]*i,r<o-1?t[r+1]*i:e.length,i,!1);s===s.next&&(s.steiner=!0),n.push(wu(s))}n.sort(yu);for(let e=0;e<n.length;e++)r=xu(n[e],r);return r}(e,t,o,r)),e.length>80*r){a=1/0,l=1/0;let t=-1/0,i=-1/0;for(let o=r;o<n;o+=r){const r=e[o],n=e[o+1];r<a&&(a=r),n<l&&(l=n),r>t&&(t=r),n>i&&(i=n)}c=Math.max(t-a,i-l),c=0!==c?32767/c:0}return pu(o,s,r,a,l,c,0),s}function hu(e,t,r,i,n){let o;if(n===function(e,t,r,i){let n=0;for(let o=t,s=r-i;o<r;o+=i)n+=(e[s]-e[o])*(e[o+1]+e[s+1]),s=o;return n}(e,t,r,i)>0)for(let n=t;n<r;n+=i)o=zu(n/i|0,e[n],e[n+1],o);else for(let n=r-i;n>=t;n-=i)o=zu(n/i|0,e[n],e[n+1],o);return o&&Mu(o,o.next)&&(Du(o),o=o.next),o}function du(e,t){if(!e)return e;t||(t=e);let r,i=e;do{if(r=!1,i.steiner||!Mu(i,i.next)&&0!==Eu(i.prev,i,i.next))i=i.next;else{if(Du(i),i=t=i.prev,i===i.next)break;r=!0}}while(r||i!==t);return t}function pu(e,t,r,i,n,o,s){if(!e)return;!s&&o&&function(e,t,r,i){let n=e;do{0===n.z&&(n.z=bu(n.x,n.y,t,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){let t,r=1;do{let i,n=e;e=null;let o=null;for(t=0;n;){t++;let s=n,a=0;for(let e=0;e<r&&(a++,s=s.nextZ,s);e++);let l=r;for(;a>0||l>0&&s;)0!==a&&(0===l||!s||n.z<=s.z)?(i=n,n=n.nextZ,a--):(i=s,s=s.nextZ,l--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;n=s}o.nextZ=null,r*=2}while(t>1)}(n)}(e,i,n,o);let a=e;for(;e.prev!==e.next;){const l=e.prev,c=e.next;if(o?mu(e,i,n,o):fu(e))t.push(l.i,e.i,c.i),Du(e),e=c.next,a=c.next;else if((e=c)===a){s?1===s?pu(e=_u(du(e),t),t,r,i,n,o,2):2===s&&gu(e,t,r,i,n,o):pu(du(e),t,r,i,n,o,1);break}}}function fu(e){const t=e.prev,r=e,i=e.next;if(Eu(t,r,i)>=0)return!1;const n=t.x,o=r.x,s=i.x,a=t.y,l=r.y,c=i.y,u=n<o?n<s?n:s:o<s?o:s,h=a<l?a<c?a:c:l<c?l:c,d=n>o?n>s?n:s:o>s?o:s,p=a>l?a>c?a:c:l>c?l:c;let f=i.next;for(;f!==t;){if(f.x>=u&&f.x<=d&&f.y>=h&&f.y<=p&&Tu(n,a,o,l,s,c,f.x,f.y)&&Eu(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function mu(e,t,r,i){const n=e.prev,o=e,s=e.next;if(Eu(n,o,s)>=0)return!1;const a=n.x,l=o.x,c=s.x,u=n.y,h=o.y,d=s.y,p=a<l?a<c?a:c:l<c?l:c,f=u<h?u<d?u:d:h<d?h:d,m=a>l?a>c?a:c:l>c?l:c,_=u>h?u>d?u:d:h>d?h:d,g=bu(p,f,t,r,i),y=bu(m,_,t,r,i);let x=e.prevZ,v=e.nextZ;for(;x&&x.z>=g&&v&&v.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==s&&Tu(a,u,l,h,c,d,x.x,x.y)&&Eu(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==s&&Tu(a,u,l,h,c,d,v.x,v.y)&&Eu(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;x&&x.z>=g;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==s&&Tu(a,u,l,h,c,d,x.x,x.y)&&Eu(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=y;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==s&&Tu(a,u,l,h,c,d,v.x,v.y)&&Eu(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function _u(e,t){let r=e;do{const i=r.prev,n=r.next.next;!Mu(i,n)&&Au(i,r,r.next,n)&&Pu(i,n)&&Pu(n,i)&&(t.push(i.i,r.i,n.i),Du(r),Du(r.next),r=e=n),r=r.next}while(r!==e);return du(r)}function gu(e,t,r,i,n,o){let s=e;do{let e=s.next.next;for(;e!==s.prev;){if(s.i!==e.i&&Su(s,e)){let a=Ru(s,e);return s=du(s,s.next),a=du(a,a.next),pu(s,t,r,i,n,o,0),void pu(a,t,r,i,n,o,0)}e=e.next}s=s.next}while(s!==e)}function yu(e,t){return e.x-t.x}function xu(e,t){const r=function(e,t){let r=t;const i=e.x,n=e.y;let o,s=-1/0;do{if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){const e=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(e<=i&&e>s&&(s=e,o=r.x<r.next.x?r:r.next,e===i))return o}r=r.next}while(r!==t);if(!o)return null;const a=o,l=o.x,c=o.y;let u=1/0;r=o;do{if(i>=r.x&&r.x>=l&&i!==r.x&&Tu(n<c?i:s,n,l,c,n<c?s:i,n,r.x,r.y)){const t=Math.abs(n-r.y)/(i-r.x);Pu(r,e)&&(t<u||t===u&&(r.x>o.x||r.x===o.x&&vu(o,r)))&&(o=r,u=t)}r=r.next}while(r!==a);return o}(e,t);if(!r)return t;const i=Ru(r,e);return du(i,i.next),du(r,r.next)}function vu(e,t){return Eu(e.prev,e,t.prev)<0&&Eu(t.next,e,e.next)<0}function bu(e,t,r,i,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function wu(e){let t=e,r=e;do{(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next}while(t!==e);return r}function Tu(e,t,r,i,n,o,s,a){return(n-s)*(t-a)>=(e-s)*(o-a)&&(e-s)*(i-a)>=(r-s)*(t-a)&&(r-s)*(o-a)>=(n-s)*(i-a)}function Su(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&Au(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(e,t)&&(Pu(e,t)&&Pu(t,e)&&function(e,t){let r=e,i=!1;const n=(e.x+t.x)/2,o=(e.y+t.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==e);return i}(e,t)&&(Eu(e.prev,e,t.prev)||Eu(e,t.prev,t))||Mu(e,t)&&Eu(e.prev,e,e.next)>0&&Eu(t.prev,t,t.next)>0)}function Eu(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Mu(e,t){return e.x===t.x&&e.y===t.y}function Au(e,t,r,i){const n=Iu(Eu(e,t,r)),o=Iu(Eu(e,t,i)),s=Iu(Eu(r,i,e)),a=Iu(Eu(r,i,t));return n!==o&&s!==a||!(0!==n||!Cu(e,r,t))||!(0!==o||!Cu(e,i,t))||!(0!==s||!Cu(r,e,i))||!(0!==a||!Cu(r,t,i))}function Cu(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function Iu(e){return e>0?1:e<0?-1:0}function Pu(e,t){return Eu(e.prev,e,e.next)<0?Eu(e,t,e.next)>=0&&Eu(e,e.prev,t)>=0:Eu(e,t,e.prev)<0||Eu(e,e.next,t)<0}function Ru(e,t){const r=ku(e.i,e.x,e.y),i=ku(t.i,t.x,t.y),n=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=n,n.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function zu(e,t,r,i){const n=ku(e,t,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function Du(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function ku(e,t,r){return{i:e,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Ou(e,t){const r=e.length;if(r<=1)return[e];const i=[];let n,o;for(let t=0;t<r;t++){const r=me(e[t]);0!==r&&(e[t].area=Math.abs(r),void 0===o&&(o=r<0),o===r<0?(n&&i.push(n),n=[e[t]]):n.push(e[t]))}if(n&&i.push(n),t>1)for(let e=0;e<i.length;e++)i[e].length<=t||(yr(i[e],t,1,i[e].length-1,Lu),i[e]=i[e].slice(0,t));return i}function Lu(e,t){return t.area-e.area}function Bu(e,t,r){const i=r.patternDependencies;let n=!1;for(const r of t){const t=r.paint.get(`${e}-pattern`);t.isConstant()||(n=!0);const o=t.constantOr(null);o&&(n=!0,i[o]=!0)}return n}function Fu(e,t,r,i,n){const o=n.patternDependencies;for(const s of t){const t=s.paint.get(`${e}-pattern`).value;if("constant"!==t.kind){let e=t.evaluate({zoom:i},r,{},n.availableImages);e=e&&e.name?e.name:e,o[e]=!0,r.patterns[s.id]=e}}return r}class Nu{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.fqid)),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ys,this.indexArray=new Ls,this.indexArray2=new Rs,this.programConfigurations=new Na(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new da,this.segments2=new da,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.projection=e.projection}updateFootprints(e,t){}populate(e,t,r,i){this.hasPattern=Bu("fill",this.layers,t);const n=this.layers[0].layout.get("fill-sort-key"),o=[];for(const{feature:s,id:a,index:l,sourceLayerIndex:c}of e){const e=this.layers[0]._featureFilter.needGeometry,u=Cl(s,e);if(!this.layers[0]._featureFilter.filter(new Do(this.zoom),u,r))continue;const h=n?n.evaluate(u,{},r,t.availableImages):void 0,d={id:a,properties:s.properties,type:s.type,sourceLayerIndex:c,index:l,geometry:e?u.geometry:Al(s,r,i),patterns:{},sortKey:h};o.push(d)}n&&o.sort(((e,t)=>e.sortKey-t.sortKey));for(const i of o){const{geometry:n,index:o,sourceLayerIndex:s}=i;if(this.hasPattern){const e=Fu("fill",this.layers,i,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(i,n,o,r,{},t.availableImages,t.brightness);t.featureIndex.insert(e[o].feature,n,o,s,this.index)}}update(e,t,r,i,n){const o=0!==Object.keys(e).length;o&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,t,o?this.stateDependentLayers:this.layers,r,i,n)}addFeatures(e,t,r,i,n,o){for(const e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,r,i,o)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,cu),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,t,r,i,n,o=[],s){for(const e of Ou(t,500)){let t=0;for(const r of e)t+=r.length;const r=this.segments.prepareSegment(t,this.layoutVertexArray,this.indexArray),i=r.vertexLength,n=[],o=[];for(const t of e){if(0===t.length)continue;t!==e[0]&&o.push(n.length/2);const r=this.segments2.prepareSegment(t.length,this.layoutVertexArray,this.indexArray2),i=r.vertexLength;this.layoutVertexArray.emplaceBack(t[0].x,t[0].y),this.indexArray2.emplaceBack(i+t.length-1,i),n.push(t[0].x),n.push(t[0].y);for(let e=1;e<t.length;e++)this.layoutVertexArray.emplaceBack(t[e].x,t[e].y),this.indexArray2.emplaceBack(i+e-1,i+e),n.push(t[e].x),n.push(t[e].y);r.vertexLength+=t.length,r.primitiveLength+=t.length}const s=uu(n,o);for(let e=0;e<s.length;e+=3)this.indexArray.emplaceBack(i+s[e],i+s[e+1],i+s[e+2]);r.vertexLength+=t,r.primitiveLength+=s.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,n,o,i,s)}}let Vu,ju,Uu,$u;so(Nu,"FillBucket",{omit:["layers","patternFeatures"]});class Gu{constructor(e,t,r,i){if(this.triangleCount=t.length/3,this.min=new $(0,0),this.max=new $(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],0===this.triangleCount||0===e.length)return;const[n,o]=[e[0].clone(),e[0].clone()];for(let t=1;t<e.length;++t){const r=e[t];n.x=Math.min(n.x,r.x),n.y=Math.min(n.y,r.y),o.x=Math.max(o.x,r.x),o.y=Math.max(o.y,r.y)}if(i){const e=Math.ceil(Math.max(o.x-n.x,o.y-n.y)/i);r=Math.max(r,e)}if(0===r)return;this.min=n,this.max=o;const s=this.max.sub(this.min);s.x=Math.max(s.x,1),s.y=Math.max(s.y,1);const a=Math.max(s.x,s.y)/r;this.cellsX=Math.max(1,Math.ceil(s.x/a)),this.cellsY=Math.max(1,Math.ceil(s.y/a)),this.xScale=1/a,this.yScale=1/a;const l=[];for(let r=0;r<this.triangleCount;r++){const i=e[t[3*r+0]].sub(this.min),n=e[t[3*r+1]].sub(this.min),o=e[t[3*r+2]].sub(this.min),s=qu(Math.floor(Math.min(i.x,n.x,o.x)),this.xScale,this.cellsX),c=qu(Math.floor(Math.max(i.x,n.x,o.x)),this.xScale,this.cellsX),u=qu(Math.floor(Math.min(i.y,n.y,o.y)),this.yScale,this.cellsY),h=qu(Math.floor(Math.max(i.y,n.y,o.y)),this.yScale,this.cellsY),d=new $(0,0),p=new $(0,0),f=new $(0,0),m=new $(0,0);for(let e=u;e<=h;++e){d.y=p.y=e*a,f.y=m.y=(e+1)*a;for(let t=s;t<=c;++t)d.x=f.x=t*a,p.x=m.x=(t+1)*a,(ql(i,n,o,d,p,m)||ql(i,n,o,d,m,f))&&l.push({cellIdx:e*this.cellsX+t,triIdx:r})}}if(0===l.length)return;l.sort(((e,t)=>e.cellIdx-t.cellIdx||e.triIdx-t.triIdx));let c=0;for(;c<l.length;){const e=l[c].cellIdx,t={start:this.payload.length,len:0};for(;c<l.length&&l[c].cellIdx===e;)++t.len,this.payload.push(l[c++].triIdx);this.cells[e]=t}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,t){if(0===this.triangleCount||0===this.cells.length)return;if(e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const r=qu(e.x-this.min.x,this.xScale,this.cellsX),i=qu(e.y-this.min.y,this.yScale,this.cellsY),n=this.cells[i*this.cellsX+r];if(n){this._lazyInitLookup();for(let e=0;e<n.len;e++){const r=this.payload[n.start+e],i=Math.floor(r/8),o=1<<r%8;if(!(this.lookup[i]&o)&&(this.lookup[i]|=o,t.push(r),t.length===this.triangleCount))return}}}query(e,t,r){if(0===this.triangleCount||0===this.cells.length)return;if(e.x>this.max.x||this.min.x>t.x)return;if(e.y>this.max.y||this.min.y>t.y)return;this._lazyInitLookup();const i=qu(e.x-this.min.x,this.xScale,this.cellsX),n=qu(t.x-this.min.x,this.xScale,this.cellsX),o=qu(e.y-this.min.y,this.yScale,this.cellsY),s=qu(t.y-this.min.y,this.yScale,this.cellsY);for(let e=o;e<=s;e++)for(let t=i;t<=n;t++){const i=this.cells[e*this.cellsX+t];if(i)for(let e=0;e<i.len;e++){const t=this.payload[i.start+e],n=Math.floor(t/8),o=1<<t%8;if(!(this.lookup[n]&o)&&(this.lookup[n]|=o,r.push(t),r.length===this.triangleCount))return}}}}function qu(e,t,r){return Math.max(0,Math.min(r-1,Math.floor(e*t)))}so(Gu,"TriangleGridIndex");class Hu{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.fqid)),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.footprints=[]}updateFootprints(e,t){for(const r of this.footprints)t.push({footprint:r,id:e})}populate(e,t,r,i){const n=[];for(const{feature:t,id:o,index:s,sourceLayerIndex:a}of e){const e=this.layers[0]._featureFilter.needGeometry,l=Cl(t,e);if(!this.layers[0]._featureFilter.filter(new Do(this.zoom),l,r))continue;const c={id:o,properties:t.properties,type:t.type,sourceLayerIndex:a,index:s,geometry:e?l.geometry:Al(t,r,i),patterns:{}};n.push(c)}for(const i of n){const{geometry:n,index:o,sourceLayerIndex:s}=i;this.addFeature(i,n,o,r,{},t.availableImages,t.brightness),t.featureIndex.insert(e[o].feature,n,o,s,this.index)}}isEmpty(){return 0===this.footprints.length}uploadPending(){return!1}upload(e){}update(e,t,r,i,n){}destroy(){}addFeature(e,t,r,i,n,o=[],s){for(const e of Ou(t,2)){const t=[],r=[],i=[],n=new $(1/0,1/0),o=new $(-1/0,-1/0);for(const s of e)if(0!==s.length){s!==e[0]&&i.push(r.length/2);for(let e=0;e<s.length;e++)r.push(s[e].x),r.push(s[e].y),t.push(s[e]),n.x=Math.min(n.x,s[e].x),n.y=Math.min(n.y,s[e].y),o.x=Math.max(o.x,s[e].x),o.y=Math.max(o.y,s[e].y)}const s=uu(r,i),a=new Gu(t,s,8,256);this.footprints.push({vertices:t,indices:s,grid:a,min:n,max:o})}}}so(Hu,"ClipBucket",{omit:["layers"]});const Wu=_s([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),Zu=_s([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),Xu=_s([{name:"a_centroid_pos",components:2,type:"Uint16"}]),Yu=_s([{name:"a_join_normal_inside",components:3,type:"Int16"}]),Ju=_s([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),Ku=_s([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:Qu}=Wu;var eh,th,rh,ih,nh,oh,sh,ah={};function lh(){if(th)return eh;th=1;var e=U();function t(e,t,i,n,o){this.properties={},this.extent=i,this.type=0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=o,e.readFields(r,this,t)}function r(e,t,r){1==e?t.id=r.readVarint():2==e?function(e,t){for(var r=e.readVarint()+e.pos;e.pos<r;){var i=t._keys[e.readVarint()],n=t._values[e.readVarint()];t.properties[i]=n}}(r,t):3==e?t.type=r.readVarint():4==e&&(t._geometry=r.pos)}function i(e){for(var t,r,i=0,n=0,o=e.length,s=o-1;n<o;s=n++)i+=((r=e[s]).x-(t=e[n]).x)*(t.y+r.y);return i}return eh=t,t.types=["Unknown","Point","LineString","Polygon"],t.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var r,i=t.readVarint()+t.pos,n=1,o=0,s=0,a=0,l=[];t.pos<i;){if(o<=0){var c=t.readVarint();n=7&c,o=c>>3}if(o--,1===n||2===n)s+=t.readSVarint(),a+=t.readSVarint(),1===n&&(r&&l.push(r),r=[]),r.push(new e(s,a));else{if(7!==n)throw new Error("unknown command "+n);r&&r.push(r[0].clone())}}return r&&l.push(r),l},t.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,r=1,i=0,n=0,o=0,s=1/0,a=-1/0,l=1/0,c=-1/0;e.pos<t;){if(i<=0){var u=e.readVarint();r=7&u,i=u>>3}if(i--,1===r||2===r)(n+=e.readSVarint())<s&&(s=n),n>a&&(a=n),(o+=e.readSVarint())<l&&(l=o),o>c&&(c=o);else if(7!==r)throw new Error("unknown command "+r)}return[s,l,a,c]},t.prototype.toGeoJSON=function(e,r,n){var o,s,a=this.extent*Math.pow(2,n),l=this.extent*e,c=this.extent*r,u=this.loadGeometry(),h=t.types[this.type];function d(e){for(var t=0;t<e.length;t++){var r=e[t];e[t]=[360*(r.x+l)/a-180,360/Math.PI*Math.atan(Math.exp((180-360*(r.y+c)/a)*Math.PI/180))-90]}}switch(this.type){case 1:var p=[];for(o=0;o<u.length;o++)p[o]=u[o][0];d(u=p);break;case 2:for(o=0;o<u.length;o++)d(u[o]);break;case 3:for(u=function(e){var t=e.length;if(t<=1)return[e];for(var r,n,o=[],s=0;s<t;s++){var a=i(e[s]);0!==a&&(void 0===n&&(n=a<0),n===a<0?(r&&o.push(r),r=[e[s]]):r.push(e[s]))}return r&&o.push(r),o}(u),o=0;o<u.length;o++)for(s=0;s<u[o].length;s++)d(u[o][s])}1===u.length?u=u[0]:h="Multi"+h;var f={type:"Feature",geometry:{type:h,coordinates:u},properties:this.properties};return"id"in this&&(f.id=this.id),f},eh}function ch(){if(ih)return rh;ih=1;var e=lh();function t(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(r,this,t),this.length=this._features.length}function r(e,t,r){15===e?t.version=r.readVarint():1===e?t.name=r.readString():5===e?t.extent=r.readVarint():2===e?t._features.push(r.pos):3===e?t._keys.push(r.readString()):4===e&&t._values.push(function(e){for(var t=null,r=e.readVarint()+e.pos;e.pos<r;){var i=e.readVarint()>>3;t=1===i?e.readString():2===i?e.readFloat():3===i?e.readDouble():4===i?e.readVarint64():5===i?e.readVarint():6===i?e.readSVarint():7===i?e.readBoolean():null}return t}(r))}return rh=t,t.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var r=this._pbf.readVarint()+this._pbf.pos;return new e(this._pbf,r,this.extent,this._keys,this._values)},rh}function uh(){return sh||(sh=1,ah.VectorTile=function(){if(oh)return nh;oh=1;var e=ch();function t(t,r,i){if(3===t){var n=new e(i,i.readVarint()+i.pos);n.length&&(r[n.name]=n)}}return nh=function(e,r){this.layers=e.readFields(t,{},r)},nh}(),ah.VectorTileFeature=lh(),ah.VectorTileLayer=ch()),ah}var hh=uh();class dh extends ${constructor(e,t,r){super(e,t),this.z=r}}class ph extends dh{constructor(e,t,r,i){super(e,t,r),this.w=i}}function fh(e,t,r,i){const n=[],o=0===i?(e,t,r,i,n,o)=>{e.push(new $(o,r+(o-t)/(i-t)*(n-r)))}:(e,t,r,i,n,o)=>{e.push(new $(t+(o-r)/(n-r)*(i-t),o))};for(const s of e){const e=[];for(const n of s){if(n.length<=2)continue;const s=[];for(let e=0;e<n.length-1;e++){const a=n[e].x,l=n[e].y,c=n[e+1].x,u=n[e+1].y,h=0===i?a:l,d=0===i?c:u;h<t?d>t&&o(s,a,l,c,u,t):h>r?d<r&&o(s,a,l,c,u,r):s.push(n[e]),d<t&&h>=t&&o(s,a,l,c,u,t),d>r&&h<=r&&o(s,a,l,c,u,r)}let a=n[n.length-1];const l=0===i?a.x:a.y;l>=t&&l<=r&&s.push(a),s.length&&(a=s[s.length-1],s[0].x===a.x&&s[0].y===a.y||s.push(s[0]),e.push(s))}e.length&&n.push(e)}return n}function mh(e,t,r,i){const n="x"===r?"y":"x",o=(i-e[r])/(t[r]-e[r]);e[n]=e[n]+(t[n]-e[n])*o,e[r]=i,e.hasOwnProperty("z")&&(e.z=Ct(e.z,t.z,o)),e.hasOwnProperty("w")&&(e.w=Ct(e.w,t.w,o))}function _h(e,t,r,i){const n=r,o=i;for(const r of["x","y"]){let i=e,s=t;i[r]>=s[r]&&(i=t,s=e),i[r]<n&&s[r]>n&&mh(i,s,r,n),i[r]<o&&s[r]>o&&mh(s,i,r,o)}}const gh=Number.MAX_SAFE_INTEGER;function yh(e,t,r,i){return e.order<t||e.order===gh||!(e.clipMask&r)||function(e,t){return 0!==t.length&&void 0===t.find((t=>t===e))}(i,e.clipScope)}function xh(e,t){return e.x-t.x||e.y-t.y}function vh(e,t){return 0===xh(e.min,t.min)&&0===xh(e.max,t.max)}function bh(e,t){return!(e.min.x>t.max.x||e.max.x<t.min.x||e.min.y>t.max.y||e.max.y<t.min.y)}function wh(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r].sourceId!==t[r].sourceId||!vh(e[r],t[r])||e[r].order!==t[r].order||e[r].clipMask!==t[r].clipMask||!G(e[r].clipScope,t[r].clipScope))return!1;return!0}function Th(e,t,r){const i=1/Xr,n=1/(1<<r.canonical.z),o=(t.x*i+r.canonical.x)*n+r.wrap,s=(t.y*i+r.canonical.y)*n;return{min:new $((e.x*i+r.canonical.x)*n+r.wrap,(e.y*i+r.canonical.y)*n),max:new $(o,s)}}function Sh(e,t,r){const i=1<<r.canonical.z,n=((t.x-r.wrap)*i-r.canonical.x)*Xr,o=(t.y*i-r.canonical.y)*Xr;return{min:new $(((e.x-r.wrap)*i-r.canonical.x)*Xr,(e.y*i-r.canonical.y)*Xr),max:new $(n,o)}}function Eh(e,t,r,i,n,o,s){const a=e.indices,l=e.vertices,c=[];for(let u=i;u<i+n;u+=3){const i=t[r[u+0]+o],n=t[r[u+1]+o],h=t[r[u+2]+o],d=Math.min(i.x,n.x,h.x),p=Math.max(i.x,n.x,h.x),f=Math.min(i.y,n.y,h.y),m=Math.max(i.y,n.y,h.y);c.length=0,e.grid.query(new $(d,f),new $(p,m),c);for(let e=0;e<c.length;e++){const t=c[e];if(ql(l[a[3*t+0]],l[a[3*t+1]],l[a[3*t+2]],i,n,h,s))return!0}}return!1}function Mh(e,t,r,i){if(!e||!r)return!1;let n=e.vertices;if(!t.canonical.equals(i.canonical)||t.wrap!==i.wrap){if(r.vertices.length<e.vertices.length)return Mh(r,i,e,t);const o=t.canonical,s=i.canonical,a=Math.pow(2,s.z-o.z);n=e.vertices.map((e=>new $((e.x+o.x*Xr)*a-s.x*Xr,(e.y+o.y*Xr)*a-s.y*Xr)))}return Eh(r,n,e.indices,0,e.indices.length,0,0)}function Ah(e,t,r,i){const n=Math.pow(2,i.z-r.z);return new $((e+r.x*Xr)*n-i.x*Xr,(t+r.y*Xr)*n-i.y*Xr)}function Ch(e,t){const r=[];t.grid.queryPoint(e,r);const i=t.indices,n=t.vertices;for(let t=0;t<r.length;t++){const o=r[t];if(jl([n[i[3*o+0]],n[i[3*o+1]],n[i[3*o+2]]],e))return!0}return!1}const Ih=[new $(0,0),new $(Xr,0),new $(Xr,Xr),new $(0,Xr)];function Ph(e,t){const r=[];let i=[];if(!t||e.length<2)return[e];if(2===e.length)return $l(e[0],e[1],Ih)?[e]:[];for(let t=0;t<e.length+2;t++){const n=e[t%e.length],o=e[(t+1)%e.length],s=$l(0===t?e[e.length-1]:e[(t-1)%e.length],n,Ih),a=$l(n,o,Ih),l=s||a;l&&i.push(n),l&&a||i.length>0&&(i.length>1&&r.push(i),i=[])}return i.length>1&&r.push(i),r}const Rh=hh.VectorTileFeature.types,zh=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-emissive-strength"],Dh=["fill-extrusion-flood-light-ground-radius"],kh=Math.pow(2,13),Oh=Math.pow(2,15)-1,Lh=new $(0,1),Bh=2147483648;function Fh(e,t,r,i,n,o,s,a){e.emplaceBack((t<<1)+s,(r<<1)+o,(Math.floor(i*kh)<<1)+n,Math.round(a))}function Nh(e,t,r){e.emplaceBack(t.x*Xr,t.y*Xr,r?1:0)}function Vh(e,t,r,i,n,o){e.emplaceBack(t.x,t.y,(r.x<<1)+i,(r.y<<1)+n,o)}function jh(e,t,r){const i=16384;e.emplaceBack(t.x,t.y,t.z,r[0]*i,r[1]*i,r[2]*i)}class Uh{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class $h{constructor(){this.centroidXY=new $(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new $(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new $(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0}span(){return new $(this.max.x-this.min.x,this.max.y-this.min.y)}}class Gh{constructor(){this.acc=new $(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,t){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=t.x,e.min.y=e.max.y=t.y)}appendEdge(e,t,r){this.accCount++,this.acc._add(t);let i=!!this.borders;t.x<e.min.x?(e.min.x=t.x,i=!0):t.x>e.max.x&&(e.max.x=t.x,i=!0),t.y<e.min.y?(e.min.y=t.y,i=!0):t.y>e.max.y&&(e.max.y=t.y,i=!0),((0===t.x||t.x===Xr)&&t.x===r.x)!=((0===t.y||t.y===Xr)&&t.y===r.y)&&this.processBorderOverlap(t,r),i&&this.checkBorderIntersection(t,r)}checkBorderIntersection(e,t){t.x<0!=e.x<0&&this.addBorderIntersection(0,Ct(t.y,e.y,(0-t.x)/(e.x-t.x))),t.x>Xr!=e.x>Xr&&this.addBorderIntersection(1,Ct(t.y,e.y,(Xr-t.x)/(e.x-t.x))),t.y<0!=e.y<0&&this.addBorderIntersection(2,Ct(t.x,e.x,(0-t.y)/(e.y-t.y))),t.y>Xr!=e.y>Xr&&this.addBorderIntersection(3,Ct(t.x,e.x,(Xr-t.y)/(e.y-t.y)))}addBorderIntersection(e,t){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const r=this.borders[e];t<r[0]&&(r[0]=t),t>r[1]&&(r[1]=t)}processBorderOverlap(e,t){if(e.x===t.x){if(e.y===t.y)return;const r=0===e.x?0:1;this.addBorderIntersection(r,t.y),this.addBorderIntersection(r,e.y)}else{const r=0===e.y?2:3;this.addBorderIntersection(r,t.x),this.addBorderIntersection(r,e.x)}}centroid(){return 0===this.accCount?new $(0,0):new $(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce(((e,t)=>e+ +(t[0]!==Number.MAX_VALUE)),0):0}}function qh(e,t){const r=e.add(t)._unit(),i=Q(e.x*r.x+e.y*r.y,-1,1);var n,o,s;return s=Math.acos(i),Math.min(4,Math.max(-4,Math.tan(s)))/4*Oh*((n=e).x*(o=t).y-n.y*o.x<0?-1:1)}const Hh=[e=>e.x<0,e=>e.x>Xr,e=>e.y<0,e=>e.y>Xr];function Wh(e,t,r,i){const n=[4];if(0===i)return n;r._mult(i);const o=e.sub(r),s=t.sub(r),a=[e,t,o,s];for(let e=0;e<4;e++)for(const t of a)if(Hh[e](t)){n.push(e);break}return n}class Zh{constructor(e){this.vertexArray=new bs,this.indexArray=new Ls,this.programConfigurations=new Na(e.layers,{zoom:e.zoom,lut:e.lut},(e=>Dh.includes(e))),this._segments=new da,this.hiddenByLandmarkVertexArray=new Ys,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new da}getDefaultSegment(){return this.regionSegments[4]}hasData(){return 0!==this.vertexArray.length}addData(e,t,r,i=!1){const n=e.length;if(n>2){let o=Math.max(0,this._segments.get().length-1);const s=this._segments._prepareSegment(4*n,this.vertexArray.length,2*this._segmentToGroundQuads[o].length);let a;o!==this._segments.get().length-1&&(o++,this._segmentToGroundQuads[o]=[],this._segmentToRegionTriCounts[o]=[0,0,0,0,0]);{const t=e[0],r=e[1];a=qh(t.sub(e[n-1])._perp()._unit(),r.sub(t)._perp()._unit())}for(let l=0;l<n;l++){const c=l===n-1?0:l+1,u=e[l],h=e[c],d=e[c===n-1?0:c+1],p=h.sub(u)._perp()._unit(),f=qh(p,d.sub(h)._perp()._unit()),m=a,_=f;if(Qh(u,h,t)||i&&ed(u,t)&&ed(h,t)){a=f;continue}const g=s.vertexLength;Vh(this.vertexArray,u,h,1,1,m),Vh(this.vertexArray,u,h,1,0,m),Vh(this.vertexArray,u,h,0,1,_),Vh(this.vertexArray,u,h,0,0,_),s.vertexLength+=4;const y=Wh(u,h,p,r);for(const e of y)this._segmentToGroundQuads[o].push({id:g,region:e}),this._segmentToRegionTriCounts[o][e]+=2,s.primitiveLength+=2;a=f}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),t=e.length;for(let e=0;e<t;e++)this._segmentToGroundQuads[e].sort(((e,t)=>e.region-t.region));for(let r=0;r<t;r++){const t=this._segmentToGroundQuads[r],i=e[r],n=this._segmentToRegionTriCounts[r];n.reduce(((e,t)=>e+t),0);let o=0;for(let e=0;e<=4;e++){const t=n[e];if(0!==t){let r=this.regionSegments[e];r||(r=this.regionSegments[e]=new da);const n={vertexOffset:i.vertexOffset,primitiveOffset:i.primitiveOffset+o,vertexLength:i.vertexLength,primitiveLength:t};r.get().push(n)}o+=t}for(let e=0;e<t.length;e++){const r=t[e].id;this.indexArray.emplaceBack(r,r+1,r+3),this.indexArray.emplaceBack(r,r+3,r+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,t,r,i,n,o){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,t,r,i,n,o)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,Zu.members),this.indexBuffer=e.createIndexBuffer(this.indexArray))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,t,r,i,n,o){this.hasData()&&this.programConfigurations.updatePaintArrays(e,t,r,i,n,o)}updateHiddenByLandmark(e){if(!this.hasData())return;const t=e.groundVertexCount+e.groundVertexArrayOffset;if(0===e.groundVertexCount)return;const r=e.flags&Bh?1:0;for(let i=e.groundVertexArrayOffset;i<t;++i)this.hiddenByLandmarkVertexArray.emplace(i,r);this._needsHiddenByLandmarkUpdate=!0}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,Ju.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const t=this.regionSegments[e];t&&t.destroy()}}}}class Xh{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.fqid)),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new Ls,this.footprintVertices=new ys,this.footprintSegments=[],this.layoutVertexArray=new vs,this.centroidVertexArray=new aa,this.wallVertexArray=new ca,this.indexArray=new Ls,this.programConfigurations=new Na(e.layers,{zoom:e.zoom,lut:e.lut},(e=>zh.includes(e))),this.segments=new da,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.groundEffect=new Zh(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[]}updateFootprints(e,t){}populate(e,t,r,i){this.features=[],this.hasPattern=Bu("fill-extrusion",this.layers,t),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=yl(r),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=0!==this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1);for(const{feature:n,id:o,index:s,sourceLayerIndex:a}of e){const e=this.layers[0]._featureFilter.needGeometry,l=Cl(n,e);if(!this.layers[0]._featureFilter.filter(new Do(this.zoom),l,r))continue;const c={id:o,sourceLayerIndex:a,index:s,geometry:e?l.geometry:Al(n,r,i),properties:n.properties,type:n.type,patterns:{}},u=this.layoutVertexArray.length,h="Polygon"===Rh[c.type];if(this.hasPattern)this.features.push(Fu("fill-extrusion",this.layers,c,this.zoom,t));else if(this.wallMode)for(const e of c.geometry)for(const n of Ph(e,h))this.addFeature(c,[n],s,r,{},t.availableImages,i,t.brightness);else this.addFeature(c,c.geometry,s,r,{},t.availableImages,i,t.brightness);t.featureIndex.insert(n,c.geometry,s,a,this.index,u)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,t,r,i,n,o){for(const e of this.features){const s="Polygon"===Rh[e.type],{geometry:a}=e;if(this.wallMode)for(const l of a)for(const a of Ph(l,s))this.addFeature(e,[a],e.index,t,r,i,n,o);else this.addFeature(e,a,e.index,t,r,i,n,o)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles()}update(e,t,r,i,n){const o=0!==Object.keys(e).length;if(o&&!this.stateDependentLayers.length)return;const s=o?this.stateDependentLayers:this.layers;this.programConfigurations.updatePaintArrays(e,t,s,r,i,n),this.groundEffect.update(e,t,s,r,i,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Qu),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,Yu.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,Ku.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Xu.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,r,i,n,o,s,a){const l=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(e,{})/this.tileToMeter,c=[new $(0,0),new $(Xr,Xr)],u=s.projection,h="globe"===u.name,d=this.wallMode||"Polygon"===Rh[e.type],p=new Gh;p.centroidDataIndex=this.centroidData.length;const f=new $h,m=this.layers[0].paint.get("fill-extrusion-base").evaluate(e,{},i)<=0,_=this.layers[0].paint.get("fill-extrusion-height").evaluate(e,{},i);let g;if(f.height=_,f.vertexArrayOffset=this.layoutVertexArray.length,f.groundVertexArrayOffset=this.groundEffect.vertexArray.length,h&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new As),this.wallMode){if(h)return void pe("Non zero fill-extrusion-line-width is not yet supported on globe.");if(1!==t.length)return;g=function(e){const t=e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y,r=function(e){let t=0;const r=e.length;for(let i=0;i<r;i++)t+=(e[(i+1)%r].x-e[i].x)*(e[(i+1)%r].y+e[i].y);return t>=0}(e);r||(e=e.reverse());const i={geometry:[],joinNormals:[],indices:[]},n=[],o=[],s=[];let a=e.length;if(a<(t?3:2))return i;for(;a>=2&&e[a-1].equals(e[a-2]);)a--;let l,c,u,h,d,p=0;for(;p<a-1&&e[p].equals(e[p+1]);)p++;t&&(l=e[a-2],d=e[p].sub(l)._unit()._perp());for(let r=p;r<a;r++){if(u=r===a-1?t?e[p+1]:void 0:e[r+1],u&&e[r].equals(u))continue;d&&(h=d),l&&(c=l),l=e[r],d=u?u.sub(l)._unit()._perp():h,h=h||d;let i=h.add(d);0===i.x&&0===i.y||i._unit();const f=i.x*d.x+i.y*d.y,m=0!==f?1/f:1/0,_=h.x*d.y-h.y*d.x>0;let g="miter";const y=2;"miter"===g&&m>y&&(g="bevel"),"bevel"===g&&(m>100&&(g="flipbevel"),m<y&&(g="miter"));const x=(e,t,r,i)=>{const a=new $(e.x,e.y),l=new $(e.x,e.y);a.x+=t.x*i,a.y+=t.y*i,l.x-=t.x*Math.max(r,1),l.y-=t.y*Math.max(r,1),s.push(t),n.push(a),o.push(l)};if("miter"===g)i._mult(m),x(l,i,0,0);else if("flipbevel"===g)i=d.mult(-1),x(l,i,0,0),x(l,i.mult(-1),0,0);else{const e=-Math.sqrt(m*m-1),t=_?e:0,r=_?0:e;c&&x(l,h,t,r),u&&x(l,d,t,r)}}i.geometry=[...n,...o.reverse(),n[0]],i.joinNormals=[...s,...s.reverse(),s[s.length-1]];const f=i.geometry.length-1;for(let e=0;e<f/2;e++)if(e+1<f/2){let t=e,r=e+1,n=f-1-e,o=f-2-e;t=0===t?f-1:t-1,r=0===r?f-1:r-1,n=0===n?f-1:n-1,o=0===o?f-1:o-1,i.indices.push(n),i.indices.push(r),i.indices.push(t),i.indices.push(n),i.indices.push(o),i.indices.push(r)}return i}(t[0]),t=[g.geometry]}const y=(e,t)=>e<(t.length-1)/2||e===t.length-1,x=this.wallMode?[t]:Ou(t,500);for(let e=x.length-1;e>=0;e--){const t=x[e];(0===t.length||(v=t[0]).every((e=>e.x<=0))||v.every((e=>e.x>=Xr))||v.every((e=>e.y<=0))||v.every((e=>e.y>=Xr)))&&x.splice(e,1)}var v;let b;if(h)b=nd(x,c,i);else{b=[];for(const e of x)b.push({polygon:e,bounds:c})}const w=d?this.edgeRadius:0,T=w>0&&this.zoom<17,S=(e,t)=>{if(0===e.length)return!1;const r=e[e.length-1];return t.x===r.x&&t.y===r.y};for(const{polygon:e,bounds:t}of b){let r=0,n=0;for(const t of e)d&&!t[0].equals(t[t.length-1])&&t.push(t[0]),n+=d?t.length-1:t.length;const o=this.segments.prepareSegment((d?5:4)*n,this.layoutVertexArray,this.indexArray);f.footprintSegIdx<0&&(f.footprintSegIdx=this.footprintSegments.length),f.polygonSegIdx<0&&(f.polygonSegIdx=this.polygonSegments.length);const s={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},a=new Uh;if(a.vertexOffset=this.footprintVertices.length,a.indexOffset=3*this.footprintIndices.length,a.ringIndices=[],d){const n=[],s=[];r=o.vertexLength;for(let r=0;r<e.length;r++){const c=e[r];c.length&&0!==r&&s.push(n.length/2);const d=[];let p,f;p=c[1].sub(c[0])._perp()._unit(),a.ringIndices.push(c.length-1);for(let e=1;e<c.length;e++){const t=c[e],r=c[e===c.length-1?1:e+1],s=t.clone();if(w){f=r.sub(t)._perp()._unit();const e=p.add(f)._unit(),i=w*Math.min(4,1/(p.x*e.x+p.y*e.y));s.x+=i*e.x,s.y+=i*e.y,s.x=Math.round(s.x),s.y=Math.round(s.y),p=f}if(!m||0!==w&&!T||S(d,s)||d.push(s),Fh(this.layoutVertexArray,s.x,s.y,0,0,1,1,0),this.wallMode){const t=y(e,c);Nh(this.wallVertexArray,g.joinNormals[e],!t)}o.vertexLength++,this.footprintVertices.emplaceBack(t.x,t.y),n.push(t.x,t.y),h&&jh(this.layoutVertexExtArray,u.projectTilePoint(s.x,s.y,i),u.upVector(i,s.x,s.y))}m&&(0===w||T)&&(0!==d.length&&S(d,d[0])&&d.pop(),this.groundEffect.addData(d,t,l))}const c=this.wallMode?g.indices:uu(n,s);for(let e=0;e<c.length;e+=3)this.footprintIndices.emplaceBack(a.vertexOffset+c[e+0],a.vertexOffset+c[e+1],a.vertexOffset+c[e+2]),this.indexArray.emplaceBack(r+c[e],r+c[e+2],r+c[e+1]),o.primitiveLength++;a.indexCount+=c.length,a.vertexCount+=this.footprintVertices.length-a.vertexOffset}for(let n=0;n<e.length;n++){const s=e[n];p.startRing(f,s[0]);let a=s.length>4&&td(s[s.length-2],s[0],s[1]),c=w?Jh(s[s.length-2],s[0],s[1],w):0;const _=[];let x,v,b;v=s[1].sub(s[0])._perp()._unit();let T=!0;for(let e=1,n=0;e<s.length;e++){let l=s[e-1],d=s[e];const E=s[e===s.length-1?1:e+1];if(p.appendEdge(f,d,l),Qh(d,l,t)){w&&(v=E.sub(d)._perp()._unit(),T=!T);continue}const M=d.sub(l)._perp(),A=M.x/(Math.abs(M.x)+Math.abs(M.y)),C=M.y>0?1:0,I=l.dist(d);if(n+I>32768&&(n=0),w){b=E.sub(d)._perp()._unit();let e=Kh(l,d,E,Yh(v,b),w);isNaN(e)&&(e=0);const t=d.sub(l)._unit();l=l.add(t.mult(c))._round(),d=d.add(t.mult(-e))._round(),c=e,v=b,m&&this.zoom>=17&&(S(_,l)||_.push(l),S(_,d)||_.push(d))}const P=o.vertexLength,R=s.length>4&&td(l,d,E);let z=rd(n,a,T);if(Fh(this.layoutVertexArray,l.x,l.y,A,C,0,0,z),Fh(this.layoutVertexArray,l.x,l.y,A,C,0,1,z),this.wallMode){const t=y(e-1,s),r=g.joinNormals[e-1];Nh(this.wallVertexArray,r,t),Nh(this.wallVertexArray,r,t)}if(n+=I,z=rd(n,R,!T),a=R,Fh(this.layoutVertexArray,d.x,d.y,A,C,0,0,z),Fh(this.layoutVertexArray,d.x,d.y,A,C,0,1,z),this.wallMode){const t=y(e,s),r=g.joinNormals[e];Nh(this.wallVertexArray,r,t),Nh(this.wallVertexArray,r,t)}if(o.vertexLength+=4,this.indexArray.emplaceBack(P+0,P+1,P+2),this.indexArray.emplaceBack(P+1,P+3,P+2),o.primitiveLength+=2,w){const i=r+(1===e?s.length-2:e-2),n=1===e?r:i+1;if(this.indexArray.emplaceBack(P+1,i,P+3),this.indexArray.emplaceBack(i,n,P+3),o.primitiveLength+=2,void 0===x&&(x=P),!Qh(E,s[e],t)){const t=e===s.length-1?x:o.vertexLength;this.indexArray.emplaceBack(P+2,P+3,t),this.indexArray.emplaceBack(P+3,t+1,t),this.indexArray.emplaceBack(P+3,n,t+1),o.primitiveLength+=3}T=!T}if(h){const e=this.layoutVertexExtArray,t=u.projectTilePoint(l.x,l.y,i),r=u.projectTilePoint(d.x,d.y,i),n=u.upVector(i,l.x,l.y),o=u.upVector(i,d.x,d.y);jh(e,t,n),jh(e,t,n),jh(e,r,o),jh(e,r,o)}}d&&(r+=s.length-1),m&&w&&this.zoom>=17&&(0!==_.length&&S(_,_[0])&&_.pop(),this.groundEffect.addData(_,t,l,w>0))}this.footprintSegments.push(a),s.triangleCount=this.indexArray.length-s.triangleArrayOffset,this.polygonSegments.push(s),++f.footprintSegLen,++f.polygonSegLen}if(f.vertexCount=this.layoutVertexArray.length-f.vertexArrayOffset,f.groundVertexCount=this.groundEffect.vertexArray.length-f.groundVertexArrayOffset,0!==f.vertexCount){if(f.centroidXY=p.borders?Lh:this.encodeCentroid(p,f),this.centroidData.push(f),p.borders){this.featuresOnBorder.push(p);const e=this.featuresOnBorder.length-1;for(let t=0;t<p.borders.length;t++)p.borders[t][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[t].push(e)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,n,o,i,a),this.groundEffect.addPaintPropertiesData(e,r,n,o,i,a),this.maxHeight=Math.max(this.maxHeight,_)}}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort(((t,r)=>this.featuresOnBorder[t].borders[e][0]-this.featuresOnBorder[r].borders[e][0]))}splitToSubtiles(){const e=[];for(let t=0;t<this.centroidData.length;t++){const r=this.centroidData[t],i=+(r.min.y+r.max.y>Xr),n=2*i+(+(r.min.x+r.max.x>Xr)^i);for(let i=0;i<r.polygonSegLen;i++){const o=r.polygonSegIdx+i;e.push({centroidIdx:t,subtile:n,polygonSegmentIdx:o,triangleSegmentIdx:this.polygonSegments[o].triangleSegIdx})}}const t=new Ls;e.sort(((e,t)=>e.triangleSegmentIdx===t.triangleSegmentIdx?e.subtile-t.subtile:e.triangleSegmentIdx-t.triangleSegmentIdx));let r=0,i=0,n=0;for(const t of e){if(t.triangleSegmentIdx!==r)break;n++}const o=e.length;for(;i!==e.length;){r=e[i].triangleSegmentIdx;let s=0,a=i,l=i;for(let t=a;t<n&&e[t].subtile===s;t++)l++;for(;a!==n;){const i=e[a];s=i.subtile;const o=this.centroidData[i.centroidIdx].min.clone(),c=this.centroidData[i.centroidIdx].max.clone(),u={vertexOffset:this.segments.segments[r].vertexOffset,primitiveOffset:t.length,vertexLength:this.segments.segments[r].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let r=a;r<l;r++){const i=e[r],n=this.polygonSegments[i.polygonSegmentIdx],s=this.centroidData[i.centroidIdx].min,a=this.centroidData[i.centroidIdx].max,l=this.indexArray.uint16;for(let e=n.triangleArrayOffset;e<n.triangleArrayOffset+n.triangleCount;e++)t.emplaceBack(l[3*e],l[3*e+1],l[3*e+2]);u.primitiveLength+=n.triangleCount,o.x=Math.min(o.x,s.x),o.y=Math.min(o.y,s.y),c.x=Math.max(c.x,a.x),c.y=Math.max(c.y,a.y)}u.primitiveLength>0&&this.triangleSubSegments.push({segment:u,min:o,max:c}),a=l;for(let t=a;t<n&&e[t].subtile===e[a].subtile;t++)l++}i=n;for(let t=i;t<o&&e[t].triangleSegmentIdx===e[i].triangleSegmentIdx;t++)n++}t._trim(),this.indexArray=t}getVisibleSegments(e,t,r){const i=new da;if(this.wallMode){for(const e of this.triangleSubSegments)i.segments.push(e.segment);return i}let n=0,o=0;const s=1<<e.canonical.z;if(t){const r=t.getMinMaxForTile(e);r&&(n=r.min,o=r.max)}o+=this.maxHeight;const a=e.toUnwrapped();let l;const c=[a.canonical.x/s+a.wrap,a.canonical.y/s],u=[(a.canonical.x+1)/s+a.wrap,(a.canonical.y+1)/s],h=(e,t,r)=>[e[0]*(1-r[0])+t[0]*r[0],e[1]*(1-r[1])+t[1]*r[1]],d=[],p=[];for(const e of this.triangleSubSegments){d[0]=e.min.x/Xr,d[1]=e.min.y/Xr,p[0]=e.max.x/Xr,p[1]=e.max.y/Xr;const t=h(c,u,d),s=h(c,u,p);if(0===new gc([t[0],t[1],n],[s[0],s[1],o]).intersectsPrecise(r)){l&&(i.segments.push(l),l=void 0);continue}const a=e.segment;l&&l.vertexOffset!==a.vertexOffset&&(i.segments.push(l),l=void 0),l?(l.vertexLength+=a.vertexLength,l.primitiveLength+=a.primitiveLength):l={vertexOffset:a.vertexOffset,primitiveLength:a.primitiveLength,vertexLength:a.vertexLength,primitiveOffset:a.primitiveOffset,sortKey:void 0,vaos:{}}}return l&&i.segments.push(l),i}encodeCentroid(e,t){const r=e.centroid(),i=t.span(),n=Math.min(7,Math.round(i.x*this.tileToMeter/10)),o=Math.min(7,Math.round(i.y*this.tileToMeter/10));return new $(Q(r.x,1,Xr-1)<<3|n,Q(r.y,1,Xr-1)<<3|o)}encodeBorderCentroid(e){if(!e.borders)return new $(0,0);const t=e.borders,r=Number.MAX_VALUE;if(t[0][0]!==r||t[1][0]!==r){const e=t[0][0]!==r?0:1;return new $(6|(t[0][0]!==r?0:65528),(t[e][0]+t[e][1])/2<<3|6)}{const e=t[2][0]!==r?2:3;return new $((t[e][0]+t[e][1])/2<<3|6,6|(t[2][0]!==r?0:65528))}}showCentroid(e){const t=this.centroidData[e.centroidDataIndex];t.flags&=Bh,t.centroidXY.x=0,t.centroidXY.y=0,this.writeCentroidToBuffer(t)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const t=e.vertexArrayOffset,r=e.vertexCount+e.vertexArrayOffset,i=e.flags&Bh?Lh:e.centroidXY,n=this.centroidVertexArray.geta_centroid_pos0(t);if(this.centroidVertexArray.geta_centroid_pos1(t)!==i.y||n!==i.x){for(let e=t;e<r;++e)this.centroidVertexArray.emplace(e,i.x,i.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const e of this.centroidData)this.writeCentroidToBuffer(e)}updateReplacement(e,t,r){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const i=t.getReplacementRegionsForTile(e.toUnwrapped());if(wh(this.activeReplacements,i))return;if(this.activeReplacements=i,0===this.centroidVertexArray.length)this.createCentroidsBuffer();else for(const e of this.centroidData)e.flags&=2147483647;const n=[];for(const t of this.activeReplacements){if(t.order<r)continue;const i=Math.max(1,Math.pow(2,t.footprintTileId.canonical.z-e.canonical.z));for(const r of this.centroidData)if(!(r.flags&Bh||t.min.x>r.max.x||r.min.x>t.max.x||t.min.y>r.max.y||r.min.y>t.max.y))for(let o=0;o<r.footprintSegLen;o++){const s=this.footprintSegments[r.footprintSegIdx+o];if(n.length=0,od(this.footprintVertices,s.vertexOffset,s.vertexCount,t.footprintTileId.canonical,e.canonical,n),Eh(t.footprint,n,this.footprintIndices.uint16,s.indexOffset,s.indexCount,-s.vertexOffset,-i)){r.flags|=Bh;break}}}for(const e of this.centroidData)this.writeCentroidToBuffer(e);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,t,r){let i=!1;for(let n=0;n<r.footprintSegLen;n++){const o=this.footprintSegments[r.footprintSegIdx+n];let s=0;for(const r of o.ringIndices){for(let n=s,a=r+s-1;n<r+s;a=n++){const r=this.footprintVertices.int16[2*(n+o.vertexOffset)+0],s=this.footprintVertices.int16[2*(n+o.vertexOffset)+1],l=this.footprintVertices.int16[2*(a+o.vertexOffset)+1];s>t!=l>t&&e<(this.footprintVertices.int16[2*(a+o.vertexOffset)+0]-r)*(t-s)/(l-s)+r&&(i=!i)}s=r}}return i}getHeightAtTileCoord(e,t){let r=Number.NEGATIVE_INFINITY,i=!0;const n=4*(e+Xr)*Xr+(t+Xr);if(this.partLookup.hasOwnProperty(n)){const e=this.partLookup[n];return e?{height:e.height,hidden:!!(e.flags&Bh)}:void 0}for(const o of this.centroidData)e>o.max.x||o.min.x>e||t>o.max.y||o.min.y>t||this.footprintContainsPoint(e,t,o)&&o&&o.height>r&&(r=o.height,this.partLookup[n]=o,i=!!(o.flags&Bh));if(r!==Number.NEGATIVE_INFINITY)return{height:r,hidden:i};this.partLookup[n]=void 0}}function Yh(e,t){const r=e.add(t)._unit();return e.x*r.x+e.y*r.y}function Jh(e,t,r,i){const n=t.sub(e)._perp()._unit(),o=r.sub(t)._perp()._unit();return Kh(e,t,r,Yh(n,o),i)}function Kh(e,t,r,i,n){const o=Math.sqrt(1-i*i);return Math.min(e.dist(t)/3,t.dist(r)/3,n*o/i)}function Qh(e,t,r){return e.x<r[0].x&&t.x<r[0].x||e.x>r[1].x&&t.x>r[1].x||e.y<r[0].y&&t.y<r[0].y||e.y>r[1].y&&t.y>r[1].y}function ed(e,t){return e.x<t[0].x||e.x>t[1].x||e.y<t[0].y||e.y>t[1].y}function td(e,t,r){if(e.x<0||e.x>=Xr||t.x<0||t.x>=Xr||r.x<0||r.x>=Xr)return!1;const i=r.sub(t),n=i.perp(),o=e.sub(t);return(i.x*o.x+i.y*o.y)/Math.sqrt((i.x*i.x+i.y*i.y)*(o.x*o.x+o.y*o.y))>-.866&&n.x*o.x+n.y*o.y<0}function rd(e,t,r){const i=t?2|e:-3&e;return r?1|i:-2&i}function id(){const e=Math.PI/32,t=Math.tan(e),r=tl;return r*Math.sqrt(1+2*t*t)-r}function nd(e,t,r){const i=1<<r.z,n=hl(r.x/i),o=hl((r.x+1)/i),s=dl(r.y/i),a=dl((r.y+1)/i);return function(e,t,r,i,n=0,o){const s=[];if(!e.length||!r||!i)return s;const a=(e,t)=>{for(const r of e)s.push({polygon:r,bounds:t})},l=Math.ceil(Math.log2(r)),c=Math.ceil(Math.log2(i)),u=l-c,h=[];for(let e=0;e<Math.abs(u);e++)h.push(u>0?0:1);for(let e=0;e<Math.min(l,c);e++)h.push(0),h.push(1);let d=e;if(d=fh(d,t[0].y-n,t[1].y+n,1),d=fh(d,t[0].x-n,t[1].x+n,0),!d.length)return s;const p=[];for(h.length?p.push({polygons:d,bounds:t,depth:0}):a(d,t);p.length;){const e=p.pop(),t=e.depth,r=h[t],i=e.bounds[0],s=e.bounds[1],l=0===r?i.x:i.y,c=0===r?s.x:s.y,u=o?o(r,l,c):.5*(l+c),d=fh(e.polygons,l-n,u+n,r),f=fh(e.polygons,u-n,c+n,r);if(d.length){const e=[i,new $(0===r?u:s.x,1===r?u:s.y)];h.length>t+1?p.push({polygons:d,bounds:e,depth:t+1}):a(d,e)}if(f.length){const e=[new $(0===r?u:i.x,1===r?u:i.y),s];h.length>t+1?p.push({polygons:f,bounds:e,depth:t+1}):a(f,e)}}return s}(e,t,Math.ceil((o-n)/11.25),Math.ceil((s-a)/11.25),1,((e,t,n)=>{if(0===e)return.5*(t+n);{const e=dl((r.y+t/Xr)/i);return(cl(.5*(dl((r.y+n/Xr)/i)+e))*i-r.y)*Xr}}))}function od(e,t,r,i,n,o){const s=Math.pow(2,i.z-n.z);for(let a=0;a<r;a++){let r=e.int16[2*(a+t)+0],l=e.int16[2*(a+t)+1];r=(r+n.x*Xr)*s-i.x*Xr,l=(l+n.y*Xr)*s-i.y*Xr,o.push(new $(r,l))}}let sd,ad;function ld(e,t){return e.x*t.x+e.y*t.y}function cd(e,t){if(1===e.length){let r=0;const i=t[r++];let n;for(;!n||i.equals(n);)if(n=t[r++],!n)return 1/0;for(;r<t.length;r++){const o=t[r],s=e[0],a=n.sub(i),l=o.sub(i),c=s.sub(i),u=ld(a,a),h=ld(a,l),d=ld(l,l),p=ld(c,a),f=ld(c,l),m=u*d-h*h,_=(d*p-h*f)/m,g=(u*f-h*p)/m,y=i.z*(1-_-g)+n.z*_+o.z*g;if(isFinite(y))return y}return 1/0}{let e=1/0;for(const r of t)e=Math.min(e,r.z);return e}}function ud(e,t,r,i,n,o,s,a){const l=s*n.getElevationAt(e,t,!0,!0),c=0!==o[0],u=c?0===o[1]?s*(o[0]/7-450):s*function(e,t,r){const i=Math.floor(t[0]/8),n=Math.floor(t[1]/8),o=10*(t[0]-8*i),s=10*(t[1]-8*n),a=e.getElevationAt(i,n,!0,!0),l=e.getMeterToDEM(r),c=Math.floor(.5*(o*l-1)),u=Math.floor(.5*(s*l-1)),h=e.tileCoordToPixel(i,n),d=2*c+1,p=2*u+1,f=function(e,t,r,i,n){return[e.getElevationAtPixel(t,r,!0),e.getElevationAtPixel(t+n,r,!0),e.getElevationAtPixel(t,r+n,!0),e.getElevationAtPixel(t+i,r+n,!0)]}(e,h.x-c,h.y-u,d,p),m=Math.abs(f[0]-f[1]),_=Math.abs(f[2]-f[3]),g=Math.abs(f[0]-f[2])+Math.abs(f[1]-f[3]),y=Math.min(.25,.5*l*(m+_)/d),x=Math.min(.25,.5*l*g/p);return a+Math.max(y*o,x*s)}(n,o,a):l;return{base:l+(0===r?-1:r),top:c?Math.max(u+i,l+r+2):l+i}}so(Xh,"FillExtrusionBucket",{omit:["layers","features"]}),so($h,"PartData"),so(Uh,"FootprintSegment"),so(Gh,"BorderCentroidData"),so(Zh,"GroundEffect");const hd=_s([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),dd=_s([{name:"a_z_offset",components:1,type:"Float32"}],4),{members:pd}=hd,fd=_s([{name:"a_packed",components:4,type:"Float32"}]),{members:md}=fd,_d=_s([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:gd}=_d;class yd{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.image=new nu({width:e,height:t}),this.positions={},this.uploaded=!1}getDash(e,t){const r=this.getKey(e,t);return this.positions[r]}trim(){const e=this.width,t=this.height=se(this.nextRow);this.image.resize({width:e,height:t})}getKey(e,t){return e.join(",")+t}getDashRanges(e,t,r){const i=[];let n=e.length%2==1?-e[e.length-1]*r:0,o=e[0]*r,s=!0;i.push({left:n,right:o,isDash:s,zeroLength:0===e[0]});let a=e[0];for(let t=1;t<e.length;t++){s=!s;const l=e[t];n=a*r,a+=l,o=a*r,i.push({left:n,right:o,isDash:s,zeroLength:0===l})}return i}addRoundDash(e,t,r){const i=t/2;for(let t=-r;t<=r;t++){const n=this.width*(this.nextRow+r+t);let o=0,s=e[o];for(let a=0;a<this.width;a++){a/s.right>1&&(s=e[++o]);const l=Math.abs(a-s.left),c=Math.abs(a-s.right),u=Math.min(l,c);let h;const d=t/r*(i+1);if(s.isDash){const e=i-Math.abs(d);h=Math.sqrt(u*u+e*e)}else h=i-Math.sqrt(u*u+d*d);this.image.data[n+a]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(e,t){for(let t=e.length-1;t>=0;--t){const r=e[t],i=e[t+1];r.zeroLength?e.splice(t,1):i&&i.isDash===r.isDash&&(i.left=r.left,e.splice(t,1))}const r=e[0],i=e[e.length-1];r.isDash===i.isDash&&(r.left=i.left-this.width,i.right=r.right+this.width);const n=this.width*this.nextRow;let o=0,s=e[o];for(let r=0;r<this.width;r++){r/s.right>1&&(s=e[++o]);const i=Math.abs(r-s.left),a=Math.abs(r-s.right),l=Math.min(i,a);this.image.data[n+r]=Math.max(0,Math.min(255,(s.isDash?l:-l)+t+128))}}addDash(e,t){const r=this.getKey(e,t);if(this.positions[r])return this.positions[r];const i="round"===t,n=i?7:0,o=2*n+1;if(this.nextRow+o>this.height)return pe("LineAtlas out of space"),null;0===e.length&&e.push(1);let s=0;for(let t=0;t<e.length;t++)e[t]<0&&(pe("Negative value is found in line dasharray, replacing values with 0"),e[t]=0),s+=e[t];if(0!==s){const r=this.width/s,o=this.getDashRanges(e,this.width,r);i?this.addRoundDash(o,r,n):this.addRegularDash(o,"square"===t?.5*r:0)}const a=this.nextRow+n;this.nextRow+=o;const l={tl:[a,n],br:[s,0]};return this.positions[r]=l,l}}so(yd,"LineAtlas");const xd=hh.VectorTileFeature.types,vd=Math.cos(Math.PI/180*37.5),bd=Math.cos(Math.PI/180*5);class wd{constructor(e){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.zoom=e.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.fqid)),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasZOffset=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((e=>{this.gradients[e.id]={}})),this.layoutVertexArray=new ws,this.layoutVertexArray2=new Ts,this.patternVertexArray=new Ss,this.indexArray=new Ls,this.programConfigurations=new Na(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new da,this.maxLineLength=0,this.zOffsetVertexArray=new Ns,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.tessellationStep=e.tessellationStep?e.tessellationStep:Xr/64}updateFootprints(e,t){}populate(e,t,r,i){this.hasPattern=Bu("line",this.layers,t);const n=this.layers[0].layout.get("line-sort-key");this.hasZOffset=!this.layers[0].isDraped();const o=this.layers[0].layout.get("line-elevation-reference");this.hasZOffset&&"none"===o&&pe(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`);const s=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.hasZOffset&&void 0!==s;const a=[];for(const{feature:t,id:o,index:s,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=Cl(t,e);if(!this.layers[0]._featureFilter.filter(new Do(this.zoom),c,r))continue;const u=n?n.evaluate(c,{},r):void 0,h={id:o,properties:t.properties,type:t.type,sourceLayerIndex:l,index:s,geometry:e?c.geometry:Al(t,r,i),patterns:{},sortKey:u};a.push(h)}n&&a.sort(((e,t)=>e.sortKey-t.sortKey));const{lineAtlas:l,featureIndex:c}=t,u=this.addConstantDashes(l);for(const i of a){const{geometry:n,index:o,sourceLayerIndex:s}=i;if(u&&this.addFeatureDashes(i,l),this.hasPattern){const e=Fu("line",this.layers,i,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(i,n,o,r,l.positions,t.availableImages,t.brightness);c.insert(e[o].feature,n,o,s,this.index)}}addConstantDashes(e){let t=!1;for(const r of this.layers){const i=r.paint.get("line-dasharray").value,n=r.layout.get("line-cap").value;if("constant"!==i.kind||"constant"!==n.kind)t=!0;else{const t=n.value,r=i.value;if(!r)continue;e.addDash(r,t)}}return t}addFeatureDashes(e,t){const r=this.zoom;for(const i of this.layers){const n=i.paint.get("line-dasharray").value,o=i.layout.get("line-cap").value;if("constant"===n.kind&&"constant"===o.kind)continue;let s,a;if("constant"===n.kind){if(s=n.value,!s)continue}else s=n.evaluate({zoom:r},e);a="constant"===o.kind?o.value:o.evaluate({zoom:r},e),t.addDash(s,a),e.patterns[i.id]=t.getKey(s,a)}}update(e,t,r,i,n){const o=0!==Object.keys(e).length;o&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,t,o?this.stateDependentLayers:this.layers,r,i,n)}addFeatures(e,t,r,i,n,o){for(const e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,r,i,o)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,md)),0!==this.patternVertexArray.length&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,gd)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,dd.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,pd),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,t,r,i,n,o,s){const a=this.layers[0].layout,l=a.get("line-join").evaluate(e,{}),c=a.get("line-cap").evaluate(e,{}),u=a.get("line-miter-limit"),h=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e,this.zOffsetValue=a.get("line-z-offset").value;for(const r of t)this.addLine(r,e,i,l,c,u,h);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,n,o,i,s)}addLine(e,t,r,i,n,o,s){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0;const a="none"===i;if(this.patternJoinNone=this.hasPattern&&a,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[],this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t<e.length-1;t++)this.totalDistance+=e[t].dist(e[t+1]);this.totalFeatureLength=this.totalDistance/(this.lineClips.end-this.lineClips.start),this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const l="Polygon"===xd[t.type];let c=e.length;for(;c>=2&&e[c-1].equals(e[c-2]);)c--;let u=0;for(;u<c-1&&e[u].equals(e[u+1]);)u++;if(c<(l?3:2))return;"bevel"===i&&(o=1.05);const h=this.segments.prepareSegment(10*c,this.layoutVertexArray,this.indexArray);let d,p,f,m,_,g;this.e1=this.e2=-1,l&&(d=e[c-2],_=e[u].sub(d)._unit()._perp());for(let t=u;t<c;t++){if(f=t===c-1?l?e[u+1]:void 0:e[t+1],f&&e[t].equals(f))continue;_&&(m=_),d&&(p=d),d=e[t],g=this.hasZOffset?this.evaluateElevationValue(p?p.dist(d):0):null,_=f?f.sub(d)._unit()._perp():m,m=m||_;const r=p&&f;let y=r?i:l||a?"butt":n;const x=m.x*_.x+m.y*_.y;if(a){const e=function(e){if(e.patternJoinNone){const t=e.segmentPoints.length/2,r=e.lineSoFar-e.segmentStart;for(let i=0;i<t;++i){const t=e.segmentPoints[2*i+1],n=Math.round(e.segmentPoints[2*i])+.5+.25*t;e.patternVertexArray.emplaceBack(n,r,e.segmentStart),e.patternVertexArray.emplaceBack(n,r,e.segmentStart)}e.segmentPoints.length=0}e.e1=e.e2=-1};if(r&&x<bd){this.updateDistance(p,d),this.addCurrentVertex(d,m,1,1,h,g),e(this),this.addCurrentVertex(d,_,-1,-1,h,g);continue}if(p){if(!f){this.updateDistance(p,d),this.addCurrentVertex(d,m,1,1,h,g),e(this);continue}y="miter"}}let v=m.add(_);0===v.x&&0===v.y||v._unit();const b=v.x*_.x+v.y*_.y,w=0!==b?1/b:1/0,T=2*Math.sqrt(2-2*b),S=b<vd&&p&&f,E=m.x*_.y-m.y*_.x>0,M=this.overscaling<=16?15*Xr/(512*this.overscaling):0;if(r&&"round"===y)if(w<s)y="miter";else if(w<=2){const e=Td(d,-10,Xr+10);y=this.hasZOffset&&(e||this.hasCrossSlope)?"miter":"fakeround"}if("miter"===y&&w>o&&(y="bevel"),"bevel"===y&&(w>2&&(y="flipbevel"),w<o&&(y="miter")),p&&!("miter"===y&&S)&&this.updateDistance(p,d),"miter"===y)if(S){const e=d.dist(p);if(e>2*M){const t=d.sub(d.sub(p)._mult(M/e)._round());this.updateDistance(p,t),this.addCurrentVertex(t,m,0,0,h,g),p=t}this.updateDistance(p,d),v._mult(w),this.addCurrentVertex(d,v,0,0,h,g);const t=d.dist(f);if(t>2*M){const e=d.add(f.sub(d)._mult(M/t)._round());this.updateDistance(d,e),this.addCurrentVertex(e,_,0,0,h,g),d=e}}else v._mult(w),this.addCurrentVertex(d,v,0,0,h,g);else if("flipbevel"===y){if(w>100)v=_.mult(-1);else{const e=w*m.add(_).mag()/m.sub(_).mag();v._perp()._mult(e*(E?-1:1))}this.addCurrentVertex(d,v,0,0,h,g),this.addCurrentVertex(d,v.mult(-1),0,0,h,g)}else if("bevel"===y||"fakeround"===y){null!=g&&p&&this.addCurrentVertex(d,m,-1,-1,h,g);const e=d.dist(p)<=2*M&&"bevel"!==y,t=v.mult(E?1:-1);t._mult(w);const r=_.mult(E?-1:1),i=m.mult(E?-1:1),n=this.evaluateElevationValue(this.distance);if(null==g&&(this.addHalfVertex(d,t.x,t.y,!1,!E,0,h,n),e||this.addHalfVertex(d,t.x+2*i.x,t.y+2*i.y,!1,E,0,h,n)),"fakeround"===y){const e=Math.round(180*T/Math.PI/20);this.addHalfVertex(d,i.x,i.y,!1,E,0,h,n);for(let t=0;t<e;t++){let o=t/e;if(.5!==o){const e=o-.5;o+=o*e*(o-1)*((1.0904+x*(x*(3.55645-1.43519*x)-3.2452))*e*e+(.848013+x*(.215638*x-1.06021)))}const s=r.sub(i)._mult(o)._add(i)._unit();this.addHalfVertex(d,s.x,s.y,!1,E,0,h,n)}this.addHalfVertex(d,r.x,r.y,!1,E,0,h,n)}e||null!=g||this.addHalfVertex(d,t.x+2*r.x,t.y+2*r.y,!1,E,0,h,n),null!=g&&f&&this.addCurrentVertex(d,_,1,1,h,g)}else"butt"===y?this.addCurrentVertex(d,v,0,0,h,g):"square"===y?(p||this.addCurrentVertex(d,v,-1,-1,h,g),this.addCurrentVertex(d,v,0,0,h,g),p&&this.addCurrentVertex(d,v,1,1,h,g)):"round"===y&&(p&&(this.addCurrentVertex(d,m,0,0,h,g),this.addCurrentVertex(d,m,1,1,h,g,!0)),f&&(this.addCurrentVertex(d,_,-1,-1,h,g,!0),this.addCurrentVertex(d,_,0,0,h,g)))}}addVerticesTo(e,t,r,i,n,o,s,a,l,c){const u=(t.w-e.w)/this.tessellationStep|0;let h=0;const d=this.scaledDistance;if(u>1){this.lineSoFar=e.w;const d=(t.x-e.x)/u,p=(t.y-e.y)/u,f=(t.z-e.z)/u,m=(t.w-e.w)/u;for(let t=1;t<u;++t){e.x+=d,e.y+=p,e.z+=f,this.lineSoFar+=m,h+=m;const t=this.evaluateElevationValue(this.prevDistance+h);this.scaledDistance=(this.prevDistance+h)/this.totalDistance,this.addHalfVertex(e,r,i,c,!1,s,l,t),this.addHalfVertex(e,n,o,c,!0,-a,l,t)}}this.lineSoFar=t.w,this.scaledDistance=d;const p=this.evaluateElevationValue(this.distance);this.addHalfVertex(t,r,i,c,!1,s,l,p),this.addHalfVertex(t,n,o,c,!0,-a,l,p)}evaluateElevationValue(e){return this.hasZOffset?"constant"===this.zOffsetValue.kind?this.zOffsetValue.value:(this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+e)/this.totalFeatureLength):pe(`line-z-offset evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`),this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0):void 0}addCurrentVertex(e,t,r,i,n,o,s=!1){const a=t.x+t.y*r,l=t.y-t.x*r,c=t.y*i-t.x,u=-t.y-t.x*i;if(null!=o){const t=-10,h=Xr+10,d=o,p=new ph(e.x,e.y,d,this.lineSoFar),f=Td(e,t,h),m=this.lineSoFar,_=this.distance;if(this.currentVertex)if(f){const o=this.currentVertexIsOutside,f=this.currentVertex,m=new ph(e.x,e.y,d,this.lineSoFar);if(_h(f,m,t,h),!Td(m,t,h)){if(o){this.e1=this.e2=-1,this.distance-=f.dist(p),this.lineSoFar=f.w;const e=this.evaluateElevationValue(f.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(f,a,l,s,!1,r,n,e),this.addHalfVertex(f,c,u,s,!0,-i,n,e),this.prevDistance=this.distance}this.distance=this.prevDistance+f.dist(m),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(f,m,a,l,c,u,r,i,n,s),this.distance=_,this.scaledDistance=this.distance/this.totalDistance}}else{const e=this.currentVertex;if(this.currentVertexIsOutside){_h(e,p,t,h),this.e1=this.e2=-1,this.distance-=e.dist(p),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=e.w;const o=this.evaluateElevationValue(e.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(e,a,l,s,!1,r,n,o),this.addHalfVertex(e,c,u,s,!0,-i,n,o),this.prevDistance=this.distance,this.distance=_,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(e,p,a,l,c,u,r,i,n,s)}else f||(this.addHalfVertex(e,a,l,s,!1,r,n,o),this.addHalfVertex(e,c,u,s,!0,-i,n,o));this.currentVertex=p,this.currentVertexIsOutside=f,this.lineSoFar=m}else this.addHalfVertex(e,a,l,s,!1,r,n,o),this.addHalfVertex(e,c,u,s,!0,-i,n,o)}addHalfVertex({x:e,y:t},r,i,n,o,s,a,l){this.patternJoinNone&&(0===this.segmentPoints.length&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),o||this.segmentPoints.push(this.lineSoFar-this.segmentStart,s)),this.layoutVertexArray.emplaceBack((e<<1)+(n?1:0),(t<<1)+(o?1:0),Math.round(63*r)+128,Math.round(63*i)+128,1+(0===s?0:s<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);const c=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,c),a.primitiveLength++),o?this.e2=c:this.e1=c,null!=l&&this.zOffsetVertexArray.emplaceBack(l)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(e,t){this.prevDistance=this.distance,this.distance+=e.dist(t),this.updateScaledDistance()}}function Td(e,t,r){return e.x<t||e.x>r||e.y<t||e.y>r}let Sd,Ed;function Md(e,t,r){return t*(Xr/(e.tileSize*Math.pow(2,r-e.tileID.overscaledZ)))}so(wd,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const Ad=(e,t,r)=>(1-r)*e+r*t;function Cd(e,t){return 1/Md(e,1,t.tileZoom)}function Id(e,t,r,i){return e.translatePosMatrix(i||t.tileID.projMatrix,t,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}const Pd=e=>{const t=[];Rd(e)&&t.push("RENDER_LINE_DASH"),e.paint.get("line-gradient")&&t.push("RENDER_LINE_GRADIENT");const r=e.paint.get("line-trim-offset");0===r[0]&&0===r[1]||t.push("RENDER_LINE_TRIM_OFFSET"),0!==e.paint.get("line-border-width").constantOr(1)&&t.push("RENDER_LINE_BORDER");const i="none"===e.layout.get("line-join").constantOr("miter"),n=!!e.paint.get("line-pattern").constantOr(1);return i&&n&&t.push("LINE_JOIN_NONE"),t};function Rd(e){const t=e.paint.get("line-dasharray").value;return t.value||"constant"!==t.kind}let zd;const Dd=()=>zd||(zd={layout:Sd||(Sd=new qo({"line-cap":new $o(Ho.layout_line["line-cap"]),"line-join":new $o(Ho.layout_line["line-join"]),"line-miter-limit":new Uo(Ho.layout_line["line-miter-limit"]),"line-round-limit":new Uo(Ho.layout_line["line-round-limit"]),"line-sort-key":new $o(Ho.layout_line["line-sort-key"]),"line-z-offset":new $o(Ho.layout_line["line-z-offset"]),"line-elevation-reference":new Uo(Ho.layout_line["line-elevation-reference"]),"line-cross-slope":new Uo(Ho.layout_line["line-cross-slope"]),visibility:new Uo(Ho.layout_line.visibility)})),paint:Ed||(Ed=new qo({"line-opacity":new $o(Ho.paint_line["line-opacity"]),"line-color":new $o(Ho.paint_line["line-color"]),"line-translate":new Uo(Ho.paint_line["line-translate"]),"line-translate-anchor":new Uo(Ho.paint_line["line-translate-anchor"]),"line-width":new $o(Ho.paint_line["line-width"]),"line-gap-width":new $o(Ho.paint_line["line-gap-width"]),"line-offset":new $o(Ho.paint_line["line-offset"]),"line-blur":new $o(Ho.paint_line["line-blur"]),"line-dasharray":new $o(Ho.paint_line["line-dasharray"]),"line-pattern":new $o(Ho.paint_line["line-pattern"]),"line-gradient":new Go(Ho.paint_line["line-gradient"]),"line-trim-offset":new Uo(Ho.paint_line["line-trim-offset"]),"line-trim-fade-range":new Uo(Ho.paint_line["line-trim-fade-range"]),"line-trim-color":new Uo(Ho.paint_line["line-trim-color"]),"line-emissive-strength":new Uo(Ho.paint_line["line-emissive-strength"]),"line-border-width":new $o(Ho.paint_line["line-border-width"]),"line-border-color":new $o(Ho.paint_line["line-border-color"]),"line-occlusion-opacity":new Uo(Ho.paint_line["line-occlusion-opacity"])}))},zd);class kd extends $o{possiblyEvaluate(e,t){return t=new Do(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,r,i){return t=ie({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,r,i)}}let Od;function Ld(e,t){return t>0?t+2*e:e}const Bd=_s([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Fd=_s([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Nd=_s([{name:"a_projected_pos",components:4,type:"Float32"}],4);_s([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Vd=_s([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),jd=_s([{name:"a_texb",components:2,type:"Uint16"}]),Ud=_s([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),$d=_s([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);_s([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Gd=_s([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),qd=_s([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);_s([{name:"triangle",components:3,type:"Uint16"}]),_s([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),_s([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"}]),_s([{type:"Float32",name:"offsetX"}]),_s([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var Hd=24;const Wd=128;function Zd(e,t){const{expression:r}=t;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new Do(e+1))};if("source"===r.kind)return{kind:"source"};{const{zoomStops:t,interpolationType:i}=r;let n=0;for(;n<t.length&&t[n]<=e;)n++;n=Math.max(0,n-1);let o=n;for(;o<t.length&&t[o]<e+1;)o++;o=Math.min(t.length-1,o);const s=t[n],a=t[o];return"composite"===r.kind?{kind:"composite",minZoom:s,maxZoom:a,interpolationType:i}:{kind:"camera",minZoom:s,maxZoom:a,minSize:r.evaluate(new Do(s)),maxSize:r.evaluate(new Do(a)),interpolationType:i}}}function Xd(e,{uSize:t,uSizeT:r},{lowerSize:i,upperSize:n}){return"source"===e.kind?i/Wd:"composite"===e.kind?Ct(i/Wd,n/Wd,r):t}function Yd(e,t,r=1){let i=0,n=0;if("constant"===e.kind)n=e.layoutSize*r;else if("source"!==e.kind){const{interpolationType:o,minZoom:s,maxZoom:a}=e,l=o?Q(nn.interpolationFactor(o,t,s,a),0,1):0;"camera"===e.kind?n=Ct(e.minSize,e.maxSize,l)*r:i=l*r}return{uSizeT:i,uSize:n}}var Jd=Object.freeze({__proto__:null,SIZE_PACK_FACTOR:Wd,evaluateSizeForFeature:Xd,evaluateSizeForZoom:Yd,getSizeData:Zd});function Kd(e,t,r){return e.sections.forEach((e=>{e.text=function(e,t,r){const i=t.layout.get("text-transform").evaluate(r,{});return"uppercase"===i?e=e.toLocaleUpperCase():"lowercase"===i&&(e=e.toLocaleLowerCase()),zo.applyArabicShaping&&(e=zo.applyArabicShaping(e)),e}(e.text,t,r)})),e}const Qd={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function ep(e){return"︶"===e||"﹈"===e||"︸"===e||"﹄"===e||"﹂"===e||"︾"===e||"︼"===e||"︺"===e||"︘"===e||"﹀"===e||"︐"===e||"︓"===e||"︔"===e||"`"===e||" ̄"===e||"︑"===e||"︒"===e}function tp(e){return"︵"===e||"﹇"===e||"︷"===e||"﹃"===e||"﹁"===e||"︽"===e||"︻"===e||"︹"===e||"︗"===e||"︿"===e}var rp,ip,np,op={};
|
|
11
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */function sp(){return rp||(rp=1,op.read=function(e,t,r,i,n){var o,s,a=8*n-i-1,l=(1<<a)-1,c=l>>1,u=-7,h=r?n-1:0,d=r?-1:1,p=e[t+h];for(h+=d,o=p&(1<<-u)-1,p>>=-u,u+=a;u>0;o=256*o+e[t+h],h+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=i;u>0;s=256*s+e[t+h],h+=d,u-=8);if(0===o)o=1-c;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,i),o-=c}return(p?-1:1)*s*Math.pow(2,o-i)},op.write=function(e,t,r,i,n,o){var s,a,l,c=8*o-n-1,u=(1<<c)-1,h=u>>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:o-1,f=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(s++,l/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(t*l-1)*Math.pow(2,n),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,n),s=0));n>=8;e[r+p]=255&a,p+=f,a/=256,n-=8);for(s=s<<n|a,c+=n;c>0;e[r+p]=255&s,p+=f,s/=256,c-=8);e[r+p-f]|=128*m}),op}function ap(){if(np)return ip;np=1,ip=t;var e=sp();function t(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var r=4294967296,i=1/r,n="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function o(e){return e.type===t.Bytes?e.readVarint()+e.pos:e.pos+1}function s(e,t,r){return r?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function a(e,t,r){var i=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));r.realloc(i);for(var n=r.pos-1;n>=e;n--)r.buf[n+i]=r.buf[n]}function l(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function c(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function u(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function h(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function d(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function p(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function f(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function m(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function _(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function g(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function y(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function x(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos<r;){var i=this.readVarint(),n=i>>3,o=this.pos;this.type=7&i,e(n,t,this),this.pos===o&&this.skip(i)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=g(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=x(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=g(this.buf,this.pos)+g(this.buf,this.pos+4)*r;return this.pos+=8,e},readSFixed64:function(){var e=g(this.buf,this.pos)+x(this.buf,this.pos+4)*r;return this.pos+=8,e},readFloat:function(){var t=e.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=e.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(e){var t,r,i=this.buf;return t=127&(r=i[this.pos++]),r<128?t:(t|=(127&(r=i[this.pos++]))<<7,r<128?t:(t|=(127&(r=i[this.pos++]))<<14,r<128?t:(t|=(127&(r=i[this.pos++]))<<21,r<128?t:function(e,t,r){var i,n,o=r.buf;if(i=(112&(n=o[r.pos++]))>>4,n<128)return s(e,i,t);if(i|=(127&(n=o[r.pos++]))<<3,n<128)return s(e,i,t);if(i|=(127&(n=o[r.pos++]))<<10,n<128)return s(e,i,t);if(i|=(127&(n=o[r.pos++]))<<17,n<128)return s(e,i,t);if(i|=(127&(n=o[r.pos++]))<<24,n<128)return s(e,i,t);if(i|=(1&(n=o[r.pos++]))<<31,n<128)return s(e,i,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(r=i[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&n?function(e,t,r){return n.decode(e.subarray(t,r))}(this.buf,t,e):function(e,t,r){for(var i="",n=t;n<r;){var o,s,a,l=e[n],c=null,u=l>239?4:l>223?3:l>191?2:1;if(n+u>r)break;1===u?l<128&&(c=l):2===u?128==(192&(o=e[n+1]))&&(c=(31&l)<<6|63&o)<=127&&(c=null):3===u?(s=e[n+2],128==(192&(o=e[n+1]))&&128==(192&s)&&((c=(15&l)<<12|(63&o)<<6|63&s)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(s=e[n+2],a=e[n+3],128==(192&(o=e[n+1]))&&128==(192&s)&&128==(192&a)&&((c=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,u=1):c>65535&&(c-=65536,i+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),i+=String.fromCharCode(c),n+=u}return i}(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,r){if(this.type!==t.Bytes)return e.push(this.readVarint(r));var i=o(this);for(e=e||[];this.pos<i;)e.push(this.readVarint(r));return e},readPackedSVarint:function(e){if(this.type!==t.Bytes)return e.push(this.readSVarint());var r=o(this);for(e=e||[];this.pos<r;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==t.Bytes)return e.push(this.readBoolean());var r=o(this);for(e=e||[];this.pos<r;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==t.Bytes)return e.push(this.readFloat());var r=o(this);for(e=e||[];this.pos<r;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==t.Bytes)return e.push(this.readDouble());var r=o(this);for(e=e||[];this.pos<r;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==t.Bytes)return e.push(this.readFixed32());var r=o(this);for(e=e||[];this.pos<r;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==t.Bytes)return e.push(this.readSFixed32());var r=o(this);for(e=e||[];this.pos<r;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==t.Bytes)return e.push(this.readFixed64());var r=o(this);for(e=e||[];this.pos<r;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==t.Bytes)return e.push(this.readSFixed64());var r=o(this);for(e=e||[];this.pos<r;)e.push(this.readSFixed64());return e},skip:function(e){var r=7&e;if(r===t.Varint)for(;this.buf[this.pos++]>127;);else if(r===t.Bytes)this.pos=this.readVarint()+this.pos;else if(r===t.Fixed32)this.pos+=4;else{if(r!==t.Fixed64)throw new Error("Unimplemented type: "+r);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),y(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),y(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),y(this.buf,-1&e,this.pos),y(this.buf,Math.floor(e*i),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),y(this.buf,-1&e,this.pos),y(this.buf,Math.floor(e*i),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,t){var r,i;if(e>=0?(r=e%4294967296|0,i=e/4294967296|0):(i=~(-e/4294967296),4294967295^(r=~(-e%4294967296))?r=r+1|0:(r=0,i=i+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,r){r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,r.buf[r.pos]=127&(e>>>=7)}(r,0,t),function(e,t){var r=(7&e)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(i,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,r){for(var i,n,o=0;o<t.length;o++){if((i=t.charCodeAt(o))>55295&&i<57344){if(!n){i>56319||o+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):n=i;continue}if(i<56320){e[r++]=239,e[r++]=191,e[r++]=189,n=i;continue}i=n-55296<<10|i-56320|65536,n=null}else n&&(e[r++]=239,e[r++]=191,e[r++]=189,n=null);i<128?e[r++]=i:(i<2048?e[r++]=i>>6|192:(i<65536?e[r++]=i>>12|224:(e[r++]=i>>18|240,e[r++]=i>>12&63|128),e[r++]=i>>6&63|128),e[r++]=63&i|128)}return r}(this.buf,e,this.pos);var r=this.pos-t;r>=128&&a(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),e.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),e.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,t){this.pos++;var r=this.pos;e(t,this);var i=this.pos-r;i>=128&&a(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i},writeMessage:function(e,r,i){this.writeTag(e,t.Bytes),this.writeRawMessage(r,i)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,l,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,c,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,d,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,u,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,h,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,p,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,f,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,m,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,_,t)},writeBytesField:function(e,r){this.writeTag(e,t.Bytes),this.writeBytes(r)},writeFixed32Field:function(e,r){this.writeTag(e,t.Fixed32),this.writeFixed32(r)},writeSFixed32Field:function(e,r){this.writeTag(e,t.Fixed32),this.writeSFixed32(r)},writeFixed64Field:function(e,r){this.writeTag(e,t.Fixed64),this.writeFixed64(r)},writeSFixed64Field:function(e,r){this.writeTag(e,t.Fixed64),this.writeSFixed64(r)},writeVarintField:function(e,r){this.writeTag(e,t.Varint),this.writeVarint(r)},writeSVarintField:function(e,r){this.writeTag(e,t.Varint),this.writeSVarint(r)},writeStringField:function(e,r){this.writeTag(e,t.Bytes),this.writeString(r)},writeFloatField:function(e,r){this.writeTag(e,t.Fixed32),this.writeFloat(r)},writeDoubleField:function(e,r){this.writeTag(e,t.Fixed64),this.writeDouble(r)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}},ip}var lp=t(ap());const cp=3;function up(e,t,r){t.glyphs=[],1===e&&r.readMessage(hp,t)}function hp(e,t,r){if(3===e){const{id:e,bitmap:i,width:n,height:o,left:s,top:a,advance:l}=r.readMessage(dp,{});t.glyphs.push({id:e,bitmap:new nu({width:n+2*cp,height:o+2*cp},i),metrics:{width:n,height:o,left:s,top:a,advance:l}})}else 4===e?t.ascender=r.readSVarint():5===e&&(t.descender=r.readSVarint())}function dp(e,t,r){1===e?t.id=r.readVarint():2===e?t.bitmap=r.readBytes():3===e?t.width=r.readVarint():4===e?t.height=r.readVarint():5===e?t.left=r.readSVarint():6===e?t.top=r.readSVarint():7===e&&(t.advance=r.readVarint())}const pp=cp,fp={horizontal:1,vertical:2,horizontalOnly:3};class mp{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,t){const r=new mp;return r.scale=e||1,r.fontStack=t,r}static forImage(e){const t=new mp;return t.imageName=e,t}}class _p{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,t){const r=new _p;for(let i=0;i<e.sections.length;i++){const n=e.sections[i];n.image?r.addImageSection(n):r.addTextSection(n,t)}return r}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSections(){return this.sections}getSectionIndex(e){return this.sectionIndex[e]}getCodePoint(e){return this.text.codePointAt(e)}verticalizePunctuation(e){this.text=function(e,t){let r="";for(let i=0;i<e.length;i++){const n=e.charCodeAt(i+1)||null,o=e.charCodeAt(i-1)||null;r+=!t&&(n&&go(n)&&!Qd[e[i+1]]||o&&go(o)&&!Qd[e[i-1]])||!Qd[e[i]]?e[i]:Qd[e[i]]}return r}(this.text,e)}trim(){let e=0;for(let t=0;t<this.text.length&&yp[this.text.charCodeAt(t)];t++)e++;let t=this.text.length;for(let r=this.text.length-1;r>=0&&r>=e&&yp[this.text.charCodeAt(r)];r--)t--;this.text=this.text.substring(e,t),this.sectionIndex=this.sectionIndex.slice(e,t)}substring(e,t){const r=new _p;return r.text=this.text.substring(e,t),r.sectionIndex=this.sectionIndex.slice(e,t),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,t)=>Math.max(e,this.sections[t].scale)),0)}addTextSection(e,t){this.text+=e.text,this.sections.push(mp.forText(e.scale,e.fontStack||t));const r=this.sections.length-1;for(let t=0;t<e.text.length;++t)this.sectionIndex.push(r)}addImageSection(e){const t=e.image?e.image.namePrimary:"";if(0===t.length)return void pe("Can't add FormattedSection with an empty image.");const r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCodePoint(r),this.sections.push(mp.forImage(t)),this.sectionIndex.push(this.sections.length-1)):pe("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function gp(e,t,r,i,n,o,s,a,l,c,u,h,d,p,f){const m=_p.fromFeature(e,n);h===fp.vertical&&m.verticalizePunctuation(d);let _=[];const g=function(e,t,r,i,n,o){if(!e)return[];const s=[],a=function(e,t,r,i,n,o){let s=0;for(let r=0;r<e.length();r++){const a=e.getSection(r);s+=vp(e.getCodePoint(r),a,i,n,t,o)}return s/Math.max(1,Math.ceil(s/r))}(e,t,r,i,n,o),l=e.text.indexOf("")>=0;let c=0;for(let r=0;r<e.length();r++){const h=e.getSection(r),d=e.getCodePoint(r);if(yp[d]||(c+=vp(d,h,i,n,t,o)),r<e.length()-1){const t=!((u=d)<11904||!(ho["Bopomofo Extended"](u)||ho.Bopomofo(u)||ho["CJK Compatibility Forms"](u)||ho["CJK Compatibility Ideographs"](u)||ho["CJK Compatibility"](u)||ho["CJK Radicals Supplement"](u)||ho["CJK Strokes"](u)||ho["CJK Symbols and Punctuation"](u)||ho["CJK Unified Ideographs Extension A"](u)||ho["CJK Unified Ideographs"](u)||ho["Enclosed CJK Letters and Months"](u)||ho["Halfwidth and Fullwidth Forms"](u)||ho.Hiragana(u)||ho["Ideographic Description Characters"](u)||ho["Kangxi Radicals"](u)||ho["Katakana Phonetic Extensions"](u)||ho.Katakana(u)||ho["Vertical Forms"](u)||ho["Yi Radicals"](u)||ho["Yi Syllables"](u)));(xp[d]||t||h.imageName)&&s.push(Tp(r+1,c,a,s,wp(d,e.getCodePoint(r+1),t&&l),!1))}}var u;return Sp(Tp(e.length(),c,a,s,0,!0))}(m,c,o,t,i,p),{processBidirectionalText:y,processStyledBidirectionalText:x}=zo;if(y&&1===m.sections.length){const e=y(m.toString(),g);for(const t of e){const e=new _p;e.text=t,e.sections=m.sections;for(let r=0;r<t.length;r++)e.sectionIndex.push(0);_.push(e)}}else if(x){const e=x(m.text,m.sectionIndex,g);for(const t of e){const e=new _p;e.text=t[0],e.sectionIndex=t[1],e.sections=m.sections,_.push(e)}}else _=function(e,t){const r=[],i=e.text;let n=0;for(const i of t)r.push(e.substring(n,i)),n=i;return n<i.length&&r.push(e.substring(n,i.length)),r}(m,g);const v=[],b={positionedLines:v,text:m.toString(),top:u[1],bottom:u[1],left:u[0],right:u[0],writingMode:h,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(e,t,r,i,n,o,s,a,l,c,u,h){let d=0,p=0,f=0;const m="right"===a?1:"left"===a?0:.5;let _=!1;for(const e of n){const r=e.getSections();for(const e of r){if(e.imageName)continue;const r=t[e.fontStack];if(r&&(_=void 0!==r.ascender&&void 0!==r.descender,!_))break}if(!_)break}let g=0;for(const s of n){s.trim();const n=s.getMaxScale(),a=(n-1)*Hd,x={positionedGlyphs:[],lineOffset:0};e.positionedLines[g]=x;const v=x.positionedGlyphs;let b=0;if(!s.length()){p+=o,++g;continue}let w=0,T=0;for(let o=0;o<s.length();o++){const a=s.getSection(o),f=s.getSectionIndex(o),m=s.getCodePoint(o);let g=a.scale,x=null,S=null,E=null,M=Hd,A=0;const C=!(l===fp.horizontal||!u&&!_o(m)||u&&(yp[m]||(y=m,ho.Arabic(y)||ho["Arabic Supplement"](y)||ho["Arabic Extended-A"](y)||ho["Arabic Presentation Forms-A"](y)||ho["Arabic Presentation Forms-B"](y))));if(a.imageName){const t=i[a.imageName];if(!t)continue;E=a.imageName,e.iconsInText=e.iconsInText||!0,S=t.paddedRect;const r=t.displaySize;g=g*Hd/h,x={width:r[0],height:r[1],left:0,top:-pp,advance:C?r[1]:r[0],localGlyph:!1},A=_?-x.height*g:n*Hd-17-r[1]*g,M=x.advance;const o=(C?r[0]:r[1])*g-Hd*n;o>0&&o>b&&(b=o)}else{const e=r[a.fontStack];if(!e)continue;e[m]&&(S=e[m]);const i=t[a.fontStack];if(!i)continue;const o=i.glyphs[m];if(!o)continue;if(x=o.metrics,M=8203!==m?Hd:0,_){const e=void 0!==i.ascender?Math.abs(i.ascender):0,t=void 0!==i.descender?Math.abs(i.descender):0,r=(e+t)*g;w<r&&(w=r,T=(e-t)/2*g),A=-e*g}else A=(n-g)*Hd-17}C?(e.verticalizable=!0,v.push({glyph:m,imageName:E,x:d,y:p+A,vertical:C,scale:g,localGlyph:x.localGlyph,fontStack:a.fontStack,sectionIndex:f,metrics:x,rect:S}),d+=M*g+c):(v.push({glyph:m,imageName:E,x:d,y:p+A,vertical:C,scale:g,localGlyph:x.localGlyph,fontStack:a.fontStack,sectionIndex:f,metrics:x,rect:S}),d+=x.advance*g+c)}0!==v.length&&(f=Math.max(d-c,f),_?Mp(v,m,b,T,o*n/2):Mp(v,m,b,0,o/2)),d=0;const S=o*n+b;x.lineOffset=Math.max(b,a),p+=S,++g}var y;const x=p,{horizontalAlign:v,verticalAlign:b}=Ep(s);(function(e,t,r,i,n,o){const s=(t-r)*n,a=-o*i;for(const t of e)for(const e of t.positionedGlyphs)e.x+=s,e.y+=a})(e.positionedLines,m,v,b,f,x),e.top+=-b*x,e.bottom=e.top+x,e.left+=-v*f,e.right=e.left+f,e.hasBaseline=_}(b,t,r,i,_,s,a,l,h,c,d,f),!function(e){for(const t of e)if(0!==t.positionedGlyphs.length)return!1;return!0}(v)&&b}const yp={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},xp={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function vp(e,t,r,i,n,o){if(t.imageName){const e=i[t.imageName];return e?e.displaySize[0]*t.scale*Hd/o+n:0}{const i=r[t.fontStack],o=i&&i.glyphs[e];return o?o.metrics.advance*t.scale+n:0}}function bp(e,t,r,i){const n=Math.pow(e-t,2);return i?e<t?n/2:2*n:n+Math.abs(r)*r}function wp(e,t,r){let i=0;return 10===e&&(i-=1e4),r&&(i+=150),40!==e&&65288!==e||(i+=50),41!==t&&65289!==t||(i+=50),i}function Tp(e,t,r,i,n,o){let s=null,a=bp(t,r,n,o);for(const e of i){const i=bp(t-e.x,r,n,o)+e.badness;i<=a&&(s=e,a=i)}return{index:e,x:t,priorBreak:s,badness:a}}function Sp(e){return e?Sp(e.priorBreak).concat(e.index):[]}function Ep(e){let t=.5,r=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}function Mp(e,t,r,i,n){if(!(t||r||i||n))return;const o=e.length-1,s=e[o],a=(s.x+s.metrics.advance*s.scale)*t;for(let t=0;t<=o;t++)e[t].x-=a,e[t].y+=r+i+n}function Ap(e,t,r,i){const{horizontalAlign:n,verticalAlign:o}=Ep(i),s=r[0]-e.displaySize[0]*n,a=r[1]-e.displaySize[1]*o;return{imagePrimary:e,imageSecondary:t,top:a,bottom:a+e.displaySize[1],left:s,right:s+e.displaySize[0]}}function Cp(e,t,r,i,n,o){const s=e.imagePrimary;let a;if(s.content){const e=s.content,t=s.pixelRatio||1;a=[e[0]/t,e[1]/t,s.displaySize[0]-e[2]/t,s.displaySize[1]-e[3]/t]}const l=t.left*o,c=t.right*o;let u,h,d,p;"width"===r||"both"===r?(p=n[0]+l-i[3],h=n[0]+c+i[1]):(p=n[0]+(l+c-s.displaySize[0])/2,h=p+s.displaySize[0]);const f=t.top*o,m=t.bottom*o;return"height"===r||"both"===r?(u=n[1]+f-i[0],d=n[1]+m+i[2]):(u=n[1]+(f+m-s.displaySize[1])/2,d=u+s.displaySize[1]),{imagePrimary:s,imageSecondary:void 0,top:u,right:h,bottom:d,left:p,collisionPadding:a}}class Ip extends ${constructor(e,t,r,i,n){super(e,t),this.angle=i,this.z=r,void 0!==n&&(this.segment=n)}clone(){return new Ip(this.x,this.y,this.z,this.angle,this.segment)}}function Pp(e,t,r,i,n){if(void 0===t.segment)return!0;let o=t,s=t.segment+1,a=0;for(;a>-r/2;){if(s--,s<0)return!1;a-=e[s].dist(o),o=e[s]}a+=e[s].dist(e[s+1]),s++;const l=[];let c=0;for(;a<r/2;){const t=e[s],r=e[s+1];if(!r)return!1;let o=e[s-1].angleTo(t)-t.angleTo(r);for(o=Math.abs((o+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:a,angleDelta:o}),c+=o;a-l[0].distance>i;)c-=l.shift().angleDelta;if(c>n)return!1;s++,a+=t.dist(r)}return!0}function Rp(e){let t=0;for(let r=0;r<e.length-1;r++)t+=e[r].dist(e[r+1]);return t}function zp(e,t,r){return e?.6*t*r:0}function Dp(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function kp(e,t,r,i,n,o){const s=zp(r,n,o),a=Dp(r,i)*o;let l=0;const c=Rp(e)/2;for(let r=0;r<e.length-1;r++){const i=e[r],n=e[r+1],o=i.dist(n);if(l+o>c){const u=(c-l)/o,h=Ct(i.x,n.x,u),d=Ct(i.y,n.y,u),p=new Ip(h,d,0,n.angleTo(i),r);return!s||Pp(e,p,a,s,t)?p:void 0}l+=o}}function Op(e,t,r,i,n,o,s,a,l){const c=zp(i,o,s),u=Dp(i,n),h=u*s,d=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-h<t/4&&(t=h+t/4),Lp(e,d?t/2*a%t:(u/2+2*o)*s*a%t,t,c,r,h,d,!1,l)}function Lp(e,t,r,i,n,o,s,a,l){const c=o/2,u=Rp(e);let h=0,d=t-r,p=[];for(let t=0;t<e.length-1;t++){const s=e[t],a=e[t+1],f=s.dist(a),m=a.angleTo(s);for(;d+r<h+f;){d+=r;const _=(d-h)/f,g=Ct(s.x,a.x,_),y=Ct(s.y,a.y,_);if(g>=0&&g<l&&y>=0&&y<l&&d-c>=0&&d+c<=u){const r=new Ip(g,y,0,m,t);i&&!Pp(e,r,o,i,n)||p.push(r)}}h+=f}return a||p.length||s||(p=Lp(e,h/2,r,i,n,o,s,!0,l)),p}function Bp(e,t,r,i,n){const o=[];for(let s=0;s<e.length;s++){const a=e[s];let l;for(let e=0;e<a.length-1;e++){let s=a[e],c=a[e+1];s.x<t&&c.x<t||(s.x<t?s=new $(t,s.y+(t-s.x)/(c.x-s.x)*(c.y-s.y))._round():c.x<t&&(c=new $(t,s.y+(t-s.x)/(c.x-s.x)*(c.y-s.y))._round()),s.y<r&&c.y<r||(s.y<r?s=new $(s.x+(r-s.y)/(c.y-s.y)*(c.x-s.x),r)._round():c.y<r&&(c=new $(s.x+(r-s.y)/(c.y-s.y)*(c.x-s.x),r)._round()),s.x>=i&&c.x>=i||(s.x>=i?s=new $(i,s.y+(i-s.x)/(c.x-s.x)*(c.y-s.y))._round():c.x>=i&&(c=new $(i,s.y+(i-s.x)/(c.x-s.x)*(c.y-s.y))._round()),s.y>=n&&c.y>=n||(s.y>=n?s=new $(s.x+(n-s.y)/(c.y-s.y)*(c.x-s.x),n)._round():c.y>=n&&(c=new $(s.x+(n-s.y)/(c.y-s.y)*(c.x-s.x),n)._round()),l&&s.equals(l[l.length-1])||(l=[s],o.push(l)),l.push(c)))))}}return o}function Fp(e){let t=0,r=0;for(const i of e)t+=i.w*i.h,r=Math.max(r,i.w);e.sort(((e,t)=>t.h-e.h));const i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}];let n=0,o=0;for(const t of e)for(let e=i.length-1;e>=0;e--){const r=i[e];if(!(t.w>r.w||t.h>r.h)){if(t.x=r.x,t.y=r.y,o=Math.max(o,t.y+t.h),n=Math.max(n,t.x+t.w),t.w===r.w&&t.h===r.h){const t=i.pop();e<i.length&&(i[e]=t)}else t.h===r.h?(r.x+=t.w,r.w-=t.w):t.w===r.w?(r.y+=t.h,r.h-=t.h):(i.push({x:r.x+t.w,y:r.y,w:r.w-t.w,h:t.h}),r.y+=t.h,r.h-=t.h);break}}return{w:n,h:o,fill:t/(n*o)||0}}so(Ip,"Anchor");const Np=1;class Vp{constructor(e,{pixelRatio:t,version:r,stretchX:i,stretchY:n,content:o},s){this.paddedRect=e,this.pixelRatio=t,this.stretchX=i,this.stretchY=n,this.content=o,this.version=r,this.padding=s}get tl(){return[this.paddedRect.x+this.padding,this.paddedRect.y+this.padding]}get br(){return[this.paddedRect.x+this.paddedRect.w-this.padding,this.paddedRect.y+this.paddedRect.h-this.padding]}get displaySize(){return[(this.paddedRect.w-2*this.padding)/this.pixelRatio,(this.paddedRect.h-2*this.padding)/this.pixelRatio]}}class jp{constructor(e,t,r){const i={},n={};this.haveRenderCallbacks=[];const o=[];this.addImages(e,i,Np,o),this.addImages(t,n,2,o);const{w:s,h:a}=Fp(o),l=new ou({width:s||1,height:a||1});for(const t in e){const n=e[t],o=i[t].paddedRect;ou.copy(n.data,l,{x:0,y:0},{x:o.x+Np,y:o.y+Np},n.data,r,n.sdf)}for(const e in t){const i=t[e],o=n[e].paddedRect;let s=n[e].padding;const a=o.x+s,c=o.y+s,u=i.data.width,h=i.data.height;s=s>1?s-1:s,ou.copy(i.data,l,{x:0,y:0},{x:a,y:c},i.data,r),ou.copy(i.data,l,{x:0,y:h-s},{x:a,y:c-s},{width:u,height:s},r),ou.copy(i.data,l,{x:0,y:0},{x:a,y:c+h},{width:u,height:s},r),ou.copy(i.data,l,{x:u-s,y:0},{x:a-s,y:c},{width:s,height:h},r),ou.copy(i.data,l,{x:0,y:0},{x:a+u,y:c},{width:s,height:h},r),ou.copy(i.data,l,{x:u-s,y:h-s},{x:a-s,y:c-s},{width:s,height:s},r),ou.copy(i.data,l,{x:0,y:h-s},{x:a+u,y:c-s},{width:s,height:s},r),ou.copy(i.data,l,{x:0,y:0},{x:a+u,y:c+h},{width:s,height:s},r),ou.copy(i.data,l,{x:u-s,y:0},{x:a-s,y:c+h},{width:s,height:s},r)}this.image=l,this.iconPositions=i,this.patternPositions=n}addImages(e,t,r,i){for(const n in e){const o=e[n],s={x:0,y:0,w:o.data.width+2*r,h:o.data.height+2*r};i.push(s),t[n]=new Vp(s,o,r),o.hasRenderCallback&&this.haveRenderCallbacks.push(n)}}patchUpdatedImages(e,t,r){this.haveRenderCallbacks=this.haveRenderCallbacks.filter((t=>e.hasImage(t,r))),e.dispatchRenderCallbacks(this.haveRenderCallbacks,r);for(const i in e.getUpdatedImages(r))this.patchUpdatedImage(this.iconPositions[i],e.getImage(i,r),t),this.patchUpdatedImage(this.patternPositions[i],e.getImage(i,r),t)}patchUpdatedImage(e,t,r){if(!e||!t)return;if(e.version===t.version)return;e.version=t.version;const[i,n]=e.tl;r.update(t.data,{position:{x:i,y:n}})}}so(Vp,"ImagePosition"),so(jp,"ImageAtlas");const Up=1e20;function $p(e,t,r,i,n,o,s,a,l){for(let c=t;c<t+i;c++)Gp(e,r*o+c,o,n,s,a,l);for(let c=r;c<r+n;c++)Gp(e,c*o+t,1,i,s,a,l)}function Gp(e,t,r,i,n,o,s){o[0]=0,s[0]=-Up,s[1]=Up,n[0]=e[t];for(let a=1,l=0,c=0;a<i;a++){n[a]=e[t+a*r];const i=a*a;do{const e=o[l];c=(n[a]-n[e]+i-e*e)/(a-e)/2}while(c<=s[l]&&--l>-1);l++,o[l]=a,s[l]=c,s[l+1]=Up}for(let a=0,l=0;a<i;a++){for(;s[l+1]<a;)l++;const i=o[l],c=a-i;e[t+a*r]=n[i]+c*c}}const qp=2,Hp={none:0,ideographs:1,all:2};class Wp{constructor(e,t,r){this.requestManager=e,this.localGlyphMode=t,this.localFontFamily=r,this.urls={},this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e,t){this.urls[t]=e}getGlyphs(e,t,r){const i=[],n=this.urls[t]||Ee.GLYPHS_URL;for(const t in e)for(const r of e[t])i.push({stack:t,id:r});re(i,(({stack:e,id:t},r)=>{let i=this.entries[e];i||(i=this.entries[e]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let o=i.glyphs[t];if(void 0!==o)return void r(null,{stack:e,id:t,glyph:o});if(o=this._tinySDF(i,e,t),o)return i.glyphs[t]=o,void r(null,{stack:e,id:t,glyph:o});const s=Math.floor(t/256);if(256*s>65535)return pe("glyphs > 65535 not supported"),void r(null,{stack:e,id:t,glyph:o});if(i.ranges[s])return void r(null,{stack:e,id:t,glyph:o});let a=i.requests[s];a||(a=i.requests[s]=[],Wp.loadGlyphRange(e,s,n,this.requestManager,((e,t)=>{if(t){i.ascender=t.ascender,i.descender=t.descender;for(const e in t.glyphs)this._doesCharSupportLocalGlyph(+e)||(i.glyphs[+e]=t.glyphs[+e]);i.ranges[s]=!0}for(const r of a)r(e,t);delete i.requests[s]}))),a.push(((i,n)=>{i?r(i):n&&r(null,{stack:e,id:t,glyph:n.glyphs[t]||null})}))}),((e,t)=>{if(e)r(e);else if(t){const e={};for(const{stack:r,id:i,glyph:n}of t)void 0===e[r]&&(e[r]={}),void 0===e[r].glyphs&&(e[r].glyphs={}),e[r].glyphs[i]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics},e[r].ascender=this.entries[r].ascender,e[r].descender=this.entries[r].descender;r(null,e)}}))}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==Hp.none&&(this.localGlyphMode===Hp.all?!!this.localFontFamily:!!this.localFontFamily&&(ho["CJK Unified Ideographs"](e)||ho["Hangul Syllables"](e)||ho.Hiragana(e)||ho.Katakana(e)||ho["CJK Symbols and Punctuation"](e)||ho["CJK Unified Ideographs Extension A"](e)||ho["CJK Unified Ideographs Extension B"](e)||ho.Osage(e)))}_tinySDF(e,t,r){const i=this.localFontFamily;if(!i||!this._doesCharSupportLocalGlyph(r))return;let n=e.tinySDF;if(!n){let r="400";/bold/i.test(t)?r="900":/medium/i.test(t)?r="500":/light/i.test(t)&&(r="200"),n=e.tinySDF=new Wp.TinySDF({fontFamily:i,fontWeight:r,fontSize:24*qp,buffer:3*qp,radius:8*qp}),n.fontWeight=r}if(this.localGlyphs[n.fontWeight][r])return this.localGlyphs[n.fontWeight][r];const o=String.fromCodePoint(r),{data:s,width:a,height:l,glyphWidth:c,glyphHeight:u,glyphLeft:h,glyphTop:d,glyphAdvance:p}=n.draw(o);return this.localGlyphs[n.fontWeight][r]={id:r,bitmap:new nu({width:a,height:l},s),metrics:{width:c/qp,height:u/qp,left:h/qp,top:d/qp-27,advance:p/qp,localGlyph:!0}}}}Wp.loadGlyphRange=function(e,t,r,i,n){const o=256*t,s=o+255,a=i.transformRequest(i.normalizeGlyphsURL(r).replace("{fontstack}",e).replace("{range}",`${o}-${s}`),et.Glyphs);nt(a,((e,t)=>{if(e)n(e);else if(t){const e={},r=function(e){return new lp(e).readFields(up,{})}(t);for(const t of r.glyphs)e[t.id]=t;n(null,{glyphs:e,ascender:r.ascender,descender:r.descender})}}))},Wp.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:r=8,cutoff:i=.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:s="normal"}={}){this.buffer=t,this.cutoff=i,this.radius=r;const a=this.size=e+4*t,l=this._createCanvas(a),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${s} ${o} ${e}px ${n}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a)}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:r,actualBoundingBoxDescent:i,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(e),s=Math.ceil(r),a=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-n))),l=Math.min(this.size-this.buffer,s+Math.ceil(i)),c=a+2*this.buffer,u=l+2*this.buffer,h=Math.max(c*u,0),d=new Uint8ClampedArray(h),p={data:d,width:c,height:u,glyphWidth:a,glyphHeight:l,glyphTop:s,glyphLeft:0,glyphAdvance:t};if(0===a||0===l)return p;const{ctx:f,buffer:m,gridInner:_,gridOuter:g}=this;f.clearRect(m,m,a,l),f.fillText(e,m,m+s);const y=f.getImageData(m,m,a,l);g.fill(Up,0,h),_.fill(0,0,h);for(let e=0;e<l;e++)for(let t=0;t<a;t++){const r=y.data[4*(e*a+t)+3]/255;if(0===r)continue;const i=(e+m)*c+t+m;if(1===r)g[i]=0,_[i]=Up;else{const e=.5-r;g[i]=e>0?e*e:0,_[i]=e<0?e*e:0}}$p(g,0,0,c,u,c,this.f,this.v,this.z),$p(_,m,m,a,l,c,this.f,this.v,this.z);for(let e=0;e<h;e++){const t=Math.sqrt(g[e])-Math.sqrt(_[e]);d[e]=Math.round(255-255*(t/this.radius+this.cutoff))}return p}};const Zp=Np;function Xp(e,t,r,i,n=1){const o=[],s=e.imagePrimary,a=s.pixelRatio,l=s.paddedRect.w-2*Zp,c=s.paddedRect.h-2*Zp,u=(e.right-e.left)*n,h=(e.bottom-e.top)*n,d=s.stretchX||[[0,l]],p=s.stretchY||[[0,c]],f=(e,t)=>e+t[1]-t[0],m=d.reduce(f,0),_=p.reduce(f,0),g=l-m,y=c-_;let x=0,v=m,b=0,w=_,T=0,S=g,E=0,M=y;if(s.content&&i){const e=s.content;x=Yp(d,0,e[0]),b=Yp(p,0,e[1]),v=Yp(d,e[0],e[2]),w=Yp(p,e[1],e[3]),T=e[0]-x,E=e[1]-b,S=e[2]-e[0]-v,M=e[3]-e[1]-w}const A=(i,o,l,c)=>{const d=Kp(i.stretch-x,v,u,e.left*n),p=Qp(i.fixed-T,S,i.stretch,m),f=Kp(o.stretch-b,w,h,e.top*n),g=Qp(o.fixed-E,M,o.stretch,_),y=Kp(l.stretch-x,v,u,e.left*n),A=Qp(l.fixed-T,S,l.stretch,m),C=Kp(c.stretch-b,w,h,e.top*n),I=Qp(c.fixed-E,M,c.stretch,_),P=new $(d,f),R=new $(y,f),z=new $(y,C),D=new $(d,C),k=new $(p/a,g/a),O=new $(A/a,I/a),L=t*Math.PI/180;if(L){const e=Math.sin(L),t=Math.cos(L),r=[t,-e,e,t];P._matMult(r),R._matMult(r),D._matMult(r),z._matMult(r)}const B=i.stretch+i.fixed,F=l.stretch+l.fixed,N=o.stretch+o.fixed,V=c.stretch+c.fixed,j=e.imageSecondary;return{tl:P,tr:R,bl:D,br:z,texPrimary:{x:s.paddedRect.x+Zp+B,y:s.paddedRect.y+Zp+N,w:F-B,h:V-N},texSecondary:j?{x:j.paddedRect.x+Zp+B,y:j.paddedRect.y+Zp+N,w:F-B,h:V-N}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:k,pixelOffsetBR:O,minFontScaleX:S/a/u,minFontScaleY:M/a/h,isSDF:r}};if(i&&(s.stretchX||s.stretchY)){const e=Jp(d,g,m),t=Jp(p,y,_);for(let r=0;r<e.length-1;r++){const i=e[r],n=e[r+1];for(let e=0;e<t.length-1;e++)o.push(A(i,t[e],n,t[e+1]))}}else o.push(A({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:c+1}));return o}function Yp(e,t,r){let i=0;for(const n of e)i+=Math.max(t,Math.min(r,n[1]))-Math.max(t,Math.min(r,n[0]));return i}function Jp(e,t,r){const i=[{fixed:-Zp,stretch:0}];for(const[t,r]of e){const e=i[i.length-1];i.push({fixed:t-e.stretch,stretch:e.stretch}),i.push({fixed:t-e.stretch,stretch:e.stretch+(r-t)})}return i.push({fixed:t+Zp,stretch:r}),i}function Kp(e,t,r,i){return e/t*r+i}function Qp(e,t,r,i){return e-t*r/i}function ef(e,t,r,i){const n=t+e.positionedLines[i].lineOffset;return 0===i?r+n/2:r+(n+(t+e.positionedLines[i-1].lineOffset))/2}function tf(e,t=1,r=!1){let i=1/0,n=1/0,o=-1/0,s=-1/0;const a=e[0];for(let e=0;e<a.length;e++){const t=a[e];(!e||t.x<i)&&(i=t.x),(!e||t.y<n)&&(n=t.y),(!e||t.x>o)&&(o=t.x),(!e||t.y>s)&&(s=t.y)}const l=Math.min(o-i,s-n);let c=l/2;const u=new Zr([],rf);if(0===l)return new $(i,n);for(let t=i;t<o;t+=l)for(let r=n;r<s;r+=l)u.push(new nf(t+c,r+c,c,e));let h=function(e){let t=0,r=0,i=0;const n=e[0];for(let e=0,o=n.length,s=o-1;e<o;s=e++){const o=n[e],a=n[s],l=o.x*a.y-a.x*o.y;r+=(o.x+a.x)*l,i+=(o.y+a.y)*l,t+=3*l}return new nf(r/t,i/t,0,e)}(e),d=u.length;for(;u.length;){const i=u.pop();(i.d>h.d||!h.d)&&(h=i,r&&console.log("found best %d after %d probes",Math.round(1e4*i.d)/1e4,d)),i.max-h.d<=t||(c=i.h/2,u.push(new nf(i.p.x-c,i.p.y-c,c,e)),u.push(new nf(i.p.x+c,i.p.y-c,c,e)),u.push(new nf(i.p.x-c,i.p.y+c,c,e)),u.push(new nf(i.p.x+c,i.p.y+c,c,e)),d+=4)}return r&&(console.log(`num probes: ${d}`),console.log(`best distance: ${h.d}`)),h.p}function rf(e,t){return t.max-e.max}class nf{constructor(e,t,r,i){this.p=new $(e,t),this.h=r,this.d=function(e,t){let r=!1,i=1/0;for(let n=0;n<t.length;n++){const o=t[n];for(let t=0,n=o.length,s=n-1;t<n;s=t++){const n=o[t],a=o[s];n.y>e.y!=a.y>e.y&&e.x<(a.x-n.x)*(e.y-n.y)/(a.y-n.y)+n.x&&(r=!r),i=Math.min(i,Nl(e,n,a))}}return(r?1:-1)*Math.sqrt(i)}(this.p,i),this.max=this.d+this.h*Math.SQRT2}}const of=Number.POSITIVE_INFINITY,sf=Math.sqrt(2);function af(e,[t,r]){let i=0,n=0;if(r===of){t<0&&(t=0);const r=t/sf;switch(e){case"top-right":case"top-left":n=r-7;break;case"bottom-right":case"bottom-left":n=7-r;break;case"bottom":n=7-t;break;case"top":n=t-7}switch(e){case"top-right":case"bottom-right":i=-r;break;case"top-left":case"bottom-left":i=r;break;case"left":i=t;break;case"right":i=-t}}else{switch(t=Math.abs(t),r=Math.abs(r),e){case"top-right":case"top-left":case"top":n=r-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-r}switch(e){case"top-right":case"bottom-right":case"right":i=-t;break;case"top-left":case"bottom-left":case"left":i=t}}return[i,n]}function lf(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function cf(e,t,r,i,n,o,s,a,l,c,u,h,d,p,f){let m=o.textMaxSize.evaluate(t,{},h);void 0===m?m=s*o.textScaleFactor:m*=o.textScaleFactor;const _=e.layers[0].layout,g=_.get("icon-offset").evaluate(t,{},h),y=pf(r.horizontal)||r.vertical,x="globe"===d.name,v=Hd,b=s*o.textScaleFactor/v,w=e.tilePixelRatio*m/v,T=(R=e.overscaling,e.zoom>18&&R>2&&(R>>=1),Math.max(Xr/(512*R),1)*_.get("symbol-spacing")),S=_.get("text-padding")*e.tilePixelRatio,E=_.get("icon-padding")*e.tilePixelRatio,M=W(_.get("text-max-angle")),A="map"===_.get("text-rotation-alignment")&&"point"!==_.get("symbol-placement"),C="map"===_.get("icon-rotation-alignment")&&"point"!==_.get("symbol-placement"),I=_.get("symbol-placement"),P=T/2;var R;const z=_.get("icon-text-fit").evaluate(t,{},h),D=_.get("icon-text-fit-padding").evaluate(t,{},h),k="none"!==z;let O;!1===e.hasAnyIconTextFit&&k&&(e.hasAnyIconTextFit=!0),i&&k&&(e.allowVerticalPlacement&&r.vertical&&(O=Cp(i,r.vertical,z,D,g,b)),y&&(i=Cp(i,y,z,D,g,b)));const L=(s,a,m)=>{if(a.x<0||a.x>=Xr||a.y<0||a.y>=Xr)return;let _=null;if(x){const{x:e,y:t,z:r}=d.projectTilePoint(a.x,a.y,m);_={anchor:new Ip(e,t,r,0,void 0),up:d.upVector(m,a.x,a.y)}}!function(e,t,r,i,n,o,s,a,l,c,u,h,d,p,f,m,_,g,y,x,v,b,w,T,S,E,M){const A=e.addToLineVertexArray(t,i);let C,I,P,R,z,D,k,O=0,L=0,B=0,F=0,N=-1,V=-1;const j={};let U=gt("");const $=r?r.anchor:t,G="none"!==l.layout.get("icon-text-fit").evaluate(v,{},S);let q=0,H=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?[q,H]=l.layout.get("text-offset").evaluate(v,{},S).map((e=>e*Hd)):(q=l.layout.get("text-radial-offset").evaluate(v,{},S)*Hd,H=of),e.allowVerticalPlacement&&n.vertical){const e=n.vertical;if(f)D=mf(e),a&&(k=mf(a));else{const r=l.layout.get("text-rotate").evaluate(v,{},S)+90;P=ff(c,$,t,u,h,d,e,p,r,m),a&&(R=ff(c,$,t,u,h,d,a,g,r))}}if(o){const i=l.layout.get("icon-rotate").evaluate(v,{},S),n=Xp(o,i,w,G,b.iconScaleFactor),s=a?Xp(a,i,w,G,b.iconScaleFactor):void 0;I=ff(c,$,t,u,h,d,o,g,i),O=4*n.length;const p=e.iconSizeData;let f=null;"source"===p.kind?(f=[Wd*l.layout.get("icon-size").evaluate(v,{},S)*b.iconScaleFactor],f[0]>hf&&pe(`${e.layerIds[0]}: Value for "icon-size" is >= ${uf}. Reduce your "icon-size".`)):"composite"===p.kind&&(f=[Wd*b.compositeIconSizes[0].evaluate(v,{},S)*b.iconScaleFactor,Wd*b.compositeIconSizes[1].evaluate(v,{},S)*b.iconScaleFactor],(f[0]>hf||f[1]>hf)&&pe(`${e.layerIds[0]}: Value for "icon-size" is >= ${uf}. Reduce your "icon-size".`)),e.addSymbols(e.icon,n,f,x,y,v,!1,r,t,A.lineStartIndex,A.lineLength,-1,T,S,E,M),N=e.icon.placedSymbolArray.length-1,s&&(L=4*s.length,e.addSymbols(e.icon,s,f,x,y,v,fp.vertical,r,t,A.lineStartIndex,A.lineLength,-1,T,S,E,M),V=e.icon.placedSymbolArray.length-1)}for(const i in n.horizontal){const o=n.horizontal[i];C||(U=gt(o.text),f?z=mf(o):C=ff(c,$,t,u,h,d,o,p,l.layout.get("text-rotate").evaluate(v,{},S),m));const a=1===o.positionedLines.length;if(B+=df(e,r,t,o,s,l,f,v,m,A,n.vertical?fp.horizontal:fp.horizontalOnly,a?Object.keys(n.horizontal):[i],j,N,b,T,S,E),a)break}n.vertical&&(F+=df(e,r,t,n.vertical,s,l,f,v,m,A,fp.vertical,["vertical"],j,V,b,T,S,E));let W=-1;const Z=(e,t)=>e?Math.max(e,t):t;W=Z(z,W),W=Z(D,W),W=Z(k,W);const X=W>-1?1:0;e.glyphOffsetArray.length>=65535&&pe("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==v.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,v.sortKey),e.symbolInstances.emplaceBack(t.x,t.y,$.x,$.y,$.z,j.right>=0?j.right:-1,j.center>=0?j.center:-1,j.left>=0?j.left:-1,j.vertical>=0?j.vertical:-1,N,V,U,void 0!==C?C:e.collisionBoxArray.length,void 0!==C?C+1:e.collisionBoxArray.length,void 0!==P?P:e.collisionBoxArray.length,void 0!==P?P+1:e.collisionBoxArray.length,void 0!==I?I:e.collisionBoxArray.length,void 0!==I?I+1:e.collisionBoxArray.length,R||e.collisionBoxArray.length,R?R+1:e.collisionBoxArray.length,u,B,F,O,L,X,0,q,H,W,0,G?1:0)}(e,a,_,s,r,i,n,O,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,S,A,l,0,E,C,g,t,o,c,u,h,p,f)};if("line"===I)for(const n of Bp(t.geometry,0,0,Xr,Xr)){const t=Op(n,T,M,r.vertical||y,i,v,w,e.overscaling,Xr);for(const r of t)y&&_f(e,y.text,P,r)||L(n,r,h)}else if("line-center"===I){for(const e of t.geometry)if(e.length>1){const t=kp(e,M,r.vertical||y,i,v,w);t&&L(e,t,h)}}else if("Polygon"===t.type)for(const e of Ou(t.geometry,0)){const t=tf(e,16);L(e[0],new Ip(t.x,t.y,0,0,void 0),h)}else if("LineString"===t.type)for(const e of t.geometry)L(e,new Ip(e[0].x,e[0].y,0,0,void 0),h);else if("Point"===t.type)for(const e of t.geometry)for(const t of e)L([t],new Ip(t.x,t.y,0,0,void 0),h)}const uf=255,hf=uf*Wd;function df(e,t,r,i,n,o,s,a,l,c,u,h,d,p,f,m,_,g){const y=function(e,t,r,i,n,o,s,a){const l=[];if(0===t.positionedLines.length)return l;const c=i.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=function(e){const t=e[0],r=e[1],i=t*r;return i>0?[t,-r]:i<0?[-t,r]:0===t?[r,t]:[r,-t]}(r);let h=Math.abs(t.top-t.bottom);for(const e of t.positionedLines)h-=e.lineOffset;const d=t.positionedLines.length,p=h/d;let f=t.top-r[1];for(let e=0;e<d;++e){const i=t.positionedLines[e];f=ef(t,p,f,e);for(const e of i.positionedGlyphs){if(!e.rect)continue;const i=e.rect||{};let o=pp+1,h=!0,d=1,p=0;if(e.imageName){const t=s[e.imageName];if(!t)continue;if(t.sdf){pe("SDF images are not supported in formatted text and will be ignored.");continue}h=!1,d=t.pixelRatio,o=Np/d}const m=(n||a)&&e.vertical,_=e.metrics.advance*e.scale/2,g=e.metrics,y=e.rect;if(null===y)continue;a&&t.verticalizable&&(p=e.imageName?_-e.metrics.width*e.scale/2:0);const x=n?[e.x+_,e.y]:[0,0];let v=[0,0],b=[0,0],w=!1;n||(m?(b=[e.x+_+u[0],e.y+u[1]-p],w=!0):v=[e.x+_+r[0],e.y+r[1]-p]);const T=y.w*e.scale/(d*(e.localGlyph?qp:1)),S=y.h*e.scale/(d*(e.localGlyph?qp:1));let E,M,A,C;if(m){const t=e.y-f,r=new $(-_,_-t),i=-Math.PI/2,n=new $(...b);E=new $(-_+v[0],v[1]),E._rotateAround(i,r)._add(n),E.x+=-t+_,E.y-=(g.left-o)*e.scale;const s=e.imageName?g.advance*e.scale:Hd*e.scale,a=String.fromCodePoint(e.glyph);ep(a)?E.x+=(1-o)*e.scale:tp(a)?E.x+=s-g.height*e.scale+(-o-1)*e.scale:E.x+=e.imageName||g.width+2*o===y.w&&g.height+2*o===y.h?(s-S)/2:(s-(g.height+2*o)*e.scale)/2,M=new $(E.x,E.y-T),A=new $(E.x+S,E.y),C=new $(E.x+S,E.y-T)}else{const t=(g.left-o)*e.scale-_+v[0],r=(-g.top-o)*e.scale+v[1],i=t+T,n=r+S;E=new $(t,r),M=new $(i,r),A=new $(t,n),C=new $(i,n)}if(c){let e;e=n?new $(0,0):w?new $(u[0],u[1]):new $(r[0],r[1]),E._rotateAround(c,e),M._rotateAround(c,e),A._rotateAround(c,e),C._rotateAround(c,e)}const I=new $(0,0),P=new $(0,0);l.push({tl:E,tr:M,bl:A,br:C,texPrimary:i,texSecondary:void 0,writingMode:t.writingMode,glyphOffset:x,sectionIndex:e.sectionIndex,isSDF:h,pixelOffsetTL:I,pixelOffsetBR:P,minFontScaleX:0,minFontScaleY:0})}}return l}(0,i,l,o,s,a,n,e.allowVerticalPlacement),x=e.textSizeData;let v=null;"source"===x.kind?(v=[Wd*o.layout.get("text-size").evaluate(a,{},_)*f.textScaleFactor],v[0]>hf&&pe(`${e.layerIds[0]}: Value for "text-size" is >= ${uf}. Reduce your "text-size".`)):"composite"===x.kind&&(v=[Wd*f.compositeTextSizes[0].evaluate(a,{},_)*f.textScaleFactor,Wd*f.compositeTextSizes[1].evaluate(a,{},_)*f.textScaleFactor],(v[0]>hf||v[1]>hf)&&pe(`${e.layerIds[0]}: Value for "text-size" is >= ${uf}. Reduce your "text-size".`)),e.addSymbols(e.text,y,v,l,s,a,u,t,r,c.lineStartIndex,c.lineLength,p,m,_,g,!1);for(const t of h)d[t]=e.text.placedSymbolArray.length-1;return 4*y.length}function pf(e){for(const t in e)return e[t];return null}function ff(e,t,r,i,n,o,s,a,l,c){let u=s.top,h=s.bottom,d=s.left,p=s.right;const f=s.collisionPadding;if(f&&(d-=f[0],u-=f[1],p+=f[2],h+=f[3]),l){const e=new $(d,u),t=new $(p,u),r=new $(d,h),i=new $(p,h),n=W(l);let o=new $(0,0);c&&(o=new $(c[0],c[1])),e._rotateAround(n,o),t._rotateAround(n,o),r._rotateAround(n,o),i._rotateAround(n,o),d=Math.min(e.x,t.x,r.x,i.x),p=Math.max(e.x,t.x,r.x,i.x),u=Math.min(e.y,t.y,r.y,i.y),h=Math.max(e.y,t.y,r.y,i.y)}return e.emplaceBack(t.x,t.y,t.z,r.x,r.y,d,u,p,h,a,i,n,o),e.length-1}function mf(e){e.collisionPadding&&(e.top-=e.collisionPadding[1],e.bottom+=e.collisionPadding[3]);const t=e.bottom-e.top;return t>0?Math.max(10,t):null}function _f(e,t,r,i){const n=e.compareText;if(t in n){const e=n[t];for(let t=e.length-1;t>=0;t--)if(i.dist(e[t])<r)return!0}else n[t]=[];return n[t].push(i),!1}function gf(e,t){const r=e.fovAboveCenter,i=e.elevation?e.elevation.getMinElevationBelowMSL()*t:0,n=(e._camera.position[2]*e.worldSize-i)/Math.cos(e._pitch),o=Math.sin(r)*n/Math.sin(Math.max(Math.PI/2-e._pitch-r,.01));let s=Math.sin(e._pitch)*o+n;const a=n*(1/e._horizonShift);return e.elevation&&0!==e.elevation.exaggeration()||(s*=1+Math.max(e.zoom-17,0)),Math.min(1.01*s,a)}function yf(e,t){if(!t.isReprojectedInTileSpace)return{scale:1<<e.z,x:e.x,y:e.y,x2:e.x+1,y2:e.y+1,projection:t};const r=Math.pow(2,-e.z),i=e.x*r,n=(e.x+1)*r,o=e.y*r,s=(e.y+1)*r,a=hl(i),l=hl(n),c=dl(o),u=dl(s),h=t.project(a,c),d=t.project(l,c),p=t.project(l,u),f=t.project(a,u);let m=Math.min(h.x,d.x,p.x,f.x),_=Math.min(h.y,d.y,p.y,f.y),g=Math.max(h.x,d.x,p.x,f.x),y=Math.max(h.y,d.y,p.y,f.y);const x=r/16;function v(e,r,i,n,o,s){const a=(i+o)/2,l=(n+s)/2,c=t.project(hl(a),dl(l)),u=Math.max(0,m-c.x,_-c.y,c.x-g,c.y-y);m=Math.min(m,c.x),g=Math.max(g,c.x),_=Math.min(_,c.y),y=Math.max(y,c.y),u>x&&(v(e,c,i,n,a,l),v(c,r,a,l,o,s))}v(h,d,i,o,n,o),v(d,p,n,o,n,s),v(p,f,n,s,i,s),v(f,h,i,s,i,o),m-=x,_-=x,g+=x,y+=x;const b=1/Math.max(g-m,y-_);return{scale:b,x:m*b,y:_*b,x2:g*b,y2:y*b,projection:t}}function xf(e,{x:t,y:r},i=0){return new $(((t-i)*e.scale-e.x)*Xr,(r*e.scale-e.y)*Xr)}const vf=N.mat4.identity(new Float32Array(16));class bf{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,t){return{x:0,y:0,z:0}}unproject(e,t){return new il(0,0)}projectTilePoint(e,t,r){return{x:e,y:t,z:0}}locationPoint(e,t,r=!0){return e._coordinatePoint(e.locationCoordinate(t),r)}pixelsPerMeter(e,t){return ul(1,e)*t}pixelSpaceConversion(e,t,r){return 1}farthestPixelDistance(e){return gf(e,e.pixelsPerMeter)}pointCoordinate(e,t,r,i){const n=e.horizonLineFromTop(!1),o=new $(t,Math.max(n,r));return e.rayIntersectionCoordinate(e.pointRayIntersection(o,i))}pointCoordinate3D(e,t,r){const i=new $(t,r);if(e.elevation)return e.elevation.pointCoordinate(i);{const t=this.pointCoordinate(e,i.x,i.y,0);return[t.x,t.y,t.z]}}isPointAboveHorizon(e,t){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,t.x,t.y);const r=e.horizonLineFromTop();return t.y<r}createInversionMatrix(e,t){return vf}createTileMatrix(e,t,r){let i,n,o;const s=r.canonical,a=N.mat4.identity(new Float64Array(16));if(this.isReprojectedInTileSpace){const l=yf(s,this);i=1,n=l.x+r.wrap*l.scale,o=l.y,N.mat4.scale(a,a,[i/l.scale,i/l.scale,e.pixelsPerMeter/t])}else i=t/e.zoomScale(s.z),n=(s.x+Math.pow(2,s.z)*r.wrap)*i,o=s.y*i;return N.mat4.translate(a,a,[n,o,0]),N.mat4.scale(a,a,[i/Xr,i/Xr,1]),a}upVector(e,t,r){return[0,0,1]}upVectorScale(e,t,r){return{metersToTile:1}}}class wf extends bf{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[t,r]=this.parallels=e.parallels||[29.5,45.5],i=Math.sin(W(t));this.n=(i+Math.sin(W(r)))/2,this.c=1+i*(2*this.n-i),this.r0=Math.sqrt(this.c)/this.n}project(e,t){const{n:r,c:i,r0:n}=this,o=W(e-this.center[0]),s=W(t),a=Math.sqrt(i-2*r*Math.sin(s))/r;return{x:a*Math.sin(o*r),y:a*Math.cos(o*r)-n,z:0}}unproject(e,t){const{n:r,c:i,r0:n}=this,o=n+t;let s=Math.atan2(e,Math.abs(o))*Math.sign(o);o*r<0&&(s-=Math.PI*Math.sign(e)*Math.sign(o));const a=W(this.center[0])*r;s=te(s,-Math.PI-a,Math.PI-a);const l=Q(Z(s/r)+this.center[0],-180,180),c=Math.asin(Q((i-(e*e+o*o)*r*r)/(2*r),-1,1)),u=Q(Z(c),-fl,fl);return new il(l,u)}}const Tf=1.340264,Sf=-.081106,Ef=893e-6,Mf=.003796,Af=Math.sqrt(3)/2;class Cf extends bf{project(e,t){t=t/180*Math.PI,e=e/180*Math.PI;const r=Math.asin(Af*Math.sin(t)),i=r*r,n=i*i*i;return{x:.5*(e*Math.cos(r)/(Af*(Tf+3*Sf*i+n*(7*Ef+9*Mf*i)))/Math.PI+.5),y:1-.5*(r*(Tf+Sf*i+n*(Ef+Mf*i))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let r=t=(2*(1-t)-1)*Math.PI,i=r*r,n=i*i*i;for(let e,o,s,a=0;a<12&&(o=r*(Tf+Sf*i+n*(Ef+Mf*i))-t,s=Tf+3*Sf*i+n*(7*Ef+9*Mf*i),e=o/s,r=Q(r-e,-Math.PI/3,Math.PI/3),i=r*r,n=i*i*i,!(Math.abs(e)<1e-12));++a);const o=Af*e*(Tf+3*Sf*i+n*(7*Ef+9*Mf*i))/Math.cos(r),s=Math.asin(Math.sin(r)/Af),a=Q(180*o/Math.PI,-180,180),l=Q(180*s/Math.PI,-fl,fl);return new il(a,l)}}class If extends bf{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){return{x:.5+e/360,y:.5-t/360,z:0}}unproject(e,t){const r=360*(e-.5),i=Q(360*(.5-t),-fl,fl);return new il(r,i)}}const Pf=Math.PI/2;function Rf(e){return Math.tan((Pf+e)/2)}class zf extends bf{constructor(e){super(e),this.center=e.center||[0,30];const[t,r]=this.parallels=e.parallels||[30,30];let i=W(t),n=W(r);this.southernCenter=i+n<0,this.southernCenter&&(i=-i,n=-n);const o=Math.cos(i),s=Rf(i);this.n=i===n?Math.sin(i):Math.log(o/Math.cos(n))/Math.log(Rf(n)/s),this.f=o*Math.pow(Rf(i),this.n)/this.n}project(e,t){t=W(t),this.southernCenter&&(t=-t),e=W(e-this.center[0]);const r=1e-6,{n:i,f:n}=this;n>0?t<-Pf+r&&(t=-Pf+r):t>Pf-r&&(t=Pf-r);const o=n/Math.pow(Rf(t),i);let s=o*Math.sin(i*e),a=n-o*Math.cos(i*e);return s=.5*(s/Math.PI+.5),a=.5*(a/Math.PI+.5),{x:s,y:this.southernCenter?a:1-a,z:0}}unproject(e,t){e=(2*e-.5)*Math.PI,this.southernCenter&&(t=1-t),t=(2*(1-t)-.5)*Math.PI;const{n:r,f:i}=this,n=i-t,o=Math.sign(n),s=Math.sign(r)*Math.sqrt(e*e+n*n);let a=Math.atan2(e,Math.abs(n))*o;n*r<0&&(a-=Math.PI*Math.sign(e)*o);const l=Q(Z(a/r)+this.center[0],-180,180),c=Q(Z(2*Math.atan(Math.pow(i/s,1/r))-Pf),-fl,fl);return new il(l,this.southernCenter?-c:c)}}class Df extends bf{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,t){return{x:ll(e),y:cl(t),z:0}}unproject(e,t){const r=hl(e),i=dl(t);return new il(r,i)}}const kf=W(fl);class Of extends bf{project(e,t){const r=(t=W(t))*t,i=r*r;return{x:.5*((e=W(e))*(.8707-.131979*r+i*(i*(.003971*r-.001529*i)-.013791))/Math.PI+.5),y:1-.5*(t*(1.007226+r*(.015085+i*(.028874*r-.044475-.005916*i)))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let r=t=(2*(1-t)-1)*Math.PI,i=25,n=0,o=r*r;do{o=r*r;const e=o*o;n=(r*(1.007226+o*(.015085+e*(.028874*o-.044475-.005916*e)))-t)/(1.007226+o*(.045255+e*(.259866*o-.311325-.005916*11*e))),r=Q(r-n,-kf,kf)}while(Math.abs(n)>1e-6&&--i>0);o=r*r;const s=Q(Z(e/(.8707+o*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979))),-180,180),a=Z(r);return new il(s,a)}}const Lf=W(fl);class Bf extends bf{project(e,t){t=W(t),e=W(e);const r=Math.cos(t),i=2/Math.PI,n=Math.acos(r*Math.cos(e/2)),o=Math.sin(n)/n,s=.5*(e*i+2*r*Math.sin(e/2)/o)||0,a=.5*(t+Math.sin(t)/o)||0;return{x:.5*(s/Math.PI+.5),y:1-.5*(a/Math.PI+1),z:0}}unproject(e,t){let r=e=(2*e-.5)*Math.PI,i=t=(2*(1-t)-1)*Math.PI,n=25;const o=1e-6;let s=0,a=0;do{const n=Math.cos(i),o=Math.sin(i),l=2*o*n,c=o*o,u=n*n,h=Math.cos(r/2),d=Math.sin(r/2),p=2*h*d,f=d*d,m=1-u*h*h,_=m?1/m:0,g=m?Math.acos(n*h)*Math.sqrt(1/m):0,y=.5*(2*g*n*d+2*r/Math.PI)-e,x=.5*(g*o+i)-t,v=.5*_*(u*f+g*n*h*c)+1/Math.PI,b=_*(p*l/4-g*o*d),w=.125*_*(l*d-g*o*u*p),T=.5*_*(c*h+g*f*n)+.5,S=b*w-T*v;s=(x*b-y*T)/S,a=(y*w-x*v)/S,r=Q(r-s,-Math.PI,Math.PI),i=Q(i-a,-Lf,Lf)}while((Math.abs(s)>o||Math.abs(a)>o)&&--n>0);return new il(Z(r),Z(i))}}class Ff extends bf{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(W(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){const{scale:r,cosPhi:i}=this;return{x:W(e)*i*r+.5,y:-Math.sin(W(t))/i*r+.5,z:0}}unproject(e,t){const{scale:r,cosPhi:i}=this,n=-(t-.5)/r,o=Q(Z((e-.5)/r)/i,-180,180),s=Math.asin(Q(n*i,-1,1)),a=Q(Z(s),-fl,fl);return new il(o,a)}}class Nf extends Df{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,t,r){const i=Ic(e,t,r),n=zc(Tc(r));return N.vec3.transformMat4(i,i,n),{x:i[0],y:i[1],z:i[2]}}locationPoint(e,t){const r=el(t.lat,t.lng),i=N.vec3.normalize([],r),n=e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(t),e._centerAltitude):e._centerAltitude,o=ul(1,0)*Xr*n;N.vec3.scaleAndAdd(r,r,i,o);const s=N.mat4.identity(new Float64Array(16));return N.mat4.multiply(s,e.pixelMatrix,e.globeMatrix),N.vec3.transformMat4(r,r,s),new $(r[0],r[1])}pixelsPerMeter(e,t){return ul(1,0)*t}pixelSpaceConversion(e,t,r){const i=ul(1,e)*t,n=Ct(ul(1,45)*t,i,r);return this.pixelsPerMeter(e,t)/n}createTileMatrix(e,t,r){const i=Dc(Tc(r.canonical));return N.mat4.multiply(new Float64Array(16),e.globeMatrix,i)}createInversionMatrix(e,t){const{center:r}=e,i=zc(Tc(t));return N.mat4.rotateY(i,i,W(r.lng)),N.mat4.rotateX(i,i,W(r.lat)),N.mat4.scale(i,i,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(i)}pointCoordinate(e,t,r,i){return vc(e,t,r,!0)||new xl(0,0)}pointCoordinate3D(e,t,r){const i=this.pointCoordinate(e,t,r,0);return[i.x,i.y,i.z]}isPointAboveHorizon(e,t){return!vc(e,t.x,t.y,!1)}farthestPixelDistance(e){const t=function(e,t){const r=e.cameraToCenterDistance,i=e._centerAltitude*t,n=e._camera,o=e._camera.forward(),s=N.vec3.add([],N.vec3.scale([],o,-r),[0,0,i]),a=e.worldSize/(2*Math.PI),l=[0,0,-a],c=e.width/e.height,u=Math.tan(e.fovAboveCenter),h=N.vec3.scale([],n.up(),u),d=N.vec3.scale([],n.right(),u*c),p=N.vec3.normalize([],N.vec3.add([],N.vec3.add([],o,h),d)),f=[];let m;if(new uc(s,p).closestPointOnSphere(l,a,f)){const t=N.vec3.add([],f,l),r=N.vec3.sub([],t,s);m=Math.cos(e.fovAboveCenter)*N.vec3.length(r)}else{const e=N.vec3.sub([],s,l),t=N.vec3.sub([],l,s);N.vec3.normalize(t,t);const r=N.vec3.length(e)-a;m=Math.sqrt(r*(r+2*a));const i=Math.acos(m/(a+r))-Math.acos(N.vec3.dot(o,t));m*=Math.cos(i)}return 1.01*m}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),r=Bc(e.zoom);if(r>0){const i=gf(e,ul(1,e.center.lat)*e.worldSize),n=e.worldSize/(2*Math.PI),o=Math.max(e.width,e.height)/e.worldSize*Math.PI;return Ct(t,i+n*(1-Math.cos(o)),Math.pow(r,10))}return t}upVector(e,t,r){return Ic(t,r,e,1)}upVectorScale(e){return{metersToTile:yc(Pc(Tc(e)))}}}function Vf(e){const t=e.parallels,r=!!t&&Math.abs(t[0]+t[1])<.01;switch(e.name){case"mercator":return new Df(e);case"equirectangular":return new If(e);case"naturalEarth":return new Of(e);case"equalEarth":return new Cf(e);case"winkelTripel":return new Bf(e);case"albers":return r?new Ff(e):new wf(e);case"lambertConformalConic":return r?new Ff(e):new zf(e);case"globe":return new Nf(e)}throw new Error(`Invalid projection name: ${e.name}`)}const jf=hh.VectorTileFeature.types,Uf=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function $f(e,t,r,i,n,o,s,a,l,c,u,h,d){const p=a?Math.min(hf,Math.round(a[0])):0,f=a?Math.min(hf,Math.round(a[1])):0;e.emplaceBack(t,r,Math.round(32*i),Math.round(32*n),o,s,(p<<1)+(l?1:0),f,16*c,16*u,256*h,256*d)}function Gf(e,t,r){e.emplaceBack(t,r)}function qf(e,t,r,i,n,o,s){e.emplaceBack(t,r,i,n,o,s)}function Hf(e,t,r,i,n){e.emplaceBack(t,r,i,n),e.emplaceBack(t,r,i,n),e.emplaceBack(t,r,i,n),e.emplaceBack(t,r,i,n)}function Wf(e){for(const t of e.sections)if(vo(t.text))return!0;return!1}class Zf{constructor(e){this.layoutVertexArray=new Cs,this.indexArray=new Ls,this.programConfigurations=e,this.segments=new da,this.dynamicLayoutVertexArray=new Ts,this.opacityVertexArray=new Ps,this.placedSymbolArray=new ea,this.iconTransitioningVertexArray=new Rs,this.globeExtVertexArray=new Is,this.zOffsetVertexArray=new Ns}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length&&0===this.iconTransitioningVertexArray.length}upload(e,t,r,i,n){this.isEmpty()||(r&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Bd.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Nd.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Uf,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,jd.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Fd.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||n)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Vd.members,!0)),this.opacityVertexBuffer.itemSize=1),(r||i)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy())}}so(Zf,"SymbolBuffers");class Xf{constructor(e,t,r){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new r,this.segments=new da,this.collisionVertexArray=new Os,this.collisionVertexArrayExt=new Ts}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Ud.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,$d.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}so(Xf,"CollisionBuffers");class Yf{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.lut=e.lut,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.fqid)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=N.mat4.identity([]),this.placementViewportMatrix=N.mat4.identity([]);const t=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Zd(this.zoom,t["text-size"]),this.iconSizeData=Zd(this.zoom,t["icon-size"]);const r=this.layers[0].layout,i=r.get("symbol-sort-key"),n=r.get("symbol-z-order");this.canOverlap=r.get("text-allow-overlap")||r.get("icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==n&&void 0!==i.constantOr(1),this.sortFeaturesByY=("viewport-y"===n||"auto"===n&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=r.get("text-writing-mode").map((e=>fp[e])),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=r.get("symbol-z-elevate"),this.activeReplacements=[],this.replacementUpdateTime=0}createArrays(){this.text=new Zf(new Na(this.layers,{zoom:this.zoom,lut:this.lut},(e=>e.startsWith("text")||e.startsWith("symbol")))),this.icon=new Zf(new Na(this.layers,{zoom:this.zoom,lut:this.lut},(e=>e.startsWith("icon")||e.startsWith("symbol")))),this.glyphOffsetArray=new ia,this.lineVertexArray=new na,this.symbolInstances=new ra}calculateGlyphDependencies(e,t,r,i,n){for(const r of e){const e=r.codePointAt(0);if(void 0===e)break;if(t[e]=!0,i&&n&&e<=65535){const e=Qd[r];e&&(t[e.charCodeAt(0)]=!0)}}}updateFootprints(e,t){}updateReplacement(e,t){if(t.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=t.updateTime;const r=t.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!wh(this.activeReplacements,r)&&(this.activeReplacements=r,!0)}populate(e,t,r,i){const n=this.layers[0],o=n.layout,s="globe"===this.projection.name,a=o.get("text-font"),l=o.get("text-field"),c=o.get("icon-image"),u=("constant"!==l.value.kind||l.value.value instanceof Kt&&!l.value.value.isEmpty()||l.value.value.toString().length>0)&&("constant"!==a.value.kind||a.value.value.length>0),h="constant"!==c.value.kind||!!c.value.value||Object.keys(c.parameters).length>0,d=o.get("symbol-sort-key");if(this.features=[],!u&&!h)return;const p=t.iconDependencies,f=t.glyphDependencies,m=t.availableImages,_=new Do(this.zoom);for(const{feature:t,id:l,index:c,sourceLayerIndex:g}of e){const e=n._featureFilter.needGeometry,y=Cl(t,e);if(!n._featureFilter.filter(_,y,r))continue;if(e||(y.geometry=Al(t,r,i)),s&&1!==t.type&&r.z<=5){const e=y.geometry,t=.98078528056,i=(e,i)=>{const n=Ic(e.x,e.y,r,1),o=Ic(i.x,i.y,r,1);return N.vec3.dot(n,o)<t};for(let t=0;t<e.length;t++)e[t]=Tl(e[t],i)}let x,v;if(u){const e=n.getValueAndResolveTokens("text-field",y,r,m),t=Kt.factory(e);Wf(t)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Po()||this.hasRTLText&&zo.isParsed())&&(x=Kd(t,n,y))}if(h){const e=n.getValueAndResolveTokens("icon-image",y,r,m);v=e instanceof Qt?e:Qt.fromString(e)}if(!x&&!v)continue;const b=this.sortFeaturesByKey?d.evaluate(y,{},r):void 0;if(this.features.push({id:l,text:x,icon:v,index:c,sourceLayerIndex:g,geometry:y.geometry,properties:t.properties,type:jf[t.type],sortKey:b}),v&&(p[v.namePrimary]=!0,v.nameSecondary&&(p[v.nameSecondary]=!0)),x){const e=a.evaluate(y,{},r).join(","),t="map"===o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(fp.vertical)>=0;for(const r of x.sections)if(r.image)p[r.image.namePrimary]=!0;else{const i=po(x.toString()),n=r.fontStack||e,o=f[n]=f[n]||{};this.calculateGlyphDependencies(r.text,o,t,this.allowVerticalPlacement,i)}}}"line"===o.get("symbol-placement")&&(this.features=function(e){const t={},r={},i=[];let n=0;function o(t){i.push(e[t]),n++}function s(e,t,n){const o=r[e];return delete r[e],r[t]=o,i[o].geometry[0].pop(),i[o].geometry[0]=i[o].geometry[0].concat(n[0]),o}function a(e,r,n){const o=t[r];return delete t[r],t[e]=o,i[o].geometry[0].shift(),i[o].geometry[0]=n[0].concat(i[o].geometry[0]),o}function l(e,t,r){const i=r?t[0][t[0].length-1]:t[0][0];return`${e}:${i.x}:${i.y}`}for(let c=0;c<e.length;c++){const u=e[c],h=u.geometry,d=u.text?u.text.toString():null;if(!d){o(c);continue}const p=l(d,h),f=l(d,h,!0);if(p in r&&f in t&&r[p]!==t[f]){const e=a(p,f,h),n=s(p,f,i[e].geometry);delete t[p],delete r[f],r[l(d,i[n].geometry,!0)]=n,i[e].geometry=null}else p in r?s(p,f,h):f in t?a(p,f,h):(o(c),t[p]=n-1,r[f]=n-1)}return i.filter((e=>e.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((e,t)=>e.sortKey-t.sortKey))}update(e,t,r,i,n){const o=0!==Object.keys(e).length;if(o&&!this.stateDependentLayers.length)return;const s=o?this.stateDependentLayers:this.layers;this.text.programConfigurations.updatePaintArrays(e,t,s,r,i,n),this.icon.programConfigurations.updatePaintArrays(e,t,s,r,i,n)}updateZOffset(){const e=(e,t,i)=>{r+=t,r>e.length&&e.resize(r);for(let n=-t;n<0;n++)e.emplace(n+r,i)},t=(e,t,r)=>{i+=t,i>e.length&&e.resize(i);for(let n=-t;n<0;n++)e.emplace(n+i,r)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let r=0,i=0;for(let r=0;r<this.symbolInstances.length;r++){const i=this.symbolInstances.get(r),{numHorizontalGlyphVertices:n,numVerticalGlyphVertices:o,numIconVertices:s}=i,a=i.zOffset,l=s>0;if((n>0||o>0)&&(e(this.text.zOffsetVertexArray,n,a),e(this.text.zOffsetVertexArray,o,a)),l){const{placedIconSymbolIndex:e,verticalPlacedIconSymbolIndex:r}=i;e>=0&&t(this.icon.zOffsetVertexArray,s,a),r>=0&&t(this.icon.zOffsetVertexArray,i.numVerticalIconVertices,a)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Vf(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){const r=this.lineVertexArray.length;if(void 0!==e.segment)for(const{x:e,y:r}of t)this.lineVertexArray.emplaceBack(e,r);return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(e,t,r,i,n,o,s,a,l,c,u,h,d,p,f,m){const _=e.indexArray,g=e.layoutVertexArray,y=e.globeExtVertexArray,x=e.segments.prepareSegment(4*t.length,g,_,this.canOverlap?o.sortKey:void 0),v=this.glyphOffsetArray.length,b=x.vertexLength,w=this.allowVerticalPlacement&&s===fp.vertical?Math.PI/2:0,T=o.text&&o.text.sections;for(let i=0;i<t.length;i++){const{tl:n,tr:s,bl:c,br:u,texPrimary:h,texSecondary:v,pixelOffsetTL:b,pixelOffsetBR:S,minFontScaleX:E,minFontScaleY:M,glyphOffset:A,isSDF:C,sectionIndex:I}=t[i],P=x.vertexLength,R=A[1];if($f(g,l.x,l.y,n.x,R+n.y,h.x,h.y,r,C,b.x,b.y,E,M),$f(g,l.x,l.y,s.x,R+s.y,h.x+h.w,h.y,r,C,S.x,b.y,E,M),$f(g,l.x,l.y,c.x,R+c.y,h.x,h.y+h.h,r,C,b.x,S.y,E,M),$f(g,l.x,l.y,u.x,R+u.y,h.x+h.w,h.y+h.h,r,C,S.x,S.y,E,M),a){const{x:t,y:r,z:i}=a.anchor,[n,o,s]=a.up;qf(y,t,r,i,n,o,s),qf(y,t,r,i,n,o,s),qf(y,t,r,i,n,o,s),qf(y,t,r,i,n,o,s),Hf(e.dynamicLayoutVertexArray,t,r,i,w)}else Hf(e.dynamicLayoutVertexArray,l.x,l.y,l.z,w);if(m){const t=v||h;Gf(e.iconTransitioningVertexArray,t.x,t.y),Gf(e.iconTransitioningVertexArray,t.x+t.w,t.y),Gf(e.iconTransitioningVertexArray,t.x,t.y+t.h),Gf(e.iconTransitioningVertexArray,t.x+t.w,t.y+t.h)}_.emplaceBack(P,P+1,P+2),_.emplaceBack(P+1,P+2,P+3),x.vertexLength+=4,x.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(A[0]),i!==t.length-1&&I===t[i+1].sectionIndex||e.programConfigurations.populatePaintArrays(g.length,o,o.index,{},d,p,f,T&&T[I])}const S=a?a.anchor:l;e.placedSymbolArray.emplaceBack(S.x,S.y,S.z,l.x,l.y,v,this.glyphOffsetArray.length-v,b,c,u,l.segment,r?r[0]:0,r?r[1]:0,i[0],i[1],s,0,!1,0,h,0)}_commitLayoutVertex(e,t,r,i,n,o,s){e.emplaceBack(t,r,i,n,o,Math.round(s.x),Math.round(s.y))}_addCollisionDebugVertices(e,t,r,i,n,o,s){const a=r.segments.prepareSegment(4,r.layoutVertexArray,r.indexArray),l=a.vertexLength,c=s.tileAnchorX,u=s.tileAnchorY;for(let e=0;e<4;e++)r.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(r.collisionVertexArrayExt,t,e.padding,s.zOffset),this._commitLayoutVertex(r.layoutVertexArray,i,n,o,c,u,new $(e.x1,e.y1)),this._commitLayoutVertex(r.layoutVertexArray,i,n,o,c,u,new $(e.x2,e.y1)),this._commitLayoutVertex(r.layoutVertexArray,i,n,o,c,u,new $(e.x2,e.y2)),this._commitLayoutVertex(r.layoutVertexArray,i,n,o,c,u,new $(e.x1,e.y2)),a.vertexLength+=4;const h=r.indexArray;h.emplaceBack(l,l+1),h.emplaceBack(l+1,l+2),h.emplaceBack(l+2,l+3),h.emplaceBack(l+3,l),a.primitiveLength+=4}_addTextDebugCollisionBoxes(e,t,r,i,n,o){for(let s=i;s<n;s++){const i=r.get(s),n=this.getSymbolInstanceTextSize(e,o,t,s);this._addCollisionDebugVertices(i,n,this.textCollisionBox,i.projectedAnchorX,i.projectedAnchorY,i.projectedAnchorZ,o)}}_addIconDebugCollisionBoxes(e,t,r,i,n,o){for(let s=i;s<n;s++){const i=r.get(s),n=this.getSymbolInstanceIconSize(e,t,o.placedIconSymbolIndex);this._addCollisionDebugVertices(i,n,this.iconCollisionBox,i.projectedAnchorX,i.projectedAnchorY,i.projectedAnchorZ,o)}}generateCollisionDebugBuffers(e,t,r){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Xf(Ds,Gd.members,Rs),this.iconCollisionBox=new Xf(Ds,Gd.members,Rs);const i=Yd(this.iconSizeData,e),n=Yd(this.textSizeData,e,r);for(let r=0;r<this.symbolInstances.length;r++){const o=this.symbolInstances.get(r);this._addTextDebugCollisionBoxes(n,e,t,o.textBoxStartIndex,o.textBoxEndIndex,o),this._addTextDebugCollisionBoxes(n,e,t,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o),this._addIconDebugCollisionBoxes(i,e,t,o.iconBoxStartIndex,o.iconBoxEndIndex,o),this._addIconDebugCollisionBoxes(i,e,t,o.verticalIconBoxStartIndex,o.verticalIconBoxEndIndex,o)}}getSymbolInstanceTextSize(e,t,r,i){const n=this.text.placedSymbolArray.get(t.rightJustifiedTextSymbolIndex>=0?t.rightJustifiedTextSymbolIndex:t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.leftJustifiedTextSymbolIndex>=0?t.leftJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex>=0?t.verticalPlacedTextSymbolIndex:i),o=Xd(this.textSizeData,e,n)/Hd;return this.tilePixelRatio*o}getSymbolInstanceIconSize(e,t,r){const i=this.icon.placedSymbolArray.get(r),n=Xd(this.iconSizeData,e,i);return this.tilePixelRatio*n}_commitDebugCollisionVertexUpdate(e,t,r,i){e.emplaceBack(t,-r,-r,i),e.emplaceBack(t,r,-r,i),e.emplaceBack(t,r,r,i),e.emplaceBack(t,-r,r,i)}_updateTextDebugCollisionBoxes(e,t,r,i,n,o,s){for(let s=i;s<n;s++){const i=r.get(s),n=this.getSymbolInstanceTextSize(e,o,t,s);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,n,i.padding,o.zOffset)}}_updateIconDebugCollisionBoxes(e,t,r,i,n,o,s){for(let s=i;s<n;s++){const i=r.get(s),n=this.getSymbolInstanceIconSize(e,t,o.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,n,i.padding,o.zOffset)}}updateCollisionDebugBuffers(e,t,r,i){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const n=Yd(this.iconSizeData,e,i),o=Yd(this.textSizeData,e,r);for(let s=0;s<this.symbolInstances.length;s++){const a=this.symbolInstances.get(s);this._updateTextDebugCollisionBoxes(o,e,t,a.textBoxStartIndex,a.textBoxEndIndex,a,r),this._updateTextDebugCollisionBoxes(o,e,t,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a,r),this._updateIconDebugCollisionBoxes(n,e,t,a.iconBoxStartIndex,a.iconBoxEndIndex,a,i),this._updateIconDebugCollisionBoxes(n,e,t,a.verticalIconBoxStartIndex,a.verticalIconBoxEndIndex,a,i)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(e,t,r,i,n,o,s,a,l){const c={};if(t<r){const{x1:r,y1:i,x2:n,y2:o,padding:s,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:d,featureIndex:p}=e.get(t);c.textBox={x1:r,y1:i,x2:n,y2:o,padding:s,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:d},c.textFeatureIndex=p}if(i<n){const{x1:t,y1:r,x2:n,y2:o,padding:s,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:d,featureIndex:p}=e.get(i);c.verticalTextBox={x1:t,y1:r,x2:n,y2:o,padding:s,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:d},c.verticalTextFeatureIndex=p}if(o<s){const{x1:t,y1:r,x2:i,y2:n,padding:s,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:d,featureIndex:p}=e.get(o);c.iconBox={x1:t,y1:r,x2:i,y2:n,padding:s,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:d},c.iconFeatureIndex=p}if(a<l){const{x1:t,y1:r,x2:i,y2:n,padding:o,projectedAnchorX:s,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:d,featureIndex:p}=e.get(a);c.verticalIconBox={x1:t,y1:r,x2:i,y2:n,padding:o,projectedAnchorX:s,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:d},c.verticalIconFeatureIndex=p}return c}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){const r=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,t){const r=e.placedSymbolArray.get(t),i=r.vertexStartIndex+4*r.numGlyphs;for(let t=r.vertexStartIndex;t<i;t+=4)e.indexArray.emplaceBack(t,t+1,t+2),e.indexArray.emplaceBack(t+1,t+2,t+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const t=Math.sin(e),r=Math.cos(e),i=[],n=[],o=[];for(let e=0;e<this.symbolInstances.length;++e){o.push(e);const s=this.symbolInstances.get(e);i.push(0|Math.round(t*s.tileAnchorX+r*s.tileAnchorY)),n.push(s.featureIndex)}return o.sort(((e,t)=>i[e]-i[t]||n[t]-n[e])),o}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;e<this.symbolInstances.length;++e)this.symbolInstanceIndexesSortedZOffset.push(e)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort(((e,t)=>this.symbolInstances.get(t).zOffset-this.symbolInstances.get(e).zOffset))}addToSortKeyRanges(e,t){const r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===t?r.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const e of this.symbolInstanceIndexes){const t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex);const{rightJustifiedTextSymbolIndex:r,centerJustifiedTextSymbolIndex:i,leftJustifiedTextSymbolIndex:n,verticalPlacedTextSymbolIndex:o,placedIconSymbolIndex:s,verticalPlacedIconSymbolIndex:a}=t;r>=0&&this.addIndicesForPlacedSymbol(this.text,r),i>=0&&i!==r&&this.addIndicesForPlacedSymbol(this.text,i),n>=0&&n!==i&&n!==r&&this.addIndicesForPlacedSymbol(this.text,n),o>=0&&this.addIndicesForPlacedSymbol(this.text,o),s>=0&&this.addIndicesForPlacedSymbol(this.icon,s),a>=0&&this.addIndicesForPlacedSymbol(this.icon,a)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Jf,Kf,Qf;so(Yf,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),Yf.addDynamicAttributes=Hf;class em{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:kt,this.defaultValue=e}evaluate(e){if(e.formattedSection){const t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}so(em,"FormatSectionOverride",{omit:["defaultValue"]});const tm=()=>Qf||(Qf={layout:Jf||(Jf=new qo({"symbol-placement":new Uo(Ho.layout_symbol["symbol-placement"]),"symbol-spacing":new Uo(Ho.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Uo(Ho.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new $o(Ho.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Uo(Ho.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new Uo(Ho.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new Uo(Ho.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new Uo(Ho.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Uo(Ho.layout_symbol["icon-ignore-placement"]),"icon-optional":new Uo(Ho.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Uo(Ho.layout_symbol["icon-rotation-alignment"]),"icon-size":new $o(Ho.layout_symbol["icon-size"]),"icon-size-scale-range":new Uo(Ho.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new $o(Ho.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new $o(Ho.layout_symbol["icon-text-fit-padding"]),"icon-image":new $o(Ho.layout_symbol["icon-image"]),"icon-rotate":new $o(Ho.layout_symbol["icon-rotate"]),"icon-padding":new Uo(Ho.layout_symbol["icon-padding"]),"icon-keep-upright":new Uo(Ho.layout_symbol["icon-keep-upright"]),"icon-offset":new $o(Ho.layout_symbol["icon-offset"]),"icon-anchor":new $o(Ho.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Uo(Ho.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Uo(Ho.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Uo(Ho.layout_symbol["text-rotation-alignment"]),"text-field":new $o(Ho.layout_symbol["text-field"]),"text-font":new $o(Ho.layout_symbol["text-font"]),"text-size":new $o(Ho.layout_symbol["text-size"]),"text-size-scale-range":new Uo(Ho.layout_symbol["text-size-scale-range"]),"text-max-width":new $o(Ho.layout_symbol["text-max-width"]),"text-line-height":new $o(Ho.layout_symbol["text-line-height"]),"text-letter-spacing":new $o(Ho.layout_symbol["text-letter-spacing"]),"text-justify":new $o(Ho.layout_symbol["text-justify"]),"text-radial-offset":new $o(Ho.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Uo(Ho.layout_symbol["text-variable-anchor"]),"text-anchor":new $o(Ho.layout_symbol["text-anchor"]),"text-max-angle":new Uo(Ho.layout_symbol["text-max-angle"]),"text-writing-mode":new Uo(Ho.layout_symbol["text-writing-mode"]),"text-rotate":new $o(Ho.layout_symbol["text-rotate"]),"text-padding":new Uo(Ho.layout_symbol["text-padding"]),"text-keep-upright":new Uo(Ho.layout_symbol["text-keep-upright"]),"text-transform":new $o(Ho.layout_symbol["text-transform"]),"text-offset":new $o(Ho.layout_symbol["text-offset"]),"text-allow-overlap":new Uo(Ho.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Uo(Ho.layout_symbol["text-ignore-placement"]),"text-optional":new Uo(Ho.layout_symbol["text-optional"]),visibility:new Uo(Ho.layout_symbol.visibility)})),paint:Kf||(Kf=new qo({"icon-opacity":new $o(Ho.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new $o(Ho.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new $o(Ho.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new $o(Ho.paint_symbol["text-emissive-strength"]),"icon-color":new $o(Ho.paint_symbol["icon-color"]),"icon-halo-color":new $o(Ho.paint_symbol["icon-halo-color"]),"icon-halo-width":new $o(Ho.paint_symbol["icon-halo-width"]),"icon-halo-blur":new $o(Ho.paint_symbol["icon-halo-blur"]),"icon-translate":new Uo(Ho.paint_symbol["icon-translate"]),"icon-translate-anchor":new Uo(Ho.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new $o(Ho.paint_symbol["icon-image-cross-fade"]),"text-opacity":new $o(Ho.paint_symbol["text-opacity"]),"text-occlusion-opacity":new $o(Ho.paint_symbol["text-occlusion-opacity"]),"text-color":new $o(Ho.paint_symbol["text-color"],{runtimeType:Ft,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new $o(Ho.paint_symbol["text-halo-color"]),"text-halo-width":new $o(Ho.paint_symbol["text-halo-width"]),"text-halo-blur":new $o(Ho.paint_symbol["text-halo-blur"]),"text-translate":new Uo(Ho.paint_symbol["text-translate"]),"text-translate-anchor":new Uo(Ho.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new Uo(Ho.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new Uo(Ho.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new Uo(Ho.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new Uo(Ho.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new $o(Ho.paint_symbol["symbol-z-offset"])}))},Qf);class rm extends ds{constructor(e,t,r,i){super(e,tm(),t,r,i),this._colorAdjustmentMatrix=N.mat4.identity([]),this.hasInitialOcclusionOpacityProperties=void 0!==e.paint&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}recalculate(e,t){super.recalculate(e,t),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const r=this.layout.get("text-writing-mode");if(r){const e=[];for(const t of r)e.indexOf(t)<0&&e.push(t);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,t,r,i){return this._saturation===e&&this._contrast===t&&this._brightnessMin===r&&this._brightnessMax===i||(this._colorAdjustmentMatrix=function(e,t,r,i){e=Se(e),t=Te(t);const n=N.mat4.create(),o=e/3,s=1-2*o,a=[s,o,o,0,o,s,o,0,o,o,s,0,0,0,0,1],l=.5-.5*t,c=i-r;return N.mat4.multiply(n,[c,0,0,0,0,c,0,0,0,0,c,0,r,r,r,1],[t,0,0,0,0,t,0,0,0,0,t,0,l,l,l,1]),N.mat4.multiply(n,n,a),n}(e,t,r,i),this._saturation=e,this._contrast=t,this._brightnessMin=r,this._brightnessMax=i),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,t,r,i){const n=this.layout.get(e).evaluate(t,{},r,i),o=this._unevaluatedLayout._values[e];return o.isDataDriven()||Zn(o.value)||!n?n:function(e,t){return t.replace(/{([^{}]+)}/g,((t,r)=>r in e?String(e[r]):""))}(t.properties,n)}createBucket(e){return new Yf(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of tm().paint.overridableProperties){if(!rm.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),r=new em(t),i=new Wn(r,t.property.specification,this.scope,this.options);let n=null;n="constant"===t.value.kind||"source"===t.value.kind?new Yn("source",i):new Jn("composite",i,t.value.zoomStops,t.value._interpolationType),this.paint._values[e]=new Vo(t.property,n,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,r){return!(!this.layout||t.isDataDriven()||r.isDataDriven())&&rm.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const r=e.get("text-field"),i=tm().paint.properties[t];let n=!1;const o=e=>{for(const t of e)if(i.overrides&&i.overrides.hasOverride(t))return void(n=!0)};if("constant"===r.value.kind&&r.value.value instanceof Kt)o(r.value.value.sections);else if("source"===r.value.kind){const e=t=>{n||(t instanceof nr&&rr(t.value)===Ut?o(t.value.sections):t instanceof lr?o(t.sections):t.eachChild(e))},t=r.value;t._styleExpression&&e(t._styleExpression.expression)}return n}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,t,r){return{config:new Fa(this,{zoom:t,lut:r}),overrideFog:!1}}}let im,nm,om,sm;var am=_s([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function lm(e){switch(e){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function cm(e){switch(e){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class um{constructor(e,t,r,i){this.context=e,this.format=r,this.useMipmap=i&&i.useMipmap,this.texture=e.gl.createTexture(),this.update(t,{premultiply:i&&i.premultiply})}update(e,t){const r=e&&e instanceof HTMLVideoElement&&0===e.width?e.videoWidth:e.width,i=e&&e instanceof HTMLVideoElement&&0===e.height?e.videoHeight:e.height,{context:n}=this,{gl:o}=n,{x:s,y:a}=t&&t.position?t.position:{x:0,y:0},l=Math.max(s+r,this.size?this.size[0]:0),c=Math.max(a+i,this.size?this.size[1]:0);!this.size||this.size[0]===l&&this.size[1]===c||(o.bindTexture(o.TEXTURE_2D,null),o.deleteTexture(this.texture),this.texture=o.createTexture(),this.size=null),o.bindTexture(o.TEXTURE_2D,this.texture),n.pixelStoreUnpackFlipY.set(!1),n.pixelStoreUnpack.set(1),n.pixelStoreUnpackPremultiplyAlpha.set(this.format===o.RGBA8&&(!t||!1!==t.premultiply));const u=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&l>0&&c>0){const e=this.useMipmap?Math.floor(Math.log2(Math.max(l,c)))+1:1;o.texStorage2D(o.TEXTURE_2D,e,this.format,l,c),this.size=[l,c]}if(this.size)if(u)o.texSubImage2D(o.TEXTURE_2D,0,s,a,lm(this.format),cm(this.format),e);else{const t=e.data;t&&o.texSubImage2D(o.TEXTURE_2D,0,s,a,r,i,lm(this.format),cm(this.format),t)}this.useMipmap&&o.generateMipmap(o.TEXTURE_2D)}bind(e,t,r=!1){const{context:i}=this,{gl:n}=i;n.bindTexture(n.TEXTURE_2D,this.texture),e!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,this.useMipmap&&!r?e===n.NEAREST?n.NEAREST_MIPMAP_NEAREST:n.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),t!==this.wrapS&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,t),this.wrapS=t)}bindExtraParam(e,t,r,i){const{context:n}=this,{gl:o}=n;o.bindTexture(o.TEXTURE_2D,this.texture),t!==this.magFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,t),this.magFilter=t),e!==this.minFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,this.useMipmap?e===o.NEAREST?o.NEAREST_MIPMAP_NEAREST:o.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),r!==this.wrapS&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,r),this.wrapS=r),i!==this.wrapT&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,i),this.wrapT=i)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class hm{constructor(e,t){this.context=e,this.texture=t}bind(e,t){const{context:r}=this,{gl:i}=r;i.bindTexture(i.TEXTURE_2D,this.texture),e!==this.minFilter&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,e),this.minFilter=e),t!==this.wrapS&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,t),this.wrapS=t)}}function dm(e,t,r,i,n,o,s,a){const l=[e,t,1,r,i,1,n,o,1],c=[s,a,1],u=N.mat3.adjoint([],l),[h,d,p]=N.vec3.transformMat3(c,c,u);return N.mat3.multiply(l,l,[h,0,0,0,d,0,0,0,p])}function pm(e,t,r,i,n,o,s,a){const l=function(e,t,r,i,n,o,s,a){const l=dm(0,0,1,0,1,1,0,1),c=dm(e,t,r,i,n,o,s,a),u=N.mat3.adjoint([],l);return N.mat3.multiply(c,c,u)}(e,t,r,i,n,o,s,a);return[l[2]/l[8]/Xr,l[5]/l[8]/Xr]}function fm(e){return[e[0],Math.min(Math.max(e[1],-fl),fl)]}class mm extends wt{constructor(e,t,r,i){super(),this.id=e,this.dispatcher=r,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(i),this.options=t,this._dirty=!1}load(e,t){if(this._loaded=t||!1,this.fire(new yt("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=ct(this.map._requestManager.transformRequest(this.url,et.Image),((t,r)=>{this._imageRequest=null,this._loaded=!0,t?this.fire(new xt(t)):r&&(this.image=r instanceof HTMLImageElement?Oe.getImageData(r):r,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())}))}loaded(){return this._loaded}updateImage(e){return e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new hm(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new yt("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(e){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof hm||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let t=e[0][1],r=e[0][1];for(const i of e)i[1]>r&&(r=i[1]),i[1]<t&&(t=i[1]);const i=(r+t)/2;if(i>fl?this.onNorthPole=!0:i<-fl&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const t=e.map(xl.fromLngLat);this.tileID=function(e){let t=1/0,r=1/0,i=-1/0,n=-1/0;for(const o of e)t=Math.min(t,o.x),r=Math.min(r,o.y),i=Math.max(i,o.x),n=Math.max(n,o.y);const o=Math.max(i-t,n-r),s=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),a=Math.pow(2,s);let l=Math.floor((t+i)/2*a);return l>1&&(l-=1),new tc(s,l,Math.floor((r+n)/2*a))}(t),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new yt("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const t=yf(new tc(0,0,0),this.map.transform.projection),r=[t.projection.project(this.coordinates[0][0],this.coordinates[0][1]),t.projection.project(this.coordinates[1][0],this.coordinates[1][1]),t.projection.project(this.coordinates[2][0],this.coordinates[2][1]),t.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(e){const t=e[1].x-e[0].x,r=e[1].y-e[0].y,i=e[2].x-e[1].x,n=e[2].y-e[1].y,o=e[3].x-e[2].x,s=e[3].y-e[2].y,a=e[0].x-e[3].x,l=e[0].y-e[3].y,c=t*n-i*r,u=i*s-o*n,h=o*l-a*s,d=a*r-t*l;return c>0&&u>0&&h>0&&d>0||c<0&&u<0&&h<0&&d<0}(r))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const i=yf(this.tileID,this.map.transform.projection),[n,o,s,a]=this.coordinates.map((e=>{const t=i.projection.project(e[0],e[1]);return xf(i,t)._round()}));this.perspectiveTransform=pm(n.x,n.y,o.x,o.y,s.x,s.y,a.x,a.y);const l=this._boundsArray=new vs;l.emplaceBack(n.x,n.y,0,0),l.emplaceBack(o.x,o.y,Xr,0),l.emplaceBack(a.x,a.y,0,Xr),l.emplaceBack(s.x,s.y,Xr,Xr),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(l,am.members),this.boundsSegments=da.simpleSegment(0,0,4,2);const c=[],u=[fm((h=this.coordinates)[0]),fm(h[1]),fm(h[2]),fm(h[3])];var h;const[d,p,f,m]=function(e){let t=e[0][0],r=t,i=e[0][1],n=i;for(let o=1;o<e.length;o++)e[o][0]<t?t=e[o][0]:e[o][0]>r&&(r=e[o][0]),e[o][1]<i?i=e[o][1]:e[o][1]>n&&(n=e[o][1]);return[t,i,r-t,n-i]}(u);{const i=new vs,[n,o,s,a]=function(e){let t=e[0].x,r=t,i=e[0].y,n=i;for(let o=1;o<e.length;o++)e[o].x<t?t=e[o].x:e[o].x>r&&(r=e[o].x),e[o].y<i?i=e[o].y:e[o].y>n&&(n=e[o].y);return[t,i,r-t,n-i]}(r),l=e=>[(e.x-n)/s,(e.y-o)/a],[u,h,_,g]=r.map(l),y=function(e,t,r,i,n,o,s,a){const l=dm(0,0,1,0,1,1,0,1),c=dm(e,t,r,i,n,o,s,a),u=N.mat3.adjoint([],c);return N.mat3.multiply(l,l,u)}(u[0],u[1],h[0],h[1],_[0],_[1],g[0],g[1]);this.elevatedGlobePerspectiveTransform=pm(u[0],u[1],h[0],h[1],_[0],_[1],g[0],g[1]);const x=(e,t)=>{c.push(e.lng);const r=Math.round((e.lng-d)/f*Xr),n=Math.round((e.lat-p)/m*Xr),o=l(t),s=N.vec3.transformMat3([],[o[0],o[1],1],y),a=Math.round(s[0]/s[2]*Xr),u=Math.round(s[1]/s[2]*Xr);i.emplaceBack(r,n,a,u)},v=r[3].x-r[0].x,b=r[3].y-r[0].y,w=r[2].x-r[1].x,T=r[2].y-r[1].y;for(let e=0;e<65;e++){const i=e/64,n=[r[0].x+i*v,r[0].y+i*b],o=[r[1].x+i*w,r[1].y+i*T],s=o[0]-n[0],a=o[1]-n[1];for(let e=0;e<65;e++){const r=e/64,i={x:n[0]+s*r,y:n[1]+a*r,z:0};x(t.projection.unproject(i.x,i.y),i)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(i,am.members)}{this.maxLongitudeTriangleSize=0;let t=[],r=new Ls;const i=(e,i,n)=>{r.emplaceBack(e,i,n);const o=c[e],s=c[i],a=c[n],l=Math.min(Math.min(o,s),a),u=Math.max(Math.max(o,s),a)-l;u>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=u),t.push(l+u/2)};for(let e=0;e<64;e++)for(let t=0;t<64;t++){const r=65*e+t,n=r+1,o=r+65,s=o+1;i(r,o,n),i(n,o,s)}[t,r]=function(e,t){const r=Array.from({length:e.length},((e,t)=>t));r.sort(((t,r)=>e[t]-e[r]));const i=[],n=new Ls;for(let o=0;o<r.length;o++){const s=r[o];i.push(e[s]);const a=3*s,l=a+1;n.emplaceBack(t.uint16[a],t.uint16[l],t.uint16[l+1])}return[i,n]}(t,r),this.elevatedGlobeTrianglesCenterLongitudes=t,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(r)}this.elevatedGlobeSegments=da.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,f/Xr,0,m/Xr,0,0,p,d,0])}prepare(){const e=0!==Object.keys(this.tiles).length;if(this.tileID&&!e)return;const t=this.map.painter.context,r=t.gl;!this._dirty||this.texture instanceof hm||(this.texture?this.texture.update(this.image):(this.texture=new um(t,this.image,r.RGBA8),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this._dirty=!1),e&&this._prepareData(t)}loadTile(e,t){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},t(null)):(e.state="errored",t(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){const t=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!t)return null;const r=this.elevatedGlobeTrianglesCenterLongitudes;let i=(n=e+180)+360*Math.round((r[0]-n)/360);var n;const o=new da,s=(e,r)=>{o.segments.push({vertexOffset:0,primitiveOffset:e,vertexLength:t.segments[0].vertexLength,primitiveLength:r,sortKey:void 0,vaos:{}})},a=.51*this.maxLongitudeTriangleSize;if(Math.abs(r[0]-i)<=a){const e=we(r,0,r.length,i+a);return e===r.length||s(e,be(r,e+1,r.length,i+360-a)-e),o}i<r[0]&&(i+=360);const l=be(r,0,r.length,i-a);if(l===r.length)return s(0,r.length),o;s(0,l-0);const c=we(r,l+1,r.length,i+a);return c!==r.length&&s(c,r.length-c),o}}const _m=(Math.pow(256,2)-1)/16907520;class gm extends ds{constructor(e,t,r,i){super(e,{layout:om||(om=new qo({visibility:new Uo(Ho.layout_raster.visibility)})),paint:sm||(sm=new qo({"raster-opacity":new Uo(Ho.paint_raster["raster-opacity"]),"raster-color":new Go(Ho.paint_raster["raster-color"]),"raster-color-mix":new Uo(Ho.paint_raster["raster-color-mix"]),"raster-color-range":new Uo(Ho.paint_raster["raster-color-range"]),"raster-hue-rotate":new Uo(Ho.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Uo(Ho.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Uo(Ho.paint_raster["raster-brightness-max"]),"raster-saturation":new Uo(Ho.paint_raster["raster-saturation"]),"raster-contrast":new Uo(Ho.paint_raster["raster-contrast"]),"raster-resampling":new Uo(Ho.paint_raster["raster-resampling"]),"raster-fade-duration":new Uo(Ho.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new Uo(Ho.paint_raster["raster-emissive-strength"]),"raster-array-band":new Uo(Ho.paint_raster["raster-array-band"]),"raster-elevation":new Uo(Ho.paint_raster["raster-elevation"])}))},t,r,i),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(e){return!(e&&e._source instanceof mm&&(e._source.onNorthPole||e._source.onSouthPole))&&0===this.paint.get("raster-elevation")}_handleSpecialPaintPropertyUpdate(e){"raster-color"!==e&&"raster-color-range"!==e||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}updateColorRamp(e){if(!this.hasColorMap())return;if(!this._curRampRange)return;const t=this._transitionablePaint._values["raster-color"].value.expression,[r,i]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(r)&&isNaN(i)||r===this._curRampRange[0]&&i===this._curRampRange[1]||(this.colorRamp=au({expression:t,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:r,end:i}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[r,i])}}let ym,xm,vm,bm,wm;class Tm extends ds{constructor(e,t,r,i){super(e,{layout:ym||(ym=new qo({visibility:new Uo(Ho["layout_raster-particle"].visibility)})),paint:xm||(xm=new qo({"raster-particle-array-band":new Uo(Ho["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new Uo(Ho["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new Go(Ho["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new Uo(Ho["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new Uo(Ho["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new Uo(Ho["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new Uo(Ho["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new Uo(Ho["paint_raster-particle"]["raster-particle-elevation"])}))},t,r,i),this._updateColorRamp(),this.lastInvalidatedAt=Oe.now()}onRemove(e){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return"none"!==this.visibility}isDraped(e){return!1}_handleSpecialPaintPropertyUpdate(e){"raster-particle-color"!==e&&"raster-particle-max-speed"!==e||(this._updateColorRamp(),this._invalidateAnimationState()),"raster-particle-count"===e&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const e=this._transitionablePaint._values["raster-particle-color"].value.expression,t=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=au({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:t}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=Oe.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class Sm extends ds{constructor(e,t){super(e,{},t,null),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}isDraped(e){return void 0!==this.implementation.renderToTile}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}function Em(e,t,r){const i=[0,0,1],n=N.quat.identity([]);return N.quat.rotateY(n,n,r?-W(e)+Math.PI:W(e)),N.quat.rotateX(n,n,-W(t)),N.vec3.transformQuat(i,i,n),N.vec3.normalize(i,i)}function Mm(e,t){const r=Cm(e.projection,e.zoom,e.width,e.height),i=function(e,t,r,i,n){const o=new il(r.lng-180*Im,r.lat),s=new il(r.lng+180*Im,r.lat),a=e.project(o.lng,o.lat),l=e.project(s.lng,s.lat),c=-Math.atan2(l.y-a.y,l.x-a.x),u=xl.fromLngLat(r);u.y=Q(u.y,-1+Im,1-Im);const h=u.toLngLat(),d=e.project(h.lng,h.lat),p=xl.fromLngLat(h);p.x+=Im;const f=p.toLngLat(),m=e.project(f.lng,f.lat),_=Rm(m.x-d.x,m.y-d.y,c),g=xl.fromLngLat(h);g.y+=Im;const y=g.toLngLat(),x=e.project(y.lng,y.lat),v=Rm(x.x-d.x,x.y-d.y,c),b=Math.abs(_.x)/Math.abs(v.y),w=N.mat4.identity([]);N.mat4.rotateZ(w,w,-c*(1-(n?0:i)));const T=N.mat4.identity([]);return N.mat4.scale(T,T,[1,1-(1-b)*i,1]),T[4]=-v.x/v.y*i,N.mat4.rotateZ(T,T,c),N.mat4.multiply(T,w,T),T}(e.projection,0,e.center,r,t),n=Am(e);return N.mat4.scale(i,i,[n,n,1]),i}function Am(e){const t=e.projection,r=Cm(e.projection,e.zoom,e.width,e.height),i=Pm(t,e.center),n=Pm(t,il.convert(t.center));return Math.pow(2,i*r+(1-r)*n)}function Cm(e,t,r,i,n=1/0){const o=e.range;if(!o)return 0;const s=Math.min(n,Math.max(r,i)),a=Math.log(s/1024)/Math.LN2;return ee(o[0]+a,o[1]+a,t)}const Im=1/4e4;function Pm(e,t){const r=Q(t.lat,-fl,fl),i=new il(t.lng-180*Im,r),n=new il(t.lng+180*Im,r),o=e.project(i.lng,r),s=e.project(n.lng,r),a=xl.fromLngLat(i),l=xl.fromLngLat(n),c=s.x-o.x,u=s.y-o.y,h=l.x-a.x,d=l.y-a.y,p=Math.sqrt((h*h+d*d)/(c*c+u*u));return Math.log(p)/Math.LN2}function Rm(e,t,r){const i=Math.cos(r),n=Math.sin(r);return{x:e*i-t*n,y:e*n+t*i}}function zm(e,t,r){N.mat4.identity(e),N.mat4.rotateZ(e,e,W(t[2])),N.mat4.rotateX(e,e,W(t[0])),N.mat4.rotateY(e,e,W(t[1])),N.mat4.scale(e,e,r),N.mat4.multiply(e,e,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function Dm(e,t,r,i,n,o,s,a){const l=[r[0]-t[0],r[1]-t[1],0],c=[i[0]-t[0],i[1]-t[1],0];if(N.vec3.length(l)<1e-12||N.vec3.length(c)<1e-12)return N.quat.identity(e);const u=N.vec3.cross([],l,c);N.vec3.normalize(u,u),N.vec3.subtract(c,i,t),l[2]=(o-n)*a,c[2]=(s-n)*a;const h=l;return N.vec3.cross(h,l,c),N.vec3.normalize(h,h),N.quat.rotationTo(e,u,h)}function km(e,t,r=!1){const i=Bc(t.zoom),n=function(e,t,r){const i=t.worldSize,n=[e[12],e[13],e[14]],o=dl(n[1]/i),s=hl(n[0]/i),a=N.mat4.identity([]),l=ul(1,o)*i,c=ul(1,0)*i*_l(o,t.zoom),u=1/kc(i);let h=c*u;if(r){const e=Cm(t.projection,t.zoom,t.width,t.height,1024);h=u*t.projection.pixelSpaceConversion(t.center.lat,i,e)}const d=el(o,s);N.vec3.add(d,d,N.vec3.scale([],N.vec3.normalize([],d),l*h*n[2]));const p=function(e){const t=[e[0],e[1],e[2]];let r=[0,1,0];const i=N.vec3.cross([],r,t);return N.vec3.cross(r,t,i),0===N.vec3.squaredLength(r)&&(r=[0,1,0],N.vec3.cross(i,t,r)),N.vec3.normalize(i,i),N.vec3.normalize(r,r),N.vec3.normalize(t,t),[i[0],i[1],i[2],0,r[0],r[1],r[2],0,t[0],t[1],t[2],0,e[0],e[1],e[2],1]}(d);N.mat4.scale(a,a,[h,h,h*l]),N.mat4.translate(a,a,[-n[0],-n[1],-n[2]]);const f=N.mat4.multiply([],t.globeMatrix,p);return N.mat4.multiply(f,f,a),N.mat4.multiply(f,f,e),f}(e,t,r);if(i>0){const r=function(e,t){const r=t.worldSize,i=ul(1,0)*r*_l(t.center.lat,t.zoom)/kc(r),n=ul(1,t.center.lat)*r,o=N.mat4.identity([]);return N.mat4.rotateY(o,o,W(t.center.lng)),N.mat4.rotateX(o,o,W(t.center.lat)),N.mat4.translate(o,o,[0,0,qa]),N.mat4.scale(o,o,[i,i,i*n]),N.mat4.translate(o,o,[t.point.x-.5*r,t.point.y-.5*r,0]),N.mat4.multiply(o,o,e),N.mat4.multiply(o,t.globeMatrix,o)}(e,t);return function(e,t,r){const i=(e,t,r)=>{const i=N.vec3.length(e),n=N.vec3.length(t),o=Sc(e,t,r);return N.vec3.scale(o,o,1/N.vec3.length(o)*Ct(i,n,r))},n=i([e[0],e[1],e[2]],[t[0],t[1],t[2]],r),o=i([e[4],e[5],e[6]],[t[4],t[5],t[6]],r),s=i([e[8],e[9],e[10]],[t[8],t[9],t[10]],r),a=Sc([e[12],e[13],e[14]],[t[12],t[13],t[14]],r);return[n[0],n[1],n[2],0,o[0],o[1],o[2],0,s[0],s[1],s[2],0,a[0],a[1],a[2],1]}(n,r,i)}return n}function Om(e,t,r,i){const n=gc.projectAabbCorners(i,r);let o=Number.MAX_VALUE,s=-1;for(let e=0;e<n.length;++e){const r=n[e];r[0]=(.5*r[0]+.5)*t.width,r[1]=(.5-.5*r[1])*t.height,r[2]<o&&(s=e,o=r[2])}const a=e=>new $(n[e][0],n[e][1]);let l;switch(s){case 0:case 6:l=[a(1),a(5),a(4),a(7),a(3),a(2),a(1)];break;case 1:case 7:l=[a(0),a(4),a(5),a(6),a(2),a(3),a(0)];break;case 3:case 5:l=[a(1),a(0),a(4),a(7),a(6),a(2),a(1)];break;default:l=[a(1),a(5),a(6),a(7),a(3),a(0),a(1)]}if(zl(e,l))return o}const Lm=_s([{name:"a_pos_3f",components:3,type:"Float32"}]),Bm=_s([{name:"a_color_3f",components:3,type:"Float32"}]),Fm=_s([{name:"a_color_4f",components:4,type:"Float32"}]),Nm=_s([{name:"a_uv_2f",components:2,type:"Float32"}]),Vm=_s([{name:"a_normal_3f",components:3,type:"Float32"}]),jm=_s([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),Um=_s([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]),$m={None:0,Model:1,Symbol:2,FillExtrusion:4,All:7};class Gm{constructor(e,t,r,i){this.message=(e?`${e}: `:"")+r,i&&(this.identifier=i),null!=t&&t.__line__&&(this.line=t.__line__)}}function qm(e,t){const r=-1===e.indexOf("://");try{return new URL(e,r&&t?"http://example.com":void 0),!0}catch(e){return!1}}class Hm{constructor(e,t){this.feature=e,this.instancedDataOffset=t,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class Wm{constructor(){this.instancedDataArray=new Ws,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class Zm{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.fqid)),this.projection=e.projection,this.index=e.index,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0}updateFootprints(e,t){}populate(e,t,r,i){this.tileToMeter=yl(r);const n=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:o,id:s,index:a,sourceLayerIndex:l}of e){const e=null!=s?s:o.properties&&o.properties.hasOwnProperty("id")?o.properties.id:void 0,c=Cl(o,n);if(!this.layers[0]._featureFilter.filter(new Do(this.zoom),c,r))continue;const u={id:e,sourceLayerIndex:l,index:a,geometry:n?c.geometry:Al(o,r,i),properties:o.properties,type:o.type,patterns:{}},h=this.addFeature(u,u.geometry,c);h&&t.featureIndex.insert(o,u.geometry,a,l,this.index,this.instancesPerModel[h].instancedDataArray.length,Xr/32)}this.lookup=null}update(e,t,r,i){for(const t in this.instancesPerModel){const r=this.instancesPerModel[t];for(const t in e)r.idToFeaturesIndex.hasOwnProperty(t)&&(this.evaluate(r.features[r.idToFeaturesIndex[t]],e[t],r,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const t in this.instancesPerModel){const r=this.instancesPerModel[t];for(const t of r.features){const i=this.layers[0],n=t.feature,o=this.canonical,s=i.paint.get("model-rotation").evaluate(n,{},o),a=i.paint.get("model-scale").evaluate(n,{},o),l=i.paint.get("model-translation").evaluate(n,{},o);N.vec3.exactEquals(t.rotation,s)&&N.vec3.exactEquals(t.scale,a)&&N.vec3.exactEquals(t.translation,l)||(this.evaluate(t,t.featureStates,r,!0),e=!0)}}return e}updateReplacement(e,t,r,i){if(t.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=t.updateTime;const n=t.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(wh(this.activeReplacements,n))return!1;this.activeReplacements=n;let o=!1;for(const t in this.instancesPerModel){const n=this.instancesPerModel[t],s=n.instancedDataArray;for(const t of n.features){const n=t.instancedDataOffset,a=t.instancedDataCount;for(let t=0;t<a;t++){const a=16*(t+n);let l=s.float32[a+0];const c=l>Xr;l=c?l-Xr:l;const u=Math.floor(l),h=s.float32[a+1];let d=!1;for(const t of this.activeReplacements)if(!yh(t,r,$m.Model,i)&&!(t.min.x>u||u>t.max.x||t.min.y>h||h>t.max.y)&&(d=Ch(Ah(u,h,e.canonical,t.footprintTileId.canonical),t.footprint),d))break;s.float32[a]=d?l+Xr:l,o=o||d!==c}}}return o}isEmpty(){for(const e in this.instancesPerModel)if(0!==this.instancesPerModel[e].instancedDataArray.length)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const t in this.instancesPerModel){const r=this.instancesPerModel[t];r.instancedDataArray.length<0||0===r.instancedDataArray.length||(r.instancedDataBuffer?r.instancedDataBuffer.updateData(r.instancedDataArray):r.instancedDataBuffer=e.createVertexBuffer(r.instancedDataArray,jm.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(const e in this.instancesPerModel){const t=this.instancesPerModel[e];0!==t.instancedDataArray.length&&t.instancedDataBuffer&&t.instancedDataBuffer.destroy()}const e=this.layers[0].modelManager;if(e&&this.modelUris)for(const t of this.modelUris)e.removeModel(t,"")}addFeature(e,t,r){const i=this.layers[0],n=i.layout.get("model-id").evaluate(r,{},this.canonical);if(!n)return pe(`modelId is not evaluated for layer ${i.id} and it is not going to get rendered.`),n;qm(n,!1)&&(this.modelUris.includes(n)||this.modelUris.push(n)),this.instancesPerModel[n]||(this.instancesPerModel[n]=new Wm);const o=this.instancesPerModel[n],s=o.instancedDataArray,a=new Hm(r,s.length);for(const e of t)for(const t of e){if(t.x<0||t.x>=Xr||t.y<0||t.y>=Xr)continue;const e=(this.lookupDim-1)/Xr,r=this.lookupDim*(t.y*e|0)+t.x*e|0;if(this.lookup){if(0!==this.lookup[r])continue;this.lookup[r]=1}this.instanceCount++;const i=s.length;s.resize(i+1),o.instancesEvaluatedElevation.push(0),s.float32[16*i]=t.x,s.float32[16*i+1]=t.y}return a.instancedDataCount=o.instancedDataArray.length-a.instancedDataOffset,a.instancedDataCount>0&&(e.id&&(o.idToFeaturesIndex[e.id]=o.features.length),o.features.push(a),this.evaluate(a,{},o,!1)),n}getModelUris(){return this.modelUris}evaluate(e,t,r,i){const n=this.layers[0],o=e.feature,s=this.canonical,a=e.rotation=n.paint.get("model-rotation").evaluate(o,t,s),l=e.scale=n.paint.get("model-scale").evaluate(o,t,s),c=e.translation=n.paint.get("model-translation").evaluate(o,t,s),u=n.paint.get("model-color").evaluate(o,t,s);u.a=n.paint.get("model-color-mix-intensity").evaluate(o,t,s);const h=[];this.maxVerticalOffset<c[2]&&(this.maxVerticalOffset=c[2]),this.maxScale=Math.max(Math.max(this.maxScale,l[0]),Math.max(l[1],l[2])),zm(h,a,l);const d=Math.round(100*u.a)+u.b/1.05;for(let t=0;t<e.instancedDataCount;++t){const n=e.instancedDataOffset+t,o=16*n,a=r.instancedDataArray.float32;let l=0;i&&(l=a[o+6]-r.instancesEvaluatedElevation[n]);const p=0|a[o+1];a[o]=(0|a[o])+u.r/1.05,a[o+1]=p+u.g/1.05,a[o+2]=d,a[o+3]=1/(s.z>10?this.tileToMeter:yl(s,p)),a[o+4]=c[0],a[o+5]=c[1],a[o+6]=c[2]+l,a[o+7]=h[0],a[o+8]=h[1],a[o+9]=h[2],a[o+10]=h[4],a[o+11]=h[5],a[o+12]=h[6],a[o+13]=h[8],a[o+14]=h[9],a[o+15]=h[10],r.instancesEvaluatedElevation[n]=c[2]}}}let Xm,Ym;so(Zm,"ModelBucket",{omit:["layers"]}),so(Wm,"PerModelAttributes"),so(Hm,"ModelFeature");const Jm=64,Km={CoordinateSpaceTile:1,CoordinateSpaceYUp:2,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function Qm(e,t,r,i,n,o,s,a,l,c=!1){const u=r.zoom,h=r.project(i),d=_l(i.lat,u),p=1/d;N.mat4.identity(e),N.mat4.translate(e,e,[h.x+s[0]*p,h.y+s[1]*p,s[2]]);let f=1,m=1;const _=r.worldSize;if(c){if("mercator"===r.projection.name){let e=0;r.elevation&&(e=r.elevation.getAtPointOrZero(new xl(h.x/_,h.y/_),0));const t=N.vec4.transformMat4([],[h.x,h.y,e,1],r.projMatrix)[3]/r.cameraToCenterDistance;f=t,m=t*_l(r.center.lat,u)}else if("globe"===r.projection.name){const t=km(e,r),n=N.mat4.multiply([],r.projMatrix,t),o=[0,0,0,1];N.vec4.transformMat4(o,o,n);const s=o[3]/r.cameraToCenterDistance,a=Bc(u),l=r.projection.pixelsPerMeter(i.lat,_)*_l(i.lat,u),c=r.projection.pixelsPerMeter(r.center.lat,_)*_l(r.center.lat,u);f=s/Ct(l,ml(r.center.lat),a),m=s*d/l,f*=c,m*=c}}else f=p;N.mat4.scale(e,e,[f,f,m]);const g=[...e],y=t.orientation,x=[];if(zm(x,[y[0]+n[0],y[1]+n[1],y[2]+n[2]],o),N.mat4.multiply(e,g,x),a&&r.elevation){let n=0;const o=[];if(l&&r.elevation){n=function(e,t,r,i,n){const o=t.elevation;if(!o)return 0;const s=gc.projectAabbCorners(r,i),a=ul(1,n.lat)*t.worldSize,l=function(e,t){const r=[0,0,1],i=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const n of i){const i=e[n.corners[0]],o=e[n.corners[1]],s=e[n.corners[2]],a=[o[0]-i[0],o[1]-i[1],t*(o[2]-i[2])],l=N.vec3.cross(a,a,[s[0]-i[0],s[1]-i[1],t*(s[2]-i[2])]);N.vec3.normalize(l,l),n.dotProductWithUp=N.vec3.dot(l,r)}return i.sort(((e,t)=>e.dotProductWithUp-t.dotProductWithUp)),i[0].corners}(s,a),c=s[l[0]],u=s[l[1]],h=s[l[2]],d=s[l[3]],p=o.getAtPointOrZero(new xl(c[0]/t.worldSize,c[1]/t.worldSize),0),f=o.getAtPointOrZero(new xl(u[0]/t.worldSize,u[1]/t.worldSize),0),m=o.getAtPointOrZero(new xl(h[0]/t.worldSize,h[1]/t.worldSize),0),_=o.getAtPointOrZero(new xl(d[0]/t.worldSize,d[1]/t.worldSize),0),g=(p+_)/2,y=(f+m)/2;return g>y?f<m?Dm(e,u,d,c,f,_,p,a):Dm(e,h,c,d,m,p,_,a):p<_?Dm(e,c,u,h,p,f,m,a):Dm(e,d,h,u,_,m,f,a),Math.max(g,y)}(o,r,t.aabb,e,i);const s=N.mat4.fromQuat([],o),a=N.mat4.multiply([],s,x);N.mat4.multiply(e,g,a)}else n=r.elevation.getAtPointOrZero(new xl(h.x/_,h.y/_),0);0!==n&&(e[14]+=n)}}function e_(e,t,r=!1){e.uploaded||(e.gfxTexture=new um(t,e.image,r?t.gl.R8:t.gl.RGBA8,{useMipmap:e.sampler.minFilter>=t.gl.NEAREST_MIPMAP_NEAREST}),e.uploaded=!0,e.image=null)}function t_(e,t,r){e.indexBuffer=t.createIndexBuffer(e.indexArray,!1,!0),e.vertexBuffer=t.createVertexBuffer(e.vertexArray,Lm.members,!1,!0),e.normalArray&&(e.normalBuffer=t.createVertexBuffer(e.normalArray,Vm.members,!1,!0)),e.texcoordArray&&(e.texcoordBuffer=t.createVertexBuffer(e.texcoordArray,Nm.members,!1,!0)),e.colorArray&&(e.colorBuffer=t.createVertexBuffer(e.colorArray,(12===e.colorArray.bytesPerElement?Bm:Fm).members,!1,!0)),e.featureArray&&(e.pbrBuffer=t.createVertexBuffer(e.featureArray,Um.members,!0)),e.segments=da.simpleSegment(0,0,e.vertexArray.length,e.indexArray.length);const i=e.material;i.pbrMetallicRoughness.baseColorTexture&&e_(i.pbrMetallicRoughness.baseColorTexture,t),i.pbrMetallicRoughness.metallicRoughnessTexture&&e_(i.pbrMetallicRoughness.metallicRoughnessTexture,t),i.normalTexture&&e_(i.normalTexture,t),i.occlusionTexture&&e_(i.occlusionTexture,t,r),i.emissionTexture&&e_(i.emissionTexture,t)}function r_(e,t,r){if(e.meshes)for(const i of e.meshes)t_(i,t,r);if(e.children)for(const i of e.children)r_(i,t,r)}function i_(e){if(e.meshes)for(const t of e.meshes)t.indexArray.destroy(),t.vertexArray.destroy(),t.colorArray&&t.colorArray.destroy(),t.normalArray&&t.normalArray.destroy(),t.texcoordArray&&t.texcoordArray.destroy(),t.featureArray&&t.featureArray.destroy();if(e.children)for(const t of e.children)i_(t)}function n_(e){if(e.meshes)for(const r of e.meshes)r.vertexBuffer&&(r.vertexBuffer.destroy(),r.indexBuffer.destroy(),r.normalBuffer&&r.normalBuffer.destroy(),r.texcoordBuffer&&r.texcoordBuffer.destroy(),r.colorBuffer&&r.colorBuffer.destroy(),r.pbrBuffer&&r.pbrBuffer.destroy(),r.segments.destroy(),r.material&&((t=r.material).pbrMetallicRoughness.baseColorTexture&&t.pbrMetallicRoughness.baseColorTexture.gfxTexture&&t.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),t.pbrMetallicRoughness.metallicRoughnessTexture&&t.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&t.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),t.normalTexture&&t.normalTexture.gfxTexture&&t.normalTexture.gfxTexture.destroy(),t.emissionTexture&&t.emissionTexture.gfxTexture&&t.emissionTexture.gfxTexture.destroy(),t.occlusionTexture&&t.occlusionTexture.gfxTexture&&t.occlusionTexture.gfxTexture.destroy()));var t;if(e.children)for(const t of e.children)n_(t)}class o_{constructor(e,t,r){this._demTile=e,this._dem=this._demTile.dem,this._scale=t,this._offset=r}static create(e,t,r){const i=r||e.findDEMTileFor(t);if(!i||!i.dem)return;const n=i.dem,o=i.tileID,s=1<<t.canonical.z-o.canonical.z;return new o_(i,n.dim/Xr/s,[(t.canonical.x/s-o.canonical.x)*n.dim,(t.canonical.y/s-o.canonical.y)*n.dim])}tileCoordToPixel(e,t){const r=t*this._scale+this._offset[1],i=Math.floor(e*this._scale+this._offset[0]),n=Math.floor(r);return new $(i,n)}getElevationAt(e,t,r,i){const n=e*this._scale+this._offset[0],o=t*this._scale+this._offset[1],s=Math.floor(n),a=Math.floor(o),l=this._dem;return i=!!i,r?Ct(Ct(l.get(s,a,i),l.get(s,a+1,i),o-a),Ct(l.get(s+1,a,i),l.get(s+1,a+1,i),o-a),n-s):l.get(s,a,i)}getElevationAtPixel(e,t,r){return this._dem.get(e,t,!!r)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*ul(1,e)*this._dem.stride}}const s_=new Float32Array(262144),a_=new Uint8Array(262144);function l_(e){let t=0;if(e.meshes)for(const r of e.meshes)t=Math.max(t,r.aabb.max[2]);if(e.children)for(const r of e.children)t=Math.max(t,l_(r));return t}function c_(e,t,r){if(e.meshes)for(const i of e.meshes){if(i.aabb.min[0]===1/0)continue;const n=gc.applyTransform(i.aabb,e.matrix);r.insert(t,n.min[0],n.min[1],n.max[0],n.max[1])}if(e.children)for(const i of e.children)c_(i,t,r)}const u_=["","wall","door","roof","window","lamp","logo"];class h_{constructor(e){this.node=e,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.cameraCollisionOpacity=1,this.feature={type:"Point",id:e.id,geometry:[],properties:{height:l_(e)}},this.aabb=this._getLocalBounds()}_getLocalBounds(){if(!this.node.meshes)return new gc([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const t=new gc([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const r of this.node.meshes)this.node.lightMeshIndex!==e&&(r.transformedAabb=gc.applyTransformFast(r.aabb,this.node.matrix),t.encapsulate(r.transformedAabb)),e++;this.aabb=t}return this.aabb}}class d_{constructor(e,t,r,i,n,o,s){this.id=r,this.layers=e,this.layerIds=this.layers.map((e=>e.fqid)),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.modelTraits|=Km.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,i&&(this.modelTraits|=Km.HasMapboxMeshFeatures),n&&(this.modelTraits|=Km.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=o,this.dirty=!0,this.needsUpload=!1,this.nodesInfo=[];for(const e of t)this.nodesInfo.push(new h_(e)),c_(e,s.featureIndexArray.length,s.grid),s.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,s.bucketLayerIDs.length-1,0)}updateFootprints(e,t){for(const r of this.getNodesInfo()){const i=r.node;i.footprint&&t.push({footprint:i.footprint,id:e})}}update(e){const t=0!==Object.keys(e).length;if(t&&!this.stateDependentLayers.length)return;const r=t?this.stateDependentLayers:this.layers;for(const t of r)this.evaluate(t,e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const t=this.getNodesInfo();for(const r of t){const t=r.node;this.uploaded?this.updatePbrBuffer(t):r_(t,e,!0)}for(const e of t)i_(e.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let t=!1;if(!e.meshes)return t;for(const r of e.meshes)r.pbrBuffer&&(r.pbrBuffer.updateData(r.featureArray),t=!0);return t}needsReEvaluation(e,t,r){const i=e.transform.projectionOptions,n=e.style.getBrightness(),o=this.brightness!==n;return!!(!this.uploaded||this.dirty||i.name!==this.projection.name||p_(r.paint.get("model-color").value,o)||p_(r.paint.get("model-color-mix-intensity").value,o)||p_(r.paint.get("model-roughness").value,o)||p_(r.paint.get("model-emissive-strength").value,o)||p_(r.paint.get("model-height-based-emissive-strength-multiplier").value,o))&&(this.projection=i,this.brightness=n,!0)}evaluateScale(e,t){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const r=this.getNodesInfo(),i=this.id.canonical;for(const e of r){const r=e.feature;e.evaluatedScale=t.paint.get("model-scale").evaluate(r,{},i)}}evaluate(e,t){const r=this.getNodesInfo();for(const i of r){if(!i.node.meshes)continue;const r=i.feature,n=t&&t[r.id],o=i.node.meshes&&i.node.meshes[0].featureData,s=i.evaluatedColor[2],a=i.evaluatedRMEA[2],l=this.id.canonical;if(i.hasTranslucentParts=!1,o){for(let t=0;t<u_.length;t++){const o=u_[t];o.length&&(r.properties.part=o);const s=e.paint.get("model-color").evaluate(r,n,l).toRenderColor(null),a=e.paint.get("model-color-mix-intensity").evaluate(r,n,l);i.evaluatedColor[t]=[s.r,s.g,s.b,a],i.evaluatedRMEA[t][0]=e.paint.get("model-roughness").evaluate(r,n,l),i.evaluatedRMEA[t][2]=e.paint.get("model-emissive-strength").evaluate(r,n,l),i.evaluatedRMEA[t][3]=s.a,i.emissionHeightBasedParams[t]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(r,n,l),!i.hasTranslucentParts&&s.a<1&&(i.hasTranslucentParts=!0)}delete r.properties.part,m_(i,s!==i.evaluatedColor[2]||a!==i.evaluatedRMEA[2],this.modelTraits)}else i.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(r,n,l);i.evaluatedScale=e.paint.get("model-scale").evaluate(r,n,l),this.updatePbrBuffer(i.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,t,r,i){const n=e.findDEMTileFor(r);if(n&&(n.tileID.canonical!==this.terrainTile||t!==this.terrainExaggeration)){if(n.dem&&n.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=n.tileID.overscaledZ;const t=o_.create(e,r,n);if(!t)return;this.modelTraits&Km.HasMapboxMeshFeatures&&this.updateDEM(e,t,r,i);for(const e of this.getNodesInfo()){const r=e.node;if(!r.footprint||!r.footprint.vertices||!r.footprint.vertices.length)continue;const i=r.footprint.vertices;let n=t.getElevationAt(i[0].x,i[0].y,!0,!0);for(let e=1;e<i.length;e++)n=Math.min(n,t.getElevationAt(i[e].x,i[e].y,!0,!0));r.elevation=n}}this.terrainTile=n.tileID.canonical,this.terrainExaggeration=t}}updateDEM(e,t,r,i){let n=t._dem._modifiedForSources[i];if(void 0===n&&(t._dem._modifiedForSources[i]=[],n=t._dem._modifiedForSources[i]),n.includes(r.canonical))return;const o=t._dem.dim;n.push(r.canonical);let s=!1;for(const e of this.getNodesInfo()){const r=e.node;if(!r.footprint||!r.footprint.grid)continue;const i=r.footprint.grid,n=t.tileCoordToPixel(i.min.x,i.min.y),a=t.tileCoordToPixel(i.max.x,i.max.y),l=Math.min(Math.min(o-a.y,n.x),Math.min(n.y,o-a.x));if(l<0)continue;const c=Q(l,2,5);let u=Math.max(0,n.x-c),h=Math.max(0,n.y-c),d=Math.min(a.x+c,o-1),p=Math.min(a.y+c,o-1);for(let e=h;e<=p;++e)for(let t=u;t<=d;++t)a_[e*o+t]=255;let f=0,m=0;for(let e=0;e<i.cellsY;++e)for(let r=0;r<i.cellsX;++r){if(!i.cells[e*i.cellsX+r])continue;const n=t.tileCoordToPixel(i.min.x+r/i.xScale,i.min.y+e/i.yScale),s=t.tileCoordToPixel(i.min.x+(r+1)/i.xScale,i.min.y+(e+1)/i.yScale);for(let e=n.y;e<=Math.min(s.y+1,o-1);++e)for(let r=n.x;r<=Math.min(s.x+1,o-1);++r)255===a_[e*o+r]&&(a_[e*o+r]=0,f+=t.getElevationAtPixel(r,e),m++)}const _=f/m;u=Math.max(1,n.x-c),h=Math.max(1,n.y-c),d=Math.min(a.x+c,o-2),p=Math.min(a.y+c,o-2),s=!0;for(let e=h;e<=p;++e)for(let r=u;r<=d;++r)0===a_[e*o+r]&&(s_[e*o+r]=t._dem.set(r,e,_));for(let e=1;e<c;++e){u=Math.max(1,n.x-e),h=Math.max(1,n.y-e),d=Math.min(a.x+e,o-2),p=Math.min(a.y+e,o-2);for(let r=h;r<=p;++r)for(let i=u;i<=d;++i){const n=r*o+i;if(255===a_[n]){let s=0,a=0,l=-1,u=-1;for(let t=-1;t<=1;++t)for(let n=-1;n<=1;++n){const c=(r+t)*o+i+n;if(a_[c]>=e)continue;const h=s_[c],d=Math.abs(h);d>a&&(s=h,a=d,l=n,u=t)}if(a>.1){const o=1-(e+.5*Math.abs(l*u))/c;let a=t._dem.get(i,r)+s*o;const h=t._dem.get(i+l,r+u),d=t._dem.get(i-l,r-u,!0);(a-h)*(a-d)>0&&(a=(h+d)/2),s_[n]=t._dem.set(i,r,a),a_[n]=e}}}}}s&&(t._demTile.needsDEMTextureUpload=!0,t._dem._timestamp=Oe.now())}getNodesInfo(){return this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const t of e)i_(t.node),n_(t.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,t){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const r=t.getReplacementRegionsForTile(e.toUnwrapped()),i=this.getNodesInfo();for(let e=0;e<this.nodesInfo.length;e++){const t=i[e].node;i[e].hiddenByReplacement=!!t.footprint&&!r.find((e=>e.footprint===t.footprint))}}getHeightAtTileCoord(e,t){const r=this.getNodesInfo(),i=[],n=[0,0,0],o=N.mat4.identity([]);for(let s=0;s<this.nodesInfo.length;s++){const a=r[s],l=a.node.meshes[0],c=l.transformedAabb;if(e<c.min[0]||t<c.min[1]||e>c.max[0]||t>c.max[1])continue;if(!0===a.node.hidden)return{height:1/0,maxHeight:a.feature.properties.height,hidden:!1,verticalScale:a.evaluatedScale[2]};N.mat4.invert(o,a.node.matrix),n[0]=e,n[1]=t,N.vec3.transformMat4(n,n,o);const u=(n[0]-l.aabb.min[0])/(l.aabb.max[0]-l.aabb.min[0])*Jm|0,h=Math.min(63,(n[1]-l.aabb.min[1])/(l.aabb.max[1]-l.aabb.min[1])*Jm|0)*Jm+Math.min(63,u),d=l.heightmap[h];if(!(d<0&&a.node.footprint)){if(a.hiddenByReplacement)return;return{height:d,maxHeight:a.feature.properties.height,hidden:!1,verticalScale:a.evaluatedScale[2]}}if(a.node.footprint.grid.query(new $(e,t),new $(e,t),i),i.length>0)return{height:void 0,maxHeight:a.feature.properties.height,hidden:a.hiddenByReplacement,verticalScale:a.evaluatedScale[2]}}}}function p_(e,t){return!e.isLightConstant&&t}function f_(e,t,r,i,n,o,s,a){let l=(61440&t|(61440&t)>>4)>>8,c=(3840&t|(3840&t)>>4)>>4,u=240&t|(240&t)>>4;r[3]>0&&(l=Ct(l,255*r[0],r[3]),c=Ct(c,255*r[1],r[3]),u=Ct(u,255*r[2],r[3]));const h=l<<8|c,d=u<<8|Math.floor(255*i[3]),p=function(e){const t=Q(e,0,2);return Math.min(Math.round(.5*t*255),255)}(i[2])<<8|15*i[0]<<4|15*i[1],f=Q(n[0],0,1),m=Q(n[1],0,1),_=Q(n[2],0,1),g=Q(n[3],0,1);let y,x,v,b;if(f!==m&&s!==o&&m!==f){const e=s-o;x=1/(e*(m-f)),v=-(o+e*f)/(e*(m-f));const t=Q(n[4],-1,1);b=Math.pow(10,t),y=255*_<<8|255*g}else y=65535,x=0,v=1,b=1;if(e.emplaceBack(h,d,p,y,x,v,b),a){const e=a.length;a.clear();for(let t=0;t<e;t++)a.emplaceBack(h,d,p,y,x,v,b)}}function m_(e,t,r){const i=e.node;let n=0;const o=r&Km.HasMeshoptCompression;for(const r of i.meshes){if(i.lights&&i.lightMeshIndex===n)continue;if(!r.featureData)continue;r.featureArray=new Zs,r.featureArray.reserve(r.featureData.length);let s=t;for(const t of r.featureData){const n=o?65535&t:t>>16&65535,a=o?t>>16&65535:65535&t,l=(15&a)<8?15&a:0,c=e.evaluatedRMEA[l],u=e.evaluatedColor[l],h=e.emissionHeightBasedParams[l];let d;if(s&&2===l&&i.lights&&(d=new Zs,d.resize(10*i.lights.length)),f_(r.featureArray,n,u,c,h,r.aabb.min[2],r.aabb.max[2],d),d&&s){s=!1;const e=i.meshes[i.lightMeshIndex];e.featureArray=d,e.featureArray._trim()}}r.featureArray._trim(),n++}}so(d_,"Tiled3dModelBucket",{omit:["layers"]}),so(h_,"Tiled3dModelFeature");const __=["id","tile","layer","source","sourceLayer","state"];class g_{constructor(e,t,r,i,n){this.type="Feature",this._vectorTileFeature=e,this._z=t,this._x=r,this._y=i,this.properties=e.properties,this.id=n}clone(){const e=new g_(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(e.state={...this.state}),this.layer&&(e.layer={...this.layer}),this.namespace&&(e.namespace=this.namespace),e}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const t of __)void 0!==this[t]&&(e[t]=this[t]);return e}}function y_(e,t,r,i){const n=1<<e.z;t.lat=dl((i/Xr+e.y)/n),t.lng=hl((r/Xr+e.x)/n)}const x_={circle:class extends ds{constructor(e,t,r,i){super(e,{layout:Yl||(Yl=new qo({"circle-sort-key":new $o(Ho.layout_circle["circle-sort-key"]),visibility:new Uo(Ho.layout_circle.visibility)})),paint:Jl||(Jl=new qo({"circle-radius":new $o(Ho.paint_circle["circle-radius"]),"circle-color":new $o(Ho.paint_circle["circle-color"]),"circle-blur":new $o(Ho.paint_circle["circle-blur"]),"circle-opacity":new $o(Ho.paint_circle["circle-opacity"]),"circle-translate":new Uo(Ho.paint_circle["circle-translate"]),"circle-translate-anchor":new Uo(Ho.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Uo(Ho.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Uo(Ho.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new $o(Ho.paint_circle["circle-stroke-width"]),"circle-stroke-color":new $o(Ho.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new $o(Ho.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new Uo(Ho.paint_circle["circle-emissive-strength"])}))},t,r,i)}createBucket(e){return new Rl(e)}queryRadius(e){const t=e;return Hl("circle-radius",this,t)+Hl("circle-stroke-width",this,t)+Wl(this.paint.get("circle-translate"))}queryIntersectsFeature(e,t,r,i,n,o,s,a){const l=Xl(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),c=this.paint.get("circle-radius").evaluate(t,r)+this.paint.get("circle-stroke-width").evaluate(t,r);return qc(e,i,o,s,a,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),l,c)}getProgramIds(){return["circle"]}getDefaultProgramParams(e,t,r){const i=Gc(this);return{config:new Fa(this,{zoom:t,lut:r}),defines:i,overrideFog:!1}}},heatmap:class extends ds{createBucket(e){return new Yc(e)}constructor(e,t,r,i){super(e,{layout:Jc||(Jc=new qo({visibility:new Uo(Ho.layout_heatmap.visibility)})),paint:Kc||(Kc=new qo({"heatmap-radius":new $o(Ho.paint_heatmap["heatmap-radius"]),"heatmap-weight":new $o(Ho.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Uo(Ho.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Go(Ho.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Uo(Ho.paint_heatmap["heatmap-opacity"])}))},t,r,i),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=au({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(e){return Hl("heatmap-radius",this,e)}queryIntersectsFeature(e,t,r,i,n,o,s,a){const l=this.paint.get("heatmap-radius").evaluate(t,r);return qc(e,i,o,s,a,!0,!0,new $(0,0),l)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(e,t,r){return"heatmap"===e?{config:new Fa(this,{zoom:t,lut:r}),overrideFog:!1}:{}}},hillshade:class extends ds{constructor(e,t,r,i){super(e,{layout:Qc||(Qc=new qo({visibility:new Uo(Ho.layout_hillshade.visibility)})),paint:eu||(eu=new qo({"hillshade-illumination-direction":new Uo(Ho.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Uo(Ho.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Uo(Ho.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Uo(Ho.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Uo(Ho.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Uo(Ho.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new Uo(Ho.paint_hillshade["hillshade-emissive-strength"])}))},t,r,i)}shouldRedrape(){return this.hasOffscreenPass()&&"viewport"===this.paint.get("hillshade-illumination-anchor")}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(e,t,r){return{overrideFog:!1}}},fill:class extends ds{constructor(e,t,r,i){super(e,{layout:Vu||(Vu=new qo({"fill-sort-key":new $o(Ho.layout_fill["fill-sort-key"]),visibility:new Uo(Ho.layout_fill.visibility),"fill-elevation-reference":new Uo(Ho.layout_fill["fill-elevation-reference"])})),paint:ju||(ju=new qo({"fill-antialias":new Uo(Ho.paint_fill["fill-antialias"]),"fill-opacity":new $o(Ho.paint_fill["fill-opacity"]),"fill-color":new $o(Ho.paint_fill["fill-color"]),"fill-outline-color":new $o(Ho.paint_fill["fill-outline-color"]),"fill-translate":new Uo(Ho.paint_fill["fill-translate"]),"fill-translate-anchor":new Uo(Ho.paint_fill["fill-translate-anchor"]),"fill-pattern":new $o(Ho.paint_fill["fill-pattern"]),"fill-emissive-strength":new Uo(Ho.paint_fill["fill-emissive-strength"]),"fill-z-offset":new $o(Ho.paint_fill["fill-z-offset"])}))},t,r,i)}getProgramIds(){const e=this.paint.get("fill-pattern"),t=e&&e.constantOr(1),r=[t?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&r.push(t&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),r}getDefaultProgramParams(e,t,r){return{config:new Fa(this,{zoom:t,lut:r}),overrideFog:!1}}recalculate(e,t){super.recalculate(e,t);const r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Nu(e)}queryRadius(){return Wl(this.paint.get("fill-translate"))}queryIntersectsFeature(e,t,r,i,n,o){return!e.queryGeometry.isAboveHorizon&&kl(Zl(e.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),i)}isTileClipped(){return!0}is3D(){return 0!==this.paint.get("fill-z-offset").constantOr(1)}},"fill-extrusion":class extends ds{constructor(e,t,r,i){super(e,{layout:sd||(sd=new qo({visibility:new Uo(Ho["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new Uo(Ho["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:ad||(ad=new qo({"fill-extrusion-opacity":new Uo(Ho["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new $o(Ho["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Uo(Ho["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Uo(Ho["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new $o(Ho["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new $o(Ho["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new $o(Ho["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new Uo(Ho["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new Uo(Ho["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new Uo(Ho["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new Uo(Ho["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new Uo(Ho["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new Uo(Ho["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new Uo(Ho["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new Uo(Ho["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new Uo(Ho["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new Uo(Ho["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new $o(Ho["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new $o(Ho["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new Uo(Ho["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new Uo(Ho["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new Uo(Ho["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new Uo(Ho["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new $o(Ho["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new $o(Ho["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new Uo(Ho["paint_fill-extrusion"]["fill-extrusion-cast-shadows"])}))},t,r,i),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new Xh(e)}queryRadius(){return Wl(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}hasShadowPass(){return this.paint.get("fill-extrusion-cast-shadows")}cutoffRange(){return this.paint.get("fill-extrusion-cutoff-fade-range")}canCastShadows(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}queryIntersectsFeature(e,t,r,i,n,o,s,a,l){const c=Xl(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),u=this.paint.get("fill-extrusion-height").evaluate(t,r),h=this.paint.get("fill-extrusion-base").evaluate(t,r),d=[0,0],p=a&&o.elevation,f=o.elevation?o.elevation.exaggeration():1,m=e.tile.getBucket(this);if(p&&m instanceof Xh){const e=m.centroidVertexArray,t=l+1;t<e.length&&(d[0]=e.geta_centroid_pos0(t),d[1]=e.geta_centroid_pos1(t))}if(0===d[0]&&1===d[1])return!1;"globe"===o.projection.name&&(i=nd([i],[new $(0,0),new $(Xr,Xr)],e.tileID.canonical).map((e=>e.polygon)).flat());const _=p?a:null,[g,y]=function(e,t,r,i,n,o,s,a,l,c,u){return"globe"===e.projection.name?function(e,t,r,i,n,o,s,a,l,c,u){const h=[],d=[],p=e.projection.upVectorScale(u,e.center.lat,e.worldSize).metersToTile,f=[0,0,0,1],m=[0,0,0,1],_=(e,t,r,i)=>{e[0]=t,e[1]=r,e[2]=i,e[3]=1},g=id();r>0&&(r+=g),i+=g;for(const g of t){const t=[],y=[];for(const h of g){const d=h.x+n.x,g=h.y+n.y,x=e.projection.projectTilePoint(d,g,u),v=e.projection.upVector(u,h.x,h.y);let b=r,w=i;if(s){const e=ud(d,g,r,i,s,a,l,c);b+=e.base,w+=e.top}0!==r?_(f,x.x+v[0]*p*b,x.y+v[1]*p*b,x.z+v[2]*p*b):_(f,x.x,x.y,x.z),_(m,x.x+v[0]*p*w,x.y+v[1]*p*w,x.z+v[2]*p*w),N.vec3.transformMat4(f,f,o),N.vec3.transformMat4(m,m,o),t.push(new dh(f[0],f[1],f[2])),y.push(new dh(m[0],m[1],m[2]))}h.push(t),d.push(y)}return[h,d]}(e,t,r,i,n,o,s,a,l,c,u):s?function(e,t,r,i,n,o,s,a,l){const c=[],u=[],h=[0,0,0,1];for(const d of e){const e=[],p=[];for(const c of d){const u=c.x+i.x,d=c.y+i.y,f=ud(u,d,t,r,o,s,a,l);h[0]=u,h[1]=d,h[2]=f.base,h[3]=1,N.vec4.transformMat4(h,h,n),h[3]=Math.max(h[3],1e-5);const m=new dh(h[0]/h[3],h[1]/h[3],h[2]/h[3]);h[0]=u,h[1]=d,h[2]=f.top,h[3]=1,N.vec4.transformMat4(h,h,n),h[3]=Math.max(h[3],1e-5);const _=new dh(h[0]/h[3],h[1]/h[3],h[2]/h[3]);e.push(m),p.push(_)}c.push(e),u.push(p)}return[c,u]}(t,r,i,n,o,s,a,l,c):function(e,t,r,i,n){const o=[],s=[],a=n[8]*t,l=n[9]*t,c=n[10]*t,u=n[11]*t,h=n[8]*r,d=n[9]*r,p=n[10]*r,f=n[11]*r;for(const t of e){const e=[],r=[];for(const o of t){const t=o.x+i.x,s=o.y+i.y,m=n[0]*t+n[4]*s+n[12],_=n[1]*t+n[5]*s+n[13],g=n[2]*t+n[6]*s+n[14],y=n[3]*t+n[7]*s+n[15],x=m+a,v=_+l,b=g+c,w=Math.max(y+u,1e-5),T=m+h,S=_+d,E=g+p,M=Math.max(y+f,1e-5);e.push(new dh(x/w,v/w,b/w)),r.push(new dh(T/M,S/M,E/M))}o.push(e),s.push(r)}return[o,s]}(t,r,i,n,o)}(o,i,h,u,c,s,_,d,f,o.center.lat,e.tileID.canonical),x=e.queryGeometry;return function(e,t,r){let i=1/0;kl(r,t)&&(i=cd(r,t[0]));for(let n=0;n<t.length;n++){const o=t[n],s=e[n];for(let e=0;e<o.length-1;e++){const t=o[e],n=[t,o[e+1],s[e+1],s[e],t];zl(r,n)&&(i=Math.min(i,cd(r,n)))}}return i!==1/0&&i}(g,y,x.isPointQuery()?x.screenBounds:x.screenGeometry)}},line:class extends ds{constructor(e,t,r,i){const n=Dd();super(e,n,t,r,i),n.layout&&(this.layout=new jo(n.layout)),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){const e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof Fi,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=(()=>{if(Od)return Od;const e=Dd();return Od=new kd(e.paint.properties["line-width"].specification),Od.useIntegerZoom=!0,Od})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new wd(e)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(e,t,r){const i=Pd(this);return{config:new Fa(this,{zoom:t,lut:r}),defines:i,overrideFog:!1}}queryRadius(e){const t=e,r=Ld(Hl("line-width",this,t),Hl("line-gap-width",this,t)),i=Hl("line-offset",this,t);return r/2+Math.abs(i)+Wl(this.paint.get("line-translate"))}queryIntersectsFeature(e,t,r,i,n,o){if(e.queryGeometry.isAboveHorizon)return!1;const s=Zl(e.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),a=e.pixelToTileUnitsFactor/2*Ld(this.paint.get("line-width").evaluate(t,r),this.paint.get("line-gap-width").evaluate(t,r)),l=this.paint.get("line-offset").evaluate(t,r);return l&&(i=function(e,t){const r=[],i=new $(0,0);for(let n=0;n<e.length;n++){const o=e[n],s=[];for(let e=0;e<o.length;e++){const r=o[e],n=o[e+1],a=0===e?i:r.sub(o[e-1])._unit()._perp(),l=e===o.length-1?i:n.sub(r)._unit()._perp(),c=a._add(l)._unit();c._mult(1/(c.x*l.x+c.y*l.y)),s.push(c._mult(t)._add(r))}r.push(s)}return r}(i,l*e.pixelToTileUnitsFactor)),function(e,t,r){for(let i=0;i<t.length;i++){const n=t[i];if(e.length>=3)for(let t=0;t<n.length;t++)if(jl(e,n[t]))return!0;if(Ol(e,n,r))return!0}return!1}(s,i,a)}isTileClipped(){return!0}isDraped(e){const t=this.layout.get("line-z-offset"),r=t.isConstant()&&!t.constantOr(0),i=this.layout.get("line-elevation-reference");return!("sea"===i||"ground"===i)&&(r||"none"!==i)}},symbol:rm,background:class extends ds{constructor(e,t,r,i){super(e,{layout:im||(im=new qo({visibility:new Uo(Ho.layout_background.visibility)})),paint:nm||(nm=new qo({"background-pitch-alignment":new Uo(Ho.paint_background["background-pitch-alignment"]),"background-color":new Uo(Ho.paint_background["background-color"]),"background-pattern":new Uo(Ho.paint_background["background-pattern"]),"background-opacity":new Uo(Ho.paint_background["background-opacity"]),"background-emissive-strength":new Uo(Ho.paint_background["background-emissive-strength"])}))},t,r,i)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(e,t,r){return{overrideFog:!1}}is3D(){return"viewport"===this.paint.get("background-pitch-alignment")}},raster:gm,"raster-particle":Tm,sky:class extends ds{constructor(e,t,r,i){super(e,{layout:vm||(vm=new qo({visibility:new Uo(Ho.layout_sky.visibility)})),paint:bm||(bm=new qo({"sky-type":new Uo(Ho.paint_sky["sky-type"]),"sky-atmosphere-sun":new Uo(Ho.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Uo(Ho.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Uo(Ho.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Uo(Ho.paint_sky["sky-gradient-radius"]),"sky-gradient":new Go(Ho.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Uo(Ho.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Uo(Ho.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Uo(Ho.paint_sky["sky-opacity"])}))},t,r,i),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"sky-gradient"===e?this._updateColorRamp():"sky-atmosphere-sun"!==e&&"sky-atmosphere-halo-color"!==e&&"sky-atmosphere-color"!==e&&"sky-atmosphere-sun-intensity"!==e||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=au({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(e){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const t=e.style.light.properties.get("position");return this._lightPosition.azimuthal!==t.azimuthal||this._lightPosition.polar!==t.polar}return!1}getCenter(e,t){if("atmosphere"===this.paint.get("sky-type")){const r=this.paint.get("sky-atmosphere-sun"),i=!r,n=e.style.light,o=n.properties.get("position");return i&&"viewport"===n.properties.get("anchor")&&pe("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),i?Em(o.azimuthal,90-o.polar,t):Em(r[0],90-r[1],t)}const r=this.paint.get("sky-gradient-center");return Em(r[0],90-r[1],t)}isSky(){return!0}markSkyboxValid(e){this._skyboxInvalidated=!1,this._lightPosition=e.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const e=this.paint.get("sky-type");return"atmosphere"===e?["skyboxCapture","skybox"]:"gradient"===e?["skyboxGradient"]:null}},slot:class extends ds{constructor(e,t,r,i){super(e,{paint:wm||(wm=new qo({}))},t,null)}},model:class extends ds{constructor(e,t,r,i){super(e,{layout:Xm||(Xm=new qo({visibility:new Uo(Ho.layout_model.visibility),"model-id":new $o(Ho.layout_model["model-id"])})),paint:Ym||(Ym=new qo({"model-opacity":new Uo(Ho.paint_model["model-opacity"]),"model-rotation":new $o(Ho.paint_model["model-rotation"]),"model-scale":new $o(Ho.paint_model["model-scale"]),"model-translation":new $o(Ho.paint_model["model-translation"]),"model-color":new $o(Ho.paint_model["model-color"]),"model-color-mix-intensity":new $o(Ho.paint_model["model-color-mix-intensity"]),"model-type":new Uo(Ho.paint_model["model-type"]),"model-cast-shadows":new Uo(Ho.paint_model["model-cast-shadows"]),"model-receive-shadows":new Uo(Ho.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new Uo(Ho.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new $o(Ho.paint_model["model-emissive-strength"]),"model-roughness":new $o(Ho.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new $o(Ho.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new Uo(Ho.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new Uo(Ho.paint_model["model-front-cutoff"])}))},t,r,i),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new Zm(e)}getProgramIds(){return["model"]}is3D(){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(e){return e instanceof d_?Xr-1:0}queryIntersectsFeature(e,t,r,i,n,o){if(!this.modelManager)return!1;const s=this.modelManager,a=e.tile.getBucket(this);if(!(a&&a instanceof Zm))return!1;const l=a;for(const r in l.instancesPerModel){const i=l.instancesPerModel[r],n=void 0!==t.id?t.id:t.properties&&t.properties.hasOwnProperty("id")?t.properties.id:void 0;if(i.idToFeaturesIndex.hasOwnProperty(n)){const t=i.features[i.idToFeaturesIndex[n]],a=s.getModel(r,this.scope);if(!a)return!1;let c=N.mat4.create();const u=new il(0,0),h=l.canonical;let d=Number.MAX_VALUE;for(let r=0;r<t.instancedDataCount;++r){const n=16*(t.instancedDataOffset+r),s=i.instancedDataArray.float32,l=[s[n+4],s[n+5],s[n+6]];y_(h,u,s[n],0|s[n+1]),Qm(c,a,o,u,t.rotation,t.scale,l,!1,!1,!1),"globe"===o.projection.name&&(c=km(c,o));const p=N.mat4.multiply([],o.projMatrix,c),f=e.queryGeometry,m=Om(f.isPointQuery()?f.screenBounds:f.screenGeometry,o,p,a.aabb);null!=m&&(d=Math.min(m,d))}return d!==Number.MAX_VALUE&&d}}return!1}_handleOverridablePaintPropertyUpdate(e,t,r){return!(!this.layout||t.isDataDriven()||r.isDataDriven()||"model-color"!==e&&"model-color-mix-intensity"!==e&&"model-rotation"!==e&&"model-scale"!==e&&"model-translation"!==e&&"model-emissive-strength"!==e)}_isPropertyZoomDependent(e){const t=this._transitionablePaint._values[e];return null!=t&&null!=t.value&&null!=t.value.expression&&t.value.expression instanceof Jn}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}queryIntersectsMatchingFeature(e,t,r,i){const n=e.tile,o=n.getBucket(this);let s=null,a=Number.MAX_VALUE;if(!(o&&o instanceof d_))return{queryFeature:s,intersectionZ:a};const l=o.getNodesInfo()[t];if(l.hiddenByReplacement||!l.node.meshes||!r.filter(new Do(n.tileID.overscaledZ),l.feature,n.tileID.canonical))return{queryFeature:s,intersectionZ:a};const c=l.node,u=i.calculatePosMatrix(n.tileID.toUnwrapped(),i.worldSize),h=l.evaluatedScale;let d=0;i.elevation&&c.elevation&&(d=c.elevation*i.elevation.exaggeration()),N.mat4.translate(u,u,[(c.anchor?c.anchor[0]:0)*(h[0]-1),(c.anchor?c.anchor[1]:0)*(h[1]-1),d]),N.mat4.scale(u,u,h);const p=e.queryGeometry,f=p.isPointQuery()?p.screenBounds:p.screenGeometry,m=function(e){const t=N.mat4.multiply([],u,e.matrix);N.mat4.multiply(t,i.expandedFarZProjMatrix,t);for(let r=0;r<e.meshes.length;++r){const n=e.meshes[r];if(r===e.lightMeshIndex)continue;const o=Om(f,i,t,n.aabb);null!=o&&(a=Math.min(o,a))}if(e.children)for(const t of e.children)m(t)};if(m(c),a===Number.MAX_VALUE)return{queryFeature:s,intersectionZ:a};const _=new il(0,0);y_(n.tileID.canonical,_,l.node.anchor[0],l.node.anchor[1]);const{z:g,x:y,y:x}=n.tileID.canonical;return s=new g_({},g,y,x,l.feature.id),s.properties=l.feature.properties,s.geometry={type:"Point",coordinates:[_.lng,_.lat]},s.layer={...this.serialize(),id:this.fqid},s.state={},s.tile=n.tileID.canonical,{queryFeature:s,intersectionZ:a}}},clip:class extends ds{constructor(e,t,r,i){super(e,{layout:Uu||(Uu=new qo({"clip-layer-types":new Uo(Ho.layout_clip["clip-layer-types"]),"clip-layer-scope":new Uo(Ho.layout_clip["clip-layer-scope"])})),paint:$u||($u=new qo({}))},t,r,i)}recalculate(e,t){super.recalculate(e,t)}createBucket(e){return new Hu(e)}isTileClipped(){return!0}is3D(){return!0}}};class v_{constructor(e){this._callback=e,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback()}),0))}remove(){this._channel=void 0,this._callback=()=>{}}}class b_{constructor(){this.tasks={},this.taskQueue=[],ae(["process"],this),this.invoker=new v_(this.process),this.nextId=0}add(e,t){const r=this.nextId++,i=function({type:e,isSymbolTile:t,zoom:r}){return r=r||0,"message"===e?0:"maybePrepare"!==e||t?"parseTile"!==e||t?"parseTile"===e&&t?300-r:"maybePrepare"===e&&t?400-r:500:200-r:100-r}(t);if(0===i){try{e()}finally{}return null}return this.tasks[r]={fn:e,metadata:t,priority:i,id:r},this.taskQueue.push(r),this.invoker.trigger(),{cancel:()=>{delete this.tasks[r]}}}process(){try{if(this.taskQueue=this.taskQueue.filter((e=>!!this.tasks[e])),!this.taskQueue.length)return;const e=this.pick();if(null===e)return;const t=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!t)return;t.fn()}finally{}}pick(){let e=null,t=1/0;for(let r=0;r<this.taskQueue.length;r++){const i=this.tasks[this.taskQueue[r]];i.priority<t&&(t=i.priority,e=r)}if(null===e)return null;const r=this.taskQueue[e];return this.taskQueue.splice(e,1),r}remove(){this.invoker.remove()}}class w_{constructor(e,t,r){this.target=e,this.parent=t,this.mapId=r,this.callbacks={},this.cancelCallbacks={},ae(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new b_}send(e,t,r,i,n=!1,o){const s=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(r.metadata=o,this.callbacks[s]=r);const a=new Set;return this.target.postMessage({id:s,type:e,hasCallback:!!r,targetMapId:i,mustQueue:n,sourceMapId:this.mapId,data:co(t,a)},a),{cancel:()=>{r&&delete this.callbacks[s],this.target.postMessage({id:s,type:"<cancel>",targetMapId:i,sourceMapId:this.mapId})}}}receive(e){const t=e.data,r=t.id;if(r&&(!t.targetMapId||this.mapId===t.targetMapId))if("<cancel>"===t.type){const e=this.cancelCallbacks[r];delete this.cancelCallbacks[r],e&&e.cancel()}else if(t.mustQueue||ge()){const e=this.callbacks[r],i=this.scheduler.add((()=>this.processTask(r,t)),e&&e.metadata||{type:"message"});i&&(this.cancelCallbacks[r]=i)}else this.processTask(r,t)}processTask(e,t){if(delete this.cancelCallbacks[e],"<response>"===t.type){const r=this.callbacks[e];delete this.callbacks[e],r&&(t.error?r(uo(t.error)):r(null,uo(t.data)))}else{const r=new Set,i=t.hasCallback?(t,i)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:t?co(t):null,data:co(i,r)},r)}:()=>{},n=uo(t.data);if(this.parent[t.type])this.parent[t.type](t.sourceMapId,n,i);else if(this.parent.getWorkerSource){const e=t.type.split(".");this.parent.getWorkerSource(t.sourceMapId,e[0],n.source,n.scope)[e[1]](n,i)}else i(new Error(`Could not find function ${t.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}class T_{constructor(e,t){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=oe();const r=this.workerPool.acquire(this.id);for(let e=0;e<r.length;e++){const i=new T_.Actor(r[e],t,this.id);i.name=`Worker ${e}`,this.actors.push(i)}this.ready=!1,this.broadcast("checkIfReady",null,(()=>{this.ready=!0}))}broadcast(e,t,r){re(this.actors,((r,i)=>{r.send(e,t,i)}),r=r||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach((e=>{e.remove()})),this.actors=[],this.workerPool.release(this.id)}}T_.Actor=w_;class S_{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,t){const r=this.toIdx(e,t);return{min:this.minimums[r],max:this.maximums[r]}}isLeaf(e,t){return this.leaves[this.toIdx(e,t)]}toIdx(e,t){return t*this.size+e}}function E_(e,t,r,i){let n=0,o=Number.MAX_VALUE;for(let s=0;s<3;s++)if(Math.abs(i[s])<1e-15){if(r[s]<e[s]||r[s]>t[s])return null}else{const a=1/i[s];let l=(e[s]-r[s])*a,c=(t[s]-r[s])*a;if(l>c){const e=l;l=c,c=e}if(l>n&&(n=l),c<o&&(o=c),n>o)return null}return n}function M_(e,t,r,i,n,o,s,a,l,c,u){const h=i-e,d=n-t,p=o-r,f=s-e,m=a-t,_=l-r,g=u[1]*_-u[2]*m,y=u[2]*f-u[0]*_,x=u[0]*m-u[1]*f,v=h*g+d*y+p*x;if(Math.abs(v)<1e-15)return null;const b=1/v,w=c[0]-e,T=c[1]-t,S=c[2]-r,E=(w*g+T*y+S*x)*b;if(E<0||E>1)return null;const M=T*p-S*d,A=S*h-w*p,C=w*d-T*h,I=(u[0]*M+u[1]*A+u[2]*C)*b;return I<0||E+I>1?null:(f*M+m*A+_*C)*b}function A_(e,t,r){return(e-t)/(r-t)}function C_(e,t,r,i,n,o,s,a,l){const c=1<<r,u=o-i,h=s-n,d=(e+1)/c*u+i,p=(t+0)/c*h+n,f=(t+1)/c*h+n;a[0]=(e+0)/c*u+i,a[1]=p,l[0]=d,l[1]=f}class I_{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const t=function(e){const t=Math.ceil(Math.log2(e.dim/8)),r=[];let i=Math.ceil(Math.pow(2,t));const n=1/i,o=(e,t,r,i,n)=>{const o=i?1:0,s=(e+1)*r-o,a=t*r,l=(t+1)*r-o;n[0]=e*r,n[1]=a,n[2]=s,n[3]=l};let s=new S_(i);const a=[];for(let t=0;t<i*i;t++){o(t%i,Math.floor(t/i),n,!1,a);const r=R_(a[0],a[1],e),l=R_(a[2],a[1],e),c=R_(a[2],a[3],e),u=R_(a[0],a[3],e);s.minimums.push(Math.min(r,l,c,u)),s.maximums.push(Math.max(r,l,c,u)),s.leaves.push(1)}for(r.push(s),i/=2;i>=1;i/=2){const e=r[r.length-1];s=new S_(i);for(let t=0;t<i*i;t++){o(t%i,Math.floor(t/i),2,!0,a);const r=e.getElevation(a[0],a[1]),n=e.getElevation(a[2],a[1]),l=e.getElevation(a[2],a[3]),c=e.getElevation(a[0],a[3]),u=e.isLeaf(a[0],a[1]),h=e.isLeaf(a[2],a[1]),d=e.isLeaf(a[2],a[3]),p=e.isLeaf(a[0],a[3]),f=Math.min(r.min,n.min,l.min,c.min),m=Math.max(r.max,n.max,l.max,c.max),_=u&&h&&d&&p;s.maximums.push(m),s.minimums.push(f),s.leaves.push(m-f<=5&&_?1:0)}r.push(s)}return r}(this.dem),r=t.length-1,i=t[r];this._addNode(i.minimums[0],i.maximums[0],i.leaves[0]),this._construct(t,0,0,r,0)}raycastRoot(e,t,r,i,n,o,s=1){return E_([e,t,-100],[r,i,this.maximums[0]*s],n,o)}raycast(e,t,r,i,n,o,s=1){if(!this.nodeCount)return null;const a=this.raycastRoot(e,t,r,i,n,o,s);if(null==a)return null;const l=[],c=[],u=[],h=[],d=[{idx:0,t:a,nodex:0,nodey:0,depth:0}];for(;d.length>0;){const{idx:a,t:p,nodex:f,nodey:m,depth:_}=d.pop();if(this.leaves[a]){C_(f,m,_,e,t,r,i,u,h);const a=1<<_,l=(f+0)/a,c=(f+1)/a,d=(m+0)/a,g=(m+1)/a,y=R_(l,d,this.dem)*s,x=R_(c,d,this.dem)*s,v=R_(c,g,this.dem)*s,b=R_(l,g,this.dem)*s,w=M_(u[0],u[1],y,h[0],u[1],x,h[0],h[1],v,n,o),T=M_(h[0],h[1],v,u[0],h[1],b,u[0],u[1],y,n,o),S=Math.min(null!==w?w:Number.MAX_VALUE,null!==T?T:Number.MAX_VALUE);if(S!==Number.MAX_VALUE)return S;{const e=N.vec3.scaleAndAdd([],n,o,p);if(P_(y,x,b,v,A_(e[0],u[0],h[0]),A_(e[1],u[1],h[1]))>=e[2])return p}continue}let g=0;for(let d=0;d<this._siblingOffset.length;d++){C_((f<<1)+this._siblingOffset[d][0],(m<<1)+this._siblingOffset[d][1],_+1,e,t,r,i,u,h),u[2]=-100,h[2]=this.maximums[this.childOffsets[a]+d]*s;const p=E_(u,h,n,o);if(null!=p){const e=p;l[d]=e;let t=!1;for(let r=0;r<g&&!t;r++)e>=l[c[r]]&&(c.splice(r,0,d),t=!0);t||(c[g]=d),g++}}for(let e=0;e<g;e++){const t=c[e];d.push({idx:this.childOffsets[a]+t,t:l[t],nodex:(f<<1)+this._siblingOffset[t][0],nodey:(m<<1)+this._siblingOffset[t][1],depth:_+1})}}return null}_addNode(e,t,r){return this.minimums.push(e),this.maximums.push(t),this.leaves.push(r),this.childOffsets.push(0),this.nodeCount++}_construct(e,t,r,i,n){if(1===e[i].isLeaf(t,r))return;this.childOffsets[n]||(this.childOffsets[n]=this.nodeCount);const o=i-1,s=e[o];let a=0,l=0;for(let e=0;e<this._siblingOffset.length;e++){const i=2*t+this._siblingOffset[e][0],n=2*r+this._siblingOffset[e][1],o=s.getElevation(i,n),c=s.isLeaf(i,n),u=this._addNode(o.min,o.max,c);c&&(a|=1<<e),l||(l=u)}for(let i=0;i<this._siblingOffset.length;i++)a&1<<i||this._construct(e,2*t+this._siblingOffset[i][0],2*r+this._siblingOffset[i][1],o,l+i)}}function P_(e,t,r,i,n,o){return Ct(Ct(e,r,o),Ct(t,i,o),n)}function R_(e,t,r){const i=r.dim,n=Q(e*i-.5,0,i-1),o=Q(t*i-.5,0,i-1),s=Math.floor(n),a=Math.floor(o),l=Math.min(s+1,i-1),c=Math.min(a+1,i-1);return P_(r.get(s,a),r.get(l,a),r.get(s,c),r.get(l,c),n-s,o-a)}const z_={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function D_(e,t,r){return(256*e*256+256*t+r)/10-1e4}function k_(e,t,r){return 256*e+t+r/256-32768}class O_{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,t,r,i=!1){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(r&&"mapbox"!==r&&"terrarium"!==r)return void pe(`"${r}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=t.height;const n=this.dim=t.height-2,o=new Uint32Array(t.data.buffer);if(this.pixels=new Uint8Array(t.data.buffer),this.floatView=new Float32Array(t.data.buffer),this.borderReady=i,this._modifiedForSources={},!i){for(let e=0;e<n;e++)o[this._idx(-1,e)]=o[this._idx(0,e)],o[this._idx(n,e)]=o[this._idx(n-1,e)],o[this._idx(e,-1)]=o[this._idx(e,0)],o[this._idx(e,n)]=o[this._idx(e,n-1)];o[this._idx(-1,-1)]=o[this._idx(0,0)],o[this._idx(n,-1)]=o[this._idx(n-1,0)],o[this._idx(-1,n)]=o[this._idx(0,n-1)],o[this._idx(n,n)]=o[this._idx(n-1,n-1)]}const s="terrarium"===r?k_:D_;for(let e=0;e<o.length;++e){const t=4*e;this.floatView[e]=s(this.pixels[t],this.pixels[t+1],this.pixels[t+2])}this._timestamp=Oe.now()}_buildQuadTree(){this._tree=new I_(this)}get(e,t,r=!1){r&&(e=Q(e,-1,this.dim),t=Q(t,-1,this.dim));const i=this._idx(e,t);return this.floatView[i]}set(e,t,r){const i=this._idx(e,t),n=this.floatView[i];return this.floatView[i]=r,r-n}static getUnpackVector(e){return z_[e]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}static pack(e,t){const r=[0,0,0,0],i=O_.getUnpackVector(t);let n=Math.floor((e+i[3])/i[2]);return r[2]=n%256,n=Math.floor(n/256),r[1]=n%256,n=Math.floor(n/256),r[0]=n,r}getPixels(){return new su({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,t,r){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let i=t*this.dim,n=t*this.dim+this.dim,o=r*this.dim,s=r*this.dim+this.dim;switch(t){case-1:i=n-1;break;case 1:n=i+1}switch(r){case-1:o=s-1;break;case 1:s=o+1}const a=-t*this.dim,l=-r*this.dim;for(let t=o;t<s;t++)for(let r=i;r<n;r++){const i=4*this._idx(r,t),n=4*this._idx(r+a,t+l);this.pixels[i+0]=e.pixels[n+0],this.pixels[i+1]=e.pixels[n+1],this.pixels[i+2]=e.pixels[n+2],this.pixels[i+3]=e.pixels[n+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function L_(e,t,r){1===e?t.headerLength=r.readFixed32():2===e?t.x=r.readVarint():3===e?t.y=r.readVarint():4===e?t.z=r.readVarint():5===e&&t.layers.push(function(e,t){return e.readFields(j_,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},t)}(r,r.readVarint()+r.pos))}function B_(e,t,r){1===e?(t.delta_filter=function(e,t){return e.readFields(F_,{blockSize:0},t)}(r,r.readVarint()+r.pos),t.filter="delta_filter"):2===e?(r.readVarint(),t.filter="zigzag_filter"):3===e?(r.readVarint(),t.filter="bitshuffle_filter"):4===e&&(r.readVarint(),t.filter="byteshuffle_filter")}function F_(e,t,r){1===e&&(t.blockSize=r.readVarint())}function N_(e,t,r){1===e?(r.readVarint(),t.codec="gzip_data"):2===e?(r.readVarint(),t.codec="jpeg_image"):3===e?(r.readVarint(),t.codec="webp_image"):4===e&&(r.readVarint(),t.codec="png_image")}function V_(e,t,r){let i=0,n=0;1===e?t.firstByte=r.readFixed64():2===e?t.lastByte=r.readFixed64():3===e?t.filters.push(function(e,t){return e.readFields(B_,{},t)}(r,r.readVarint()+r.pos)):4===e?t.codec=function(e,t){return e.readFields(N_,{},t)}(r,r.readVarint()+r.pos):5===e?n=r.readFloat():6===e?i=r.readFloat():7===e?t.bands.push(r.readString()):8===e?t.offset=r.readDouble():9===e&&(t.scale=r.readDouble()),0===t.offset&&(t.offset=n),0===t.scale&&(t.scale=i)}function j_(e,t,r){1===e?t.version=r.readVarint():2===e?t.name=r.readString():3===e?t.units=r.readString():4===e?t.tileSize=r.readVarint():5===e?t.buffer=r.readVarint():6===e?t.pixelFormat=r.readVarint():7===e&&t.dataIndex.push(function(e,t){return e.readFields(V_,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},t)}(r,r.readVarint()+r.pos))}function U_(e,t,r){if(2===e)!function(e,t,r){e.readFields($_,r,t)}(r,r.readVarint()+r.pos,t);else if(3===e)throw new Error("Not implemented")}function $_(e,t,r){if(1===e){let e=0;const i=r.readVarint()+r.pos;for(;r.pos<i;)t[e++]=r.readVarint()}}so(O_,"DEMData"),so(I_,"DemMinMaxQuadTree",{omit:["dem"]});class G_{constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const t=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,t),t}put(e,t){this.cache.has(e)?this.cache.delete(e):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,t)}}function q_(e,t){if(4!==t.length)throw new Error(`Expected data of dimension 4 but got ${t.length}.`);let r=t[3];for(let i=2;i>=1;i--){const n=1===i?1:0,o=2===i?1:0;for(let i=0;i<t[0];i++){const s=t[1]*i;for(let i=n;i<t[1];i++){const n=t[2]*(i+s);for(let i=o;i<t[2];i++){const o=t[3]*(i+n);for(let i=0;i<t[3];i++){const t=o+i;e[t]+=e[t-r]}}}}r*=t[i]}return e}function H_(e){for(let t=0,r=e.length;t<r;t++)e[t]=e[t]>>>1^-(1&e[t]);return e}function W_(e,t){switch(t){case"uint32":return e;case"uint16":for(let t=0;t<e.length;t+=2){const r=e[t],i=e[t+1];e[t]=(240&r)>>4|(61440&r)>>8|(240&i)<<4|61440&i,e[t+1]=15&r|(3840&r)>>4|(15&i)<<8|(3840&i)<<4}return e;case"uint8":for(let t=0;t<e.length;t+=4){const r=e[t],i=e[t+1],n=e[t+2],o=e[t+3];e[t+0]=(192&r)>>6|(192&i)>>4|(192&n)>>2|192&o,e[t+1]=(48&r)>>4|(48&i)>>2|48&n|(48&o)<<2,e[t+2]=(12&r)>>2|12&i|(12&n)<<2|(12&o)<<4,e[t+3]=3&r|(3&i)<<2|(3&n)<<4|(3&o)<<6}return e;default:throw new Error(`Invalid pixel format, "${t}"`)}}var Z_=Uint8Array,X_=Uint16Array,Y_=Int32Array,J_=new Z_([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),K_=new Z_([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Q_=new Z_([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),eg=function(e,t){for(var r=new X_(31),i=0;i<31;++i)r[i]=t+=1<<e[i-1];var n=new Y_(r[30]);for(i=1;i<30;++i)for(var o=r[i];o<r[i+1];++o)n[o]=o-r[i]<<5|i;return{b:r,r:n}},tg=eg(J_,2),rg=tg.b,ig=tg.r;rg[28]=258,ig[258]=28;for(var ng=eg(K_,0).b,og=new X_(32768),sg=0;sg<32768;++sg){var ag=(43690&sg)>>1|(21845&sg)<<1;og[sg]=((65280&(ag=(61680&(ag=(52428&ag)>>2|(13107&ag)<<2))>>4|(3855&ag)<<4))>>8|(255&ag)<<8)>>1}var lg=function(e,t,r){for(var i=e.length,n=0,o=new X_(t);n<i;++n)e[n]&&++o[e[n]-1];var s,a=new X_(t);for(n=1;n<t;++n)a[n]=a[n-1]+o[n-1]<<1;s=new X_(1<<t);var l=15-t;for(n=0;n<i;++n)if(e[n])for(var c=n<<4|e[n],u=t-e[n],h=a[e[n]-1]++<<u,d=h|(1<<u)-1;h<=d;++h)s[og[h]>>l]=c;return s},cg=new Z_(288);for(sg=0;sg<144;++sg)cg[sg]=8;for(sg=144;sg<256;++sg)cg[sg]=9;for(sg=256;sg<280;++sg)cg[sg]=7;for(sg=280;sg<288;++sg)cg[sg]=8;var ug=new Z_(32);for(sg=0;sg<32;++sg)ug[sg]=5;var hg=lg(cg,9),dg=lg(ug,5),pg=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},fg=function(e,t,r){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(7&t)&r},mg=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(7&t)},_g=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],gg=function(e,t,r){var i=new Error(t||_g[e]);if(i.code=e,Error.captureStackTrace&&Error.captureStackTrace(i,gg),!r)throw i;return i},yg=new Z_(0),xg="undefined"!=typeof TextDecoder&&new TextDecoder;try{xg.decode(yg,{stream:!0})}catch(e){}const vg={gzip_data:"gzip"};class bg extends Error{constructor(e){super(e),this.name="MRTError"}}const wg={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},Tg={uint32:1,uint16:2,uint8:4},Sg={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let Eg;class Mg{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const t=this.layers[e];if(!t)throw new bg(`Layer '${e}' not found`);return t}getHeaderLength(e){const t=new Uint8Array(e),r=new DataView(e);if(13!==t[0])throw new bg("File is not a valid MRT.");return r.getUint32(1,!0)}parseHeader(e){const t=new Uint8Array(e),r=this.getHeaderLength(e);if(t.length<r)throw new bg(`Expected header with length >= ${r} but got buffer of length ${t.length}`);const i=function(e){return e.readFields(L_,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0)}(new Eg(t.subarray(0,r)));if(!isNaN(this.x)&&(this.x!==i.x||this.y!==i.y||this.z!==i.z))throw new bg(`Invalid attempt to parse header ${i.z}/${i.x}/${i.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=i.x,this.y=i.y,this.z=i.z;for(const e of i.layers)this.layers[e.name]=new Ag(e,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const t=[],r=this.getLayer(e.layerName);for(let i of e.blockIndices){const n=r.dataIndex[i],o=n.firstByte-e.firstByte,s=n.lastByte-e.firstByte;if(r._blocksInProgress.has(i))continue;const a={layerName:r.name,firstByte:o,lastByte:s,pixelFormat:r.pixelFormat,blockIndex:i,blockShape:[n.bands.length].concat(r.bandShape),buffer:r.buffer,codec:n.codec.codec,filters:n.filters.map((e=>e.filter))};r._blocksInProgress.add(i),t.push(a)}return new Cg(t,(()=>{t.forEach((e=>r._blocksInProgress.delete(e.blockIndex)))}),((e,i)=>{if(t.forEach((e=>r._blocksInProgress.delete(e.blockIndex))),e)throw e;i.forEach((e=>{this.getLayer(e.layerName).processDecodedData(e)}))}))}}class Ag{constructor({version:e,name:t,units:r,tileSize:i,pixelFormat:n,buffer:o,dataIndex:s},a){if(this.version=e,1!==this.version)throw new bg(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=t,this.units=r,this.tileSize=i,this.buffer=o,this.pixelFormat=wg[n],this.dataIndex=s,this.bandShape=[i+2*o,i+2*o,Tg[this.pixelFormat]],this._decodedBlocks=new G_(a?a.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return Tg[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map((({bands:e})=>e)).flat()}processDecodedData(e){const t=e.blockIndex.toString();this._decodedBlocks.get(t)||this._decodedBlocks.put(t,e.data)}getBlockForBand(e){let t=0;switch(typeof e){case"string":for(const[r,i]of this.dataIndex.entries()){for(const[n,o]of i.bands.entries())if(o===e)return{bandIndex:t+n,blockIndex:r,blockBandIndex:n};t+=i.bands.length}break;case"number":for(const[r,i]of this.dataIndex.entries()){if(e>=t&&e<t+i.bands.length)return{bandIndex:e,blockIndex:r,blockBandIndex:e-t};t+=i.bands.length}break;default:throw new bg(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}throw new bg(`Band not found: ${JSON.stringify(e)}`)}getDataRange(e){let t=1/0,r=-1/0;const i=[],n=new Set;for(const o of e){const{blockIndex:e}=this.getBlockForBand(o);if(e<0)throw new bg(`Invalid band: ${JSON.stringify(o)}`);const s=this.dataIndex[e];i.includes(e)||i.push(e),n.add(e),t=Math.min(t,s.firstByte),r=Math.max(r,s.lastByte)}if(n.size>this.cacheSize)throw new bg(`Number of blocks to decode (${n.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:t,lastByte:r,blockIndices:i}}hasBand(e){const{blockIndex:t}=this.getBlockForBand(e);return t>=0}hasDataForBand(e){const{blockIndex:t}=this.getBlockForBand(e);return t>=0&&!!this._decodedBlocks.get(t.toString())}getBandView(e){const{blockIndex:t,blockBandIndex:r}=this.getBlockForBand(e),i=this._decodedBlocks.get(t.toString());if(!i)throw new bg(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const n=this.dataIndex[t],o=this.bandShape.reduce(((e,t)=>e*t),1),s=r*o,a=i.subarray(s,s+o);return{data:a,bytes:new Uint8Array(a.buffer).subarray(a.byteOffset,a.byteOffset+a.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:n.offset,scale:n.scale}}}Mg.setPbf=function(e){Eg=e};class Cg{constructor(e,t,r){this.tasks=e,this._onCancel=t,this._onComplete=r,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,t){this._finalized||(this._onComplete(e,t),this._finalized=!0)}}Mg.performDecoding=function(e,t){const r=new Uint8Array(e);return Promise.all(t.tasks.map((e=>{const{layerName:t,firstByte:i,lastByte:n,pixelFormat:o,blockShape:s,blockIndex:a,filters:l,codec:c}=e,u=r.subarray(i,n+1),h=new Uint32Array(s[0]*s[1]*s[2]);let d;if("gzip_data"!==c)throw new bg(`Unhandled codec: ${c}`);return d=function(e,t){if(!globalThis.DecompressionStream&&"gzip_data"===t)return Promise.resolve(((o=function(e){31==e[0]&&139==e[1]&&8==e[2]||gg(6,"invalid gzip data");var t=e[3],r=10;4&t&&(r+=2+(e[10]|e[11]<<8));for(var i=(t>>3&1)+(t>>4&1);i>0;i-=!e[r++]);return r+(2&t)}(n=e))+8>n.length&&gg(6,"invalid gzip data"),function(e,t,r){var i=e.length;if(!i||t.f&&!t.l)return r||new Z_(0);var n=!r,o=n||2!=t.i,s=t.i;n&&(r=new Z_(3*i));var a,l,c=function(e){var t=r.length;if(e>t){var i=new Z_(Math.max(2*t,e));i.set(r),r=i}},u=t.f||0,h=t.p||0,d=t.b||0,p=t.l,f=t.d,m=t.m,_=t.n,g=8*i;do{if(!p){u=fg(e,h,1);var y=fg(e,h+1,3);if(h+=3,!y){var x=e[(P=4+((h+7)/8|0))-4]|e[P-3]<<8,v=P+x;if(v>i){s&&gg(0);break}o&&c(d+x),r.set(e.subarray(P,v),d),t.b=d+=x,t.p=h=8*v,t.f=u;continue}if(1==y)p=hg,f=dg,m=9,_=5;else if(2==y){var b=fg(e,h,31)+257,w=fg(e,h+10,15)+4,T=b+fg(e,h+5,31)+1;h+=14;for(var S=new Z_(T),E=new Z_(19),M=0;M<w;++M)E[Q_[M]]=fg(e,h+3*M,7);h+=3*w;var A=pg(E),C=(1<<A)-1,I=lg(E,A);for(M=0;M<T;){var P,R=I[fg(e,h,C)];if(h+=15&R,(P=R>>4)<16)S[M++]=P;else{var z=0,D=0;for(16==P?(D=3+fg(e,h,3),h+=2,z=S[M-1]):17==P?(D=3+fg(e,h,7),h+=3):18==P&&(D=11+fg(e,h,127),h+=7);D--;)S[M++]=z}}var k=S.subarray(0,b),O=S.subarray(b);m=pg(k),_=pg(O),p=lg(k,m),f=lg(O,_)}else gg(1);if(h>g){s&&gg(0);break}}o&&c(d+131072);for(var L=(1<<m)-1,B=(1<<_)-1,F=h;;F=h){var N=(z=p[mg(e,h)&L])>>4;if((h+=15&z)>g){s&&gg(0);break}if(z||gg(2),N<256)r[d++]=N;else{if(256==N){F=h,p=null;break}var V=N-254;N>264&&(V=fg(e,h,(1<<($=J_[M=N-257]))-1)+rg[M],h+=$);var j=f[mg(e,h)&B],U=j>>4;if(j||gg(3),h+=15&j,O=ng[U],U>3){var $=K_[U];O+=mg(e,h)&(1<<$)-1,h+=$}if(h>g){s&&gg(0);break}o&&c(d+131072);var G=d+V;if(d<O){var q=0-O,H=Math.min(O,G);for(q+d<0&&gg(3);d<H;++d)r[d]=(void 0)[q+d]}for(;d<G;++d)r[d]=r[d-O]}}t.l=p,t.p=F,t.b=d,t.f=u,p&&(u=1,t.m=m,t.d=f,t.n=_)}while(!u);return d!=r.length&&n?(a=r,(null==(l=d)||l>a.length)&&(l=a.length),new Z_(a.subarray(0,l))):r.subarray(0,d)}(n.subarray(o,-8),{i:2},new Z_(((r=n)[(i=r.length)-4]|r[i-3]<<8|r[i-2]<<16|r[i-1]<<24)>>>0))));var r,i,n,o;const s=vg[t];if(!s)throw new Error(`Unhandled codec: ${t}`);const a=new globalThis.DecompressionStream(s);return new Response(new Blob([e]).stream().pipeThrough(a)).arrayBuffer().then((e=>new Uint8Array(e)))}(u,c).then((e=>(function(e,t){e.readFields(U_,t)}(new Eg(e),h),new Sg[o](h.buffer)))),d.then((e=>{for(let t=l.length-1;t>=0;t--)switch(l[t]){case"delta_filter":q_(e,s);break;case"zigzag_filter":H_(e);break;case"bitshuffle_filter":W_(e,o);break;default:throw new bg(`Unhandled filter "${l[t]}"`)}return{layerName:t,blockIndex:a,data:e}})).catch((e=>{throw e}))})))},so(Cg,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]});var Ig={workerUrl:"",workerClass:null,workerParams:void 0};const Pg="mapboxgl_preloaded_worker_pool";class Rg{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<Rg.workerCount;)this.workers.push(null!=Ig.workerClass?new Ig.workerClass:new self.Worker(Ig.workerUrl,Ig.workerParams));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&0===this.numActive()&&(this.workers.forEach((e=>{e.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[Pg]}numActive(){return Object.keys(this.active).length}}let zg;function Dg(){return zg||(zg=new Rg),zg}Rg.workerCount=2;let kg,Og,Lg,Bg,Fg,Ng=null;function Vg(){return ge()&&self.worker&&self.worker.dracoUrl?self.worker.dracoUrl:Og||Ee.DRACO_URL}function jg(){if(ge()&&self.worker&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(Bg)return Bg;const e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if("object"!=typeof WebAssembly)throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return Bg=WebAssembly.validate(e)?Ee.MESHOPT_SIMD_URL:Ee.MESHOPT_URL,Bg}const Ug={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},$g={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},Gg={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function qg(e,t,r){const i=r.json.bufferViews.length,n=r.buffers.length;t.bufferView=i,r.json.bufferViews[i]={buffer:n,byteLength:e.byteLength},r.buffers[n]=e}const Hg="KHR_draco_mesh_compression";function Wg(e,t){const r=e.extensions&&e.extensions[Hg];if(!r)return;const i=new Lg.Decoder,n=ey(t,r.bufferView),o=new Lg.Mesh;if(!i.DecodeArrayToMesh(n,n.byteLength,o))throw new Error("Failed to decode Draco mesh");const s=t.json.accessors[e.indices],a=Ug[s.componentType],l=s.count*a.BYTES_PER_ELEMENT,c=Lg._malloc(l);a===Uint16Array?i.GetTrianglesUInt16Array(o,l,c):i.GetTrianglesUInt32Array(o,l,c),qg(Lg.memory.buffer.slice(c,c+l),s,t),Lg._free(c);for(const n of Object.keys(r.attributes)){const s=i.GetAttributeByUniqueId(o,r.attributes[n]),a=t.json.accessors[e.attributes[n]],l=$g[a.componentType],c=a.count*Gg[a.type]*Ug[a.componentType].BYTES_PER_ELEMENT,u=Lg._malloc(c);i.GetAttributeDataArrayForAllPoints(o,s,Lg[l],c,u),qg(Lg.memory.buffer.slice(u,u+c),a,t),Lg._free(u)}i.destroy(),o.destroy(),delete e.extensions[Hg]}const Zg="EXT_meshopt_compression";function Xg(e,t){if(!e.extensions||!e.extensions[Zg])return;const r=e.extensions[Zg],i=new Uint8Array(t.buffers[r.buffer],r.byteOffset||0,r.byteLength||0),n=new Uint8Array(r.count*r.byteStride);Fg.decodeGltfBuffer(n,r.count,r.byteStride,i,r.mode,r.filter),e.buffer=t.buffers.length,e.byteOffset=0,t.buffers[e.buffer]=n.buffer,delete e.extensions[Zg]}const Yg=1179937895,Jg=new TextDecoder("utf8");function Kg(e,t){return new URL(e,t).href}function Qg(e,t,r,i){return fetch(Kg(e.uri,i)).then((e=>e.arrayBuffer())).then((e=>{t.buffers[r]=e}))}function ey(e,t){const r=e.json.bufferViews[t];return new Uint8Array(e.buffers[r.buffer],r.byteOffset||0,r.byteLength)}function ty(e,t,r,i){if(e.uri){const n=Kg(e.uri,i);return fetch(n).then((e=>e.blob())).then((e=>createImageBitmap(e))).then((e=>{t.images[r]=e}))}if(void 0!==e.bufferView){const i=ey(t,e.bufferView),n=new Blob([i],{type:e.mimeType});return createImageBitmap(n).then((e=>{t.images[r]=e}))}}function ry(e,t=0,r){const i={json:null,images:[],buffers:[]};if(new Uint32Array(e,t,1)[0]===Yg){const r=new Uint32Array(e,t);let n=2;const o=(r[n++]>>2)-3,s=r[n++]>>2;if(n++,i.json=JSON.parse(Jg.decode(r.subarray(n,n+s))),n+=s,n<o){const o=r[n++];n++;const s=t+(n<<2);i.buffers[0]=e.slice(s,s+o)}}else i.json=JSON.parse(Jg.decode(new Uint8Array(e,t)));const{buffers:n,images:o,meshes:s,extensionsUsed:a,bufferViews:l}=i.json;let c=Promise.resolve();if(n){const e=[];for(let t=0;t<n.length;t++){const o=n[t];o.uri?e.push(Qg(o,i,t,r)):i.buffers[t]||(i.buffers[t]=null)}c=Promise.all(e)}return c.then((()=>{const e=[],t=a&&a.includes(Hg),n=a&&a.includes(Zg);if(t&&e.push(function(){if(!Lg)return null!=kg?kg:(kg=function(e){let t,r=null;function i(){t=new Uint8Array(r.buffer)}function n(){throw new Error("Unexpected Draco error.")}const o={a:{a:n,d:function(e,r,i){return t.copyWithin(e,r,r+i)},c:function(e){const n=t.length,o=Math.max(e>>>0,Math.ceil(1.2*n)),s=Math.ceil((o-n)/65536);try{return r.grow(s),i(),!0}catch(e){return!1}},b:n}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(e,o):e.then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,o)))).then((e=>{const{Rb:n,Qb:o,P:s,T:a,X:l,Ja:c,La:u,Qa:h,Va:d,Wa:p,eb:f,jb:m,f:_,e:g,yb:y,zb:x,Ab:v,Bb:b,Db:w,Gb:T}=e.instance.exports;r=g;const S=(()=>{let e=0,r=0,i=0,s=0;return a=>{i&&(n(s),n(e),r+=i,i=e=0),e||(r+=128,e=o(r));const l=a.length+7&-8;let c=e;l>=r&&(i=l,c=s=o(l));for(let e=0;e<a.length;e++)t[c+e]=a[e];return c}})();return i(),_(),{memory:g,_free:n,_malloc:o,Mesh:class{constructor(){this.ptr=s()}destroy(){a(this.ptr)}},Decoder:class{constructor(){this.ptr=c()}destroy(){m(this.ptr)}DecodeArrayToMesh(e,t,r){const i=S(e),n=u(this.ptr,i,t,r.ptr);return!!l(n)}GetAttributeByUniqueId(e,t){return{ptr:h(this.ptr,e.ptr,t)}}GetTrianglesUInt16Array(e,t,r){d(this.ptr,e.ptr,t,r)}GetTrianglesUInt32Array(e,t,r){p(this.ptr,e.ptr,t,r)}GetAttributeDataArrayForAllPoints(e,t,r,i,n){f(this.ptr,e.ptr,t.ptr,r,i,n)}},DT_INT8:y(),DT_UINT8:x(),DT_INT16:v(),DT_UINT16:b(),DT_UINT32:w(),DT_FLOAT32:T()}}))}(fetch(Vg())),kg.then((e=>{Lg=e,kg=void 0})))}()),n&&e.push(function(){if(Fg)return;const e=function(e){let t;const r=WebAssembly.instantiateStreaming(e,{}).then((e=>{t=e.instance,t.exports.__wasm_call_ctors()})),i={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},n={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:r,supported:!0,decodeGltfBuffer(e,r,o,s,a,l){!function(e,t,r,i,n,o,s){const a=e.exports.sbrk,l=i+3&-4,c=a(l*n),u=a(o.length),h=new Uint8Array(e.exports.memory.buffer);h.set(o,u);const d=t(c,i,n,u,o.length);if(0===d&&s&&s(c,l,n),r.set(h.subarray(c,c+i*n)),a(c-a(0)),0!==d)throw new Error(`Malformed buffer data: ${d}`)}(t,t.exports[n[a]],e,r,o,s,t.exports[i[l]])}}}(fetch(jg()));return e.ready.then((()=>{Fg=e}))}()),o)for(let t=0;t<o.length;t++)e.push(ty(o[t],i,t,r));return(e.length?Promise.all(e):Promise.resolve()).then((()=>{if(t&&s)for(const{primitives:e}of s)for(const t of e)Wg(t,i);if(n&&s&&l)for(const e of l)Xg(e,i);return i}))}))}function iy(e,t){const r=e.json.bufferViews[t.bufferView],i=Ug[t.componentType];return new i(e.buffers[r.buffer],(t.byteOffset||0)+(r.byteOffset||0),t.count*(r.byteStride&&r.byteStride!==Gg[t.type]*i.BYTES_PER_ELEMENT?r.byteStride/i.BYTES_PER_ELEMENT:Gg[t.type]))}function ny(e,t,r,i){const n=Ug[t.componentType],o=function(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(n),s=e.json.bufferViews[t.bufferView],a=s.byteStride?s.byteStride/n.BYTES_PER_ELEMENT:Gg[t.type],l=r.float32,c=l.length/r.capacity;for(let e=0,r=0;e<t.count*a;e+=a,r+=c)for(let t=0;t<c;t++)l[r+t]=i[e+t]*o;r._trim()}function oy(e,t,r){const i=e.indices,n=e.attributes,o={};o.indexArray=new Ls;const s=t.json.accessors[i],a=s.count/3;o.indexArray.reserve(a);const l=iy(t,s);for(let e=0;e<a;e++)o.indexArray.emplaceBack(l[3*e],l[3*e+1],l[3*e+2]);o.indexArray._trim(),o.vertexArray=new Ss;const c=t.json.accessors[n.POSITION];o.vertexArray.reserve(c.count);const u=iy(t,c);for(let e=0;e<c.count;e++)o.vertexArray.emplaceBack(u[3*e],u[3*e+1],u[3*e+2]);if(o.vertexArray._trim(),o.aabb=new gc(c.min,c.max),o.centroid=function(e,t){const r=[0,0,0],i=e.length;if(i>0){for(let n=0;n<i;n++){const i=3*e[n];r[0]+=t[i],r[1]+=t[i+1],r[2]+=t[i+2]}r[0]/=i,r[1]/=i,r[2]/=i}return r}(l,u),void 0!==n.COLOR_0){const e=t.json.accessors[n.COLOR_0],r=Gg[e.type],i=iy(t,e);o.colorArray=3===r?new Ss:new Ts,o.colorArray.resize(e.count),ny(t,e,o.colorArray,i)}if(void 0!==n.NORMAL){o.normalArray=new Ss;const e=t.json.accessors[n.NORMAL];o.normalArray.resize(e.count);const r=iy(t,e);ny(t,e,o.normalArray,r)}if(void 0!==n.TEXCOORD_0&&r.length>0){o.texcoordArray=new Hs;const e=t.json.accessors[n.TEXCOORD_0];o.texcoordArray.resize(e.count);const r=iy(t,e);ny(t,e,o.texcoordArray,r)}if(void 0!==n._FEATURE_ID_RGBA4444){const e=t.json.accessors[n._FEATURE_ID_RGBA4444];t.json.extensionsUsed&&t.json.extensionsUsed.includes("EXT_meshopt_compression")&&(o.featureData=iy(t,e))}void 0!==n._FEATURE_RGBA4444&&(o.featureData=new Uint32Array(iy(t,t.json.accessors[n._FEATURE_RGBA4444]).buffer));const h=e.material;return o.material=function(e,t){const{emissiveFactor:r=[0,0,0],alphaMode:i="OPAQUE",alphaCutoff:n=.5,normalTexture:o,occlusionTexture:s,emissiveTexture:a,doubleSided:l}=e,{baseColorFactor:c=[1,1,1,1],metallicFactor:u=1,roughnessFactor:h=1,baseColorTexture:d,metallicRoughnessTexture:p}=e.pbrMetallicRoughness||{},f=s?t[s.index]:void 0;if(s&&s.extensions&&s.extensions.KHR_texture_transform&&f){const e=s.extensions.KHR_texture_transform;f.offsetScale=[e.offset[0],e.offset[1],e.scale[0],e.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new Mt(...c),metallicFactor:u,roughnessFactor:h,baseColorTexture:d?t[d.index]:void 0,metallicRoughnessTexture:p?t[p.index]:void 0},doubleSided:l,emissiveFactor:r,alphaMode:i,alphaCutoff:n,normalTexture:o?t[o.index]:void 0,occlusionTexture:f,emissionTexture:a?t[a.index]:void 0,defined:void 0===e.defined}}(void 0!==h?t.json.materials[h]:{defined:!1},r),o}function sy(e,t,r){const{matrix:i,rotation:n,translation:o,scale:s,mesh:a,extras:l,children:c}=e,u={};if(u.matrix=i||N.mat4.fromRotationTranslationScale([],n||[0,0,0,1],o||[0,0,0],s||[1,1,1]),void 0!==a){u.meshes=r[a];const e=u.anchor=[0,0];for(const t of u.meshes){const{min:r,max:i}=t.aabb;e[0]+=r[0]+i[0],e[1]+=r[1]+i[1]}e[0]=Math.floor(e[0]/u.meshes.length/2),e[1]=Math.floor(e[1]/u.meshes.length/2)}if(l&&(l.id&&(u.id=l.id),l.lights&&(u.lights=function(e){if(!e.length)return[];const t=function(e){const t=atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.codePointAt(e);return r}(e),r=[],i=t.length/24,n=new Uint16Array(t.buffer),o=new Float32Array(t.buffer);for(let e=0;e<i;e++){const t=n[2*e*6]/30,i=n[2*e*6+1]/30,s=n[2*e*6+10]/100,a=o[6*e+1],l=o[6*e+2],c=o[6*e+3],u=o[6*e+4],h=c-a,d=u-l,p=Math.hypot(h,d);r.push({pos:[a+.5*h,l+.5*d,i],normal:[d/p,-h/p,0],width:p,height:t,depth:s,points:[a,l,c,u]})}return r}(l.lights))),c){const e=[];for(const i of c)e.push(sy(t.json.nodes[i],t,r));u.children=e}return u}function ay(e){if(0===e.vertices.length||0===e.indices.length)return null;const t=new Gu(e.vertices,e.indices,8,256),[r,i]=[t.min.clone(),t.max.clone()];return{vertices:e.vertices,indices:e.indices,grid:t,min:r,max:i}}function ly(e){if(!e.extras||!e.extras.ground)return null;const t=e.extras.ground;if(!t||!Array.isArray(t)||0===t.length)return null;const r=t[0];if(!r||!Array.isArray(r)||0===r.length)return null;const i=[];for(const e of r){if(!Array.isArray(e)||2!==e.length)continue;const t=e[0],r=e[1];"number"==typeof t&&"number"==typeof r&&i.push(new $(t,r))}if(i.length<3)return null;i.length>1&&i[i.length-1].equals(i[0])&&i.pop();let n=0;for(let e=0;e<i.length;e++){const t=i[e],r=i[(e+1)%i.length],o=i[(e+2)%i.length];n+=(t.x-r.x)*(o.y-r.y)-(o.x-r.x)*(t.y-r.y)}n>0&&i.reverse();const o=uu(i.flatMap((e=>[e.x,e.y])),[]);return 0===o.length?null:{vertices:i,indices:o}}function cy(e,t){const r=[],i=[];let n=0;const o=[];for(const s of e){n=r.length;const e=s.vertexArray.float32,a=s.indexArray.uint16;for(let i=0;i<s.vertexArray.length;i++)o[0]=e[3*i+0],o[1]=e[3*i+1],o[2]=e[3*i+2],N.vec3.transformMat4(o,o,t),r.push(new $(o[0],o[1]));for(let e=0;e<3*s.indexArray.length;e++)i.push(a[e]+n)}if(i.length%3!=0)return null;for(let e=0;e<i.length;e+=3){const t=r[i[e+0]],n=r[i[e+1]],o=r[i[e+2]];(t.x-n.x)*(o.y-n.y)-(o.x-n.x)*(t.y-n.y)>0&&([i[e+1],i[e+2]]=[i[e+2],i[e+1]])}return{vertices:r,indices:i}}function uy(e){const t=function(e,t){const r=[],i=WebGL2RenderingContext;if(e.json.textures)for(const n of e.json.textures){const o={magFilter:i.LINEAR,minFilter:i.NEAREST,wrapS:i.REPEAT,wrapT:i.REPEAT};void 0!==n.sampler&&Object.assign(o,e.json.samplers[n.sampler]),r.push({image:t[n.source],sampler:o,uploaded:!1})}return r}(e,e.images),r=function(e,t){const r=[];for(const i of e.json.meshes){const n=[];for(const r of i.primitives)n.push(oy(r,e,t));r.push(n)}return r}(e,t),{scenes:i,scene:n,nodes:o}=e.json,s=i?i[n||0].nodes:o,a=[];for(const t of s)a.push(sy(o[t],e,r));return function(e,t,r){const i={},n=new Set;for(let o=0;o<e.length;o++){const e=r[t[o]];if(!e.extras)continue;const s=e.extras["mapbox:footprint:version"],a=e.extras["mapbox:footprint:id"];(s||a)&&n.add(o),"1.0.0"===s&&a&&(i[a]=o)}for(let o=0;o<e.length;o++){if(n.has(o))continue;const s=e[o],a=r[t[o]];if(!a.extras)continue;let l=null;s.id in i&&(l=cy(e[i[s.id]].meshes,s.matrix)),l||(l=ly(a)),l&&(s.footprint=ay(l))}if(n.size>0){const t=Array.from(n.values()).sort(((e,t)=>e-t));for(let r=t.length-1;r>=0;r--)e.splice(t[r],1)}}(a,s,e.json.nodes),a}function hy(e){e.heightmap=new Float32Array(4096),e.heightmap.fill(-1);const t=e.vertexArray.float32,r=e.aabb.min[0]-1,i=e.aabb.min[1]-1,n=Jm/(e.aabb.max[0]-r+2),o=Jm/(e.aabb.max[1]-i+2);for(let s=0;s<t.length;s+=3){const a=t[s+2],l=(t[s+0]-r)*n|0,c=(t[s+1]-i)*o|0;a>e.heightmap[c*Jm+l]&&(e.heightmap[c*Jm+l]=a)}}function dy(e,t){const r={};r.indexArray=new Ls,r.indexArray.reserve(4*e.length),r.vertexArray=new Ss,r.vertexArray.reserve(10*e.length),r.colorArray=new Ts,r.vertexArray.reserve(10*e.length);let i=0;for(const n of e){const e=Math.min(10,Math.max(4,1.3*n.height))*t,o=[-n.normal[1],n.normal[0],0],s=Math.min(.29,.1*n.width/n.depth),a=n.width-2*n.depth*t*(s+.01),l=N.vec3.scaleAndAdd([],n.pos,o,a/2),c=N.vec3.scaleAndAdd([],n.pos,o,-a/2),u=[l[0],l[1],l[2]+n.height],h=[c[0],c[1],c[2]+n.height],d=N.vec3.scaleAndAdd([],n.normal,o,s);N.vec3.scale(d,d,e);const p=N.vec3.scaleAndAdd([],n.normal,o,-s);N.vec3.scale(p,p,e),N.vec3.add(d,l,d),N.vec3.add(p,c,p),l[2]+=.1,c[2]+=.1,r.vertexArray.emplaceBack(d[0],d[1],d[2]),r.vertexArray.emplaceBack(p[0],p[1],p[2]),r.vertexArray.emplaceBack(l[0],l[1],l[2]),r.vertexArray.emplaceBack(c[0],c[1],c[2]),r.vertexArray.emplaceBack(u[0],u[1],u[2]),r.vertexArray.emplaceBack(h[0],h[1],h[2]),r.vertexArray.emplaceBack(l[0],l[1],l[2]),r.vertexArray.emplaceBack(c[0],c[1],c[2]),r.vertexArray.emplaceBack(d[0],d[1],d[2]),r.vertexArray.emplaceBack(p[0],p[1],p[2]);const f=a/e/2;r.colorArray.emplaceBack(-f-s,-1,f,.8),r.colorArray.emplaceBack(f+s,-1,f,.8),r.colorArray.emplaceBack(-f,0,f,1.3),r.colorArray.emplaceBack(f,0,f,1.3),r.colorArray.emplaceBack(f+s,-.8,f,.7),r.colorArray.emplaceBack(f+s,-.8,f,.7),r.colorArray.emplaceBack(0,0,f,1.3),r.colorArray.emplaceBack(0,0,f,1.3),r.colorArray.emplaceBack(f+s,-1.2,f,.8),r.colorArray.emplaceBack(f+s,-1.2,f,.8),r.indexArray.emplaceBack(6+i,4+i,8+i),r.indexArray.emplaceBack(7+i,9+i,5+i),r.indexArray.emplaceBack(0+i,1+i,2+i),r.indexArray.emplaceBack(1+i,3+i,2+i),i+=10}const n={defined:!0,emissiveFactor:[0,0,0]},o={};return o.baseColorFactor=Mt.white,n.pbrMetallicRoughness=o,r.material=n,r.aabb=new gc([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),r}class py{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){const r=e[t];this._stringToNumber[r]=t,this._numberToString[t]=r}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}class fy{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new no(Xr,16,0),this.featureIndexArray=new sa,this.promoteId=t,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,t,r,i,n,o=0,s=0){const a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,i,n,o);const l=this.grid;for(let e=0;e<t.length;e++){const r=t[e],i=[1/0,1/0,-1/0,-1/0];for(let e=0;e<r.length;e++){const t=r[e];i[0]=Math.min(i[0],t.x),i[1]=Math.min(i[1],t.y),i[2]=Math.max(i[2],t.x),i[3]=Math.max(i[3],t.y)}0!==s&&(i[0]-=s,i[1]-=s,i[2]+=s,i[3]+=s),i[0]<Xr&&i[1]<Xr&&i[2]>=0&&i[3]>=0&&l.insert(a,i[0],i[1],i[2],i[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new hh.VectorTile(new lp(this.rawTileData)).layers,this.sourceLayerCoder=new py(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,t,r){this.loadVTLayers(),this.serializedLayersCache.clear();const i=Yo(e.filter),n=e.tileResult,o=e.transform,s=n.bufferedTilespaceBounds,a=this.grid.query(s.min.x,s.min.y,s.max.x,s.max.y,((e,t,r,i)=>Ul(n.bufferedTilespaceGeometry,e,t,r,i)));a.sort(_y);let l=null;o.elevation&&a.length>0&&(l=o_.create(o.elevation,this.tileID));const c={};let u;for(let s=0;s<a.length;s++){const h=a[s];if(h===u)continue;u=h;const d=this.featureIndexArray.get(h);let p=null;if(this.is3DTile){const e=this.bucketLayerIDs[0][0],r=t[e];if("model"!==r.type)continue;const{queryFeature:s,intersectionZ:a}=r.queryIntersectsMatchingFeature(n,d.featureIndex,i,o);s&&this.appendToResult(c,e,d.featureIndex,s,a)}else this.loadMatchingFeature(c,d,i,e.layers,e.availableImages,t,r,((t,r,i,o=0)=>(p||(p=Al(t,this.tileID.canonical,e.tileTransform)),r.queryIntersectsFeature(n,t,i,p,this.z,e.transform,e.pixelPosMatrix,l,o))))}return c}loadMatchingFeature(e,t,r,i,n,o,s,a){const{featureIndex:l,bucketIndex:c,sourceLayerIndex:u,layoutVertexArrayOffset:h}=t,d=this.bucketLayerIDs[c];if(i.length&&!function(e,t){for(let r=0;r<e.length;r++)if(t.indexOf(e[r])>=0)return!0;return!1}(i,d))return;const p=this.sourceLayerCoder.decode(u),f=this.vtLayers[p].feature(l);if(r.needGeometry){const e=Cl(f,!0);if(!r.filter(new Do(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!r.filter(new Do(this.tileID.overscaledZ),f))return;const m=this.getId(f,p);for(let t=0;t<d.length;t++){const r=d[t];if(i.length&&i.indexOf(r)<0)continue;const c=o[r];if(!c)continue;let u={};void 0!==m&&s&&(u=s.getState(c.sourceLayer||"_geojsonTileLayer",m));const p=!a||a(f,c,u,h);if(!p)continue;const _=new g_(f,this.z,this.x,this.y,m);let g=this.serializedLayersCache.get(r);g||(g=c.serialize(),g.id=r,this.serializedLayersCache.set(r,g)),_.layer=ie({},g),_.tile=this.tileID.canonical,_.layer.paint=my(g.paint,c.paint,f,u,n),_.layer.layout=my(g.layout,c.layout,f,u,n),this.appendToResult(e,r,l,_,p)}}appendToResult(e,t,r,i,n){let o=e[t];void 0===o&&(o=e[t]=[]),o.push({featureIndex:r,feature:i,intersectionZ:n})}lookupSymbolFeatures(e,t,r,i,n,o,s){const a={};this.loadVTLayers();const l=Yo(i);for(const i of e)this.loadMatchingFeature(a,{bucketIndex:t,sourceLayerIndex:r,featureIndex:i,layoutVertexArrayOffset:0},l,n,o,s);return a}loadFeature(e){const{featureIndex:t,sourceLayerIndex:r}=e;this.loadVTLayers();const i=this.sourceLayerCoder.decode(r),n=this.vtFeatures[i];if(n[t])return n[t];const o=this.vtLayers[i].feature(t);return n[t]=o,o}hasLayer(e){for(const t of this.bucketLayerIDs)for(const r of t)if(e===r)return!0;return!1}getId(e,t){let r=e.id;if(this.promoteId){const i="string"==typeof this.promoteId?this.promoteId:this.promoteId[t];null!=i&&(r=e.properties[i]),"boolean"==typeof r&&(r=Number(r))}return r}}function my(e,t,r,i,n){return ce(e,((e,o)=>{const s=t instanceof jo?t.get(o):null;return s&&s.evaluate?s.evaluate(r,i,n):s}))}function _y(e,t){return t-e}so(fy,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const gy=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class yy{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[t,r]=new Uint8Array(e,0,2);if(219!==t)throw new Error("Data does not appear to be in a KDBush format.");const i=r>>4;if(1!==i)throw new Error(`Got v${i} data when expected v1.`);const n=gy[15&r];if(!n)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new yy(s,o,n,e)}constructor(e,t=64,r=Float64Array,i){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=r,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const n=gy.indexOf(this.ArrayType),o=2*e*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-s%8)%8;if(n<0)throw new Error(`Unexpected typed array class: ${r}.`);i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+o+s+a),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=e,this.coords[this._pos++]=t,r}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return xy(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,r,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:s}=this,a=[0,n.length-1,0],l=[];for(;a.length;){const c=a.pop()||0,u=a.pop()||0,h=a.pop()||0;if(u-h<=s){for(let s=h;s<=u;s++){const a=o[2*s],c=o[2*s+1];a>=e&&a<=r&&c>=t&&c<=i&&l.push(n[s])}continue}const d=h+u>>1,p=o[2*d],f=o[2*d+1];p>=e&&p<=r&&f>=t&&f<=i&&l.push(n[d]),(0===c?e<=p:t<=f)&&(a.push(h),a.push(d-1),a.push(1-c)),(0===c?r>=p:i>=f)&&(a.push(d+1),a.push(u),a.push(1-c))}return l}within(e,t,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:n,nodeSize:o}=this,s=[0,i.length-1,0],a=[],l=r*r;for(;s.length;){const c=s.pop()||0,u=s.pop()||0,h=s.pop()||0;if(u-h<=o){for(let r=h;r<=u;r++)Ty(n[2*r],n[2*r+1],e,t)<=l&&a.push(i[r]);continue}const d=h+u>>1,p=n[2*d],f=n[2*d+1];Ty(p,f,e,t)<=l&&a.push(i[d]),(0===c?e-r<=p:t-r<=f)&&(s.push(h),s.push(d-1),s.push(1-c)),(0===c?e+r>=p:t+r>=f)&&(s.push(d+1),s.push(u),s.push(1-c))}return a}}function xy(e,t,r,i,n,o){if(n-i<=r)return;const s=i+n>>1;vy(e,t,s,i,n,o),xy(e,t,r,i,s-1,1-o),xy(e,t,r,s+1,n,1-o)}function vy(e,t,r,i,n,o){for(;n>i;){if(n-i>600){const s=n-i+1,a=r-i+1,l=Math.log(s),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(s-c)/s)*(a-s/2<0?-1:1);vy(e,t,r,Math.max(i,Math.floor(r-a*c/s+u)),Math.min(n,Math.floor(r+(s-a)*c/s+u)),o)}const s=t[2*r+o];let a=i,l=n;for(by(e,t,i,r),t[2*n+o]>s&&by(e,t,i,n);a<l;){for(by(e,t,a,l),a++,l--;t[2*a+o]<s;)a++;for(;t[2*l+o]>s;)l--}t[2*i+o]===s?by(e,t,i,l):(l++,by(e,t,l,n)),l<=r&&(i=l+1),r<=l&&(n=l-1)}}function by(e,t,r,i){wy(e,r,i),wy(t,2*r,2*i),wy(t,2*r+1,2*i+1)}function wy(e,t,r){const i=e[t];e[t]=e[r],e[r]=i}function Ty(e,t,r,i){const n=e-r,o=t-i;return n*n+o*o}e.$=Lo,e.A=class extends Gm{},e.B=ur,e.C=Rt,e.D=Wo,e.E=wt,e.F=Fn,e.G=On,e.H=Bn,e.I=Vp,e.J=Zn,e.K=Zo,e.L=Kn,e.M=Xn,e.N=Pi,e.O=zi,e.P=$,e.Q=Ii,e.R=et,e.S=mr,e.T=um,e.U=Et,e.V=Gm,e.W=Xo,e.X=Nn,e.Y=Ln,e.Z=function(e){const t=e.value;let r=[];if(!t)return r;const i=ur(t);return"string"!==i?(r=r.concat([new Gm(e.key,t,`string expected, "${i}" found`)]),r):(qm(t,!0)||(r=r.concat([new Gm(e.key,t,`invalid url "${t}"`)])),r)},e._=Ho,e.a=function(e){return Ee.API_CDN_URL_REGEX.test(e)},e.a$=ys,e.a0=qo,e.a1=Uo,e.a2=class{constructor(e){this.specification=e}possiblyEvaluate(e,t){return _e(e.expression.evaluate(t))}interpolate(e,t,r){return{x:Ct(e.x,t.x,r),y:Ct(e.y,t.y,r),z:Ct(e.z,t.z,r),azimuthal:Ct(e.azimuthal,t.azimuthal,r),polar:Ct(e.polar,t.polar,r)}}},e.a3=Do,e.a4=Jn,e.a5=xl,e.a6=N,e.a7=ee,e.a8=jo,e.a9=Bc,e.aA=ic,e.aB=gm,e.aC=Tm,e.aD=mm,e.aE=function(e,t){const r=document.createElement("video");r.muted=!0,r.onloadstart=function(){t(null,r)};for(let t=0;t<e.length;t++){const i=document.createElement("source");ot(e[t])||(r.crossOrigin="Anonymous"),i.src=e[t],r.appendChild(i)}return{cancel:()=>{}}},e.aF=hm,e.aG=function(e){return fetch(e).then((e=>e.arrayBuffer())).then((t=>ry(t,0,e)))},e.aH=uy,e.aI=class{constructor(e,t,r,i){this.id=e,this.position=null!=t?new il(t[0],t[1]):new il(0,0),this.orientation=null!=r?r:[0,0,0],this.nodes=i,this.uploaded=!1,this.aabb=new gc([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(e,t){if(N.mat4.multiply(e.matrix,t,e.matrix),e.meshes)for(const t of e.meshes){const r=gc.applyTransformFast(t.aabb,e.matrix);this.aabb.encapsulate(r)}if(e.children)for(const t of e.children)this._applyTransformations(t,e.matrix)}computeBoundsAndApplyParent(){const e=N.mat4.identity([]);for(const t of this.nodes)this._applyTransformations(t,e)}computeModelMatrix(e,t,r,i,n,o,s=!1){Qm(this.matrix,this,e.transform,this.position,t,r,i,n,o,s)}upload(e){if(!this.uploaded){for(const t of this.nodes)r_(t,e);for(const e of this.nodes)i_(e);this.uploaded=!0}}destroy(){for(const e of this.nodes)n_(e)}},e.aJ=ae,e.aK=function(e){return e.indexOf(ls)>=0},e.aL=yf,e.aM=hl,e.aN=dl,e.aO=vs,e.aP=Ls,e.aQ=oe,e.aR=Ks,e.aS=Yf,e.aT=function(){zo.isLoading()||zo.isLoaded()||"deferred"!==Po()||Ro()},e.aU=Yo,e.aV=Cl,e.aW=g_,e.aX=ye,e.aY=wd,e.aZ=Nu,e.a_=Al,e.aa=Ct,e.ab=Xr,e.ac=It,e.ad=class{constructor(e){this.specification=e}possiblyEvaluate(e,t){return function([e,t]){const r=_e([1,e,t]);return{x:r.x,y:r.y,z:r.z}}(e.expression.evaluate(t))}interpolate(e,t,r){return{x:Ct(e.x,t.x,r),y:Ct(e.y,t.y,r),z:Ct(e.z,t.z,r)}}},e.ae=function(e,t,r=0,i=!0){const n=new $(r,r),o=e.sub(n),s=t.add(n),a=[o,new $(s.x,o.y),s,new $(o.x,s.y)];return i&&a.push(o.clone()),a},e.af=function(e,t){const r=[];for(let i=0;i<e.length;i++){const n=te(i-1,-1,e.length-1),o=te(i+1,-1,e.length-1),s=e[i],a=e[o],l=e[n].sub(s).unit(),c=a.sub(s).unit(),u=c.angleWithSep(l.x,l.y),h=l.add(c).unit().mult(-1*t/Math.sin(u/2));r.push(s.add(h))}return r},e.ag=xf,e.ah=Ul,e.ai=function(e,t,r=0){return N.vec3.fromValues(((t.x-r)*e.scale-e.x)*Xr,(t.y*e.scale-e.y)*Xr,pl(t.z,t.y))},e.aj=uc,e.ak=Md,e.al=function(e){let t=1/0,r=1/0,i=-1/0,n=-1/0;for(const o of e)t=Math.min(t,o.x),r=Math.min(r,o.y),i=Math.max(i,o.x),n=Math.max(n,o.y);return{min:new $(t,r),max:new $(i,n)}},e.am=ll,e.an=jl,e.ao=bl,e.ap=Q,e.aq=qa,e.ar=function(e,t){const r={};for(let i=0;i<t.length;i++){const n=t[i];n in e&&(r[n]=e[n])}return r},e.as=nl,e.at=cl,e.au=class{constructor(e){this.entries={},this.scheduler=e}request(e,t,r,i){const n=this.entries[e]=this.entries[e]||{callbacks:[]};if(n.result){const[e,r]=n.result;return this.scheduler?this.scheduler.add((()=>{i(e,r)}),t):i(e,r),()=>{}}return n.callbacks.push(i),n.cancel||(n.cancel=r(((r,i)=>{n.result=[r,i];for(const e of n.callbacks)this.scheduler?this.scheduler.add((()=>{e(r,i)}),t):e(r,i);setTimeout((()=>delete this.entries[e]),3e3)}))),()=>{n.result||(n.callbacks=n.callbacks.filter((e=>e!==i)),n.callbacks.length||(n.cancel(),delete this.entries[e]))}}},e.av=cs,e.aw=function(e,t,r){const i=JSON.stringify(e.request);return e.data&&(this.deduped.entries[i]={result:[null,e.data]}),this.deduped.request(i,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom},(t=>{const i=nt(e.request,((e,i,n,o)=>{e?t(e):i&&t(null,{vectorTile:r?void 0:new hh.VectorTile(new lp(i)),rawData:i,cacheControl:n,expires:o})}));return()=>{i.cancel(),t()}}),t)},e.ax=function(e){He++,He>Ve&&(e.getActor().send("enforceCacheSizeLimit",Ne),He=0)},e.ay=ke,e.az=function(e){return e<=1?1:Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},e.b=function(e){return Ee.API_FONTS_REGEX.test(e)},e.b$=hc,e.b0=qs,e.b1=cc,e.b2=da,e.b3=uu,e.b4=am,e.b5=function(e,t){const r=Bc(t.zoom);if(0===r)return Tc(e);const i=Ac(e),n=Cc(i),o=ll(i.getWest())*t.worldSize,s=ll(i.getEast())*t.worldSize,a=cl(i.getNorth())*t.worldSize,l=cl(i.getSouth())*t.worldSize,c=[o,a,0],u=[s,a,0],h=[o,l,0],d=[s,l,0],p=N.mat4.invert([],t.globeMatrix);return N.vec3.transformMat4(c,c,p),N.vec3.transformMat4(u,u,p),N.vec3.transformMat4(h,h,p),N.vec3.transformMat4(d,d,p),n[0]=Sc(n[0],h,r),n[1]=Sc(n[1],d,r),n[2]=Sc(n[2],u,r),n[3]=Sc(n[3],c,r),gc.fromPoints(n)},e.b6=zc,e.b7=Ic,e.b8=Sc,e.b9=xs,e.bA=Mt,e.bB=te,e.bC=W,e.bD=ve,e.bE=ul,e.bF=function(e,t,r){e[4*t+0]=r[0],e[4*t+1]=r[1],e[4*t+2]=r[2],e[4*t+3]=r[3]},e.bG=Ca,e.bH=Ta,e.bI=Sa,e.bJ=wa,e.bK=ba,e.bL=il,e.bM=Vf,e.bN=rc,e.bO=_c,e.bP=Am,e.bQ=tc,e.bR=Mc,e.bS=function(e,t,r,i,n,o,s,a,l){if("globe"===l.name)return Mc(e,t,new tc(r,i,n),!1);const c=yf({z:r,x:i,y:n},l);return new gc([(o+c.x/c.scale)*t,t*(c.y/c.scale),s],[(o+c.x2/c.scale)*t,t*(c.y2/c.scale),a])},e.bT=function(e,t,r){let i=0;for(let r=0;r<2;++r){const n=0;e[r]>n&&(i+=(e[r]-n)*(e[r]-n)),t[r]<n&&(i+=(n-t[r])*(n-t[r]))}return i},e.bU=fl,e.bV=Wa,e.bW=function(e){const t=N.mat4.identity(new Float64Array(16));N.mat4.multiply(t,e.pixelMatrix,e.globeMatrix);const r=[0,Ja,0],i=[0,Ka,0];return N.vec3.transformMat4(r,r,t),N.vec3.transformMat4(i,i,t),[r[0]>0&&r[0]<=e.width&&r[1]>0&&r[1]<=e.height&&!Nc(e,new il(e.center.lat,90)),i[0]>0&&i[0]<=e.width&&i[1]>0&&i[1]<=e.height&&!Nc(e,new il(e.center.lat,-90))]},e.bX=function(e,t){const{scale:r}=e.tileTransform,i=r*Xr/(e.tileSize*Math.pow(2,t.zoom-e.tileID.overscaledZ+e.tileID.canonical.z));return N.mat2.scale(new Float32Array(4),t.inverseAdjustmentMatrix,[i,i])},e.bY=Cm,e.bZ=Mm,e.b_=function(e){const t=Mm(e,!0);return N.mat2.invert([],[t[0],t[1],t[4],t[5]])},e.ba=lc,e.bb=Mg,e.bc=lp,e.bd=nt,e.be=function(e){const t=[];for(const r in e)t.push(e[r]);return t},e.bf=function(e,t){const r=[];for(const i in e)i in t||r.push(i);return r},e.bg=re,e.bh=["type","source","source-layer","minzoom","maxzoom","filter","layout"],e.bi=G,e.bj=function(e,t){const{x:r,y:i}=e.point,n=Lc(r,i,e.worldSize/e._pixelsPerMercatorPixel,0,0);return N.mat4.multiply(n,n,Dc(Tc(t)))},e.bk=Yd,e.bl=fp,e.bm=Xd,e.bn=function(e,t,r,i,n){const o=5*t+2;e.float32[o+0]=r,e.float32[o+1]=i,e.float32[o+2]=n},e.bo=Hf,e.bp=Bp,e.bq=zl,e.br=Hd,e.bs=yh,e.bt=$m,e.bu=Ah,e.bv=Ch,e.bw=lf,e.bx=af,e.by=Ep,e.bz=yy,e.c=Ae,e.c$=oc,e.c0=function(e){const{x:t,y:r}=e.point,{lng:i,lat:n}=e._center;return Lc(t,r,e.worldSize,i,n)},e.c1=Z,e.c2=nc,e.c3=Ha,e.c4=function(e){const t=Math.round((e+45+360)%360/90)%4;return X[t]},e.c5=45,e.c6=al,e.c7=Ea,e.c8=function(e,t,r){const i=Math.sqrt(e*e+t*t+r*r),n=i>0?Math.acos(r/i)*H:0;let o=0!==e||0!==t?Math.atan2(-t,-e)*H+90:0;return o<0&&(o+=360),[i,o,n]},e.c9=yl,e.cA=function(e){const t=fl-5;e=Q(e,-t,t)/t*90;const r=Math.pow(Math.abs(Math.sin(W(e))),3);return Math.round(r*(Ya.length-1))},e.cB=function(e,t,r,i){const n=t.getNorth(),o=t.getSouth(),s=t.getWest(),a=t.getEast(),l=1<<e.z,c=a-s,u=n-o,h=c/Xa,d=-u/Ya[r],p=[0,h,0,d,0,0,n,s,0];if(e.z>0){const e=180/i;N.mat3.multiply(p,p,[e/c+1,0,0,0,e/u+1,0,-.5*e/h,.5*e/d,1])}return p[2]=l,p[5]=e.x,p[8]=e.y,p},e.cC=Tc,e.cD=function(e,t,r){const i=N.mat4.identity(new Float64Array(16)),n=(t/(1<<e)-.5)*Math.PI*2;return N.mat4.rotateY(i,r.globeMatrix,n),Float32Array.from(i)},e.cE=class{isDataAvailableAtPoint(e){const t=this._source();if(this.isUsingMockSource()||!t||e.y<0||e.y>1)return!1;const r=t.getSource().maxzoom,i=1<<r,n=Math.floor(e.x),o=Math.floor((e.x-n)*i),s=Math.floor(e.y*i),a=this.findDEMTileFor(new ic(r,n,r,o,s));return!(!a||!a.dem)}getAtPointOrZero(e,t=0){return this.getAtPoint(e,t)||0}getAtPoint(e,t,r=!0){if(this.isUsingMockSource())return null;null==t&&(t=null);const i=this._source();if(!i)return t;if(e.y<0||e.y>1)return t;const n=i.getSource().maxzoom,o=1<<n,s=Math.floor(e.x),a=e.x-s,l=new ic(n,s,n,Math.floor(a*o),Math.floor(e.y*o)),c=this.findDEMTileFor(l);if(!c||!c.dem)return t;const u=c.dem,h=1<<c.tileID.canonical.z,d=(a*h-c.tileID.canonical.x)*u.dim,p=(e.y*h-c.tileID.canonical.y)*u.dim,f=Math.floor(d),m=Math.floor(p);return(r?this.exaggeration():1)*Ct(Ct(u.get(f,m),u.get(f,m+1),p-m),Ct(u.get(f+1,m),u.get(f+1,m+1),p-m),d-f)}getAtTileOffset(e,t,r){const i=1<<e.canonical.z;return this.getAtPointOrZero(new xl(e.wrap+(e.canonical.x+t/Xr)/i,(e.canonical.y+r/Xr)/i))}getAtTileOffsetFunc(e,t,r,i){return n=>{const o=this.getAtTileOffset(e,n.x,n.y),s=i.upVector(e.canonical,n.x,n.y),a=i.upVectorScale(e.canonical,t,r).metersToTile;return N.vec3.scale(s,s,o*a),s}}getForTilePoints(e,t,r,i){if(this.isUsingMockSource())return!1;const n=o_.create(this,e,i);return!!n&&(t.forEach((e=>{e[2]=this.exaggeration()*n.getElevationAt(e[0],e[1],r)})),!0)}getMinMaxForTile(e){if(this.isUsingMockSource())return null;const t=this.findDEMTileFor(e);if(!t||!t.dem)return null;const r=t.dem.tree,i=t.tileID,n=1<<e.canonical.z-i.canonical.z;let o=e.canonical.x/n-i.canonical.x,s=e.canonical.y/n-i.canonical.y,a=0;for(let t=0;t<e.canonical.z-i.canonical.z&&!r.leaves[a];t++){o*=2,s*=2;const e=2*Math.floor(s)+Math.floor(o);a=r.childOffsets[a]+e,o%=1,s%=1}return{min:this.exaggeration()*r.minimums[a],max:this.exaggeration()*r.maximums[a]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(e,t,r){throw new Error("Pure virtual method called.")}pointCoordinate(e){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(e){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const e=this.visibleDemTiles;if(0===e.length)return null;let t=!1,r=Number.MAX_VALUE,i=Number.MIN_VALUE;for(const n of e){const e=this.getMinMaxForTile(n.tileID);e&&(r=Math.min(r,e.min),i=Math.max(i,e.max),t=!0)}return t?{min:r,max:i}:null}},e.cF=su,e.cG=yc,e.cH=function(e,t){return[Math.pow(e[0],2.2)*t,Math.pow(e[1],2.2)*t,Math.pow(e[2],2.2)*t]},e.cI=Oc,e.cJ=Se,e.cK=Te,e.cL=256,e.cM=function(e,t){const r=[0,0,0],i=zc(Tc(t.canonical));return N.vec3.transformMat4(r,r,i),N.vec3.transformMat4(r,r,e),r},e.cN=e=>({u_camera_to_center_distance:new wa(e),u_extrude_scale:new Ra(e),u_device_pixel_ratio:new wa(e),u_matrix:new Ca(e),u_inv_rot_matrix:new Ca(e),u_merc_center:new Ta(e),u_tile_id:new Sa(e),u_zoom_transition:new wa(e),u_up_dir:new Sa(e),u_emissive_strength:new wa(e)}),e.cO=e=>({u_matrix:new Ca(e),u_pixels_to_tile_units:new Ra(e),u_device_pixel_ratio:new wa(e),u_units_to_pixels:new Ta(e),u_dash_image:new ba(e),u_gradient_image:new ba(e),u_image_height:new wa(e),u_texsize:new Ta(e),u_tile_units_to_pixels:new wa(e),u_alpha_discard_threshold:new wa(e),u_trim_offset:new Ta(e),u_trim_fade_range:new Ta(e),u_trim_color:new Ea(e),u_emissive_strength:new wa(e),u_zbias_factor:new wa(e),u_tile_to_meter:new wa(e)}),e.cP=e=>({u_matrix:new Ca(e),u_texsize:new Ta(e),u_pixels_to_tile_units:new Ra(e),u_device_pixel_ratio:new wa(e),u_image:new ba(e),u_units_to_pixels:new Ta(e),u_tile_units_to_pixels:new wa(e),u_alpha_discard_threshold:new wa(e),u_trim_offset:new Ta(e),u_emissive_strength:new wa(e),u_zbias_factor:new wa(e),u_tile_to_meter:new wa(e)}),e.cQ=ks,e.cR=qd,e.cS=Jd,e.cT=Gc,e.cU=(e,t,r,i,n,o)=>{const s=e.transform,a="globe"===s.projection.name;let l;if("map"===o.paint.get("circle-pitch-alignment"))if(a){const e=Oc(s.zoom,t.canonical)*s._pixelsPerMercatorPixel;l=Float32Array.from([e,0,0,e])}else l=s.calculatePixelsToTileUnitsMatrix(r);else l=new Float32Array([s.pixelsToGLUnits[0],0,0,s.pixelsToGLUnits[1]]);const c={u_camera_to_center_distance:e.transform.getCameraToCenterDistance(s.projection),u_matrix:e.translatePosMatrix(t.projMatrix,r,o.paint.get("circle-translate"),o.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Oe.devicePixelRatio,u_extrude_scale:l,u_inv_rot_matrix:$c,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:o.paint.get("circle-emissive-strength")};if(a){c.u_inv_rot_matrix=i,c.u_merc_center=n,c.u_tile_id=[t.canonical.x,t.canonical.y,1<<t.canonical.z],c.u_zoom_transition=Bc(s.zoom);const e=n[0]*Xr,r=n[1]*Xr;c.u_up_dir=s.projection.upVector(new tc(0,0,0),e,r)}return c},e.cV=Pd,e.cW=(e,t,r,i,n,o)=>{const s=e.transform,a=s.pitch<15?Ad(.07,.7,Q((14-s.zoom)/5,0,1)):.07;return{u_matrix:Id(e,t,r,i),u_texsize:t.imageAtlasTexture?t.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:s.calculatePixelsToTileUnitsMatrix(t),u_device_pixel_ratio:n,u_image:0,u_tile_units_to_pixels:Cd(t,s),u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:o,u_emissive_strength:r.paint.get("line-emissive-strength"),u_zbias_factor:a,u_tile_to_meter:yl(t.tileID.canonical,0)}},e.cX=(e,t,r,i,n,o,s)=>{const a=e.transform,l=a.calculatePixelsToTileUnitsMatrix(t),c=a.pitch<15?Ad(.07,.7,Q((14-a.zoom)/5,0,1)):.07;return{u_matrix:Id(e,t,r,i),u_pixels_to_tile_units:l,u_device_pixel_ratio:o,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:n,u_texsize:Rd(r)&&t.lineAtlasTexture?t.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:Cd(t,e.transform),u_alpha_discard_threshold:0,u_trim_offset:s,u_trim_fade_range:r.paint.get("line-trim-fade-range"),u_trim_color:r.paint.get("line-trim-color").toRenderColor(r.lut).toArray01(),u_emissive_strength:r.paint.get("line-emissive-strength"),u_zbias_factor:c,u_tile_to_meter:yl(t.tileID.canonical,0)}},e.cY=se,e.cZ=au,e.c_=id,e.ca=gc,e.cb=_e,e.cc=function(e){return[Math.pow(e[0],1/2.2),Math.pow(e[1],1/2.2),Math.pow(e[2],1/2.2)]},e.cd=function(e){return e({pluginStatus:Eo,pluginURL:Mo}),Io.on("pluginStateChange",e),e},e.ce=T_,e.cf=Dg,e.cg=Wp,e.ch=Hp,e.ci=rt,e.cj=Ao,e.ck=Be,e.cl=gt,e.cm=he,e.cn=function(e){const t=e.indexOf(ls);return t>=0?e.slice(0,t):e},e.co=function(e){const t=e.indexOf(ls);return t>=0?e.slice(t+1):""},e.cp=function(e){const t=[],r=e.id;return void 0===r&&t.push({message:`layers.${r}: missing required property "id"`}),void 0===e.render&&t.push({message:`layers.${r}: missing required method "render"`}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),t},e.cq=function(e,t,r,i){return"custom"===e.type?new Sm(e,t):new x_[e.type](e,t,r,i)},e.cr=ue,e.cs=Io,e.ct=it,e.cu=Ma,e.cv=class extends va{constructor(e){super(e),this.current=Ia}set(e,t,r){if(this.fetchUniformLocation(e,t))for(let e=0;e<9;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix3fv(this.location,!1,r);break}}},e.cw=Y,e.cx=function(e,t,r){const i=Bc(r.zoom),n=e.style.map._antialias,o=t.options.extStandardDerivativesForceOff||e.terrain&&e.terrain.exaggeration()>0;return 0===i&&!n&&!o},e.cy=function(e){const t=e.pixelsPerMeter,r=t/ul(1,e.center.lat),i=N.mat4.identity(new Float64Array(16));return N.mat4.translate(i,i,[e.point.x,e.point.y,0]),N.mat4.scale(i,i,[r,r,t]),Float32Array.from(i)},e.cz=Ac,e.d=function(e){return Ee.API_TILEJSON_REGEX.test(e)},e.d$=t,e.d0=Xh,e.d1=Bh,e.d2=450,e.d3=7,e.d4=_m,e.d5=_s,e.d6=Xs,e.d7=256,e.d8=Dc,e.d9=Ss,e.dA=Fc,e.dB=function(e){const t=[0,0,0],r=N.mat4.identity(new Float64Array(16));return N.mat4.multiply(r,e.pixelMatrix,e.globeMatrix),N.vec3.transformMat4(t,t,r),new $(t[0],t[1])},e.dC=function(e,t,r=!1){if(Eo===bo||Eo===wo||Eo===To)throw new Error("setRTLTextPlugin cannot be called multiple times.");Mo=Oe.resolveURL(e),Eo=bo,So=t,Co(),r||Ro()},e.dD=Po,e.dE=function(){Dg().acquire(Pg)},e.dF=function(){const e=zg;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(Pg),zg=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},e.dG=Rg,e.dH=function(e){const t=Ge();if(!t)return;const r=t.delete(Fe);e&&r.catch(e).then((()=>e()))},e.dI=Ig,e.dJ=Vg,e.dK=function(e){Og=Oe.resolveURL(e),Ng||(Ng=new T_(Dg(),new wt)),Ng.broadcast("setDracoUrl",Og)},e.dL=jg,e.dM=function(e){Bg=Oe.resolveURL(e),Ng||(Ng=new T_(Dg(),new wt)),Ng.broadcast("setMeshoptUrl",Bg)},e.dN=so,e.dO=nu,e.dP=qp,e.dQ=py,e.dR=fy,e.dS=yd,e.dT=ce,e.dU=jp,e.dV=function(e,t,r,i,n,o,s,a,l,c,u=1,h){e.createArrays(),e.tilePixelRatio=Xr/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;const d=e.layers[0].layout,p=e.layers[0]._unevaluatedLayout._values,f={};if(f.scaleFactor=u,f.textSizeScaleRange=d.get("text-size-scale-range"),f.iconSizeScaleRange=d.get("icon-size-scale-range"),f.textScaleFactor=Q(f.scaleFactor,f.textSizeScaleRange[0],f.textSizeScaleRange[1]),f.iconScaleFactor=Q(f.scaleFactor,f.iconSizeScaleRange[0],f.iconSizeScaleRange[1]),"composite"===e.textSizeData.kind){const{minZoom:t,maxZoom:r}=e.textSizeData;f.compositeTextSizes=[p["text-size"].possiblyEvaluate(new Do(t),a),p["text-size"].possiblyEvaluate(new Do(r),a)]}if("composite"===e.iconSizeData.kind){const{minZoom:t,maxZoom:r}=e.iconSizeData;f.compositeIconSizes=[p["icon-size"].possiblyEvaluate(new Do(t),a),p["icon-size"].possiblyEvaluate(new Do(r),a)]}f.layoutTextSize=p["text-size"].possiblyEvaluate(new Do(l+1),a),f.layoutIconSize=p["icon-size"].possiblyEvaluate(new Do(l+1),a),f.textMaxSize=p["text-size"].possiblyEvaluate(new Do(18),a);const m="map"===d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),_=d.get("text-size");let g=!1;for(const t of e.features)if(t.icon&&t.icon.nameSecondary){g=!0;break}for(const o of e.features){const l=d.get("text-font").evaluate(o,{},a).join(","),u=_.evaluate(o,{},a)*f.textScaleFactor,p=f.layoutTextSize.evaluate(o,{},a)*f.textScaleFactor,y=(f.layoutIconSize.evaluate(o,{},a),{horizontal:{},vertical:void 0}),x=o.text;let v,b=[0,0];if(x){const i=x.toString(),s=d.get("text-letter-spacing").evaluate(o,{},a)*Hd,c=d.get("text-line-height").evaluate(o,{},a)*Hd,h=fo(i)?s:0,f=d.get("text-anchor").evaluate(o,{},a),_=d.get("text-variable-anchor");if(!_){const e=d.get("text-radial-offset").evaluate(o,{},a);b=e?af(f,[e*Hd,of]):d.get("text-offset").evaluate(o,{},a).map((e=>e*Hd))}let g=m?"center":d.get("text-justify").evaluate(o,{},a);const v="point"===d.get("symbol-placement"),w=v?d.get("text-max-width").evaluate(o,{},a)*Hd:1/0,T=o=>{e.allowVerticalPlacement&&po(i)&&(y.vertical=gp(x,t,r,n,l,w,c,f,o,h,b,fp.vertical,!0,p,u))};if(!m&&_){const e="auto"===g?_.map((e=>lf(e))):[g];let i=!1;for(let o=0;o<e.length;o++){const s=e[o];if(!y.horizontal[s])if(i)y.horizontal[s]=y.horizontal[0];else{const e=gp(x,t,r,n,l,w,c,"center",s,h,b,fp.horizontal,!1,p,u);e&&(y.horizontal[s]=e,i=1===e.positionedLines.length)}}T("left")}else{if("auto"===g&&(g=lf(f)),v||d.get("text-writing-mode").indexOf("horizontal")>=0||!po(i)){const e=gp(x,t,r,n,l,w,c,f,g,h,b,fp.horizontal,!1,p,u);e&&(y.horizontal[g]=e)}T(v?"left":g)}}let w=!1;if(o.icon&&o.icon.namePrimary){const t=i[o.icon.namePrimary];t&&(v=Ap(n[o.icon.namePrimary],o.icon.nameSecondary?n[o.icon.nameSecondary]:void 0,d.get("icon-offset").evaluate(o,{},a),d.get("icon-anchor").evaluate(o,{},a)),w=t.sdf,void 0===e.sdfIcons?e.sdfIcons=t.sdf:e.sdfIcons!==t.sdf&&pe("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(t.pixelRatio!==e.pixelRatio||0!==d.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0))}const T=pf(y.horizontal)||y.vertical;e.iconsInText||(e.iconsInText=!!T&&T.iconsInText),(T||v)&&cf(e,o,y,v,i,f,p,0,b,w,s,a,c,h,g)}o&&e.generateCollisionDebugBuffers(l,e.collisionBoxArray,f.textScaleFactor)},e.dW=hh,e.dX=O_,e.dY=U,e.dZ=uh,e.d_=ap,e.da=Vs,e.db=js,e.dc=function(e,t,r,i,n){return Q((e-t)/(r-t)*(n-i)+i,i,n)},e.dd=En,e.de=_l,e.df=class{constructor(e,t,r,i){this.context=e,this.format=i,this.size=r,this.texture=e.gl.createTexture();const[n,o,s]=this.size,{gl:a}=e;a.bindTexture(a.TEXTURE_3D,this.texture),e.pixelStoreUnpackFlipY.set(!1),e.pixelStoreUnpack.set(1),e.pixelStoreUnpackPremultiplyAlpha.set(!1),a.texImage3D(a.TEXTURE_3D,0,this.format,n,o,s,0,lm(this.format),cm(this.format),t.data)}bind(e,t){const{context:r}=this,{gl:i}=r;i.bindTexture(i.TEXTURE_3D,this.texture),e!==this.minFilter&&(i.texParameteri(i.TEXTURE_3D,i.TEXTURE_MAG_FILTER,e),i.texParameteri(i.TEXTURE_3D,i.TEXTURE_MIN_FILTER,e),this.minFilter=e),t!==this.wrapS&&(i.texParameteri(i.TEXTURE_3D,i.TEXTURE_WRAP_S,t),i.texParameteri(i.TEXTURE_3D,i.TEXTURE_WRAP_T,t),this.wrapS=t)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}},e.dg=km,e.dh=[1,1,1],e.di=o_,e.dj=Km,e.dk=Rs,e.dl=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new $(1/0,1/0),max:new $(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(e,t=!1){const r=Th(new $(0,0),new $(Xr,Xr),e),i=[];if(t&&!bh(r,this._globalClipBounds))return i;for(const t of this._activeRegions){if(t.hiddenByOverlap)continue;if(!bh(r,t))continue;const n=Sh(t.min,t.max,e);i.push({min:n.min,max:n.max,sourceId:this._sourceIds[t.priority],footprint:t.footprint,footprintTileId:t.tileId,order:t.order,clipMask:t.clipMask,clipScope:t.clipScope})}return i}setSources(e){this._setSources(e.map((e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const t=[];for(const r of e.cache.getVisibleCoordinates()){const i=e.cache.getTile(r).buckets[e.layer];i&&i.updateFootprints(r.toUnwrapped(),t)}return t},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope}))))}_addSource(e){const t=e.getFootprints();if(0===t.length)return;const r=e.getOrder(),i=e.getClipMask(),n=e.getClipScope();for(const e of t){if(!e.footprint)continue;const t=Th(e.footprint.min,e.footprint.max,e.id);this._activeRegions.push({min:t.min,max:t.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:e.id,footprint:e.footprint,order:r,clipMask:i,clipScope:n})}this._sourceIds.push(e.getSourceId())}_computeReplacement(){this._activeRegions.sort(((e,t)=>e.priority-t.priority||xh(e.min,t.min)||xh(e.max,t.max)||e.order-t.order||e.clipMask-t.clipMask||function(e,t){const r=(e,t)=>e+t;return e.length-t.length||e.reduce(r,"").localeCompare(t.reduce(r,""))}(e.clipScope,t.clipScope)));let e=this._activeRegions.length!==this._prevRegions.length;if(!e){let t=0;for(;!e&&t!==this._activeRegions.length;){const r=this._activeRegions[t],i=this._prevRegions[t];e=r.priority!==i.priority||!vh(r,i)||r.order!==i.order||r.clipMask!==i.clipMask||!G(r.clipScope,i.clipScope),++t}}if(e){++this._updateTime;for(const e of this._activeRegions)e.order!==gh&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,e.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,e.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,e.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,e.max.y));const e=e=>{const t=this._activeRegions;if(e>=t.length)return e;const r=t[e].priority;for(;e<t.length&&t[e].priority===r;)++e;return e};if(this._sourceIds.length>1){let t=0,r=e(t);for(;t!==r;){let i=t;const n=t;for(;i!==r;){const e=this._activeRegions[i];e.hiddenByOverlap=!1;for(let t=0;t<n;t++){const r=this._activeRegions[t];if(!r.hiddenByOverlap&&e.order===gh&&bh(e,r)&&(e.hiddenByOverlap=Mh(e.footprint,e.tileId,r.footprint,r.tileId),e.hiddenByOverlap))break}++i}t=r,r=e(t)}}}}_setSources(e){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let t=e.length-1;t>=0;t--)this._addSource(e[t]);this._computeReplacement()}},e.dm=class{constructor(e){this._createGrid(e),this._createPoles(e)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const e of this._poleSegments)e.destroy();for(const e of this._gridSegments)e.withSkirts.destroy(),e.withoutSkirts.destroy()}_fillGridMeshWithLods(e,t){const r=new ys,i=new Ls,n=[],o=e+1+2,s=t[0]+1,a=t[0]+1+(1+t.length),l=(e,t,r)=>{let i=e===o-1?e-2:0===e?e:e-1;return i+=r?24575:0,[i,t]};for(let e=0;e<o;++e)r.emplaceBack(...l(e,0,!0));for(let e=0;e<s;++e)for(let t=0;t<o;++t)r.emplaceBack(...l(t,e,(0===t||t===o-1)&&!0));for(let e=0;e<t.length;++e){const i=t[e];for(let e=0;e<o;++e)r.emplaceBack(...l(e,i,!0))}for(let e=0;e<t.length;++e){const s=i.length,l=t[e]+1+2,c=new Ls;for(let r=0;r<l-1;r++){const n=r===l-2,s=n?o*(a-t.length+e-r):o;for(let e=0;e<o-1;e++){const t=r*o+e;0===r||n||0===e||e===o-2?(c.emplaceBack(t+1,t,t+s),c.emplaceBack(t+s,t+s+1,t+1)):(i.emplaceBack(t+1,t,t+s),i.emplaceBack(t+s,t+s+1,t+1))}}const u=da.simpleSegment(0,s,r.length,i.length-s);for(let e=0;e<c.uint16.length;e+=3)i.emplaceBack(c.uint16[e],c.uint16[e+1],c.uint16[e+2]);const h=da.simpleSegment(0,s,r.length,i.length-s);n.push({withoutSkirts:u,withSkirts:h})}return{vertices:r,indices:i,segments:n}}_createGrid(e){const t=this._fillGridMeshWithLods(Xa,Ya);this._gridSegments=t.segments,this._gridBuffer=e.createVertexBuffer(t.vertices,cc.members),this._gridIndexBuffer=e.createIndexBuffer(t.indices,!0)}_createPoles(e){const t=new Ls;for(let e=0;e<=Xa;e++)t.emplaceBack(0,e+1,e+2);this._poleIndexBuffer=e.createIndexBuffer(t,!0);const r=new Vs,i=new Vs,n=new Vs,o=new Vs;this._poleSegments=[];for(let e=0,t=0;e<Ha;e++){const s=360/(1<<e);r.emplaceBack(0,-qa,0,.5,0),i.emplaceBack(0,-qa,0,.5,1),n.emplaceBack(0,-qa,0,.5,.5),o.emplaceBack(0,-qa,0,.5,.5);for(let e=0;e<=Xa;e++){let t=e/Xa,a=0;const l=Ct(0,s,t),[c,u,h]=Qa(jc,Uc,l,qa);r.emplaceBack(c,u,h,t,a),i.emplaceBack(c,u,h,t,1-a);const d=W(l);t=.5+.5*Math.sin(d),a=.5+.5*Math.cos(d),n.emplaceBack(c,u,h,t,a),o.emplaceBack(c,u,h,t,1-a)}this._poleSegments.push(da.simpleSegment(t,0,66,64)),t+=66}this._poleNorthVertexBuffer=e.createVertexBuffer(r,ac,!1),this._poleSouthVertexBuffer=e.createVertexBuffer(i,ac,!1),this._texturedPoleNorthVertexBuffer=e.createVertexBuffer(n,ac,!1),this._texturedPoleSouthVertexBuffer=e.createVertexBuffer(o,ac,!1)}getGridBuffers(e,t){return[this._gridBuffer,this._gridIndexBuffer,t?this._gridSegments[e].withSkirts:this._gridSegments[e].withoutSkirts]}getPoleBuffers(e,t){return[t?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,t?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[e]]}},e.dn=gh,e.dp=J,e.dq=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},e.dr=K,e.ds=gl,e.dt=el,e.du=function([e,t,r]){const i=Math.hypot(e,t,r),n=Math.atan2(e,r),o=.5*Math.PI-Math.acos(-t/i);return new il(Z(n),Z(o))},e.dv=Pm,e.dw=tl,e.dx=function(e){const t=e.navigator?e.navigator.userAgent:null;return!!function(e){if(null==xe){const t=e.navigator?e.navigator.userAgent:null;xe=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return xe}(e)&&t&&(t.match("Version/15.4")||t.match("Version/15.5")||t.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},e.dy=function(e,t){Ne=e,Ve=t},e.dz=Nc,e.e=Ee,e.e0=function(e){let t=0;if(new Uint32Array(e,0,1)[0]!==Yg){const r=new Uint32Array(e,0,7),[,,i,n,o,s]=r;t=r.byteLength+n+o+s+o,(i!==e.byteLength||t>=e.byteLength)&&pe("Invalid b3dm header information.")}return ry(e,t)},e.e1=function(e,t){const r=uy(e);for(const e of r){for(const t of e.meshes)hy(t);e.lights&&(e.lightMeshIndex=e.meshes.length,e.meshes.push(dy(e.lights,t)))}return r},e.e2=d_,e.e3=w_,e.e4=zo,e.e5=function(e){qe(),null!=Ue&&Ue.then((t=>{t.keys().then((r=>{for(let i=0;i<r.length-e;i++)t.delete(r[i])}))}))},e.f=function(e){return 0===e.indexOf("mapbox:")},e.g=function(e,t){return it(ie(e,{method:"GET"}),t)},e.h=Me,e.i=function(e){return Ee.API_STYLE_REGEX.test(e)&&!Ae(e)},e.j=function(e){return decodeURIComponent(atob(e).split("").map((e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join(""))},e.k=function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(Number("0x"+t)))))},e.l=ie,e.m=We,e.n=function(e,t){return it(ie(e,{type:"json"}),t)},e.o=ct,e.p=function(e,t){return it(ie(e,{method:"POST"}),t)},e.q=Oe,e.r=ou,e.s=function(e){try{const t=self[e];return t.setItem("_mapbox_test_",1),t.removeItem("_mapbox_test_"),!0}catch(e){return!1}},e.t=xt,e.u=function(){return function e(t){return t?(t^Math.random()*(16>>t/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()},e.v=function(e){return!!e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)},e.w=pe,e.x=yt,e.y=2,e.z=Fp})),i(["./shared"],(function(e){function t(e){const t=e?e.url.toString():void 0;return t?performance.getEntriesByName(t):[]}function r(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return JSON.stringify(e);if(Array.isArray(e)){let t="[";for(const i of e)t+=`${r(i)},`;return`${t}]`}let t="{";for(const i of Object.keys(e).sort())t+=`${i}:${r(e[i])},`;return`${t}}`}function i(t){let i="";for(const n of e.bh)i+=`/${r(t[n])}`;return i}class n{constructor(e){this.keyCache={},this._layers={},this._layerConfigs={},e&&this.replace(e)}replace(e,t){this._layerConfigs={},this._layers={},this.update(e,[],t)}update(t,r,n){this._options=n;for(const r of t)this._layerConfigs[r.id]=r,(this._layers[r.id]=e.cq(r,this.scope,null,this._options)).compileFilter(n),this.keyCache[r.id]&&delete this.keyCache[r.id];for(const e of r)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const o=function(e,t){const r={};for(let n=0;n<e.length;n++){const o=t&&t[e[n].id]||i(e[n]);t&&(t[e[n].id]=o);let s=r[o];s||(s=r[o]=[]),s.push(e[n])}const n=[];for(const e in r)n.push(r[e]);return n}(e.be(this._layerConfigs),this.keyCache);for(const e of o){const t=e.map((e=>this._layers[e.id])),r=t[0];if("none"===r.visibility)continue;const i=r.source||"";let n=this.familiesBySource[i];n||(n=this.familiesBySource[i]={});const o=r.sourceLayer||"_geojsonTileLayer";let s=n[o];s||(s=n[o]=[]),s.push(t)}}}const o=1*e.dP;class s{constructor(t){const r={},i=[];for(const e in t){const n=t[e],s=r[e]={};for(const e in n.glyphs){const t=n.glyphs[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const r=t.metrics.localGlyph?o:1,a={x:0,y:0,w:t.bitmap.width+2*r,h:t.bitmap.height+2*r};i.push(a),s[e]=a}}const{w:n,h:s}=e.z(i),a=new e.dO({width:n||1,height:s||1});for(const i in t){const n=t[i];for(const t in n.glyphs){const s=n.glyphs[+t];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;const l=r[i][t],c=s.metrics.localGlyph?o:1;e.dO.copy(s.bitmap,a,{x:0,y:0},{x:l.x+c,y:l.y+c},s.bitmap)}}this.image=a,this.positions=r}}e.dN(s,"GlyphAtlas");class a{constructor(t){this.tileID=new e.aA(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.tileZoom=t.tileZoom,this.uid=t.uid,this.zoom=t.zoom,this.lut=t.lut,this.canonical=t.tileID.canonical,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.scope=t.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.request&&t.request.collectResourceTiming,this.promoteId=t.promoteId,this.isSymbolTile=t.isSymbolTile,this.tileTransform=e.aL(t.tileID.canonical,t.projection),this.projection=t.projection,this.worldview=t.worldview,this.localizableLayerIds=t.localizableLayerIds,this.brightness=t.brightness,this.extraShadowCaster=!!t.extraShadowCaster,this.tessellationStep=t.tessellationStep,this.scaleFactor=t.scaleFactor}parse(t,r,i,n,o){this.status="parsing",this.data=t,this.collisionBoxArray=new e.aR;const a=new e.dQ(Object.keys(t.layers).sort()),c=new e.dR(this.tileID,this.promoteId);c.bucketLayerIDs=[];const u={},h=new e.dS(256,256),d={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:h,availableImages:i,brightness:this.brightness},p=r.familiesBySource[this.source];for(const r in p){const n=t.layers[r];if(!n)continue;let o=!1,s=!1,h=!1;for(const e of p[r])"symbol"===e[0].type?o=!0:s=!0,e[0].is3D()&&"model"!==e[0].type&&(h=!0);if(this.extraShadowCaster&&!h)continue;if(!0===this.isSymbolTile&&!o)continue;if(!1===this.isSymbolTile&&!s)continue;1===n.version&&e.w(`Vector tile source "${this.source}" layer "${r}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const f=a.encode(r),m=[];for(let e=0,t=0;e<n.length;e++){const i=n.feature(e),o=c.getId(i,r);if(this.localizableLayerIds&&this.localizableLayerIds.has(r)){const e=i.properties?i.properties.worldview:null;if(this.worldview&&"string"==typeof e)if("all"===e)i.properties.$localized=!0;else{if(!e.split(",").includes(this.worldview))continue;i.properties.$localized=!0,i.properties.worldview=this.worldview}}m.push({feature:i,id:o,index:t,sourceLayerIndex:f}),t++}for(const t of p[r]){const r=t[0];(!this.extraShadowCaster||r.is3D()&&"model"!==r.type)&&(void 0!==this.isSymbolTile&&"symbol"===r.type!==this.isSymbolTile||r.minzoom&&this.zoom<Math.floor(r.minzoom)||r.maxzoom&&this.zoom>=r.maxzoom||"none"!==r.visibility&&(l(t,this.zoom,d.brightness,i),(u[r.id]=r.createBucket({index:c.bucketLayerIDs.length,layers:t,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:f,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep})).populate(m,d,this.tileID.canonical,this.tileTransform),c.bucketLayerIDs.push(t.map((t=>e.av(t.id,t.scope))))))}}let f,m,_,g;h.trim();const y={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},x=()=>{if(f)return this.status="done",o(f);if(this.extraShadowCaster)this.status="done",o(null,{buckets:e.be(u).filter((e=>!e.isEmpty())),featureIndex:c,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:d.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(m&&_&&g){const t=new s(m),r=new e.dU(_,g,this.lut);for(const n in u){const o=u[n];o instanceof e.aS?(l(o.layers,this.zoom,d.brightness,i),e.dV(o,m,t.positions,_,r.iconPositions,this.showCollisionBoxes,i,this.tileID.canonical,this.tileZoom,this.projection,this.scaleFactor,this.brightness)):o.hasPattern&&(o instanceof e.aY||o instanceof e.aZ||o instanceof e.d0)&&(l(o.layers,this.zoom,d.brightness,i),o.addFeatures(d,this.tileID.canonical,r.patternPositions,i,this.tileTransform,this.brightness))}this.status="done",o(null,{buckets:e.be(u).filter((e=>!e.isEmpty())),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,lineAtlas:h,imageAtlas:r,brightness:d.brightness})}};if(!this.extraShadowCaster){const t=e.dT(d.glyphDependencies,(e=>Object.keys(e).map(Number)));Object.keys(t).length?n.send("getGlyphs",{uid:this.uid,stacks:t,scope:this.scope},((e,t)=>{f||(f=e,m=t,x())}),void 0,!1,y):m={};const r=Object.keys(d.iconDependencies);r.length?n.send("getImages",{icons:r,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},((e,t)=>{f||(f=e,_=t,x())}),void 0,!1,y):_={};const i=Object.keys(d.patternDependencies);i.length?n.send("getImages",{icons:i,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},((e,t)=>{f||(f=e,g=t,x())}),void 0,!1,y):g={}}x()}}function l(t,r,i,n){const o=new e.a3(r,{brightness:i});for(const e of t)e.recalculate(o,n)}class c extends e.E{constructor(t,r,i,n,o,s){super(),this.actor=t,this.layerIndex=r,this.availableImages=i,this.loadVectorData=o||e.aw,this.loading={},this.loaded={},this.deduped=new e.au(t.scheduler),this.isSpriteLoaded=n,this.scheduler=t.scheduler,this.brightness=s}loadTile(r,i){const n=r.uid,o=r&&r.request,s=o&&o.collectResourceTiming,l=this.loading[n]=new a(r);l.abort=this.loadVectorData(r,((a,c)=>{const u=!this.loading[n];if(delete this.loading[n],u||a||!c)return l.status="done",u||(this.loaded[n]=l),i(a);const h=c.rawData,d={};c.expires&&(d.expires=c.expires),c.cacheControl&&(d.cacheControl=c.cacheControl),l.vectorTile=c.vectorTile||new e.dW.VectorTile(new e.bc(h));const p=()=>{l.parse(l.vectorTile,this.layerIndex,this.availableImages,this.actor,((r,n)=>{if(r||!n)return i(r);const a={};if(s){const e=t(o);e.length>0&&(a.resourceTiming=JSON.parse(JSON.stringify(e)))}i(null,e.l({rawTileData:h.slice(0)},n,d,a))}))};this.isSpriteLoaded?p():this.once("isSpriteLoaded",(()=>{this.scheduler?this.scheduler.add(p,{type:"parseTile",isSymbolTile:r.isSymbolTile,zoom:r.tileZoom}):p()})),this.loaded=this.loaded||{},this.loaded[n]=l}))}reloadTile(t,r){const i=this.loaded,n=t.uid;if(i&&i[n]){const o=i[n];o.scaleFactor=t.scaleFactor,o.showCollisionBoxes=t.showCollisionBoxes,o.projection=t.projection,o.brightness=t.brightness,o.tileTransform=e.aL(t.tileID.canonical,t.projection),o.extraShadowCaster=t.extraShadowCaster,o.lut=t.lut;const s=(e,t)=>{const i=o.reloadCallback;i&&(delete o.reloadCallback,o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,i)),r(e,t)};"parsing"===o.status?o.reloadCallback=s:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}else r(null,void 0)}abortTile(e,t){const r=e.uid,i=this.loading[r];i&&(i.abort&&i.abort(),delete this.loading[r]),t()}removeTile(e,t){const r=this.loaded,i=e.uid;r&&r[i]&&delete r[i],t()}}class u{loadTile(t,r){const{uid:i,encoding:n,rawImageData:o,padding:s}=t,a=ImageBitmap&&o instanceof ImageBitmap?this.getImageData(o,s):o;r(null,new e.dX(i,a,n,s<1))}getImageData(e,t){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);const r=this.offscreenCanvasContext.getImageData(-t,-t,e.width+2*t,e.height+2*t);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),r}}e.bb.setPbf(e.bc);class h{decodeRasterArray({task:t,buffer:r},i){e.bb.performDecoding(r,t).then((e=>{i(null,e)}),(e=>{i(e)}))}}const d=e.dW.VectorTileFeature.prototype.toGeoJSON;class p{constructor(t){this._feature=t,this.extent=e.ab,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10))}loadGeometry(){if(1===this._feature.type){const t=[];for(const r of this._feature.geometry)t.push([new e.P(r[0],r[1])]);return t}{const t=[];for(const r of this._feature.geometry){const i=[];for(const t of r)i.push(new e.P(t[0],t[1]));t.push(i)}return t}}toGeoJSON(e,t,r){return d.call(this,e,t,r)}}class f{constructor(t){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=e.ab,this.length=t.length,this._features=t}feature(e){return new p(this._features[e])}}const m=64/4096,_=128;class g{constructor(){this.features=new Map}clear(){this.features.clear()}load(e=[],t){for(const r of e){const e=r.id;if(null==e)continue;let i=this.features.get(e);i&&this.updateCache(i,t),r.geometry?(i=x(r),this.updateCache(i,t),this.features.set(e,i)):this.features.delete(e),this.updateCache(i,t)}}updateCache(e,t){for(const{canonical:r,uid:i}of Object.values(t)){const{z:n,x:o,y:s}=r;y(e,Math.pow(2,n),o,s)&&delete t[i]}}getTile(e,t,r){const i=Math.pow(2,e),n=[];for(const e of this.features.values())y(e,i,t,r)&&n.push(T(e,i,t,r));return{features:n}}getFeatures(){return[...this.features.values()]}}function y({minX:e,minY:t,maxX:r,maxY:i},n,o,s){return e<(o+1+m)/n&&t<(s+1+m)/n&&r>(o-m)/n&&i>(s-m)/n}function x(e){const{id:t,geometry:r,properties:i}=e;if(!r)return;if("GeometryCollection"===r.type)throw new Error("GeometryCollection not supported in dynamic mode.");const{type:n,coordinates:o}=r,s={id:t,type:1,geometry:[],tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},a=s.geometry;if("Point"===n)v(o,a,s);else if("MultiPoint"===n)for(const e of o)v(e,a,s);else if("LineString"===n)s.type=2,b(o,a,s);else if("MultiLineString"===n)s.type=2,w(o,a,s);else if("Polygon"===n)s.type=3,w(o,a,s,!0);else{if("MultiPolygon"!==n)throw new Error("Input data is not a valid GeoJSON object.");s.type=3;for(const e of o)w(e,a,s,!0)}return s}function v([t,r],i,n){const o=e.am(t);let s=e.at(r);s=s<0?0:s>1?1:s,i.push(o,s),n.minX=Math.min(n.minX,o),n.minY=Math.min(n.minY,s),n.maxX=Math.max(n.maxX,o),n.maxY=Math.max(n.maxY,s)}function b(e,t,r,i=!1,n=!1){const o=[];for(const t of e)v(t,o,r);t.push(o),i&&function(e,t){let r=0;for(let t=0,i=e.length,n=i-2;t<i;n=t,t+=2)r+=(e[t]-e[n])*(e[t+1]+e[n+1]);if(r>0===t)for(let t=0,r=e.length;t<r/2;t+=2){const i=e[t],n=e[t+1];e[t]=e[r-2-t],e[t+1]=e[r-1-t],e[r-2-t]=i,e[r-1-t]=n}}(o,n)}function w(e,t,r,i=!1){for(let n=0;n<e.length;n++)b(e[n],t,r,i,0===n)}function T(t,r,i,n){const{id:o,type:s,geometry:a,tags:l}=t,c=[];if(1===s)!function(t,r,i,n,o){for(let s=0;s<t.length;s+=2){const a=Math.round(e.ab*(t[s+0]*r-i)),l=Math.round(e.ab*(t[s+1]*r-n));o.push([a,l])}}(a,r,i,n,c);else for(const e of a)S(e,r,i,n,c);return{id:o,type:s,geometry:c,tags:l}}function S(t,r,i,n,o){const s=-_,a=e.ab+_;let l;for(let c=0;c<t.length-2;c+=2){let u=Math.round(e.ab*(t[c+0]*r-i)),h=Math.round(e.ab*(t[c+1]*r-n)),d=Math.round(e.ab*(t[c+2]*r-i)),p=Math.round(e.ab*(t[c+3]*r-n));const f=d-u,m=p-h;u<s&&d<s||(u<s?(h+=Math.round(m*((s-u)/f)),u=s):d<s&&(p=h+Math.round(m*((s-u)/f)),d=s),h<s&&p<s||(h<s?(u+=Math.round(f*((s-h)/m)),h=s):p<s&&(d=u+Math.round(f*((s-h)/m)),p=s),u>=a&&d>=a||(u>=a?(h+=Math.round(m*((a-u)/f)),u=a):d>=a&&(p=h+Math.round(m*((a-u)/f)),d=a),h>=a&&p>=a||(h>=a?(u+=Math.round(f*((a-h)/m)),h=a):p>=a&&(d=u+Math.round(f*((a-h)/m)),p=a),l&&u===l[l.length-1][0]&&h===l[l.length-1][1]||(l=[[u,h]],o.push(l)),l.push([d,p])))))}}var E,M,A,C={exports:{}},I=function(){if(A)return C.exports;A=1;var t=e.d_(),r=function(){if(M)return E;M=1;var t=e.dY(),r=e.dZ().VectorTileFeature;function i(e,t){this.options=t||{},this.features=e,this.length=e.length}function n(e,t){this.id="number"==typeof e.id?e.id:void 0,this.type=e.type,this.rawGeometry=1===e.type?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=t||4096}return E=i,i.prototype.feature=function(e){return new n(this.features[e],this.options.extent)},n.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var r=0;r<e.length;r++){for(var i=e[r],n=[],o=0;o<i.length;o++)n.push(new t(i[o][0],i[o][1]));this.geometry.push(n)}return this.geometry},n.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,t=1/0,r=-1/0,i=1/0,n=-1/0,o=0;o<e.length;o++)for(var s=e[o],a=0;a<s.length;a++){var l=s[a];t=Math.min(t,l.x),r=Math.max(r,l.x),i=Math.min(i,l.y),n=Math.max(n,l.y)}return[t,i,r,n]},n.prototype.toGeoJSON=r.prototype.toGeoJSON,E}();function i(e){var r=new t;return function(e,t){for(var r in e.layers)t.writeMessage(3,n,e.layers[r])}(e,r),r.finish()}function n(e,t){var r;t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||""),t.writeVarintField(5,e.extent||4096);var i={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<e.length;r++)i.feature=e.feature(r),t.writeMessage(2,o,i);var n=i.keys;for(r=0;r<n.length;r++)t.writeStringField(3,n[r]);var s=i.values;for(r=0;r<s.length;r++)t.writeMessage(4,u,s[r])}function o(e,t){var r=e.feature;void 0!==r.id&&t.writeVarintField(1,r.id),t.writeMessage(2,s,e),t.writeVarintField(3,r.type),t.writeMessage(4,c,r)}function s(e,t){var r=e.feature,i=e.keys,n=e.values,o=e.keycache,s=e.valuecache;for(var a in r.properties){var l=r.properties[a],c=o[a];if(null!==l){void 0===c&&(i.push(a),o[a]=c=i.length-1),t.writeVarint(c);var u=typeof l;"string"!==u&&"boolean"!==u&&"number"!==u&&(l=JSON.stringify(l));var h=u+":"+l,d=s[h];void 0===d&&(n.push(l),s[h]=d=n.length-1),t.writeVarint(d)}}}function a(e,t){return(t<<3)+(7&e)}function l(e){return e<<1^e>>31}function c(e,t){for(var r=e.loadGeometry(),i=e.type,n=0,o=0,s=r.length,c=0;c<s;c++){var u=r[c],h=1;1===i&&(h=u.length),t.writeVarint(a(1,h));for(var d=3===i?u.length-1:u.length,p=0;p<d;p++){1===p&&1!==i&&t.writeVarint(a(2,d-1));var f=u[p].x-n,m=u[p].y-o;t.writeVarint(l(f)),t.writeVarint(l(m)),n+=f,o+=m}3===i&&t.writeVarint(a(7,1))}}function u(e,t){var r=typeof e;"string"===r?t.writeStringField(1,e):"boolean"===r?t.writeBooleanField(7,e):"number"===r&&(e%1!=0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e))}return C.exports=i,C.exports.fromVectorTileJs=i,C.exports.fromGeojsonVt=function(e,t){t=t||{};var n={};for(var o in e)n[o]=new r(e[o].features,t),n[o].name=o,n[o].version=t.version,n[o].extent=t.extent;return i({layers:n})},C.exports.GeoJSONWrapper=r,C.exports}(),P=e.d$(I);const R={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},z=Math.fround||(D=new Float32Array(1),e=>(D[0]=+e,D[0]));var D;const k=3,O=5,L=6;class B{constructor(e){this.options=Object.assign(Object.create(R),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){const{log:t,minZoom:r,maxZoom:i}=this.options;t&&console.time("total time");const n=`prepare ${e.length} points`;t&&console.time(n),this.points=e;const o=[];for(let t=0;t<e.length;t++){const r=e[t];if(!r.geometry)continue;const[i,n]=r.geometry.coordinates,s=z(V(i)),a=z(j(n));o.push(s,a,1/0,t,-1,1),this.options.reduce&&o.push(0)}let s=this.trees[i+1]=this._createTree(o);t&&console.timeEnd(n);for(let e=i;e>=r;e--){const r=+Date.now();s=this.trees[e]=this._createTree(this._cluster(s,e)),t&&console.log("z%d: %d clusters in %dms",e,s.numItems,+Date.now()-r)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let r=((e[0]+180)%360+360)%360-180;const i=Math.max(-90,Math.min(90,e[1]));let n=180===e[2]?180:((e[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)r=-180,n=180;else if(r>n){const e=this.getClusters([r,i,180,o],t),s=this.getClusters([-180,i,n,o],t);return e.concat(s)}const s=this.trees[this._limitZoom(t)],a=s.range(V(r),j(o),V(n),j(i)),l=s.data,c=[];for(const e of a){const t=this.stride*e;c.push(l[t+O]>1?F(l,t,this.clusterProps):this.points[l[t+k]])}return c}getChildren(e){const t=this._getOriginId(e),r=this._getOriginZoom(e),i="No cluster with the specified id.",n=this.trees[r];if(!n)throw new Error(i);const o=n.data;if(t*this.stride>=o.length)throw new Error(i);const s=this.options.radius/(this.options.extent*Math.pow(2,r-1)),a=n.within(o[t*this.stride],o[t*this.stride+1],s),l=[];for(const t of a){const r=t*this.stride;o[r+4]===e&&l.push(o[r+O]>1?F(o,r,this.clusterProps):this.points[o[r+k]])}if(0===l.length)throw new Error(i);return l}getLeaves(e,t,r){const i=[];return this._appendLeaves(i,e,t=t||10,r=r||0,0),i}getTile(e,t,r){const i=this.trees[this._limitZoom(e)],n=Math.pow(2,e),{extent:o,radius:s}=this.options,a=s/o,l=(r-a)/n,c=(r+1+a)/n,u={features:[]};return this._addTileFeatures(i.range((t-a)/n,l,(t+1+a)/n,c),i.data,t,r,n,u),0===t&&this._addTileFeatures(i.range(1-a/n,l,1,c),i.data,n,r,n,u),t===n-1&&this._addTileFeatures(i.range(0,l,a/n,c),i.data,-1,r,n,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const r=this.getChildren(e);if(t++,1!==r.length)break;e=r[0].properties.cluster_id}return t}_appendLeaves(e,t,r,i,n){const o=this.getChildren(t);for(const t of o){const o=t.properties;if(o&&o.cluster?n+o.point_count<=i?n+=o.point_count:n=this._appendLeaves(e,o.cluster_id,r,i,n):n<i?n++:e.push(t),e.length===r)break}return n}_createTree(t){const r=new e.bz(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let e=0;e<t.length;e+=this.stride)r.add(t[e],t[e+1]);return r.finish(),r.data=t,r}_addTileFeatures(e,t,r,i,n,o){for(const s of e){const e=s*this.stride,a=t[e+O]>1;let l,c,u;if(a)l=N(t,e,this.clusterProps),c=t[e],u=t[e+1];else{const r=this.points[t[e+k]];l=r.properties;const[i,n]=r.geometry.coordinates;c=V(i),u=j(n)}const h={type:1,geometry:[[Math.round(this.options.extent*(c*n-r)),Math.round(this.options.extent*(u*n-i))]],tags:l};let d;d=a||this.options.generateId?t[e+k]:this.points[t[e+k]].id,void 0!==d&&(h.id=d),o.features.push(h)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:r,extent:i,reduce:n,minPoints:o}=this.options,s=r/(i*Math.pow(2,t)),a=e.data,l=[],c=this.stride;for(let r=0;r<a.length;r+=c){if(a[r+2]<=t)continue;a[r+2]=t;const i=a[r],u=a[r+1],h=e.within(a[r],a[r+1],s),d=a[r+O];let p=d;for(const e of h){const r=e*c;a[r+2]>t&&(p+=a[r+O])}if(p>d&&p>=o){let e,o=i*d,s=u*d,f=-1;const m=(r/c<<5)+(t+1)+this.points.length;for(const i of h){const l=i*c;if(a[l+2]<=t)continue;a[l+2]=t;const u=a[l+O];o+=a[l]*u,s+=a[l+1]*u,a[l+4]=m,n&&(e||(e=this._map(a,r,!0),f=this.clusterProps.length,this.clusterProps.push(e)),n(e,this._map(a,l)))}a[r+4]=m,l.push(o/p,s/p,1/0,m,-1,p),n&&l.push(f)}else{for(let e=0;e<c;e++)l.push(a[r+e]);if(p>1)for(const e of h){const r=e*c;if(!(a[r+2]<=t)){a[r+2]=t;for(let e=0;e<c;e++)l.push(a[r+e])}}}}return l}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,r){if(e[t+O]>1){const i=this.clusterProps[e[t+L]];return r?Object.assign({},i):i}const i=this.points[e[t+k]].properties,n=this.options.map(i);return r&&n===i?Object.assign({},n):n}}function F(e,t,r){return{type:"Feature",id:e[t+k],properties:N(e,t,r),geometry:{type:"Point",coordinates:[(i=e[t],360*(i-.5)),U(e[t+1])]}};var i}function N(e,t,r){const i=e[t+O],n=i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?Math.round(i/100)/10+"k":i,o=e[t+L],s=-1===o?{}:Object.assign({},r[o]);return Object.assign(s,{cluster:!0,cluster_id:e[t+k],point_count:i,point_count_abbreviated:n})}function V(e){return e/360+.5}function j(e){const t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function U(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function $(e,t,r,i){let n=i;const o=t+(r-t>>1);let s,a=r-t;const l=e[t],c=e[t+1],u=e[r],h=e[r+1];for(let i=t+3;i<r;i+=3){const t=G(e[i],e[i+1],l,c,u,h);if(t>n)s=i,n=t;else if(t===n){const e=Math.abs(i-o);e<a&&(s=i,a=e)}}n>i&&(s-t>3&&$(e,t,s,i),e[s+2]=n,r-s>3&&$(e,s,r,i))}function G(e,t,r,i,n,o){let s=n-r,a=o-i;if(0!==s||0!==a){const l=((e-r)*s+(t-i)*a)/(s*s+a*a);l>1?(r=n,i=o):l>0&&(r+=s*l,i+=a*l)}return s=e-r,a=t-i,s*s+a*a}function q(e,t,r,i){const n={id:e??null,type:t,geometry:r,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===t||"MultiPoint"===t||"LineString"===t)H(n,r);else if("Polygon"===t)H(n,r[0]);else if("MultiLineString"===t)for(const e of r)H(n,e);else if("MultiPolygon"===t)for(const e of r)H(n,e[0]);return n}function H(e,t){for(let r=0;r<t.length;r+=3)e.minX=Math.min(e.minX,t[r]),e.minY=Math.min(e.minY,t[r+1]),e.maxX=Math.max(e.maxX,t[r]),e.maxY=Math.max(e.maxY,t[r+1])}function W(e,t,r,i){if(!t.geometry)return;const n=t.geometry.coordinates;if(n&&0===n.length)return;const o=t.geometry.type,s=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2);let a=[],l=t.id;if(r.promoteId?l=t.properties[r.promoteId]:r.generateId&&(l=i||0),"Point"===o)Z(n,a);else if("MultiPoint"===o)for(const e of n)Z(e,a);else if("LineString"===o)X(n,a,s,!1);else if("MultiLineString"===o){if(r.lineMetrics){for(const r of n)a=[],X(r,a,s,!1),e.push(q(l,"LineString",a,t.properties));return}Y(n,a,s,!1)}else if("Polygon"===o)Y(n,a,s,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(const n of t.geometry.geometries)W(e,{id:l,geometry:n,properties:t.properties},r,i);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const e of n){const t=[];Y(e,t,s,!0),a.push(t)}}e.push(q(l,o,a,t.properties))}function Z(e,t){t.push(J(e[0]),K(e[1]),0)}function X(e,t,r,i){let n,o,s=0;for(let r=0;r<e.length;r++){const a=J(e[r][0]),l=K(e[r][1]);t.push(a,l,0),r>0&&(s+=i?(n*l-a*o)/2:Math.sqrt(Math.pow(a-n,2)+Math.pow(l-o,2))),n=a,o=l}const a=t.length-3;t[2]=1,$(t,0,a,r),t[a+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size}function Y(e,t,r,i){for(let n=0;n<e.length;n++){const o=[];X(e[n],o,r,i),t.push(o)}}function J(e){return e/360+.5}function K(e){const t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function Q(e,t,r,i,n,o,s,a){if(i/=t,o>=(r/=t)&&s<i)return e;if(s<r||o>=i)return null;const l=[];for(const t of e){const e=t.geometry;let o=t.type;const s=0===n?t.minX:t.minY,c=0===n?t.maxX:t.maxY;if(s>=r&&c<i){l.push(t);continue}if(c<r||s>=i)continue;let u=[];if("Point"===o||"MultiPoint"===o)ee(e,u,r,i,n);else if("LineString"===o)te(e,u,r,i,n,!1,a.lineMetrics);else if("MultiLineString"===o)ie(e,u,r,i,n,!1);else if("Polygon"===o)ie(e,u,r,i,n,!0);else if("MultiPolygon"===o)for(const t of e){const e=[];ie(t,e,r,i,n,!0),e.length&&u.push(e)}if(u.length){if(a.lineMetrics&&"LineString"===o){for(const e of u)l.push(q(t.id,o,e,t.tags));continue}"LineString"!==o&&"MultiLineString"!==o||(1===u.length?(o="LineString",u=u[0]):o="MultiLineString"),"Point"!==o&&"MultiPoint"!==o||(o=3===u.length?"Point":"MultiPoint"),l.push(q(t.id,o,u,t.tags))}}return l.length?l:null}function ee(e,t,r,i,n){for(let o=0;o<e.length;o+=3){const s=e[o+n];s>=r&&s<=i&&ne(t,e[o],e[o+1],e[o+2])}}function te(e,t,r,i,n,o,s){let a=re(e);const l=0===n?oe:se;let c,u,h=e.start;for(let d=0;d<e.length-3;d+=3){const p=e[d],f=e[d+1],m=e[d+2],_=e[d+3],g=e[d+4],y=0===n?p:f,x=0===n?_:g;let v=!1;s&&(c=Math.sqrt(Math.pow(p-_,2)+Math.pow(f-g,2))),y<r?x>r&&(u=l(a,p,f,_,g,r),s&&(a.start=h+c*u)):y>i?x<i&&(u=l(a,p,f,_,g,i),s&&(a.start=h+c*u)):ne(a,p,f,m),x<r&&y>=r&&(u=l(a,p,f,_,g,r),v=!0),x>i&&y<=i&&(u=l(a,p,f,_,g,i),v=!0),!o&&v&&(s&&(a.end=h+c*u),t.push(a),a=re(e)),s&&(h+=c)}let d=e.length-3;const p=e[d],f=e[d+1],m=0===n?p:f;m>=r&&m<=i&&ne(a,p,f,e[d+2]),d=a.length-3,o&&d>=3&&(a[d]!==a[0]||a[d+1]!==a[1])&&ne(a,a[0],a[1],a[2]),a.length&&t.push(a)}function re(e){const t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function ie(e,t,r,i,n,o){for(const s of e)te(s,t,r,i,n,o,!1)}function ne(e,t,r,i){e.push(t,r,i)}function oe(e,t,r,i,n,o){const s=(o-t)/(i-t);return ne(e,o,r+(n-r)*s,1),s}function se(e,t,r,i,n,o){const s=(o-r)/(n-r);return ne(e,t+(i-t)*s,o,1),s}function ae(e,t){const r=[];for(let i=0;i<e.length;i++){const n=e[i],o=n.type;let s;if("Point"===o||"MultiPoint"===o||"LineString"===o)s=le(n.geometry,t);else if("MultiLineString"===o||"Polygon"===o){s=[];for(const e of n.geometry)s.push(le(e,t))}else if("MultiPolygon"===o){s=[];for(const e of n.geometry){const r=[];for(const i of e)r.push(le(i,t));s.push(r)}}r.push(q(n.id,o,s,n.tags))}return r}function le(e,t){const r=[];r.size=e.size,void 0!==e.start&&(r.start=e.start,r.end=e.end);for(let i=0;i<e.length;i+=3)r.push(e[i]+t,e[i+1],e[i+2]);return r}function ce(e,t){if(e.transformed)return e;const r=1<<e.z,i=e.x,n=e.y;for(const o of e.features){const e=o.geometry,s=o.type;if(o.geometry=[],1===s)for(let s=0;s<e.length;s+=2)o.geometry.push(ue(e[s],e[s+1],t,r,i,n));else for(let s=0;s<e.length;s++){const a=[];for(let o=0;o<e[s].length;o+=2)a.push(ue(e[s][o],e[s][o+1],t,r,i,n));o.geometry.push(a)}}return e.transformed=!0,e}function ue(e,t,r,i,n,o){return[Math.round(r*(e*i-n)),Math.round(r*(t*i-o))]}function he(e,t,r,i,n){const o=t===n.maxZoom?0:n.tolerance/((1<<t)*n.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:e.length,source:null,x:r,y:i,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const t of e)de(s,t,o,n);return s}function de(e,t,r,i){const n=t.geometry,o=t.type,s=[];if(e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),"Point"===o||"MultiPoint"===o)for(let t=0;t<n.length;t+=3)s.push(n[t],n[t+1]),e.numPoints++,e.numSimplified++;else if("LineString"===o)pe(s,n,e,r,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(let t=0;t<n.length;t++)pe(s,n[t],e,r,"Polygon"===o,0===t);else if("MultiPolygon"===o)for(let t=0;t<n.length;t++){const i=n[t];for(let t=0;t<i.length;t++)pe(s,i[t],e,r,!0,0===t)}if(s.length){let r=t.tags||null;if("LineString"===o&&i.lineMetrics){r={};for(const e in t.tags)r[e]=t.tags[e];r.mapbox_clip_start=n.start/n.size,r.mapbox_clip_end=n.end/n.size}const a={geometry:s,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:r};null!==t.id&&(a.id=t.id),e.features.push(a)}}function pe(e,t,r,i,n,o){const s=i*i;if(i>0&&t.size<(n?s:i))return void(r.numPoints+=t.length/3);const a=[];for(let e=0;e<t.length;e+=3)(0===i||t[e+2]>s)&&(r.numSimplified++,a.push(t[e],t[e+1])),r.numPoints++;n&&function(e,t){let r=0;for(let t=0,i=e.length,n=i-2;t<i;n=t,t+=2)r+=(e[t]-e[n])*(e[t+1]+e[n+1]);if(r>0===t)for(let t=0,r=e.length;t<r/2;t+=2){const i=e[t],n=e[t+1];e[t]=e[r-2-t],e[t+1]=e[r-1-t],e[r-2-t]=i,e[r-1-t]=n}}(a,o),e.push(a)}const fe={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class me{constructor(e,t){const r=(t=this.options=function(e,t){for(const r in t)e[r]=t[r];return e}(Object.create(fe),t)).debug;if(r&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");let i=function(e,t){const r=[];if("FeatureCollection"===e.type)for(let i=0;i<e.features.length;i++)W(r,e.features[i],t,i);else W(r,"Feature"===e.type?e:{geometry:e},t);return r}(e,t);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),i=function(e,t){const r=t.buffer/t.extent;let i=e;const n=Q(e,1,-1-r,r,0,-1,2,t),o=Q(e,1,1-r,2+r,0,-1,2,t);return(n||o)&&(i=Q(e,1,-r,1+r,0,-1,2,t)||[],n&&(i=ae(n,1).concat(i)),o&&(i=i.concat(ae(o,-1)))),i}(i,t),i.length&&this.splitTile(i,0,0,0),r&&(i.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(e,t,r,i,n,o,s){const a=[e,t,r,i],l=this.options,c=l.debug;for(;a.length;){i=a.pop(),r=a.pop(),t=a.pop(),e=a.pop();const u=1<<t,h=_e(t,r,i);let d=this.tiles[h];if(!d&&(c>1&&console.time("creation"),d=this.tiles[h]=he(e,t,r,i,l),this.tileCoords.push({z:t,x:r,y:i}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,r,i,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));const e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(d.source=e,null==n){if(t===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue}else{if(t===l.maxZoom||t===n)continue;if(null!=n){const e=n-t;if(r!==o>>e||i!==s>>e)continue}}if(d.source=null,0===e.length)continue;c>1&&console.time("clipping");const p=.5*l.buffer/l.extent,f=.5-p,m=.5+p,_=1+p;let g=null,y=null,x=null,v=null,b=Q(e,u,r-p,r+m,0,d.minX,d.maxX,l),w=Q(e,u,r+f,r+_,0,d.minX,d.maxX,l);e=null,b&&(g=Q(b,u,i-p,i+m,1,d.minY,d.maxY,l),y=Q(b,u,i+f,i+_,1,d.minY,d.maxY,l),b=null),w&&(x=Q(w,u,i-p,i+m,1,d.minY,d.maxY,l),v=Q(w,u,i+f,i+_,1,d.minY,d.maxY,l),w=null),c>1&&console.timeEnd("clipping"),a.push(g||[],t+1,2*r,2*i),a.push(y||[],t+1,2*r,2*i+1),a.push(x||[],t+1,2*r+1,2*i),a.push(v||[],t+1,2*r+1,2*i+1)}}getTile(e,t,r){e=+e,t=+t,r=+r;const i=this.options,{extent:n,debug:o}=i;if(e<0||e>24)return null;const s=1<<e,a=_e(e,t=t+s&s-1,r);if(this.tiles[a])return ce(this.tiles[a],n);o>1&&console.log("drilling down to z%d-%d-%d",e,t,r);let l,c=e,u=t,h=r;for(;!l&&c>0;)c--,u>>=1,h>>=1,l=this.tiles[_e(c,u,h)];return l&&l.source?(o>1&&(console.log("found parent tile z%d-%d-%d",c,u,h),console.time("drilling down")),this.splitTile(l.source,c,u,h,e,t,r),o>1&&console.timeEnd("drilling down"),this.tiles[a]?ce(this.tiles[a],n):null):null}}function _e(e,t,r){return 32*((1<<e)*r+t)+e}function ge(e,t){const r=e.tileID.canonical;if(!this._geoJSONIndex)return void t(null,null);const i=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!i)return void t(null,null);const n=new f(i.features);let o=P(n);0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),t(null,{vectorTile:n,rawData:o.buffer})}class ye extends c{constructor(e,t,r,i,n,o){super(e,t,r,i,ge,o),n&&(this.loadGeoJSON=n),this._dynamicIndex=new g}loadData(r,i){const n=r&&r.request,o=n&&n.collectResourceTiming;this.loadGeoJSON(r,((s,a)=>{if(s||!a)return i(s);if("object"!=typeof a)return i(new Error(`Input data given to '${r.source}' is not a valid GeoJSON object.`));{try{if(r.filter){const t=e.M(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===t.result)throw new Error(t.value.map((e=>`${e.key}: ${e.message}`)).join(", "));a.features=a.features.filter((e=>t.value.evaluate({zoom:0},e)))}r.dynamic?("Feature"===a.type&&(a={type:"FeatureCollection",features:[a]}),r.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(a.features,this.loaded),r.cluster&&(a.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=r.cluster?new B(function({superclusterOptions:t,clusterProperties:r}){if(!r||!t)return t;const i={},n={},o={accumulated:null,zoom:0},s={properties:null},a=Object.keys(r);for(const t of a){const[o,s]=r[t],a=e.M(s),l=e.M("string"==typeof o?[o,["accumulated"],["get",t]]:o);i[t]=a.value,n[t]=l.value}return t.map=e=>{s.properties=e;const t={};for(const e of a)t[e]=i[e].evaluate(o,s);return t},t.reduce=(e,t)=>{s.properties=t;for(const t of a)o.accumulated=e[t],e[t]=n[t].evaluate(o,s)},t}(r)).load(a.features):r.dynamic?this._dynamicIndex:function(e,t){return new me(e,t)}(a,r.geojsonVtOptions)}catch(e){return i(e)}const s={};if(o){const e=t(n);e&&(s.resourceTiming={},s.resourceTiming[r.source]=JSON.parse(JSON.stringify(e)))}i(null,s)}}))}reloadTile(e,t){const r=this.loaded;return r&&r[e.uid]?e.partial?t(null,void 0):super.reloadTile(e,t):this.loadTile(e,t)}loadGeoJSON(t,r){if(t.request)e.n(t.request,r);else{if("string"!=typeof t.data)return r(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));try{return r(null,JSON.parse(t.data))}catch(e){return r(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(e,t){try{t(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId))}catch(e){t(e)}}getClusterChildren(e,t){try{t(null,this._geoJSONIndex.getChildren(e.clusterId))}catch(e){t(e)}}getClusterLeaves(e,t){try{t(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset))}catch(e){t(e)}}}class xe{constructor(t,r){this.tileID=new e.aA(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.tileZoom=t.tileZoom,this.uid=t.uid,this.zoom=t.zoom,this.canonical=t.tileID.canonical,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=t.projection,this.brightness=r}parse(t,r,i,n){this.status="parsing";const o=new e.aA(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),s=[],a=r.familiesBySource[i.source],l=new e.dR(o,i.promoteId);return l.bucketLayerIDs=[],l.is3DTile=!0,e.e0(t).then((t=>{if(!t)return n(new Error("Could not parse tile"));const r=e.e1(t,1/e.c9(i.tileID.canonical)),c=t.json.extensionsUsed&&t.json.extensionsUsed.includes("MAPBOX_mesh_features")||t.json.asset.extras&&t.json.asset.extras.MAPBOX_mesh_features,u=t.json.extensionsUsed&&t.json.extensionsUsed.includes("EXT_meshopt_compression"),h=new e.a3(this.zoom,{brightness:this.brightness});for(const t in a)for(const i of a[t]){const t=i[0];l.bucketLayerIDs.push(i.map((t=>e.av(t.id,t.scope)))),t.recalculate(h,[]);const n=new e.e2(i,r,o,c,u,this.brightness,l);c||(n.needsUpload=!0),s.push(n),n.evaluate(t)}this.status="done",n(null,{buckets:s,featureIndex:l,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})})).catch((e=>n(new Error(e.message))))}}class ve{constructor(e,t,r,i,n,o){this.actor=e,this.layerIndex=t,this.availableImages=r,this.brightness=o,this.loading={},this.loaded={}}loadTile(t,r){const i=t.uid,n=this.loading[i]=new xe(t,this.brightness);e.bd(t.request,((e,o)=>{const s=!this.loading[i];return delete this.loading[i],s||e?(n.status="done",s||(this.loaded[i]=n),r(e)):o&&0!==o.byteLength?void n.parse(o,this.layerIndex,t,((e,t)=>{n.status="done",this.loaded=this.loaded||{},this.loaded[i]=n,e||!t?r(e):r(null,t)})):(n.status="done",this.loaded[i]=n,r())}))}reloadTile(e,t){const r=this.loaded,i=e.uid;if(r&&r[i]){const n=r[i];n.projection=e.projection,n.brightness=e.brightness;const o=(r,i)=>{n.reloadCallback&&(delete n.reloadCallback,this.loadTile(e,t)),t(r,i)};"parsing"===n.status?n.reloadCallback=o:"done"===n.status&&this.loadTile(e,t)}}abortTile(e,t){const r=e.uid;this.loading[r]&&delete this.loading[r],t()}removeTile(e,t){const r=this.loaded,i=e.uid;r&&r[i]&&delete r[i],t()}}class be{constructor(t){this.self=t,this.actor=new e.e3(t,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=e.bM({name:"mercator"}),this.workerSourceTypes={vector:c,geojson:ye,"batched-model":ve},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(e,t)=>{if(this.workerSourceTypes[e])throw new Error(`Worker source with name "${e}" already registered.`);this.workerSourceTypes[e]=t},this.self.registerRTLTextPlugin=t=>{if(e.e4.isParsed())throw new Error("RTL text plugin already registered.");e.e4.applyArabicShaping=t.applyArabicShaping,e.e4.processBidirectionalText=t.processBidirectionalText,e.e4.processStyledBidirectionalText=t.processStyledBidirectionalText}}clearCaches(e,t,r){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],delete this.rasterArrayWorkerSource,r()}checkIfReady(e,t,r){r()}setReferrer(e,t){this.referrer=t}spriteLoaded(t,{scope:r,isLoaded:i}){if(this.isSpriteLoaded[t]||(this.isSpriteLoaded[t]={}),this.isSpriteLoaded[t][r]=i,this.workerSources[t]&&this.workerSources[t][r])for(const n in this.workerSources[t][r]){const o=this.workerSources[t][r][n];for(const t in o){const r=o[t];r instanceof c&&(r.isSpriteLoaded=i,r.fire(new e.x("isSpriteLoaded")))}}}setImages(e,{scope:t,images:r},i){if(this.availableImages[e]||(this.availableImages[e]={}),this.availableImages[e][t]=r,this.workerSources[e]&&this.workerSources[e][t]){for(const i in this.workerSources[e][t]){const n=this.workerSources[e][t][i];for(const e in n)n[e].availableImages=r}i()}else i()}setProjection(t,r){this.projections[t]=e.bM(r)}setBrightness(e,t,r){this.brightness=t,r()}setLayers(e,t,r){this.getLayerIndex(e,t.scope).replace(t.layers,t.options),r()}updateLayers(e,t,r){this.getLayerIndex(e,t.scope).update(t.layers,t.removedIds,t.options),r()}loadTile(e,t,r){t.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,t.type,t.source,t.scope).loadTile(t,r)}loadDEMTile(e,t,r){this.getDEMWorkerSource(e,t.source,t.scope).loadTile(t,r)}decodeRasterArray(e,t,r){this.getRasterArrayWorkerSource().decodeRasterArray(t,r)}reloadTile(e,t,r){t.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,t.type,t.source,t.scope).reloadTile(t,r)}abortTile(e,t,r){this.getWorkerSource(e,t.type,t.source,t.scope).abortTile(t,r)}removeTile(e,t,r){this.getWorkerSource(e,t.type,t.source,t.scope).removeTile(t,r)}removeSource(e,t,r){if(!(this.workerSources[e]&&this.workerSources[e][t.scope]&&this.workerSources[e][t.scope][t.type]&&this.workerSources[e][t.scope][t.type][t.source]))return;const i=this.workerSources[e][t.scope][t.type][t.source];delete this.workerSources[e][t.scope][t.type][t.source],void 0!==i.removeSource?i.removeSource(t,r):r()}loadWorkerSource(e,t,r){try{this.self.importScripts(t.url),r()}catch(e){r(e.toString())}}syncRTLPluginState(t,r,i){try{e.e4.setState(r);const t=e.e4.getPluginURL();if(e.e4.isLoaded()&&!e.e4.isParsed()&&null!=t){this.self.importScripts(t);const r=e.e4.isParsed();i(r?void 0:new Error(`RTL Text Plugin failed to import scripts from ${t}`),r)}}catch(e){i(e.toString())}}setDracoUrl(e,t){this.dracoUrl=t}getAvailableImages(e,t){this.availableImages[e]||(this.availableImages[e]={});let r=this.availableImages[e][t];return r||(r=[]),r}getLayerIndex(e,t){this.layerIndexes[e]||(this.layerIndexes[e]={});let r=this.layerIndexes[e][t];return r||(r=this.layerIndexes[e][t]=new n,r.scope=t),r}getWorkerSource(e,t,r,i){return this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][i]||(this.workerSources[e][i]={}),this.workerSources[e][i][t]||(this.workerSources[e][i][t]={}),this.isSpriteLoaded[e]||(this.isSpriteLoaded[e]={}),this.workerSources[e][i][t][r]||(this.workerSources[e][i][t][r]=new this.workerSourceTypes[t]({send:(t,r,i,n,o,s)=>{this.actor.send(t,r,i,e,o,s)},scheduler:this.actor.scheduler},this.getLayerIndex(e,i),this.getAvailableImages(e,i),this.isSpriteLoaded[e][i],void 0,this.brightness)),this.workerSources[e][i][t][r]}getDEMWorkerSource(e,t,r){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][r]||(this.demWorkerSources[e][r]={}),this.demWorkerSources[e][r][t]||(this.demWorkerSources[e][r][t]=new u),this.demWorkerSources[e][r][t]}getRasterArrayWorkerSource(){return this.rasterArrayWorkerSource||(this.rasterArrayWorkerSource=new h),this.rasterArrayWorkerSource}enforceCacheSizeLimit(t,r){e.e5(r)}getWorkerPerformanceMetrics(e,t,r){r(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new be(self)),be})),i(["./shared"],(function(e){var t="3.8.0";const r={create:"create",load:"load",fullLoad:"fullLoad"},i={mark(e){performance.mark(e)},measure(e,t,r){performance.measure(e,t,r)}};function n(t){const r=t.name.split("?")[0];return e.a(r)&&r.includes("mapbox-gl.js")?"javascript":e.a(r)&&r.includes("mapbox-gl.css")?"css":e.b(r)?"fontRange":e.c(r)?"sprite":e.i(r)?"style":e.d(r)?"tilejson":"other"}var o,s={},a=function(){if(o)return s;function e(e){return!t(e)}function t(t){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var e,t,r=new Blob([""],{type:"text/javascript"}),i=URL.createObjectURL(r);try{t=new Worker(i),e=!0}catch(t){e=!1}return t&&t.terminate(),URL.revokeObjectURL(i),e}()?function(){var e=document.createElement("canvas");e.width=e.height=1;var t=e.getContext("2d");if(!t)return!1;var r=t.getImageData(0,0,1,1);return r&&r.width===e.width}()?(void 0===r[i=t&&t.failIfMajorPerformanceCaveat]&&(r[i]=function(t){var r,i=function(t){var r=document.createElement("canvas"),i=Object.create(e.webGLContextAttributes);return i.failIfMajorPerformanceCaveat=t,r.getContext("webgl2",i)}(t);if(!i)return!1;try{r=i.createShader(i.VERTEX_SHADER)}catch(e){return!1}return!(!r||i.isContextLost())&&(i.shaderSource(r,"void main() {}"),i.compileShader(r),!0===i.getShaderParameter(r,i.COMPILE_STATUS))}(i)),r[i]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var i}o=1,s.supported=e,s.notSupportedReason=t;var r={};return e.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},s}();function l(e,t,r){const i=document.createElement(e);return null!=t&&(i.className=t),r&&r.appendChild(i),i}function c(e,t,r){const i=document.createElementNS("http://www.w3.org/2000/svg",e);for(const e of Object.keys(t))i.setAttributeNS(null,e,String(t[e]));return r&&r.appendChild(i),i}const u="undefined"!=typeof document?document.documentElement&&document.documentElement.style:null,h=u&&void 0!==u.userSelect?"userSelect":"WebkitUserSelect";let d;function p(){u&&h&&(d=u[h],u[h]="none")}function f(){u&&h&&(u[h]=d)}function m(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",m,!0)}function _(){window.addEventListener("click",m,!0),window.setTimeout((()=>{window.removeEventListener("click",m,!0)}),0)}function g(e,t){const r=e.getBoundingClientRect();return v(e,r,t)}function y(e,t){const r=e.getBoundingClientRect(),i=[];for(let n=0;n<t.length;n++)i.push(v(e,r,t[n]));return i}function x(e){return void 0!==window.InstallTrigger&&2===e.button&&e.ctrlKey&&window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:e.button}function v(t,r,i){const n=t.offsetWidth===r.width?1:t.offsetWidth/r.width;return new e.P((i.clientX-r.left)*n,(i.clientY-r.top)*n)}const b="01",w="NO_ACCESS_TOKEN";class T{constructor(e,t,r){this._transformRequestFn=e,this._customAccessToken=t,this._silenceAuthErrors=!!r,this._createSkuToken()}_createSkuToken(){const e=function(){let e="";for(let t=0;t<10;t++)e+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",b,e].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=e.token,this._skuTokenExpiresAt=e.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}normalizeStyleURL(r,i){if(!e.f(r))return r;const n=E(r);return n.params.push(`sdk=js-${t}`),n.path=`/styles/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||i)}normalizeGlyphsURL(t,r){if(!e.f(t))return t;const i=E(t);return i.path=`/fonts/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||r)}normalizeModelURL(t,r){if(!e.f(t))return t;const i=E(t);return i.path=`/models/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||r)}normalizeSourceURL(t,r,i,n){if(!e.f(t))return t;const o=E(t);return o.path=`/v4/${o.authority}.json`,o.params.push("secure"),i&&o.params.push(`language=${i}`),n&&o.params.push(`worldview=${n}`),this._makeAPIURL(o,this._customAccessToken||r)}normalizeSpriteURL(t,r,i,n){const o=E(t);return e.f(t)?(o.path=`/styles/v1${o.path}/sprite${r}${i}`,this._makeAPIURL(o,this._customAccessToken||n)):(o.path+=`${r}${i}`,M(o))}normalizeTileURL(t,r,i){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!e.f(t))return t;const n=E(t);n.path=n.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${r||i&&"raster"!==n.authority&&512===i?"@2x":""}${e.m.supported?".webp":"$1"}`),"raster"===n.authority?n.path=`/${e.e.RASTER_URL_PREFIX}${n.path}`:"rasterarrays"===n.authority?n.path=`/${e.e.RASTERARRAYS_URL_PREFIX}${n.path}`:"3dtiles"===n.authority?n.path=`/${e.e.TILES3D_URL_PREFIX}${n.path}`:(n.path=n.path.replace(/^.+\/v4\//,"/"),n.path=`/${e.e.TILE_URL_VERSION}${n.path}`);const o=this._customAccessToken||function(e){for(const t of e){const e=t.match(/^access_token=(.*)$/);if(e)return e[1]}return null}(n.params)||e.e.ACCESS_TOKEN;return e.e.REQUIRE_ACCESS_TOKEN&&o&&this._skuToken&&n.params.push(`sku=${this._skuToken}`),this._makeAPIURL(n,o)}canonicalizeTileURL(t,r){const i=E(t);if(!i.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!i.path.match(/\.[\w]+$/))return t;let n="mapbox://";i.path.match(/^\/raster\/v1\//)?n+=`raster/${i.path.replace(`/${e.e.RASTER_URL_PREFIX}/`,"")}`:i.path.match(/^\/rasterarrays\/v1\//)?n+=`rasterarrays/${i.path.replace(`/${e.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:n+=`tiles/${i.path.replace(`/${e.e.TILE_URL_VERSION}/`,"")}`;let o=i.params;return r&&(o=o.filter((e=>!e.match(/^access_token=/)))),o.length&&(n+=`?${o.join("&")}`),n}canonicalizeTileset(t,r){const i=!!r&&e.f(r),n=[];for(const r of t.tiles||[])e.h(r)?n.push(this.canonicalizeTileURL(r,i)):n.push(r);return n}_makeAPIURL(t,r){const i="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",n=E(e.e.API_URL);if(t.protocol=n.protocol,t.authority=n.authority,"http"===t.protocol){const e=t.params.indexOf("secure");e>=0&&t.params.splice(e,1)}if("/"!==n.path&&(t.path=`${n.path}${t.path}`),!e.e.REQUIRE_ACCESS_TOKEN)return M(t);if(r=r||e.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!r)throw new Error(`An API access token is required to use Mapbox GL. ${i}`);if("s"===r[0])throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${i}`)}return t.params=t.params.filter((e=>-1===e.indexOf("access_token"))),t.params.push(`access_token=${r||""}`),M(t)}}const S=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function E(e){const t=e.match(S);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function M(e){const t=e.params.length?`?${e.params.join("&")}`:"";return`${e.protocol}://${e.authority}${e.path}${t}`}const A="mapbox.eventData";function C(t){if(!t)return null;const r=t.split(".");if(!r||3!==r.length)return null;try{return JSON.parse(e.j(r[1]))}catch(e){return null}}class I{constructor(e){this.type=e,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const r=C(e.e.ACCESS_TOKEN);let i="";return i=r&&r.u?e.k(r.u):e.e.ACCESS_TOKEN||"",t?`${A}.${t}:${i}`:`${A}:${i}`}fetchEventData(){const t=e.s("localStorage"),r=this.getStorageKey(),i=this.getStorageKey("uuid");if(t)try{const e=localStorage.getItem(r);e&&(this.eventData=JSON.parse(e));const t=localStorage.getItem(i);t&&(this.anonId=t)}catch(t){e.w("Unable to read from LocalStorage")}}saveEventData(){const t=e.s("localStorage"),r=this.getStorageKey(),i=this.getStorageKey("uuid"),n=this.anonId;if(t&&n)try{localStorage.setItem(i,n),Object.keys(this.eventData).length>=1&&localStorage.setItem(r,JSON.stringify(this.eventData))}catch(t){e.w("Unable to write to LocalStorage")}}processRequests(e){}postEvent(t,r,i,n){if(!e.e.EVENTS_URL)return;const o=E(e.e.EVENTS_URL);o.params.push(`access_token=${n||e.e.ACCESS_TOKEN||""}`);const s={event:this.type,created:new Date(t).toISOString()},a=r?e.l(s,r):s,l={url:M(o),headers:{"Content-Type":"text/plain"},body:JSON.stringify([a])};this.pendingRequest=e.p(l,(e=>{this.pendingRequest=null,i(e),this.saveEventData(),this.processRequests(n)}))}queueRequest(e,t){this.queue.push(e),this.processRequests(t)}}const P=new class extends I{constructor(e){super("appUserTurnstile"),this._customAccessToken=e}postTurnstileEvent(t,r){e.e.EVENTS_URL&&e.e.ACCESS_TOKEN&&Array.isArray(t)&&t.some((t=>e.f(t)||e.h(t)))&&this.queueRequest(Date.now(),r)}processRequests(r){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const i=C(e.e.ACCESS_TOKEN),n=i?i.u:e.e.ACCESS_TOKEN;let o=n!==this.eventData.tokenU;e.v(this.anonId)||(this.anonId=e.u(),o=!0);const s=this.queue.shift();if(this.eventData.lastSuccess){const e=new Date(this.eventData.lastSuccess),t=new Date(s),r=(s-this.eventData.lastSuccess)/864e5;o=o||r>=1||r<-1||e.getDate()!==t.getDate()}else o=!0;o?this.postEvent(s,{sdkIdentifier:"mapbox-gl-js",sdkVersion:t,skuId:b,"enabled.telemetry":!1,userId:this.anonId},(e=>{e||(this.eventData.lastSuccess=s,this.eventData.tokenU=n)}),r):this.processRequests()}},R=P.postTurnstileEvent.bind(P),z=new class extends I{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(t,r,i,n){this.skuToken=r,this.errorCb=n,e.e.EVENTS_URL&&(i||e.e.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},i):this.errorCb(new Error(w)))}processRequests(r){if(this.pendingRequest||0===this.queue.length)return;const{id:i,timestamp:n}=this.queue.shift();i&&this.success[i]||(this.anonId||this.fetchEventData(),e.v(this.anonId)||(this.anonId=e.u()),this.postEvent(n,{sdkIdentifier:"mapbox-gl-js",sdkVersion:t,skuId:b,skuToken:this.skuToken,userId:this.anonId},(e=>{e?this.errorCb(e):i&&(this.success[i]=!0)}),r))}remove(){this.errorCb=null}},D=z.postMapLoadEvent.bind(z),k=new class extends I{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(t){let r=this.mapInstanceIdMap.get(t);return r||(r=e.u(),this.mapInstanceIdMap.set(t,r)),r}getEventId(e){const t=this.eventIdPerMapInstanceMap.get(e)||0;return this.eventIdPerMapInstanceMap.set(e,t+1),t}postStyleLoadEvent(t,r){const{map:i,style:n,importedStyles:o}=r;if(!e.e.EVENTS_URL||!t&&!e.e.ACCESS_TOKEN)return;const s=this.getMapInstanceId(i),a={mapInstanceId:s,eventId:this.getEventId(s),style:n};o.length&&(a.importedStyles=o),this.queueRequest({timestamp:Date.now(),payload:a},t)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:t,payload:r}=this.queue.shift();this.postEvent(t,r,(()=>{}),e)}},O=k.postStyleLoadEvent.bind(k),L=new class extends I{constructor(){super("gljs.performance")}postPerformanceEvent(t,r){e.e.EVENTS_URL&&(t||e.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:r},t)}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:o,performanceData:s}=this.queue.shift(),a=function(i){const o=performance.getEntriesByType("resource"),s=performance.getEntriesByType("mark"),a=function(e){const t={};if(e)for(const r in e)if("other"!==r)for(const i of e[r]){const e=`${r}ResolveRangeMin`,n=`${r}ResolveRangeMax`,o=`${r}RequestCount`,s=`${r}RequestCachedCount`;t[e]=Math.min(t[e]||1/0,i.startTime),t[n]=Math.max(t[n]||-1/0,i.responseEnd);const a=e=>{void 0===t[e]&&(t[e]=0),++t[e]};void 0!==i.transferSize&&0===i.transferSize&&a(s),a(o)}return t}(function(e,t){const r={};if(e)for(const i of e){const e=t(i);void 0===r[e]&&(r[e]=[]),r[e].push(i)}return r}(o,n)),l=window.devicePixelRatio,c=navigator.connection||navigator.mozConnection||navigator.webkitConnection,u=c?c.effectiveType:void 0,h={counters:[],metadata:[],attributes:[]},d=(e,t,r)=>{null!=r&&e.push({name:t,value:r.toString()})};for(const e in a)d(h.counters,e,a[e]);if(i.interactionRange[0]!==1/0&&i.interactionRange[1]!==-1/0&&(d(h.counters,"interactionRangeMin",i.interactionRange[0]),d(h.counters,"interactionRangeMax",i.interactionRange[1])),s)for(const e of Object.keys(r)){const t=r[e],i=s.find((e=>e.name===t));i&&d(h.counters,t,i.startTime)}return d(h.counters,"visibilityHidden",i.visibilityHidden),d(h.attributes,"style",function(t){if(t)for(const r of t){const t=r.name.split("?")[0];if(e.i(t)){const e=t.split("/").slice(-2);if(2===e.length)return`mapbox://styles/${e[0]}/${e[1]}`}}}(o)),d(h.attributes,"terrainEnabled",i.terrainEnabled?"true":"false"),d(h.attributes,"fogEnabled",i.fogEnabled?"true":"false"),d(h.attributes,"projection",i.projection),d(h.attributes,"zoom",i.zoom),d(h.metadata,"devicePixelRatio",l),d(h.metadata,"connectionEffectiveType",u),d(h.metadata,"navigatorUserAgent",navigator.userAgent),d(h.metadata,"screenWidth",window.screen.width),d(h.metadata,"screenHeight",window.screen.height),d(h.metadata,"windowWidth",window.innerWidth),d(h.metadata,"windowHeight",window.innerHeight),d(h.metadata,"mapWidth",i.width/l),d(h.metadata,"mapHeight",i.height/l),d(h.metadata,"webglRenderer",i.renderer),d(h.metadata,"webglVendor",i.vendor),d(h.metadata,"sdkVersion",t),d(h.metadata,"sdkIdentifier","mapbox-gl-js"),h}(s);for(const e of a.metadata);for(const e of a.counters);for(const e of a.attributes);this.postEvent(o,a,(()=>{}),i)}},B=L.postPerformanceEvent.bind(L),F=new class extends I{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(t,r,i,n){if(!e.e.API_URL||!e.e.SESSION_PATH)return;const o=E(e.e.API_URL+e.e.SESSION_PATH);o.params.push(`sku=${r||""}`),o.params.push(`access_token=${n||e.e.ACCESS_TOKEN||""}`);const s={url:M(o),headers:{"Content-Type":"text/plain"}};this.pendingRequest=e.g(s,(e=>{this.pendingRequest=null,i(e),this.saveEventData(),this.processRequests(n)}))}getSessionAPI(t,r,i,n){this.skuToken=r,this.errorCb=n,e.e.SESSION_PATH&&e.e.API_URL&&(i||e.e.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},i):this.errorCb(new Error(w)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{id:t,timestamp:r}=this.queue.shift();t&&this.success[t]||this.getSession(r,this.skuToken,(e=>{e?this.errorCb(e):t&&(this.success[t]=!0)}),e)}remove(){this.errorCb=null}},N=F.getSessionAPI.bind(F),V=new Set;function j(e,t){t?V.add(e):V.delete(e)}class U{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages=new Set}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(e,t){this._updatedSourceCaches[e]=t,this.setDirty()}discardSourceCacheUpdate(e){delete this._updatedSourceCaches[e]}updateLayer(e){const t=e.scope;this._updatedLayers[t]=this._updatedLayers[t]||new Set,this._updatedLayers[t].add(e.id),this.setDirty()}removeLayer(e){const t=e.scope;this._removedLayers[t]=this._removedLayers[t]||{},this._updatedLayers[t]=this._updatedLayers[t]||new Set,this._removedLayers[t][e.id]=e,this._updatedLayers[t].delete(e.id),this._updatedPaintProps.delete(e.fqid),this.setDirty()}getRemovedLayer(e){return this._removedLayers[e.scope]?this._removedLayers[e.scope][e.id]:null}discardLayerRemoval(e){this._removedLayers[e.scope]&&delete this._removedLayers[e.scope][e.id]}getLayerUpdatesByScope(){const e={};for(const t in this._updatedLayers)e[t]=e[t]||{},e[t].updatedIds=Array.from(this._updatedLayers[t].values());for(const t in this._removedLayers)e[t]=e[t]||{},e[t].removedIds=Object.keys(this._removedLayers[t]);return e}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(e){this._updatedPaintProps.add(e.fqid),this.setDirty()}getUpdatedImages(){return Array.from(this._updatedImages.values())}updateImage(e){this._updatedImages.add(e),this.setDirty()}resetUpdatedImages(){this._updatedImages.clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages.clear()}}function $(e){const{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class G extends e.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded={},this.requestors=[],this.patterns={},this.atlasImage={},this.atlasTexture={},this.dirty=!0}createScope(t){this.images[t]={},this.loaded[t]=!1,this.updatedImages[t]={},this.patterns[t]={},this.callbackDispatchedThisFrame[t]={},this.atlasImage[t]=new e.r({width:1,height:1})}isLoaded(){for(const e in this.loaded)if(!this.loaded[e])return!1;return!0}setLoaded(e,t){if(this.loaded[t]!==e&&(this.loaded[t]=e,e)){for(const{ids:e,callback:r}of this.requestors)this._notify(e,t,r);this.requestors=[]}}hasImage(e,t){return!!this.getImage(e,t)}getImage(e,t){return this.images[t][e]}addImage(e,t,r){this._validate(e,r)&&(this.images[t][e]=r)}_validate(t,r){let i=!0;return this._validateStretch(r.stretchX,r.data&&r.data.width)||(this.fire(new e.t(new Error(`Image "${t}" has invalid "stretchX" value`))),i=!1),this._validateStretch(r.stretchY,r.data&&r.data.height)||(this.fire(new e.t(new Error(`Image "${t}" has invalid "stretchY" value`))),i=!1),this._validateContent(r.content,r)||(this.fire(new e.t(new Error(`Image "${t}" has invalid "content" value`))),i=!1),i}_validateStretch(e,t){if(!e)return!0;let r=0;for(const i of e){if(i[0]<r||i[1]<i[0]||t<i[1])return!1;r=i[1]}return!0}_validateContent(e,t){return!(e&&(4!==e.length||e[0]<0||t.data.width<e[0]||e[1]<0||t.data.height<e[1]||e[2]<0||t.data.width<e[2]||e[3]<0||t.data.height<e[3]||e[2]<e[0]||e[3]<e[1]))}updateImage(e,t,r){r.version=this.images[t][e].version+1,this.images[t][e]=r,this.updatedImages[t][e]=!0}removeImage(e,t){const r=this.images[t][e];delete this.images[t][e],delete this.patterns[t][e],r.userImage&&r.userImage.onRemove&&r.userImage.onRemove()}listImages(e){return Object.keys(this.images[e])}getImages(e,t,r){let i=!0;const n=!!this.loaded[t];if(!n)for(const r of e)this.images[t][r]||(i=!1);n||i?this._notify(e,t,r):this.requestors.push({ids:e,scope:t,callback:r})}getUpdatedImages(e){return this.updatedImages[e]}_notify(t,r,i){const n={};for(const i of t){this.images[r][i]||this.fire(new e.x("styleimagemissing",{id:i}));const t=this.images[r][i];t?n[i]={data:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,hasRenderCallback:Boolean(t.userImage&&t.userImage.render)}:e.w(`Image "${i}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}i(null,n)}getPixelSize(e){const{width:t,height:r}=this.atlasImage[e];return{width:t,height:r}}getPattern(t,r,i){const n=this.patterns[r][t],o=this.getImage(t,r);if(!o)return null;if(n&&n.position.version===o.version)return n.position;if(n)n.position.version=o.version;else{const i={w:o.data.width+2*e.y,h:o.data.height+2*e.y,x:0,y:0},n=new e.I(i,o,e.y);this.patterns[r][t]={bin:i,position:n}}return this._updatePatternAtlas(r,i),this.patterns[r][t].position}bind(t,r){const i=t.gl;let n=this.atlasTexture[r];n?this.dirty&&(n.update(this.atlasImage[r]),this.dirty=!1):(n=new e.T(t,this.atlasImage[r],i.RGBA8),this.atlasTexture[r]=n),n.bind(i.LINEAR,i.CLAMP_TO_EDGE)}_updatePatternAtlas(t,r){const i=[];for(const e in this.patterns[t])i.push(this.patterns[t][e].bin);const{w:n,h:o}=e.z(i),s=this.atlasImage[t];s.resize({width:n||1,height:o||1});for(const i in this.patterns[t]){const{bin:n,position:o}=this.patterns[t][i];let a=o.padding;const l=n.x+a,c=n.y+a,u=this.images[t][i].data,h=u.width,d=u.height;a=a>1?a-1:a,e.r.copy(u,s,{x:0,y:0},{x:l,y:c},{width:h,height:d},r),e.r.copy(u,s,{x:0,y:d-a},{x:l,y:c-a},{width:h,height:a},r),e.r.copy(u,s,{x:0,y:0},{x:l,y:c+d},{width:h,height:a},r),e.r.copy(u,s,{x:h-a,y:0},{x:l-a,y:c},{width:a,height:d},r),e.r.copy(u,s,{x:0,y:0},{x:l+h,y:c},{width:a,height:d},r),e.r.copy(u,s,{x:h-a,y:d-a},{x:l-a,y:c-a},{width:a,height:a},r),e.r.copy(u,s,{x:0,y:d-a},{x:l+h,y:c-a},{width:a,height:a},r),e.r.copy(u,s,{x:0,y:0},{x:l+h,y:c+d},{width:a,height:a},r),e.r.copy(u,s,{x:h-a,y:0},{x:l-a,y:c+d},{width:a,height:a},r)}this.dirty=!0}beginFrame(){for(const e in this.images)this.callbackDispatchedThisFrame[e]={}}dispatchRenderCallbacks(e,t){for(const r of e){if(this.callbackDispatchedThisFrame[t][r])continue;this.callbackDispatchedThisFrame[t][r]=!0;const e=this.images[t][r];$(e)&&this.updateImage(r,t,e)}}}function q(t){const r=t.key,i=t.value,n=t.valueSpec||{},o=t.objectElementValidators||{},s=t.style,a=t.styleSpec;let l=[];const c=e.B(i);if("object"!==c)return[new e.V(r,i,`object expected, ${c} found`)];for(const t in i){const c=t.split(".")[0];let u;o[c]?u=o[c]:n[c]?u=pe:o["*"]?u=o["*"]:n["*"]&&(u=pe),u?l=l.concat(u({key:(r?`${r}.`:r)+t,value:i[t],valueSpec:n[c]||n["*"],style:s,styleSpec:a,object:i,objectKey:t},i)):l.push(new e.A(r,i[t],`unknown property "${t}"`))}for(const t in n)o[t]||n[t].required&&void 0===n[t].default&&void 0===i[t]&&l.push(new e.V(r,i,`missing required property "${t}"`));return l}function H(t){const r=t.value,i=t.valueSpec,n=t.style,o=t.styleSpec,s=t.key,a=t.arrayElementValidator||pe;if("array"!==e.B(r))return[new e.V(s,r,`array expected, ${e.B(r)} found`)];if(i.length&&r.length!==i.length)return[new e.V(s,r,`array length ${i.length} expected, length ${r.length} found`)];if(i["min-length"]&&r.length<i["min-length"])return[new e.V(s,r,`array length at least ${i["min-length"]} expected, length ${r.length} found`)];let l={type:i.value,values:i.values,minimum:i.minimum,maximum:i.maximum,function:void 0};o.$version<7&&(l.function=i.function),"object"===e.B(i.value)&&(l=i.value);let c=[];for(let e=0;e<r.length;e++)c=c.concat(a({array:r,arrayIndex:e,value:r[e],valueSpec:l,style:n,styleSpec:o,key:`${s}[${e}]`},!0));return c}function W(t){const r=t.key,i=t.value,n=t.valueSpec;let o=e.B(i);if("number"===o&&i!=i&&(o="NaN"),"number"!==o)return[new e.V(r,i,`number expected, ${o} found`)];if("minimum"in n){let o=n.minimum;if("array"===e.B(n.minimum)&&(o=n.minimum[t.arrayIndex]),i<o)return[new e.V(r,i,`${i} is less than the minimum value ${o}`)]}if("maximum"in n){let o=n.maximum;if("array"===e.B(n.maximum)&&(o=n.maximum[t.arrayIndex]),i>o)return[new e.V(r,i,`${i} is greater than the maximum value ${o}`)]}return[]}function Z(t){const r=t.valueSpec,i=e.D(t.value.type);let n,o,s,a={};const l="categorical"!==i&&void 0===t.value.property,c=!l,u="array"===e.B(t.value.stops)&&"array"===e.B(t.value.stops[0])&&"object"===e.B(t.value.stops[0][0]),h=q({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===i)return[new e.V(t.key,t.value,'identity function may not have a "stops" property')];let r=[];const n=t.value;return r=r.concat(H({key:t.key,value:n,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:d})),"array"===e.B(n)&&0===n.length&&r.push(new e.V(t.key,n,"array must have at least one stop")),r},default:function(e){return pe({key:e.key,value:e.value,valueSpec:r,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===i&&l&&h.push(new e.V(t.key,t.value,'missing required property "property"')),"identity"===i||t.value.stops||h.push(new e.V(t.key,t.value,'missing required property "stops"')),"exponential"===i&&t.valueSpec.expression&&!e.F(t.valueSpec)&&h.push(new e.V(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(c&&!e.G(t.valueSpec)?h.push(new e.V(t.key,t.value,"property functions not supported")):l&&!e.H(t.valueSpec)&&h.push(new e.V(t.key,t.value,"zoom functions not supported"))),"categorical"!==i&&!u||void 0!==t.value.property||h.push(new e.V(t.key,t.value,'"property" property is required')),h;function d(t){let i=[];const n=t.value,l=t.key;if("array"!==e.B(n))return[new e.V(l,n,`array expected, ${e.B(n)} found`)];if(2!==n.length)return[new e.V(l,n,`array length 2 expected, length ${n.length} found`)];if(u){if("object"!==e.B(n[0]))return[new e.V(l,n,`object expected, ${e.B(n[0])} found`)];if(void 0===n[0].zoom)return[new e.V(l,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new e.V(l,n,"object stop key must have value")];const r=e.D(n[0].zoom);if("number"!=typeof r)return[new e.V(l,n[0].zoom,"stop zoom values must be numbers")];if(s&&s>r)return[new e.V(l,n[0].zoom,"stop zoom values must appear in ascending order")];r!==s&&(s=r,o=void 0,a={}),i=i.concat(q({key:`${l}[0]`,value:n[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:W,value:p}}))}else i=i.concat(p({key:`${l}[0]`,value:n[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},n));return e.J(e.K(n[1]))?i.concat([new e.V(`${l}[1]`,n[1],"expressions are not allowed in function stops.")]):i.concat(pe({key:`${l}[1]`,value:n[1],valueSpec:r,style:t.style,styleSpec:t.styleSpec}))}function p(t,s){const l=e.B(t.value),c=e.D(t.value),u=null!==t.value?t.value:s;if(n){if(l!==n)return[new e.V(t.key,u,`${l} stop domain type must match previous stop domain type ${n}`)]}else n=l;if("number"!==l&&"string"!==l&&"boolean"!==l&&"number"!=typeof c&&"string"!=typeof c&&"boolean"!=typeof c)return[new e.V(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==l&&"categorical"!==i){let n=`number expected, ${l} found`;return e.G(r)&&void 0===i&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new e.V(t.key,u,n)]}return"categorical"!==i||"number"!==l||"number"==typeof c&&isFinite(c)&&Math.floor(c)===c?"categorical"!==i&&"number"===l&&"number"==typeof c&&"number"==typeof o&&void 0!==o&&c<o?[new e.V(t.key,u,"stop domain values must appear in ascending order")]:(o=c,"categorical"===i&&c in a?[new e.V(t.key,u,"stop domain values must be unique")]:(a[c]=!0,[])):[new e.V(t.key,u,`integer expected, found ${String(c)}`)]}}function X(t){const r=("property"===t.expressionContext?e.L:e.M)(e.K(t.value),t.valueSpec);if("error"===r.result)return r.value.map((r=>new e.V(`${t.key}${r.key}`,t.value,r.message)));const i=r.value.expression||r.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!i.outputDefined())return[new e.V(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!e.N(i))return[new e.V(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext)return Y(i,t);if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!e.O(i,["zoom","feature-state"]))return[new e.V(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!e.Q(i))return[new e.V(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Y(t,r){const i=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(r.valueSpec&&r.valueSpec.expression)for(const e of r.valueSpec.expression.parameters)i.delete(e);if(0===i.size)return[];const n=[];return t instanceof e.S&&i.has(t.name)?[new e.V(r.key,r.value,`["${t.name}"] expression is not supported in a filter for a ${r.object.type} layer with id: ${r.object.id}`)]:(t.eachChild((e=>{n.push(...Y(e,r))})),n)}function J(t){const r=t.key,i=t.value,n=t.valueSpec,o=[];return Array.isArray(n.values)?-1===n.values.indexOf(e.D(i))&&o.push(new e.V(r,i,`expected one of [${n.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(n.values).indexOf(e.D(i))&&o.push(new e.V(r,i,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(i)} found`)),o}function K(t){return e.W(e.K(t.value))?X(e.C({},t,{expressionContext:"filter",valueSpec:t.styleSpec[`filter_${t.layerType||"fill"}`]})):Q(t)}function Q(t){const r=t.value,i=t.key;if("array"!==e.B(r))return[new e.V(i,r,`array expected, ${e.B(r)} found`)];const n=t.styleSpec;let o,s=[];if(r.length<1)return[new e.V(i,r,"filter array must have at least 1 element")];switch(s=s.concat(J({key:`${i}[0]`,value:r[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),e.D(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&"$type"===e.D(r[1])&&s.push(new e.V(i,r,`"$type" cannot be use with operator "${r[0]}"`));case"==":case"!=":3!==r.length&&s.push(new e.V(i,r,`filter array for operator "${r[0]}" must have 3 elements`));case"in":case"!in":r.length>=2&&(o=e.B(r[1]),"string"!==o&&s.push(new e.V(`${i}[1]`,r[1],`string expected, ${o} found`)));for(let a=2;a<r.length;a++)o=e.B(r[a]),"$type"===e.D(r[1])?s=s.concat(J({key:`${i}[${a}]`,value:r[a],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==o&&"number"!==o&&"boolean"!==o&&s.push(new e.V(`${i}[${a}]`,r[a],`string, number, or boolean expected, ${o} found`));break;case"any":case"all":case"none":for(let e=1;e<r.length;e++)s=s.concat(Q({key:`${i}[${e}]`,value:r[e],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":o=e.B(r[1]),2!==r.length?s.push(new e.V(i,r,`filter array for "${r[0]}" operator must have 2 elements`)):"string"!==o&&s.push(new e.V(`${i}[1]`,r[1],`string expected, ${o} found`))}return s}function ee(t,r){const i=t.key,n=t.style,o=t.layer,s=t.styleSpec,a=t.value,l=t.objectKey,c=s[`${r}_${t.layerType}`];if(!c)return[];const u=l.match(/^(.*)-transition$/);if("paint"===r&&u&&c[u[1]]&&c[u[1]].transition)return pe({key:i,value:a,valueSpec:s.transition,style:n,styleSpec:s});const h=t.valueSpec||c[l];if(!h)return[new e.A(i,a,`unknown property "${l}"`)];let d;if("string"===e.B(a)&&e.G(h)&&!h.tokens&&(d=/^{([^}]+)}$/.exec(a))){const t=`\`{ "type": "identity", "property": ${d?JSON.stringify(d[1]):'"_"'} }\``;return[new e.V(i,a,`"${l}" does not support interpolation syntax\nUse an identity property function instead: ${t}.`)]}const p=[];if("symbol"===t.layerType)"text-field"!==l||!n||n.glyphs||n.imports||p.push(new e.V(i,a,'use of "text-field" requires a style "glyphs" property')),"text-font"===l&&e.X(e.K(a))&&"identity"===e.D(a.type)&&p.push(new e.V(i,a,'"text-font" does not support identity functions'));else if("model"===t.layerType&&"paint"===r&&o&&o.layout&&o.layout.hasOwnProperty("model-id")&&e.G(h)&&(e.Y(h)||e.H(h))){const t=e.L(e.K(a),h),r=t.value.expression||t.value._styleExpression.expression;r&&!e.O(r,["measure-light"])&&("model-emissive-strength"===l&&e.Q(r)&&e.N(r)||p.push(new e.V(i,a,`${l} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return p.concat(pe({key:t.key,value:a,valueSpec:h,style:n,styleSpec:s,expressionContext:"property",propertyType:r,propertyKey:l}))}function te(e){return ee(e,"paint")}function re(e){return ee(e,"layout")}function ie(t){let r=[];const i=t.value,n=t.key,o=t.style,s=t.styleSpec;i.type||i.ref||r.push(new e.V(n,i,'either "type" or "ref" is required'));let a=e.D(i.type);const l=e.D(i.ref);if(i.id){const s=e.D(i.id);for(let a=0;a<t.arrayIndex;a++){const t=o.layers[a];e.D(t.id)===s&&r.push(new e.V(n,i.id,`duplicate layer id "${i.id}", previously used at line ${t.id.__line__}`))}}if("ref"in i){let t;["type","source","source-layer","filter","layout"].forEach((t=>{t in i&&r.push(new e.V(n,i[t],`"${t}" is prohibited for ref layers`))})),o.layers.forEach((r=>{e.D(r.id)===l&&(t=r)})),t?t.ref?r.push(new e.V(n,i.ref,"ref cannot reference another ref layer")):a=e.D(t.type):"string"==typeof l&&r.push(new e.V(n,i.ref,`ref layer "${l}" not found`))}else if("background"!==a&&"sky"!==a&&"slot"!==a)if(i.source){const t=o.sources&&o.sources[i.source],s=t&&e.D(t.type);t?"vector"===s&&"raster"===a?r.push(new e.V(n,i.source,`layer "${i.id}" requires a raster source`)):"raster"===s&&"raster"!==a?r.push(new e.V(n,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==s||i["source-layer"]?"raster-dem"===s&&"hillshade"!==a?r.push(new e.V(n,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"raster-array"!==s||["raster","raster-particle"].includes(a)?"line"!==a||!i.paint||!i.paint["line-gradient"]&&!i.paint["line-trim-offset"]||"geojson"===s&&t.lineMetrics?"raster-particle"===a&&"raster-array"!==s&&r.push(new e.V(n,i.source,`layer "${i.id}" requires a 'raster-array' source.`)):r.push(new e.V(n,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new e.V(n,i.source,"raster-array source can only be used with layer type 'raster'.")):r.push(new e.V(n,i,`layer "${i.id}" must specify a "source-layer"`)):r.push(new e.V(n,i.source,`source "${i.source}" not found`))}else r.push(new e.V(n,i,'missing required property "source"'));return r=r.concat(q({key:n,value:i,valueSpec:s.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":()=>[],type:()=>pe({key:`${n}.type`,value:i.type,valueSpec:s.layer.type,style:t.style,styleSpec:t.styleSpec,object:i,objectKey:"type"}),filter:t=>K(e.C({layerType:a},t)),layout:t=>q({layer:i,key:t.key,value:t.value,valueSpec:{},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>re(e.C({layerType:a},t))}}),paint:t=>q({layer:i,key:t.key,value:t.value,valueSpec:{},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>te(e.C({layerType:a,layer:i},t))}})}})),r}function ne(t){const r=t.value,i=t.key,n=e.B(r);return"string"!==n?[new e.V(i,r,`string expected, ${n} found`)]:[]}const oe={promoteId:function({key:t,value:r}){if("string"===e.B(r))return ne({key:t,value:r});{const e=[];for(const i in r)e.push(...ne({key:`${t}.${i}`,value:r[i]}));return e}}};function se(t){const r=t.value,i=t.key,n=t.styleSpec,o=t.style;if(!r.type)return[new e.V(i,r,'"type" is required')];const s=e.D(r.type);let a=[];switch(["vector","raster","raster-dem","raster-array"].includes(s)&&(r.url||r.tiles||a.push(new e.A(i,r,'Either "url" or "tiles" is required.'))),s){case"vector":case"raster":case"raster-dem":case"raster-array":return a=a.concat(q({key:i,value:r,valueSpec:n[`source_${s.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:oe})),a;case"geojson":if(a=q({key:i,value:r,valueSpec:n.source_geojson,style:o,styleSpec:n,objectElementValidators:oe}),r.cluster)for(const e in r.clusterProperties){const[t,n]=r.clusterProperties[e],o="string"==typeof t?[t,["accumulated"],["get",e]]:t;a.push(...X({key:`${i}.${e}.map`,value:n,expressionContext:"cluster-map"})),a.push(...X({key:`${i}.${e}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return a;case"video":return q({key:i,value:r,valueSpec:n.source_video,style:o,styleSpec:n});case"image":return q({key:i,value:r,valueSpec:n.source_image,style:o,styleSpec:n});case"canvas":return[new e.V(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return J({key:`${i}.type`,value:r.type,valueSpec:{values:ae(n)},style:o,styleSpec:n})}}function ae(e){return e.source.reduce(((t,r)=>{const i=e[r];return"enum"===i.type.type&&(t=t.concat(Object.keys(i.type.values))),t}),[])}function le(t){const r=t.value,i=t.styleSpec,n=i.light,o=t.style;let s=[];const a=e.B(r);if(void 0===r)return s;if("object"!==a)return s=s.concat([new e.V("light",r,`object expected, ${a} found`)]),s;for(const t in r){const a=t.match(/^(.*)-transition$/);s=s.concat(a&&n[a[1]]&&n[a[1]].transition?pe({key:t,value:r[t],valueSpec:i.transition,style:o,styleSpec:i}):n[t]?pe({key:t,value:r[t],valueSpec:n[t],style:o,styleSpec:i}):[new e.V(t,r[t],`unknown property "${t}"`)])}return s}function ce(t){const r=t.value;let i=[];if(!r)return i;const n=e.B(r);if("object"!==n)return i=i.concat([new e.V("light-3d",r,`object expected, ${n} found`)]),i;const o=t.styleSpec,s=o["light-3d"],a=t.key,l=t.style,c=t.style.lights;for(const t of["type","id"])if(!(t in r))return i=i.concat([new e.V("light-3d",r,`missing property ${t} on light`)]),i;if(r.type&&c)for(let n=0;n<t.arrayIndex;n++){const t=e.D(r.type),o=c[n];e.D(o.type)===t&&i.push(new e.V(a,r.id,`duplicate light type "${r.type}", previously defined at line ${o.id.__line__}`))}const u=`properties_light_${r.type}`;if(!(u in o))return i=i.concat([new e.V("light-3d",r,`Invalid light type ${r.type}`)]),i;const h=o[u];for(const n in r)if("properties"===n){const s=r[n],a=e.B(s);if("object"!==a)return i=i.concat([new e.V("properties",s,`object expected, ${a} found`)]),i;for(const r in s)i=i.concat(h[r]?pe({key:r,value:s[r],valueSpec:h[r],style:l,styleSpec:o}):[new e.A(t.key,s[r],`unknown property "${r}"`)])}else{const t=n.match(/^(.*)-transition$/);i=i.concat(t&&s[t[1]]&&s[t[1]].transition?pe({key:n,value:r[n],valueSpec:o.transition,style:l,styleSpec:o}):s[n]?pe({key:n,value:r[n],valueSpec:s[n],style:l,styleSpec:o}):[new e.A(n,r[n],`unknown property "${n}"`)])}return i}function ue(t){const r=t.value,i=t.key,n=t.style,o=t.styleSpec,s=o.terrain;let a=[];const l=e.B(r);if(void 0===r)return a;if("null"===l)return a;if("object"!==l)return a=a.concat([new e.V("terrain",r,`object expected, ${l} found`)]),a;for(const t in r){const i=t.match(/^(.*)-transition$/);a=a.concat(i&&s[i[1]]&&s[i[1]].transition?pe({key:t,value:r[t],valueSpec:o.transition,style:n,styleSpec:o}):s[t]?pe({key:t,value:r[t],valueSpec:s[t],style:n,styleSpec:o}):[new e.A(t,r[t],`unknown property "${t}"`)])}if(r.source){const t=n.sources&&n.sources[r.source],o=t&&e.D(t.type);t?"raster-dem"!==o&&a.push(new e.V(i,r.source,`terrain cannot be used with a source of type ${String(o)}, it only be used with a "raster-dem" source type`)):a.push(new e.V(i,r.source,`source "${r.source}" not found`))}else a.push(new e.V(i,r,'terrain is missing required property "source"'));return a}function he(t){const r=t.value,i=t.style,n=t.styleSpec,o=n.fog;let s=[];const a=e.B(r);if(void 0===r)return s;if("object"!==a)return s=s.concat([new e.V("fog",r,`object expected, ${a} found`)]),s;for(const t in r){const a=t.match(/^(.*)-transition$/);s=s.concat(a&&o[a[1]]&&o[a[1]].transition?pe({key:t,value:r[t],valueSpec:n.transition,style:i,styleSpec:n}):o[t]?pe({key:t,value:r[t],valueSpec:o[t],style:i,styleSpec:n}):[new e.A(t,r[t],`unknown property "${t}"`)])}return s}const de={"*":()=>[],array:H,boolean:function(t){const r=t.value,i=t.key,n=e.B(r);return"boolean"!==n?[new e.V(i,r,`boolean expected, ${n} found`)]:[]},number:W,color:function(t){const r=t.key,i=t.value,n=e.B(i);return"string"!==n?[new e.V(r,i,`color expected, ${n} found`)]:null===e.U.parseCSSColor(i)?[new e.V(r,i,`color expected, "${i}" found`)]:[]},enum:J,filter:K,function:Z,layer:ie,object:q,source:se,model:e.Z,light:le,"light-3d":ce,terrain:ue,fog:he,string:ne,formatted:function(e){return 0===ne(e).length?[]:X(e)},resolvedImage:function(e){return 0===ne(e).length?[]:X(e)},projection:function(t){const r=t.value,i=t.styleSpec,n=i.projection,o=t.style;let s=[];const a=e.B(r);if("object"===a)for(const e in r)s=s.concat(pe({key:e,value:r[e],valueSpec:n[e],style:o,styleSpec:i}));else"string"!==a&&(s=s.concat([new e.V("projection",r,`object or string expected, ${a} found`)]));return s},import:function(t){const{value:r,styleSpec:i}=t,{data:n,...o}=r;Object.defineProperty(o,"__line__",{value:r.__line__,enumerable:!1});let s=q(e.C({},t,{value:o,valueSpec:i.import}));return""===e.D(o.id)&&s.push(new e.V(`${t.key}.id`,o,"import id can't be an empty string")),n&&(s=s.concat(me(n,i,{key:`${t.key}.data`}))),s}};function pe(t,r=!1){const i=t.value,n=t.valueSpec,o=t.styleSpec;if(n.expression&&e.X(e.D(i)))return Z(t);if(n.expression&&e.J(e.K(i)))return X(t);if(n.type&&de[n.type]){const i=de[n.type](t);return!0===r&&i.length>0&&"array"===e.B(t.value)?X(t):i}return q(e.C({},t,{valueSpec:n.type?o[n.type]:n}))}function fe(t){const r=t.value,i=t.key,n=ne(t);return n.length||(-1===r.indexOf("{fontstack}")&&n.push(new e.V(i,r,'"glyphs" url must include a "{fontstack}" token')),-1===r.indexOf("{range}")&&n.push(new e.V(i,r,'"glyphs" url must include a "{range}" token'))),n}function me(t,r=e._,i={}){return pe({key:i.key||"",value:t,valueSpec:r.$root,styleSpec:r,style:t,objectElementValidators:{glyphs:fe,"*":()=>[]}})}function _e(t,r=e._){return Ae(me(t,r))}const ge=e=>Ae(se(e)),ye=e=>Ae(le(e)),xe=e=>Ae(ce(e)),ve=e=>Ae(ue(e)),be=e=>Ae(he(e)),we=e=>Ae(ie(e)),Te=e=>Ae(K(e)),Se=e=>Ae(te(e)),Ee=e=>Ae(re(e)),Me=t=>Ae(e.Z(t));function Ae(e){return e.slice().sort(((e,t)=>e.line&&t.line?e.line-t.line:0))}function Ce(t,r){let i=!1;if(r&&r.length)for(const n of r)n instanceof e.A?e.w(n.message):(t.fire(new e.t(new Error(n.message))),i=!0);return i}let Ie;class Pe extends e.E{constructor(t,r="flat"){super(),this._transitionable=new e.$(Ie||(Ie=new e.a0({anchor:new e.a1(e._.light.anchor),position:new e.a2(e._.light.position),color:new e.a1(e._.light.color),intensity:new e.a1(e._.light.intensity)}))),this.setLight(t,r),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,t,r={}){this._validate(ye,e,r)||(this._transitionable.setTransitionOrValue(e),this.id=t)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,r,i){return(!i||!1!==i.validate)&&Ce(this,t.call(_e,e.l({value:r,style:{glyphs:!0,sprite:!0},styleSpec:e._})))}}let Re=class extends e.E{constructor(t,r,i,n){super(),this.scope=i,this._transitionable=new e.$(new e.a0({source:new e.a1(e._.terrain.source),exaggeration:new e.a1(e._.terrain.exaggeration)}),i,n),this._transitionable.setTransitionOrValue(t,n),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=r}get(){return this._transitionable.serialize()}set(e,t){this._transitionable.setTransitionOrValue(e,t)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}getExaggeration(t){return this._transitioning.possiblyEvaluate(new e.a3(t)).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const t=this._transitionable._values.exaggeration;if(!t)return null;const r=t.value.expression;if(!r)return null;let i=-1,n=-1,o=1;for(const t of r.zoomStops)o=r.evaluate(new e.a3(t)),o>.01?(i=t,n=-1):n=t;return o<.01&&i>0&&n>i?[i,n]:null}isZoomDependent(){const t=this._transitionable._values.exaggeration;return null!=t&&null!=t.value&&null!=t.value.expression&&t.value.expression instanceof e.a4}};const ze=45,De=65,ke=.05;function Oe(t,r,i,n){const o=e.a7(ze,De,i),[s,a]=Le(t,n);let l=1-Math.min(1,Math.exp((r-s)/(a-s)*-6));return l*=l*l,l=Math.min(1,1.00747*l),l*o*t.alpha}function Le(e,t){const r=.5/Math.tan(.5*t);return[e.range[0]+r,e.range[1]+r]}function Be(t,r,i,n,o){const s=e.a6.vec3.transformMat4([],[r,i,n],o.mercatorFogMatrix);return Oe(t,e.a6.vec3.length(s),o.pitch,o._fov)}function Fe(t,r,i,n,o,s,a){const l=[[i,n,0],[o,n,0],[o,s,0],[i,s,0]];let c=Number.MAX_VALUE,u=-Number.MAX_VALUE;for(const t of l){const i=e.a6.vec3.transformMat4([],t,r),n=e.a6.vec3.length(i);c=Math.min(c,n),u=Math.max(u,n)}return[Oe(t,c,a.pitch,a._fov),Oe(t,u,a.pitch,a._fov)]}class Ne extends e.E{constructor(t,r,i,n){super();const o=new e.a0({range:new e.a1(e._.fog.range),color:new e.a1(e._.fog.color),"high-color":new e.a1(e._.fog["high-color"]),"space-color":new e.a1(e._.fog["space-color"]),"horizon-blend":new e.a1(e._.fog["horizon-blend"]),"star-intensity":new e.a1(e._.fog["star-intensity"]),"vertical-range":new e.a1(e._.fog["vertical-range"])});this._transitionable=new e.$(o,i,new Map(n)),this.set(t,n),this._transitioning=this._transitionable.untransitioned(),this._transform=r,this.properties=new e.a8(o),this.scope=i}get state(){const t=this._transform,r="globe"===t.projection.name,i=e.a9(t.zoom),n=this.properties.get("range"),o=[.5,3];return{range:r?[e.aa(o[0],n[0],i),e.aa(o[1],n[1],i)]:n,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(t,r,i={}){if(this._validate(be,t,i))return;const n=e.l({},t);for(const t of Object.keys(e._.fog))void 0===n[t]&&(n[t]=e._.fog[t].default);this._options=n,this._transitionable.setTransitionOrValue(this._options,r)}getOpacity(t){if(!this._transform.projection.supportsFog)return 0;const r=this.properties&&this.properties.get("color")||1;return("globe"===this._transform.projection.name?1:e.a7(ze,De,t))*r.a}getOpacityAtLatLng(t,r){return this._transform.projection.supportsFog?function(t,r,i){const n=e.a5.fromLngLat(r),o=i.elevation?i.elevation.getAtPointOrZero(n):0;return Be(t,n.x,n.y,o,i)}(this.state,t,r):0}getOpacityForTile(t){if(!this._transform.projection.supportsFog)return[1,1];const r=this._transform.calculateFogTileMatrix(t.toUnwrapped());return Fe(this.state,r,0,0,e.ab,e.ab,this._transform)}getOpacityForBounds(e,t,r,i,n){return this._transform.projection.supportsFog?Fe(this.state,e,t,r,i,n,this._transform):[1,1]}getFovAdjustedRange(e){return this._transform.projection.supportsFog?Le(this.state,e):[0,1]}isVisibleOnFrustum(t){if(!this._transform.projection.supportsFog)return!1;const r=[4,5,6,7];for(const i of r){const r=t.points[i];let n;if(r[2]>=0)n=r;else{const o=t.points[i-4];n=e.ac(o,r,o[2]/(o[2]-r[2]))}if(Be(this.state,n[0],n[1],0,this._transform)>=ke)return!0}return!1}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,r,i){return(!i||!1!==i.validate)&&Ce(this,t.call(_e,e.l({value:r,style:{glyphs:!0,sprite:!0},styleSpec:e._})))}}class Ve extends e.E{constructor(t,r,i,n){super(),this.scope=i,this._options=t,this.properties=new e.a8(r),this._transitionable=new e.$(r,i,new Map(n)),this._transitionable.setTransitionOrValue(t.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(e){this._transitionable.setTransitionOrValue(this._options.properties,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(e,t){this._options=e,this._transitionable.setTransitionOrValue(e.properties,t)}shadowsEnabled(){return!!this.properties&&!0===this.properties.get("cast-shadows")}}let je,Ue;class $e{constructor(e,t,r,i){this.screenBounds=e,this.cameraPoint=t,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=r,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,i)}static createFromScreenPoints(t,r){let i,n;if(t instanceof e.P||"number"==typeof t[0]){const o=e.P.convert(t);i=[o],n=r.isPointAboveHorizon(o)}else{const o=e.P.convert(t[0]),s=e.P.convert(t[1]);i=[o,s],n=e.ae(o,s).every((e=>r.isPointAboveHorizon(e)))}return new $e(i,r.getCameraPoint(),n,r)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(t){return e.ae(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const r=this.screenBounds[0],i=1===this.screenBounds.length?this.screenBounds[0].add(new e.P(1,1)):this.screenBounds[1],n=e.ae(r,i,0,!1);return this.cameraPoint.y>i.y&&(this.cameraPoint.x>r.x&&this.cameraPoint.x<i.x?n.splice(3,0,this.cameraPoint):this.cameraPoint.x>=i.x?n[2]=this.cameraPoint:this.cameraPoint.x<=r.x&&(n[3]=this.cameraPoint)),e.af(n,t)}bufferedCameraGeometryGlobe(t){const r=this.screenBounds[0],i=1===this.screenBounds.length?this.screenBounds[0].add(new e.P(1,1)):this.screenBounds[1],n=e.ae(r,i,t),o=this.cameraPoint.clone();switch(3*((o.y>r.y)+(o.y>i.y))+((o.x>r.x)+(o.x>i.x))){case 0:n[0]=o,n[4]=o.clone();break;case 1:n.splice(1,0,o);break;case 2:n[1]=o;break;case 3:n.splice(4,0,o);break;case 5:n.splice(2,0,o);break;case 6:n[3]=o;break;case 7:n.splice(3,0,o);break;case 8:n[2]=o}return n}containsTile(t,r,i,n=0){const o=t.queryPadding/r._pixelsPerMercatorPixel+1,s=i?this._bufferedCameraMercator(o,r):this._bufferedScreenMercator(o,r);let a=t.tileID.wrap+(s.unwrapped?n:0);const l=s.polygon.map((r=>e.ag(t.tileTransform,r,a)));if(!e.ah(l,0,0,e.ab,e.ab))return;a=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?n:0);const c=this.screenGeometryMercator.polygon.map((r=>e.ai(t.tileTransform,r,a))),u=c.map((t=>new e.P(t[0],t[1]))),h=r.getFreeCameraOptions().position||new e.a5(0,0,0),d=e.ai(t.tileTransform,h,a),p=c.map((t=>{const r=e.a6.vec3.sub(t,t,d);return e.a6.vec3.normalize(r,r),new e.aj(d,r)})),f=e.ak(t,1,r.zoom)*r._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:u,tilespaceRays:p,bufferedTilespaceGeometry:l,bufferedTilespaceBounds:(m=e.al(l),m.min.x=e.ap(m.min.x,0,e.ab),m.min.y=e.ap(m.min.y,0,e.ab),m.max.x=e.ap(m.max.x,0,e.ab),m.max.y=e.ap(m.max.y,0,e.ab),m),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:f};var m}_bufferedScreenMercator(e,t){const r=He(e);if(this._screenRaycastCache[r])return this._screenRaycastCache[r];{let i;return i="globe"===t.projection.name?this._projectAndResample(this.bufferedScreenGeometry(e),t):{polygon:this.bufferedScreenGeometry(e).map((e=>t.pointCoordinate3D(e))),unwrapped:!0},this._screenRaycastCache[r]=i,i}}_bufferedCameraMercator(e,t){const r=He(e);if(this._cameraRaycastCache[r])return this._cameraRaycastCache[r];{let i;return i="globe"===t.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(e),t):{polygon:this.bufferedCameraGeometry(e).map((e=>t.pointCoordinate3D(e))),unwrapped:!0},this._cameraRaycastCache[r]=i,i}}_projectAndResample(t,r){const i=function(t,r){const i=e.a6.mat4.multiply([],r.pixelMatrix,r.globeMatrix),n=[0,-e.aq,0,1],o=[0,e.aq,0,1],s=[0,0,0,1];e.a6.vec4.transformMat4(n,n,i),e.a6.vec4.transformMat4(o,o,i),e.a6.vec4.transformMat4(s,s,i);const a=new e.P(n[0]/n[3],n[1]/n[3]),l=new e.P(o[0]/o[3],o[1]/o[3]),c=e.an(t,a)&&n[3]<s[3],u=e.an(t,l)&&o[3]<s[3];if(!c&&!u)return null;const h=function(e,t,r){for(let i=1;i<e.length;i++){const n=qe(t.pointCoordinate3D(e[i-1]).x),o=qe(t.pointCoordinate3D(e[i]).x);if(r<0){if(n<o)return{idx:i,t:-n/(o-1-n)}}else if(o<n)return{idx:i,t:(1-n)/(o+1-n)}}return null}(t,r,c?-1:1);if(!h)return null;const{idx:d,t:p}=h;let f=d>1?Ge(t.slice(0,d),r):[],m=d<t.length?Ge(t.slice(d),r):[];f=f.map((t=>new e.P(qe(t.x),t.y))),m=m.map((t=>new e.P(qe(t.x),t.y)));const _=[...f];0===_.length&&_.push(m[m.length-1]);const g=e.aa(_[_.length-1].y,(0===m.length?f[0]:m[0]).y,p);let y;return y=c?[new e.P(0,g),new e.P(0,0),new e.P(1,0),new e.P(1,g)]:[new e.P(1,g),new e.P(1,1),new e.P(0,1),new e.P(0,g)],_.push(...y),0===m.length?_.push(f[0]):_.push(...m),{polygon:_.map((t=>new e.a5(t.x,t.y))),unwrapped:!1}}(t,r);if(i)return i;const n=function(t,r){let i=!1,n=-1/0,o=0;for(let e=0;e<t.length-1;e++)t[e].x>n&&(n=t[e].x,o=e);for(let e=0;e<t.length-1;e++){const r=(o+e)%(t.length-1),n=t[r],s=t[r+1];Math.abs(n.x-s.x)>.5&&(n.x<s.x?(n.x+=1,0===r&&(t[t.length-1].x+=1)):(s.x+=1,r+1===t.length-1&&(t[0].x+=1)),i=!0)}const s=e.am(r.center.lng);return i&&s<Math.abs(s-1)&&t.forEach((e=>{e.x-=1})),{polygon:t,unwrapped:i}}(Ge(t,r).map((t=>new e.P(qe(t.x),t.y))),r);return{polygon:n.polygon.map((t=>new e.a5(t.x,t.y))),unwrapped:n.unwrapped}}}function Ge(t,r){return e.ao(t,(e=>{const t=r.pointCoordinate3D(e);e.x=t.x,e.y=t.y}),1/256)}function qe(e){return e<0?1+e%1:e%1}function He(e){return 100*e|0}function We(t,r,i,n,o){const s=function(i,n){if(i)return o(i);if(n){if(t.url&&n.tiles&&t.tiles&&delete t.tiles,n.variants){if(!Array.isArray(n.variants))return o(new Error("variants must be an array"));for(const t of n.variants){if(null==t||"object"!=typeof t||t.constructor!==Object)return o(new Error("variant must be an object"));if(!Array.isArray(t.capabilities))return o(new Error("capabilities must be an array"));if(1===t.capabilities.length&&"meshopt"===t.capabilities[0]){n=e.l(n,t);break}}}const i=e.ar(e.l({},n,t),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);i.tiles=r.canonicalizeTileset(i,t.url),o(null,i)}},a=function(e,t,r){if(!e)return null;if(!t&&!r)return e;r=r||e.worldview_default;const i=Object.values(e.language||{});if(0===i.length)return null;const n=Object.values(e.worldview||{});if(0===n.length)return null;const o=i.every((e=>e===t)),s=n.every((e=>e===r));return o&&s?e:t in(e.language_options||{})||r in(e.worldview_options||{})?null:e.language_options&&e.worldview_options?e:null}(t.data,i,n);return a?e.q.frame((()=>s(null,a))):t.url?e.n(r.transformRequest(r.normalizeSourceURL(t.url,null,i,n),e.R.Source),s):e.q.frame((()=>{const{data:e,...r}=t;s(null,r)}))}class Ze{constructor(t,r,i){this.bounds=e.as.convert(this.validateBounds(t)),this.minzoom=r||0,this.maxzoom=i||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(t){const r=Math.pow(2,t.z),i=Math.floor(e.am(this.bounds.getWest())*r),n=Math.floor(e.at(this.bounds.getNorth())*r),o=Math.ceil(e.am(this.bounds.getEast())*r),s=Math.ceil(e.at(this.bounds.getSouth())*r);return t.x>=i&&t.x<o&&t.y>=n&&t.y<s}}class Xe extends e.E{constructor(t,r,i,n){if(super(),this.id=t,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,e.l(this,e.ar(r,["url","scheme","tileSize","promoteId"])),this._options=e.l({type:"vector"},r),this._collectResourceTiming=!!r.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n),this._tileWorkers={},this._deduped=new e.au}load(t){this._loaded=!1,this.fire(new e.x("dataloading",{dataType:"source"}));const r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,i=this.map.getWorldview();this._tileJSONRequest=We(this._options,this.map._requestManager,r,i,((n,o)=>{if(this._tileJSONRequest=null,this._loaded=!0,n)r&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${r}`),i&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${i}`),this.fire(new e.t(n));else if(o){if(e.l(this,o),this.hasWorldviews=!!o.worldview_options,o.worldview_default&&(this.worldviewDefault=o.worldview_default),o.vector_layers){this.vectorLayers=o.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const e of o.vector_layers)this.vectorLayerIds.push(e.id),o.worldview&&o.worldview[e.source]&&this.localizableLayerIds.add(e.id)}o.bounds&&(this.tileBounds=new Ze(o.bounds,this.minzoom,this.maxzoom)),R(o.tiles,this.map._requestManager._customAccessToken),this.fire(new e.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.x("data",{dataType:"source",sourceDataType:"content"}))}t&&t(n)}))}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();const t=e.av(this.id,this.scope);this.load((()=>this.map.style.clearSource(t)))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(e){this.cancelTileJSONRequest()}serialize(){return e.l({},this._options)}loadTile(t,r){const i=t.tileID.canonical.url(this.tiles,this.scheme),n=this.map._requestManager.normalizeTileURL(i),o=this.map._requestManager.transformRequest(n,e.R.Tile),s=this.map.style?this.map.style.getLut(this.scope):null,a=s?{image:s.image.clone()}:null,l={request:o,data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,lut:a,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,pixelRatio:e.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:t.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor()};if(this.hasWorldviews&&e.f(i)&&(l.worldview=this.map.getWorldview()||this.worldviewDefault,l.localizableLayerIds=this.localizableLayerIds),l.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state)"loading"===t.state?t.reloadCallback=r:t.request=t.actor.send("reloadTile",l,c.bind(this));else if(t.actor=this._tileWorkers[n]=this._tileWorkers[n]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",l,c.bind(this),void 0,!0);else{const r=e.aw.call({deduped:this._deduped},l,((e,r)=>{e||!r?c.call(this,e):(l.data={cacheControl:r.cacheControl,expires:r.expires,rawData:r.rawData.slice(0)},t.actor&&t.actor.send("loadTile",l,c.bind(this),void 0,!0))}),!0);t.request={cancel:r}}function c(i,n){return delete t.request,t.aborted?r(null):i&&404!==i.status?r(i):(n&&n.resourceTiming&&(t.resourceTiming=n.resourceTiming),this.map._refreshExpiredTiles&&n&&t.setExpiryData(n),t.loadVectorData(n,this.map.painter),e.ax(this.dispatcher),r(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(e,t){e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope}),e.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Ye extends e.E{constructor(t,r,i,n){super(),this.id=t,this.dispatcher=i,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=e.l({type:"raster"},r),e.l(this,e.ar(r,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new e.x("dataloading",{dataType:"source"})),this._tileJSONRequest=We(this._options,this.map._requestManager,null,null,((r,i)=>{this._tileJSONRequest=null,this._loaded=!0,r?this.fire(new e.t(r)):i&&(e.l(this,i),i.raster_layers&&(this.rasterLayers=i.raster_layers,this.rasterLayerIds=this.rasterLayers.map((e=>e.id))),i.bounds&&(this.tileBounds=new Ze(i.bounds,this.minzoom,this.maxzoom)),R(i.tiles),this.fire(new e.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.x("data",{dataType:"source",sourceDataType:"content"}))),t&&t(r)}))}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();const t=e.av(this.id,this.scope);this.load((()=>this.map.style.clearSource(t)))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(e){this.cancelTileJSONRequest()}serialize(){return e.l({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(t,r){const i=e.q.devicePixelRatio>=2,n=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),i,this.tileSize);t.request=e.o(this.map._requestManager.transformRequest(n,e.R.Tile),((i,n,o,s)=>(delete t.request,t.aborted?(t.state="unloaded",r(null)):i?(t.state="errored",r(i)):n?(this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:o,expires:s}),t.setTexture(n,this.map.painter),t.state="loaded",e.ax(this.dispatcher),void r(null)):r(null))))}abortTile(e,t){e.request&&(e.request.cancel(),delete e.request),t&&t()}unloadTile(t,r){t.texture&&t.texture instanceof e.T?(t.destroy(!0),t.texture&&t.texture instanceof e.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),r&&r()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Je extends Ye{constructor(t,r,i,n){super(t,r,i,n),this.type="raster-array",this.maxzoom=22,this._options=e.l({type:"raster-array"},r)}triggerRepaint(e){const t=this.map.painter._terrain,r=this.map.style.getSourceCache(this.id);t&&t.enabled&&r&&t._clearRenderCacheForTile(r.id,e.tileID),this.map.triggerRepaint()}loadTile(t,r){const i=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),n=this.map._requestManager.transformRequest(i,e.R.Tile);t.requestParams=n,t.actor||(t.actor=this.dispatcher.getActor()),t.request=t.fetchHeader(void 0,((e,i,n,o)=>{if(delete t.request,t.aborted)return t.state="unloaded",r(null);if(e){if(20===e.code)return;return t.state="errored",r(e)}this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:n,expires:o}),t.state="empty",r(null)}))}unloadTile(t,r){const i=t.texture;i&&i instanceof e.T?(t.destroy(!0),this.map.painter.saveTileTexture(i)):(t.destroy(),t.flushQueues(),t._isHeaderLoaded=!1,delete t._mrt,delete t.textureDescriptor),t.fbo&&(t.fbo.destroy(),delete t.fbo),delete t.request,delete t.requestParams,delete t.neighboringTiles,t.state="unloaded"}prepareTile(t,r,i){t._isHeaderLoaded&&("empty"!==t.state&&(t.state="reloading"),t.fetchBand(r,i,((r,i)=>{if(r)return t.state="errored",this.fire(new e.t(r)),void this.triggerRepaint(t);i&&(t.setTexture(i,this.map.painter),t.state="loaded",this.triggerRepaint(t))})))}getInitialBand(e){if(!this.rasterLayers)return 0;const t=this.rasterLayers.find((({id:t})=>t===e)),r=t&&t.fields,i=r&&r.bands&&r.bands;return i?i[0]:0}getTextureDescriptor(t,r,i){if(!t)return;const n=r.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!n)return;let o=null;r instanceof e.aB?o=r.paint.get("raster-array-band"):r instanceof e.aC&&(o=r.paint.get("raster-particle-array-band"));const s=o||this.getInitialBand(n);if(null!=s)if(t.textureDescriptor){if(!t.updateNeeded(n,s)||i)return Object.assign({},t.textureDescriptor,{texture:t.texture})}else this.prepareTile(t,n,s)}}const Ke={vector:Xe,raster:Ye,"raster-dem":class extends Ye{constructor(t,r,i,n){super(t,r,i,n),this.type="raster-dem",this.maxzoom=22,this._options=e.l({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox"}loadTile(t,r){const i=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function n(e,i){e&&(t.state="errored",r(e)),i&&(t.dem=i,t.dem.onDeserialize(),t.needsHillshadePrepare=!0,t.needsDEMTextureUpload=!0,t.state="loaded",r(null))}t.request=e.o(this.map._requestManager.transformRequest(i,e.R.Tile),function(i,o,s,a){if(delete t.request,t.aborted)t.state="unloaded",r(null);else if(i)t.state="errored",r(i);else if(o){this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:s,expires:a});const r=ImageBitmap&&o instanceof ImageBitmap&&e.ay(),i=1-(o.width-e.az(o.width))/2;i<1||t.neighboringTiles||(t.neighboringTiles=this._getNeighboringTiles(t.tileID));const l=r?o:e.q.getImageData(o,i),c={uid:t.uid,coord:t.tileID,source:this.id,scope:this.scope,rawImageData:l,encoding:this.encoding,padding:i};t.actor&&"expired"!==t.state||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",c,n.bind(this),void 0,!0))}}.bind(this))}_getNeighboringTiles(t){const r=t.canonical,i=Math.pow(2,r.z),n=(r.x-1+i)%i,o=0===r.x?t.wrap-1:t.wrap,s=(r.x+1+i)%i,a=r.x+1===i?t.wrap+1:t.wrap,l={};return l[new e.aA(t.overscaledZ,o,r.z,n,r.y).key]={backfilled:!1},l[new e.aA(t.overscaledZ,a,r.z,s,r.y).key]={backfilled:!1},r.y>0&&(l[new e.aA(t.overscaledZ,o,r.z,n,r.y-1).key]={backfilled:!1},l[new e.aA(t.overscaledZ,t.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},l[new e.aA(t.overscaledZ,a,r.z,s,r.y-1).key]={backfilled:!1}),r.y+1<i&&(l[new e.aA(t.overscaledZ,o,r.z,n,r.y+1).key]={backfilled:!1},l[new e.aA(t.overscaledZ,t.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},l[new e.aA(t.overscaledZ,a,r.z,s,r.y+1).key]={backfilled:!1}),l}},"raster-array":Je,geojson:class extends e.E{constructor(t,r,i,n){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=i.getActor(),this.setEventedParent(n),this._data=r.data,this._options=e.l({},r),this._collectResourceTiming=r.collectResourceTiming,void 0!==r.maxzoom&&(this.maxzoom=r.maxzoom),void 0!==r.minzoom&&(this.minzoom=r.minzoom),r.type&&(this.type=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId;const o=e.ab/this.tileSize;this.workerOptions=e.l({source:this.id,scope:this.scope,cluster:r.cluster||!1,geojsonVtOptions:{buffer:(void 0!==r.buffer?r.buffer:128)*o,tolerance:(void 0!==r.tolerance?r.tolerance:.375)*o,extent:e.ab,maxZoom:this.maxzoom,lineMetrics:r.lineMetrics||!1,generateId:r.generateId||!1},superclusterOptions:{maxZoom:void 0!==r.clusterMaxZoom?r.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,r.clusterMinPoints||2),extent:e.ab,radius:(void 0!==r.clusterRadius?r.clusterRadius:50)*o,log:!1,generateId:r.generateId||!1},clusterProperties:r.clusterProperties,filter:r.filter,dynamic:r.dynamic},r.workerOptions)}onAdd(e){this.map=e,this.setData(this._data)}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(t){if(!this._options.dynamic)return this.fire(new e.t(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if("string"!=typeof t&&("Feature"===t.type&&(t={type:"FeatureCollection",features:[t]}),"FeatureCollection"!==t.type))return this.fire(new e.t(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&"string"!=typeof t&&"string"!=typeof this._data&&"FeatureCollection"===this._data.type){const e=new Map;for(const t of this._data.features)e.set(t.id,t);for(const r of t.features)e.set(r.id,r);this._data.features=[...e.values()]}else this._data=t;return this._updateWorkerData(!0),this}getClusterExpansionZoom(e,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:e,source:this.id,scope:this.scope},t),this}getClusterChildren(e,t){return this.actor.send("geojson.getClusterChildren",{clusterId:e,source:this.id,scope:this.scope},t),this}getClusterLeaves(e,t,r,i){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:e,limit:t,offset:r},i),this}_updateWorkerData(t=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new e.x("dataloading",{dataType:"source"})),this._loaded=!1;const r=e.l({append:t},this.workerOptions);r.scope=this.scope;const i=this._data;"string"==typeof i?(r.request=this.map._requestManager.transformRequest(e.q.resolveURL(i),e.R.Source),r.request.collectResourceTiming=this._collectResourceTiming):r.data=JSON.stringify(i),this._pendingLoad=this.actor.send(`${this.type}.loadData`,r,((r,i)=>{if(this._loaded=!0,this._pendingLoad=null,r)this.fire(new e.t(r));else{const r={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&i&&i.resourceTiming&&i.resourceTiming[this.id]&&(r.resourceTiming=i.resourceTiming[this.id]),t&&(this._partialReload=!0),this.fire(new e.x("data",r)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(t),this._coalesce=!1)}))}loaded(){return this._loaded}loadTile(t,r){const i=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const n=this.map.style?this.map.style.getLut(this.scope):null,o=n?{image:n.image.clone()}:null,s=this._partialReload,a={type:this.type,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:o,scope:this.scope,pixelRatio:e.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,scaleFactor:this.map.getScaleFactor(),partial:s};t.request=this.actor.send(i,a,((e,n)=>s&&!n?(t.state="loaded",r(null)):(delete t.request,t.destroy(),t.aborted?r(null):e?r(e):(t.loadVectorData(n,this.map.painter,"reloadTile"===i),r(null)))),void 0,"loadTile"===i)}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}unloadTile(e,t){this.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope}),e.destroy()}onRemove(e){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return e.l({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends e.aD{constructor(e,t,r,i){super(e,t,r,i),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const r of t.urls)this.urls.push(this.map._requestManager.transformRequest(r,e.R.Source).url);e.aE(this.urls,((t,r)=>{this._loaded=!0,t?this.fire(new e.t(t)):r&&(this.video=r,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading())}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const r=this.video.seekable;t<r.start(0)||t>r.end(0)?this.fire(new e.t(new e.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${r.start(0)} and ${r.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const t=this.map.painter.context,r=t.gl;this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new e.T(t,this.video,r.RGBA8),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(t)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:e.aD,model:class extends e.E{constructor(e,t,r,i){super(),this.id=e,this.type="model",this.models=[],this._loaded=!1,this._options=t}load(){const t=[];for(const r in this._options.models){const i=this._options.models[r],n=e.aG(this.map._requestManager.transformRequest(i.uri,e.R.Model).url).then((t=>{if(!t)return;const n=e.aH(t),o=new e.aI(r,i.position,i.orientation,n);o.computeBoundsAndApplyParent(),this.models.push(o)})).catch((t=>{this.fire(new e.t(new Error(`Could not load model ${r} from ${i.uri}: ${t.message}`)))}));t.push(n)}return Promise.allSettled(t).then((()=>{this._loaded=!0,this.fire(new e.x("data",{dataType:"source",sourceDataType:"metadata"}))})).catch((t=>{this.fire(new e.t(new Error(`Could not load models: ${t.message}`)))}))}onAdd(e){this.map=e,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(e,t){}serialize(){return{type:"model"}}},"batched-model":class extends e.E{constructor(e,t,r,i){super(),this.type="batched-model",this.id=e,this.tileSize=512,this._options=t,this.tiles=this._options.tiles,this.maxzoom=t.maxzoom||19,this.minzoom=t.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=r,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(i)}onAdd(e){this.map=e,this.load()}load(t){this._loaded=!1,this.fire(new e.x("dataloading",{dataType:"source"}));const r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,i=this.map.getWorldview();this._tileJSONRequest=We(this._options,this.map._requestManager,r,i,((n,o)=>{this._tileJSONRequest=null,this._loaded=!0,n?(r&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${r}`),i&&2!==i.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${i}`),this.fire(new e.t(n))):o&&(e.l(this,o),o.bounds&&(this.tileBounds=new Ze(o.bounds,this.minzoom,this.maxzoom)),R(o.tiles,this.map._requestManager._customAccessToken),this.fire(new e.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.x("data",{dataType:"source",sourceDataType:"content"}))),t&&t(n)}))}hasTransition(){return!1}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loaded(){return this._loaded}loadTile(t,r){const i=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme)),n={request:this.map._requestManager.transformRequest(i,e.R.Tile),data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,lut:null,maxZoom:null,promoteId:null,pixelRatio:null,scaleFactor:null};if(t.actor&&"expired"!==t.state)if("loading"===t.state)t.reloadCallback=r;else{if(t.buckets){const e=Object.values(t.buckets);for(const t of e)t.dirty=!0;return void(t.state="loaded")}t.request=t.actor.send("reloadTile",n,o.bind(this))}else t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",n,o.bind(this),void 0,!0);function o(e,i){return t.aborted?r(null):e&&404!==e.status?r(e):(this.map._refreshExpiredTiles&&i&&t.setExpiryData(i),t.loadModelData(i,this.map.painter),t.state="loaded",void r(null))}}serialize(){return e.l({},this._options)}},canvas:class extends e.aD{constructor(t,r,i,n){super(t,r,i,n),r.coordinates?Array.isArray(r.coordinates)&&4===r.coordinates.length&&!r.coordinates.some((e=>!Array.isArray(e)||2!==e.length||e.some((e=>"number"!=typeof e))))||this.fire(new e.t(new e.V(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.t(new e.V(`sources.${t}`,null,'missing required property "coordinates"'))),r.animate&&"boolean"!=typeof r.animate&&this.fire(new e.t(new e.V(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),r.canvas?"string"==typeof r.canvas||r.canvas instanceof HTMLCanvasElement||this.fire(new e.t(new e.V(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new e.t(new e.V(`sources.${t}`,null,'missing required property "canvas"'))),this.options=r,this.animate=void 0===r.animate||r.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new e.t(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(e){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const r=this.map.painter.context;this.texture?!t&&!this._playing||this.texture instanceof e.aF||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new e.T(r,this.canvas,r.gl.RGBA8,{premultiply:!0}),this._prepareData(r)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}},custom:class extends e.E{constructor(t,r,i,n){super(),this.id=t,this.type="custom",this._dataType="raster",this._dispatcher=i,this._implementation=r,this.setEventedParent(n),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new e.t(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new e.t(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Ze(this._implementation.bounds,this.minzoom,this.maxzoom)),r.update=this._update.bind(this),r.clearTiles=this._clearTiles.bind(this),r.coveringTiles=this._coveringTiles.bind(this),e.l(this,e.ar(r,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return e.ar(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new e.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.x("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(t){this.map=t,this._loaded=!1,this.fire(new e.x("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(t),this.load()}onRemove(e){this._implementation.onRemove&&this._implementation.onRemove(e)}hasTile(e){if(this._implementation.hasTile){const{x:t,y:r,z:i}=e.canonical;return this._implementation.hasTile({x:t,y:r,z:i})}return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e,t){const{x:r,y:i,z:n}=e.tileID.canonical,o=new AbortController;e.request=Promise.resolve(this._implementation.loadTile({x:r,y:i,z:n},{signal:o.signal})).then(function(r){return delete e.request,e.aborted?(e.state="unloaded",t(null)):void 0===r?(e.state="errored",t(null)):null===r?(this.loadTileData(e,{width:this.tileSize,height:this.tileSize,data:null}),e.state="loaded",t(null)):function(e){return e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof ImageBitmap||e instanceof HTMLImageElement}(r)?(this.loadTileData(e,r),e.state="loaded",void t(null)):(e.state="errored",t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}.bind(this)).catch((r=>{20!==r.code&&(e.state="errored",t(r))})),e.request.cancel=()=>o.abort()}loadTileData(e,t){e.setTexture(t,this.map.painter)}unloadTile(t,r){if(t.texture&&t.texture instanceof e.T?(t.destroy(!0),t.texture&&t.texture instanceof e.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),this._implementation.unloadTile){const{x:e,y:r,z:i}=t.tileID.canonical;this._implementation.unloadTile({x:e,y:r,z:i})}r&&r()}abortTile(e,t){e.request&&e.request.cancel&&(e.request.cancel(),delete e.request),t&&t()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map((e=>({x:e.canonical.x,y:e.canonical.y,z:e.canonical.z})))}_clearTiles(){const t=e.av(this.id,this.scope);this.map.style.clearSource(t)}_update(){this.fire(new e.x("data",{dataType:"source",sourceDataType:"content"}))}}},Qe=function(t,r,i,n){const o=new Ke[r.type](t,r,i,n);if(o.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${o.id}`);return e.aJ(["load","abort","unload","serialize","prepare"],o),o};function et(t,r){const i=e.a6.mat4.identity([]);return e.a6.mat4.scale(i,i,[.5*t.width,.5*-t.height,1]),e.a6.mat4.translate(i,i,[1,-1,0]),e.a6.mat4.multiply(i,i,t.calculateProjMatrix(r.toUnwrapped())),Float32Array.from(i)}function tt(t,r,i,n,o,s,a,l,c=!1){const u=t.tilesIn(i,l,c);u.sort(it);const h=[];for(const e of u)h.push({wrappedTileID:e.tile.tileID.wrapped().key,queryResults:e.tile.queryRenderedFeatures(r,t._state,e,n,o,s,a,et(t.transform,e.tile.tileID),c)});const d=function(e){const t={},r={};for(const i of e){const e=i.queryResults,n=i.wrappedTileID,o=r[n]=r[n]||{};for(const r in e){const i=e[r],n=o[r]=o[r]||{},s=t[r]=t[r]||[];for(const e of i)n[e.featureIndex]||(n[e.featureIndex]=!0,s.push(e))}}return t}(h);for(const r in d)d[r].forEach((i=>{const n=i.feature,o=n.layer;o&&"background"!==o.type&&"sky"!==o.type&&"slot"!==o.type&&(e.aK(r)||(n.source=o.source,o["source-layer"]&&(n.sourceLayer=o["source-layer"])),n.state=void 0!==n.id?t.getFeatureState(o["source-layer"],n.id):{})}));return d}function rt(e,t){const r=e.getRenderableIds().map((t=>e.getTileByID(t))),i=[],n={};for(let e=0;e<r.length;e++){const o=r[e],s=o.tileID.canonical.key;n[s]||(n[s]=!0,o.querySourceFeatures(i,t))}return i}function it(e,t){const r=e.tileID,i=t.tileID;return r.overscaledZ-i.overscaledZ||r.canonical.y-i.canonical.y||r.wrap-i.wrap||r.canonical.x-i.canonical.x}function nt(e,t){const r={};if(!t)return r;for(const i of e){const e=i.layerIds.map((e=>t.getLayer(e))).filter(Boolean);if(0!==e.length){i.layers=e,i.stateDependentLayerIds&&(i.stateDependentLayers=i.stateDependentLayerIds.map((t=>e.filter((e=>e.id===t))[0])));for(const t of e)r[t.fqid]=i}}return r}const ot=32,st=33,at=new Uint16Array(8184);for(let e=0;e<2046;e++){let t=e+2,r=0,i=0,n=0,o=0,s=0,a=0;for(1&t?n=o=s=ot:r=i=a=ot;(t>>=1)>1;){const e=r+n>>1,l=i+o>>1;1&t?(n=r,o=i,r=s,i=a):(r=n,i=o,n=s,o=a),s=e,a=l}const l=4*e;at[l+0]=r,at[l+1]=i,at[l+2]=n,at[l+3]=o}const lt=new Uint16Array(2178),ct=new Uint8Array(1089),ut=new Uint16Array(1089);function ht(e){return 0===e?-.03125:32===e?.03125:0}const dt={type:2,extent:e.ab,loadGeometry:()=>[[new e.P(0,0),new e.P(e.ab+1,0),new e.P(e.ab+1,e.ab+1),new e.P(0,e.ab+1),new e.P(0,0)]]};class pt{constructor(t,r,i,n,o){this.tileID=t,this.uid=e.aQ(),this.uses=0,this.tileSize=r,this.tileZoom=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=o,n&&n.style&&(this._lastUpdatedBrightness=n.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",n&&n.transform&&(this.projection=n.transform.projection)}registerFadeDuration(t){const r=t+this.timeAdded;r<e.q.now()||this.fadeEndTime&&r<this.fadeEndTime||(this.fadeEndTime=r)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}get tileTransform(){return this._tileTransform||(this._tileTransform=e.aL(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(t,r,i){if(this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=nt(t.buckets,r.style),this.hasSymbolBuckets=!1;for(const t in this.buckets){const r=this.buckets[t];if(r instanceof e.aS){if(this.hasSymbolBuckets=!0,!i)break;r.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const t in this.buckets){const r=this.buckets[t];if(r instanceof e.aS&&r.hasRTLText){this.hasRTLText=!0,e.aT();break}}this.queryPadding=0;for(const e in this.buckets){const t=this.buckets[e],i=r.style.getOwnLayer(e);if(!i)continue;const n=i.queryRadius(t);this.queryPadding=Math.max(this.queryPadding,n)}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),t.lineAtlas&&(this.lineAtlas=t.lineAtlas),this._lastUpdatedBrightness=t.brightness}else this.collisionBoxArray=new e.aR}unloadVectorData(){if(this.hasData()){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}loadModelData(e,t,r){e&&(e.resourceTiming&&(this.resourceTiming=e.resourceTiming),this.buckets={...this.buckets,...nt(e.buckets,t.style)},e.featureIndex&&(this.latestFeatureIndex=e.featureIndex))}getBucket(e){return this.buckets[e.fqid]}upload(t){for(const e in this.buckets){const r=this.buckets[e];r.uploadPending()&&r.upload(t)}const r=t.gl,i=this.imageAtlas;if(i&&!i.uploaded){const n=!!Object.keys(i.patternPositions).length;this.imageAtlasTexture=new e.T(t,i.image,r.RGBA8,{useMipmap:n}),this.imageAtlas.uploaded=!0}this.glyphAtlasImage&&(this.glyphAtlasTexture=new e.T(t,this.glyphAtlasImage,r.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new e.T(t,this.lineAtlas.image,r.R8),this.lineAtlas.uploaded=!0)}prepare(e,t,r){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture,r),!t||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const i=t.style.getBrightness();(this._lastUpdatedBrightness||i)&&(this._lastUpdatedBrightness&&i&&Math.abs(this._lastUpdatedBrightness-i)<.001||(this._lastUpdatedBrightness=i,this.updateBuckets(t)))}queryRenderedFeatures(e,t,r,i,n,o,s,a,l){return this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)?this.latestFeatureIndex.query({tileResult:r,pixelPosMatrix:a,transform:s,filter:i,layers:n,availableImages:o,tileTransform:this.tileTransform},e,t):{}}querySourceFeatures(t,r){const i=this.latestFeatureIndex;if(!i||!i.rawTileData)return;const n=i.loadVTLayers(),o=r?r.sourceLayer:"",s=n._geojsonTileLayer||n[o];if(!s)return;const a=e.aU(r&&r.filter),{z:l,x:c,y:u}=this.tileID.canonical,h={z:l,x:c,y:u};for(let r=0;r<s.length;r++){const n=s.feature(r);if(a.needGeometry){const t=e.aV(n,!0);if(!a.filter(new e.a3(this.tileID.overscaledZ),t,this.tileID.canonical))continue}else if(!a.filter(new e.a3(this.tileID.overscaledZ),n))continue;const d=i.getId(n,o),p=new e.aW(n,l,c,u,d);p.tile=h,t.push(p)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return!!this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const r=this.expirationTime;if(t.cacheControl){const r=e.aX(t.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const e=Date.now();let t=!1;if(this.expirationTime>e)t=!1;else if(r)if(this.expirationTime<r)t=!0;else{const i=this.expirationTime-r;i?this.expirationTime=e+Math.max(i,3e4):t=!0}else t=!0;t?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}refreshFeatureState(e){this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)&&e&&this.updateBuckets(e)}updateBuckets(t){if(!this.latestFeatureIndex)return;const r=this.latestFeatureIndex.loadVTLayers(),i=t.style.listImages(),n=t.style.getBrightness();for(const o in this.buckets){if(!t.style.hasLayer(o))continue;const s=this.buckets[o],a=s.layers[0],l=a.sourceLayer||"_geojsonTileLayer",c=r[l],u=t.style.getSourceCache(a.source,a.scope);let h={};u&&(h=u._state.getState(l,void 0)),s.update(h,c,i,this.imageAtlas&&this.imageAtlas.patternPositions||{},n),(s instanceof e.aY||s instanceof e.aZ)&&t._terrain&&t._terrain.enabled&&u&&s.programConfigurations.needsUpload&&t._terrain._clearRenderCacheForTile(u.id,this.tileID);const d=t&&t.style&&t.style.getOwnLayer(o);d&&(this.queryPadding=Math.max(this.queryPadding,d.queryRadius(s)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<e.q.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=e.q.now()+t}setTexture(t,r){const i=r.context,n=i.gl;this.texture=this.texture||r.getTileTexture(t.width),this.texture&&this.texture instanceof e.T?this.texture.update(t):(this.texture=new e.T(i,t,n.RGBA8,{useMipmap:!0}),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE))}setDependencies(e,t){const r={};for(const e of t)r[e]=!0;this.dependencies[e]=r}hasDependency(e,t){for(const r of e){const e=this.dependencies[r];if(e)for(const r of t)if(e[r])return!0}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(t,r){if(!r||"mercator"===r.name||this._tileDebugBuffer)return;const i=e.a_(dt,this.tileID.canonical,this.tileTransform)[0],n=new e.a$,o=new e.b0;for(let e=0;e<i.length;e++){const{x:t,y:r}=i[e];n.emplaceBack(t,r),o.emplaceBack(e)}o.emplaceBack(0),this._tileDebugIndexBuffer=t.createIndexBuffer(o),this._tileDebugBuffer=t.createVertexBuffer(n,e.b1.members),this._tileDebugSegments=e.b2.simpleSegment(0,0,n.length,o.length)}_makeTileBoundsBuffers(t,r){if(this._tileBoundsBuffer||!r||"mercator"===r.name)return;const i=e.a_(dt,this.tileID.canonical,this.tileTransform)[0];let n,o;if(this.isRaster){const t=function(t,r){const i=e.aL(t,r),n=Math.pow(2,t.z);for(let o=0;o<st;o++)for(let s=0;s<st;s++){const a=e.aM((t.x+(s+ht(s))/ot)/n),l=e.aN((t.y+(o+ht(o))/ot)/n),c=r.project(a,l),u=o*st+s;lt[2*u+0]=Math.round((c.x*i.scale-i.x)*e.ab),lt[2*u+1]=Math.round((c.y*i.scale-i.y)*e.ab)}ct.fill(0),ut.fill(0);for(let e=2045;e>=0;e--){const t=4*e,r=at[t+0],i=at[t+1],n=at[t+2],o=at[t+3],s=r+n>>1,a=i+o>>1,l=s+a-i,c=a+r-s,u=i*st+r,h=o*st+n,d=a*st+s,p=Math.hypot((lt[2*u+0]+lt[2*h+0])/2-lt[2*d+0],(lt[2*u+1]+lt[2*h+1])/2-lt[2*d+1])>=16;ct[d]=ct[d]||(p?1:0),e<1022&&(ct[d]=ct[d]||ct[(i+c>>1)*st+(r+l>>1)]||ct[(o+c>>1)*st+(n+l>>1)])}const o=new e.aO,s=new e.aP;let a=0;function l(t,r){const i=r*st+t;return 0===ut[i]&&(o.emplaceBack(lt[2*i+0],lt[2*i+1],t*e.ab/ot,r*e.ab/ot),ut[i]=++a),ut[i]-1}function c(e,t,r,i,n,o){const a=e+r>>1,u=t+i>>1;if(Math.abs(e-n)+Math.abs(t-o)>1&&ct[u*st+a])c(n,o,e,t,a,u),c(r,i,n,o,a,u);else{const a=l(e,t),c=l(r,i),u=l(n,o);s.emplaceBack(a,c,u)}}return c(0,0,ot,ot,ot,0),c(ot,ot,0,0,0,ot),{vertices:o,indices:s}}(this.tileID.canonical,r);n=t.vertices,o=t.indices}else{n=new e.aO,o=new e.aP;for(const{x:e,y:t}of i)n.emplaceBack(e,t,0,0);const t=e.b3(n.int16,void 0,4);for(let e=0;e<t.length;e+=3)o.emplaceBack(t[e],t[e+1],t[e+2])}this._tileBoundsBuffer=t.createVertexBuffer(n,e.b4.members),this._tileBoundsIndexBuffer=t.createIndexBuffer(o),this._tileBoundsSegments=e.b2.simpleSegment(0,0,n.length,o.length)}_makeGlobeTileDebugBuffers(t,r){const i=r.projection;if(!i||"globe"!==i.name||r.freezeTileCoverage)return;const n=this.tileID.canonical,o=e.b5(n,r),s=e.b6(o),a=e.a9(r.zoom);let l;a>0&&(l=e.a6.mat4.invert(new Float64Array(16),r.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(t,n,r,s,l,a),this._makeGlobeTileDebugTextBuffer(t,n,r,s,l,a)}_globePoint(t,r,i,n,o,s,a){let l=e.b7(t,r,i);if(s){const o=1<<i.z,c=e.am(n.center.lng),u=e.at(n.center.lat),h=(i.x+.5)/o-c;let d=0;h>.5?d=-1:h<-.5&&(d=1);let p=(t/e.ab+i.x)/o+d,f=(r/e.ab+i.y)/o;p=(p-c)*n._pixelsPerMercatorPixel+c,f=(f-u)*n._pixelsPerMercatorPixel+u;const m=[p*n.worldSize,f*n.worldSize,0];e.a6.vec3.transformMat4(m,m,s),l=e.b8(l,m,a)}return e.a6.vec3.transformMat4(l,l,o)}_makeGlobeTileDebugBorderBuffer(t,r,i,n,o,s){const a=new e.a$,l=new e.b0,c=new e.b9,u=(e,t,u,h,d)=>{const p=(u-e)/(d-1),f=(h-t)/(d-1),m=a.length;for(let u=0;u<d;u++){const h=e+u*p,d=t+u*f;a.emplaceBack(h,d);const _=this._globePoint(h,d,r,i,n,o,s);c.emplaceBack(_[0],_[1],_[2]),l.emplaceBack(m+u)}},h=e.ab;u(0,0,h,0,16),u(h,0,h,h,16),u(h,h,0,h,16),u(0,h,0,0,16),this._tileDebugIndexBuffer=t.createIndexBuffer(l),this._tileDebugBuffer=t.createVertexBuffer(a,e.b1.members),this._globeTileDebugBorderBuffer=t.createVertexBuffer(c,e.ba.members),this._tileDebugSegments=e.b2.simpleSegment(0,0,a.length,l.length)}_makeGlobeTileDebugTextBuffer(t,r,i,n,o,s){const a=e.ab/4,l=new e.a$,c=new e.aP,u=new e.b9,h=25;c.reserve(32),l.reserve(h),u.reserve(h);const d=(e,t)=>h*e+t;for(let e=0;e<h;e++){const t=e*a;for(let e=0;e<h;e++){const c=e*a;l.emplaceBack(c,t);const h=this._globePoint(c,t,r,i,n,o,s);u.emplaceBack(h[0],h[1],h[2])}}for(let e=0;e<4;e++)for(let t=0;t<4;t++){const r=d(e,t),i=d(e,t+1),n=d(e+1,t),o=d(e+1,t+1);c.emplaceBack(r,i,n),c.emplaceBack(n,i,o)}this._tileDebugTextIndexBuffer=t.createIndexBuffer(c),this._tileDebugTextBuffer=t.createVertexBuffer(l,e.b1.members),this._globeTileDebugTextBuffer=t.createVertexBuffer(u,e.ba.members),this._tileDebugTextSegments=e.b2.simpleSegment(0,0,h,32)}destroy(t=!1){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),!t&&this.texture&&this.texture instanceof e.T&&(this.texture.destroy(),delete this.texture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}}e.bb.setPbf(e.bc);class ft extends pt{constructor(e,t,r,i,n){super(e,t,r,i,n),this._workQueue=[],this._fetchQueue=[],this._isHeaderLoaded=!1}setTexture(t,r){const i=r.context,n=i.gl;this.texture=this.texture||r.getTileTexture(t.width),this.texture&&this.texture instanceof e.T?this.texture.update(t,{premultiply:!1}):this.texture=new e.T(i,t,n.RGBA8,{premultiply:!1})}flushQueues(){for(;this._workQueue.length;)this._workQueue.pop()();for(;this._fetchQueue.length;)this._fetchQueue.pop()()}fetchHeader(t=16384,r){const i=this._mrt=new e.bb(30),n=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(t-1)}});return this.entireBuffer=null,this.request=e.bd(n,((e,n,o,s)=>{if(e)r(e);else try{const e=i.getHeaderLength(n);if(e>t)return void(this.request=this.fetchHeader(e,r));i.parseHeader(n),this._isHeaderLoaded=!0;let a=0;for(const e of Object.values(i.layers))a=Math.max(a,e.dataIndex[e.dataIndex.length-1].last_byte);n.byteLength>=a&&(this.entireBuffer=n),r(null,this.entireBuffer||n,o,s)}catch(e){r(e)}})),this.request}fetchBand(t,r,i){const n=this._mrt;if(!this._isHeaderLoaded||!n)return void i(new Error("Tile header is not ready"));const o=this.actor;if(!o)return void i(new Error("Can't fetch tile band without an actor"));let s;const a=(e,n)=>{s.complete(e,n),e?i(e):(this.updateTextureDescriptor(t,r),i(null,this.textureDescriptor&&this.textureDescriptor.img))},l=(e,t)=>{if(e)return i(e);const r=o.send("decodeRasterArray",{buffer:t,task:s},a,void 0,!0);this._workQueue.push((()=>{r&&r.cancel(),s.cancel()}))},c=n.getLayer(t);if(!c)return void i(new Error(`Unknown sourceLayer "${t}"`));if(c.hasDataForBand(r))return this.updateTextureDescriptor(t,r),void i(null,this.textureDescriptor?this.textureDescriptor.img:null);const u=c.getDataRange([r]);if(s=n.createDecodingTask(u),!s||s.tasks.length)if(this.flushQueues(),this.entireBuffer)l(null,this.entireBuffer.slice(u.firstByte,u.lastByte+1));else{const t=Object.assign({},this.requestParams,{headers:{Range:`bytes=${u.firstByte}-${u.lastByte}`}}),r=e.bd(t,l);this._fetchQueue.push((()=>{r.cancel(),s.cancel()}))}else i(null)}updateNeeded(e,t){return(!this.textureDescriptor||this.textureDescriptor.band!==t||this.textureDescriptor.layer!==e)&&"errored"!==this.state}updateTextureDescriptor(t,r){if(!this._mrt)return;const i=this._mrt.getLayer(t);if(!i||!i.hasBand(r)||!i.hasDataForBand(r))return;const{bytes:n,tileSize:o,buffer:s,offset:a,scale:l}=i.getBandView(r),c=o+2*s,u={data:n,width:c,height:c},h=this.texture;h&&h instanceof e.T&&h.update(u,{premultiply:!1}),this.textureDescriptor={layer:t,band:r,img:u,buffer:s,offset:a,tileSize:o,format:i.pixelFormat,mix:[l,256*l,65536*l,16777216*l]}}}class mt{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(const e in this.data)for(const t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,r){const i=e.wrapped().key;void 0===this.data[i]&&(this.data[i]=[]);const n={value:t,timeout:void 0};if(void 0!==r&&(n.timeout=setTimeout((()=>{this.remove(e,n)}),r)),this.data[i].push(n),this.order.push(i),this.order.length>this.max){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){const t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;const r=e.wrapped().key,i=void 0===t?0:this.data[r].indexOf(t),n=this.data[r][i];return this.data[r].splice(i,1),n.timeout&&clearTimeout(n.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(n.value),this.order.splice(this.order.indexOf(r),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){const t=[];for(const r in this.data)for(const i of this.data[r])e(i.value)||t.push(i);for(const e of t)this.remove(e.value.tileID,e)}}class _t{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,r,i){const n=String(r);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][n]=this.stateChanges[t][n]||{},e.l(this.stateChanges[t][n],i),null===this.deletedStates[t]){this.deletedStates[t]={};for(const e in this.state[t])e!==n&&(this.deletedStates[t][e]=null)}else if(this.deletedStates[t]&&null===this.deletedStates[t][n]){this.deletedStates[t][n]={};for(const e in this.state[t][n])i[e]||(this.deletedStates[t][n][e]=null)}else for(const e in i)this.deletedStates[t]&&this.deletedStates[t][n]&&null===this.deletedStates[t][n][e]&&delete this.deletedStates[t][n][e]}removeFeatureState(e,t,r){if(null===this.deletedStates[e])return;const i=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},r&&void 0!==t)null!==this.deletedStates[e][i]&&(this.deletedStates[e][i]=this.deletedStates[e][i]||{},this.deletedStates[e][i][r]=null);else if(void 0!==t)if(this.stateChanges[e]&&this.stateChanges[e][i])for(r in this.deletedStates[e][i]={},this.stateChanges[e][i])this.deletedStates[e][i][r]=null;else this.deletedStates[e][i]=null;else this.deletedStates[e]=null}getState(t,r){const i=this.state[t]||{},n=this.stateChanges[t]||{},o=this.deletedStates[t];if(null===o)return{};if(void 0!==r){const t=String(r),s=e.l({},i[t],n[t]);if(o){const e=o[r];if(null===e)return{};for(const t in e)delete s[t]}return s}const s=e.l({},i,n);if(o)for(const e in o)delete s[e];return s}initializeTileState(e,t){e.refreshFeatureState(t)}coalesceChanges(t,r){const i={};for(const t in this.stateChanges){this.state[t]=this.state[t]||{};const r={};for(const i in this.stateChanges[t])this.state[t][i]||(this.state[t][i]={}),e.l(this.state[t][i],this.stateChanges[t][i]),r[i]=this.state[t][i];i[t]=r}for(const t in this.deletedStates){this.state[t]=this.state[t]||{};const r={};if(null===this.deletedStates[t])for(const e in this.state[t])r[e]={},this.state[t][e]={};else for(const e in this.deletedStates[t]){if(null===this.deletedStates[t][e])this.state[t][e]={};else if(this.state[t][e])for(const r of Object.keys(this.deletedStates[t][e]))delete this.state[t][e][r];r[e]=this.state[t][e]}i[t]=i[t]||{},e.l(i[t],r)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(i).length)for(const e in t)t[e].refreshFeatureState(r)}}class gt extends e.E{constructor(e,t,r){super(),this.id=e,this._onlySymbols=r,t.on("data",(e=>{"source"===e.dataType&&"metadata"===e.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===e.dataType&&"content"===e.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))})),t.on("error",(()=>{this._sourceErrored=!0})),this._source=t,this._tiles={},this._cache=new mt(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=t.minTileCacheSize,this._maxTileCacheSize=t.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new _t,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"raster-array"===this._source.type||"custom"===this._source.type&&"raster"===this._source._dataType}onAdd(e){this.map=e,this._minTileCacheSize=void 0===this._minTileCacheSize&&e?e._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&e?e._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(const e in this._tiles){const t=this._tiles[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(e,t){return e.isSymbolTile=this._onlySymbols,e.isExtraShadowCaster=this._shadowCasterTiles[e.tileID.key],this._source.loadTile(e,t)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e)}_abortTile(e){if(this._source.abortTile)return this._source.abortTile(e)}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const t in this._tiles){const r=this._tiles[t];r.upload(e),r.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return e.be(this._tiles).map((e=>e.tileID)).sort(yt).map((e=>e.key))}getRenderableIds(t,r){const i=[];for(const e in this._tiles)this._isIdRenderable(+e,t,r)&&i.push(this._tiles[e]);return t?i.sort(((t,r)=>{const i=t.tileID,n=r.tileID,o=new e.P(i.canonical.x,i.canonical.y)._rotate(this.transform.angle),s=new e.P(n.canonical.x,n.canonical.y)._rotate(this.transform.angle);return i.overscaledZ-n.overscaledZ||s.y-o.y||s.x-o.x})).map((e=>e.tileID.key)):i.map((e=>e.tileID)).sort(yt).map((e=>e.key))}hasRenderableParent(e){const t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}_isIdRenderable(e,t,r){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())&&(r||!this._shadowCasterTiles[e])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)"errored"!==this._tiles[e].state&&this._reloadTile(+e,"reloading")}}_reloadTile(e,t){const r=this._tiles[e];r&&("loading"!==r.state&&(r.state=t),this._loadTile(r,this._tileLoaded.bind(this,r,e,t)))}_tileLoaded(t,r,i,n){if(n)if(t.state="errored",404!==n.status)this._source.fire(new e.t(n,{tile:t}));else{if(this._source.fire(new e.x("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:t})),!(t.tileID.key in this._loadedParentTiles))return;if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const e=this.map.painter.terrain;this.update(this.transform,e.getScaledDemTileSize(),!0),e.resetTileLookupCache(this.id)}else this.update(this.transform)}else t.timeAdded=e.q.now(),"expired"===i&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(r,t),"raster-dem"===this._source.type&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),this._source.fire(new e.x("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id}))}_backfillDEM(e){const t=this.getRenderableIds();for(let i=0;i<t.length;i++){const n=t[i];if(e.neighboringTiles&&e.neighboringTiles[n]){const t=this.getTileByID(n);r(e,t),r(t,e)}}function r(e,t){if(!e.dem||e.dem.borderReady)return;e.needsHillshadePrepare=!0,e.needsDEMTextureUpload=!0;let r=t.tileID.canonical.x-e.tileID.canonical.x;const i=t.tileID.canonical.y-e.tileID.canonical.y,n=Math.pow(2,e.tileID.canonical.z),o=t.tileID.key;0===r&&0===i||Math.abs(i)>1||(Math.abs(r)>1&&(1===Math.abs(r+n)?r+=n:1===Math.abs(r-n)&&(r-=n)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,r,i),e.neighboringTiles&&e.neighboringTiles[o]&&(e.neighboringTiles[o].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,r,i){for(const n in this._tiles){let o=this._tiles[n];if(i[n]||!o.hasData()||o.tileID.overscaledZ<=t||o.tileID.overscaledZ>r)continue;let s=o.tileID;for(;o&&o.tileID.overscaledZ>t+1;){const e=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[e.key],o&&o.hasData()&&(s=e)}let a=s;for(;a.overscaledZ>t;)if(a=a.scaledTo(a.overscaledZ-1),e[a.key]){i[s.key]=s;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){const r=this._loadedParentTiles[e.key];return r&&r.tileID.overscaledZ>=t?r:null}for(let r=e.overscaledZ-1;r>=t;r--){const t=e.scaledTo(r),i=this._getLoadedTile(t);if(i)return i}}_getLoadedTile(e){const t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}updateCacheSize(e,t){t=t||this._source.tileSize;const r=Math.ceil(e.width/t)+1,i=Math.ceil(e.height/t)+1,n=Math.floor(r*i*5),o="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,n):n,s="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(s)}handleWrapJump(e){const t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,t){const e={};for(const r in this._tiles){const i=this._tiles[r];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+t),e[i.tileID.key]=i}this._tiles=e;for(const e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const e in this._tiles)this._setTileReloadTimer(+e,this._tiles[e])}}update(t,r,i,n){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage)return;if(this.usedForTerrain&&!i)return;this.updateCacheSize(t,r),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const o="batched-model"===this._source.type;let s,a=this._source.maxzoom;const l=this.map&&this.map.painter?this.map.painter._terrain:null;if(l&&l.sourceCache===this&&l.attenuationRange()){const e=l.attenuationRange()[0],t=Math.floor(e)-Math.log2(l.getDemUpscale());a>t&&(a=t)}if(this.used||this.usedForTerrain){if(this._source.tileID)s=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((t=>new e.aA(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y)));else if(0!==this.tileCoverLift){const n=t.clone();n.tileCoverLift=this.tileCoverLift,s=n.coveringTiles({tileSize:r||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:a,roundZoom:this._source.roundZoom&&!i,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:o}),this._source.minzoom<=1&&"globe"===t.projection.name&&(s.push(new e.aA(1,0,1,0,0)),s.push(new e.aA(1,0,1,1,0)),s.push(new e.aA(1,0,1,0,1)),s.push(new e.aA(1,0,1,1,1)))}else if(s=t.coveringTiles({tileSize:r||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:a,roundZoom:this._source.roundZoom&&!i,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:o}),this._source.hasTile){const e=this._source.hasTile.bind(this._source);s=s.filter((t=>e(t)))}}else s=[];if(s.length>0&&this.castsShadows&&n&&"globe"!==this.transform.projection.name&&!this.usedForTerrain&&!xt(this._source.type)){const e=t.coveringZoomLevel({tileSize:r||this._source.tileSize,roundZoom:this._source.roundZoom&&!i}),a=Math.min(e,this._source.maxzoom);if(o){const e=t.extendTileCover(s,a);for(const t of e)s.push(t)}else{const e=t.extendTileCover(s,a,n);for(const t of e)this._shadowCasterTiles[t.key]=!0,s.push(t)}}const c=this._updateRetainedTiles(s);if(xt(this._source.type)&&0!==s.length){const t={},r={},i=Object.keys(c);for(const n of i){const i=c[n],o=this._tiles[n];if(!o||o.fadeEndTime&&o.fadeEndTime<=e.q.now())continue;const s=this.findLoadedParent(i,Math.max(i.overscaledZ-gt.maxOverzooming,this._source.minzoom));s&&(this._addTile(s.tileID),t[s.tileID.key]=s.tileID),r[n]=i}const n=s[s.length-1].overscaledZ;for(const e in this._tiles){const t=this._tiles[e];if(c[e]||!t.hasData())continue;let i=t.tileID;for(;i.overscaledZ>n;){i=i.scaledTo(i.overscaledZ-1);const n=this._tiles[i.key];if(n&&n.hasData()&&r[i.key]){c[e]=t.tileID;break}}}for(const e in t)c[e]||(this._coveredTiles[e]=!0,c[e]=t[e])}for(const e in c)this._tiles[e].clearFadeHold();const u=e.bf(this._tiles,c);for(const e of u){const t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):t.hasSymbolBuckets&&!t.symbolFadeFinished()||this._removeTile(+e)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e)}_updateRetainedTiles(e){const t={};if(0===e.length)return t;const r={},i=e.reduce(((e,t)=>Math.min(e,t.overscaledZ)),1/0),n=e[0].overscaledZ,o=Math.max(n-gt.maxOverzooming,this._source.minzoom),s=Math.max(n+gt.maxUnderzooming,this._source.minzoom),a={};for(const r of e){const e=this._addTile(r);t[r.key]=r,e.hasData()||i<this._source.maxzoom&&(a[r.key]=r)}this._retainLoadedChildren(a,i,s,t);for(const i of e){let e=this._tiles[i.key];if(e.hasData())continue;if(i.canonical.z>=this._source.maxzoom){const e=i.children(this._source.maxzoom)[0],r=this.getTile(e);if(r&&r.hasData()){t[e.key]=e;continue}}else{const e=i.children(this._source.maxzoom);if(t[e[0].key]&&t[e[1].key]&&t[e[2].key]&&t[e[3].key])continue}let n=e.wasRequested();for(let s=i.overscaledZ-1;s>=o;--s){const o=i.scaledTo(s);if(r[o.key])break;if(r[o.key]=!0,e=this.getTile(o),!e&&n&&(e=this._addTile(o)),e&&(t[o.key]=o,n=e.wasRequested(),e.hasData()))break}}return t}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const t=[];let r,i=this._tiles[e].tileID;for(;i.overscaledZ>0;){if(i.key in this._loadedParentTiles){r=this._loadedParentTiles[i.key];break}t.push(i.key);const e=i.scaledTo(i.overscaledZ-1);if(r=this._getLoadedTile(e),r)break;i=e}for(const e of t)this._loadedParentTiles[e]=r}}_addTile(t){let r=this._tiles[t.key];if(r)return!0!==r.isExtraShadowCaster||!!this._shadowCasterTiles[t.key]||this._reloadTile(t.key,"reloading"),r;r=this._cache.getAndRemove(t),r&&(this._setTileReloadTimer(t.key,r),r.tileID=t,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,r)));const i=Boolean(r);if(!i){const e=this.map?this.map.painter:null,i=this._source.tileSize*t.overscaleFactor();r="raster-array"===this._source.type?new ft(t,i,this.transform.tileZoom,e,this._isRaster):new pt(t,i,this.transform.tileZoom,e,this._isRaster),this._loadTile(r,this._tileLoaded.bind(this,r,t.key,r.state))}return r?(r.uses++,this._tiles[t.key]=r,i||this._source.fire(new e.x("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r):null}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const r=t.getExpiryTimeout();r&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,"expired"),delete this._timers[e]}),r))}_removeTile(e){const t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),t.uses>0||(t.hasData()&&"reloading"!==t.state||"empty"===t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(+e);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(t,r,i){const n=[],o=this.transform;if(!o)return n;const s="globe"===o.projection.name,a=e.am(o.center.lng);for(const l in this._tiles){const c=this._tiles[l];if(i&&c.clearQueryDebugViz(),c.holdingForFade())continue;let u;if(s){const t=c.tileID.canonical;if(0===t.z){const r=[Math.abs(e.ap(a,...vt(t,-1))-a),Math.abs(e.ap(a,...vt(t,1))-a)];u=[0,2*r.indexOf(Math.min(...r))-1]}else{const r=[Math.abs(e.ap(a,...vt(t,-1))-a),Math.abs(e.ap(a,...vt(t,0))-a),Math.abs(e.ap(a,...vt(t,1))-a)];u=[r.indexOf(Math.min(...r))-1]}}else u=[0];for(const e of u){const i=t.containsTile(c,o,r,e);i&&n.push(i)}}return n}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(e){return this._getRenderableCoordinates(e)}_getRenderableCoordinates(e,t){const r=this.getRenderableIds(e,t).map((e=>this._tiles[e].tileID)),i="globe"===this.transform.projection.name;for(const e of r)e.projMatrix=this.transform.calculateProjMatrix(e.toUnwrapped()),e.expandedProjMatrix=i?this.transform.calculateProjMatrix(e.toUnwrapped(),!1,!0):e.projMatrix;return r}sortCoordinatesByDistance(e){const t=e.slice(),r=this.transform._camera.position,i=this.transform._camera.forward(),n={};for(const e of t){const t=1/(1<<e.canonical.z);n[e.key]=((e.canonical.x+.5)*t+e.wrap-r[0])*i[0]+((e.canonical.y+.5)*t-r[1])*i[1]-r[2]*i[2]}return t.sort(((e,t)=>n[e.key]-n[t.key])),t}hasTransition(){if(this._source.hasTransition())return!0;if(xt(this._source.type))for(const t in this._tiles){const r=this._tiles[t];if(void 0!==r.fadeEndTime&&r.fadeEndTime>=e.q.now())return!0}return!1}setFeatureState(e,t,r){this._state.updateState(e=e||"_geojsonTileLayer",t,r)}removeFeatureState(e,t,r){this._state.removeFeatureState(e=e||"_geojsonTileLayer",t,r)}getFeatureState(e,t){return this._state.getState(e=e||"_geojsonTileLayer",t)}setDependencies(e,t,r){const i=this._tiles[e];i&&i.setDependencies(t,r)}reloadTilesForDependencies(e,t){for(const r in this._tiles)this._tiles[r].hasDependency(e,t)&&this._reloadTile(+r,"reloading");this._cache.filter((r=>!r.hasDependency(e,t)))}_preloadTiles(t,r){if(!this._sourceLoaded){const e=()=>{this._sourceLoaded&&(this._source.off("data",e),this._preloadTiles(t,r))};return void this._source.on("data",e)}const i=new Map,n=Array.isArray(t)?t:[t],o=this.map.painter.terrain,s=this.usedForTerrain&&o?o.getScaledDemTileSize():this._source.tileSize;for(const e of n){const t=e.coveringTiles({tileSize:s,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const e of t)i.set(e.key,e);this.usedForTerrain&&e.updateElevation(!1)}const a=Array.from(i.values());e.bg(a,((e,t)=>{const r=new pt(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(r,(e=>{"raster-dem"===this._source.type&&r.dem&&this._backfillDEM(r),t(e,r)}))}),r)}}function yt(e,t){const r=Math.abs(2*e.wrap)-+(e.wrap<0),i=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||i-r||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function xt(e){return"raster"===e||"image"===e||"video"===e||"custom"===e}function vt(e,t){const r=1<<e.z;return[e.x/r+t,(e.x+1)/r+t]}gt.maxOverzooming=10,gt.maxUnderzooming=3;class bt{constructor(e){this.style=e,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const e=!1,t=!1;for(const r in this.style._mergedLayers){const i=this.style._mergedLayers[r];if("fill-extrusion"===i.type)this.layers.push({layer:i,visible:e,visibilityChanged:t});else if("model"===i.type){const r=this.style.getLayerSource(i);r&&"batched-model"===r.type&&this.layers.push({layer:i,visible:e,visibilityChanged:t})}}}onNewFrame(e){this.layersGotHidden=!1;for(const t of this.layers){const r=t.layer;let i=!1;"fill-extrusion"===r.type?i=!r.isHidden(e)&&r.paint.get("fill-extrusion-opacity")>0:"model"===r.type&&(i=!r.isHidden(e)&&r.paint.get("model-opacity")>0),this.layersGotHidden=this.layersGotHidden||!i&&t.visible,t.visible=i}}updateZOffset(e,t){this.currentBuildingBuckets=[];for(const e of this.layers){const r=e.layer,i=this.style.getLayerSourceCache(r);let n=1;"fill-extrusion"===r.type&&(n=e.visible?r.paint.get("fill-extrusion-vertical-scale"):0);let o=i?i.getTile(t):null;if(!o&&i&&t.canonical.z>i.getSource().minzoom){let e=t.scaledTo(Math.min(i.getSource().maxzoom,t.overscaledZ-1));for(;e.overscaledZ>=i.getSource().minzoom&&(o=i.getTile(e),!o&&0!==e.overscaledZ);)e=e.scaledTo(e.overscaledZ-1)}this.currentBuildingBuckets.push({bucket:o?o.getBucket(r):null,tileID:o?o.tileID:t,verticalScale:n})}e.hasAnyZOffset=!1;let r=!1;for(let i=0;i<e.symbolInstances.length;i++){const n=e.symbolInstances.get(i),o=n.zOffset,s=this._getHeightAtTileOffset(t,n.tileAnchorX,n.tileAnchorY);n.zOffset=s!==Number.NEGATIVE_INFINITY?s:o,r||o===n.zOffset||(r=!0),e.hasAnyZOffset||0===n.zOffset||(e.hasAnyZOffset=!0)}r&&(e.zOffsetBuffersNeedUpload=!0,e.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(t,r,i,n){let o=r,s=i;if(t.canonical.z!==n.canonical.z){const a=n.canonical,l=1/(1<<t.canonical.z-a.z);o=(r+t.canonical.x*e.ab)*l-a.x*e.ab|0,s=(i+t.canonical.y*e.ab)*l-a.y*e.ab|0}return{tileX:o,tileY:s}}_getHeightAtTileOffset(e,t,r){let i,n;for(let o=0;o<this.layers.length;++o){if("fill-extrusion"!==this.layers[o].layer.type)continue;const{bucket:s,tileID:a,verticalScale:l}=this.currentBuildingBuckets[o];if(!s)continue;const{tileX:c,tileY:u}=this._mapCoordToOverlappingTile(e,t,r,a),h=s.getHeightAtTileCoord(c,u);h&&void 0!==h.height&&(h.hidden?i=h.height:n=Math.max(h.height*l,n||0))}if(void 0!==n)return n;for(let n=0;n<this.layers.length;++n){const o=this.layers[n];if("model"!==o.layer.type||!o.visible)continue;const{bucket:s,tileID:a}=this.currentBuildingBuckets[n];if(!s)continue;const{tileX:l,tileY:c}=this._mapCoordToOverlappingTile(e,t,r,a),u=s.getHeightAtTileCoord(l,c);if(u&&!u.hidden)return void 0===u.height&&void 0!==i?Math.min(u.maxHeight,i)*u.verticalScale:u.height?u.height*u.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function wt(t,r){const i={};for(const e in t)"ref"!==e&&(i[e]=t[e]);return e.bh.forEach((e=>{e in r&&(i[e]=r[e])})),i}function Tt(e){e=e.slice();const t=Object.create(null);for(let r=0;r<e.length;r++)t[e[r].id]=e[r];for(let r=0;r<e.length;r++)"ref"in e[r]&&(e[r]=wt(e[r],t[e[r].ref]));return e}const St={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport"};function Et(e,t,r){r.push({command:St.addSource,args:[e,t[e]]})}function Mt(e,t,r){t.push({command:St.removeSource,args:[e]}),r[e]=!0}function At(e,t,r,i){Mt(e,r,i),Et(e,t,r)}function Ct(t,r,i){let n;for(n in t[i])if(t[i].hasOwnProperty(n)&&"data"!==n&&!e.bi(t[i][n],r[i][n]))return!1;for(n in r[i])if(r[i].hasOwnProperty(n)&&"data"!==n&&!e.bi(t[i][n],r[i][n]))return!1;return!0}function It(t,r,i,n,o,s){let a;for(a in r=r||{},t=t||{})t.hasOwnProperty(a)&&(e.bi(t[a],r[a])||i.push({command:s,args:[n,a,r[a],o]}));for(a in r)r.hasOwnProperty(a)&&!t.hasOwnProperty(a)&&(e.bi(t[a],r[a])||i.push({command:s,args:[n,a,r[a],o]}))}function Pt(e){return e.id}function Rt(e,t){return e[t.id]=t,e}class zt{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(1===this.points.length)return this.points[0];t=e.ap(t,0,1);let r=1,i=this._distances[r];const n=t*this.paddedLength+this.padding;for(;i<n&&r<this._distances.length;)i=this._distances[++r];const o=r-1,s=this._distances[o],a=i-s,l=a>0?(n-s)/a:0;return this.points[o].mult(1-l).add(this.points[r].mult(l))}}class Dt{constructor(e,t,r){const i=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(e/r),this.yCellCount=Math.ceil(t/r);for(let e=0;e<this.xCellCount*this.yCellCount;e++)i.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,r,i,n){this._forEachCell(t,r,i,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(n)}insertCircle(e,t,r,i){this._forEachCell(t-i,r-i,t+i,r+i,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(r),this.circles.push(i)}_insertBoxCell(e,t,r,i,n,o){this.boxCells[n].push(o)}_insertCircleCell(e,t,r,i,n,o){this.circleCells[n].push(o)}_query(e,t,r,i,n,o){if(r<0||e>this.width||i<0||t>this.height)return!n&&[];const s=[];if(e<=0&&t<=0&&this.width<=r&&this.height<=i){if(n)return!0;for(let e=0;e<this.boxKeys.length;e++)s.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){const t=this.circles[3*e],r=this.circles[3*e+1],i=this.circles[3*e+2];s.push({key:this.circleKeys[e],x1:t-i,y1:r-i,x2:t+i,y2:r+i})}return o?s.filter(o):s}return this._forEachCell(e,t,r,i,this._queryCell,s,{hitTest:n,seenUids:{box:{},circle:{}}},o),n?s.length>0:s}_queryCircle(e,t,r,i,n){const o=e-r,s=e+r,a=t-r,l=t+r;if(s<0||o>this.width||l<0||a>this.height)return!i&&[];const c=[];return this._forEachCell(o,a,s,l,this._queryCellCircle,c,{hitTest:i,circle:{x:e,y:t,radius:r},seenUids:{box:{},circle:{}}},n),i?c.length>0:c}query(e,t,r,i,n){return this._query(e,t,r,i,!1,n)}hitTest(e,t,r,i,n){return this._query(e,t,r,i,!0,n)}hitTestCircle(e,t,r,i){return this._queryCircle(e,t,r,!0,i)}_queryCell(e,t,r,i,n,o,s,a){const l=s.seenUids,c=this.boxCells[n];if(null!==c){const n=this.bboxes;for(const u of c)if(!l.box[u]){l.box[u]=!0;const c=4*u;if(e<=n[c+2]&&t<=n[c+3]&&r>=n[c+0]&&i>=n[c+1]&&(!a||a(this.boxKeys[u]))){if(s.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[u],x1:n[c],y1:n[c+1],x2:n[c+2],y2:n[c+3]})}}}const u=this.circleCells[n];if(null!==u){const n=this.circles;for(const c of u)if(!l.circle[c]){l.circle[c]=!0;const u=3*c;if(this._circleAndRectCollide(n[u],n[u+1],n[u+2],e,t,r,i)&&(!a||a(this.circleKeys[c]))){if(s.hitTest)return o.push(!0),!0;{const e=n[u],t=n[u+1],r=n[u+2];o.push({key:this.circleKeys[c],x1:e-r,y1:t-r,x2:e+r,y2:t+r})}}}}}_queryCellCircle(e,t,r,i,n,o,s,a){const l=s.circle,c=s.seenUids,u=this.boxCells[n];if(null!==u){const e=this.bboxes;for(const t of u)if(!c.box[t]){c.box[t]=!0;const r=4*t;if(this._circleAndRectCollide(l.x,l.y,l.radius,e[r+0],e[r+1],e[r+2],e[r+3])&&(!a||a(this.boxKeys[t])))return o.push(!0),!0}}const h=this.circleCells[n];if(null!==h){const e=this.circles;for(const t of h)if(!c.circle[t]){c.circle[t]=!0;const r=3*t;if(this._circlesCollide(e[r],e[r+1],e[r+2],l.x,l.y,l.radius)&&(!a||a(this.circleKeys[t])))return o.push(!0),!0}}}_forEachCell(e,t,r,i,n,o,s,a){const l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),u=this._convertToXCellCoord(r),h=this._convertToYCellCoord(i);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++)if(n.call(this,e,t,r,i,this.xCellCount*l+d,o,s,a))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,r,i,n,o){const s=i-e,a=n-t,l=r+o;return l*l>s*s+a*a}_circleAndRectCollide(e,t,r,i,n,o,s){const a=(o-i)/2,l=Math.abs(e-(i+a));if(l>a+r)return!1;const c=(s-n)/2,u=Math.abs(t-(n+c));if(u>c+r)return!1;if(l<=a||u<=c)return!0;const h=l-a,d=u-c;return h*h+d*d<=r*r}}const kt={unknown:0,flipRequired:1,flipNotRequired:2},Ot=Math.tan(85*Math.PI/180);function Lt(t,r,i,n,o,s,a){const l=e.a6.mat4.create();if(i)if("globe"===s.name){const t=e.bj(o,r);e.a6.mat4.multiply(l,l,t)}else{const t=e.a6.mat2.invert([],a);l[0]=t[0],l[1]=t[1],l[4]=t[2],l[5]=t[3],n||e.a6.mat4.rotateZ(l,l,o.angle)}else e.a6.mat4.multiply(l,o.labelPlaneMatrix,t);return l}function Bt(e,t,r,i,n,o,s){const a=Lt(e,t,r,i,n,o,s);return"globe"===o.name&&r||(a[2]=a[6]=a[10]=a[14]=0),a}function Ft(t,r,i,n,o,s,a){if(i){if("globe"===s.name){const l=Lt(t,r,i,n,o,s,a);return e.a6.mat4.invert(l,l),e.a6.mat4.multiply(l,t,l),l}{const r=e.a6.mat4.clone(t),i=e.a6.mat4.identity([]);return i[0]=a[0],i[1]=a[1],i[4]=a[2],i[5]=a[3],e.a6.mat4.multiply(r,r,i),n||e.a6.mat4.rotateZ(r,r,-o.angle),r}}return o.glCoordMatrix}function Nt(t,r,i,n){const o=[t,r,i,1];i?e.a6.vec4.transformMat4(o,o,n):Yt(o,o,n);const s=o[3];return o[0]/=s,o[1]/=s,o[2]/=s,o}function Vt(e,t){return Math.min(.5+e/t*.5,1.5)}function jt(e,t){const r=e[0]/e[3],i=e[1]/e[3];return r>=-t[0]&&r<=t[0]&&i>=-t[1]&&i<=t[1]}function Ut(t,r,i,n,o,s,a,l,c,u){const h=i.transform,d=n?t.textSizeData:t.iconSizeData,p=e.bk(d,i.transform.zoom),f="globe"===h.projection.name,m=[256/i.width*2+1,256/i.height*2+1],_=n?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;_.clear();let g=null;f&&(g=n?t.text.globeExtVertexArray:t.icon.globeExtVertexArray);const y=t.lineVertexArray,x=n?t.text.placedSymbolArray:t.icon.placedSymbolArray,v=i.transform.width/i.transform.height;let b,w=!1;for(let n=0;n<x.length;n++){const f=x.get(n),{numGlyphs:T,writingMode:S}=f;if(S!==e.bl.vertical||w||b===e.bl.horizontal||(w=!0),b=S,(f.hidden||S===e.bl.vertical)&&!w){Xt(T,_);continue}w=!1;const E=new e.P(f.tileAnchorX,f.tileAnchorY);let{x:M,y:A,z:C}=h.projection.projectTilePoint(E.x,E.y,u.canonical);if(c){const[e,t,r]=c(E);M+=e,A+=t,C+=r}const I=[M,A,C,1];if(e.a6.vec4.transformMat4(I,I,r),!jt(I,m)){Xt(T,_);continue}const P=I[3],R=Vt(i.transform.getCameraToCenterDistance(h.projection),P),z=e.bm(d,p,f),D=a?z/R:z*R,k=Nt(M,A,C,o);if(k[3]<=0){Xt(T,_);continue}let O={};const L=a?null:c,B=qt(f,D,!1,l,r,o,s,t.glyphOffsetArray,y,_,g,k,E,O,v,L,h.projection,u,a);w=B.useVertical,L&&B.needsFlipping&&(O={}),(B.notEnoughRoom||w||B.needsFlipping&&qt(f,D,!0,l,r,o,s,t.glyphOffsetArray,y,_,g,k,E,O,v,L,h.projection,u,a).notEnoughRoom)&&Xt(T,_)}n?(t.text.dynamicLayoutVertexBuffer.updateData(_),g&&t.text.globeExtVertexBuffer&&t.text.globeExtVertexBuffer.updateData(g)):(t.icon.dynamicLayoutVertexBuffer.updateData(_),g&&t.icon.globeExtVertexBuffer&&t.icon.globeExtVertexBuffer.updateData(g))}function $t(e,t,r,i,n,o,s,a,l,c,u,h,d,p,f,m){const{lineStartIndex:_,glyphStartIndex:g,segment:y}=a,x=g+a.numGlyphs,v=_+a.lineLength,b=t.getoffsetX(g),w=t.getoffsetX(x-1),T=Zt(e*b,r,i,n,o,s,y,_,v,l,c,u,h,d,!0,p,f,m);if(!T)return null;const S=Zt(e*w,r,i,n,o,s,y,_,v,l,c,u,h,d,!0,p,f,m);return S?{first:T,last:S}:null}function Gt(t,r,i,n){return t===e.bl.horizontal&&Math.abs(n)>Math.abs(i)?{useVertical:!0}:t===e.bl.vertical?n>0?{needsFlipping:!0}:null:r!==kt.unknown&&function(e,t){return 0===e||Math.abs(t/e)>Ot}(i,n)?r===kt.flipRequired?{needsFlipping:!0}:null:i<0?{needsFlipping:!0}:null}function qt(t,r,i,n,o,s,a,l,c,u,h,d,p,f,m,_,g,y,x){const v=r/24,b=t.lineOffsetX*v,w=t.lineOffsetY*v,{lineStartIndex:T,glyphStartIndex:S,numGlyphs:E,segment:M,writingMode:A,flipState:C}=t,I=T+t.lineLength,P=t=>{if(h){const[r,i,n]=t.up,o=u.length;e.bn(h,o+0,r,i,n),e.bn(h,o+1,r,i,n),e.bn(h,o+2,r,i,n),e.bn(h,o+3,r,i,n)}const[r,i,n]=t.point;e.bo(u,r,i,n,t.angle)};if(E>1){const e=$t(v,l,b,w,i,d,p,t,c,s,f,_,!1,g,y,x);if(!e)return{notEnoughRoom:!0};if(n&&!i){let[r,i,n]=e.first.point,[o,s,l]=e.last.point;[r,i]=Nt(r,i,n,a),[o,s]=Nt(o,s,l,a);const c=Gt(A,C,(o-r)*m,s-i);if(t.flipState=c&&c.needsFlipping?kt.flipRequired:kt.flipNotRequired,c)return c}P(e.first);for(let e=S+1;e<S+E-1;e++){const t=Zt(v*l.getoffsetX(e),b,w,i,d,p,M,T,I,c,s,f,_,!1,!1,g,y,x);if(!t)return u.length-=4*(e-S),{notEnoughRoom:!0};P(t)}P(e.last)}else{if(n&&!i){const r=Nt(p.x,p.y,0,o),i=T+M+1,n=new e.P(c.getx(i),c.gety(i)),s=Nt(n.x,n.y,0,o),a=s[3]>0?s:Wt(p,n,r,1,o,void 0,g,y.canonical),l=Gt(A,C,(a[0]-r[0])*m,a[1]-r[1]);if(t.flipState=l&&l.needsFlipping?kt.flipRequired:kt.flipNotRequired,l)return l}const r=Zt(v*l.getoffsetX(S),b,w,i,d,p,M,T,I,c,s,f,_,!1,!1,g,y,x);if(!r)return{notEnoughRoom:!0};P(r)}return{}}function Ht(e,t,r,i,n){const{x:o,y:s,z:a}=i.projectTilePoint(e.x,e.y,t);if(!n)return Nt(o,s,a,r);const[l,c,u]=n(e);return Nt(o+l,s+c,a+u,r)}function Wt(t,r,i,n,o,s,a,l){const c=Ht(t.sub(r)._unit()._add(t),l,o,a,s);return e.a6.vec3.sub(c,i,c),e.a6.vec3.normalize(c,c),e.a6.vec3.scaleAndAdd(c,i,c,n)}function Zt(t,r,i,n,o,s,a,l,c,u,h,d,p,f,m,_,g,y){const x=n?t-r:t+r;let v=x>0?1:-1,b=0;n&&(v*=-1,b=Math.PI),v<0&&(b+=Math.PI);let w=l+a+(v>0?0:1)|0,T=o,S=o,E=0,M=0;const A=Math.abs(x),C=[],I=[];let P=s,R=P;const z=()=>Wt(R,P,S,A-E+1,h,p,_,g.canonical);for(;E+M<=A;){if(w+=v,w<l||w>=c)return null;if(S=T,R=P,C.push(S),f&&I.push(R),P=new e.P(u.getx(w),u.gety(w)),T=d[w],!T){const e=Ht(P,g.canonical,h,_,p);T=e[3]>0?d[w]=e:z()}E+=M,M=e.a6.vec3.distance(S,T)}m&&p&&(d[w]&&(T=z(),M=e.a6.vec3.distance(S,T)),d[w]=T);const D=(A-E)/M,k=P.sub(R)._mult(D)._add(R),O=e.a6.vec3.sub([],T,S),L=e.a6.vec3.scaleAndAdd([],S,O,D);let B=[0,0,1],F=O[0],N=O[1];if(y&&(B=_.upVector(g.canonical,k.x,k.y),0!==B[0]||0!==B[1]||1!==B[2])){const t=[B[2],0,-B[0]],r=e.a6.vec3.cross([],B,t);e.a6.vec3.normalize(t,t),e.a6.vec3.normalize(r,r),F=e.a6.vec3.dot(O,t),N=e.a6.vec3.dot(O,r)}if(i){const t=e.a6.vec3.cross([],B,O);e.a6.vec3.normalize(t,t),e.a6.vec3.scaleAndAdd(L,L,t,i*v)}const V=b+Math.atan2(N,F);return C.push(L),f&&I.push(k),{point:L,angle:V,path:C,tilePath:I,up:B}}function Xt(e,t){const r=t.length,i=r+4*e;t.resize(i),t.float32.fill(-1/0,4*r,4*i)}function Yt(e,t,r){const i=t[0],n=t[1];return e[0]=r[0]*i+r[4]*n+r[12],e[1]=r[1]*i+r[5]*n+r[13],e[3]=r[3]*i+r[7]*n+r[15],e}const Jt=100;class Kt{constructor(e,t,r=new Dt(e.width+200,e.height+200,25),i=new Dt(e.width+200,e.height+200,25)){this.transform=e,this.grid=r,this.ignoredGrid=i,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+Jt,this.screenBottomBoundary=e.height+Jt,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.fogState=t}placeCollisionBox(e,t,r,i,n,o,s,a){let l=r.projectedAnchorX,c=r.projectedAnchorY,u=r.projectedAnchorZ;const h=r.elevation,d=r.tileID,p=e.getProjection();if(h&&d){const[e,t,i]=p.upVector(d.canonical,r.tileAnchorX,r.tileAnchorY),n=p.upVectorScale(d.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;l+=e*h*n,c+=t*h*n,u+=i*h*n}const f=this.projectAndGetPerspectiveRatio(s,l,c,u,r.tileID,"globe"===p.name||!!h||this.transform.pitch>0,p),m=o*f.perspectiveRatio,_=(r.x1*t+i.x-r.padding)*m+f.point.x,g=(r.y1*t+i.y-r.padding)*m+f.point.y,y=(r.x2*t+i.x+r.padding)*m+f.point.x,x=(r.y2*t+i.y+r.padding)*m+f.point.y,v=f.perspectiveRatio<=.55||f.occluded;return!this.isInsideGrid(_,g,y,x)||!n&&this.grid.hitTest(_,g,y,x,a)||v?{box:[],offscreen:!1,occluded:f.occluded}:{box:[_,g,y,x],offscreen:this.isOffscreen(_,g,y,x),occluded:!1}}placeCollisionCircles(t,r,i,n,o,s,a,l,c,u,h,d,p,f,m){const _=[],g=this.transform.elevation,y=t.getProjection(),x=g?g.getAtTileOffsetFunc(m,this.transform.center.lat,this.transform.worldSize,y):null,v=new e.P(i.tileAnchorX,i.tileAnchorY);let{x:b,y:w,z:T}=y.projectTilePoint(v.x,v.y,m.canonical);if(x){const[e,t,r]=x(v);b+=e,w+=t,T+=r}const S="globe"===y.name,E=this.projectAndGetPerspectiveRatio(a,b,w,T,m,S||!!g||this.transform.pitch>0,y),{perspectiveRatio:M}=E,A=(h?s/M:s*M)/e.br,C=Nt(b,w,T,l),I=E.signedDistanceFromCamera>0?$t(A,o,i.lineOffsetX*A,i.lineOffsetY*A,!1,C,v,i,n,l,{},g&&!h?x:null,h&&!!g,y,m,h):null;let P=!1,R=!1,z=!0;if(I&&!E.occluded){const t=.5*p*M+f,i=new e.P(-100,-100),n=new e.P(this.screenRightBoundary,this.screenBottomBoundary),o=new zt,{first:s,last:a}=I,l=s.path.length;let h=[];for(let e=l-1;e>=1;e--)h.push(s.path[e]);for(let e=1;e<a.path.length;e++)h.push(a.path[e]);const m=2.5*t;c&&(h=h.map((([e,t,r],i)=>(x&&!S&&(r=x(i<l-1?s.tilePath[l-1-i]:a.tilePath[i-l+2])[2]),Nt(e,t,r,c)))),h.some((e=>e[3]<=0))&&(h=[]));let g=[];if(h.length>0){let t=1/0,r=-1/0,o=1/0,s=-1/0;for(const e of h)t=Math.min(t,e[0]),o=Math.min(o,e[1]),r=Math.max(r,e[0]),s=Math.max(s,e[1]);r>=i.x&&t<=n.x&&s>=i.y&&o<=n.y&&(g=[h.map((t=>new e.P(t[0],t[1])))],(t<i.x||r>n.x||o<i.y||s>n.y)&&(g=e.bp(g,i.x,i.y,n.x,n.y)))}for(const e of g){o.reset(e,.25*t);let i=0;i=o.length<=.5*t?1:Math.ceil(o.paddedLength/m)+1;for(let e=0;e<i;e++){const n=e/Math.max(i-1,1),s=o.lerp(n),a=s.x+Jt,l=s.y+Jt;_.push(a,l,t,0);const c=a-t,h=l-t,p=a+t,f=l+t;if(z=z&&this.isOffscreen(c,h,p,f),R=R||this.isInsideGrid(c,h,p,f),!r&&this.grid.hitTestCircle(a,l,t,d)&&(P=!0,!u))return{circles:[],offscreen:!1,collisionDetected:P,occluded:!1}}}}return{circles:!u&&P||!R?[]:_,offscreen:z,collisionDetected:P,occluded:E.occluded}}queryRenderedSymbols(t){if(0===t.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const r=[];let i=1/0,n=1/0,o=-1/0,s=-1/0;for(const a of t){const t=new e.P(a.x+Jt,a.y+Jt);i=Math.min(i,t.x),n=Math.min(n,t.y),o=Math.max(o,t.x),s=Math.max(s,t.y),r.push(t)}const a=this.grid.query(i,n,o,s).concat(this.ignoredGrid.query(i,n,o,s)),l={},c={};for(const t of a){const i=t.key;if(void 0===l[i.bucketInstanceId]&&(l[i.bucketInstanceId]={}),l[i.bucketInstanceId][i.featureIndex])continue;const n=[new e.P(t.x1,t.y1),new e.P(t.x2,t.y1),new e.P(t.x2,t.y2),new e.P(t.x1,t.y2)];e.bq(r,n)&&(l[i.bucketInstanceId][i.featureIndex]=!0,void 0===c[i.bucketInstanceId]&&(c[i.bucketInstanceId]=[]),c[i.bucketInstanceId].push(i.featureIndex))}return c}insertCollisionBox(e,t,r,i,n){(t?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:i,collisionGroupID:n},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,r,i,n){const o=t?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:i,collisionGroupID:n};for(let t=0;t<e.length;t+=4)o.insertCircle(s,e[t],e[t+1],e[t+2])}projectAndGetPerspectiveRatio(t,r,i,n,o,s,a){const l=[r,i,n,1];let c=!1;if(n||this.transform.pitch>0){if(e.a6.vec4.transformMat4(l,l,t),this.fogState&&o&&"globe"!==a.name){const t=function(t,r,i,n,o,s){const a=s.calculateFogTileMatrix(o),l=[r,i,n];return e.a6.vec3.transformMat4(l,l,a),Oe(t,e.a6.vec3.length(l),s.pitch,s._fov)}(this.fogState,r,i,n,o.toUnwrapped(),this.transform);c=t>.9}}else Yt(l,l,t);const u=l[3];return{point:new e.P((l[0]/u+1)/2*this.transform.width+Jt,(-l[1]/u+1)/2*this.transform.height+Jt),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(a)/u*.5,1.5),signedDistanceFromCamera:u,occluded:s&&l[2]>u||c}}isOffscreen(e,t,r,i){return r<Jt||e>=this.screenRightBoundary||i<Jt||t>this.screenBottomBoundary}isInsideGrid(e,t,r,i){return r>=0&&e<this.gridRightBoundary&&i>=0&&t<this.gridBottomBoundary}getViewportMatrix(){const t=e.a6.mat4.identity([]);return e.a6.mat4.translate(t,t,[-100,-100,0]),t}}function Qt(t,r,i){const n=r.createTileMatrix(t,t.worldSize,i.toUnwrapped());return e.a6.mat4.multiply(new Float32Array(16),t.projMatrix,n)}function er(e,t,r){if(t.projection.name===r.projection.name)return e.projMatrix;const i=r.clone();return i.setProjection(t.projection),Qt(i,t.getProjection(),e)}function tr(e,t,r){return t.name===r.projection.name?e.projMatrix:Qt(r,t,e)}class rr{constructor(e,t,r,i){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):i&&r?1:0,this.placed=r}isHidden(){return 0===this.opacity&&!this.placed}}class ir{constructor(e,t,r,i,n,o=!1){this.text=new rr(e?e.text:null,t,r,n),this.icon=new rr(e?e.icon:null,t,i,n),this.clipped=o}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class nr{constructor(e,t,r,i=!1){this.text=e,this.icon=t,this.skipFade=r,this.clipped=i}}class or{constructor(){this.invProjMatrix=e.a6.mat4.create(),this.viewportMatrix=e.a6.mat4.create(),this.circles=[]}}class sr{constructor(e,t,r,i,n){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=r,this.bucketIndex=i,this.tileID=n}}class ar{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}}function lr(t,r,i,n,o){const{horizontalAlign:s,verticalAlign:a}=e.by(t),l=-(s-.5)*r,c=-(a-.5)*i,u=e.bx(t,n);return new e.P(l+u[0]*o,c+u[1]*o)}function cr(t,r,i,n,o){const s=new e.P(t,r);return i&&s._rotate(n?o:-o),s}class ur{constructor(e,t,r,i,n,o){this.transform=e.clone(),this.projection=e.projection.name,this.collisionIndex=new Kt(this.transform,n),this.buildingIndex=o,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=t,this.retainedQueryData={},this.collisionGroups=new ar(r),this.collisionCircleArrays={},this.prevPlacement=i,i&&(i.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,r,i,n,o=1){const s=i.getBucket(r),a=i.latestFeatureIndex;if(!s||!a||r.fqid!==s.layerIds[0])return;const l=s.layers[0].layout,c=s.layers[0].paint,u=i.collisionBoxArray,h=Math.pow(2,this.transform.zoom-i.tileID.overscaledZ),d=i.tileSize/e.ab,p=i.tileID.toUnwrapped();this.transform.setProjection(s.projection);const f=(m=i.tileID,_=s.getProjection(),g=this.transform,_.name===this.projection?g.calculateProjMatrix(m.toUnwrapped()):Qt(g,_,m));var m,_,g;const y="map"===l.get("text-pitch-alignment"),x="map"===l.get("text-rotation-alignment");r.compileFilter(r.options);const v=r.dynamicFilter(),b=r.dynamicFilterNeedsFeature(),w=this.transform.calculatePixelsToTileUnitsMatrix(i),T=Bt(f,i.tileID.canonical,y,x,this.transform,s.getProjection(),w);let S=null;if(y){const t=Ft(f,i.tileID.canonical,y,x,this.transform,s.getProjection(),w);S=e.a6.mat4.multiply([],this.transform.labelPlaneMatrix,t)}let E=null;v&&i.latestFeatureIndex&&(E={unwrappedTileID:p,dynamicFilter:v,dynamicFilterNeedsFeature:b}),this.retainedQueryData[s.bucketInstanceId]=new sr(s.bucketInstanceId,a,s.sourceLayerIndex,s.index,i.tileID);const M=s.layers[0].layout.get("text-size-scale-range"),A=e.ap(o,M[0],M[1]),C=s.layers[0].layout.get("icon-size-scale-range"),I=e.ap(o,C[0],C[1]),P={bucket:s,layout:l,paint:c,posMatrix:f,textLabelPlaneMatrix:T,labelToScreenMatrix:S,clippingData:E,scale:h,textPixelRatio:d,holdingForFade:i.holdingForFade(),collisionBoxArray:u,partiallyEvaluatedTextSize:e.bk(s.textSizeData,this.transform.zoom,A),partiallyEvaluatedIconSize:e.bk(s.iconSizeData,this.transform.zoom,I),collisionGroup:this.collisionGroups.get(s.sourceID),latestFeatureIndex:i.latestFeatureIndex};if(n)for(const e of s.sortKeyRanges){const{sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:n}=e;t.push({sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:n,parameters:P})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:s.symbolInstances.length,parameters:P})}attemptAnchorPlacement(e,t,r,i,n,o,s,a,l,c,u,h,d,p,f,m,_,g){const{textOffset0:y,textOffset1:x,crossTileID:v}=h,b=[y,x],w=lr(e,r,i,b,n),T=this.collisionIndex.placeCollisionBox(p,n,t,cr(w.x,w.y,o,s,this.transform.angle),u,a,l,c.predicate);if(m){const e=p.getSymbolInstanceIconSize(g,this.transform.zoom,h.placedIconSymbolIndex);if(0===this.collisionIndex.placeCollisionBox(p,e,m,cr(w.x,w.y,o,s,this.transform.angle),u,a,l,c.predicate).box.length)return}if(T.box.length>0){let t;return this.prevPlacement&&this.prevPlacement.variableOffsets[v]&&this.prevPlacement.placements[v]&&this.prevPlacement.placements[v].text&&(t=this.prevPlacement.variableOffsets[v].anchor),this.variableOffsets[v]={textOffset:b,width:r,height:i,anchor:e,textScale:n,prevAnchor:t},this.markUsedJustification(p,e,h,f),p.allowVerticalPlacement&&(this.markUsedOrientation(p,f,h),this.placedOrientations[v]=f),{shift:w,placedGlyphBoxes:T}}}placeLayerBucketPart(t,r,i,n,o=1){const{bucket:s,layout:a,paint:l,posMatrix:c,textLabelPlaneMatrix:u,labelToScreenMatrix:h,clippingData:d,textPixelRatio:p,holdingForFade:f,collisionBoxArray:m,partiallyEvaluatedTextSize:_,partiallyEvaluatedIconSize:g,collisionGroup:y,latestFeatureIndex:x}=t.parameters,v=a.get("text-optional"),b=a.get("icon-optional"),w=a.get("text-allow-overlap"),T=a.get("icon-allow-overlap"),S="map"===a.get("text-rotation-alignment"),E="map"===a.get("text-pitch-alignment"),M=a.get("symbol-z-elevate"),A=l.get("symbol-z-offset"),C="sea"===a.get("symbol-elevation-reference"),I=a.get("text-size-scale-range"),P=a.get("icon-size-scale-range"),R=e.ap(o,I[0],I[1]),z=e.ap(o,P[0],P[1]);this.transform.setProjection(s.projection);let D=w&&(T||!s.hasIconData()||b),k=T&&(w||!s.hasTextData()||v);const O=!A.isConstant();!s.collisionArrays&&m&&s.deserializeCollisionBoxes(m),i&&n&&s.updateCollisionDebugBuffers(this.transform.zoom,m,R,z);const L=(t,n,l)=>{const{crossTileID:m,numVerticalGlyphVertices:M}=t;let I=null;if(d&&d.dynamicFilterNeedsFeature||O){const e=this.retainedQueryData[s.bucketInstanceId];I=x.loadFeature({featureIndex:t.featureIndex,bucketIndex:e.bucketIndex,sourceLayerIndex:e.sourceLayerIndex,layoutVertexArrayOffset:0})}if(d&&!(0,d.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch},I,this.retainedQueryData[s.bucketInstanceId].tileID.canonical,new e.P(t.tileAnchorX,t.tileAnchorY),this.transform.calculateDistanceTileData(d.unwrappedTileID)))return this.placements[m]=new nr(!1,!1,!1,!0),void r.add(m);const P=A.evaluate(I,{});if(r.has(m))return;if(f)return void(this.placements[m]=new nr(!1,!1,!1));let R=!1,z=!1,L=!0,B=!1,F=!1,N=null,V={box:null,offscreen:null,occluded:null},j={box:null,offscreen:null,occluded:null},U=null,$=null,G=null,q=0,H=0,W=0;l.textFeatureIndex?q=l.textFeatureIndex:t.useRuntimeCollisionCircles&&(q=t.featureIndex),l.verticalTextFeatureIndex&&(H=l.verticalTextFeatureIndex);const Z=e=>{e.tileID=this.retainedQueryData[s.bucketInstanceId].tileID;const r=this.transform.elevation;e.elevation=C?P:P+(r?r.getAtTileOffset(e.tileID,e.tileAnchorX,e.tileAnchorY):0),e.elevation+=t.zOffset},X=l.textBox;if(X){Z(X);const r=r=>{let i=e.bl.horizontal;if(s.allowVerticalPlacement&&!r&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[m];e&&(this.placedOrientations[m]=e,i=e,this.markUsedOrientation(s,i,t))}return i},i=(t,r)=>{if(s.allowVerticalPlacement&&M>0&&l.verticalTextBox){for(const i of s.writingModes)if(i===e.bl.vertical?(V=r(),j=V):V=t(),V&&V.box&&V.box.length)break}else V=t()};if(a.get("text-variable-anchor")){let o=a.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[m]){const e=this.prevPlacement.variableOffsets[m];o.indexOf(e.anchor)>0&&(o=o.filter((t=>t!==e.anchor)),o.unshift(e.anchor))}const u=(e,r,i)=>{const a=s.getSymbolInstanceTextSize(_,t,this.transform.zoom,n),l=(e.x2-e.x1)*a+2*e.padding,u=(e.y2-e.y1)*a+2*e.padding,h=t.hasIconTextFit&&!T?r:null;h&&Z(h);let d={box:[],offscreen:!1,occluded:!1};const f=w?2*o.length:o.length;for(let r=0;r<f;++r){const f=this.attemptAnchorPlacement(o[r%o.length],e,l,u,a,S,E,p,c,y,r>=o.length,t,n,s,i,h,_,g);if(f&&(d=f.placedGlyphBoxes,d&&d.box&&d.box.length)){R=!0,N=f.shift;break}}return d};i((()=>u(X,l.iconBox,e.bl.horizontal)),(()=>{const t=l.verticalTextBox;return t&&Z(t),s.allowVerticalPlacement&&!(V&&V.box&&V.box.length)&&M>0&&t?u(t,l.verticalIconBox,e.bl.vertical):{box:null,offscreen:null,occluded:null}})),V&&(R=V.box,L=V.offscreen,B=V.occluded);const h=r(!(!V||!V.box));if(!R&&this.prevPlacement){const e=this.prevPlacement.variableOffsets[m];e&&(this.variableOffsets[m]=e,this.markUsedJustification(s,e.anchor,t,h))}}else{const a=(r,i)=>{const a=s.getSymbolInstanceTextSize(_,t,this.transform.zoom,n,o),l=this.collisionIndex.placeCollisionBox(s,a,r,new e.P(0,0),w,p,c,y.predicate);return l&&l.box&&l.box.length&&(this.markUsedOrientation(s,i,t),this.placedOrientations[m]=i),l};i((()=>a(X,e.bl.horizontal)),(()=>{const t=l.verticalTextBox;return s.allowVerticalPlacement&&M>0&&t?(Z(t),a(t,e.bl.vertical)):{box:null,offscreen:null,occluded:null}})),r(!!(V&&V.box&&V.box.length))}}if(U=V,R=U&&U.box&&U.box.length>0,L=U&&U.offscreen,B=U&&U.occluded,t.useRuntimeCollisionCircles){const r=s.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex),n=e.bm(s.textSizeData,_,r),o=a.get("text-padding");$=this.collisionIndex.placeCollisionCircles(s,w,r,s.lineVertexArray,s.glyphOffsetArray,n,c,u,h,i,E,y.predicate,t.collisionCircleDiameter*n/e.br,o,this.retainedQueryData[s.bucketInstanceId].tileID),R=w||$.circles.length>0&&!$.collisionDetected,L=L&&$.offscreen,B=$.occluded}if(l.iconFeatureIndex&&(W=l.iconFeatureIndex),l.iconBox){const r=r=>{Z(r);const i=t.hasIconTextFit&&N?cr(N.x,N.y,S,E,this.transform.angle):new e.P(0,0),n=s.getSymbolInstanceIconSize(g,this.transform.zoom,t.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(s,n,r,i,T,p,c,y.predicate)};j&&j.box&&j.box.length&&l.verticalIconBox?(G=r(l.verticalIconBox),z=G.box.length>0):(G=r(l.iconBox),z=G.box.length>0),L=L&&G.offscreen,F=G.occluded}const Y=v||0===t.numHorizontalGlyphVertices&&0===M,J=b||0===t.numIconVertices;if(Y||J?J?Y||(z=z&&R):R=z&&R:z=R=z&&R,R&&U&&U.box&&this.collisionIndex.insertCollisionBox(U.box,a.get("text-ignore-placement"),s.bucketInstanceId,j&&j.box&&H?H:q,y.ID),z&&G&&this.collisionIndex.insertCollisionBox(G.box,a.get("icon-ignore-placement"),s.bucketInstanceId,W,y.ID),$&&(R&&this.collisionIndex.insertCollisionCircles($.circles,a.get("text-ignore-placement"),s.bucketInstanceId,q,y.ID),i)){const e=s.bucketInstanceId;let t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=new or);for(let e=0;e<$.circles.length;e+=4)t.circles.push($.circles[e+0]),t.circles.push($.circles[e+1]),t.circles.push($.circles[e+2]),t.circles.push($.collisionDetected?1:0)}const K="globe"!==s.projection.name;D=D&&(K||!B),k=k&&(K||!F),this.placements[m]=new nr(R||D,z||k,L||s.justReloaded),r.add(m)};if(M&&this.buildingIndex&&(this.buildingIndex.updateZOffset(s,this.retainedQueryData[s.bucketInstanceId].tileID),s.updateZOffset()),s.sortFeaturesByY){const t=s.getSortedSymbolIndexes(this.transform.angle);for(let e=t.length-1;e>=0;--e){const r=t[e];L(s.symbolInstances.get(r),r,s.collisionArrays[r])}s.hasAnyZOffset&&e.w(`${s.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(s.hasAnyZOffset){const e=s.getSortedIndexesByZOffset();for(let t=0;t<e.length;++t){const r=e[t];L(s.symbolInstances.get(r),r,s.collisionArrays[r])}}else for(let e=t.symbolInstanceStart;e<t.symbolInstanceEnd;e++)L(s.symbolInstances.get(e),e,s.collisionArrays[e]);if(i&&s.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[s.bucketInstanceId];e.a6.mat4.invert(t.invProjMatrix,c),t.viewportMatrix=this.collisionIndex.getViewportMatrix()}s.justReloaded=!1}markUsedJustification(t,r,i,n){const{leftJustifiedTextSymbolIndex:o,centerJustifiedTextSymbolIndex:s,rightJustifiedTextSymbolIndex:a,verticalPlacedTextSymbolIndex:l,crossTileID:c}=i,u=e.bw(r),h=n===e.bl.vertical?l:"left"===u?o:"center"===u?s:"right"===u?a:-1;o>=0&&(t.text.placedSymbolArray.get(o).crossTileID=h>=0&&o!==h?0:c),s>=0&&(t.text.placedSymbolArray.get(s).crossTileID=h>=0&&s!==h?0:c),a>=0&&(t.text.placedSymbolArray.get(a).crossTileID=h>=0&&a!==h?0:c),l>=0&&(t.text.placedSymbolArray.get(l).crossTileID=h>=0&&l!==h?0:c)}markUsedOrientation(t,r,i){const n=r===e.bl.horizontal||r===e.bl.horizontalOnly?r:0,o=r===e.bl.vertical?r:0,{leftJustifiedTextSymbolIndex:s,centerJustifiedTextSymbolIndex:a,rightJustifiedTextSymbolIndex:l,verticalPlacedTextSymbolIndex:c}=i,u=t.text.placedSymbolArray;s>=0&&(u.get(s).placedOrientation=n),a>=0&&(u.get(a).placedOrientation=n),l>=0&&(u.get(l).placedOrientation=n),c>=0&&(u.get(c).placedOrientation=o)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const t=this.prevPlacement;let r=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;const i=t?t.symbolFadeChange(e):1,n=t?t.opacities:{},o=t?t.variableOffsets:{},s=t?t.placedOrientations:{};for(const e in this.placements){const t=this.placements[e],o=n[e];o?(this.opacities[e]=new ir(o,i,t.text,t.icon,null,t.clipped),r=r||t.text!==o.text.placed||t.icon!==o.icon.placed):(this.opacities[e]=new ir(null,i,t.text,t.icon,t.skipFade,t.clipped),r=r||t.text||t.icon)}for(const e in n){const t=n[e];if(!this.opacities[e]){const n=new ir(t,i,!1,!1);n.isHidden()||(this.opacities[e]=n,r=r||t.text.placed||t.icon.placed)}}for(const e in o)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=o[e]);for(const e in s)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=s[e]);r?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t,r,i){const n=new Set;for(const o of t){const t=o.getBucket(e);t&&o.latestFeatureIndex&&e.fqid===t.layerIds[0]&&(this.updateBucketOpacities(t,n,o,o.collisionBoxArray,r,i,o.tileID,e.scope),t.layers[0].layout.get("symbol-z-elevate")&&this.buildingIndex&&(this.buildingIndex.updateZOffset(t,o.tileID),t.updateZOffset()))}}updateBucketOpacities(t,r,i,n,o,s,a,l){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const c=t.layers[0].layout,u=t.layers[0].paint,h=!!t.layers[0].dynamicFilter(),d=new ir(null,0,!1,!1,!0),p=c.get("text-allow-overlap"),f=c.get("icon-allow-overlap"),m=c.get("text-variable-anchor"),_="map"===c.get("text-rotation-alignment"),g="map"===c.get("text-pitch-alignment"),y=u.get("symbol-z-offset"),x="sea"===c.get("symbol-elevation-reference"),v=!y.isConstant(),b=new ir(null,0,p&&(f||!t.hasIconData()||c.get("icon-optional")),f&&(p||!t.hasTextData()||c.get("text-optional")),!0);!t.collisionArrays&&n&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(n);const w=(e,t,r)=>{for(let i=0;i<t/4;i++)e.opacityVertexArray.emplaceBack(r)};let T=0;s&&t.updateReplacement(a,s);for(let n=0;n<t.symbolInstances.length;n++){const c=t.symbolInstances.get(n),{numHorizontalGlyphVertices:u,numVerticalGlyphVertices:p,crossTileID:f,numIconVertices:S,tileAnchorX:E,tileAnchorY:M}=c;let A=null;const C=this.retainedQueryData[t.bucketInstanceId];v&&c&&C&&(A=i.latestFeatureIndex.loadFeature({featureIndex:c.featureIndex,bucketIndex:C.bucketIndex,sourceLayerIndex:C.sourceLayerIndex,layoutVertexArrayOffset:0}));const I=y.evaluate(A,{}),P=r.has(f);let R=this.opacities[f];P?R=d:R||(R=b,this.opacities[f]=R),r.add(f);const z=u>0||p>0,D=S>0,k=this.placedOrientations[f],O=k===e.bl.vertical,L=k===e.bl.horizontal||k===e.bl.horizontalOnly;!z&&!D||R.isHidden()||T++;let B=!1;if((z||D)&&s)for(const r of t.activeReplacements){if(e.bs(r,o,e.bt.Symbol,l))continue;if(r.min.x>E||E>r.max.x||r.min.y>M||M>r.max.y)continue;const t=e.bu(E,M,a.canonical,r.footprintTileId.canonical);if(B=e.bv(t,r.footprint),B)break}if(z){const e=B?vr:xr(R.text);w(t.text,u,O?vr:e),w(t.text,p,L?vr:e);const r=R.text.isHidden(),{leftJustifiedTextSymbolIndex:i,centerJustifiedTextSymbolIndex:n,rightJustifiedTextSymbolIndex:o,verticalPlacedTextSymbolIndex:s}=c,a=t.text.placedSymbolArray,l=r||O?1:0;i>=0&&(a.get(i).hidden=l),n>=0&&(a.get(n).hidden=l),o>=0&&(a.get(o).hidden=l),s>=0&&(a.get(s).hidden=r||L?1:0);const h=this.variableOffsets[f];h&&this.markUsedJustification(t,h.anchor,c,k);const d=this.placedOrientations[f];d&&(this.markUsedJustification(t,"left",c,d),this.markUsedOrientation(t,d,c))}if(D){const e=B?vr:xr(R.icon),{placedIconSymbolIndex:r,verticalPlacedIconSymbolIndex:i}=c,n=t.icon.placedSymbolArray,o=R.icon.isHidden()?1:0;r>=0&&(w(t.icon,S,O?vr:e),n.get(r).hidden=o),i>=0&&(w(t.icon,c.numVerticalIconVertices,L?vr:e),n.get(i).hidden=o)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const r=t.collisionArrays[n];if(r){let i=new e.P(0,0),n=!0;if(r.textBox||r.verticalTextBox){if(m){const e=this.variableOffsets[f];e?(i=lr(e.anchor,e.width,e.height,e.textOffset,e.textScale),_&&i._rotate(g?this.transform.angle:-this.transform.angle)):n=!1}h&&(n=!R.clipped),r.textBox&&hr(t.textCollisionBox.collisionVertexArray,R.text.placed,!n||O,I,x,i.x,i.y),r.verticalTextBox&&hr(t.textCollisionBox.collisionVertexArray,R.text.placed,!n||L,I,x,i.x,i.y)}const o=n&&Boolean(!L&&r.verticalIconBox);r.iconBox&&hr(t.iconCollisionBox.collisionVertexArray,R.icon.placed,o,I,x,c.hasIconTextFit?i.x:0,c.hasIconTextFit?i.y:0),r.verticalIconBox&&hr(t.iconCollisionBox.collisionVertexArray,R.icon.placed,!o,I,x,c.hasIconTextFit?i.x:0,c.hasIconTextFit?i.y:0)}}}if(t.fullyClipped=0===T,t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=e.invProjMatrix,t.placementViewportMatrix=e.viewportMatrix,t.collisionCircleArray=e.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){const r=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*r>e}setStale(){this.stale=!0}}function hr(e,t,r,i,n,o,s){e.emplaceBack(t?1:0,r?1:0,o||0,s||0,i,n?1:0),e.emplaceBack(t?1:0,r?1:0,o||0,s||0,i,n?1:0),e.emplaceBack(t?1:0,r?1:0,o||0,s||0,i,n?1:0),e.emplaceBack(t?1:0,r?1:0,o||0,s||0,i,n?1:0)}const dr=Math.pow(2,25),pr=Math.pow(2,24),fr=Math.pow(2,17),mr=Math.pow(2,16),_r=Math.pow(2,9),gr=Math.pow(2,8),yr=Math.pow(2,1);function xr(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;const t=e.placed?1:0,r=Math.floor(127*e.opacity);return r*dr+t*pr+r*fr+t*mr+r*_r+t*gr+r*yr+t}const vr=0;class br{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&void 0!==e.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(e,t,r,i,n,o){const s=this._bucketParts;for(;this._currentTileIndex<e.length;)if(t.getBucketParts(s,i,e[this._currentTileIndex],this._sortAcrossTiles,o),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,s.sort(((e,t)=>e.sortKey-t.sortKey)));this._currentPartIndex<s.length;){const e=s[this._currentPartIndex];if(t.placeLayerBucketPart(e,this._seenCrossTileIDs,r,0===e.symbolInstanceStart,o),this._currentPartIndex++,n())return!0}return!1}}class wr{constructor(e,t,r,i,n,o,s,a,l){this.placement=new ur(e,n,o,s,a,l),this._currentPlacementIndex=t.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=i,this._done=!1}isDone(){return this._done}continuePlacement(t,r,i,n,o){const s=e.q.now(),a=()=>{const t=e.q.now()-s;return!this._forceFullPlacement&&t>2};for(;this._currentPlacementIndex>=0;){const s=r[t[this._currentPlacementIndex]],l=this.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){const t=s,r=t.layout.get("symbol-z-elevate"),l=void 0!==t.layout.get("symbol-sort-key").constantOr(1),c=t.layout.get("symbol-z-order"),u="viewport-y"===c||"auto"===c&&!("viewport-y"!==c&&l),h=t.layout.get("text-allow-overlap")||t.layout.get("icon-allow-overlap")||t.layout.get("text-ignore-placement")||t.layout.get("icon-ignore-placement"),d=u&&h,p=this._inProgressLayer=this._inProgressLayer||new br(t),f=e.av(s.source,s.scope);if(p.continuePlacement(r||d?n[f]:i[f],this.placement,this._showCollisionBoxes,s,a,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const Tr=512/e.ab/2;class Sr{constructor(t,r,i){this.tileID=t,this.bucketInstanceId=i,this.index=new e.bz(r.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const n=t.canonical.x*e.ab,o=t.canonical.y*e.ab;for(let e=0;e<r.length;e++){const{key:t,crossTileID:i,tileAnchorX:s,tileAnchorY:a}=r.get(e),l=Math.floor((n+s)*Tr),c=Math.floor((o+a)*Tr);this.index.add(l,c),this.keys.push(t),this.crossTileIDs.push(i)}this.index.finish()}findMatches(t,r,i){const n=this.tileID.canonical.z<r.canonical.z?1:Math.pow(2,this.tileID.canonical.z-r.canonical.z),o=Tr/Math.pow(2,r.canonical.z-this.tileID.canonical.z),s=r.canonical.x*e.ab,a=r.canonical.y*e.ab;for(let e=0;e<t.length;e++){const r=t.get(e);if(r.crossTileID)continue;const{key:l,tileAnchorX:c,tileAnchorY:u}=r,h=Math.floor((s+c)*o),d=Math.floor((a+u)*o),p=this.index.range(h-n,d-n,h+n,d+n);for(const e of p){const t=this.crossTileIDs[e];if(this.keys[e]===l&&!i.has(t)){i.add(t),r.crossTileID=t;break}}}}}class Er{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Mr{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const t=Math.round((e-this.lng)/360);if(0!==t)for(const e in this.indexes){const r=this.indexes[e],i={};for(const e in r){const n=r[e];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+t),i[n.tileID.key]=n}this.indexes[e]=i}this.lng=e}addBucket(e,t,r){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;e<t.symbolInstances.length;e++)t.symbolInstances.get(e).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]=new Set);const i=this.usedCrossTileIDs[e.overscaledZ];for(const r in this.indexes){const n=this.indexes[r];if(Number(r)>e.overscaledZ)for(const r in n){const o=n[r];o.tileID.isChildOf(e)&&o.findMatches(t.symbolInstances,e,i)}else{const o=n[e.scaledTo(Number(r)).key];o&&o.findMatches(t.symbolInstances,e,i)}}for(let e=0;e<t.symbolInstances.length;e++){const n=t.symbolInstances.get(e);n.crossTileID||(n.crossTileID=r.generate(),i.add(n.crossTileID))}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Sr(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(const r of t.crossTileIDs)this.usedCrossTileIDs[e].delete(r)}removeStaleBuckets(e){let t=!1;for(const r in this.indexes){const i=this.indexes[r];for(const n in i)e[i[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,i[n]),delete i[n],t=!0)}return t}}class Ar{constructor(){this.layerIndexes={},this.crossTileIDs=new Er,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,r,i){let n=this.layerIndexes[e.fqid];void 0===n&&(n=this.layerIndexes[e.fqid]=new Mr);let o=!1;const s={};"globe"!==i.name&&n.handleWrapJump(r);for(const r of t){const t=r.getBucket(e);t&&e.fqid===t.layerIds[0]&&(t.bucketInstanceId||(t.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(r.tileID,t,this.crossTileIDs)&&(o=!0),s[t.bucketInstanceId]=!0)}return n.removeStaleBuckets(s)&&(o=!0),o}pruneUnusedLayers(e){const t={};e.forEach((e=>{t[e]=!0}));for(const e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}const Cr=771;class Ir{constructor(e,t,r,i){this.blendFunction=e,this.blendColor=t,this.mask=r,this.blendEquation=i}}Ir.Replace=[1,0,1,0],Ir.disabled=new Ir(Ir.Replace,e.bA.transparent,[!1,!1,!1,!1]),Ir.unblended=new Ir(Ir.Replace,e.bA.transparent,[!0,!0,!0,!0]),Ir.alphaBlended=new Ir([1,Cr,1,Cr],e.bA.transparent,[!0,!0,!0,!0]),Ir.alphaBlendedNonPremultiplied=new Ir([770,Cr,770,Cr],e.bA.transparent,[!0,!0,!0,!0]),Ir.multiply=new Ir([774,0,774,0],e.bA.transparent,[!0,!0,!0,!0]);class Pr{constructor(e,t,r){this.func=e,this.mask=t,this.range=r}}Pr.ReadOnly=!1,Pr.ReadWrite=!0,Pr.disabled=new Pr(519,Pr.ReadOnly,[0,1]);const Rr=7680;class zr{constructor(e,t,r,i,n,o){this.test=e,this.ref=t,this.mask=r,this.fail=i,this.depthFail=n,this.pass=o}}zr.disabled=new zr({func:519,mask:0},0,0,Rr,Rr,Rr);const Dr=1029,kr=2305;class Or{constructor(e,t,r){this.enable=e,this.mode=t,this.frontFace=r}}function Lr(t,r){const i=e.bD(t,3);e.a6.mat4.fromQuat(t,r),e.bF(t,3,i)}function Br(t,r){const i=e.a6.quat.identity([]);return e.a6.quat.rotateZ(i,i,-r),e.a6.quat.rotateX(i,i,-t),i}function Fr(t,r){const i=[t[0],t[1],0],n=[r[0],r[1],0];if(e.a6.vec3.length(i)>=1e-15){const t=e.a6.vec3.normalize([],i);e.a6.vec3.scale(n,t,e.a6.vec3.dot(n,t)),r[0]=n[0],r[1]=n[1]}const o=e.a6.vec3.cross([],r,t);if(e.a6.vec3.len(o)<1e-15)return null;const s=Math.atan2(-o[1],o[0]);return Br(Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2]),s)}Or.disabled=new Or(!1,Dr,kr),Or.backCCW=new Or(!0,Dr,kr),Or.backCW=new Or(!0,Dr,2304),Or.frontCW=new Or(!0,1028,2304),Or.frontCCW=new Or(!0,1028,kr);class Nr{constructor(e,t){this.position=e,this.orientation=t}get position(){return this._position}set position(t){if(t){const r=t instanceof e.a5?t:new e.a5(t[0],t[1],t[2]);this._renderWorldCopies&&(r.x=e.bB(r.x,0,1)),this._position=r}else this._position=null}lookAtPoint(t,r){if(this.orientation=null,!this.position)return;const i=this.position,n=this._elevation?this._elevation.getAtPointOrZero(e.a5.fromLngLat(t)):0,o=e.a5.fromLngLat(t,n),s=[o.x-i.x,o.y-i.y,o.z-i.z];r||(r=[0,0,1]),r[2]=Math.abs(r[2]),this.orientation=Fr(s,r)}setPitchBearing(t,r){this.orientation=Br(e.bC(t),e.bC(-r))}}class Vr{constructor(t,r){this._transform=e.a6.mat4.identity([]),this.orientation=r,this.position=t}get mercatorPosition(){const t=this.position;return new e.a5(t[0],t[1],t[2])}get position(){const t=e.bD(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var r;t&&e.bF(this._transform,3,[(r=t)[0],r[1],r[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||e.a6.quat.identity([]),t&&Lr(this._transform,this._orientation)}getPitchBearing(){const e=this.forward(),t=this.right();return{bearing:Math.atan2(-t[1],t[0]),pitch:Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2])}}setPitchBearing(e,t){this._orientation=Br(e,t),Lr(this._transform,this._orientation)}forward(){const t=e.bD(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=e.bD(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=e.bD(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,r){const i=new Float64Array(16);return e.a6.mat4.invert(i,this.getWorldToCamera(t,r)),i}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(t,r,i){const n=this.position;e.a6.vec3.scale(n,n,-t);const o=new Float64Array(16);return e.a6.mat4.fromScaling(o,[i,i,i]),e.a6.mat4.translate(o,o,n),o[10]*=r,o}getWorldToCamera(t,r){const i=new Float64Array(16),n=new Float64Array(4),o=this.position;return e.a6.quat.conjugate(n,this._orientation),e.a6.vec3.scale(o,o,-t),e.a6.mat4.fromQuat(i,n),e.a6.mat4.translate(i,i,o),i[1]*=-1,i[5]*=-1,i[9]*=-1,i[13]*=-1,i[8]*=r,i[9]*=r,i[10]*=r,i[11]*=r,i}getCameraToClipPerspective(t,r,i,n){const o=new Float64Array(16);return e.a6.mat4.perspective(o,t,r,i,n),o}getCameraToClipOrthographic(t,r,i,n,o,s){const a=new Float64Array(16);return e.a6.mat4.ortho(a,t,r,i,n,o,s),a}getDistanceToElevation(t,r=!1){const i=0===t?0:e.bE(t,r?e.aN(this.position[1]):this.position[1]),n=this.forward();return(i-this.position[2])/n[2]}clone(){return new Vr([...this.position],[...this.orientation])}}const jr={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class Ur{constructor(e=0,t=0,r=0,i=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(r)||r<0||isNaN(i)||i<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=r,this.right=i}interpolate(t,r,i){return null!=r.top&&null!=t.top&&(this.top=e.aa(t.top,r.top,i)),null!=r.bottom&&null!=t.bottom&&(this.bottom=e.aa(t.bottom,r.bottom,i)),null!=r.left&&null!=t.left&&(this.left=e.aa(t.left,r.left,i)),null!=r.right&&null!=t.right&&(this.right=e.aa(t.right,r.right,i)),this}getCenter(t,r){const i=e.ap((this.left+t-this.right)/2,0,t),n=e.ap((this.top+r-this.bottom)/2,0,r);return new e.P(i,n)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Ur(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const $r=(e,t,r)=>(1-r)*e+r*t,Gr=e=>e*e*e*e*e;class qr{constructor(t,r,i,n,o,s,a){this.tileSize=512,this._renderWorldCopies=void 0===o||o,this._minZoom=t||0,this._maxZoom=r||22,this._minPitch=i??0,this._maxPitch=n??60,this.setProjection(s),this.setMaxBounds(a),this.width=0,this.height=0,this._center=new e.bL(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new Ur,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new Vr,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1}clone(){const e=new qr(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return e._elevation=this._elevation,e._centerAltitude=this._centerAltitude,e._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,e.tileSize=this.tileSize,e.mercatorFromTransition=this.mercatorFromTransition,e.width=this.width,e.height=this.height,e.cameraElevationReference=this.cameraElevationReference,e._center=this._center,e._setZoom(this.zoom),e._seaLevelZoom=this._seaLevelZoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._nearZ=this._nearZ,e._farZ=this._farZ,e._averageElevation=this._averageElevation,e._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._camera=this._camera.clone(),e._calcMatrices(),e.freezeTileCoverage=this.freezeTileCoverage,e.frustumCorners=this.frustumCorners,e}get isOrthographic(){return"globe"!==this.projection.name&&this._orthographicProjectionAtLowPitch&&this.pitch<15}get elevation(){return this._elevation}set elevation(e){this._elevation!==e&&(this._elevation=e,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return"globe"!==this.projection.name&&!this.isOrthographic}updateElevation(e,t=!1){const r=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(null==this._seaLevelZoom||r)&&this._updateCameraOnTerrain(),(e||r)&&this._constrainCamera(t),this._calcMatrices()}getProjection(){return e.ar(this.projection,["name","center","parallels"])}setProjection(t){this.projectionOptions=t||{name:"mercator"};const r=this.projection?this.getProjection():void 0;this.projection=e.bM(this.projectionOptions);const i=this.getProjection(),n=!e.bi(r,i);return n&&this._calcMatrices(),this.mercatorFromTransition=!1,n}setOrthographicProjectionAtLowPitch(e){return this._orthographicProjectionAtLowPitch!==e&&(this._orthographicProjectionAtLowPitch=e,this._calcMatrices(),!0)}setMercatorFromTransition(){const t=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=e.bM({name:"mercator"});const r=t!==this.projection.name;return r&&this._calcMatrices(),r}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies}set renderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const e=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get cameraWorldSize(){const e=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return e.bE(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new e.P(this.width,this.height)}get bearing(){return e.bB(this.rotation,-180,180)}set bearing(e){this.rotation=e}get rotation(){return-this.angle/Math.PI*180}set rotation(t){const r=-t*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=e.a6.mat2.create(),e.a6.mat2.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const r=e.ap(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==r&&(this._unmodified=!1,this._pitch=r,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}get fovX(){return this._fov}get fovY(){const e=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/e)}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=e.bC(t),this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(e){this._averageElevation=e,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(e){const t=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==t&&(this._unmodified=!1,this._setZoom(t),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(e){this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(e){this._tileCoverLift!==e&&(this._tileCoverLift=e)}_updateCameraOnTerrain(){const e=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,t=this.elevation&&e===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||e===Number.NEGATIVE_INFINITY&&(!t||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const r=this._elevation;t||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&r.exaggeration()&&this._centerAltitudeValidForExaggeration!==r.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*r.exaggeration(),this._centerAltitudeValidForExaggeration=r.exaggeration()):(this._centerAltitude=e||0,this._centerAltitudeValidForExaggeration=r.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){void 0!==this._centerAltitudeValidForExaggeration&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;const t=this._elevation,r=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],i=this.horizonLineFromTop();let n=0,o=0;for(let s=0;s<r.length;s++){const a=new e.P(r[s][0]*this.width,i+r[s][1]*(this.height-i)),l=t.pointCoordinate(a);if(!l)continue;const c=1/Math.hypot(l[0]-this._camera.position[0],l[1]-this._camera.position[1]);n+=l[3]*c,o+=c}return 0===o?NaN:n/o}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._terrainEnabled()&&("ground"===this.cameraElevationReference?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(null==this._seaLevelZoom||!this._elevation)return;const e=this._seaLevelZoom,t=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),r=this.pixelsPerMeter/this.worldSize*t,i=this._mercatorZfromZoom(e),n=this._mercatorZfromZoom(this._maxZoom),o=Math.max(i-r,n);this._setZoom(this._zoomFromMercatorZ(o))}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}computeZoomRelativeTo(t){const r=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,t.toAltitude()));let i;i=t.z<this._camera.position[2]?[r.x,r.y,r.z]:[t.x,t.y,t.z];const n=e.a6.vec3.length(e.a6.vec3.sub([],this._camera.position,i));return e.ap(this._zoomFromMercatorZ(n),this._minZoom,this._maxZoom)}setFreeCameraOptions(t){if(!this.height)return;if(!t.position&&!t.orientation)return;this._updateCameraState();let r=!1;if(t.orientation&&!e.a6.quat.exactEquals(t.orientation,this._camera.orientation)&&(r=this._setCameraOrientation(t.orientation)),t.position){const i=[t.position.x,t.position.y,t.position.z];e.a6.vec3.exactEquals(i,this._camera.position)||(this._setCameraPosition(i),r=!0)}r&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const t=this._camera.position,r=new Nr;return r.position=new e.a5(t[0],t[1],t[2]),r.orientation=this._camera.orientation,r._elevation=this.elevation,r._renderWorldCopies=this.renderWorldCopies,r}_setCameraOrientation(t){if(!e.a6.quat.length(t))return!1;e.a6.quat.normalize(t,t);const r=e.a6.vec3.transformQuat([],[0,0,-1],t),i=e.a6.vec3.transformQuat([],[0,-1,0],t);if(i[2]<0)return!1;const n=Fr(r,i);return!!n&&(this._camera.orientation=n,!0)}_setCameraPosition(t){const r=this.zoomScale(this.minZoom)*this.tileSize,i=this.zoomScale(this.maxZoom)*this.tileSize,n=this.cameraToCenterDistance;t[2]=e.ap(t[2],n/i,n/r),this._camera.position=t}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,r){this._unmodified=!1,this._edgeInsets.interpolate(e,t,r),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){const t=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,t)}getVisibleUnwrappedCoordinates(t){const r=[new e.bN(0,t)];if(this.renderWorldCopies){const i=this.pointCoordinate(new e.P(0,0)),n=this.pointCoordinate(new e.P(this.width,0)),o=this.pointCoordinate(new e.P(this.width,this.height)),s=this.pointCoordinate(new e.P(0,this.height)),a=Math.floor(Math.min(i.x,n.x,o.x,s.x)),l=Math.floor(Math.max(i.x,n.x,o.x,s.x)),c=1;for(let i=a-c;i<=l+c;i++)0!==i&&r.push(new e.bN(i,t))}return r}isLODDisabled(e){return(!e||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(t,r,i){let n=[];const o=void 0!==i,s=!o;if(s&&this.zoom<r)return n;if(o&&0===i[0]&&0===i[1])return n;const a=new Set,l=(t,r,i,o,s)=>{const l=e.c2(r,t,i,o,s);a.has(l)||(n.push(new e.aA(t,r,i,o,s)),a.add(l))};for(let e=0;e<t.length;e++){const n=t[e];if(s&&n.canonical.z!==r)continue;const a=n.canonical,c=n.overscaledZ,u=n.wrap,h=1<<a.z,d=a.x+1<h,p=a.x>0,f=a.y+1<h,m=a.y>0,_=n.wrap-(p?0:1),g=n.wrap+(d?0:1),y=p?a.x-1:h-1,x=d?a.x+1:0;if(o)i[0]<0?(l(c,g,a.z,x,a.y),i[1]<0&&f&&(l(c,u,a.z,a.x,a.y+1),l(c,g,a.z,x,a.y+1)),i[1]>0&&m&&(l(c,u,a.z,a.x,a.y-1),l(c,g,a.z,x,a.y-1))):i[0]>0?(l(c,_,a.z,y,a.y),i[1]<0&&f&&(l(c,u,a.z,a.x,a.y+1),l(c,_,a.z,y,a.y+1)),i[1]>0&&m&&(l(c,u,a.z,a.x,a.y-1),l(c,_,a.z,y,a.y-1))):i[1]<0&&f?l(c,u,a.z,a.x,a.y+1):m&&l(c,u,a.z,a.x,a.y-1);else{const e=n.visibleQuadrants;1&e&&(l(c,_,a.z,y,a.y),m&&(l(c,u,a.z,a.x,a.y-1),l(c,_,a.z,y,a.y-1))),2&e&&(l(c,g,a.z,x,a.y),m&&(l(c,u,a.z,a.x,a.y-1),l(c,g,a.z,x,a.y-1))),4&e&&(l(c,_,a.z,y,a.y),f&&(l(c,u,a.z,a.x,a.y+1),l(c,_,a.z,y,a.y+1))),8&e&&(l(c,g,a.z,x,a.y),f&&(l(c,u,a.z,a.x,a.y+1),l(c,g,a.z,x,a.y+1)))}}const c=[];for(const e of n)n.some((t=>e.isChildOf(t)))||c.push(e);if(n=c.filter((e=>!t.some((t=>!!(e.overscaledZ<r&&t.isChildOf(e))||e.equals(t)||e.isChildOf(t))))),s){const e=1<<r,t="globe"===this.projection.name?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),i=[e*t.x,e*t.y],o=4,s=o*o;n=n.filter((e=>{const t=e.canonical.x+.5-i[0],r=e.canonical.y+.5-i[1];return t*t+r*r<s}))}return n}coveringTiles(t){let r=this.coveringZoomLevel(t);const i=r,n=this.elevation&&this.elevation.exaggeration(),o=n&&!t.isTerrainDEM,s="mercator"===this.projection.name;if(void 0!==t.minzoom&&r<t.minzoom)return[];void 0!==t.maxzoom&&r>t.maxzoom&&(r=t.maxzoom);const a=this.locationCoordinate(this.center),l=this.center.lat,c=1<<r,u=[c*a.x,c*a.y,0],h="globe"===this.projection.name,d=!h,p=e.bO.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r,d),f=h?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),m=c*e.bE(1,this.center.lat),_=this._camera.position[2]/e.bE(1,this.center.lat),g=[c*f.x,c*f.y,_*(d?1:m)],y=h||n,x=this.cameraToCenterDistance/t.tileSize*(t.roundZoom?1:.502),v=this.isLODDisabled(!0)?r:0;let b;if(this._elevation&&t.isTerrainDEM)b=1e4*this._elevation.exaggeration();else if(this._elevation){const e=this._elevation.getMinMaxForVisibleTiles();b=e?e.max:this._centerAltitude}else b=this._centerAltitude;const w=t.isTerrainDEM?-b:this._elevation?this._elevation.getMinElevationBelowMSL():0,T=this.projection.isReprojectedInTileSpace?e.bP(this):1,S=t=>{const r=1/4e4,i=new e.a5(t.x+r,t.y,t.z),n=new e.a5(t.x,t.y+r,t.z),o=t.toLngLat(),s=i.toLngLat(),a=n.toLngLat(),l=this.locationCoordinate(o),c=this.locationCoordinate(s),u=this.locationCoordinate(a),h=Math.hypot(c.x-l.x,c.y-l.y),d=Math.hypot(u.x-l.x,u.y-l.y);return Math.sqrt(h*d)*T/r},E=t=>{const r=b,i=w;return{aabb:e.bS(this,c,0,0,0,t,i,r,this.projection),zoom:0,x:0,y:0,minZ:i,maxZ:r,wrap:t,fullyVisible:!1}},M=[];let A=[];const C=r,I=t.reparseOverscaled?i:r,P=(_-this._centerAltitude)*m,R=e=>{if(!this._elevation||!e.tileID||!s)return;const t=this._elevation.getMinMaxForTile(e.tileID),r=e.aabb;t?(r.min[2]=t.min,r.max[2]=t.max,r.center[2]=(r.min[2]+r.max[2])/2):(e.shouldSplit=D(e),e.shouldSplit||(r.min[2]=r.max[2]=r.center[2]=this._centerAltitude))},z=(e,t)=>{if(.707*t<e)return 1;const r=t/e;return r/(1.4144271570014144+(Math.pow(1.1,r-1.4144271570014144+1)-1)/(1.1-1)-1)},D=t=>{if(t.zoom<v)return!0;if(t.zoom===C)return!1;if(null!=t.shouldSplit)return t.shouldSplit;const r=t.aabb.distanceX(g),n=t.aabb.distanceY(g);let a=P,c=1;if(h){a=t.aabb.distanceZ(g);const r=Math.pow(2,t.zoom),i=e.aN((t.y+1)/r),n=e.aN(t.y/r),o=Math.min(Math.max(l,i),n),s=e.c6(o)/e.c6(l);if(c=o===l?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,s/this._mercatorScaleRatio),this.zoom<=e.c3&&t.zoom===C-1&&s>=.9)return!0}else if(o&&(a=t.aabb.distanceZ(g)*m),this.projection.isReprojectedInTileSpace&&i<=5){const r=Math.pow(2,t.zoom),i=S(new e.a5((t.x+.5)/r,(t.y+.5)/r));c=i>.85?1:i}if(!s){const e=Math.sqrt(r*r+n*n+a*a);let i=(1<<C-t.zoom)*x*c;return i*=z(Math.max(a,P),e),e<i}let d=Number.MAX_VALUE,p=0;const f=t.aabb.getCorners(),_=[];for(const t of f){e.a6.vec3.sub(_,t,g),h||(o?_[2]*=m:_[2]=P);const r=e.a6.vec3.dot(_,this._camera.forward());r<d&&(d=r,p=Math.abs(_[2]))}let y=(1<<C-t.zoom)*x*c;if(y*=z(Math.max(p,P),d),d<y)return!0;const b=t.aabb.closestPoint(u);return b[0]===u[0]&&b[1]===u[1]};if(this.renderWorldCopies)for(let e=1;e<=3;e++)M.push(E(-e)),M.push(E(e));for(M.push(E(0));M.length>0;){const i=M.pop(),n=i.x,a=i.y;let l=i.fullyVisible;const d=()=>"globe"===this.projection.name&&(0===i.y||i.y===(1<<i.zoom)-1);if(!l){let t=y?i.aabb.intersects(p):i.aabb.intersectsFlat(p);if(0===t&&d()){const r=new e.bQ(i.zoom,n,a);t=e.bR(this,c,r,!0).intersects(p)}if(0===t)continue;l=2===t}if(i.zoom!==C&&D(i))for(let t=0;t<4;t++){const r=(n<<1)+t%2,u=(a<<1)+(t>>1),d={aabb:s?i.aabb.quadrant(t):e.bS(this,c,i.zoom+1,r,u,i.wrap,i.minZ,i.maxZ,this.projection),zoom:i.zoom+1,x:r,y:u,wrap:i.wrap,fullyVisible:l,tileID:void 0,shouldSplit:void 0,minZ:i.minZ,maxZ:i.maxZ};o&&!h&&(d.tileID=new e.aA(i.zoom+1===C?I:i.zoom+1,i.wrap,i.zoom+1,r,u),R(d)),M.push(d)}else{const o=i.zoom===C?I:i.zoom;if(t.minzoom&&t.minzoom>o)continue;let s=0;if(!l){let r=y?i.aabb.intersectsPrecise(p):i.aabb.intersectsPreciseFlat(p);if(0===r&&d()){const t=new e.bQ(i.zoom,n,a);r=e.bR(this,c,t,!0).intersectsPrecise(p)}if(0===r)continue;if(t.calculateQuadrantVisibility)if(p.containsPoint(i.aabb.center))s=15;else for(let e=0;e<4;e++)0!==i.aabb.quadrant(e).intersects(p)&&(s|=1<<e)}const h=u[0]-(.5+n+(i.wrap<<i.zoom))*(1<<r-i.zoom),f=u[1]-.5-a,m=i.tileID?i.tileID:new e.aA(o,i.wrap,i.zoom,n,a);t.calculateQuadrantVisibility&&(m.visibleQuadrants=s),A.push({tileID:m,distanceSq:h*h+f*f})}}if(this.fogCullDistSq){const r=this.fogCullDistSq,i=this.horizonLineFromTop();A=A.filter((n=>{const o=[0,0,0,1],s=[e.ab,e.ab,0,1],a=this.calculateFogTileMatrix(n.tileID.toUnwrapped());e.a6.vec4.transformMat4(o,o,a),e.a6.vec4.transformMat4(s,s,a);const l=e.a6.vec4.min([],o,s),c=e.a6.vec4.max([],o,s),u=e.bT(l,c);if(0===u)return!0;let h=!1;const d=this._elevation;if(d&&u>r&&0!==i){const r=this.calculateProjMatrix(n.tileID.toUnwrapped());let o;t.isTerrainDEM||(o=d.getMinMaxForTile(n.tileID)),o||(o={min:w,max:b});const s=e.c4(this.rotation),a=[s[0]*e.ab,s[1]*e.ab,o.max];e.a6.vec3.transformMat4(a,a,r),h=(1-a[1])*this.height*.5<i}return u<r||h}))}return A.sort(((e,t)=>e.distanceSq-t.distanceSq)).map((e=>e.tileID))}resize(e,t){this.width=e,this.height=t,this.pixelsToGLUnits=[2/e,-2/t],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(t){const r=e.ap(t.lat,-e.bU,e.bU),i=this.projection.project(t.lng,r);return new e.P(i.x*this.worldSize,i.y*this.worldSize)}unproject(e){return this.projection.unproject(e.x/this.worldSize,e.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/e.bE(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,r){let i,n;const o=this.centerPoint;if("globe"===this.projection.name){const e=this.worldSize;i=(r.x-o.x)/e,n=(r.y-o.y)/e}else{const e=this.pointCoordinate(r),t=this.pointCoordinate(o);i=e.x-t.x,n=e.y-t.y}const s=this.locationCoordinate(t);this.setLocation(new e.a5(s.x-i,s.y-n))}setLocation(e){this.center=this.coordinateLocation(e),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(e){return this.projection.locationPoint(this,e)}locationPoint3D(e){return this.projection.locationPoint(this,e,!0)}pointLocation(e){return this.coordinateLocation(this.pointCoordinate(e))}pointLocation3D(e){return this.coordinateLocation(this.pointCoordinate3D(e))}locationCoordinate(t,r){const i=r?e.bE(r,t.lat):void 0,n=this.projection.project(t.lng,t.lat);return new e.a5(n.x,n.y,i)}coordinateLocation(e){return this.projection.unproject(e.x,e.y)}pointRayIntersection(t,r){const i=null!=r?r:this._centerAltitude,n=[t.x,t.y,0,1],o=[t.x,t.y,1,1];e.a6.vec4.transformMat4(n,n,this.pixelMatrixInverse),e.a6.vec4.transformMat4(o,o,this.pixelMatrixInverse);const s=o[3];e.a6.vec4.scale(n,n,1/n[3]),e.a6.vec4.scale(o,o,1/s);const a=n[2],l=o[2];return{p0:n,p1:o,t:a===l?0:(i-a)/(l-a)}}screenPointToMercatorRay(t){const r=[t.x,t.y,0,1],i=[t.x,t.y,1,1];return e.a6.vec4.transformMat4(r,r,this.pixelMatrixInverse),e.a6.vec4.transformMat4(i,i,this.pixelMatrixInverse),e.a6.vec4.scale(r,r,1/r[3]),e.a6.vec4.scale(i,i,1/i[3]),r[2]=e.bE(r[2],this._center.lat)*this.worldSize,i[2]=e.bE(i[2],this._center.lat)*this.worldSize,e.a6.vec4.scale(r,r,1/this.worldSize),e.a6.vec4.scale(i,i,1/this.worldSize),new e.aj([r[0],r[1],r[2]],e.a6.vec3.normalize([],e.a6.vec3.sub([],i,r)))}rayIntersectionCoordinate(t){const{p0:r,p1:i,t:n}=t,o=e.bE(r[2],this._center.lat),s=e.bE(i[2],this._center.lat);return new e.a5(e.aa(r[0],i[0],n)/this.worldSize,e.aa(r[1],i[1],n)/this.worldSize,e.aa(o,s,n))}pointCoordinate(e,t=this._centerAltitude){return this.projection.pointCoordinate(this,e.x,e.y,t)}pointCoordinate3D(t){if(!this.elevation)return this.pointCoordinate(t);let r=this.projection.pointCoordinate3D(this,t.x,t.y);if(r)return new e.a5(r[0],r[1],r[2]);let i=0,n=this.horizonLineFromTop();if(t.y>n)return this.pointCoordinate(t);const o=.02*n,s=t.clone();for(let t=0;t<10&&n-i>o;t++){s.y=e.aa(i,n,.66);const t=this.projection.pointCoordinate3D(this,s.x,s.y);t?(n=s.y,r=t):i=s.y}return r?new e.a5(r[0],r[1],r[2]):this.pointCoordinate(t)}isPointAboveHorizon(e){return this.projection.isPointAboveHorizon(this,e)}isPointOnSurface(t){if(t.y<0||t.y>this.height||t.x<0||t.x>this.width)return!1;if(this.elevation||this.zoom>=e.bV)return!this.isPointAboveHorizon(t);const r=this.pointCoordinate(t);return r.y>=0&&r.y<=1}_coordinatePoint(t,r){const i=r&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,n=[t.x*this.worldSize,t.y*this.worldSize,i+t.toAltitude(),1];return e.a6.vec4.transformMat4(n,n,this.pixelMatrix),n[3]>0?new e.P(n[0]/n[3],n[1]/n[3]):new e.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:r}=this._edgeInsets,i=this.height-this._edgeInsets.bottom,n=this.width-this._edgeInsets.right,o=this.pointLocation3D(new e.P(r,t)),s=this.pointLocation3D(new e.P(n,t)),a=this.pointLocation3D(new e.P(n,i)),l=this.pointLocation3D(new e.P(r,i));let c=Math.min(o.lng,s.lng,a.lng,l.lng),u=Math.max(o.lng,s.lng,a.lng,l.lng),h=Math.min(o.lat,s.lat,a.lat,l.lat),d=Math.max(o.lat,s.lat,a.lat,l.lat);const p=Math.pow(2,-this.zoom)/16*270,f="globe"===this.projection.name?1:4,m=(t,r,i,n,o)=>{const s=(t+i)/2,a=(r+n)/2,l=new e.P(s,a),{lng:_,lat:g}=this.pointLocation3D(l),y=Math.max(0,c-_,h-g,_-u,g-d);c=Math.min(c,_),u=Math.max(u,_),h=Math.min(h,g),d=Math.max(d,g),(o<f||y>p)&&(m(t,r,s,a,o+1),m(s,a,i,n,o+1))};if(m(r,t,n,t,1),m(n,t,n,i,1),m(n,i,r,i,1),m(r,i,r,t,1),"globe"===this.projection.name){const[t,r]=e.bW(this);t?(d=90,u=180,c=-180):r&&(h=-90,u=180,c=-180)}return new e.as(new e.bL(c,h),new e.bL(u,d))}_getBoundsRectangular(t,r){const{top:i,left:n}=this._edgeInsets,o=this.height-this._edgeInsets.bottom,s=this.width-this._edgeInsets.right,a=new e.P(n,i),l=new e.P(s,i),c=new e.P(s,o),u=new e.P(n,o);let h=this.pointCoordinate(a,t),d=this.pointCoordinate(l,t);const p=this.pointCoordinate(c,r),f=this.pointCoordinate(u,r),m=(e,t)=>(t.y-e.y)/(t.x-e.x);return h.y>1&&d.y>=0?h=new e.a5((1-f.y)/m(f,h)+f.x,1):h.y<0&&d.y<=1&&(h=new e.a5(-f.y/m(f,h)+f.x,0)),d.y>1&&h.y>=0?d=new e.a5((1-p.y)/m(p,d)+p.x,1):d.y<0&&h.y<=1&&(d=new e.a5(-p.y/m(p,d)+p.x,0)),(new e.as).extend(this.coordinateLocation(h)).extend(this.coordinateLocation(d)).extend(this.coordinateLocation(f)).extend(this.coordinateLocation(p))}_getBoundsRectangularTerrain(){const e=this.elevation;if(!e.visibleDemTiles.length||e.isUsingMockSource())return this._getBoundsRectangular(0,0);const t=e.visibleDemTiles.reduce(((e,t)=>{if(t.dem){const r=t.dem.tree;e.min=Math.min(e.min,r.minimums[0]),e.max=Math.max(e.max,r.maximums[0])}return e}),{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(t.min*e.exaggeration(),t.max*e.exaggeration())}getBounds(){return"mercator"===this.projection.name||"equirectangular"===this.projection.name?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(e=!0){const t=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,r=this.height/2-t*(1-this._horizonShift);return e?Math.max(0,r):r}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-e.bU,this.maxLat=e.bU,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=e.am(this.minLng)*this.tileSize,this.worldMaxX=e.am(this.maxLng)*this.tileSize,this.worldMinY=e.at(this.maxLat)*this.tileSize,this.worldMaxY=e.at(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(e,t){return this.projection.createTileMatrix(this,t,e)}calculateDistanceTileData(t){const r=t.key,i=this._distanceTileDataCache;if(i[r])return i[r];const n=t.canonical,o=1/this.height,s=this.cameraWorldSize,a=s/this.zoomScale(n.z),l=(n.x+Math.pow(2,n.z)*t.wrap)*a,c=n.y*a,u=this.point;u.x*=s/this.worldSize,u.y*=s/this.worldSize;const h=this.angle,d=Math.sin(-h),p=-Math.cos(-h);return i[r]={bearing:[d,p],center:[(u.x-l)*o,(u.y-c)*o],scale:a/e.ab*o},i[r]}calculateFogTileMatrix(t){const r=t.key,i=this._fogTileMatrixCache;if(i[r])return i[r];const n=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,t);return e.a6.mat4.multiply(n,this.worldToFogMatrix,n),i[r]=new Float32Array(n),i[r]}calculateProjMatrix(t,r=!1,i=!1){const n=t.key;let o;if(o=i?this._expandedProjMatrixCache:r?this._alignedProjMatrixCache:this._projMatrixCache,o[n])return o[n];const s=this.calculatePosMatrix(t,this.worldSize);let a;return a=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:i?this.expandedFarZProjMatrix:r?this.alignedProjMatrix:this.projMatrix,e.a6.mat4.multiply(s,a,s),o[n]=new Float32Array(s),o[n]}calculatePixelsToTileUnitsMatrix(t){const r=t.tileID.key,i=this._pixelsToTileUnitsCache;if(i[r])return i[r];const n=e.bX(t,this);return i[r]=n,i[r]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if("globe"===this.projection.name){const t=1/this.worldSize,r=e.a6.mat4.fromScaling([],[t,t,t]);return e.a6.mat4.multiply(r,r,this.globeMatrix),r}}recenterOnTerrain(){if(!this._elevation||"globe"===this.projection.name)return;const t=this._elevation;this._updateCameraState();const r=e.bE(1,this._center.lat)*this.worldSize,i=this._computeCameraPosition(r),n=this._camera.forward(),o=e.bE(1,this._center.lat);i[2]/=o,n[2]/=o,e.a6.vec3.normalize(n,n);const s=t.raycast(i,n,t.exaggeration());if(s){const t=e.a6.vec3.scaleAndAdd([],i,n,s),r=new e.a5(t[0],t[1],e.bE(t[2],e.aN(t[1]))),a=(r.z+e.a6.vec3.length([r.x-i[0],r.y-i[1],r.z-i[2]*o]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(a),this._centerAltitude=r.toAltitude(),this._center=this.coordinateLocation(r),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(t=!1){if(!this._elevation)return;const r=this._elevation,i=e.bE(1,this._center.lat)*this.worldSize,n=this._computeCameraPosition(i),o=r.getAtPointOrZero(new e.a5(...n)),s=this.pixelsPerMeter/this.worldSize*o,a=this._minimumHeightOverTerrain(),l=n[2]-s;if(l<=a)if(l<0||t){const t=this.locationCoordinate(this._center,this._centerAltitude),r=[n[0],n[1],t.z-n[2]],i=e.a6.vec3.length(r);r[2]-=(a-l)/this._pixelsPerMercatorPixel;const o=e.a6.vec3.length(r);if(0===o)return;e.a6.vec3.scale(r,r,i/o*this._pixelsPerMercatorPixel),this._camera.position=[n[0],n[1],t.z*this._pixelsPerMercatorPixel-r[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t="globe"===this.projection.name||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||t){const r=this.center;return r.lat=e.ap(r.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!t)&&(r.lng=e.ap(r.lng,this.minLng,this.maxLng)),this.center=r,void(this._constraining=!1)}const r=this._unmodified,{x:i,y:n}=this.point;let o=0,s=i,a=n;const l=this.width/2,c=this.height/2,u=this.worldMinY*this.scale,h=this.worldMaxY*this.scale;if(n-c<u&&(a=u+c),n+c>h&&(a=h-c),h-u<this.height&&(o=Math.max(o,this.height/(h-u)),a=(h+u)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const e=this.worldMinX*this.scale,t=this.worldMaxX*this.scale,r=this.worldSize/2-(e+t)/2;s=(i+r+this.worldSize)%this.worldSize-r,s-l<e&&(s=e+l),s+l>t&&(s=t-l),t-e<this.width&&(o=Math.max(o,this.width/(t-e)),s=(t+e)/2)}s===i&&a===n||(this.center=this.unproject(new e.P(s,a))),o&&(this.zoom+=this.scaleZoom(o)),this._constrainCamera(),this._unmodified=r,this._constraining=!1}_minZoomForBounds(){let e=Math.max(0,this.scaleZoom(this.height/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(e=Math.max(e,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),e}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,r="globe"===this.projection.name,i=this.pixelsPerMeter;"globe"===this.projection.name&&(this._mercatorScaleRatio=e.bE(1,this.center.lat)/e.bE(1,e.c5));const n=e.bY(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,n),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const o="meters"===this.projection.zAxisUnit?i:1,s=this._camera.getWorldToCamera(this.worldSize,o);let a;const l=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(l[8]=2*-t.x/this.width,l[9]=2*t.y/this.height,this.isOrthographic){let e=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),r=e*this.aspect,i=-r,n=-e;r-=t.x,i-=t.x,e+=t.y,n+=t.y,a=this._camera.getCameraToClipOrthographic(i,r,n,e,this._nearZ,this._farZ),((e,t,r,i)=>{for(let n=0;n<16;n++)e[n]=$r(t[n],r[n],i)})(a,a,l,Gr(this.pitch>=15?1:this.pitch/15))}else a=l;const c=e.a6.mat4.mul([],l,s);let u=e.a6.mat4.mul([],a,s);if(this.projection.isReprojectedInTileSpace){const t=this.locationCoordinate(this.center),r=e.a6.mat4.identity([]);e.a6.mat4.translate(r,r,[t.x*this.worldSize,t.y*this.worldSize,0]),e.a6.mat4.multiply(r,r,e.bZ(this)),e.a6.mat4.translate(r,r,[-t.x*this.worldSize,-t.y*this.worldSize,0]),e.a6.mat4.multiply(u,u,r),e.a6.mat4.multiply(c,c,r),this.inverseAdjustmentMatrix=e.b_(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=e.a6.mat4.scale([],u,[this.worldSize,this.worldSize,this.worldSize/o,1]),this.projMatrix=u,this.invProjMatrix=e.a6.mat4.invert(new Float64Array(16),this.projMatrix),r){const r=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);r[8]=2*-t.x/this.width,r[9]=2*t.y/this.height,this.expandedFarZProjMatrix=e.a6.mat4.mul([],r,s)}else this.expandedFarZProjMatrix=this.projMatrix;const h=e.a6.mat4.invert([],a);this.frustumCorners=e.b$.fromInvProjectionMatrix(h,this.horizonLineFromTop(),this.height),this.cameraFrustum=e.bO.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!r);const d=new Float32Array(16);e.a6.mat4.identity(d),e.a6.mat4.scale(d,d,[1,-1,1]),e.a6.mat4.rotateX(d,d,this._pitch),e.a6.mat4.rotateZ(d,d,this.angle);const p=e.a6.mat4.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=e.a6.mat4.clone(p);const f=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;p[8]=2*-t.x/this.width,p[9]=2*(t.y+f)/this.height,this.skyboxMatrix=e.a6.mat4.multiply(d,p,d);const m=this.point,_=m.x,g=m.y,y=this.width%2/2,x=this.height%2/2,v=Math.cos(this.angle),b=Math.sin(this.angle),w=_-Math.round(_)+v*y+b*x,T=g-Math.round(g)+v*x+b*y,S=new Float64Array(u);if(e.a6.mat4.translate(S,S,[w>.5?w-1:w,T>.5?T-1:T,0]),this.alignedProjMatrix=S,u=e.a6.mat4.create(),e.a6.mat4.scale(u,u,[this.width/2,-this.height/2,1]),e.a6.mat4.translate(u,u,[1,-1,0]),this.labelPlaneMatrix=u,u=e.a6.mat4.create(),e.a6.mat4.scale(u,u,[1,-1,1]),e.a6.mat4.translate(u,u,[-1,-1,0]),e.a6.mat4.scale(u,u,[2/this.width,2/this.height,1]),this.glCoordMatrix=u,this.pixelMatrix=e.a6.mat4.multiply(new Float64Array(16),this.labelPlaneMatrix,c),this._calcFogMatrices(),this._distanceTileDataCache={},u=e.a6.mat4.invert(new Float64Array(16),this.pixelMatrix),!u)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=u,"globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=e.c0(this);const t=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=e.a6.vec3.transformMat4(t,t,s),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=u;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSizeForFog,r=this.cameraPixelsPerMeter,i=this._camera.position,n=1/this.height/this._pixelsPerMercatorPixel,o=[t,t,r];e.a6.vec3.scale(o,o,n),e.a6.vec3.scale(i,i,-1),e.a6.vec3.multiply(i,i,o);const s=e.a6.mat4.create();e.a6.mat4.translate(s,s,i),e.a6.mat4.scale(s,s,o),this.mercatorFogMatrix=s,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,r,n)}_computeCameraPosition(e){const t=(e=e||this.pixelsPerMeter)/this.pixelsPerMeter,r=this._camera.forward(),i=this.point,n=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*t-e/this.worldSize*this._centerAltitude;return[i.x/this.worldSize-r[0]*n,i.y/this.worldSize-r[1]*n,e/this.worldSize*this._centerAltitude-r[2]*n]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const r=this._maxCameraBoundsDistance()*Math.cos(this._pitch),i=this._camera.position[2],n=t[2];let o=1;this.projection.wrap&&(this.center=this.center.wrap()),n>0&&(o=Math.min((r-i)/n,1)),this._camera.position=e.a6.vec3.scaleAndAdd([],this._camera.position,t,o),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,r=this._camera.forward(),{pitch:i,bearing:n}=this._camera.getPitchBearing(),o=e.bE(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,s=this._mercatorZfromZoom(this._maxZoom)*Math.cos(e.bC(this._maxPitch)),a=Math.max((t[2]-o)/Math.cos(i),s),l=this._zoomFromMercatorZ(a);e.a6.vec3.scaleAndAdd(t,t,r,a),this._pitch=e.ap(i,e.bC(this.minPitch),e.bC(this.maxPitch)),this.angle=e.bB(n,-Math.PI,Math.PI),this._setZoom(e.ap(l,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new e.a5(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(e){return Math.pow(2,e)*this.tileSize}_mercatorZfromZoom(e){return this.cameraToCenterDistance/this._worldSizeFromZoom(e)}_minimumHeightOverTerrain(){const e=Math.min(null!=this._seaLevelZoom?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(e)}_zoomFromMercatorZ(e){return this.scaleZoom(this.cameraToCenterDistance/(e*this.tileSize))}zoomFromMercatorZAdjusted(t){let r=0,i=e.bV,n=0,o=1/0;for(;i-r>1e-6&&i>r;){const e=r+.5*(i-r),s=this.tileSize*Math.pow(2,e),a=this.getCameraToCenterDistance(this.projection,e,s),l=this.scaleZoom(a/(t*this.tileSize)),c=Math.abs(e-l);c<o&&(o=c,n=e),e<l?r=e:i=e}return n}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(e.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(t,r){const i=Math.min(t.x,r.x),n=Math.max(t.x,r.x),o=Math.min(t.y,r.y),s=Math.max(t.y,r.y);if(o<this.horizonLineFromTop(!1))return!0;if("mercator"!==this.projection.name)return!1;const a=[new e.P(i,o),new e.P(n,s),new e.P(i,s),new e.P(n,o)],l=this.renderWorldCopies?-3:0,c=this.renderWorldCopies?4:1;for(const e of a){const t=this.pointRayIntersection(e);if(t.t<0)return!0;const r=this.rayIntersectionCoordinate(t);if(r.x<l||r.y<0||r.x>c||r.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+e.c1(this.fovAboveCenter)>88||this.anyCornerOffEdge(new e.P(0,0),new e.P(this.width,this.height))}zoomDeltaToMovement(t,r){const i=e.a6.vec3.length(e.a6.vec3.sub([],this._camera.position,t)),n=this._zoomFromMercatorZ(i)+r;return i-this._mercatorZfromZoom(n)}getCameraPoint(){if("globe"===this.projection.name){const t=function([t,r,i],n){const o=[t,r,i,1];e.a6.vec4.transformMat4(o,o,n);const s=o[3]=Math.max(o[3],1e-6);return o[0]/=s,o[1]/=s,o[2]/=s,o}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new e.P(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.P(0,t))}}getCameraToCenterDistance(t,r=this.zoom,i=this.worldSize){const n=e.bY(t,r,this.width,this.height,1024),o=t.pixelSpaceConversion(this.center.lat,i,n);let s=.5/Math.tan(.5*this._fov)*this.height*o;return this.isOrthographic&&(s=$r(1,s,Gr(this.pitch>=15?1:this.pitch/15))),s}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return"globe"===this.projection.name&&e.a6.mat4.multiply(t,t,this.globeMatrix),t}getFrustum(t){return e.bO.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,"meters"===this.projection.zAxisUnit)}}const Hr=(t,r)=>{if(r>0&&t.terrain&&e.w("Cutoff is currently disabled on terrain"),r<=0||t.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const i=t.transform,n=Math.max(Math.abs(i._zoom-(t.minCutoffZoom-1)),1),o=i.isLODDisabled(!1)?e.a7(60,45,i.pitch):e.a7(30,15,i.pitch),s=i._farZ-i._nearZ,a=r*i.height,l=((1-(c=o))*i.cameraToCenterDistance+c*(i._farZ+a))*n;var c;return{shouldRenderCutoff:o<1,uniformValues:{u_cutoff_params:[i._nearZ,i._farZ,(l-i._nearZ)/s,(l-a-i._nearZ)/s]}}},Wr={cascadeCount:2,normalOffset:3,shadowMapResolution:2048};class Zr{constructor(e,t){this.aabb=e,this.lastCascade=t}}class Xr{add(e,t){const r=this.receivers[e.key];void 0!==r?(r.aabb.min[0]=Math.min(r.aabb.min[0],t.min[0]),r.aabb.min[1]=Math.min(r.aabb.min[1],t.min[1]),r.aabb.min[2]=Math.min(r.aabb.min[2],t.min[2]),r.aabb.max[0]=Math.max(r.aabb.max[0],t.max[0]),r.aabb.max[1]=Math.max(r.aabb.max[1],t.max[1]),r.aabb.max[2]=Math.max(r.aabb.max[2],t.max[2])):this.receivers[e.key]=new Zr(t,null)}clear(){this.receivers={}}get(e){return this.receivers[e.key]}computeRequiredCascades(t,r,i){const n=e.ca.fromPoints(t.points);let o=0;for(const t in this.receivers){const s=this.receivers[t];if(!s)continue;if(!n.intersectsAabb(s.aabb))continue;s.aabb.min=n.closestPoint(s.aabb.min),s.aabb.max=n.closestPoint(s.aabb.max);const a=s.aabb.getCorners();for(let t=0;t<i.length;t++){let n=!0;for(const o of a){const s=[o[0]*r,o[1]*r,o[2]];if(e.a6.vec3.transformMat4(s,s,i[t].matrix),s[0]<-1||s[0]>1||s[1]<-1||s[1]>1){n=!1;break}}if(s.lastCascade=t,o=Math.max(o,t),n)break}}return o+1}}class Yr{constructor(e){this.painter=e,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new Xr,this._depthMode=new Pr(e.context.gl.LEQUAL,Pr.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1,e.tp.registerParameter(this,["Shadows"],"_forceDisable",{label:"forceDisable"},(()=>{this.painter.style.map.triggerRepaint()})),e.tp.registerParameter(Wr,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),e.tp.registerParameter(Wr,["Shadows"],"normalOffset",{min:0,max:10,step:.05}),e.tp.registerParameter(Wr,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32}),e.tp.registerBinding(this,["Shadows"],"_numCascadesToRender",{readonly:!0,label:"numCascadesToRender"})}destroy(){for(const e of this._cascades)e.texture.destroy(),e.framebuffer.destroy();this._cascades=[]}updateShadowParameters(t,r){const i=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!r||!r.properties)return;const n=r.properties.get("shadow-intensity");if(!r.shadowsEnabled()||n<=0)return;if(this._shadowLayerCount=i.style.order.reduce(((e,r)=>{const n=i.style._mergedLayers[r];return e+(n.hasShadowPass()&&!n.isHidden(t.zoom)?1:0)}),0),this._enabled=this._shadowLayerCount>0,!this.enabled)return;const o=i.context,s=Wr.shadowMapResolution,a=Wr.shadowMapResolution;if(0===this._cascades.length||Wr.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let t=0;t<Wr.cascadeCount;++t){const t=i._shadowMapDebug,r=o.gl,n=o.createFramebuffer(s,a,t,"texture"),l=new e.T(o,{width:s,height:a,data:null},r.DEPTH_COMPONENT16);if(n.depthAttachment.set(l.texture),t){const t=new e.T(o,{width:s,height:a,data:null},r.RGBA8);n.colorAttachment.set(t.texture)}this._cascades.push({framebuffer:n,texture:l,matrix:[],far:0,boundingSphereRadius:0,frustum:new e.bO,scale:0})}}this.shadowDirection=Kr(r);let l=0;if(t.elevation){const e=t.elevation,r=[1e4,-1e4];e.visibleDemTiles.filter((e=>e.dem)).forEach((e=>{const t=e.dem.tree;r[0]=Math.min(r[0],t.minimums[0]),r[1]=Math.max(r[1],t.maximums[0])})),1e4!==r[0]&&(l=(r[1]-r[0])*e.exaggeration())}const c=1.5*t.cameraToCenterDistance,u=3*c,h=new Float64Array(16);for(let r=0;r<this._cascades.length;++r){const i=this._cascades[r];let n=t.height/50,o=1;1===Wr.cascadeCount?o=u:0===r?o=c:(n=c,o=u);const[s,a]=ei(t,this.shadowDirection,n,o,Wr.shadowMapResolution,l);i.scale=t.scale,i.matrix=s,i.boundingSphereRadius=a,e.a6.mat4.invert(h,i.matrix),i.frustum=e.bO.fromInvProjectionMatrix(h,1,0,!0),i.far=o}const d=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[d].far,this._cascades[d].far],this._uniformValues.u_shadow_intensity=n,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/Wr.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=Wr.shadowMapResolution,this._uniformValues.u_shadowmap_0=jr.ShadowMap0,this._uniformValues.u_shadowmap_1=jr.ShadowMap0+1,this._groundShadowTiles=i.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const p=i.transform.elevation;for(const e of this._groundShadowTiles){let t={min:0,max:0};if(p){const r=p.getMinMaxForTile(e);r&&(t=r)}this.addShadowReceiver(e.toUnwrapped(),t.min,t.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(e){this._enabled=e}drawShadowPass(t,r){if(!this.enabled)return;const i=this.painter,n=i.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(i.transform.getFrustum(0),i.transform.worldSize,this._cascades),n.viewport.set([0,0,Wr.shadowMapResolution,Wr.shadowMapResolution]);for(let o=0;o<this._numCascadesToRender;++o){i.currentShadowCascade=o,n.bindFramebuffer.set(this._cascades[o].framebuffer.framebuffer),n.clear({color:e.bA.white,depth:1});for(const e of t.order){const n=t._mergedLayers[e];if(!n.hasShadowPass()||n.isHidden(i.transform.zoom))continue;const o=t.getLayerSourceCache(n),s=o?r[o.id]:void 0;("model"===n.type||s&&s.length)&&i.renderLayer(i,o,n,s)}}i.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const e=this.painter,t=e.style,r=e.context,i=t.directionalLight,n=t.ambientLight;if(!i||!n)return;const o=[],s=Hr(e,e.longestCutoffRange);s.shouldRenderCutoff&&o.push("RENDER_CUTOFF"),o.push("RENDER_SHADOWS","DEPTH_TEXTURE"),this.useNormalOffset&&o.push("NORMAL_OFFSET");const a=Qr(t,i,n),l=new Pr(r.gl.LEQUAL,Pr.ReadOnly,e.depthRangeFor3D);for(const t of this._groundShadowTiles){const i=t.toUnwrapped(),n=e.isTileAffectedByFog(t),c=e.getOrCreateProgram("groundShadow",{defines:o,overrideFog:n});this.setupShadows(i,c),e.uploadCommonUniforms(r,c,i,null,s);const u={u_matrix:e.transform.calculateProjMatrix(i),u_ground_shadow_factor:a};c.draw(e,r.gl.TRIANGLES,l,zr.disabled,Ir.multiply,Or.disabled,u,"ground_shadow",e.tileExtentBuffer,e.quadTriangleIndexBuffer,e.tileExtentSegments,{},e.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?Ir.unblended:Ir.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(t){const r=this.painter.transform,i=r.calculatePosMatrix(t,r.worldSize);return e.a6.mat4.multiply(i,this._cascades[this.painter.currentShadowCascade].matrix,i),Float32Array.from(i)}calculateShadowPassMatrixFromMatrix(t){return e.a6.mat4.multiply(t,this._cascades[this.painter.currentShadowCascade].matrix,t),Float32Array.from(t)}setupShadows(t,r,i,n=0){if(!this.enabled)return;const o=this.painter.transform,s=this.painter.context,a=s.gl,l=this._uniformValues,c=new Float64Array(16),u=o.calculatePosMatrix(t,o.worldSize);for(let t=0;t<this._cascades.length;t++)e.a6.mat4.multiply(c,this._cascades[t].matrix,u),l[0===t?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(c),s.activeTexture.set(a.TEXTURE0+jr.ShadowMap0+t),this._cascades[t].texture.bind(a.NEAREST,a.CLAMP_TO_EDGE);if(this.useNormalOffset=!!i,this.useNormalOffset){const r=e.c9(t.canonical),s=2/o.tileSize*e.ab/Wr.shadowMapResolution,a=s*this._cascades[0].boundingSphereRadius,c=s*this._cascades[this._cascades.length-1].boundingSphereRadius,u=("vector-tile"===i?1:3)/Math.pow(2,n-t.canonical.z-(1-o.zoom+Math.floor(o.zoom)));l.u_shadow_normal_offset=[r,a*u,c*u],l.u_shadow_bias=[6e-5,.0012,.012]}else l.u_shadow_bias=[36e-5,.0012,.012];r.setShadowUniformValues(s,l)}setupShadowsFromMatrix(t,r,i=!1){if(!this.enabled)return;const n=this.painter.context,o=n.gl,s=this._uniformValues,a=new Float64Array(16);for(let r=0;r<Wr.cascadeCount;r++)e.a6.mat4.multiply(a,this._cascades[r].matrix,t),s[0===r?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(a),n.activeTexture.set(o.TEXTURE0+jr.ShadowMap0+r),this._cascades[r].texture.bind(o.NEAREST,o.CLAMP_TO_EDGE);if(this.useNormalOffset=i,i){const e=Wr.normalOffset;s.u_shadow_normal_offset=[1,e,e],s.u_shadow_bias=[6e-5,.0012,.012]}else s.u_shadow_bias=[36e-5,.0012,.012];r.setShadowUniformValues(n,s)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(t,r,i,n){if(n[2]>=0)return{};const o=function(t,r,i){const n=i/(1<<t.canonical.z);return new e.ca([t.canonical.x*n+t.wrap*i,t.canonical.y*n+t.wrap*i,0],[(t.canonical.x+1)*n+t.wrap*i,(t.canonical.y+1)*n+t.wrap*i,r])}(t,r,i).getCorners(),s=r/-n[2];n[0]<0?(e.a6.vec3.add(o[0],o[0],[n[0]*s,0,0]),e.a6.vec3.add(o[3],o[3],[n[0]*s,0,0])):n[0]>0&&(e.a6.vec3.add(o[1],o[1],[n[0]*s,0,0]),e.a6.vec3.add(o[2],o[2],[n[0]*s,0,0])),n[1]<0?(e.a6.vec3.add(o[0],o[0],[0,n[1]*s,0]),e.a6.vec3.add(o[1],o[1],[0,n[1]*s,0])):n[1]>0&&(e.a6.vec3.add(o[2],o[2],[0,n[1]*s,0]),e.a6.vec3.add(o[3],o[3],[0,n[1]*s,0]));const a={};return a.vertices=o,a.planes=[Jr(o[1],o[0],o[4]),Jr(o[2],o[1],o[5]),Jr(o[3],o[2],o[6]),Jr(o[0],o[3],o[7])],a}addShadowReceiver(t,r,i){this._receivers.add(t,e.ca.fromTileIdAndHeight(t,r,i))}getMaxCascadeForTile(e){const t=this._receivers.get(e);return t&&t.lastCascade?t.lastCascade:0}}function Jr(t,r,i){const n=e.a6.vec3.sub([],i,r),o=e.a6.vec3.sub([],t,r),s=e.a6.vec3.cross([],n,o),a=e.a6.vec3.length(s);return 0===a?[0,0,1,0]:(e.a6.vec3.scale(s,s,1/a),[s[0],s[1],s[2],-e.a6.vec3.dot(s,r)])}function Kr(t){const r=t.properties.get("direction"),i=e.c8(r.x,r.y,r.z);i[2]=e.ap(i[2],0,75);const n=e.cb([i[0],i[1],i[2]]);return e.a6.vec3.fromValues(n.x,n.y,n.z)}function Qr(t,r,i){const n=r.properties.get("color"),o=r.properties.get("intensity"),s=r.properties.get("direction"),a=[s.x,s.y,s.z],l=i.properties.get("color"),c=i.properties.get("intensity"),u=Math.max(e.a6.vec3.dot([0,0,1],a),0),h=[0,0,0];e.a6.vec3.scale(h,l.toRenderColor(t.getLut(r.scope)).toArray01Linear().slice(0,3),c);const d=[0,0,0];return e.a6.vec3.scale(d,n.toRenderColor(t.getLut(i.scope)).toArray01Linear().slice(0,3),u*o),e.cc([h[0]>0?h[0]/(h[0]+d[0]):0,h[1]>0?h[1]/(h[1]+d[1]):0,h[2]>0?h[2]/(h[2]+d[2]):0])}function ei(t,r,i,n,o,s){const a=t.zoom,l=t.scale,c=t.worldSize,u=1/c,h=t.aspect,d=Math.sqrt(1+h*h)*Math.tan(.5*t.fovX),p=d*d,f=n-i,m=n+i;let _,g;p>f/m?(_=n,g=n*d):(_=.5*m*(1+p),g=.5*Math.sqrt(f*f+2*(n*n+i*i)*p+m*m*p*p));const y=t.projection.pixelsPerMeter(t.center.lat,c),x=t._camera.getCameraToWorldMercator(),v=[0,0,-_*u];e.a6.vec3.transformMat4(v,v,x);let b=g*u;const w=t._edgeInsets;if(!(0===w.left&&0===w.top&&0===w.right&&0===w.bottom||w.left===w.right&&w.top===w.bottom)){const r=t._camera.getWorldToCamera(t.worldSize,"meters"===t.projection.zAxisUnit?y:1),o=t._camera.getCameraToClipPerspective(t._fov,t.width/t.height,i,n);o[8]=2*-t.centerOffset.x/t.width,o[9]=2*t.centerOffset.y/t.height;const s=new Float64Array(16);e.a6.mat4.mul(s,o,r);const u=new Float64Array(16);e.a6.mat4.invert(u,s);const h=e.bO.fromInvProjectionMatrix(u,c,a,!0);for(const r of h.points){const i=((T=r)[0]/=l,T[1]/=l,T[2]=e.bE(T[2],t._center.lat),T);b=Math.max(b,e.a6.vec3.len(e.a6.vec3.subtract([],v,i)))}}var T;b*=o/(o-1);const S=Math.acos(r[2]),E=Math.atan2(-r[0],-r[1]),M=new Vr;M.position=v,M.setPitchBearing(S,E);const A=M.getWorldToCamera(c,y),C=b*c,I=Math.min(t._mercatorZfromZoom(17)*c*-2,-2*C),P=M.getCameraToClipOrthographic(-C,C,-C,C,I,(C+s*y)/r[2]),R=new Float64Array(16);e.a6.mat4.multiply(R,P,A);const z=e.a6.vec3.fromValues(Math.floor(1e6*v[0])/1e6*c,Math.floor(1e6*v[1])/1e6*c,0),D=.5*o,k=[0,0,0];e.a6.vec3.transformMat4(k,z,R),e.a6.vec3.scale(k,k,D);const O=[Math.floor(k[0]),Math.floor(k[1]),Math.floor(k[2])],L=[0,0,0];e.a6.vec3.sub(L,k,O),e.a6.vec3.scale(L,L,-1/D);const B=new Float64Array(16);return e.a6.mat4.identity(B),e.a6.mat4.translate(B,B,L),e.a6.mat4.multiply(R,B,R),[R,C]}class ti extends e.E{constructor(e){super(),this.requestManager=e,this.models={"":{}},this.numModelsLoading={}}loadModel(t,r){return e.aG(this.requestManager.transformRequest(r,e.R.Model).url).then((r=>{if(!r)return;const i=e.aH(r),n=new e.aI(t,void 0,void 0,i);return n.computeBoundsAndApplyParent(),n})).catch((i=>{if(i&&404===i.status)return null;this.fire(new e.t(new Error(`Could not load model ${t} from ${r}: ${i.message}`)))}))}load(t,r){this.models[r]||(this.models[r]={});const i=Object.keys(t);this.numModelsLoading[r]=(this.numModelsLoading[r]||0)+i.length;const n=[];for(const e of i)n.push(this.loadModel(e,t[e]));Promise.allSettled(n).then((t=>{for(let e=0;e<t.length;e++){const{status:n,value:o}=t[e];"fulfilled"===n&&o&&(this.models[r][i[e]]={model:o,numReferences:1})}this.numModelsLoading[r]-=i.length,this.fire(new e.x("data",{dataType:"style"}))})).catch((t=>{this.fire(new e.t(new Error(`Could not load models: ${t.message}`)))}))}isLoaded(){for(const e in this.numModelsLoading)if(this.numModelsLoading[e]>0)return!1;return!0}hasModel(e,t){return!!this.getModel(e,t)}getModel(e,t){return this.models[t]||(this.models[t]={}),this.models[t][e]?this.models[t][e].model:void 0}addModel(e,t,r){this.models[r]||(this.models[r]={}),this.hasModel(e,r)&&this.models[r][e].numReferences++,this.load({[e]:this.requestManager.normalizeModelURL(t)},r)}addModels(e,t){this.models[t]||(this.models[t]={});const r={};for(const i in e)this.models[t][i]={},r[i]=this.requestManager.normalizeModelURL(e[i]);this.load(r,t)}addModelsFromBucket(e,t){this.models[t]||(this.models[t]={});const r={};for(const i of e)this.hasModel(i,t)?this.models[t][i].numReferences++:r[i]=this.requestManager.normalizeModelURL(i);this.load(r,t)}removeModel(e,t){if(this.models[t]&&this.models[t][e]&&(this.models[t][e].numReferences--,0===this.models[t][e].numReferences)){const r=this.models[t][e].model;delete this.models[t][e],r.destroy()}}listModels(e){return this.models[e]||(this.models[e]={}),Object.keys(this.models[e])}upload(e,t){this.models[t]||(this.models[t]={});for(const r in this.models[t])this.models[t][r].model&&this.models[t][r].model.upload(e.context)}}const ri=new e.a0({data:new e.a1(e._.colorTheme.data)}),ii=(e,t)=>Ce(e,t&&t.filter((e=>"source.canvas"!==e.identifier))),ni=e.ar(St,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection","setCamera","addImport","removeImport","updateImport"]),oi=e.ar(St,["setCenter","setZoom","setBearing","setPitch"]),si={version:8,layers:[],sources:{}},ai={duration:300,delay:0};class li extends e.E{constructor(t,r={}){super(),this.map=t,this.scope=r.scope||"",this.globalId=null,this.fragments=[],this.importDepth=r.importDepth||0,this.importsCache=r.importsCache||new Map,this.resolvedImports=r.resolvedImports||new Set,this.transition=e.l({},ai),this._buildingIndex=new bt(this),this.crossTileSymbolIndex=new Ar,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._mergedLayerSelectors=new Map,this._clipLayerPresent=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=r.styleChanges||new U,this.dispatcher=r.dispatcher?r.dispatcher:new e.ce(e.cf(),this),r.imageManager?this.imageManager=r.imageManager:(this.imageManager=new G,this.imageManager.setEventedParent(this)),this.imageManager.createScope(this.scope),this.glyphManager=r.glyphManager?r.glyphManager:new e.cg(t._requestManager,r.localFontFamily?e.ch.all:r.localIdeographFontFamily?e.ch.ideographs:e.ch.none,r.localFontFamily||r.localIdeographFontFamily),r.modelManager?this.modelManager=r.modelManager:(this.modelManager=new ti(t._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._order=[],this._markersNeedUpdate=!1,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null},this._styleColorThemeForScope={},this.options=r.configOptions?r.configOptions:new Map,this._configDependentLayers=r.configDependentLayers?r.configDependentLayers:new Set,this._config=r.config,this._initialConfig=r.initialConfig,this.dispatcher.broadcast("setReferrer",e.ci());const i=this;this._rtlTextPluginCallback=li.registerForPluginStateChange((t=>{i.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:t.pluginStatus,pluginURL:t.pluginURL},((t,r)=>{if(e.cj(t),r&&r.every((e=>e)))for(const e in i._sourceCaches){const t=i._sourceCaches[e],r=t.getSource().type;"vector"!==r&&"geojson"!==r||t.reload()}}))})),this.on("data",(e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;const t=this.getOwnSource(e.sourceId);if(t&&t.vectorLayerIds)for(const e in this._layers){const r=this._layers[e];r.source===t.id&&this._validateLayer(r)}}))}load(e){return e?("string"==typeof e?this.loadURL(e):this.loadJSON(e),this):this}_getGlobalId(t){if(!t)return null;if("string"==typeof t){if(e.f(t))return t;const r=e.ck(t);if(!r.startsWith("http"))try{return new URL(r,location.href).toString()}catch(e){return r}return r}return`json://${e.cl(JSON.stringify(t))}`}_diffStyle(t,r,i){this.globalId=this._getGlobalId(t);const n=(e,t)=>{try{t(null,this.setState(e,i))}catch(e){t(e,!1)}};if("string"==typeof t){const i=this.map._requestManager.normalizeStyleURL(t),o=this.map._requestManager.transformRequest(i,e.R.Style);e.n(o,((t,i)=>{t?this.fire(new e.t(t)):i&&n(i,r)}))}else"object"==typeof t&&n(t,r)}loadURL(t,r={}){this.fire(new e.x("dataloading",{dataType:"style"}));const i="boolean"==typeof r.validate?r.validate:!e.f(t);this.globalId=this._getGlobalId(t),t=this.map._requestManager.normalizeStyleURL(t,r.accessToken),this.resolvedImports.add(t);const n=this.importsCache.get(t);if(n)return this._load(n,i);const o=this.map._requestManager.transformRequest(t,e.R.Style);this._request=e.n(o,((r,n)=>{if(this._request=null,r)this.fire(new e.t(r));else if(n)return this.importsCache.set(t,n),this._load(n,i)}))}loadJSON(t,r={}){this.fire(new e.x("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(t),this._request=e.q.frame((()=>{this._request=null,this._load(t,!1!==r.validate)}))}loadEmpty(){this.fire(new e.x("dataloading",{dataType:"style"})),this._load(si,!1)}_loadImports(t,r,i){if(this.importDepth>=4)return e.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const n=[];for(const e of t){const t=this._createFragmentStyle(e),o=new Promise((e=>{t.once("style.import.load",e),t.once("error",e)})).then((()=>this.mergeAll()));if(n.push(o),this.resolvedImports.has(e.url)){t.loadEmpty();continue}const s=e.data||this.importsCache.get(e.url);s?(t.loadJSON(s,{validate:r}),this._isInternalStyle(s)&&(t.globalId=null)):e.url?t.loadURL(e.url,{validate:r}):t.loadEmpty();const a={style:t,id:e.id,config:e.config};if(i){const e=this.fragments.findIndex((({id:e})=>e===i));this.fragments=this.fragments.slice(0,e).concat(a).concat(this.fragments.slice(e))}else this.fragments.push(a)}return Promise.allSettled(n)}getImportGlobalIds(e=this,t=new Set){for(const r of e.fragments)r.style.globalId&&t.add(r.style.globalId),this.getImportGlobalIds(r.style,t);return[...t.values()]}_createFragmentStyle(t){const r=this.scope?e.av(t.id,this.scope):t.id;let i;const n=this._initialConfig&&this._initialConfig[r];(t.config||n)&&(i=e.l({},t.config,n));const o=new li(this.map,{scope:r,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:i,configOptions:this.options,configDependentLayers:this._configDependentLayers});return o.setEventedParent(this.map,{style:o}),o}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(e){return this.isRootStyle()&&(e.fragment||!!e.schema&&!1!==e.fragment)}_load(t,r){const i=t.schema;if(this._isInternalStyle(t)){const i=e.l({},si,{imports:[{id:"basemap",data:t,url:""}]});return void this._load(i,r)}if(this.updateConfig(this._config,i),r&&ii(this,_e(t)))return;this._loaded=!0,this.stylesheet=e.cm(t);const n=()=>{for(const e in t.sources)this.addSource(e,t.sources[e],{validate:!1,isInitialLoad:!0});t.sprite?this._loadSprite(t.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),this.glyphManager.setURL(t.glyphs,this.scope);const i=Tt(this.stylesheet.layers);if(this._order=i.map((e=>e.id)),this.stylesheet.light&&e.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(1===this.stylesheet.lights.length&&"flat"===this.stylesheet.lights[0].type){const e=this.stylesheet.lights[0];this.light=new Pe(e.properties,e.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new Pe(this.stylesheet.light)),this._layers={};for(const t of i){const r=e.cq(t,this.scope,this._styleColorTheme.lut,this.options);0!==r.configDependencies.size&&this._configDependentLayers.add(r.fqid),r.setEventedParent(this,{layer:{id:r.id}}),this._layers[r.id]=r;const i=this.getOwnLayerSourceCache(r),n=!!this.directionalLight&&this.directionalLight.shadowsEnabled();i&&r.canCastShadows()&&n&&(i.castsShadows=!0)}this.stylesheet.models&&this.modelManager.addModels(this.stylesheet.models,this.scope);const n=this.stylesheet.terrain;n&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(n,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new e.x("data",{dataType:"style"}));const o=this.isRootStyle();t.imports?this._loadImports(t.imports,r).then((()=>{this._reloadImports(),this.fire(new e.x(o?"style.load":"style.import.load"))})):(this._reloadImports(),this.fire(new e.x(o?"style.load":"style.import.load")))},o=this.stylesheet["color-theme"];if(this._styleColorTheme.colorTheme=o,o){const t=this._evaluateColorThemeData(o);this._loadColorTheme(t).then((()=>{n()})).catch((t=>{e.w(`Couldn't load color theme from the stylesheet: ${t}`),n()}))}else this._styleColorTheme.lut=null,n()}isRootStyle(){return 0===this.importDepth}mergeAll(){let t,r,i,n,o,s,a,l;const c={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle((e=>{if(e.stylesheet){if(null!=e.light&&(t=e.light),e.stylesheet.lights)for(const t of e.stylesheet.lights)"ambient"===t.type&&null!=e.ambientLight&&(r=e.ambientLight),"directional"===t.type&&null!=e.directionalLight&&(i=e.directionalLight);n=this._prioritizeTerrain(n,e.terrain,e.stylesheet.terrain),e.stylesheet.fog&&null!=e.fog&&(o=e.fog),null!=e.stylesheet.camera&&(l=e.stylesheet.camera),null!=e.stylesheet.projection&&(s=e.stylesheet.projection),null!=e.stylesheet.transition&&(a=e.stylesheet.transition),c[e.scope]=e._styleColorTheme}})),this.light=t,this.ambientLight=r,this.directionalLight=i,this.fog=o,this._styleColorThemeForScope=c,null===n?delete this.terrain:this.terrain=n,this.camera=l||{"camera-projection":"perspective"},this.projection=s||{name:"mercator"},this.transition=e.l({},ai,a),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(e){const t=r=>{for(const e of r.fragments)t(e.style);e(r)};t(this)}_prioritizeTerrain(e,t,r){const i=e&&0===e.drapeRenderMode;return null===r?t&&0===t.drapeRenderMode?t:i?e:null:null!=t&&(!e||i||t&&1===t.drapeRenderMode)?t:e}mergeTerrain(){let e;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle((t=>{e=this._prioritizeTerrain(e,t.terrain,t.stylesheet.terrain)})),null===e?delete this.terrain:this.terrain=e}mergeProjection(){let e;this.forEachFragmentStyle((t=>{null!=t.stylesheet.projection&&(e=t.stylesheet.projection)})),this.projection=e||{name:"mercator"}}mergeSources(){const t={},r={},i={};this.forEachFragmentStyle((n=>{for(const r in n._sourceCaches){const i=e.av(r,n.scope);t[i]=n._sourceCaches[r]}for(const t in n._otherSourceCaches){const i=e.av(t,n.scope);r[i]=n._otherSourceCaches[t]}for(const t in n._symbolSourceCaches){const r=e.av(t,n.scope);i[r]=n._symbolSourceCaches[t]}})),this._mergedSourceCaches=t,this._mergedOtherSourceCaches=r,this._mergedSymbolSourceCaches=i}mergeLayers(){const t={},r=[],i={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._mergedLayerSelectors.clear(),this.forEachFragmentStyle((i=>{for(const n of i._order){const o=i._layers[n];if("slot"===o.type){const r=e.cn(n);if(t[r])continue;t[r]=[]}o.slot&&t[o.slot]?t[o.slot].push(o):r.push(o)}const{featuresets:n}=i.stylesheet||{};if(n)for(const t in n){const{selectors:r}=n[t];for(const n of r){const r=i._layers[n.layer],o=this._mergedLayerSelectors.get(r.fqid)||[];let s;if(n.properties)for(const t in n.properties){const r=e.M(n.properties[t]);"success"===r.result&&(s=s||{},s[t]=r.value)}o.push({featuresetId:t,featureNamespace:n.featureNamespace,properties:s}),this._mergedLayerSelectors.set(r.fqid,o)}}})),this._mergedOrder=[];const n=(r=[])=>{for(const o of r)if("slot"===o.type){const r=e.cn(o.id);t[r]&&n(t[r]),this._mergedSlots.push(r)}else{const t=e.av(o.id,o.scope);this._mergedOrder.push(t),i[t]=o,o.is3D()&&(this._has3DLayers=!0),"circle"===o.type&&(this._hasCircleLayers=!0),"symbol"===o.type&&(this._hasSymbolLayers=!0),"clip"===o.type&&(this._clipLayerPresent=!0)}};n(r),this._mergedOrder.sort(((e,t)=>{const r=i[e],n=i[t];return r.hasInitialOcclusionOpacityProperties?n.is3D()?1:0:r.is3D()&&n.hasInitialOcclusionOpacityProperties?-1:0})),this._mergedLayers=i,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&0===this.terrain.drapeRenderMode}getCamera(){return this.stylesheet.camera}setCamera(t){return this.stylesheet.camera=e.l({},this.stylesheet.camera,t),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(t){return t.data?function(t,r,i){const n=e.l({},r);for(const t of Object.keys(e._.colorTheme))void 0===n[t]&&(n[t]=e._.colorTheme[t].default);const o=new e.$(ri,t,new Map(i));return o.setTransitionOrValue(n,i),o.untransitioned().possiblyEvaluate(new e.a3(0))}(this.scope,t,this.options).get("data"):null}_loadColorTheme(t){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const r=this._styleColorTheme.lutLoadingCorrelationID;return new Promise(((i,n)=>{const o="data:image/png;base64,";if(!t||0===t.length)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void i();let s=t;s.startsWith(o)||(s=o+s);const a="mapbox-reserved-lut",l=new Image;l.src=s,l.onerror=()=>{this._styleColorTheme.lutLoading=!1,n(new Error("Failed to load image data"))},l.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==r)return void i();this._styleColorTheme.lutLoading=!1;const{width:o,height:s,data:c}=e.q.getImageData(l);if(s>32)return void n(new Error("The height of the image must be less than or equal to 32 pixels."));if(o!==s*s)return void n(new Error("The width of the image must be equal to the height squared."));this.getImage(a)&&this.removeImage(a),this.addImage(a,{data:new e.r({width:o,height:s},c),pixelRatio:1,sdf:!1,version:0});const u=this.imageManager.getImage(a,this.scope);u?(this._styleColorTheme.lut={image:u.data,data:t},i()):n(new Error("Missing LUT image."))}}))}getLut(e){const t=this._styleColorThemeForScope[e];return t?t.lut:null}setProjection(e){e?this.stylesheet.projection=e:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(t){this._spriteRequest=function(t,r,i){let n,o,s;const a=e.q.devicePixelRatio>1?"@2x":"";let l=e.n(r.transformRequest(r.normalizeSpriteURL(t,a,".json"),e.R.SpriteJSON),((e,t)=>{l=null,s||(s=e,n=t,u())})),c=e.o(r.transformRequest(r.normalizeSpriteURL(t,a,".png"),e.R.SpriteImage),((e,t)=>{c=null,s||(s=e,o=t,u())}));function u(){if(s)i(s);else if(n&&o){const t=e.q.getImageData(o),r={};for(const i in n){const{width:o,height:s,x:a,y:l,sdf:c,pixelRatio:u,stretchX:h,stretchY:d,content:p}=n[i],f=new e.r({width:o,height:s});e.r.copy(t,f,{x:a,y:l},{x:0,y:0},{width:o,height:s},null),r[i]={data:f,pixelRatio:u,sdf:c,stretchX:h,stretchY:d,content:p}}i(null,r)}}return{cancel(){l&&(l.cancel(),l=null),c&&(c.cancel(),c=null)}}}(t,this.map._requestManager,((t,r)=>{if(this._spriteRequest=null,t)this.fire(new e.t(t));else if(r)for(const e in r)this.imageManager.addImage(e,this.scope,r[e]);this.imageManager.setLoaded(!0,this.scope),this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new e.x("data",{dataType:"style"}))}))}_validateLayer(t){const r=this.getOwnSource(t.source);if(!r)return;const i=t.sourceLayer;i&&("geojson"===r.type||r.vectorLayerIds&&-1===r.vectorLayerIds.indexOf(i))&&this.fire(new e.t(new Error(`Source layer "${i}" does not exist on source "${r.id}" as specified by style layer "${t.id}"`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const e in this._sourceCaches)if(!this._sourceCaches[e].loaded())return!1;if(!this.imageManager.isLoaded())return!1;if(!this.modelManager.isLoaded())return!1;if(this._styleColorTheme.lutLoading)return!1;for(const{style:e}of this.fragments)if(!e.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map(((e,t)=>{const r=this.fragments[t];return r&&r.style&&(e.data=r.style.serialize()),e}))}_serializeSources(){const e={};for(const t in this._sourceCaches){const r=this._sourceCaches[t].getSource();e[r.id]||(e[r.id]=r.serialize())}return e}_serializeLayers(e){const t=[];for(const r of e){const e=this._layers[r];e&&"custom"!==e.type&&t.push(e.serialize())}return t}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasTransitions(){if(this.hasLightTransitions())return!0;if(this.hasFogTransition())return!0;for(const e in this._sourceCaches)if(this._sourceCaches[e].hasTransition())return!0;for(const e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(e){return e?this.order:this._mergedOrder}isLayerDraped(e){return!!this.terrain&&e.isDraped(this.getLayerSourceCache(e))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(t){const r=this.getOwnLayer(t);if(r)return r;this.fire(new e.t(new Error(`The layer '${t}' does not exist in the map's style.`)))}_checkSource(t){const r=this.getOwnSource(t);if(r)return r;this.fire(new e.t(new Error(`The source '${t}' does not exist in the map's style.`)))}precompilePrograms(e,t){const r=this.map.painter;if(r)for(let i=e.minzoom||0;i<(e.maxzoom||25.5);i++){const i=e.getProgramIds();if(i)for(const n of i){const i=e.getDefaultProgramParams(n,t.zoom,this._styleColorTheme.lut);i&&(r.style=this,this.fog&&(r._fogVisible=!0,i.overrideFog=!0,r.getOrCreateProgram(n,i)),r._fogVisible=!1,i.overrideFog=!1,r.getOrCreateProgram(n,i),(this.stylesheet.terrain||this.stylesheet.projection&&"globe"===this.stylesheet.projection.name)&&(i.overrideRtt=!0,r.getOrCreateProgram(n,i)))}}}update(t){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(t),this.directionalLight&&this.directionalLight.recalculate(t);const r=this.calculateLightsBrightness();t.brightness=r||0,r!==this._brightness&&(this._brightness=r,this.dispatcher.broadcast("setBrightness",r));const i=this._changes.isDirty();let n=!1;if(this._changes.isDirty()){const e=this._changes.getLayerUpdatesByScope();for(const t in e){const{updatedIds:r,removedIds:i}=e[t];(r||i)&&(this._updateWorkerLayers(t,r,i),n=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(t),this.light&&this.light.updateTransitions(t),this.ambientLight&&this.ambientLight.updateTransitions(t),this.directionalLight&&this.directionalLight.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this._changes.reset()}const o={};for(const e in this._mergedSourceCaches){const t=this._mergedSourceCaches[e];o[e]=t.used,t.used=!1,t.tileCoverLift=0}for(const e of this._mergedOrder){const r=this._mergedLayers[e];if(r.recalculate(t,this._availableImages),!r.isHidden(t.zoom)){const e=this.getLayerSourceCache(r);e&&(e.used=!0,e.tileCoverLift=Math.max(e.tileCoverLift,r.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback((()=>{this.precompilePrograms(r,t)})):this.precompilePrograms(r,t))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&n&&this.mergeLayers();for(const t in o){const r=this._mergedSourceCaches[t];o[t]!==r.used&&r.getSource().fire(new e.x("data",{sourceDataType:"visibility",dataType:"source",sourceId:r.getSource().id}))}this.light&&this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),i&&this.fire(new e.x("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=this._changes.getUpdatedImages();if(e.length){for(const t in this._sourceCaches)this._sourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e);this._changes.resetUpdatedImages()}}_updateWorkerLayers(e,t,r){const i=this.getFragmentStyle(e);i&&this.dispatcher.broadcast("updateLayers",{layers:t?i._serializeLayers(t):[],scope:e,removedIds:r||[],options:i.options})}setState(t,r){if(this._checkLoaded(),ii(this,_e(t)))return!1;(t=e.cm(t)).layers=Tt(t.layers);const i=function(t,r){if(!t)return[{command:St.setStyle,args:[r]}];let i=[];try{if(!e.bi(t.version,r.version))return[{command:St.setStyle,args:[r]}];if(e.bi(t.center,r.center)||i.push({command:St.setCenter,args:[r.center]}),e.bi(t.zoom,r.zoom)||i.push({command:St.setZoom,args:[r.zoom]}),e.bi(t.bearing,r.bearing)||i.push({command:St.setBearing,args:[r.bearing]}),e.bi(t.pitch,r.pitch)||i.push({command:St.setPitch,args:[r.pitch]}),e.bi(t.sprite,r.sprite)||i.push({command:St.setSprite,args:[r.sprite]}),e.bi(t.glyphs,r.glyphs)||i.push({command:St.setGlyphs,args:[r.glyphs]}),e.bi(t.imports,r.imports)||function(t=[],r=[],i){r=r||[];const n=(t=t||[]).map(Pt),o=r.map(Pt),s=t.reduce(Rt,{}),a=r.reduce(Rt,{}),l=n.slice();let c,u,h,d;for(c=0,u=0;c<n.length;c++)h=n[c],a.hasOwnProperty(h)?u++:(i.push({command:St.removeImport,args:[h]}),l.splice(l.indexOf(h,u),1));for(c=0,u=0;c<o.length;c++)h=o[o.length-1-c],l[l.length-1-c]!==h&&(s.hasOwnProperty(h)?(i.push({command:St.removeImport,args:[h]}),l.splice(l.lastIndexOf(h,l.length-u),1)):u++,d=l[l.length-c],i.push({command:St.addImport,args:[a[h],d]}),l.splice(l.length-c,0,h));for(const t of r){const r=s[t.id];r&&!e.bi(r,t)&&i.push({command:St.updateImport,args:[t.id,t]})}}(t.imports,r.imports,i),e.bi(t.transition,r.transition)||i.push({command:St.setTransition,args:[r.transition]}),e.bi(t.light,r.light)||i.push({command:St.setLight,args:[r.light]}),e.bi(t.fog,r.fog)||i.push({command:St.setFog,args:[r.fog]}),e.bi(t.projection,r.projection)||i.push({command:St.setProjection,args:[r.projection]}),e.bi(t.lights,r.lights)||i.push({command:St.setLights,args:[r.lights]}),e.bi(t.camera,r.camera)||i.push({command:St.setCamera,args:[r.camera]}),!e.bi(t["color-theme"],r["color-theme"]))return[{command:St.setStyle,args:[r]}];const n={},o=[];!function(t,r,i,n){let o;for(o in r=r||{},t=t||{})t.hasOwnProperty(o)&&(r.hasOwnProperty(o)||Mt(o,i,n));for(o in r){if(!r.hasOwnProperty(o))continue;const s=r[o];t.hasOwnProperty(o)?e.bi(t[o],s)||("geojson"===t[o].type&&"geojson"===s.type&&Ct(t,r,o)?i.push({command:St.setGeoJSONSourceData,args:[o,s.data]}):At(o,r,i,n)):Et(o,r,i)}}(t.sources,r.sources,o,n);const s=[];t.layers&&t.layers.forEach((e=>{e.source&&n[e.source]?i.push({command:St.removeLayer,args:[e.id]}):s.push(e)}));let a=t.terrain;a&&n[a.source]&&(i.push({command:St.setTerrain,args:[void 0]}),a=void 0),i=i.concat(o),e.bi(a,r.terrain)||i.push({command:St.setTerrain,args:[r.terrain]}),function(t,r,i){r=r||[];const n=(t=t||[]).map(Pt),o=r.map(Pt),s=t.reduce(Rt,{}),a=r.reduce(Rt,{}),l=n.slice(),c=Object.create(null);let u,h,d,p,f,m,_;for(u=0,h=0;u<n.length;u++)d=n[u],a.hasOwnProperty(d)?h++:(i.push({command:St.removeLayer,args:[d]}),l.splice(l.indexOf(d,h),1));for(u=0,h=0;u<o.length;u++)d=o[o.length-1-u],l[l.length-1-u]!==d&&(s.hasOwnProperty(d)?(i.push({command:St.removeLayer,args:[d]}),l.splice(l.lastIndexOf(d,l.length-h),1)):h++,m=l[l.length-u],i.push({command:St.addLayer,args:[a[d],m]}),l.splice(l.length-u,0,d),c[d]=!0);for(u=0;u<o.length;u++)if(d=o[u],p=s[d],f=a[d],!c[d]&&!e.bi(p,f))if(e.bi(p.source,f.source)&&e.bi(p["source-layer"],f["source-layer"])&&e.bi(p.type,f.type)){for(_ in It(p.layout,f.layout,i,d,null,St.setLayoutProperty),It(p.paint,f.paint,i,d,null,St.setPaintProperty),e.bi(p.slot,f.slot)||i.push({command:St.setSlot,args:[d,f.slot]}),e.bi(p.filter,f.filter)||i.push({command:St.setFilter,args:[d,f.filter]}),e.bi(p.minzoom,f.minzoom)&&e.bi(p.maxzoom,f.maxzoom)||i.push({command:St.setLayerZoomRange,args:[d,f.minzoom,f.maxzoom]}),p)p.hasOwnProperty(_)&&"layout"!==_&&"paint"!==_&&"filter"!==_&&"metadata"!==_&&"minzoom"!==_&&"maxzoom"!==_&&"slot"!==_&&(0===_.indexOf("paint.")?It(p[_],f[_],i,d,_.slice(6),St.setPaintProperty):e.bi(p[_],f[_])||i.push({command:St.setLayerProperty,args:[d,_,f[_]]}));for(_ in f)f.hasOwnProperty(_)&&!p.hasOwnProperty(_)&&"layout"!==_&&"paint"!==_&&"filter"!==_&&"metadata"!==_&&"minzoom"!==_&&"maxzoom"!==_&&"slot"!==_&&(0===_.indexOf("paint.")?It(p[_],f[_],i,d,_.slice(6),St.setPaintProperty):e.bi(p[_],f[_])||i.push({command:St.setLayerProperty,args:[d,_,f[_]]}))}else i.push({command:St.removeLayer,args:[d]}),m=l[l.lastIndexOf(d)+1],i.push({command:St.addLayer,args:[f,m]})}(s,r.layers,i)}catch(e){console.warn("Unable to compute style diff:",e),i=[{command:St.setStyle,args:[r]}]}return i}(this.serialize(),t).filter((e=>!(e.command in oi)));if(0===i.length)return!1;const n=i.filter((e=>!(e.command in ni)));if(n.length>0)throw new Error(`Unimplemented: ${n.map((e=>e.command)).join(", ")}.`);const o=[];return i.forEach((e=>{o.push(this[e.command].apply(this,e.args))})),r&&Promise.all(o).then(r),this.stylesheet=t,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}addImage(t,r){return this.getImage(t)?this.fire(new e.t(new Error("An image with this name already exists."))):(this.imageManager.addImage(t,this.scope,r),this._afterImageUpdated(t),this)}updateImage(e,t){this.imageManager.updateImage(e,this.scope,t)}getImage(e){return this.imageManager.getImage(e,this.scope)}removeImage(t){return this.getImage(t)?(this.imageManager.removeImage(t,this.scope),this._afterImageUpdated(t),this):this.fire(new e.t(new Error("No image with this name exists.")))}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(this.scope),this._changes.updateImage(t),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.fire(new e.x("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModel(e,t,r={}){return this._checkLoaded(),this._validate(Me,`models.${e}`,t,null,r)||(this.modelManager.addModel(e,t,this.scope),this._changes.setDirty()),this}hasModel(e){return this.modelManager.hasModel(e,this.scope)}removeModel(t){return this.hasModel(t)?(this.modelManager.removeModel(t,this.scope),this):this.fire(new e.t(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(t,r,i={}){if(this._checkLoaded(),void 0!==this.getOwnSource(t))throw new Error(`There is already a source with ID "${t}".`);if(!r.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(r).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(ge,`sources.${t}`,r,null,i))return;this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);const n=Qe(t,r,this.dispatcher,this);n.scope=this.scope,n.setEventedParent(this,(()=>({isSourceLoaded:this._isSourceCacheLoaded(n.id),source:n.serialize(),sourceId:n.id})));const o=t=>{const r=(t?"symbol:":"other:")+n.id,i=e.av(r,this.scope),o=this._sourceCaches[r]=new gt(i,n,t);(t?this._symbolSourceCaches:this._otherSourceCaches)[n.id]=o,o.onAdd(this.map)};o(!1),"vector"!==r.type&&"geojson"!==r.type||o(!0),n.onAdd&&n.onAdd(this.map),i.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(t){this._checkLoaded();const r=this.getOwnSource(t);if(!r)throw new Error("There is no source with this ID");for(const r in this._layers)if(this._layers[r].source===t)return this.fire(new e.t(new Error(`Source "${t}" cannot be removed while layer "${r}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===t)return this.fire(new e.t(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));const i=this.getOwnSourceCaches(t);for(const t of i){const r=e.cn(t.id);delete this._sourceCaches[r],this._changes.discardSourceCacheUpdate(t.id),t.fire(new e.x("data",{sourceDataType:"metadata",dataType:"source",sourceId:t.getSource().id})),t.setEventedParent(null),t.clearTiles()}return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],this.mergeSources(),r.setEventedParent(null),r.onRemove&&r.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(e,t){this._checkLoaded(),this.getOwnSource(e).setData(t),this._changes.setDirty()}getOwnSource(e){const t=this.getOwnSourceCache(e);return t&&t.getSource()}getOwnSources(){const e=[];for(const t in this._otherSourceCaches){const r=this.getOwnSourceCache(t);r&&e.push(r.getSource())}return e}areTilesLoaded(){const e=this._mergedSourceCaches;for(const t in e){const r=e[t]._tiles;for(const e in r){const t=r[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}}return!0}setLights(t){if(this._checkLoaded(),!t)return delete this.ambientLight,void delete this.directionalLight;const r=this._getTransitionParameters();for(const i of t){if(this._validate(xe,"lights",i))return;switch(i.type){case"ambient":if(this.ambientLight){const e=this.ambientLight;e.set(i),e.updateTransitions(r)}else this.ambientLight=new Ve(i,je||(je=new e.a0({color:new e.a1(e._.properties_light_ambient.color),intensity:new e.a1(e._.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const e=this.directionalLight;e.set(i),e.updateTransitions(r)}else this.directionalLight=new Ve(i,Ue||(Ue=new e.a0({direction:new e.ad(e._.properties_light_directional.direction),color:new e.a1(e._.properties_light_directional.color),intensity:new e.a1(e._.properties_light_directional.intensity),"cast-shadows":new e.a1(e._.properties_light_directional["cast-shadows"]),"shadow-intensity":new e.a1(e._.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const i=new e.a3(this.z||0,r);this.ambientLight&&this.ambientLight.recalculate(i),this.directionalLight&&this.directionalLight.recalculate(i),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const t=this.directionalLight,r=this.ambientLight;if(!t||!r)return;const i=e=>.2126*(e[0]<=.03928?e[0]/12.92:Math.pow((e[0]+.055)/1.055,2.4))+.7152*(e[1]<=.03928?e[1]/12.92:Math.pow((e[1]+.055)/1.055,2.4))+.0722*(e[2]<=.03928?e[2]/12.92:Math.pow((e[2]+.055)/1.055,2.4)),n=t.properties.get("color").toRenderColor(null).toArray01(),o=t.properties.get("intensity"),s=t.properties.get("direction"),a=1-e.c8(s.x,s.y,s.z)[2]/90,l=i(n)*o*a,c=r.properties.get("color").toRenderColor(null).toArray01(),u=r.properties.get("intensity"),h=i(c)*u;return Number(((l+h)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const e=[];return this.directionalLight&&e.push(this.directionalLight.get()),this.ambientLight&&e.push(this.ambientLight.get()),e}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(t){if(!t)return this;if(e.aK(t)){const r=e.co(t),i=this.fragments.find((({id:e})=>e===r));if(!i)throw new Error(`Style import '${t}' not found`);const n=e.cn(t);return i.style.getFragmentStyle(n)}{const e=this.fragments.find((({id:e})=>e===t));if(!e)throw new Error(`Style import '${t}' not found`);return e.style}}getFeaturesetDescriptors(e){const t=this.getFragmentStyle(e);if(!t||!t.stylesheet.featuresets)return[];const r=[];for(const e in t.stylesheet.featuresets)r.push({featuresetId:e,importId:t.scope?t.scope:void 0});return r}getFeaturesetLayers(t,r){const i=this.getFragmentStyle(r),n=i.stylesheet.featuresets;if(!n||!n[t])return this.fire(new e.t(new Error(`The featureset '${t}' does not exist in the map's style and cannot be queried.`))),[];const o=[];for(const e of n[t].selectors){const t=i.getOwnLayer(e.layer);t&&o.push(t)}return o}getConfigProperty(t,r){const i=this.getFragmentStyle(t);if(!i)return null;const n=e.av(r,i.scope),o=i.options.get(n),s=o?o.value||o.default:null;return s?s.serialize():null}setConfigProperty(t,r,i){const n=this.getFragmentStyle(t);if(!n)return;const o=n.stylesheet.schema;if(!o||!o[r])return;const s=e.M(i);if("success"!==s.result)return void ii(this,s.value);const a=s.value.expression,l=e.av(r,n.scope),c=n.options.get(l);if(!c)return;let u;const{minValue:h,maxValue:d,stepValue:p,type:f,values:m}=o[r],_=e.M(o[r].default);"success"===_.result&&(u=_.value.expression),u?(this.options.set(l,{...c,value:a,default:u,minValue:h,maxValue:d,stepValue:p,type:f,values:m}),this.updateConfigDependencies(r)):this.fire(new e.t(new Error(`No schema defined for the config option "${r}" in the "${t}" fragment.`)))}getConfig(t){const r=this.getFragmentStyle(t);if(!r)return null;const i=r.stylesheet.schema;if(!i)return null;const n={};for(const t in i){const i=e.av(t,r.scope),o=r.options.get(i),s=o?o.value||o.default:null;n[t]=s?s.serialize():null}return n}setConfig(e,t){const r=this.getFragmentStyle(e);r&&(r.updateConfig(t,r.stylesheet.schema),this.updateConfigDependencies())}getSchema(e){const t=this.getFragmentStyle(e);return t?t.stylesheet.schema:null}setSchema(e,t){const r=this.getFragmentStyle(e);r&&(r.stylesheet.schema=t,r.updateConfig(r._config,t),this.updateConfigDependencies())}updateConfig(t,r){if(this._config=t,t||r)if(r)for(const i in r){let n,o;const s=e.M(r[i].default);if("success"===s.result&&(n=s.value.expression),t&&void 0!==t[i]){const r=e.M(t[i]);"success"===r.result&&(o=r.value.expression)}const{minValue:a,maxValue:l,stepValue:c,type:u,values:h}=r[i];if(n){const t=e.av(i,this.scope);this.options.set(t,{default:n,value:o,minValue:a,maxValue:l,stepValue:c,type:u,values:h})}else this.fire(new e.t(new Error(`No schema defined for config option "${i}".`)))}else this.fire(new e.t(new Error("Attempting to set config for a style without schema.")))}updateConfigDependencies(e){for(const t of this._configDependentLayers){const r=this.getLayer(t);if(r){if(e&&!r.configDependencies.has(e))continue;r.possiblyEvaluateVisibility(),this._updateLayer(r)}}this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.forEachFragmentStyle((e=>{if(e._styleColorTheme.colorTheme){const t=e._evaluateColorThemeData(e._styleColorTheme.colorTheme);(!e._styleColorTheme.lut&&""!==t||e._styleColorTheme.lut&&t!==e._styleColorTheme.lut.data)&&e.setColorTheme(e._styleColorTheme.colorTheme)}})),this._changes.setDirty()}addLayer(t,r,i={}){this._checkLoaded();const n=t.id;if(this._layers[n])return void this.fire(new e.t(new Error(`Layer with id "${n}" already exists on this map`)));let o;if("custom"===t.type){if(ii(this,e.cp(t)))return;o=e.cq(t,this.scope,this._styleColorTheme.lut,this.options)}else{if("object"==typeof t.source&&(this.addSource(n,t.source),t=e.cm(t),t=e.l(t,{source:n})),this._validate(we,`layers.${n}`,t,{arrayIndex:-1},i))return;o=e.cq(t,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(o),o.setEventedParent(this,{layer:{id:n}})}0!==o.configDependencies.size&&this._configDependentLayers.add(o.fqid);let s=this._order.length;if(r){const t=this._order.indexOf(r);if(-1===t)return void this.fire(new e.t(new Error(`Layer with id "${r}" does not exist on this map.`)));o.slot===this._layers[r].slot?s=t:e.w(`Layer with id "${r}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(s,0,n),this._layerOrderChanged=!0,this._layers[n]=o;const a=this.getOwnLayerSourceCache(o),l=!!this.directionalLight&&this.directionalLight.shadowsEnabled();a&&o.canCastShadows()&&l&&(a.castsShadows=!0);const c=this._changes.getRemovedLayer(o);if(c&&o.source&&a&&"custom"!==o.type){this._changes.discardLayerRemoval(o);const t=e.av(o.source,o.scope);c.type!==o.type?this._changes.updateSourceCache(t,"clear"):(this._changes.updateSourceCache(t,"reload"),a.pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map),o.scope=this.scope,this.mergeLayers()}moveLayer(t,r){this._checkLoaded();const i=this._checkLayer(t);if(!i)return;if(t===r)return;const n=this._order.indexOf(t);this._order.splice(n,1);let o=this._order.length;if(r){const t=this._order.indexOf(r);if(-1===t)return void this.fire(new e.t(new Error(`Layer with id "${r}" does not exist on this map.`)));i.slot===this._layers[r].slot?o=t:e.w(`Layer with id "${r}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(o,0,t),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(e){this._checkLoaded();const t=this._checkLayer(e);if(!t)return;t.setEventedParent(null);const r=this._order.indexOf(e);this._order.splice(r,1),delete this._layers[e],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(t.fqid),this._changes.removeLayer(t);const i=this.getOwnLayerSourceCache(t);if(i&&i.castsShadows){let e=!1;for(const r in this._layers)if(this._layers[r].source===t.source&&this._layers[r].canCastShadows()){e=!0;break}i.castsShadows=e}t.onRemove&&t.onRemove(this.map),this.mergeLayers()}getOwnLayer(e){return this._layers[e]}hasLayer(e){return e in this._mergedLayers}hasLayerType(e){for(const t in this._layers)if(this._layers[t].type===e)return!0;return!1}setLayerZoomRange(e,t,r){this._checkLoaded();const i=this._checkLayer(e);i&&(i.minzoom===t&&i.maxzoom===r||(null!=t&&(i.minzoom=t),null!=r&&(i.maxzoom=r),this._updateLayer(i)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(e,t){this._checkLoaded();const r=this._checkLayer(e);r&&r.slot!==t&&(r.slot=t,this._updateLayer(r))}setFilter(t,r,i={}){this._checkLoaded();const n=this._checkLayer(t);if(n&&!e.bi(n.filter,r))return null==r?(n.filter=void 0,void this._updateLayer(n)):void(this._validate(Te,`layers.${n.id}.filter`,r,{layerType:n.type},i)||(n.filter=e.cm(r),this._updateLayer(n)))}getFilter(t){const r=this._checkLayer(t);if(r)return e.cm(r.filter)}setLayoutProperty(t,r,i,n={}){this._checkLoaded();const o=this._checkLayer(t);if(o&&!e.bi(o.getLayoutProperty(r),i)){if(null!=i&&(!n||!1!==n.validate)&&ii(o,Ee.call(_e,{key:`layers.${t}.layout.${r}`,layerType:o.type,objectKey:r,value:i,styleSpec:e._,style:{glyphs:!0,sprite:!0}})))return;o.setLayoutProperty(r,i),0!==o.configDependencies.size&&this._configDependentLayers.add(o.fqid),this._updateLayer(o)}}getLayoutProperty(e,t){const r=this._checkLayer(e);if(r)return r.getLayoutProperty(t)}setPaintProperty(t,r,i,n={}){this._checkLoaded();const o=this._checkLayer(t);if(!o)return;if(e.bi(o.getPaintProperty(r),i))return;if(null!=i&&(!n||!1!==n.validate)&&ii(o,Se.call(_e,{key:`layers.${t}.paint.${r}`,layerType:o.type,objectKey:r,value:i,styleSpec:e._})))return;const s=o.setPaintProperty(r,i);0!==o.configDependencies.size&&this._configDependentLayers.add(o.fqid),s&&this._updateLayer(o),this._changes.updatePaintProperties(o)}getPaintProperty(e,t){const r=this._checkLayer(e);if(r)return r.getPaintProperty(t)}setFeatureState(t,r){this._checkLoaded();const i=t.featureset;if(i){if("featuresetId"in i){const e=this.getFragmentStyle(i.importId),n=e.getFeaturesetLayers(i.featuresetId);for(const{source:i,sourceLayer:o}of n)e.setFeatureState({id:t.id,source:i,sourceLayer:o},r)}else if("layerId"in i){const e=this.getLayer(i.layerId);this.setFeatureState({id:t.id,source:e.source,sourceLayer:e.sourceLayer},r)}return}const n=t.source,o=t.sourceLayer,s=this._checkSource(n);if(!s)return;const a=s.type;if("geojson"===a&&o)return void this.fire(new e.t(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===a&&!o)return void this.fire(new e.t(new Error("The sourceLayer parameter must be provided for vector source types.")));void 0===t.id&&this.fire(new e.t(new Error("The feature id parameter must be provided.")));const l=this.getOwnSourceCaches(n);for(const e of l)e.setFeatureState(o,t.id,r)}removeFeatureState(t,r){this._checkLoaded();const i=t.featureset;if(i){if("featuresetId"in i){const e=this.getFragmentStyle(i.importId),n=e.getFeaturesetLayers(i.featuresetId);for(const{source:i,sourceLayer:o}of n)e.removeFeatureState({id:t.id,source:i,sourceLayer:o},r)}else if("layerId"in i){const e=this.getLayer(i.layerId);this.removeFeatureState({id:t.id,source:e.source,sourceLayer:e.sourceLayer},r)}return}const n=t.source,o=this._checkSource(n);if(!o)return;const s=o.type,a="vector"===s?t.sourceLayer:void 0;if("vector"===s&&!a)return void this.fire(new e.t(new Error("The sourceLayer parameter must be provided for vector source types.")));if(r&&"string"!=typeof t.id&&"number"!=typeof t.id)return void this.fire(new e.t(new Error("A feature id is required to remove its specific state property.")));const l=this.getOwnSourceCaches(n);for(const e of l)e.removeFeatureState(a,t.id,r)}getFeatureState(t){this._checkLoaded();const r=t.featureset;if(r){let i;if("featuresetId"in r){const n=this.getFragmentStyle(r.importId),o=n.getFeaturesetLayers(r.featuresetId);for(const{source:r,sourceLayer:s}of o){const o=n.getFeatureState({id:t.id,source:r,sourceLayer:s});if(o&&!i)i=o;else if(!e.bi(i,o))return void this.fire(new e.t(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in t){const e=this.getLayer(r.layerId);i=this.getFeatureState({id:t.id,source:e.source,sourceLayer:e.sourceLayer})}return i}const i=t.source,n=t.sourceLayer,o=this._checkSource(i);if(o){if("vector"!==o.type||n)return void 0===t.id&&this.fire(new e.t(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(i)[0].getFeatureState(n,t.id);this.fire(new e.t(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(t){return this.stylesheet.transition=e.l({},this.stylesheet.transition,t),this.transition=this.stylesheet.transition,this}getTransition(){return e.l({},this.stylesheet.transition)}serialize(){this._checkLoaded();const t=this.getTerrain(),r=t&&this.terrain&&this.terrain.scope===this.scope?t:this.stylesheet.terrain;return e.cr({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:r,fog:this.stylesheet.fog,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},(e=>void 0!==e))}_updateFilteredLayers(e){for(const t of Object.values(this._mergedLayers))e(t)&&this._updateLayer(t)}_updateLayer(t){this._changes.updateLayer(t);const r=this.getLayerSourceCache(t),i=e.av(t.source,t.scope),n=this._changes.getUpdatedSourceCaches();t.source&&!n[i]&&r&&"raster"!==r.getSource().type&&(this._changes.updateSourceCache(i,"reload"),r.pause()),t.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(e){const t=e=>this._mergedLayers[e].is3D(),r=this.order,i={},n=[];for(let o=r.length-1;o>=0;o--){const s=r[o];if(t(s)){i[s]=o;for(const t of e){const e=t[s];if(e)for(const t of e)n.push(t)}}}n.sort(((e,t)=>t.intersectionZ-e.intersectionZ));const o=[];for(let s=r.length-1;s>=0;s--){const a=r[s];if(t(a))for(let e=n.length-1;e>=0;e--){const t=n[e].feature;if(t.layer&&i[t.layer.id]<s)break;o.push(t),n.pop()}else for(const t of e){const e=t[a];if(e)for(const t of e)o.push(t.feature)}}return o}queryRenderedFeatures(t,r,i){r&&!Array.isArray(r)&&r.filter&&this._validate(Te,"queryRenderedFeatures.filter",r.filter,null,r);let n,o=!1;const s=new Set;if(r&&r.layers){if(!Array.isArray(r.layers))return this.fire(new e.t(new Error("parameters.layers must be an Array."))),[];n=[];for(const t of r.layers){const r=this._mergedLayers[t];if(!r)return this.fire(new e.t(new Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))),[];r.is3D()&&(o=!0),s.add(r.source),n.push(t)}}else o=this.has3DLayers();const a=this._queryRenderedFeatures(t,i,{layerIds:n,filter:r.filter,has3DLayers:o,includedSources:s}),l=this._flattenAndSortRenderedFeatures(a),c=[];for(const t of l)e.co(t.layer.id)===this.scope&&c.push(t);return c}queryRenderedFeaturesForInteractions(t,r,i){let n=[];for(const{featureset:o,filter:s,radius:a}of r){let r=!1;const l=[],c=new Set;if("featuresetId"in o){const e=this.getFeaturesetLayers(o.featuresetId,o.importId);if(0===e.length)continue;for(const t of e)t.is3D()&&(r=!0),c.add(t.source),l.push(t.fqid)}else if("layerId"in o){const t=this._mergedLayers[o.layerId];if(!t)return this.fire(new e.t(new Error(`The layer '${o.layerId}' does not exist in the map's style and cannot be queried for features.`))),[];t.is3D()&&(r=!0),c.add(t.source),l.push(o.layerId)}let u=t;if(a)if(t instanceof e.P||"number"==typeof t[0]){const r=e.P.convert(t);u=[[r.x-a,r.y-a],[r.x+a,r.y+a]]}else{const r=e.P.convert(t[0]),i=e.P.convert(t[1]);u=[[r.x-a,r.y-a],[i.x+a,i.y+a]]}n=n.concat(this._queryRenderedFeatures(u,i,{layerIds:l,filter:s,has3DLayers:r,includedSources:c}))}const o=this._flattenAndSortRenderedFeatures(n),s=(e,t,r)=>{const i=e.clone();if(delete i.layer,i.featureset=t,r&&r.featureNamespace&&(i.namespace=r.featureNamespace),r&&r.properties){const t={},n=this.map.transform.zoom;for(const i of Object.keys(r.properties)){const o=r.properties[i].evaluate({zoom:n},e._vectorTileFeature,e.state,e.tile,this._availableImages);null!=o&&(t[i]=o)}i.properties=t}return i},a=[];for(const t of o){const i=t.layer.id,n=e.cn(i),o=e.co(i);for(const{featureset:e}of r){if("layerId"in e&&e.layerId!==i)continue;if("layerId"in e&&e.layerId===i){const r=s(t,e);a.push(r);continue}if("featuresetId"in e){if(e.importId!==o)continue;if(!this.getFeaturesetLayers(e.featuresetId,e.importId).map((e=>e.id)).includes(n))continue}const r=this._mergedLayerSelectors.get(i)||[];for(const i of r){const r=s(t,e,i);a.push(r)}}}return a}_queryRenderedFeatures(t,r,i){const{layerIds:n,filter:o,has3DLayers:s,includedSources:a}=i,l=[],c=$e.createFromScreenPoints(t,r);for(const e in this._mergedSourceCaches){if(!this._mergedSourceCaches[e].getSource())continue;const t=this._mergedSourceCaches[e].getSource().id;n&&!a.has(t)||l.push(tt(this._mergedSourceCaches[e],this._mergedLayers,c,o,n||[],this._availableImages,r,s,!!this.map._showQueryGeometry))}return this.placement&&l.push(function(t,r,i,n,o,s,a,l){const c={},u=a.queryRenderedSymbols(i),h=[];for(const e of Object.keys(u).map(Number))h.push(l[e]);h.sort(it);for(const e of h){const r=e.featureIndex.lookupSymbolFeatures(u[e.bucketInstanceId],e.bucketIndex,e.sourceLayerIndex,n,o,s,t);for(const t in r){const i=c[t]=c[t]||[],n=r[t];n.sort(((t,r)=>{const i=e.featureSortOrder;if(i){const e=i.indexOf(t.featureIndex);return i.indexOf(r.featureIndex)-e}return r.featureIndex-t.featureIndex}));for(const e of n)i.push(e)}}for(const i in c)c[i].forEach((n=>{const o=n.feature,s=t[i],a=r(s);if(!a)return;const l=a.getFeatureState(o.layer["source-layer"],o.id);o.state=l,e.aK(s.id)||(o.source=o.layer.source,o.layer["source-layer"]&&(o.sourceLayer=o.layer["source-layer"]))}));return c}(this._mergedLayers,this.getLayerSourceCache.bind(this),c.screenGeometry,o,n||[],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData)),l}querySourceFeatures(e,t){const r=t&&t.filter;r&&this._validate(Te,"querySourceFeatures.filter",r,null,t);let i=[];const n=this.getOwnSourceCaches(e);for(const e of n)i=i.concat(rt(e,t));return i}addSourceType(e,t,r){return li.getSourceType(e)?r(new Error(`A source type called "${e}" already exists.`)):(li.setSourceType(e,t),t.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:t.workerSourceURL},r):r(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(t,r,i={}){this._checkLoaded();const n=this.light.getLight();let o=!1;for(const r in t)if(!e.bi(t[r],n[r])){o=!0;break}if(!o)return;const s=this._getTransitionParameters();this.light.setLight(t,r,i),this.light.updateTransitions(s)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){void 0===this.disableElevatedTerrain&&(this.disableElevatedTerrain=e.q.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&e.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(t,r=1){if(this._checkLoaded(),!t)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),0===r&&delete this.terrain,null===t?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let i=t;const n=null==t.source;if(1===r){if(this.disableElevatedTerrain)return;if("object"==typeof i.source){const t="terrain-dem-src";this.addSource(t,i.source),i=e.cm(i),i=e.l(i,{source:t})}const t=e.l({},i),r={};if(this.terrain&&n){t.source=this.terrain.get().source;const e=this.terrain?this.getFragmentStyle(this.terrain.scope):null;e&&(r.style=e.serialize())}if(this._validate(ve,"terrain",t,r))return}if(!this.terrain||this.terrain.scope!==this.scope&&!n||this.terrain&&r!==this.terrain.drapeRenderMode){if(!i)return;this._createTerrain(i,r),this.fire(new e.x("data",{dataType:"style"}))}else{const r=this.terrain,n=r.get();for(const t of Object.keys(e._.terrain))!i.hasOwnProperty(t)&&e._.terrain[t].default&&(i[t]=e._.terrain[t].default);for(const i in t)if(!e.bi(t[i],n[i])){r.set(t,this.options),this.stylesheet.terrain=t;const i=this._getTransitionParameters({duration:0});r.updateTransitions(i),this.fire(new e.x("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(e){const t=this.fog=new Ne(e,this.map.transform,this.scope,this.options);this.stylesheet.fog=t.get();const r=this._getTransitionParameters({duration:0});t.updateTransitions(r)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask((()=>{for(const e of this.map._markers)e._evaluateOpacity()}))}getFog(){return this.fog?this.fog.get():null}setFog(t){if(this._checkLoaded(),!t)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const r=this.fog;if(!e.bi(r.get(),t)){r.set(t,this.options),this.stylesheet.fog=r.get();const e=this._getTransitionParameters({duration:0});r.updateTransitions(e)}}else this._createFog(t);this._markersNeedUpdate=!0}setColorTheme(t){this._checkLoaded();const r=()=>{for(const e in this._layers)this._layers[e].lut=this._styleColorTheme.lut;for(const e in this._sourceCaches)this._sourceCaches[e].clearTiles()};if(this._styleColorTheme.colorTheme=t,!t)return this._styleColorTheme.lut=null,void r();const i=this._evaluateColorThemeData(t);this._loadColorTheme(i).then((()=>{this.fire(new e.x("colorthemeset")),r()})).catch((t=>{e.w(`Couldn't set color theme: ${t}`)}))}_getTransitionParameters(t){return{now:e.q.now(),transition:e.l(this.transition,t)}}updateDrapeFirstLayers(){if(!this.terrain)return;const e=[],t=[];for(const r of this._mergedOrder)this.isLayerDraped(this._mergedLayers[r])?e.push(r):t.push(r);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...e),this._drapedFirstOrder.push(...t)}_createTerrain(e,t){const r=this.terrain=new Re(e,t,this.scope,this.options);1===t&&(this.stylesheet.terrain=e),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const i=this._getTransitionParameters({duration:0});r.updateTransitions(i)}_force3DLayerUpdate(){for(const e in this._layers){const t=this._layers[e];"fill-extrusion"===t.type&&this._updateLayer(t)}}_forceSymbolLayerUpdate(){for(const e in this._layers){const t=this._layers[e];"symbol"===t.type&&this._updateLayer(t)}}_validate(t,r,i,n,o={}){if(o&&!1===o.validate)return!1;const s=e.l({},this.serialize());return ii(this,t.call(_e,e.l({key:r,style:s,value:i,styleSpec:e._},n)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),e.cs.off("pluginStateChange",this._rtlTextPluginCallback);for(const e in this._mergedLayers)this._mergedLayers[e].setEventedParent(null);for(const e in this._mergedSourceCaches)this._mergedSourceCaches[e].clearTiles(),this._mergedSourceCaches[e].setEventedParent(null);this.setEventedParent(null),delete this.fog,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.dispatcher.remove())}clearSource(e){const t=this.getSourceCaches(e);for(const e of t)e.clearTiles()}clearSources(){for(const e in this._mergedSourceCaches)this._mergedSourceCaches[e].clearTiles()}reloadSource(e){const t=this.getSourceCaches(e);for(const e of t)e.resume(),e.reload()}reloadSources(){for(const e of this.getSources())e.reload&&e.reload()}updateSources(e){let t;this.directionalLight&&(t=Kr(this.directionalLight));for(const r in this._mergedSourceCaches)this._mergedSourceCaches[r].update(e,void 0,void 0,t)}_generateCollisionBoxes(){for(const e in this._sourceCaches){const t=this._sourceCaches[e];t.resume(),t.reload()}}_updatePlacement(t,r,i,n,o,s,a=!1){let l=!1,c=!1;const u={},h={};for(const t of this._mergedOrder){const i=this._mergedLayers[t];if("symbol"!==i.type)continue;const n=e.av(i.source,i.scope);let o=u[n];if(!o){const e=this.getLayerSourceCache(i);if(!e)continue;const t=e.getRenderableIds(!0).map((t=>e.getTileByID(t)));h[n]=t.slice(),o=u[n]=t.sort(((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1)))}const s=this.crossTileSymbolIndex.addLayer(i,o,r.center.lng,r.projection);l=l||s}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),a=a||this._layerOrderChanged||0===n,this._layerOrderChanged&&this.fire(new e.x("neworder")),(a||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(e.q.now(),r.zoom))&&(this.pauseablePlacement=new wr(r,this._mergedOrder,a,i,n,o,this.placement,this.fog&&r.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,u,h,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(e.q.now()),c=!0),l&&this.pauseablePlacement.placement.setStale()),c||l){this._buildingIndex.onNewFrame(r.zoom);for(let t=0;t<this._mergedOrder.length;t++){const r=this._mergedLayers[this._mergedOrder[t]];if("symbol"!==r.type)continue;const i=this.isLayerClipped(r);this.placement.updateLayerOpacities(r,u[e.av(r.source,r.scope)],t,i?s:null)}}return{needsRerender:!this.pauseablePlacement.isDone()||this.placement.hasTransitions(e.q.now())}}_releaseSymbolFadeTiles(){for(const e in this._sourceCaches)this._sourceCaches[e].releaseSymbolFadeTiles()}addImport(t,r){this._checkLoaded();const i=this.stylesheet.imports=this.stylesheet.imports||[];if(-1!==i.findIndex((({id:e})=>e===t.id)))return void this.fire(new e.t(new Error(`Import with id '${t.id}' already exists in the map's style.`)));if(!r)return i.push(t),this._loadImports([t],!0);const n=i.findIndex((({id:e})=>e===r));return-1===n&&this.fire(new e.t(new Error(`Import with id "${r}" does not exist on this map.`))),this.stylesheet.imports=i.slice(0,n).concat(t).concat(i.slice(n)),this._loadImports([t],!0,r)}updateImport(t,r){this._checkLoaded();const i=this.stylesheet.imports||[],n=this.getImportIndex(t);return-1===n?this:"string"==typeof r?(this.setImportUrl(t,r),this):(r.url&&r.url!==i[n].url&&this.setImportUrl(t,r.url),e.bi(r.config,i[n].config)||this.setImportConfig(t,r.config),e.bi(r.data,i[n].data)||this.setImportData(t,r.data),this)}moveImport(e,t){this._checkLoaded();let r=this.stylesheet.imports||[];const i=this.getImportIndex(e);if(-1===i)return this;const n=this.getImportIndex(t);if(-1===n)return this;const o=r[i],s=this.fragments[i];return r=r.filter((({id:t})=>t!==e)),this.fragments=this.fragments.filter((({id:t})=>t!==e)),this.stylesheet.imports=r.slice(0,n).concat(o).concat(r.slice(n)),this.fragments=this.fragments.slice(0,n).concat(s).concat(this.fragments.slice(n)),this.mergeLayers(),this}setImportUrl(e,t){this._checkLoaded();const r=this.stylesheet.imports||[],i=this.getImportIndex(e);if(-1===i)return this;r[i].url=t;const n=this.fragments[i];return n.style=this._createFragmentStyle(r[i]),n.style.on("style.import.load",(()=>this.mergeAll())),n.style.loadURL(t),this}setImportData(e,t){this._checkLoaded();const r=this.getImportIndex(e),i=this.stylesheet.imports||[];return-1===r?this:t?(this.fragments[r].style.setState(t),this._reloadImports(),this):(delete i[r].data,this.setImportUrl(e,i[r].url))}setImportConfig(e,t){this._checkLoaded();const r=this.getImportIndex(e),i=this.stylesheet.imports||[];if(-1===r)return this;t?i[r].config=t:delete i[r].config;const n=this.fragments[r],o=n.style.stylesheet&&n.style.stylesheet.schema;return n.config=t,n.style.updateConfig(t,o),this.updateConfigDependencies(),this}removeImport(e){this._checkLoaded();const t=this.stylesheet.imports||[],r=this.getImportIndex(e);-1!==r&&(t.splice(r,1),this.fragments[r].style._remove(),this.fragments.splice(r,1),this._reloadImports())}getImportIndex(t){const r=(this.stylesheet.imports||[]).findIndex((e=>e.id===t));return-1===r&&this.fire(new e.t(new Error(`Import '${t}' does not exist in the map's style and cannot be updated.`))),r}getLayer(e){return this._mergedLayers[e]}getSources(){const e=[];for(const t in this._mergedOtherSourceCaches){const r=this._mergedOtherSourceCaches[t];r&&e.push(r.getSource())}return e}getSource(e,t){const r=this.getSourceCache(e,t);return r&&r.getSource()}getLayerSource(e){const t=this.getLayerSourceCache(e);return t&&t.getSource()}getSourceCache(t,r){const i=e.av(t,r);return this._mergedOtherSourceCaches[i]}getLayerSourceCache(t){const r=e.av(t.source,t.scope);return"symbol"===t.type?this._mergedSymbolSourceCaches[r]:this._mergedOtherSourceCaches[r]}getSourceCaches(e){if(null==e)return Object.values(this._mergedSourceCaches);const t=[];return this._mergedOtherSourceCaches[e]&&t.push(this._mergedOtherSourceCaches[e]),this._mergedSymbolSourceCaches[e]&&t.push(this._mergedSymbolSourceCaches[e]),t}updateSourceCaches(){const e=this._changes.getUpdatedSourceCaches();for(const t in e){const r=e[t];"reload"===r?this.reloadSource(t):"clear"===r&&this.clearSource(t)}}updateLayers(e){const t=this._changes.getUpdatedPaintProperties();for(const r of t){const t=this.getLayer(r);t&&t.updateTransitions(e)}}getImages(e,t,r){this.imageManager.getImages(t.icons,t.scope,r),this._updateTilesForChangedImages();const i=e=>{e&&e.setDependencies(t.tileID.key,t.type,t.icons)};i(this._otherSourceCaches[t.source]),i(this._symbolSourceCaches[t.source])}getGlyphs(e,t,r){this.glyphManager.getGlyphs(t.stacks,t.scope,r)}getResource(t,r,i){return e.ct(r,i)}getOwnSourceCache(e){return this._otherSourceCaches[e]}getOwnLayerSourceCache(e){return"symbol"===e.type?this._symbolSourceCaches[e.source]:this._otherSourceCaches[e.source]}getOwnSourceCaches(e){const t=[];return this._otherSourceCaches[e]&&t.push(this._otherSourceCaches[e]),this._symbolSourceCaches[e]&&t.push(this._symbolSourceCaches[e]),t}_isSourceCacheLoaded(t){const r=this.getOwnSourceCaches(t);return 0===r.length?(this.fire(new e.t(new Error(`There is no source with ID '${t}'`))),!1):r.every((e=>e.loaded()))}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(e,t){if(!this._clipLayerPresent&&"fill-extrusion"!==e.type)return!1;const r="fill-extrusion"===e.type&&"building"===e.sourceLayer;if(e.is3D()){if(r||t&&"batched-model"===t.type)return!0;if("model"===e.type)return!0}else if("symbol"===e.type)return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach((e=>{e.style._remove()})),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}li.getSourceType=function(e){return Ke[e]},li.setSourceType=function(e,t){Ke[e]=t},li.registerForPluginStateChange=e.cd;var ci="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#ifdef RENDER_CUTOFF\nfloat cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}\n#endif",ui="\nout vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\n#ifdef INDICATOR_CUTOUT\nuniform vec2 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;\n#endif\nvec4 applyCutout(vec4 color) {\n#ifdef INDICATOR_CUTOUT\nfloat holeMinOpacity=u_indicator_cutout_params.x;float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0);\n#else\nreturn color;\n#endif\n}\n#ifdef DEBUG_WIREFRAME\n#define HANDLE_WIREFRAME_DEBUG \\\nglFragColor=vec4(0.7,0.0,0.0,0.7); \\\ngl_FragDepth=gl_FragCoord.z-0.0001;\n#else\n#define HANDLE_WIREFRAME_DEBUG\n#endif\n#ifdef RENDER_CUTOFF\nuniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;\n#endif\nvec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}",hi="\n#define EXTENT 8192.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const vec2 units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (units_to_pixels*pos+offset)/pattern_size;}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}\n#ifdef RENDER_CUTOFF\nuniform vec4 u_cutoff_params;out float v_cutoff_opacity;\n#endif\nconst vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)\n{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}",di="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",pi="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\n#ifdef TERRAIN\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nreturn currentElevation(apos);}\n#endif\nvec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }\n#endif\n#ifdef DEPTH_OCCLUSION\nuniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset;\n#ifdef DEPTH_D24\nfloat unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);}\n#else\nhighp float unpack_depth_rgba(vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;\n#ifdef DEPTH_D24\nfloat depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);\n#else\nfloat depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));\n#endif\nreturn coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;\n#ifdef DEPTH_D24\nhighp vec4 depth=vec4(\ntexture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r\n);depth=unpack_depth4(depth);\n#else\nhighp vec4 depth=vec4(\nunpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy))\n);\n#endif\nreturn depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) {\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));\n#endif\nres+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));}\n#else\nbool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }\n#endif//DEPTH_OCCLUSION",fi="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif",mi="highp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}\n#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {\n#ifdef FOG_DITHERING\nvec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);\n#else\nreturn color;\n#endif\n}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif",_i="#ifdef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)\n);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0)\n);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}\n#endif",gi="#ifdef RASTER_ARRAY\nuniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;}\n#endif\nuniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}",yi="#ifdef RENDER_SHADOWS\nuniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}\n#endif//RENDER_SHADOWS",xi="#ifdef RENDER_SHADOWS\n#ifdef DEPTH_TEXTURE\nuniform highp sampler2D u_shadowmap_0;uniform highp sampler2D u_shadowmap_1;\n#else\nuniform sampler2D u_shadowmap_0;uniform sampler2D u_shadowmap_1;\n#endif\nuniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;highp float shadow_sample_1(highp vec2 uv,highp float compare) {highp float shadow_depth;\n#ifdef DEPTH_TEXTURE\nshadow_depth=texture(u_shadowmap_1,uv).r;\n#else\nshadow_depth=unpack_depth(texture(u_shadowmap_1,uv))*0.5+0.5;\n#endif\nreturn step(shadow_depth,compare);}highp float shadow_sample_0(highp vec2 uv,highp float compare) {highp float shadow_depth;\n#ifdef DEPTH_TEXTURE\nshadow_depth=texture(u_shadowmap_0,uv).r;\n#else\nshadow_depth=unpack_depth(texture(u_shadowmap_0,uv))*0.5+0.5;\n#endif\nreturn step(shadow_depth,compare);}float shadow_occlusion_1(highp vec4 pos,highp float bias) {highp vec2 uv=pos.xy;return shadow_sample_1(uv,pos.z-bias);}float shadow_occlusion_0(highp vec4 pos,highp float bias) {highp float compare0=pos.z-bias;\n#ifdef TEXTURE_GATHER\nhighp vec2 uv=pos.xy;highp vec4 samples=textureGather(u_shadowmap_0,uv,0);lowp vec4 stepSamples=step(samples,vec4(compare0));\n#else\nhighp vec2 uv00=pos.xy-vec2(0.5*u_shadow_texel_size);highp vec2 uv10=uv00+vec2(u_shadow_texel_size,0.0);highp vec2 uv01=uv00+vec2(0.0,u_shadow_texel_size);highp vec2 uv11=uv01+vec2(u_shadow_texel_size,0.0);lowp vec4 stepSamples=vec4(\nshadow_sample_0(uv01,compare0),shadow_sample_0(uv11,compare0),shadow_sample_0(uv10,compare0),shadow_sample_0(uv00,compare0)\n);\n#endif\nvec2 f=fract(pos.xy*u_shadow_map_resolution-vec2(0.5));lowp vec2 lerpx=mix(stepSamples.wx,stepSamples.zy,f.xx);return mix(lerpx.x,lerpx.y,f.y);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {\n#ifdef SHADOWS_SINGLE_CASCADE\nlight_view_pos0.xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);\n#else\nlight_view_pos0.xyz/=light_view_pos0.w;light_view_pos1.xyz/=light_view_pos1.w;vec4 uv=vec4(light_view_pos0.xy,light_view_pos1.xy);vec4 abs_bounds=abs(uv);if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {light_view_pos0.xyz=light_view_pos0.xyz*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}light_view_pos1.xyz=light_view_pos1.xyz*0.5+0.5;float occlusion1=shadow_occlusion_1(light_view_pos1,bias);return mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth));\n#endif\n}highp float calculate_shadow_bias(float NDotL) {\n#ifdef NORMAL_OFFSET\nreturn 0.5*u_shadow_bias.x;\n#else\nreturn 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));\n#endif\n}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}\n#endif";const vi=[];Mi(ci,vi),Mi(hi,vi),Mi(ui,vi);const bi={"_prelude_fog.vertex.glsl":fi,"_prelude_terrain.vertex.glsl":pi,"_prelude_shadow.vertex.glsl":yi,"_prelude_fog.fragment.glsl":mi,"_prelude_shadow.fragment.glsl":xi,"_prelude_lighting.glsl":"\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}\n#endif//LIGHTING_3D_MODE","_prelude_raster_array.glsl":_i,"_prelude_raster_particle.glsl":gi},wi={};Ai("",pi),Ai(mi,fi),Ai(xi,yi),Ai(_i,""),Ai(gi,"");const Ti=Ai(ui,hi),Si=ci;var Ei={background:Ai('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec4 u_color;uniform float u_opacity;\n#ifdef LIGHTING_3D_MODE\nin vec4 v_color;\n#endif\nvoid main() {vec4 out_color;\n#ifdef LIGHTING_3D_MODE\nout_color=v_color;\n#else\nout_color=u_color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_lighting.glsl"\nin vec2 a_pos;uniform mat4 u_matrix;\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),backgroundPattern:Ai('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),circle:Ai('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nuniform float u_emissive_strength;void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float opacity_t=smoothstep((1.0-blur_positive)*antialiased_blur,blur_positive*antialiased_blur,extrude_length-1.0)-smoothstep(0.0,antialiasblur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\nglFragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nout vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);\n#else \nsurface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nocclusion_world_center=world_center;occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}'),clippingMask:Ai("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Ai('#include "_prelude_fog.fragment.glsl"\nuniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\nif (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nout vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\npos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),heatmapTexture:Ai("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(0.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}","in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:Ai("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",'#include "_prelude_terrain.vertex.glsl"\nin vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;out float v_placed;out float v_notUsed;void main() {float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(a_anchor_pos));vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}'),collisionCircle:Ai("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}","in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:Ai("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",'#include "_prelude_terrain.vertex.glsl"\nin vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;\n#endif\nout vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}'),fill:Ai('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nuniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec4 out_color=color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nuniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillOutline:Ai('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nin highp vec2 v_pos;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nuniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillOutlinePattern:Ai('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nin highp vec2 v_pos;in highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;out highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillPattern:Ai('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;in highp vec2 v_pos;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillExtrusion:Ai('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec4 v_color;in vec4 v_flat;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;\n#endif\nuniform lowp float u_opacity;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec2 v_ao;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nin vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nin highp vec3 v_normal;\n#endif\nuniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nin float v_flood_radius;in float v_has_floodlight;\n#endif\nin float v_height;\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float emissive_strength\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nvec3 normal=normalize(v_normal);\n#endif\nfloat z;vec4 color=v_color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);\n#ifdef LIGHTING_3D_MODE\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#else\ncolor=mix(v_color,v_roof_color,z);\n#endif\n#endif\nfloat h=max(0.0,v_height);float ao_shade=1.0;\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\ncolor.rgb*=mix(ao_shade,1.0,v_has_floodlight);\n#else\ncolor.rgb*=ao_shade;\n#endif\n#else\ncolor.rgb*=ao_shade;\n#endif\n#endif\n#ifdef LIGHTING_3D_MODE\nfloat flood_radiance=0.0;\n#ifdef FLOOD_LIGHT\nflood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef FLOOD_LIGHT\nfloat ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);\n#else\nfloat shadowed_lighting_factor;\n#ifdef RENDER_CUTOFF\nshadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}\n#else\nshadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\n#endif\ncolor.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\n#endif\n#else\ncolor.rgb=apply_lighting(color.rgb,normal);\n#ifdef FLOOD_LIGHT\ncolor.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);\n#endif\n#endif\ncolor.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));\n#endif\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_lighting.glsl"\nuniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nuniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nout vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nout highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec2 v_ao;\n#endif\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nout float v_flood_radius;out float v_has_floodlight;\n#endif\nout float v_height;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define highp float flood_light_wall_radius\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize highp float flood_light_wall_radius\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp float emissive_strength\nbase*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nv_normal=normal;\n#endif\nbase=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat cutoff=1.0;vec3 scaled_pos=pos;\n#ifdef RENDER_CUTOFF\nvec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);cutoff=cutoff_opacity(u_cutoff_params,ground.z);if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\ngl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifndef LIGHTING_3D_MODE\ncolorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#endif\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\nfloat is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;\n#endif\nv_color=vec4(color.rgb,1.0);v_flat=vec4(linearProduct(color.rgb,vec3(calculate_NdotL(normal))),1.0);\n#else\nv_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nfloat roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),fillExtrusionDepth:Ai("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}",'#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nin vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp vec4 color\nout highp float v_depth;void main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp vec4 color\nbase*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nvec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);\n#else\npos=vec3(pos_nx.xy,t > 0.0 ? height : base);\n#endif\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}'),fillExtrusionPattern:Ai('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nin vec3 v_normal;\n#endif\nin highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define highp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize highp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_lighting.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nout highp vec2 v_pos;out vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nout vec3 v_normal;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define highp float pixel_ratio\n#pragma mapbox: define highp float line_width\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize highp float pixel_ratio\n#pragma mapbox: initialize highp float line_width\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_normal=normal;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif \n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}'),groundShadow:Ai('#include "_prelude_shadow.fragment.glsl"\nprecision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\nvoid main() {float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);\n#ifdef RENDER_CUTOFF\nshadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));\n#endif\n#ifdef FOG\nshadow=mix(shadow,vec3(1.0),v_fog_opacity);\n#endif\n#ifdef INDICATOR_CUTOUT\nshadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0)).r);\n#endif\nglFragColor=vec4(shadow,1.0);}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos);\n#endif\n}'),fillExtrusionGroundEffect:Ai("uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;\n#ifdef SDF_SUBPASS\nin highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}\n#ifdef FOG\nin highp float v_fog;\n#endif\n#endif\nvoid main() {\n#ifdef CLEAR_SUBPASS\nvec4 color=vec4(1.0);\n#ifdef CLEAR_FROM_TEXTURE\ncolor=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));\n#endif\nglFragColor=color;\n#else\n#ifdef SDF_SUBPASS\nhighp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;\n#ifdef FOG\nfog=v_fog;\n#endif\n#ifdef RENDER_CUTOFF\nfog*=v_cutoff_opacity;\n#endif\nglFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));\n#else\nvec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);\n#ifdef OVERDRAW_INSPECTOR\ncolor=vec4(1.0);\n#endif\nglFragColor=color;\n#endif\nHANDLE_WIREFRAME_DEBUG;\n#endif\n}",'#include "_prelude_fog.vertex.glsl"\nin highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark;\n#ifdef SDF_SUBPASS\nout highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;\n#ifdef FOG\nout highp float v_fog;\n#endif\n#endif\nuniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao;\n#pragma mapbox: define highp float flood_light_ground_radius\nconst float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {\n#pragma mapbox: initialize highp float flood_light_ground_radius\nvec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;\n#ifdef SDF_SUBPASS\nv_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);\n#ifdef FOG\nv_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);\n#endif\n#endif\nfloat hidden_by_landmark=0.0;\n#ifdef HAS_CENTROID\nhidden_by_landmark=a_hidden_by_landmark;\n#endif\nfloat isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}'),hillshadePrepare:Ai("precision highp float;uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(\n(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Ai('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef LIGHTING_3D_MODE\nglFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);\n#endif\n#ifdef FOG\nglFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),line:Ai('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;in vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nfloat luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\nfloat linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist=texture(u_dash_image,v_tex).r;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trim_alpha=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);out_color=mix(out_color,u_trim_color,transition_factor);trim_alpha=out_color.a;}\n#endif\nif (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}\n#ifdef RENDER_LINE_BORDER\nfloat edgeBlur=(border_width+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color.rgb=mix(border_color.rgb*border_color.a*trim_alpha,out_color.rgb,smoothAlpha);}}\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=(alpha*opacity);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define EXTRUDE_SCALE 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\nin float a_z_offset;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nin highp vec4 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nin float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\ngl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset+0.01*step(0.01,a_z_offset),1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;\n#endif\n#endif\ngl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude_xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nfloat a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];\n#ifdef RENDER_LINE_GRADIENT\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end);\n#else\nv_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nfloat scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/floorwidth,(-normal.y*height+dash.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),linePattern:Ai('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform highp float u_device_pixel_ratio;uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec4 v_uv;\n#endif\n#ifdef LINE_JOIN_NONE\nin vec2 v_pattern_data;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nuniform float u_emissive_strength;\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define mediump float pixel_ratio\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize mediump float pixel_ratio\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {color=vec4(0,0,0,0);}}\n#endif\n#ifdef LINE_JOIN_NONE\nfloat pattern_len=pattern_size/aspect;float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);}\n#endif\n#ifdef LIGHTING_3D_MODE\ncolor=apply_lighting_with_emission_ground(color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\nin float a_z_offset;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec4 a_packed;\n#endif\nin highp float a_linesofar;\n#ifdef LINE_JOIN_NONE\nin highp vec3 a_pattern_data;out vec2 v_pattern_data;\n#endif\nuniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nout highp vec4 v_uv;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\n#pragma mapbox: define mediump float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define mediump float floorwidth\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define mediump float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\n#pragma mapbox: initialize mediump float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize mediump float pixel_ratio\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\ngl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset+0.01*step(0.01,a_z_offset),1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;\n#endif\n#endif\ngl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude_xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nfloat a_uv_x=a_packed[0];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;\n#ifdef LINE_JOIN_NONE\nv_width=floorwidth+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),raster:Ai('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_raster_array.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nin float v_split_fade;\n#endif\nuniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;\n#ifndef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;\n#endif\n#ifdef RASTER_COLOR\nuniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;\n#endif\nvoid main() {vec4 color0,color1,color;vec2 value;\n#ifdef RASTER_COLOR\n#ifdef RASTER_ARRAY\n#ifdef RASTER_ARRAY_LINEAR\nvalue=mix(\nraTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#else\nvalue=mix(\nraTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#endif\nif (value.y > 0.0) value.x/=value.y;\n#else\ncolor=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);\n#endif\ncolor=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;\n#else\ncolor0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);\n#endif\ncolor.a*=u_opacity;\n#ifdef GLOBE_POLES\ncolor.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);\n#endif\nvec3 rgb=color.rgb;rgb=vec3(\ndot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef PROJECTION_GLOBE_VIEW\nglFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));\n#endif\n#ifdef RENDER_CUTOFF\nglFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;in vec2 a_texture_pos;\n#endif\nout vec2 v_pos0;out vec2 v_pos1;out float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nout float v_split_fade;\n#endif\nvoid main() {vec2 uv;\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos ,1.0);uv=a_uv;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);\n#endif\n#else\nfloat w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]); \nv_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\ngl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;\n#ifdef RENDER_CUTOFF\nv_depth=gl_Position.z;\n#endif\n}'),rasterParticle:Ai('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),0.0).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\nin vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\nuv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}'),rasterParticleDraw:Ai("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",'#include "_prelude_raster_particle.glsl"\nin float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2(\nmod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}'),rasterParticleTexture:Ai("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:Ai('#include "_prelude_raster_particle.glsl"\nuniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow(\nlinearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)\n);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}',"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbol:Ai('#include "_prelude_lighting.glsl"\n#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor;\n#ifdef ICON_TRANSITION\nuniform float u_icon_transition;\n#endif\n#ifdef COLOR_ADJUSTMENT\nuniform mat4 u_color_adj_mat;\n#endif\nin vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nin vec2 v_tex_b;\n#endif\nin float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nin float is_sdf;in vec2 v_tex_a_icon;\n#endif\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\nvec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];\n#ifdef RENDER_TEXT_AND_SYMBOL\nif (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nreturn;}\n#endif\n#ifdef RENDER_SDF\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha;\n#else\n#ifdef ICON_TRANSITION\nvec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b);\n#else\nout_color=texture(u_texture,v_tex_a);\n#endif\n#ifdef COLOR_ADJUSTMENT\nout_color=u_color_adj_mat*out_color;\n#endif\n#endif\nout_color*=opacity*fade_opacity;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\nin vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;\n#ifdef Z_OFFSET\nin float a_auto_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_globe_anchor;in vec3 a_globe_normal;\n#endif\n#ifdef ICON_TRANSITION\nin vec2 a_texb;\n#endif\n#ifdef OCCLUSION_QUERIES\nin float a_occlusion_query_opacity;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nout vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nout vec2 v_tex_b;\n#endif\nout float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nout float is_sdf;out vec2 v_tex_a_icon;\n#endif\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\n#pragma mapbox: define lowp float occlusion_opacity\n#pragma mapbox: define lowp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\n#pragma mapbox: initialize lowp float occlusion_opacity\n#pragma mapbox: initialize lowp float z_offset\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor);\n#ifdef Z_OFFSET\ne+=a_auto_z_offset;\n#endif\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w;\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;\n#endif\nvec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\n#ifdef Z_OFFSET\nz+=u_pitch_with_map ? a_auto_z_offset+(u_elevation_from_sea ? z_offset : z_offset) : 0.0;\n#else\nz+=u_pitch_with_map ? (u_elevation_from_sea ? z_offset : z_offset) : 0.0;\n#endif\nfloat occlusion_fade=globe_occlusion_fade;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float out_fade_opacity=interpolated_fade_opacity*projection_transition_fade;\n#ifdef DEPTH_OCCLUSION\nfloat depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;\n#endif\n#ifdef OCCLUSION_QUERIES\nfloat occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;\n#endif\nfloat alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);\n#endif\nfloat gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize;\n#ifdef RENDER_TEXT_AND_SYMBOL\nis_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;\n#endif\n#ifdef ICON_TRANSITION\nv_tex_b=a_texb/u_texsize;\n#endif\n}'),terrainRaster:Ai('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;in vec2 v_pos0;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nin vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#endif\nuniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;\n#ifdef LIGHTING_3D_MODE\nconst vec3 normal=vec3(0.0,0.0,1.0);\n#ifdef RENDER_SHADOWS\nfloat cutoffOpacity=1.0;\n#ifdef RENDER_CUTOFF\ncutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);\n#endif\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nvec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;\n#else\nfloat lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));\n#endif\n#else\nfloat lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0;\n#endif\n#endif\n#else\ncolor=image_color;\n#endif\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#else\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth;\n#endif\nvoid main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\nv_fog_pos=fog_position(decodedPos);\n#else\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);\n#endif\n}'),terrainDepth:Ai("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",'#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}'),skybox:Ai('#include "_prelude_fog.fragment.glsl"\nin lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',di),skyboxGradient:Ai('#include "_prelude_fog.fragment.glsl"\nin highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',di),skyboxCapture:Ai("\nin highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float;\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}","in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:Ai('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0;\n#ifndef FOG\nuniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nvec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nraster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(raster.rgb*antialias,antialias);\n#else\nraster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor=apply_lighting_with_emission_ground(color,color.a);color.a=1.0;\n#else\ncolor=apply_lighting_ground(color);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;\n#endif\nout vec2 v_pos0;void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);globe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}'),globeAtmosphere:Ai('#include "_prelude_fog.fragment.glsl"\nuniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {\n#ifdef ALPHA_PASS\nglFragColor=vec4(0,0,0,0);return;\n#else\n#ifdef NATIVE\nglFragColor=vec4(1,1,1,1);\n#else\nglFragColor=vec4(0,0,0,1);\n#endif\nreturn;\n#endif\n}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;\n#ifdef ALPHA_PASS\nfloat a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);\n#else\nvec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;\n#ifndef NATIVE\nc=dither(c,gl_FragCoord.xy+u_temporal_offset);\n#endif\nglFragColor=vec4(c*t,t);\n#endif\n}',"in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}"),model:Ai('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;\n#endif\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nuniform vec4 u_occlusionTextureTransform;\n#endif\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#ifdef HAS_ATTRIBUTE_a_pbr\nin lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;\n#endif\n#ifdef HAS_TEXTURE_u_baseColorTexture\nuniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;\n#endif\n#ifdef HAS_TEXTURE_u_metallicRoughnessTexture\nuniform sampler2D u_metallicRoughnessTexture;\n#endif\n#ifdef HAS_TEXTURE_u_occlusionTexture\nuniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;\n#endif\n#ifdef HAS_TEXTURE_u_normalTexture\nuniform sampler2D u_normalTexture;\n#endif\n#ifdef HAS_TEXTURE_u_emissionTexture\nuniform sampler2D u_emissionTexture;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nin highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack;\n#ifdef DEPTH_D24\nhighp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}\n#else\nhighp float unpack_depth_rgba(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size;\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depthTexture,coord).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));\n#endif\nreturn v_depth > depth+0.0005;}\n#endif\n#define saturate(_x) clamp(_x,0.,1.)\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)\n{\n#ifdef LIGHTING_3D_MODE\nvec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));\n#endif\nreturn apply_lighting(albedo,transformed_normal,lighting_factor);\n#else\nvec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-lightColor),vec3(1.0));return c3;\n#endif\n}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;\n#ifdef HAS_ATTRIBUTE_a_color_3f\nalbedo*=vec4(color_3f,1.0);\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#else\n#ifdef HAS_ATTRIBUTE_a_color_4f\nalbedo*=color_4f;\n#endif\n#endif\n#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)\nvec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}\n#ifdef UNPREMULT_TEXTURE_IN_SHADER\nif(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;\n#endif\nif(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}\n#endif\nvec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);\n#ifdef APPLY_LUT_ON_GPU\ncolor=applyLUT(u_lutTexture,color);\n#endif\nreturn color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {\n#ifdef HAS_TEXTURE_u_normalTexture\nhighp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;\n#else\nreturn mat3(1.0);\n#endif\n}highp vec3 getNormal(){highp vec3 n;\n#ifdef HAS_ATTRIBUTE_a_normal_3f\nn=normalize(normal_3f);\n#else\nhighp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));n=normalize(cross(fdx,fdy))*-1.0;\n#endif\n#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nvec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);\n#endif\nreturn n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;\n#ifdef HAS_ATTRIBUTE_a_pbr\nmat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;\n#endif\n#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) \nvec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;\n#endif\nconst float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)\n{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)\n{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)\n{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)\n{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)\n{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)\n{\n#ifdef LIGHTING_3D_MODE\nreturn mat.diffuseColor;\n#else\nreturn mat.diffuseColor/PI;\n#endif\n}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)\n{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)\n{vec3 env_light=vec3(0.65,0.65,0.65);\n#ifdef LIGHTING_3D_MODE\nfloat ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;\n#endif\nvec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)\n{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=NdotL;\n#endif\nvec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*lightColor;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;\n#if !defined(LIGHTING_3D_MODE)\nconst vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);\n#endif\ncolor*=intensityFactor;return color;}void main() {\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nif (isOccluded()) {discard;}\n#endif\nvec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;\n#ifdef LIGHTING_3D_MODE\nlightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;\n#endif\nvec4 finalColor;\n#ifdef DIFFUSE_SHADED\nvec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);\n#ifdef HAS_TEXTURE_u_occlusionTexture\nfloat ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;\n#endif\nfinalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;\n#else\nMaterial mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;\n#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nvec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;\n#else\nvec2 uv=uv_2f;\n#endif\nao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;\n#endif\nvec4 emissive=u_emissiveFactor;\n#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nemissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);\n#endif\n#ifdef APPLY_LUT_ON_GPU\nfloat emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;\n#endif\ncolor+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;\n#ifdef HAS_ATTRIBUTE_a_pbr\nfloat resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb;\n#ifdef APPLY_LUT_ON_GPU\ncolor_mix=applyLUT(u_lutTexture,color_mix);\n#endif\ncolor=mix(color,color_mix,min(1.0,resEmission));\n#ifdef HAS_ATTRIBUTE_a_color_4f\nfloat distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);\n#endif\n#endif\nvec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);\n#endif\n#ifdef FOG\nfinalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));\n#endif\n#ifdef RENDER_CUTOFF\nfinalColor*=v_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\nfinalColor=applyCutout(finalColor);\n#endif\nglFragColor=finalColor;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec3 a_pos_3f;\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr\n#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength\nuniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_normal_matrix;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;\n#endif\nout vec4 v_position_height;out lowp vec4 v_color_mix;\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nout highp float v_depth;\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\nout lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;\n#endif\nvec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute-custom highp vec4 pbr\n#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength\nhighp mat4 normal_matrix;\n#ifdef INSTANCED_ARRAYS\nnormal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\nnormal_matrix=u_normal_matrix;\n#endif\nvec3 local_pos;mat3 rs;\n#ifdef MODEL_POSITION_ON_GPU\nvec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;\n#else\nlocal_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);\n#endif\nv_position_height.w=a_pos_3f.z;\n#ifdef HAS_ATTRIBUTE_a_pbr\nvec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(local_pos);\n#endif\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nfloat x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f);\n#else\nnormal_3f=vec3(normal_matrix*vec4(normal_3f,0));\n#endif\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#ifdef HAS_ATTRIBUTE_a_color_4f\nv_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);\n#ifdef NORMAL_OFFSET\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nvec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#else\nvec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#endif\n#endif\n#endif\nv_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w;\n#endif\n}'),modelDepth:Ai("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}","in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;\n#ifdef MODEL_POSITION_ON_GPU\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_instance;\n#endif\nuniform highp mat4 u_node_matrix;\n#endif\nvoid main() {\n#ifdef MODEL_POSITION_ON_GPU\nhighp mat4 instance;\n#ifdef INSTANCED_ARRAYS\ninstance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\ninstance=u_instance;\n#endif\nvec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden);\n#else\ngl_Position=u_matrix*vec4(a_pos_3f,1);\n#endif\nv_depth=gl_Position.z/gl_Position.w;}"),stars:Ai("in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)\n{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}","\nin vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}"),snowParticle:Ai("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}","\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; \nuniform float u_horizontalOscillationRate; \nuniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}"),rainParticle:Ai("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}","\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity; \nuniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos*=halfBoxSize; \npos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}"),occlusion:Ai("uniform vec4 u_color;void main() {glFragColor=u_color;}",'#include "_prelude_terrain.vertex.glsl"\nin highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos;\n#ifdef TERRAIN\nfloat e=elevation(world_pos.xy);world_pos.z+=e;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}')};function Mi(e,t){const r=e.replace(/\s*\/\/[^\n]*\n/g,"\n").split("\n");for(let e of r)if(e=e.trim(),"#"===e[0]&&e.includes("if")&&!e.includes("endif")){e=e.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const r=e.split(" ");for(const e of r)t.includes(e)||t.push(e)}}function Ai(e,t){const r=/#include\s+"([^"]+)"/g,i=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g;let n=t.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);n&&(n=n.map((e=>{const t=e.split(" ");return t[t.length-1]})),n=[...new Set(n)]);const o={},s=[],a=[];if(e=e.replace(r,((e,t)=>(a.push(t),""))),(t=t.replace(r,((e,t)=>(s.push(t),"")))).includes("flat out"))return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071');let l=[...vi];Mi(e,l),Mi(t,l);for(const e of[...s,...a])bi[e]||console.error(`Undefined include: ${e}`),wi[e]||(wi[e]=[],Mi(bi[e],wi[e])),l=[...l,...wi[e]];return{fragmentSource:e=e.replace(i,((e,t,r,i,n)=>(o[n]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nin ${r} ${i} ${n};\n#else\nuniform ${r} ${i} u_${n};\n#endif\n`:"initialize"===t?`\n#ifdef HAS_UNIFORM_u_${n}\n ${r} ${i} ${n} = u_${n};\n#endif\n`:"define-attribute"===t?`\n#ifdef HAS_ATTRIBUTE_a_${n}\n in ${r} ${i} ${n};\n#endif\n`:"initialize-attribute"===t?"":void 0))),vertexSource:t=t.replace(i,((e,t,r,i,n)=>{const s="float"===i?"vec2":i,a=n.match(/color/)?"color":s;return"define-attribute-vertex-shader-only"===t?`\n#ifdef HAS_ATTRIBUTE_a_${n}\nin ${r} ${i} a_${n};\n#endif\n`:o[n]?"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${r} ${s} a_${n};\nout ${r} ${i} ${n};\n#else\nuniform ${r} ${i} u_${n};\n#endif\n`:"initialize"===t?"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = a_${n};\n#else\n ${r} ${i} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = unpack_mix_${a}(a_${n}, u_${n}_t);\n#else\n ${r} ${i} ${n} = u_${n};\n#endif\n`:"define-attribute"===t?`\n#ifdef HAS_ATTRIBUTE_a_${n}\n in ${r} ${i} a_${n};\n out ${r} ${i} ${n};\n#endif\n`:"initialize-attribute"===t?`\n#ifdef HAS_ATTRIBUTE_a_${n}\n ${n} = a_${n};\n#endif\n`:void 0:"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${r} ${s} a_${n};\n#else\nuniform ${r} ${i} u_${n};\n#endif\n`:"define-instanced"===t?"mat4"===a?`\n#ifdef INSTANCED_ARRAYS\nin vec4 a_${n}0;\nin vec4 a_${n}1;\nin vec4 a_${n}2;\nin vec4 a_${n}3;\n#else\nuniform ${r} ${i} u_${n};\n#endif\n`:`\n#ifdef INSTANCED_ARRAYS\nin ${r} ${s} a_${n};\n#else\nuniform ${r} ${i} u_${n};\n#endif\n`:"initialize-attribute-custom"===t?`\n#ifdef HAS_ATTRIBUTE_a_${n}\n ${r} ${i} ${n} = a_${n};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${r} ${i} ${n} = a_${n};\n#else\n ${r} ${i} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${r} ${i} ${n} = unpack_mix_${a}(a_${n}, u_${n}_t);\n#else\n ${r} ${i} ${n} = u_${n};\n#endif\n`})),staticAttributes:n,usedDefines:l,vertexIncludes:s,fragmentIncludes:a}}class Ci{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(e,t,r,i,n,o,s,a){this.context=e;let l=this.boundPaintVertexBuffers.length!==i.length;for(let e=0;!l&&e<i.length;e++)this.boundPaintVertexBuffers[e]!==i[e]&&(l=!0);let c=this.boundDynamicVertexBuffers.length!==s.length;for(let e=0;!c&&e<s.length;e++)this.boundDynamicVertexBuffers[e]!==s[e]&&(c=!0);if(!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==r||l||c||this.boundIndexBuffer!==n||this.boundVertexOffset!==o)this.freshBind(t,r,i,n,o,s,a);else{e.bindVertexArrayOES.set(this.vao);for(const r of s)r&&(r.bind(),a&&r.instanceCount&&r.setVertexAttribDivisor(e.gl,t,a));n&&n.dynamicDraw&&n.bind()}}freshBind(e,t,r,i,n,o,s){const a=e.numAttributes,l=this.context,c=l.gl;this.vao&&this.destroy(),this.vao=l.gl.createVertexArray(),l.bindVertexArrayOES.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=i,this.boundVertexOffset=n,this.boundDynamicVertexBuffers=o,t.enableAttributes(c,e),t.bind(),t.setVertexAttribPointers(c,e,n);for(const t of r)t.enableAttributes(c,e),t.bind(),t.setVertexAttribPointers(c,e,n);for(const t of o)t&&(t.enableAttributes(c,e),t.bind(),t.setVertexAttribPointers(c,e,n),s&&t.instanceCount&&t.setVertexAttribDivisor(c,e,s));i&&i.bind(),l.currentNumAttributes=a}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function Ii(t,r){const i=Math.pow(2,r.canonical.z),n=r.canonical.y;return[new e.a5(0,n/i).toLngLat().lat,new e.a5(0,(n+1)/i).toLngLat().lat]}function Pi(t,r,i,n,o,s,a){const l=t.context,c=l.gl,u=i.hillshadeFBO;if(!u)return;t.prepareDrawTile();const h=t.isTileAffectedByFog(r),d=t.getOrCreateProgram("hillshade",{overrideFog:h});l.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,u.colorAttachment.get());const p=((t,r,i,n)=>{const o=i.paint.get("hillshade-shadow-color"),s=i.paint.get("hillshade-highlight-color"),a=i.paint.get("hillshade-accent-color"),l=i.paint.get("hillshade-emissive-strength");let c=e.bC(i.paint.get("hillshade-illumination-direction"));if("viewport"===i.paint.get("hillshade-illumination-anchor"))c-=t.transform.angle;else if(t.style&&t.style.enable3dLights()&&t.style.directionalLight){const r=t.style.directionalLight.properties.get("direction"),i=e.c8(r.x,r.y,r.z);c=e.bC(i[1])}const u=!t.options.moving;return{u_matrix:n||t.transform.calculateProjMatrix(r.tileID.toUnwrapped(),u),u_image:0,u_latrange:Ii(0,r.tileID),u_light:[i.paint.get("hillshade-exaggeration"),c],u_shadow:o.toRenderColor(i.lut),u_highlight:s.toRenderColor(i.lut),u_emissive_strength:l,u_accent:a.toRenderColor(i.lut)}})(t,i,n,t.terrain?r.projMatrix:null);t.uploadCommonUniforms(l,d,r.toUnwrapped());const{tileBoundsBuffer:f,tileBoundsIndexBuffer:m,tileBoundsSegments:_}=t.getTileBoundsBuffers(i);d.draw(t,c.TRIANGLES,o,s,a,Or.disabled,p,n.id,f,m,_)}function Ri(t,r,i){if(!r.needsDEMTextureUpload)return;const n=t.context,o=n.gl;n.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||t.getTileTexture(i.stride);const s=i.getPixels();r.demTexture?r.demTexture.update(s,{premultiply:!1}):r.demTexture=new e.T(n,s,o.R32F,{premultiply:!1}),r.needsDEMTextureUpload=!1}function zi(t,r,i){const n=t.context,o=n.gl;if(!r.dem)return;const s=r.dem;if(n.activeTexture.set(o.TEXTURE1),Ri(t,r,s),!r.demTexture)return;r.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE);const a=s.dim;n.activeTexture.set(o.TEXTURE0);let l=r.hillshadeFBO;if(!l){const t=new e.T(n,{width:a,height:a,data:null},o.RGBA8);t.bind(o.LINEAR,o.CLAMP_TO_EDGE),l=r.hillshadeFBO=n.createFramebuffer(a,a,!0,"renderbuffer"),l.colorAttachment.set(t.texture)}n.bindFramebuffer.set(l.framebuffer),n.viewport.set([0,0,a,a]);const{tileBoundsBuffer:c,tileBoundsIndexBuffer:u,tileBoundsSegments:h}=t.getMercatorTileBoundsBuffers(),d=[];t.linearFloatFilteringSupported()&&d.push("TERRAIN_DEM_FLOAT_FORMAT"),t.getOrCreateProgram("hillshadePrepare",{defines:d}).draw(t,o.TRIANGLES,Pr.disabled,zr.disabled,Ir.unblended,Or.disabled,((t,r)=>{const i=r.stride,n=e.a6.mat4.create();return e.a6.mat4.ortho(n,0,e.ab,-e.ab,0,0,1),e.a6.mat4.translate(n,n,[0,-e.ab,0]),{u_matrix:n,u_image:1,u_dimension:[i,i],u_zoom:t.overscaledZ}})(r.tileID,s),i.id,c,u,h),r.needsHillshadePrepare=!1}class Di{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class ki extends Di{getDefault(){return e.bA.transparent}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Oi extends Di{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Li extends Di{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class Bi extends Di{getDefault(){return[!0,!0,!0,!0]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Fi extends Di{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class Ni extends Di{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class Vi extends Di{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const t=this.current;(e.func!==t.func||e.ref!==t.ref||e.mask!==t.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class ji extends Di{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class Ui extends Di{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}}class $i extends Di{getDefault(){return[0,1]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class Gi extends Di{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}}class qi extends Di{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class Hi extends Di{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}}class Wi extends Di{getDefault(){const e=this.gl;return[e.ONE,e.ZERO,e.ONE,e.ZERO]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.blendFuncSeparate(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Zi extends Di{getDefault(){return e.bA.transparent}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Xi extends Di{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(e,e),this.current=e,this.dirty=!1)}}class Yi extends Di{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}}class Ji extends Di{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class Ki extends Di{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}let Qi=class extends Di{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}};class en extends Di{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class tn extends Di{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class rn extends Di{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class nn extends Di{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class on extends Di{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class sn extends Di{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class an extends Di{getDefault(){return null}set(e){const t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class ln extends Di{getDefault(){return null}set(e){this.gl&&(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}}class cn extends Di{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class un extends Di{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class hn extends Di{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class dn extends Di{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}}class pn extends dn{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class fn extends dn{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,this.attachment(),t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class mn extends dn{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,this.attachment(),t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class _n extends fn{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const gn=(e,t,r)=>({u_matrix:e,u_image0:0,u_skirt_height:t,u_ground_shadow_factor:r}),yn=(e,t,r,i,n,o,s,a,l,c,u,h,d,p,f,m)=>({u_proj_matrix:Float32Array.from(e),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(i),u_merc_matrix:r,u_zoom_transition:n,u_merc_center:o,u_image0:0,u_frustum_tl:s,u_frustum_tr:a,u_frustum_br:l,u_frustum_bl:c,u_globe_pos:u,u_globe_radius:h,u_viewport:d,u_grid_matrix:m?Float32Array.from(m):new Float32Array(9),u_skirt_height:p,u_far_z_cutoff:f});function xn(e,t){return null!=e&&null!=t&&!(!e.hasData()||!t.hasData())&&null!=e.demTexture&&null!=t.demTexture&&e.tileID.key!==t.tileID.key}const vn=new class{constructor(){this.operations={}}newMorphing(e,t,r,i,n){if(e in this.operations){const t=this.operations[e];t.to.tileID.key!==r.tileID.key&&(t.queued=r)}else this.operations[e]={startTime:i,phase:0,duration:n,from:t,to:r,queued:null}}getMorphValuesForProxy(e){if(!(e in this.operations))return null;const t=this.operations[e];return{from:t.from,to:t.to,phase:t.phase}}update(e){for(const t in this.operations){const r=this.operations[t];for(r.phase=(e-r.startTime)/r.duration;r.phase>=1||!this._validOp(r);)if(!this._nextOp(r,e)){delete this.operations[t];break}}}_nextOp(e,t){return!!e.queued&&(e.from=e.to,e.to=e.queued,e.queued=null,e.phase=0,e.startTime=t,!0)}_validOp(e){return e.from.hasData()&&e.to.hasData()}},bn={0:null,1:"TERRAIN_VERTEX_MORPHING"};function wn(e,t,r){if(0===t)return 0;const i=t<1&&514===r?.25/t:1;return 6*Math.pow(1.5,22-e)*Math.max(t,1)*i}function Tn(e,t){const r=1<<e.z;return!t&&(0===e.x||e.x===r-1)||0===e.y||e.y===r-1}const Sn=e=>({u_matrix:e});function En(t,r,i,n,o){if(o>0){const s=e.q.now(),a=(s-t.timeAdded)/o,l=r?(s-r.timeAdded)/o:-1,c=i.getSource(),u=n.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),h=!r||Math.abs(r.tileID.overscaledZ-u)>Math.abs(t.tileID.overscaledZ-u),d=h&&t.refreshedUponExpiration?1:e.ap(h?a:1-l,0,1);return t.refreshedUponExpiration&&a>=1&&(t.refreshedUponExpiration=!1),r?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return{opacity:1,mix:0}}class Mn extends gt{constructor(t){const r={type:"raster-dem",maxzoom:t.transform.maxZoom},i=new e.ce(e.cf(),null),n=Qe("mock-dem",r,i,t.style);super("mock-dem",n,!1),n.setEventedParent(this),this._sourceLoaded=!0}_loadTile(e,t){e.state="loaded",t(null)}}class An extends gt{constructor(t){const r=Qe("proxy",{type:"geojson",maxzoom:t.transform.maxZoom},new e.ce(e.cf(),null),t.style);super("proxy",r,!1),r.setEventedParent(this),this.map=this.getSource().map=t,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(e,t,r){if(e.freezeTileCoverage)return;this.transform=e;const i=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce(((t,r)=>{if(t[r.key]="",!this._tiles[r.key]){const t=new pt(r,this._source.tileSize*r.overscaleFactor(),e.tileZoom);t.state="loaded",this._tiles[r.key]=t}return t}),{});for(const e in this._tiles)e in i||(this.freeFBO(e),this._tiles[e].unloadVectorData(),delete this._tiles[e])}freeFBO(e){const t=this.proxyCachedFBO[e];if(void 0!==t){const r=Object.values(t);this.renderCachePool.push(...r),delete this.proxyCachedFBO[e]}}deallocRenderCache(){this.renderCache.forEach((e=>e.fb.destroy())),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class Cn extends e.aA{constructor(e,t,r){super(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y),this.proxyTileKey=t,this.projMatrix=r}}class In extends e.cE{constructor(t,r){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},t.tp.registerParameter(this._debugParams,["Terrain"],"sortTilesHiZFirst",{},(()=>{this._style.map.triggerRepaint()})),t.tp.registerParameter(this._debugParams,["Terrain"],"disableRenderCache",{},(()=>{this._style.map.triggerRepaint()})),t.tp.registerButton(["Terrain"],"Invalidate Render Cache",(()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint()})),this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[i,n,o]=function(){const t=new e.a$,r=new e.aP,i=131;t.reserve(17161),r.reserve(33800);const n=e.ab/128,o=e.ab+n/2,s=o+n;for(let r=-n;r<s;r+=n)for(let i=-n;i<s;i+=n){const n=i<0||i>o||r<0||r>o?24575:0,s=e.ap(Math.round(i),0,e.ab),a=e.ap(Math.round(r),0,e.ab);t.emplaceBack(s+n,a)}const a=(e,t)=>{const n=t*i+e;r.emplaceBack(n+1,n,n+i),r.emplaceBack(n+i,n+i+1,n+1)};for(let e=1;e<129;e++)for(let t=1;t<129;t++)a(t,e);return[0,129].forEach((e=>{for(let t=0;t<130;t++)a(t,e),a(e,t)})),[t,r,32768]}(),s=t.context;this.gridBuffer=s.createVertexBuffer(i,e.b1.members),this.gridIndexBuffer=s.createIndexBuffer(n),this.gridSegments=e.b2.simpleSegment(0,0,i.length,n.length),this.gridNoSkirtSegments=e.b2.simpleSegment(0,0,i.length,o),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new An(r.map),this.orthoMatrix=e.a6.mat4.create(),e.a6.mat4.ortho(this.orthoMatrix,"globe"===this.painter.transform.projection.name?.015:0,e.ab,0,e.ab,0,1);const a=s.gl;this._overlapStencilMode=new zr({func:a.GEQUAL,mask:255},0,255,a.KEEP,a.KEEP,a.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=r,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Mn(r.map),this._pendingGroundEffectLayers=[]}set style(e){e.on("data",this._onStyleDataEvent.bind(this)),this._style=e,this._style.map.on("moveend",(()=>{this._clearLineLayersFromRenderCache()}))}update(t,r,i){if(t&&t.terrain){this._style!==t&&(this.style=t,this._evaluationZoom=void 0);const n=t.terrain.properties,o=0===t.terrain.drapeRenderMode,s=t.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=e.q.now();const a=t.terrain&&t.terrain.scope,l=n.get("source"),c=o?this._mockSourceCache:t.getSourceCache(l,a);if(!c)return void e.w(`Couldn't find terrain source "${l}".`);if(this.sourceCache=c,this._attenuationRange=t.terrain.getAttenuationRange(),this._exaggeration=s?this.calculateExaggeration(r):n.get("exaggeration"),!r.projection.requiresDraping&&s&&0===this._exaggeration)return void this._disable();this.enabled=!0;const u=()=>{this.sourceCache.used&&e.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.\nThis leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const t=this.getScaledDemTileSize();this.sourceCache.update(r,t,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,u(),this._initializing=!0),u(),r.updateElevation(!0,i),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(r),this._emptyDEMTextureDirty=!0,this._previousZoom=r.zoom}else this._disable()}calculateExaggeration(t){if(this._attenuationRange&&t.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(t.zoom);const r=this._previousCameraAltitude,i=t.getFreeCameraOptions().position.z/t.pixelsPerMeter*t.worldSize;this._previousCameraAltitude=i;const n=null!=r?i-r:Number.MAX_VALUE;if(Math.abs(n)<2)return this._exaggeration;const o=t.zoom,s=this._style.terrain;if(!this._previousUpdateTimestamp)return s.getExaggeration(o);let a=o-this._previousZoom;const l=this._previousUpdateTimestamp;let c=o;null!=this._evaluationZoom&&(c=this._evaluationZoom,Math.abs(o-c)>.5&&(a=.5*(o-c+a)),a*n<0&&(c+=a)),this._evaluationZoom=c;const u=s.getExaggeration(c),h=u===s.getExaggeration(Math.max(0,c-.1));if(h&&Math.abs(u-this._exaggeration)<.01)return u;let d=Math.min(.1,.00375*(this._updateTimestamp-l));return(h||u<.1||Math.abs(a)<1e-4)&&(d=Math.min(.2,4*d)),e.aa(this._exaggeration,u,d)}resetTileLookupCache(e){this._findCoveringTileCache[e]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(e){e.coord&&"source"===e.dataType?this._clearRenderCacheForTile(e.sourceCacheId,e.coord):"style"===e.dataType&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const e in this._style._mergedSourceCaches)this._style._mergedSourceCaches[e].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach((e=>e.fb.destroy())),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const e=2*this.proxySourceCache.getSource().tileSize;return[e,e]}set useVertexMorphing(e){this._useVertexMorphing=e}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const r=this.proxySourceCache,i=this.painter.transform;this._initializing&&(this._initializing=0===i._centerAltitude&&-1===this.getAtPointOrZero(e.a5.fromLngLat(i.center),-1),this._emptyDEMTextureDirty=!this._initializing);const n=this.proxyCoords=r.getIds().map((e=>{const t=r.getTileByID(e).tileID;return t.projMatrix=i.calculateProjMatrix(t.toUnwrapped()),t}));!function(t,r){const i=r.transform.pointCoordinate(r.transform.getCameraPoint()),n=new e.P(i.x,i.y);t.sort(((t,r)=>{if(r.overscaledZ-t.overscaledZ)return r.overscaledZ-t.overscaledZ;const i=new e.P(t.canonical.x+(1<<t.canonical.z)*t.wrap,t.canonical.y),o=new e.P(r.canonical.x+(1<<r.canonical.z)*r.wrap,r.canonical.y),s=n.mult(1<<t.canonical.z);return s.x-=.5,s.y-=.5,s.distSqr(i)-s.distSqr(o)}))}(n,this.painter);const o=this.proxyToSource||{};this.proxyToSource={},n.forEach((e=>{this.proxyToSource[e.key]={}})),this.terrainTileForTile={};const s=this._style._mergedSourceCaches;for(const e in s){const r=s[e];if(!r.used)continue;if(r!==this.sourceCache&&this.resetTileLookupCache(r.id),this._setupProxiedCoordsForOrtho(r,t[e],o),r.usedForTerrain)continue;const i=t[e];r.getSource().reparseOverscaled&&this._assignTerrainTiles(i)}this.proxiedCoords[r.id]=n.map((e=>new Cn(e,e.key,this.orthoMatrix))),this._assignTerrainTiles(n),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(o),this.renderingToTexture=!1;const a={};this._visibleDemTiles=[];for(const e of this.proxyCoords){const t=this.terrainTileForTile[e.key];if(!t)continue;const r=t.tileID.key;r in a||(this._visibleDemTiles.push(t),a[r]=r)}}_assignTerrainTiles(e){this._initializing||e.forEach((e=>{if(this.terrainTileForTile[e.key])return;const t=this._findTileCoveringTileID(e,this.sourceCache);t&&(this.terrainTileForTile[e.key]=t)}))}_prepareDEMTextures(){const e=this.painter.context,t=e.gl;for(const r in this.terrainTileForTile){const i=this.terrainTileForTile[r],n=i.dem;!n||i.demTexture&&!i.needsDEMTextureUpload||(e.activeTexture.set(t.TEXTURE1),Ri(this.painter,i,n))}}_prepareDemTileUniforms(e,t,r,i){if(!t||null==t.demTexture)return!1;const n=e.tileID.canonical,o=Math.pow(2,t.tileID.canonical.z-n.z),s=i||"";return r[`u_dem_tl${s}`]=[n.x*o%1,n.y*o%1],r[`u_dem_scale${s}`]=o,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let e=0;const t=this._visibleDemTiles.reduce(((t,r)=>{if(!r.dem)return t;const i=r.dem.tree.minimums[0];return i>0&&e++,t+i}),0);return e?t/e:0}_updateEmptyDEMTexture(){const t=this.painter.context,r=t.gl;t.activeTexture.set(r.TEXTURE2);const i=this._getLoadedAreaMinimum(),n=new e.cF({width:1,height:1},new Float32Array([i]));this._emptyDEMTextureDirty=!1;let o=this._emptyDEMTexture;return o?o.update(n,{premultiply:!1}):o=this._emptyDEMTexture=new e.T(t,n,r.R32F,{premultiply:!1}),o}setupElevationDraw(t,r,i){const n=this.painter.context,o=n.gl,s={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};s.u_exaggeration=this.exaggeration();let a=null,l=null,c=1;if(i&&i.morphing&&this._useVertexMorphing){const e=i.morphing.srcDemTile,r=i.morphing.dstDemTile;c=i.morphing.phase,e&&r&&(this._prepareDemTileUniforms(t,e,s,"_prev")&&(l=e),this._prepareDemTileUniforms(t,r,s)&&(a=r))}const u=e=>e&&e.demTexture&&this.painter.linearFloatFilteringSupported()?o.LINEAR:o.NEAREST;let h=null;var d;if(this.enabled?l&&a?(h=a.demTexture,n.activeTexture.set(o.TEXTURE4),l.demTexture.bind(u(l),o.CLAMP_TO_EDGE),s.u_dem_lerp=c):(a=this.terrainTileForTile[t.tileID.key],h=this._prepareDemTileUniforms(t,a,s)?a.demTexture:this.emptyDEMTexture):h=this.emptyDEMTexture,n.activeTexture.set(o.TEXTURE2),h&&(s.u_dem_size=1===(d=h).size[0]?1:d.size[0]-2,h.bind(u(a),o.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(i&&i.useDepthForOcclusion,r,s),i&&i.useMeterToDem&&a){const t=(1<<a.tileID.canonical.z)*e.bE(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;s.u_meter_to_dem=t}if(i&&i.labelPlaneMatrixInv&&(s.u_label_plane_matrix_inv=i.labelPlaneMatrixInv),r.setTerrainUniformValues(n,s),"globe"===this.painter.transform.projection.name){const e=this.globeUniformValues(this.painter.transform,t.tileID.canonical,i&&i.useDenormalizedUpVectorScale);r.setGlobeUniformValues(n,e)}}globeUniformValues(t,r,i){const n=t.projection;return{u_tile_tl_up:n.upVector(r,0,0),u_tile_tr_up:n.upVector(r,e.ab,0),u_tile_br_up:n.upVector(r,e.ab,e.ab),u_tile_bl_up:n.upVector(r,0,e.ab),u_tile_up_scale:i?e.cG(1):n.upVectorScale(r,t.center.lat,t.worldSize).metersToTile}}renderToBackBuffer(t){const r=this.painter,i=this.painter.context;0!==t.length&&(i.bindFramebuffer.set(null),i.viewport.set([0,0,r.width,r.height]),r.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(t,r,i,n,o){if("globe"===t.transform.projection.name)!function(t,r,i,n,o){const s=t.context,a=s.gl;let l,c;const u=t.transform,h=e.cx(t,s,u),d=(e,r)=>{if(c===r)return;const i=[bn[r],"PROJECTION_GLOBE_VIEW"];h&&i.push("CUSTOM_ANTIALIASING");const n=t.isTileAffectedByFog(e);l=t.getOrCreateProgram("globeRaster",{defines:i,overrideFog:n}),c=r},p=t.colorModeForRenderPass(),f=new Pr(a.LEQUAL,Pr.ReadWrite,t.depthRangeFor3D);vn.update(o);const m=e.cy(u),_=[e.am(u.center.lng),e.at(u.center.lat)],g=t.globeSharedBuffers,y=[u.width*e.q.devicePixelRatio,u.height*e.q.devicePixelRatio],x=Float32Array.from(u.globeMatrix),v={useDenormalizedUpVectorScale:!0};{const u=t.transform,h=wn(u.zoom,r.exaggeration(),r.sourceCache._source.tileSize);c=-1;const b=a.TRIANGLES;for(const c of n){const n=i.getTile(c),w=zr.disabled,T=r.prevTerrainTileForTile[c.key],S=r.terrainTileForTile[c.key];xn(T,S)&&vn.newMorphing(c.key,T,S,o,250),s.activeTexture.set(a.TEXTURE0),n.texture&&n.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);const E=vn.getMorphValuesForProxy(c.key),M=E?1:0;E&&e.C(v,{morphing:{srcDemTile:E.from,dstDemTile:E.to,phase:e.cw(E.phase)}});const A=e.cz(c.canonical),C=e.cA(A.getCenter().lat),I=e.cB(c.canonical,A,C,u.worldSize/u._pixelsPerMercatorPixel),P=e.b6(e.cC(c.canonical)),R=yn(u.expandedFarZProjMatrix,x,m,P,e.a9(u.zoom),_,u.frustumCorners.TL,u.frustumCorners.TR,u.frustumCorners.BR,u.frustumCorners.BL,u.globeCenterInViewSpace,u.globeRadius,y,h,u._farZ,I);if(d(c,M),l&&(r.setupElevationDraw(n,l,v),t.uploadCommonUniforms(s,l,c.toUnwrapped()),g)){const[e,r,i]=g.getGridBuffers(C,0!==h);l.draw(t,b,f,w,p,Or.backCCW,R,"globe_raster",e,r,i)}}}if(g&&(t.renderDefaultNorthPole||t.renderDefaultSouthPole)){const o=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];h&&o.push("CUSTOM_ANTIALIASING"),l=t.getOrCreateProgram("globeRaster",{defines:o});for(const o of n){const{x:n,y:c,z:h}=o.canonical,d=0===c,m=c===(1<<h)-1,[x,b,w,T]=g.getPoleBuffers(h,!1);if(T&&(d||m)){const c=i.getTile(o);s.activeTexture.set(a.TEXTURE0),c.texture&&c.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);let g=e.cD(h,n,u);const S=e.b6(e.cC(o.canonical)),E=(e,r)=>e.draw(t,a.TRIANGLES,f,zr.disabled,p,Or.disabled,yn(u.expandedFarZProjMatrix,g,g,S,0,_,u.frustumCorners.TL,u.frustumCorners.TR,u.frustumCorners.BR,u.frustumCorners.BL,u.globeCenterInViewSpace,u.globeRadius,y,0,u._farZ),"globe_pole_raster",r,w,T);r.setupElevationDraw(c,l,v),t.uploadCommonUniforms(s,l,o.toUnwrapped()),d&&t.renderDefaultNorthPole&&E(l,x),m&&t.renderDefaultSouthPole&&(g=e.a6.mat4.scale(e.a6.mat4.create(),g,[1,-1,1]),E(l,b))}}}}(t,r,i,n,o);else{const s=t.context,a=s.gl;let l,c;const u=t.shadowRenderer,h=Hr(t,t.longestCutoffRange),d=e=>{if(c===e)return;const r=[];r.push(bn[e]),h.shouldRenderCutoff&&r.push("RENDER_CUTOFF"),u&&(r.push("RENDER_SHADOWS","DEPTH_TEXTURE"),u.useNormalOffset&&r.push("NORMAL_OFFSET")),l=t.getOrCreateProgram("terrainRaster",{defines:r}),c=e},p=t.colorModeForRenderPass(),f=new Pr(a.LEQUAL,Pr.ReadWrite,t.depthRangeFor3D);vn.update(o);const m=t.transform,_=wn(m.zoom,r.exaggeration(),r.sourceCache._source.tileSize);let g=[0,0,0];if(u){const e=t.style.directionalLight,r=t.style.ambientLight;e&&r&&(g=Qr(t.style,e,r))}{c=-1;const y=a.TRIANGLES,[x,v]=[r.gridIndexBuffer,r.gridSegments];for(const c of n){const n=i.getTile(c),b=zr.disabled,w=r.prevTerrainTileForTile[c.key],T=r.terrainTileForTile[c.key];xn(w,T)&&vn.newMorphing(c.key,w,T,o,250),s.activeTexture.set(a.TEXTURE0),n.texture&&n.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);const S=vn.getMorphValuesForProxy(c.key),E=S?1:0;let M;S&&(M={morphing:{srcDemTile:S.from,dstDemTile:S.to,phase:e.cw(S.phase)}});const A=gn(c.projMatrix,Tn(c.canonical,m.renderWorldCopies)?_/10:_,g);if(d(E),!l)continue;r.setupElevationDraw(n,l,M);const C=c.toUnwrapped();u&&u.setupShadows(C,l),t.uploadCommonUniforms(s,l,C,null,h),l.draw(t,y,f,b,p,Or.backCCW,A,"terrain_raster",r.gridBuffer,x,v)}}}}(r,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,r.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}renderBatch(t){if(0===this._drapedRenderBatches.length)return t+1;this.renderingToTexture=!0;const r=this.painter,i=this.painter.context,n=this.proxySourceCache,o=this.proxiedCoords[n.id],s=this._drapedRenderBatches.shift(),a=r.style.order,l=[];let c=0;for(const u of o){const o=n.getTileByID(u.proxyTileKey),h=n.proxyCachedFBO[u.key]?n.proxyCachedFBO[u.key][t]:void 0,d=void 0!==h?n.renderCache[h]:this.pool[c++],p=void 0!==h;if(o.texture=d.tex,p&&!d.dirty){l.push(o.tileID);continue}let f;i.bindFramebuffer.set(d.fb.framebuffer),this.renderedToTile=!1,d.dirty&&(i.clear({color:e.bA.transparent,stencil:0}),d.dirty=!1);for(let e=s.start;e<=s.end;++e){const t=r.style._mergedLayers[a[e]];if(t.isHidden(r.transform.zoom))continue;const n=r.style.getLayerSourceCache(t),o=n?this.proxyToSource[u.key][n.id]:[u];if(!o)continue;const s=o;i.viewport.set([0,0,d.fb.width,d.fb.height]),f!==(n?n.id:null)&&(this._setupStencil(d,o,t,n),f=n?n.id:null),r.renderLayer(r,n,t,s)}if(0===this._drapedRenderBatches.length)for(const e of this._pendingGroundEffectLayers){const t=r.style._mergedLayers[a[e]];if(t.isHidden(r.transform.zoom))continue;const n=r.style.getLayerSourceCache(t),o=n?this.proxyToSource[u.key][n.id]:[u];if(!o)continue;const s=o;i.viewport.set([0,0,d.fb.width,d.fb.height]),f!==(n?n.id:null)&&(this._setupStencil(d,o,t,n),f=n?n.id:null),r.renderLayer(r,n,t,s)}this.renderedToTile?(d.dirty=!0,l.push(o.tileID)):p||--c,5===c&&(c=0,this.renderToBackBuffer(l))}return this.renderToBackBuffer(l),this.renderingToTexture=!1,i.bindFramebuffer.set(null),i.viewport.set([0,0,r.width,r.height]),s.end+1}postRender(){}isLayerOrderingCorrect(e){const t=e.order.length;let r=-1,i=t;for(let n=0;n<t;++n)this._style.isLayerDraped(e._mergedLayers[e.order[n]])?r=Math.max(r,n):i=Math.min(i,n);return i>r}getMinElevationBelowMSL(){let e=0;return this._visibleDemTiles.filter((e=>e.dem)).forEach((t=>{e=Math.min(e,t.dem.tree.minimums[0])})),0===e?e:(e-30)*this._exaggeration}raycast(e,t,r){if(!this._visibleDemTiles)return null;const i=this._visibleDemTiles.filter((e=>e.dem)).map((i=>{const n=i.tileID,o=1<<n.overscaledZ,{x:s,y:a}=n.canonical,l=s/o,c=(s+1)/o,u=a/o,h=(a+1)/o;return{minx:l,miny:u,maxx:c,maxy:h,t:i.dem.tree.raycastRoot(l,u,c,h,e,t,r),tile:i}}));i.sort(((e,t)=>(null!==e.t?e.t:Number.MAX_VALUE)-(null!==t.t?t.t:Number.MAX_VALUE)));for(const n of i){if(null==n.t)return null;const i=n.tile.dem.tree.raycast(n.minx,n.miny,n.maxx,n.maxy,e,t,r);if(null!=i)return i}return null}_createFBO(){const t=this.painter.context,r=t.gl,i=this.drapeBufferSize;t.activeTexture.set(r.TEXTURE0);const n=new e.T(t,{width:i[0],height:i[1],data:null},r.RGBA8);n.bind(r.LINEAR,r.CLAMP_TO_EDGE);const o=t.createFramebuffer(i[0],i[1],!0,null);return o.colorAttachment.set(n.texture),o.depthAttachment=new _n(t,o.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,i[0],i[1]),this._stencilRef=0,o.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):o.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:o,tex:n,dirty:!1}}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache)return!0;if(this._style.hasLightTransitions())return!0;for(const e in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[e].hasTransition())return!0;return this._style.order.some((e=>{const t=this._style._mergedLayers[e],r=t.isHidden(this.painter.transform.zoom);return"hillshade"===t.type||"custom"===t.type?!r&&t.shouldRedrape():!r&&t.hasTransition()}))}_clearLineLayersFromRenderCache(){let t=!1;for(const e of this._style.getSources())if(e instanceof Xe){t=!0;break}if(!t)return;const r={};for(let t=0;t<this._style.order.length;++t){const i=this._style._mergedLayers[this._style.order[t]],n=this._style.getLayerSourceCache(i);if(n&&!r[n.id]&&!i.isHidden(this.painter.transform.zoom)&&"line"===i.type&&i.widthExpression()instanceof e.a4){r[n.id]=!0;for(const e of this.proxyCoords){const t=this.proxyToSource[e.key][n.id];if(t)for(const e of t)this._clearRenderCacheForTile(n.id,e)}}}}_clearRasterLayersFromRenderCache(){let e=!1;for(const t in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[t]._source instanceof Ye){e=!0;break}if(!e)return;const t={};for(let e=0;e<this._style.order.length;++e){const r=this._style._mergedLayers[this._style.order[e]],i=this._style.getLayerSourceCache(r);if(!i||t[i.id])continue;if(r.isHidden(this.painter.transform.zoom)||"raster"!==r.type)continue;const n=r.paint.get("raster-fade-duration");for(const e of this.proxyCoords){const t=this.proxyToSource[e.key][i.id];if(t)for(const e of t){const t=En(i.getTile(e),i.findLoadedParent(e,0),i,this.painter.transform,n);(1!==t.opacity||0!==t.mix)&&this._clearRenderCacheForTile(i.id,e)}}}}_setupDrapedRenderBatches(){const t=this._style.order,r=t.length;if(0===r)return;const i=[];this._pendingGroundEffectLayers=[];let n,o=0,s=this._style._mergedLayers[t[o]];for(;!this._style.isLayerDraped(s)&&s.isHidden(this.painter.transform.zoom)&&++o<r;)s=this._style._mergedLayers[t[o]];for(;o<r;++o){const e=this._style._mergedLayers[t[o]];e.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(e)?void 0===n&&(n=o):("fill-extrusion"===e.type&&this._pendingGroundEffectLayers.push(o),void 0!==n&&(i.push({start:n,end:o-1}),n=void 0)))}if(void 0!==n&&i.push({start:n,end:o-1}),0!==i.length){const t=i[i.length-1];this._pendingGroundEffectLayers.every((e=>e>t.end))||e.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=i}_setupRenderCache(e){const t=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,t.renderCache.length>t.renderCachePool.length){const e=Object.values(t.proxyCachedFBO);t.proxyCachedFBO={};for(let r=0;r<e.length;++r){const i=Object.values(e[r]);t.renderCachePool.push(...i)}}return}this._clearRasterLayersFromRenderCache();const r=this.proxyCoords,i=this._tilesDirty;for(let n=r.length-1;n>=0;n--){const o=r[n];if(t.getTileByID(o.key),void 0!==t.proxyCachedFBO[o.key]){const r=e[o.key],n=this.proxyToSource[o.key];let s=0;for(const e in n){const t=n[e],o=r[e];if(!o||o.length!==t.length||t.some(((t,r)=>t!==o[r]||i[e]&&i[e].hasOwnProperty(t.key)))){s=-1;break}++s}for(const e in t.proxyCachedFBO[o.key])t.renderCache[t.proxyCachedFBO[o.key][e]].dirty=s<0||s!==Object.values(r).length}}const n=[...this._drapedRenderBatches];n.sort(((e,t)=>t.end-t.start-(e.end-e.start)));for(const e of n)for(const i of r){if(t.proxyCachedFBO[i.key])continue;let r=t.renderCachePool.pop();void 0===r&&t.renderCache.length<50&&(r=t.renderCache.length,t.renderCache.push(this._createFBO())),void 0!==r&&(t.proxyCachedFBO[i.key]={},t.proxyCachedFBO[i.key][e.start]=r,t.renderCache[r].dirty=!0)}this._tilesDirty={}}_setupStencil(e,t,r,i){if(!i||!this._sourceTilesOverlap[i.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const n=this.painter.context,o=n.gl;if(t.length<=1)return void(this._overlapStencilType=!1);let s;if(r.isTileClipped())s=t.length,this._overlapStencilMode.test={func:o.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(t[0].overscaledZ>t[t.length-1].overscaledZ))return void(this._overlapStencilType=!1);s=1,this._overlapStencilMode.test={func:o.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+s>255&&(n.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=s,this._overlapStencilMode.ref=this._stencilRef,r.isTileClipped()&&this._renderTileClippingMasks(t,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(e){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[e.key]),this._overlapStencilMode):zr.disabled}_renderTileClippingMasks(e,t){const r=this.painter,i=this.painter.context,n=i.gl;r._tileClippingMaskIDs={},i.setColorMode(Ir.disabled),i.setDepthMode(Pr.disabled);const o=r.getOrCreateProgram("clippingMask");for(const i of e){const e=r._tileClippingMaskIDs[i.key]=--t;o.draw(r,n.TRIANGLES,Pr.disabled,new zr({func:n.ALWAYS,mask:0},e,255,n.KEEP,n.KEEP,n.REPLACE),Ir.disabled,Or.disabled,Sn(i.projMatrix),"$clipping",r.tileExtentBuffer,r.quadTriangleIndexBuffer,r.tileExtentSegments)}}pointCoordinate(t){const r=this.painter.transform;if(t.x<0||t.x>r.width||t.y<0||t.y>r.height)return null;const i=[t.x,t.y,1,1];e.a6.vec4.transformMat4(i,i,r.pixelMatrixInverse),e.a6.vec4.scale(i,i,1/i[3]),i[0]/=r.worldSize,i[1]/=r.worldSize;const n=r._camera.position,o=e.bE(1,r.center.lat),s=[n[0],n[1],n[2]/o,0],a=e.a6.vec3.subtract([],i.slice(0,3),s);e.a6.vec3.normalize(a,a);const l=this.raycast(s,a,this._exaggeration);return null!==l&&l?(e.a6.vec3.scaleAndAdd(s,s,a,l),s[3]=s[2],s[2]*=o,s):null}_setupProxiedCoordsForOrtho(t,r,i){if(t.getSource()instanceof e.aD)return this._setupProxiedCoordsForImageSource(t,r,i);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const n=this.proxiedCoords[t.id]=[],o=this.proxyCoords;for(let e=0;e<o.length;e++){const r=o[e],s=this._findTileCoveringTileID(r,t);if(s){const e=this._createProxiedId(r,s,i[r.key]&&i[r.key][t.id]);n.push(e),this.proxyToSource[r.key][t.id]=[e]}}let s=!1;const a=new Set;for(let e=0;e<r.length;e++){const o=t.getTile(r[e]);if(!o||!o.hasData())continue;const l=this._findTileCoveringTileID(o.tileID,this.proxySourceCache);if(l&&l.tileID.canonical.z!==o.tileID.canonical.z){const e=this.proxyToSource[l.tileID.key][t.id],r=this._createProxiedId(l.tileID,o,i[l.tileID.key]&&i[l.tileID.key][t.id]);e?e.splice(e.length-1,0,r):this.proxyToSource[l.tileID.key][t.id]=[r];const c=this.proxyToSource[l.tileID.key][t.id];a.has(c)||a.add(c),n.push(r),s=!0}}if(this._sourceTilesOverlap[t.id]=s,s&&this._debugParams.sortTilesHiZFirst)for(const e of a)e.sort(((e,t)=>t.overscaledZ-e.overscaledZ))}_setupProxiedCoordsForImageSource(t,r,i){if(!t.getSource().loaded())return;const n=this.proxiedCoords[t.id]=[],o=this.proxyCoords,s=t.getSource(),a=s.tileID;if(!a)return;const l=new e.P(a.x,a.y)._div(1<<a.z),c=s.coordinates.map(e.a5.fromLngLat).reduce(((e,t)=>(e.min.x=Math.min(e.min.x,t.x-l.x),e.min.y=Math.min(e.min.y,t.y-l.y),e.max.x=Math.max(e.max.x,t.x-l.x),e.max.y=Math.max(e.max.y,t.y-l.y),e)),{min:new e.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new e.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),u=(t,r)=>{const i=t.wrap+t.canonical.x/(1<<t.canonical.z),n=t.canonical.y/(1<<t.canonical.z),o=e.ab/(1<<t.canonical.z),s=r.wrap+r.canonical.x/(1<<r.canonical.z),a=r.canonical.y/(1<<r.canonical.z);return i+o<s+c.min.x||i>s+c.max.x||n+o<a+c.min.y||n>a+c.max.y};for(let e=0;e<o.length;e++){const s=o[e];for(let e=0;e<r.length;e++){const o=t.getTile(r[e]);if(!o||!o.hasData())continue;if(u(s,o.tileID))continue;const a=this._createProxiedId(s,o,i[s.key]&&i[s.key][t.id]),l=this.proxyToSource[s.key][t.id];l?l.push(a):this.proxyToSource[s.key][t.id]=[a],n.push(a)}}}_createProxiedId(t,r,i){let n=this.orthoMatrix;if(i){const e=i.find((e=>e.key===r.tileID.key));if(e)return e}if(r.tileID.key!==t.key){const i=t.canonical.z-r.tileID.canonical.z;let o,s,a;n=e.a6.mat4.create();const l=r.tileID.wrap-t.wrap<<t.overscaledZ;i>0?(o=e.ab>>i,s=o*((r.tileID.canonical.x<<i)-t.canonical.x+l),a=o*((r.tileID.canonical.y<<i)-t.canonical.y)):(o=e.ab<<-i,s=e.ab*(r.tileID.canonical.x-(t.canonical.x+l<<-i)),a=e.ab*(r.tileID.canonical.y-(t.canonical.y<<-i))),e.a6.mat4.ortho(n,0,o,0,o,0,1),e.a6.mat4.translate(n,n,[s,a,0])}return new Cn(r.tileID,t.key,n)}_findTileCoveringTileID(t,r){let i=r.getTile(t);if(i&&i.hasData())return i;const n=this._findCoveringTileCache[r.id],o=n[t.key];if(i=o?r.getTileByID(o):null,i&&i.hasData()||null===o)return i;let s=i?i.tileID:t,a=s.overscaledZ;const l=r.getSource().minzoom,c=[];if(!o){const n=r.getSource().maxzoom;if(t.canonical.z>=n){const i=t.canonical.z-n;r.getSource().reparseOverscaled?(a=Math.max(t.canonical.z+2,r.transform.tileZoom),s=new e.aA(a,t.wrap,n,t.canonical.x>>i,t.canonical.y>>i)):0!==i&&(a=n,s=new e.aA(a,t.wrap,n,t.canonical.x>>i,t.canonical.y>>i))}s.key!==t.key&&(c.push(s.key),i=r.getTile(s))}const u=e=>{c.forEach((t=>{n[t]=e})),c.length=0};for(a-=1;a>=l&&(!i||!i.hasData());a--){i&&u(i.tileID.key);const e=s.calculateScaledKey(a);if(i=r.getTileByID(e),i&&i.hasData())break;const t=n[e];if(null===t)break;void 0===t?c.push(e):i=r.getTileByID(t)}return u(i?i.tileID.key:null),i&&i.hasData()?i:null}findDEMTileFor(e){return this.enabled?this._findTileCoveringTileID(e,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(e,t){let r=this._tilesDirty[e];r||(r=this._tilesDirty[e]={}),r[t.key]=!0}}function Pn(t,r,i){const n=function(t,r,i){const n=e.a6.vec3.dot(r,t),o=e.a6.vec3.dot(i,[.2126,.7152,.0722]),s=(e,t,r)=>(1-r)*e+r*t,a=s(1-.3*Math.min(o,1),1,Math.min(n+1,1));return s(.92,1,Math.asin(e.ap(r[2],-1,1))/Math.PI+.5)*a}(t,[0,0,1],r),o=[0,0,0];e.a6.vec3.scale(o,i.slice(0,3),n);const s=[0,0,0];e.a6.vec3.scale(s,r.slice(0,3),t[2]);const a=[0,0,0];return e.a6.vec3.add(a,o,s),e.cc(a)}const Rn=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],zn=["stars","rain_particle","snow_particle","fillExtrusion","fillExtrusionGroundEffect","model","symbol"];class Dn{static cacheKey(e,t,r,i){let n=`${t}${i?i.cacheKey:""}`;for(const t of r)e.usedDefines.includes(t)&&(n+=`/${t}`);return n}constructor(t,r,i,n,o,s){const a=t.gl;this.program=a.createProgram(),this.configuration=n,this.name=r,this.fixedDefines=[...s];const l=n?n.getBinderAttributes():[],c=(i.staticAttributes||[]).concat(l);let u=n?n.defines():[];u=u.concat(s.map((e=>`#define ${e}`)));const h="#version 300 es\n";let d=h+u.concat("precision mediump float;",Si,Ti.fragmentSource).join("\n");for(const e of i.fragmentIncludes)d+=`\n${bi[e]}`;d+=`\n${i.fragmentSource}`;let p=h+u.concat("precision highp float;",Si,Ti.vertexSource).join("\n");for(const e of i.vertexIncludes)p+=`\n${bi[e]}`;p+=`\n${i.vertexSource}`;const f=a.createShader(a.FRAGMENT_SHADER);if(a.isContextLost())return void(this.failedToCreate=!0);a.shaderSource(f,d),a.compileShader(f),a.attachShader(this.program,f);const m=a.createShader(a.VERTEX_SHADER);if(a.isContextLost())this.failedToCreate=!0;else{a.shaderSource(m,p),a.compileShader(m),a.attachShader(this.program,m),this.attributes={},this.numAttributes=c.length;for(let e=0;e<this.numAttributes;e++)if(c[e]){const t=c[e].startsWith("a_")?c[e]:`a_${c[e]}`;a.bindAttribLocation(this.program,e,t),this.attributes[t]=e}a.linkProgram(this.program),a.deleteShader(m),a.deleteShader(f),this.fixedUniforms=o(t),this.binderUniforms=n?n.getUniforms(t):[],(s.includes("TERRAIN")||-1!==r.indexOf("symbol")||-1!==r.indexOf("circle"))&&(this.terrainUniforms=(t=>({u_dem:new e.bK(t),u_dem_prev:new e.bK(t),u_dem_tl:new e.bH(t),u_dem_scale:new e.bJ(t),u_dem_tl_prev:new e.bH(t),u_dem_scale_prev:new e.bJ(t),u_dem_size:new e.bJ(t),u_dem_lerp:new e.bJ(t),u_exaggeration:new e.bJ(t),u_depth:new e.bK(t),u_depth_size_inv:new e.bH(t),u_depth_range_unpack:new e.bH(t),u_occluder_half_size:new e.bJ(t),u_occlusion_depth_offset:new e.bJ(t),u_meter_to_dem:new e.bJ(t),u_label_plane_matrix_inv:new e.bG(t)}))(t)),s.includes("GLOBE")&&(this.globeUniforms=(t=>({u_tile_tl_up:new e.bI(t),u_tile_tr_up:new e.bI(t),u_tile_br_up:new e.bI(t),u_tile_bl_up:new e.bI(t),u_tile_up_scale:new e.bJ(t)}))(t)),s.includes("FOG")&&(this.fogUniforms=(t=>({u_fog_matrix:new e.bG(t),u_fog_range:new e.bH(t),u_fog_color:new e.c7(t),u_fog_horizon_blend:new e.bJ(t),u_fog_vertical_limit:new e.bH(t),u_fog_temporal_offset:new e.bJ(t),u_frustum_tl:new e.bI(t),u_frustum_tr:new e.bI(t),u_frustum_br:new e.bI(t),u_frustum_bl:new e.bI(t),u_globe_pos:new e.bI(t),u_globe_radius:new e.bJ(t),u_globe_transition:new e.bJ(t),u_is_globe:new e.bK(t),u_viewport:new e.bH(t)}))(t)),s.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(t=>({u_cutoff_params:new e.c7(t)}))(t)),s.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(t=>({u_lighting_ambient_color:new e.bI(t),u_lighting_directional_dir:new e.bI(t),u_lighting_directional_color:new e.bI(t),u_ground_radiance:new e.bI(t)}))(t)),s.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(t=>({u_light_matrix_0:new e.bG(t),u_light_matrix_1:new e.bG(t),u_fade_range:new e.bH(t),u_shadow_normal_offset:new e.bI(t),u_shadow_intensity:new e.bJ(t),u_shadow_texel_size:new e.bJ(t),u_shadow_map_resolution:new e.bJ(t),u_shadow_direction:new e.bI(t),u_shadow_bias:new e.bI(t),u_shadowmap_0:new e.bK(t),u_shadowmap_1:new e.bK(t)}))(t))}}setTerrainUniformValues(e,t){if(!this.terrainUniforms)return;const r=this.terrainUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)r[e]&&r[e].set(this.program,e,t[e])}}setGlobeUniformValues(e,t){if(!this.globeUniforms)return;const r=this.globeUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)r[e]&&r[e].set(this.program,e,t[e])}}setFogUniformValues(e,t){if(!this.fogUniforms)return;const r=this.fogUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)r[e].set(this.program,e,t[e])}}setCutoffUniformValues(e,t){if(!this.cutoffUniforms)return;const r=this.cutoffUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)r[e].set(this.program,e,t[e])}}setLightsUniformValues(e,t){if(!this.lightsUniforms)return;const r=this.lightsUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)r[e].set(this.program,e,t[e])}}setShadowUniformValues(e,t){if(this.failedToCreate||!this.shadowUniforms)return;const r=this.shadowUniforms;e.program.set(this.program);for(const e in t)r[e].set(this.program,e,t[e])}_drawDebugWireframe(t,r,i,n,o,s,a,l,c,u){const h=t.options.wireframe;if(!1===h.terrain&&!1===h.layers2D&&!1===h.layers3D)return;const d=t.context;if(!(()=>!(!h.terrain||"terrainRaster"!==this.name&&"globeRaster"!==this.name)||!(!h.layers2D||t._terrain&&t._terrain.renderingToTexture||!Rn.includes(this.name))||!(!h.layers3D||!zn.includes(this.name)))())return;const p=d.gl,f=t.wireframeDebugCache.getLinesFromTrianglesBuffer(t.frameCounter,o,d);if(!f)return;const m=[...this.fixedDefines];m.push("DEBUG_WIREFRAME");const _=t.getOrCreateProgram(this.name,{config:this.configuration,defines:m});d.program.set(_.program);const g=(e,t,r)=>{if(t[e]&&r[e])for(const i in t[e])r[e][i]&&r[e][i].set(r.program,i,t[e][i].current)};c&&c.setUniforms(_.program,d,_.binderUniforms,a,{zoom:l}),g("fixedUniforms",this,_),g("terrainUniforms",this,_),g("globeUniforms",this,_),g("fogUniforms",this,_),g("lightsUniforms",this,_),g("shadowUniforms",this,_),f.bind(),d.setColorMode(new Ir([p.ONE,p.ONE_MINUS_SRC_ALPHA,p.ZERO,p.ONE],e.bA.transparent,[!0,!0,!0,!1])),d.setDepthMode(new Pr(r.func===p.LESS?p.LEQUAL:r.func,Pr.ReadOnly,r.range)),d.setStencilMode(zr.disabled);const y=3*s.primitiveLength*2,x=3*s.primitiveOffset*2*2;u&&u>1?p.drawElementsInstanced(p.LINES,y,p.UNSIGNED_SHORT,x,u):p.drawElements(p.LINES,y,p.UNSIGNED_SHORT,x),o.bind(),d.program.set(this.program),d.setDepthMode(r),d.setStencilMode(i),d.setColorMode(n)}checkUniforms(e,t,r){if(this.fixedDefines.includes(t))for(const i of Object.keys(r))if(!r[i].initialized)throw new Error(`Program '${this.name}', from draw '${e}': uniform ${i} not set but required by ${t} being defined`)}draw(e,t,r,i,n,o,s,a,l,c,u,h,d,p,f,m){const _=e.context,g=_.gl;if(this.failedToCreate)return;_.program.set(this.program),_.setDepthMode(r),_.setStencilMode(i),_.setColorMode(n),_.setCullFace(o);for(const e of Object.keys(this.fixedUniforms))this.fixedUniforms[e].set(this.program,e,s[e]);p&&p.setUniforms(this.program,_,this.binderUniforms,h,{zoom:d});const y={[g.POINTS]:1,[g.LINES]:2,[g.TRIANGLES]:3,[g.LINE_STRIP]:1}[t];this.checkUniforms(a,"RENDER_SHADOWS",this.shadowUniforms);const x=m&&m>0?1:void 0;for(const o of u.get()){const s=o.vaos||(o.vaos={});(s[a]||(s[a]=new Ci)).bind(_,this,l,p?p.getPaintVertexBuffers():[],c,o.vertexOffset,f||[],x),m&&m>1?g.drawElementsInstanced(t,o.primitiveLength*y,g.UNSIGNED_SHORT,o.primitiveOffset*y*2,m):c?g.drawElements(t,o.primitiveLength*y,g.UNSIGNED_SHORT,o.primitiveOffset*y*2):g.drawArrays(t,o.vertexOffset,o.vertexLength),t===g.TRIANGLES&&c&&this._drawDebugWireframe(e,r,i,n,c,o,h,d,p,m)}}}function kn(t,r){const i=Math.pow(2,r.tileID.overscaledZ),n=r.tileSize*Math.pow(2,t.transform.tileZoom)/i,o=n*(r.tileID.canonical.x+r.tileID.wrap*i),s=n*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture?r.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/e.ak(r,1,t.transform.tileZoom),u_pixel_coord_upper:[o>>16,s>>16],u_pixel_coord_lower:[65535&o,65535&s]}}const On={terrain:0,flat:1},Ln=e.a6.mat4.create(),Bn=(t,r,i,n,o,s,a,l,c,u,h,d,p,f,m,_,g,y)=>{const x=r.style.light,v=x.properties.get("position"),b=[v.x,v.y,v.z],w=e.a6.mat3.create();"viewport"===x.properties.get("anchor")&&(e.a6.mat3.fromRotation(w,-r.transform.angle),e.a6.vec3.transformMat3(b,b,w));const T=x.properties.get("color"),S=r.transform,E={u_matrix:t,u_lightpos:b,u_lightintensity:x.properties.get("intensity"),u_lightcolor:[T.r,T.g,T.b],u_vertical_gradient:+i,u_opacity:n,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Ln,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:On[u],u_base_type:On[h],u_ao:o,u_edge_radius:s,u_width_scale:a,u_flood_light_color:m,u_vertical_scale:_,u_flood_light_intensity:g,u_ground_shadow_factor:y};return"globe"===S.projection.name&&(E.u_tile_id=[l.canonical.x,l.canonical.y,1<<l.canonical.z],E.u_zoom_transition=d,E.u_inv_rot_matrix=f,E.u_merc_center=p,E.u_up_dir=S.projection.upVector(new e.bQ(0,0,0),p[0]*e.ab,p[1]*e.ab),E.u_height_lift=c),E},Fn=(e,t,r,i,n,o)=>({u_matrix:e,u_edge_radius:t,u_width_scale:r,u_vertical_scale:i,u_height_type:On[n],u_base_type:On[o]}),Nn=(t,r,i,n,o,s,a,l,c,u,h,d,p,f,m,_,g)=>{const y=Bn(t,r,i,n,o,s,a,l,u,h,d,p,f,m,_,g,1,[0,0,0]),x={u_height_factor:-Math.pow(2,l.overscaledZ)/c.tileSize/8};return e.l(y,kn(r,c),x)},Vn=(e,t)=>({u_matrix:e,u_emissive_strength:t}),jn=(t,r,i,n)=>e.l(Vn(t,r),kn(i,n)),Un=(e,t,r)=>({u_matrix:e,u_world:r,u_emissive_strength:t}),$n=(t,r,i,n,o)=>e.l(jn(t,r,i,n),{u_world:o}),Gn=(t,r,i,n)=>{const o=e.ab/i.tileSize;return{u_matrix:t,u_camera_to_center_distance:r.getCameraToCenterDistance(n),u_extrude_scale:[r.pixelsToGLUnits[0]/o,r.pixelsToGLUnits[1]/o]}},qn=(e,t,r=1)=>({u_matrix:e,u_color:t.toRenderColor(null),u_overlay:0,u_overlay_scale:r}),Hn=e.a6.mat4.create(),Wn=(t,r,i,n,o,s,a)=>{const l=t.transform,c="globe"===l.projection.name,u=c?e.cI(l.zoom,r.canonical)*l._pixelsPerMercatorPixel:e.ak(i,1,s),h={u_matrix:r.projMatrix,u_extrude_scale:u,u_intensity:a,u_inv_rot_matrix:Hn,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(c){h.u_inv_rot_matrix=n,h.u_merc_center=o,h.u_tile_id=[r.canonical.x,r.canonical.y,1<<r.canonical.z],h.u_zoom_transition=e.a9(l.zoom);const t=o[0]*e.ab,i=o[1]*e.ab;h.u_up_dir=l.projection.upVector(new e.bQ(0,0,0),t,i)}return h};function Zn(e,[t,r,i,n],[o,s]){if(o===s)return[0,0,0,0];const a=255*(e-1)/(e*(s-o));return[t*a,r*a,i*a,n*a]}function Xn(e,t,[r,i]){return r===i?0:.5/e+(t-r)*(e-1)/(e*(i-r))}const Yn=(t,r,i,n,o,s,a,l,c,u,h,d,p,f,m,_,g,y,x,v,b)=>({u_matrix:t,u_normalize_matrix:r,u_globe_matrix:i,u_merc_matrix:n,u_grid_matrix:o,u_tl_parent:s,u_scale_parent:u,u_fade_t:h.mix,u_opacity:h.opacity*d.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:d.paint.get("raster-brightness-min"),u_brightness_high:d.paint.get("raster-brightness-max"),u_saturation_factor:e.cJ(d.paint.get("raster-saturation")),u_contrast_factor:e.cK(d.paint.get("raster-contrast")),u_spin_weights:Jn(d.paint.get("raster-hue-rotate")),u_perspective_transform:p,u_raster_elevation:f,u_zoom_transition:a,u_merc_center:l,u_cutoff_params:c,u_colorization_mix:Zn(e.cL,_,y),u_colorization_offset:Xn(e.cL,g,y),u_color_ramp:m,u_texture_offset:[v/(x+2*v),x/(x+2*v)],u_texture_res:[x+2*v,x+2*v],u_emissive_strength:b});function Jn(e){e*=Math.PI/180;const t=Math.sin(e),r=Math.cos(e);return[(2*r+1)/3,(-Math.sqrt(3)*t-r+1)/3,(Math.sqrt(3)*t-r+1)/3]}const Kn=.05,Qn=(e,t,r,i,n,o,s,a,l,c,u,h)=>({u_matrix:e,u_normalize_matrix:t,u_globe_matrix:r,u_merc_matrix:i,u_grid_matrix:n,u_tl_parent:o,u_scale_parent:c,u_fade_t:u.mix,u_opacity:u.opacity,u_image0:0,u_image1:1,u_raster_elevation:h,u_zoom_transition:s,u_merc_center:a,u_cutoff_params:l}),eo=(e,t,r,i,n,o,s,a,l,c)=>({u_particle_texture:e,u_particle_texture_side_len:t,u_tile_offset:r,u_velocity:i,u_color_ramp:o,u_velocity_res:n,u_max_speed:s,u_uv_offset:a,u_data_scale:[255*l[0],255*l[1]],u_data_offset:c,u_particle_pos_scale:1.1,u_particle_pos_offset:[Kn,Kn]}),to=(e,t,r,i,n,o,s,a,l,c)=>({u_particle_texture:e,u_particle_texture_side_len:t,u_velocity:r,u_velocity_res:i,u_max_speed:n,u_speed_factor:o,u_reset_rate:s,u_rand_seed:Math.random(),u_uv_offset:a,u_data_scale:[255*l[0],255*l[1]],u_data_offset:c,u_particle_pos_scale:1.1,u_particle_pos_offset:[Kn,Kn]}),ro=e.a6.mat4.create(),io=(t,r,i,n,o,s,a,l,c,u,h,d,p,f,m,_,g,y,x,v,b,w)=>{const T=o.transform,S={u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_camera_to_center_distance:T.getCameraToCenterDistance(x),u_rotate_symbol:+i,u_aspect_ratio:T.width/T.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_matrix:s,u_label_plane_matrix:a,u_coord_matrix:l,u_is_text:+u,u_elevation_from_sea:c?1:0,u_pitch_with_map:+n,u_texsize:h,u_texsize_icon:d,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:ro,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:ro,u_up_vector:[0,-1,0],u_color_adj_mat:v,u_icon_transition:b||0,u_gamma_scale:n?o.transform.getCameraToCenterDistance(x)*Math.cos(o.terrain?0:o.transform._pitch):1,u_device_pixel_ratio:e.q.devicePixelRatio,u_is_halo:+p,u_scale_factor:w||1};return"globe"===x.name&&(S.u_tile_id=[f.canonical.x,f.canonical.y,1<<f.canonical.z],S.u_zoom_transition=m,S.u_inv_rot_matrix=g,S.u_merc_center=_,S.u_camera_forward=T._camera.forward(),S.u_ecef_origin=e.cM(T.globeMatrix,f.toUnwrapped()),S.u_tile_matrix=Float32Array.from(T.globeMatrix),S.u_up_vector=y),S},no=(e,t,r,i)=>({u_matrix:e,u_emissive_strength:t,u_opacity:r,u_color:i}),oo=(t,r,i,n,o,s,a,l,c)=>e.l(function(t,r,i,n,o,s){const{width:a,height:l}=n.imageManager.getPixelSize(r),c=Math.pow(2,s.tileID.overscaledZ),u=s.tileSize*Math.pow(2,n.transform.tileZoom)/c,h=u*(s.tileID.canonical.x+s.tileID.wrap*c),d=u*s.tileID.canonical.y;return{u_image:0,u_pattern_tl:i.tl,u_pattern_br:i.br,u_texsize:[a,l],u_pattern_size:i.displaySize,u_pattern_units_to_pixels:o?[n.transform.width,-1*n.transform.height]:[1/e.ak(s,1,n.transform.tileZoom),1/e.ak(s,1,n.transform.tileZoom)],u_pixel_coord_upper:[h>>16,d>>16],u_pixel_coord_lower:[65535&h,65535&d]}}(0,s,a,n,l,c),{u_matrix:t,u_emissive_strength:r,u_opacity:i}),so=new Float32Array(e.a6.mat4.identity([])),ao=(t,r,i,n,o,s,a,l,c,u,h,d,p,f=[0,0,0],m)=>{const _=o.style.light,g=_.properties.get("position"),y=[-g.x,-g.y,g.z],x=e.a6.mat3.create();"viewport"===_.properties.get("anchor")&&(e.a6.mat3.fromRotation(x,-o.transform.angle),e.a6.vec3.transformMat3(y,y,x));const v="MASK"===h.alphaMode,b=_.properties.get("color").toRenderColor(null),w=p.paint.get("model-ambient-occlusion-intensity"),T=p.paint.get("model-color").constantOr(e.bA.white).toRenderColor(null),S=p.paint.get("model-color-mix-intensity").constantOr(0);return{u_matrix:t,u_lighting_matrix:r,u_normal_matrix:i,u_node_matrix:n||so,u_lightpos:y,u_lightintensity:_.properties.get("intensity"),u_lightcolor:[b.r,b.g,b.b],u_camera_pos:f,u_opacity:s,u_baseTextureIsAlpha:0,u_alphaMask:+v,u_alphaCutoff:h.alphaCutoff,u_baseColorFactor:[a.r,a.g,a.b,a.a],u_emissiveFactor:[l[0],l[1],l[2],1],u_metallicFactor:c,u_roughnessFactor:u,u_baseColorTexture:jr.BaseColor,u_metallicRoughnessTexture:jr.MetallicRoughness,u_normalTexture:jr.Normal,u_occlusionTexture:jr.Occlusion,u_emissionTexture:jr.Emission,u_lutTexture:jr.LUT,u_color_mix:[T.r,T.g,T.b,S],u_aoIntensity:w,u_emissive_strength:d,u_occlusionTextureTransform:m||[0,0,0,0]}},lo=(e,t=so,r=so)=>({u_matrix:e,u_instance:t,u_node_matrix:r}),co={fillExtrusion:t=>({u_matrix:new e.bG(t),u_lightpos:new e.bI(t),u_lightintensity:new e.bJ(t),u_lightcolor:new e.bI(t),u_vertical_gradient:new e.bJ(t),u_opacity:new e.bJ(t),u_edge_radius:new e.bJ(t),u_width_scale:new e.bJ(t),u_ao:new e.bH(t),u_height_type:new e.bK(t),u_base_type:new e.bK(t),u_tile_id:new e.bI(t),u_zoom_transition:new e.bJ(t),u_inv_rot_matrix:new e.bG(t),u_merc_center:new e.bH(t),u_up_dir:new e.bI(t),u_height_lift:new e.bJ(t),u_flood_light_color:new e.bI(t),u_vertical_scale:new e.bJ(t),u_flood_light_intensity:new e.bJ(t),u_ground_shadow_factor:new e.bI(t)}),fillExtrusionDepth:t=>({u_matrix:new e.bG(t),u_edge_radius:new e.bJ(t),u_width_scale:new e.bJ(t),u_vertical_scale:new e.bJ(t),u_height_type:new e.bK(t),u_base_type:new e.bK(t)}),fillExtrusionPattern:t=>({u_matrix:new e.bG(t),u_lightpos:new e.bI(t),u_lightintensity:new e.bJ(t),u_lightcolor:new e.bI(t),u_vertical_gradient:new e.bJ(t),u_height_factor:new e.bJ(t),u_edge_radius:new e.bJ(t),u_width_scale:new e.bJ(t),u_ao:new e.bH(t),u_height_type:new e.bK(t),u_base_type:new e.bK(t),u_tile_id:new e.bI(t),u_zoom_transition:new e.bJ(t),u_inv_rot_matrix:new e.bG(t),u_merc_center:new e.bH(t),u_up_dir:new e.bI(t),u_height_lift:new e.bJ(t),u_image:new e.bK(t),u_texsize:new e.bH(t),u_pixel_coord_upper:new e.bH(t),u_pixel_coord_lower:new e.bH(t),u_tile_units_to_pixels:new e.bJ(t),u_opacity:new e.bJ(t)}),fillExtrusionGroundEffect:t=>({u_matrix:new e.bG(t),u_opacity:new e.bJ(t),u_ao_pass:new e.bJ(t),u_meter_to_tile:new e.bJ(t),u_ao:new e.bH(t),u_flood_light_intensity:new e.bJ(t),u_flood_light_color:new e.bI(t),u_attenuation:new e.bJ(t),u_edge_radius:new e.bJ(t),u_fb:new e.bK(t),u_fb_size:new e.bJ(t),u_dynamic_offset:new e.bJ(t)}),fill:t=>({u_matrix:new e.bG(t),u_emissive_strength:new e.bJ(t)}),fillPattern:t=>({u_matrix:new e.bG(t),u_emissive_strength:new e.bJ(t),u_image:new e.bK(t),u_texsize:new e.bH(t),u_pixel_coord_upper:new e.bH(t),u_pixel_coord_lower:new e.bH(t),u_tile_units_to_pixels:new e.bJ(t)}),fillOutline:t=>({u_matrix:new e.bG(t),u_emissive_strength:new e.bJ(t),u_world:new e.bH(t)}),fillOutlinePattern:t=>({u_matrix:new e.bG(t),u_emissive_strength:new e.bJ(t),u_world:new e.bH(t),u_image:new e.bK(t),u_texsize:new e.bH(t),u_pixel_coord_upper:new e.bH(t),u_pixel_coord_lower:new e.bH(t),u_tile_units_to_pixels:new e.bJ(t)}),circle:e.cN,collisionBox:t=>({u_matrix:new e.bG(t),u_camera_to_center_distance:new e.bJ(t),u_extrude_scale:new e.bH(t)}),collisionCircle:t=>({u_matrix:new e.bG(t),u_inv_matrix:new e.bG(t),u_camera_to_center_distance:new e.bJ(t),u_viewport_size:new e.bH(t)}),debug:t=>({u_color:new e.cu(t),u_matrix:new e.bG(t),u_overlay:new e.bK(t),u_overlay_scale:new e.bJ(t)}),clippingMask:t=>({u_matrix:new e.bG(t)}),heatmap:t=>({u_extrude_scale:new e.bJ(t),u_intensity:new e.bJ(t),u_matrix:new e.bG(t),u_inv_rot_matrix:new e.bG(t),u_merc_center:new e.bH(t),u_tile_id:new e.bI(t),u_zoom_transition:new e.bJ(t),u_up_dir:new e.bI(t)}),heatmapTexture:t=>({u_image:new e.bK(t),u_color_ramp:new e.bK(t),u_opacity:new e.bJ(t)}),hillshade:t=>({u_matrix:new e.bG(t),u_image:new e.bK(t),u_latrange:new e.bH(t),u_light:new e.bH(t),u_shadow:new e.cu(t),u_highlight:new e.cu(t),u_emissive_strength:new e.bJ(t),u_accent:new e.cu(t)}),hillshadePrepare:t=>({u_matrix:new e.bG(t),u_image:new e.bK(t),u_dimension:new e.bH(t),u_zoom:new e.bJ(t)}),line:e.cO,linePattern:e.cP,raster:t=>({u_matrix:new e.bG(t),u_normalize_matrix:new e.bG(t),u_globe_matrix:new e.bG(t),u_merc_matrix:new e.bG(t),u_grid_matrix:new e.cv(t),u_tl_parent:new e.bH(t),u_scale_parent:new e.bJ(t),u_fade_t:new e.bJ(t),u_opacity:new e.bJ(t),u_image0:new e.bK(t),u_image1:new e.bK(t),u_brightness_low:new e.bJ(t),u_brightness_high:new e.bJ(t),u_saturation_factor:new e.bJ(t),u_contrast_factor:new e.bJ(t),u_spin_weights:new e.bI(t),u_perspective_transform:new e.bH(t),u_raster_elevation:new e.bJ(t),u_zoom_transition:new e.bJ(t),u_merc_center:new e.bH(t),u_cutoff_params:new e.c7(t),u_colorization_mix:new e.c7(t),u_colorization_offset:new e.bJ(t),u_color_ramp:new e.bK(t),u_texture_offset:new e.bH(t),u_texture_res:new e.bH(t),u_emissive_strength:new e.bJ(t)}),rasterParticle:t=>({u_matrix:new e.bG(t),u_normalize_matrix:new e.bG(t),u_globe_matrix:new e.bG(t),u_merc_matrix:new e.bG(t),u_grid_matrix:new e.cv(t),u_tl_parent:new e.bH(t),u_scale_parent:new e.bJ(t),u_fade_t:new e.bJ(t),u_opacity:new e.bJ(t),u_image0:new e.bK(t),u_image1:new e.bK(t),u_raster_elevation:new e.bJ(t),u_zoom_transition:new e.bJ(t),u_merc_center:new e.bH(t),u_cutoff_params:new e.c7(t)}),rasterParticleTexture:t=>({u_texture:new e.bK(t),u_opacity:new e.bJ(t)}),rasterParticleDraw:t=>({u_particle_texture:new e.bK(t),u_particle_texture_side_len:new e.bJ(t),u_tile_offset:new e.bH(t),u_velocity:new e.bK(t),u_color_ramp:new e.bK(t),u_velocity_res:new e.bH(t),u_max_speed:new e.bJ(t),u_uv_offset:new e.bH(t),u_data_scale:new e.bH(t),u_data_offset:new e.bJ(t),u_particle_pos_scale:new e.bJ(t),u_particle_pos_offset:new e.bH(t)}),rasterParticleUpdate:t=>({u_particle_texture:new e.bK(t),u_particle_texture_side_len:new e.bJ(t),u_velocity:new e.bK(t),u_velocity_res:new e.bH(t),u_max_speed:new e.bJ(t),u_speed_factor:new e.bJ(t),u_reset_rate:new e.bJ(t),u_rand_seed:new e.bJ(t),u_uv_offset:new e.bH(t),u_data_scale:new e.bH(t),u_data_offset:new e.bJ(t),u_particle_pos_scale:new e.bJ(t),u_particle_pos_offset:new e.bH(t)}),symbol:t=>({u_is_size_zoom_constant:new e.bK(t),u_is_size_feature_constant:new e.bK(t),u_size_t:new e.bJ(t),u_size:new e.bJ(t),u_camera_to_center_distance:new e.bJ(t),u_rotate_symbol:new e.bK(t),u_aspect_ratio:new e.bJ(t),u_fade_change:new e.bJ(t),u_matrix:new e.bG(t),u_label_plane_matrix:new e.bG(t),u_coord_matrix:new e.bG(t),u_is_text:new e.bK(t),u_elevation_from_sea:new e.bK(t),u_pitch_with_map:new e.bK(t),u_texsize:new e.bH(t),u_texsize_icon:new e.bH(t),u_texture:new e.bK(t),u_texture_icon:new e.bK(t),u_gamma_scale:new e.bJ(t),u_device_pixel_ratio:new e.bJ(t),u_tile_id:new e.bI(t),u_zoom_transition:new e.bJ(t),u_inv_rot_matrix:new e.bG(t),u_merc_center:new e.bH(t),u_camera_forward:new e.bI(t),u_tile_matrix:new e.bG(t),u_up_vector:new e.bI(t),u_ecef_origin:new e.bI(t),u_is_halo:new e.bK(t),u_icon_transition:new e.bJ(t),u_color_adj_mat:new e.bG(t),u_scale_factor:new e.bJ(t)}),background:t=>({u_matrix:new e.bG(t),u_emissive_strength:new e.bJ(t),u_opacity:new e.bJ(t),u_color:new e.cu(t)}),backgroundPattern:t=>({u_matrix:new e.bG(t),u_emissive_strength:new e.bJ(t),u_opacity:new e.bJ(t),u_image:new e.bK(t),u_pattern_tl:new e.bH(t),u_pattern_br:new e.bH(t),u_texsize:new e.bH(t),u_pattern_size:new e.bH(t),u_pixel_coord_upper:new e.bH(t),u_pixel_coord_lower:new e.bH(t),u_pattern_units_to_pixels:new e.bH(t)}),terrainRaster:t=>({u_matrix:new e.bG(t),u_image0:new e.bK(t),u_skirt_height:new e.bJ(t),u_ground_shadow_factor:new e.bI(t)}),skybox:t=>({u_matrix:new e.bG(t),u_sun_direction:new e.bI(t),u_cubemap:new e.bK(t),u_opacity:new e.bJ(t),u_temporal_offset:new e.bJ(t)}),skyboxGradient:t=>({u_matrix:new e.bG(t),u_color_ramp:new e.bK(t),u_center_direction:new e.bI(t),u_radius:new e.bJ(t),u_opacity:new e.bJ(t),u_temporal_offset:new e.bJ(t)}),skyboxCapture:t=>({u_matrix_3f:new e.cv(t),u_sun_direction:new e.bI(t),u_sun_intensity:new e.bJ(t),u_color_tint_r:new e.c7(t),u_color_tint_m:new e.c7(t),u_luminance:new e.bJ(t)}),globeRaster:t=>({u_proj_matrix:new e.bG(t),u_globe_matrix:new e.bG(t),u_normalize_matrix:new e.bG(t),u_merc_matrix:new e.bG(t),u_zoom_transition:new e.bJ(t),u_merc_center:new e.bH(t),u_image0:new e.bK(t),u_grid_matrix:new e.cv(t),u_skirt_height:new e.bJ(t),u_far_z_cutoff:new e.bJ(t),u_frustum_tl:new e.bI(t),u_frustum_tr:new e.bI(t),u_frustum_br:new e.bI(t),u_frustum_bl:new e.bI(t),u_globe_pos:new e.bI(t),u_globe_radius:new e.bJ(t),u_viewport:new e.bH(t)}),globeAtmosphere:t=>({u_frustum_tl:new e.bI(t),u_frustum_tr:new e.bI(t),u_frustum_br:new e.bI(t),u_frustum_bl:new e.bI(t),u_horizon:new e.bJ(t),u_transition:new e.bJ(t),u_fadeout_range:new e.bJ(t),u_color:new e.c7(t),u_high_color:new e.c7(t),u_space_color:new e.c7(t),u_temporal_offset:new e.bJ(t),u_horizon_angle:new e.bJ(t)}),model:t=>({u_matrix:new e.bG(t),u_lighting_matrix:new e.bG(t),u_normal_matrix:new e.bG(t),u_node_matrix:new e.bG(t),u_lightpos:new e.bI(t),u_lightintensity:new e.bJ(t),u_lightcolor:new e.bI(t),u_camera_pos:new e.bI(t),u_opacity:new e.bJ(t),u_baseColorFactor:new e.c7(t),u_emissiveFactor:new e.c7(t),u_metallicFactor:new e.bJ(t),u_roughnessFactor:new e.bJ(t),u_baseTextureIsAlpha:new e.bK(t),u_alphaMask:new e.bK(t),u_alphaCutoff:new e.bJ(t),u_baseColorTexture:new e.bK(t),u_metallicRoughnessTexture:new e.bK(t),u_normalTexture:new e.bK(t),u_occlusionTexture:new e.bK(t),u_emissionTexture:new e.bK(t),u_lutTexture:new e.bK(t),u_color_mix:new e.c7(t),u_aoIntensity:new e.bJ(t),u_emissive_strength:new e.bJ(t),u_occlusionTextureTransform:new e.c7(t)}),modelDepth:t=>({u_matrix:new e.bG(t),u_instance:new e.bG(t),u_node_matrix:new e.bG(t)}),groundShadow:t=>({u_matrix:new e.bG(t),u_ground_shadow_factor:new e.bI(t)}),stars:t=>({u_matrix:new e.bG(t),u_up:new e.bI(t),u_right:new e.bI(t),u_intensity_multiplier:new e.bJ(t)}),snowParticle:t=>({u_modelview:new e.bG(t),u_projection:new e.bG(t),u_time:new e.bJ(t),u_cam_pos:new e.bI(t),u_velocityConeAperture:new e.bJ(t),u_velocity:new e.bJ(t),u_horizontalOscillationRadius:new e.bJ(t),u_horizontalOscillationRate:new e.bJ(t),u_boxSize:new e.bJ(t),u_billboardSize:new e.bJ(t),u_simpleShapeParameters:new e.bH(t),u_screenSize:new e.bH(t),u_thinningCenterPos:new e.bH(t),u_thinningShape:new e.bI(t),u_thinningAffectedRatio:new e.bJ(t),u_thinningParticleOffset:new e.bJ(t),u_particleColor:new e.c7(t),u_direction:new e.bI(t)}),rainParticle:t=>({u_modelview:new e.bG(t),u_projection:new e.bG(t),u_time:new e.bJ(t),u_cam_pos:new e.bI(t),u_texScreen:new e.bK(t),u_velocityConeAperture:new e.bJ(t),u_velocity:new e.bJ(t),u_boxSize:new e.bJ(t),u_rainDropletSize:new e.bH(t),u_distortionStrength:new e.bJ(t),u_rainDirection:new e.bI(t),u_color:new e.c7(t),u_screenSize:new e.bH(t),u_thinningCenterPos:new e.bH(t),u_thinningShape:new e.bI(t),u_thinningAffectedRatio:new e.bJ(t),u_thinningParticleOffset:new e.bJ(t),u_shapeDirectionalPower:new e.bJ(t),u_mode:new e.bJ(t)}),occlusion:t=>({u_matrix:new e.bG(t),u_anchorPos:new e.bI(t),u_screenSizePx:new e.bH(t),u_occluderSizePx:new e.bH(t),u_color:new e.c7(t)})};class uo{constructor(e,t,r,i){this.id=uo.uniqueIdxCounter,uo.uniqueIdxCounter++,this.context=e;const n=e.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(r),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||i||t.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){this.id=uo.uniqueIdxCounter,uo.uniqueIdxCounter++;const t=this.context.gl;this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}uo.uniqueIdxCounter=0;const ho={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class po{constructor(e,t,r,i,n,o){this.length=t.length,this.attributes=r,this.itemSize=t.bytesPerElement,this.dynamicDraw=i,this.instanceCount=o,this.context=e;const s=e.gl;this.buffer=s.createBuffer(),e.bindVertexBuffer.set(this.buffer),s.bufferData(s.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?s.DYNAMIC_DRAW:s.STATIC_DRAW),this.dynamicDraw||n||t.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){const t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let r=0;r<this.attributes.length;r++){const i=t.attributes[this.attributes[r].name];void 0!==i&&e.enableVertexAttribArray(i)}}setVertexAttribPointers(e,t,r){for(let i=0;i<this.attributes.length;i++){const n=this.attributes[i],o=t.attributes[n.name];void 0!==o&&e.vertexAttribPointer(o,n.components,e[ho[n.type]],!1,this.itemSize,n.offset+this.itemSize*(r||0))}}setVertexAttribDivisor(e,t,r){for(let i=0;i<this.attributes.length;i++){const n=t.attributes[this.attributes[i].name];void 0!==n&&this.instanceCount&&this.instanceCount>0&&e.vertexAttribDivisor(n,r)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class fo{constructor(e,t,r,i,n){this.context=e,this.width=t,this.height=r;const o=this.framebuffer=e.gl.createFramebuffer();i&&(this.colorAttachment=new pn(e,o)),n&&(this.depthAttachmentType=n,this.depthAttachment="renderbuffer"===n?new fn(e,o):new mn(e,o))}destroy(){const e=this.context.gl;if(this.colorAttachment){const t=this.colorAttachment.get();t&&e.deleteTexture(t)}if(this.depthAttachment&&this.depthAttachmentType)if("renderbuffer"===this.depthAttachmentType){const t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}else{const t=this.depthAttachment.get();t&&e.deleteTexture(t)}e.deleteFramebuffer(this.framebuffer)}}class mo{constructor(e,t){this.gl=e,this.clearColor=new ki(this),this.clearDepth=new Oi(this),this.clearStencil=new Li(this),this.colorMask=new Bi(this),this.depthMask=new Fi(this),this.stencilMask=new Ni(this),this.stencilFunc=new Vi(this),this.stencilOp=new ji(this),this.stencilTest=new Ui(this),this.depthRange=new $i(this),this.depthTest=new Gi(this),this.depthFunc=new qi(this),this.blend=new Hi(this),this.blendFunc=new Wi(this),this.blendColor=new Zi(this),this.blendEquation=new Xi(this),this.cullFace=new Yi(this),this.cullFaceSide=new Ji(this),this.frontFace=new Ki(this),this.program=new Qi(this),this.activeTexture=new en(this),this.viewport=new tn(this),this.bindFramebuffer=new rn(this),this.bindRenderbuffer=new nn(this),this.bindTexture=new on(this),this.bindVertexBuffer=new sn(this),this.bindElementBuffer=new an(this),this.bindVertexArrayOES=new ln(this),this.pixelStoreUnpack=new cn(this),this.pixelStoreUnpackPremultiplyAlpha=new un(this),this.pixelStoreUnpackFlipY=new hn(this),this.options=t?{...t}:{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=e.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=e.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=e.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=e.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=e.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=e.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),this.maxPointSize=e.getParameter(e.ALIASED_POINT_SIZE_RANGE)[1]}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,t,r){return new uo(this,e,t,r)}createVertexBuffer(e,t,r,i,n){return new po(this,e,t,r,i,n)}createRenderbuffer(e,t,r){const i=this.gl,n=i.createRenderbuffer();return this.bindRenderbuffer.set(n),i.renderbufferStorage(i.RENDERBUFFER,e,t,r),this.bindRenderbuffer.set(null),n}createFramebuffer(e,t,r,i){return new fo(this,e,t,r,i)}clear({color:e,depth:t,stencil:r,colorMask:i}){const n=this.gl;let o=0;e&&(o|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set(i||[!0,!0,!0,!0])),void 0!==t&&(o|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),void 0!==r&&(o|=n.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),n.clear(o)}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(t){e.bi(t.blendFunction,Ir.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor),t.blendEquation?this.blendEquation.set(t.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(t.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let _o;function go(t,r,i,n,o,s,a){const l=t.context,c=l.gl,u=t.transform,h=t.getOrCreateProgram("collisionBox"),d=[];let p=0,f=0;for(let l=0;l<n.length;l++){const m=n[l],_=r.getTile(m),g=_.getBucket(i);if(!g)continue;const y=er(m,g,u);let x=y;0===o[0]&&0===o[1]||(x=t.translatePosMatrix(y,_,o,s));const v=a?g.textCollisionBox:g.iconCollisionBox,b=g.collisionCircleArray;if(b.length>0){const t=e.a6.mat4.create(),r=x;e.a6.mat4.mul(t,g.placementInvProjMatrix,u.glCoordMatrix),e.a6.mat4.mul(t,t,g.placementViewportMatrix),d.push({circleArray:b,circleOffset:f,transform:r,invTransform:t,projection:g.getProjection()}),p+=b.length/4,f=p}v&&(t.terrain&&t.terrain.setupElevationDraw(_,h),h.draw(t,c.LINES,Pr.disabled,zr.disabled,t.colorModeForRenderPass(),Or.disabled,Gn(x,u,_,g.getProjection()),i.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,null,u.zoom,null,[v.collisionVertexBuffer,v.collisionVertexBufferExt]))}if(!a||!d.length)return;const m=t.getOrCreateProgram("collisionCircle"),_=new e.cQ;_.resize(4*p),_._trim();let g=0;for(const e of d)for(let t=0;t<e.circleArray.length/4;t++){const r=4*t,i=e.circleArray[r+0],n=e.circleArray[r+1],o=e.circleArray[r+2],s=e.circleArray[r+3];_.emplace(g++,i,n,o,s,0),_.emplace(g++,i,n,o,s,1),_.emplace(g++,i,n,o,s,2),_.emplace(g++,i,n,o,s,3)}(!_o||_o.length<2*p)&&(_o=function(t){const r=2*t,i=new e.aP;i.resize(r),i._trim();for(let e=0;e<r;e++){const t=6*e;i.uint16[t+0]=4*e+0,i.uint16[t+1]=4*e+1,i.uint16[t+2]=4*e+2,i.uint16[t+3]=4*e+2,i.uint16[t+4]=4*e+3,i.uint16[t+5]=4*e+0}return i}(p));const y=l.createIndexBuffer(_o,!0),x=l.createVertexBuffer(_,e.cR.members,!0);for(const r of d){const n={u_matrix:r.transform,u_inv_matrix:r.invTransform,u_camera_to_center_distance:(v=u).getCameraToCenterDistance(r.projection),u_viewport_size:[v.width,v.height]};m.draw(t,c.TRIANGLES,Pr.disabled,zr.disabled,t.colorModeForRenderPass(),Or.disabled,n,i.id,x,y,e.b2.simpleSegment(0,2*r.circleOffset,r.circleArray.length,r.circleArray.length/2),null,u.zoom)}var v;x.destroy(),y.destroy()}const yo=e.a6.mat4.create();function xo(t){const r=t._camera.getWorldToCamera(t.worldSize,1),i=e.a6.mat4.multiply([],r,t.globeMatrix);e.a6.mat4.invert(i,i);const n=[0,0,0],o=[0,1,0,0];return e.a6.vec4.transformMat4(o,o,i),n[0]=o[0],n[1]=o[1],n[2]=o[2],e.a6.vec3.normalize(n,n),n}function vo({width:t,height:r,anchor:i,textOffset:n,textScale:o},s){const{horizontalAlign:a,verticalAlign:l}=e.by(i),c=-(a-.5)*t,u=-(l-.5)*r,h=e.bx(i,n);return new e.P((c/o+h[0])*s,(u/o+h[1])*s)}function bo(t,r,i,n,o,s,a,l,c,u,h){const d=t.text.placedSymbolArray,p=t.text.dynamicLayoutVertexArray,f=t.icon.dynamicLayoutVertexArray,m={},_=t.getProjection(),g=tr(l,_,s),y=s.elevation,x=_.upVectorScale(l.canonical,s.center.lat,s.worldSize).metersToTile;p.clear();for(let f=0;f<d.length;f++){const v=d.get(f),{tileAnchorX:b,tileAnchorY:w,numGlyphs:T}=v,S=v.hidden||!v.crossTileID||t.allowVerticalPlacement&&!v.placedOrientation?null:n[v.crossTileID];if(S){let n=0,d=0,f=0;if(y){const e=y?y.getAtTileOffset(l,b,w):0,[t,r,i]=_.upVector(l.canonical,b,w);n=e*t*x,d=e*r*x,f=e*i*x}let[E,M,A,C]=Nt(v.projectedAnchorX+n,v.projectedAnchorY+d,v.projectedAnchorZ+f,i?g:a);const I=Vt(s.getCameraToCenterDistance(_),C);let P=o.evaluateSizeForFeature(t.textSizeData,u,v)*I/e.br;i&&(P*=t.tilePixelRatio/c);const R=vo(S,P);i?(({x:E,y:M,z:A}=_.projectTilePoint(b+R.x,w+R.y,l.canonical)),[E,M,A]=Nt(E+n,M+d,A+f,a)):(r&&R._rotate(-s.angle),E+=R.x,M+=R.y,A=0);const z=t.allowVerticalPlacement&&v.placedOrientation===e.bl.vertical?Math.PI/2:0;for(let t=0;t<T;t++)e.bo(p,E,M,A,z);h&&v.associatedIconIndex>=0&&(m[v.associatedIconIndex]={x:E,y:M,z:A,angle:z})}else Xt(T,p)}if(h){f.clear();const r=t.icon.placedSymbolArray;for(let t=0;t<r.length;t++){const i=r.get(t),{numGlyphs:n}=i,o=m[t];if(i.hidden||!o)Xt(n,f);else{const{x:t,y:r,z:i,angle:s}=o;for(let o=0;o<n;o++)e.bo(f,t,r,i,s)}}t.icon.dynamicLayoutVertexBuffer.updateData(f)}t.text.dynamicLayoutVertexBuffer.updateData(p)}function wo(t,r,i,n,o,s,a={}){const l=i.paint.get("icon-translate"),c=i.paint.get("text-translate"),u=i.paint.get("icon-translate-anchor"),h=i.paint.get("text-translate-anchor"),d=i.layout.get("icon-rotation-alignment"),p=i.layout.get("text-rotation-alignment"),f=i.layout.get("icon-pitch-alignment"),m=i.layout.get("text-pitch-alignment"),_=i.layout.get("icon-keep-upright"),g=i.layout.get("text-keep-upright"),y=i.paint.get("icon-color-saturation"),x=i.paint.get("icon-color-contrast"),v=i.paint.get("icon-color-brightness-min"),b=i.paint.get("icon-color-brightness-max"),w="sea"===i.layout.get("symbol-elevation-reference"),T=t.context,S=T.gl,E=t.transform,M="map"===d,A="map"===p,C="map"===f,I="map"===m,P=void 0!==i.layout.get("symbol-sort-key").constantOr(1);let R=!1;const z=t.depthModeForSublayer(0,Pr.ReadOnly),D=[e.am(E.center.lng),e.at(E.center.lat)],k=i.layout.get("text-variable-anchor"),O="globe"===E.projection.name,L=[],B=[0,-1,0];for(const o of n){const n=r.getTile(o),s=n.getBucket(i);if(!s)continue;if("mercator"===s.projection.name&&O)continue;if(s.fullyClipped)continue;const d="globe"===s.projection.name,p=d?e.a9(E.zoom):0,f=tr(o,s.getProjection(),E),m=E.calculatePixelsToTileUnitsMatrix(n),T=k&&s.hasTextData(),z=s.hasIconTextFit()&&T&&s.hasIconData(),F=s.getProjection().createInversionMatrix(E,o.canonical),N=e=>{E.depthOcclusionForSymbolsAndCircles&&(i.hasInitialOcclusionOpacityProperties||t.terrain)&&(e.push("DEPTH_D24"),e.push("DEPTH_OCCLUSION"))},V=()=>{const r=M&&"point"!==i.layout.get("symbol-placement"),a=[];N(a);const c=r||z,h=i.paint.get("icon-image-cross-fade").constantOr(0);t.terrainRenderModeElevated()&&C&&a.push("PITCH_WITH_MAP_TERRAIN"),d&&(a.push("PROJECTION_GLOBE_VIEW"),c&&a.push("PROJECTED_POS_ON_VIEWPORT")),h>0&&a.push("ICON_TRANSITION"),s.icon.zOffsetVertexBuffer&&a.push("Z_OFFSET"),0===y&&0===x&&0===v&&1===b||a.push("COLOR_ADJUSTMENT"),s.sdfIcons&&a.push("RENDER_SDF");const g=s.icon.programConfigurations.get(i.id),T=t.getOrCreateProgram("symbol",{config:g,defines:a}),A=n.imageAtlasTexture?n.imageAtlasTexture.size:[0,0],I=s.iconSizeData,P=e.bk(I,E.zoom),R=C||0!==E.pitch,k=Lt(f,n.tileID.canonical,C,M,E,s.getProjection(),m),L=Ft(f,n.tileID.canonical,C,M,E,s.getProjection(),m),V=t.translatePosMatrix(L,n,l,u,!0),j=t.translatePosMatrix(f,n,l,u),U=c?yo:k,$=M&&!C&&!r;let G=B;!O&&!E.mercatorFromTransition||M||(G=xo(E));const q=d?G:B,H=i.getColorAdjustmentMatrix(y,x,v,b),W=io(I.kind,P,$,C,t,j,U,V,w,!1,A,[0,0],!0,o,p,D,F,q,s.getProjection(),H,h),Z=n.imageAtlasTexture?n.imageAtlasTexture:null,X=1!==i.layout.get("icon-size").constantOr(0)||s.iconsNeedLinear,Y=s.sdfIcons||t.options.rotating||t.options.zooming||X||R?S.LINEAR:S.NEAREST,J=s.sdfIcons&&0!==i.paint.get("icon-halo-width").constantOr(1),K=t.terrain&&C&&r?e.a6.mat4.invert(e.a6.mat4.create(),k):yo;if(r&&s.icon){const e=E.elevation,r=e?e.getAtTileOffsetFunc(o,E.center.lat,E.worldSize,s.getProjection()):null,i=Bt(f,n.tileID.canonical,C,M,E,s.getProjection(),m);Ut(s,f,t,!1,i,L,C,_,r,o)}return{program:T,buffers:s.icon,uniformValues:W,atlasTexture:Z,atlasTextureIcon:null,atlasInterpolation:Y,atlasInterpolationIcon:null,isSDF:s.sdfIcons,hasHalo:J,tile:n,labelPlaneMatrixInv:K}},j=()=>{const r=A&&"point"!==i.layout.get("symbol-placement"),a=[],l=r||k||z;t.terrainRenderModeElevated()&&I&&a.push("PITCH_WITH_MAP_TERRAIN"),d&&(a.push("PROJECTION_GLOBE_VIEW"),l&&a.push("PROJECTED_POS_ON_VIEWPORT")),s.text.zOffsetVertexBuffer&&a.push("Z_OFFSET"),s.iconsInText&&a.push("RENDER_TEXT_AND_SYMBOL"),a.push("RENDER_SDF"),N(a);const u=s.text.programConfigurations.get(i.id),_=t.getOrCreateProgram("symbol",{config:u,defines:a});let y,x=[0,0],v=null;const b=s.textSizeData;s.iconsInText&&(x=n.imageAtlasTexture?n.imageAtlasTexture.size:[0,0],v=n.imageAtlasTexture?n.imageAtlasTexture:null,y=I||0!==E.pitch||t.options.rotating||t.options.zooming||"composite"===b.kind||"camera"===b.kind?S.LINEAR:S.NEAREST);const T=n.glyphAtlasTexture?n.glyphAtlasTexture.size:[0,0],M=i.layout.get("text-size-scale-range"),C=e.ap(t.scaleFactor,M[0],M[1]),P=e.bk(b,E.zoom,C),R=Lt(f,n.tileID.canonical,I,A,E,s.getProjection(),m),L=Ft(f,n.tileID.canonical,I,A,E,s.getProjection(),m),V=t.translatePosMatrix(L,n,c,h,!0),j=t.translatePosMatrix(f,n,c,h),U=l?yo:R,$=A&&!I&&!r;let G=B;!O&&!E.mercatorFromTransition||A||(G=xo(E));const q=io(b.kind,P,$,I,t,j,U,V,w,!0,T,x,!0,o,p,D,F,d?G:B,s.getProjection(),null,null,C),H=n.glyphAtlasTexture?n.glyphAtlasTexture:null,W=S.LINEAR,Z=0!==i.paint.get("text-halo-width").constantOr(1),X=t.terrain&&I&&r?e.a6.mat4.invert(e.a6.mat4.create(),R):yo;if(r&&s.text){const e=E.elevation,r=e?e.getAtTileOffsetFunc(o,E.center.lat,E.worldSize,s.getProjection()):null,i=Bt(f,n.tileID.canonical,I,A,E,s.getProjection(),m);Ut(s,f,t,!0,i,L,I,g,r,o)}return{program:_,buffers:s.text,uniformValues:q,atlasTexture:H,atlasTextureIcon:v,atlasInterpolation:W,atlasInterpolationIcon:y,isSDF:!0,hasHalo:Z,tile:n,labelPlaneMatrixInv:X}},U=s.icon.segments.get().length,$=s.text.segments.get().length,G=U&&!a.onlyText?V():null,q=$&&!a.onlyIcons?j():null,H=i.paint.get("icon-opacity").constantOr(1),W=i.paint.get("text-opacity").constantOr(1);if(P&&s.canOverlap){R=!0;const t=H&&!a.onlyText?s.icon.segments.get():[],r=W&&!a.onlyIcons?s.text.segments.get():[];for(const r of t)L.push({segments:new e.b2([r]),sortKey:r.sortKey,state:G});for(const t of r)L.push({segments:new e.b2([t]),sortKey:t.sortKey,state:q})}else a.onlyText||L.push({segments:H?s.icon.segments:new e.b2([]),sortKey:0,state:G}),a.onlyIcons||L.push({segments:W?s.text.segments:new e.b2([]),sortKey:0,state:q})}R&&L.sort(((e,t)=>e.sortKey-t.sortKey));for(const e of L){const r=e.state;if(r)if(t.terrain?t.terrain.setupElevationDraw(r.tile,r.program,{useDepthForOcclusion:E.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:r.labelPlaneMatrixInv}):t.setupDepthForOcclusion(E.depthOcclusionForSymbolsAndCircles,r.program),T.activeTexture.set(S.TEXTURE0),r.atlasTexture&&r.atlasTexture.bind(r.atlasInterpolation,S.CLAMP_TO_EDGE,!0),r.atlasTextureIcon&&(T.activeTexture.set(S.TEXTURE1),r.atlasTextureIcon&&r.atlasTextureIcon.bind(r.atlasInterpolationIcon,S.CLAMP_TO_EDGE,!0)),t.uploadCommonLightUniforms(t.context,r.program),r.hasHalo){const n=r.uniformValues;n.u_is_halo=1,To(r.buffers,e.segments,i,t,r.program,z,o,s,n,2),n.u_is_halo=0}else{if(r.isSDF){const n=r.uniformValues;r.hasHalo&&(n.u_is_halo=1,To(r.buffers,e.segments,i,t,r.program,z,o,s,n,1)),n.u_is_halo=0}To(r.buffers,e.segments,i,t,r.program,z,o,s,r.uniformValues,1)}}}function To(e,t,r,i,n,o,s,a,l,c){const u=[e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer,e.iconTransitioningVertexBuffer,e.globeExtVertexBuffer,e.zOffsetVertexBuffer];n.draw(i,i.context.gl.TRIANGLES,o,s,a,Or.disabled,l,r.id,e.layoutVertexBuffer,e.indexBuffer,t,r.paint,i.transform.zoom,e.programConfigurations.get(r.id),u,c)}function So(e,t,r,i,n,o,s){const a=e.context.gl,l=r.paint.get("fill-pattern"),c=r.is3D(),u=c?e.stencilModeFor3D():zr.disabled,h=l&&l.constantOr(1);let d,p,f,m,_;s?(p=h&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",d=a.LINES):(p=h?"fillPattern":"fill",d=a.TRIANGLES);for(const g of i){const i=t.getTile(g);if(h&&!i.patternsLoaded())continue;const y=i.getBucket(r);if(!y)continue;e.prepareDrawTile();const x=y.programConfigurations.get(r.id),v=e.isTileAffectedByFog(g),b=e.getOrCreateProgram(p,{config:x,overrideFog:v});h&&(e.context.activeTexture.set(a.TEXTURE0),i.imageAtlasTexture&&i.imageAtlasTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE),x.updatePaintBuffers());const w=l.constantOr(null);if(w&&i.imageAtlas){const e=i.imageAtlas.patternPositions[w.toString()];e&&x.setConstantPatternPositions(e)}const T=e.translatePosMatrix(g.projMatrix,i,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor")),S=r.paint.get("fill-emissive-strength");if(s){m=y.indexBuffer2,_=y.segments2;const t=e.terrain&&e.terrain.renderingToTexture?e.terrain.drapeBufferSize:[a.drawingBufferWidth,a.drawingBufferHeight];f="fillOutlinePattern"===p&&h?$n(T,S,e,i,t):Un(T,S,t)}else m=y.indexBuffer,_=y.segments,f=h?jn(T,S,e,i):Vn(T,S);e.uploadCommonUniforms(e.context,b,g.toUnwrapped()),b.draw(e,d,n,c?u:e.stencilModeForClipping(g),o,Or.disabled,f,r.id,y.layoutVertexBuffer,m,_,r.paint,e.transform.zoom,x,void 0)}}function Eo(t,r,i,n,o,s,a,l){i.resetLayerRenderingStats(t);const c=t.context,u=c.gl,h=t.transform,d=i.paint.get("fill-extrusion-pattern"),p=d.constantOr(1),f=i.paint.get("fill-extrusion-opacity"),m=t.style.enable3dLights(),_=i.paint.get(m&&!p?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),g=[i.paint.get("fill-extrusion-ambient-occlusion-intensity"),_],y=i.layout.get("fill-extrusion-edge-radius"),x=y>0&&!i.paint.get("fill-extrusion-rounded-roof"),v=x?0:y,b="globe"===h.projection.name?e.c_():0,w="globe"===h.projection.name,T=w?e.a9(h.zoom):0,S=[e.am(h.center.lng),e.at(h.center.lat)],E=i.paint.get("fill-extrusion-flood-light-color").toRenderColor(i.lut).toArray01().slice(0,3),M=i.paint.get("fill-extrusion-flood-light-intensity"),A=i.paint.get("fill-extrusion-vertical-scale"),C=0!==i.paint.get("fill-extrusion-line-width").constantOr(1),I=i.paint.get("fill-extrusion-height-alignment"),P=i.paint.get("fill-extrusion-base-alignment"),R=Hr(t,i.paint.get("fill-extrusion-cutoff-fade-range")),z=[];let D;w&&z.push("PROJECTION_GLOBE_VIEW"),g[0]>0&&z.push("FAUX_AO"),x&&z.push("ZERO_ROOF_RADIUS"),l&&z.push("HAS_CENTROID"),M>0&&z.push("FLOOD_LIGHT"),R.shouldRenderCutoff&&z.push("RENDER_CUTOFF"),C&&z.push("RENDER_WALL_MODE");const k="shadow"===t.renderPass,O=t.shadowRenderer,L=k&&!!O;t.shadowRenderer&&(t.shadowRenderer.useNormalOffset=!0);let B=[0,0,0];if(O){const e=t.style.directionalLight,r=t.style.ambientLight;e&&r&&(B=Qr(t.style,e,r)),k||(z.push("RENDER_SHADOWS","DEPTH_TEXTURE"),O.useNormalOffset&&z.push("NORMAL_OFFSET")),D=z.concat(["SHADOWS_SINGLE_CASCADE"])}const F=L?"fillExtrusionDepth":p?"fillExtrusionPattern":"fillExtrusion",N=i.getLayerRenderingStats();for(const e of n){const n=r.getTile(e),m=n.getBucket(i);if(!m||m.projection.name!==h.projection.name)continue;let _=!1;O&&(_=0===O.getMaxCascadeForTile(e.toUnwrapped()));const y=t.isTileAffectedByFog(e),x=m.programConfigurations.get(i.id),L=t.getOrCreateProgram(F,{config:x,defines:_?D:z,overrideFog:y});if(t.terrain&&t.terrain.setupElevationDraw(n,L,{useMeterToDem:!0}),!m.centroidVertexBuffer){const e=L.attributes.a_centroid_pos;void 0!==e&&u.vertexAttrib2f(e,0,0)}!k&&O&&O.setupShadows(n.tileID.toUnwrapped(),L,"vector-tile",n.tileID.overscaledZ),p&&(t.context.activeTexture.set(u.TEXTURE0),n.imageAtlasTexture&&n.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),x.updatePaintBuffers());const V=d.constantOr(null);if(V&&n.imageAtlas){const e=n.imageAtlas.patternPositions[V.toString()];e&&x.setConstantPatternPositions(e)}const j=i.paint.get("fill-extrusion-vertical-gradient"),U=1/m.tileToMeter;let $;if(k&&O){if(Ro(n.tileID,m,t))continue;const e=O.calculateShadowPassMatrixFromTile(n.tileID.toUnwrapped());$=Fn(e,v,U,A,I,P)}else{const r=t.translatePosMatrix(e.expandedProjMatrix,n,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),o=h.projection.createInversionMatrix(h,e.canonical);$=p?Nn(r,t,j,f,g,v,U,e,n,b,I,P,T,S,o,E,A):Bn(r,t,j,f,g,v,U,e,b,I,P,T,S,o,E,A,M,B)}t.uploadCommonUniforms(c,L,e.toUnwrapped(),null,R);let G=m.segments;if("mercator"===h.projection.name&&!k&&(G=m.getVisibleSegments(n.tileID,t.terrain,t.transform.getFrustum(0)),!G.get().length))continue;if(N)if(k)for(const e of G.get())N.numRenderedVerticesInShadowPass+=e.primitiveLength;else for(const e of G.get())N.numRenderedVerticesInTransparentPass+=e.primitiveLength;const q=[];(t.terrain||l)&&q.push(m.centroidVertexBuffer),w&&q.push(m.layoutVertexExtBuffer),C&&q.push(m.wallVertexBuffer),L.draw(t,c.gl.TRIANGLES,o,s,a,Or.backCCW,$,i.id,m.layoutVertexBuffer,m.indexBuffer,G,i.paint,t.transform.zoom,x,q)}t.shadowRenderer&&(t.shadowRenderer.useNormalOffset=!1)}function Mo(t,r,i,n,o,s,a,l,c,u,h,d,p,f,m,_,g,y,x){const v=t.context,b=v.gl,w=t.transform,T=t.transform.zoom,S=[],E=Hr(t,i.paint.get("fill-extrusion-cutoff-fade-range"));"clear"===u?(S.push("CLEAR_SUBPASS"),x&&(S.push("CLEAR_FROM_TEXTURE"),v.activeTexture.set(b.TEXTURE0),x.bind(b.LINEAR,b.CLAMP_TO_EDGE))):"sdf"===u&&S.push("SDF_SUBPASS"),g&&S.push("HAS_CENTROID"),E.shouldRenderCutoff&&S.push("RENDER_CUTOFF");const M=i.layout.get("fill-extrusion-edge-radius"),A=(e,r,n,u,y)=>{const b=r.programConfigurations.get(i.id),w=t.isTileAffectedByFog(e),A=t.getOrCreateProgram("fillExtrusionGroundEffect",{config:b,defines:S,overrideFog:w}),C=((e,t,r,i,n,o,s,a,l,c,u)=>({u_matrix:t,u_opacity:r,u_ao_pass:i?1:0,u_meter_to_tile:n,u_ao:o,u_flood_light_intensity:s,u_flood_light_color:a,u_attenuation:l,u_edge_radius:c,u_fb:0,u_fb_size:u,u_dynamic_offset:1}))(0,u,h,c,y,[d,p*y],f,m,_,T>=17?0:M*y,x?x.size[0]:0),I=[];g&&I.push(r.hiddenByLandmarkVertexBuffer),t.uploadCommonUniforms(v,A,e.toUnwrapped(),null,E),A.draw(t,v.gl.TRIANGLES,o,s,a,l,C,i.id,r.vertexBuffer,r.indexBuffer,n,i.paint,T,b,I)};for(const o of n){const n=r.getTile(o),s=n.getBucket(i);if(!s||s.projection.name!==w.projection.name||!s.groundEffect||s.groundEffect&&!s.groundEffect.hasData())continue;const a=s.groundEffect,l=1/s.tileToMeter;{const e=t.translatePosMatrix(o.projMatrix,n,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),r=a.getDefaultSegment();A(o,a,r,e,l)}if(y)for(let s=0;s<4;s++){const a=e.c$[s](o),c=r.getTile(a);if(!c)continue;const u=c.getBucket(i);if(!u||u.projection.name!==w.projection.name||!u.groundEffect||u.groundEffect&&!u.groundEffect.hasData())continue;const h=u.groundEffect;let d,p;0===s?(d=[-e.ab,0,0],p=1):1===s?(d=[e.ab,0,0],p=0):2===s?(d=[0,-e.ab,0],p=3):(d=[0,e.ab,0],p=2);const f=h.regionSegments[p];if(!f)continue;const m=new Float32Array(16);e.a6.mat4.translate(m,o.projMatrix,d),A(o,h,f,t.translatePosMatrix(m,n,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),l)}}}function Ao(t,r,i,n,o,s,a){0===n.centroidVertexArray.length&&n.createCentroidsBuffer();const l=s?s.findDEMTileFor(i):null;if(!(l&&l.dem||a))return;const c=t=>new e.P(Math.ceil((t+e.d2)*e.d3),0),u=e=>{const t=r.getSource().minzoom,i=e=>{const t=r.getTileByID(e);if(t&&t.hasData())return t.getBucket(o)},n=[0,-1,1];for(const r of n){if(e.overscaledZ+r<t)continue;const n=i(e.calculateScaledKey(e.overscaledZ+r));if(n)return n}},h=[0,0,0],d=(t,r)=>(h[0]=Math.min(t.min.y,r.min.y),h[1]=Math.max(t.max.y,r.max.y),h[2]=e.ab-r.min.x>t.max.x?r.min.x-e.ab:t.max.x,h),p=(t,r)=>(h[0]=Math.min(t.min.x,r.min.x),h[1]=Math.max(t.max.x,r.max.x),h[2]=e.ab-r.min.y>t.max.y?r.min.y-e.ab:t.max.y,h),f=[(e,t)=>d(e,t),(e,t)=>d(t,e),(e,t)=>p(e,t),(e,t)=>p(t,e)],m=(t,r,n,o,a,c,u)=>{if(!s)return 0;const h=[[c?n:t,c?t:n,0],[c?n:r,c?r:n,0]],d=u<0?e.ab+u:u,p=[c?d:(t+r)/2,c?(t+r)/2:d,0];return 0===n&&u<0||0!==n&&u>0?s.getForTilePoints(a,[p],!0,o):h.push(p),s.getForTilePoints(i,h,!0,l),Math.max(h[0][2],h[1][2],p[2])/s.exaggeration()};for(let t=0;t<4;t++){const r=n.borderFeatureIndices[t];if(0===r.length)continue;const o=e.c$[t](i),l=u(o);if(!(l&&l instanceof e.d0))continue;if(n.borderDoneWithNeighborZ[t]===l.canonical.z)continue;0===l.centroidVertexArray.length&&l.createCentroidsBuffer();const h=s?s.findDEMTileFor(o):null;if(!(h&&h.dem||a))continue;const d=(t<2?1:5)-t,p=l.borderDoneWithNeighborZ[d]!==n.canonical.z,y=l.borderFeatureIndices[d];let x=0;if(n.canonical.z!==l.canonical.z){for(const e of r)n.showCentroid(n.featuresOnBorder[e]);if(p)for(const e of y)l.showCentroid(l.featuresOnBorder[e]);n.borderDoneWithNeighborZ[t]=l.canonical.z,l.borderDoneWithNeighborZ[d]=n.canonical.z}for(const i of r){const r=n.featuresOnBorder[i],s=n.centroidData[r.centroidDataIndex],u=r.borders[t];let p;for(;x<y.length;){p=l.featuresOnBorder[y[x]];const e=p.borders[d];if(e[1]>u[0]+3||e[0]>u[0]-3)break;l.showCentroid(p),x++}if(p&&x<y.length){const i=x;let v=0;for(;!(p.borders[d][0]>u[1]-3)&&(v++,++x!==y.length);)p=l.featuresOnBorder[y[x]];p=l.featuresOnBorder[y[i]];let b=!1;if(v>=1){const e=p.borders[d];Math.abs(u[0]-e[0])<3&&Math.abs(u[1]-e[1])<3&&(v=1,b=!0,x=i+1)}else if(0===v){n.showCentroid(r);continue}const w=l.centroidData[p.centroidDataIndex];a&&b&&(((_=s).flags|(g=w).flags)&e.d1?(_.flags|=e.d1,g.flags|=e.d1):(_.flags&=~e.d1,g.flags&=~e.d1));const T=r.intersectsCount()>1||p.intersectsCount()>1;if(v>1)x=i,s.centroidXY=w.centroidXY=new e.P(0,0);else if(h&&h.dem&&!T){const r=f[t](s,w),i=t%2?e.ab-1:0,n=m(r[0],Math.min(e.ab-1,r[1]),i,h,o,t<2,r[2]);s.centroidXY=w.centroidXY=c(n)}else T?s.centroidXY=w.centroidXY=new e.P(0,0):(s.centroidXY=n.encodeBorderCentroid(r),w.centroidXY=l.encodeBorderCentroid(p));n.writeCentroidToBuffer(s),l.writeCentroidToBuffer(w)}else n.showCentroid(r)}n.borderDoneWithNeighborZ[t]=l.canonical.z,l.borderDoneWithNeighborZ[d]=n.canonical.z}var _,g;(n.needsCentroidUpdate||!n.centroidVertexBuffer&&0!==n.centroidVertexArray.length)&&n.uploadCentroid(t)}const Co=[1,0,0],Io=[0,1,0],Po=[0,0,1];function Ro(t,r,i){const n=i.transform,o=i.shadowRenderer;if(!o)return!0;const s=t.toUnwrapped(),a=n.tileSize*o._cascades[i.currentShadowCascade].scale;let l=r.maxHeight;if(n.elevation){const e=n.elevation.getMinMaxForTile(t);e&&(l+=e.max)}const c=[...o.shadowDirection];c[2]=-c[2];const u=o.computeSimplifiedTileShadowVolume(s,l,a,c);if(!u)return!1;const h=[Co,Io,Po,c,[c[0],0,c[2]],[0,c[1],c[2]]],d="globe"===n.projection.name,p=n.scaleZoom(a),f=e.bO.fromInvProjectionMatrix(n.invProjMatrix,n.worldSize,p,!d),m=o.getCurrentCascadeFrustum();return 0===f.intersectsPrecise(u.vertices,u.planes,h)||0===m.intersectsPrecise(u.vertices,u.planes,h)}function zo(t){return[t[0]*e.d4,t[1]*e.d4,t[2]*e.d4,0]}function Do(t,r,i,n,o,s,a,l,c){const u=n.getSource(),h=i.globeSharedBuffers;if(!h)return;let d,p,f;if(r&&(d=n.getTile(r)),u instanceof e.aD?(p=u.texture,f=e.cD(0,0,i.transform)):d&&r&&(p=d.texture,f=e.cD(r.canonical.z,r.canonical.x,i.transform)),!p||!f)return;t||(f=e.a6.mat4.scale(e.a6.mat4.create(),f,[1,-1,1]));const m=i.context,_=m.gl,g="nearest"===o.paint.get("raster-resampling")?_.NEAREST:_.LINEAR,y=i.colorModeForDrapableLayerRenderPass(s),x=a.defines;x.push("GLOBE_POLES");const v=new Pr(_.LEQUAL,Pr.ReadWrite,i.depthRangeFor3D),b=Float32Array.from(i.transform.expandedFarZProjMatrix),w=Float32Array.from(e.b6(e.cC(new e.bQ(0,0,0))));i.terrain&&i.terrain.prepareDrawTile(),m.activeTexture.set(_.TEXTURE0),p.bind(g,_.CLAMP_TO_EDGE),m.activeTexture.set(_.TEXTURE1),p.bind(g,_.CLAMP_TO_EDGE),p.useMipmap&&m.extTextureFilterAnisotropic&&i.transform.pitch>20&&_.texParameterf(_.TEXTURE_2D,m.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,m.extTextureFilterAnisotropicMax);const[T,S,E,M]=r?h.getPoleBuffers(r.canonical.z,!1):h.getPoleBuffers(0,!0),A=o.paint.get("raster-elevation");let C;t?(C=T,i.renderDefaultNorthPole=0!==A):(C=S,i.renderDefaultSouthPole=0!==A);const I=zo(a.mix),P=((e,t,r,i,n,o,s,a,l,c,u,h,d)=>Yn(e,t,r,new Float32Array(16),new Float32Array(9),[0,0],i,[0,0],[0,0,0,0],1,{opacity:1,mix:0},o,[0,0]||[0,0],a,2,c,u,h,1,0,d))(b,w,f,e.a9(i.transform.zoom),0,o,0,A,0,I,a.offset,a.range,s),R=i.getOrCreateProgram("raster",{defines:x});i.uploadCommonUniforms(m,R,null),R.draw(i,_.TRIANGLES,v,c,y,l,P,o.id,C,E,M)}function ko(e){const t=e._nearZ,r=e.projection.farthestPixelDistance(e),i=r-t,n=.2*e.height,o=t+n;return[t,r,(o-n-t)/i,(o-t)/i]}function Oo(e,t,r,i){if(e)return t instanceof Je&&e instanceof ft?t.getTextureDescriptor(e,r,!0):{texture:e.texture,mix:zo(i.mix),offset:i.offset,buffer:0,tileSize:1}}var Lo=e.d5([{name:"a_index",type:"Int16",components:1}]);class Bo{constructor(t,r,i,n){const o={width:i[0],height:i[1],data:null},s=t.gl;this.targetColorTexture=new e.T(t,o,s.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new e.T(t,o,s.RGBA8,{useMipmap:!1}),this.context=t,this.updateParticleTexture(r,n),this.lastInvalidatedAt=0}updateParticleTexture(t,r){if(this.particleTextureDimension===r.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const i=this.context.gl,n=r.width*r.height;this.particleTexture0=new e.T(this.context,r,i.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new e.T(this.context,r,i.RGBA8,{premultiply:!1,useMipmap:!1});const o=new e.d6;o.reserve(n);for(let e=0;e<n;e++)o.emplaceBack(e);this.particleIndexBuffer=this.context.createVertexBuffer(o,Lo.members,!0),this.particleSegment=e.b2.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=r.width}update(t){return!(this.lastInvalidatedAt<t&&(this.lastInvalidatedAt=e.q.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function Fo(t,r,i){if(!t)return null;const n=r.getTextureDescriptor(t,i,!0);if(!n)return null;let{texture:o,mix:s,offset:a,tileSize:l,buffer:c,format:u}=n;if(!o||!u)return null;let h=!1;return"uint32"===u&&(h=!0,s[3]=0,s=Zn(e.d7,s,[0,i.paint.get("raster-particle-max-speed")]),a=Xn(e.d7,a,[0,i.paint.get("raster-particle-max-speed")])),{texture:o,textureOffset:[c/(l+2*c),l/(l+2*c)],tileSize:l,scalarData:h,scale:s,offset:a,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[u]]}}function No(e){const t=e._nearZ,r=e.projection.farthestPixelDistance(e),i=r-t,n=.2*e.height,o=t+n;return[t,r,(o-n-t)/i,(o-t)/i]}const Vo=new e.bA(1,0,0,1),jo=new e.bA(0,1,0,1),Uo=new e.bA(0,0,1,1),$o=new e.bA(1,0,1,1),Go=new e.bA(0,1,1,1);function qo(t,r,i,n,o,s,a){const l=t.context,c=t.transform,u=l.gl,h="globe"===c.projection.name,d=h?["PROJECTION_GLOBE_VIEW"]:[];let p=e.a6.mat4.clone(i.projMatrix);if(h&&e.a9(c.zoom)>0){const t=e.b5(i.canonical,c),r=e.d8(t);p=e.a6.mat4.multiply(new Float32Array(16),c.globeMatrix,r),e.a6.mat4.multiply(p,c.projMatrix,p)}const f=e.a6.mat4.create();f[12]+=2*o/(e.q.devicePixelRatio*c.width),f[13]+=2*s/(e.q.devicePixelRatio*c.height),e.a6.mat4.multiply(p,f,p);const m=t.getOrCreateProgram("debug",{defines:d}),_=r.getTileByID(i.key);t.terrain&&t.terrain.setupElevationDraw(_,m);const g=Pr.disabled,y=zr.disabled,x=t.colorModeForRenderPass(),v="$debug";l.activeTexture.set(u.TEXTURE0),t.emptyTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),h?_._makeGlobeTileDebugBuffers(t.context,c):_._makeDebugTileBoundsBuffers(t.context,c.projection);const b=_._tileDebugBuffer||t.debugBuffer,w=_._tileDebugIndexBuffer||t.debugIndexBuffer,T=_._tileDebugSegments||t.debugSegments;if(m.draw(t,u.LINE_STRIP,g,y,x,Or.disabled,qn(p,n),v,b,w,T,null,null,null,[_._globeTileDebugBorderBuffer]),a){const e=_.latestRawTileData,r=Math.floor((e&&e.byteLength||0)/1024);let n=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(n+=` => ${i.overscaledZ}`),n+=` ${_.state}`,n+=` ${r}kb`,function(e,t){e.initDebugOverlayCanvas();const r=e.debugOverlayCanvas,i=e.context.gl,n=e.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,r.width,r.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(t,5,5),n.strokeText(t,5,5),e.debugOverlayTexture.update(r),e.debugOverlayTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}(t,n)}const S=r.getTile(i).tileSize,E=512/Math.min(S,512)*(i.overscaledZ/c.zoom)*.5,M=_._tileDebugTextBuffer||t.debugBuffer,A=_._tileDebugTextIndexBuffer||t.quadTriangleIndexBuffer,C=_._tileDebugTextSegments||t.debugSegments;m.draw(t,u.TRIANGLES,g,y,Ir.alphaBlended,Or.disabled,qn(p,e.bA.transparent,E),v,M,A,C,null,null,null,[_._globeTileDebugTextBuffer])}function Ho(e,t,r,i){Zo(e,0,t+r/2,e.transform.width,r,i)}function Wo(e,t,r,i){Zo(e,t-r/2,0,r,e.transform.height,i)}function Zo(t,r,i,n,o,s){const a=t.context,l=a.gl;l.enable(l.SCISSOR_TEST),l.scissor(r*e.q.devicePixelRatio,i*e.q.devicePixelRatio,n*e.q.devicePixelRatio,o*e.q.devicePixelRatio),a.clear({color:s}),l.disable(l.SCISSOR_TEST)}const Xo=e.d5([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Yo}=Xo;function Jo(e,t,r,i){e.emplaceBack(t,r,i)}class Ko{constructor(t){this.vertexArray=new e.d9,this.indices=new e.aP,Jo(this.vertexArray,-1,-1,1),Jo(this.vertexArray,1,-1,1),Jo(this.vertexArray,-1,1,1),Jo(this.vertexArray,1,1,1),Jo(this.vertexArray,-1,-1,-1),Jo(this.vertexArray,1,-1,-1),Jo(this.vertexArray,-1,1,-1),Jo(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=t.createVertexBuffer(this.vertexArray,Yo),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=e.b2.simpleSegment(0,0,36,12)}}function Qo(t,r,i,n,o,s){const a=t.context.gl,l=r.paint.get("sky-atmosphere-color"),c=r.paint.get("sky-atmosphere-halo-color"),u=r.paint.get("sky-atmosphere-sun-intensity"),h=((e,t,r,i,n)=>({u_matrix_3f:e,u_sun_direction:t,u_sun_intensity:r,u_color_tint_r:[i.r,i.g,i.b,i.a],u_color_tint_m:[n.r,n.g,n.b,n.a],u_luminance:5e-5}))(e.a6.mat3.fromMat4(e.a6.mat3.create(),n),o,u,l,c);a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+s,r.skyboxTexture,0),i.draw(t,a.TRIANGLES,Pr.disabled,zr.disabled,Ir.unblended,Or.frontCW,h,"skyboxCapture",r.skyboxGeometry.vertexBuffer,r.skyboxGeometry.indexBuffer,r.skyboxGeometry.segment)}const es=e.d5([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class ts{constructor(t){const r=new e.da;r.emplaceBack(-1,1,1,0,0),r.emplaceBack(1,1,1,1,0),r.emplaceBack(1,-1,1,1,1),r.emplaceBack(-1,-1,1,0,1);const i=new e.aP;i.emplaceBack(0,1,2),i.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(r,es.members),this.indexBuffer=t.createIndexBuffer(i),this.segments=e.b2.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const rs=e.d5([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class is{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class ns{constructor(t){this.colorModeAlphaBlendedWriteRGB=new Ir([1,Cr,1,Cr],e.bA.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new Ir([1,0,1,0],e.bA.transparent,[!1,!1,!1,!0]),this.params=new is,this.updateNeeded=!0,t.tp.registerParameter(this.params,["Stars"],"starsCount",{min:100,max:16e3,step:1},(()=>{this.updateNeeded=!0})),t.tp.registerParameter(this.params,["Stars"],"sizeMultiplier",{min:.01,max:2,step:.01}),t.tp.registerParameter(this.params,["Stars"],"sizeRange",{min:0,max:200,step:1},(()=>{this.updateNeeded=!0})),t.tp.registerParameter(this.params,["Stars"],"intensityRange",{min:0,max:200,step:1},(()=>{this.updateNeeded=!0}))}update(t){const r=t.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new ts(r);const t=this.params.sizeRange,i=this.params.intensityRange,n=function(t){const r=e.dd(30),i=[];for(let n=0;n<t;++n){const t=2*Math.PI*r(),n=Math.acos(1-2*r())-.5*Math.PI;i.push(e.a6.vec3.fromValues(Math.cos(n)*Math.cos(t),Math.cos(n)*Math.sin(t),Math.sin(n)))}return i}(this.params.starsCount),o=e.dd(300),s=new e.db,a=new e.aP;let l=0;for(let r=0;r<n.length;++r){const c=e.a6.vec3.scale([],n[r],200),u=Math.max(0,1+.01*t*(1*o()-.5)),h=Math.max(0,1+.01*i*(1*o()-.5));s.emplaceBack(c[0],c[1],c[2],-1,-1,u,h),s.emplaceBack(c[0],c[1],c[2],1,-1,u,h),s.emplaceBack(c[0],c[1],c[2],1,1,u,h),s.emplaceBack(c[0],c[1],c[2],-1,1,u,h),a.emplaceBack(l+0,l+1,l+2),a.emplaceBack(l+0,l+2,l+3),l+=4}this.starsVx=r.createVertexBuffer(s,rs.members),this.starsIdx=r.createIndexBuffer(a),this.starsSegments=e.b2.simpleSegment(0,0,s.length,a.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(t,r){const i=t.context,n=i.gl,o=t.transform,s=new Pr(n.LEQUAL,Pr.ReadOnly,[0,1]),a=e.a9(o.zoom),l=t.style.getLut(r.scope),c=r.properties.get("color").toRenderColor(l).toArray01(),u=r.properties.get("high-color").toRenderColor(l).toArray01(),h=r.properties.get("space-color").toRenderColor(l).toArray01PremultipliedAlpha(),d=5e-4,p=e.dc(r.properties.get("horizon-blend"),0,1,d,.25),f=e.cx(t,i,o)&&p===d?o.worldSize/(2*Math.PI*1.025)-1:o.globeRadius,m=t.frameCounter/1e3%1,_=e.a6.vec3.length(o.globeCenterInViewSpace),g=Math.sqrt(Math.pow(_,2)-Math.pow(f,2)),y=Math.acos(g/_),x=e=>{const r="globe"===o.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];e&&r.push("ALPHA_PASS");const l=t.getOrCreateProgram("globeAtmosphere",{defines:r}),d=((e,t,r,i,n,o,s,a,l,c,u,h)=>({u_frustum_tl:e,u_frustum_tr:t,u_frustum_br:r,u_frustum_bl:i,u_horizon:n,u_transition:o,u_fadeout_range:s,u_color:a,u_high_color:l,u_space_color:c,u_temporal_offset:u,u_horizon_angle:h}))(o.frustumCorners.TL,o.frustumCorners.TR,o.frustumCorners.BR,o.frustumCorners.BL,o.frustumCorners.horizon,a,p,c,u,h,m,y);t.uploadCommonUniforms(i,l);const f=this.atmosphereBuffer;f&&l.draw(t,n.TRIANGLES,s,zr.disabled,e?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,Or.backCW,d,e?"atmosphere_glow_alpha":"atmosphere_glow",f.vertexBuffer,f.indexBuffer,f.segments)};x(!1),x(!0)}drawStars(t,r){const i=e.ap(r.properties.get("star-intensity"),0,1);if(0===i)return;const n=t.context,o=n.gl,s=t.transform,a=t.getOrCreateProgram("stars"),l=e.a6.quat.identity([]);e.a6.quat.rotateX(l,l,-s._pitch),e.a6.quat.rotateZ(l,l,-s.angle),e.a6.quat.rotateX(l,l,e.bC(s._center.lat)),e.a6.quat.rotateY(l,l,-e.bC(s._center.lng));const c=e.a6.mat4.fromQuat(new Float32Array(16),l),u=e.a6.mat4.multiply([],s.starsProjMatrix,c),h=e.a6.mat3.fromMat4([],c),d=e.a6.mat3.invert([],h),p=[0,1,0];e.a6.vec3.transformMat3(p,p,d),e.a6.vec3.scale(p,p,this.params.sizeMultiplier);const f=[1,0,0];e.a6.vec3.transformMat3(f,f,d),e.a6.vec3.scale(f,f,this.params.sizeMultiplier);const m=(_=p,g=f,y=i,{u_matrix:Float32Array.from(u),u_up:_,u_right:g,u_intensity_multiplier:y});var _,g,y;t.uploadCommonUniforms(n,a),this.starsVx&&this.starsIdx&&a.draw(t,o.TRIANGLES,Pr.disabled,zr.disabled,this.colorModeAlphaBlendedWriteRGB,Or.disabled,m,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}function os(t,r){const i=[...t],n=r.cameraWorldSizeForFog/r.worldSize,o=e.a6.mat4.identity([]);return e.a6.mat4.scale(o,o,[n,n,1]),e.a6.mat4.multiply(i,o,i),e.a6.mat4.multiply(i,r.worldToFogMatrix,i),i}function ss(t,r,i,n,o){const s=i.material,a=n.context,{baseColorTexture:l,metallicRoughnessTexture:c}=s.pbrMetallicRoughness,{normalTexture:u,occlusionTexture:h,emissionTexture:d}=s;function p(e,r,i){if(e&&(t.push(r),a.activeTexture.set(a.gl.TEXTURE0+i),e.gfxTexture)){const{minFilter:t,magFilter:r,wrapS:i,wrapT:n}=e.sampler;e.gfxTexture.bindExtraParam(t,r,i,n)}}p(l,"HAS_TEXTURE_u_baseColorTexture",jr.BaseColor),p(c,"HAS_TEXTURE_u_metallicRoughnessTexture",jr.MetallicRoughness),p(u,"HAS_TEXTURE_u_normalTexture",jr.Normal),p(h,"HAS_TEXTURE_u_occlusionTexture",jr.Occlusion),p(d,"HAS_TEXTURE_u_emissionTexture",jr.Emission),o&&(o.texture||(o.texture=new e.df(n.context,o.image,[o.image.height,o.image.height,o.image.height],a.gl.RGBA8)),a.activeTexture.set(a.gl.TEXTURE0+jr.LUT),o.texture&&o.texture.bind(a.gl.LINEAR,a.gl.CLAMP_TO_EDGE),t.push("APPLY_LUT_ON_GPU")),i.texcoordBuffer&&(t.push("HAS_ATTRIBUTE_a_uv_2f"),r.push(i.texcoordBuffer)),i.colorBuffer&&(t.push(12===i.colorBuffer.itemSize?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),r.push(i.colorBuffer)),i.normalBuffer&&(t.push("HAS_ATTRIBUTE_a_normal_3f"),r.push(i.normalBuffer)),i.pbrBuffer&&(t.push("HAS_ATTRIBUTE_a_pbr"),t.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),r.push(i.pbrBuffer)),"OPAQUE"!==s.alphaMode&&"MASK"!==s.alphaMode||t.push("UNPREMULT_TEXTURE_IN_SHADER"),s.defined||t.push("DIFFUSE_SHADED"),t.push("USE_STANDARD_DERIVATIVES");const f=n.shadowRenderer;f&&(t.push("RENDER_SHADOWS","DEPTH_TEXTURE"),f.useNormalOffset&&t.push("NORMAL_OFFSET"))}function as(t,r,i,n,o,s){const a=i.paint.get("model-opacity"),l=r.context,c=new Pr(r.context.gl.LEQUAL,Pr.ReadWrite,r.depthRangeFor3D),u=r.transform,h=t.mesh,d=h.material,p=d.pbrMetallicRoughness,f=r.style.fog;let m;m="pixels"===r.transform.projection.zAxisUnit?[...t.nodeModelMatrix]:e.a6.mat4.multiply([],n.zScaleMatrix,t.nodeModelMatrix),e.a6.mat4.multiply(m,n.negCameraPosMatrix,m);const _=e.a6.mat4.invert([],m);e.a6.mat4.transpose(_,_);const g=i.paint.get("model-emissive-strength").constantOr(0),y=ao(new Float32Array(t.worldViewProjection),new Float32Array(m),new Float32Array(_),null,r,a,p.baseColorFactor.toRenderColor(null),d.emissiveFactor,p.metallicFactor,p.roughnessFactor,d,g,i),x={defines:[]},v=[],b=r.shadowRenderer;b&&(b.useNormalOffset=!1),ss(x.defines,v,h,r,i.lut);let w=null;if(f){const e=os(t.nodeModelMatrix,r.transform);if(w=new Float32Array(e),"globe"!==u.projection.name){const t=h.aabb.min,r=h.aabb.max,[i,n]=f.getOpacityForBounds(e,t[0],t[1],r[0],r[1]);x.overrideFog=i>=ke||n>=ke}}const T=Hr(r,i.paint.get("model-cutoff-fade-range"));T.shouldRenderCutoff&&x.defines.push("RENDER_CUTOFF");const S=r.getOrCreateProgram("model",x);r.uploadCommonUniforms(l,S,null,w,T),"shadow"!==r.renderPass&&b&&b.setupShadowsFromMatrix(t.nodeModelMatrix,S),S.draw(r,l.gl.TRIANGLES,c,o,s,h.material.doubleSided?Or.disabled:Or.backCCW,y,i.id,h.vertexBuffer,h.indexBuffer,h.segments,i.paint,r.transform.zoom,void 0,v)}function ls(t,r,i,n,o,s,a){let l;l="globe"===t.projection.name?e.dg(i,t):[...i],e.a6.mat4.multiply(l,l,r.matrix);const c=e.a6.mat4.multiply([],n,l);if(r.meshes)for(const t of r.meshes){if("BLEND"!==t.material.alphaMode){a.push({mesh:t,depth:0,modelIndex:o,worldViewProjection:c,nodeModelMatrix:l});continue}const r=e.a6.vec3.transformMat4([],t.centroid,c);r[2]>0&&s.push({mesh:t,depth:r[2],modelIndex:o,worldViewProjection:c,nodeModelMatrix:l})}if(r.children)for(const e of r.children)ls(t,e,i,n,o,s,a)}function cs(e,t,r,i){const n=r.shadowRenderer;if(!n)return;const o=n.getShadowPassDepthMode(),s=n.getShadowPassColorMode(),a=n.calculateShadowPassMatrixFromMatrix(t),l=lo(a);r.getOrCreateProgram("modelDepth",{defines:r._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(r,r.context.gl.TRIANGLES,o,zr.disabled,s,Or.backCCW,l,i.id,e.vertexBuffer,e.indexBuffer,e.segments,i.paint,r.transform.zoom,void 0,void 0)}function us(t,r,i){const n=r.updateZoomBasedPaintProperties(),o=function(t,r,i){let n,o,s,a=t.terrain?t.terrain.exaggeration():0;if(t.terrain&&a>0){const r=t.terrain,o=r.findDEMTileFor(i);o&&o.dem?n=e.di.create(r,i,o):a=0}if(0===a&&(r.terrainElevationMin=0,r.terrainElevationMax=0),a===r.validForExaggeration&&(0===a||n&&n._demTile&&n._demTile.tileID===r.validForDEMTile.id&&n._dem._timestamp===r.validForDEMTile.timestamp))return!1;for(const e in r.instancesPerModel){const t=r.instancesPerModel[e];for(let e=0;e<t.instancedDataArray.length;++e){const i=(n?a*n.getElevationAt(0|t.instancedDataArray.float32[16*e],0|t.instancedDataArray.float32[16*e+1],!0,!0):0)+t.instancesEvaluatedElevation[e];t.instancedDataArray.float32[16*e+6]=i,o=o?Math.min(r.terrainElevationMin,i):i,s=s?Math.max(r.terrainElevationMax,i):i}}return r.terrainElevationMin=o||0,r.terrainElevationMax=s||0,r.validForExaggeration=a,r.validForDEMTile=n&&n._demTile?{id:n._demTile.tileID,timestamp:n._dem._timestamp}:{id:void 0,timestamp:0},!0}(t,r,i);(n||o)&&(r.uploaded=!1,r.upload(t.context))}const hs={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new e.ca([0,0,0],[e.ab,e.ab,0])};function ds(t,r){const i=1<<t.canonical.z,n=r.getFreeCameraOptions().position,o=r.elevation,s=t.canonical.x/i,a=(t.canonical.x+1)/i,l=t.canonical.y/i,c=(t.canonical.y+1)/i;let u=r._centerAltitude;if(o){const e=o.getMinMaxForTile(t);e&&e.max>u&&(u=e.max)}const h=e.ap(n.x,s,a)-n.x,d=e.ap(n.y,l,c)-n.y,p=e.bE(u,r.center.lat)-n.z;return r._zoomFromMercatorZ(Math.sqrt(h*h+d*d+p*p))}function ps(e,t,r,i,n,o,s){const a=e.context,l="shadow"===e.renderPass,c=e.shadowRenderer,u=l&&c?c.getShadowPassDepthMode():new Pr(a.gl.LEQUAL,Pr.ReadWrite,e.depthRangeFor3D),h=e.isTileAffectedByFog(o);if(r.meshes)for(const d of r.meshes){const p=["MODEL_POSITION_ON_GPU"],f=[];let m,_,g;i.instancedDataArray.length>20&&p.push("INSTANCED_ARRAYS");const y=Hr(e,t.paint.get("model-cutoff-fade-range"));if(y.shouldRenderCutoff&&p.push("RENDER_CUTOFF"),l&&c)m=e.getOrCreateProgram("modelDepth",{defines:p}),_=lo(s.shadowTileMatrix,s.shadowTileMatrix,Float32Array.from(r.matrix)),g=c.getShadowPassColorMode();else{ss(p,f,d,e,t.lut),m=e.getOrCreateProgram("model",{defines:p,overrideFog:h});const i=d.material,l=i.pbrMetallicRoughness,u=t.paint.get("model-opacity"),x=t.paint.get("model-emissive-strength").constantOr(0);_=ao(o.expandedProjMatrix,Float32Array.from(r.matrix),new Float32Array(16),null,e,u,l.baseColorFactor.toRenderColor(null),i.emissiveFactor,l.metallicFactor,l.roughnessFactor,i,x,t,n),c&&(s.shadowUniformsInitialized?m.setShadowUniformValues(a,c.getShadowUniformValues()):(c.setupShadows(o.toUnwrapped(),m,"model-tile",o.overscaledZ),s.shadowUniformsInitialized=!0)),g=y.shouldRenderCutoff||u<1||"OPAQUE"!==i.alphaMode?Ir.alphaBlended:Ir.unblended}e.uploadCommonUniforms(a,m,o.toUnwrapped(),null,y);const x=d.material.doubleSided?Or.disabled:Or.backCCW;if(i.instancedDataArray.length>20)f.push(i.instancedDataBuffer),m.draw(e,a.gl.TRIANGLES,u,zr.disabled,g,x,_,t.id,d.vertexBuffer,d.indexBuffer,d.segments,t.paint,e.transform.zoom,void 0,f,i.instancedDataArray.length);else{const r=l?"u_instance":"u_normal_matrix";for(let n=0;n<i.instancedDataArray.length;++n)_[r]=new Float32Array(i.instancedDataArray.arrayBuffer,64*n,16),m.draw(e,a.gl.TRIANGLES,u,zr.disabled,g,x,_,t.id,d.vertexBuffer,d.indexBuffer,d.segments,t.paint,e.transform.zoom,void 0,f)}}if(r.children)for(const a of r.children)ps(e,t,a,i,n,o,s)}const fs=[1,-1,1];function ms(t,r,i,n){if(!i.modelManager)return!0;const o=i.modelManager;if(!i.shadowRenderer)return!0;const s=i.shadowRenderer,a=r.aabb;let l=!0,c=t.maxHeight;if(0===c){let e=0;for(const r in t.instancesPerModel){const t=o.getModel(r,n);t?e=Math.max(e,Math.max(Math.max(t.aabb.max[0],t.aabb.max[1]),t.aabb.max[2])):l=!1}c=t.maxScale*e*1.41+t.maxVerticalOffset,l&&(t.maxHeight=c)}a.max[2]=c,a.min[2]+=t.terrainElevationMin,a.max[2]+=t.terrainElevationMax,e.a6.vec3.transformMat4(a.min,a.min,r.tileMatrix),e.a6.vec3.transformMat4(a.max,a.max,r.tileMatrix);const u=a.intersects(s.getCurrentCascadeFrustum());return 0===i.currentShadowCascade&&(t.isInsideFirstShadowMapFrustum=2===u),0===u}function _s(t,r){const i=t.uniformValues.u_cutoff_params[0],n=t.uniformValues.u_cutoff_params[1],o=t.uniformValues.u_cutoff_params[2],s=t.uniformValues.u_cutoff_params[3];return n===i||s===o?1:e.ap(((r-i)/(n-i)-o)/(s-o),0,1)}function gs(t,r,i,n){if(r.pitch<20)return 1;const o=r.getWorldToCameraMatrix();e.a6.mat4.multiply(o,o,t);const s=e.a6.vec4.fromValues(i.min[0],i.min[1],i.min[2],1);let a=e.a6.vec4.transformMat4(e.a6.vec4.create(),s,o),l=a,c=a;s[1]=i.max[1],a=e.a6.vec4.transformMat4(e.a6.vec4.create(),s,o),l=a[1]<l[1]?a:l,c=a[1]>c[1]?a:c,s[0]=i.max[0],a=e.a6.vec4.transformMat4(e.a6.vec4.create(),s,o),l=a[1]<l[1]?a:l,c=a[1]>c[1]?a:c,s[1]=i.min[1],a=e.a6.vec4.transformMat4(e.a6.vec4.create(),s,o),l=a[1]<l[1]?a:l,c=a[1]>c[1]?a:c;const u=e.ap(n[0],0,1),h=100*r.pixelsPerMeter*e.ap(n[1],0,1),d=e.ap(n[2],0,1),p=e.a6.vec4.lerp(e.a6.vec4.create(),l,c,u),f=Math.tan(.5*r.fovX),m=-p[2]*f;if(0===h)return p[1]<-Math.abs(m)?d:1;const _=(-Math.abs(m)-p[1])/h,g=(e,t,r)=>(1-r)*e+r*t,y=e.ap(g(1,d,_),d,1);return g(1,y,e.ap((r.pitch-20)/20,0,1))}class ys{}class xs{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(t,r,i){{const e=this._storage.get(r.id);if(e)return e.lastUsedFrameIdx=t,e.buf}const n=i.gl,o=n.getBufferParameter(n.ELEMENT_ARRAY_BUFFER,n.BUFFER_SIZE),s=new ArrayBuffer(o),a=new Int16Array(s);n.getBufferSubData(n.ELEMENT_ARRAY_BUFFER,0,new Int16Array(s));const l=new e.dk;for(let e=0;e<o/2;e+=3){const t=a[e],r=a[e+1],i=a[e+2];l.emplaceBack(t,r),l.emplaceBack(r,i),l.emplaceBack(i,t)}const c=i.bindVertexArrayOES.current,u=new ys;return u.buf=new uo(i,l),u.lastUsedFrameIdx=t,this._storage.set(r.id,u),i.bindVertexArrayOES.set(c),u.buf}update(e){for(const[t,r]of this._storage)e-r.lastUsedFrameIdx>30&&(r.buf.destroy(),this._storage.delete(t))}destroy(){for(const[e,t]of this._storage)t.buf.destroy(),this._storage.delete(e)}}class vs{constructor(e){this.occluderSize=30,this.depthOffset=-1e-4,e.registerParameter(this,["Occlusion"],"occluderSize",{min:1,max:100,step:1}),e.registerParameter(this,["Occlusion"],"depthOffset",{min:-.05,max:0,step:1e-5})}}class bs{registerParameter(){}registerButton(){}registerBinding(){}refreshUI(){}}const ws={symbol:function(t,r,i,n,o){if("translucent"!==t.renderPass)return;const s=zr.disabled,a=t.colorModeForRenderPass(),l=i.layout.get("text-variable-anchor"),c=i.layout.get("text-size-scale-range"),u=e.ap(t.scaleFactor,c[0],c[1]);l&&function(t,r,i,n,o,s,a,l){const c=r.transform,u="map"===o,h="map"===s;for(const r of t){const t=n.getTile(r),o=t.getBucket(i);if(!o||!o.text||!o.text.segments.get().length)continue;const s=e.bk(o.textSizeData,c.zoom,l),d=tr(r,o.getProjection(),c),p=c.calculatePixelsToTileUnitsMatrix(t),f=Lt(d,t.tileID.canonical,h,u,c,o.getProjection(),p),m=o.hasIconTextFit()&&o.hasIconData();if(s){const i=Math.pow(2,c.zoom-t.tileID.overscaledZ);bo(o,u,h,a,e.cS,c,f,r,i,s,m)}}}(n,t,i,r,i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),o,u);const h=0!==i.paint.get("icon-opacity").constantOr(1),d=0!==i.paint.get("text-opacity").constantOr(1);void 0!==i.layout.get("symbol-sort-key").constantOr(1)&&(h||d)?wo(t,r,i,n,s,a):(h&&wo(t,r,i,n,s,a,{onlyIcons:!0}),d&&wo(t,r,i,n,s,a,{onlyText:!0})),r.map.showCollisionBoxes&&(go(t,r,i,n,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),!0),go(t,r,i,n,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),!1))},circle:function(t,r,i,n){if("translucent"!==t.renderPass)return;const o=i.paint.get("circle-opacity"),s=i.paint.get("circle-stroke-width"),a=i.paint.get("circle-stroke-opacity"),l=void 0!==i.layout.get("circle-sort-key").constantOr(1),c=i.paint.get("circle-emissive-strength");if(0===o.constantOr(1)&&(0===s.constantOr(1)||0===a.constantOr(1)))return;const u=t.context,h=u.gl,d=t.transform,p=t.depthModeForSublayer(0,Pr.ReadOnly),f=zr.disabled,m=t.colorModeForDrapableLayerRenderPass(c),_="globe"===d.projection.name,g=[e.am(d.center.lng),e.at(d.center.lat)],y=[];for(let o=0;o<n.length;o++){const s=n[o],a=r.getTile(s),c=a.getBucket(i);if(!c||c.projection.name!==d.projection.name)continue;const u=c.programConfigurations.get(i.id),h=e.cT(i),p=t.isTileAffectedByFog(s);_&&h.push("PROJECTION_GLOBE_VIEW"),h.push("DEPTH_D24"),t.terrain&&d.depthOcclusionForSymbolsAndCircles&&h.push("DEPTH_OCCLUSION");const f=t.getOrCreateProgram("circle",{config:u,defines:h,overrideFog:p}),m=c.layoutVertexBuffer,x=c.globeExtVertexBuffer,v=c.indexBuffer,b=d.projection.createInversionMatrix(d,s.canonical),w={programConfiguration:u,program:f,layoutVertexBuffer:m,globeExtVertexBuffer:x,indexBuffer:v,uniformValues:e.cU(t,s,a,b,g,i),tile:a};if(l){const t=c.segments.get();for(const r of t)y.push({segments:new e.b2([r]),sortKey:r.sortKey,state:w})}else y.push({segments:c.segments,sortKey:0,state:w})}l&&y.sort(((e,t)=>e.sortKey-t.sortKey));const x={useDepthForOcclusion:d.depthOcclusionForSymbolsAndCircles};for(const e of y){const{programConfiguration:r,program:n,layoutVertexBuffer:o,globeExtVertexBuffer:s,indexBuffer:a,uniformValues:l,tile:c}=e.state,_=e.segments;t.terrain&&t.terrain.setupElevationDraw(c,n,x),t.uploadCommonUniforms(u,n,c.tileID.toUnwrapped()),n.draw(t,h.TRIANGLES,p,f,m,Or.disabled,l,i.id,o,a,_,i.paint,d.zoom,r,[s])}},heatmap:function(t,r,i,n){if(0!==i.paint.get("heatmap-opacity"))if("offscreen"===t.renderPass){const o=t.context,s=o.gl,a=zr.disabled,l=new Ir([s.ONE,s.ONE,s.ONE,s.ONE],e.bA.transparent,[!0,!0,!0,!0]);!function(e,t,r,i){const n=e.gl,o=t.width*i,s=t.height*i;e.activeTexture.set(n.TEXTURE1),e.viewport.set([0,0,o,s]);let a=r.heatmapFbo;if(!a||a&&(a.width!==o||a.height!==s)){a&&a.destroy();const t=n.createTexture();n.bindTexture(n.TEXTURE_2D,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),a=r.heatmapFbo=e.createFramebuffer(o,s,!0,null),function(e,t,r,i,n,o){const s=e.gl;s.texImage2D(s.TEXTURE_2D,0,e.extRenderToTextureHalfFloat?s.RGBA16F:s.RGBA,n,o,0,s.RGBA,e.extRenderToTextureHalfFloat?s.HALF_FLOAT:s.UNSIGNED_BYTE,null),i.colorAttachment.set(r)}(e,0,t,a,o,s)}else n.bindTexture(n.TEXTURE_2D,a.colorAttachment.get()),e.bindFramebuffer.set(a.framebuffer)}(o,t,i,"globe"===t.transform.projection.name?.5:.25),o.clear({color:e.bA.transparent});const c=t.transform,u="globe"===c.projection.name,h=u?["PROJECTION_GLOBE_VIEW"]:[],d=u?Or.frontCCW:Or.disabled,p=[e.am(c.center.lng),e.at(c.center.lat)];for(let e=0;e<n.length;e++){const f=n[e];if(r.hasRenderableParent(f))continue;const m=r.getTile(f),_=m.getBucket(i);if(!_||_.projection.name!==c.projection.name)continue;const g=t.isTileAffectedByFog(f),y=_.programConfigurations.get(i.id),x=t.getOrCreateProgram("heatmap",{config:y,defines:h,overrideFog:g}),{zoom:v}=t.transform;t.terrain&&t.terrain.setupElevationDraw(m,x),t.uploadCommonUniforms(o,x,f.toUnwrapped());const b=c.projection.createInversionMatrix(c,f.canonical);x.draw(t,s.TRIANGLES,Pr.disabled,a,l,d,Wn(t,f,m,b,p,v,i.paint.get("heatmap-intensity")),i.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,i.paint,t.transform.zoom,y,u?[_.globeExtVertexBuffer]:null)}o.viewport.set([0,0,t.width,t.height])}else"translucent"===t.renderPass&&(t.context.setColorMode(t.colorModeForRenderPass()),function(t,r){const i=t.context,n=i.gl,o=r.heatmapFbo;if(!o)return;i.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),i.activeTexture.set(n.TEXTURE1);let s=r.colorRampTexture;s||(s=r.colorRampTexture=new e.T(i,r.colorRamp,n.RGBA8)),s.bind(n.LINEAR,n.CLAMP_TO_EDGE),t.getOrCreateProgram("heatmapTexture").draw(t,n.TRIANGLES,Pr.disabled,zr.disabled,t.colorModeForRenderPass(),Or.disabled,((e,t)=>({u_image:0,u_color_ramp:1,u_opacity:t.paint.get("heatmap-opacity")}))(0,r),r.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,r.paint,t.transform.zoom)}(t,i))},line:function(t,r,i,n){if("translucent"!==t.renderPass)return;const o=i.paint.get("line-opacity"),s=i.paint.get("line-width");if(0===o.constantOr(1)||0===s.constantOr(1))return;const a=i.paint.get("line-emissive-strength"),l=i.paint.get("line-occlusion-opacity"),c="sea"===i.layout.get("line-elevation-reference"),u=t.context,h=u.gl,d=!i.isDraped();if(d&&"globe"===t.transform.projection.name)return;const p=i.layout.get("line-cross-slope"),f=void 0!==p,m=p<1,_=d?new Pr(t.depthOcclusion?h.GREATER:h.LEQUAL,Pr.ReadOnly,t.depthRangeFor3D):t.depthModeForSublayer(0,Pr.ReadOnly),g=t.colorModeForDrapableLayerRenderPass(a),y=t.terrain&&t.terrain.renderingToTexture,x=y?1:e.q.devicePixelRatio,v=i.paint.get("line-dasharray"),b=v.constantOr(1),w=i.layout.get("line-cap"),T=v.constantOr(null),S=w.constantOr(null),E=i.paint.get("line-pattern"),M=E.constantOr(1),A=E.constantOr(null),C=i.paint.get("line-opacity").constantOr(1);let I=!M&&1!==C||t.depthOcclusion&&l>0&&l<1;const P=i.paint.get("line-gradient"),R=M?"linePattern":"line",z=e.cV(i);let D;if(y&&t.terrain&&t.terrain.clipOrMaskOverlapStencilType()&&(I=!1),0!==l&&t.depthOcclusion){const t=i.paint._values["line-opacity"];t&&t.value&&"constant"===t.value.kind?D=t.value:e.w(`Occlusion opacity for layer ${i.id} is supported only when line-opacity isn't data-driven.`)}if(d&&(t.forceTerrainMode=!0),!d&&0!==l&&t.terrain&&!y)return void e.w(`Occlusion opacity for layer ${i.id} is supported on terrain only if the layer has line-z-offset enabled.`);const k=I&&d?t.stencilModeFor3D():zr.disabled;d&&(z.push("ELEVATED"),f&&z.push(m?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),c&&z.push("ELEVATION_REFERENCE_SEA"));for(const o of n){const n=r.getTile(o);if(M&&!n.patternsLoaded())continue;const s=n.getBucket(i);if(!s)continue;t.prepareDrawTile();const a=s.programConfigurations.get(i.id),p=t.isTileAffectedByFog(o),f=t.getOrCreateProgram(R,{config:a,defines:z,overrideFog:p,overrideRtt:!d&&void 0});if(A&&n.imageAtlas){const e=n.imageAtlas.patternPositions[A.toString()];e&&a.setConstantPatternPositions(e)}if(!M&&T&&S&&n.lineAtlas){const e=n.lineAtlas.getDash(T,S);e&&a.setConstantPatternPositions(e)}let[m,v]=i.paint.get("line-trim-offset");if("round"===S||"square"===S){const e=1;m!==v&&(0===m&&(m-=e),1===v&&(v+=e))}const w=y?o.projMatrix:null,E=M?e.cW(t,n,i,w,x,[m,v]):e.cX(t,n,i,w,s.lineClipsArray.length,x,[m,v]);if(P){const n=s.gradients[i.id];let a=n.texture;if(i.gradientVersion!==n.version){let l=256;if(i.stepInterpolant){const i=r.getSource().maxzoom,n=o.canonical.z===i?Math.ceil(1<<t.transform.maxZoom-o.canonical.z):1;l=e.ap(e.cY(s.maxLineLength/e.ab*1024*n),256,u.maxTextureSize)}n.gradient=e.cZ({expression:i.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:n.gradient||void 0,clips:s.lineClipsArray}),n.texture?n.texture.update(n.gradient):n.texture=new e.T(u,n.gradient,h.RGBA8),n.version=i.gradientVersion,a=n.texture}u.activeTexture.set(h.TEXTURE1),a.bind(i.stepInterpolant?h.NEAREST:h.LINEAR,h.CLAMP_TO_EDGE)}b&&(u.activeTexture.set(h.TEXTURE0),n.lineAtlasTexture&&n.lineAtlasTexture.bind(h.LINEAR,h.REPEAT),a.updatePaintBuffers()),M&&(u.activeTexture.set(h.TEXTURE0),n.imageAtlasTexture&&n.imageAtlasTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),a.updatePaintBuffers()),d&&!c&&t.terrain.setupElevationDraw(n,f),t.uploadCommonUniforms(u,f,o.toUnwrapped());const O=e=>{null!=D&&(D.value=C*l),f.draw(t,h.TRIANGLES,_,e,g,Or.disabled,E,i.id,s.layoutVertexBuffer,s.indexBuffer,s.segments,i.paint,t.transform.zoom,a,[s.layoutVertexBuffer2,s.patternVertexBuffer,s.zOffsetVertexBuffer]),null!=D&&(D.value=C)};if(I&&!d){const e=t.stencilModeForClipping(o).ref;0===e&&y&&u.clear({stencil:0});const r={func:h.EQUAL,mask:255};E.u_alpha_discard_threshold=.8,O(new zr(r,e,255,h.KEEP,h.KEEP,h.INVERT)),E.u_alpha_discard_threshold=0,O(new zr(r,e,255,h.KEEP,h.KEEP,h.KEEP))}else I&&d&&(E.u_alpha_discard_threshold=.001),O(d?k:t.stencilModeForClipping(o))}d&&(t.forceTerrainMode=!1),I&&(t.resetStencilClippingMasks(),y&&u.clear({stencil:0})),0===l||t.depthOcclusion||y||t.layersWithOcclusionOpacity.push(t.currentLayer)},fill:function(t,r,i,n){const o=i.paint.get("fill-color"),s=i.paint.get("fill-opacity"),a=i.is3D(),l=new Pr(t.context.gl.LEQUAL,Pr.ReadWrite,t.depthRangeFor3D);if(0===s.constantOr(1))return;const c=i.paint.get("fill-emissive-strength"),u=t.colorModeForDrapableLayerRenderPass(c),h=i.paint.get("fill-pattern"),d=t.opaquePassEnabledForLayer()&&!h.constantOr(1)&&1===o.constantOr(e.bA.transparent).a&&1===s.constantOr(0)?"opaque":"translucent";if(t.renderPass===d){const e=a?l:t.depthModeForSublayer(1,"opaque"===t.renderPass?Pr.ReadWrite:Pr.ReadOnly);So(t,r,i,n,e,u,!1)}if(!a&&"translucent"===t.renderPass&&i.paint.get("fill-antialias")){const e=a?l:t.depthModeForSublayer(i.getPaintProperty("fill-outline-color")?2:0,Pr.ReadOnly);So(t,r,i,n,e,u,!0)}},"fill-extrusion":function(t,r,i,n){const o=i.paint.get("fill-extrusion-opacity"),s=t.context,a=s.gl,l=t.terrain,c=l&&l.renderingToTexture;if(0===o)return;const u=t.conflationActive&&t.style.isLayerClipped(i,r.getSource()),h=t.style.order.indexOf(i.fqid);if(u&&function(e,t,r,i,n){for(const o of i){const i=t.getTile(o).getBucket(r);i&&(i.updateReplacement(o,e.replacementSource,n),i.uploadCentroid(e.context))}}(t,r,i,n,h),l||u)for(const e of n){const n=r.getTile(e).getBucket(i);n&&Ao(t.context,r,e,n,i,l,u)}if("shadow"===t.renderPass&&t.shadowRenderer){const s=t.shadowRenderer;if(l&&o<.65&&i._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof e.a4)return;const a=s.getShadowPassDepthMode(),c=s.getShadowPassColorMode();Eo(t,r,i,n,a,zr.disabled,c,u)}else if("translucent"===t.renderPass){const h=!i.paint.get("fill-extrusion-pattern").constantOr(1),d=i.paint.get("fill-extrusion-color").constantOr(e.bA.white);if(!c&&0!==d.a){const e=new Pr(t.context.gl.LEQUAL,Pr.ReadWrite,t.depthRangeFor3D);1===o&&h?Eo(t,r,i,n,e,zr.disabled,Ir.unblended,u):(Eo(t,r,i,n,e,zr.disabled,Ir.disabled,u),Eo(t,r,i,n,e,t.stencilModeFor3D(),t.colorModeForRenderPass(),u),t.resetStencilClippingMasks())}if(t.style.enable3dLights()&&h&&(!l&&"globe"!==t.transform.projection.name||c)){const o=i.paint.get("fill-extrusion-opacity"),h=i.paint.get("fill-extrusion-ambient-occlusion-intensity"),d=i.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),p=i.paint.get("fill-extrusion-flood-light-intensity"),f=i.paint.get("fill-extrusion-flood-light-color").toRenderColor(i.lut).toArray01().slice(0,3),m=h>0&&d>0,_=p>0,g=(e,t,r)=>(1-r)*e+r*t,y=s=>{const l=t.depthModeForSublayer(1,Pr.ReadOnly,a.LEQUAL,!0),c=i.paint.get(s?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),m=g(.1,3,c),_=t._showOverdrawInspector;if(!_){const c=new zr({func:a.ALWAYS,mask:255},255,255,a.KEEP,a.KEEP,a.REPLACE),_=new Ir([a.ONE,a.ONE,a.ONE,a.ONE],e.bA.transparent,[!1,!1,!1,!0],a.MIN);Mo(t,r,i,n,l,c,_,Or.disabled,s,"sdf",o,h,d,p,f,m,u,!1)}{const c=_?zr.disabled:new zr({func:a.EQUAL,mask:255},255,255,a.KEEP,a.DECR,a.DECR),g=_?t.colorModeForRenderPass():new Ir([a.ONE_MINUS_DST_ALPHA,a.DST_ALPHA,a.ONE,a.ONE],e.bA.transparent,[!0,!0,!0,!0]);Mo(t,r,i,n,l,c,g,Or.disabled,s,"color",o,h,d,p,f,m,u,!1)}};if(c){const c=(s,l,c)=>{const m=t.depthModeForSublayer(1,Pr.ReadOnly,a.LEQUAL,!1),_=i.paint.get(s?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),y=g(.1,3,_);{const c=new Ir([a.ONE,a.ONE,a.ONE,a.ONE],e.bA.transparent,[!1,!1,!1,!0]);Mo(t,r,i,n,m,zr.disabled,c,Or.disabled,s,"clear",o,h,d,p,f,y,u,l)}{const c=new zr({func:a.ALWAYS,mask:255},255,255,a.KEEP,a.KEEP,a.REPLACE),_=new Ir([a.ONE,a.ONE,a.ONE,a.ONE],e.bA.transparent,[!1,!1,!1,!0],a.MIN);Mo(t,r,i,n,m,c,_,Or.disabled,s,"sdf",o,h,d,p,f,y,u,l)}{const c=s?a.ZERO:a.ONE_MINUS_DST_ALPHA,_=new zr({func:a.EQUAL,mask:255},255,255,a.KEEP,a.DECR,a.DECR),g=new Ir([c,a.DST_ALPHA,a.ONE_MINUS_DST_ALPHA,a.ZERO],e.bA.transparent,[!0,!0,!0,!0]);Mo(t,r,i,n,m,_,g,Or.disabled,s,"color",o,h,d,p,f,y,u,l)}{const _=new Ir([a.ONE,a.ONE,a.ONE,s?a.ZERO:a.ONE],e.bA.transparent,[!1,!1,!1,!0],s?a.FUNC_ADD:a.MAX);Mo(t,r,i,n,m,zr.disabled,_,Or.disabled,s,"clear",o,h,d,p,f,y,u,l,c)}};if(m||_){let r;if(t.prepareDrawTile(),l){const t=l.drapeBufferSize[0],i=l.drapeBufferSize[1];r=l.framebufferCopyTexture,r&&(!r||r.size[0]===t&&r.size[1]===i)||(r&&r.destroy(),r=l.framebufferCopyTexture=new e.T(s,new e.r({width:t,height:i}),a.RGBA8)),r.bind(a.LINEAR,a.CLAMP_TO_EDGE),a.copyTexSubImage2D(a.TEXTURE_2D,0,0,0,0,0,t,i)}m&&c(!0,!1,r),_&&c(!1,!0,r)}}else m&&y(!0),_&&y(!1),(m||_)&&t.resetStencilClippingMasks()}}},hillshade:function(e,t,r,i){if("offscreen"!==e.renderPass&&"translucent"!==e.renderPass)return;if(e.style.disableElevatedTerrain)return;const n=e.context,o=e.terrain&&e.terrain.renderingToTexture,[s,a]="translucent"!==e.renderPass||o?[{},i]:e.stencilConfigForOverlap(i);for(const i of a){const n=t.getTile(i);if(n.needsHillshadePrepare&&"offscreen"===e.renderPass)zi(e,n,r);else if("translucent"===e.renderPass){const t=e.depthModeForSublayer(0,Pr.ReadOnly),a=r.paint.get("hillshade-emissive-strength"),l=e.colorModeForDrapableLayerRenderPass(a),c=o&&e.terrain?e.terrain.stencilModeForRTTOverlap(i):s[i.overscaledZ];Pi(e,i,n,r,t,c,l)}}n.viewport.set([0,0,e.width,e.height]),e.resetStencilClippingMasks()},raster:function(t,r,i,n,o,s){if("translucent"!==t.renderPass)return;if(0===i.paint.get("raster-opacity"))return;const a="globe"===t.transform.projection.name,l=0!==i.paint.get("raster-elevation"),c=l&&a;if(t.renderElevatedRasterBackface&&!c)return;const u=t.context,h=u.gl,d=r.getSource(),p=function(t,r,i,n){const o=r.paint.get("raster-color"),s="raster-array"===t.type,a=[],l=r.paint.get("raster-resampling"),c=r.paint.get("raster-color-mix");let u=r.paint.get("raster-color-range");const h=[c[0],c[1],c[2],0],d=c[3];let p="nearest"===l?n.NEAREST:n.LINEAR;if(s&&(a.push("RASTER_ARRAY"),o||a.push("RASTER_COLOR"),"linear"===l&&a.push("RASTER_ARRAY_LINEAR"),p=n.NEAREST,!u&&t.rasterLayers)){const e=t.rasterLayers.find((({id:e})=>e===r.sourceLayer));e&&e.fields&&e.fields.range&&(u=e.fields.range)}if(u=u||[0,1],o){a.push("RASTER_COLOR"),i.activeTexture.set(n.TEXTURE2),r.updateColorRamp(u);let t=r.colorRampTexture;t||(t=r.colorRampTexture=new e.T(i,r.colorRamp,n.RGBA8)),t.bind(n.LINEAR,n.CLAMP_TO_EDGE)}return{mix:h,range:u,offset:d,defines:a,resampling:p}}(d,i,u,h);if(d instanceof e.aD&&!n.length&&!a)return;const f=i.paint.get("raster-emissive-strength"),m=t.colorModeForDrapableLayerRenderPass(f),_=t.terrain&&t.terrain.renderingToTexture,g=!t.options.moving,y="nearest"===i.paint.get("raster-resampling")?h.NEAREST:h.LINEAR;if(d instanceof e.aD&&!n.length&&(d.onNorthPole||d.onSouthPole)){const e=l?t.stencilModeFor3D():zr.disabled;return void Do(!!d.onNorthPole,null,t,r,i,f,p,Or.disabled,e)}if(!n.length)return;const[x,v]=d instanceof e.aD||_?[{},n]:t.stencilConfigForOverlap(n),b=v[v.length-1].overscaledZ;c&&p.defines.push("PROJECTION_GLOBE_VIEW"),l&&p.defines.push("RENDER_CUTOFF");const w=(n,o,v)=>{for(const w of n){const n=w.toUnwrapped(),T=r.getTile(w);if(_&&(!T||!T.hasData()))continue;u.activeTexture.set(h.TEXTURE0);const S=Oo(T,d,i,p);if(!S||!S.texture)continue;const{texture:E,mix:M,offset:A,tileSize:C,buffer:I}=S;let P,R;_?(P=Pr.disabled,R=w.projMatrix):l?(P=new Pr(h.LEQUAL,Pr.ReadWrite,t.depthRangeFor3D),R=a?Float32Array.from(t.transform.expandedFarZProjMatrix):t.transform.calculateProjMatrix(n,g)):(P=t.depthModeForSublayer(w.overscaledZ-b,1===i.paint.get("raster-opacity")?Pr.ReadWrite:Pr.ReadOnly,h.LESS),R=t.transform.calculateProjMatrix(n,g));const z=t.terrain&&_?t.terrain.stencilModeForRTTOverlap(w):x[w.overscaledZ],D=s?0:i.paint.get("raster-fade-duration");T.registerFadeDuration(D);const k=r.findLoadedParent(w,0),O=En(T,k,r,t.transform,D);let L,B;t.terrain&&t.terrain.prepareDrawTile(),u.activeTexture.set(h.TEXTURE0),E.bind(y,h.CLAMP_TO_EDGE),u.activeTexture.set(h.TEXTURE1),k?(k.texture&&k.texture.bind(y,h.CLAMP_TO_EDGE),L=Math.pow(2,k.tileID.overscaledZ-T.tileID.overscaledZ),B=[T.tileID.canonical.x*L%1,T.tileID.canonical.y*L%1]):E.bind(y,h.CLAMP_TO_EDGE),E.useMipmap&&u.extTextureFilterAnisotropic&&t.transform.pitch>20&&h.texParameterf(h.TEXTURE_2D,u.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,u.extTextureFilterAnisotropicMax);const F=t.transform;let N;const V=l?ko(F):[0,0,0,0];let j,U,$,G,q,H=0;if(c&&d instanceof e.aD&&d.coordinates.length>3)j=Float32Array.from(e.b6(e.cC(new e.bQ(0,0,0)))),U=Float32Array.from(F.globeMatrix),$=Float32Array.from(e.cy(F)),G=[e.am(F.center.lng),e.at(F.center.lat)],N=d.elevatedGlobePerspectiveTransform,q=d.elevatedGlobeGridMatrix||new Float32Array(9);else if(c){const t=e.cz(w.canonical);H=e.cA(t.getCenter().lat),j=Float32Array.from(e.b6(e.cC(w.canonical))),U=Float32Array.from(F.globeMatrix),$=Float32Array.from(e.cy(F)),G=[e.am(F.center.lng),e.at(F.center.lat)],N=[0,0],q=Float32Array.from(e.cB(w.canonical,t,H,F.worldSize/F._pixelsPerMercatorPixel))}else N=d instanceof e.aD?d.perspectiveTransform:[0,0],j=new Float32Array(16),U=new Float32Array(9),$=new Float32Array(16),G=[0,0],q=new Float32Array(9);const W=Yn(R,j,U,$,q,B||[0,0],e.a9(t.transform.zoom),G,V,L||1,O,i,N,l?i.paint.get("raster-elevation"):0,2,M,A,p.range,C,I,f),Z=t.isTileAffectedByFog(w),X=t.getOrCreateProgram("raster",{defines:p.defines,overrideFog:Z});if(t.uploadCommonUniforms(u,X,n),d instanceof e.aD){const r=d.elevatedGlobeVertexBuffer,n=d.elevatedGlobeIndexBuffer;if(_||!a)d.boundsBuffer&&d.boundsSegments&&X.draw(t,h.TRIANGLES,P,zr.disabled,m,Or.disabled,W,i.id,d.boundsBuffer,t.quadTriangleIndexBuffer,d.boundsSegments);else if(r&&n){const s=F.zoom<=e.c3?d.elevatedGlobeSegments:d.getSegmentsForLongitude(F.center.lng);s&&X.draw(t,h.TRIANGLES,P,zr.disabled,m,o,W,i.id,r,n,s)}}else if(c){P=new Pr(h.LEQUAL,Pr.ReadOnly,t.depthRangeFor3D);const e=t.globeSharedBuffers;if(e){const[r,n,s]=e.getGridBuffers(H,!1);X.draw(t,h.TRIANGLES,P,v||z,t.colorModeForRenderPass(),o,W,i.id,r,n,s)}}else{const{tileBoundsBuffer:e,tileBoundsIndexBuffer:r,tileBoundsSegments:n}=t.getTileBoundsBuffers(T);X.draw(t,h.TRIANGLES,P,z,m,Or.disabled,W,i.id,e,r,n)}}if(!(d instanceof e.aD)&&c)for(const e of n){const n=e.canonical.y===(1<<e.canonical.z)-1;0===e.canonical.y&&Do(!0,e,t,r,i,f,p,o,v||zr.disabled),n&&Do(!1,e,t,r,i,f,p,o===Or.frontCW?Or.backCW:Or.frontCW,v||zr.disabled)}};c?w(v,t.renderElevatedRasterBackface?Or.backCW:Or.frontCW,t.stencilModeFor3D()):w(v,Or.disabled,void 0),t.resetStencilClippingMasks()},"raster-particle":function(t,r,i,n,o,s){"offscreen"===t.renderPass&&function(t,r,i,n){if(!n.length)return;const o=t.context,s=o.gl,a=r.getSource();if(!(a instanceof Je))return;const l=Math.ceil(Math.sqrt(i.paint.get("raster-particle-count")));let c=i.particlePositionRGBAImage;if(!c||c.width!==l){const t=function(e){const t=e*e,r=new Uint8Array(4*t),i=function(e){return e|=0,e=Math.imul(2747636419^e,2654435769),e=Math.imul(e^e>>>16,2654435769),((e=Math.imul(e^e>>>16,2654435769))>>>0)/4294967296},n=1/1.1;for(let e=0;e<t;e++){const t=n*(i(2*e+0)+Kn),o=n*(i(2*e+1)+Kn),s=255*t%1,a=255*o%1,l=s,c=o-a/255,u=a;r[4*e+0]=255*(t-s/255),r[4*e+1]=255*l,r[4*e+2]=255*c,r[4*e+3]=255*u}return r}(l);c=i.particlePositionRGBAImage=new e.r({width:l,height:l},t)}let u=i.particleFramebuffer;u?u.width!==l&&(u.destroy(),u=i.particleFramebuffer=o.createFramebuffer(l,l,!0,null)):u=i.particleFramebuffer=o.createFramebuffer(l,l,!0,null);const h=[];for(const e of n){const t=r.getTile(e);if(!(t instanceof ft))continue;const n=Fo(t,a,i);if(!n)continue;const s=[t.tileSize,t.tileSize];let u=i.tileFramebuffer;u||(u=i.tileFramebuffer=o.createFramebuffer(s[0],s[1],!0,null));let d=t.rasterParticleState;d||(d=t.rasterParticleState=new Bo(o,e,s,c));const p=d.update(i.lastInvalidatedAt);d.particleTextureDimension!==l&&d.updateParticleTexture(e,c);const f=d.targetColorTexture;d.targetColorTexture=d.backgroundColorTexture,d.backgroundColorTexture=f;const m=d.particleTexture0;d.particleTexture0=d.particleTexture1,d.particleTexture1=m,h.push([e,n,d,p])}if(0===h.length)return;const d=e.q.now(),p=i.previousDrawTimestamp?.001*(d-i.previousDrawTimestamp):.0167;if(i.previousDrawTimestamp=d,i.hasColorMap()){o.activeTexture.set(s.TEXTURE0+2);let t=i.colorRampTexture;t||(t=i.colorRampTexture=new e.T(o,i.colorRamp,s.RGBA8)),t.bind(s.LINEAR,s.CLAMP_TO_EDGE)}o.bindFramebuffer.set(i.tileFramebuffer.framebuffer),function(t,r,i){const n=t.context,o=n.gl,s=r.tileFramebuffer;n.activeTexture.set(o.TEXTURE0);const a={u_texture:0,u_opacity:1.05*(c=r.paint.get("raster-particle-fade-opacity-factor"))/(c+.05)},l=t.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var c;for(const c of i){const[,,i,u]=c;s.colorAttachment.set(i.targetColorTexture.texture),n.viewport.set([0,0,s.width,s.height]),n.clear({color:e.bA.transparent}),u&&(i.backgroundColorTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE),l.draw(t,o.TRIANGLES,Pr.disabled,zr.disabled,Ir.alphaBlended,Or.disabled,a,r.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments))}}(t,i,h),function(t,r,i,n){const o=t.context,s=o.gl,a=i.tileFramebuffer,l="globe"===t.transform.projection.name,c=i.paint.get("raster-particle-max-speed");for(const u of n){const[n,h,d]=u;o.activeTexture.set(s.TEXTURE0+0),h.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),a.colorAttachment.set(d.targetColorTexture.texture);const p=t.getOrCreateProgram("rasterParticleDraw",{defines:h.defines,overrideFog:!1});o.activeTexture.set(s.TEXTURE0+1);const f=h.scalarData?[]:[0,1,2,3].map((t=>e.c$[t](n)));f.push(n);const m=n.canonical.x,_=n.canonical.y;for(const e of f){const o=r.getTile(l?e.wrapped():e);if(!o)continue;const a=o.rasterParticleState;if(!a)continue;const u=e.canonical.x+(1<<e.canonical.z)*(e.wrap-n.wrap),d=e.canonical.y;a.particleTexture0.bind(s.NEAREST,s.CLAMP_TO_EDGE);const f=eo(1,a.particleTexture0.size[0],[u-m,d-_],0,h.texture.size,2,c,h.textureOffset,h.scale,h.offset);p.draw(t,s.POINTS,Pr.disabled,zr.disabled,Ir.alphaBlended,Or.disabled,f,i.id,a.particleIndexBuffer,void 0,a.particleSegment)}}}(t,r,i,h),o.bindFramebuffer.set(i.particleFramebuffer.framebuffer),function(t,r,i,n){const o=t.context,s=o.gl,a=r.paint.get("raster-particle-max-speed"),l=n*r.paint.get("raster-particle-speed-factor")*.15,c=function(e){return Math.pow(e,6)}(.01+1*r.paint.get("raster-particle-reset-rate-factor")),u=r.particleFramebuffer;o.viewport.set([0,0,u.width,u.height]);for(const n of i){const[,i,h]=n;o.activeTexture.set(s.TEXTURE0+0),i.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),o.activeTexture.set(s.TEXTURE0+1);const d=h.particleTexture0;d.bind(s.NEAREST,s.CLAMP_TO_EDGE);const p=to(1,d.size[0],0,i.texture.size,a,l,c,i.textureOffset,i.scale,i.offset);u.colorAttachment.set(h.particleTexture1.texture),o.clear({color:e.bA.transparent}),t.getOrCreateProgram("rasterParticleUpdate",{defines:i.defines}).draw(t,s.TRIANGLES,Pr.disabled,zr.disabled,Ir.unblended,Or.disabled,p,r.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments)}}(t,i,h,p)}(t,r,i,n),"translucent"===t.renderPass&&(function(t,r,i,n){const o=t.context,s=o.gl,a=r.getSource().tileSize,l=5*(1-e.a7(e.bV,e.bV+1,t.transform.zoom))*a+i.paint.get("raster-particle-elevation"),c=!t.options.moving,u="globe"===t.transform.projection.name;if(!n.length)return;const[h,d]=t.stencilConfigForOverlap(n),p=[];u&&p.push("PROJECTION_GLOBE_VIEW");const f=t.stencilModeFor3D();for(const n of d){const a=n.toUnwrapped(),d=r.getTile(n);if(!d.rasterParticleState)continue;const m=d.rasterParticleState,_=100;d.registerFadeDuration(_);const g=r.findLoadedParent(n,0),y=En(d,g,r,t.transform,_);let x,v;t.terrain&&t.terrain.prepareDrawTile(),o.activeTexture.set(s.TEXTURE0),m.targetColorTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),o.activeTexture.set(s.TEXTURE1),g&&g.rasterParticleState?(g.rasterParticleState.targetColorTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),x=Math.pow(2,g.tileID.overscaledZ-d.tileID.overscaledZ),v=[d.tileID.canonical.x*x%1,d.tileID.canonical.y*x%1]):m.targetColorTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE);const b=u?Float32Array.from(t.transform.expandedFarZProjMatrix):t.transform.calculateProjMatrix(a,c),w=t.transform,T=No(w),S=e.cz(n.canonical),E=e.cA(S.getCenter().lat);let M,A,C,I,P;u?(M=Float32Array.from(e.b6(e.cC(n.canonical))),A=Float32Array.from(w.globeMatrix),C=Float32Array.from(e.cy(w)),I=[e.am(w.center.lng),e.at(w.center.lat)],P=Float32Array.from(e.cB(n.canonical,S,E,w.worldSize/w._pixelsPerMercatorPixel))):(M=new Float32Array(16),A=new Float32Array(9),C=new Float32Array(16),I=[0,0],P=new Float32Array(9));const R=Qn(b,M,A,C,P,v||[0,0],e.a9(t.transform.zoom),I,T,x||1,y,l),z=t.isTileAffectedByFog(n),D=t.getOrCreateProgram("rasterParticle",{defines:p,overrideFog:z});if(t.uploadCommonUniforms(o,D,a),u){const e=new Pr(s.LEQUAL,Pr.ReadOnly,t.depthRangeFor3D),r=0,n=t.globeSharedBuffers;if(n){const[o,a,l]=n.getGridBuffers(E,0!==r);D.draw(t,s.TRIANGLES,e,f,Ir.alphaBlended,t.renderElevatedRasterBackface?Or.frontCCW:Or.backCCW,R,i.id,o,a,l)}}else{const e=t.depthModeForSublayer(0,Pr.ReadOnly),r=h[n.overscaledZ],{tileBoundsBuffer:o,tileBoundsIndexBuffer:a,tileBoundsSegments:l}=t.getTileBoundsBuffers(d);D.draw(t,s.TRIANGLES,e,r,Ir.alphaBlended,Or.disabled,R,i.id,o,a,l)}}t.resetStencilClippingMasks()}(t,r,i,n),t.style.map.triggerRepaint())},background:function(t,r,i,n){const o=i.paint.get("background-color"),s=i.paint.get("background-opacity"),a=i.paint.get("background-emissive-strength"),l="viewport"===i.paint.get("background-pitch-alignment");if(0===s)return;const c=t.context,u=c.gl,h=t.transform,d=h.tileSize,p=i.paint.get("background-pattern");let f;if(void 0!==p){if(null===p)return;if(f=t.imageManager.getPattern(p.toString(),i.scope,t.style.getLut(i.scope)),!f)return}const m=!p&&1===o.a&&1===s&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==m)return;const _=zr.disabled,g=t.depthModeForSublayer(0,"opaque"===m?Pr.ReadWrite:Pr.ReadOnly),y=t.colorModeForDrapableLayerRenderPass(a),x=p?"backgroundPattern":"background";let v,b=n;if(b||(v=t.getBackgroundTiles(),b=Object.values(v).map((e=>e.tileID))),p&&(c.activeTexture.set(u.TEXTURE0),t.imageManager.bind(t.context,i.scope)),l){const r=t.getOrCreateProgram(x,{overrideFog:!1,overrideRtt:!0}),n=new Float32Array(e.a6.mat4.identity([])),c=new e.aA(0,0,0,0,0),h=p?oo(n,a,s,t,0,i.scope,f,l,{tileID:c,tileSize:d}):no(n,a,s,o.toRenderColor(i.lut));r.draw(t,u.TRIANGLES,g,_,y,Or.disabled,h,i.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments)}else for(const e of b){const m=t.isTileAffectedByFog(e),b=t.getOrCreateProgram(x,{overrideFog:m}),w=e.toUnwrapped(),T=n?e.projMatrix:t.transform.calculateProjMatrix(w);t.prepareDrawTile();const S=r?r.getTile(e):v?v[e.key]:new pt(e,d,h.zoom,t),E=p?oo(T,a,s,t,0,i.scope,f,l,{tileID:e,tileSize:d}):no(T,a,s,o.toRenderColor(i.lut));t.uploadCommonUniforms(c,b,w);const{tileBoundsBuffer:M,tileBoundsIndexBuffer:A,tileBoundsSegments:C}=t.getTileBoundsBuffers(S);b.draw(t,u.TRIANGLES,g,_,y,Or.disabled,E,i.id,M,A,C)}},sky:function(t,r,i){const n=t._atmosphere?e.a9(t.transform.zoom):1,o=i.paint.get("sky-opacity")*n;if(0===o)return;const s=t.context,a=i.paint.get("sky-type"),l=new Pr(s.gl.LEQUAL,Pr.ReadOnly,[0,1]),c=t.frameCounter/1e3%1;"atmosphere"===a?"offscreen"===t.renderPass?i.needsSkyboxCapture(t)&&(function(t,r){const i=t.context,n=i.gl;let o=r.skyboxFbo;if(!o){o=r.skyboxFbo=i.createFramebuffer(32,32,!0,null),r.skyboxGeometry=new Ko(i),r.skyboxTexture=i.gl.createTexture(),n.bindTexture(n.TEXTURE_CUBE_MAP,r.skyboxTexture),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MAG_FILTER,n.LINEAR);for(let e=0;e<6;++e)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,n.RGBA,32,32,0,n.RGBA,n.UNSIGNED_BYTE,null)}i.bindFramebuffer.set(o.framebuffer),i.viewport.set([0,0,32,32]);const s=r.getCenter(t,!0),a=t.getOrCreateProgram("skyboxCapture"),l=new Float64Array(16);e.a6.mat4.identity(l),e.a6.mat4.rotateY(l,l,.5*-Math.PI),Qo(t,r,a,l,s,0),e.a6.mat4.identity(l),e.a6.mat4.rotateY(l,l,.5*Math.PI),Qo(t,r,a,l,s,1),e.a6.mat4.identity(l),e.a6.mat4.rotateX(l,l,.5*-Math.PI),Qo(t,r,a,l,s,2),e.a6.mat4.identity(l),e.a6.mat4.rotateX(l,l,.5*Math.PI),Qo(t,r,a,l,s,3),e.a6.mat4.identity(l),Qo(t,r,a,l,s,4),e.a6.mat4.identity(l),e.a6.mat4.rotateY(l,l,Math.PI),Qo(t,r,a,l,s,5),i.viewport.set([0,0,t.width,t.height])}(t,i),i.markSkyboxValid(t)):"sky"===t.renderPass&&function(e,t,r,i,n){const o=e.context,s=o.gl,a=e.transform,l=e.getOrCreateProgram("skybox");o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_CUBE_MAP,t.skyboxTexture);const c=((e,t,r,i,n)=>({u_matrix:e,u_sun_direction:t,u_cubemap:0,u_opacity:i,u_temporal_offset:n}))(a.skyboxMatrix,t.getCenter(e,!1),0,i,n);e.uploadCommonUniforms(o,l),l.draw(e,s.TRIANGLES,r,zr.disabled,e.colorModeForRenderPass(),Or.backCW,c,"skybox",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}(t,i,l,o,c):"gradient"===a&&"sky"===t.renderPass&&function(t,r,i,n,o){const s=t.context,a=s.gl,l=t.transform,c=t.getOrCreateProgram("skyboxGradient");r.skyboxGeometry||(r.skyboxGeometry=new Ko(s)),s.activeTexture.set(a.TEXTURE0);let u=r.colorRampTexture;u||(u=r.colorRampTexture=new e.T(s,r.colorRamp,a.RGBA8)),u.bind(a.LINEAR,a.CLAMP_TO_EDGE);const h=((t,r,i,n,o)=>({u_matrix:t,u_color_ramp:0,u_center_direction:r,u_radius:e.bC(i),u_opacity:n,u_temporal_offset:o}))(l.skyboxMatrix,r.getCenter(t,!1),r.paint.get("sky-gradient-radius"),n,o);t.uploadCommonUniforms(s,c),c.draw(t,a.TRIANGLES,i,zr.disabled,t.colorModeForRenderPass(),Or.backCW,h,"skyboxGradient",r.skyboxGeometry.vertexBuffer,r.skyboxGeometry.indexBuffer,r.skyboxGeometry.segment)}(t,i,l,o,c)},debug:function(t,r,i,n,o,s){for(let a=0;a<i.length;a++)if(o){const o=1,l=.8,c=new e.bA(n.r*l,n.g*l,n.b*l,1);qo(t,r,i[a],n,-o,-o,s),qo(t,r,i[a],n,-o,o,s),qo(t,r,i[a],n,o,o,s),qo(t,r,i[a],n,o,-o,s),qo(t,r,i[a],c,0,0,s)}else qo(t,r,i[a],n,0,0,s)},custom:function(t,r,i,n){const o=t.context,s=i.implementation;if(!t.transform.projection.unsupportedLayers||!t.transform.projection.unsupportedLayers.includes("custom")||t.terrain&&(t.terrain.renderingToTexture||"offscreen"===t.renderPass)&&i.isDraped(r)){if("offscreen"===t.renderPass){const r=s.prerender;if(r){if(t.setCustomLayerDefaults(),o.setColorMode(t.colorModeForRenderPass()),"globe"===t.transform.projection.name){const i=t.transform.pointMerc;r.call(s,o.gl,t.transform.customLayerMatrix(),t.transform.getProjection(),t.transform.globeToMercatorMatrix(),e.a9(t.transform.zoom),[i.x,i.y],t.transform.pixelsPerMeterRatio)}else r.call(s,o.gl,t.transform.customLayerMatrix());o.setDirty(),t.setBaseState()}}else if("translucent"===t.renderPass){if(t.terrain&&t.terrain.renderingToTexture){const r=s.renderToTile;if(r){const i=n[0].canonical,a=new e.a5(i.x+n[0].wrap*(1<<i.z),i.y,i.z);o.setDepthMode(Pr.disabled),o.setStencilMode(zr.disabled),o.setColorMode(t.colorModeForRenderPass()),t.setCustomLayerDefaults(),r.call(s,o.gl,a),o.setDirty(),t.setBaseState()}return}t.setCustomLayerDefaults(),o.setColorMode(t.colorModeForRenderPass()),o.setStencilMode(zr.disabled);const r="3d"===s.renderingMode?new Pr(t.context.gl.LEQUAL,Pr.ReadWrite,t.depthRangeFor3D):t.depthModeForSublayer(0,Pr.ReadOnly);if(o.setDepthMode(r),"globe"===t.transform.projection.name){const r=t.transform.pointMerc;s.render(o.gl,t.transform.customLayerMatrix(),t.transform.getProjection(),t.transform.globeToMercatorMatrix(),e.a9(t.transform.zoom),[r.x,r.y],t.transform.pixelsPerMeterRatio)}else s.render(o.gl,t.transform.customLayerMatrix());o.setDirty(),t.setBaseState(),o.bindFramebuffer.set(null)}}else e.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(t,r,i,n){if("opaque"===t.renderPass)return;const o=i.paint.get("model-opacity");if(0===o)return;const s=i.paint.get("model-cast-shadows");if("shadow"===t.renderPass){if(!s)return;if(t.terrain&&o<.65&&i._transitionablePaint._values["model-opacity"].value.expression instanceof e.a4)return}const a=t.shadowRenderer,l=i.paint.get("model-receive-shadows");a&&(a.useNormalOffset=!0,l||(a.enabled=!1));const c=()=>{a&&(a.useNormalOffset=!0,l||(a.enabled=!0))},u=r.getSource();if("light-beam"===t.renderPass&&"batched-model"!==u.type)return;if("vector"===u.type||"geojson"===u.type)return function(t,r,i,n,o){const s=t.transform;if("mercator"!==s.projection.name)return void e.w(`Drawing 3D models for ${s.projection.name} projection is not yet implemented`);const a=s.getFreeCameraOptions().position;if(!t.modelManager)return;const l=t.modelManager;i.modelManager=l;const c=t.shadowRenderer;if(!i._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const u=i._unevaluatedLayout._values["model-id"],h={...i.layout.get("model-id").parameters},d=t.style.order.indexOf(i.fqid);for(const p of n){const n=r.getTile(p).getBucket(i);if(!n||n.projection.name!==s.projection.name)continue;const f=n.getModelUris();f&&!n.modelsRequested&&(l.addModelsFromBucket(f,o),n.modelsRequested=!0);const m=ds(p,s);h.zoom=m;const _=u.possiblyEvaluate(h);if(us(t,n,p),hs.shadowUniformsInitialized=!1,hs.useSingleShadowCascade=!!c&&0===c.getMaxCascadeForTile(p.toUnwrapped()),"shadow"===t.renderPass&&c){if(1===t.currentShadowCascade&&n.isInsideFirstShadowMapFrustum)continue;const r=s.calculatePosMatrix(p.toUnwrapped(),s.worldSize);if(hs.tileMatrix.set(r),hs.shadowTileMatrix=Float32Array.from(c.calculateShadowPassMatrixFromMatrix(r)),hs.aabb.min.fill(0),hs.aabb.max[0]=hs.aabb.max[1]=e.ab,hs.aabb.max[2]=0,ms(n,hs,t,i.scope))continue}const g=1<<p.canonical.z,y=[((a.x-p.wrap)*g-p.canonical.x)*e.ab,(a.y*g-p.canonical.y)*e.ab,a.z*g*e.ab];t.conflationActive&&Object.keys(n.instancesPerModel).length>0&&t.style.isLayerClipped(i,r.getSource())&&n.updateReplacement(p,t.replacementSource,d,o)&&(n.uploaded=!1,n.upload(t.context));for(let e in n.instancesPerModel){const r=n.instancesPerModel[e];r.features.length>0&&(e=_.evaluate(r.features[0].feature,{}));const s=l.getModel(e,o);if(s&&s.uploaded)for(const e of s.nodes)ps(t,i,e,r,y,p,hs)}}}(t,r,i,n,"vector"===u.type?i.scope:""),void c();if(!u.loaded())return;if("batched-model"===u.type)return function(t,r,i,n){i.resetLayerRenderingStats(t);const o=t.context,s=t.transform,a=t.style.fog,l=t.shadowRenderer;if("mercator"!==s.projection.name)return void e.w(`Drawing 3D landmark models for ${s.projection.name} projection is not yet implemented`);const c=t.transform.getFreeCameraOptions().position,u=e.a6.vec3.scale([],[c.x,c.y,c.z],t.transform.worldSize),h=e.a6.vec3.negate([],u),d=e.a6.mat4.identity([]),p=e.de(s.center.lat,s.zoom),f=e.a6.mat4.fromScaling([],[1,1,1/p]);e.a6.mat4.translate(d,d,h);const m=i.paint.get("model-opacity"),_=new Pr(o.gl.LEQUAL,Pr.ReadWrite,t.depthRangeFor3D),g=new Pr(o.gl.LEQUAL,Pr.ReadOnly,t.depthRangeFor3D),y=new e.ca([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),x="shadow"===t.renderPass,v=x&&l?l.getCurrentCascadeFrustum():s.getFrustum(s.scaleZoom(s.worldSize)),b=i.paint.get("model-front-cutoff"),w=b[2]<1,T=Hr(t,i.paint.get("model-cutoff-fade-range")),S=i.getLayerRenderingStats();(function(e,t,r,i){const n=e.terrain?e.terrain.exaggeration():0,o=e.transform.zoom;for(const s of i){const i=t.getTile(s).getBucket(r);i&&(e.conflationActive&&i.updateReplacement(s,e.replacementSource),i.evaluateScale(e,r),e.terrain&&n>0&&i.elevationUpdate(e.terrain,n,s,r.source),i.needsReEvaluation(e,o,r)&&i.evaluate(r))}})(t,r,i,n),function(){let c,h,E;w?(c=n.length-1,h=-1,E=-1):(c=0,h=n.length,E=1);const M=new Float64Array(16),A=e.a6.vec3.create(),C=new e.P(0,0);for(let I=c;I!==h;I+=E){const c=n[I],h=r.getTile(c).getBucket(i);if(!h||!h.uploaded)continue;let E=!1;l&&(E=0===l.getMaxCascadeForTile(c.toUnwrapped()));const P=s.calculatePosMatrix(c.toUnwrapped(),s.worldSize),R=h.modelTraits;!x&&w&&(e.a6.mat4.invert(M,P),e.a6.vec3.transformMat4(A,u,M),C.x=A[0],C.y=A[1]);const z=[];for(const r of h.getNodesInfo()){if(r.hiddenByReplacement)continue;if(!r.node.meshes)continue;const i=r.node;let n=0;t.terrain&&i.elevation&&(n=i.elevation*t.terrain.exaggeration());const o=(()=>{const t=r.aabb;return y.min=[...t.min],y.max=[...t.max],y.min[2]+=n,y.max[2]+=n,e.a6.vec3.transformMat4(y.min,y.min,P),e.a6.vec3.transformMat4(y.max,y.max,P),y})(),a=r.evaluatedScale;if(a[0]<=1&&a[1]<=1&&a[2]<=1&&0===o.intersects(v))continue;if(!x&&w){const t=1/6;r.cameraCollisionOpacity=u[0]>o.min[0]&&u[0]<o.max[0]&&u[1]>o.min[1]&&u[1]<o.max[1]&&u[2]*p<o.max[2]&&i.footprint&&e.bv(C,i.footprint)?Math.max(r.cameraCollisionOpacity-t,0):Math.min(1,r.cameraCollisionOpacity+t)}const l=[...P],c=i.anchor?i.anchor[0]:0,h=i.anchor?i.anchor[1]:0;e.a6.mat4.translate(l,l,[c*(a[0]-1),h*(a[1]-1),n]),e.a6.vec3.exactEquals(a,e.dh)||e.a6.mat4.scale(l,l,a);const d=e.a6.mat4.multiply([],l,i.matrix),f=e.a6.mat4.multiply([],s.expandedFarZProjMatrix,d),_=e.a6.mat4.multiply([],s.expandedFarZProjMatrix,l),g=e.a6.vec4.transformMat4([],[c,h,n,1],f)[2];i.hidden=!1;let S=m;x||(w&&(S*=r.cameraCollisionOpacity,S*=gs(l,s,r.aabb,b)),S*=_s(T,g)),0!==S?z.push({nodeInfo:r,depth:g,opacity:S,wvpForNode:f,wvpForTile:_,nodeModelMatrix:d,tileModelMatrix:l}):i.hidden=!0}x||z.sort(((e,t)=>!w||1===e.opacity&&1===t.opacity?e.depth<t.depth?-1:1:1===e.opacity?-1:1===t.opacity?1:e.depth>t.depth?-1:1));for(const r of z){const n=r.nodeInfo,c=n.node;let u=e.a6.mat4.multiply([],f,r.tileModelMatrix);e.a6.mat4.multiply(u,d,u);const h=e.a6.mat4.invert([],u);e.a6.mat4.transpose(h,h),e.a6.mat4.scale(h,h,fs),u=e.a6.mat4.multiply(u,u,c.matrix);const p="light-beam"===t.renderPass,m=R&e.dj.HasMapboxMeshFeatures,y=m?0:n.evaluatedRMEA[0][2];for(let e=0;e<c.meshes.length;++e){const d=c.meshes[e],f=e===c.lightMeshIndex;let v=r.wvpForNode;if(f){if(!p&&!t.terrain&&t.shadowRenderer){t.currentLayer<t.firstLightBeamLayer&&(t.firstLightBeamLayer=t.currentLayer);continue}v=r.wvpForTile}else if(p)continue;const b={defines:[]},w=[];if(!x&&l&&(l.useNormalOffset=!!d.normalBuffer),ss(b.defines,w,d,t,i.lut),m||b.defines.push("DIFFUSE_SHADED"),E&&b.defines.push("SHADOWS_SINGLE_CASCADE"),S&&(x?S.numRenderedVerticesInShadowPass+=d.vertexArray.length:S.numRenderedVerticesInTransparentPass+=d.vertexArray.length),x){cs(d,r.nodeModelMatrix,t,i);continue}let T=null;if(a){const e=os(r.nodeModelMatrix,t.transform);if(T=new Float32Array(e),"globe"!==s.projection.name){const t=d.aabb.min,r=d.aabb.max,[i,n]=a.getOpacityForBounds(e,t[0],t[1],r[0],r[1]);b.overrideFog=i>=ke||n>=ke}}const M=d.material;let A;M.occlusionTexture&&M.occlusionTexture.offsetScale&&(A=M.occlusionTexture.offsetScale,b.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const C=t.getOrCreateProgram("model",b);!x&&l&&l.setupShadowsFromMatrix(r.tileModelMatrix,C,l.useNormalOffset),t.uploadCommonUniforms(o,C,null,T);const I=M.pbrMetallicRoughness;I.metallicFactor=.9,I.roughnessFactor=.5;const P=ao(new Float32Array(v),new Float32Array(u),new Float32Array(h),new Float32Array(c.matrix),t,r.opacity,I.baseColorFactor.toRenderColor(null),M.emissiveFactor,I.metallicFactor,I.roughnessFactor,M,y,i,[0,0,0],A);!f&&(n.hasTranslucentParts||r.opacity<1)&&C.draw(t,o.gl.TRIANGLES,_,zr.disabled,Ir.disabled,Or.backCCW,P,i.id,d.vertexBuffer,d.indexBuffer,d.segments,i.paint,t.transform.zoom,void 0,w),C.draw(t,o.gl.TRIANGLES,f?g:_,zr.disabled,f||r.opacity<1||n.hasTranslucentParts?Ir.alphaBlended:Ir.unblended,Or.backCCW,P,i.id,d.vertexBuffer,d.indexBuffer,d.segments,i.paint,t.transform.zoom,void 0,w)}}}}()}(t,r,i,n),void c();if("model"!==u.type)return;const h=u.getModels(),d=[],p=t.transform.getFreeCameraOptions().position,f=e.a6.vec3.scale([],[p.x,p.y,p.z],t.transform.worldSize);e.a6.vec3.negate(f,f);const m=[],_=[];let g=0;for(const r of h){const n=i.paint.get("model-rotation").constantOr(null),o=i.paint.get("model-scale").constantOr(null),s=i.paint.get("model-translation").constantOr(null);r.computeModelMatrix(t,n,o,s,!0,!0,!1);const a=e.a6.mat4.identity([]),l=e.de(r.position.lat,t.transform.zoom),c=e.a6.mat4.fromScaling([],[1,1,1/l]);e.a6.mat4.translate(a,a,f),d.push({zScaleMatrix:c,negCameraPosMatrix:a});for(const e of r.nodes)ls(t.transform,e,r.matrix,t.transform.expandedFarZProjMatrix,g,m,_);g++}if(m.sort(((e,t)=>t.depth-e.depth)),"shadow"!==t.renderPass){if(1===o)for(const e of _)as(e,t,i,d[e.modelIndex],zr.disabled,t.colorModeForRenderPass());else{for(const e of _)as(e,t,i,d[e.modelIndex],zr.disabled,Ir.disabled);for(const e of _)as(e,t,i,d[e.modelIndex],t.stencilModeFor3D(),t.colorModeForRenderPass());t.resetStencilClippingMasks()}for(const e of m)as(e,t,i,d[e.modelIndex],zr.disabled,t.colorModeForRenderPass());c()}else{for(const e of _)cs(e.mesh,e.nodeModelMatrix,t,i);for(const e of m)cs(e.mesh,e.nodeModelMatrix,t,i);c()}}},Ts={model:function(e,t,r){const i=t.getSource();if(!i.loaded())return;if("vector"===i.type||"geojson"===i.type)return void(r.modelManager&&r.modelManager.upload(r,"vector"===i.type?e.scope:""));if("batched-model"===i.type)return;if("model"!==i.type)return;const n=i.getModels();for(const e of n)e.upload(r.context)},raster:function(e,t,r){const i=t.getSource();if(!(i instanceof Je&&i.loaded()))return;const n=e.sourceLayer||i.rasterLayerIds&&i.rasterLayerIds[0];if(!n)return;const o=e.paint.get("raster-array-band")||i.getInitialBand(n);if(null==o)return;const s=t.getIds().map((e=>t.getTileByID(e)));for(const e of s)e.updateNeeded(n,o)&&i.prepareTile(e,n,o)},"raster-particle":function(e,t,r){const i=t.getSource();if(!(i instanceof Je&&i.loaded()))return;const n=e.sourceLayer||i.rasterLayerIds&&i.rasterLayerIds[0];if(!n)return;const o=e.paint.get("raster-particle-array-band")||i.getInitialBand(n);if(null==o)return;const s=t.getIds().map((e=>t.getTileByID(e)));for(const e of s)e.updateNeeded(n,o)&&i.prepareTile(e,n,o)}};class Ss{constructor(t,r,i,n,o){this.context=new mo(t,r),this.transform=i,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=o,this._timeStamp=e.q.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const s=["fill","line","symbol","circle","heatmap","fill-extrusion","raster","raster-particle","hillshade","model","background","sky"];for(const e of s)this._debugParams.enabledLayers[e]=!0;o.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},(()=>{this.style.map.triggerRepaint()})),o.registerParameter(this._debugParams,["Precipitation"],"forceEnablePrecipitation"),o.registerParameter(this._debugParams,["FPS"],"fpsWindow",{min:1,max:100,step:1}),o.registerBinding(this._debugParams,["FPS"],"continousRedraw",{readonly:!0,label:"continuous redraw"}),o.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"value"}),o.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"graph",view:"graph",min:0,max:200});for(const e of s)o.registerParameter(this._debugParams.enabledLayers,["Debug","Layers"],e);this.occlusionParams=new vs(o),this.setup(),this.numSublayers=gt.maxUnderzooming+gt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new e.dl,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new Yr(this),this._wireframeDebugCache=new xs,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const a=new e.r({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new e.T(this.context,a,t.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=n}updateTerrain(e,t){const r=!!e&&!!e.terrain&&this.transform.projection.supportsTerrain;if(!(r||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new In(this,e));const i=this._terrain;this.transform.elevation=r?i:null,i.update(e,this.transform,t),this.transform.elevation&&!i.enabled&&(this.transform.elevation=null)}_updateFog(e){const t=e.fog;if(!t||"globe"===this.transform.projection.name||t.getOpacity(this.transform.pitch)<1||t.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[r,i]=t.getFovAdjustedRange(this.transform._fov);if(r>i)return void(this.transform.fogCullDistSq=null);const n=r+.78*(i-r);this.transform.fogCullDistSq=n*n}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(e){e&&!this._terrain&&(this._terrain=new In(this,this.style)),this._forceTerrainMode=e}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(t,r){if(this.width=t*e.q.devicePixelRatio,this.height=r*e.q.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const e of this.style.order)this.style._mergedLayers[e].resize()}setup(){const t=this.context,r=new e.a$;r.emplaceBack(0,0),r.emplaceBack(e.ab,0),r.emplaceBack(0,e.ab),r.emplaceBack(e.ab,e.ab),this.tileExtentBuffer=t.createVertexBuffer(r,e.b1.members),this.tileExtentSegments=e.b2.simpleSegment(0,0,4,2);const i=new e.a$;i.emplaceBack(0,0),i.emplaceBack(e.ab,0),i.emplaceBack(0,e.ab),i.emplaceBack(e.ab,e.ab),this.debugBuffer=t.createVertexBuffer(i,e.b1.members),this.debugSegments=e.b2.simpleSegment(0,0,4,5);const n=new e.a$;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(-1,1),n.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(n,e.b1.members),this.viewportSegments=e.b2.simpleSegment(0,0,4,2);const o=new e.aO;o.emplaceBack(0,0,0,0),o.emplaceBack(e.ab,0,e.ab,0),o.emplaceBack(0,e.ab,0,e.ab),o.emplaceBack(e.ab,e.ab,e.ab,e.ab),this.mercatorBoundsBuffer=t.createVertexBuffer(o,e.b4.members),this.mercatorBoundsSegments=e.b2.simpleSegment(0,0,4,2);const s=new e.aP;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(s);const a=new e.b0;for(const e of[0,1,3,2,0])a.emplaceBack(e);this.debugIndexBuffer=t.createIndexBuffer(a),this.emptyTexture=new e.T(t,new e.r({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA8),this.identityMat=e.a6.mat4.create();const l=this.context.gl;this.stencilClearMode=new zr({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(e){return e._makeTileBoundsBuffers(this.context,this.transform.projection),e._tileBoundsBuffer?{tileBoundsBuffer:e._tileBoundsBuffer,tileBoundsIndexBuffer:e._tileBoundsIndexBuffer,tileBoundsSegments:e._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const e=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,e.TRIANGLES,Pr.disabled,this.stencilClearMode,Ir.disabled,Or.disabled,Sn(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(e,t,r){if(!t||this.currentStencilSource===t.id||!e.isTileClipped()||!r||0===r.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let e=!1;for(const t of r)if(void 0===this._tileClippingMaskIDs[t.key]){e=!0;break}if(!e)return}this.currentStencilSource=t.id;const i=this.context,n=i.gl;this.nextStencilID+r.length>256&&this.clearStencil(),i.setColorMode(Ir.disabled),i.setDepthMode(Pr.disabled);const o=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const e of r){const r=t.getTile(e),i=this._tileClippingMaskIDs[e.key]=this.nextStencilID++,{tileBoundsBuffer:s,tileBoundsIndexBuffer:a,tileBoundsSegments:l}=this.getTileBoundsBuffers(r);o.draw(this,n.TRIANGLES,Pr.disabled,new zr({func:n.ALWAYS,mask:0},i,255,n.KEEP,n.KEEP,n.REPLACE),Ir.disabled,Or.disabled,Sn(e.projMatrix),"$clipping",s,a,l)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,t=this.context.gl;return new zr({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(e);const t=this.context.gl;return new zr({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}stencilConfigForOverlap(e){const t=this.context.gl,r=e.sort(((e,t)=>t.overscaledZ-e.overscaledZ)),i=r[r.length-1].overscaledZ,n=r[0].overscaledZ-i+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();const e={};for(let r=0;r<n;r++)e[r+i]=new zr({func:t.GEQUAL,mask:255},r+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=n,[e,r]}return[{[i]:zr.disabled},r]}colorModeForRenderPass(){const t=this.context.gl;if(this._showOverdrawInspector){const r=1/8;return new Ir([t.CONSTANT_COLOR,t.ONE,t.CONSTANT_COLOR,t.ONE],new e.bA(r,r,r,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?Ir.unblended:Ir.alphaBlended}colorModeForDrapableLayerRenderPass(t){const r=this.context.gl;return(()=>this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture)()&&"translucent"===this.renderPass?new Ir([r.ONE,r.ONE_MINUS_SRC_ALPHA,r.CONSTANT_ALPHA,r.ONE_MINUS_SRC_ALPHA],new e.bA(0,0,0,void 0===t?0:t),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(e,t,r,i=!1){if(this.depthOcclusion)return new Pr(this.context.gl.GREATER,Pr.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!i)return Pr.disabled;const n=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new Pr(r||this.context.gl.LEQUAL,t,[n,n])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){const t=this.context.gl,r=Math.ceil(this.width),i=Math.ceil(this.height),n=this.context.bindFramebuffer.get(),o=t.getParameter(t.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===r&&this.depthFBO.height===i||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),0!==r&&0!==i&&(this.depthFBO=new fo(this.context,r,i,!1,"texture"),this.depthTexture=new e.T(this.context,{width:r,height:i,data:null},t.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(n),t.bindTexture(t.TEXTURE_2D,o),this.depthFBO&&(t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),t.blitFramebuffer(0,0,r,i,0,0,r,i,t.DEPTH_BUFFER_BIT,t.NEAREST),t.bindFramebuffer(t.FRAMEBUFFER,this.context.bindFramebuffer.current))}updateAverageFPS(){this._fpsHistory.push(0===this._dt?0:1e3/this._dt),this._fpsHistory.length>this._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce(((e,t)=>e+t/this._fpsHistory.length),0))}render(t,r){const i=e.q.now();this._dt=i-this._timeStamp,this._timeStamp=i,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=t.map.repaint,this.style=t,this.options=r;const n=this.style._mergedLayers,o=this.style._getOrder(!(!this.terrain||!this.terrain.enabled)).filter((e=>{const t=n[e];return!(t.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[t.type]}));let s=!1,a=!1;for(const e of o){const t=n[e];"circle"===t.type&&(s=!0),"symbol"===t.type&&(t.hasInitialOcclusionOpacityProperties?a=!0:s=!0)}const l=o.map((e=>n[e])),c=this.style._mergedSourceCaches;this.imageManager=t.imageManager,this.modelManager=t.modelManager,this.symbolFadeChange=t.placement.symbolFadeChange(e.q.now()),this.imageManager.beginFrame();let u=0,h=!1;for(const e in c){const t=c[e];t.used&&(t.prepare(this.context),t.getSource().usedInConflation&&++u)}let d=!1;for(const e of l)e.isHidden(this.transform.zoom)||("clip"===e.type&&(d=!0),this.prepareLayer(e));const p={},f={},m={},_={},g={};for(const e in c){const t=c[e];p[e]=t.getVisibleCoordinates(),f[e]=p[e].slice().reverse(),m[e]=t.getVisibleCoordinates(!0).reverse(),_[e]=t.getShadowCasterCoordinates(),g[e]=t.sortCoordinatesByDistance(p[e])}const y=e=>{const t=this.style.getLayerSourceCache(e);return t&&t.used?t.getSource():null};if(u||d||this._clippingActiveLastFrame){const t=[],r=[];let i=0;for(const e of l)this.isSourceForClippingOrConflation(e,y(e))&&(t.push(e),r.push(i)),i++;if(t&&(d||t.length>1)||this._clippingActiveLastFrame){d=!1;const i=[];for(let n=0;n<t.length;n++){const o=t[n],s=r[n],a=this.style.getLayerSourceCache(o);if(!a||!a.used||!a.getSource().usedInConflation&&"clip"!==o.type)continue;let l=e.dn,c=e.bt.None;const u=[];let h=!0;if("clip"===o.type){l=s;for(const t of o.layout.get("clip-layer-types"))c|="model"===t?e.bt.Model:"symbol"===t?e.bt.Symbol:e.bt.FillExtrusion;for(const e of o.layout.get("clip-layer-scope"))u.push(e);o.isHidden(this.transform.zoom)?h=!1:d=!0}h&&i.push({layer:o.fqid,cache:a,order:l,clipMask:c,clipScope:u})}this.replacementSource.setSources(i),h=!0}}this._clippingActiveLastFrame=d,h||this.replacementSource.clear(),this.conflationActive=h,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let e=0;e<l.length;e++){const t=l[e],r=t.cutoffRange();if(this.longestCutoffRange=Math.max(r,this.longestCutoffRange),r>0){const e=y(t);e&&(this.minCutoffZoom=Math.max(e.minzoom,this.minCutoffZoom)),t.minzoom&&(this.minCutoffZoom=Math.max(t.minzoom,this.minCutoffZoom))}t.is3D()&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=e),this._lastOcclusionLayer=e)}const x=this.style&&this.style.fog;x?(this._fogVisible=0!==x.getOpacity(this.transform.pitch),this._fogVisible&&"globe"!==this.transform.projection.name&&(this._fogVisible=x.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(m),this.opaquePassCutoff=0);const v=this._shadowRenderer;if(v){v.updateShadowParameters(this.transform,this.style.directionalLight);for(const e in c)for(const t of p[e]){let e={min:0,max:0};this.terrain&&(e=this.terrain.getMinMaxForTile(t)||e),v.addShadowReceiver(t.toUnwrapped(),e.min,e.max)}}if("globe"!==this.transform.projection.name||this.globeSharedBuffers||(this.globeSharedBuffers=new e.dm(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new ns(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),!V.has(this.context.gl))return;this.renderPass="offscreen";for(const e of l){const r=t.getLayerSourceCache(e);if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;const i=r?f[r.id]:void 0;("custom"===e.type||"raster"===e.type||"raster-particle"===e.type||e.isSky()||i&&i.length)&&this.renderLayer(this,r,e,i)}this.depthRangeFor3D=[0,1-(l.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,_)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const b="globe"===this.transform.projection.name||this.transform.isHorizonVisible(),w=(()=>{if(r.showOverdrawInspector)return e.bA.black;const t=this.style.fog;if(t&&this.transform.projection.supportsFog){const r=this.style.getLut(t.scope);if(!b){const i=t.properties.get("color").toRenderColor(r).toArray01();return new e.bA(...i)}if(b){const i=t.properties.get("space-color").toRenderColor(r).toArray01();return new e.bA(...i)}}return e.bA.transparent})();if(this.context.clear({color:w,depth:1}),this.clearStencil(),this._showOverdrawInspector=r.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&b&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=o.length-1;this.currentLayer>=0;this.currentLayer--){const e=l[this.currentLayer],r=t.getLayerSourceCache(e);if(e.isSky())continue;const i=r?(e.is3D()?g:f)[r.id]:void 0;this._renderTileClippingMasks(e,r,i),this.renderLayer(this,r,e,i)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&b&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||e.a9(this.transform.zoom)>0)&&("globe"===this.transform.projection.name||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<o.length;this.currentLayer++){const e=l[this.currentLayer],r=t.getLayerSourceCache(e);e.isSky()&&this.renderLayer(this,r,e,r?f[r.id]:void 0)}function T(e,t){let r;return t&&(r=("symbol"===e.type?m:e.is3D()?g:f)[t.id]),r}if(this.renderPass="translucent","globe"===this.transform.projection.name){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<o.length;){const e=l[this.currentLayer];if("raster"===e.type||"raster-particle"===e.type){const r=t.getLayerSourceCache(e);this.renderLayer(this,r,e,T(e,r))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let S=0;v&&(S=v.getShadowCastingLayerCount());let E=!1,M=-1;for(let e=0;e<o.length;++e){const t=l[e];t.isHidden(this.transform.zoom)||t.is3D()&&(M=e)}for(a&&-1===M&&(s=!0);this.currentLayer<o.length;){const e=l[this.currentLayer],r=t.getLayerSourceCache(e);if(e.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(e)){if(e.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(s&&!E&&this.terrain&&!this.transform.isOrthographic&&(E=!0,this.blitDepth()),a&&-1!==M&&this.currentLayer===M+1&&!this.transform.isOrthographic&&this.blitDepth(),e.is3D()||this.terrain||this._renderTileClippingMasks(e,r,r?p[r.id]:void 0),this.renderLayer(this,r,e,T(e,r)),!this.terrain&&v&&S>0&&e.hasShadowPass()&&0==--S&&(v.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer)){const e=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=e;this.currentLayer++){const e=l[this.currentLayer];if(!e.hasLightBeamPass())continue;const r=t.getLayerSourceCache(e);this.renderLayer(this,r,e,r?f[r.id]:void 0)}this.currentLayer=e,this.renderPass="translucent"}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const e=this.currentLayer;this.depthOcclusion=!0;for(const e of this.layersWithOcclusionOpacity){this.currentLayer=e;const r=l[this.currentLayer],i=t.getLayerSourceCache(r),n=i?f[i.id]:void 0;r.is3D()||this.terrain||this._renderTileClippingMasks(r,i,i?p[i.id]:void 0),this.renderLayer(this,i,r,n)}this.depthOcclusion=!1,this.currentLayer=e,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let r=null;l.forEach((e=>{const i=t.getLayerSourceCache(e);i&&!e.isHidden(this.transform.zoom)&&i.getVisibleCoordinates().length&&(!r||r.getSource().maxzoom<i.getSource().maxzoom)&&(r=i)})),r&&this.options.showTileBoundaries&&ws.debug(this,r,r.getVisibleCoordinates(),e.bA.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&ws.debug(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new e.bA(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(e){const t=e.transform.padding;Ho(e,e.transform.height-(t.top||0),3,Vo),Ho(e,t.bottom||0,3,jo),Wo(e,t.left||0,3,Uo),Wo(e,e.transform.width-(t.right||0),3,$o);const r=e.transform.centerPoint;!function(e,t,r,i){Zo(e,t-1,r-10,2,20,i),Zo(e,t-10,r-1,20,2,i)}(e,r.x,e.transform.height-r.y,Go)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveCanvasCopy()),h||(this.conflationActive=!1)}prepareLayer(e){this.gpuTimingStart(e);const{unsupportedLayers:t}=this.transform.projection,r=!t||!t.includes(e.type);if(Ts[e.type]&&(r||this.terrain&&"custom"===e.type)){const t=this.style.getLayerSourceCache(e);Ts[e.type](e,t,this)}this.gpuTimingEnd()}renderLayer(e,t,r,i){r.isHidden(this.transform.zoom)||("background"===r.type||"sky"===r.type||"custom"===r.type||"model"===r.type||"raster"===r.type||"raster-particle"===r.type||i&&i.length)&&(this.id=r.id,this.gpuTimingStart(r),e.transform.projection.unsupportedLayers&&e.transform.projection.unsupportedLayers.includes(r.type)&&(!e.terrain||"custom"!==r.type)||"clip"===r.type||ws[r.type](e,t,r,i,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(e){if(!this.options.gpuTiming)return;const t=this.context.extTimerQuery,r=this.context.gl;let i=this.gpuTimers[e.id];i||(i=this.gpuTimers[e.id]={calls:0,cpuTime:0,query:r.createQuery()}),i.calls++,r.beginQuery(t.TIME_ELAPSED_EXT,i.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const e=this.context.extTimerQuery,t=this.context.gl,r=t.createQuery();this.deferredRenderGpuTimeQueries.push(r),t.beginQuery(e.TIME_ELAPSED_EXT,r)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){const e=this.gpuTimers;return this.gpuTimers={},e}collectDeferredRenderGpuQueries(){const e=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],e}queryGpuTimers(e){const t={};for(const r in e){const i=e[r],n=this.context.extTimerQuery,o=n.getQueryParameter(i.query,this.context.gl.QUERY_RESULT)/1e6;n.deleteQueryEXT(i.query),t[r]=o}return t}queryGpuTimeDeferredRender(e){if(!this.options.gpuTimingDeferredRender)return 0;const t=this.context.gl;let r=0;for(const i of e)r+=t.getQueryParameter(i,t.QUERY_RESULT)/1e6,t.deleteQuery(i);return r}translatePosMatrix(t,r,i,n,o){if(!i[0]&&!i[1])return t;const s=o?"map"===n?this.transform.angle:0:"viewport"===n?-this.transform.angle:0;if(s){const e=Math.sin(s),t=Math.cos(s);i=[i[0]*t-i[1]*e,i[0]*e+i[1]*t]}const a=[o?i[0]:e.ak(r,i[0],this.transform.zoom),o?i[1]:e.ak(r,i[1],this.transform.zoom),0],l=new Float32Array(16);return e.a6.mat4.translate(l,t,a),l}saveTileTexture(e){const t=e.size[0],r=this._tileTextures[t];r?r.push(e):this._tileTextures[t]=[e]}getTileTexture(e){const t=this._tileTextures[e];return t&&t.length>0?t.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return null!=this.context.extTextureFloatLinear}currentGlobalDefines(e,t,r){const i=void 0===r?this.terrain&&this.terrain.renderingToTexture:r,n=[];return this.style&&this.style.enable3dLights()&&("globeRaster"===e||"terrainRaster"===e?(n.push("LIGHTING_3D_MODE"),n.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):i||n.push("LIGHTING_3D_MODE")),"shadow"===this.renderPass&&(this._shadowMapDebug||n.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(n.push("TERRAIN"),this.linearFloatFilteringSupported()&&n.push("TERRAIN_DEM_FLOAT_FORMAT")),"globe"===this.transform.projection.name&&n.push("GLOBE"),!this._fogVisible||i||void 0!==t&&!t||n.push("FOG","FOG_DITHERING"),i&&n.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&n.push("OVERDRAW_INSPECTOR"),n}getOrCreateProgram(e,t){this.cache=this.cache||{};const r=t&&t.defines||[],i=t&&t.config,n=this.currentGlobalDefines(e,t&&t.overrideFog,t&&t.overrideRtt).concat(r),o=Dn.cacheKey(Ei[e],e,n,i);return this.cache[o]||(this.cache[o]=new Dn(this.context,e,Ei[e],i,co[e],n)),this.cache[o]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new e.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(t,r){if(this.style.enable3dLights()){const i=this.style.directionalLight,n=this.style.ambientLight;if(i&&n){const o=((t,r,i)=>{const n=t.properties.get("direction"),o=t.properties.get("color").toRenderColor(i.getLut(t.scope)).toArray01(),s=t.properties.get("intensity"),a=r.properties.get("color").toRenderColor(i.getLut(r.scope)).toArray01(),l=r.properties.get("intensity"),c=[n.x,n.y,n.z],u=e.cH(a,l),h=e.cH(o,s);return{u_lighting_ambient_color:u,u_lighting_directional_dir:c,u_lighting_directional_color:h,u_ground_radiance:Pn(c,h,u)}})(i,n,this.style);r.setLightsUniformValues(t,o)}}}uploadCommonUniforms(t,r,i,n,o){if(this.uploadCommonLightUniforms(t,r),this.terrain&&this.terrain.renderingToTexture)return;const s=this.style.fog;if(s){const o=s.getOpacity(this.transform.pitch),a=((t,r,i,n,o,s,a,l,c,u,h,d)=>{const p=t.transform,f=r.properties.get("color").toRenderColor(t.style.getLut(r.scope)).toArray01();f[3]=n;const m=t.frameCounter/1e3%1,[_,g]=r.properties.get("vertical-range");return{u_fog_matrix:i?p.calculateFogTileMatrix(i):d||t.identityMat,u_fog_range:r.getFovAdjustedRange(p._fov),u_fog_color:f,u_fog_horizon_blend:r.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(_,g),g],u_fog_temporal_offset:m,u_frustum_tl:o,u_frustum_tr:s,u_frustum_br:a,u_frustum_bl:l,u_globe_pos:c,u_globe_radius:u,u_viewport:h,u_globe_transition:e.a9(p.zoom),u_is_globe:+("globe"===p.projection.name)}})(this,s,i,o,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*e.q.devicePixelRatio,this.transform.height*e.q.devicePixelRatio],n);r.setFogUniformValues(t,a)}o&&r.setCutoffUniformValues(t,o.uniformValues)}setTileLoadedFlag(e){this.tileLoaded=e}saveCanvasCopy(){const e=this.canvasCopy();e&&(this.frameCopies.push(e),this.tileLoaded=!1)}canvasCopy(){const e=this.context.gl,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,0,0,e.drawingBufferWidth,e.drawingBufferHeight,0),t}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const e=this.style&&this.style.fog;return!!e&&0!==e.getOpacity(this.transform.pitch)}getBackgroundTiles(){const e=this._backgroundTiles,t=this._backgroundTiles={},r=this.transform.coveringTiles({tileSize:512});for(const i of r)t[i.key]=e[i.key]||new pt(i,512,this.transform.tileZoom,this);return t}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(e,t){return!(!e.is3D()||"clip"!==e.type&&(e.minzoom&&e.minzoom>this.transform.zoom||(this.style._clipLayerPresent||"building"!==e.sourceLayer)&&(!t||"batched-model"!==t.type)))}isTileAffectedByFog(e){if(!this.style||!this.style.fog)return!1;if("globe"===this.transform.projection.name)return!0;let t=this._cachedTileFogOpacities[e.key];return t||(this._cachedTileFogOpacities[e.key]=t=this.style.fog.getOpacityForTile(e)),t[0]>=ke||t[1]>=ke}setupDepthForOcclusion(e,t,r){const i=this.context,n=i.gl,o=!!r;var s;r||(r={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),i.activeTexture.set(n.TEXTURE3),e&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(n.NEAREST,n.CLAMP_TO_EDGE),r.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],r.u_depth_range_unpack=[2/((s=this.depthRangeFor3D)[1]-s[0]),-1-2*s[0]/(s[1]-s[0])],r.u_occluder_half_size=.5*this.occlusionParams.occluderSize,r.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(n.NEAREST,n.CLAMP_TO_EDGE),i.activeTexture.set(n.TEXTURE0),o||t.setTerrainUniformValues(i,r)}}function Es(e,t){let r=!1,i=null;const n=()=>{i=null,r&&(e(),i=setTimeout(n,t),r=!1)};return()=>(r=!0,i||n(),i)}class Ms{constructor(t){this._hashName=t&&encodeURIComponent(t),e.aJ(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=Es(this._updateHashUnthrottled.bind(this),300)}addTo(e){return this._map=e,window.addEventListener("hashchange",this._onHashChange,!1),e.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const e=this._map;if(!e)return"";const t=As(e);if(this._hashName){const e=this._hashName;let r=!1;const i=location.hash.slice(1).split("&").map((i=>{const n=i.split("=")[0];return n===e?(r=!0,`${n}=${t}`):i})).filter((e=>e));return r||i.push(`${e}=${t}`),`#${i.join("&")}`}return`#${t}`}_getCurrentHash(){const e=location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map((e=>e.split("="))).forEach((e=>{e[0]===this._hashName&&(t=e)})),(t&&t[1]||"").split("/")}return e.split("/")}_onHashChange(){const e=this._map;if(!e)return!1;const t=this._getCurrentHash();if(t.length>=3&&!t.some((e=>isNaN(e)))){const r=e.dragRotate.isEnabled()&&e.touchZoomRotate.isEnabled()?+(t[3]||0):e.getBearing();return e.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:r,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function As(e,t){const r=e.getCenter(),i=Math.round(100*e.getZoom())/100,n=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,n),s=Math.round(r.lng*o)/o,a=Math.round(r.lat*o)/o,l=e.getBearing(),c=e.getPitch();let u=t?`/${s}/${a}/${i}`:`${i}/${a}/${s}`;return(l||c)&&(u+="/"+Math.round(10*l)/10),c&&(u+=`/${Math.round(c)}`),u}const Cs={linearity:.3,easing:e.dp(0,0,.3,1)},Is=e.l({deceleration:2500,maxSpeed:1400},Cs),Ps=e.l({deceleration:20,maxSpeed:1400},Cs),Rs=e.l({deceleration:1e3,maxSpeed:360},Cs),zs=e.l({deceleration:1e3,maxSpeed:90},Cs);class Ds{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:e.q.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,r=e.q.now();for(;t.length>0&&r-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._map._prefersReducedMotion())return;if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const r={zoom:0,bearing:0,pitch:0,pan:new e.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:e}of this._inertiaBuffer)r.zoom+=e.zoomDelta||0,r.bearing+=e.bearingDelta||0,r.pitch+=e.pitchDelta||0,e.panDelta&&r.pan._add(e.panDelta),e.around&&(r.around=e.around),e.pinchAround&&(r.pinchAround=e.pinchAround);const i=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(r.pan.mag()){const o=Os(r.pan.mag(),i,e.l({},Is,t||{}));n.offset=r.pan.mult(o.amount/r.pan.mag()),n.center=this._map.transform.center,ks(n,o)}if(r.zoom){const e=Os(r.zoom,i,Ps);n.zoom=this._map.transform.zoom+e.amount,ks(n,e)}if(r.bearing){const t=Os(r.bearing,i,Rs);n.bearing=this._map.transform.bearing+e.ap(t.amount,-179,179),ks(n,t)}if(r.pitch){const e=Os(r.pitch,i,zs);n.pitch=this._map.transform.pitch+e.amount,ks(n,e)}if(n.zoom||n.bearing){const e=void 0===r.pinchAround?r.around:r.pinchAround;n.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),n.noMoveStart=!0,n}}function ks(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function Os(t,r,i){const{maxSpeed:n,linearity:o,deceleration:s}=i,a=e.ap(t*o/(r/1e3),-n,n),l=Math.abs(a)/(s*o);return{easing:i.easing,duration:1e3*l,amount:a*(l/2)}}class Ls extends e.x{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,r,i,n={}){const o=g(r.getCanvasContainer(),i),s=r.unproject(o);super(t,e.l({point:o,lngLat:s,originalEvent:i},n)),this._defaultPrevented=!1,this.target=r}}class Bs extends e.x{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,r,i){const n="touchend"===t?i.changedTouches:i.touches,o=y(r.getCanvasContainer(),n),s=o.map((e=>r.unproject(e))),a=o.reduce(((e,t,r,i)=>e.add(t.div(i.length))),new e.P(0,0));super(t,{points:o,point:a,lngLats:s,lngLat:r.unproject(a),originalEvent:i}),this._defaultPrevented=!1}}class Fs extends e.x{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t){super("wheel",{originalEvent:t}),this._defaultPrevented=!1}}class Ns{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){this._mousedownPos=void 0}wheel(e){return this._firePreventable(new Fs(this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new Ls(e.type,this._map,e))}mouseup(e){this._map.fire(new Ls(e.type,this._map,e))}preclick(t){const r=e.l({},t);r.type="preclick",this._map.fire(new Ls(r.type,this._map,r))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||(this.preclick(e),this._map.fire(new Ls(e.type,this._map,e)))}dblclick(e){return this._firePreventable(new Ls(e.type,this._map,e))}mouseover(e){this._map.fire(new Ls(e.type,this._map,e))}mouseout(e){this._map.fire(new Ls(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Bs(e.type,this._map,e))}touchmove(e){this._map.fire(new Bs(e.type,this._map,e))}touchend(e){this._map.fire(new Bs(e.type,this._map,e))}touchcancel(e){this._map.fire(new Bs(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vs{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(e){this._map.fire(new Ls(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ls("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new Ls(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class js{constructor(e,t){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(p(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;const r=t,i=this._startPos,n=this._lastPos;if(!i||!n||n.equals(r)||!this._box&&r.dist(i)<this._clickTolerance)return;this._lastPos=r,this._box||(this._box=l("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",e));const o=Math.min(i.x,r.x),s=Math.max(i.x,r.x),a=Math.min(i.y,r.y),c=Math.max(i.y,r.y);this._map._requestDomTask((()=>{this._box&&(this._box.style.transform=`translate(${o}px,${a}px)`,this._box.style.width=s-o+"px",this._box.style.height=c-a+"px")}))}mouseupWindow(t,r){if(!this._active)return;const i=this._startPos,n=r;if(i&&0===t.button){if(this.reset(),_(),i.x!==n.x||i.y!==n.y)return this._map.fire(new e.x("boxzoomend",{originalEvent:t})),{cameraAnimation:e=>e.fitScreenCoordinates(i,n,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",t)}}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),f(),delete this._startPos,delete this._lastPos}_fireEvent(t,r){return this._map.fire(new e.x(t,{originalEvent:r}))}}function Us(e,t){const r={};for(let i=0;i<e.length;i++)r[e[i].identifier]=t[i];return r}class $s{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(t,r,i){(this.centroid||i.length>this.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=t.timeStamp),i.length===this.numTouches&&(this.centroid=function(t){const r=new e.P(0,0);for(const e of t)r._add(e);return r.div(t.length)}(r),this.touches=Us(i,r)))}touchmove(e,t,r){if(this.aborted||!this.centroid)return;const i=Us(r,t);for(const e in this.touches){const t=i[e];(!t||t.dist(this.touches[e])>30)&&(this.aborted=!0)}}touchend(e,t,r){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===r.length){const e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class Gs{constructor(e){this.singleTap=new $s(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(e,t,r){this.singleTap.touchstart(e,t,r)}touchmove(e,t,r){this.singleTap.touchmove(e,t,r)}touchend(e,t,r){const i=this.singleTap.touchend(e,t,r);if(i){const t=e.timeStamp-this.lastTime<500,r=!this.lastTap||this.lastTap.dist(i)<30;if(t&&r||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=i,this.count===this.numTaps)return this.reset(),i}}}class qs{constructor(){this._zoomIn=new Gs({numTouches:1,numTaps:2}),this._zoomOut=new Gs({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,r){this._zoomIn.touchstart(e,t,r),this._zoomOut.touchstart(e,t,r)}touchmove(e,t,r){this._zoomIn.touchmove(e,t,r),this._zoomOut.touchmove(e,t,r)}touchend(e,t,r){const i=this._zoomIn.touchend(e,t,r),n=this._zoomOut.touchend(e,t,r);return i?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()+1,around:t.unproject(i)},{originalEvent:e})}):n?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()-1,around:t.unproject(n)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const Hs={0:1,2:2};class Ws{constructor(e){this.reset(),this._clickTolerance=e.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(e,t){return!1}_move(e,t){return{}}mousedown(e,t){if(this._lastPoint)return;const r=x(e);this._correctButton(e,r)&&(this._lastPoint=t,this._eventButton=r)}mousemoveWindow(e,t){const r=this._lastPoint;if(r)if(e.preventDefault(),null!=this._eventButton&&function(e,t){const r=Hs[t];return void 0===e.buttons||(e.buttons&r)!==r}(e,this._eventButton))this.reset();else if(this._moved||!(t.dist(r)<this._clickTolerance))return this._moved=!0,this._lastPoint=t,this._move(r,t)}mouseupWindow(e){this._lastPoint&&x(e)===this._eventButton&&(this._moved&&_(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Zs extends Ws{mousedown(e,t){super.mousedown(e,t),this._lastPoint&&(this._active=!0)}_correctButton(e,t){return 0===t&&!e.ctrlKey}_move(e,t){return{around:t,panDelta:t.sub(e)}}}class Xs extends Ws{_correctButton(e,t){return 0===t&&e.ctrlKey||2===t}_move(e,t){const r=.8*(t.x-e.x);if(r)return this._active=!0,{bearingDelta:r}}contextmenu(e){e.preventDefault()}}class Ys extends Ws{_correctButton(e,t){return 0===t&&e.ctrlKey||2===t}_move(e,t){const r=-.5*(t.y-e.y);if(r)return this._active=!0,{pitchDelta:r}}contextmenu(e){e.preventDefault()}}class Js{constructor(t,r){this._map=t,this._el=t.getCanvasContainer(),this._minTouches=1,this._clickTolerance=r.clickTolerance||1,this.reset(),e.aJ(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new e.P(0,0)}touchstart(e,t,r){return this._calculateTransform(e,t,r)}touchmove(t,r,i){if(this._active&&!(i.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(1===i.length&&!e.dq())return void this._showTouchPanBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return t.cancelable&&t.preventDefault(),this._calculateTransform(t,r,i)}}touchend(e,t,r){this._calculateTransform(e,t,r),this._active&&r.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,r,i){i.length>0&&(this._active=!0);const n=Us(i,r),o=new e.P(0,0),s=new e.P(0,0);let a=0;for(const e in n){const t=n[e],r=this._touches[e];r&&(o._add(t),s._add(t.sub(r)),a++,n[e]=t)}if(this._touches=n,a<this._minTouches||!s.mag())return;const l=s.div(a);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(a),panDelta:l}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=l("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout((()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")}),500)}}class Ks{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(e){}_move(e,t,r){return{}}touchstart(e,t,r){this._firstTwoTouches||r.length<2||(this._firstTwoTouches=[r[0].identifier,r[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,r){const i=this._firstTwoTouches;if(!i)return;e.preventDefault();const[n,o]=i,s=Qs(r,t,n),a=Qs(r,t,o);if(!s||!a)return;const l=this._aroundCenter?null:s.add(a).div(2);return this._move([s,a],l,e)}touchend(e,t,r){if(!this._firstTwoTouches)return;const[i,n]=this._firstTwoTouches,o=Qs(r,t,i),s=Qs(r,t,n);o&&s||(this._active&&_(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Qs(e,t,r){for(let i=0;i<e.length;i++)if(e[i].identifier===r)return t[i]}function ea(e,t){return Math.log(e/t)/Math.LN2}class ta extends Ks{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){const r=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(ea(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:ea(this._distance,r),pinchAround:t}}}function ra(e,t){return 180*e.angleWith(t)/Math.PI}class ia extends Ks{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t){const r=this._vector;if(this._vector=e[0].sub(e[1]),r&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:ra(this._vector,r),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const t=25/(Math.PI*this._minDiameter)*360,r=this._startVector;if(!r)return!1;const i=ra(e,r);return Math.abs(i)<t}}function na(e){return Math.abs(e.y)>Math.abs(e.x)}class oa extends Ks{constructor(e){super(),this._map=e}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(e){this._lastPoints=e,na(e[0].sub(e[1]))&&(this._valid=!1)}_move(t,r,i){const n=this._lastPoints;if(!n)return;const o=t[0].sub(n[0]),s=t[1].sub(n[1]);return this._map._cooperativeGestures&&!e.dq()&&i.touches.length<3||(this._valid=this.gestureBeginsVertically(o,s,i.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(o.y+s.y)/2*-.5})}gestureBeginsVertically(e,t,r){if(void 0!==this._valid)return this._valid;const i=e.mag()>=2,n=t.mag()>=2;if(!i&&!n)return;if(!i||!n)return null==this._firstMove&&(this._firstMove=r),r-this._firstMove<100&&void 0;const o=e.y>0==t.y>0;return na(e)&&na(t)&&o}}const sa={panStep:100,bearingStep:15,pitchStep:10};class aa{constructor(){const e=sa;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,r=0,i=0,n=0,o=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?r=-1:(e.preventDefault(),n=-1);break;case 39:e.shiftKey?r=1:(e.preventDefault(),n=1);break;case 38:e.shiftKey?i=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?i=-1:(e.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(r=0,i=0),{cameraAnimation:s=>{const a=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:la,zoom:t?Math.round(a)+t*(e.shiftKey?2:1):a,bearing:s.getBearing()+r*this._bearingStep,pitch:s.getPitch()+i*this._pitchStep,offset:[-n*this._panStep,-o*this._panStep],center:s.getCenter()},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function la(e){return e*(2-e)}const ca=4.000244140625,ua=1/450;class ha{constructor(t,r){this._map=t,this._el=t.getCanvasContainer(),this._handler=r,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=ua,e.aJ(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||e.dq()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let r=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const i=e.q.now(),n=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==r&&r%ca==0?this._type="wheel":0!==r&&Math.abs(r)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=r,this._timeout=window.setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(n*r)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),t.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=t,this._delta-=r,this._active||this._start(t)),t.preventDefault()}_onTimeout(e){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const t=g(this._el,e);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:t,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const t=this._map.transform;"wheel"===this._type&&t.projection.wrap&&(t._center.lng>=180||t._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const r=()=>t._terrainEnabled()&&this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(0!==this._delta){const e="wheel"===this._type&&Math.abs(this._delta)>ca?this._wheelZoomRate:this._defaultZoomRate;let i=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==i&&(i=1/i);const n=r(),o=Math.pow(2,n),s="number"==typeof this._targetZoom?t.zoomScale(this._targetZoom):o;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(s*i))),"wheel"===this._type&&(this._startZoom=n,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const i="number"==typeof this._targetZoom?this._targetZoom:r(),n=this._startZoom,o=this._easing;let s,a=!1;if("wheel"===this._type&&n&&o){const t=Math.min((e.q.now()-this._lastWheelEventTime)/200,1),r=o(t);s=e.aa(n,i,r),t<1?this._frameId||(this._frameId=!0):a=!0}else s=i,a=!0;this._active=!0,a&&(this._active=!1,this._finishTimeout=window.setTimeout((()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout}),200));let l=s-r();return l*this._lastDelta<0&&(l=0),{noInertia:!0,needsRenderFrame:!a,zoomDelta:l,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let r=e.dr;if(this._prevEase){const t=this._prevEase,i=(e.q.now()-t.start)/t.duration,n=t.easing(i+.01)-t.easing(i),o=.27/Math.sqrt(n*n+1e-4)*.01,s=Math.sqrt(.0729-o*o);r=e.dp(o,s,.25,1)}return this._prevEase={start:e.q.now(),duration:t,easing:r},r}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=l("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout((()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")}),200)}}class da{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class pa{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(e,t){return e.preventDefault(),{cameraAnimation:r=>{r.easeTo({duration:300,zoom:r.getZoom()+(e.shiftKey?-1:1),around:r.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class fa{constructor(){this._tap=new Gs({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(e,t,r){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?r.length>0&&(this._swipePoint=t[0],this._swipeTouch=r[0].identifier):this._tap.touchstart(e,t,r))}touchmove(e,t,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;const i=t[0],n=i.y-this._swipePoint.y;return this._swipePoint=i,e.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(e,t,r)}touchend(e,t,r){this._tapTime?this._swipePoint&&0===r.length&&this.reset():this._tap.touchend(e,t,r)&&(this._tapTime=e.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ma{constructor(e,t,r){this._el=e,this._mousePan=t,this._touchPan=r}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class _a{constructor(e,t,r){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=t,this._mousePitch=r}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class ga{constructor(e,t,r,i){this._el=e,this._touchZoom=t,this._touchRotate=r,this._tapDragZoom=i,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const ya=e=>e.zoom||e.drag||e.pitch||e.rotate;class xa extends e.x{}class va{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,r){const i=e.a6.vec3.sub([],r,t);this.radius=e.a6.vec3.length(i[2]<0?e.a6.vec3.div([],i,this.constants):[i[0],i[1],0])}projectRay(t){e.a6.vec3.div(t,t,this.constants),e.a6.vec3.normalize(t,t),e.a6.vec3.mul(t,t,this.constants);const r=e.a6.vec3.scale([],t,this.radius);if(r[2]>0){const t=e.a6.vec3.scale([],[0,0,1],e.a6.vec3.dot(r,[0,0,1])),i=e.a6.vec3.scale([],e.a6.vec3.normalize([],[r[0],r[1],0]),this.radius),n=e.a6.vec3.add([],r,e.a6.vec3.scale([],e.a6.vec3.sub([],e.a6.vec3.add([],i,t),r),2));r[0]=n[0],r[1]=n[1]}return r}}function ba(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}class wa{constructor(t,r){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ds(t),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new va,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(r),e.aJ(["handleEvent","handleWindowEvent"],this);const i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[window,"blur",void 0]];for(const[e,t,r]of this._listeners){const i=e===document?this.handleWindowEvent:this.handleEvent;e.addEventListener(t,i,r)}}destroy(){for(const[e,t,r]of this._listeners){const i=e===document?this.handleWindowEvent:this.handleEvent;e.removeEventListener(t,i,r)}}_addDefaultHandlers(e){const t=this._map,r=t.getCanvasContainer();this._add("mapEvent",new Ns(t,e));const i=t.boxZoom=new js(t,e);this._add("boxZoom",i);const n=new qs,o=new pa;t.doubleClickZoom=new da(o,n),this._add("tapZoom",n),this._add("clickZoom",o);const s=new fa;this._add("tapDragZoom",s);const a=t.touchPitch=new oa(t);this._add("touchPitch",a);const l=new Xs(e),c=new Ys(e);t.dragRotate=new _a(e,l,c),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);const u=new Zs(e),h=new Js(t,e);t.dragPan=new ma(r,u,h),this._add("mousePan",u),this._add("touchPan",h,["touchZoom","touchRotate"]);const d=new ia,p=new ta;t.touchZoomRotate=new ga(r,p,d,s),this._add("touchRotate",d,["touchPan","touchZoom"]),this._add("touchZoom",p,["touchPan","touchRotate"]),this._add("blockableMapEvent",new Vs(t));const f=t.scrollZoom=new ha(t,this);this._add("scrollZoom",f,["mousePan"]);const m=t.keyboard=new aa;this._add("keyboard",m);for(const r of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])e.interactive&&e[r]&&t[r].enable(e[r])}_add(e,t,r){this._handlers.push({handlerName:e,handler:t,allowed:r}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(const{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!ya(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(e,t,r){for(const i in e)if(i!==r&&(!t||t.indexOf(i)<0))return!0;return!1}handleWindowEvent(e){this.handleEvent(e,`${e.type}Window`)}_getMapTouches(e){const t=[];for(const r of e)this._el.contains(r.target)&&t.push(r);return t}handleEvent(e,t){this._updatingCamera=!0;const r="renderFrame"===e.type,i=r?void 0:e,n={needsRenderFrame:!1},o={},s={},a=e.touches?this._getMapTouches(e.touches):void 0,l=a?y(this._el,a):r?void 0:g(this._el,e);for(const{handlerName:r,handler:c,allowed:u}of this._handlers){if(!c.isEnabled())continue;let h;this._blockedByActive(s,u,r)?c.reset():c[t||e.type]&&(h=c[t||e.type](e,l,a),this.mergeHandlerResult(n,o,h,r,i),h&&h.needsRenderFrame&&this._triggerRenderFrame()),(h||c.isActive())&&(s[r]=c)}const c={};for(const e in this._previousActiveHandlers)s[e]||(c[e]=i);this._previousActiveHandlers=s,(Object.keys(c).length||ba(n))&&(this._changes.push([n,o,c]),this._triggerRenderFrame()),(Object.keys(s).length||ba(n))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:u}=n;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map))}mergeHandlerResult(t,r,i,n,o){if(!i)return;e.l(t,i);const s={handlerName:n,originalEvent:i.originalEvent||o};void 0!==i.zoomDelta&&(r.zoom=s),void 0!==i.panDelta&&(r.drag=s),void 0!==i.pitchDelta&&(r.pitch=s),void 0!==i.bearingDelta&&(r.rotate=s)}_applyChanges(){const t={},r={},i={};for(const[n,o,s]of this._changes)n.panDelta&&(t.panDelta=(t.panDelta||new e.P(0,0))._add(n.panDelta)),n.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+n.pitchDelta),void 0!==n.around&&(t.around=n.around),void 0!==n.aroundCoord&&(t.aroundCoord=n.aroundCoord),void 0!==n.pinchAround&&(t.pinchAround=n.pinchAround),n.noInertia&&(t.noInertia=n.noInertia),e.l(r,o),e.l(i,s);this._updateMapTransform(t,r,i),this._changes=[]}_updateMapTransform(t,r,i){const n=this._map,o=n.transform,s=e=>[e.x,e.y,e.z];if((()=>{const e=this._eventsInProgress.drag;return e&&!this._handlersById[e.handlerName].isActive()})()&&!ba(t)){const e=o.zoom;o.cameraElevationReference="sea",null!=this._originalZoom&&o._orthographicProjectionAtLowPitch&&"globe"!==o.projection.name&&0===o.pitch?(o.cameraElevationReference="ground",o.zoom=this._originalZoom):(o.recenterOnTerrain(),o.cameraElevationReference="ground"),e!==o.zoom&&this._map._update(!0)}if(o._isCameraConstrained&&n._stop(!0),!ba(t))return void this._fireEvents(r,i,!0);let{panDelta:a,zoomDelta:l,bearingDelta:c,pitchDelta:u,around:h,aroundCoord:d,pinchAround:p}=t;o._isCameraConstrained&&(l>0&&(l=0),o._isCameraConstrained=!1),void 0!==p&&(h=p),(l||(e=>r[e]&&!this._eventsInProgress[e])("drag"))&&h&&(this._dragOrigin=s(o.pointCoordinate3D(h)),this._originalZoom=o.zoom,this._trackingEllipsoid.setup(o._camera.position,this._dragOrigin)),o.cameraElevationReference="sea",n._stop(!0),h=h||n.transform.centerPoint,c&&(o.bearing+=c),u&&(o.pitch+=u),o._updateCameraState();const f=[0,0,0];if(a)if("mercator"===o.projection.name){const e=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(h).dir),t=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(h.sub(a)).dir);f[0]=t[0]-e[0],f[1]=t[1]-e[1]}else{const t=o.pointCoordinate(h);if("globe"===o.projection.name){a=a.rotate(-o.angle);const r=o._pixelsPerMercatorPixel/o.worldSize;f[0]=-a.x*e.ds(e.aN(t.y))*r,f[1]=-a.y*e.ds(o.center.lat)*r}else{const e=o.pointCoordinate(h.sub(a));t&&e&&(f[0]=e.x-t.x,f[1]=e.y-t.y)}}const m=o.zoom,_=[0,0,0];if(l){const t=s(d||o.pointCoordinate3D(h)),r={dir:e.a6.vec3.normalize([],e.a6.vec3.sub([],t,o._camera.position))};if(r.dir[2]<0){const i=o.zoomDeltaToMovement(t,l);e.a6.vec3.scale(_,r.dir,i)}}const g=e.a6.vec3.add(f,f,_);o._translateCameraConstrained(g),l&&Math.abs(o.zoom-m)>1e-4&&o.recenterOnTerrain(),o.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(r,i,!0)}_fireEvents(t,r,i){const n=ya(this._eventsInProgress),o=ya(t),s={};for(const e in t){const{originalEvent:r}=t[e];this._eventsInProgress[e]||(s[`${e}start`]=r),this._eventsInProgress[e]=t[e]}!n&&o&&this._fireEvent("movestart",o.originalEvent);for(const e in s)this._fireEvent(e,s[e]);o&&this._fireEvent("move",o.originalEvent);for(const e in t){const{originalEvent:r}=t[e];this._fireEvent(e,r)}const a={};let l;for(const e in this._eventsInProgress){const{handlerName:t,originalEvent:i}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],l=r[t]||i,a[`${e}end`]=l)}for(const e in a)this._fireEvent(e,a[e]);const c=ya(this._eventsInProgress);if(i&&(n||o)&&!c){this._updatingCamera=!0;const t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),r=e=>0!==e&&-this._bearingSnap<e&&e<this._bearingSnap;t?(r(t.bearing||this._map.getBearing())&&(t.bearing=0),this._map.easeTo(t,{originalEvent:l})):(this._map.fire(new e.x("moveend",{originalEvent:l})),r(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,r){this._map.fire(new e.x(t,r?{originalEvent:r}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((e=>{this._frameId=void 0,this.handleEvent(new xa("renderFrame",{timeStamp:e})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const Ta="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class Sa extends e.E{constructor(t,r){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=r.bearingSnap,this._respectPrefersReducedMotion=!1!==r.respectPrefersReducedMotion,e.aJ(["_renderFrameCallback"],this)}getCenter(){return new e.bL(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}panBy(t,r,i){return t=e.P.convert(t).mult(-1),this.panTo(this.transform.center,e.l({offset:t},r),i)}panTo(t,r,i){return this.easeTo(e.l({center:t},r),i)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(t,r,i){return this.easeTo(e.l({zoom:t},r),i)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(t,r,i){return this.easeTo(e.l({bearing:t},r),i)}resetNorth(t,r){return this.rotateTo(0,e.l({duration:1e3},t),r),this}resetNorthPitch(t,r){return this.easeTo(e.l({bearing:0,pitch:0,duration:1e3},t),r),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}cameraForBounds(t,r){t=e.as.convert(t);const i=r&&r.bearing||0,n=r&&r.pitch||0,o=t.getNorthWest(),s=t.getSouthEast();return this._cameraForBounds(this.transform,o,s,i,n,r)}_extendPadding(t){const r={top:0,right:0,bottom:0,left:0};return null==t?e.l({},r,this.transform.padding):"number"==typeof t?{top:t,bottom:t,right:t,left:t}:e.l({},r,t)}_extendCameraOptions(t){return(t=e.l({offset:[0,0],maxZoom:this.transform.maxZoom},t)).padding=this._extendPadding(t.padding),t}_minimumAABBFrustumDistance(e,t){const r=t.max[0]-t.min[0],i=t.max[1]-t.min[1];return r/i>e.aspect?r/(2*Math.tan(.5*e.fovX)*e.aspect):i/(2*Math.tan(.5*e.fovY)*e.aspect)}_cameraForBoundsOnGlobe(t,r,i,n,o,s){const a=t.clone(),l=this._extendCameraOptions(s);a.bearing=n,a.pitch=o;const c=e.bL.convert(r),u=e.bL.convert(i),h=.5*(c.lat+u.lat),d=.5*(c.lng+u.lng),p=e.dt(h,d),f=e.a6.vec3.normalize([],p),m=e.a6.vec3.normalize([],e.a6.vec3.cross([],f,[0,1,0])),_=e.a6.vec3.cross([],m,f),g=[m[0],m[1],m[2],0,_[0],_[1],_[2],0,f[0],f[1],f[2],0,0,0,0,1],y=[p,e.dt(c.lat,c.lng),e.dt(u.lat,c.lng),e.dt(u.lat,u.lng),e.dt(c.lat,u.lng),e.dt(h,c.lng),e.dt(h,u.lng),e.dt(c.lat,d),e.dt(u.lat,d)];let x=e.ca.fromPoints(y.map((t=>[e.a6.vec3.dot(m,t),e.a6.vec3.dot(_,t),e.a6.vec3.dot(f,t)])));const v=e.a6.vec3.transformMat4([],x.center,g);0===e.a6.vec3.squaredLength(v)&&e.a6.vec3.set(v,0,0,1),e.a6.vec3.normalize(v,v),e.a6.vec3.scale(v,v,e.aq),a.center=e.du(v);const b=a.getWorldToCameraMatrix(),w=e.a6.mat4.invert(new Float64Array(16),b);x=e.ca.applyTransform(x,e.a6.mat4.multiply([],b,g));const T=this._extendAABB(x,a,l,n);if(!T)return void e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");x=T,e.a6.vec3.transformMat4(v,v,b);const S=.5*(x.max[2]-x.min[2]),E=this._minimumAABBFrustumDistance(a,x),M=e.a6.vec3.scale([],[0,0,1],S),A=e.a6.vec3.add(M,v,M),C=E+(0===a.pitch?0:e.a6.vec3.distance(v,A)),I=a.globeCenterInViewSpace,P=e.a6.vec3.sub([],v,[I[0],I[1],I[2]]);e.a6.vec3.normalize(P,P),e.a6.vec3.scale(P,P,C);const R=e.a6.vec3.add([],v,P);e.a6.vec3.transformMat4(R,R,w);const z=e.dw/e.aq,D=e.a6.vec3.length(R),k=e.bE(Math.max(D*z-e.dw,Number.EPSILON),0),O=Math.min(a.zoomFromMercatorZAdjusted(k),l.maxZoom);return O>.5*(e.c3+e.bV)?(a.setProjection({name:"mercator"}),a.zoom=O,this._cameraForBounds(a,r,i,n,o,s)):{center:a.center,zoom:O,bearing:n,pitch:o}}_extendAABB(t,r,i,n){const o=.5*((i.padding.left||0)+(i.padding.right||0)),s=.5*((i.padding.top||0)+(i.padding.bottom||0)),a=s,l=o,c=o,u=s,h=r.width-(l+c),d=r.height-(a+u),p=e.a6.vec3.sub([],t.max,t.min),f=Math.min(h/p[0],d/p[1]),m=Math.min(r.scaleZoom(r.scale*f),i.maxZoom);if(isNaN(m))return null;const _=r.scale/r.zoomScale(m),g=new e.ca([t.min[0]-l*_,t.min[1]-u*_,t.min[2]],[t.max[0]+c*_,t.max[1]+a*_,t.max[2]]),y=("number"==typeof i.offset.x&&"number"==typeof i.offset.y?new e.P(i.offset.x,i.offset.y):e.P.convert(i.offset)).rotate(-e.bC(n));return g.center[0]-=y.x*_,g.center[1]+=y.y*_,g}queryTerrainElevation(t,r){const i=this.transform.elevation;return i?(r=e.l({},{exaggerated:!0},r),i.getAtPoint(e.a5.fromLngLat(t),null,r.exaggerated)):null}_cameraForBounds(t,r,i,n,o,s){if("globe"===t.projection.name)return this._cameraForBoundsOnGlobe(t,r,i,n,o,s);const a=t.clone(),l=this._extendCameraOptions(s);a.bearing=n,a.pitch=o;const c=e.bL.convert(r),u=e.bL.convert(i),h=new e.bL(c.lng,u.lat),d=new e.bL(u.lng,c.lat),p=a.project(c),f=a.project(u),m=this.queryTerrainElevation(c),_=this.queryTerrainElevation(u),g=this.queryTerrainElevation(h),y=this.queryTerrainElevation(d),x=[[p.x,p.y,Math.min(m||0,_||0,g||0,y||0)],[f.x,f.y,Math.max(m||0,_||0,g||0,y||0)]];let v=e.ca.fromPoints(x);const b=a.getWorldToCameraMatrix(),w=e.a6.mat4.invert(new Float64Array(16),b);v=e.ca.applyTransform(v,b);const T=this._extendAABB(v,a,l,n);if(!T)return void e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");v=T;const S=.5*e.a6.vec3.sub([],v.max,v.min)[2],E=this._minimumAABBFrustumDistance(a,v),M=[0,0,1,0];e.a6.vec4.transformMat4(M,M,b),e.a6.vec4.normalize(M,M);const A=e.a6.vec3.scale([],M,E+S),C=e.a6.vec3.add([],v.center,A);e.a6.vec3.transformMat4(v.center,v.center,w),e.a6.vec3.transformMat4(C,C,w);const I=a.unproject(new e.P(v.center[0],v.center[1])),P=e.dv(a.projection,I),R=Math.pow(2,P),z=Math.min(a._zoomFromMercatorZ(C[2]*a.pixelsPerMeter*R/a.worldSize),l.maxZoom);return a.mercatorFromTransition&&z<.5*(e.c3+e.bV)?(a.setProjection({name:"globe"}),a.zoom=z,this._cameraForBounds(a,r,i,n,o,s)):{center:I,zoom:z,bearing:n,pitch:o}}fitBounds(e,t,r){const i=this.cameraForBounds(e,t);return this._fitInternal(i,t,r)}fitScreenCoordinates(t,r,i,n,o){const s=e.P.convert(t),a=e.P.convert(r),l=new e.P(Math.min(s.x,a.x),Math.min(s.y,a.y)),c=new e.P(Math.max(s.x,a.x),Math.max(s.y,a.y));if("mercator"===this.transform.projection.name&&this.transform.anyCornerOffEdge(s,a))return this;const u=this.transform.pointLocation3D(l),h=this.transform.pointLocation3D(c),d=this.transform.pointLocation3D(new e.P(l.x,c.y)),p=this.transform.pointLocation3D(new e.P(c.x,l.y)),f=[Math.min(u.lng,h.lng,d.lng,p.lng),Math.min(u.lat,h.lat,d.lat,p.lat)],m=[Math.max(u.lng,h.lng,d.lng,p.lng),Math.max(u.lat,h.lat,d.lat,p.lat)],_=n&&n.pitch?n.pitch:this.getPitch(),g=this._cameraForBounds(this.transform,f,m,i,_,n);return this._fitInternal(g,n,o)}_fitInternal(t,r,i){return t?(r=e.l(t,r)).linear?this.easeTo(r,i):this.flyTo(r,i):this}jumpTo(t,r){this.stop();const i=t.preloadOnly?this.transform.clone():this.transform;let n=!1,o=!1,s=!1;"zoom"in t&&i.zoom!==+t.zoom&&(n=!0,i.zoom=+t.zoom),void 0!==t.center&&(i.center=e.bL.convert(t.center)),"bearing"in t&&i.bearing!==+t.bearing&&(o=!0,i.bearing=+t.bearing),"pitch"in t&&i.pitch!==+t.pitch&&(s=!0,i.pitch=+t.pitch);const a="number"==typeof t.padding?this._extendPadding(t.padding):t.padding;if(null!=t.padding&&!i.isPaddingEqual(a))if(!1===t.retainPadding){const e=i.clone();e.padding=a,i.setLocationAtPoint(i.center,e.centerPoint)}else i.padding=a;return t.preloadOnly?(this._preloadTiles(i),this):(this.fire(new e.x("movestart",r)).fire(new e.x("move",r)),n&&this.fire(new e.x("zoomstart",r)).fire(new e.x("zoom",r)).fire(new e.x("zoomend",r)),o&&this.fire(new e.x("rotatestart",r)).fire(new e.x("rotate",r)).fire(new e.x("rotateend",r)),s&&this.fire(new e.x("pitchstart",r)).fire(new e.x("pitch",r)).fire(new e.x("pitchend",r)),this.fire(new e.x("moveend",r)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||e.w(Ta),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,r){const i=this.transform;if(!i.projection.supportsFreeCamera)return e.w(Ta),this;this.stop();const n=i.zoom,o=i.pitch,s=i.bearing;i.setFreeCameraOptions(t);const a=n!==i.zoom,l=o!==i.pitch,c=s!==i.bearing;return this.fire(new e.x("movestart",r)).fire(new e.x("move",r)),a&&this.fire(new e.x("zoomstart",r)).fire(new e.x("zoom",r)).fire(new e.x("zoomend",r)),c&&this.fire(new e.x("rotatestart",r)).fire(new e.x("rotate",r)).fire(new e.x("rotateend",r)),l&&this.fire(new e.x("pitchstart",r)).fire(new e.x("pitch",r)).fire(new e.x("pitchend",r)),this.fire(new e.x("moveend",r)),this}easeTo(t,r){this._stop(!1,t.easeId),(!1===(t=e.l({offset:[0,0],duration:500,easing:e.dr},t)).animate||this._prefersReducedMotion(t))&&(t.duration=0);const i=this.transform,n=this.getZoom(),o=this.getBearing(),s=this.getPitch(),a=this.getPadding(),l="zoom"in t?+t.zoom:n,c="bearing"in t?this._normalizeBearing(t.bearing,o):o,u="pitch"in t?+t.pitch:s,h=this._extendPadding(t.padding),d=e.P.convert(t.offset);let p,f,m;if("globe"===i.projection.name){const r=e.a5.fromLngLat(i.center),n=d.rotate(-i.angle);r.x+=n.x/i.worldSize,r.y+=n.y/i.worldSize;const o=r.toLngLat(),s=e.bL.convert(t.center||o);this._normalizeCenter(s),p=i.centerPoint.add(n),f=new e.P(r.x,r.y).mult(i.worldSize),m=new e.P(e.am(s.lng),e.at(s.lat)).mult(i.worldSize).sub(f)}else{p=i.centerPoint.add(d);const r=i.pointLocation(p),n=e.bL.convert(t.center||r);this._normalizeCenter(n),f=i.project(r),m=i.project(n).sub(f)}const _=i.zoomScale(l-n);let g,y;t.around&&(g=e.bL.convert(t.around),y=i.locationPoint(g));const x=this._zooming||l!==n,v=this._rotating||o!==c,b=this._pitching||u!==s,w=!i.isPaddingEqual(h),T=!1===t.retainPadding?i.clone():i,S=i=>S=>{if(x&&(i.zoom=e.aa(n,l,S)),v&&(i.bearing=e.aa(o,c,S)),b&&(i.pitch=e.aa(s,u,S)),w&&(T.interpolatePadding(a,h,S),p=T.centerPoint.add(d)),g)i.setLocationAtPoint(g,y);else{const e=i.zoomScale(i.zoom-n),t=l>n?Math.min(2,_):Math.max(.5,_),r=Math.pow(t,1-S),o=i.unproject(f.add(m.mult(S*r)).mult(e));i.setLocationAtPoint(i.renderWorldCopies?o.wrap():o,p)}return t.preloadOnly||this._fireMoveEvents(r),i};if(t.preloadOnly){const e=this._emulate(S,t.duration,i);return this._preloadTiles(e),this}const E={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=x,this._rotating=v,this._pitching=b,this._padding=w,this._easeId=t.easeId,this._prepareEase(r,t.noMoveStart,E),this._ease(S(i),(e=>{"sea"===i.cameraElevationReference&&i.recenterOnTerrain(),this._afterEase(r,e)}),t),this}_prepareEase(t,r,i={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&0===this.transform.pitch&&"globe"!==this.transform.projection.name&&(this.transform.cameraElevationReference="ground"),r||i.moving||this.fire(new e.x("movestart",t)),this._zooming&&!i.zooming&&this.fire(new e.x("zoomstart",t)),this._rotating&&!i.rotating&&this.fire(new e.x("rotatestart",t)),this._pitching&&!i.pitching&&this.fire(new e.x("pitchstart",t))}_fireMoveEvents(t){this.fire(new e.x("move",t)),this._zooming&&this.fire(new e.x("zoom",t)),this._rotating&&this.fire(new e.x("rotate",t)),this._pitching&&this.fire(new e.x("pitch",t))}_afterEase(t,r){if(this._easeId&&r&&this._easeId===r)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const i=this._zooming,n=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,i&&this.fire(new e.x("zoomend",t)),n&&this.fire(new e.x("rotateend",t)),o&&this.fire(new e.x("pitchend",t)),this.fire(new e.x("moveend",t))}flyTo(t,r){if(this._prefersReducedMotion(t)){const i=e.ar(t,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(i,r)}this.stop(),t=e.l({offset:[0,0],speed:1.2,curve:1.42,easing:e.dr},t);const i=this.transform,n=this.getZoom(),o=this.getBearing(),s=this.getPitch(),a=this.getPadding(),l="zoom"in t?e.ap(+t.zoom,i.minZoom,i.maxZoom):n,c="bearing"in t?this._normalizeBearing(t.bearing,o):o,u="pitch"in t?+t.pitch:s,h=this._extendPadding(t.padding),d=i.zoomScale(l-n),p=e.P.convert(t.offset);let f=i.centerPoint.add(p);const m=i.pointLocation(f),_=e.bL.convert(t.center||m);this._normalizeCenter(_);const g=i.project(m),y=i.project(_).sub(g);let x=t.curve;const v=Math.max(i.width,i.height),b=v/d,w=y.mag();if("minZoom"in t){const r=e.ap(Math.min(t.minZoom,n,l),i.minZoom,i.maxZoom),o=v/i.zoomScale(r-n);x=Math.sqrt(o/w*2)}const T=x*x;function S(e){const t=(b*b-v*v+(e?-1:1)*T*T*w*w)/(2*(e?b:v)*T*w);return Math.log(Math.sqrt(t*t+1)-t)}function E(e){return(Math.exp(e)-Math.exp(-e))/2}function M(e){return(Math.exp(e)+Math.exp(-e))/2}const A=S(0);let C=function(e){return M(A)/M(A+x*e)},I=function(e){return v*((M(A)*(E(t=A+x*e)/M(t))-E(A))/T)/w;var t},P=(S(1)-A)/x;if(Math.abs(w)<1e-6||!isFinite(P)){if(Math.abs(v-b)<1e-6)return this.easeTo(t,r);const e=b<v?-1:1;P=Math.abs(Math.log(b/v))/x,I=function(){return 0},C=function(t){return Math.exp(e*x*t)}}t.duration="duration"in t?+t.duration:1e3*P/("screenSpeed"in t?+t.screenSpeed/x:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0);const R=o!==c,z=u!==s,D=!i.isPaddingEqual(h),k=!1===t.retainPadding?i.clone():i,O=i=>d=>{const m=d*P,x=1/C(m);i.zoom=1===d?l:n+i.scaleZoom(x),R&&(i.bearing=e.aa(o,c,d)),z&&(i.pitch=e.aa(s,u,d)),D&&(k.interpolatePadding(a,h,d),f=k.centerPoint.add(p));const v=1===d?_:i.unproject(g.add(y.mult(I(m))).mult(x));return i.setLocationAtPoint(i.renderWorldCopies?v.wrap():v,f),i._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(r),i};if(t.preloadOnly){const e=this._emulate(O,t.duration,i);return this._preloadTiles(e),this}return this._zooming=!0,this._rotating=R,this._pitching=z,this._padding=D,this._prepareEase(r,!1),this._ease(O(i),(()=>this._afterEase(r)),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(e){}_cancelRenderFrame(e){}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const e=this._onEaseEnd;this._onEaseEnd=void 0,e.call(this,t)}if(!e){const e=this.handlers;e&&e.stop(!1)}return this}_ease(t,r,i){!1===i.animate||0===i.duration?(t(1),r()):(this._easeStart=e.q.now(),this._easeOptions=i,this._onEaseFrame=t,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((e.q.now()-this._easeStart)/this._easeOptions.duration,1),r=this._onEaseFrame;r&&r(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,r){t=e.bB(t,-180,180);const i=Math.abs(t-r);return Math.abs(t-360-r)<i&&(t-=360),Math.abs(t+360-r)<i&&(t+=360),t}_normalizeCenter(e){const t=this.transform;if(t.maxBounds)return;if("globe"!==t.projection.name&&!t.renderWorldCopies)return;const r=e.lng-t.center.lng;e.lng+=r>180?-360:r<-180?360:0}_prefersReducedMotion(t){return this._respectPrefersReducedMotion&&e.q.prefersReducedMotion&&!(t&&t.essential)}_emulate(e,t,r){const i=Math.ceil(15*t/1e3),n=[],o=e(r.clone());for(let e=0;e<=i;e++){const t=o(e/i);n.push(t.clone())}return n}_preloadTiles(e,t){}}class Ea{constructor(t={}){this.options=t,e.aJ(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(e){const t=this.options&&this.options.compact,r=e._getUIString("AttributionControl.ToggleAttribution");this._map=e,this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=l("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",r);const i=l("span","mapboxgl-ctrl-icon",this._compactButton);return i.setAttribute("aria-hidden","true"),i.setAttribute("title",r),this._innerContainer=l("div","mapboxgl-ctrl-attrib-inner",this._container),t&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===t&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));const r=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||e.e.ACCESS_TOKEN}];if(t){const i=r.reduce(((e,t,i)=>(t.value&&(e+=`${t.key}=${t.value}${i<r.length-1?"&":""}`),e)),"?");t.href=`${e.e.FEEDBACK_URL}/${i}#${As(this._map,!0)}`,t.rel="noopener nofollow"}}_updateData(e){!e||"metadata"!==e.sourceDataType&&"visibility"!==e.sourceDataType&&"style"!==e.dataType||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let e=[];if(this._map.style.stylesheet){const e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}const t=this._map.style._mergedSourceCaches;for(const r in t){const i=t[r];if(i.used){const t=i.getSource();t.attribution&&e.indexOf(t.attribution)<0&&e.push(t.attribution)}}e.sort(((e,t)=>e.length-t.length)),e=e.filter(((t,r)=>{for(let i=r+1;i<e.length;i++)if(e[i].indexOf(t)>=0)return!1;return!0})),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=[...this.options.customAttribution,...e]:e.unshift(this.options.customAttribution));const r=e.join(" | ");r!==this._attribHTML&&(this._attribHTML=r,e.length?(this._innerContainer.innerHTML=r,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class Ma{constructor(){e.aJ(["_updateLogo","_updateCompact"],this)}onAdd(e){this._map=e,this._container=l("div","mapboxgl-ctrl");const t=l("a","mapboxgl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://www.mapbox.com/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(e){e&&"metadata"!==e.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const e=this._map.style._sourceCaches;if(0===Object.entries(e).length)return!0;for(const t in e){const r=e[t].getSource();if(r.hasOwnProperty("mapbox_logo")&&!r.mapbox_logo)return!1}return!0}_updateCompact(){const e=this._container.children;if(e.length){const t=e[0];this._map.getCanvasContainer().offsetWidth<250?t.classList.add("mapboxgl-compact"):t.classList.remove("mapboxgl-compact")}}}class Aa{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){const t=this._currentlyRunning,r=t?this._queue.concat(t):this._queue;for(const t of r)if(t.id===e)return void(t.cancelled=!0)}run(e=0){const t=this._currentlyRunning=this._queue;this._queue=[];for(const r of t)if(!r.cancelled&&(r.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class Ca{constructor(e){this.jumpTo(e)}getValue(t){if(t<=this._startTime)return this._start;if(t>=this._endTime)return this._end;const r=e.cw((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-r)+this._end*r}isEasing(e){return e>=this._startTime&&e<=this._endTime}jumpTo(e){this._startTime=-1/0,this._endTime=-1/0,this._start=e,this._end=e}easeTo(e,t,r){this._start=this.getValue(t),this._end=e,this._startTime=t,this._endTime=t+r}}const Ia={"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},Pa=["mouseenter","mouseover","mouseleave","mouseout"];class Ra extends e.x{constructor(e,t,r,i){const{point:n,lngLat:o,originalEvent:s,target:a}=e;super(e.type,{point:n,lngLat:o,originalEvent:s,target:a}),this.preventDefault=()=>{e.preventDefault()},this.id=t,this.interaction=r,this.feature=i}}class za{constructor(e){this.map=e,this.interactionsByType=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this)}add(t,r){if(this.typeById.has(t))throw new Error(`Interaction id "${t}" already exists.`);const{type:i,filter:n}=r;if(n){const r=e.M(n,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===r.result)throw new Error(r.value.map((e=>`${e.key}: ${e.message}`)).join(", "));this.filters.set(t,r.value)}const o=this.interactionsByType.get(i)||new Map;0===o.size&&(Pa.includes(i)?this.map.on(i,r.featureset,this.handleType):this.map.on(i,this.handleType),this.interactionsByType.set(i,o)),o.set(t,r),this.typeById.set(t,i)}remove(e){const t=this.typeById.get(e);if(!t)return;this.typeById.delete(e),this.filters.delete(e);const r=this.interactionsByType.get(t);r&&(r.delete(e),0===r.size&&this.map.off(t,this.handleType))}handleType(t){const r=this.interactionsByType.get(t.type),i=Array.from(r).reverse(),n=[];for(const[,e]of i)e.featureset&&n.push({featureset:e.featureset,filter:e.filter,radius:e.radius});let o=this.map.style.queryRenderedFeaturesForInteractions(t.point,n,this.map.transform);!o.length&&Pa.includes(t.type)&&(o=[null]);let s=!1;for(const r of o){for(const[n,o]of i){const{handler:i,featureset:a}=o;if(a&&(null==r||e.bi(r.featureset,a))&&!1!==i(new Ra(t,n,o,r))){s=!0;break}}if(s)break}if(!s)for(const[e,r]of i){const{handler:i,featureset:n}=r;if(!n&&!1!==i(new Ra(t,e,r,null)))break}}}function Da(t,r){if(Array.isArray(t)&&Array.isArray(r)){const e=new Set(t),i=new Set(r);return e.size===i.size&&t.every((e=>i.has(e)))}return e.bi(t,r)}const ka={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1},Oa={showCompass:!0,showZoom:!0,visualizePitch:!1};class La{constructor(t,r,i=!1){this._clickTolerance=10,this.element=r,this.mouseRotate=new Xs({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,i&&(this.mousePitch=new Ys({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),e.aJ(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),r.addEventListener("mousedown",this.mousedown),r.addEventListener("touchstart",this.touchstart,{passive:!1}),r.addEventListener("touchmove",this.touchmove),r.addEventListener("touchend",this.touchend),r.addEventListener("touchcancel",this.reset)}down(e,t){this.mouseRotate.mousedown(e,t),this.mousePitch&&this.mousePitch.mousedown(e,t),p()}move(e,t){const r=this.map,i=this.mouseRotate.mousemoveWindow(e,t),n=i&&i.bearingDelta;if(n&&r.setBearing(r.getBearing()+n),this.mousePitch){const i=this.mousePitch.mousemoveWindow(e,t),n=i&&i.pitchDelta;n&&r.setPitch(r.getPitch()+n)}}off(){const e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart,{passive:!1}),e.removeEventListener("touchmove",this.touchmove),e.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){f(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down(e.l({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),g(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(e){this.move(e,g(this.element,e))}mouseup(e){this.mouseRotate.mouseupWindow(e),this.mousePitch&&this.mousePitch.mouseupWindow(e),this.offTemp()}touchstart(e){1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=y(this.element,e.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>e.preventDefault()},this._startPos))}touchmove(e){1!==e.targetTouches.length?this.reset():(this._lastPos=y(this.element,e.targetTouches)[0],this.move({preventDefault:()=>e.preventDefault()},this._lastPos))}touchend(e){0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function Ba(t,r,i){if(t=new e.bL(t.lng,t.lat),r){const n=new e.bL(t.lng-360,t.lat),o=new e.bL(t.lng+360,t.lat),s=360*Math.ceil(Math.abs(t.lng-i.center.lng)/360),a=i.locationPoint(t).distSqr(r),l=r.x<0||r.y<0||r.x>i.width||r.y>i.height;i.locationPoint(n).distSqr(r)<a&&(l||Math.abs(n.lng-i.center.lng)<s)?t=n:i.locationPoint(o).distSqr(r)<a&&(l||Math.abs(o.lng-i.center.lng)<s)&&(t=o)}for(;Math.abs(t.lng-i.center.lng)>180;){const e=i.locationPoint(t);if(e.x>=0&&e.y>=0&&e.x<=i.width&&e.y<=i.height)break;t.lng>i.center.lng?t.lng-=360:t.lng+=360}return t}const Fa={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};class Na extends e.E{constructor(t,r){if(super(),(t instanceof HTMLElement||r)&&(t=e.l({element:t},r)),e.aJ(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),this._occludedOpacity=t&&t.occludedOpacity||.2,t&&t.element)this._element=t.element,this._offset=e.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=l("div");const r=41,i=27,n=c("svg",{display:"block",height:r*this._scale+"px",width:i*this._scale+"px",viewBox:`0 0 ${i} ${r}`},this._element),o=c("radialGradient",{id:"shadowGradient"},c("defs",{},n));c("stop",{offset:"10%","stop-opacity":.4},o),c("stop",{offset:"100%","stop-opacity":.05},o),c("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},n),c("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},n),c("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},n),c("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},n),this._offset=e.P.convert(t&&t.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",(e=>{e.preventDefault()})),this._element.addEventListener("mousedown",(e=>{e.preventDefault()}));const i=this._element.classList;for(const e in Fa)i.remove(`mapboxgl-marker-anchor-${e}`);i.add(`mapboxgl-marker-anchor-${this._anchor}`);const n=t&&t.className?t.className.trim().split(/\s+/):[];i.add(...n),this._popup=null}addTo(e){return e===this._map||(this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._updateMoving),e.on("moveend",this._update),e.on("remove",this._clearFadeTimer),e._addMarker(this),this.setDraggable(this._draggable),this._update(),e.on("click",this._onMapClick)),this}remove(){const e=this._map;return e&&(e.off("click",this._onMapClick),e.off("move",this._updateMoving),e.off("moveend",this._update),e.off("mousedown",this._addDragHandler),e.off("touchstart",this._addDragHandler),e.off("mouseup",this._onUp),e.off("touchend",this._onUp),e.off("mousemove",this._onMove),e.off("touchmove",this._onMove),e.off("remove",this._clearFadeTimer),e._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.bL.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const t=38.1,r=13.5,i=Math.sqrt(Math.pow(r,2)/2);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-t],"bottom-left":[i,-1*(t-r+i)],"bottom-right":[-i,-1*(t-r+i)],left:[r,-1*(t-r)],right:[-r,-1*(t-r)]}:this._offset}this._popup=e,e._marker=this,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(e){const t=e.code,r=e.charCode||e.keyCode;"Space"!==t&&"Enter"!==t&&32!==r&&13!==r||this.togglePopup()}_onMapClick(e){const t=e.originalEvent.target,r=this._element;this._popup&&(t===r||r.contains(t))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const e=this._popup;return e?(e.isOpen()?(e.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(e.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const e=this._map,t=this._pos;if(!e||!t)return!1;const r=e.unproject(t),i=e.getFreeCameraOptions();if(!i.position)return!1;const n=i.position.toLngLat();return n.distanceTo(r)<.9*n.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const r=this._pos;if(!r||r.x<0||r.x>t.transform.width||r.y<0||r.y>t.transform.height)return void this._clearFadeTimer();const i=t.unproject(r);let n;t._showingGlobe()&&e.dz(t.transform,this._lngLat)?n=0:(n=1-t._queryFogOpacity(i),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(n*=this._occludedOpacity)),this._element.style.opacity=`${n}`,this._element.style.pointerEvents=n>0?"auto":"none",this._popup&&this._popup._setOpacity(n),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const e=this._pos;if(!e||!this._map)return;const t=this._offset.mult(this._scale);this._element.style.transform=`\n translate(${e.x}px,${e.y}px)\n ${Fa[this._anchor]}\n ${this._calculateXYTransform()} ${this._calculateZTransform()}\n translate(${t.x}px,${t.y}px)\n `}_calculateXYTransform(){const t=this._pos,r=this._map,i=this.getPitchAlignment();if(!r||!t||"map"!==i)return"";if(!r._showingGlobe()){const e=r.getPitch();return e?`rotateX(${e}deg)`:""}const n=e.c1(e.dA(r.transform,this._lngLat)),o=t.sub(e.dB(r.transform)),s=Math.abs(o.x)+Math.abs(o.y);if(0===s)return"";const a=n/s;return`rotateX(${-o.y*a}deg) rotateY(${o.x*a}deg)`}_calculateZTransform(){const t=this._pos,r=this._map;if(!r||!t)return"";let i=0;const n=this.getRotationAlignment();if("map"===n)if(r._showingGlobe()){const t=r.project(new e.bL(this._lngLat.lng,this._lngLat.lat+.001)),n=r.project(new e.bL(this._lngLat.lng,this._lngLat.lat-.001)).sub(t);i=e.c1(Math.atan2(n.y,n.x))-90}else i=-r.getBearing();else if("horizon"===n){const n=e.a7(4,6,r.getZoom()),o=e.dB(r.transform);o.y+=n*r.transform.height;const s=t.sub(o),a=e.c1(Math.atan2(s.y,s.x));i=(a>90?a-270:a+90)*(1-n)}return i+=this._rotation,i?`rotateZ(${i}deg)`:""}_update(e){cancelAnimationFrame(this._updateFrameId);const t=this._map;t&&(t.transform.renderWorldCopies&&(this._lngLat=Ba(this._lngLat,this._pos,t.transform)),this._pos=t.project(this._lngLat),!0===e?this._updateFrameId=requestAnimationFrame((()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())})):this._pos=this._pos.round(),t._requestDomTask((()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(t._showingGlobe()||t.getTerrain()||t.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))})))}getOffset(){return this._offset}setOffset(t){return this._offset=e.P.convert(t),this._update(),this}addClassName(e){return this._element.classList.add(e),this}removeClassName(e){return this._element.classList.remove(e),this}toggleClassName(e){return this._element.classList.toggle(e)}_onMove(t){const r=this._map;if(!r)return;const i=this._pointerdownPos,n=this._positionDelta;if(i&&n){if(!this._isDragging){const e=this._clickTolerance||r._clickTolerance;if(t.point.dist(i)<e)return;this._isDragging=!0}this._pos=t.point.sub(n),this._lngLat=r.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new e.x("dragstart"))),this.fire(new e.x("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const t=this._map;t&&(t.off("mousemove",this._onMove),t.off("touchmove",this._onMove)),"active"===this._state&&this.fire(new e.x("dragend")),this._state="inactive"}_addDragHandler(e){const t=this._map,r=this._pos;t&&r&&this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(r),this._pointerdownPos=e.point,this._state="pending",t.on("mousemove",this._onMove),t.on("touchmove",this._onMove),t.once("mouseup",this._onUp),t.once("touchend",this._onUp))}setDraggable(e){this._draggable=!!e;const t=this._map;return t&&(e?(t.on("mousedown",this._addDragHandler),t.on("touchstart",this._addDragHandler)):(t.off("mousedown",this._addDragHandler),t.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return"auto"===this._rotationAlignment||"horizon"===this._rotationAlignment&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e||"auto",this._update(),this}getPitchAlignment(){return"auto"===this._pitchAlignment?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(e){return this._occludedOpacity=e||.2,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const Va={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},ja={maxWidth:100,unit:"metric"},Ua={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},$a={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Ga=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function qa(t=new e.P(0,0),r="bottom"){if("number"==typeof t){const i=Math.round(Math.sqrt(.5*Math.pow(t,2)));switch(r){case"top":return new e.P(0,t);case"top-left":return new e.P(i,i);case"top-right":return new e.P(-i,i);case"bottom":return new e.P(0,-t);case"bottom-left":return new e.P(i,-i);case"bottom-right":return new e.P(-i,-i);case"left":return new e.P(t,0);case"right":return new e.P(-t,0)}return new e.P(0,0)}return t instanceof e.P||Array.isArray(t)?e.P.convert(t):e.P.convert(t[r]||[0,0])}const Ha={version:t,supported:a.supported,setRTLTextPlugin:e.dC,getRTLTextPluginStatus:e.dD,Map:class extends Sa{constructor(t){i.mark(r.create);const n=t;if(null!=(t=e.l({},ka,t)).minZoom&&null!=t.maxZoom&&t.minZoom>t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=t.minPitch&&null!=t.maxPitch&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=t.minPitch&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=t.maxPitch&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(t.antialias&&e.dx(window)&&(t.antialias=!1,e.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new qr(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),t),this._repaint=!!t.repaint,this._interactive=t.interactive,this._minTileCacheSize=t.minTileCacheSize,this._maxTileCacheSize=t.maxTileCacheSize,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._antialias=t.antialias,this._trackResize=t.trackResize,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles,this._fadeDuration=t.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=t.crossSourceCollisions,this._collectResourceTiming=t.collectResourceTiming,this._language=this._parseLanguage(t.language),this._worldview=t.worldview,this._renderTaskQueue=new Aa,this._domRenderTaskQueue=new Aa,this._controls=[],this._markers=[],this._popups=[],this._mapId=e.aQ(),this._locale=e.l({},Ia,t.locale),this._clickTolerance=t.clickTolerance,this._cooperativeGestures=t.cooperativeGestures,this._performanceMetricsCollection=t.performanceMetricsCollection,this._tessellationStep=t.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=t.precompilePrograms,this._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Ca(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=t.scaleFactor,this._requestManager=new T(t.transformRequest,t.accessToken,t.testMode),this._silenceAuthErrors=!!t.testMode,this._contextCreateOptions=t.contextCreateOptions?{...t.contextCreateOptions}:{},"string"==typeof t.container){const e=document.getElementById(t.container);if(!e)throw new Error(`Container '${t.container.toString()}' not found.`);this._container=e}else{if(!(t.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=t.container}if(this._container.childNodes.length>0&&e.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),t.maxBounds&&this.setMaxBounds(t.maxBounds),e.aJ(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._tp||(this._tp=new bs),this._tp.registerParameter(this,["Debug"],"showOverdrawInspector"),this._tp.registerParameter(this,["Debug"],"showTileBoundaries"),this._tp.registerParameter(this,["Debug"],"showParseStatus"),this._tp.registerParameter(this,["Debug"],"repaint"),this._tp.registerParameter(this,["Debug"],"showTileAABBs"),this._tp.registerParameter(this,["Debug"],"showPadding"),this._tp.registerParameter(this,["Debug"],"showCollisionBoxes",{noSave:!0}),this._tp.registerParameter(this.transform,["Debug"],"freezeTileCoverage",{noSave:!0},(()=>{this._update()})),this._tp.registerParameter(this,["Debug","Wireframe"],"showTerrainWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers2DWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers3DWireframe"),this._tp.registerParameter(this,["Scaling"],"_scaleFactor",{min:.1,max:10,step:.1},(()=>{this.setScaleFactor(this._scaleFactor)})),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");if(this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new wa(this,t),this._localFontFamily=t.localFontFamily,this._localIdeographFontFamily=t.localIdeographFontFamily,(t.style||!t.testMode)&&this.setStyle(t.style||e.e.DEFAULT_STYLE,{config:t.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),t.projection&&this.setProjection(t.projection),t.hash&&(this._hash=new Ms("string"==typeof t.hash&&t.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){null==n.center&&null==n.zoom||(this.transform._unmodified=!1),this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch});const r=t.bounds;r&&(this.resize(),this.fitBounds(r,e.l({},t.fitBoundsOptions,{duration:0})))}this.resize(),t.attributionControl&&this.addControl(new Ea({customAttribution:t.customAttribution})),this._logoControl=new Ma,this.addControl(this._logoControl,t.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent()})),this.on("data",(t=>{this._update("style"===t.dataType),this.fire(new e.x(`${t.dataType}data`,t))})),this.on("dataloading",(t=>{this.fire(new e.x(`${t.dataType}dataloading`,t))})),this._interactions=new za(this)}_getMapId(){return this._mapId}addControl(t,r){if(void 0===r&&(r=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t||!t.onAdd)return this.fire(new e.t(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=t.onAdd(this);this._controls.push(t);const n=this._controlPositions[r];return-1!==r.indexOf("bottom")?n.insertBefore(i,n.firstChild):n.appendChild(i),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new e.t(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const r=this._controls.indexOf(t);return r>-1&&this._controls.splice(r,1),t.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(t){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const r=!this._moving;return r&&this.fire(new e.x("movestart",t)).fire(new e.x("move",t)),this.fire(new e.x("resize",t)),r&&this.fire(new e.x("moveend",t)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(t){return this.transform.setMaxBounds(e.as.convert(t)),this._update()}setMinZoom(t){if((t=t??-2)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t?this.setZoom(t):this.fire(new e.x("zoomstart")).fire(new e.x("zoom")).fire(new e.x("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if((t=t??22)>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t?this.setZoom(t):this.fire(new e.x("zoomstart")).fire(new e.x("zoom")).fire(new e.x("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=t??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()<t?this.setPitch(t):this.fire(new e.x("pitchstart")).fire(new e.x("pitch")).fire(new e.x("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if((t=t??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t?this.setPitch(t):this.fire(new e.x("pitchstart")).fire(new e.x("pitch")).fire(new e.x("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(e){return this._scaleFactor=e,this.painter.scaleFactor=e,this._tp.refreshUI(),this._scaleFactorChanged=!0,this.style._updateFilteredLayers((e=>"symbol"===e.type)),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(e){return"auto"===e?navigator.language:Array.isArray(e)?0===e.length?void 0:e.map((e=>"auto"===e?navigator.language:e)):e}setLanguage(e){const t=this._parseLanguage(e);if(!this.style||t===this._language)return this;this._language=t,this.style.reloadSources();for(const e of this._controls)e._setLanguage&&e._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(e){return this.style&&e!==this._worldview?(this._worldview=e,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return"globe"===this.transform.projection.name}setProjection(e){return this._lazyInitEmptyStyle(),e?"string"==typeof e&&(e={name:e}):e=null,this._useExplicitProjection=!!e,this._prioritizeAndUpdateProjection(e,this.style.projection)}_updateProjectionTransition(){if("globe"!==this.getProjection().name)return;const t=this.transform,r=t.projection.name;let i;"globe"===r&&t.zoom>=e.bV?(t.setMercatorFromTransition(),i=!0):"mercator"===r&&t.zoom<e.bV&&(t.setProjection({name:"globe"}),i=!0),i&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate())}_prioritizeAndUpdateProjection(e,t){return this._updateProjection(e||t||{name:"mercator"})}_updateProjection(t){let r;return r="globe"===t.name&&this.transform.zoom>=e.bV?this.transform.setMercatorFromTransition():this.transform.setProjection(t),this.style.applyProjectionUpdate(),r&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(t){return this.transform.locationPoint3D(e.bL.convert(t))}unproject(t){return this.transform.pointLocation3D(e.P.convert(t))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(e,t,r){const i=e=>{let r=[];if(Array.isArray(t)){const i=t.filter((e=>this.getLayer(e)));r=i.length?this.queryRenderedFeatures(e,{layers:i}):[]}else r=this.queryRenderedFeatures(e,{featureset:t});return r};if("mouseenter"===e||"mouseover"===e){let n=!1;const o=t=>{const o=i(t.point);o.length?n||(n=!0,r.call(this,new Ls(e,this,t.originalEvent,{features:o}))):n=!1};return{listener:r,targets:t,delegates:{mousemove:o,mouseout:()=>{n=!1}}}}if("mouseleave"===e||"mouseout"===e){let n=!1;const o=t=>{i(t.point).length?n=!0:n&&(n=!1,r.call(this,new Ls(e,this,t.originalEvent)))},s=t=>{n&&(n=!1,r.call(this,new Ls(e,this,t.originalEvent)))};return{listener:r,targets:t,delegates:{mousemove:o,mouseout:s}}}{const n=e=>{const t=i(e.point);t.length&&(e.features=t,r.call(this,e),delete e.features)};return{listener:r,targets:t,delegates:{[e]:n}}}}on(e,t,r){if("function"==typeof t||void 0===r)return super.on(e,t);if("string"==typeof t&&(t=[t]),!this._areTargetsValid(t))return this;const i=this._createDelegatedListener(e,t,r);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(i);for(const e in i.delegates)this.on(e,i.delegates[e]);return this}once(e,t,r){if("function"==typeof t||void 0===r)return super.once(e,t);if("string"==typeof t&&(t=[t]),!this._areTargetsValid(t))return this;const i=this._createDelegatedListener(e,t,r);for(const e in i.delegates)this.once(e,i.delegates[e]);return this}off(e,t,r){if("function"==typeof t||void 0===r)return super.off(e,t);if("string"==typeof t&&(t=[t]),!this._areTargetsValid(t))return this;const i=this._delegatedListeners?this._delegatedListeners[e]:void 0;return i&&(e=>{for(let i=0;i<e.length;i++){const n=e[i];if(n.listener===r&&Da(n.targets,t)){for(const e in n.delegates)this.off(e,n.delegates[e]);return e.splice(i,1),this}}})(i),this}queryRenderedFeatures(t,r){if(!this.style)return[];if(void 0!==r||void 0===t||t instanceof e.P||Array.isArray(t)||(r=t,t=void 0),t=t||[[0,0],[this.transform.width,this.transform.height]],"featureset"in(r=r||{}))return this._isFeaturesetDescriptorValid(r.featureset)?this.style.queryRenderedFeaturesForInteractions(t,[r],this.transform):[];if(r.layers&&Array.isArray(r.layers))for(const e of r.layers)if(!this._isValidId(e))return[];return this.style.queryRenderedFeatures(t,r,this.transform)}querySourceFeatures(e,t){return!e||"string"==typeof e&&!this._isValidId(e)?[]:this.style.querySourceFeatures(e,t)}isPointOnSurface(t){const{name:r}=this.transform.projection;return"globe"!==r&&"mercator"!==r&&e.w(`${r} projection does not support isPointOnSurface, this API may behave unexpectedly.`),this.transform.isPointOnSurface(e.P.convert(t))}addInteraction(e,t){return this._interactions.add(e,t),this}removeInteraction(e){return this._interactions.remove(e),this}setStyle(t,r){return r=e.l({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},r),this.style&&t&&!1!==r.diff&&r.localFontFamily===this._localFontFamily&&r.localIdeographFontFamily===this._localIdeographFontFamily&&!r.config?(this.style._diffStyle(t,((i,n)=>{i?(e.w(`Unable to perform style diff: ${String(i.message||i.error||i)}. Rebuilding the style from scratch.`),this._updateStyle(t,r)):n&&this._update(!0)}),(()=>{this._postStyleLoadEvent()})),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._localFontFamily=r.localFontFamily,this._updateStyle(t,r))}_getUIString(e){const t=this._locale[e];if(null==t)throw new Error(`Missing UI string '${e}'`);return t}_updateStyle(t,r){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),t){const i=e.l({},r);r&&r.config&&(i.initialConfig=r.config,delete i.config),this.style=new li(this,i).load(t),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new li(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(e.w("There is no style added to the map."),!1)}_isValidId(t){return null==t?(this.fire(new e.t(new Error("IDs can't be empty."))),!1):!e.aK(t)||(this.fire(new e.t(new Error(`IDs can't contain special symbols: "${t}".`))),!1)}_isFeaturesetDescriptorValid(e){return"featuresetId"in e?this._isValidId(e.featuresetId):"layerId"in e&&this._isValidId(e.layerId)}_areTargetsValid(e){if(Array.isArray(e)){for(const t of e)if(!this._isValidId(t))return!1;return!0}return this._isFeaturesetDescriptorValid(e)}addSource(e,t){return this._isValidId(e)?(this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)):this}isSourceLoaded(e){return!!this._isValidId(e)&&!!this.style&&this.style._isSourceCacheLoaded(e)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(e,t,r){this._lazyInitEmptyStyle(),this.style.addSourceType(e,t,r)}removeSource(e){return this._isValidId(e)?(this.style.removeSource(e),this._updateTerrain(),this._update(!0)):this}getSource(e){return this._isValidId(e)?this.style.getOwnSource(e):null}addImage(t,r,{pixelRatio:i=1,sdf:n=!1,stretchX:o,stretchY:s,content:a}={}){if(this._lazyInitEmptyStyle(),r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap){const{width:l,height:c,data:u}=e.q.getImageData(r);this.style.addImage(t,{data:new e.r({width:l,height:c},u),pixelRatio:i,stretchX:o,stretchY:s,content:a,sdf:n,version:0})}else if(void 0===r.width||void 0===r.height)this.fire(new e.t(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:l,height:c}=r,u=r;this.style.addImage(t,{data:new e.r({width:l,height:c},new Uint8Array(u.data)),pixelRatio:i,stretchX:o,stretchY:s,content:a,sdf:n,version:0,userImage:u}),u.onAdd&&u.onAdd(this,t)}}updateImage(t,r){this._lazyInitEmptyStyle();const i=this.style.getImage(t);if(!i)return void this.fire(new e.t(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const n=r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap?e.q.getImageData(r):r,{width:o,height:s,data:a}=n;if(void 0===o||void 0===s)return void this.fire(new e.t(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(o!==i.data.width||s!==i.data.height)return void this.fire(new e.t(new Error(`The width and height of the updated image (${o}, ${s})\n must be that same as the previous version of the image\n (${i.data.width}, ${i.data.height})`)));const l=!(r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap);i.data.replace(a,l),this.style.updateImage(t,i)}hasImage(t){return t?!!this.style&&!!this.style.getImage(t):(this.fire(new e.t(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(t,r){e.o(this._requestManager.transformRequest(t,e.R.Image),((t,i)=>{r(t,i instanceof HTMLImageElement?e.q.getImageData(i):i)}))}listImages(){return this.style.listImages()}addModel(e,t){this._lazyInitEmptyStyle(),this.style.addModel(e,t)}hasModel(t){return t?this.style.hasModel(t):(this.fire(new e.t(new Error("Missing required model id"))),!1)}removeModel(e){this.style.removeModel(e)}listModels(){return this.style.listModels()}addLayer(e,t){return this._isValidId(e.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)):this}getSlot(e){const t=this.getLayer(e);return t&&t.slot||null}setSlot(e,t){return this.style.setSlot(e,t),this.style.mergeLayers(),this._update(!0)}addImport(e,t){return this.style.addImport(e,t),this}updateImport(e,t){return"string"!=typeof t&&t.id!==e?(this.removeImport(e),this.addImport(t)):(this.style.updateImport(e,t),this._update(!0))}removeImport(e){return this.style.removeImport(e),this}moveImport(e,t){return this.style.moveImport(e,t),this._update(!0)}moveLayer(e,t){return this._isValidId(e)?(this.style.moveLayer(e,t),this._update(!0)):this}removeLayer(e){return this._isValidId(e)?(this.style.removeLayer(e),this._update(!0)):this}getLayer(e){if(!this._isValidId(e))return null;const t=this.style.getOwnLayer(e);return t?"custom"===t.type?t.implementation:t.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(e,t,r){return this._isValidId(e)?(this.style.setLayerZoomRange(e,t,r),this._update(!0)):this}setFilter(e,t,r={}){return this._isValidId(e)?(this.style.setFilter(e,t,r),this._update(!0)):this}getFilter(e){return this._isValidId(e)?this.style.getFilter(e):null}setPaintProperty(e,t,r,i={}){return this._isValidId(e)?(this.style.setPaintProperty(e,t,r,i),this._update(!0)):this}getPaintProperty(e,t){return this._isValidId(e)?this.style.getPaintProperty(e,t):null}setLayoutProperty(e,t,r,i={}){return this._isValidId(e)?(this.style.setLayoutProperty(e,t,r,i),this._update(!0)):this}getLayoutProperty(e,t){return this._isValidId(e)?this.style.getLayoutProperty(e,t):null}getSchema(e){return this.style.getSchema(e)}setSchema(e,t){return this.style.setSchema(e,t),this._update(!0)}getConfig(e){return this.style.getConfig(e)}setConfig(e,t){return this.style.setConfig(e,t),this._update(!0)}getConfigProperty(e,t){return this.style.getConfigProperty(e,t)}setConfigProperty(e,t,r){return this.style.setConfigProperty(e,t,r),this._update(!0)}getFeaturesetDescriptors(e){return this.style.getFeaturesetDescriptors(e)}setLights(e){if(this._lazyInitEmptyStyle(),e&&1===e.length&&"flat"===e[0].type){const t=e[0];t.properties?this.style.setFlatLight(t.properties,t.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(e),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const e=this.style.getLights()||[];return 0===e.length&&e.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),e}setLight(e,t={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:e}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(e){return this._lazyInitEmptyStyle(),!e&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(e),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(e){return this._lazyInitEmptyStyle(),this.style.setFog(e),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setColorTheme(e){return this._lazyInitEmptyStyle(),this.style.setColorTheme(e),this._update(!0)}setCamera(e){return this.style.setCamera(e),this._triggerCameraUpdate(e)}_triggerCameraUpdate(e){return this._update(this.transform.setOrthographicProjectionAtLowPitch("orthographic"===e["camera-projection"]))}getCamera(){return this.style.camera}_queryFogOpacity(t){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(e.bL.convert(t),this.transform):0}setFeatureState(e,t){return e.source&&!this._isValidId(e.source)?this:(this.style.setFeatureState(e,t),this._update())}removeFeatureState(e,t){return e.source&&!this._isValidId(e.source)?this:(this.style.removeFeatureState(e,t),this._update())}getFeatureState(e){return e.source&&!this._isValidId(e.source)?null:this.style.getFeatureState(e)}_updateContainerDimensions(){if(!this._container)return;const e=this._container.getBoundingClientRect().width||400,t=this._container.getBoundingClientRect().height||300;let r,i,n,o=this._container;for(;o&&(!i||!n);){const e=window.getComputedStyle(o).transform;e&&"none"!==e&&(r=e.match(/matrix.*\((.+)\)/)[1].split(", "),r[0]&&"0"!==r[0]&&"1"!==r[0]&&(i=r[0]),r[3]&&"0"!==r[3]&&"1"!==r[3]&&(n=r[3])),o=o.parentElement}this._containerWidth=i?Math.abs(e/i):e,this._containerHeight=n?Math.abs(t/n):t}_detectMissingCSS(){"rgb(250, 128, 114)"!==window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&e.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const e=this._container;e.classList.add("mapboxgl-map"),(this._missingCSSCanary=l("div","mapboxgl-canary",e)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=l("div","mapboxgl-canvas-container",e);this._canvas=l("canvas","mapboxgl-canvas",t),this._interactive&&(t.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const r=this._controlContainer=l("div","mapboxgl-control-container",e),i=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach((e=>{i[e]=l("div",`mapboxgl-ctrl-${e}`,r)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,r){const i=e.q.devicePixelRatio||1;this._canvas.width=i*Math.ceil(t),this._canvas.height=i*Math.ceil(r),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${r}px`}_addMarker(e){this._markers.push(e)}_removeMarker(e){const t=this._markers.indexOf(e);-1!==t&&this._markers.splice(t,1)}_addPopup(e){this._popups.push(e)}_removePopup(e){const t=this._popups.indexOf(e);-1!==t&&this._popups.splice(t,1)}_setupPainter(){const t=e.l({},a.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),r=this._canvas.getContext("webgl2",t);r?(j(r,!0),this.painter=new Ss(r,this._contextCreateOptions,this.transform,this._scaleFactor,this._tp),this.on("data",(e=>{"source"===e.dataType&&this.painter.setTileLoadedFlag(!0)})),e.m.testSupport(r)):this.fire(new e.t(new Error("Failed to initialize WebGL")))}_contextLost(t){t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new e.x("webglcontextlost",{originalEvent:t}))}_contextRestored(t){this._setupPainter(),this.resize(),this._update(),this.fire(new e.x("webglcontextrestored",{originalEvent:t}))}_onMapScroll(e){if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(e){return this.style?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_requestDomTask(e){!this.loaded()||this.loaded()&&!this.isMoving()?e():this._domRenderTaskQueue.add(e)}_render(t){let n;this.fire(new e.x("renderstart")),++this._frameId;const o=this.painter.context.extTimerQuery,s=e.q.now(),a=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(n=a.createQuery(),a.beginQuery(o.TIME_ELAPSED_EXT,n)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(t),this._domRenderTaskQueue.run(t),this._removed)return;this._updateProjectionTransition();const l=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const t=this.transform.zoom,r=this.transform.pitch,i=e.q.now(),n=new e.a3(t,{now:i,fadeDuration:l,pitch:r,transition:this.style.transition});this.style.update(n)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let c=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),c=this._updateAverageElevation(s),this.style.updateSources(this.transform),this._forceMarkerAndPopupUpdate()):c=this._updateAverageElevation(s);const u=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,l,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),u&&(this._placementDirty=u.needsRerender),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:l,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new e.x("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,i.mark(r.load),this.fire(new e.x("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),n){const t=e.q.now()-s;a.endQuery(o.TIME_ELAPSED_EXT),setTimeout((()=>{const r=a.getQueryParameter(n,a.QUERY_RESULT)/1e6;a.deleteQuery(n),this.fire(new e.x("gpu-timing-frame",{cpuTime:t,gpuTime:r}))}),50)}if(this.listens("gpu-timing-layer")){const t=this.painter.collectGpuTimers();setTimeout((()=>{const r=this.painter.queryGpuTimers(t);this.fire(new e.x("gpu-timing-layer",{layerTimes:r}))}),50)}if(this.listens("gpu-timing-deferred-render")){const t=this.painter.collectDeferredRenderGpuQueries();setTimeout((()=>{const r=this.painter.queryGpuTimeDeferredRender(t);this.fire(new e.x("gpu-timing-deferred-render",{gpuTime:r}))}),50)}const h=this._sourcesDirty||this._styleDirty||this._placementDirty||c;if(h||this._repaint)this.triggerRepaint();else{const t=this.idle();if(t&&(c=this._updateAverageElevation(s,!0)),c)this.triggerRepaint();else if(this._triggerFrame(!1),t&&(this.fire(new e.x("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const t=this._calculateSpeedIndex();this.fire(new e.x("speedindexcompleted",{speedIndex:t})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||h||(this._fullyLoaded=!0,i.mark(r.fullLoad),this._performanceMetricsCollection&&B(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(e){for(const t of this._markers)e&&!this.getRenderWorldCopies()&&(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!e||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update()}_updateAverageElevation(e,t=!1){const r=e=>(this.transform.averageElevation=e,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&r(0);const i=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(i||(t||e-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(e)){const t=this.transform.averageElevation;let n=this.transform.sampleAverageElevation();null!=this.transform.elevation&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(n)?n=0:this._averageElevationLastSampledAt=e;const o=Math.abs(t-n);if(o>1){if(this._isInitialLoad||i)return this._averageElevation.jumpTo(n),r(n);this._averageElevation.easeTo(n,e,300)}else if(o>1e-4)return this._averageElevation.jumpTo(n),r(n)}return!!this._averageElevation.isEasing(e)&&r(this._averageElevation.getValue(e))}_authenticate(){N(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(t=>{if(t&&(t.message===w||401===t.status)){const t=this.painter.context.gl;j(t,!1),this._logoControl instanceof Ma&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new e.t(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}})),D(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(()=>{}))}_postStyleLoadEvent(){this.style.globalId&&O(this._requestManager._customAccessToken,{map:this,skuToken:this._requestManager._skuToken,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_updateTerrain(){const e=this._isDragging();this.painter.updateTerrain(this.style,e)}_calculateSpeedIndex(){const e=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const r=this.painter.context.gl,i=r.createFramebuffer();function n(e){r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0);const t=new Uint8Array(r.drawingBufferWidth*r.drawingBufferHeight*4);return r.readPixels(0,0,r.drawingBufferWidth,r.drawingBufferHeight,r.RGBA,r.UNSIGNED_BYTE,t),t}return r.bindFramebuffer(r.FRAMEBUFFER,i),this._canvasPixelComparison(n(e),t.canvasCopies.map(n),t.timeStamps)}_canvasPixelComparison(e,t,r){let i=r[1]-r[0];const n=e.length/4;for(let o=0;o<t.length;o++){const s=t[o];let a=0;for(let t=0;t<s.length;t+=4)s[t]===e[t]&&s[t+1]===e[t+1]&&s[t+2]===e[t+2]&&s[t+3]===e[t+3]&&(a+=1);i+=(r[o+2]-r[o+1])*(1-a/n)}return i}remove(){this._hash&&this._hash.remove();for(const e of this._controls)e.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),window.removeEventListener("resize",this._onWindowResize,!1),window.removeEventListener("orientationchange",this._onWindowResize,!1),window.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.removeEventListener("online",this._onWindowOnline,!1),window.removeEventListener("visibilitychange",this._onVisibilityChange,!1);const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),V.delete(this.painter.context.gl),F.remove(),z.remove(),this._removed=!0,this.fire(new e.x("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(t){this._renderNextFrame=this._renderNextFrame||t,this.style&&!this._frame&&(this._frame=e.q.frame((e=>{const t=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,t&&this._render(e)})))}_preloadTiles(t){const r=this.style?this.style.getSourceCaches():[];return e.bg(r,((e,r)=>e._preloadTiles(t,r)),(()=>{this.triggerRepaint()})),this}_onWindowOnline(){this._update()}_onWindowResize(e){this._trackResize&&this.resize({originalEvent:e})._update()}_onVisibilityChange(){"hidden"===document.visibilityState&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._tp.refreshUI(),this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(e){this._showParseStatus!==e&&(this._showParseStatus=e,this._tp.refreshUI(),this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(e){this._showTerrainWireframe!==e&&(this._showTerrainWireframe=e,this._tp.refreshUI(),this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(e){this._showLayers2DWireframe!==e&&(this._showLayers2DWireframe=e,this._tp.refreshUI(),this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(e){this._showLayers3DWireframe!==e&&(this._showLayers3DWireframe=e,this._tp.refreshUI(),this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(e){this._speedIndexTiming!==e&&(this._speedIndexTiming=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._tp.refreshUI(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,this._tp.refreshUI(),e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._tp.refreshUI(),this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this._tp.refreshUI(),this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(e){this._showTileAABBs!==e&&(this._showTileAABBs=e,this._tp.refreshUI(),e&&this._update())}_setCacheLimits(t,r){e.dy(t,r)}get version(){return t}},NavigationControl:class{constructor(t={}){this.options=e.l({},Oa,t),this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this.options.showZoom&&(e.aJ(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",(e=>{this._map&&this._map.zoomIn({},{originalEvent:e})})),l("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",(e=>{this._map&&this._map.zoomOut({},{originalEvent:e})})),l("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(e.aJ(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",(e=>{const t=this._map;t&&(this.options.visualizePitch?t.resetNorthPitch({},{originalEvent:e}):t.resetNorth({},{originalEvent:e}))})),this._compassIcon=l("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const e=this._map;if(!e)return;const t=e.getZoom(),r=t===e.getMaxZoom(),i=t===e.getMinZoom();this._zoomInButton.disabled=r,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",r.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())}_rotateCompassArrow(){const e=this._map;if(!e)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(e.transform.pitch*(Math.PI/180)),.5)}) rotateX(${e.transform.pitch}deg) rotateZ(${e.transform.angle*(180/Math.PI)}deg)`:`rotate(${e.transform.angle*(180/Math.PI)}deg)`;e._requestDomTask((()=>{this._compassIcon&&(this._compassIcon.style.transform=t)}))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),e.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&e.on("pitch",this._rotateCompassArrow),e.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new La(e,this._compass,this.options.visualizePitch)),this._container}onRemove(){const e=this._map;e&&(this._container.remove(),this.options.showZoom&&e.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&e.off("pitch",this._rotateCompassArrow),e.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(e,t){const r=l("button",e,this._container);return r.type="button",r.addEventListener("click",t),r}_setButtonTitle(e,t){if(!this._map)return;const r=this._map._getUIString(`NavigationControl.${t}`);e.setAttribute("aria-label",r),e.firstElementChild&&e.firstElementChild.setAttribute("title",r)}},GeolocateControl:class extends e.E{constructor(t={}){super();const r=navigator.geolocation;this.options=e.l({geolocation:r},Va,t),e.aJ(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=Es(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(e){return this._map=e,this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(e){const t=(t=!!this.options.geolocation)=>{this._supportsGeolocation=t,e(t)};void 0!==this._supportsGeolocation?e(this._supportsGeolocation):void 0!==navigator.permissions?navigator.permissions.query({name:"geolocation"}).then((e=>t("denied"!==e.state))).catch((()=>t())):t()}_isOutOfMapMaxBounds(e){const t=this._map.getMaxBounds(),r=e.coords;return!!t&&(r.longitude<t.getWest()||r.longitude>t.getEast()||r.latitude<t.getSouth()||r.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(t){if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.x("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new e.x("geolocate",t)),this._finish()}}_updateCamera(t){const r=new e.bL(t.coords.longitude,t.coords.latitude),i=t.coords.accuracy,n=this._map.getBearing(),o=e.l({bearing:n},this.options.fitBoundsOptions);this._map.fitBounds(r.toBounds(i),o,{geolocateSource:!0})}_updateMarker(t){if(t){const r=new e.bL(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const t=this._map.transform,r=e.bE(1,t._center.lat)*t.worldSize,i=Math.ceil(2*this._accuracy*r);this._circleElement.style.width=`${i}px`,this._circleElement.style.height=`${i}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(t){if(this._map){if(this.options.trackUserLocation)if(1===t.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&this._noTimeout)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new e.x("error",t)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(t){if(void 0!==this._map){if(this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this._geolocateButton=l("button","mapboxgl-ctrl-geolocate",this._container),l("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===t){e.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=l("div","mapboxgl-user-location"),this._dotElement.appendChild(l("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(l("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new Na({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=l("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Na({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(t=>{t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||t.originalEvent&&"resize"===t.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new e.x("trackuserlocationend")))}))}}_onDeviceOrientation(e){this._userLocationDotMarker&&(e.webkitCompassHeading?this._heading=e.webkitCompassHeading:!0===e.absolute&&(this._heading=-1*e.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return e.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new e.x("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new e.x("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new e.x("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(e={maximumAge:6e5,timeout:0},this._noTimeout=!0):(e=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,e),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const e=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};"undefined"!=typeof DeviceMotionEvent&&"function"==typeof DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((t=>{"granted"===t&&e()})).catch(console.error):e()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Ea,ScaleControl:class{constructor(t={}){this.options=e.l({},ja,t),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch(e){return!1}}(),e.aJ(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const e=this.options.maxWidth||100,t=this._map,r=t._containerHeight/2,i=t._containerWidth/2-e/2,n=t.unproject([i,r]),o=t.unproject([i+e,r]),s=n.distanceTo(o);if("imperial"===this.options.unit){const t=3.2808*s;t>5280?this._setScale(e,t/5280,"mile"):this._setScale(e,t,"foot")}else"nautical"===this.options.unit?this._setScale(e,s/1852,"nautical-mile"):s>=1e3?this._setScale(e,s/1e3,"kilometer"):this._setScale(e,s,"meter")}_setScale(e,t,r){this._map._requestDomTask((()=>{const i=function(e){const t=Math.pow(10,`${Math.floor(e)}`.length-1);let r=e/t;return r=r>=10?10:r>=5?5:r>=3?3:r>=2?2:r>=1?1:function(e){const t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(r),t*r}(t),n=i/t;this._container.innerHTML=this._isNumberFormatSupported&&"nautical-mile"!==r?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:r}).format(i):`${i} ${Ua[r]}`,this._container.style.width=e*n+"px"}))}onAdd(e){return this._map=e,this._language=e.getLanguage(),this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-scale",e.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(e){this._language=e,this._update()}setUnit(e){this.options.unit=e,this._update()}},FullscreenControl:class{constructor(t={}){this._fullscreen=!1,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:e.w("Full screen control 'container' must be a DOM element.")),e.aJ(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=l("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",e.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const e=this._fullscreenButton=l("button","mapboxgl-ctrl-fullscreen",this._controlContainer);l("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",e)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends e.E{constructor(t){super(),this.options=e.l(Object.create($a),t),e.aJ(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(t&&t.className?t.className.trim().split(/\s+/):[])}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&t.on("preclick",this._onClose),this.options.closeOnMove&&t.on("move",this._onClose),t.on("remove",this.remove),this._update(),t._addPopup(this),this._focusFirstElement(),this._trackPointer?(t.on("mousemove",this._onMouseEvent),t.on("mouseup",this._onMouseEvent),t._canvasContainer.classList.add("mapboxgl-track-pointer")):t.on("move",this._update),this.fire(new e.x("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const t=this._map;return t&&(t.off("move",this._update),t.off("move",this._onClose),t.off("preclick",this._onClose),t.off("click",this._onClose),t.off("remove",this.remove),t.off("mousemove",this._onMouseEvent),t.off("mouseup",this._onMouseEvent),t.off("drag",this._onMouseEvent),t._canvasContainer&&t._canvasContainer.classList.remove("mapboxgl-track-pointer"),t._removePopup(this),this._map=void 0),this.fire(new e.x("close")),this}getLngLat(){return this._lngLat}setLngLat(t){this._lngLat=e.bL.convert(t),this._pos=null,this._trackPointer=!1,this._update();const r=this._map;return r&&(r.on("move",this._update),r.off("mousemove",this._onMouseEvent),r._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const e=this._map;return e&&(e.off("move",this._update),e.on("mousemove",this._onMouseEvent),e.on("drag",this._onMouseEvent),e._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){const t=document.createDocumentFragment(),r=document.createElement("body");let i;for(r.innerHTML=e;i=r.firstChild,i;)t.appendChild(i);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=l("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(e),this.options.closeButton){const e=this._closeButton=l("button","mapboxgl-popup-close-button",t);e.type="button",e.setAttribute("aria-label","Close popup"),e.setAttribute("aria-hidden","true"),e.innerHTML="×",e.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(e){return this._classList.add(e),this._updateClassList(),this}removeClassName(e){return this._classList.delete(e),this._updateClassList(),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){let t;return this._classList.delete(e)?t=!1:(this._classList.add(e),t=!0),this._updateClassList(),t}_onMouseEvent(e){this._update(e.point)}_getAnchor(e){if(this.options.anchor)return this.options.anchor;const t=this._map,r=this._container,i=this._pos;if(!t||!r||!i)return"bottom";const n=r.offsetWidth,o=r.offsetHeight,s=i.x<n/2,a=i.x>t.transform.width-n/2;if(i.y+e<o)return s?"top-left":a?"top-right":"top";if(i.y>t.transform.height-o){if(s)return"bottom-left";if(a)return"bottom-right"}return s?"left":a?"right":"bottom"}_updateClassList(){const e=this._container;if(!e)return;const t=[...this._classList];t.push("mapboxgl-popup"),this._anchor&&t.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&t.push("mapboxgl-popup-track-pointer"),e.className=t.join(" ")}_update(t){const r=this._map,i=this._content;if(!r||!this._lngLat&&!this._trackPointer||!i)return;let n=this._container;if(n||(n=this._container=l("div","mapboxgl-popup",r.getContainer()),this._tip=l("div","mapboxgl-popup-tip",n),n.appendChild(i)),this.options.maxWidth&&n.style.maxWidth!==this.options.maxWidth&&(n.style.maxWidth=this.options.maxWidth),r.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Ba(this._lngLat,this._pos,r.transform)),!this._trackPointer||t){const i=this._pos=this._trackPointer&&t instanceof e.P?t:r.project(this._lngLat),n=qa(this.options.offset),o=this._anchor=this._getAnchor(n.y),s=qa(this.options.offset,o),a=i.add(s).round();r._requestDomTask((()=>{this._container&&o&&(this._container.style.transform=`${Fa[o]} translate(${a.x}px,${a.y}px)`)}))}if(!this._marker&&r._showingGlobe()){const t=e.dz(r.transform,this._lngLat)?0:1;this._setOpacity(t)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const e=this._container.querySelector(Ga);e&&e.focus()}_onClose(){this.remove()}_setOpacity(e){this._container&&(this._container.style.opacity=`${e}`),this._content&&(this._content.style.pointerEvents=e?"auto":"none")}},Marker:Na,Style:li,LngLat:e.bL,LngLatBounds:e.as,Point:e.P,MercatorCoordinate:e.a5,FreeCameraOptions:Nr,Evented:e.E,config:e.e,prewarm:e.dE,clearPrewarmedResources:e.dF,get accessToken(){return e.e.ACCESS_TOKEN},set accessToken(t){e.e.ACCESS_TOKEN=t},get baseApiUrl(){return e.e.API_URL},set baseApiUrl(t){e.e.API_URL=t},get workerCount(){return e.dG.workerCount},set workerCount(t){e.dG.workerCount=t},get maxParallelImageRequests(){return e.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){e.e.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(t){e.dH(t)},get workerUrl(){return e.dI.workerUrl},set workerUrl(t){e.dI.workerUrl=t},get workerClass(){return e.dI.workerClass},set workerClass(t){e.dI.workerClass=t},get workerParams(){return e.dI.workerParams},set workerParams(t){e.dI.workerParams=t},get dracoUrl(){return e.dJ()},set dracoUrl(t){e.dK(t)},get meshoptUrl(){return e.dL()},set meshoptUrl(t){e.dM(t)},setNow:e.q.setNow,restoreNow:e.q.restoreNow};return Ha}));var n=r;return n}()),D.exports),O=p(k),L=6371008.8,B={centimeters:637100880,centimetres:637100880,degrees:360/(2*Math.PI),feet:20902260.511392,inches:39.37*L,kilometers:6371.0088,kilometres:6371.0088,meters:L,metres:L,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:L/1852,radians:1,yards:6967335.223679999};function F(e,t,r={}){const i={type:"Feature"};return(0===r.id||r.id)&&(i.id=r.id),r.bbox&&(i.bbox=r.bbox),i.properties=t||{},i.geometry=e,i}function N(e){return 180*(e%(2*Math.PI))/Math.PI}function V(e){return e%360*Math.PI/180}function j(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}function U(e,t,r,i={}){const n=function(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return[...e.geometry.coordinates];if("Point"===e.type)return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}(e),o=V(n[0]),s=V(n[1]),a=V(r),l=function(e,t="kilometers"){const r=B[t];if(!r)throw new Error(t+" units is invalid");return e/r}(t,i.units),c=Math.asin(Math.sin(s)*Math.cos(l)+Math.cos(s)*Math.sin(l)*Math.cos(a));return function(e,t,r={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!j(e[0])||!j(e[1]))throw new Error("coordinates must contain numbers");return F({type:"Point",coordinates:e},t,r)}([N(o+Math.atan2(Math.sin(a)*Math.sin(l)*Math.cos(s),Math.cos(l)-Math.sin(s)*Math.sin(c))),N(c)],i.properties)}function $(e,t,r={}){const i=r.steps||64,n=r.properties?r.properties:!Array.isArray(e)&&"Feature"===e.type&&e.properties?e.properties:{},o=[];for(let n=0;n<i;n++)o.push(U(e,t,-360*n/i,r).geometry.coordinates);return o.push(o[0]),function(e,t,r={}){for(const t of e){if(t.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(t[t.length-1].length!==t[0].length)throw new Error("First and last Position are not equivalent.");for(let e=0;e<t[t.length-1].length;e++)if(t[t.length-1][e]!==t[0][e])throw new Error("First and last Position are not equivalent.")}return F({type:"Polygon",coordinates:e},t,r)}([o],n)}function G(e,t,r,i){return new(r||(r=Promise))((function(n,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))}function q(e,t){var r,i,n,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(r=1,i&&(n=2&a[0]?i.return:a[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,a[1])).done)return n;switch(i=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){o.label=a[1];break}if(6===a[0]&&o.label<n[1]){o.label=n[1],n=a;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(a);break}n[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{r=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}"function"==typeof SuppressedError&&SuppressedError;var H=function(){function e(){}return e.endpoints={auth:{generateAuthToken:"/auth/generateAuthToken"},rating:{rate:"/rating/rate",hazardTool:"/rating/hazardTool"},backTesting:{payouts:"/backTesting/payouts",getMapAccessToken:"/backTesting/getMapToken"}},e}();const W={black:"#000",white:"#fff"},Z="#e57373",X="#ef5350",Y="#f44336",J="#d32f2f",K="#c62828",Q="#f3e5f5",ee="#ce93d8",te="#ba68c8",re="#ab47bc",ie="#9c27b0",ne="#7b1fa2",oe="#e3f2fd",se="#90caf9",ae="#42a5f5",le="#1976d2",ce="#1565c0",ue="#4fc3f7",he="#29b6f6",de="#03a9f4",pe="#0288d1",fe="#01579b",me="#81c784",_e="#66bb6a",ge="#4caf50",ye="#388e3c",xe="#2e7d32",ve="#1b5e20",be="#ffb74d",we="#ffa726",Te="#ff9800",Se="#f57c00",Ee="#e65100",Me={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"};function Ae(e,...t){const r=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach((e=>r.searchParams.append("args[]",e))),`Minified MUI error #${e}; visit ${r} for the full message.`}var Ce="$$material";function Ie(){return Ie=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Ie.apply(null,arguments)}function Pe(e){var t=Object.create(null);return function(r){return void 0===t[r]&&(t[r]=e(r)),t[r]}}var Re=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,ze=Pe((function(e){return Re.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91}));var De=function(){function e(e){var t=this;this._insertTag=function(e){var r;r=0===t.tags.length?t.insertionPoint?t.insertionPoint.nextSibling:t.prepend?t.container.firstChild:t.before:t.tags[t.tags.length-1].nextSibling,t.container.insertBefore(e,r),t.tags.push(e)},this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(e){e.forEach(this._insertTag)},t.insert=function(e){this.ctr%(this.isSpeedy?65e3:1)==0&&this._insertTag(function(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}(this));var t=this.tags[this.tags.length-1];if(this.isSpeedy){var r=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(t);try{r.insertRule(e,r.cssRules.length)}catch(e){}}else t.appendChild(document.createTextNode(e));this.ctr++},t.flush=function(){this.tags.forEach((function(e){var t;return null==(t=e.parentNode)?void 0:t.removeChild(e)})),this.tags=[],this.ctr=0},e}(),ke="-ms-",Oe="-moz-",Le="-webkit-",Be="comm",Fe="rule",Ne="decl",Ve="@keyframes",je=Math.abs,Ue=String.fromCharCode,$e=Object.assign;function Ge(e){return e.trim()}function qe(e,t,r){return e.replace(t,r)}function He(e,t){return e.indexOf(t)}function We(e,t){return 0|e.charCodeAt(t)}function Ze(e,t,r){return e.slice(t,r)}function Xe(e){return e.length}function Ye(e){return e.length}function Je(e,t){return t.push(e),e}var Ke=1,Qe=1,et=0,tt=0,rt=0,it="";function nt(e,t,r,i,n,o,s){return{value:e,root:t,parent:r,type:i,props:n,children:o,line:Ke,column:Qe,length:s,return:""}}function ot(e,t){return $e(nt("",null,null,"",null,null,0),e,{length:-e.length},t)}function st(){return rt=tt>0?We(it,--tt):0,Qe--,10===rt&&(Qe=1,Ke--),rt}function at(){return rt=tt<et?We(it,tt++):0,Qe++,10===rt&&(Qe=1,Ke++),rt}function lt(){return We(it,tt)}function ct(){return tt}function ut(e,t){return Ze(it,e,t)}function ht(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function dt(e){return Ke=Qe=1,et=Xe(it=e),tt=0,[]}function pt(e){return it="",e}function ft(e){return Ge(ut(tt-1,gt(91===e?e+2:40===e?e+1:e)))}function mt(e){for(;(rt=lt())&&rt<33;)at();return ht(e)>2||ht(rt)>3?"":" "}function _t(e,t){for(;--t&&at()&&!(rt<48||rt>102||rt>57&&rt<65||rt>70&&rt<97););return ut(e,ct()+(t<6&&32==lt()&&32==at()))}function gt(e){for(;at();)switch(rt){case e:return tt;case 34:case 39:34!==e&&39!==e&>(rt);break;case 40:41===e&>(e);break;case 92:at()}return tt}function yt(e,t){for(;at()&&e+rt!==57&&(e+rt!==84||47!==lt()););return"/*"+ut(t,tt-1)+"*"+Ue(47===e?e:at())}function xt(e){for(;!ht(lt());)at();return ut(e,tt)}function vt(e){return pt(bt("",null,null,null,[""],e=dt(e),0,[0],e))}function bt(e,t,r,i,n,o,s,a,l){for(var c=0,u=0,h=s,d=0,p=0,f=0,m=1,_=1,g=1,y=0,x="",v=n,b=o,w=i,T=x;_;)switch(f=y,y=at()){case 40:if(108!=f&&58==We(T,h-1)){-1!=He(T+=qe(ft(y),"&","&\f"),"&\f")&&(g=-1);break}case 34:case 39:case 91:T+=ft(y);break;case 9:case 10:case 13:case 32:T+=mt(f);break;case 92:T+=_t(ct()-1,7);continue;case 47:switch(lt()){case 42:case 47:Je(Tt(yt(at(),ct()),t,r),l);break;default:T+="/"}break;case 123*m:a[c++]=Xe(T)*g;case 125*m:case 59:case 0:switch(y){case 0:case 125:_=0;case 59+u:-1==g&&(T=qe(T,/\f/g,"")),p>0&&Xe(T)-h&&Je(p>32?St(T+";",i,r,h-1):St(qe(T," ","")+";",i,r,h-2),l);break;case 59:T+=";";default:if(Je(w=wt(T,t,r,c,u,n,a,x,v=[],b=[],h),o),123===y)if(0===u)bt(T,t,w,w,v,o,h,a,b);else switch(99===d&&110===We(T,3)?100:d){case 100:case 108:case 109:case 115:bt(e,w,w,i&&Je(wt(e,w,w,0,0,n,a,x,n,v=[],h),b),n,b,h,a,i?v:b);break;default:bt(T,w,w,w,[""],b,0,a,b)}}c=u=p=0,m=g=1,x=T="",h=s;break;case 58:h=1+Xe(T),p=f;default:if(m<1)if(123==y)--m;else if(125==y&&0==m++&&125==st())continue;switch(T+=Ue(y),y*m){case 38:g=u>0?1:(T+="\f",-1);break;case 44:a[c++]=(Xe(T)-1)*g,g=1;break;case 64:45===lt()&&(T+=ft(at())),d=lt(),u=h=Xe(x=T+=xt(ct())),y++;break;case 45:45===f&&2==Xe(T)&&(m=0)}}return o}function wt(e,t,r,i,n,o,s,a,l,c,u){for(var h=n-1,d=0===n?o:[""],p=Ye(d),f=0,m=0,_=0;f<i;++f)for(var g=0,y=Ze(e,h+1,h=je(m=s[f])),x=e;g<p;++g)(x=Ge(m>0?d[g]+" "+y:qe(y,/&\f/g,d[g])))&&(l[_++]=x);return nt(e,t,r,0===n?Fe:a,l,c,u)}function Tt(e,t,r){return nt(e,t,r,Be,Ue(rt),Ze(e,2,-2),0)}function St(e,t,r,i){return nt(e,t,r,Ne,Ze(e,0,i),Ze(e,i+1,-1),i)}function Et(e,t){for(var r="",i=Ye(e),n=0;n<i;n++)r+=t(e[n],n,e,t)||"";return r}function Mt(e,t,r,i){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case Ne:return e.return=e.return||e.value;case Be:return"";case Ve:return e.return=e.value+"{"+Et(e.children,i)+"}";case Fe:e.value=e.props.join(",")}return Xe(r=Et(e.children,i))?e.return=e.value+"{"+r+"}":""}function At(e){var t=Ye(e);return function(r,i,n,o){for(var s="",a=0;a<t;a++)s+=e[a](r,i,n,o)||"";return s}}var Ct="undefined"!=typeof document,It=function(e,t,r){for(var i=0,n=0;i=n,n=lt(),38===i&&12===n&&(t[r]=1),!ht(n);)at();return ut(e,tt)},Pt=function(e,t){return pt(function(e,t){var r=-1,i=44;do{switch(ht(i)){case 0:38===i&&12===lt()&&(t[r]=1),e[r]+=It(tt-1,t,r);break;case 2:e[r]+=ft(i);break;case 4:if(44===i){e[++r]=58===lt()?"&\f":"",t[r]=e[r].length;break}default:e[r]+=Ue(i)}}while(i=at());return e}(dt(e),t))},Rt=new WeakMap,zt=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,r=e.parent,i=e.column===r.column&&e.line===r.line;"rule"!==r.type;)if(!(r=r.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||Rt.get(r))&&!i){Rt.set(e,!0);for(var n=[],o=Pt(t,n),s=r.props,a=0,l=0;a<o.length;a++)for(var c=0;c<s.length;c++,l++)e.props[l]=n[a]?o[a].replace(/&\f/g,s[c]):s[c]+" "+o[a]}}},Dt=function(e){if("decl"===e.type){var t=e.value;108===t.charCodeAt(0)&&98===t.charCodeAt(2)&&(e.return="",e.value="")}};function kt(e,t){switch(function(e,t){return 45^We(e,0)?(((t<<2^We(e,0))<<2^We(e,1))<<2^We(e,2))<<2^We(e,3):0}(e,t)){case 5103:return Le+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Le+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Le+e+Oe+e+ke+e+e;case 6828:case 4268:return Le+e+ke+e+e;case 6165:return Le+e+ke+"flex-"+e+e;case 5187:return Le+e+qe(e,/(\w+).+(:[^]+)/,Le+"box-$1$2"+ke+"flex-$1$2")+e;case 5443:return Le+e+ke+"flex-item-"+qe(e,/flex-|-self/,"")+e;case 4675:return Le+e+ke+"flex-line-pack"+qe(e,/align-content|flex-|-self/,"")+e;case 5548:return Le+e+ke+qe(e,"shrink","negative")+e;case 5292:return Le+e+ke+qe(e,"basis","preferred-size")+e;case 6060:return Le+"box-"+qe(e,"-grow","")+Le+e+ke+qe(e,"grow","positive")+e;case 4554:return Le+qe(e,/([^-])(transform)/g,"$1"+Le+"$2")+e;case 6187:return qe(qe(qe(e,/(zoom-|grab)/,Le+"$1"),/(image-set)/,Le+"$1"),e,"")+e;case 5495:case 3959:return qe(e,/(image-set\([^]*)/,Le+"$1$`$1");case 4968:return qe(qe(e,/(.+:)(flex-)?(.*)/,Le+"box-pack:$3"+ke+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Le+e+e;case 4095:case 3583:case 4068:case 2532:return qe(e,/(.+)-inline(.+)/,Le+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Xe(e)-1-t>6)switch(We(e,t+1)){case 109:if(45!==We(e,t+4))break;case 102:return qe(e,/(.+:)(.+)-([^]+)/,"$1"+Le+"$2-$3$1"+Oe+(108==We(e,t+3)?"$3":"$2-$3"))+e;case 115:return~He(e,"stretch")?kt(qe(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==We(e,t+1))break;case 6444:switch(We(e,Xe(e)-3-(~He(e,"!important")&&10))){case 107:return qe(e,":",":"+Le)+e;case 101:return qe(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Le+(45===We(e,14)?"inline-":"")+"box$3$1"+Le+"$2$3$1"+ke+"$2box$3")+e}break;case 5936:switch(We(e,t+11)){case 114:return Le+e+ke+qe(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Le+e+ke+qe(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Le+e+ke+qe(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Le+e+ke+e+e}return e}var Ot,Lt,Bt,Ft=Ct?void 0:(Ot=function(){return Pe((function(){var e={};return function(t){return e[t]}}))},Lt=new WeakMap,function(e){if(Lt.has(e))return Lt.get(e);var t=Ot(e);return Lt.set(e,t),t}),Nt=[function(e,t,r,i){if(e.length>-1&&!e.return)switch(e.type){case Ne:e.return=kt(e.value,e.length);break;case Ve:return Et([ot(e,{value:qe(e.value,"@","@"+Le)})],i);case Fe:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=t.exec(e))?e[0]:e}(t,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Et([ot(e,{props:[qe(t,/:(read-\w+)/,":-moz-$1")]})],i);case"::placeholder":return Et([ot(e,{props:[qe(t,/:(plac\w+)/,":"+Le+"input-$1")]}),ot(e,{props:[qe(t,/:(plac\w+)/,":-moz-$1")]}),ot(e,{props:[qe(t,/:(plac\w+)/,ke+"input-$1")]})],i)}return""}))}}],Vt=function(e){var t=e.key;if(Ct&&"css"===t){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var i,n,o=e.stylisPlugins||Nt,s={},a=[];Ct&&(i=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),(function(e){for(var t=e.getAttribute("data-emotion").split(" "),r=1;r<t.length;r++)s[t[r]]=!0;a.push(e)})));var l,c=[zt,Dt];if(Ct){var u,h=[Mt,(l=function(e){u.insert(e)},function(e){e.root||(e=e.return)&&l(e)})],d=At(c.concat(o,h));n=function(e,t,r,i){u=r,function(e){Et(vt(e),d)}(e?e+"{"+t.styles+"}":t.styles),i&&(g.inserted[t.name]=!0)}}else{var p=[Mt],f=At(c.concat(o,p)),m=Ft(o)(t),_=function(e,t){var r=t.name;return void 0===m[r]&&(m[r]=function(e){return Et(vt(e),f)}(e?e+"{"+t.styles+"}":t.styles)),m[r]};n=function(e,t,r,i){var n=t.name,o=_(e,t);return void 0===g.compat?(i&&(g.inserted[n]=!0),o):i?void(g.inserted[n]=o):o}}var g={key:t,sheet:new De({key:t,container:i,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:s,registered:{},insert:n};return g.sheet.hydrate(a),g},jt={exports:{}},Ut={};var $t,Gt,qt,Ht,Wt={};
|
|
12
|
+
/** @license React v16.13.1
|
|
13
|
+
* react-is.development.js
|
|
14
|
+
*
|
|
15
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
16
|
+
*
|
|
17
|
+
* This source code is licensed under the MIT license found in the
|
|
18
|
+
* LICENSE file in the root directory of this source tree.
|
|
19
|
+
*/function Zt(){return Gt||(Gt=1,"production"===process.env.NODE_ENV?jt.exports=function(){if(Bt)return Ut;Bt=1;var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,i=e?Symbol.for("react.fragment"):60107,n=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,d=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,f=e?Symbol.for("react.lazy"):60116,m=e?Symbol.for("react.block"):60121,_=e?Symbol.for("react.fundamental"):60117,g=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function x(e){if("object"==typeof e&&null!==e){var d=e.$$typeof;switch(d){case t:switch(e=e.type){case l:case c:case i:case o:case n:case h:return e;default:switch(e=e&&e.$$typeof){case a:case u:case f:case p:case s:return e;default:return d}}case r:return d}}}function v(e){return x(e)===c}return Ut.AsyncMode=l,Ut.ConcurrentMode=c,Ut.ContextConsumer=a,Ut.ContextProvider=s,Ut.Element=t,Ut.ForwardRef=u,Ut.Fragment=i,Ut.Lazy=f,Ut.Memo=p,Ut.Portal=r,Ut.Profiler=o,Ut.StrictMode=n,Ut.Suspense=h,Ut.isAsyncMode=function(e){return v(e)||x(e)===l},Ut.isConcurrentMode=v,Ut.isContextConsumer=function(e){return x(e)===a},Ut.isContextProvider=function(e){return x(e)===s},Ut.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},Ut.isForwardRef=function(e){return x(e)===u},Ut.isFragment=function(e){return x(e)===i},Ut.isLazy=function(e){return x(e)===f},Ut.isMemo=function(e){return x(e)===p},Ut.isPortal=function(e){return x(e)===r},Ut.isProfiler=function(e){return x(e)===o},Ut.isStrictMode=function(e){return x(e)===n},Ut.isSuspense=function(e){return x(e)===h},Ut.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===c||e===o||e===n||e===h||e===d||"object"==typeof e&&null!==e&&(e.$$typeof===f||e.$$typeof===p||e.$$typeof===s||e.$$typeof===a||e.$$typeof===u||e.$$typeof===_||e.$$typeof===g||e.$$typeof===y||e.$$typeof===m)},Ut.typeOf=x,Ut}():jt.exports=($t||($t=1,"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,i=e?Symbol.for("react.fragment"):60107,n=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,d=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,f=e?Symbol.for("react.lazy"):60116,m=e?Symbol.for("react.block"):60121,_=e?Symbol.for("react.fundamental"):60117,g=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function x(e){if("object"==typeof e&&null!==e){var d=e.$$typeof;switch(d){case t:var m=e.type;switch(m){case l:case c:case i:case o:case n:case h:return m;default:var _=m&&m.$$typeof;switch(_){case a:case u:case f:case p:case s:return _;default:return d}}case r:return d}}}var v=l,b=c,w=a,T=s,S=t,E=u,M=i,A=f,C=p,I=r,P=o,R=n,z=h,D=!1;function k(e){return x(e)===c}Wt.AsyncMode=v,Wt.ConcurrentMode=b,Wt.ContextConsumer=w,Wt.ContextProvider=T,Wt.Element=S,Wt.ForwardRef=E,Wt.Fragment=M,Wt.Lazy=A,Wt.Memo=C,Wt.Portal=I,Wt.Profiler=P,Wt.StrictMode=R,Wt.Suspense=z,Wt.isAsyncMode=function(e){return D||(D=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),k(e)||x(e)===l},Wt.isConcurrentMode=k,Wt.isContextConsumer=function(e){return x(e)===a},Wt.isContextProvider=function(e){return x(e)===s},Wt.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},Wt.isForwardRef=function(e){return x(e)===u},Wt.isFragment=function(e){return x(e)===i},Wt.isLazy=function(e){return x(e)===f},Wt.isMemo=function(e){return x(e)===p},Wt.isPortal=function(e){return x(e)===r},Wt.isProfiler=function(e){return x(e)===o},Wt.isStrictMode=function(e){return x(e)===n},Wt.isSuspense=function(e){return x(e)===h},Wt.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===c||e===o||e===n||e===h||e===d||"object"==typeof e&&null!==e&&(e.$$typeof===f||e.$$typeof===p||e.$$typeof===s||e.$$typeof===a||e.$$typeof===u||e.$$typeof===_||e.$$typeof===g||e.$$typeof===y||e.$$typeof===m)},Wt.typeOf=x}()),Wt)),jt.exports}!function(){if(Ht)return qt;Ht=1;var e=Zt(),t={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},r={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},i={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},n={};function o(r){return e.isMemo(r)?i:n[r.$$typeof]||t}n[e.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},n[e.Memo]=i;var s=Object.defineProperty,a=Object.getOwnPropertyNames,l=Object.getOwnPropertySymbols,c=Object.getOwnPropertyDescriptor,u=Object.getPrototypeOf,h=Object.prototype;qt=function e(t,i,n){if("string"!=typeof i){if(h){var d=u(i);d&&d!==h&&e(t,d,n)}var p=a(i);l&&(p=p.concat(l(i)));for(var f=o(t),m=o(i),_=0;_<p.length;++_){var g=p[_];if(!(r[g]||n&&n[g]||m&&m[g]||f&&f[g])){var y=c(i,g);try{s(t,g,y)}catch(e){}}}}return t}}();var Xt="undefined"!=typeof document;var Yt=function(e,t,r){var i=e.key+"-"+t.name;(!1===r||!1===Xt&&void 0!==e.compat)&&void 0===e.registered[i]&&(e.registered[i]=t.styles)};var Jt={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Kt=/[A-Z]|^ms/g,Qt=/_EMO_([^_]+?)_([^]*?)_EMO_/g,er=function(e){return 45===e.charCodeAt(1)},tr=function(e){return null!=e&&"boolean"!=typeof e},rr=Pe((function(e){return er(e)?e:e.replace(Kt,"-$&").toLowerCase()})),ir=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(Qt,(function(e,t,r){return or={name:t,styles:r,next:or},t}))}return 1===Jt[e]||er(e)||"number"!=typeof t||0===t?t:t+"px"};function nr(e,t,r){if(null==r)return"";var i=r;if(void 0!==i.__emotion_styles)return i;switch(typeof r){case"boolean":return"";case"object":var n=r;if(1===n.anim)return or={name:n.name,styles:n.styles,next:or},n.name;var o=r;if(void 0!==o.styles){var s=o.next;if(void 0!==s)for(;void 0!==s;)or={name:s.name,styles:s.styles,next:or},s=s.next;return o.styles+";"}return function(e,t,r){var i="";if(Array.isArray(r))for(var n=0;n<r.length;n++)i+=nr(e,t,r[n])+";";else for(var o in r){var s=r[o];if("object"!=typeof s){var a=s;null!=t&&void 0!==t[a]?i+=o+"{"+t[a]+"}":tr(a)&&(i+=rr(o)+":"+ir(o,a)+";")}else if(!Array.isArray(s)||"string"!=typeof s[0]||null!=t&&void 0!==t[s[0]]){var l=nr(e,t,s);switch(o){case"animation":case"animationName":i+=rr(o)+":"+l+";";break;default:i+=o+"{"+l+"}"}}else for(var c=0;c<s.length;c++)tr(s[c])&&(i+=rr(o)+":"+ir(o,s[c])+";")}return i}(e,t,r);case"function":if(void 0!==e){var a=or,l=r(e);return or=a,nr(e,t,l)}}var c=r;if(null==t)return c;var u=t[c];return void 0!==u?u:c}var or,sr=/label:\s*([^\s;{]+)\s*(;|$)/g;function ar(e,t,r){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var i=!0,n="";or=void 0;var o=e[0];null==o||void 0===o.raw?(i=!1,n+=nr(r,t,o)):n+=o[0];for(var s=1;s<e.length;s++){if(n+=nr(r,t,e[s]),i)n+=o[s]}sr.lastIndex=0;for(var a,l="";null!==(a=sr.exec(n));)l+="-"+a[1];var c=function(e){for(var t,r=0,i=0,n=e.length;n>=4;++i,n-=4)t=1540483477*(65535&(t=255&e.charCodeAt(i)|(255&e.charCodeAt(++i))<<8|(255&e.charCodeAt(++i))<<16|(255&e.charCodeAt(++i))<<24))+(59797*(t>>>16)<<16),r=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&r)+(59797*(r>>>16)<<16);switch(n){case 3:r^=(255&e.charCodeAt(i+2))<<16;case 2:r^=(255&e.charCodeAt(i+1))<<8;case 1:r=1540483477*(65535&(r^=255&e.charCodeAt(i)))+(59797*(r>>>16)<<16)}return(((r=1540483477*(65535&(r^=r>>>13))+(59797*(r>>>16)<<16))^r>>>15)>>>0).toString(36)}(n)+l;return{name:c,styles:n,next:or}}var lr="undefined"!=typeof document,cr=function(e){return e()},ur=!!e.useInsertionEffect&&e.useInsertionEffect,hr=lr&&ur||cr,dr="undefined"!=typeof document,pr=e.createContext("undefined"!=typeof HTMLElement?Vt({key:"css"}):null);pr.Provider;var fr=function(e){return r((function(t,r){var n=i(pr);return e(t,n,r)}))};dr||(fr=function(t){return function(r){var n=i(pr);return null===n?(n=Vt({key:"css"}),e.createElement(pr.Provider,{value:n},t(r,n))):t(r,n)}});var mr=e.createContext({});function _r(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return ar(t)}var gr=function(){var e=_r.apply(void 0,arguments),t="animation-"+e.name;return{name:t,styles:"@keyframes "+t+"{"+e.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}},yr=ze,xr=function(e){return"theme"!==e},vr=function(e){return"string"==typeof e&&e.charCodeAt(0)>96?yr:xr},br=function(e,t,r){var i;if(t){var n=t.shouldForwardProp;i=e.__emotion_forwardProp&&n?function(t){return e.__emotion_forwardProp(t)&&n(t)}:n}return"function"!=typeof i&&r&&(i=e.__emotion_forwardProp),i},wr="undefined"!=typeof document,Tr=function(t){var r=t.cache,i=t.serialized,n=t.isStringTag;Yt(r,i,n);var o=hr((function(){return function(e,t,r){Yt(e,t,r);var i=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var n="",o=t;do{var s=e.insert(t===o?"."+i:"",o,e.sheet,!0);Xt||void 0===s||(n+=s),o=o.next}while(void 0!==o);if(!Xt&&0!==n.length)return n}}(r,i,n)}));if(!wr&&void 0!==o){for(var s,a=i.name,l=i.next;void 0!==l;)a+=" "+l.name,l=l.next;return e.createElement("style",((s={})["data-emotion"]=r.key+" "+a,s.dangerouslySetInnerHTML={__html:o},s.nonce=r.sheet.nonce,s))}return null},Sr=function t(r,i){var n,o,s=r.__emotion_real===r,a=s&&r.__emotion_base||r;void 0!==i&&(n=i.label,o=i.target);var l=br(r,i,s),c=l||vr(a),u=!c("as");return function(){var h=arguments,d=s&&void 0!==r.__emotion_styles?r.__emotion_styles.slice(0):[];if(void 0!==n&&d.push("label:"+n+";"),null==h[0]||void 0===h[0].raw)d.push.apply(d,h);else{d.push(h[0][0]);for(var p=h.length,f=1;f<p;f++)d.push(h[f],h[0][f])}var m=fr((function(t,r,i){var n,s,h,p,f=u&&t.as||a,m="",_=[],g=t;if(null==t.theme){for(var y in g={},t)g[y]=t[y];g.theme=e.useContext(mr)}"string"==typeof t.className?(n=r.registered,s=_,h=t.className,p="",h.split(" ").forEach((function(e){void 0!==n[e]?s.push(n[e]+";"):e&&(p+=e+" ")})),m=p):null!=t.className&&(m=t.className+" ");var x=ar(d.concat(_),r.registered,g);m+=r.key+"-"+x.name,void 0!==o&&(m+=" "+o);var v=u&&void 0===l?vr(f):c,b={};for(var w in t)u&&"as"===w||v(w)&&(b[w]=t[w]);return b.className=m,i&&(b.ref=i),e.createElement(e.Fragment,null,e.createElement(Tr,{cache:r,serialized:x,isStringTag:"string"==typeof f}),e.createElement(f,b))}));return m.displayName=void 0!==n?n:"Styled("+("string"==typeof a?a:a.displayName||a.name||"Component")+")",m.defaultProps=r.defaultProps,m.__emotion_real=m,m.__emotion_base=a,m.__emotion_styles=d,m.__emotion_forwardProp=l,Object.defineProperty(m,"toString",{value:function(){return"."+o}}),m.withComponent=function(e,r){return t(e,Ie({},i,r,{shouldForwardProp:br(m,r,!0)})).apply(void 0,d)},m}}.bind();["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach((function(e){Sr[e]=Sr(e)}));var Er,Mr={exports:{}},Ar={exports:{}},Cr={};var Ir,Pr,Rr,zr,Dr,kr,Or,Lr,Br,Fr,Nr,Vr,jr,Ur,$r,Gr={};
|
|
20
|
+
/** @license React v16.13.1
|
|
21
|
+
* react-is.development.js
|
|
22
|
+
*
|
|
23
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
24
|
+
*
|
|
25
|
+
* This source code is licensed under the MIT license found in the
|
|
26
|
+
* LICENSE file in the root directory of this source tree.
|
|
27
|
+
*/function qr(){return Pr||(Pr=1,"production"===process.env.NODE_ENV?Ar.exports=function(){if(Er)return Cr;Er=1;var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,i=e?Symbol.for("react.fragment"):60107,n=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,d=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,f=e?Symbol.for("react.lazy"):60116,m=e?Symbol.for("react.block"):60121,_=e?Symbol.for("react.fundamental"):60117,g=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function x(e){if("object"==typeof e&&null!==e){var d=e.$$typeof;switch(d){case t:switch(e=e.type){case l:case c:case i:case o:case n:case h:return e;default:switch(e=e&&e.$$typeof){case a:case u:case f:case p:case s:return e;default:return d}}case r:return d}}}function v(e){return x(e)===c}return Cr.AsyncMode=l,Cr.ConcurrentMode=c,Cr.ContextConsumer=a,Cr.ContextProvider=s,Cr.Element=t,Cr.ForwardRef=u,Cr.Fragment=i,Cr.Lazy=f,Cr.Memo=p,Cr.Portal=r,Cr.Profiler=o,Cr.StrictMode=n,Cr.Suspense=h,Cr.isAsyncMode=function(e){return v(e)||x(e)===l},Cr.isConcurrentMode=v,Cr.isContextConsumer=function(e){return x(e)===a},Cr.isContextProvider=function(e){return x(e)===s},Cr.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},Cr.isForwardRef=function(e){return x(e)===u},Cr.isFragment=function(e){return x(e)===i},Cr.isLazy=function(e){return x(e)===f},Cr.isMemo=function(e){return x(e)===p},Cr.isPortal=function(e){return x(e)===r},Cr.isProfiler=function(e){return x(e)===o},Cr.isStrictMode=function(e){return x(e)===n},Cr.isSuspense=function(e){return x(e)===h},Cr.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===c||e===o||e===n||e===h||e===d||"object"==typeof e&&null!==e&&(e.$$typeof===f||e.$$typeof===p||e.$$typeof===s||e.$$typeof===a||e.$$typeof===u||e.$$typeof===_||e.$$typeof===g||e.$$typeof===y||e.$$typeof===m)},Cr.typeOf=x,Cr}():Ar.exports=(Ir||(Ir=1,"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,i=e?Symbol.for("react.fragment"):60107,n=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,d=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,f=e?Symbol.for("react.lazy"):60116,m=e?Symbol.for("react.block"):60121,_=e?Symbol.for("react.fundamental"):60117,g=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function x(e){if("object"==typeof e&&null!==e){var d=e.$$typeof;switch(d){case t:var m=e.type;switch(m){case l:case c:case i:case o:case n:case h:return m;default:var _=m&&m.$$typeof;switch(_){case a:case u:case f:case p:case s:return _;default:return d}}case r:return d}}}var v=l,b=c,w=a,T=s,S=t,E=u,M=i,A=f,C=p,I=r,P=o,R=n,z=h,D=!1;function k(e){return x(e)===c}Gr.AsyncMode=v,Gr.ConcurrentMode=b,Gr.ContextConsumer=w,Gr.ContextProvider=T,Gr.Element=S,Gr.ForwardRef=E,Gr.Fragment=M,Gr.Lazy=A,Gr.Memo=C,Gr.Portal=I,Gr.Profiler=P,Gr.StrictMode=R,Gr.Suspense=z,Gr.isAsyncMode=function(e){return D||(D=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),k(e)||x(e)===l},Gr.isConcurrentMode=k,Gr.isContextConsumer=function(e){return x(e)===a},Gr.isContextProvider=function(e){return x(e)===s},Gr.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},Gr.isForwardRef=function(e){return x(e)===u},Gr.isFragment=function(e){return x(e)===i},Gr.isLazy=function(e){return x(e)===f},Gr.isMemo=function(e){return x(e)===p},Gr.isPortal=function(e){return x(e)===r},Gr.isProfiler=function(e){return x(e)===o},Gr.isStrictMode=function(e){return x(e)===n},Gr.isSuspense=function(e){return x(e)===h},Gr.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===c||e===o||e===n||e===h||e===d||"object"==typeof e&&null!==e&&(e.$$typeof===f||e.$$typeof===p||e.$$typeof===s||e.$$typeof===a||e.$$typeof===u||e.$$typeof===_||e.$$typeof===g||e.$$typeof===y||e.$$typeof===m)},Gr.typeOf=x}()),Gr)),Ar.exports}
|
|
28
|
+
/*
|
|
29
|
+
object-assign
|
|
30
|
+
(c) Sindre Sorhus
|
|
31
|
+
@license MIT
|
|
32
|
+
*/function Hr(){if(zr)return Rr;zr=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;return Rr=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach((function(e){i[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(e){return!1}}()?Object.assign:function(i,n){for(var o,s,a=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(i),l=1;l<arguments.length;l++){for(var c in o=Object(arguments[l]))t.call(o,c)&&(a[c]=o[c]);if(e){s=e(o);for(var u=0;u<s.length;u++)r.call(o,s[u])&&(a[s[u]]=o[s[u]])}}return a},Rr}function Wr(){if(kr)return Dr;kr=1;return Dr="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function Zr(){return Lr?Or:(Lr=1,Or=Function.call.bind(Object.prototype.hasOwnProperty))}function Xr(){if(Fr)return Br;Fr=1;var e=function(){};if("production"!==process.env.NODE_ENV){var t=Wr(),r={},i=Zr();e=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function n(n,o,s,a,l){if("production"!==process.env.NODE_ENV)for(var c in n)if(i(n,c)){var u;try{if("function"!=typeof n[c]){var h=Error((a||"React class")+": "+s+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof n[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}u=n[c](o,c,a,s,null,t)}catch(e){u=e}if(!u||u instanceof Error||e((a||"React class")+": type specification of "+s+" `"+c+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof u+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),u instanceof Error&&!(u.message in r)){r[u.message]=!0;var d=l?l():"";e("Failed "+s+" type: "+u.message+(null!=d?d:""))}}}return n.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(r={})},Br=n}function Yr(){if(Vr)return Nr;Vr=1;var e=qr(),t=Hr(),r=Wr(),i=Zr(),n=Xr(),o=function(){};function s(){return null}return"production"!==process.env.NODE_ENV&&(o=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),Nr=function(a,l){var c="function"==typeof Symbol&&Symbol.iterator;var u="<<anonymous>>",h={array:m("array"),bigint:m("bigint"),bool:m("boolean"),func:m("function"),number:m("number"),object:m("object"),string:m("string"),symbol:m("symbol"),any:f(s),arrayOf:function(e){return f((function(t,i,n,o,s){if("function"!=typeof e)return new p("Property `"+s+"` of component `"+n+"` has invalid PropType notation inside arrayOf.");var a=t[i];if(!Array.isArray(a))return new p("Invalid "+o+" `"+s+"` of type `"+y(a)+"` supplied to `"+n+"`, expected an array.");for(var l=0;l<a.length;l++){var c=e(a,l,n,o,s+"["+l+"]",r);if(c instanceof Error)return c}return null}))},element:f((function(e,t,r,i,n){var o=e[t];return a(o)?null:new p("Invalid "+i+" `"+n+"` of type `"+y(o)+"` supplied to `"+r+"`, expected a single ReactElement.")})),elementType:f((function(t,r,i,n,o){var s=t[r];return e.isValidElementType(s)?null:new p("Invalid "+n+" `"+o+"` of type `"+y(s)+"` supplied to `"+i+"`, expected a single ReactElement type.")})),instanceOf:function(e){return f((function(t,r,i,n,o){if(!(t[r]instanceof e)){var s=e.name||u;return new p("Invalid "+n+" `"+o+"` of type `"+(((a=t[r]).constructor&&a.constructor.name?a.constructor.name:u)+"` supplied to `")+i+"`, expected instance of `"+s+"`.")}var a;return null}))},node:f((function(e,t,r,i,n){return g(e[t])?null:new p("Invalid "+i+" `"+n+"` supplied to `"+r+"`, expected a ReactNode.")})),objectOf:function(e){return f((function(t,n,o,s,a){if("function"!=typeof e)return new p("Property `"+a+"` of component `"+o+"` has invalid PropType notation inside objectOf.");var l=t[n],c=y(l);if("object"!==c)return new p("Invalid "+s+" `"+a+"` of type `"+c+"` supplied to `"+o+"`, expected an object.");for(var u in l)if(i(l,u)){var h=e(l,u,o,s,a+"."+u,r);if(h instanceof Error)return h}return null}))},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&o(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),s;return f((function(t,r,i,n,o){for(var s=t[r],a=0;a<e.length;a++)if(d(s,e[a]))return null;var l=JSON.stringify(e,(function(e,t){return"symbol"===x(t)?String(t):t}));return new p("Invalid "+n+" `"+o+"` of value `"+String(s)+"` supplied to `"+i+"`, expected one of "+l+".")}))},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&o("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var t=0;t<e.length;t++){var n=e[t];if("function"!=typeof n)return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+v(n)+" at index "+t+"."),s}return f((function(t,n,o,s,a){for(var l=[],c=0;c<e.length;c++){var u=(0,e[c])(t,n,o,s,a,r);if(null==u)return null;u.data&&i(u.data,"expectedType")&&l.push(u.data.expectedType)}return new p("Invalid "+s+" `"+a+"` supplied to `"+o+"`"+(l.length>0?", expected one of type ["+l.join(", ")+"]":"")+".")}))},shape:function(e){return f((function(t,i,n,o,s){var a=t[i],l=y(a);if("object"!==l)return new p("Invalid "+o+" `"+s+"` of type `"+l+"` supplied to `"+n+"`, expected `object`.");for(var c in e){var u=e[c];if("function"!=typeof u)return _(n,o,s,c,x(u));var h=u(a,c,n,o,s+"."+c,r);if(h)return h}return null}))},exact:function(e){return f((function(n,o,s,a,l){var c=n[o],u=y(c);if("object"!==u)return new p("Invalid "+a+" `"+l+"` of type `"+u+"` supplied to `"+s+"`, expected `object`.");var h=t({},n[o],e);for(var d in h){var f=e[d];if(i(e,d)&&"function"!=typeof f)return _(s,a,l,d,x(f));if(!f)return new p("Invalid "+a+" `"+l+"` key `"+d+"` supplied to `"+s+"`.\nBad object: "+JSON.stringify(n[o],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var m=f(c,d,s,a,l+"."+d,r);if(m)return m}return null}))}};function d(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function p(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function f(e){if("production"!==process.env.NODE_ENV)var t={},i=0;function n(n,s,a,c,h,d,f){if(c=c||u,d=d||a,f!==r){if(l){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var _=c+":"+a;!t[_]&&i<3&&(o("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+c+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),t[_]=!0,i++)}}return null==s[a]?n?null===s[a]?new p("The "+h+" `"+d+"` is marked as required in `"+c+"`, but its value is `null`."):new p("The "+h+" `"+d+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(s,a,c,h,d)}var s=n.bind(null,!1);return s.isRequired=n.bind(null,!0),s}function m(e){return f((function(t,r,i,n,o,s){var a=t[r];return y(a)!==e?new p("Invalid "+n+" `"+o+"` of type `"+x(a)+"` supplied to `"+i+"`, expected `"+e+"`.",{expectedType:e}):null}))}function _(e,t,r,i,n){return new p((e||"React class")+": "+t+" type `"+r+"."+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+n+"`.")}function g(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(g);if(null===e||a(e))return!0;var t=function(e){var t=e&&(c&&e[c]||e["@@iterator"]);if("function"==typeof t)return t}(e);if(!t)return!1;var r,i=t.call(e);if(t!==e.entries){for(;!(r=i.next()).done;)if(!g(r.value))return!1}else for(;!(r=i.next()).done;){var n=r.value;if(n&&!g(n[1]))return!1}return!0;default:return!1}}function y(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function x(e){if(null==e)return""+e;var t=y(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function v(e){var t=x(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return p.prototype=Error.prototype,h.checkPropTypes=n,h.resetWarningCache=n.resetWarningCache,h.PropTypes=h,h},Nr}function Jr(){if(Ur)return jr;Ur=1;var e=Wr();function t(){}function r(){}return r.resetWarningCache=t,jr=function(){function i(t,r,i,n,o,s){if(s!==e){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function n(){return i}i.isRequired=i;var o={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:n,element:i,elementType:i,instanceOf:n,node:i,objectOf:n,oneOf:n,oneOfType:n,shape:n,exact:n,checkPropTypes:r,resetWarningCache:t};return o.PropTypes=o,o}}function Kr(){if($r)return Mr.exports;if($r=1,"production"!==process.env.NODE_ENV){var e=qr();Mr.exports=Yr()(e.isElement,true)}else Mr.exports=Jr()();return Mr.exports}var Qr=p(Kr());
|
|
33
|
+
/**
|
|
34
|
+
* @mui/styled-engine v6.1.6
|
|
35
|
+
*
|
|
36
|
+
* @license MIT
|
|
37
|
+
* This source code is licensed under the MIT license found in the
|
|
38
|
+
* LICENSE file in the root directory of this source tree.
|
|
39
|
+
*/
|
|
40
|
+
function ei(e,t){const r=Sr(e,t);return"production"!==process.env.NODE_ENV?(...t)=>{const i="string"==typeof e?`"${e}"`:"component";return 0===t.length?console.error([`MUI: Seems like you called \`styled(${i})()\` without a \`style\` argument.`,'You must provide a `styles` argument: `styled("div")(styleYouForgotToPass)`.'].join("\n")):t.some((e=>void 0===e))&&console.error(`MUI: the styled(${i})(...args) API requires all its args to be defined.`),r(...t)}:r}const ti=[];function ri(e){return ti[0]=e,ar(ti)}function ii(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}function ni(e){if(!ii(e))return e;const t={};return Object.keys(e).forEach((r=>{t[r]=ni(e[r])})),t}function oi(e,t,r={clone:!0}){const i=r.clone?{...e}:e;return ii(e)&&ii(t)&&Object.keys(t).forEach((n=>{ii(t[n])&&Object.prototype.hasOwnProperty.call(e,n)&&ii(e[n])?i[n]=oi(e[n],t[n],r):r.clone?i[n]=ii(t[n])?ni(t[n]):t[n]:i[n]=t[n]})),i}function si(e){const{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:r="px",step:i=5,...n}=e,o=(e=>{const t=Object.keys(e).map((t=>({key:t,val:e[t]})))||[];return t.sort(((e,t)=>e.val-t.val)),t.reduce(((e,t)=>({...e,[t.key]:t.val})),{})})(t),s=Object.keys(o);function a(e){return`@media (min-width:${"number"==typeof t[e]?t[e]:e}${r})`}function l(e){return`@media (max-width:${("number"==typeof t[e]?t[e]:e)-i/100}${r})`}function c(e,n){const o=s.indexOf(n);return`@media (min-width:${"number"==typeof t[e]?t[e]:e}${r}) and (max-width:${(-1!==o&&"number"==typeof t[s[o]]?t[s[o]]:n)-i/100}${r})`}return{keys:s,values:o,up:a,down:l,between:c,only:function(e){return s.indexOf(e)+1<s.length?c(e,s[s.indexOf(e)+1]):a(e)},not:function(e){const t=s.indexOf(e);return 0===t?a(s[1]):t===s.length-1?l(s[t]):c(e,s[s.indexOf(e)+1]).replace("@media","@media not all and")},unit:r,...n}}const ai={borderRadius:4},li="production"!==process.env.NODE_ENV?Qr.oneOfType([Qr.number,Qr.string,Qr.object,Qr.array]):{};function ci(e,t){return t?oi(e,t,{clone:!1}):e}const ui={xs:0,sm:600,md:900,lg:1200,xl:1536},hi={keys:["xs","sm","md","lg","xl"],up:e=>`@media (min-width:${ui[e]}px)`},di={containerQueries:e=>({up:t=>{let r="number"==typeof t?t:ui[t]||t;return"number"==typeof r&&(r=`${r}px`),e?`@container ${e} (min-width:${r})`:`@container (min-width:${r})`}})};function pi(e,t,r){const i=e.theme||{};if(Array.isArray(t)){const e=i.breakpoints||hi;return t.reduce(((i,n,o)=>(i[e.up(e.keys[o])]=r(t[o]),i)),{})}if("object"==typeof t){const e=i.breakpoints||hi;return Object.keys(t).reduce(((n,o)=>{if(s=e.keys,"@"===(a=o)||a.startsWith("@")&&(s.some((e=>a.startsWith(`@${e}`)))||a.match(/^@\d/))){const e=function(e,t){const r=t.match(/^@([^/]+)?\/?(.+)?$/);if(!r){if("production"!==process.env.NODE_ENV)throw new Error("production"!==process.env.NODE_ENV?`MUI: The provided shorthand (${t}) is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.\nFor example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.`:Ae(18,`(${t})`));return null}const[,i,n]=r,o=Number.isNaN(+i)?i||0:+i;return e.containerQueries(n).up(o)}(i.containerQueries?i:di,o);e&&(n[e]=r(t[o],o))}else if(Object.keys(e.values||ui).includes(o)){n[e.up(o)]=r(t[o],o)}else{const e=o;n[e]=t[e]}var s,a;return n}),{})}return r(t)}function fi(e){if("string"!=typeof e)throw new Error("production"!==process.env.NODE_ENV?"MUI: `capitalize(string)` expects a string argument.":Ae(7));return e.charAt(0).toUpperCase()+e.slice(1)}function mi(e,t,r=!0){if(!t||"string"!=typeof t)return null;if(e&&e.vars&&r){const r=`vars.${t}`.split(".").reduce(((e,t)=>e&&e[t]?e[t]:null),e);if(null!=r)return r}return t.split(".").reduce(((e,t)=>e&&null!=e[t]?e[t]:null),e)}function _i(e,t,r,i=r){let n;return n="function"==typeof e?e(r):Array.isArray(e)?e[r]||i:mi(e,r)||i,t&&(n=t(n,i,e)),n}function gi(e){const{prop:t,cssProperty:r=e.prop,themeKey:i,transform:n}=e,o=e=>{if(null==e[t])return null;const o=e[t],s=mi(e.theme,i)||{};return pi(e,o,(e=>{let i=_i(s,n,e);return e===i&&"string"==typeof e&&(i=_i(s,n,`${t}${"default"===e?"":fi(e)}`,e)),!1===r?i:{[r]:i}}))};return o.propTypes="production"!==process.env.NODE_ENV?{[t]:li}:{},o.filterProps=[t],o}const yi={m:"margin",p:"padding"},xi={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},vi={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},bi=function(e){const t={};return r=>(void 0===t[r]&&(t[r]=e(r)),t[r])}((e=>{if(e.length>2){if(!vi[e])return[e];e=vi[e]}const[t,r]=e.split(""),i=yi[t],n=xi[r]||"";return Array.isArray(n)?n.map((e=>i+e)):[i+n]})),wi=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],Ti=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"],Si=[...wi,...Ti];function Ei(e,t,r,i){const n=mi(e,t,!0)??r;return"number"==typeof n||"string"==typeof n?e=>"string"==typeof e?e:("production"!==process.env.NODE_ENV&&"number"!=typeof e&&console.error(`MUI: Expected ${i} argument to be a number or a string, got ${e}.`),"string"==typeof n?`calc(${e} * ${n})`:n*e):Array.isArray(n)?e=>{if("string"==typeof e)return e;const r=Math.abs(e);"production"!==process.env.NODE_ENV&&(Number.isInteger(r)?r>n.length-1&&console.error([`MUI: The value provided (${r}) overflows.`,`The supported values are: ${JSON.stringify(n)}.`,`${r} > ${n.length-1}, you need to add the missing values.`].join("\n")):console.error([`MUI: The \`theme.${t}\` array type cannot be combined with non integer values.You should either use an integer value that can be used as index, or define the \`theme.${t}\` as a number.`].join("\n")));const i=n[r];return e>=0?i:"number"==typeof i?-i:`-${i}`}:"function"==typeof n?n:("production"!==process.env.NODE_ENV&&console.error([`MUI: The \`theme.${t}\` value (${n}) is invalid.`,"It should be a number, an array or a function."].join("\n")),()=>{})}function Mi(e){return Ei(e,"spacing",8,"spacing")}function Ai(e,t){return"string"==typeof t||null==t?t:e(t)}function Ci(e,t,r,i){if(!t.includes(r))return null;const n=function(e,t){return r=>e.reduce(((e,i)=>(e[i]=Ai(t,r),e)),{})}(bi(r),i);return pi(e,e[r],n)}function Ii(e,t){const r=Mi(e.theme);return Object.keys(e).map((i=>Ci(e,t,i,r))).reduce(ci,{})}function Pi(e){return Ii(e,wi)}function Ri(e){return Ii(e,Ti)}function zi(e=8,t=Mi({spacing:e})){if(e.mui)return e;const r=(...e)=>{"production"!==process.env.NODE_ENV&&(e.length<=4||console.error(`MUI: Too many arguments provided, expected between 0 and 4, got ${e.length}`));return(0===e.length?[1]:e).map((e=>{const r=t(e);return"number"==typeof r?`${r}px`:r})).join(" ")};return r.mui=!0,r}function Di(...e){const t=e.reduce(((e,t)=>(t.filterProps.forEach((r=>{e[r]=t})),e)),{}),r=e=>Object.keys(e).reduce(((r,i)=>t[i]?ci(r,t[i](e)):r),{});return r.propTypes="production"!==process.env.NODE_ENV?e.reduce(((e,t)=>Object.assign(e,t.propTypes)),{}):{},r.filterProps=e.reduce(((e,t)=>e.concat(t.filterProps)),[]),r}function ki(e){return"number"!=typeof e?e:`${e}px solid`}function Oi(e,t){return gi({prop:e,themeKey:"borders",transform:t})}Pi.propTypes="production"!==process.env.NODE_ENV?wi.reduce(((e,t)=>(e[t]=li,e)),{}):{},Pi.filterProps=wi,Ri.propTypes="production"!==process.env.NODE_ENV?Ti.reduce(((e,t)=>(e[t]=li,e)),{}):{},Ri.filterProps=Ti,"production"===process.env.NODE_ENV||Si.reduce(((e,t)=>(e[t]=li,e)),{});const Li=Oi("border",ki),Bi=Oi("borderTop",ki),Fi=Oi("borderRight",ki),Ni=Oi("borderBottom",ki),Vi=Oi("borderLeft",ki),ji=Oi("borderColor"),Ui=Oi("borderTopColor"),$i=Oi("borderRightColor"),Gi=Oi("borderBottomColor"),qi=Oi("borderLeftColor"),Hi=Oi("outline",ki),Wi=Oi("outlineColor"),Zi=e=>{if(void 0!==e.borderRadius&&null!==e.borderRadius){const t=Ei(e.theme,"shape.borderRadius",4,"borderRadius"),r=e=>({borderRadius:Ai(t,e)});return pi(e,e.borderRadius,r)}return null};Zi.propTypes="production"!==process.env.NODE_ENV?{borderRadius:li}:{},Zi.filterProps=["borderRadius"],Di(Li,Bi,Fi,Ni,Vi,ji,Ui,$i,Gi,qi,Zi,Hi,Wi);const Xi=e=>{if(void 0!==e.gap&&null!==e.gap){const t=Ei(e.theme,"spacing",8,"gap"),r=e=>({gap:Ai(t,e)});return pi(e,e.gap,r)}return null};Xi.propTypes="production"!==process.env.NODE_ENV?{gap:li}:{},Xi.filterProps=["gap"];const Yi=e=>{if(void 0!==e.columnGap&&null!==e.columnGap){const t=Ei(e.theme,"spacing",8,"columnGap"),r=e=>({columnGap:Ai(t,e)});return pi(e,e.columnGap,r)}return null};Yi.propTypes="production"!==process.env.NODE_ENV?{columnGap:li}:{},Yi.filterProps=["columnGap"];const Ji=e=>{if(void 0!==e.rowGap&&null!==e.rowGap){const t=Ei(e.theme,"spacing",8,"rowGap"),r=e=>({rowGap:Ai(t,e)});return pi(e,e.rowGap,r)}return null};Ji.propTypes="production"!==process.env.NODE_ENV?{rowGap:li}:{},Ji.filterProps=["rowGap"];function Ki(e,t){return"grey"===t?t:e}Di(Xi,Yi,Ji,gi({prop:"gridColumn"}),gi({prop:"gridRow"}),gi({prop:"gridAutoFlow"}),gi({prop:"gridAutoColumns"}),gi({prop:"gridAutoRows"}),gi({prop:"gridTemplateColumns"}),gi({prop:"gridTemplateRows"}),gi({prop:"gridTemplateAreas"}),gi({prop:"gridArea"}));function Qi(e){return e<=1&&0!==e?100*e+"%":e}Di(gi({prop:"color",themeKey:"palette",transform:Ki}),gi({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:Ki}),gi({prop:"backgroundColor",themeKey:"palette",transform:Ki}));const en=gi({prop:"width",transform:Qi}),tn=e=>{if(void 0!==e.maxWidth&&null!==e.maxWidth){const t=t=>{const r=e.theme?.breakpoints?.values?.[t]||ui[t];return r?"px"!==e.theme?.breakpoints?.unit?{maxWidth:`${r}${e.theme.breakpoints.unit}`}:{maxWidth:r}:{maxWidth:Qi(t)}};return pi(e,e.maxWidth,t)}return null};tn.filterProps=["maxWidth"];const rn=gi({prop:"minWidth",transform:Qi}),nn=gi({prop:"height",transform:Qi}),on=gi({prop:"maxHeight",transform:Qi}),sn=gi({prop:"minHeight",transform:Qi});gi({prop:"size",cssProperty:"width",transform:Qi}),gi({prop:"size",cssProperty:"height",transform:Qi});Di(en,tn,rn,nn,on,sn,gi({prop:"boxSizing"}));const an={border:{themeKey:"borders",transform:ki},borderTop:{themeKey:"borders",transform:ki},borderRight:{themeKey:"borders",transform:ki},borderBottom:{themeKey:"borders",transform:ki},borderLeft:{themeKey:"borders",transform:ki},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:ki},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:Zi},color:{themeKey:"palette",transform:Ki},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:Ki},backgroundColor:{themeKey:"palette",transform:Ki},p:{style:Ri},pt:{style:Ri},pr:{style:Ri},pb:{style:Ri},pl:{style:Ri},px:{style:Ri},py:{style:Ri},padding:{style:Ri},paddingTop:{style:Ri},paddingRight:{style:Ri},paddingBottom:{style:Ri},paddingLeft:{style:Ri},paddingX:{style:Ri},paddingY:{style:Ri},paddingInline:{style:Ri},paddingInlineStart:{style:Ri},paddingInlineEnd:{style:Ri},paddingBlock:{style:Ri},paddingBlockStart:{style:Ri},paddingBlockEnd:{style:Ri},m:{style:Pi},mt:{style:Pi},mr:{style:Pi},mb:{style:Pi},ml:{style:Pi},mx:{style:Pi},my:{style:Pi},margin:{style:Pi},marginTop:{style:Pi},marginRight:{style:Pi},marginBottom:{style:Pi},marginLeft:{style:Pi},marginX:{style:Pi},marginY:{style:Pi},marginInline:{style:Pi},marginInlineStart:{style:Pi},marginInlineEnd:{style:Pi},marginBlock:{style:Pi},marginBlockStart:{style:Pi},marginBlockEnd:{style:Pi},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:Xi},rowGap:{style:Ji},columnGap:{style:Yi},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:Qi},maxWidth:{style:tn},minWidth:{transform:Qi},height:{transform:Qi},maxHeight:{transform:Qi},minHeight:{transform:Qi},boxSizing:{},font:{themeKey:"font"},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};const ln=function(){function e(e,t,r,i){const n={[e]:t,theme:r},o=i[e];if(!o)return{[e]:t};const{cssProperty:s=e,themeKey:a,transform:l,style:c}=o;if(null==t)return null;if("typography"===a&&"inherit"===t)return{[e]:t};const u=mi(r,a)||{};if(c)return c(n);return pi(n,t,(t=>{let r=_i(u,l,t);return t===r&&"string"==typeof t&&(r=_i(u,l,`${e}${"default"===t?"":fi(t)}`,t)),!1===s?r:{[s]:r}}))}return function t(r){const{sx:i,theme:n={}}=r||{};if(!i)return null;const o=n.unstable_sxConfig??an;function s(r){let i=r;if("function"==typeof r)i=r(n);else if("object"!=typeof r)return r;if(!i)return null;const s=function(e={}){const t=e.keys?.reduce(((t,r)=>(t[e.up(r)]={},t)),{});return t||{}}(n.breakpoints),a=Object.keys(s);let l=s;return Object.keys(i).forEach((r=>{const s=function(e,t){return"function"==typeof e?e(t):e}(i[r],n);if(null!=s)if("object"==typeof s)if(o[r])l=ci(l,e(r,s,n,o));else{const e=pi({theme:n},s,(e=>({[r]:e})));!function(...e){const t=e.reduce(((e,t)=>e.concat(Object.keys(t))),[]),r=new Set(t);return e.every((e=>r.size===Object.keys(e).length))}(e,s)?l=ci(l,e):l[r]=t({sx:s,theme:n})}else l=ci(l,e(r,s,n,o))})),function(e,t){if(!e.containerQueries)return t;const r=Object.keys(t).filter((e=>e.startsWith("@container"))).sort(((e,t)=>{const r=/min-width:\s*([0-9.]+)/;return+(e.match(r)?.[1]||0)-+(t.match(r)?.[1]||0)}));return r.length?r.reduce(((e,r)=>{const i=t[r];return delete e[r],e[r]=i,e}),{...t}):t}(n,function(e,t){return e.reduce(((e,t)=>{const r=e[t];return(!r||0===Object.keys(r).length)&&delete e[t],e}),t)}(a,l))}return Array.isArray(i)?i.map(s):s(i)}}();function cn(e,t){const r=this;if(r.vars){if(!r.colorSchemes?.[e]||"function"!=typeof r.getColorSchemeSelector)return{};let i=r.getColorSchemeSelector(e);return"&"===i?t:((i.includes("data-")||i.includes("."))&&(i=`*:where(${i.replace(/\s*&$/,"")}) &`),{[i]:t})}return r.palette.mode===e?t:{}}function un(e={},...t){const{breakpoints:r={},palette:i={},spacing:n,shape:o={},...s}=e;let a=oi({breakpoints:si(r),direction:"ltr",components:{},palette:{mode:"light",...i},spacing:zi(n),shape:{...ai,...o}},s);return a=function(e){const t=(e,t)=>e.replace("@media",t?`@container ${t}`:"@container");function r(r,i){r.up=(...r)=>t(e.breakpoints.up(...r),i),r.down=(...r)=>t(e.breakpoints.down(...r),i),r.between=(...r)=>t(e.breakpoints.between(...r),i),r.only=(...r)=>t(e.breakpoints.only(...r),i),r.not=(...r)=>{const n=t(e.breakpoints.not(...r),i);return n.includes("not all and")?n.replace("not all and ","").replace("min-width:","width<").replace("max-width:","width>").replace("and","or"):n}}const i={},n=e=>(r(i,e),i);return r(n),{...e,containerQueries:n}}(a),a.applyStyles=cn,a=t.reduce(((e,t)=>oi(e,t)),a),a.unstable_sxConfig={...an,...s?.unstable_sxConfig},a.unstable_sx=function(e){return ln({sx:e,theme:this})},a}function hn(t=null){const r=e.useContext(mr);return r&&(i=r,0!==Object.keys(i).length)?r:t;var i}ln.filterProps=["sx"];const dn=un();function pn(e=dn){return hn(e)}function fn(e){const{sx:t,...r}=e,{systemProps:i,otherProps:n}=(e=>{const t={systemProps:{},otherProps:{}},r=e?.theme?.unstable_sxConfig??an;return Object.keys(e).forEach((i=>{r[i]?t.systemProps[i]=e[i]:t.otherProps[i]=e[i]})),t})(r);let o;return o=Array.isArray(t)?[i,...t]:"function"==typeof t?(...e)=>{const r=t(...e);return ii(r)?{...i,...r}:i}:{...i,...t},{...n,sx:o}}const mn=e=>e,_n=(()=>{let e=mn;return{configure(t){e=t},generate:t=>e(t),reset(){e=mn}}})();function gn(e){var t,r,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(r=gn(e[t]))&&(i&&(i+=" "),i+=r)}else for(r in e)e[r]&&(i&&(i+=" "),i+=r);return i}function yn(){for(var e,t,r=0,i="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=gn(e))&&(i&&(i+=" "),i+=t);return i}const xn={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function vn(e,t,r="Mui"){const i=xn[t];return i?`${r}-${i}`:`${_n.generate(e)}-${t}`}function bn(e,t,r="Mui"){const i={};return t.forEach((t=>{i[t]=vn(e,t,r)})),i}var wn,Tn={exports:{}},Sn={};var En,Mn,An={};
|
|
41
|
+
/**
|
|
42
|
+
* @license React
|
|
43
|
+
* react-is.development.js
|
|
44
|
+
*
|
|
45
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
46
|
+
*
|
|
47
|
+
* This source code is licensed under the MIT license found in the
|
|
48
|
+
* LICENSE file in the root directory of this source tree.
|
|
49
|
+
*/var Cn=(Mn||(Mn=1,"production"===process.env.NODE_ENV?Tn.exports=function(){if(wn)return Sn;wn=1;var e,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),a=Symbol.for("react.context"),l=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen");function m(e){if("object"==typeof e&&null!==e){var f=e.$$typeof;switch(f){case t:switch(e=e.type){case i:case o:case n:case u:case h:return e;default:switch(e=e&&e.$$typeof){case l:case a:case c:case p:case d:case s:return e;default:return f}}case r:return f}}}return e=Symbol.for("react.module.reference"),Sn.ContextConsumer=a,Sn.ContextProvider=s,Sn.Element=t,Sn.ForwardRef=c,Sn.Fragment=i,Sn.Lazy=p,Sn.Memo=d,Sn.Portal=r,Sn.Profiler=o,Sn.StrictMode=n,Sn.Suspense=u,Sn.SuspenseList=h,Sn.isAsyncMode=function(){return!1},Sn.isConcurrentMode=function(){return!1},Sn.isContextConsumer=function(e){return m(e)===a},Sn.isContextProvider=function(e){return m(e)===s},Sn.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},Sn.isForwardRef=function(e){return m(e)===c},Sn.isFragment=function(e){return m(e)===i},Sn.isLazy=function(e){return m(e)===p},Sn.isMemo=function(e){return m(e)===d},Sn.isPortal=function(e){return m(e)===r},Sn.isProfiler=function(e){return m(e)===o},Sn.isStrictMode=function(e){return m(e)===n},Sn.isSuspense=function(e){return m(e)===u},Sn.isSuspenseList=function(e){return m(e)===h},Sn.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===i||t===o||t===n||t===u||t===h||t===f||"object"==typeof t&&null!==t&&(t.$$typeof===p||t.$$typeof===d||t.$$typeof===s||t.$$typeof===a||t.$$typeof===c||t.$$typeof===e||void 0!==t.getModuleId)},Sn.typeOf=m,Sn}():Tn.exports=(En||(En=1,"production"!==process.env.NODE_ENV&&function(){var e,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),a=Symbol.for("react.context"),l=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen");function m(e){if("object"==typeof e&&null!==e){var f=e.$$typeof;switch(f){case t:var m=e.type;switch(m){case i:case o:case n:case u:case h:return m;default:var _=m&&m.$$typeof;switch(_){case l:case a:case c:case p:case d:case s:return _;default:return f}}case r:return f}}}e=Symbol.for("react.module.reference");var _=a,g=s,y=t,x=c,v=i,b=p,w=d,T=r,S=o,E=n,M=u,A=h,C=!1,I=!1;An.ContextConsumer=_,An.ContextProvider=g,An.Element=y,An.ForwardRef=x,An.Fragment=v,An.Lazy=b,An.Memo=w,An.Portal=T,An.Profiler=S,An.StrictMode=E,An.Suspense=M,An.SuspenseList=A,An.isAsyncMode=function(e){return C||(C=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},An.isConcurrentMode=function(e){return I||(I=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},An.isContextConsumer=function(e){return m(e)===a},An.isContextProvider=function(e){return m(e)===s},An.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},An.isForwardRef=function(e){return m(e)===c},An.isFragment=function(e){return m(e)===i},An.isLazy=function(e){return m(e)===p},An.isMemo=function(e){return m(e)===d},An.isPortal=function(e){return m(e)===r},An.isProfiler=function(e){return m(e)===o},An.isStrictMode=function(e){return m(e)===n},An.isSuspense=function(e){return m(e)===u},An.isSuspenseList=function(e){return m(e)===h},An.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===i||t===o||t===n||t===u||t===h||t===f||"object"==typeof t&&null!==t&&(t.$$typeof===p||t.$$typeof===d||t.$$typeof===s||t.$$typeof===a||t.$$typeof===c||t.$$typeof===e||void 0!==t.getModuleId)},An.typeOf=m}()),An)),Tn.exports);function In(e,t=""){return e.displayName||e.name||t}function Pn(e,t,r){const i=In(t);return e.displayName||(""!==i?`${r}(${i})`:r)}function Rn(e){const{variants:t,...r}=e,i={variants:t,style:ri(r),isProcessed:!0};return i.style===r||t&&t.forEach((e=>{"function"!=typeof e.style&&(e.style=ri(e.style))})),i}const zn=un();function Dn(e){return"ownerState"!==e&&"theme"!==e&&"sx"!==e&&"as"!==e}function kn(e){return e?(t,r)=>r[e]:null}function On(e,t){const r="function"==typeof t?t(e):t;if(Array.isArray(r))return r.flatMap((t=>On(e,t)));if(Array.isArray(r?.variants)){let t;if(r.isProcessed)t=r.style;else{const{variants:e,...i}=r;t=i}return Ln(e,r.variants,[t])}return r?.isProcessed?r.style:r}function Ln(e,t,r=[]){let i;e:for(let n=0;n<t.length;n+=1){const o=t[n];if("function"==typeof o.props){if(i??={...e,...e.ownerState,ownerState:e.ownerState},!o.props(i))continue}else for(const t in o.props)if(e[t]!==o.props[t]&&e.ownerState?.[t]!==o.props[t])continue e;"function"==typeof o.style?(i??={...e,...e.ownerState,ownerState:e.ownerState},r.push(o.style(i))):r.push(o.style)}return r}function Bn(e,t){let r;return"production"!==process.env.NODE_ENV&&e&&(r=`${e}-${Fn(t||"Root")}`),r}function Fn(e){return e?e.charAt(0).toLowerCase()+e.slice(1):e}function Nn(e,t){const r={...t};for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=i;if("components"===n||"slots"===n)r[n]={...e[n],...r[n]};else if("componentsProps"===n||"slotProps"===n){const i=e[n],o=t[n];if(o)if(i){r[n]={...o};for(const e in i)if(Object.prototype.hasOwnProperty.call(i,e)){const t=e;r[n][t]=Nn(i[t],o[t])}}else r[n]=o;else r[n]=i||{}}else void 0===r[n]&&(r[n]=e[n])}return r}const Vn="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;function jn(e,t=0,r=1){return"production"!==process.env.NODE_ENV&&(e<t||e>r)&&console.error(`MUI: The value provided ${e} is out of range [${t}, ${r}].`),function(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,r))}(e,t,r)}function Un(e){if(e.type)return e;if("#"===e.charAt(0))return Un(function(e){e=e.slice(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let r=e.match(t);return r&&1===r[0].length&&(r=r.map((e=>e+e))),r?`rgb${4===r.length?"a":""}(${r.map(((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", ")})`:""}(e));const t=e.indexOf("("),r=e.substring(0,t);if(!["rgb","rgba","hsl","hsla","color"].includes(r))throw new Error("production"!==process.env.NODE_ENV?`MUI: Unsupported \`${e}\` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().`:Ae(9,e));let i,n=e.substring(t+1,e.length-1);if("color"===r){if(n=n.split(" "),i=n.shift(),4===n.length&&"/"===n[3].charAt(0)&&(n[3]=n[3].slice(1)),!["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].includes(i))throw new Error("production"!==process.env.NODE_ENV?`MUI: unsupported \`${i}\` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.`:Ae(10,i))}else n=n.split(",");return n=n.map((e=>parseFloat(e))),{type:r,values:n,colorSpace:i}}const $n=(e,t)=>{try{return(e=>{const t=Un(e);return t.values.slice(0,3).map(((e,r)=>t.type.includes("hsl")&&0!==r?`${e}%`:e)).join(" ")})(e)}catch(r){return t&&"production"!==process.env.NODE_ENV&&console.warn(t),e}};function Gn(e){const{type:t,colorSpace:r}=e;let{values:i}=e;return t.includes("rgb")?i=i.map(((e,t)=>t<3?parseInt(e,10):e)):t.includes("hsl")&&(i[1]=`${i[1]}%`,i[2]=`${i[2]}%`),i=t.includes("color")?`${r} ${i.join(" ")}`:`${i.join(", ")}`,`${t}(${i})`}function qn(e){e=Un(e);const{values:t}=e,r=t[0],i=t[1]/100,n=t[2]/100,o=i*Math.min(n,1-n),s=(e,t=(e+r/30)%12)=>n-o*Math.max(Math.min(t-3,9-t,1),-1);let a="rgb";const l=[Math.round(255*s(0)),Math.round(255*s(8)),Math.round(255*s(4))];return"hsla"===e.type&&(a+="a",l.push(t[3])),Gn({type:a,values:l})}function Hn(e){let t="hsl"===(e=Un(e)).type||"hsla"===e.type?Un(qn(e)).values:e.values;return t=t.map((t=>("color"!==e.type&&(t/=255),t<=.03928?t/12.92:((t+.055)/1.055)**2.4))),Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function Wn(e,t){const r=Hn(e),i=Hn(t);return(Math.max(r,i)+.05)/(Math.min(r,i)+.05)}function Zn(e,t){return e=Un(e),t=jn(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,Gn(e)}function Xn(e,t,r){try{return Zn(e,t)}catch(t){return e}}function Yn(e,t){if(e=Un(e),t=jn(t),e.type.includes("hsl"))e.values[2]*=1-t;else if(e.type.includes("rgb")||e.type.includes("color"))for(let r=0;r<3;r+=1)e.values[r]*=1-t;return Gn(e)}function Jn(e,t,r){try{return Yn(e,t)}catch(t){return e}}function Kn(e,t){if(e=Un(e),t=jn(t),e.type.includes("hsl"))e.values[2]+=(100-e.values[2])*t;else if(e.type.includes("rgb"))for(let r=0;r<3;r+=1)e.values[r]+=(255-e.values[r])*t;else if(e.type.includes("color"))for(let r=0;r<3;r+=1)e.values[r]+=(1-e.values[r])*t;return Gn(e)}function Qn(e,t,r){try{return Kn(e,t)}catch(t){return e}}function eo(e,t,r){try{return function(e,t=.15){return Hn(e)>.5?Yn(e,t):Kn(e,t)}(e,t)}catch(t){return e}}function to(e,t){return"production"===process.env.NODE_ENV?()=>null:function(...r){return e(...r)||t(...r)}}function ro(e,t,r,i,n){const o=e[t],s=n||t;if(null==o||"undefined"==typeof window)return null;let a;const l=o.type;return"function"!=typeof l||function(e){const{prototype:t={}}=e;return Boolean(t.isReactComponent)}(l)||(a="Did you accidentally use a plain function component for an element instead?"),void 0!==a?new Error(`Invalid ${i} \`${s}\` supplied to \`${r}\`. Expected an element that can hold a ref. ${a} For more information see https://mui.com/r/caveat-with-refs-guide`):null}const io=to(Qr.element,ro);io.isRequired=to(Qr.element.isRequired,ro);var no=to(Qr.elementType,(function(e,t,r,i,n){const o=e[t],s=n||t;if(null==o||"undefined"==typeof window)return null;let a;return"function"!=typeof o||function(e){const{prototype:t={}}=e;return Boolean(t.isReactComponent)}(o)||(a="Did you accidentally provide a plain function component instead?"),void 0!==a?new Error(`Invalid ${i} \`${s}\` supplied to \`${r}\`. Expected an element type that can hold a ref. ${a} For more information see https://mui.com/r/caveat-with-refs-guide`):null}));const oo="exact-prop: ";function so(e,t,r,i,n){if("production"===process.env.NODE_ENV)return null;const o=e[t],s=n||t;return null==o?null:o&&1!==o.nodeType?new Error(`Invalid ${i} \`${s}\` supplied to \`${r}\`. Expected an HTMLElement.`):null}const ao=Qr.oneOfType([Qr.func,Qr.object]);function lo(e){return e&&e.ownerDocument||document}function co(e,t){"function"==typeof e?e(t):e&&(e.current=t)}let uo=0;const ho={...e}.useId;function po(t){if(void 0!==ho){const e=ho();return t??e}return function(t){const[r,i]=e.useState(t),n=t||r;return e.useEffect((()=>{null==r&&(uo+=1,i(`mui-${uo}`))}),[r]),n}(t)}function fo(t){const r=e.useRef(t);return Vn((()=>{r.current=t})),e.useRef(((...e)=>(0,r.current)(...e))).current}function mo(...t){return e.useMemo((()=>t.every((e=>null==e))?null:e=>{t.forEach((t=>{co(t,e)}))}),t)}const _o={};function go(t,r){const i=e.useRef(_o);return i.current===_o&&(i.current=t(r)),i}const yo=[];class xo{static create(){return new xo}currentId=null;start(e,t){this.clear(),this.currentId=setTimeout((()=>{this.currentId=null,t()}),e)}clear=()=>{null!==this.currentId&&(clearTimeout(this.currentId),this.currentId=null)};disposeEffect=()=>this.clear}function vo(){const t=go(xo.create).current;var r;return r=t.disposeEffect,e.useEffect(r,yo),t}function bo(e){try{return e.matches(":focus-visible")}catch(e){"production"===process.env.NODE_ENV||/jsdom/.test(window.navigator.userAgent)||console.warn(["MUI: The `:focus-visible` pseudo class is not supported in this browser.","Some components rely on this feature to work properly."].join("\n"))}return!1}function wo(e,t,r,i){const n=e[t];if(null==n||!Number.isInteger(n)){const e=function(e){const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":Number.isFinite(e)?e!==Math.floor(e)?"float":"number":"Infinity";case"object":return null===e?"null":e.constructor.name;default:return t}}(n);return new RangeError(`Invalid ${i} \`${t}\` of type \`${e}\` supplied to \`${r}\`, expected \`integer\`.`)}return null}function To(e,t,...r){return void 0===e[t]?null:wo(e,t,...r)}function So(){return null}To.isRequired=wo,So.isRequired=So;var Eo="production"===process.env.NODE_ENV?So:To;function Mo(e,t,r=void 0){const i={};for(const n in e){const o=e[n];let s="",a=!0;for(let e=0;e<o.length;e+=1){const i=o[e];i&&(s+=(!0===a?"":" ")+t(i),a=!1,r&&r[i]&&(s+=" "+r[i]))}i[n]=s}return i}function Ao(e,t,r){return void 0===e||"string"==typeof e?t:{...t,ownerState:{...t.ownerState,...r}}}function Co(e){if(void 0===e)return{};const t={};return Object.keys(e).filter((t=>!(t.match(/^on[A-Z]/)&&"function"==typeof e[t]))).forEach((r=>{t[r]=e[r]})),t}function Io(e){const{getSlotProps:t,additionalProps:r,externalSlotProps:i,externalForwardedProps:n,className:o}=e;if(!t){const e=yn(r?.className,o,n?.className,i?.className),t={...r?.style,...n?.style,...i?.style},s={...r,...n,...i};return e.length>0&&(s.className=e),Object.keys(t).length>0&&(s.style=t),{props:s,internalRef:void 0}}const s=function(e,t=[]){if(void 0===e)return{};const r={};return Object.keys(e).filter((r=>r.match(/^on[A-Z]/)&&"function"==typeof e[r]&&!t.includes(r))).forEach((t=>{r[t]=e[t]})),r}({...n,...i}),a=Co(i),l=Co(n),c=t(s),u=yn(c?.className,r?.className,o,n?.className,i?.className),h={...c?.style,...r?.style,...n?.style,...i?.style},d={...c,...r,...l,...a};return u.length>0&&(d.className=u),Object.keys(h).length>0&&(d.style=h),{props:d,internalRef:c.ref}}function Po(t){return parseInt(e.version,10)>=19?t?.props?.ref||null:t?.ref||null}const Ro=e.createContext();"production"!==process.env.NODE_ENV&&(Qr.node,Qr.bool);const zo=()=>e.useContext(Ro)??!1,Do=e.createContext(void 0);function ko({props:t,name:r}){return function(e){const{theme:t,name:r,props:i}=e;if(!t||!t.components||!t.components[r])return i;const n=t.components[r];return n.defaultProps?Nn(n.defaultProps,i):n.styleOverrides||n.variants?i:Nn(n,i)}({props:t,name:r,theme:{components:e.useContext(Do)}})}"production"!==process.env.NODE_ENV&&(Qr.node,Qr.object);const Oo={theme:void 0};function Lo(e=""){function t(...r){if(!r.length)return"";const i=r[0];return"string"!=typeof i||i.match(/(#|\(|\)|(-?(\d*\.)?\d+)(px|em|%|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc))|^(-?(\d*\.)?\d+)$|(\d+ \d+ \d+)/)?`, ${i}`:`, var(--${e?`${e}-`:""}${i}${t(...r.slice(1))})`}return(r,...i)=>`var(--${e?`${e}-`:""}${r}${t(...i)})`}const Bo=(e,t,r,i=[])=>{let n=e;t.forEach(((e,o)=>{o===t.length-1?Array.isArray(n)?n[Number(e)]=r:n&&"object"==typeof n&&(n[e]=r):n&&"object"==typeof n&&(n[e]||(n[e]=i.includes(e)?[]:{}),n=n[e])}))};function Fo(e,t){const{prefix:r,shouldSkipGeneratingVar:i}=t||{},n={},o={},s={};var a,l;return a=(e,t,a)=>{if(!("string"!=typeof t&&"number"!=typeof t||i&&i(e,t))){const i=`--${r?`${r}-`:""}${e.join("-")}`,l=((e,t)=>"number"==typeof t?["lineHeight","fontWeight","opacity","zIndex"].some((t=>e.includes(t)))||e[e.length-1].toLowerCase().includes("opacity")?t:`${t}px`:t)(e,t);Object.assign(n,{[i]:l}),Bo(o,e,`var(${i})`,a),Bo(s,e,`var(${i}, ${l})`,a)}},l=e=>"vars"===e[0],function e(t,r=[],i=[]){Object.entries(t).forEach((([t,n])=>{(!l||l&&!l([...r,t]))&&null!=n&&("object"==typeof n&&Object.keys(n).length>0?e(n,[...r,t],Array.isArray(n)?[...i,t]:i):a([...r,t],n,i))}))}(e),{css:n,vars:o,varsWithDefaults:s}}function No(){return{text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:W.white,default:W.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}}}const Vo=No();function jo(){return{text:{primary:W.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:W.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}}}const Uo=jo();function $o(e,t,r,i){const n=i.light||i,o=i.dark||1.5*i;e[t]||(e.hasOwnProperty(r)?e[t]=e[r]:"light"===t?e.light=Kn(e.main,n):"dark"===t&&(e.dark=Yn(e.main,o)))}function Go(e){const{mode:t="light",contrastThreshold:r=3,tonalOffset:i=.2,...n}=e,o=e.primary||function(e="light"){return"dark"===e?{main:se,light:oe,dark:ae}:{main:le,light:ae,dark:ce}}(t),s=e.secondary||function(e="light"){return"dark"===e?{main:ee,light:Q,dark:re}:{main:ie,light:te,dark:ne}}(t),a=e.error||function(e="light"){return"dark"===e?{main:Y,light:Z,dark:J}:{main:J,light:X,dark:K}}(t),l=e.info||function(e="light"){return"dark"===e?{main:he,light:ue,dark:pe}:{main:pe,light:de,dark:fe}}(t),c=e.success||function(e="light"){return"dark"===e?{main:_e,light:me,dark:ye}:{main:xe,light:ge,dark:ve}}(t),u=e.warning||function(e="light"){return"dark"===e?{main:we,light:be,dark:Se}:{main:"#ed6c02",light:Te,dark:Ee}}(t);function h(e){const t=Wn(e,Uo.text.primary)>=r?Uo.text.primary:Vo.text.primary;if("production"!==process.env.NODE_ENV){const r=Wn(e,t);r<3&&console.error([`MUI: The contrast ratio of ${r}:1 for ${t} on ${e}`,"falls below the WCAG recommended absolute minimum contrast ratio of 3:1.","https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast"].join("\n"))}return t}const d=({color:e,name:t,mainShade:r=500,lightShade:n=300,darkShade:o=700})=>{if(!(e={...e}).main&&e[r]&&(e.main=e[r]),!e.hasOwnProperty("main"))throw new Error("production"!==process.env.NODE_ENV?`MUI: The color${t?` (${t})`:""} provided to augmentColor(color) is invalid.\nThe color object needs to have a \`main\` property or a \`${r}\` property.`:Ae(11,t?` (${t})`:"",r));if("string"!=typeof e.main)throw new Error("production"!==process.env.NODE_ENV?`MUI: The color${t?` (${t})`:""} provided to augmentColor(color) is invalid.\n\`color.main\` should be a string, but \`${JSON.stringify(e.main)}\` was provided instead.\n\nDid you intend to use one of the following approaches?\n\nimport { green } from "@mui/material/colors";\n\nconst theme1 = createTheme({ palette: {\n primary: green,\n} });\n\nconst theme2 = createTheme({ palette: {\n primary: { main: green[500] },\n} });`:Ae(12,t?` (${t})`:"",JSON.stringify(e.main)));return $o(e,"light",n,i),$o(e,"dark",o,i),e.contrastText||(e.contrastText=h(e.main)),e};let p;"light"===t?p=No():"dark"===t&&(p=jo()),"production"!==process.env.NODE_ENV&&(p||console.error(`MUI: The palette mode \`${t}\` is not supported.`));return oi({common:{...W},mode:t,primary:d({color:o,name:"primary"}),secondary:d({color:s,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:d({color:a,name:"error"}),warning:d({color:u,name:"warning"}),info:d({color:l,name:"info"}),success:d({color:c,name:"success"}),grey:Me,contrastThreshold:r,getContrastText:h,augmentColor:d,tonalOffset:i,...p},n)}function qo(e){const t={};return Object.entries(e).forEach((e=>{const[r,i]=e;"object"==typeof i&&(t[r]=`${i.fontStyle?`${i.fontStyle} `:""}${i.fontVariant?`${i.fontVariant} `:""}${i.fontWeight?`${i.fontWeight} `:""}${i.fontStretch?`${i.fontStretch} `:""}${i.fontSize||""}${i.lineHeight?`/${i.lineHeight} `:""}${i.fontFamily||""}`)})),t}const Ho={textTransform:"uppercase"},Wo='"Roboto", "Helvetica", "Arial", sans-serif';function Zo(e,t){const{fontFamily:r=Wo,fontSize:i=14,fontWeightLight:n=300,fontWeightRegular:o=400,fontWeightMedium:s=500,fontWeightBold:a=700,htmlFontSize:l=16,allVariants:c,pxToRem:u,...h}="function"==typeof t?t(e):t;"production"!==process.env.NODE_ENV&&("number"!=typeof i&&console.error("MUI: `fontSize` is required to be a number."),"number"!=typeof l&&console.error("MUI: `htmlFontSize` is required to be a number."));const d=i/14,p=u||(e=>e/l*d+"rem"),f=(e,t,i,n,o)=>{return{fontFamily:r,fontWeight:e,fontSize:p(t),lineHeight:i,...r===Wo?{letterSpacing:(s=n/t,Math.round(1e5*s)/1e5)+"em"}:{},...o,...c};var s},m={h1:f(n,96,1.167,-1.5),h2:f(n,60,1.2,-.5),h3:f(o,48,1.167,0),h4:f(o,34,1.235,.25),h5:f(o,24,1.334,0),h6:f(s,20,1.6,.15),subtitle1:f(o,16,1.75,.15),subtitle2:f(s,14,1.57,.1),body1:f(o,16,1.5,.15),body2:f(o,14,1.43,.15),button:f(s,14,1.75,.4,Ho),caption:f(o,12,1.66,.4),overline:f(o,12,2.66,1,Ho),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return oi({htmlFontSize:l,pxToRem:p,fontFamily:r,fontSize:i,fontWeightLight:n,fontWeightRegular:o,fontWeightMedium:s,fontWeightBold:a,...m},h,{clone:!1})}function Xo(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,0.2)`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,0.14)`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,0.12)`].join(",")}const Yo=["none",Xo(0,2,1,-1,0,1,1,0,0,1,3,0),Xo(0,3,1,-2,0,2,2,0,0,1,5,0),Xo(0,3,3,-2,0,3,4,0,0,1,8,0),Xo(0,2,4,-1,0,4,5,0,0,1,10,0),Xo(0,3,5,-1,0,5,8,0,0,1,14,0),Xo(0,3,5,-1,0,6,10,0,0,1,18,0),Xo(0,4,5,-2,0,7,10,1,0,2,16,1),Xo(0,5,5,-3,0,8,10,1,0,3,14,2),Xo(0,5,6,-3,0,9,12,1,0,3,16,2),Xo(0,6,6,-3,0,10,14,1,0,4,18,3),Xo(0,6,7,-4,0,11,15,1,0,4,20,3),Xo(0,7,8,-4,0,12,17,2,0,5,22,4),Xo(0,7,8,-4,0,13,19,2,0,5,24,4),Xo(0,7,9,-4,0,14,21,2,0,5,26,4),Xo(0,8,9,-5,0,15,22,2,0,6,28,5),Xo(0,8,10,-5,0,16,24,2,0,6,30,5),Xo(0,8,11,-5,0,17,26,2,0,6,32,5),Xo(0,9,11,-5,0,18,28,2,0,7,34,6),Xo(0,9,12,-6,0,19,29,2,0,7,36,6),Xo(0,10,13,-6,0,20,31,3,0,8,38,7),Xo(0,10,13,-6,0,21,33,3,0,8,40,7),Xo(0,10,14,-6,0,22,35,3,0,8,42,7),Xo(0,11,14,-7,0,23,36,3,0,9,44,8),Xo(0,11,15,-7,0,24,38,3,0,9,46,8)],Jo={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},Ko={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function Qo(e){return`${Math.round(e)}ms`}function es(e){if(!e)return 0;const t=e/36;return Math.min(Math.round(10*(4+15*t**.25+t/5)),3e3)}function ts(e){const t={...Jo,...e.easing},r={...Ko,...e.duration};return{getAutoHeightDuration:es,create:(e=["all"],i={})=>{const{duration:n=r.standard,easing:o=t.easeInOut,delay:s=0,...a}=i;if("production"!==process.env.NODE_ENV){const t=e=>"string"==typeof e,r=e=>!Number.isNaN(parseFloat(e));t(e)||Array.isArray(e)||console.error('MUI: Argument "props" must be a string or Array.'),r(n)||t(n)||console.error(`MUI: Argument "duration" must be a number or a string but found ${n}.`),t(o)||console.error('MUI: Argument "easing" must be a string.'),r(s)||t(s)||console.error('MUI: Argument "delay" must be a number or a string.'),"object"!=typeof i&&console.error(["MUI: Secong argument of transition.create must be an object.","Arguments should be either `create('prop1', options)` or `create(['prop1', 'prop2'], options)`"].join("\n")),0!==Object.keys(a).length&&console.error(`MUI: Unrecognized argument(s) [${Object.keys(a).join(",")}].`)}return(Array.isArray(e)?e:[e]).map((e=>`${e} ${"string"==typeof n?n:Qo(n)} ${o} ${"string"==typeof s?s:Qo(s)}`)).join(",")},...e,easing:t,duration:r}}const rs={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function is(e={}){const t={...e};return function e(t){const r=Object.entries(t);for(let n=0;n<r.length;n++){const[o,s]=r[n];!ii(i=s)&&void 0!==i&&"string"!=typeof i&&"boolean"!=typeof i&&"number"!=typeof i&&!Array.isArray(i)||o.startsWith("unstable_")?delete t[o]:ii(s)&&(t[o]={...s},e(t[o]))}var i}(t),`import { unstable_createBreakpoints as createBreakpoints, createTransitions } from '@mui/material/styles';\n\nconst theme = ${JSON.stringify(t,null,2)};\n\ntheme.breakpoints = createBreakpoints(theme.breakpoints || {});\ntheme.transitions = createTransitions(theme.transitions || {});\n\nexport default theme;`}function ns(e={},...t){const{breakpoints:r,mixins:i={},spacing:n,palette:o={},transitions:s={},typography:a={},shape:l,...c}=e;if(e.vars)throw new Error("production"!==process.env.NODE_ENV?"MUI: `vars` is a private field used for CSS variables support.\nPlease use another name.":Ae(20));const u=Go(o),h=un(e);let d=oi(h,{mixins:(p=h.breakpoints,f=i,{toolbar:{minHeight:56,[p.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[p.up("sm")]:{minHeight:64}},...f}),palette:u,shadows:Yo.slice(),typography:Zo(u,a),transitions:ts(s),zIndex:{...rs}});var p,f;if(d=oi(d,c),d=t.reduce(((e,t)=>oi(e,t)),d),"production"!==process.env.NODE_ENV){const e=["active","checked","completed","disabled","error","expanded","focused","focusVisible","required","selected"],t=(t,r)=>{let i;for(i in t){const n=t[i];if(e.includes(i)&&Object.keys(n).length>0){if("production"!==process.env.NODE_ENV){const e=vn("",i);console.error([`MUI: The \`${r}\` component increases the CSS specificity of the \`${i}\` internal state.`,"You can not override it like this: ",JSON.stringify(t,null,2),"",`Instead, you need to use the '&.${e}' syntax:`,JSON.stringify({root:{[`&.${e}`]:n}},null,2),"","https://mui.com/r/state-classes-guide"].join("\n"))}t[i]={}}}};Object.keys(d.components).forEach((e=>{const r=d.components[e].styleOverrides;r&&e.startsWith("Mui")&&t(r,e)}))}return d.unstable_sxConfig={...an,...c?.unstable_sxConfig},d.unstable_sx=function(e){return ln({sx:e,theme:this})},d.toRuntimeSource=is,d}function os(e){let t;return t=e<1?5.11916*e**2:4.5*Math.log(e+1)+2,Math.round(10*t)/1e3}const ss=[...Array(25)].map(((e,t)=>{if(0===t)return"none";const r=os(t);return`linear-gradient(rgba(255 255 255 / ${r}), rgba(255 255 255 / ${r}))`}));function as(e){return{inputPlaceholder:"dark"===e?.5:.42,inputUnderline:"dark"===e?.7:.42,switchTrackDisabled:"dark"===e?.2:.12,switchTrack:"dark"===e?.3:.38}}function ls(e){return"dark"===e?ss:[]}function cs(e){return!!e[0].match(/(cssVarPrefix|colorSchemeSelector|rootSelector|typography|mixins|breakpoints|direction|transitions)/)||!!e[0].match(/sxConfig$/)||"palette"===e[0]&&!!e[1]?.match(/(mode|contrastThreshold|tonalOffset)/)}var us=e=>(t,r)=>{const i=e.rootSelector||":root",n=e.colorSchemeSelector;let o=n;if("class"===n&&(o=".%s"),"data"===n&&(o="[data-%s]"),n?.startsWith("data-")&&!n.includes("%s")&&(o=`[${n}="%s"]`),e.defaultColorScheme===t){if("dark"===t){const n={};return(s=e.cssVarPrefix,[...[...Array(25)].map(((e,t)=>`--${s?`${s}-`:""}overlays-${t}`)),`--${s?`${s}-`:""}palette-AppBar-darkBg`,`--${s?`${s}-`:""}palette-AppBar-darkColor`]).forEach((e=>{n[e]=r[e],delete r[e]})),"media"===o?{[i]:r,"@media (prefers-color-scheme: dark)":{[i]:n}}:o?{[o.replace("%s",t)]:n,[`${i}, ${o.replace("%s",t)}`]:r}:{[i]:{...r,...n}}}if(o&&"media"!==o)return`${i}, ${o.replace("%s",String(t))}`}else if(t){if("media"===o)return{[`@media (prefers-color-scheme: ${String(t)})`]:{[i]:r}};if(o)return o.replace("%s",String(t))}var s;return i};function hs(e,t,r){!e[t]&&r&&(e[t]=r)}function ds(e){return e&&e.startsWith("hsl")?qn(e):e}function ps(e,t){`${t}Channel`in e||(e[`${t}Channel`]=$n(ds(e[t]),`MUI: Can't create \`palette.${t}Channel\` because \`palette.${t}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().\nTo suppress this warning, you need to explicitly provide the \`palette.${t}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}const fs=e=>{try{return e()}catch(e){}};function ms(e,t,r,i){if(!t)return;t=!0===t?{}:t;const n="dark"===i?"dark":"light";if(!r)return void(e[i]=function(e){const{palette:t={mode:"light"},opacity:r,overlays:i,...n}=e,o=Go(t);return{palette:o,opacity:{...as(o.mode),...r},overlays:i||ls(o.mode),...n}}({...t,palette:{mode:n,...t?.palette}}));const{palette:o,...s}=ns({...r,palette:{mode:n,...t?.palette}});return e[i]={...t,palette:o,opacity:{...as(n),...t?.opacity},overlays:t?.overlays||ls(n)},s}function _s(e={},...t){const{colorSchemes:r={light:!0},defaultColorScheme:i,disableCssColorScheme:n=!1,cssVarPrefix:o="mui",shouldSkipGeneratingVar:s=cs,colorSchemeSelector:a=(r.light&&r.dark?"media":void 0),rootSelector:l=":root",...c}=e,u=Object.keys(r)[0],h=i||(r.light&&"light"!==u?"light":u),d=((e="mui")=>Lo(e))(o),{[h]:p,light:f,dark:m,..._}=r,g={..._};let y=p;if(("dark"===h&&!("dark"in r)||"light"===h&&!("light"in r))&&(y=!0),!y)throw new Error("production"!==process.env.NODE_ENV?`MUI: The \`colorSchemes.${h}\` option is either missing or invalid.`:Ae(21,h));const x=ms(g,y,c,h);f&&!g.light&&ms(g,f,void 0,"light"),m&&!g.dark&&ms(g,m,void 0,"dark");let v={defaultColorScheme:h,...x,cssVarPrefix:o,colorSchemeSelector:a,rootSelector:l,getCssVar:d,colorSchemes:g,font:{...qo(x.typography),...x.font},spacing:(b=c.spacing,"number"==typeof b?`${b}px`:"string"==typeof b||"function"==typeof b||Array.isArray(b)?b:"8px")};var b;Object.keys(v.colorSchemes).forEach((e=>{const t=v.colorSchemes[e].palette,r=e=>{const r=e.split("-"),i=r[1],n=r[2];return d(e,t[i][n])};var i;if("light"===t.mode&&(hs(t.common,"background","#fff"),hs(t.common,"onBackground","#000")),"dark"===t.mode&&(hs(t.common,"background","#000"),hs(t.common,"onBackground","#fff")),i=t,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"].forEach((e=>{i[e]||(i[e]={})})),"light"===t.mode){hs(t.Alert,"errorColor",Jn(t.error.light,.6)),hs(t.Alert,"infoColor",Jn(t.info.light,.6)),hs(t.Alert,"successColor",Jn(t.success.light,.6)),hs(t.Alert,"warningColor",Jn(t.warning.light,.6)),hs(t.Alert,"errorFilledBg",r("palette-error-main")),hs(t.Alert,"infoFilledBg",r("palette-info-main")),hs(t.Alert,"successFilledBg",r("palette-success-main")),hs(t.Alert,"warningFilledBg",r("palette-warning-main")),hs(t.Alert,"errorFilledColor",fs((()=>t.getContrastText(t.error.main)))),hs(t.Alert,"infoFilledColor",fs((()=>t.getContrastText(t.info.main)))),hs(t.Alert,"successFilledColor",fs((()=>t.getContrastText(t.success.main)))),hs(t.Alert,"warningFilledColor",fs((()=>t.getContrastText(t.warning.main)))),hs(t.Alert,"errorStandardBg",Qn(t.error.light,.9)),hs(t.Alert,"infoStandardBg",Qn(t.info.light,.9)),hs(t.Alert,"successStandardBg",Qn(t.success.light,.9)),hs(t.Alert,"warningStandardBg",Qn(t.warning.light,.9)),hs(t.Alert,"errorIconColor",r("palette-error-main")),hs(t.Alert,"infoIconColor",r("palette-info-main")),hs(t.Alert,"successIconColor",r("palette-success-main")),hs(t.Alert,"warningIconColor",r("palette-warning-main")),hs(t.AppBar,"defaultBg",r("palette-grey-100")),hs(t.Avatar,"defaultBg",r("palette-grey-400")),hs(t.Button,"inheritContainedBg",r("palette-grey-300")),hs(t.Button,"inheritContainedHoverBg",r("palette-grey-A100")),hs(t.Chip,"defaultBorder",r("palette-grey-400")),hs(t.Chip,"defaultAvatarColor",r("palette-grey-700")),hs(t.Chip,"defaultIconColor",r("palette-grey-700")),hs(t.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),hs(t.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),hs(t.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),hs(t.LinearProgress,"primaryBg",Qn(t.primary.main,.62)),hs(t.LinearProgress,"secondaryBg",Qn(t.secondary.main,.62)),hs(t.LinearProgress,"errorBg",Qn(t.error.main,.62)),hs(t.LinearProgress,"infoBg",Qn(t.info.main,.62)),hs(t.LinearProgress,"successBg",Qn(t.success.main,.62)),hs(t.LinearProgress,"warningBg",Qn(t.warning.main,.62)),hs(t.Skeleton,"bg",`rgba(${r("palette-text-primaryChannel")} / 0.11)`),hs(t.Slider,"primaryTrack",Qn(t.primary.main,.62)),hs(t.Slider,"secondaryTrack",Qn(t.secondary.main,.62)),hs(t.Slider,"errorTrack",Qn(t.error.main,.62)),hs(t.Slider,"infoTrack",Qn(t.info.main,.62)),hs(t.Slider,"successTrack",Qn(t.success.main,.62)),hs(t.Slider,"warningTrack",Qn(t.warning.main,.62));const e=eo(t.background.default,.8);hs(t.SnackbarContent,"bg",e),hs(t.SnackbarContent,"color",fs((()=>t.getContrastText(e)))),hs(t.SpeedDialAction,"fabHoverBg",eo(t.background.paper,.15)),hs(t.StepConnector,"border",r("palette-grey-400")),hs(t.StepContent,"border",r("palette-grey-400")),hs(t.Switch,"defaultColor",r("palette-common-white")),hs(t.Switch,"defaultDisabledColor",r("palette-grey-100")),hs(t.Switch,"primaryDisabledColor",Qn(t.primary.main,.62)),hs(t.Switch,"secondaryDisabledColor",Qn(t.secondary.main,.62)),hs(t.Switch,"errorDisabledColor",Qn(t.error.main,.62)),hs(t.Switch,"infoDisabledColor",Qn(t.info.main,.62)),hs(t.Switch,"successDisabledColor",Qn(t.success.main,.62)),hs(t.Switch,"warningDisabledColor",Qn(t.warning.main,.62)),hs(t.TableCell,"border",Qn(Xn(t.divider,1),.88)),hs(t.Tooltip,"bg",Xn(t.grey[700],.92))}if("dark"===t.mode){hs(t.Alert,"errorColor",Qn(t.error.light,.6)),hs(t.Alert,"infoColor",Qn(t.info.light,.6)),hs(t.Alert,"successColor",Qn(t.success.light,.6)),hs(t.Alert,"warningColor",Qn(t.warning.light,.6)),hs(t.Alert,"errorFilledBg",r("palette-error-dark")),hs(t.Alert,"infoFilledBg",r("palette-info-dark")),hs(t.Alert,"successFilledBg",r("palette-success-dark")),hs(t.Alert,"warningFilledBg",r("palette-warning-dark")),hs(t.Alert,"errorFilledColor",fs((()=>t.getContrastText(t.error.dark)))),hs(t.Alert,"infoFilledColor",fs((()=>t.getContrastText(t.info.dark)))),hs(t.Alert,"successFilledColor",fs((()=>t.getContrastText(t.success.dark)))),hs(t.Alert,"warningFilledColor",fs((()=>t.getContrastText(t.warning.dark)))),hs(t.Alert,"errorStandardBg",Jn(t.error.light,.9)),hs(t.Alert,"infoStandardBg",Jn(t.info.light,.9)),hs(t.Alert,"successStandardBg",Jn(t.success.light,.9)),hs(t.Alert,"warningStandardBg",Jn(t.warning.light,.9)),hs(t.Alert,"errorIconColor",r("palette-error-main")),hs(t.Alert,"infoIconColor",r("palette-info-main")),hs(t.Alert,"successIconColor",r("palette-success-main")),hs(t.Alert,"warningIconColor",r("palette-warning-main")),hs(t.AppBar,"defaultBg",r("palette-grey-900")),hs(t.AppBar,"darkBg",r("palette-background-paper")),hs(t.AppBar,"darkColor",r("palette-text-primary")),hs(t.Avatar,"defaultBg",r("palette-grey-600")),hs(t.Button,"inheritContainedBg",r("palette-grey-800")),hs(t.Button,"inheritContainedHoverBg",r("palette-grey-700")),hs(t.Chip,"defaultBorder",r("palette-grey-700")),hs(t.Chip,"defaultAvatarColor",r("palette-grey-300")),hs(t.Chip,"defaultIconColor",r("palette-grey-300")),hs(t.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),hs(t.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),hs(t.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),hs(t.LinearProgress,"primaryBg",Jn(t.primary.main,.5)),hs(t.LinearProgress,"secondaryBg",Jn(t.secondary.main,.5)),hs(t.LinearProgress,"errorBg",Jn(t.error.main,.5)),hs(t.LinearProgress,"infoBg",Jn(t.info.main,.5)),hs(t.LinearProgress,"successBg",Jn(t.success.main,.5)),hs(t.LinearProgress,"warningBg",Jn(t.warning.main,.5)),hs(t.Skeleton,"bg",`rgba(${r("palette-text-primaryChannel")} / 0.13)`),hs(t.Slider,"primaryTrack",Jn(t.primary.main,.5)),hs(t.Slider,"secondaryTrack",Jn(t.secondary.main,.5)),hs(t.Slider,"errorTrack",Jn(t.error.main,.5)),hs(t.Slider,"infoTrack",Jn(t.info.main,.5)),hs(t.Slider,"successTrack",Jn(t.success.main,.5)),hs(t.Slider,"warningTrack",Jn(t.warning.main,.5));const e=eo(t.background.default,.98);hs(t.SnackbarContent,"bg",e),hs(t.SnackbarContent,"color",fs((()=>t.getContrastText(e)))),hs(t.SpeedDialAction,"fabHoverBg",eo(t.background.paper,.15)),hs(t.StepConnector,"border",r("palette-grey-600")),hs(t.StepContent,"border",r("palette-grey-600")),hs(t.Switch,"defaultColor",r("palette-grey-300")),hs(t.Switch,"defaultDisabledColor",r("palette-grey-600")),hs(t.Switch,"primaryDisabledColor",Jn(t.primary.main,.55)),hs(t.Switch,"secondaryDisabledColor",Jn(t.secondary.main,.55)),hs(t.Switch,"errorDisabledColor",Jn(t.error.main,.55)),hs(t.Switch,"infoDisabledColor",Jn(t.info.main,.55)),hs(t.Switch,"successDisabledColor",Jn(t.success.main,.55)),hs(t.Switch,"warningDisabledColor",Jn(t.warning.main,.55)),hs(t.TableCell,"border",Jn(Xn(t.divider,1),.68)),hs(t.Tooltip,"bg",Xn(t.grey[700],.92))}ps(t.background,"default"),ps(t.background,"paper"),ps(t.common,"background"),ps(t.common,"onBackground"),ps(t,"divider"),Object.keys(t).forEach((e=>{const r=t[e];r&&"object"==typeof r&&(r.main&&hs(t[e],"mainChannel",$n(ds(r.main))),r.light&&hs(t[e],"lightChannel",$n(ds(r.light))),r.dark&&hs(t[e],"darkChannel",$n(ds(r.dark))),r.contrastText&&hs(t[e],"contrastTextChannel",$n(ds(r.contrastText))),"text"===e&&(ps(t[e],"primary"),ps(t[e],"secondary")),"action"===e&&(r.active&&ps(t[e],"active"),r.selected&&ps(t[e],"selected")))}))})),v=t.reduce(((e,t)=>oi(e,t)),v);const w={prefix:o,disableCssColorScheme:n,shouldSkipGeneratingVar:s,getSelector:us(v)},{vars:T,generateThemeVars:S,generateStyleSheets:E}=function(e,t={}){const{getSelector:r=_,disableCssColorScheme:i,colorSchemeSelector:n}=t,{colorSchemes:o={},components:s,defaultColorScheme:a="light",...l}=e,{vars:c,css:u,varsWithDefaults:h}=Fo(l,t);let d=h;const p={},{[a]:f,...m}=o;if(Object.entries(m||{}).forEach((([e,r])=>{const{vars:i,css:n,varsWithDefaults:o}=Fo(r,t);d=oi(d,o),p[e]={css:n,vars:i}})),f){const{css:e,vars:r,varsWithDefaults:i}=Fo(f,t);d=oi(d,i),p[a]={css:e,vars:r}}function _(t,r){let i=n;if("class"===n&&(i=".%s"),"data"===n&&(i="[data-%s]"),n?.startsWith("data-")&&!n.includes("%s")&&(i=`[${n}="%s"]`),t){if("media"===i){if(e.defaultColorScheme===t)return":root";const i=o[t]?.palette?.mode||t;return{[`@media (prefers-color-scheme: ${i})`]:{":root":r}}}if(i)return e.defaultColorScheme===t?`:root, ${i.replace("%s",String(t))}`:i.replace("%s",String(t))}return":root"}return{vars:d,generateThemeVars:()=>{let e={...c};return Object.entries(p).forEach((([,{vars:t}])=>{e=oi(e,t)})),e},generateStyleSheets:()=>{const t=[],n=e.defaultColorScheme||"light";function s(e,r){Object.keys(r).length&&t.push("string"==typeof e?{[e]:{...r}}:e)}s(r(void 0,{...u}),u);const{[n]:a,...l}=p;if(a){const{css:e}=a,t=o[n]?.palette?.mode,l=!i&&t?{colorScheme:t,...e}:{...e};s(r(n,{...l}),l)}return Object.entries(l).forEach((([e,{css:t}])=>{const n=o[e]?.palette?.mode,a=!i&&n?{colorScheme:n,...t}:{...t};s(r(e,{...a}),a)})),t}}}(v,w);return v.vars=T,Object.entries(v.colorSchemes[v.defaultColorScheme]).forEach((([e,t])=>{v[e]=t})),v.generateThemeVars=S,v.generateStyleSheets=E,v.generateSpacing=function(){return zi(c.spacing,Mi(this))},v.getColorSchemeSelector=function(e){return function(t){return"media"===e?("production"!==process.env.NODE_ENV&&"light"!==t&&"dark"!==t&&console.error(`MUI: @media (prefers-color-scheme) supports only 'light' or 'dark', but receive '${t}'.`),`@media (prefers-color-scheme: ${t})`):e?e.startsWith("data-")&&!e.includes("%s")?`[${e}="${t}"] &`:"class"===e?`.${t} &`:"data"===e?`[data-${t}] &`:`${e.replace("%s",t)} &`:"&"}}(a),v.spacing=v.generateSpacing(),v.shouldSkipGeneratingVar=s,v.unstable_sxConfig={...an,...c?.unstable_sxConfig},v.unstable_sx=function(e){return ln({sx:e,theme:this})},v.toRuntimeSource=is,v}function gs(e,t,r){e.colorSchemes&&r&&(e.colorSchemes[t]={...!0!==r&&r,palette:Go({...!0===r?{}:r.palette,mode:t})})}function ys(e={},...t){const{palette:r,cssVariables:i=!1,colorSchemes:n=(r?void 0:{light:!0}),defaultColorScheme:o=r?.mode,...s}=e,a=o||"light",l=n?.[a],c={...n,...r?{[a]:{..."boolean"!=typeof l&&l,palette:r}}:void 0};if(!1===i){if(!("colorSchemes"in e))return ns(e,...t);let i=r;"palette"in e||c[a]&&(!0!==c[a]?i=c[a].palette:"dark"===a&&(i={mode:"dark"}));const n=ns({...e,palette:i},...t);return n.defaultColorScheme=a,n.colorSchemes=c,"light"===n.palette.mode&&(n.colorSchemes.light={...!0!==c.light&&c.light,palette:n.palette},gs(n,"dark",c.dark)),"dark"===n.palette.mode&&(n.colorSchemes.dark={...!0!==c.dark&&c.dark,palette:n.palette},gs(n,"light",c.light)),n}return r||"light"in c||"light"!==a||(c.light=!0),_s({...s,colorSchemes:c,defaultColorScheme:a,..."boolean"!=typeof i&&i},...t)}const xs=ys();function vs(){const t=pn(xs);return"production"!==process.env.NODE_ENV&&e.useDebugValue(t),t[Ce]||t}const bs=function(e={}){const{themeId:t,defaultTheme:r=zn,rootShouldForwardProp:i=Dn,slotShouldForwardProp:n=Dn}=e;function o(e){!function(e,t,r){e.theme=function(e){for(const t in e)return!1;return!0}(e.theme)?r:e.theme[t]||e.theme}(e,t,r)}return(e,t={})=>{!function(e,t){Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))}(e,(e=>e.filter((e=>e!==ln))));const{name:r,slot:s,skipVariantsResolver:a,skipSx:l,overridesResolver:c=kn(Fn(s)),...u}=t,h=void 0!==a?a:s&&"Root"!==s&&"root"!==s||!1,d=l||!1;let p=Dn;"Root"===s||"root"===s?p=i:s?p=n:function(e){return"string"==typeof e&&e.charCodeAt(0)>96}(e)&&(p=void 0);const f=ei(e,{shouldForwardProp:p,label:Bn(r,s),...u}),m=e=>{if("function"==typeof e&&e.__emotion_real!==e)return function(t){return On(t,e)};if(ii(e)){const t=Rn(e);return t.variants?function(e){return On(e,t)}:t.style}return e},_=(...t)=>{const i=[],n=t.map(m),a=[];if(i.push(o),r&&c&&a.push((function(e){const t=e.theme,i=t.components?.[r]?.styleOverrides;if(!i)return null;const n={};for(const t in i)n[t]=On(e,i[t]);return c(e,n)})),r&&!h&&a.push((function(e){const t=e.theme,i=t?.components?.[r]?.variants;return i?Ln(e,i):null})),d||a.push(ln),Array.isArray(n[0])){const e=n.shift(),t=new Array(i.length).fill(""),r=new Array(a.length).fill("");let o;o=[...t,...e,...r],o.raw=[...t,...e.raw,...r],i.unshift(o)}const l=[...i,...n,...a],u=f(...l);return e.muiName&&(u.muiName=e.muiName),"production"!==process.env.NODE_ENV&&(u.displayName=function(e,t,r){if(e)return`${e}${fi(t||"")}`;return`Styled(${function(e){if(null!=e){if("string"==typeof e)return e;if("function"==typeof e)return In(e,"Component");if("object"==typeof e)switch(e.$$typeof){case Cn.ForwardRef:return Pn(e,e.render,"ForwardRef");case Cn.Memo:return Pn(e,e.type,"memo");default:return}}}(r)})`}(r,s,e)),u};return f.withConfig&&(_.withConfig=f.withConfig),_}}({themeId:Ce,defaultTheme:xs,rootShouldForwardProp:e=>function(e){return"ownerState"!==e&&"theme"!==e&&"sx"!==e&&"as"!==e}(e)&&"classes"!==e});const ws=function(e){let t,r;return function(i){let n=t;return void 0!==n&&i.theme===r||(Oo.theme=i.theme,n=Rn(e(Oo)),t=n,r=i.theme),n}};function Ts(e){return ko(e)}"production"!==process.env.NODE_ENV&&(Qr.node,Qr.object.isRequired);var Ss,Es={exports:{}},Ms={};var As,Cs,Is={};
|
|
50
|
+
/**
|
|
51
|
+
* @license React
|
|
52
|
+
* react-is.development.js
|
|
53
|
+
*
|
|
54
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
55
|
+
*
|
|
56
|
+
* This source code is licensed under the MIT license found in the
|
|
57
|
+
* LICENSE file in the root directory of this source tree.
|
|
58
|
+
*/var Ps=(Cs||(Cs=1,"production"===process.env.NODE_ENV?Es.exports=function(){if(Ss)return Ms;Ss=1;var e,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),a=Symbol.for("react.context"),l=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen");function m(e){if("object"==typeof e&&null!==e){var f=e.$$typeof;switch(f){case t:switch(e=e.type){case i:case o:case n:case u:case h:return e;default:switch(e=e&&e.$$typeof){case l:case a:case c:case p:case d:case s:return e;default:return f}}case r:return f}}}return e=Symbol.for("react.module.reference"),Ms.ContextConsumer=a,Ms.ContextProvider=s,Ms.Element=t,Ms.ForwardRef=c,Ms.Fragment=i,Ms.Lazy=p,Ms.Memo=d,Ms.Portal=r,Ms.Profiler=o,Ms.StrictMode=n,Ms.Suspense=u,Ms.SuspenseList=h,Ms.isAsyncMode=function(){return!1},Ms.isConcurrentMode=function(){return!1},Ms.isContextConsumer=function(e){return m(e)===a},Ms.isContextProvider=function(e){return m(e)===s},Ms.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},Ms.isForwardRef=function(e){return m(e)===c},Ms.isFragment=function(e){return m(e)===i},Ms.isLazy=function(e){return m(e)===p},Ms.isMemo=function(e){return m(e)===d},Ms.isPortal=function(e){return m(e)===r},Ms.isProfiler=function(e){return m(e)===o},Ms.isStrictMode=function(e){return m(e)===n},Ms.isSuspense=function(e){return m(e)===u},Ms.isSuspenseList=function(e){return m(e)===h},Ms.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===i||t===o||t===n||t===u||t===h||t===f||"object"==typeof t&&null!==t&&(t.$$typeof===p||t.$$typeof===d||t.$$typeof===s||t.$$typeof===a||t.$$typeof===c||t.$$typeof===e||void 0!==t.getModuleId)},Ms.typeOf=m,Ms}():Es.exports=(As||(As=1,"production"!==process.env.NODE_ENV&&function(){var e,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),a=Symbol.for("react.context"),l=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen");function m(e){if("object"==typeof e&&null!==e){var f=e.$$typeof;switch(f){case t:var m=e.type;switch(m){case i:case o:case n:case u:case h:return m;default:var _=m&&m.$$typeof;switch(_){case l:case a:case c:case p:case d:case s:return _;default:return f}}case r:return f}}}e=Symbol.for("react.module.reference");var _=a,g=s,y=t,x=c,v=i,b=p,w=d,T=r,S=o,E=n,M=u,A=h,C=!1,I=!1;Is.ContextConsumer=_,Is.ContextProvider=g,Is.Element=y,Is.ForwardRef=x,Is.Fragment=v,Is.Lazy=b,Is.Memo=w,Is.Portal=T,Is.Profiler=S,Is.StrictMode=E,Is.Suspense=M,Is.SuspenseList=A,Is.isAsyncMode=function(e){return C||(C=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},Is.isConcurrentMode=function(e){return I||(I=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},Is.isContextConsumer=function(e){return m(e)===a},Is.isContextProvider=function(e){return m(e)===s},Is.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},Is.isForwardRef=function(e){return m(e)===c},Is.isFragment=function(e){return m(e)===i},Is.isLazy=function(e){return m(e)===p},Is.isMemo=function(e){return m(e)===d},Is.isPortal=function(e){return m(e)===r},Is.isProfiler=function(e){return m(e)===o},Is.isStrictMode=function(e){return m(e)===n},Is.isSuspense=function(e){return m(e)===u},Is.isSuspenseList=function(e){return m(e)===h},Is.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===i||t===o||t===n||t===u||t===h||t===f||"object"==typeof t&&null!==t&&(t.$$typeof===p||t.$$typeof===d||t.$$typeof===s||t.$$typeof===a||t.$$typeof===c||t.$$typeof===e||void 0!==t.getModuleId)},Is.typeOf=m}()),Is)),Es.exports);function Rs(e,t){if(null==e)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.includes(i))continue;r[i]=e[i]}return r}function zs(e,t){return zs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},zs(e,t)}function Ds(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,zs(e,t)}var ks=!1,Os="production"!==process.env.NODE_ENV?Qr.oneOfType([Qr.number,Qr.shape({enter:Qr.number,exit:Qr.number,appear:Qr.number}).isRequired]):null;"production"!==process.env.NODE_ENV&&Qr.oneOfType([Qr.string,Qr.shape({enter:Qr.string,exit:Qr.string,active:Qr.string}),Qr.shape({enter:Qr.string,enterDone:Qr.string,enterActive:Qr.string,exit:Qr.string,exitDone:Qr.string,exitActive:Qr.string})]);var Ls=t.createContext(null),Bs="unmounted",Fs="exited",Ns="entering",Vs="entered",js="exiting",Us=function(e){function r(t,r){var i;i=e.call(this,t,r)||this;var n,o=r&&!r.isMounting?t.enter:t.appear;return i.appearStatus=null,t.in?o?(n=Fs,i.appearStatus=Ns):n=Vs:n=t.unmountOnExit||t.mountOnEnter?Bs:Fs,i.state={status:n},i.nextCallback=null,i}Ds(r,e),r.getDerivedStateFromProps=function(e,t){return e.in&&t.status===Bs?{status:Fs}:null};var i=r.prototype;return i.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},i.componentDidUpdate=function(e){var t=null;if(e!==this.props){var r=this.state.status;this.props.in?r!==Ns&&r!==Vs&&(t=Ns):r!==Ns&&r!==Vs||(t=js)}this.updateStatus(!1,t)},i.componentWillUnmount=function(){this.cancelNextCallback()},i.getTimeouts=function(){var e,t,r,i=this.props.timeout;return e=t=r=i,null!=i&&"number"!=typeof i&&(e=i.exit,t=i.enter,r=void 0!==i.appear?i.appear:t),{exit:e,enter:t,appear:r}},i.updateStatus=function(e,t){if(void 0===e&&(e=!1),null!==t)if(this.cancelNextCallback(),t===Ns){if(this.props.unmountOnExit||this.props.mountOnEnter){var r=this.props.nodeRef?this.props.nodeRef.current:d.findDOMNode(this);r&&function(e){e.scrollTop}(r)}this.performEnter(e)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Fs&&this.setState({status:Bs})},i.performEnter=function(e){var t=this,r=this.props.enter,i=this.context?this.context.isMounting:e,n=this.props.nodeRef?[i]:[d.findDOMNode(this),i],o=n[0],s=n[1],a=this.getTimeouts(),l=i?a.appear:a.enter;!e&&!r||ks?this.safeSetState({status:Vs},(function(){t.props.onEntered(o)})):(this.props.onEnter(o,s),this.safeSetState({status:Ns},(function(){t.props.onEntering(o,s),t.onTransitionEnd(l,(function(){t.safeSetState({status:Vs},(function(){t.props.onEntered(o,s)}))}))})))},i.performExit=function(){var e=this,t=this.props.exit,r=this.getTimeouts(),i=this.props.nodeRef?void 0:d.findDOMNode(this);t&&!ks?(this.props.onExit(i),this.safeSetState({status:js},(function(){e.props.onExiting(i),e.onTransitionEnd(r.exit,(function(){e.safeSetState({status:Fs},(function(){e.props.onExited(i)}))}))}))):this.safeSetState({status:Fs},(function(){e.props.onExited(i)}))},i.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},i.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},i.setNextCallback=function(e){var t=this,r=!0;return this.nextCallback=function(i){r&&(r=!1,t.nextCallback=null,e(i))},this.nextCallback.cancel=function(){r=!1},this.nextCallback},i.onTransitionEnd=function(e,t){this.setNextCallback(t);var r=this.props.nodeRef?this.props.nodeRef.current:d.findDOMNode(this),i=null==e&&!this.props.addEndListener;if(r&&!i){if(this.props.addEndListener){var n=this.props.nodeRef?[this.nextCallback]:[r,this.nextCallback],o=n[0],s=n[1];this.props.addEndListener(o,s)}null!=e&&setTimeout(this.nextCallback,e)}else setTimeout(this.nextCallback,0)},i.render=function(){var e=this.state.status;if(e===Bs)return null;var r=this.props,i=r.children;r.in,r.mountOnEnter,r.unmountOnExit,r.appear,r.enter,r.exit,r.timeout,r.addEndListener,r.onEnter,r.onEntering,r.onEntered,r.onExit,r.onExiting,r.onExited,r.nodeRef;var n=Rs(r,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return t.createElement(Ls.Provider,{value:null},"function"==typeof i?i(e,n):t.cloneElement(t.Children.only(i),n))},r}(t.Component);function $s(){}function Gs(e,t){var r=Object.create(null);return e&&n.map(e,(function(e){return e})).forEach((function(e){r[e.key]=function(e){return t&&o(e)?t(e):e}(e)})),r}function qs(e,t,r){return null!=r[t]?r[t]:e.props[t]}function Hs(e,t,r){var i=Gs(e.children),n=function(e,t){function r(r){return r in t?t[r]:e[r]}e=e||{},t=t||{};var i,n=Object.create(null),o=[];for(var s in e)s in t?o.length&&(n[s]=o,o=[]):o.push(s);var a={};for(var l in t){if(n[l])for(i=0;i<n[l].length;i++){var c=n[l][i];a[n[l][i]]=r(c)}a[l]=r(l)}for(i=0;i<o.length;i++)a[o[i]]=r(o[i]);return a}(t,i);return Object.keys(n).forEach((function(a){var l=n[a];if(o(l)){var c=a in t,u=a in i,h=t[a],d=o(h)&&!h.props.in;!u||c&&!d?u||!c||d?u&&c&&o(h)&&(n[a]=s(l,{onExited:r.bind(null,l),in:h.props.in,exit:qs(l,"exit",e),enter:qs(l,"enter",e)})):n[a]=s(l,{in:!1}):n[a]=s(l,{onExited:r.bind(null,l),in:!0,exit:qs(l,"exit",e),enter:qs(l,"enter",e)})}})),n}Us.contextType=Ls,Us.propTypes="production"!==process.env.NODE_ENV?{nodeRef:Qr.shape({current:"undefined"==typeof Element?Qr.any:function(e,t,r,i,n,o){var s=e[t];return Qr.instanceOf(s&&"ownerDocument"in s?s.ownerDocument.defaultView.Element:Element)(e,t,r,i,n,o)}}),children:Qr.oneOfType([Qr.func.isRequired,Qr.element.isRequired]).isRequired,in:Qr.bool,mountOnEnter:Qr.bool,unmountOnExit:Qr.bool,appear:Qr.bool,enter:Qr.bool,exit:Qr.bool,timeout:function(e){var t=Os;e.addEndListener||(t=t.isRequired);for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return t.apply(void 0,[e].concat(i))},addEndListener:Qr.func,onEnter:Qr.func,onEntering:Qr.func,onEntered:Qr.func,onExit:Qr.func,onExiting:Qr.func,onExited:Qr.func}:{},Us.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:$s,onEntering:$s,onEntered:$s,onExit:$s,onExiting:$s,onExited:$s},Us.UNMOUNTED=Bs,Us.EXITED=Fs,Us.ENTERING=Ns,Us.ENTERED=Vs,Us.EXITING=js;var Ws=Object.values||function(e){return Object.keys(e).map((function(t){return e[t]}))},Zs=function(e){function r(t,r){var i,n=(i=e.call(this,t,r)||this).handleExited.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(i));return i.state={contextValue:{isMounting:!0},handleExited:n,firstRender:!0},i}Ds(r,e);var i=r.prototype;return i.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},i.componentWillUnmount=function(){this.mounted=!1},r.getDerivedStateFromProps=function(e,t){var r,i,n=t.children,o=t.handleExited;return{children:t.firstRender?(r=e,i=o,Gs(r.children,(function(e){return s(e,{onExited:i.bind(null,e),in:!0,appear:qs(e,"appear",r),enter:qs(e,"enter",r),exit:qs(e,"exit",r)})}))):Hs(e,n,o),firstRender:!1}},i.handleExited=function(e,t){var r=Gs(this.props.children);e.key in r||(e.props.onExited&&e.props.onExited(t),this.mounted&&this.setState((function(t){var r=Ie({},t.children);return delete r[e.key],{children:r}})))},i.render=function(){var e=this.props,r=e.component,i=e.childFactory,n=Rs(e,["component","childFactory"]),o=this.state.contextValue,s=Ws(this.state.children).map(i);return delete n.appear,delete n.enter,delete n.exit,null===r?t.createElement(Ls.Provider,{value:o},s):t.createElement(Ls.Provider,{value:o},t.createElement(r,n,s))},r}(t.Component);Zs.propTypes="production"!==process.env.NODE_ENV?{component:Qr.any,children:Qr.node,appear:Qr.bool,enter:Qr.bool,exit:Qr.bool,childFactory:Qr.func}:{},Zs.defaultProps={component:"div",childFactory:function(e){return e}};function Xs(e,t){const{timeout:r,easing:i,style:n={}}=e;return{duration:n.transitionDuration??("number"==typeof r?r:r[t.mode]||0),easing:n.transitionTimingFunction??("object"==typeof i?i[t.mode]:i),delay:n.transitionDelay}}function Ys(e){return vn("MuiPaper",e)}bn("MuiPaper",["root","rounded","outlined","elevation","elevation0","elevation1","elevation2","elevation3","elevation4","elevation5","elevation6","elevation7","elevation8","elevation9","elevation10","elevation11","elevation12","elevation13","elevation14","elevation15","elevation16","elevation17","elevation18","elevation19","elevation20","elevation21","elevation22","elevation23","elevation24"]);const Js=bs("div",{name:"MuiPaper",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,t[r.variant],!r.square&&t.rounded,"elevation"===r.variant&&t[`elevation${r.elevation}`]]}})(ws((({theme:e})=>({backgroundColor:(e.vars||e).palette.background.paper,color:(e.vars||e).palette.text.primary,transition:e.transitions.create("box-shadow"),variants:[{props:({ownerState:e})=>!e.square,style:{borderRadius:e.shape.borderRadius}},{props:{variant:"outlined"},style:{border:`1px solid ${(e.vars||e).palette.divider}`}},{props:{variant:"elevation"},style:{boxShadow:"var(--Paper-shadow)",backgroundImage:"var(--Paper-overlay)"}}]})))),Ks=e.forwardRef((function(e,t){const r=Ts({props:e,name:"MuiPaper"}),i=vs(),{className:n,component:o="div",elevation:s=1,square:a=!1,variant:l="elevation",...c}=r,u={...r,component:o,elevation:s,square:a,variant:l},h=(e=>{const{square:t,elevation:r,variant:i,classes:n}=e;return Mo({root:["root",i,!t&&"rounded","elevation"===i&&`elevation${r}`]},Ys,n)})(u);return"production"!==process.env.NODE_ENV&&void 0===i.shadows[s]&&console.error([`MUI: The elevation provided <Paper elevation={${s}}> is not available in the theme.`,`Please make sure that \`theme.shadows[${s}]\` is defined.`].join("\n")),T.jsx(Js,{as:o,ownerState:u,className:yn(h.root,n),ref:t,...c,style:{..."elevation"===l&&{"--Paper-shadow":(i.vars||i).shadows[s],...i.vars&&{"--Paper-overlay":i.vars.overlays?.[s]},...!i.vars&&"dark"===i.palette.mode&&{"--Paper-overlay":`linear-gradient(${Zn("#fff",os(s))}, ${Zn("#fff",os(s))})`}},...c.style}})}));"production"!==process.env.NODE_ENV&&(Ks.propTypes={children:Qr.node,classes:Qr.object,className:Qr.string,component:Qr.elementType,elevation:to(Eo,(e=>{const{elevation:t,variant:r}=e;return t>0&&"outlined"===r?new Error(`MUI: Combining \`elevation={${t}}\` with \`variant="${r}"\` has no effect. Either use \`elevation={0}\` or use a different \`variant\`.`):null})),square:Qr.bool,style:Qr.object,sx:Qr.oneOfType([Qr.arrayOf(Qr.oneOfType([Qr.func,Qr.object,Qr.bool])),Qr.func,Qr.object]),variant:Qr.oneOfType([Qr.oneOf(["elevation","outlined"]),Qr.string])});class Qs{static create(){return new Qs}static use(){const t=go(Qs.create).current,[r,i]=e.useState(!1);return t.shouldMount=r,t.setShouldMount=i,e.useEffect(t.mountEffect,[r]),t}constructor(){this.ref={current:null},this.mounted=null,this.didMount=!1,this.shouldMount=!1,this.setShouldMount=null}mount(){return this.mounted||(this.mounted=function(){let e,t;const r=new Promise(((r,i)=>{e=r,t=i}));return r.resolve=e,r.reject=t,r}(),this.shouldMount=!0,this.setShouldMount(this.shouldMount)),this.mounted}mountEffect=()=>{this.shouldMount&&!this.didMount&&null!==this.ref.current&&(this.didMount=!0,this.mounted.resolve())};start(...e){this.mount().then((()=>this.ref.current?.start(...e)))}stop(...e){this.mount().then((()=>this.ref.current?.stop(...e)))}pulsate(...e){this.mount().then((()=>this.ref.current?.pulsate(...e)))}}function ea(t){const{className:r,classes:i,pulsate:n=!1,rippleX:o,rippleY:s,rippleSize:a,in:l,onExited:c,timeout:u}=t,[h,d]=e.useState(!1),p=yn(r,i.ripple,i.rippleVisible,n&&i.ripplePulsate),f={width:a,height:a,top:-a/2+s,left:-a/2+o},m=yn(i.child,h&&i.childLeaving,n&&i.childPulsate);return l||h||d(!0),e.useEffect((()=>{if(!l&&null!=c){const e=setTimeout(c,u);return()=>{clearTimeout(e)}}}),[c,l,u]),T.jsx("span",{className:p,style:f,children:T.jsx("span",{className:m})})}"production"!==process.env.NODE_ENV&&(ea.propTypes={classes:Qr.object.isRequired,className:Qr.string,in:Qr.bool,onExited:Qr.func,pulsate:Qr.bool,rippleSize:Qr.number,rippleX:Qr.number,rippleY:Qr.number,timeout:Qr.number.isRequired});const ta=bn("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),ra=gr`
|
|
59
|
+
0% {
|
|
60
|
+
transform: scale(0);
|
|
61
|
+
opacity: 0.1;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
100% {
|
|
65
|
+
transform: scale(1);
|
|
66
|
+
opacity: 0.3;
|
|
67
|
+
}
|
|
68
|
+
`,ia=gr`
|
|
69
|
+
0% {
|
|
70
|
+
opacity: 1;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
100% {
|
|
74
|
+
opacity: 0;
|
|
75
|
+
}
|
|
76
|
+
`,na=gr`
|
|
77
|
+
0% {
|
|
78
|
+
transform: scale(1);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
50% {
|
|
82
|
+
transform: scale(0.92);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
100% {
|
|
86
|
+
transform: scale(1);
|
|
87
|
+
}
|
|
88
|
+
`,oa=bs("span",{name:"MuiTouchRipple",slot:"Root"})({overflow:"hidden",pointerEvents:"none",position:"absolute",zIndex:0,top:0,right:0,bottom:0,left:0,borderRadius:"inherit"}),sa=bs(ea,{name:"MuiTouchRipple",slot:"Ripple"})`
|
|
89
|
+
opacity: 0;
|
|
90
|
+
position: absolute;
|
|
91
|
+
|
|
92
|
+
&.${ta.rippleVisible} {
|
|
93
|
+
opacity: 0.3;
|
|
94
|
+
transform: scale(1);
|
|
95
|
+
animation-name: ${ra};
|
|
96
|
+
animation-duration: ${550}ms;
|
|
97
|
+
animation-timing-function: ${({theme:e})=>e.transitions.easing.easeInOut};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&.${ta.ripplePulsate} {
|
|
101
|
+
animation-duration: ${({theme:e})=>e.transitions.duration.shorter}ms;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
& .${ta.child} {
|
|
105
|
+
opacity: 1;
|
|
106
|
+
display: block;
|
|
107
|
+
width: 100%;
|
|
108
|
+
height: 100%;
|
|
109
|
+
border-radius: 50%;
|
|
110
|
+
background-color: currentColor;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
& .${ta.childLeaving} {
|
|
114
|
+
opacity: 0;
|
|
115
|
+
animation-name: ${ia};
|
|
116
|
+
animation-duration: ${550}ms;
|
|
117
|
+
animation-timing-function: ${({theme:e})=>e.transitions.easing.easeInOut};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
& .${ta.childPulsate} {
|
|
121
|
+
position: absolute;
|
|
122
|
+
/* @noflip */
|
|
123
|
+
left: 0px;
|
|
124
|
+
top: 0;
|
|
125
|
+
animation-name: ${na};
|
|
126
|
+
animation-duration: 2500ms;
|
|
127
|
+
animation-timing-function: ${({theme:e})=>e.transitions.easing.easeInOut};
|
|
128
|
+
animation-iteration-count: infinite;
|
|
129
|
+
animation-delay: 200ms;
|
|
130
|
+
}
|
|
131
|
+
`,aa=e.forwardRef((function(t,r){const i=Ts({props:t,name:"MuiTouchRipple"}),{center:n=!1,classes:o={},className:s,...a}=i,[l,c]=e.useState([]),u=e.useRef(0),h=e.useRef(null);e.useEffect((()=>{h.current&&(h.current(),h.current=null)}),[l]);const d=e.useRef(!1),p=vo(),f=e.useRef(null),m=e.useRef(null),_=e.useCallback((e=>{const{pulsate:t,rippleX:r,rippleY:i,rippleSize:n,cb:s}=e;c((e=>[...e,T.jsx(sa,{classes:{ripple:yn(o.ripple,ta.ripple),rippleVisible:yn(o.rippleVisible,ta.rippleVisible),ripplePulsate:yn(o.ripplePulsate,ta.ripplePulsate),child:yn(o.child,ta.child),childLeaving:yn(o.childLeaving,ta.childLeaving),childPulsate:yn(o.childPulsate,ta.childPulsate)},timeout:550,pulsate:t,rippleX:r,rippleY:i,rippleSize:n},u.current)])),u.current+=1,h.current=s}),[o]),g=e.useCallback(((e={},t={},r=()=>{})=>{const{pulsate:i=!1,center:o=n||t.pulsate,fakeElement:s=!1}=t;if("mousedown"===e?.type&&d.current)return void(d.current=!1);"touchstart"===e?.type&&(d.current=!0);const a=s?null:m.current,l=a?a.getBoundingClientRect():{width:0,height:0,left:0,top:0};let c,u,h;if(o||void 0===e||0===e.clientX&&0===e.clientY||!e.clientX&&!e.touches)c=Math.round(l.width/2),u=Math.round(l.height/2);else{const{clientX:t,clientY:r}=e.touches&&e.touches.length>0?e.touches[0]:e;c=Math.round(t-l.left),u=Math.round(r-l.top)}if(o)h=Math.sqrt((2*l.width**2+l.height**2)/3),h%2==0&&(h+=1);else{const e=2*Math.max(Math.abs((a?a.clientWidth:0)-c),c)+2,t=2*Math.max(Math.abs((a?a.clientHeight:0)-u),u)+2;h=Math.sqrt(e**2+t**2)}e?.touches?null===f.current&&(f.current=()=>{_({pulsate:i,rippleX:c,rippleY:u,rippleSize:h,cb:r})},p.start(80,(()=>{f.current&&(f.current(),f.current=null)}))):_({pulsate:i,rippleX:c,rippleY:u,rippleSize:h,cb:r})}),[n,_,p]),y=e.useCallback((()=>{g({},{pulsate:!0})}),[g]),x=e.useCallback(((e,t)=>{if(p.clear(),"touchend"===e?.type&&f.current)return f.current(),f.current=null,void p.start(0,(()=>{x(e,t)}));f.current=null,c((e=>e.length>0?e.slice(1):e)),h.current=t}),[p]);return e.useImperativeHandle(r,(()=>({pulsate:y,start:g,stop:x})),[y,g,x]),T.jsx(oa,{className:yn(ta.root,o.root,s),ref:m,...a,children:T.jsx(Zs,{component:null,exit:!0,children:l})})}));function la(e){return vn("MuiButtonBase",e)}"production"!==process.env.NODE_ENV&&(aa.propTypes={center:Qr.bool,classes:Qr.object,className:Qr.string});const ca=bn("MuiButtonBase",["root","disabled","focusVisible"]),ua=bs("button",{name:"MuiButtonBase",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"inline-flex",alignItems:"center",justifyContent:"center",position:"relative",boxSizing:"border-box",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none",textDecoration:"none",color:"inherit","&::-moz-focus-inner":{borderStyle:"none"},[`&.${ca.disabled}`]:{pointerEvents:"none",cursor:"default"},"@media print":{colorAdjust:"exact"}}),ha=e.forwardRef((function(t,r){const i=Ts({props:t,name:"MuiButtonBase"}),{action:n,centerRipple:o=!1,children:s,className:a,component:l="button",disabled:c=!1,disableRipple:u=!1,disableTouchRipple:h=!1,focusRipple:d=!1,focusVisibleClassName:p,LinkComponent:f="a",onBlur:m,onClick:_,onContextMenu:g,onDragLeave:y,onFocus:x,onFocusVisible:v,onKeyDown:b,onKeyUp:w,onMouseDown:S,onMouseLeave:E,onMouseUp:M,onTouchEnd:A,onTouchMove:C,onTouchStart:I,tabIndex:P=0,TouchRippleProps:R,touchRippleRef:z,type:D,...k}=i,O=e.useRef(null),L=Qs.use(),B=mo(L.ref,z),[F,N]=e.useState(!1);c&&F&&N(!1),e.useImperativeHandle(n,(()=>({focusVisible:()=>{N(!0),O.current.focus()}})),[]);const V=L.shouldMount&&!u&&!c;function j(e,t,r=h){return fo((i=>{t&&t(i);return r||L[e](i),!0}))}e.useEffect((()=>{F&&d&&!u&&L.pulsate()}),[u,d,F,L]);const U=j("start",S),$=j("stop",g),G=j("stop",y),q=j("stop",M),H=j("stop",(e=>{F&&e.preventDefault(),E&&E(e)})),W=j("start",I),Z=j("stop",A),X=j("stop",C),Y=j("stop",(e=>{bo(e.target)||N(!1),m&&m(e)}),!1),J=fo((e=>{O.current||(O.current=e.currentTarget),bo(e.target)&&(N(!0),v&&v(e)),x&&x(e)})),K=()=>{const e=O.current;return l&&"button"!==l&&!("A"===e.tagName&&e.href)},Q=fo((e=>{d&&!e.repeat&&F&&" "===e.key&&L.stop(e,(()=>{L.start(e)})),e.target===e.currentTarget&&K()&&" "===e.key&&e.preventDefault(),b&&b(e),e.target===e.currentTarget&&K()&&"Enter"===e.key&&!c&&(e.preventDefault(),_&&_(e))})),ee=fo((e=>{d&&" "===e.key&&F&&!e.defaultPrevented&&L.stop(e,(()=>{L.pulsate(e)})),w&&w(e),_&&e.target===e.currentTarget&&K()&&" "===e.key&&!e.defaultPrevented&&_(e)}));let te=l;"button"===te&&(k.href||k.to)&&(te=f);const re={};"button"===te?(re.type=void 0===D?"button":D,re.disabled=c):(k.href||k.to||(re.role="button"),c&&(re["aria-disabled"]=c));const ie=mo(r,O),ne={...i,centerRipple:o,component:l,disabled:c,disableRipple:u,disableTouchRipple:h,focusRipple:d,tabIndex:P,focusVisible:F},oe=(e=>{const{disabled:t,focusVisible:r,focusVisibleClassName:i,classes:n}=e,o=Mo({root:["root",t&&"disabled",r&&"focusVisible"]},la,n);return r&&i&&(o.root+=` ${i}`),o})(ne);return T.jsxs(ua,{as:te,className:yn(oe.root,a),ownerState:ne,onBlur:Y,onClick:_,onContextMenu:$,onFocus:J,onKeyDown:Q,onKeyUp:ee,onMouseDown:U,onMouseLeave:H,onMouseUp:q,onDragLeave:G,onTouchEnd:Z,onTouchMove:X,onTouchStart:W,ref:ie,tabIndex:c?-1:P,type:D,...re,...k,children:[s,V?T.jsx(aa,{ref:B,center:o,...R}):null]})}));function da(e=[]){return([,t])=>t&&function(e,t=[]){if(!function(e){return"string"==typeof e.main}(e))return!1;for(const r of t)if(!e.hasOwnProperty(r)||"string"!=typeof e[r])return!1;return!0}(t,e)}function pa(e){return vn("MuiTypography",e)}"production"!==process.env.NODE_ENV&&(ha.propTypes={action:ao,centerRipple:Qr.bool,children:Qr.node,classes:Qr.object,className:Qr.string,component:no,disabled:Qr.bool,disableRipple:Qr.bool,disableTouchRipple:Qr.bool,focusRipple:Qr.bool,focusVisibleClassName:Qr.string,href:Qr.any,LinkComponent:Qr.elementType,onBlur:Qr.func,onClick:Qr.func,onContextMenu:Qr.func,onDragLeave:Qr.func,onFocus:Qr.func,onFocusVisible:Qr.func,onKeyDown:Qr.func,onKeyUp:Qr.func,onMouseDown:Qr.func,onMouseLeave:Qr.func,onMouseUp:Qr.func,onTouchEnd:Qr.func,onTouchMove:Qr.func,onTouchStart:Qr.func,sx:Qr.oneOfType([Qr.arrayOf(Qr.oneOfType([Qr.func,Qr.object,Qr.bool])),Qr.func,Qr.object]),tabIndex:Qr.number,TouchRippleProps:Qr.object,touchRippleRef:Qr.oneOfType([Qr.func,Qr.shape({current:Qr.shape({pulsate:Qr.func.isRequired,start:Qr.func.isRequired,stop:Qr.func.isRequired})})]),type:Qr.oneOfType([Qr.oneOf(["button","reset","submit"]),Qr.string])}),bn("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);const fa={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},ma=fn,_a=bs("span",{name:"MuiTypography",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,r.variant&&t[r.variant],"inherit"!==r.align&&t[`align${fi(r.align)}`],r.noWrap&&t.noWrap,r.gutterBottom&&t.gutterBottom,r.paragraph&&t.paragraph]}})(ws((({theme:e})=>({margin:0,variants:[{props:{variant:"inherit"},style:{font:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}},...Object.entries(e.typography).filter((([e,t])=>"inherit"!==e&&t&&"object"==typeof t)).map((([e,t])=>({props:{variant:e},style:t}))),...Object.entries(e.palette).filter(da()).map((([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}}))),...Object.entries(e.palette?.text||{}).filter((([,e])=>"string"==typeof e)).map((([t])=>({props:{color:`text${fi(t)}`},style:{color:(e.vars||e).palette.text[t]}}))),{props:({ownerState:e})=>"inherit"!==e.align,style:{textAlign:"var(--Typography-textAlign)"}},{props:({ownerState:e})=>e.noWrap,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{props:({ownerState:e})=>e.gutterBottom,style:{marginBottom:"0.35em"}},{props:({ownerState:e})=>e.paragraph,style:{marginBottom:16}}]})))),ga={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},ya=e.forwardRef((function(e,t){const{color:r,...i}=Ts({props:e,name:"MuiTypography"}),n=ma({...i,...!fa[r]&&{color:r}}),{align:o="inherit",className:s,component:a,gutterBottom:l=!1,noWrap:c=!1,paragraph:u=!1,variant:h="body1",variantMapping:d=ga,...p}=n,f={...n,align:o,color:r,className:s,component:a,gutterBottom:l,noWrap:c,paragraph:u,variant:h,variantMapping:d},m=a||(u?"p":d[h]||ga[h])||"span",_=(e=>{const{align:t,gutterBottom:r,noWrap:i,paragraph:n,variant:o,classes:s}=e;return Mo({root:["root",o,"inherit"!==e.align&&`align${fi(t)}`,r&&"gutterBottom",i&&"noWrap",n&&"paragraph"]},pa,s)})(f);return T.jsx(_a,{as:m,ref:t,className:yn(_.root,s),...p,ownerState:f,style:{..."inherit"!==o&&{"--Typography-textAlign":o},...p.style}})}));"production"!==process.env.NODE_ENV&&(ya.propTypes={align:Qr.oneOf(["center","inherit","justify","left","right"]),children:Qr.node,classes:Qr.object,className:Qr.string,color:Qr.oneOfType([Qr.oneOf(["primary","secondary","success","error","info","warning","textPrimary","textSecondary","textDisabled"]),Qr.string]),component:Qr.elementType,gutterBottom:Qr.bool,noWrap:Qr.bool,paragraph:Qr.bool,style:Qr.object,sx:Qr.oneOfType([Qr.arrayOf(Qr.oneOfType([Qr.func,Qr.object,Qr.bool])),Qr.func,Qr.object]),variant:Qr.oneOfType([Qr.oneOf(["body1","body2","button","caption","h1","h2","h3","h4","h5","h6","inherit","overline","subtitle1","subtitle2"]),Qr.string]),variantMapping:Qr.object});var xa="top",va="bottom",ba="right",wa="left",Ta="auto",Sa=[xa,va,ba,wa],Ea="start",Ma="end",Aa="viewport",Ca="popper",Ia=Sa.reduce((function(e,t){return e.concat([t+"-"+Ea,t+"-"+Ma])}),[]),Pa=[].concat(Sa,[Ta]).reduce((function(e,t){return e.concat([t,t+"-"+Ea,t+"-"+Ma])}),[]),Ra=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function za(e){return e?(e.nodeName||"").toLowerCase():null}function Da(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function ka(e){return e instanceof Da(e).Element||e instanceof Element}function Oa(e){return e instanceof Da(e).HTMLElement||e instanceof HTMLElement}function La(e){return"undefined"!=typeof ShadowRoot&&(e instanceof Da(e).ShadowRoot||e instanceof ShadowRoot)}var Ba={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var r=t.styles[e]||{},i=t.attributes[e]||{},n=t.elements[e];Oa(n)&&za(n)&&(Object.assign(n.style,r),Object.keys(i).forEach((function(e){var t=i[e];!1===t?n.removeAttribute(e):n.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow),function(){Object.keys(t.elements).forEach((function(e){var i=t.elements[e],n=t.attributes[e]||{},o=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:r[e]).reduce((function(e,t){return e[t]="",e}),{});Oa(i)&&za(i)&&(Object.assign(i.style,o),Object.keys(n).forEach((function(e){i.removeAttribute(e)})))}))}},requires:["computeStyles"]};function Fa(e){return e.split("-")[0]}var Na=Math.max,Va=Math.min,ja=Math.round;function Ua(){var e=navigator.userAgentData;return null!=e&&e.brands&&Array.isArray(e.brands)?e.brands.map((function(e){return e.brand+"/"+e.version})).join(" "):navigator.userAgent}function $a(){return!/^((?!chrome|android).)*safari/i.test(Ua())}function Ga(e,t,r){void 0===t&&(t=!1),void 0===r&&(r=!1);var i=e.getBoundingClientRect(),n=1,o=1;t&&Oa(e)&&(n=e.offsetWidth>0&&ja(i.width)/e.offsetWidth||1,o=e.offsetHeight>0&&ja(i.height)/e.offsetHeight||1);var s=(ka(e)?Da(e):window).visualViewport,a=!$a()&&r,l=(i.left+(a&&s?s.offsetLeft:0))/n,c=(i.top+(a&&s?s.offsetTop:0))/o,u=i.width/n,h=i.height/o;return{width:u,height:h,top:c,right:l+u,bottom:c+h,left:l,x:l,y:c}}function qa(e){var t=Ga(e),r=e.offsetWidth,i=e.offsetHeight;return Math.abs(t.width-r)<=1&&(r=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:e.offsetLeft,y:e.offsetTop,width:r,height:i}}function Ha(e,t){var r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&La(r)){var i=t;do{if(i&&e.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function Wa(e){return Da(e).getComputedStyle(e)}function Za(e){return["table","td","th"].indexOf(za(e))>=0}function Xa(e){return((ka(e)?e.ownerDocument:e.document)||window.document).documentElement}function Ya(e){return"html"===za(e)?e:e.assignedSlot||e.parentNode||(La(e)?e.host:null)||Xa(e)}function Ja(e){return Oa(e)&&"fixed"!==Wa(e).position?e.offsetParent:null}function Ka(e){for(var t=Da(e),r=Ja(e);r&&Za(r)&&"static"===Wa(r).position;)r=Ja(r);return r&&("html"===za(r)||"body"===za(r)&&"static"===Wa(r).position)?t:r||function(e){var t=/firefox/i.test(Ua());if(/Trident/i.test(Ua())&&Oa(e)&&"fixed"===Wa(e).position)return null;var r=Ya(e);for(La(r)&&(r=r.host);Oa(r)&&["html","body"].indexOf(za(r))<0;){var i=Wa(r);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return r;r=r.parentNode}return null}(e)||t}function Qa(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function el(e,t,r){return Na(e,Va(t,r))}function tl(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function rl(e,t){return t.reduce((function(t,r){return t[r]=e,t}),{})}var il={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,r=e.state,i=e.name,n=e.options,o=r.elements.arrow,s=r.modifiersData.popperOffsets,a=Fa(r.placement),l=Qa(a),c=[wa,ba].indexOf(a)>=0?"height":"width";if(o&&s){var u=function(e,t){return tl("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:rl(e,Sa))}(n.padding,r),h=qa(o),d="y"===l?xa:wa,p="y"===l?va:ba,f=r.rects.reference[c]+r.rects.reference[l]-s[l]-r.rects.popper[c],m=s[l]-r.rects.reference[l],_=Ka(o),g=_?"y"===l?_.clientHeight||0:_.clientWidth||0:0,y=f/2-m/2,x=u[d],v=g-h[c]-u[p],b=g/2-h[c]/2+y,w=el(x,b,v),T=l;r.modifiersData[i]=((t={})[T]=w,t.centerOffset=w-b,t)}},effect:function(e){var t=e.state,r=e.options.element,i=void 0===r?"[data-popper-arrow]":r;null!=i&&("string"!=typeof i||(i=t.elements.popper.querySelector(i)))&&Ha(t.elements.popper,i)&&(t.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function nl(e){return e.split("-")[1]}var ol={top:"auto",right:"auto",bottom:"auto",left:"auto"};function sl(e){var t,r=e.popper,i=e.popperRect,n=e.placement,o=e.variation,s=e.offsets,a=e.position,l=e.gpuAcceleration,c=e.adaptive,u=e.roundOffsets,h=e.isFixed,d=s.x,p=void 0===d?0:d,f=s.y,m=void 0===f?0:f,_="function"==typeof u?u({x:p,y:m}):{x:p,y:m};p=_.x,m=_.y;var g=s.hasOwnProperty("x"),y=s.hasOwnProperty("y"),x=wa,v=xa,b=window;if(c){var w=Ka(r),T="clientHeight",S="clientWidth";if(w===Da(r)&&"static"!==Wa(w=Xa(r)).position&&"absolute"===a&&(T="scrollHeight",S="scrollWidth"),n===xa||(n===wa||n===ba)&&o===Ma)v=va,m-=(h&&w===b&&b.visualViewport?b.visualViewport.height:w[T])-i.height,m*=l?1:-1;if(n===wa||(n===xa||n===va)&&o===Ma)x=ba,p-=(h&&w===b&&b.visualViewport?b.visualViewport.width:w[S])-i.width,p*=l?1:-1}var E,M=Object.assign({position:a},c&&ol),A=!0===u?function(e,t){var r=e.x,i=e.y,n=t.devicePixelRatio||1;return{x:ja(r*n)/n||0,y:ja(i*n)/n||0}}({x:p,y:m},Da(r)):{x:p,y:m};return p=A.x,m=A.y,l?Object.assign({},M,((E={})[v]=y?"0":"",E[x]=g?"0":"",E.transform=(b.devicePixelRatio||1)<=1?"translate("+p+"px, "+m+"px)":"translate3d("+p+"px, "+m+"px, 0)",E)):Object.assign({},M,((t={})[v]=y?m+"px":"",t[x]=g?p+"px":"",t.transform="",t))}var al={passive:!0};var ll={left:"right",right:"left",bottom:"top",top:"bottom"};function cl(e){return e.replace(/left|right|bottom|top/g,(function(e){return ll[e]}))}var ul={start:"end",end:"start"};function hl(e){return e.replace(/start|end/g,(function(e){return ul[e]}))}function dl(e){var t=Da(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function pl(e){return Ga(Xa(e)).left+dl(e).scrollLeft}function fl(e){var t=Wa(e),r=t.overflow,i=t.overflowX,n=t.overflowY;return/auto|scroll|overlay|hidden/.test(r+n+i)}function ml(e){return["html","body","#document"].indexOf(za(e))>=0?e.ownerDocument.body:Oa(e)&&fl(e)?e:ml(Ya(e))}function _l(e,t){var r;void 0===t&&(t=[]);var i=ml(e),n=i===(null==(r=e.ownerDocument)?void 0:r.body),o=Da(i),s=n?[o].concat(o.visualViewport||[],fl(i)?i:[]):i,a=t.concat(s);return n?a:a.concat(_l(Ya(s)))}function gl(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function yl(e,t,r){return t===Aa?gl(function(e,t){var r=Da(e),i=Xa(e),n=r.visualViewport,o=i.clientWidth,s=i.clientHeight,a=0,l=0;if(n){o=n.width,s=n.height;var c=$a();(c||!c&&"fixed"===t)&&(a=n.offsetLeft,l=n.offsetTop)}return{width:o,height:s,x:a+pl(e),y:l}}(e,r)):ka(t)?function(e,t){var r=Ga(e,!1,"fixed"===t);return r.top=r.top+e.clientTop,r.left=r.left+e.clientLeft,r.bottom=r.top+e.clientHeight,r.right=r.left+e.clientWidth,r.width=e.clientWidth,r.height=e.clientHeight,r.x=r.left,r.y=r.top,r}(t,r):gl(function(e){var t,r=Xa(e),i=dl(e),n=null==(t=e.ownerDocument)?void 0:t.body,o=Na(r.scrollWidth,r.clientWidth,n?n.scrollWidth:0,n?n.clientWidth:0),s=Na(r.scrollHeight,r.clientHeight,n?n.scrollHeight:0,n?n.clientHeight:0),a=-i.scrollLeft+pl(e),l=-i.scrollTop;return"rtl"===Wa(n||r).direction&&(a+=Na(r.clientWidth,n?n.clientWidth:0)-o),{width:o,height:s,x:a,y:l}}(Xa(e)))}function xl(e,t,r,i){var n="clippingParents"===t?function(e){var t=_l(Ya(e)),r=["absolute","fixed"].indexOf(Wa(e).position)>=0&&Oa(e)?Ka(e):e;return ka(r)?t.filter((function(e){return ka(e)&&Ha(e,r)&&"body"!==za(e)})):[]}(e):[].concat(t),o=[].concat(n,[r]),s=o[0],a=o.reduce((function(t,r){var n=yl(e,r,i);return t.top=Na(n.top,t.top),t.right=Va(n.right,t.right),t.bottom=Va(n.bottom,t.bottom),t.left=Na(n.left,t.left),t}),yl(e,s,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function vl(e){var t,r=e.reference,i=e.element,n=e.placement,o=n?Fa(n):null,s=n?nl(n):null,a=r.x+r.width/2-i.width/2,l=r.y+r.height/2-i.height/2;switch(o){case xa:t={x:a,y:r.y-i.height};break;case va:t={x:a,y:r.y+r.height};break;case ba:t={x:r.x+r.width,y:l};break;case wa:t={x:r.x-i.width,y:l};break;default:t={x:r.x,y:r.y}}var c=o?Qa(o):null;if(null!=c){var u="y"===c?"height":"width";switch(s){case Ea:t[c]=t[c]-(r[u]/2-i[u]/2);break;case Ma:t[c]=t[c]+(r[u]/2-i[u]/2)}}return t}function bl(e,t){void 0===t&&(t={});var r=t,i=r.placement,n=void 0===i?e.placement:i,o=r.strategy,s=void 0===o?e.strategy:o,a=r.boundary,l=void 0===a?"clippingParents":a,c=r.rootBoundary,u=void 0===c?Aa:c,h=r.elementContext,d=void 0===h?Ca:h,p=r.altBoundary,f=void 0!==p&&p,m=r.padding,_=void 0===m?0:m,g=tl("number"!=typeof _?_:rl(_,Sa)),y=d===Ca?"reference":Ca,x=e.rects.popper,v=e.elements[f?y:d],b=xl(ka(v)?v:v.contextElement||Xa(e.elements.popper),l,u,s),w=Ga(e.elements.reference),T=vl({reference:w,element:x,strategy:"absolute",placement:n}),S=gl(Object.assign({},x,T)),E=d===Ca?S:w,M={top:b.top-E.top+g.top,bottom:E.bottom-b.bottom+g.bottom,left:b.left-E.left+g.left,right:E.right-b.right+g.right},A=e.modifiersData.offset;if(d===Ca&&A){var C=A[n];Object.keys(M).forEach((function(e){var t=[ba,va].indexOf(e)>=0?1:-1,r=[xa,va].indexOf(e)>=0?"y":"x";M[e]+=C[r]*t}))}return M}function wl(e,t){void 0===t&&(t={});var r=t,i=r.placement,n=r.boundary,o=r.rootBoundary,s=r.padding,a=r.flipVariations,l=r.allowedAutoPlacements,c=void 0===l?Pa:l,u=nl(i),h=u?a?Ia:Ia.filter((function(e){return nl(e)===u})):Sa,d=h.filter((function(e){return c.indexOf(e)>=0}));0===d.length&&(d=h);var p=d.reduce((function(t,r){return t[r]=bl(e,{placement:r,boundary:n,rootBoundary:o,padding:s})[Fa(r)],t}),{});return Object.keys(p).sort((function(e,t){return p[e]-p[t]}))}var Tl={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name;if(!t.modifiersData[i]._skip){for(var n=r.mainAxis,o=void 0===n||n,s=r.altAxis,a=void 0===s||s,l=r.fallbackPlacements,c=r.padding,u=r.boundary,h=r.rootBoundary,d=r.altBoundary,p=r.flipVariations,f=void 0===p||p,m=r.allowedAutoPlacements,_=t.options.placement,g=Fa(_),y=l||(g===_||!f?[cl(_)]:function(e){if(Fa(e)===Ta)return[];var t=cl(e);return[hl(e),t,hl(t)]}(_)),x=[_].concat(y).reduce((function(e,r){return e.concat(Fa(r)===Ta?wl(t,{placement:r,boundary:u,rootBoundary:h,padding:c,flipVariations:f,allowedAutoPlacements:m}):r)}),[]),v=t.rects.reference,b=t.rects.popper,w=new Map,T=!0,S=x[0],E=0;E<x.length;E++){var M=x[E],A=Fa(M),C=nl(M)===Ea,I=[xa,va].indexOf(A)>=0,P=I?"width":"height",R=bl(t,{placement:M,boundary:u,rootBoundary:h,altBoundary:d,padding:c}),z=I?C?ba:wa:C?va:xa;v[P]>b[P]&&(z=cl(z));var D=cl(z),k=[];if(o&&k.push(R[A]<=0),a&&k.push(R[z]<=0,R[D]<=0),k.every((function(e){return e}))){S=M,T=!1;break}w.set(M,k)}if(T)for(var O=function(e){var t=x.find((function(t){var r=w.get(t);if(r)return r.slice(0,e).every((function(e){return e}))}));if(t)return S=t,"break"},L=f?3:1;L>0;L--){if("break"===O(L))break}t.placement!==S&&(t.modifiersData[i]._skip=!0,t.placement=S,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Sl(e,t,r){return void 0===r&&(r={x:0,y:0}),{top:e.top-t.height-r.y,right:e.right-t.width+r.x,bottom:e.bottom-t.height+r.y,left:e.left-t.width-r.x}}function El(e){return[xa,ba,va,wa].some((function(t){return e[t]>=0}))}var Ml={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,r=e.options,i=e.name,n=r.offset,o=void 0===n?[0,0]:n,s=Pa.reduce((function(e,r){return e[r]=function(e,t,r){var i=Fa(e),n=[wa,xa].indexOf(i)>=0?-1:1,o="function"==typeof r?r(Object.assign({},t,{placement:e})):r,s=o[0],a=o[1];return s=s||0,a=(a||0)*n,[wa,ba].indexOf(i)>=0?{x:a,y:s}:{x:s,y:a}}(r,t.rects,o),e}),{}),a=s[t.placement],l=a.x,c=a.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[i]=s}};var Al={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name,n=r.mainAxis,o=void 0===n||n,s=r.altAxis,a=void 0!==s&&s,l=r.boundary,c=r.rootBoundary,u=r.altBoundary,h=r.padding,d=r.tether,p=void 0===d||d,f=r.tetherOffset,m=void 0===f?0:f,_=bl(t,{boundary:l,rootBoundary:c,padding:h,altBoundary:u}),g=Fa(t.placement),y=nl(t.placement),x=!y,v=Qa(g),b="x"===v?"y":"x",w=t.modifiersData.popperOffsets,T=t.rects.reference,S=t.rects.popper,E="function"==typeof m?m(Object.assign({},t.rects,{placement:t.placement})):m,M="number"==typeof E?{mainAxis:E,altAxis:E}:Object.assign({mainAxis:0,altAxis:0},E),A=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,C={x:0,y:0};if(w){if(o){var I,P="y"===v?xa:wa,R="y"===v?va:ba,z="y"===v?"height":"width",D=w[v],k=D+_[P],O=D-_[R],L=p?-S[z]/2:0,B=y===Ea?T[z]:S[z],F=y===Ea?-S[z]:-T[z],N=t.elements.arrow,V=p&&N?qa(N):{width:0,height:0},j=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},U=j[P],$=j[R],G=el(0,T[z],V[z]),q=x?T[z]/2-L-G-U-M.mainAxis:B-G-U-M.mainAxis,H=x?-T[z]/2+L+G+$+M.mainAxis:F+G+$+M.mainAxis,W=t.elements.arrow&&Ka(t.elements.arrow),Z=W?"y"===v?W.clientTop||0:W.clientLeft||0:0,X=null!=(I=null==A?void 0:A[v])?I:0,Y=D+H-X,J=el(p?Va(k,D+q-X-Z):k,D,p?Na(O,Y):O);w[v]=J,C[v]=J-D}if(a){var K,Q="x"===v?xa:wa,ee="x"===v?va:ba,te=w[b],re="y"===b?"height":"width",ie=te+_[Q],ne=te-_[ee],oe=-1!==[xa,wa].indexOf(g),se=null!=(K=null==A?void 0:A[b])?K:0,ae=oe?ie:te-T[re]-S[re]-se+M.altAxis,le=oe?te+T[re]+S[re]-se-M.altAxis:ne,ce=p&&oe?function(e,t,r){var i=el(e,t,r);return i>r?r:i}(ae,te,le):el(p?ae:ie,te,p?le:ne);w[b]=ce,C[b]=ce-te}t.modifiersData[i]=C}},requiresIfExists:["offset"]};function Cl(e,t,r){void 0===r&&(r=!1);var i=Oa(t),n=Oa(t)&&function(e){var t=e.getBoundingClientRect(),r=ja(t.width)/e.offsetWidth||1,i=ja(t.height)/e.offsetHeight||1;return 1!==r||1!==i}(t),o=Xa(t),s=Ga(e,n,r),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(i||!i&&!r)&&(("body"!==za(t)||fl(o))&&(a=function(e){return e!==Da(e)&&Oa(e)?{scrollLeft:(t=e).scrollLeft,scrollTop:t.scrollTop}:dl(e);var t}(t)),Oa(t)?((l=Ga(t,!0)).x+=t.clientLeft,l.y+=t.clientTop):o&&(l.x=pl(o))),{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function Il(e){var t=new Map,r=new Set,i=[];function n(e){r.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!r.has(e)){var i=t.get(e);i&&n(i)}})),i.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){r.has(e.name)||n(e)})),i}var Pl={placement:"bottom",modifiers:[],strategy:"absolute"};function Rl(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return!t.some((function(e){return!(e&&"function"==typeof e.getBoundingClientRect)}))}function zl(e){void 0===e&&(e={});var t=e,r=t.defaultModifiers,i=void 0===r?[]:r,n=t.defaultOptions,o=void 0===n?Pl:n;return function(e,t,r){void 0===r&&(r=o);var n,s,a={placement:"bottom",orderedModifiers:[],options:Object.assign({},Pl,o),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},l=[],c=!1,u={state:a,setOptions:function(r){var n="function"==typeof r?r(a.options):r;h(),a.options=Object.assign({},o,a.options,n),a.scrollParents={reference:ka(e)?_l(e):e.contextElement?_l(e.contextElement):[],popper:_l(t)};var s,c,d=function(e){var t=Il(e);return Ra.reduce((function(e,r){return e.concat(t.filter((function(e){return e.phase===r})))}),[])}((s=[].concat(i,a.options.modifiers),c=s.reduce((function(e,t){var r=e[t.name];return e[t.name]=r?Object.assign({},r,t,{options:Object.assign({},r.options,t.options),data:Object.assign({},r.data,t.data)}):t,e}),{}),Object.keys(c).map((function(e){return c[e]}))));return a.orderedModifiers=d.filter((function(e){return e.enabled})),a.orderedModifiers.forEach((function(e){var t=e.name,r=e.options,i=void 0===r?{}:r,n=e.effect;if("function"==typeof n){var o=n({state:a,name:t,instance:u,options:i}),s=function(){};l.push(o||s)}})),u.update()},forceUpdate:function(){if(!c){var e=a.elements,t=e.reference,r=e.popper;if(Rl(t,r)){a.rects={reference:Cl(t,Ka(r),"fixed"===a.options.strategy),popper:qa(r)},a.reset=!1,a.placement=a.options.placement,a.orderedModifiers.forEach((function(e){return a.modifiersData[e.name]=Object.assign({},e.data)}));for(var i=0;i<a.orderedModifiers.length;i++)if(!0!==a.reset){var n=a.orderedModifiers[i],o=n.fn,s=n.options,l=void 0===s?{}:s,h=n.name;"function"==typeof o&&(a=o({state:a,options:l,name:h,instance:u})||a)}else a.reset=!1,i=-1}}},update:(n=function(){return new Promise((function(e){u.forceUpdate(),e(a)}))},function(){return s||(s=new Promise((function(e){Promise.resolve().then((function(){s=void 0,e(n())}))}))),s}),destroy:function(){h(),c=!0}};if(!Rl(e,t))return u;function h(){l.forEach((function(e){return e()})),l=[]}return u.setOptions(r).then((function(e){!c&&r.onFirstUpdate&&r.onFirstUpdate(e)})),u}}var Dl=zl({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,r=e.instance,i=e.options,n=i.scroll,o=void 0===n||n,s=i.resize,a=void 0===s||s,l=Da(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return o&&c.forEach((function(e){e.addEventListener("scroll",r.update,al)})),a&&l.addEventListener("resize",r.update,al),function(){o&&c.forEach((function(e){e.removeEventListener("scroll",r.update,al)})),a&&l.removeEventListener("resize",r.update,al)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,r=e.name;t.modifiersData[r]=vl({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,r=e.options,i=r.gpuAcceleration,n=void 0===i||i,o=r.adaptive,s=void 0===o||o,a=r.roundOffsets,l=void 0===a||a,c={placement:Fa(t.placement),variation:nl(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:n,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,sl(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:s,roundOffsets:l})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,sl(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},Ba,Ml,Tl,Al,il,{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,r=e.name,i=t.rects.reference,n=t.rects.popper,o=t.modifiersData.preventOverflow,s=bl(t,{elementContext:"reference"}),a=bl(t,{altBoundary:!0}),l=Sl(s,i),c=Sl(a,n,o),u=El(l),h=El(c);t.modifiersData[r]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:h},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":h})}}]});const kl=e.forwardRef((function(t,r){const{children:i,container:n,disablePortal:o=!1}=t,[s,a]=e.useState(null),l=mo(e.isValidElement(i)?Po(i):null,r);if(Vn((()=>{o||a(function(e){return"function"==typeof e?e():e}(n)||document.body)}),[n,o]),Vn((()=>{if(s&&!o)return co(r,s),()=>{co(r,null)}}),[r,s,o]),o){if(e.isValidElement(i)){const t={ref:l};return e.cloneElement(i,t)}return T.jsx(e.Fragment,{children:i})}return T.jsx(e.Fragment,{children:s?h.createPortal(i,s):s})}));function Ol(e){return vn("MuiPopper",e)}function Ll(e){return"function"==typeof e?e():e}function Bl(e){return void 0!==e.nodeType}"production"!==process.env.NODE_ENV&&(kl.propTypes={children:Qr.node,container:Qr.oneOfType([so,Qr.func]),disablePortal:Qr.bool}),"production"!==process.env.NODE_ENV&&(kl.propTypes=function(e){return"production"===process.env.NODE_ENV?e:{...e,[oo]:t=>{const r=Object.keys(t).filter((t=>!e.hasOwnProperty(t)));return r.length>0?new Error(`The following props are not supported: ${r.map((e=>`\`${e}\``)).join(", ")}. Please remove them.`):null}}}(kl.propTypes)),bn("MuiPopper",["root"]);const Fl={},Nl=e.forwardRef((function(t,r){const{anchorEl:i,children:n,direction:o,disablePortal:s,modifiers:a,open:l,placement:c,popperOptions:u,popperRef:h,slotProps:d={},slots:p={},TransitionProps:f,ownerState:m,..._}=t,g=e.useRef(null),y=mo(g,r),x=e.useRef(null),v=mo(x,h),b=e.useRef(v);Vn((()=>{b.current=v}),[v]),e.useImperativeHandle(h,(()=>x.current),[]);const w=function(e,t){if("ltr"===t)return e;switch(e){case"bottom-end":return"bottom-start";case"bottom-start":return"bottom-end";case"top-end":return"top-start";case"top-start":return"top-end";default:return e}}(c,o),[S,E]=e.useState(w),[M,A]=e.useState(Ll(i));e.useEffect((()=>{x.current&&x.current.forceUpdate()})),e.useEffect((()=>{i&&A(Ll(i))}),[i]),Vn((()=>{if(!M||!l)return;if("production"!==process.env.NODE_ENV&&M&&Bl(M)&&1===M.nodeType){const e=M.getBoundingClientRect();"test"!==process.env.NODE_ENV&&0===e.top&&0===e.left&&0===e.right&&0===e.bottom&&console.warn(["MUI: The `anchorEl` prop provided to the component is invalid.","The anchor element should be part of the document layout.","Make sure the element is present in the document or that it's not display none."].join("\n"))}let e=[{name:"preventOverflow",options:{altBoundary:s}},{name:"flip",options:{altBoundary:s}},{name:"onUpdate",enabled:!0,phase:"afterWrite",fn:({state:e})=>{E(e.placement)}}];null!=a&&(e=e.concat(a)),u&&null!=u.modifiers&&(e=e.concat(u.modifiers));const t=Dl(M,g.current,{placement:w,...u,modifiers:e});return b.current(t),()=>{t.destroy(),b.current(null)}}),[M,s,a,l,u,w]);const C={placement:S};null!==f&&(C.TransitionProps=f);const I=(e=>{const{classes:t}=e;return Mo({root:["root"]},Ol,t)})(t),P=p.root??"div",R=function(e){const{elementType:t,externalSlotProps:r,ownerState:i,skipResolvingSlotProps:n=!1,...o}=e,s=n?{}:function(e,t){return"function"==typeof e?e(t,void 0):e}(r,i),{props:a,internalRef:l}=Io({...o,externalSlotProps:s});return Ao(t,{...a,ref:mo(l,s?.ref,e.additionalProps?.ref)},i)}({elementType:P,externalSlotProps:d.root,externalForwardedProps:_,additionalProps:{role:"tooltip",ref:y},ownerState:t,className:I.root});return T.jsx(P,{...R,children:"function"==typeof n?n(C):n})})),Vl=e.forwardRef((function(t,r){const{anchorEl:i,children:n,container:o,direction:s="ltr",disablePortal:a=!1,keepMounted:l=!1,modifiers:c,open:u,placement:h="bottom",popperOptions:d=Fl,popperRef:p,style:f,transition:m=!1,slotProps:_={},slots:g={},...y}=t,[x,v]=e.useState(!0);if(!l&&!u&&(!m||x))return null;let b;if(o)b=o;else if(i){const e=Ll(i);b=e&&Bl(e)?lo(e).body:lo(null).body}const w=u||!l||m&&!x?void 0:"none",S=m?{in:u,onEnter:()=>{v(!1)},onExited:()=>{v(!0)}}:void 0;return T.jsx(kl,{disablePortal:a,container:b,children:T.jsx(Nl,{anchorEl:i,direction:s,disablePortal:a,modifiers:c,ref:r,open:m?!x:u,placement:h,popperOptions:d,popperRef:p,slotProps:_,slots:g,...y,style:{position:"fixed",top:0,left:0,display:w,...f},TransitionProps:S,children:n})})}));"production"!==process.env.NODE_ENV&&(Vl.propTypes={anchorEl:to(Qr.oneOfType([so,Qr.object,Qr.func]),(e=>{if(e.open){const t=Ll(e.anchorEl);if(t&&Bl(t)&&1===t.nodeType){const e=t.getBoundingClientRect();if("test"!==process.env.NODE_ENV&&0===e.top&&0===e.left&&0===e.right&&0===e.bottom)return new Error(["MUI: The `anchorEl` prop provided to the component is invalid.","The anchor element should be part of the document layout.","Make sure the element is present in the document or that it's not display none."].join("\n"))}else if(!t||"function"!=typeof t.getBoundingClientRect||!Bl(t)&&null!=t.contextElement&&1!==t.contextElement.nodeType)return new Error(["MUI: The `anchorEl` prop provided to the component is invalid.","It should be an HTML element instance or a virtualElement ","(https://popper.js.org/docs/v2/virtual-elements/)."].join("\n"))}return null})),children:Qr.oneOfType([Qr.node,Qr.func]),container:Qr.oneOfType([so,Qr.func]),direction:Qr.oneOf(["ltr","rtl"]),disablePortal:Qr.bool,keepMounted:Qr.bool,modifiers:Qr.arrayOf(Qr.shape({data:Qr.object,effect:Qr.func,enabled:Qr.bool,fn:Qr.func,name:Qr.any,options:Qr.object,phase:Qr.oneOf(["afterMain","afterRead","afterWrite","beforeMain","beforeRead","beforeWrite","main","read","write"]),requires:Qr.arrayOf(Qr.string),requiresIfExists:Qr.arrayOf(Qr.string)})),open:Qr.bool.isRequired,placement:Qr.oneOf(["auto-end","auto-start","auto","bottom-end","bottom-start","bottom","left-end","left-start","left","right-end","right-start","right","top-end","top-start","top"]),popperOptions:Qr.shape({modifiers:Qr.array,onFirstUpdate:Qr.func,placement:Qr.oneOf(["auto-end","auto-start","auto","bottom-end","bottom-start","bottom","left-end","left-start","left","right-end","right-start","right","top-end","top-start","top"]),strategy:Qr.oneOf(["absolute","fixed"])}),popperRef:ao,slotProps:Qr.shape({root:Qr.oneOfType([Qr.func,Qr.object])}),slots:Qr.shape({root:Qr.elementType}),transition:Qr.bool});const jl=bs(Vl,{name:"MuiPopper",slot:"Root",overridesResolver:(e,t)=>t.root})({}),Ul=e.forwardRef((function(e,t){const r=zo(),i=Ts({props:e,name:"MuiPopper"}),{anchorEl:n,component:o,components:s,componentsProps:a,container:l,disablePortal:c,keepMounted:u,modifiers:h,open:d,placement:p,popperOptions:f,popperRef:m,transition:_,slots:g,slotProps:y,...x}=i,v=g?.root??s?.Root,b={anchorEl:n,container:l,disablePortal:c,keepMounted:u,modifiers:h,open:d,placement:p,popperOptions:f,popperRef:m,transition:_,...x};return T.jsx(jl,{as:o,direction:r?"rtl":"ltr",slots:{root:v},slotProps:y??a,...b,ref:t})}));"production"!==process.env.NODE_ENV&&(Ul.propTypes={anchorEl:Qr.oneOfType([so,Qr.object,Qr.func]),children:Qr.oneOfType([Qr.node,Qr.func]),component:Qr.elementType,components:Qr.shape({Root:Qr.elementType}),componentsProps:Qr.shape({root:Qr.oneOfType([Qr.func,Qr.object])}),container:Qr.oneOfType([so,Qr.func]),disablePortal:Qr.bool,keepMounted:Qr.bool,modifiers:Qr.arrayOf(Qr.shape({data:Qr.object,effect:Qr.func,enabled:Qr.bool,fn:Qr.func,name:Qr.any,options:Qr.object,phase:Qr.oneOf(["afterMain","afterRead","afterWrite","beforeMain","beforeRead","beforeWrite","main","read","write"]),requires:Qr.arrayOf(Qr.string),requiresIfExists:Qr.arrayOf(Qr.string)})),open:Qr.bool.isRequired,placement:Qr.oneOf(["auto-end","auto-start","auto","bottom-end","bottom-start","bottom","left-end","left-start","left","right-end","right-start","right","top-end","top-start","top"]),popperOptions:Qr.shape({modifiers:Qr.array,onFirstUpdate:Qr.func,placement:Qr.oneOf(["auto-end","auto-start","auto","bottom-end","bottom-start","bottom","left-end","left-start","left","right-end","right-start","right","top-end","top-start","top"]),strategy:Qr.oneOf(["absolute","fixed"])}),popperRef:ao,slotProps:Qr.shape({root:Qr.oneOfType([Qr.func,Qr.object])}),slots:Qr.shape({root:Qr.elementType}),sx:Qr.oneOfType([Qr.arrayOf(Qr.oneOfType([Qr.func,Qr.object,Qr.bool])),Qr.func,Qr.object]),transition:Qr.bool});const $l=bn("MuiBox",["root"]),Gl=ys(),ql=function(t={}){const{themeId:r,defaultTheme:i,defaultClassName:n="MuiBox-root",generateClassName:o}=t,s=ei("div",{shouldForwardProp:e=>"theme"!==e&&"sx"!==e&&"as"!==e})(ln);return e.forwardRef((function(e,t){const a=pn(i),{className:l,component:c="div",...u}=fn(e);return T.jsx(s,{as:c,ref:t,className:yn(l,o?o(n):n),theme:r&&a[r]||a,...u})}))}({themeId:Ce,defaultTheme:Gl,defaultClassName:$l.root,generateClassName:_n.generate});function Hl(e){return vn("MuiCard",e)}"production"!==process.env.NODE_ENV&&(ql.propTypes={children:Qr.node,component:Qr.elementType,sx:Qr.oneOfType([Qr.arrayOf(Qr.oneOfType([Qr.func,Qr.object,Qr.bool])),Qr.func,Qr.object])}),bn("MuiCard",["root"]);const Wl=bs(Ks,{name:"MuiCard",slot:"Root",overridesResolver:(e,t)=>t.root})({overflow:"hidden"}),Zl=e.forwardRef((function(e,t){const r=Ts({props:e,name:"MuiCard"}),{className:i,raised:n=!1,...o}=r,s={...r,raised:n},a=(e=>{const{classes:t}=e;return Mo({root:["root"]},Hl,t)})(s);return T.jsx(Wl,{className:yn(a.root,i),elevation:n?8:void 0,ref:t,ownerState:s,...o})}));function Xl(e){return vn("MuiCardContent",e)}"production"!==process.env.NODE_ENV&&(Zl.propTypes={children:Qr.node,classes:Qr.object,className:Qr.string,raised:to(Qr.bool,(e=>e.raised&&"outlined"===e.variant?new Error('MUI: Combining `raised={true}` with `variant="outlined"` has no effect.'):null)),sx:Qr.oneOfType([Qr.arrayOf(Qr.oneOfType([Qr.func,Qr.object,Qr.bool])),Qr.func,Qr.object])}),bn("MuiCardContent",["root"]);const Yl=bs("div",{name:"MuiCardContent",slot:"Root",overridesResolver:(e,t)=>t.root})({padding:16,"&:last-child":{paddingBottom:24}}),Jl=e.forwardRef((function(e,t){const r=Ts({props:e,name:"MuiCardContent"}),{className:i,component:n="div",...o}=r,s={...r,component:n},a=(e=>{const{classes:t}=e;return Mo({root:["root"]},Xl,t)})(s);return T.jsx(Yl,{as:n,className:yn(a.root,i),ownerState:s,ref:t,...o})}));function Kl(e){return`scale(${e}, ${e**2})`}"production"!==process.env.NODE_ENV&&(Jl.propTypes={children:Qr.node,classes:Qr.object,className:Qr.string,component:Qr.elementType,sx:Qr.oneOfType([Qr.arrayOf(Qr.oneOfType([Qr.func,Qr.object,Qr.bool])),Qr.func,Qr.object])});const Ql={entering:{opacity:1,transform:Kl(1)},entered:{opacity:1,transform:"none"}},ec="undefined"!=typeof navigator&&/^((?!chrome|android).)*(safari|mobile)/i.test(navigator.userAgent)&&/(os |version\/)15(.|_)4/i.test(navigator.userAgent),tc=e.forwardRef((function(t,r){const{addEndListener:i,appear:n=!0,children:o,easing:s,in:a,onEnter:l,onEntered:c,onEntering:u,onExit:h,onExited:d,onExiting:p,style:f,timeout:m="auto",TransitionComponent:_=Us,...g}=t,y=vo(),x=e.useRef(),v=vs(),b=e.useRef(null),w=mo(b,Po(o),r),S=e=>t=>{if(e){const r=b.current;void 0===t?e(r):e(r,t)}},E=S(u),M=S(((e,t)=>{(e=>{e.scrollTop})(e);const{duration:r,delay:i,easing:n}=Xs({style:f,timeout:m,easing:s},{mode:"enter"});let o;"auto"===m?(o=v.transitions.getAutoHeightDuration(e.clientHeight),x.current=o):o=r,e.style.transition=[v.transitions.create("opacity",{duration:o,delay:i}),v.transitions.create("transform",{duration:ec?o:.666*o,delay:i,easing:n})].join(","),l&&l(e,t)})),A=S(c),C=S(p),I=S((e=>{const{duration:t,delay:r,easing:i}=Xs({style:f,timeout:m,easing:s},{mode:"exit"});let n;"auto"===m?(n=v.transitions.getAutoHeightDuration(e.clientHeight),x.current=n):n=t,e.style.transition=[v.transitions.create("opacity",{duration:n,delay:r}),v.transitions.create("transform",{duration:ec?n:.666*n,delay:ec?r:r||.333*n,easing:i})].join(","),e.style.opacity=0,e.style.transform=Kl(.75),h&&h(e)})),P=S(d);return T.jsx(_,{appear:n,in:a,nodeRef:b,onEnter:M,onEntered:A,onEntering:E,onExit:I,onExited:P,onExiting:C,addEndListener:e=>{"auto"===m&&y.start(x.current||0,e),i&&i(b.current,e)},timeout:"auto"===m?null:m,...g,children:(t,r)=>e.cloneElement(o,{style:{opacity:0,transform:Kl(.75),visibility:"exited"!==t||a?void 0:"hidden",...Ql[t],...f,...o.props.style},ref:w,...r})})}));function rc(e){return vn("MuiTooltip",e)}"production"!==process.env.NODE_ENV&&(tc.propTypes={addEndListener:Qr.func,appear:Qr.bool,children:io.isRequired,easing:Qr.oneOfType([Qr.shape({enter:Qr.string,exit:Qr.string}),Qr.string]),in:Qr.bool,onEnter:Qr.func,onEntered:Qr.func,onEntering:Qr.func,onExit:Qr.func,onExited:Qr.func,onExiting:Qr.func,style:Qr.object,timeout:Qr.oneOfType([Qr.oneOf(["auto"]),Qr.number,Qr.shape({appear:Qr.number,enter:Qr.number,exit:Qr.number})])}),tc&&(tc.muiSupportAuto=!0);const ic=bn("MuiTooltip",["popper","popperInteractive","popperArrow","popperClose","tooltip","tooltipArrow","touch","tooltipPlacementLeft","tooltipPlacementRight","tooltipPlacementTop","tooltipPlacementBottom","arrow"]);const nc=bs(Ul,{name:"MuiTooltip",slot:"Popper",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.popper,!r.disableInteractive&&t.popperInteractive,r.arrow&&t.popperArrow,!r.open&&t.popperClose]}})(ws((({theme:e})=>({zIndex:(e.vars||e).zIndex.tooltip,pointerEvents:"none",variants:[{props:({ownerState:e})=>!e.disableInteractive,style:{pointerEvents:"auto"}},{props:({open:e})=>!e,style:{pointerEvents:"none"}},{props:({ownerState:e})=>e.arrow,style:{[`&[data-popper-placement*="bottom"] .${ic.arrow}`]:{top:0,marginTop:"-0.71em","&::before":{transformOrigin:"0 100%"}},[`&[data-popper-placement*="top"] .${ic.arrow}`]:{bottom:0,marginBottom:"-0.71em","&::before":{transformOrigin:"100% 0"}},[`&[data-popper-placement*="right"] .${ic.arrow}`]:{height:"1em",width:"0.71em","&::before":{transformOrigin:"100% 100%"}},[`&[data-popper-placement*="left"] .${ic.arrow}`]:{height:"1em",width:"0.71em","&::before":{transformOrigin:"0 0"}}}},{props:({ownerState:e})=>e.arrow&&!e.isRtl,style:{[`&[data-popper-placement*="right"] .${ic.arrow}`]:{left:0,marginLeft:"-0.71em"}}},{props:({ownerState:e})=>e.arrow&&!!e.isRtl,style:{[`&[data-popper-placement*="right"] .${ic.arrow}`]:{right:0,marginRight:"-0.71em"}}},{props:({ownerState:e})=>e.arrow&&!e.isRtl,style:{[`&[data-popper-placement*="left"] .${ic.arrow}`]:{right:0,marginRight:"-0.71em"}}},{props:({ownerState:e})=>e.arrow&&!!e.isRtl,style:{[`&[data-popper-placement*="left"] .${ic.arrow}`]:{left:0,marginLeft:"-0.71em"}}}]})))),oc=bs("div",{name:"MuiTooltip",slot:"Tooltip",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.tooltip,r.touch&&t.touch,r.arrow&&t.tooltipArrow,t[`tooltipPlacement${fi(r.placement.split("-")[0])}`]]}})(ws((({theme:e})=>{return{backgroundColor:e.vars?e.vars.palette.Tooltip.bg:Zn(e.palette.grey[700],.92),borderRadius:(e.vars||e).shape.borderRadius,color:(e.vars||e).palette.common.white,fontFamily:e.typography.fontFamily,padding:"4px 8px",fontSize:e.typography.pxToRem(11),maxWidth:300,margin:2,wordWrap:"break-word",fontWeight:e.typography.fontWeightMedium,[`.${ic.popper}[data-popper-placement*="left"] &`]:{transformOrigin:"right center"},[`.${ic.popper}[data-popper-placement*="right"] &`]:{transformOrigin:"left center"},[`.${ic.popper}[data-popper-placement*="top"] &`]:{transformOrigin:"center bottom",marginBottom:"14px"},[`.${ic.popper}[data-popper-placement*="bottom"] &`]:{transformOrigin:"center top",marginTop:"14px"},variants:[{props:({ownerState:e})=>e.arrow,style:{position:"relative",margin:0}},{props:({ownerState:e})=>e.touch,style:{padding:"8px 16px",fontSize:e.typography.pxToRem(14),lineHeight:(t=16/14,Math.round(1e5*t)/1e5)+"em",fontWeight:e.typography.fontWeightRegular}},{props:({ownerState:e})=>!e.isRtl,style:{[`.${ic.popper}[data-popper-placement*="left"] &`]:{marginRight:"14px"},[`.${ic.popper}[data-popper-placement*="right"] &`]:{marginLeft:"14px"}}},{props:({ownerState:e})=>!e.isRtl&&e.touch,style:{[`.${ic.popper}[data-popper-placement*="left"] &`]:{marginRight:"24px"},[`.${ic.popper}[data-popper-placement*="right"] &`]:{marginLeft:"24px"}}},{props:({ownerState:e})=>!!e.isRtl,style:{[`.${ic.popper}[data-popper-placement*="left"] &`]:{marginLeft:"14px"},[`.${ic.popper}[data-popper-placement*="right"] &`]:{marginRight:"14px"}}},{props:({ownerState:e})=>!!e.isRtl&&e.touch,style:{[`.${ic.popper}[data-popper-placement*="left"] &`]:{marginLeft:"24px"},[`.${ic.popper}[data-popper-placement*="right"] &`]:{marginRight:"24px"}}},{props:({ownerState:e})=>e.touch,style:{[`.${ic.popper}[data-popper-placement*="top"] &`]:{marginBottom:"24px"}}},{props:({ownerState:e})=>e.touch,style:{[`.${ic.popper}[data-popper-placement*="bottom"] &`]:{marginTop:"24px"}}}]};var t}))),sc=bs("span",{name:"MuiTooltip",slot:"Arrow",overridesResolver:(e,t)=>t.arrow})(ws((({theme:e})=>({overflow:"hidden",position:"absolute",width:"1em",height:"0.71em",boxSizing:"border-box",color:e.vars?e.vars.palette.Tooltip.bg:Zn(e.palette.grey[700],.9),"&::before":{content:'""',margin:"auto",display:"block",width:"100%",height:"100%",backgroundColor:"currentColor",transform:"rotate(45deg)"}}))));let ac=!1;const lc=new xo;let cc={x:0,y:0};function uc(e,t){return(r,...i)=>{t&&t(r,...i),e(r,...i)}}const hc=e.forwardRef((function(t,r){const i=Ts({props:t,name:"MuiTooltip"}),{arrow:n=!1,children:o,classes:s,components:a={},componentsProps:l={},describeChild:c=!1,disableFocusListener:u=!1,disableHoverListener:h=!1,disableInteractive:d=!1,disableTouchListener:p=!1,enterDelay:f=100,enterNextDelay:m=0,enterTouchDelay:_=700,followCursor:g=!1,id:y,leaveDelay:x=0,leaveTouchDelay:v=1500,onClose:b,onOpen:w,open:S,placement:E="bottom",PopperComponent:M,PopperProps:A={},slotProps:C={},slots:I={},title:P,TransitionComponent:R=tc,TransitionProps:z,...D}=i,k=e.isValidElement(o)?o:T.jsx("span",{children:o}),O=vs(),L=zo(),[B,F]=e.useState(),[N,V]=e.useState(null),j=e.useRef(!1),U=d||g,$=vo(),G=vo(),q=vo(),H=vo(),[W,Z]=function({controlled:t,default:r,name:i,state:n="value"}){const{current:o}=e.useRef(void 0!==t),[s,a]=e.useState(r),l=o?t:s;if("production"!==process.env.NODE_ENV){e.useEffect((()=>{o!==(void 0!==t)&&console.error([`MUI: A component is changing the ${o?"":"un"}controlled ${n} state of ${i} to be ${o?"un":""}controlled.`,"Elements should not switch from uncontrolled to controlled (or vice versa).",`Decide between using a controlled or uncontrolled ${i} element for the lifetime of the component.`,"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.","More info: https://fb.me/react-controlled-components"].join("\n"))}),[n,i,t]);const{current:s}=e.useRef(r);e.useEffect((()=>{o||Object.is(s,r)||console.error([`MUI: A component is changing the default ${n} state of an uncontrolled ${i} after being initialized. To suppress this warning opt to use a controlled ${i}.`].join("\n"))}),[JSON.stringify(r)])}return[l,e.useCallback((e=>{o||a(e)}),[])]}({controlled:S,default:!1,name:"Tooltip",state:"open"});let X=W;if("production"!==process.env.NODE_ENV){const{current:t}=e.useRef(void 0!==S);e.useEffect((()=>{B&&B.disabled&&!t&&""!==P&&"button"===B.tagName.toLowerCase()&&console.error(["MUI: You are providing a disabled `button` child to the Tooltip component.","A disabled element does not fire events.","Tooltip needs to listen to the child element's events to display the title.","","Add a simple wrapper element, such as a `span`."].join("\n"))}),[P,B,t])}const Y=po(y),J=e.useRef(),K=fo((()=>{void 0!==J.current&&(document.body.style.WebkitUserSelect=J.current,J.current=void 0),H.clear()}));e.useEffect((()=>K),[K]);const Q=e=>{lc.clear(),ac=!0,Z(!0),w&&!X&&w(e)},ee=fo((e=>{lc.start(800+x,(()=>{ac=!1})),Z(!1),b&&X&&b(e),$.start(O.transitions.duration.shortest,(()=>{j.current=!1}))})),te=e=>{j.current&&"touchstart"!==e.type||(B&&B.removeAttribute("title"),G.clear(),q.clear(),f||ac&&m?G.start(ac?m:f,(()=>{Q(e)})):Q(e))},re=e=>{G.clear(),q.start(x,(()=>{ee(e)}))},[,ie]=e.useState(!1),ne=e=>{bo(e.target)||(ie(!1),re(e))},oe=e=>{B||F(e.currentTarget),bo(e.target)&&(ie(!0),te(e))},se=e=>{j.current=!0;const t=k.props;t.onTouchStart&&t.onTouchStart(e)},ae=e=>{se(e),q.clear(),$.clear(),K(),J.current=document.body.style.WebkitUserSelect,document.body.style.WebkitUserSelect="none",H.start(_,(()=>{document.body.style.WebkitUserSelect=J.current,te(e)}))},le=e=>{k.props.onTouchEnd&&k.props.onTouchEnd(e),K(),q.start(v,(()=>{ee(e)}))};e.useEffect((()=>{if(X)return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)};function e(e){"Escape"===e.key&&ee(e)}}),[ee,X]);const ce=mo(Po(k),F,r);P||0===P||(X=!1);const ue=e.useRef(),he={},de="string"==typeof P;c?(he.title=X||!de||h?null:P,he["aria-describedby"]=X?Y:null):(he["aria-label"]=de?P:null,he["aria-labelledby"]=X&&!de?Y:null);const pe={...he,...D,...k.props,className:yn(D.className,k.props.className),onTouchStart:se,ref:ce,...g?{onMouseMove:e=>{const t=k.props;t.onMouseMove&&t.onMouseMove(e),cc={x:e.clientX,y:e.clientY},ue.current&&ue.current.update()}}:{}};"production"!==process.env.NODE_ENV&&(pe["data-mui-internal-clone-element"]=!0,e.useEffect((()=>{B&&!B.getAttribute("data-mui-internal-clone-element")&&console.error(["MUI: The `children` component of the Tooltip is not forwarding its props correctly.","Please make sure that props are spread on the same element that the ref is applied to."].join("\n"))}),[B]));const fe={};p||(pe.onTouchStart=ae,pe.onTouchEnd=le),h||(pe.onMouseOver=uc(te,pe.onMouseOver),pe.onMouseLeave=uc(re,pe.onMouseLeave),U||(fe.onMouseOver=te,fe.onMouseLeave=re)),u||(pe.onFocus=uc(oe,pe.onFocus),pe.onBlur=uc(ne,pe.onBlur),U||(fe.onFocus=oe,fe.onBlur=ne)),"production"!==process.env.NODE_ENV&&k.props.title&&console.error(["MUI: You have provided a `title` prop to the child of <Tooltip />.",`Remove this title prop \`${k.props.title}\` or the Tooltip component.`].join("\n"));const me=e.useMemo((()=>{let e=[{name:"arrow",enabled:Boolean(N),options:{element:N,padding:4}}];return A.popperOptions?.modifiers&&(e=e.concat(A.popperOptions.modifiers)),{...A.popperOptions,modifiers:e}}),[N,A]),_e={...i,isRtl:L,arrow:n,disableInteractive:U,placement:E,PopperComponentProp:M,touch:j.current},ge=(e=>{const{classes:t,disableInteractive:r,arrow:i,touch:n,placement:o}=e;return Mo({popper:["popper",!r&&"popperInteractive",i&&"popperArrow"],tooltip:["tooltip",i&&"tooltipArrow",n&&"touch",`tooltipPlacement${fi(o.split("-")[0])}`],arrow:["arrow"]},rc,t)})(_e),ye=I.popper??a.Popper??nc,xe=I.transition??a.Transition??R??tc,ve=I.tooltip??a.Tooltip??oc,be=I.arrow??a.Arrow??sc,we=Ao(ye,{...A,...C.popper??l.popper,className:yn(ge.popper,A?.className,(C.popper??l.popper)?.className)},_e),Te=Ao(xe,{...z,...C.transition??l.transition},_e),Se=Ao(ve,{...C.tooltip??l.tooltip,className:yn(ge.tooltip,(C.tooltip??l.tooltip)?.className)},_e),Ee=Ao(be,{...C.arrow??l.arrow,className:yn(ge.arrow,(C.arrow??l.arrow)?.className)},_e);return T.jsxs(e.Fragment,{children:[e.cloneElement(k,pe),T.jsx(ye,{as:M??Ul,placement:E,anchorEl:g?{getBoundingClientRect:()=>({top:cc.y,left:cc.x,right:cc.x,bottom:cc.y,width:0,height:0})}:B,popperRef:ue,open:!!B&&X,id:Y,transition:!0,...fe,...we,popperOptions:me,children:({TransitionProps:e})=>T.jsx(xe,{timeout:O.transitions.duration.shorter,...e,...Te,children:T.jsxs(ve,{...Se,children:[P,n?T.jsx(be,{...Ee,ref:V}):null]})})})]})}));function dc(e){return vn("MuiToggleButton",e)}"production"!==process.env.NODE_ENV&&(hc.propTypes={arrow:Qr.bool,children:io.isRequired,classes:Qr.object,className:Qr.string,components:Qr.shape({Arrow:Qr.elementType,Popper:Qr.elementType,Tooltip:Qr.elementType,Transition:Qr.elementType}),componentsProps:Qr.shape({arrow:Qr.object,popper:Qr.object,tooltip:Qr.object,transition:Qr.object}),describeChild:Qr.bool,disableFocusListener:Qr.bool,disableHoverListener:Qr.bool,disableInteractive:Qr.bool,disableTouchListener:Qr.bool,enterDelay:Qr.number,enterNextDelay:Qr.number,enterTouchDelay:Qr.number,followCursor:Qr.bool,id:Qr.string,leaveDelay:Qr.number,leaveTouchDelay:Qr.number,onClose:Qr.func,onOpen:Qr.func,open:Qr.bool,placement:Qr.oneOf(["bottom-end","bottom-start","bottom","left-end","left-start","left","right-end","right-start","right","top-end","top-start","top"]),PopperComponent:Qr.elementType,PopperProps:Qr.object,slotProps:Qr.shape({arrow:Qr.object,popper:Qr.object,tooltip:Qr.object,transition:Qr.object}),slots:Qr.shape({arrow:Qr.elementType,popper:Qr.elementType,tooltip:Qr.elementType,transition:Qr.elementType}),sx:Qr.oneOfType([Qr.arrayOf(Qr.oneOfType([Qr.func,Qr.object,Qr.bool])),Qr.func,Qr.object]),title:Qr.node,TransitionComponent:Qr.elementType,TransitionProps:Qr.object});const pc=bn("MuiToggleButton",["root","disabled","selected","standard","primary","secondary","sizeSmall","sizeMedium","sizeLarge","fullWidth"]),fc=e.createContext({});"production"!==process.env.NODE_ENV&&(fc.displayName="ToggleButtonGroupContext");const mc=e.createContext(void 0);function _c(e,t){return void 0!==t&&void 0!==e&&(Array.isArray(t)?t.includes(e):e===t)}"production"!==process.env.NODE_ENV&&(mc.displayName="ToggleButtonGroupButtonContext");const gc=bs(ha,{name:"MuiToggleButton",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,t[`size${fi(r.size)}`]]}})(ws((({theme:e})=>({...e.typography.button,borderRadius:(e.vars||e).shape.borderRadius,padding:11,border:`1px solid ${(e.vars||e).palette.divider}`,color:(e.vars||e).palette.action.active,[`&.${pc.disabled}`]:{color:(e.vars||e).palette.action.disabled,border:`1px solid ${(e.vars||e).palette.action.disabledBackground}`},"&:hover":{textDecoration:"none",backgroundColor:e.vars?`rgba(${e.vars.palette.text.primaryChannel} / ${e.vars.palette.action.hoverOpacity})`:Zn(e.palette.text.primary,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},variants:[{props:{color:"standard"},style:{[`&.${pc.selected}`]:{color:(e.vars||e).palette.text.primary,backgroundColor:e.vars?`rgba(${e.vars.palette.text.primaryChannel} / ${e.vars.palette.action.selectedOpacity})`:Zn(e.palette.text.primary,e.palette.action.selectedOpacity),"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.text.primaryChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:Zn(e.palette.text.primary,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette.text.primaryChannel} / ${e.vars.palette.action.selectedOpacity})`:Zn(e.palette.text.primary,e.palette.action.selectedOpacity)}}}}},...Object.entries(e.palette).filter(da()).map((([t])=>({props:{color:t},style:{[`&.${pc.selected}`]:{color:(e.vars||e).palette[t].main,backgroundColor:e.vars?`rgba(${e.vars.palette[t].mainChannel} / ${e.vars.palette.action.selectedOpacity})`:Zn(e.palette[t].main,e.palette.action.selectedOpacity),"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette[t].mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:Zn(e.palette[t].main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette[t].mainChannel} / ${e.vars.palette.action.selectedOpacity})`:Zn(e.palette[t].main,e.palette.action.selectedOpacity)}}}}}))),{props:{fullWidth:!0},style:{width:"100%"}},{props:{size:"small"},style:{padding:7,fontSize:e.typography.pxToRem(13)}},{props:{size:"large"},style:{padding:15,fontSize:e.typography.pxToRem(15)}}]})))),yc=e.forwardRef((function(t,r){const{value:i,...n}=e.useContext(fc),o=e.useContext(mc),s=Ts({props:Nn({...n,selected:_c(t.value,i)},t),name:"MuiToggleButton"}),{children:a,className:l,color:c="standard",disabled:u=!1,disableFocusRipple:h=!1,fullWidth:d=!1,onChange:p,onClick:f,selected:m,size:_="medium",value:g,...y}=s,x={...s,color:c,disabled:u,disableFocusRipple:h,fullWidth:d,size:_},v=(e=>{const{classes:t,fullWidth:r,selected:i,disabled:n,size:o,color:s}=e;return Mo({root:["root",i&&"selected",n&&"disabled",r&&"fullWidth",`size${fi(o)}`,s]},dc,t)})(x),b=o||"";return T.jsx(gc,{className:yn(n.className,v.root,l,b),disabled:u,focusRipple:!h,ref:r,onClick:e=>{f&&(f(e,g),e.defaultPrevented)||p&&p(e,g)},onChange:p,value:g,ownerState:x,"aria-pressed":m,...y,children:a})}));function xc(e){return vn("MuiToggleButtonGroup",e)}"production"!==process.env.NODE_ENV&&(yc.propTypes={children:Qr.node,classes:Qr.object,className:Qr.string,color:Qr.oneOfType([Qr.oneOf(["standard","primary","secondary","error","info","success","warning"]),Qr.string]),disabled:Qr.bool,disableFocusRipple:Qr.bool,disableRipple:Qr.bool,fullWidth:Qr.bool,onChange:Qr.func,onClick:Qr.func,selected:Qr.bool,size:Qr.oneOfType([Qr.oneOf(["small","medium","large"]),Qr.string]),sx:Qr.oneOfType([Qr.arrayOf(Qr.oneOfType([Qr.func,Qr.object,Qr.bool])),Qr.func,Qr.object]),value:Qr.any.isRequired});const vc=bn("MuiToggleButtonGroup",["root","selected","horizontal","vertical","disabled","grouped","groupedHorizontal","groupedVertical","fullWidth","firstButton","lastButton","middleButton"]),bc=bs("div",{name:"MuiToggleButtonGroup",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[{[`& .${vc.grouped}`]:t.grouped},{[`& .${vc.grouped}`]:t[`grouped${fi(r.orientation)}`]},{[`& .${vc.firstButton}`]:t.firstButton},{[`& .${vc.lastButton}`]:t.lastButton},{[`& .${vc.middleButton}`]:t.middleButton},t.root,"vertical"===r.orientation&&t.vertical,r.fullWidth&&t.fullWidth]}})(ws((({theme:e})=>({display:"inline-flex",borderRadius:(e.vars||e).shape.borderRadius,variants:[{props:{orientation:"vertical"},style:{flexDirection:"column",[`& .${vc.grouped}`]:{[`&.${vc.selected} + .${vc.grouped}.${vc.selected}`]:{borderTop:0,marginTop:0}},[`& .${vc.firstButton},& .${vc.middleButton}`]:{borderBottomLeftRadius:0,borderBottomRightRadius:0},[`& .${vc.lastButton},& .${vc.middleButton}`]:{marginTop:-1,borderTop:"1px solid transparent",borderTopLeftRadius:0,borderTopRightRadius:0},[`& .${vc.lastButton}.${pc.disabled},& .${vc.middleButton}.${pc.disabled}`]:{borderTop:"1px solid transparent"}}},{props:{fullWidth:!0},style:{width:"100%"}},{props:{orientation:"horizontal"},style:{[`& .${vc.grouped}`]:{[`&.${vc.selected} + .${vc.grouped}.${vc.selected}`]:{borderLeft:0,marginLeft:0}},[`& .${vc.firstButton},& .${vc.middleButton}`]:{borderTopRightRadius:0,borderBottomRightRadius:0},[`& .${vc.lastButton},& .${vc.middleButton}`]:{marginLeft:-1,borderLeft:"1px solid transparent",borderTopLeftRadius:0,borderBottomLeftRadius:0},[`& .${vc.lastButton}.${pc.disabled},& .${vc.middleButton}.${pc.disabled}`]:{borderLeft:"1px solid transparent"}}}]})))),wc=e.forwardRef((function(t,r){const i=Ts({props:t,name:"MuiToggleButtonGroup"}),{children:n,className:o,color:s="standard",disabled:a=!1,exclusive:l=!1,fullWidth:c=!1,onChange:u,orientation:h="horizontal",size:d="medium",value:p,...f}=i,m={...i,disabled:a,fullWidth:c,orientation:h,size:d},_=(e=>{const{classes:t,orientation:r,fullWidth:i,disabled:n}=e;return Mo({root:["root",r,i&&"fullWidth"],grouped:["grouped",`grouped${fi(r)}`,n&&"disabled"],firstButton:["firstButton"],lastButton:["lastButton"],middleButton:["middleButton"]},xc,t)})(m),g=e.useCallback(((e,t)=>{if(!u)return;const r=p&&p.indexOf(t);let i;p&&r>=0?(i=p.slice(),i.splice(r,1)):i=p?p.concat(t):[t],u(e,i)}),[u,p]),y=e.useCallback(((e,t)=>{u&&u(e,p===t?null:t)}),[u,p]),x=e.useMemo((()=>({className:_.grouped,onChange:l?y:g,value:p,size:d,fullWidth:c,color:s,disabled:a})),[_.grouped,l,y,g,p,d,c,s,a]),v=function(t){return e.Children.toArray(t).filter((t=>e.isValidElement(t)))}(n),b=v.length,w=e=>{const t=0===e,r=e===b-1;return t&&r?"":t?_.firstButton:r?_.lastButton:_.middleButton};return T.jsx(bc,{role:"group",className:yn(_.root,o),ref:r,ownerState:m,...f,children:T.jsx(fc.Provider,{value:x,children:v.map(((e,t)=>("production"!==process.env.NODE_ENV&&Ps.isFragment(e)&&console.error(["MUI: The ToggleButtonGroup component doesn't accept a Fragment as a child.","Consider providing an array instead."].join("\n")),T.jsx(mc.Provider,{value:w(t),children:e},t))))})})}));"production"!==process.env.NODE_ENV&&(wc.propTypes={children:Qr.node,classes:Qr.object,className:Qr.string,color:Qr.oneOfType([Qr.oneOf(["standard","primary","secondary","error","info","success","warning"]),Qr.string]),disabled:Qr.bool,exclusive:Qr.bool,fullWidth:Qr.bool,onChange:Qr.func,orientation:Qr.oneOf(["horizontal","vertical"]),size:Qr.oneOfType([Qr.oneOf(["small","medium","large"]),Qr.string]),sx:Qr.oneOfType([Qr.arrayOf(Qr.oneOfType([Qr.func,Qr.object,Qr.bool])),Qr.func,Qr.object]),value:Qr.any});R(".legend{\r\n --legend-font-size: 10px;\r\n --legend-padding: 5px;\r\n width: 250px;\r\n height: 20px;\r\n position:absolute;\r\n z-index:10;\r\n background-color: white;\r\n padding: 0;\r\n display:inline-flex;\r\n border-radius:3px;\r\n box-shadow: 2px 2px 6px gray;\r\n}\r\n\r\n.legend > .item-container {\r\n display:inline-flex;\r\n padding:0;\r\n position:absolute;\r\n top: 5px;\r\n left: 5px;\r\n}\r\n\r\n.legend > .item-container:hover > item {\r\n opacity: 0.2;\r\n}\r\n\r\n.legend > .item-container > .item {\r\n height: var(--legend-font-size);\r\n width:30px;\r\n display:inline-flex;\r\n padding:0;\r\n}\r\n\r\n.legend > .item-container > .item:hover {\r\n opacity: 1 !important;\r\n}");var Tc=function(e){return T.jsx("div",{className:e.className+" legend",children:T.jsxs("div",{className:"item-container",children:[T.jsx(hc,{title:T.jsx("span",{style:{fontSize:"1.25em",padding:"2px"},children:"Category 5"}),children:T.jsx("span",{className:"item",style:{backgroundColor:I(5)}})}),T.jsx(hc,{title:T.jsx("span",{style:{fontSize:"1.25em",padding:"2px"},children:"Category 4"}),children:T.jsx("span",{className:"item",style:{backgroundColor:I(4)}})}),T.jsx(hc,{title:T.jsx("span",{style:{fontSize:"1.25em",padding:"2px"},children:"Category 3"}),children:T.jsx("span",{className:"item",style:{backgroundColor:I(3)}})}),T.jsx(hc,{title:T.jsx("span",{style:{fontSize:"1.25em",padding:"2px"},children:"Category 2"}),children:T.jsx("span",{className:"item",style:{backgroundColor:I(2)}})}),T.jsx(hc,{title:T.jsx("span",{style:{fontSize:"1.25em",padding:"2px"},children:"Category 1"}),children:T.jsx("span",{className:"item",style:{backgroundColor:I(1)}})}),T.jsx(hc,{title:T.jsx("span",{style:{fontSize:"1.25em",padding:"2px"},children:"Tropical Storm"}),children:T.jsx("span",{className:"item",style:{backgroundColor:I(0)}})}),T.jsx(hc,{title:T.jsx("span",{style:{fontSize:"1.25em",padding:"2px"},children:"Tropical Depression"}),children:T.jsx("span",{className:"item",style:{backgroundColor:I(-1)}})}),T.jsx(hc,{title:T.jsx("span",{style:{fontSize:"1.25em",padding:"2px"},children:"Tropical Expression"}),children:T.jsx("span",{className:"item",style:{backgroundColor:I(-2)}})})]})})};R(".storm-legend{\r\n top: 80px;\r\n}");var Sc=function(e){return T.jsx("div",{children:T.jsx(Zl,{className:e.className+" storm-legend",variant:"outlined",sx:{overflow:"auto",position:"absolute",zIndex:10,right:20,backgroundColor:"rgba(255,255,255,0.6)",maxHeight:"calc(calc(100% - 80px) / 2)"},children:T.jsxs(Jl,{children:[T.jsx(ya,{gutterBottom:!0,sx:{color:"text.secondary",fontSize:16,fontWeight:700,pb:1},children:"Storm Legend"}),T.jsx(ql,{children:e.stormTracks&&e.stormTracks.map((function(e){return T.jsxs(ya,{variant:"body2",children:[T.jsx("span",{style:{width:"20px",height:"20px",backgroundColor:e.color,display:"inline-block",marginRight:"10px",marginLeft:"10px"}}),T.jsx("span",{style:{position:"relative",height:"25px",top:-5,display:"inline-block"},children:e.name})]},e.name+e.year)}))})]})})})};r((function(e,t){var r=a(void 0),i=a(void 0),n=l(!1),o=n[0],s=n[1],h=l(new O.Marker),d=h[0],p=h[1],f=l(void 0),m=f[0],_=f[1],g=l(b.CAT_INTENSITY),y=g[0],x=g[1],v=l([]),R=v[0],z=v[1];function D(t,r,i,n,o,s,a){if(null!=e.ciacRadius&&null!=e.ciacRadius&&null!=e.location&&null!=e.location){var l=[e.location.longitude,e.location.latitude],c=function(e,t,r){var i=e;return{radius:t,latitude:i[1],longitude:i[0],payouts:r}}(l,1e3,t),u=function(e,t,r){var i=e;return{code:t,latitude:i[1],longitude:i[0],payouts:r}}(l,r,i),h=function(e,t,r,i){var n=e;return{shapes:[{type:"__circle",latitude:n[1],longitude:n[0],radius:t}],includeNotNamedStorms:r,payouts:i}}(l,e.ciacRadius,o,n);(function(e,t){return G(void 0,void 0,void 0,(function(){var r;return q(this,(function(i){switch(i.label){case 0:return r="https://api-uat.nms3939.com"+H.endpoints.backTesting.payouts,[4,fetch(r,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":t},body:JSON.stringify(e)})];case 1:return[4,i.sent().json()];case 2:return[2,i.sent()]}}))}))})({includeZeroPayouts:s,limit:a,latitude:e.location.latitude,longitude:e.location.longitude,proxy:c,anemometer:u,ciac:h},e.apiAccessToken).then((function(t){var r=t.payouts.map((function(e,t){return e.color=P(t),e}));z(r),null!=e.onCalculatePayouts&&e.onCalculatePayouts(r)}),(function(e){throw console.error(e),Error(e)}))}}c(t,(function(){return{calculatePayouts:function(e,t,r,i,n,o,s){D(e,t,r,i,n,o,s)}}}));var k=function(e){if(r&&r.current){var t=r.current.getSource(M);if(t){var i=t._data.features.map((function(t){var r,i,n,o,s,a,l,c,u,h,d;return{type:t.type,geometry:t.geometry,properties:{view:e,muted:null===(r=t.properties)||void 0===r?void 0:r.muted,name:null===(i=t.properties)||void 0===i?void 0:i.name,year:null===(n=t.properties)||void 0===n?void 0:n.year,windspeed:null===(o=t.properties)||void 0===o?void 0:o.windspeed,category:null===(s=t.properties)||void 0===s?void 0:s.category,time:null===(a=t.properties)||void 0===a?void 0:a.time,latitude:null===(l=t.properties)||void 0===l?void 0:l.latitude,longitude:null===(c=t.properties)||void 0===c?void 0:c.longitude,location:null===(u=t.properties)||void 0===u?void 0:u.location,checked:null===(h=t.properties)||void 0===h?void 0:h.checked,color:null===(d=t.properties)||void 0===d?void 0:d.color}}}));t.setData({type:"FeatureCollection",features:i})}var n=r.current.getSource(A);if(n){i=n._data.features.map((function(t){var r,i,n,o,s,a;return{type:t.type,geometry:t.geometry,properties:{view:e,muted:null===(r=t.properties)||void 0===r?void 0:r.muted,name:null===(i=t.properties)||void 0===i?void 0:i.name,year:null===(n=t.properties)||void 0===n?void 0:n.year,category:null===(o=t.properties)||void 0===o?void 0:o.category,checked:null===(s=t.properties)||void 0===s?void 0:s.checked,color:null===(a=t.properties)||void 0===a?void 0:a.color}}}));n.setData({type:"FeatureCollection",features:i})}}};function L(e,t){if(r&&r.current){var i=0,n=e.map((function(e){var r=P(i);return i+=1,e.stormTrack.map((function(e){return{type:"Feature",geometry:e.LOCATION,properties:{view:t,muted:!1,checked:!0,name:e.NAME,year:e.SEASON,windspeed:e.USA_WIND,category:e.USA_SSHS,time:e.ISO_TIME,latitude:e.LOCATION.coordinates.at(1),longitude:e.LOCATION.coordinates.at(0),location:e.LOCATION,color:r}}}))})),o=n.map((function(e){return function(e){for(var t,r,i,n,o,s,a,l=[],c=1;c<e.length;c++){var u=((null===(t=e[c].properties)||void 0===t?void 0:t.category)+(null===(r=e[c-1].properties)||void 0===r?void 0:r.category))/2,h=e[c-1].geometry.coordinates,d=e[c].geometry.coordinates;if(h[0]<0||d[0]<0){var p=B(h[0],360),f=B(d[0],360);h[0]=p,d[0]=f}l.push({type:"Feature",geometry:{type:"LineString",coordinates:[h,d]},properties:{name:null===(i=e[c].properties)||void 0===i?void 0:i.name,year:null===(n=e[c].properties)||void 0===n?void 0:n.year,category:u,muted:null===(o=e[c].properties)||void 0===o?void 0:o.muted,checked:!0,view:null===(s=e[c].properties)||void 0===s?void 0:s.view,color:null===(a=e[c].properties)||void 0===a?void 0:a.color}})}return l}(e)})),s=r.current.getSource(M);s&&s.setData({type:"FeatureCollection",features:n.flat()});var a=r.current.getSource(A);a&&a.setData({type:"FeatureCollection",features:o.flat()})}}function B(e,t){return(e%t+t)%t}return u((function(){return O.accessToken=e.mapAccessToken,r.current=new O.Map({container:i.current,style:"mapbox://styles/adubu001/cm23vizjd00gk01qk59q062mj",pitchWithRotate:!1,dragRotate:!1,touchZoomRotate:!1,center:e.location?[e.location.longitude,e.location.latitude]:S,zoom:8}),r.current.on("load",(function(){var e,t,i,n,o,a,l,c,u;s(!0),null===(e=r.current)||void 0===e||e.addSource(E,{type:"geojson",data:{type:"FeatureCollection",features:[]}}),null===(t=r.current)||void 0===t||t.addSource(M,{type:"geojson",data:{type:"FeatureCollection",features:[]}}),null===(i=r.current)||void 0===i||i.addSource(A,{type:"geojson",data:{type:"FeatureCollection",features:[]}}),null===(n=r.current)||void 0===n||n.addLayer({id:"__ciac_layer",type:"fill",source:E,paint:{"fill-color":"#105397","fill-opacity":.35}}),null===(o=r.current)||void 0===o||o.addLayer({id:"outline",type:"line",source:E,paint:{"line-color":"#105397","line-width":2}}),null===(a=r.current)||void 0===a||a.addLayer({id:"__tropical_storm_tracks_layer",type:"line",source:A,paint:{"line-color":["match",["concat",["get","view"],["get","muted"]],b.CAT_INTENSITY+"false",["interpolate",["linear"],["get","category"],-5,w.COLOR_TROPICAL_EXPRESSION,-4,w.COLOR_TROPICAL_EXPRESSION,-3,w.COLOR_TROPICAL_EXPRESSION,-2,w.COLOR_TROPICAL_EXPRESSION,-1,w.COLOR_TROPICAL_DEPRESSION,0,w.COLOR_TROPICAL_STORM,1,w.COLOR_CAT_1,2,w.COLOR_CAT_2,3,w.COLOR_CAT_3,4,w.COLOR_CAT_4,5,w.COLOR_CAT_5],b.STORMS+"false",["get","color"],"rgba(255,255,255,0.2)"],"line-width":4}}),null===(l=r.current)||void 0===l||l.addLayer({id:C,type:"circle",source:M,paint:{"circle-stroke-color":["match",["concat","",["get","muted"]],"false","#000","rgba(0,0,0,0.2)"],"circle-stroke-width":1,"circle-color":["match",["concat",["get","view"],["get","category"],["get","muted"]],b.CAT_INTENSITY+"-5false",w.COLOR_TROPICAL_EXPRESSION,b.CAT_INTENSITY+"-4false",w.COLOR_TROPICAL_EXPRESSION,b.CAT_INTENSITY+"-3false",w.COLOR_TROPICAL_EXPRESSION,b.CAT_INTENSITY+"-2false",w.COLOR_TROPICAL_EXPRESSION,b.CAT_INTENSITY+"-1false",w.COLOR_TROPICAL_DEPRESSION,b.CAT_INTENSITY+"0false",w.COLOR_TROPICAL_STORM,b.CAT_INTENSITY+"1false",w.COLOR_CAT_1,b.CAT_INTENSITY+"2false",w.COLOR_CAT_2,b.CAT_INTENSITY+"3false",w.COLOR_CAT_3,b.CAT_INTENSITY+"4false",w.COLOR_CAT_4,b.CAT_INTENSITY+"5false",w.COLOR_CAT_5,b.STORMS+"-5false",["get","color"],b.STORMS+"-4false",["get","color"],b.STORMS+"-3false",["get","color"],b.STORMS+"-2false",["get","color"],b.STORMS+"-1false",["get","color"],b.STORMS+"0false",["get","color"],b.STORMS+"1false",["get","color"],b.STORMS+"2false",["get","color"],b.STORMS+"3false",["get","color"],b.STORMS+"4false",["get","color"],b.STORMS+"5false",["get","color"],w.COLOR_MUTED],"circle-radius":5}});var h=new O.Popup({closeButton:!1,closeOnClick:!0,closeOnMove:!0});null===(c=r.current)||void 0===c||c.on("mouseenter",C,(function(e){if(r.current){r.current.getCanvas().style.cursor="pointer";var t=e.features[0].geometry.coordinates.slice(),i=e.features[0].properties,n="";for(n+="<strong>".concat(i.name," ").concat(i.year,"</strong>"),n+='<span style="border-radius:3px;margin-left:5px;padding:3px 10px;color:white;background-color:'.concat(I(i.category),'">').concat(function(e){switch(e){case 5:case 4:case 3:case 2:case 1:return"Category ".concat(e);case 0:return"Tropical Storm";case-1:return"Tropical Depression";case-2:case-3:case-4:case-5:return"Tropical Expression";case-10:return"N/A";default:return""}}(i.category),"</span>"),n+='<div style="width:150px">'.concat((o=i.time,new Date(Date.parse(o)).toLocaleDateString("en-us",{day:"numeric",year:"numeric",month:"short",hour:"numeric",minute:"numeric",timeZone:"UTC"})),"</div><p>"),n+='<div><strong>Windspeed: </strong><span">'.concat(i.windspeed," MPH</span></div>"),n+='<div><strong>LatLng: </strong><span">('.concat(i.latitude,"°, ").concat(i.longitude,"°)</span></div>"),n+="</p>";Math.abs(e.lngLat.lng-t[0])>180;)t[0]+=e.lngLat.lng>t[0]?360:-360;h.setLngLat(t).setHTML(n).addTo(r.current),h.on("mouseleave",(function(){r.current&&(r.current.getCanvas().style.cursor=""),h.remove()}))}var o})),null===(u=r.current)||void 0===u||u.on("mouseleave",C,(function(){r.current&&(r.current.getCanvas().style.cursor=""),h.remove()}))})),function(){var e;return null===(e=r.current)||void 0===e?void 0:e.remove()}}),[]),u((function(){if(o)if(null!=e.location&&null!=e.location){if(null==r?void 0:r.current){var t=[e.location.longitude,e.location.latitude];p(d.remove().setLngLat(t).addTo(r.current)),r.current.flyTo({center:t,essential:!0})}}else p(d.remove())}),[e.location,r,o]),u((function(){if(o)if(null!=e.ciacRadius&&null!=e.ciacRadius&&null!=e.location&&null!=e.location){if(null==r?void 0:r.current){var t,i=$([e.location.longitude,e.location.latitude],e.ciacRadius,{steps:200,units:"miles"});_(m),(t=r.current.getSource(E))&&(console.log("draw circle"),t.setData({type:"FeatureCollection",features:[i]}))}}else console.log("skip circle"),(null==r?void 0:r.current)&&(_(void 0),(t=r.current.getSource(E))&&t.setData({type:"FeatureCollection",features:[]}))}),[e.ciacRadius,e.location,r,o]),u((function(){o&&L(R,y)}),[o,R,y]),u((function(){o&&e.location&&e.limit&&e.proxyPayouts&&e.anemometerCode&&e.anemometerPayouts&&e.ciacRadius&&e.ciacRadius&&r&&D(e.proxyPayouts,e.anemometerCode,e.anemometerPayouts,e.ciacPayouts,!1,!1,e.limit)}),[e.location,e.limit,e.proxyPayouts,e.anemometerCode,e.anemometerPayouts,e.ciacRadius,e.ciacRadius,r,o]),T.jsxs("div",{className:"map__wrapper",children:[y==b.CAT_INTENSITY&&T.jsx(Tc,{className:"cat__legend"}),T.jsxs(wc,{className:"map__views",color:"primary",value:y,exclusive:!0,onChange:function(t,r){null!==r&&x(r),k(r),null!=e.onViewChange&&e.onViewChange(r)},"aria-label":"Platform",sx:{backgroundColor:"white",zIndex:10},children:[T.jsx(yc,{value:b.CAT_INTENSITY,children:"CAT Strength View"}),T.jsx(yc,{value:b.STORMS,children:"Storms View"})]}),y==b.STORMS&&T.jsx(Sc,{stormTracks:R}),T.jsx("div",{ref:i,className:"map__container"})]})}));
|
|
132
|
+
//# sourceMappingURL=index.js.map
|