From a594e1e21a19b97e20536696f083259f1370299b Mon Sep 17 00:00:00 2001 From: Nour-Cheour10 Date: Mon, 26 Aug 2024 18:10:31 +0200 Subject: [PATCH] changed on click --- docs/source/_static/embed-bundle.js | 3 ++ docs/source/_static/embed-bundle.js.map | 1 + examples/RasterLayer.ipynb | 2 +- examples/map.ipynb | 41 +++++++++++++---- ipyopenlayers/openlayers.py | 61 ++++++------------------- src/widget.ts | 2 +- 6 files changed, 51 insertions(+), 59 deletions(-) create mode 100644 docs/source/_static/embed-bundle.js create mode 100644 docs/source/_static/embed-bundle.js.map diff --git a/docs/source/_static/embed-bundle.js b/docs/source/_static/embed-bundle.js new file mode 100644 index 0000000..c8e659a --- /dev/null +++ b/docs/source/_static/embed-bundle.js @@ -0,0 +1,3 @@ +/*! For license information please see embed-bundle.js.LICENSE.txt */ +define("ipyopenlayers",["@jupyter-widgets/base"],(t=>(()=>{var e,i,n={4930:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var n=i(5516),r=i.n(n),s=i(1364),o=i.n(s)()(r());o.push([t.id,".lm-Widget.lm-Panel.jp-OutputArea-output.ipyopenlayer-map-container-wrapper {\n height: 100%;\n}\n.lm-Widget.lm-Panel.jp-OutputArea-child.jp-OutputArea-executeResult.ipyopenlayer-map-container-wrapper-parent {\n height: 100%;\n}\n\n.ol-container {\n height: 100%;\n width: 100%;\n}\n.jp-LinkedOutputView .jupyter-widgets.ipyopenlayer-widgets {\n min-height: 500px;\n height: 100%;\n}\n\n.jupyter-widgets.ipyopenlayer-widgets {\n height: 400px;\n overflow: hidden;\n flex: 1 1 auto;\n}\n","",{version:3,sources:["webpack://./css/widget.css"],names:[],mappings:"AAAA;EACE,YAAY;AACd;AACA;EACE,YAAY;AACd;;AAEA;EACE,YAAY;EACZ,WAAW;AACb;AACA;EACE,iBAAiB;EACjB,YAAY;AACd;;AAEA;EACE,aAAa;EACb,gBAAgB;EAChB,cAAc;AAChB",sourcesContent:[".lm-Widget.lm-Panel.jp-OutputArea-output.ipyopenlayer-map-container-wrapper {\n height: 100%;\n}\n.lm-Widget.lm-Panel.jp-OutputArea-child.jp-OutputArea-executeResult.ipyopenlayer-map-container-wrapper-parent {\n height: 100%;\n}\n\n.ol-container {\n height: 100%;\n width: 100%;\n}\n.jp-LinkedOutputView .jupyter-widgets.ipyopenlayer-widgets {\n min-height: 500px;\n height: 100%;\n}\n\n.jupyter-widgets.ipyopenlayer-widgets {\n height: 400px;\n overflow: hidden;\n flex: 1 1 auto;\n}\n"],sourceRoot:""}]);const a=o},4096:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var n=i(5516),r=i.n(n),s=i(1364),o=i.n(s)()(r());o.push([t.id,':root,\n:host {\n --ol-background-color: white;\n --ol-accent-background-color: #F5F5F5;\n --ol-subtle-background-color: rgba(128, 128, 128, 0.25);\n --ol-partial-background-color: rgba(255, 255, 255, 0.75);\n --ol-foreground-color: #333333;\n --ol-subtle-foreground-color: #666666;\n --ol-brand-color: #00AAFF;\n}\n\n.ol-box {\n box-sizing: border-box;\n border-radius: 2px;\n border: 1.5px solid var(--ol-background-color);\n background-color: var(--ol-partial-background-color);\n}\n\n.ol-mouse-position {\n top: 8px;\n right: 8px;\n position: absolute;\n}\n\n.ol-scale-line {\n background: var(--ol-partial-background-color);\n border-radius: 4px;\n bottom: 8px;\n left: 8px;\n padding: 2px;\n position: absolute;\n}\n\n.ol-scale-line-inner {\n border: 1px solid var(--ol-subtle-foreground-color);\n border-top: none;\n color: var(--ol-foreground-color);\n font-size: 10px;\n text-align: center;\n margin: 1px;\n will-change: contents, width;\n transition: all 0.25s;\n}\n\n.ol-scale-bar {\n position: absolute;\n bottom: 8px;\n left: 8px;\n}\n\n.ol-scale-bar-inner {\n display: flex;\n}\n\n.ol-scale-step-marker {\n width: 1px;\n height: 15px;\n background-color: var(--ol-foreground-color);\n float: right;\n z-index: 10;\n}\n\n.ol-scale-step-text {\n position: absolute;\n bottom: -5px;\n font-size: 10px;\n z-index: 11;\n color: var(--ol-foreground-color);\n text-shadow: -1.5px 0 var(--ol-partial-background-color), 0 1.5px var(--ol-partial-background-color), 1.5px 0 var(--ol-partial-background-color), 0 -1.5px var(--ol-partial-background-color);\n}\n\n.ol-scale-text {\n position: absolute;\n font-size: 12px;\n text-align: center;\n bottom: 25px;\n color: var(--ol-foreground-color);\n text-shadow: -1.5px 0 var(--ol-partial-background-color), 0 1.5px var(--ol-partial-background-color), 1.5px 0 var(--ol-partial-background-color), 0 -1.5px var(--ol-partial-background-color);\n}\n\n.ol-scale-singlebar {\n position: relative;\n height: 10px;\n z-index: 9;\n box-sizing: border-box;\n border: 1px solid var(--ol-foreground-color);\n}\n\n.ol-scale-singlebar-even {\n background-color: var(--ol-subtle-foreground-color);\n}\n\n.ol-scale-singlebar-odd {\n background-color: var(--ol-background-color);\n}\n\n.ol-unsupported {\n display: none;\n}\n\n.ol-viewport,\n.ol-unselectable {\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n.ol-viewport canvas {\n all: unset;\n overflow: hidden;\n}\n\n.ol-viewport {\n touch-action: pan-x pan-y;\n}\n\n.ol-selectable {\n -webkit-touch-callout: default;\n -webkit-user-select: text;\n -moz-user-select: text;\n user-select: text;\n}\n\n.ol-grabbing {\n cursor: -webkit-grabbing;\n cursor: -moz-grabbing;\n cursor: grabbing;\n}\n\n.ol-grab {\n cursor: move;\n cursor: -webkit-grab;\n cursor: -moz-grab;\n cursor: grab;\n}\n\n.ol-control {\n position: absolute;\n background-color: var(--ol-subtle-background-color);\n border-radius: 4px;\n}\n\n.ol-zoom {\n top: .5em;\n left: .5em;\n}\n\n.ol-rotate {\n top: .5em;\n right: .5em;\n transition: opacity .25s linear, visibility 0s linear;\n}\n\n.ol-rotate.ol-hidden {\n opacity: 0;\n visibility: hidden;\n transition: opacity .25s linear, visibility 0s linear .25s;\n}\n\n.ol-zoom-extent {\n top: 4.643em;\n left: .5em;\n}\n\n.ol-full-screen {\n right: .5em;\n top: .5em;\n}\n\n.ol-control button {\n display: block;\n margin: 1px;\n padding: 0;\n color: var(--ol-subtle-foreground-color);\n font-weight: bold;\n text-decoration: none;\n font-size: inherit;\n text-align: center;\n height: 1.375em;\n width: 1.375em;\n line-height: .4em;\n background-color: var(--ol-background-color);\n border: none;\n border-radius: 2px;\n}\n\n.ol-control button::-moz-focus-inner {\n border: none;\n padding: 0;\n}\n\n.ol-zoom-extent button {\n line-height: 1.4em;\n}\n\n.ol-compass {\n display: block;\n font-weight: normal;\n will-change: transform;\n}\n\n.ol-touch .ol-control button {\n font-size: 1.5em;\n}\n\n.ol-touch .ol-zoom-extent {\n top: 5.5em;\n}\n\n.ol-control button:hover,\n.ol-control button:focus {\n text-decoration: none;\n outline: 1px solid var(--ol-subtle-foreground-color);\n color: var(--ol-foreground-color);\n}\n\n.ol-zoom .ol-zoom-in {\n border-radius: 2px 2px 0 0;\n}\n\n.ol-zoom .ol-zoom-out {\n border-radius: 0 0 2px 2px;\n}\n\n.ol-attribution {\n text-align: right;\n bottom: .5em;\n right: .5em;\n max-width: calc(100% - 1.3em);\n display: flex;\n flex-flow: row-reverse;\n align-items: center;\n}\n\n.ol-attribution a {\n color: var(--ol-subtle-foreground-color);\n text-decoration: none;\n}\n\n.ol-attribution ul {\n margin: 0;\n padding: 1px .5em;\n color: var(--ol-foreground-color);\n text-shadow: 0 0 2px var(--ol-background-color);\n font-size: 12px;\n}\n\n.ol-attribution li {\n display: inline;\n list-style: none;\n}\n\n.ol-attribution li:not(:last-child):after {\n content: " ";\n}\n\n.ol-attribution img {\n max-height: 2em;\n max-width: inherit;\n vertical-align: middle;\n}\n\n.ol-attribution button {\n flex-shrink: 0;\n}\n\n.ol-attribution.ol-collapsed ul {\n display: none;\n}\n\n.ol-attribution:not(.ol-collapsed) {\n background: var(--ol-partial-background-color);\n}\n\n.ol-attribution.ol-uncollapsible {\n bottom: 0;\n right: 0;\n border-radius: 4px 0 0;\n}\n\n.ol-attribution.ol-uncollapsible img {\n margin-top: -.2em;\n max-height: 1.6em;\n}\n\n.ol-attribution.ol-uncollapsible button {\n display: none;\n}\n\n.ol-zoomslider {\n top: 4.5em;\n left: .5em;\n height: 200px;\n}\n\n.ol-zoomslider button {\n position: relative;\n height: 10px;\n}\n\n.ol-touch .ol-zoomslider {\n top: 5.5em;\n}\n\n.ol-overviewmap {\n left: 0.5em;\n bottom: 0.5em;\n}\n\n.ol-overviewmap.ol-uncollapsible {\n bottom: 0;\n left: 0;\n border-radius: 0 4px 0 0;\n}\n\n.ol-overviewmap .ol-overviewmap-map,\n.ol-overviewmap button {\n display: block;\n}\n\n.ol-overviewmap .ol-overviewmap-map {\n border: 1px solid var(--ol-subtle-foreground-color);\n height: 150px;\n width: 150px;\n}\n\n.ol-overviewmap:not(.ol-collapsed) button {\n bottom: 0;\n left: 0;\n position: absolute;\n}\n\n.ol-overviewmap.ol-collapsed .ol-overviewmap-map,\n.ol-overviewmap.ol-uncollapsible button {\n display: none;\n}\n\n.ol-overviewmap:not(.ol-collapsed) {\n background: var(--ol-subtle-background-color);\n}\n\n.ol-overviewmap-box {\n border: 1.5px dotted var(--ol-subtle-foreground-color);\n}\n\n.ol-overviewmap .ol-overviewmap-box:hover {\n cursor: move;\n}\n',"",{version:3,sources:["webpack://./node_modules/ol/ol.css"],names:[],mappings:"AAAA;;EAEE,4BAA4B;EAC5B,qCAAqC;EACrC,uDAAuD;EACvD,wDAAwD;EACxD,8BAA8B;EAC9B,qCAAqC;EACrC,yBAAyB;AAC3B;;AAEA;EACE,sBAAsB;EACtB,kBAAkB;EAClB,8CAA8C;EAC9C,oDAAoD;AACtD;;AAEA;EACE,QAAQ;EACR,UAAU;EACV,kBAAkB;AACpB;;AAEA;EACE,8CAA8C;EAC9C,kBAAkB;EAClB,WAAW;EACX,SAAS;EACT,YAAY;EACZ,kBAAkB;AACpB;;AAEA;EACE,mDAAmD;EACnD,gBAAgB;EAChB,iCAAiC;EACjC,eAAe;EACf,kBAAkB;EAClB,WAAW;EACX,4BAA4B;EAC5B,qBAAqB;AACvB;;AAEA;EACE,kBAAkB;EAClB,WAAW;EACX,SAAS;AACX;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,UAAU;EACV,YAAY;EACZ,4CAA4C;EAC5C,YAAY;EACZ,WAAW;AACb;;AAEA;EACE,kBAAkB;EAClB,YAAY;EACZ,eAAe;EACf,WAAW;EACX,iCAAiC;EACjC,6LAA6L;AAC/L;;AAEA;EACE,kBAAkB;EAClB,eAAe;EACf,kBAAkB;EAClB,YAAY;EACZ,iCAAiC;EACjC,6LAA6L;AAC/L;;AAEA;EACE,kBAAkB;EAClB,YAAY;EACZ,UAAU;EACV,sBAAsB;EACtB,4CAA4C;AAC9C;;AAEA;EACE,mDAAmD;AACrD;;AAEA;EACE,4CAA4C;AAC9C;;AAEA;EACE,aAAa;AACf;;AAEA;;EAEE,2BAA2B;EAC3B,yBAAyB;EACzB,sBAAsB;EACtB,iBAAiB;EACjB,wCAAwC;AAC1C;;AAEA;EACE,UAAU;EACV,gBAAgB;AAClB;;AAEA;EACE,yBAAyB;AAC3B;;AAEA;EACE,8BAA8B;EAC9B,yBAAyB;EACzB,sBAAsB;EACtB,iBAAiB;AACnB;;AAEA;EACE,wBAAwB;EACxB,qBAAqB;EACrB,gBAAgB;AAClB;;AAEA;EACE,YAAY;EACZ,oBAAoB;EACpB,iBAAiB;EACjB,YAAY;AACd;;AAEA;EACE,kBAAkB;EAClB,mDAAmD;EACnD,kBAAkB;AACpB;;AAEA;EACE,SAAS;EACT,UAAU;AACZ;;AAEA;EACE,SAAS;EACT,WAAW;EACX,qDAAqD;AACvD;;AAEA;EACE,UAAU;EACV,kBAAkB;EAClB,0DAA0D;AAC5D;;AAEA;EACE,YAAY;EACZ,UAAU;AACZ;;AAEA;EACE,WAAW;EACX,SAAS;AACX;;AAEA;EACE,cAAc;EACd,WAAW;EACX,UAAU;EACV,wCAAwC;EACxC,iBAAiB;EACjB,qBAAqB;EACrB,kBAAkB;EAClB,kBAAkB;EAClB,eAAe;EACf,cAAc;EACd,iBAAiB;EACjB,4CAA4C;EAC5C,YAAY;EACZ,kBAAkB;AACpB;;AAEA;EACE,YAAY;EACZ,UAAU;AACZ;;AAEA;EACE,kBAAkB;AACpB;;AAEA;EACE,cAAc;EACd,mBAAmB;EACnB,sBAAsB;AACxB;;AAEA;EACE,gBAAgB;AAClB;;AAEA;EACE,UAAU;AACZ;;AAEA;;EAEE,qBAAqB;EACrB,oDAAoD;EACpD,iCAAiC;AACnC;;AAEA;EACE,0BAA0B;AAC5B;;AAEA;EACE,0BAA0B;AAC5B;;AAEA;EACE,iBAAiB;EACjB,YAAY;EACZ,WAAW;EACX,6BAA6B;EAC7B,aAAa;EACb,sBAAsB;EACtB,mBAAmB;AACrB;;AAEA;EACE,wCAAwC;EACxC,qBAAqB;AACvB;;AAEA;EACE,SAAS;EACT,iBAAiB;EACjB,iCAAiC;EACjC,+CAA+C;EAC/C,eAAe;AACjB;;AAEA;EACE,eAAe;EACf,gBAAgB;AAClB;;AAEA;EACE,YAAY;AACd;;AAEA;EACE,eAAe;EACf,kBAAkB;EAClB,sBAAsB;AACxB;;AAEA;EACE,cAAc;AAChB;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,8CAA8C;AAChD;;AAEA;EACE,SAAS;EACT,QAAQ;EACR,sBAAsB;AACxB;;AAEA;EACE,iBAAiB;EACjB,iBAAiB;AACnB;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,UAAU;EACV,UAAU;EACV,aAAa;AACf;;AAEA;EACE,kBAAkB;EAClB,YAAY;AACd;;AAEA;EACE,UAAU;AACZ;;AAEA;EACE,WAAW;EACX,aAAa;AACf;;AAEA;EACE,SAAS;EACT,OAAO;EACP,wBAAwB;AAC1B;;AAEA;;EAEE,cAAc;AAChB;;AAEA;EACE,mDAAmD;EACnD,aAAa;EACb,YAAY;AACd;;AAEA;EACE,SAAS;EACT,OAAO;EACP,kBAAkB;AACpB;;AAEA;;EAEE,aAAa;AACf;;AAEA;EACE,6CAA6C;AAC/C;;AAEA;EACE,sDAAsD;AACxD;;AAEA;EACE,YAAY;AACd",sourcesContent:[':root,\n:host {\n --ol-background-color: white;\n --ol-accent-background-color: #F5F5F5;\n --ol-subtle-background-color: rgba(128, 128, 128, 0.25);\n --ol-partial-background-color: rgba(255, 255, 255, 0.75);\n --ol-foreground-color: #333333;\n --ol-subtle-foreground-color: #666666;\n --ol-brand-color: #00AAFF;\n}\n\n.ol-box {\n box-sizing: border-box;\n border-radius: 2px;\n border: 1.5px solid var(--ol-background-color);\n background-color: var(--ol-partial-background-color);\n}\n\n.ol-mouse-position {\n top: 8px;\n right: 8px;\n position: absolute;\n}\n\n.ol-scale-line {\n background: var(--ol-partial-background-color);\n border-radius: 4px;\n bottom: 8px;\n left: 8px;\n padding: 2px;\n position: absolute;\n}\n\n.ol-scale-line-inner {\n border: 1px solid var(--ol-subtle-foreground-color);\n border-top: none;\n color: var(--ol-foreground-color);\n font-size: 10px;\n text-align: center;\n margin: 1px;\n will-change: contents, width;\n transition: all 0.25s;\n}\n\n.ol-scale-bar {\n position: absolute;\n bottom: 8px;\n left: 8px;\n}\n\n.ol-scale-bar-inner {\n display: flex;\n}\n\n.ol-scale-step-marker {\n width: 1px;\n height: 15px;\n background-color: var(--ol-foreground-color);\n float: right;\n z-index: 10;\n}\n\n.ol-scale-step-text {\n position: absolute;\n bottom: -5px;\n font-size: 10px;\n z-index: 11;\n color: var(--ol-foreground-color);\n text-shadow: -1.5px 0 var(--ol-partial-background-color), 0 1.5px var(--ol-partial-background-color), 1.5px 0 var(--ol-partial-background-color), 0 -1.5px var(--ol-partial-background-color);\n}\n\n.ol-scale-text {\n position: absolute;\n font-size: 12px;\n text-align: center;\n bottom: 25px;\n color: var(--ol-foreground-color);\n text-shadow: -1.5px 0 var(--ol-partial-background-color), 0 1.5px var(--ol-partial-background-color), 1.5px 0 var(--ol-partial-background-color), 0 -1.5px var(--ol-partial-background-color);\n}\n\n.ol-scale-singlebar {\n position: relative;\n height: 10px;\n z-index: 9;\n box-sizing: border-box;\n border: 1px solid var(--ol-foreground-color);\n}\n\n.ol-scale-singlebar-even {\n background-color: var(--ol-subtle-foreground-color);\n}\n\n.ol-scale-singlebar-odd {\n background-color: var(--ol-background-color);\n}\n\n.ol-unsupported {\n display: none;\n}\n\n.ol-viewport,\n.ol-unselectable {\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n.ol-viewport canvas {\n all: unset;\n overflow: hidden;\n}\n\n.ol-viewport {\n touch-action: pan-x pan-y;\n}\n\n.ol-selectable {\n -webkit-touch-callout: default;\n -webkit-user-select: text;\n -moz-user-select: text;\n user-select: text;\n}\n\n.ol-grabbing {\n cursor: -webkit-grabbing;\n cursor: -moz-grabbing;\n cursor: grabbing;\n}\n\n.ol-grab {\n cursor: move;\n cursor: -webkit-grab;\n cursor: -moz-grab;\n cursor: grab;\n}\n\n.ol-control {\n position: absolute;\n background-color: var(--ol-subtle-background-color);\n border-radius: 4px;\n}\n\n.ol-zoom {\n top: .5em;\n left: .5em;\n}\n\n.ol-rotate {\n top: .5em;\n right: .5em;\n transition: opacity .25s linear, visibility 0s linear;\n}\n\n.ol-rotate.ol-hidden {\n opacity: 0;\n visibility: hidden;\n transition: opacity .25s linear, visibility 0s linear .25s;\n}\n\n.ol-zoom-extent {\n top: 4.643em;\n left: .5em;\n}\n\n.ol-full-screen {\n right: .5em;\n top: .5em;\n}\n\n.ol-control button {\n display: block;\n margin: 1px;\n padding: 0;\n color: var(--ol-subtle-foreground-color);\n font-weight: bold;\n text-decoration: none;\n font-size: inherit;\n text-align: center;\n height: 1.375em;\n width: 1.375em;\n line-height: .4em;\n background-color: var(--ol-background-color);\n border: none;\n border-radius: 2px;\n}\n\n.ol-control button::-moz-focus-inner {\n border: none;\n padding: 0;\n}\n\n.ol-zoom-extent button {\n line-height: 1.4em;\n}\n\n.ol-compass {\n display: block;\n font-weight: normal;\n will-change: transform;\n}\n\n.ol-touch .ol-control button {\n font-size: 1.5em;\n}\n\n.ol-touch .ol-zoom-extent {\n top: 5.5em;\n}\n\n.ol-control button:hover,\n.ol-control button:focus {\n text-decoration: none;\n outline: 1px solid var(--ol-subtle-foreground-color);\n color: var(--ol-foreground-color);\n}\n\n.ol-zoom .ol-zoom-in {\n border-radius: 2px 2px 0 0;\n}\n\n.ol-zoom .ol-zoom-out {\n border-radius: 0 0 2px 2px;\n}\n\n.ol-attribution {\n text-align: right;\n bottom: .5em;\n right: .5em;\n max-width: calc(100% - 1.3em);\n display: flex;\n flex-flow: row-reverse;\n align-items: center;\n}\n\n.ol-attribution a {\n color: var(--ol-subtle-foreground-color);\n text-decoration: none;\n}\n\n.ol-attribution ul {\n margin: 0;\n padding: 1px .5em;\n color: var(--ol-foreground-color);\n text-shadow: 0 0 2px var(--ol-background-color);\n font-size: 12px;\n}\n\n.ol-attribution li {\n display: inline;\n list-style: none;\n}\n\n.ol-attribution li:not(:last-child):after {\n content: " ";\n}\n\n.ol-attribution img {\n max-height: 2em;\n max-width: inherit;\n vertical-align: middle;\n}\n\n.ol-attribution button {\n flex-shrink: 0;\n}\n\n.ol-attribution.ol-collapsed ul {\n display: none;\n}\n\n.ol-attribution:not(.ol-collapsed) {\n background: var(--ol-partial-background-color);\n}\n\n.ol-attribution.ol-uncollapsible {\n bottom: 0;\n right: 0;\n border-radius: 4px 0 0;\n}\n\n.ol-attribution.ol-uncollapsible img {\n margin-top: -.2em;\n max-height: 1.6em;\n}\n\n.ol-attribution.ol-uncollapsible button {\n display: none;\n}\n\n.ol-zoomslider {\n top: 4.5em;\n left: .5em;\n height: 200px;\n}\n\n.ol-zoomslider button {\n position: relative;\n height: 10px;\n}\n\n.ol-touch .ol-zoomslider {\n top: 5.5em;\n}\n\n.ol-overviewmap {\n left: 0.5em;\n bottom: 0.5em;\n}\n\n.ol-overviewmap.ol-uncollapsible {\n bottom: 0;\n left: 0;\n border-radius: 0 4px 0 0;\n}\n\n.ol-overviewmap .ol-overviewmap-map,\n.ol-overviewmap button {\n display: block;\n}\n\n.ol-overviewmap .ol-overviewmap-map {\n border: 1px solid var(--ol-subtle-foreground-color);\n height: 150px;\n width: 150px;\n}\n\n.ol-overviewmap:not(.ol-collapsed) button {\n bottom: 0;\n left: 0;\n position: absolute;\n}\n\n.ol-overviewmap.ol-collapsed .ol-overviewmap-map,\n.ol-overviewmap.ol-uncollapsible button {\n display: none;\n}\n\n.ol-overviewmap:not(.ol-collapsed) {\n background: var(--ol-subtle-background-color);\n}\n\n.ol-overviewmap-box {\n border: 1.5px dotted var(--ol-subtle-foreground-color);\n}\n\n.ol-overviewmap .ol-overviewmap-box:hover {\n cursor: move;\n}\n'],sourceRoot:""}]);const a=o},1364:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var i="",n=void 0!==e[5];return e[4]&&(i+="@supports (".concat(e[4],") {")),e[2]&&(i+="@media ".concat(e[2]," {")),n&&(i+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),i+=t(e),n&&(i+="}"),e[2]&&(i+="}"),e[4]&&(i+="}"),i})).join("")},e.i=function(t,i,n,r,s){"string"==typeof t&&(t=[[null,t,void 0]]);var o={};if(n)for(var a=0;a0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=s),i&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=i):c[2]=i),r&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=r):c[4]="".concat(r)),e.push(c))}},e}},5516:t=>{"use strict";t.exports=function(t){var e=t[1],i=t[3];if(!i)return e;if("function"==typeof btoa){var n=btoa(unescape(encodeURIComponent(JSON.stringify(i)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(n),s="/*# ".concat(r," */");return[e].concat([s]).join("\n")}return[e].join("\n")}},7700:t=>{"use strict";function e(t,e,n){n=n||2;var s,o,a,l,u,d,f,p=e&&e.length,m=p?e[0]*n:t.length,_=i(t,0,m,n,!0),v=[];if(!_||_.next===_.prev)return v;if(p&&(_=function(t,e,n,r){var s,o,a,l=[];for(s=0,o=e.length;s80*n){s=a=t[0],o=l=t[1];for(var y=n;ya&&(a=u),d>l&&(l=d);f=0!==(f=Math.max(a-s,l-o))?32767/f:0}return r(_,v,n,s,o,f,0),v}function i(t,e,i,n,r){var s,o;if(r===C(t,e,i,n)>0)for(s=e;s=e;s-=n)o=w(s,t[s],t[s+1],o);return o&&_(o,o.next)&&(b(o),o=o.next),o}function n(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!_(n,n.next)&&0!==m(n.prev,n,n.next))n=n.next;else{if(b(n),(n=e=n.prev)===n.next)break;i=!0}}while(i||n!==e);return e}function r(t,e,i,h,c,u,g){if(t){!g&&u&&function(t,e,i,n){var r=t;do{0===r.z&&(r.z=d(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,i,n,r,s,o,a,l,h=1;do{for(i=t,t=null,s=null,o=0;i;){for(o++,n=i,a=0,e=0;e0||l>0&&n;)0!==a&&(0===l||!n||i.z<=n.z)?(r=i,i=i.nextZ,a--):(r=n,n=n.nextZ,l--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,h*=2}while(o>1)}(r)}(t,h,c,u);for(var f,p,m=t;t.prev!==t.next;)if(f=t.prev,p=t.next,u?o(t,h,c,u):s(t))e.push(f.i/i|0),e.push(t.i/i|0),e.push(p.i/i|0),b(t),t=p.next,m=p.next;else if((t=p)===m){g?1===g?r(t=a(n(t),e,i),e,i,h,c,u,2):2===g&&l(t,e,i,h,c,u):r(n(t),e,i,h,c,u,1);break}}}function s(t){var e=t.prev,i=t,n=t.next;if(m(e,i,n)>=0)return!1;for(var r=e.x,s=i.x,o=n.x,a=e.y,l=i.y,h=n.y,c=rs?r>o?r:o:s>o?s:o,g=a>l?a>h?a:h:l>h?l:h,p=n.next;p!==e;){if(p.x>=c&&p.x<=d&&p.y>=u&&p.y<=g&&f(r,a,s,l,o,h,p.x,p.y)&&m(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function o(t,e,i,n){var r=t.prev,s=t,o=t.next;if(m(r,s,o)>=0)return!1;for(var a=r.x,l=s.x,h=o.x,c=r.y,u=s.y,g=o.y,p=al?a>h?a:h:l>h?l:h,y=c>u?c>g?c:g:u>g?u:g,x=d(p,_,e,i,n),E=d(v,y,e,i,n),A=t.prevZ,w=t.nextZ;A&&A.z>=x&&w&&w.z<=E;){if(A.x>=p&&A.x<=v&&A.y>=_&&A.y<=y&&A!==r&&A!==o&&f(a,c,l,u,h,g,A.x,A.y)&&m(A.prev,A,A.next)>=0)return!1;if(A=A.prevZ,w.x>=p&&w.x<=v&&w.y>=_&&w.y<=y&&w!==r&&w!==o&&f(a,c,l,u,h,g,w.x,w.y)&&m(w.prev,w,w.next)>=0)return!1;w=w.nextZ}for(;A&&A.z>=x;){if(A.x>=p&&A.x<=v&&A.y>=_&&A.y<=y&&A!==r&&A!==o&&f(a,c,l,u,h,g,A.x,A.y)&&m(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;w&&w.z<=E;){if(w.x>=p&&w.x<=v&&w.y>=_&&w.y<=y&&w!==r&&w!==o&&f(a,c,l,u,h,g,w.x,w.y)&&m(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function a(t,e,i){var r=t;do{var s=r.prev,o=r.next.next;!_(s,o)&&v(s,r,r.next,o)&&E(s,o)&&E(o,s)&&(e.push(s.i/i|0),e.push(r.i/i|0),e.push(o.i/i|0),b(r),b(r.next),r=t=o),r=r.next}while(r!==t);return n(r)}function l(t,e,i,s,o,a){var l=t;do{for(var h=l.next.next;h!==l.prev;){if(l.i!==h.i&&p(l,h)){var c=A(l,h);return l=n(l,l.next),c=n(c,c.next),r(l,e,i,s,o,a,0),void r(c,e,i,s,o,a,0)}h=h.next}l=l.next}while(l!==t)}function h(t,e){return t.x-e.x}function c(t,e){var i=function(t,e){var i,n=e,r=t.x,s=t.y,o=-1/0;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){var a=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=r&&a>o&&(o=a,i=n.x=n.x&&n.x>=c&&r!==n.x&&f(si.x||n.x===i.x&&u(i,n)))&&(i=n,g=l)),n=n.next}while(n!==h);return i}(t,e);if(!i)return e;var r=A(i,t);return n(r,r.next),n(i,i.next)}function u(t,e){return m(t.prev,t,e.prev)<0&&m(e.next,t,t.next)<0}function d(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function g(t){var e=t,i=t;do{(e.x=(t-o)*(s-a)&&(t-o)*(n-a)>=(i-o)*(e-a)&&(i-o)*(s-a)>=(r-o)*(n-a)}function p(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&v(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(E(t,e)&&E(e,t)&&function(t,e){var i=t,n=!1,r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(m(t.prev,t,e.prev)||m(t,e.prev,e))||_(t,e)&&m(t.prev,t,t.next)>0&&m(e.prev,e,e.next)>0)}function m(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function _(t,e){return t.x===e.x&&t.y===e.y}function v(t,e,i,n){var r=x(m(t,e,i)),s=x(m(t,e,n)),o=x(m(i,n,t)),a=x(m(i,n,e));return r!==s&&o!==a||!(0!==r||!y(t,i,e))||!(0!==s||!y(t,n,e))||!(0!==o||!y(i,t,n))||!(0!==a||!y(i,e,n))}function y(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function x(t){return t>0?1:t<0?-1:0}function E(t,e){return m(t.prev,t,t.next)<0?m(t,e,t.next)>=0&&m(t,t.prev,e)>=0:m(t,e,t.prev)<0||m(t,t.next,e)<0}function A(t,e){var i=new T(t.i,t.x,t.y),n=new T(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function w(t,e,i,n){var r=new T(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function b(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function T(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function C(t,e,i,n){for(var r=0,s=e,o=i-n;s0&&(n+=t[r-1].length,i.holes.push(n))}return i}},9029:(t,e)=>{e.read=function(t,e,i,n,r){var s,o,a=8*r-n-1,l=(1<>1,c=-7,u=i?r-1:0,d=i?-1:1,g=t[e+u];for(u+=d,s=g&(1<<-c)-1,g>>=-c,c+=a;c>0;s=256*s+t[e+u],u+=d,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=n;c>0;o=256*o+t[e+u],u+=d,c-=8);if(0===s)s=1-h;else{if(s===l)return o?NaN:1/0*(g?-1:1);o+=Math.pow(2,n),s-=h}return(g?-1:1)*o*Math.pow(2,s-n)},e.write=function(t,e,i,n,r,s){var o,a,l,h=8*s-r-1,c=(1<>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:s-1,f=n?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+u>=1?d/l:d*Math.pow(2,1-u))*l>=2&&(o++,l/=2),o+u>=c?(a=0,o=c):o+u>=1?(a=(e*l-1)*Math.pow(2,r),o+=u):(a=e*Math.pow(2,u-1)*Math.pow(2,r),o=0));r>=8;t[i+g]=255&a,g+=f,a/=256,r-=8);for(o=o<0;t[i+g]=255&o,g+=f,o/=256,h-=8);t[i+g-f]|=128*p}},3789:(t,e,i)=>{"use strict";t.exports=r;var n=i(9029);function r(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}r.Varint=0,r.Fixed64=1,r.Bytes=2,r.Fixed32=5;var s=4294967296,o=1/s,a="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function l(t){return t.type===r.Bytes?t.readVarint()+t.pos:t.pos+1}function h(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function c(t,e,i){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(var r=i.pos-1;r>=t;r--)i.buf[r+n]=i.buf[r]}function u(t,e){for(var i=0;i>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function A(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}r.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos>3,s=this.pos;this.type=7&n,t(r,e,this),this.pos===s&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=x(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=A(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=x(this.buf,this.pos)+x(this.buf,this.pos+4)*s;return this.pos+=8,t},readSFixed64:function(){var t=x(this.buf,this.pos)+A(this.buf,this.pos+4)*s;return this.pos+=8,t},readFloat:function(){var t=n.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=n.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,n=this.buf;return e=127&(i=n[this.pos++]),i<128?e:(e|=(127&(i=n[this.pos++]))<<7,i<128?e:(e|=(127&(i=n[this.pos++]))<<14,i<128?e:(e|=(127&(i=n[this.pos++]))<<21,i<128?e:function(t,e,i){var n,r,s=i.buf;if(n=(112&(r=s[i.pos++]))>>4,r<128)return h(t,n,e);if(n|=(127&(r=s[i.pos++]))<<3,r<128)return h(t,n,e);if(n|=(127&(r=s[i.pos++]))<<10,r<128)return h(t,n,e);if(n|=(127&(r=s[i.pos++]))<<17,r<128)return h(t,n,e);if(n|=(127&(r=s[i.pos++]))<<24,r<128)return h(t,n,e);if(n|=(1&(r=s[i.pos++]))<<31,r<128)return h(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&a?function(t,e,i){return a.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){for(var n="",r=e;r239?4:l>223?3:l>191?2:1;if(r+c>i)break;1===c?l<128&&(h=l):2===c?128==(192&(s=t[r+1]))&&(h=(31&l)<<6|63&s)<=127&&(h=null):3===c?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&((h=(15&l)<<12|(63&s)<<6|63&o)<=2047||h>=55296&&h<=57343)&&(h=null)):4===c&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&((h=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)<=65535||h>=1114112)&&(h=null)),null===h?(h=65533,c=1):h>65535&&(h-=65536,n+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),n+=String.fromCharCode(h),r+=c}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==r.Bytes)return t.push(this.readVarint(e));var i=l(this);for(t=t||[];this.pos127;);else if(e===r.Bytes)this.pos=this.readVarint()+this.pos;else if(e===r.Fixed32)this.pos+=4;else{if(e!==r.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var i,n;if(t>=0?(i=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,e),function(t,e){var i=(7&t)<<4;e.buf[e.pos++]|=i|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,i){for(var n,r,s=0;s55295&&n<57344){if(!r){n>56319||s+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&c(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),n.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),n.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i=128&&c(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,r.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,u,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,d,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,p,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,g,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,f,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,m,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,_,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,v,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,y,e)},writeBytesField:function(t,e){this.writeTag(t,r.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,r.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,r.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,r.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,r.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,r.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,r.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,r.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,r.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,r.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}},8495:function(t){t.exports=function(){"use strict";function t(t,n,r,s,o){!function t(i,n,r,s,o){for(;s>r;){if(s-r>600){var a=s-r+1,l=n-r+1,h=Math.log(a),c=.5*Math.exp(2*h/3),u=.5*Math.sqrt(h*c*(a-c)/a)*(l-a/2<0?-1:1);t(i,n,Math.max(r,Math.floor(n-l*c/a+u)),Math.min(s,Math.floor(n+(a-l)*c/a+u)),o)}var d=i[n],g=r,f=s;for(e(i,r,n),o(i[s],d)>0&&e(i,r,s);g0;)f--}0===o(i[r],d)?e(i,r,f):e(i,++f,s),f<=n&&(r=f+1),n<=f&&(s=f-1)}}(t,n,r||0,s||t.length-1,o||i)}function e(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function i(t,e){return te?1:0}var n=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function r(t,e,i){if(!i)return e.indexOf(t);for(var n=0;n=t.minX&&e.maxY>=t.minY}function f(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function p(e,i,n,r,s){for(var o=[i,n];o.length;)if(!((n=o.pop())-(i=o.pop())<=r)){var a=i+Math.ceil((n-i)/r/2)*r;t(e,a,i,n,s),o.push(i,a,a,n)}}return n.prototype.all=function(){return this._all(this.data,[])},n.prototype.search=function(t){var e=this.data,i=[];if(!g(t,e))return i;for(var n=this.toBBox,r=[];e;){for(var s=0;s=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)},n.prototype._split=function(t,e){var i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);var o=this._chooseSplitIndex(i,r,n),a=f(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,s(i,this.toBBox),s(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)},n.prototype._splitRoot=function(t,e){this.data=f([t,e]),this.data.height=t.height+1,this.data.leaf=!1,s(this.data,this.toBBox)},n.prototype._chooseSplitIndex=function(t,e,i){for(var n,r,s,a,l,h,u,d=1/0,g=1/0,f=e;f<=i-e;f++){var p=o(t,0,f,this.toBBox),m=o(t,f,i,this.toBBox),_=(r=p,s=m,void 0,void 0,void 0,void 0,a=Math.max(r.minX,s.minX),l=Math.max(r.minY,s.minY),h=Math.min(r.maxX,s.maxX),u=Math.min(r.maxY,s.maxY),Math.max(0,h-a)*Math.max(0,u-l)),v=c(p)+c(m);_=e;g--){var f=t.children[g];a(l,t.leaf?r(f):f),h+=u(l)}return h},n.prototype._adjustParentBBoxes=function(t,e,i){for(var n=i;n>=0;n--)a(e[n],t)},n.prototype._condense=function(t){for(var e=t.length-1,i=void 0;e>=0;e--)0===t[e].children.length?e>0?(i=t[e-1].children).splice(i.indexOf(t[e]),1):this.clear():s(t[e],this.toBBox)},n}()},4061:t=>{function e(t,e){const i=new RegExp(e,"g"),n=t.match(i);return n?n.length:0}t.exports=e,t.exports.default=e},2066:(t,e,i)=>{const n=i(1512),r=i(7620),s=i(4061);function o(t,e,i){const o=i&&i.debug||!1,a=!(i&&!1===typeof i.nested),l=i&&i.startIndex||0;o&&console.log("[xml-utils] starting findTagByName with",e," and ",i);const h=n(t,`<${e}[ \n>/]`,l);if(o&&console.log("[xml-utils] start:",h),-1===h)return;const c=t.slice(h+e.length);let u=r(c,"^[^<]*[ /]>",0);const d=-1!==u&&"/"===c[u-1];if(o&&console.log("[xml-utils] selfClosing:",d),!1===d)if(a){let t=0,i=1,n=0;for(;-1!==(u=r(c,"[ /]"+e+">",t));){const r=c.substring(t,u+1);if(i+=s(r,"<"+e+"[ \n\t>]"),n+=s(r,""),n>=i)break;t=u}}else u=r(c,"[ /]"+e+">",0);const g=h+e.length+u+1;if(o&&console.log("[xml-utils] end:",g),-1===g)return;const f=t.slice(h,g);let p;return p=d?null:f.slice(f.indexOf(">")+1,f.lastIndexOf("<")),{inner:p,outer:f,start:h,end:g}}t.exports=o,t.exports.default=o},2585:(t,e,i)=>{const n=i(2066);function r(t,e,i){const r=[],s=i&&i.debug||!1,o=!i||"boolean"!=typeof i.nested||i.nested;let a,l=i&&i.startIndex||0;for(;a=n(t,e,{debug:s,startIndex:l});)l=o?a.start+1+e.length:a.end,r.push(a);return s&&console.log("findTagsByName found",r.length,"tags"),r}t.exports=r,t.exports.default=r},845:t=>{function e(t,e,i){const n=i&&i.debug||!1;n&&console.log("[xml-utils] getting "+e+" in "+t);const r="object"==typeof t?t.outer:t,s=r.slice(0,r.indexOf(">")+1),o=['"',"'"];for(let t=0;t{function e(t,e,i){const n=new RegExp(e).exec(t.slice(i));return n?i+n.index+n[0].length-1:-1}t.exports=e,t.exports.default=e},1512:t=>{function e(t,e,i){const n=new RegExp(e).exec(t.slice(i));return n?i+n.index:-1}t.exports=e,t.exports.default=e},1463:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>_});var n=i(5072),r=i.n(n),s=i(7825),o=i.n(s),a=i(40),l=i.n(a),h=i(5056),c=i.n(h),u=i(540),d=i.n(u),g=i(1113),f=i.n(g),p=i(4930),m={};m.styleTagTransform=f(),m.setAttributes=c(),m.insert=l().bind(null,"head"),m.domAPI=o(),m.insertStyleElement=d(),r()(p.A,m);const _=p.A&&p.A.locals?p.A.locals:void 0},5045:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>_});var n=i(5072),r=i.n(n),s=i(7825),o=i.n(s),a=i(40),l=i.n(a),h=i(5056),c=i.n(h),u=i(540),d=i.n(u),g=i(1113),f=i.n(g),p=i(4096),m={};m.styleTagTransform=f(),m.setAttributes=c(),m.insert=l().bind(null,"head"),m.domAPI=o(),m.insertStyleElement=d(),r()(p.A,m);const _=p.A&&p.A.locals?p.A.locals:void 0},5072:t=>{"use strict";var e=[];function i(t){for(var i=-1,n=0;n{"use strict";var e={};t.exports=function(t,i){var n=function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(t){i=null}e[t]=i}return e[t]}(t);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(i)}},540:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},5056:(t,e,i)=>{"use strict";t.exports=function(t){var e=i.nc;e&&t.setAttribute("nonce",e)}},7825:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(i){!function(t,e,i){var n="";i.supports&&(n+="@supports (".concat(i.supports,") {")),i.media&&(n+="@media ".concat(i.media," {"));var r=void 0!==i.layer;r&&(n+="@layer".concat(i.layer.length>0?" ".concat(i.layer):""," {")),n+=i.css,r&&(n+="}"),i.media&&(n+="}"),i.supports&&(n+="}");var s=i.sourceMap;s&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),e.styleTagTransform(n,t,e.options)}(e,t,i)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},1113:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},1646:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BaseControlView=e.BaseControlModel=void 0,i(5045),i(1463);const n=i(2055);i(5045);const r=i(5672);i(1463);class s extends n.DOMWidgetModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:s.model_name,_model_module:s.model_module,_model_module_version:s.model_module_version,_view_name:s.view_name,_view_module:s.view_module,_view_module_version:s.view_module_version})}}e.BaseControlModel=s,s.serializers=Object.assign({},n.DOMWidgetModel.serializers),s.model_name="BaseControlModel",s.model_module=r.MODULE_NAME,s.model_module_version=r.MODULE_VERSION,s.view_name="BaseControlView",s.view_module=r.MODULE_NAME,s.view_module_version=r.MODULE_VERSION;class o extends n.DOMWidgetView{render(){super.render(),this.createObj()}}e.BaseControlView=o},5979:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.BaseOverlayView=e.BaseOverlayModel=void 0;const r=i(2055);i(5045);const s=i(5672);i(1463);const o=n(i(9519));class a extends r.DOMWidgetModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:a.model_name,_model_module:a.model_module,_model_module_version:a.model_module_version,_view_name:a.view_name,_view_module:a.view_module,_view_module_version:a.view_module_version})}}e.BaseOverlayModel=a,a.serializers=Object.assign({},r.DOMWidgetModel.serializers),a.model_name="BaseOverlayModel",a.model_module=s.MODULE_NAME,a.model_module_version=s.MODULE_VERSION,a.view_name="BaseOverlayView",a.view_module=s.MODULE_NAME,a.view_module_version=s.MODULE_VERSION;class l extends r.DOMWidgetView{render(){super.render(),this.createElement(),this.createOverlay(),this.model_events()}createOverlay(){const t=this.model.get("position");return this.overlay=new o.default({position:t,element:this.element}),this.overlay}model_events(){this.listenTo(this.model,"change:position",this.updatePosition)}updatePosition(){const t=this.model.get("position");this.overlay.setPosition(t)}}e.BaseOverlayView=l},4911:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.FullScreenView=e.FullScreenModel=void 0;const r=i(2055),s=i(1646),o=n(i(4368));i(5045);const a=i(5672);i(1463);class l extends s.BaseControlModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:l.model_name,_model_module:l.model_module,_model_module_version:l.model_module_version,_view_name:l.view_name,_view_module:l.view_module,_view_module_version:l.view_module_version})}}e.FullScreenModel=l,l.serializers=Object.assign({},r.DOMWidgetModel.serializers),l.model_name="FullScreenModel",l.model_module=a.MODULE_NAME,l.model_module_version=a.MODULE_VERSION,l.view_name="FullScreenView",l.view_module=a.MODULE_NAME,l.view_module_version=a.MODULE_VERSION;class h extends s.BaseControlView{createObj(){this.obj=new o.default({className:"ol-full-screen"})}}e.FullScreenView=h},3683:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.OpenLayersGeoJSONView=e.OpenLayersGeoJSONModel=void 0;const r=i(2055);i(5045);const s=i(5672);i(1463);const o=n(i(2004)),a=i(9806),l=i(9340),h=i(7173),c=i(3185);class u extends c.LayerModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:u.model_name,_model_module:u.model_module,_model_module_version:u.model_module_version,_view_name:u.view_name,_view_module:u.view_module,_view_module_version:u.view_module_version,layers:[]})}}e.OpenLayersGeoJSONModel=u,u.serializers=Object.assign({},r.DOMWidgetModel.serializers),u.model_name="OpenLayersGeoJSONModel",u.model_module=s.MODULE_NAME,u.model_module_version=s.MODULE_VERSION,u.view_name="OpenLayersGeoJSONView",u.view_module=s.MODULE_NAME,u.view_module_version=s.MODULE_VERSION;class d extends c.LayerView{constructor(){super(...arguments),this.invisibleStyle=new a.Style({fill:new a.Fill({color:"rgba(0, 0, 0, 0)"}),stroke:new a.Stroke({color:"rgba(0, 0, 0, 0)",width:0})})}render(){this.initVectorLayer(),this.create_obj(),this.modelEvents()}create_obj(){this.obj=this.vectorLayer}initVectorLayer(){this.vectorSource=new l.Vector({features:(new o.default).readFeatures(this.model.get("data"))}),this.vectorLayer=new h.Vector({source:this.vectorSource,style:this.createStyleFunction()})}createStyleFunction(){const t=this.model.get("style")||{};return e=>new a.Style({stroke:new a.Stroke({color:t.strokeColor||"#3399CC",width:t.strokeWidth||1.25}),fill:new a.Fill({color:t.fillColor||"rgba(255, 255, 255, 0.4)"}),image:new a.Circle({radius:t.pointRadius||5,fill:new a.Fill({color:t.pointFillColor||"#FF0000"}),stroke:new a.Stroke({color:t.pointStrokeColor||"#000000",width:t.pointStrokeWidth||1})})})}updateStyle(){this.vectorLayer.setStyle(this.createStyleFunction())}updateVisibility(){const t=this.model.get("visible");this.vectorSource.getFeatures().forEach((e=>{e.setStyle(t?void 0:this.invisibleStyle)}))}updateData(){this.vectorSource.clear(),this.vectorSource.addFeatures((new o.default).readFeatures(this.model.get("data")))}modelEvents(){this.listenTo(this.model,"change:style",this.updateStyle),this.listenTo(this.model,"change:data",this.updateData),this.listenTo(this.model,"change:visible",this.updateVisibility)}}e.OpenLayersGeoJSONView=d},1665:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.GeoTIFFTileLayerView=e.GeoTIFFTileLayerModel=void 0;const r=i(2055),s=n(i(3828)),o=n(i(5913)),a=i(5672),l=i(3185);class h extends l.LayerModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:h.model_name,_model_module:h.model_module,_model_module_version:h.model_module_version,_view_name:h.view_name,_view_module:h.view_module,_view_module_version:h.view_module_version,url:""})}}e.GeoTIFFTileLayerModel=h,h.serializers=Object.assign({},r.DOMWidgetModel.serializers),h.model_name="GeoTIFFTileLayerModel",h.model_module=a.MODULE_NAME,h.model_module_version=a.MODULE_VERSION,h.view_name="GeoTIFFTileLayerView",h.view_module=a.MODULE_NAME,h.view_module_version=a.MODULE_VERSION;class c extends l.LayerView{render(){super.render(),this.sourcesChanged(),this.model.on("change:url",this.sourcesChanged,this)}create_obj(){const t=this.model.get("url");t&&(this.obj=new s.default({source:new o.default({sources:[{url:t}]})}))}sourcesChanged(){const t=this.model.get("url");if(t){const e=new o.default({sources:[{url:t}]});this.obj.setSource(e)}}}e.GeoTIFFTileLayerView=c},3096:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.HeatmapLayerView=e.HeatmapLayerModel=void 0;const r=i(3185),s=i(5672),o=n(i(9145)),a=i(9340),l=n(i(6097)),h=n(i(250));class c extends r.LayerModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:c.model_name,_model_module:c.model_module,_model_module_version:c.model_module_version,_view_name:c.view_name,_view_module:c.view_module,_view_module_version:c.view_module_version,blur:15,radius:8,points:[]})}}e.HeatmapLayerModel=c,c.serializers=Object.assign({},r.LayerModel.serializers),c.model_name="HeatmapLayerModel",c.model_module=s.MODULE_NAME,c.model_module_version=s.MODULE_VERSION,c.view_name="HeatmapLayerView",c.view_module=s.MODULE_NAME,c.view_module_version=s.MODULE_VERSION;class u extends r.LayerView{render(){this.create_obj(),this.modelEvents()}create_obj(){const t=new a.Vector({features:this.model.get("points").map((t=>{const e=new l.default(new h.default([t[1],t[0]]));return e.set("weight",t[2]),e}))});this.obj=new o.default({source:t,blur:this.model.get("blur"),radius:this.model.get("radius")})}modelEvents(){this.model.on("change:blur",this.update_blur,this),this.model.on("change:radius",this.update_radius,this),this.model.on("change:points",this.update_points,this)}update_blur(){this.obj.setBlur(this.model.get("blur"))}update_radius(){this.obj.setRadius(this.model.get("radius"))}update_points(){const t=new a.Vector({features:this.model.get("points").map((t=>{const e=new l.default(new h.default([t[1],t[0]]));return e.set("weight",t[2]),e}))});this.obj.setSource(t)}}e.HeatmapLayerView=u},3757:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ImageOverlayView=e.ImageOverlayModel=void 0;const n=i(2055),r=i(5979);i(5045);const s=i(5672);i(1463);class o extends r.BaseOverlayModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:o.model_name,_model_module:o.model_module,_model_module_version:o.model_module_version,_view_name:o.view_name,_view_module:o.view_module,_view_module_version:o.view_module_version,image_url:""})}}e.ImageOverlayModel=o,o.serializers=Object.assign({},n.DOMWidgetModel.serializers),o.model_name="ImageOverlayModel",o.model_module=s.MODULE_NAME,o.model_module_version=s.MODULE_VERSION,o.view_name="ImageOverlayView",o.view_module=s.MODULE_NAME,o.view_module_version=s.MODULE_VERSION;class a extends r.BaseOverlayView{render(){super.render(),this.updateImageElement()}createElement(){this.element=document.createElement("img")}model_events(){super.model_events(),this.listenTo(this.model,"change:image_url",this.updateImageElement)}updateImageElement(){const t=this.model.get("image_url");t&&(this.element.src=t)}}e.ImageOverlayView=a},8156:function(t,e,i){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(e,i);r&&!("get"in r?!e.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,n,r)}:function(t,e,i,n){void 0===n&&(n=i),t[n]=e[i]}),r=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),r(i(5672),e),r(i(2110),e)},3185:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LayerView=e.LayerModel=void 0;const n=i(2055),r=i(5672);class s extends n.WidgetModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:s.model_name,_model_module:s.model_module,_model_module_version:s.model_module_version,_view_name:s.view_name,_view_module:s.view_module,_view_module_version:s.view_module_version,value:"Hello World"})}}e.LayerModel=s,s.serializers=Object.assign({},n.WidgetModel.serializers),s.model_name="LayerModel",s.model_module=r.MODULE_NAME,s.model_module_version=r.MODULE_VERSION,s.view_name="LayerView",s.view_module=r.MODULE_NAME,s.view_module_version=r.MODULE_VERSION;class o extends n.WidgetView{render(){super.render(),this.create_obj()}}e.LayerView=o},972:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.MousePositionView=e.MousePositionModel=void 0;const r=i(2055),s=i(1646),o=n(i(6493));i(5045);const a=i(5672);i(1463);class l extends s.BaseControlModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:l.model_name,_model_module:l.model_module,_model_module_version:l.model_module_version,_view_name:l.view_name,_view_module:l.view_module,_view_module_version:l.view_module_version})}}e.MousePositionModel=l,l.serializers=Object.assign({},r.DOMWidgetModel.serializers),l.model_name="MousePositionModel",l.model_module=a.MODULE_NAME,l.model_module_version=a.MODULE_VERSION,l.view_name="MousePositionView",l.view_module=a.MODULE_NAME,l.view_module_version=a.MODULE_VERSION;class h extends s.BaseControlView{createObj(){this.obj=new o.default({className:"ol-mouse-position"})}}e.MousePositionView=h},2076:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PopupOverlayView=e.PopupOverlayModel=void 0;const n=i(2055);i(5045);const r=i(5672);i(1463);const s=i(5979);class o extends s.BaseOverlayModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:o.model_name,_model_module:o.model_module,_model_module_version:o.model_module_version,_view_name:o.view_name,_view_module:o.view_module,_view_module_version:o.view_module_version})}}e.PopupOverlayModel=o,o.serializers=Object.assign({},n.DOMWidgetModel.serializers),o.model_name="PopupOverlayModel",o.model_module=r.MODULE_NAME,o.model_module_version=r.MODULE_VERSION,o.view_name="PopupOverlayView",o.view_module=r.MODULE_NAME,o.view_module_version=r.MODULE_VERSION;class a extends s.BaseOverlayView{render(){super.render(),this.updatePopupElement()}createElement(){this.element=document.createElement("div")}model_events(){super.model_events(),this.listenTo(this.model,"change:popup_content",this.updatePopupElement)}updatePopupElement(){const t=this.model.get("popup_content");t&&(this.element.innerHTML=t)}}e.PopupOverlayView=a},4534:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.RasterTileLayerView=e.RasterTileLayerModel=void 0;const r=i(2055),s=n(i(3828)),o=n(i(5778)),a=i(5672),l=i(3185);class h extends l.LayerModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:h.model_name,_model_module:h.model_module,_model_module_version:h.model_module_version,_view_name:h.view_name,_view_module:h.view_module,_view_module_version:h.view_module_version,layers:[],url:"",attributions:[],tileSize:256,max_zoom:19,min_zoom:0})}}e.RasterTileLayerModel=h,h.serializers=Object.assign({},r.DOMWidgetModel.serializers),h.model_name="RasterTileLayerModel",h.model_module=a.MODULE_NAME,h.model_module_version=a.MODULE_VERSION,h.view_name="RasterTileLayerView",h.view_module=a.MODULE_NAME,h.view_module_version=a.MODULE_VERSION;class c extends l.LayerView{render(){super.render(),this.urlChanged(),this.model.on("change:url",this.urlChanged,this)}create_obj(){this.obj=this.tileLayer=new s.default({source:new o.default({url:this.model.get("url"),attributions:this.model.get("attributions"),tileSize:this.model.get("tileSize"),maxZoom:this.model.get("max_zoom"),minZoom:this.model.get("min_zoom")})})}urlChanged(){const t=this.model.get("url");if(t){const e=new o.default({url:t,attributions:this.model.get("attributions"),tileSize:this.model.get("tileSize"),maxZoom:this.model.get("max_zoom"),minZoom:this.model.get("min_zoom")});this.tileLayer.setSource(e)}}}e.RasterTileLayerView=c},9716:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.ScaleLineView=e.ScaleLineModel=void 0;const r=i(2055),s=i(1646),o=n(i(1201));i(5045);const a=i(5672);i(1463);class l extends s.BaseControlModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:l.model_name,_model_module:l.model_module,_model_module_version:l.model_module_version,_view_name:l.view_name,_view_module:l.view_module,_view_module_version:l.view_module_version})}}e.ScaleLineModel=l,l.serializers=Object.assign({},r.DOMWidgetModel.serializers),l.model_name="ScaleLineModel",l.model_module=a.MODULE_NAME,l.model_module_version=a.MODULE_VERSION,l.view_name="ScaleLineView",l.view_module=a.MODULE_NAME,l.view_module_version=a.MODULE_VERSION;class h extends s.BaseControlView{createObj(){this.obj=new o.default({className:"ol-scale-line"})}}e.ScaleLineView=h},3940:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.VectorTileLayerView=e.VectorTileLayerModel=void 0;const r=i(2055),s=n(i(6030)),o=n(i(2618)),a=i(5672),l=i(3185),h=i(1990),c=n(i(1898)),u=n(i(2004)),d=n(i(8861)),g=i(9806);class f extends l.LayerModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:f.model_name,_model_module:f.model_module,_model_module_version:f.model_module_version,_view_name:f.view_name,_view_module:f.view_module,_view_module_version:f.view_module_version,features:[]})}}e.VectorTileLayerModel=f,f.serializers=Object.assign({},r.DOMWidgetModel.serializers),f.model_name="VectorTileLayerModel",f.model_module=a.MODULE_NAME,f.model_module_version=a.MODULE_VERSION,f.view_name="VectorTileLayerView",f.view_module=a.MODULE_NAME,f.view_module_version=a.MODULE_VERSION;class p extends l.LayerView{render(){super.render(),this.model.on("change:url",this.urlChanged,this),this.model.on("change:style",this.styleChanged,this),this.model.on("change:visible",this.visibilityChanged,this),this.model.on("change:opacity",this.opacityChanged,this),this.model.on("change:attribution",this.attributionChanged,this),this.model.on("change:max_zoom",this.maxZoomChanged,this),this.model.on("change:min_zoom",this.minZoomChanged,this)}create_obj(){this.urlChanged(),this.styleChanged(),this.visibilityChanged(),this.opacityChanged(),this.attributionChanged(),this.maxZoomChanged(),this.minZoomChanged()}urlChanged(){const t=this.model.get("url");if(t){const e=this.model.get("source_format")||{type:"MVT"};let i;switch(e.type){case"MVT":default:i=new c.default({layerName:e.layer_name,layers:e.layers});break;case"GeoJSON":i=new u.default({dataProjection:e.dataProjection||"EPSG:4326",featureProjection:e.featureProjection,geometryName:e.geometry_name,extractGeometryName:e.extractGeometryName||!1});break;case"TopoJSON":i=new d.default({dataProjection:e.dataProjection||"EPSG:4326",layerName:e.layer_name,layers:e.layers})}const n=new o.default({format:i,url:t,tileGrid:(0,h.createXYZ)({maxZoom:19}),attributions:this.model.get("attribution"),maxZoom:this.model.get("max_zoom"),minZoom:this.model.get("min_zoom")});this.obj?this.obj.setSource(n):this.obj=new s.default({source:n,visible:this.model.get("visible"),opacity:this.model.get("opacity"),style:this.createStyleFunction()})}}visibilityChanged(){const t=this.model.get("visible");this.obj&&this.obj.setVisible(t)}opacityChanged(){const t=this.model.get("opacity");this.obj&&this.obj.setOpacity(t)}attributionChanged(){const t=this.model.get("attribution");if(this.obj){const e=this.obj.getSource();e&&e.setAttributions(t)}}maxZoomChanged(){const t=this.model.get("max_zoom");if(this.obj){const e=this.obj.getSource();e&&e.set("maxZoom",t)}}minZoomChanged(){const t=this.model.get("min_zoom");if(this.obj){const e=this.obj.getSource();e&&e.set("minZoom",t)}}styleChanged(){if(this.obj){const t=this.createStyleFunction();this.obj.setStyle(t)}}createStyleFunction(){const t=this.model.get("style")||{};return e=>new g.Style({stroke:new g.Stroke({color:t.strokeColor||"#3399CC",width:t.strokeWidth||1.25}),fill:new g.Fill({color:t.fillColor||"rgba(255, 255, 255, 0.4)"}),image:new g.Circle({radius:t.pointRadius||5,fill:new g.Fill({color:t.pointFillColor||"#0000FF"}),stroke:new g.Stroke({color:t.pointStrokeColor||"#000000",width:t.pointStrokeWidth||1})})})}}e.VectorTileLayerView=p},5672:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MODULE_NAME=e.MODULE_VERSION=void 0;const n=i(8330);e.MODULE_VERSION=n.version,e.MODULE_NAME=n.name},5460:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VideoOverlayView=e.VideoOverlayModel=void 0;const n=i(2055);i(5045);const r=i(5672);i(1463);const s=i(5979);class o extends s.BaseOverlayModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:o.model_name,_model_module:o.model_module,_model_module_version:o.model_module_version,_view_name:o.view_name,_view_module:o.view_module,_view_module_version:o.view_module_version})}}e.VideoOverlayModel=o,o.serializers=Object.assign({},n.DOMWidgetModel.serializers),o.model_name="VideoOverlayModel",o.model_module=r.MODULE_NAME,o.model_module_version=r.MODULE_VERSION,o.view_name="VideoOverlayVIew",o.view_module=r.MODULE_NAME,o.view_module_version=r.MODULE_VERSION;class a extends s.BaseOverlayView{render(){super.render(),this.updateVideoElement()}createElement(){this.element=document.createElement("div"),this.videoElement=document.createElement("video"),this.videoElement.controls=!0,this.element.appendChild(this.videoElement)}model_events(){super.model_events(),this.listenTo(this.model,"change:video_url",this.updateVideoElement)}updateVideoElement(){const t=this.model.get("video_url");t&&(this.videoElement.src=t)}}e.VideoOverlayView=a},2110:function(t,e,i){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(e,i);r&&!("get"in r?!e.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,n,r)}:function(t,e,i,n){void 0===n&&(n=i),t[n]=e[i]}),r=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)},s=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.MapView=e.MapModel=void 0;const a=i(2055),l=o(i(9621)),h=i(6187),c=o(i(9906));i(5045);const u=i(5672);i(1463);const d=i(6409),g=i(9340);r(i(3757),e),r(i(3683),e),r(i(5460),e),r(i(2076),e),r(i(7820),e),r(i(4911),e),r(i(9716),e),r(i(972),e),r(i(3096),e),r(i(4534),e),r(i(1665),e),r(i(3940),e);const f=[0,0];class p extends a.DOMWidgetModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:p.model_name,_model_module:p.model_module,_model_module_version:p.model_module_version,_view_name:p.view_name,_view_module:p.view_module,_view_module_version:p.view_module_version,layers:[],controls:[],overlays:[],zoom:2,center:f})}}e.MapModel=p,p.serializers=Object.assign(Object.assign({},a.DOMWidgetModel.serializers),{layers:{deserialize:a.unpack_models},overlays:{deserialize:a.unpack_models},controls:{deserialize:a.unpack_models}}),p.model_name="MapModel",p.model_module=u.MODULE_NAME,p.model_module_version=u.MODULE_VERSION,p.view_name="MapView",p.view_module=u.MODULE_NAME,p.view_module_version=u.MODULE_VERSION;class m extends a.DOMWidgetView{render(){(0,d.useGeographic)(),this.el.classList.add("jupyter-widgets"),this.el.classList.add("ipyopenlayer-widgets"),this.map_container=document.createElement("div"),this.map_container.classList.add("ol-container"),requestAnimationFrame((()=>{const t=this.el.parentElement;if(t){t.classList.add("ipyopenlayer-map-container-wrapper");const e=t.parentElement;e&&e.classList.add("ipyopenlayer-map-container-wrapper-parent")}})),this.el.appendChild(this.map_container),this.layerViews=new a.ViewList(this.addLayerModel,this.removeLayerView,this),this.overlayViews=new a.ViewList(this.addOverlayModel,this.removeOverlayView,this),this.controlViews=new a.ViewList(this.addControlModel,this.removeControlView,this),this.map=new h.Map({target:this.map_container,view:new c.default({center:this.model.get("center"),zoom:this.model.get("zoom")}),layers:[new l.default({source:new g.OSM})]}),this.map.on("click",(t=>{this.handleMapClick(t)})),this.map.getView().on("change:center",(()=>{this.model.set("center",this.map.getView().getCenter()),this.model.save_changes()})),this.map.getView().on("change:resolution",(t=>{this.model.set("zoom",this.map.getView().getZoom()),this.model.save_changes()})),this.layersChanged(),this.overlayChanged(),this.controlChanged(),this.model.on("change:layers",this.layersChanged,this),this.model.on("change:overlays",this.overlayChanged,this),this.model.on("change:controls",this.controlChanged,this),this.model.on("change:zoom",this.zoomChanged,this),this.model.on("change:center",this.centerChanged,this)}handleMapClick(t){const e=t.coordinate,[i,n]=e;this.send({type:"click",lon:i,lat:n})}layersChanged(){const t=this.model.get("layers");this.layerViews.update(t)}overlayChanged(){const t=this.model.get("overlays");this.overlayViews.update(t)}controlChanged(){const t=this.model.get("controls");this.controlViews.update(t)}zoomChanged(){const t=this.model.get("zoom");null!=t&&this.map.getView().setZoom(t)}centerChanged(){const t=this.model.get("center");null!=t&&this.map.getView().setCenter(t)}removeLayerView(t){this.map.removeLayer(t.obj),t.remove()}removeOverlayView(t){t.overlay&&this.map.removeOverlay(t.overlay),t.remove()}removeControlView(t){this.map.removeControl(t.obj),t.remove()}addLayerModel(t){return s(this,void 0,void 0,(function*(){const e=yield this.create_child_view(t,{map_view:this});return this.map.addLayer(e.obj),this.displayed.then((()=>{e.trigger("displayed",this)})),e}))}addOverlayModel(t){return s(this,void 0,void 0,(function*(){const e=yield this.create_child_view(t,{map_view:this});return this.map.addOverlay(e.overlay),this.displayed.then((()=>{e.trigger("displayed",this)})),e}))}addControlModel(t){return s(this,void 0,void 0,(function*(){const e=yield this.create_child_view(t,{map_view:this});return e.obj&&(this.map.addControl(e.obj),this.displayed.then((()=>{e.trigger("displayed",this)}))),e}))}}e.MapView=m},7820:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.ZoomSliderView=e.ZoomSliderModel=void 0;const r=i(2055),s=i(1646),o=n(i(7891));i(5045);const a=i(5672);i(1463);class l extends s.BaseControlModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:l.model_name,_model_module:l.model_module,_model_module_version:l.model_module_version,_view_name:l.view_name,_view_module:l.view_module,_view_module_version:l.view_module_version})}}e.ZoomSliderModel=l,l.serializers=Object.assign({},r.DOMWidgetModel.serializers),l.model_name="ZoomSliderModel",l.model_module=a.MODULE_NAME,l.model_module_version=a.MODULE_VERSION,l.view_name="ZoomSliderView",l.view_module=a.MODULE_NAME,l.view_module_version=a.MODULE_VERSION;class h extends s.BaseControlView{createObj(){this.obj=new o.default({className:"ol-zoomslider"})}}e.ZoomSliderView=h},2055:e=>{"use strict";e.exports=t},8625:()=>{},6504:()=>{},6580:()=>{},4946:(t,e,i)=>{"use strict";i.d(e,{$:()=>n,AC:()=>h,Hm:()=>d,NZ:()=>s,S3:()=>u,TZ:()=>c,s$:()=>a,ub:()=>l});const n={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},r={};for(const t in n)n.hasOwnProperty(t)&&(r[n[t]]=parseInt(t,10));const s=[r.BitsPerSample,r.ExtraSamples,r.SampleFormat,r.StripByteCounts,r.StripOffsets,r.StripRowCounts,r.TileByteCounts,r.TileOffsets,r.SubIFDs],o={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},a={};for(const t in o)o.hasOwnProperty(t)&&(a[o[t]]=parseInt(t,10));const l={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,TransparencyMask:4,CMYK:5,YCbCr:6,CIELab:8,ICCLab:9},h={Unspecified:0,Assocalpha:1,Unassalpha:2},c={Version:0,AddCompression:1},u={None:0,Deflate:1,Zstandard:2},d={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"},g={};for(const t in d)d.hasOwnProperty(t)&&(g[d[t]]=parseInt(t,10))},2435:(t,e,i)=>{"use strict";i.d(e,{A:()=>h});var n=i(1796),r=i(4211),s=i(7777);const o="length";class a extends s.Ay{constructor(t,e,i){super(t),this.element=e,this.index=i}}class l extends n.A{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t||[],this.unique_)for(let t=0,e=this.array_.length;t0;)this.pop()}extend(t){for(let e=0,i=t.length;ethis.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new a(r.A.ADD,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new a(r.A.REMOVE,e,t)),e}setAt(t,e){if(t>=this.getLength())return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const i=this.array_[t];this.array_[t]=e,this.dispatchEvent(new a(r.A.REMOVE,i,t)),this.dispatchEvent(new a(r.A.ADD,e,t))}updateLength_(){this.set(o,this.array_.length)}assertUnique_(t,e){for(let i=0,n=this.array_.length;i{"use strict";i.d(e,{A:()=>n});const n={ADD:"add",REMOVE:"remove"}},2771:(t,e,i)=>{"use strict";i.d(e,{$r:()=>h,Ay:()=>d,bL:()=>a,xo:()=>o});var n=i(5291),r=i(8066),s=i(6843);function o(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageBitmap?t:null}function a(t){return t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t instanceof DataView?t:null}let l=null;function h(t){l||(l=(0,s.Y)(t.width,t.height,void 0,{willReadFrequently:!0}));const e=l.canvas,i=t.width;e.width!==i&&(e.width=i);const n=t.height;return e.height!==n&&(e.height=n),l.clearRect(0,0,i,n),l.drawImage(t,0,0),l.getImageData(0,0,i,n).data}const c=[256,256];class u extends n.A{constructor(t){const e=r.A.IDLE;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null}getSize(){if(this.size_)return this.size_;const t=o(this.data_);return t?[t.width,t.height]:c}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==r.A.IDLE&&this.state!==r.A.ERROR)return;this.state=r.A.LOADING,this.changed();const t=this;this.loader_().then((function(e){t.data_=e,t.state=r.A.LOADED,t.changed()})).catch((function(e){t.error_=e,t.state=r.A.ERROR,t.changed()}))}}const d=u},1581:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});const n=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}},6097:(t,e,i)=>{"use strict";i.r(e),i.d(e,{createStyleFunction:()=>l,default:()=>h});var n=i(1796),r=i(8417),s=i(4504),o=i(554);class a extends n.A{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if("function"==typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new a(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const i=this.getStyle();return i&&t.setStyle(i),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&((0,o.JH)(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=(0,o.KT)(t,r.A.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?l(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function l(t){if("function"==typeof t)return t;let e;return Array.isArray(t)?e=t:((0,s.v)("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[t]),function(){return e}}const h=a},966:(t,e,i)=>{"use strict";i.d(e,{Ay:()=>g,D4:()=>d,RA:()=>u,f6:()=>c});var n=i(2272),r=i(8417),s=i(4289),o=i(4919),a=i(554),l=i(2138);class h extends n.A{constructor(t,e,i,n){super(),this.extent=t,this.pixelRatio_=i,this.resolution=e,this.state="function"==typeof n?s.A.IDLE:n,this.image_=null,this.loader="function"==typeof n?n:null}changed(){this.dispatchEvent(r.A.CHANGE)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(this.state==s.A.IDLE&&this.loader){this.state=s.A.LOADING,this.changed();const t=this.getResolution(),e=Array.isArray(t)?t[0]:t;(0,l.hq)((()=>this.loader(this.getExtent(),e,this.getPixelRatio()))).then((t=>{"image"in t&&(this.image_=t.image),"extent"in t&&(this.extent=t.extent),"resolution"in t&&(this.resolution=t.resolution),"pixelRatio"in t&&(this.pixelRatio_=t.pixelRatio),(t instanceof HTMLImageElement||t instanceof ImageBitmap||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement)&&(this.image_=t),this.state=s.A.LOADED})).catch((t=>{this.state=s.A.ERROR,console.error(t)})).finally((()=>this.changed()))}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}}function c(t,e,i){const n=t;let s=!0,l=!1,h=!1;const c=[(0,a.Jz)(n,r.A.LOAD,(function(){h=!0,l||e()}))];return n.src&&o.DT?(l=!0,n.decode().then((function(){s&&e()})).catch((function(t){s&&(h?e():i())}))):c.push((0,a.Jz)(n,r.A.ERROR,i)),function(){s=!1,c.forEach(a.JH)}}function u(t,e){return e&&(t.src=e),t.src&&o.DT?new Promise(((e,i)=>t.decode().then((()=>e(t))).catch((n=>t.complete&&t.width?e(t):i(n))))):function(t){return new Promise(((e,i)=>{function n(){s(),e(t)}function r(){s(),i(new Error("Image load error"))}function s(){t.removeEventListener("load",n),t.removeEventListener("error",r)}t.addEventListener("load",n),t.addEventListener("error",r)}))}(t)}function d(t,e){return e&&(t.src=e),t.src&&o.DT&&o.XM?t.decode().then((()=>createImageBitmap(t))).catch((e=>{if(t.complete&&t.width)return t;throw e})):u(t)}const g=h},5770:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var n=i(4289),r=i(966);class s extends r.Ay{constructor(t,e,i,r,s){super(t,e,i,void 0!==s?n.A.IDLE:n.A.LOADED),this.loader_=void 0!==s?s:null,this.canvas_=r,this.error_=null}getError(){return this.error_}handleLoad_(t){t?(this.error_=t,this.state=n.A.ERROR):this.state=n.A.LOADED,this.changed()}load(){this.state==n.A.IDLE&&(this.state=n.A.LOADING,this.changed(),this.loader_(this.handleLoad_.bind(this)))}getImage(){return this.canvas_}}const o=s},4289:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});const n={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4}},8026:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var n=i(5291),r=i(8066),s=i(6843),o=i(966);class a extends n.A{constructor(t,e,i,n,r,s){super(t,e,s),this.crossOrigin_=n,this.src_=i,this.key=i,this.image_=new Image,null!==n&&(this.image_.crossOrigin=n),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=r.A.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=r.A.ERROR,this.unlistenImage_(),this.image_=function(){const t=(0,s.Y)(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=r.A.LOADED:this.state=r.A.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==r.A.ERROR&&(this.state=r.A.IDLE,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==r.A.IDLE&&(this.state=r.A.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=(0,o.f6)(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}const l=a},1261:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});const n={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"}},4424:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});const n={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"}},1796:(t,e,i)=>{"use strict";i.d(e,{A:()=>c});var n=i(7777),r=i(7262),s=i(6490),o=i(9891),a=i(3358);class l extends n.Ay{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class h extends s.A{constructor(t){super(),this.on,this.once,this.un,(0,o.v6)(this),this.values_=null,void 0!==t&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new l(i,t,e)),i=r.A.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new l(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const n=this.values_||(this.values_={});if(i)n[t]=e;else{const i=n[t];n[t]=e,i!==e&&this.notify(t,i)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],(0,a.p)(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}const c=h},7262:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});const n={PROPERTYCHANGE:"propertychange"}},6490:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var n=i(2272),r=i(8417),s=i(554);class o extends n.A{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(r.A.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r{"use strict";i.r(e),i.d(e,{default:()=>p});var n=i(1796),r=i(1261),s=i(9988),o=i(3839),a=i(554),l=i(6843);const h="element",c="map",u="offset",d="position",g="positioning";class f extends n.A{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=void 0===t.insertFirst||t.insertFirst,this.stopEvent=void 0===t.stopEvent||t.stopEvent,this.element=document.createElement("div"),this.element.className=void 0!==t.className?t.className:"ol-overlay-container "+s.Q5,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=!0===t.autoPan?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(h,this.handleElementChanged),this.addChangeListener(c,this.handleMapChanged),this.addChangeListener(u,this.handleOffsetChanged),this.addChangeListener(d,this.handlePositionChanged),this.addChangeListener(g,this.handlePositioningChanged),void 0!==t.element&&this.setElement(t.element),this.setOffset(void 0!==t.offset?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),void 0!==t.position&&this.setPosition(t.position)}getElement(){return this.get(h)}getId(){return this.id}getMap(){return this.get(c)||null}getOffset(){return this.get(u)}getPosition(){return this.get(d)}getPositioning(){return this.get(g)}handleElementChanged(){(0,l.gS)(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&((0,l.bf)(this.element),(0,a.JH)(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=(0,a.KT)(t,r.A.POSTRENDER,this.render,this),this.updatePixelPosition();const e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(h,t)}setMap(t){this.set(c,t)}setOffset(t){this.set(u,t)}setPosition(t){this.set(d,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(d))return;const i=this.getRect(e.getTargetElement(),e.getSize()),n=this.getElement(),r=this.getRect(n,[(0,l.Gq)(n),(0,l.DK)(n)]),s=void 0===(t=t||{}).margin?20:t.margin;if(!(0,o.ms)(i,r)){const n=r[0]-i[0],o=i[2]-r[2],a=r[1]-i[1],l=i[3]-r[3],h=[0,0];if(n<0?h[0]=n-s:o<0&&(h[0]=Math.abs(o)+s),a<0?h[1]=a-s:l<0&&(h[1]=Math.abs(l)+s),0!==h[0]||0!==h[1]){const i=e.getView().getCenterInternal(),n=e.getPixelFromCoordinateInternal(i);if(!n)return;const r=[n[0]+h[0],n[1]+h[1]],s=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(r),duration:s.duration,easing:s.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),n=i.left+window.pageXOffset,r=i.top+window.pageYOffset;return[n,r,n+e[0],r+e[1]]}setPositioning(t){this.set(g,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e)return void this.setVisible(!1);const i=t.getPixelFromCoordinate(e),n=t.getSize();this.updateRenderedPosition(i,n)}updateRenderedPosition(t,e){const i=this.element.style,n=this.getOffset(),r=this.getPositioning();this.setVisible(!0);let s="0%",o="0%";"bottom-right"==r||"center-right"==r||"top-right"==r?s="-100%":"bottom-center"!=r&&"center-center"!=r&&"top-center"!=r||(s="-50%"),"bottom-left"==r||"bottom-center"==r||"bottom-right"==r?o="-100%":"center-left"!=r&&"center-center"!=r&&"center-right"!=r||(o="-50%");const a=`translate(${s}, ${o}) translate(${Math.round(t[0]+n[0])+"px"}, ${Math.round(t[1]+n[1])+"px"})`;this.rendered.transform_!=a&&(this.rendered.transform_=a,i.transform=a)}getOptions(){return this.options}}const p=f},5291:(t,e,i)=>{"use strict";i.d(e,{A:()=>h});var n=i(2272),r=i(8417),s=i(8066),o=i(9891),a=i(5774);class l extends n.A{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.interimTile=null,this.key="",this.transition_=void 0===i.transition?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(r.A.CHANGE)}release(){this.state===s.A.ERROR&&this.setState(s.A.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){let t=this.interimTile;if(!t)return this;do{if(t.getState()==s.A.LOADED)return this.transition_=0,t;t=t.interimTile}while(t);return this}refreshInterimChain(){let t=this.interimTile;if(!t)return;let e=this;do{if(t.getState()==s.A.LOADED){t.interimTile=null;break}t.getState()==s.A.LOADING?e=t:t.getState()==s.A.IDLE?e.interimTile=t.interimTile:e=t,t=e.interimTile}while(t)}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==s.A.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){(0,o.b0)()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;const n=e-i+1e3/60;return n>=this.transition_?1:(0,a.a6)(n/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}}const h=l},2473:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var n=i(5941),r=i(4614);class s extends n.A{clear(){for(;this.getCount()>0;)this.pop().release();super.clear()}expireCache(t){for(;this.canExpireCache()&&!(this.peekLast().getKey()in t);)this.pop().release()}pruneExceptNewestZ(){if(0===this.getCount())return;const t=this.peekFirstKey(),e=(0,r.K)(t)[0];this.forEach((t=>{t.tileCoord[0]!==e&&(this.remove((0,r.i7)(t.tileCoord)),t.release())}))}}const o=s},3171:(t,e,i)=>{"use strict";i.d(e,{A:()=>h,z:()=>c});var n=i(8417),r=i(4504),s=i(3358);const o=1/0,a=class{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,(0,s.I)(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const n=this.keyFunction_(i);return delete this.queuedElements_[n],i}enqueue(t){(0,r.v)(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=o&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,n=e.length,r=e[t],s=i[t],o=t;for(;t>1;){const r=this.getLeftChildIndex_(t),s=this.getRightChildIndex_(t),o=st;){const t=this.getParentIndex_(e);if(!(n[t]>s))break;i[e]=i[t],n[e]=n[t],e=t}i[e]=r,n[e]=s}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const r=e.length;let s,a,l;for(a=0;a0;)n=this.dequeue()[0],r=n.getKey(),i=n.getState(),i!==l.A.IDLE||r in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++s,n.load())}};function c(t,e,i,n,r){if(!t||!(i in t.wantedTiles))return o;if(!t.wantedTiles[i][e.getKey()])return o;const s=t.viewState.center,a=n[0]-s[0],l=n[1]-s[1];return 65536*Math.log(r)+Math.sqrt(a*a+l*l)/r}},1218:(t,e,i)=>{"use strict";i.d(e,{A:()=>s,N:()=>r});class n{constructor(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minXthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function r(t,e,i,r,s){return void 0!==s?(s.minX=t,s.maxX=e,s.minY=i,s.maxY=r,s):new n(t,e,i,r)}const s=n},8066:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});const n={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4}},8724:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var n=i(5291),r=i(6843),s=i(9891);const o=[];class a extends n.A{constructor(t,e,i,n){super(t,e,{transition:0}),this.context_={},this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=n.bind(void 0,this),this.wrappedTileCoord=i}getContext(t){const e=(0,s.v6)(t);return e in this.context_||(this.context_[e]=(0,r.Y)(1,1,o)),this.context_[e]}hasContext(t){return(0,s.v6)(t)in this.context_}getImage(t){return this.hasContext(t)?this.getContext(t).canvas:null}getReplayState(t){const e=(0,s.v6)(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[e]}load(){this.getSourceTiles()}release(){for(const t in this.context_){const e=this.context_[t];(0,r.Yg)(e),o.push(e.canvas),delete this.context_[t]}super.release()}}const l=a},64:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var n=i(5291),r=i(8066);class s extends n.A{constructor(t,e,i,n,r,s){super(t,e,s),this.extent=null,this.format_=n,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=r,this.url_=i,this.key=i}getFormat(){return this.format_}getFeatures(){return this.features_}load(){this.state==r.A.IDLE&&(this.setState(r.A.LOADING),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(t,e){this.setFeatures(t)}onError(){this.setState(r.A.ERROR)}setFeatures(t){this.features_=t,this.setState(r.A.LOADED)}setLoader(t){this.loader_=t}}const o=s},9906:(t,e,i)=>{"use strict";i.r(e),i.d(e,{createCenterConstraint:()=>T,createResolutionConstraint:()=>C,createRotationConstraint:()=>S,default:()=>P,isNoopAnimation:()=>R});var n=i(1796),r=i(9611);const s={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};var o=i(8943),a=i(6409),l=i(2138),h=i(4137),c=i(4504),u=i(4769);function d(t,e,i){return function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;const l=e?0:s[0]*r,h=e?0:s[1]*r,c=a?a[0]:0,d=a?a[1]:0;let g=t[0]+l/2+c,f=t[2]-l/2+c,p=t[1]+h/2+d,m=t[3]-h/2+d;g>f&&(g=(f+g)/2,f=g),p>m&&(p=(m+p)/2,m=p);let _=(0,u.qE)(n[0],g,f),v=(0,u.qE)(n[1],p,m);if(o&&i&&r){const t=30*r;_+=-t*Math.log(1+Math.max(0,g-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-f)/t),v+=-t*Math.log(1+Math.max(0,p-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-m)/t)}return[_,v]}}function g(t){return t}var f=i(3839),p=i(2654);function m(t,e,i,n){const r=(0,f.RG)(e)/i[0],s=(0,f.Oq)(e)/i[1];return n?Math.min(t,Math.max(r,s)):Math.min(t,Math.min(r,s))}function _(t,e,i){let n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(n=Math.max(n,i),n/=Math.log(1+50*Math.max(0,i/t-1))/50+1),(0,u.qE)(n,i/2,2*e)}function v(t,e,i,n,r){return i=void 0===i||i,function(s,o,a,l){if(void 0!==s){const o=n?m(t,n,a,r):t;return i&&l?_(s,o,e):(0,u.qE)(s,e,o)}}}var y=i(4214),x=i(5774),E=i(366);const A=0;class w extends n.A{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=(0,a.createProjection)(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&(0,a.disableCoordinateWarning)(),t.center&&(t.center=(0,a.fromUserCoordinate)(t.center,this.projection_)),t.extent&&(t.extent=(0,a.fromUserExtent)(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in s)delete e[t];this.setProperties(e,!0);const i=C(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const n=T(t),r=i.constraint,o=S(t);this.constraints_={center:n,resolution:r,rotation:o},this.setRotation(void 0!==t.rotation?t.rotation:0),this.setCenterInternal(void 0!==t.center?t.center:null),void 0!==t.resolution?this.setResolution(t.resolution):void 0!==t.zoom&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const n=t||[0,0,0,0];e=e||[0,0,0,0];const r=this.getResolution(),s=r/2*(n[3]-e[3]+e[1]-n[1]),o=r/2*(n[0]-e[0]+e[2]-n[2]);this.setCenterInternal([i[0]+s,i[1]-o])}}getUpdatedOptions_(t){const e=this.getProperties();return void 0!==e.resolution?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let t=0;t1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n0}getInteracting(){return this.hints_[r.A.INTERACTING]>0}cancelAnimations(){let t;this.setHint(r.A.ANIMATING,-this.hints_[r.A.ANIMATING]);for(let e=0,i=this.animations_.length;e=0;--i){const n=this.animations_[i];let s=!0;for(let i=0,r=n.length;i0?o/r.duration:1;a>=1?(r.complete=!0,a=1):s=!1;const l=r.easing(a);if(r.sourceCenter){const t=r.sourceCenter[0],e=r.sourceCenter[1],i=r.targetCenter[0],n=r.targetCenter[1];this.nextCenter_=r.targetCenter;const s=t+l*(i-t),o=e+l*(n-e);this.targetCenter_=[s,o]}if(r.sourceResolution&&r.targetResolution){const t=1===l?r.targetResolution:r.sourceResolution+l*(r.targetResolution-r.sourceResolution);if(r.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,r.anchor)}this.nextResolution_=r.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==r.sourceRotation&&void 0!==r.targetRotation){const t=1===l?(0,u.xP)(r.targetRotation+Math.PI,2*Math.PI)-Math.PI:r.sourceRotation+l*(r.targetRotation-r.sourceRotation);if(r.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,r.anchor)}this.nextRotation_=r.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!r.complete)break}if(s){this.animations_[i]=null,this.setHint(r.A.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&b(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],(0,h.e$)(i,t-this.getRotation()),(0,h.WQ)(i,e)),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),r=this.getResolution();return void 0!==n&&void 0!==r&&(i=[e[0]-t*(e[0]-n[0])/r,e[1]-t*(e[1]-n[1])/r]),i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?(0,a.toUserCoordinate)(t,this.getProjection()):t}getCenterInternal(){return this.get(s.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){const e=this.calculateExtentInternal(t);return(0,a.toUserExtent)(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();(0,c.v)(e,"The view center is not defined");const i=this.getResolution();(0,c.v)(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return(0,c.v)(void 0!==n,"The view rotation is not defined"),(0,f.Bg)(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(s.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal((0,a.fromUserExtent)(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=(0,f.RG)(t)/e[0],n=(0,f.Oq)(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(i){return e/Math.pow(t,i*n)}}getRotation(){return this.get(s.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/r}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const r=this.padding_;if(r){const t=this.getViewportSizeMinusPadding_();n=I(n,this.getViewportSize_(),[t[0]/2+r[3],t[1]/2+r[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const r=(0,p.FT)(this.resolutions_,t,1);n=r,e=this.resolutions_[r],i=r==this.resolutions_.length-1?2:e/this.resolutions_[r+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;const e=(0,u.qE)(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,(0,u.qE)(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if((0,c.v)(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){(0,c.v)(!(0,f.Im)(t),"Cannot fit empty extent provided as `geometry`");const e=(0,a.fromUserExtent)(t,this.getProjection());i=(0,E.VY)(e)}else if("Circle"===t.getType()){const e=(0,a.fromUserExtent)(t.getExtent(),this.getProjection());i=(0,E.VY)(e),i.rotate(this.getRotation(),(0,f.q1)(e))}else{const e=(0,a.getUserProjection)();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),r=t.getFlatCoordinates(),s=t.getStride();let o=1/0,a=1/0,l=-1/0,h=-1/0;for(let t=0,e=r.length;tc&&g{"use strict";i.d(e,{A:()=>n});const n={ANIMATING:0,INTERACTING:1}},2654:(t,e,i)=>{"use strict";function n(t,e,i){let n,s;i=i||r;let o=0,a=t.length,l=!1;for(;o>1),s=+i(t[n],e),s<0?o=n+1:(a=n,l=!s);return l?o:~o}function r(t,e){return t>e?1:te?-1:0}function o(t,e,i){if(t[0]<=e)return 0;const n=t.length;if(e<=t[n-1])return n-1;if("function"==typeof i){for(let r=1;r0?r-1:r}return n-1}if(i>0){for(let i=1;i0||i&&0===s)}))}i.d(e,{El:()=>n,FT:()=>o,V_:()=>r,WC:()=>c,X$:()=>l,aI:()=>h,gI:()=>a,rG:()=>s})},4504:(t,e,i)=>{"use strict";function n(t,e){if(!t)throw new Error(e)}i.d(e,{v:()=>n})},8e3:(t,e,i)=>{"use strict";i.d(e,{_j:()=>A,oJ:()=>f,sH:()=>E,$C:()=>T,cD:()=>x,S8:()=>w,eE:()=>y,dI:()=>b,fu:()=>v});const n={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]};var r={name:"xyz",min:[0,0,0],channel:["X","Y","Z"],alias:["XYZ","ciexyz","cie1931"],whitepoint:{2:{A:[109.85,100,35.585],C:[98.074,100,118.232],D50:[96.422,100,82.521],D55:[95.682,100,92.149],D65:[95.045592705167,100,108.9057750759878],D75:[94.972,100,122.638],F2:[99.187,100,67.395],F7:[95.044,100,108.755],F11:[100.966,100,64.37],E:[100,100,100]},10:{A:[111.144,100,35.2],C:[97.285,100,116.145],D50:[96.72,100,81.427],D55:[95.799,100,90.926],D65:[94.811,100,107.304],D75:[94.416,100,120.641],F2:[103.28,100,69.026],F7:[95.792,100,107.687],F11:[103.866,100,65.627],E:[100,100,100]}}};r.max=r.whitepoint[2].D65,r.rgb=function(t,e){e=e||r.whitepoint[2].E;var i,n,s,o=t[0]/e[0],a=t[1]/e[1],l=t[2]/e[2];return n=-.96924363628087*o+1.87596750150772*a+.041555057407175*l,s=.055630079696993*o+-.20397695888897*a+1.056971514242878*l,i=(i=3.240969941904521*o+-1.537383177570093*a+-.498610760293*l)>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*=12.92,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:n*=12.92,s=s>.0031308?1.055*Math.pow(s,1/2.4)-.055:s*=12.92,[255*(i=Math.min(Math.max(0,i),1)),255*(n=Math.min(Math.max(0,n),1)),255*(s=Math.min(Math.max(0,s),1))]},n.xyz=function(t,e){var i=t[0]/255,n=t[1]/255,s=t[2]/255,o=.21263900587151*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)+.71516867876775*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.072192315360733*(s=s>.04045?Math.pow((s+.055)/1.055,2.4):s/12.92),a=.019330818715591*i+.11919477979462*n+.95053215224966*s;return[(.41239079926595*i+.35758433938387*n+.18048078840183*s)*(e=e||r.whitepoint[2].E)[0],o*e[1],a*e[2]]};const s=r,o={name:"luv",min:[0,-134,-140],max:[100,224,122],channel:["lightness","u","v"],alias:["LUV","cieluv","cie1976"],xyz:function(t,e,i){var n,r,o,a,l,h,c,u,d;return o=t[0],a=t[1],l=t[2],0===o?[0,0,0]:(e=e||"D65",i=i||2,n=a/(13*o)+4*(c=s.whitepoint[i][e][0])/(c+15*(u=s.whitepoint[i][e][1])+3*(d=s.whitepoint[i][e][2]))||0,r=l/(13*o)+9*u/(c+15*u+3*d)||0,[9*(h=o>8?u*Math.pow((o+16)/116,3):u*o*.0011070564598794539)*n/(4*r)||0,h,h*(12-3*n-20*r)/(4*r)||0])}};s.luv=function(t,e,i){var n,r,o,a,l,h,c,u,d,g,f;e=e||"D65",i=i||2,g=4*(c=s.whitepoint[i][e][0])/(c+15*(u=s.whitepoint[i][e][1])+3*(d=s.whitepoint[i][e][2])),f=9*u/(c+15*u+3*d),n=4*(a=t[0])/(a+15*(l=t[1])+3*(h=t[2]))||0,r=9*l/(a+15*l+3*h)||0;var p=l/u;return[o=p<=.008856451679035631?903.2962962962961*p:116*Math.pow(p,1/3)-16,13*o*(n-g),13*o*(r-f)]};var a={name:"lchuv",channel:["lightness","chroma","hue"],alias:["LCHuv","cielchuv"],min:[0,0,0],max:[100,100,360],luv:function(t){var e,i=t[0],n=t[1];return e=t[2]/360*2*Math.PI,[i,n*Math.cos(e),n*Math.sin(e)]},xyz:function(t){return o.xyz(a.luv(t))}};const l=a;o.lchuv=function(t){var e=t[0],i=t[1],n=t[2],r=Math.sqrt(i*i+n*n),s=360*Math.atan2(n,i)/2/Math.PI;return s<0&&(s+=360),[e,r,s]},s.lchuv=function(t){return o.lchuv(s.luv(t))};const h={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},c=function(t){var e,i,n=[],r=1;if("number"==typeof t)return{space:"rgb",values:[t>>>16,(65280&t)>>>8,255&t],alpha:1};if("number"==typeof t)return{space:"rgb",values:[t>>>16,(65280&t)>>>8,255&t],alpha:1};if(t=String(t).toLowerCase(),h[t])n=h[t].slice(),i="rgb";else if("transparent"===t)r=0,i="rgb",n=[0,0,0];else if("#"===t[0]){var s=t.slice(1),o=s.length;r=1,o<=4?(n=[parseInt(s[0]+s[0],16),parseInt(s[1]+s[1],16),parseInt(s[2]+s[2],16)],4===o&&(r=parseInt(s[3]+s[3],16)/255)):(n=[parseInt(s[0]+s[1],16),parseInt(s[2]+s[3],16),parseInt(s[4]+s[5],16)],8===o&&(r=parseInt(s[6]+s[7],16)/255)),n[0]||(n[0]=0),n[1]||(n[1]=0),n[2]||(n[2]=0),i="rgb"}else if(e=/^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\s*\(([^\)]*)\)/.exec(t)){var a=e[1],l="cmyk"===(i=a.replace(/a$/,""))?4:"gray"===i?1:3;n=e[2].trim().split(/\s*[,\/]\s*|\s+/),"color"===i&&(i=n.shift()),r=(n=n.map((function(t,e){if("%"===t[t.length-1])return t=parseFloat(t)/100,3===e?t:"rgb"===i?255*t:"h"===i[0]?100*t:"l"!==i[0]||e?"lab"===i?125*t:"lch"===i?e<2?150*t:360*t:"o"!==i[0]||e?"oklab"===i?.4*t:"oklch"===i?e<2?.4*t:360*t:t:t:100*t;if("h"===i[e]||2===e&&"h"===i[i.length-1]){if(void 0!==u[t])return u[t];if(t.endsWith("deg"))return parseFloat(t);if(t.endsWith("turn"))return 360*parseFloat(t);if(t.endsWith("grad"))return 360*parseFloat(t)/400;if(t.endsWith("rad"))return 180*parseFloat(t)/Math.PI}return"none"===t?0:parseFloat(t)}))).length>l?n.pop():1}else/[0-9](?:\s|\/|,)/.test(t)&&(n=t.match(/([0-9]+)/g).map((function(t){return parseFloat(t)})),i=t.match(/([a-z])/gi)?.join("")?.toLowerCase()||"rgb");return{space:i,values:n,alpha:r}};var u={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};const d={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(t){var e,i,n,r,s,o=t[0]/360,a=t[1]/100,l=t[2]/100,h=0;if(0===a)return[s=255*l,s,s];for(e=2*l-(i=l<.5?l*(1+a):l+a-l*a),r=[0,0,0];h<3;)(n=o+1/3*-(h-1))<0?n++:n>1&&n--,s=6*n<1?e+6*(i-e)*n:2*n<1?i:3*n<2?e+(i-e)*(2/3-n)*6:e,r[h++]=255*s;return r}};n.hsl=function(t){var e,i,n=t[0]/255,r=t[1]/255,s=t[2]/255,o=Math.min(n,r,s),a=Math.max(n,r,s),l=a-o;return a===o?e=0:n===a?e=(r-s)/l:r===a?e=2+(s-n)/l:s===a&&(e=4+(n-r)/l),(e=Math.min(60*e,360))<0&&(e+=360),i=(o+a)/2,[e,100*(a===o?0:i<=.5?l/(a+o):l/(2-a-o)),100*i]};var g=i(4769);function f(t){return"string"==typeof t?t:b(t)}const p=1024,m={};let _=0;function v(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function y(t){const e=s.lchuv(n.xyz(t));return e[3]=t[3],e}function x(t){const e=s.rgb(l.xyz(t));return e[3]=t[3],e}function E(t){if(m.hasOwnProperty(t))return m[t];if(_>=p){let t=0;for(const e in m)3&t++||(delete m[e],--_)}const e=function(t){var e;Array.isArray(t)&&t.raw&&(t=String.raw(...arguments)),t instanceof Number&&(t=+t);var i=c(t);if(!i.space)return[];const r="h"===i.space[0]?d.min:n.min,s="h"===i.space[0]?d.max:n.max;return(e=Array(3))[0]=Math.min(Math.max(i.values[0],r[0]),s[0]),e[1]=Math.min(Math.max(i.values[1],r[1]),s[1]),e[2]=Math.min(Math.max(i.values[2],r[2]),s[2]),"h"===i.space[0]&&(e=d.rgb(e)),e.push(Math.min(Math.max(i.alpha,0),1)),e}(t);if(4!==e.length)throw new Error('Failed to parse "'+t+'" as color');for(const i of e)if(isNaN(i))throw new Error('Failed to parse "'+t+'" as color');return w(e),m[t]=e,++_,e}function A(t){return Array.isArray(t)?t:E(t)}function w(t){return t[0]=(0,g.qE)(t[0]+.5|0,0,255),t[1]=(0,g.qE)(t[1]+.5|0,0,255),t[2]=(0,g.qE)(t[2]+.5|0,0,255),t[3]=(0,g.qE)(t[3],0,1),t}function b(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];return n!=(0|n)&&(n=n+.5|0),"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}function T(t){try{return E(t),!0}catch(t){return!1}}},6291:(t,e,i)=>{"use strict";i.d(e,{F:()=>l});var n=i(4289),r=i(6843),s=i(9767),o=i(6533),a=i(8e3);function l(t){return t?Array.isArray(t)?(0,a.dI)(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return o.ue.getPattern(t.src,"anonymous",t.color);const e=t.src+":"+t.offset,i=o.ue.getPattern(e,void 0,t.color);if(i)return i;const a=o.ue.get(t.src,"anonymous",null);if(a.getImageState()!==n.A.LOADED)return null;const l=(0,r.Y)(t.size[0],t.size[1]);return l.drawImage(a.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),(0,s.J)(l.canvas,e,void 0,n.A.LOADED,t.color,!0),o.ue.getPattern(e,void 0,t.color)}(t):t:null}},2602:(t,e,i)=>{"use strict";i.d(e,{R8:()=>s,z3:()=>o});const n={info:1,warn:2,error:3,none:4};let r=n.info;function s(...t){r>n.warn||console.warn(...t)}function o(...t){r>n.error||console.error(...t)}},4384:(t,e,i)=>{"use strict";i.d(e,{A:()=>h});var n=i(1796),r=i(1261),s=i(2138),o=i(554),a=i(6843);class l extends n.A{constructor(t){super();const e=t.element;!e||t.target||e.style.pointerEvents||(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){(0,a.bf)(this.element),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&(0,a.bf)(this.element);for(let t=0,e=this.listenerKeys.length;t{"use strict";i.r(e),i.d(e,{default:()=>f});var n=i(4384),r=i(8417),s=i(4424),o=i(9988),a=i(554),l=i(6843);const h=["fullscreenchange","webkitfullscreenchange","MSFullscreenChange"];class c extends n.A{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target}),this.on,this.once,this.un,this.keys_=void 0!==t.keys&&t.keys,this.source_=t.source,this.isInFullscreen_=!1,this.boundHandleMapTargetChange_=this.handleMapTargetChange_.bind(this),this.cssClassName_=void 0!==t.className?t.className:"ol-full-screen",this.documentListeners_=[],this.activeClassName_=void 0!==t.activeClassName?t.activeClassName.split(" "):[this.cssClassName_+"-true"],this.inactiveClassName_=void 0!==t.inactiveClassName?t.inactiveClassName.split(" "):[this.cssClassName_+"-false"];const e=void 0!==t.label?t.label:"⤢";this.labelNode_="string"==typeof e?document.createTextNode(e):e;const i=void 0!==t.labelActive?t.labelActive:"×";this.labelActiveNode_="string"==typeof i?document.createTextNode(i):i;const n=t.tipLabel?t.tipLabel:"Toggle full-screen";this.button_=document.createElement("button"),this.button_.title=n,this.button_.setAttribute("type","button"),this.button_.appendChild(this.labelNode_),this.button_.addEventListener(r.A.CLICK,this.handleClick_.bind(this),!1),this.setClassName_(this.button_,this.isInFullscreen_),this.element.className=`${this.cssClassName_} ${o.XI} ${o.$N}`,this.element.appendChild(this.button_)}handleClick_(t){t.preventDefault(),this.handleFullScreen_()}handleFullScreen_(){const t=this.getMap();if(!t)return;const e=t.getOwnerDocument();if(u(e))if(d(e))!function(t){t.exitFullscreen?t.exitFullscreen():t.webkitExitFullscreen&&t.webkitExitFullscreen()}(e);else{let i;i=this.source_?"string"==typeof this.source_?e.getElementById(this.source_):this.source_:t.getTargetElement(),this.keys_?function(t){t.webkitRequestFullscreen?t.webkitRequestFullscreen():g(t)}(i):g(i)}}handleFullScreenChange_(){const t=this.getMap();if(!t)return;const e=this.isInFullscreen_;this.isInFullscreen_=d(t.getOwnerDocument()),e!==this.isInFullscreen_&&(this.setClassName_(this.button_,this.isInFullscreen_),this.isInFullscreen_?((0,l.fo)(this.labelActiveNode_,this.labelNode_),this.dispatchEvent("enterfullscreen")):((0,l.fo)(this.labelNode_,this.labelActiveNode_),this.dispatchEvent("leavefullscreen")),t.updateSize())}setClassName_(t,e){e?(t.classList.remove(...this.inactiveClassName_),t.classList.add(...this.activeClassName_)):(t.classList.remove(...this.activeClassName_),t.classList.add(...this.inactiveClassName_))}setMap(t){const e=this.getMap();e&&e.removeChangeListener(s.A.TARGET,this.boundHandleMapTargetChange_),super.setMap(t),this.handleMapTargetChange_(),t&&t.addChangeListener(s.A.TARGET,this.boundHandleMapTargetChange_)}handleMapTargetChange_(){const t=this.documentListeners_;for(let e=0,i=t.length;e{"use strict";i.r(e),i.d(e,{default:()=>u});var n=i(4384),r=i(7601),s=i(6409),o=i(554),a=i(4137);const l="projection",h="coordinateFormat";class c extends n.A{constructor(t){t=t||{};const e=document.createElement("div");e.className=void 0!==t.className?t.className:"ol-mouse-position",super({element:e,render:t.render,target:t.target}),this.on,this.once,this.un,this.addChangeListener(l,this.handleProjectionChanged_),t.coordinateFormat&&this.setCoordinateFormat(t.coordinateFormat),t.projection&&this.setProjection(t.projection),this.renderOnMouseOut_=void 0!==t.placeholder,this.placeholder_=this.renderOnMouseOut_?t.placeholder:" ",this.renderedHTML_=e.innerHTML,this.mapProjection_=null,this.transform_=null,this.wrapX_=!1!==t.wrapX}handleProjectionChanged_(){this.transform_=null}getCoordinateFormat(){return this.get(h)}getProjection(){return this.get(l)}handleMouseMove(t){const e=this.getMap();this.updateHTML_(e.getEventPixel(t))}handleMouseOut(t){this.updateHTML_(null)}setMap(t){if(super.setMap(t),t){const e=t.getViewport();this.listenerKeys.push((0,o.KT)(e,r.A.POINTERMOVE,this.handleMouseMove,this)),this.renderOnMouseOut_&&this.listenerKeys.push((0,o.KT)(e,r.A.POINTEROUT,this.handleMouseOut,this)),this.updateHTML_(null)}}setCoordinateFormat(t){this.set(h,t)}setProjection(t){this.set(l,(0,s.get)(t))}updateHTML_(t){let e=this.placeholder_;if(t&&this.mapProjection_){if(!this.transform_){const t=this.getProjection();this.transform_=t?(0,s.getTransformFromProjections)(this.mapProjection_,t):s.identityTransform}const i=this.getMap().getCoordinateFromPixelInternal(t);if(i){const t=(0,s.getUserProjection)();if(t&&(this.transform_=(0,s.getTransformFromProjections)(this.mapProjection_,t)),this.transform_(i,i),this.wrapX_){const e=t||this.getProjection()||this.mapProjection_;(0,a.Li)(i,e)}const n=this.getCoordinateFormat();e=n?n(i):i.toString()}}this.renderedHTML_&&e===this.renderedHTML_||(this.element.innerHTML=e,this.renderedHTML_=e)}render(t){const e=t.frameState;e?this.mapProjection_!=e.viewState.projection&&(this.mapProjection_=e.viewState.projection,this.transform_=null):this.mapProjection_=null}}const u=c},1201:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>c});var n=i(4384),r=i(9988),s=i(6409);const o="units",a=[1,2,5],l=25.4/.28;class h extends n.A{constructor(t){t=t||{};const e=document.createElement("div");e.style.pointerEvents="none",super({element:e,render:t.render,target:t.target}),this.on,this.once,this.un;const i=void 0!==t.className?t.className:t.bar?"ol-scale-bar":"ol-scale-line";this.innerElement_=document.createElement("div"),this.innerElement_.className=i+"-inner",this.element.className=i+" "+r.XI,this.element.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=void 0!==t.minWidth?t.minWidth:64,this.maxWidth_=t.maxWidth,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_="",this.addChangeListener(o,this.handleUnitsChanged_),this.setUnits(t.units||"metric"),this.scaleBar_=t.bar||!1,this.scaleBarSteps_=t.steps||4,this.scaleBarText_=t.text||!1,this.dpi_=t.dpi||void 0}getUnits(){return this.get(o)}handleUnitsChanged_(){this.updateElement_()}setUnits(t){this.set(o,t)}setDpi(t){this.dpi_=t}updateElement_(){const t=this.viewState_;if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=t.center,i=t.projection,n=this.getUnits(),r="degrees"==n?"degrees":"m";let o=(0,s.getPointResolution)(i,t.resolution,e,r);const h=this.minWidth_*(this.dpi_||l)/l,c=void 0!==this.maxWidth_?this.maxWidth_*(this.dpi_||l)/l:void 0;let u=h*o,d="";if("degrees"==n){const t=s.METERS_PER_UNIT.degrees;u*=t,u=c){g=m,f=_,p=v;break}if(f>=h)break;m=g,_=f,v=p,++y}const x=this.scaleBar_?this.createScaleBar(f,g,d):g.toFixed(p<0?-p:0)+" "+d;this.renderedHTML_!=x&&(this.innerElement_.innerHTML=x,this.renderedHTML_=x),this.renderedWidth_!=f&&(this.innerElement_.style.width=f+"px",this.renderedWidth_=f),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}createScaleBar(t,e,i){const n=this.getScaleForResolution(),r=n<1?Math.round(1/n).toLocaleString()+" : 1":"1 : "+Math.round(n).toLocaleString(),s=this.scaleBarSteps_,o=t/s,a=[this.createMarker("absolute")];for(let n=0;n
`+this.createMarker("relative")+(n%2==0||2===s?this.createStepText(n,t,!1,e,i):"")+"")}return a.push(this.createStepText(s,t,!0,e,i)),(this.scaleBarText_?`
`+r+"
":"")+a.join("")}createMarker(t){return`
`}createStepText(t,e,i,n,r){const s=(0===t?0:Math.round(n/this.scaleBarSteps_*t*100)/100)+(0===t?"":" "+r);return`
`+s+"
"}getScaleForResolution(){return(0,s.getPointResolution)(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center,"m")*(1e3/25.4)*(this.dpi_||l)}render(t){const e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()}}const c=h},7891:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>d});var n=i(4384),r=i(8417),s=i(7601),o=i(9988),a=i(4769),l=i(5774),h=i(554),c=i(7777);class u extends n.A{constructor(t){super({target:(t=t||{}).target,element:document.createElement("div"),render:t.render}),this.dragListenerKeys_=[],this.currentResolution_=void 0,this.direction_=0,this.dragging_,this.heightLimit_=0,this.widthLimit_=0,this.startX_,this.startY_,this.thumbSize_=null,this.sliderInitialized_=!1,this.duration_=void 0!==t.duration?t.duration:200;const e=void 0!==t.className?t.className:"ol-zoomslider",i=document.createElement("button");i.setAttribute("type","button"),i.className=e+"-thumb "+o.XI;const n=this.element;n.className=e+" "+o.XI+" "+o.$N,n.appendChild(i),n.addEventListener(s.A.POINTERDOWN,this.handleDraggerStart_.bind(this),!1),n.addEventListener(s.A.POINTERMOVE,this.handleDraggerDrag_.bind(this),!1),n.addEventListener(s.A.POINTERUP,this.handleDraggerEnd_.bind(this),!1),n.addEventListener(r.A.CLICK,this.handleContainerClick_.bind(this),!1),i.addEventListener(r.A.CLICK,c.dG,!1)}setMap(t){super.setMap(t),t&&t.render()}initSlider_(){const t=this.element;let e=t.offsetWidth,i=t.offsetHeight;if(0===e&&0===i)return this.sliderInitialized_=!1;const n=getComputedStyle(t);e-=parseFloat(n.paddingRight)+parseFloat(n.paddingLeft),i-=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom);const r=t.firstElementChild,s=getComputedStyle(r),o=r.offsetWidth+parseFloat(s.marginRight)+parseFloat(s.marginLeft),a=r.offsetHeight+parseFloat(s.marginTop)+parseFloat(s.marginBottom);return this.thumbSize_=[o,a],e>i?(this.direction_=1,this.widthLimit_=e-o):(this.direction_=0,this.heightLimit_=i-a),this.sliderInitialized_=!0}handleContainerClick_(t){const e=this.getMap().getView(),i=this.getRelativePosition_(t.offsetX-this.thumbSize_[0]/2,t.offsetY-this.thumbSize_[1]/2),n=this.getResolutionForPosition_(i),r=e.getConstrainedZoom(e.getZoomForResolution(n));e.animateInternal({zoom:r,duration:this.duration_,easing:l.vT})}handleDraggerStart_(t){if(!this.dragging_&&t.target===this.element.firstElementChild){const e=this.element.firstElementChild;if(this.getMap().getView().beginInteraction(),this.startX_=t.clientX-parseFloat(e.style.left),this.startY_=t.clientY-parseFloat(e.style.top),this.dragging_=!0,0===this.dragListenerKeys_.length){const t=this.handleDraggerDrag_,e=this.handleDraggerEnd_,i=this.getMap().getOwnerDocument();this.dragListenerKeys_.push((0,h.KT)(i,s.A.POINTERMOVE,t,this),(0,h.KT)(i,s.A.POINTERUP,e,this))}}}handleDraggerDrag_(t){if(this.dragging_){const e=t.clientX-this.startX_,i=t.clientY-this.startY_,n=this.getRelativePosition_(e,i);this.currentResolution_=this.getResolutionForPosition_(n),this.getMap().getView().setResolution(this.currentResolution_)}}handleDraggerEnd_(t){this.dragging_&&(this.getMap().getView().endInteraction(),this.dragging_=!1,this.startX_=void 0,this.startY_=void 0,this.dragListenerKeys_.forEach(h.JH),this.dragListenerKeys_.length=0)}setThumbPosition_(t){const e=this.getPositionForResolution_(t),i=this.element.firstElementChild;1==this.direction_?i.style.left=this.widthLimit_*e+"px":i.style.top=this.heightLimit_*e+"px"}getRelativePosition_(t,e){let i;return i=1===this.direction_?t/this.widthLimit_:e/this.heightLimit_,(0,a.qE)(i,0,1)}getResolutionForPosition_(t){return this.getMap().getView().getResolutionForValueFunction()(1-t)}getPositionForResolution_(t){const e=this.getMap().getView().getValueForResolutionFunction();return(0,a.qE)(1-e(t),0,1)}render(t){if(!t.frameState)return;if(!this.sliderInitialized_&&!this.initSlider_())return;const e=t.frameState.viewState.resolution;this.currentResolution_=e,this.setThumbPosition_(e)}}const d=u},4137:(t,e,i)=>{"use strict";i.d(e,{Li:()=>u,U$:()=>d,WQ:()=>o,aI:()=>l,aP:()=>a,e$:()=>h,hs:()=>c});var n=i(3839),r=i(4769),s=i(7170);function o(t,e){return t[0]+=+e[0],t[1]+=+e[1],t}function a(t,e,i){const n=(0,r.xP)(e+180,360)-180,o=Math.abs(3600*n),a=i||0;let l=Math.floor(o/3600),h=Math.floor((o-3600*l)/60),c=(0,r.Mg)(o-3600*l-60*h,a);c>=60&&(c=0,h+=1),h>=60&&(h=0,l+=1);let u=l+"°";return 0===h&&0===c||(u+=" "+(0,s.H)(h,2)+"′"),0!==c&&(u+=" "+(0,s.H)(c,2,a)+"″"),0!==n&&(u+=" "+t.charAt(n<0?1:0)),u}function l(t,e){let i=!0;for(let n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function h(t,e){const i=Math.cos(e),n=Math.sin(e),r=t[0]*i-t[1]*n,s=t[1]*i+t[0]*n;return t[0]=r,t[1]=s,t}function c(t,e){return t[0]*=e,t[1]*=e,t}function u(t,e){if(e.canWrapX()){const i=(0,n.RG)(e.getExtent()),r=d(t,e,i);r&&(t[0]-=r*i)}return t}function d(t,e,i){const r=e.getExtent();let s=0;return e.canWrapX()&&(t[0]r[2])&&(i=i||(0,n.RG)(r),s=Math.floor((t[0]-r[0])/i)),s}},9988:(t,e,i)=>{"use strict";i.d(e,{$N:()=>a,K5:()=>u,Q5:()=>r,Si:()=>n,Vv:()=>o,XI:()=>s,nT:()=>l});const n="ol-hidden",r="ol-selectable",s="ol-unselectable",o="ol-unsupported",a="ol-control",l="ol-collapsed",h=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))","?\\s*([-,\\\"\\'\\sa-z]+?)\\s*$"].join(""),"i"),c=["style","variant","weight","size","lineHeight","family"],u=function(t){const e=t.match(h);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let t=0,n=c.length;t{"use strict";i.d(e,{DK:()=>h,Gq:()=>l,WM:()=>g,Y:()=>r,Yg:()=>a,bf:()=>u,fo:()=>c,gS:()=>d,lr:()=>o});var n=i(4919);function r(t,e,i,r){let s;return s=i&&i.length?i.shift():n.Wl?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(s.width=t),e&&(s.height=e),s.getContext("2d",r)}let s;function o(){return s||(s=r(1,1)),s}function a(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function l(t){let e=t.offsetWidth;const i=getComputedStyle(t);return e+=parseInt(i.marginLeft,10)+parseInt(i.marginRight,10),e}function h(t){let e=t.offsetHeight;const i=getComputedStyle(t);return e+=parseInt(i.marginTop,10)+parseInt(i.marginBottom,10),e}function c(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function u(t){return t&&t.parentNode?t.parentNode.removeChild(t):null}function d(t){for(;t.lastChild;)t.removeChild(t.lastChild)}function g(t,e){const i=t.childNodes;for(let n=0;;++n){const r=i[n],s=e[n];if(!r&&!s)break;r!==s&&(r?s?t.insertBefore(s,r):(t.removeChild(r),--n):t.appendChild(s))}}},5774:(t,e,i)=>{"use strict";function n(t){return Math.pow(t,3)}function r(t){return 1-n(1-t)}function s(t){return 3*t*t-2*t*t*t}function o(t){return t}i.d(e,{T9:()=>s,a6:()=>n,sn:()=>o,vT:()=>r})},554:(t,e,i)=>{"use strict";i.d(e,{JH:()=>o,Jz:()=>s,KT:()=>r});var n=i(3358);function r(t,e,i,n,r){if(n&&n!==t&&(i=i.bind(n)),r){const n=i;i=function(){t.removeEventListener(e,i),n.apply(this,arguments)}}const s={target:t,type:e,listener:i};return t.addEventListener(e,i),s}function s(t,e,i,n){return r(t,e,i,n,!0)}function o(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),(0,n.I)(t))}},7777:(t,e,i)=>{"use strict";function n(t){t.stopPropagation()}i.d(e,{Ay:()=>r,dG:()=>n});const r=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}},8417:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});const n={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"}},2272:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var n=i(1581),r=i(7777),s=i(2138),o=i(3358);class a extends n.A{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e="string"==typeof t,i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const o=e?new r.Ay(t):t;o.target||(o.target=this.eventTarget_||this);const a=this.dispatching_||(this.dispatching_={}),l=this.pendingRemovals_||(this.pendingRemovals_={});let h;i in a||(a[i]=0,l[i]=0),++a[i];for(let t=0,e=n.length;t0)}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=s.tV,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}}const l=a},9837:(t,e,i)=>{"use strict";i.d(e,{DG:()=>x,Fq:()=>u,SR:()=>E,T8:()=>a,Xj:()=>v,Ye:()=>L,ZD:()=>w,_D:()=>y,cT:()=>h,go:()=>m,ho:()=>_,j:()=>o,mE:()=>c,qA:()=>d,qg:()=>A,wl:()=>l});var n=i(2654),r=i(8e3);let s=0;const o=0,a=1<",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string"},b={[w.Get]:P((([t,e])=>void 0!==e?function(t){switch(t){case"string":return h;case"color":return c;case"number":return l;case"boolean":return a;case"number[]":return u;default:throw new Error(`Unrecognized type hint: ${t}`)}}(e.value):g),C(1,2),(function(t,e){const i=A(t[1],e);if(!(i instanceof y))throw new Error("Expected a literal argument for get operation");if("string"!=typeof i.value)throw new Error("Expected a string argument for get operation");return e.properties.add(i.value),3===t.length?[i,A(t[2],e)]:[i]})),[w.Var]:P((([t])=>t.type),C(1,1),(function(t,e,i,n){const r=t[1];if("string"!=typeof r)throw new Error("Expected a string argument for var operation");if(e.variables.add(r),!("variables"in e.style)||void 0===e.style.variables[r])return[new y(g,r)];const s=A(e.style.variables[r],e);if(s.value=r,n&&!_(n,s.type))throw new Error(`The variable ${r} has type ${m(s.type)} but the following type was expected: ${m(n)}`);return[s]})),[w.Id]:P(l|h,T,(function(t,e){e.featureId=!0})),[w.Concat]:P(h,C(2,1/0),S(g)),[w.GeometryType]:P(h,T,(function(t,e){e.geometryType=!0})),[w.Resolution]:P(l,T),[w.Zoom]:P(l,T),[w.Time]:P(l,T),[w.Any]:P(a,C(2,1/0),S(a)),[w.All]:P(a,C(2,1/0),S(a)),[w.Not]:P(a,C(1,1),S(a)),[w.Equal]:P(a,C(2,2),S(g),R),[w.NotEqual]:P(a,C(2,2),S(g),R),[w.GreaterThan]:P(a,C(2,2),S(g),R),[w.GreaterThanOrEqualTo]:P(a,C(2,2),S(g),R),[w.LessThan]:P(a,C(2,2),S(g),R),[w.LessThanOrEqualTo]:P(a,C(2,2),S(g),R),[w.Multiply]:P((t=>{let e=l|c;for(let i=0;i{let e=g;for(let i=1;i{let e=g;for(let i=2;i{let e=c|l;for(let i=3;i{let e=g;for(let i=1;i2===t.length?u|d:3===t.length||4===t.length?u|c:u),C(1,1/0),S(l)),[w.Color]:P(c,C(1,4),S(l)),[w.Band]:P(l,C(1,3),S(l)),[w.Palette]:P(c,C(2,2),(function(t,e){const i=A(t[1],e,l);if(i.type!==l)throw new Error(`The first argument of palette must be an number, got ${m(i.type)} instead`);const n=t[2];if(!Array.isArray(n))throw new Error("The second argument of palette must be an array");const r=new Array(n.length);for(let t=0;te)throw new Error(`Expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${r}, got ${s}`)}}function S(t){return function(e,i){const n=e[0],r=e.length-1,s=new Array(r);for(let o=0;o{"use strict";i.d(e,{uZ:()=>v,ZB:()=>h,nR:()=>y,VO:()=>c,Lm:()=>g,z0:()=>m,$R:()=>l,Tl:()=>f,Sl:()=>p});const n=class{constructor(t,e){this.name=t,this.data=e,this.texture_=null}getTexture(t){if(!this.texture_){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.data.length/4,1,0,t.RGBA,t.UNSIGNED_BYTE,this.data),this.texture_=e}return this.texture_}delete(t){this.texture_&&t.deleteTexture(this.texture_),this.texture_=null}};var r=i(9837),s=i(5605),o=i(8e3),a=i(8538);function l(t){const e=t.toString();return e.includes(".")?e:e+".0"}function h(t){if(t.length<2||t.length>4)throw new Error("`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.");return`vec${t.length}(${t.map(l).join(", ")})`}function c(t){const e=(0,o._j)(t),i=e.length>3?e[3]:1;return h([e[0]/255*i,e[1]/255*i,e[2]/255*i,i])}const u={};let d=0;function g(t){return t in u||(u[t]=d++),u[t]}function f(t){return l(g(t))}function p(t){return"u_var_"+t}function m(){return{inFragmentShader:!1,variables:{},properties:{},functions:{},bandCount:0,style:{}}}const _="getBandValue",v="u_paletteTextures";function y(t,e,i,n){const s=(0,r.qg)(t,i,e);if((0,r.Xj)(s.type,r.j))throw new Error("No matching type was found");if(!(0,r.ho)(e,s.type)){const t=(0,r.go)(e),i=(0,r.go)(s.type);throw new Error(`Expected expression to be of type ${t}, got ${i}`)}return A(s,e,n)}function x(t){return(e,i,n)=>{const r=i.args.length,s=new Array(r);for(let t=0;t{const i=e.args[0].value;return i in t.properties||(t.properties[i]={name:i,type:e.type}),(t.inFragmentShader?"v_prop_":"a_prop_")+i},[r.ZD.GeometryType]:(t,e,i)=>{const n="geometryType";return n in t.properties||(t.properties[n]={name:n,type:r.cT,evaluator:t=>(0,r.Ye)(t.getGeometry())}),(t.inFragmentShader?"v_prop_":"a_prop_")+n},[r.ZD.Var]:(t,e)=>{const i=e.args[0].value;return i in t.variables||(t.variables[i]={name:i,type:e.type}),p(i)},[r.ZD.Resolution]:()=>"u_resolution",[r.ZD.Zoom]:()=>"u_zoom",[r.ZD.Time]:()=>"u_time",[r.ZD.Any]:x((t=>`(${t.join(" || ")})`)),[r.ZD.All]:x((t=>`(${t.join(" && ")})`)),[r.ZD.Not]:x((([t])=>`(!${t})`)),[r.ZD.Equal]:x((([t,e])=>`(${t} == ${e})`)),[r.ZD.NotEqual]:x((([t,e])=>`(${t} != ${e})`)),[r.ZD.GreaterThan]:x((([t,e])=>`(${t} > ${e})`)),[r.ZD.GreaterThanOrEqualTo]:x((([t,e])=>`(${t} >= ${e})`)),[r.ZD.LessThan]:x((([t,e])=>`(${t} < ${e})`)),[r.ZD.LessThanOrEqualTo]:x((([t,e])=>`(${t} <= ${e})`)),[r.ZD.Multiply]:x((t=>`(${t.join(" * ")})`)),[r.ZD.Divide]:x((([t,e])=>`(${t} / ${e})`)),[r.ZD.Add]:x((t=>`(${t.join(" + ")})`)),[r.ZD.Subtract]:x((([t,e])=>`(${t} - ${e})`)),[r.ZD.Clamp]:x((([t,e,i])=>`clamp(${t}, ${e}, ${i})`)),[r.ZD.Mod]:x((([t,e])=>`mod(${t}, ${e})`)),[r.ZD.Pow]:x((([t,e])=>`pow(${t}, ${e})`)),[r.ZD.Abs]:x((([t])=>`abs(${t})`)),[r.ZD.Floor]:x((([t])=>`floor(${t})`)),[r.ZD.Ceil]:x((([t])=>`ceil(${t})`)),[r.ZD.Round]:x((([t])=>`floor(${t} + 0.5)`)),[r.ZD.Sin]:x((([t])=>`sin(${t})`)),[r.ZD.Cos]:x((([t])=>`cos(${t})`)),[r.ZD.Atan]:x((([t,e])=>void 0!==e?`atan(${t}, ${e})`:`atan(${t})`)),[r.ZD.Sqrt]:x((([t])=>`sqrt(${t})`)),[r.ZD.Match]:x((t=>{const e=t[0],i=t[t.length-1];let n=null;for(let r=t.length-3;r>=1;r-=2)n=`(${e} == ${t[r]} ? ${t[r+1]} : ${n||i})`;return n})),[r.ZD.Between]:x((([t,e,i])=>`(${t} >= ${e} && ${t} <= ${i})`)),[r.ZD.Interpolate]:x((([t,e,...i])=>{let n="";for(let r=0;r{const e=t[t.length-1];let i=null;for(let n=t.length-3;n>=0;n-=2)i=`(${t[n]} ? ${t[n+1]} : ${i||e})`;return i})),[r.ZD.In]:x((([t,...e],i)=>{const n=function(t,e){return`operator_in_${Object.keys(e.functions).length}`}(0,i),r=[];for(let t=0;t`vec${t.length}(${t.join(", ")})`)),[r.ZD.Color]:x((t=>{if(1===t.length)return`vec4(vec3(${t[0]} / 255.0), 1.0)`;if(2===t.length)return`(${t[1]} * vec4(vec3(${t[0]} / 255.0), 1.0))`;const e=t.slice(0,3).map((t=>`${t} / 255.0`));return 3===t.length?`vec4(${e.join(", ")}, 1.0)`:`(${t[3]} * vec4(${e.join(", ")}, 1.0))`})),[r.ZD.Band]:x((([t,e,i],n)=>{if(!(_ in n.functions)){let t="";const e=n.bandCount||1;for(let i=0;i{const[i,...s]=e.args,a=s.length,l=new Uint8Array(4*a);for(let t=0;t0)return l(t.value);if((t.type&r.T8)>0)return t.value.toString();if((t.type&r.cT)>0)return f(t.value.toString());if((t.type&r.mE)>0)return c(t.value);if((t.type&r.Fq)>0)return h(t.value);if((t.type&r.qA)>0)return n=t.value,h((0,a.xq)(n));var n;throw new Error(`Unexpected expression ${t.value} (expected type ${(0,r.go)(e)})`)}},3839:(t,e,i)=>{"use strict";i.d(e,{$C:()=>x,$u:()=>j,Af:()=>G,Bg:()=>I,HY:()=>k,Im:()=>N,Ld:()=>a,Li:()=>U,Mx:()=>z,N:()=>g,NW:()=>B,Oq:()=>L,Py:()=>O,QJ:()=>V,R:()=>T,R8:()=>E,RG:()=>F,Rj:()=>c,S5:()=>d,Tr:()=>r,UG:()=>b,Vy:()=>m,WU:()=>D,X$:()=>y,Ym:()=>l,Yw:()=>P,_N:()=>M,aI:()=>_,aZ:()=>f,bE:()=>v,dP:()=>p,k_:()=>C,ms:()=>h,o8:()=>o,q1:()=>S,qF:()=>R,r:()=>s,sB:()=>w,vz:()=>u});var n=i(7136);function r(t){const e=[1/0,1/0,-1/0,-1/0];for(let i=0,n=t.length;is&&(h|=n.A.RIGHT),lo&&(h|=n.A.ABOVE),h===n.A.UNKNOWN&&(h=n.A.INTERSECTING),h}function d(){return[1/0,1/0,-1/0,-1/0]}function g(t,e,i,n,r){return r?(r[0]=t,r[1]=e,r[2]=i,r[3]=n,r):[t,e,i,n]}function f(t){return g(1/0,1/0,-1/0,-1/0,t)}function p(t,e){const i=t[0],n=t[1];return g(i,n,i,n,e)}function m(t,e,i,n,r){return E(f(r),t,e,i,n)}function _(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function v(t,e,i){return Math.abs(t[0]-e[0])t[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function x(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function E(t,e,i,n,r){for(;ie[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function N(t){return t[2]=a&&m<=h),r||!(o&n.A.RIGHT)||s&n.A.RIGHT||(_=f-(g-h)*p,r=_>=l&&_<=c),r||!(o&n.A.BELOW)||s&n.A.BELOW||(m=g-(f-l)/p,r=m>=a&&m<=h),r||!(o&n.A.LEFT)||s&n.A.LEFT||(_=f-(g-a)*p,r=_>=l&&_<=c)}return r}function B(t,e,i,n){if(N(t))return f(i);let r=[];if(n>1){const e=t[2]-t[0],i=t[3]-t[1];for(let s=0;s=i[2])){const e=F(i),r=Math.floor((n[0]-i[0])/e)*e;t[0]-=r,t[2]-=r}return t}function V(t,e,i){if(e.canWrapX()){const n=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[n[0],t[1],n[2],t[3]]];U(t,e);const r=F(n);if(F(t)>r&&!i)return[[n[0],t[1],n[2],t[3]]];if(t[0]n[2])return[[t[0],t[1],n[2],t[3]],[n[0],t[1],t[2]-r,t[3]]]}return[t]}},7136:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});const n={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16}},2698:(t,e,i)=>{"use strict";i.d(e,{m8:()=>s,nF:()=>o});var n=i(2138);let r=!1;function s(t,e,i,n,s,o,a){const l=new XMLHttpRequest;l.open("GET","function"==typeof t?t(i,n,s):t,!0),"arraybuffer"==e.getType()&&(l.responseType="arraybuffer"),l.withCredentials=r,l.onload=function(t){if(!l.status||l.status>=200&&l.status<300){const t=e.getType();try{let n;"text"==t||"json"==t?n=l.responseText:"xml"==t?n=l.responseXML||l.responseText:"arraybuffer"==t&&(n=l.response),n?o(e.readFeatures(n,{extent:i,featureProjection:s}),e.readProjection(n)):a()}catch{a()}}else a()},l.onerror=a,l.send()}function o(t,e){return function(i,r,o,a,l){const h=this;s(t,e,i,r,o,(function(t,e){h.addFeatures(t),void 0!==a&&a(t)}),l||n.tV)}}},3180:(t,e,i)=>{"use strict";i.d(e,{te:()=>T,Bs:()=>b,Ay:()=>E,hX:()=>A});var n=i(6097),r=i(1070),s=i(250),o=i(7781),a=i(366),l=i(9219),h=i(9018),c=i(3251),u=i(8417),d=i(5322),g=i(3839),f=i(554);class p extends d.A{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(f.JH),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,i=t.length;et.clone()))}const _=p;var v=i(9891),y=i(6409),x=i(6693);const E=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=n.default,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?(0,y.get)(e.dataProjection):this.readProjection(t);e.extent&&i&&"tile-pixels"===i.getUnits()&&(i=(0,y.get)(i),i.setWorldExtent(e.extent)),e={dataProjection:i,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return(0,v.b0)()}readFeature(t,e){return(0,v.b0)()}readFeatures(t,e){return(0,v.b0)()}readGeometry(t,e){return(0,v.b0)()}readProjection(t){return(0,v.b0)()}writeFeature(t,e){return(0,v.b0)()}writeFeatures(t,e){return(0,v.b0)()}writeGeometry(t,e){return(0,v.b0)()}};function A(t,e,i){const n=i?(0,y.get)(i.featureProjection):null,r=i?(0,y.get)(i.dataProjection):null;let s=t;if(n&&r&&!(0,y.equivalent)(n,r)){e&&(s=t.clone());const i=e?n:r,o=e?r:n;"tile-pixels"===i.getUnits()?s.transform(i,o):s.applyTransform((0,y.getTransform)(i,o))}if(e&&i&&void 0!==i.decimals){const e=Math.pow(10,i.decimals),n=function(t){for(let i=0,n=t.length;ib({...t,geometry:e}))).flat();const n="MultiPolygon"===i.type?"Polygon":i.type;if("GeometryCollection"===n||"Circle"===n)throw new Error("Unsupported geometry type: "+n);const s=i.layout.length;return A(new r.Ay(n,"Polygon"===n?function(t,e,i){return Array.isArray(e[0])?((0,x.mb)(t,0,e,i)||(t=t.slice(),(0,x.NK)(t,0,e,i)),t):((0,x.PA)(t,0,e,i)||(t=t.slice(),(0,x.ug)(t,0,e,i)),t)}(i.flatCoordinates,i.ends,s):i.flatCoordinates,i.ends?.flat(),s,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function T(t,e){if(!t)return null;if(Array.isArray(t)){const i=t.map((t=>T(t,e)));return new _(i)}return A(new(0,w[t.type])(t.flatCoordinates,t.layout,t.ends),!1,e)}},2004:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>f});var n=i(6097),r=i(2463),s=i(1070),o=i(3180),a=i(6997),l=i(5276),h=i(6409),c=i(3358);class u extends r.A{constructor(t){t=t||{},super(),this.dataProjection=(0,h.get)(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=(0,h.get)(t.featureProjection)),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,e){let i=null;i="Feature"===t.type?t:{type:"Feature",geometry:t,properties:null};const r=d(i.geometry);if(this.featureClass===s.Ay)return(0,o.Bs)({geometry:r,id:i.id,properties:i.properties},e);const a=new n.default;return this.geometryName_?a.setGeometryName(this.geometryName_):this.extractGeometryName_&&i.geometry_name&&a.setGeometryName(i.geometry_name),a.setGeometry((0,o.te)(r,e)),"id"in i&&a.setId(i.id),i.properties&&a.setProperties(i.properties,!0),a}readFeaturesFromObject(t,e){let i=null;if("FeatureCollection"===t.type){i=[];const n=t.features;for(let t=0,r=n.length;t{"use strict";i.d(e,{A:()=>a});var n=i(3180),r=i(9891);class s extends n.Ay{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(o(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(o(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return(0,r.b0)()}readFeaturesFromObject(t,e){return(0,r.b0)()}readGeometry(t,e){return this.readGeometryFromObject(o(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return(0,r.b0)()}readProjection(t){return this.readProjectionFromObject(o(t))}readProjectionFromObject(t){return(0,r.b0)()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return(0,r.b0)()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return(0,r.b0)()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return(0,r.b0)()}}function o(t){if("string"==typeof t){return JSON.parse(t)||null}return null!==t?t:null}const a=s},1898:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>x});var n=i(3180),r=i(7781),s=i(9018),o=i(9219),a=i(3251),l=i(3789),h=i(250),c=i(366),u=i(1338),d=i(1070),g=i(6409),f=i(6693);class p extends n.Ay{constructor(t){super(),t=t||{},this.dataProjection=new u.A({code:"",units:"tile-pixels"}),this.featureClass=t.featureClass?t.featureClass:d.Ay,this.geometryName_=t.geometryName,this.layerName_=t.layerName?t.layerName:"layer",this.layers_=t.layers?t.layers:null,this.idProperty_=t.idProperty,this.supportedMediaTypes=["application/vnd.mapbox-vector-tile","application/x-protobuf"]}readRawGeometry_(t,e,i,n){t.pos=e.geometry;const r=t.readVarint()+t.pos;let s=1,o=0,a=0,l=0,h=0,c=0;for(;t.pos>3}if(o--,1===s||2===s)a+=t.readSVarint(),l+=t.readSVarint(),1===s&&h>c&&(n.push(h),c=h),i.push(a,l),h+=2;else{if(7!==s)throw new Error("Invalid command found in the PBF");h>c&&(i.push(i[c],i[c+1]),h+=2)}}h>c&&(n.push(h),c=h)}createFeature_(t,e,i){const l=e.type;if(0===l)return null;let u;const g=e.properties;let p;this.idProperty_?(p=g[this.idProperty_],delete g[this.idProperty_]):p=e.id,g[this.layerName_]=e.layer.name;const m=[],_=[];this.readRawGeometry_(t,e,m,_);const v=function(t,e){let i;return 1===t?i=1===e?"Point":"MultiPoint":2===t?i=1===e?"LineString":"MultiLineString":3===t&&(i="Polygon"),i}(l,_.length);if(this.featureClass===d.Ay)u=new this.featureClass(v,m,_,2,g,p),u.transform(i.dataProjection);else{let t;if("Polygon"==v){const e=(0,f.yJ)(m,_);t=e.length>1?new a.A(m,"XY",e):new c.Ay(m,"XY",_)}else t="Point"===v?new h.default(m,"XY"):"LineString"===v?new r.A(m,"XY"):"MultiPoint"===v?new o.A(m,"XY"):"MultiLineString"===v?new s.A(m,"XY",_):null;u=new(0,this.featureClass),this.geometryName_&&u.setGeometryName(this.geometryName_);const e=(0,n.hX)(t,!1,i);u.setGeometry(e),void 0!==p&&u.setId(p),u.setProperties(g,!0)}return u}getType(){return"arraybuffer"}readFeatures(t,e){const i=this.layers_;e=this.adaptOptions(e);const n=(0,g.get)(e.dataProjection);n.setWorldExtent(e.extent),e.dataProjection=n;const r=new l(t),s=r.readFields(m,{}),o=[];for(const t in s){if(i&&!i.includes(t))continue;const a=s[t],l=a?[0,0,a.extent,a.extent]:null;n.setExtent(l);for(let t=0,i=a.length;t>3)?i.readString():2===t?i.readFloat():3===t?i.readDouble():4===t?i.readVarint64():5===t?i.readVarint():6===t?i.readSVarint():7===t?i.readBoolean():null;e.values.push(n)}}function v(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t){const t=i.readVarint()+i.pos;for(;i.pos{"use strict";i.r(e),i.d(e,{default:()=>x});var n=i(6097),r=i(2463),s=i(7781),o=i(9018),a=i(9219),l=i(3251),h=i(250),c=i(366),u=i(6409),d=i(3180);class g extends r.A{constructor(t){super(),t=t||{},this.layerName_=t.layerName,this.layers_=t.layers?t.layers:null,this.dataProjection=(0,u.get)(t.dataProjection?t.dataProjection:"EPSG:4326")}readFeaturesFromObject(t,e){if("Topology"==t.type){const i=t;let n,r=null,s=null;i.transform&&(n=i.transform,r=n.scale,s=n.translate);const o=i.arcs;n&&function(t,e,i){for(let n=0,r=t.length;n0&&i.pop(),n>=0){const t=e[n];for(let e=0,n=t.length;e=0;--e)i.push(t[e].slice(0))}return i}function m(t,e,i,n,r,s,o){const a=t.geometries,l=[];for(let t=0,h=a.length;t{"use strict";i.d(e,{B4:()=>a,W8:()=>s,hq:()=>l,rT:()=>r,tV:()=>o});var n=i(2654);function r(){return!0}function s(){return!1}function o(){}function a(t){let e,i,r,s=!1;return function(){const o=Array.prototype.slice.call(arguments);return s&&this===r&&(0,n.aI)(o,i)||(s=!0,r=this,i=o,e=t.apply(this,arguments)),e}}function l(t){return function(){let e;try{e=t()}catch(t){return Promise.reject(t)}return e instanceof Promise?e:Promise.resolve(e)}()}},5322:(t,e,i)=>{"use strict";i.d(e,{A:()=>d});var n=i(1796),r=i(9891),s=i(7659),o=i(3839),a=i(6409),l=i(2138),h=i(6178);const c=(0,s.vt)();class u extends n.A{constructor(){super(),this.extent_=(0,o.S5)(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=(0,l.B4)(((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)}))}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return(0,r.b0)()}closestPointXY(t,e,i,n){return(0,r.b0)()}containsXY(t,e){const i=this.getClosestPoint([t,e]);return i[0]===t&&i[1]===e}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return(0,r.b0)()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&(0,o.aZ)(t),this.extentRevision_=this.getRevision()}return(0,o.$u)(this.extent_,t)}rotate(t,e){(0,r.b0)()}scale(t,e,i){(0,r.b0)()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return(0,r.b0)()}getType(){return(0,r.b0)()}applyTransform(t){(0,r.b0)()}intersectsExtent(t){return(0,r.b0)()}translate(t,e){(0,r.b0)()}transform(t,e){const i=(0,a.get)(t),n="tile-pixels"==i.getUnits()?function(t,n,r){const l=i.getExtent(),u=i.getWorldExtent(),d=(0,o.Oq)(u)/(0,o.Oq)(l);return(0,s.Zz)(c,u[0],u[3],d,-d,0,0,0),(0,h.Rc)(t,0,t.length,r,c,n),(0,a.getTransform)(i,e)(t,n,r)}:(0,a.getTransform)(i,e);return this.applyTransform(n),this}}const d=u},7781:(t,e,i)=>{"use strict";i.d(e,{A:()=>p});var n=i(5276),r=i(1077),s=i(3839),o=i(6997),a=i(4507),l=i(2654),h=i(442),c=i(4373),u=i(973),d=i(634),g=i(3068);class f extends n.Ay{constructor(t,e){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}appendCoordinate(t){(0,l.X$)(this.flatCoordinates,t),this.changed()}clone(){const t=new f(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<(0,s.Ld)(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt((0,r.MD)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),(0,r.n)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,n))}forEachSegment(t){return(0,h.j)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinateAtM(t,e){return"XYM"!=this.layout&&"XYZM"!=this.layout?null:(e=void 0!==e&&e,(0,u.gr)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return(0,c.n2)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return(0,u.SH)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return(0,g.k)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const e=[];return e.length=(0,a.P4)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new f(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return(0,d.gp)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=(0,o.z2)(this.flatCoordinates,0,t,this.stride),this.changed()}}const p=f},9018:(t,e,i)=>{"use strict";i.d(e,{A:()=>f});var n=i(7781),r=i(5276),s=i(1077),o=i(3839),a=i(6997),l=i(4507),h=i(2654),c=i(4373),u=i(973),d=i(634);class g extends r.Ay{constructor(t,e,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(void 0!==e&&i)this.setFlatCoordinates(e,t),this.ends_=i;else{const e=t,i=[],n=[];for(let t=0,r=e.length;t{"use strict";i.d(e,{A:()=>u});var n=i(250),r=i(5276),s=i(3839),o=i(6997),a=i(2654),l=i(4373),h=i(4769);class c extends r.Ay{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){(0,a.X$)(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new c(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<(0,s.Ld)(this.getExtent(),t,e))return n;const r=this.flatCoordinates,o=this.stride;for(let s=0,a=r.length;s{"use strict";i.d(e,{A:()=>y});var n=i(9219),r=i(366),s=i(5276),o=i(1077),a=i(3839),l=i(6997),h=i(2654),c=i(1988),u=i(4373),d=i(634),g=i(6693),f=i(3909),p=i(8781),m=i(969),_=i(4507);class v extends s.Ay{constructor(t,e,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(t[0])){const n=t,r=[],s=[];for(let t=0,e=n.length;t{"use strict";i.r(e),i.d(e,{default:()=>l});var n=i(5276),r=i(3839),s=i(6997),o=i(4769);class a extends n.Ay{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new a(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const r=this.flatCoordinates,s=(0,o.hG)(t,e,r[0],r[1]);if(s{"use strict";i.d(e,{kj:()=>E,Ay:()=>x,VY:()=>A});var n=i(5276),r=i(1077),s=i(3839),o=i(6997),a=i(4507),l=i(4373),h=i(3909);class c extends n.Ay{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}clone(){return new c(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<(0,s.Ld)(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt((0,r.MD)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),(0,r.n)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return(0,h.eN)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return(0,l.n2)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=(0,a.P4)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new c(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=(0,o.z2)(this.flatCoordinates,0,t,this.stride),this.changed()}}const u=c;var d=i(250),g=i(2654),f=i(1988),p=i(634),m=i(6693),_=i(969),v=i(3294);class y extends n.Ay{constructor(t,e,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,void 0!==e&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?(0,g.X$)(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new y(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<(0,s.Ld)(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt((0,r.HX)(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),(0,r.oW)(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return(0,_.zb)(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return(0,h.PK)(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),(0,m.ug)(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,(0,l.cD)(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=(0,s.q1)(this.getExtent());this.flatInteriorPoint_=(0,f.J)(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new d.default(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new u(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,n=[];let r=0;for(let s=0,o=i.length;s{"use strict";i.d(e,{Ay:()=>u,p0:()=>l,v7:()=>c});var n=i(5322),r=i(9891),s=i(3839),o=i(6178);class a extends n.A{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return(0,s.Vy)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return(0,r.b0)()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length{"use strict";function n(t,e,i,n){let r=0,s=t[i-n],o=t[i-n+1];for(;es,PK:()=>r,eN:()=>n})},8781:(t,e,i)=>{"use strict";i.d(e,{C:()=>r});var n=i(3839);function r(t,e,i,r){const s=[];let o=(0,n.S5)();for(let a=0,l=i.length;a{"use strict";i.d(e,{HX:()=>o,MD:()=>s,c:()=>a,n:()=>l,oW:()=>h,te:()=>c});var n=i(4769);function r(t,e,i,r,s,o,a){const l=t[e],h=t[e+1],c=t[i]-l,u=t[i+1]-h;let d;if(0===c&&0===u)d=e;else{const g=((s-l)*c+(o-h)*u)/(c*c+u*u);if(g>1)d=i;else{if(g>0){for(let s=0;ss&&(s=l),o=i,a=r}return s}function o(t,e,i,n,r){for(let o=0,a=i.length;o{"use strict";i.d(e,{Gd:()=>a,a_:()=>s,t7:()=>r,zb:()=>o});var n=i(3839);function r(t,e,i,r,o){return!(0,n.sB)(o,(function(n){return!s(t,e,i,r,n[0],n[1])}))}function s(t,e,i,n,r,s){let o=0,a=t[i-n],l=t[i-n+1];for(;es&&(i-a)*(s-l)-(r-a)*(n-l)>0&&o++:n<=s&&(i-a)*(s-l)-(r-a)*(n-l)<0&&o--,a=i,l=n}return 0!==o}function o(t,e,i,n,r,o){if(0===i.length)return!1;if(!s(t,e,i[0],n,r,o))return!1;for(let e=1,a=i.length;e{"use strict";function n(t,e,i,n){for(let n=0,r=i.length;ns,_n:()=>n,d6:()=>o,z2:()=>r})},4373:(t,e,i)=>{"use strict";function n(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=e;os,cD:()=>r,n2:()=>n})},1988:(t,e,i)=>{"use strict";i.d(e,{J:()=>s,p:()=>o});var n=i(2654),r=i(969);function s(t,e,i,s,o,a,l){let h,c,u,d,g,f,p;const m=o[a+1],_=[];for(let n=0,r=i.length;ny&&(u=(d+g)/2,(0,r.zb)(t,e,i,s,u,m)&&(v=u,y=n)),d=g}return isNaN(v)&&(v=o[a]),l?(l.push(v,m,y),l):[v,m,y]}function o(t,e,i,n,r){let o=[];for(let a=0,l=i.length;a{"use strict";i.d(e,{L8:()=>a,SH:()=>s,gr:()=>o});var n=i(2654),r=i(4769);function s(t,e,i,s,o,a,l){let h,c;const u=(i-e)/s;if(1===u)h=e;else if(2===u)h=e,c=o;else if(0!==u){let r=t[e],a=t[e+1],l=0;const u=[0];for(let n=e+s;n1?l:2,a=a||new Array(l);for(let e=0;e>1;s{"use strict";i.d(e,{HT:()=>h,Wp:()=>c,fB:()=>a,gp:()=>o,sj:()=>l});var n=i(3839),r=i(442),s=i(969);function o(t,e,i,s,o){const a=(0,n.R8)((0,n.S5)(),t,e,i,s);return!!(0,n.HY)(o,a)&&(!!(0,n.ms)(o,a)||a[0]>=o[0]&&a[2]<=o[2]||a[1]>=o[1]&&a[3]<=o[3]||(0,r.j)(t,e,i,s,(function(t,e){return(0,n.Mx)(o,t,e)})))}function a(t,e,i,n,r){for(let s=0,a=i.length;s{"use strict";function n(t,e,i,n){let r=t[e],s=t[e+1],o=0;for(let a=e+n;an})},6693:(t,e,i)=>{"use strict";function n(t,e,i,n){for(;e0}function s(t,e,i,n,s){s=void 0!==s&&s;for(let o=0,a=i.length;oh,PA:()=>s,mb:()=>o,ug:()=>a,NK:()=>l})},442:(t,e,i)=>{"use strict";function n(t,e,i,n,r){let s;for(e+=n;en})},4507:(t,e,i)=>{"use strict";i.d(e,{AL:()=>s,Hg:()=>l,P4:()=>r,n$:()=>o,sx:()=>h});var n=i(4769);function r(t,e,i,r,s,o,a){const l=(i-e)/r;if(l<3){for(;e0;){const i=c.pop(),o=c.pop();let a=0;const l=t[o],d=t[o+1],g=t[i],f=t[i+1];for(let e=o+r;ea&&(u=e,a=s)}a>s&&(h[(u-e)/r]=1,o+r0&&p>g)&&(f<0&&m0&&m>f)?(l=i,h=d):(s[a++]=l,s[a++]=h,c=l,u=h,l=i,h=d)}return s[a++]=l,s[a++]=h,a}function l(t,e,i,n,r,s,o,l){for(let h=0,c=i.length;h{"use strict";function n(t,e,i,n,r,s){s=s||[];let o=0;for(let a=e;an,Tl:()=>o,e$:()=>r,hs:()=>s})},4919:(t,e,i)=>{"use strict";i.d(e,{DT:()=>c,FT:()=>d,Wl:()=>h,XM:()=>u,_p:()=>r,cr:()=>l,ew:()=>a,j:()=>o,oF:()=>s});const n="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",r=n.includes("firefox"),s=n.includes("safari")&&!n.includes("chrom")&&(n.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(n)),o=n.includes("webkit")&&!n.includes("edge"),a=n.includes("macintosh"),l="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,h="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,c="undefined"!=typeof Image&&Image.prototype.decode,u="function"==typeof createImageBitmap,d=function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch(t){}return t}()},6187:(t,e,i)=>{"use strict";i.r(e),i.d(e,{Collection:()=>n.A,Disposable:()=>r.A,Feature:()=>s.default,Geolocation:()=>w,Graticule:()=>b.A,Image:()=>T.Ay,ImageCanvas:()=>C.A,ImageTile:()=>S.A,ImageWrapper:()=>T.Ay,Kinetic:()=>R,Map:()=>oe,MapBrowserEvent:()=>Q,MapBrowserEventHandler:()=>st,MapEvent:()=>J,Object:()=>a.A,Observable:()=>ae.A,Overlay:()=>le.default,Tile:()=>he.A,TileCache:()=>ce.A,TileQueue:()=>lt.A,TileRange:()=>ue.A,VERSION:()=>M.xv,VectorRenderTile:()=>de.A,VectorTile:()=>ge.A,View:()=>ht.default,getUid:()=>M.v6});var n=i(2435),r=i(1581),s=i(6097),o=i(7777),a=i(1796),l=i(366),h=i(6409),c=i(4769);const u="accuracy",d="accuracyGeometry",g="altitude",f="altitudeAccuracy",p="heading",m="position",_="projection",v="speed",y="tracking",x="trackingOptions";class E extends o.Ay{constructor(t){super("error"),this.code=t.code,this.message=t.message}}class A extends a.A{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.position_=null,this.transform_=h.identityTransform,this.watchId_=void 0,this.addChangeListener(_,this.handleProjectionChanged_),this.addChangeListener(y,this.handleTrackingChanged_),void 0!==t.projection&&this.setProjection(t.projection),void 0!==t.trackingOptions&&this.setTrackingOptions(t.trackingOptions),this.setTracking(void 0!==t.tracking&&t.tracking)}disposeInternal(){this.setTracking(!1),super.disposeInternal()}handleProjectionChanged_(){const t=this.getProjection();t&&(this.transform_=(0,h.getTransformFromProjections)((0,h.get)("EPSG:4326"),t),this.position_&&this.set(m,this.transform_(this.position_)))}handleTrackingChanged_(){if("geolocation"in navigator){const t=this.getTracking();t&&void 0===this.watchId_?this.watchId_=navigator.geolocation.watchPosition(this.positionChange_.bind(this),this.positionError_.bind(this),this.getTrackingOptions()):t||void 0===this.watchId_||(navigator.geolocation.clearWatch(this.watchId_),this.watchId_=void 0)}}positionChange_(t){const e=t.coords;this.set(u,e.accuracy),this.set(g,null===e.altitude?void 0:e.altitude),this.set(f,null===e.altitudeAccuracy?void 0:e.altitudeAccuracy),this.set(p,null===e.heading?void 0:(0,c.eh)(e.heading)),this.position_?(this.position_[0]=e.longitude,this.position_[1]=e.latitude):this.position_=[e.longitude,e.latitude];const i=this.transform_(this.position_);this.set(m,i.slice()),this.set(v,null===e.speed?void 0:e.speed);const n=(0,l.kj)(this.position_,e.accuracy);n.applyTransform(this.transform_),this.set(d,n),this.changed()}positionError_(t){this.dispatchEvent(new E(t))}getAccuracy(){return this.get(u)}getAccuracyGeometry(){return this.get(d)||null}getAltitude(){return this.get(g)}getAltitudeAccuracy(){return this.get(f)}getHeading(){return this.get(p)}getPosition(){return this.get(m)}getProjection(){return this.get(_)}getSpeed(){return this.get(v)}getTracking(){return this.get(y)}getTrackingOptions(){return this.get(x)}setProjection(t){this.set(_,(0,h.get)(t))}setTracking(t){this.set(y,t)}setTrackingOptions(t){this.set(x,t)}}const w=A;var b=i(1030),T=i(966),C=i(5770),S=i(8026);const R=class{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]0&&this.points_[i+2]>t;)i-=3;const n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const r=this.points_[e]-this.points_[i],s=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(s,r),this.initialVelocity_=Math.sqrt(r*r+s*s)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}};var I=i(4211),P=i(888),L=i(2138),M=i(9891),O=i(7659),D=i(3839),F=i(6533),k=i(2e3),N=i(4137);class j extends r.A{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){(0,M.b0)()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;(0,O.Zz)(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),(0,O.T9)(n,i)}forEachFeatureAtCoordinate(t,e,i,n,r,s,o,a){let l;const h=e.viewState;function c(t,e,i,n){return r.call(s,e,t?i:null,n)}const u=h.projection,d=(0,N.Li)(t.slice(),u),g=[[0,0]];if(u.canWrapX()&&n){const t=u.getExtent(),e=(0,D.RG)(t);g.push([-e,0],[e,0])}const f=e.layerStatesArray,p=f.length,m=[],_=[];for(let n=0;n=0;--r){const s=f[r],u=s.layer;if(u.hasRenderer()&&(0,k.l)(s,h)&&o.call(a,u)){const r=u.getRenderer(),o=u.getSource();if(r&&o){const a=o.getWrapX()?d:t,h=c.bind(null,s.managed);_[0]=a[0]+g[n][0],_[1]=a[1]+g[n][1],l=r.forEachFeatureAtCoordinate(_,e,i,h,m)}if(l)return l}}if(0===m.length)return;const v=1/m.length;return m.forEach(((t,e)=>t.distanceSq+=e*v)),m.sort(((t,e)=>t.distanceSq-e.distanceSq)),m.some((t=>l=t.callback(t.feature,t.layer,t.geometry))),l}hasFeatureAtCoordinate(t,e,i,n,r,s){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,L.rT,this,r,s)}getMap(){return this.map_}renderFrame(t){(0,M.b0)()}scheduleExpireIconCache(t){F.ue.canExpireCache()&&t.postRenderFunctions.push(G)}}function G(t,e){F.ue.expire()}const z=j;var B=i(7262),U=i(4156),V=i(6788),X=i(9988),Z=i(8778),W=i(554),$=i(6843);const q=class extends z{constructor(t){super(t),this.fontChangeListenerKey_=(0,W.KT)(Z.yY,B.A.PROPERTYCHANGE,t.redrawText.bind(t)),this.element_=document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=X.XI+" ol-layers";const i=t.getViewport();i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const n=new U.A(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){(0,W.JH)(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),super.disposeInternal()}renderFrame(t){if(!t)return void(this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1));this.calculateMatrices2D(t),this.dispatchRenderEvent(V.A.PRECOMPOSE,t);const e=t.layerStatesArray.sort((function(t,e){return t.zIndex-e.zIndex}));e.some((t=>t.layer instanceof P.A&&t.layer.getDeclutter()))&&(t.declutter={});const i=t.viewState;this.children_.length=0;const n=[];let r=null;for(let s=0,o=e.length;s=0;--i){const n=e[i],r=n.layer;r.getDeclutter()&&r.renderDeclutter(t,n)}e.forEach((e=>e.layer.renderDeferred(t)))}}};var Y=i(8417),H=i(1130);class K extends o.Ay{constructor(t,e,i){super(t),this.map=e,this.frameState=void 0!==i?i:null}}const J=K,Q=class extends J{constructor(t,e,i,n,r,s){super(t,e,r),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=void 0!==n&&n,this.activePointers=s}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}},tt={SINGLECLICK:"singleclick",CLICK:Y.A.CLICK,DBLCLICK:Y.A.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var et=i(7601),it=i(2272),nt=i(4919);class rt extends it.A{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=void 0===e?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=(0,W.KT)(i,et.A.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=(0,W.KT)(i,et.A.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(Y.A.TOUCHMOVE,this.boundHandleTouchMove_,!!nt.FT&&{passive:!1})}emulateClick_(t){let e=new Q(tt.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new Q(tt.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout((()=>{this.clickTimeoutId_=void 0;const e=new Q(tt.SINGLECLICK,this.map_,t);this.dispatchEvent(e)}),250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==tt.POINTERUP||e.type==tt.POINTERCANCEL){delete this.trackedTouches_[i];for(const t in this.trackedTouches_)if(this.trackedTouches_[t].target!==e.target){delete this.trackedTouches_[t];break}}else e.type!=tt.POINTERDOWN&&e.type!=tt.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new Q(tt.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(W.JH),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return 0===t.button}handlePointerDown_(t){this.emulateClicks_=0===this.activePointers_.length,this.updateActivePointers_(t);const e=new Q(tt.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),0===this.dragListenerKeys_.length){const t=this.map_.getOwnerDocument();this.dragListenerKeys_.push((0,W.KT)(t,tt.POINTERMOVE,this.handlePointerMove_,this),(0,W.KT)(t,tt.POINTERUP,this.handlePointerUp_,this),(0,W.KT)(this.element_,tt.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push((0,W.KT)(this.element_.getRootNode(),tt.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new Q(tt.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!(!this.down_||!this.isMoving_(t));this.dispatchEvent(new Q(tt.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;e&&!e.defaultPrevented||"boolean"==typeof t.cancelable&&!0!==t.cancelable||t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&((0,W.JH)(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(Y.A.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&((0,W.JH)(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(W.JH),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const st=rt;var ot=i(1261),at=i(4424),lt=i(3171),ht=i(9906),ct=i(9611),ut=i(4504),dt=i(4384),gt=i(2654);class ft extends dt.A{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=void 0===t.collapsed||t.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=void 0!==t.collapsible,this.collapsible_=void 0===t.collapsible||t.collapsible,this.collapsible_||(this.collapsed_=!1);const e=void 0!==t.className?t.className:"ol-attribution",i=void 0!==t.tipLabel?t.tipLabel:"Attributions",n=void 0!==t.expandClassName?t.expandClassName:e+"-expand",r=void 0!==t.collapseLabel?t.collapseLabel:"›",s=void 0!==t.collapseClassName?t.collapseClassName:e+"-collapse";"string"==typeof r?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=r,this.collapseLabel_.className=s):this.collapseLabel_=r;const o=void 0!==t.label?t.label:"i";"string"==typeof o?(this.label_=document.createElement("span"),this.label_.textContent=o,this.label_.className=n):this.label_=o;const a=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(a),this.toggleButton_.addEventListener(Y.A.CLICK,this.handleClick_.bind(this),!1);const l=e+" "+X.XI+" "+X.$N+(this.collapsed_&&this.collapsible_?" "+X.nT:"")+(this.collapsible_?"":" ol-uncollapsible"),h=this.element;h.className=l,h.appendChild(this.toggleButton_),h.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=Array.from(new Set(this.getMap().getAllLayers().flatMap((e=>e.getAttributions(t))))),i=!this.getMap().getAllLayers().some((t=>t.getSource()&&!1===t.getSource().getAttributionsCollapsible()));return this.overrideCollapsible_||this.setCollapsible(i),e}async updateElement_(t){if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=await Promise.all(this.collectSourceAttributions_(t).map((t=>(0,L.hq)((()=>t))))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!(0,gt.aI)(e,this.renderedAttributions_)){(0,$.gS)(this.ulElement_);for(let t=0,i=e.length;t0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:mt.vT}):t.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const t="rotate("+i+"rad)";if(this.autoHide_){const t=this.element.classList.contains(X.Si);t||0!==i?t&&0!==i&&this.element.classList.remove(X.Si):this.element.classList.add(X.Si)}this.label_.style.transform=t}this.rotation_=i}}const vt=_t;class yt extends dt.A{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=void 0!==t.className?t.className:"ol-zoom",i=void 0!==t.delta?t.delta:1,n=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",r=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",s=void 0!==t.zoomInLabel?t.zoomInLabel:"+",o=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",a=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",l=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",h=document.createElement("button");h.className=n,h.setAttribute("type","button"),h.title=a,h.appendChild("string"==typeof s?document.createTextNode(s):s),h.addEventListener(Y.A.CLICK,this.handleClick_.bind(this,i),!1);const c=document.createElement("button");c.className=r,c.setAttribute("type","button"),c.title=l,c.appendChild("string"==typeof o?document.createTextNode(o):o),c.addEventListener(Y.A.CLICK,this.handleClick_.bind(this,-i),!1);const u=e+" "+X.XI+" "+X.$N,d=this.element;d.className=u,d.appendChild(h),d.appendChild(c),this.duration_=void 0!==t.duration?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const e=this.getMap().getView();if(!e)return;const i=e.getZoom();if(void 0!==i){const n=e.getConstrainedZoom(i+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:mt.vT})):e.setZoom(n)}}}const xt=yt,Et="active";class At extends a.A{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(Et)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Et,t)}setMap(t){this.map_=t}}function wt(t,e,i,n){const r=t.getZoom();if(void 0===r)return;const s=t.getConstrainedZoom(r+e),o=t.getResolutionForZoom(s);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:i,duration:void 0!==n?n:250,easing:mt.vT})}const bt=At,Tt=class extends bt{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:250}handleEvent(t){let e=!1;if(t.type==tt.DBLCLICK){const i=t.originalEvent,n=t.map,r=t.coordinate,s=i.shiftKey?-this.delta_:this.delta_;wt(n.getView(),s,r,this.duration_),i.preventDefault(),e=!0}return!e}};function Ct(t){const e=t.length;let i=0,n=0;for(let r=0;r0}}else if(t.type==tt.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==tt.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}};function Rt(t){const e=arguments;return function(t){let i=!0;for(let n=0,r=e.length;n0&&this.condition_(t)){const e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}};var Gt=i(4214);const zt=class extends St{constructor(t){t=t||{},super({stopDown:L.W8}),this.condition_=t.condition?t.condition:It,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!kt(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===Gt.b8)return;const n=e.getSize(),r=t.pixel,s=Math.atan2(n[1]/2-r[1],r[0]-n[0]/2);if(void 0!==this.lastAngle_){const t=s-this.lastAngle_;i.adjustRotationInternal(-t)}this.lastAngle_=s}handleUpEvent(t){return!kt(t)||(t.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(t){return!!kt(t)&&(!(!Mt(t)||!this.condition_(t))&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0))}};class Bt extends r.A{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,i="px",n=this.element_.style;n.left=Math.min(t[0],e[0])+i,n.top=Math.min(t[1],e[1])+i,n.width=Math.abs(e[0]-t[0])+i,n.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const t=this.startPixel_,e=this.endPixel_,i=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);i[4]=i[0].slice(),this.geometry_?this.geometry_.setCoordinates([i]):this.geometry_=new l.Ay([i])}getGeometry(){return this.geometry_}}const Ut=Bt,Vt="boxcancel";class Xt extends o.Ay{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}const Zt=class extends St{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.box_=new Ut(t.className||"ol-dragbox"),this.minArea_=void 0!==t.minArea?t.minArea:64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition?t.condition:Mt,this.boxEndCondition_=t.boxEndCondition?t.boxEndCondition:this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const n=i[0]-e[0],r=i[1]-e[1];return n*n+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new Xt("boxdrag",t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;this.box_.setMap(null);const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new Xt(e?"boxend":Vt,t.coordinate,t)),!1}handleDownEvent(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Xt("boxstart",t.coordinate,t)),!0)}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Xt(Vt,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}},Wt=class extends Zt{constructor(t){super({condition:(t=t||{}).condition?t.condition:Dt,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=void 0!==t.duration?t.duration:200,this.out_=void 0!==t.out&&t.out}onBoxEnd(t){const e=this.getMap().getView();let i=this.getGeometry();if(this.out_){const t=e.rotatedExtentForGeometry(i),n=e.getResolutionForExtentInternal(t),r=e.getResolution()/n;i=i.clone(),i.scale(r*r)}e.fitInternal(i,{duration:this.duration_,easing:mt.vT})}},$t="ArrowLeft",qt="ArrowRight",Yt="ArrowDown",Ht=class extends bt{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return Ot(t)&&Ft(t)},this.condition_=void 0!==t.condition?t.condition:this.defaultCondition_,this.duration_=void 0!==t.duration?t.duration:100,this.pixelDelta_=void 0!==t.pixelDelta?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==Y.A.KEYDOWN){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==Yt||n==$t||n==qt||"ArrowUp"==n)){const r=t.map.getView(),s=r.getResolution()*this.pixelDelta_;let o=0,a=0;n==Yt?a=-s:n==$t?o=-s:n==qt?o=s:a=s;const l=[o,a];(0,N.e$)(l,r.getRotation()),function(t,e,i){const n=t.getCenterInternal();if(n){const r=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:mt.sn,center:t.getConstrainedCenter(r)})}}(r,l,this.duration_),i.preventDefault(),e=!0}}return!e}},Kt=class extends bt{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!function(t){const e=t.originalEvent;return nt.ew?e.metaKey:e.ctrlKey}(t)&&Ft(t)},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:100}handleEvent(t){let e=!1;if(t.type==Y.A.KEYDOWN||t.type==Y.A.KEYPRESS){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&("+"===n||"-"===n)){const r=t.map,s="+"===n?this.delta_:-this.delta_;wt(r.getView(),s,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}},Jt=class extends bt{constructor(t){super(t=t||{}),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=void 0!==t.maxDelta?t.maxDelta:1,this.duration_=void 0!==t.duration?t.duration:250,this.timeout_=void 0!==t.timeout?t.timeout:80,this.useAnchor_=void 0===t.useAnchor||t.useAnchor,this.constrainResolution_=void 0!==t.constrainResolution&&t.constrainResolution;const e=t.condition?t.condition:Lt;this.condition_=t.onFocusOnly?Rt(Pt,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();t&&t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)}handleEvent(t){if(!this.condition_(t))return!0;if(t.type!==Y.A.WHEEL)return!0;const e=t.map,i=t.originalEvent;let n;if(i.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==Y.A.WHEEL&&(n=i.deltaY,nt._p&&i.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(n/=nt.cr),i.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=40)),0===n)return!1;this.lastDelta_=n;const r=Date.now();void 0===this.startTime_&&(this.startTime_=r),(!this.mode_||r-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(n)<4?"trackpad":"wheel");const s=e.getView();if("trackpad"===this.mode_&&!s.getConstrainResolution()&&!this.constrainResolution_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(s.getAnimating()&&s.cancelAnimations(),s.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),s.adjustZoom(-n/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=r,!1;this.totalDelta_+=n;const o=Math.max(this.timeout_-(r-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,e),o),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-(0,c.qE)(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),wt(e,i,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}},Qt=class extends St{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=L.W8),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==t.threshold?t.threshold:.3,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],n=this.targetPointers[1],r=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(void 0!==this.lastAngle_){const t=r-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=r;const s=t.map,o=s.getView();o.getConstraints().rotation!==Gt.b8&&(this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(Ct(this.targetPointers))),this.rotating_&&(s.render(),o.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return!(this.targetPointers.length<2)||(t.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}},te=class extends St{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=L.W8),super(e),this.anchor_=null,this.duration_=void 0!==t.duration?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.targetPointers[1],r=i.clientX-n.clientX,s=i.clientY-n.clientY,o=Math.sqrt(r*r+s*s);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,l=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(Ct(this.targetPointers))),a.render(),l.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map.getView(),i=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,i),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}};var ee=i(8538),ie=i(2602);function ne(t){t instanceof k.A?t.setMapInternal(null):t instanceof H.A&&t.getLayers().forEach(ne)}function re(t,e){if(t instanceof k.A)t.setMapInternal(e);else if(t instanceof H.A){const i=t.getLayers().getArray();for(let t=0,n=i.length;tthis.updateSize())),this.controls=e.controls||function(t){t=t||{};const e=new n.A;return(void 0===t.zoom||t.zoom)&&e.push(new xt(t.zoomOptions)),(void 0===t.rotate||t.rotate)&&e.push(new vt(t.rotateOptions)),(void 0===t.attribution||t.attribution)&&e.push(new pt(t.attributionOptions)),e}(),this.interactions=e.interactions||function(t){t=t||{};const e=new n.A,i=new R(-.005,.05,100);return(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new zt),(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new Tt({delta:t.zoomDelta,duration:t.zoomDuration})),(void 0===t.dragPan||t.dragPan)&&e.push(new jt({onFocusOnly:t.onFocusOnly,kinetic:i})),(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new Qt),(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new te({duration:t.zoomDuration})),(void 0===t.keyboard||t.keyboard)&&(e.push(new Ht),e.push(new Kt({delta:t.zoomDelta,duration:t.zoomDuration}))),(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new Jt({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration})),(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new Wt({duration:t.zoomDuration})),e}({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new lt.A(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(at.A.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(at.A.VIEW,this.handleViewChanged_),this.addChangeListener(at.A.SIZE,this.handleSizeChanged_),this.addChangeListener(at.A.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;!t.view||t.view instanceof ht.default||t.view.then((function(t){i.setView(new ht.default(t))})),this.controls.addEventListener(I.A.ADD,(t=>{t.element.setMap(this)})),this.controls.addEventListener(I.A.REMOVE,(t=>{t.element.setMap(null)})),this.interactions.addEventListener(I.A.ADD,(t=>{t.element.setMap(this)})),this.interactions.addEventListener(I.A.REMOVE,(t=>{t.element.setMap(null)})),this.overlays_.addEventListener(I.A.ADD,(t=>{this.addOverlayInternal_(t.element)})),this.overlays_.addEventListener(I.A.REMOVE,(t=>{const e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)})),this.controls.forEach((t=>{t.setMap(this)})),this.interactions.forEach((t=>{t.setMap(this)})),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){re(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const n=this.getCoordinateFromPixelInternal(t),r=void 0!==(i=void 0!==i?i:{}).hitTolerance?i.hitTolerance:0,s=void 0!==i.layerFilter?i.layerFilter:L.rT,o=!1!==i.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,r,o,e,null,s,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,(function(t){i.push(t)}),e),i}getAllLayers(){const t=[];return function e(i){i.forEach((function(i){i instanceof H.A?e(i.getLayers()):t.push(i)}))}(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t),n=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:L.rT,r=void 0!==e.hitTolerance?e.hitTolerance:0,s=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,s,n,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const e=this.viewport_.getBoundingClientRect(),i=this.getSize(),n=e.width/i[0],r=e.height/i[1],s="changedTouches"in t?t.changedTouches[0]:t;return[(s.clientX-e.left)/n,(s.clientY-e.top)/r]}getTarget(){return this.get(at.A.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return(0,h.toUserCoordinate)(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?(0,O.Bb)(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(at.A.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof n.A)return void e.setLayers(t);const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e=0;i--){const n=e[i];if(n.getMap()===this&&n.getActive()&&this.getTargetElement()&&(!n.handleEvent(t)||t.propagationStopped))break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let i=this.maxTilesLoading_,n=i;if(t){const e=t.viewHints;if(e[ct.A.ANIMATING]||e[ct.A.INTERACTING]){const e=Date.now()-t.time>8;i=e?0:8,n=e?0:2}}e.getTilesLoading(){this.postRenderTimeoutHandle_=void 0,this.handlePostRender()}),0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new H.i("removelayer",e)),this.set(at.A.LAYERGROUP,t)}setSize(t){this.set(at.A.SIZE,t)}setTarget(t){this.set(at.A.TARGET,t)}setView(t){if(!t||t instanceof ht.default)return void this.set(at.A.VIEW,t);this.set(at.A.VIEW,new ht.default);const e=this;t.then((function(t){e.setView(new ht.default(t))}))}updateSize(){const t=this.getTargetElement();let e;if(t){const i=getComputedStyle(t),n=t.offsetWidth-parseFloat(i.borderLeftWidth)-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight)-parseFloat(i.borderRightWidth),r=t.offsetHeight-parseFloat(i.borderTopWidth)-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom)-parseFloat(i.borderBottomWidth);isNaN(n)||isNaN(r)||(e=[n,r],!(0,ee.Ie)(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&(0,ie.R8)("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&(0,gt.aI)(e,i)||(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}}const oe=se;var ae=i(6490),le=i(9519),he=i(5291),ce=i(2473),ue=i(1218),de=i(8724),ge=i(64)},7173:(t,e,i)=>{"use strict";i.r(e),i.d(e,{Graticule:()=>n.A,Group:()=>r.A,Heatmap:()=>s.default,Image:()=>o.A,Layer:()=>a.A,Tile:()=>l.default,Vector:()=>h.A,VectorImage:()=>b,VectorTile:()=>T.default,WebGLPoints:()=>I,WebGLTile:()=>P.default});var n=i(1030),r=i(1130),s=i(9145),o=i(1266),a=i(2e3),l=i(9621),h=i(2726),c=i(888),u=i(3736),d=i(208),g=i(8417),f=i(5770),p=i(4289),m=i(8495),_=i(9611),v=i(7659),y=i(2005),x=i(3839);class E extends u.A{constructor(t){super(t),this.vectorRenderer_=new d.A(t),this.layerImageRatio_=t.getImageRatio(),this.coordinateToVectorPixelTransform_=(0,v.vt)(),this.renderedPixelToCoordinateTransform_=null}disposeInternal(){this.vectorRenderer_.dispose(),super.disposeInternal()}getFeatures(t){if(!this.vectorRenderer_)return Promise.resolve([]);const e=(0,v.Bb)(this.coordinateToVectorPixelTransform_,(0,v.Bb)(this.renderedPixelToCoordinateTransform_,t.slice()));return this.vectorRenderer_.getFeatures(e)}handleFontsChanged(){this.vectorRenderer_.handleFontsChanged()}prepareFrame(t){const e=t.pixelRatio,i=t.viewState,n=i.resolution,r=t.viewHints,s=this.vectorRenderer_;let o=t.extent;1!==this.layerImageRatio_&&(o=o.slice(0),(0,x.Af)(o,this.layerImageRatio_));const a=(0,x.RG)(o)/n,l=(0,x.Oq)(o)/n;if(!r[_.A.ANIMATING]&&!r[_.A.INTERACTING]&&!(0,x.Im)(o)){s.useContainer(null,null);const r=s.context,h=t.layerStatesArray[t.layerIndex],c=Object.assign({},h,{opacity:1}),u=Object.assign({},t,{extent:o,size:[a,l],viewState:Object.assign({},t.viewState,{rotation:0}),layerStatesArray:[c],layerIndex:0,declutter:null}),d=this.getLayer().getDeclutter();d&&(u.declutter={[d]:new m(9)});let _=!0;const x=new f.A(o,n,e,r.canvas,(function(t){s.prepareFrame(u)&&s.replayGroupChanged&&(s.clipping=!1,s.renderFrame(u,null)&&(s.renderDeclutter(u),s.renderDeferred(u),_=!1),t())}));x.addEventListener(g.A.CHANGE,(()=>{if(x.getState()!==p.A.LOADED)return;this.image_=_?null:x;const t=x.getPixelRatio(),n=(0,y.m)(x.getResolution())*e/t;this.renderedResolution=n,this.coordinateToVectorPixelTransform_=(0,v.Zz)(this.coordinateToVectorPixelTransform_,a/2,l/2,1/n,-1/n,0,-i.center[0],-i.center[1])})),x.load()}return this.image_&&(this.renderedPixelToCoordinateTransform_=t.pixelToCoordinateTransform.slice()),!!this.image_}preRender(){}postRender(){}renderDeclutter(){}forEachFeatureAtCoordinate(t,e,i,n,r){return this.vectorRenderer_?this.vectorRenderer_.forEachFeatureAtCoordinate(t,e,i,n,r):super.forEachFeatureAtCoordinate(t,e,i,n,r)}}const A=E;class w extends c.A{constructor(t){t=t||{};const e=Object.assign({},t);delete e.imageRatio,super(e),this.imageRatio_=void 0!==t.imageRatio?t.imageRatio:1}getImageRatio(){return this.imageRatio_}createRenderer(){return new A(this)}}const b=w;var T=i(6030),C=i(6825),S=i(3539);class R extends a.A{constructor(t){super(Object.assign({},t)),this.parseResult_=(0,S.my)(t.style),this.styleVariables_=t.style.variables||{},this.hitDetectionDisabled_=!!t.disableHitDetection}createRenderer(){const t=Object.keys(this.parseResult_.attributes).map((t=>({name:t,...this.parseResult_.attributes[t]})));return new C.A(this,{vertexShader:this.parseResult_.builder.getSymbolVertexShader(),fragmentShader:this.parseResult_.builder.getSymbolFragmentShader(),hitDetectionEnabled:!this.hitDetectionDisabled_,uniforms:this.parseResult_.uniforms,attributes:t})}updateStyleVariables(t){Object.assign(this.styleVariables_,t),this.changed()}}const I=R;var P=i(3828)},1856:(t,e,i)=>{"use strict";i.d(e,{A:()=>h});var n=i(1796),r=i(3064),s=i(9891),o=i(4504),a=i(4769);class l extends n.A{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);"object"==typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[r.A.OPACITY]=void 0!==t.opacity?t.opacity:1,(0,o.v)("number"==typeof e[r.A.OPACITY],"Layer opacity must be a number"),e[r.A.VISIBLE]=void 0===t.visible||t.visible,e[r.A.Z_INDEX]=t.zIndex,e[r.A.MAX_RESOLUTION]=void 0!==t.maxResolution?t.maxResolution:1/0,e[r.A.MIN_RESOLUTION]=void 0!==t.minResolution?t.minResolution:0,e[r.A.MIN_ZOOM]=void 0!==t.minZoom?t.minZoom:-1/0,e[r.A.MAX_ZOOM]=void 0!==t.maxZoom?t.maxZoom:1/0,this.className_=void 0!==e.className?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:void 0===t||t},i=this.getZIndex();return e.opacity=(0,a.qE)(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i||e.managed?i:1/0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return(0,s.b0)()}getLayerStatesArray(t){return(0,s.b0)()}getExtent(){return this.get(r.A.EXTENT)}getMaxResolution(){return this.get(r.A.MAX_RESOLUTION)}getMinResolution(){return this.get(r.A.MIN_RESOLUTION)}getMinZoom(){return this.get(r.A.MIN_ZOOM)}getMaxZoom(){return this.get(r.A.MAX_ZOOM)}getOpacity(){return this.get(r.A.OPACITY)}getSourceState(){return(0,s.b0)()}getVisible(){return this.get(r.A.VISIBLE)}getZIndex(){return this.get(r.A.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(r.A.EXTENT,t)}setMaxResolution(t){this.set(r.A.MAX_RESOLUTION,t)}setMinResolution(t){this.set(r.A.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(r.A.MAX_ZOOM,t)}setMinZoom(t){this.set(r.A.MIN_ZOOM,t)}setOpacity(t){(0,o.v)("number"==typeof t,"Layer opacity must be a number"),this.set(r.A.OPACITY,t)}setVisible(t){this.set(r.A.VISIBLE,t)}setZIndex(t){this.set(r.A.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}const h=l},5348:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var n=i(2e3),r=i(9132);class s extends n.A{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.setPreload(void 0!==t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError)}getPreload(){return this.get(r.A.PRELOAD)}setPreload(t){this.set(r.A.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(r.A.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(r.A.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}const o=s},888:(t,e,i)=>{"use strict";i.d(e,{A:()=>Z});var n=i(2e3),r=i(8495),s=i(5152),o=i(7033),a=i(6808),l=i(4728),h=i(7604),c=i(5893),u=i(1518),d=i(9837),g=i(8e3);function f(t,e,i){const n=(0,d.qg)(t,i);if(!(0,d.ho)(e,n.type)){const t=(0,d.go)(e),i=(0,d.go)(n.type);throw new Error(`Expected expression to be of type ${t}, got ${i}`)}return p(n,i)}function p(t,e){if(t instanceof d._D){if(t.type===d.mE&&"string"==typeof t.value){const e=(0,g.sH)(t.value);return function(){return e}}return function(){return t.value}}const i=t.operator;switch(i){case d.ZD.Number:case d.ZD.String:case d.ZD.Coalesce:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i{for(let e=0;e{for(let e=0;et.properties[e];case d.ZD.Var:return t=>t.variables[e];default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}(t);case d.ZD.Id:return t=>t.featureId;case d.ZD.GeometryType:return t=>t.geometryType;case d.ZD.Concat:{const i=t.args.map((t=>p(t,e)));return t=>"".concat(...i.map((e=>e(t).toString())))}case d.ZD.Resolution:return t=>t.resolution;case d.ZD.Any:case d.ZD.All:case d.ZD.Between:case d.ZD.In:case d.ZD.Not:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i{for(let e=0;e{for(let e=0;e{const e=r[0](t),i=r[1](t),n=r[2](t);return e>=i&&e<=n};case d.ZD.In:return t=>{const e=r[0](t);for(let i=1;i!r[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}(t,e);case d.ZD.Equal:case d.ZD.NotEqual:case d.ZD.LessThan:case d.ZD.LessThanOrEqualTo:case d.ZD.GreaterThan:case d.ZD.GreaterThanOrEqualTo:return function(t,e){const i=t.operator,n=p(t.args[0],e),r=p(t.args[1],e);switch(i){case d.ZD.Equal:return t=>n(t)===r(t);case d.ZD.NotEqual:return t=>n(t)!==r(t);case d.ZD.LessThan:return t=>n(t)n(t)<=r(t);case d.ZD.GreaterThan:return t=>n(t)>r(t);case d.ZD.GreaterThanOrEqualTo:return t=>n(t)>=r(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}(t,e);case d.ZD.Multiply:case d.ZD.Divide:case d.ZD.Add:case d.ZD.Subtract:case d.ZD.Clamp:case d.ZD.Mod:case d.ZD.Pow:case d.ZD.Abs:case d.ZD.Floor:case d.ZD.Ceil:case d.ZD.Round:case d.ZD.Sin:case d.ZD.Cos:case d.ZD.Atan:case d.ZD.Sqrt:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i{let e=1;for(let i=0;ir[0](t)/r[1](t);case d.ZD.Add:return t=>{let e=0;for(let i=0;ir[0](t)-r[1](t);case d.ZD.Clamp:return t=>{const e=r[0](t),i=r[1](t);if(en?n:e};case d.ZD.Mod:return t=>r[0](t)%r[1](t);case d.ZD.Pow:return t=>Math.pow(r[0](t),r[1](t));case d.ZD.Abs:return t=>Math.abs(r[0](t));case d.ZD.Floor:return t=>Math.floor(r[0](t));case d.ZD.Ceil:return t=>Math.ceil(r[0](t));case d.ZD.Round:return t=>Math.round(r[0](t));case d.ZD.Sin:return t=>Math.sin(r[0](t));case d.ZD.Cos:return t=>Math.cos(r[0](t));case d.ZD.Atan:return 2===n?t=>Math.atan2(r[0](t),r[1](t)):t=>Math.atan(r[0](t));case d.ZD.Sqrt:return t=>Math.sqrt(r[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}(t,e);case d.ZD.Case:return function(t,e){const i=t.args.length,n=new Array(i);for(let r=0;r{for(let e=0;e{const e=n[0](t);for(let r=1;r{const e=n[0](t),r=n[1](t);let s,o;for(let a=2;a=r)return 2===a?l:h?_(e,r,s,o,i,l):m(e,r,s,o,i,l);s=i,o=l}return o}}(t,e);case d.ZD.ToString:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i{const i=r[0](e);return t.args[0].type===d.mE?(0,g.dI)(i):i.toString()};throw new Error(`Unsupported convert operator ${i}`)}(t,e);default:throw new Error(`Unsupported operator ${i}`)}}function m(t,e,i,n,r,s){const o=r-i;if(0===o)return n;const a=e-i;return n+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(s-n)}function _(t,e,i,n,r,s){if(0==r-i)return n;const o=(0,g.eE)(n),a=(0,g.eE)(s);let l=a[2]-o[2];l>180?l-=360:l<-180&&(l+=360);const h=[m(t,e,i,o[0],r,a[0]),m(t,e,i,o[1],r,a[1]),o[2]+m(t,e,i,0,r,l),m(t,e,i,n[3],r,s[3])];return(0,g.S8)((0,g.cD)(h))}var v=i(3358),y=i(8538);function x(t){return!0}function E(t){const e=(0,d.SR)(),i=t.length,n=new Array(i);for(let r=0;r4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function U(t,e){const i=j(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}const V="renderOrder";class X extends n.A{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=void 0!==t.renderBuffer?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=void 0!==t.updateWhileAnimating&&t.updateWhileAnimating,this.updateWhileInteracting_=void 0!==t.updateWhileInteracting&&t.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(V)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();i in t.declutter==0&&(t.declutter[i]=new r(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(V,t)}setStyle(t){this.style_=void 0===t?s.d1:t;const e=function(t){if(void 0===t)return s.d1;if(!t)return null;if("function"==typeof t)return t;if(t instanceof s.Ay)return t;if(!Array.isArray(t))return E([t]);if(0===t.length)return[];const e=t.length,i=t[0];if(i instanceof s.Ay){const i=new Array(e);for(let n=0;n{"use strict";i.d(e,{A:()=>T});var n=i(2435),r=i(6788),s=i(6097),o=i(6808),a=i(7781),l=i(250),h=i(5893),c=i(5152),u=i(1518),d=i(2726),g=i(1736),f=i(3839),p=i(4769),m=i(4137),_=i(6409),v=i(7672),y=i(7659),x=i(4580);function E(t,e,i){const n=[];let r=t(0),s=t(1),o=e(r),a=e(s);const l=[s,r],h=[a,o],c=[1,0],u={};let d,g,f,m,_,v,y=1e5;for(;--y>0&&c.length>0;)f=c.pop(),r=l.pop(),o=h.pop(),v=f.toString(),v in u||(n.push(o[0],o[1]),u[v]=!0),m=c.pop(),s=l.pop(),a=h.pop(),_=(f+m)/2,d=t(_),g=e(d),(0,p.Q1)(g[0],g[1],o[0],o[1],a[0],a[1]){const e=t.get("graticule_label");return this.lonLabelStyleBase_.getText().setText(e),this.lonLabelStyleBase_},this.latLabelStyleBase_=new c.Ay({text:void 0!==t.latLabelStyle?t.latLabelStyle.clone():new u.A({font:"12px Calibri,sans-serif",textAlign:"right",fill:new o.A({color:"rgba(0,0,0,1)"}),stroke:new h.A({color:"rgba(255,255,255,1)",width:3})})}),this.latLabelStyle_=t=>{const e=t.get("graticule_label");return this.latLabelStyleBase_.getText().setText(e),this.latLabelStyleBase_},this.meridiansLabels_=[],this.parallelsLabels_=[],this.addEventListener(r.A.POSTRENDER,this.drawLabels_.bind(this))),this.intervals_=void 0!==t.intervals?t.intervals:w,this.setSource(new g.A({loader:this.loaderFunction.bind(this),strategy:this.strategyFunction.bind(this),features:new n.A,overlaps:!1,useSpatialIndex:!1,wrapX:t.wrapX})),this.featurePool_=[],this.lineStyle_=new c.Ay({stroke:this.strokeStyle_}),this.loadedExtent_=null,this.renderedExtent_=null,this.renderedResolution_=null,this.setRenderOrder(null)}strategyFunction(t,e){let i=t.slice();return this.projection_&&this.getSource().getWrapX()&&(0,f.Li)(i,this.projection_),this.loadedExtent_&&((0,f.bE)(this.loadedExtent_,i,e)?i=this.loadedExtent_.slice():this.getSource().removeLoadedExtent(this.loadedExtent_)),[i]}loaderFunction(t,e,i){this.loadedExtent_=t;const n=this.getSource(),r=this.getExtent()||[-1/0,-1/0,1/0,1/0],o=(0,f._N)(r,t);if(this.renderedExtent_&&(0,f.aI)(this.renderedExtent_,o)&&this.renderedResolution_===e)return;if(this.renderedExtent_=o,this.renderedResolution_=e,(0,f.Im)(o))return;const a=(0,f.q1)(o),l=e*e/4;(!this.projection_||!(0,_.equivalent)(this.projection_,i))&&this.updateProjectionInfo_(i),this.createGraticule_(o,a,e,l);let h,c=this.meridians_.length+this.parallels_.length;for(this.meridiansLabels_&&(c+=this.meridians_.length),this.parallelsLabels_&&(c+=this.parallels_.length);c>this.featurePool_.length;)h=new s.default,this.featurePool_.push(h);const u=n.getFeaturesCollection();u.clear();let d,g,p=0;for(d=0,g=this.meridians_.length;dMath.PI/2);const d=function(t){if(!(t.context instanceof CanvasRenderingContext2D))throw new Error("Only works for render events from Canvas 2D layers");const e=t.inversePixelTransform[0],i=t.inversePixelTransform[1],n=Math.sqrt(e*e+i*i),r=t.frameState,s=(0,y.lw)(t.inversePixelTransform.slice(),r.coordinateToPixelTransform),o=(0,x.j)(r.viewState.resolution,n);let a;const l=(0,_.getUserProjection)();return l&&(a=(0,_.getTransformFromProjections)(l,r.viewState.projection)),new v.A(t.context,n,r.extent,s,r.viewState.rotation,o,a)}(t);for(let t=a;t<=l;++t){let i,n,c,g,f=this.meridians_.length+this.parallels_.length;if(this.meridiansLabels_)for(n=0,c=this.meridiansLabels_.length;n=a?(t[0]=o[0],t[2]=o[2]):s=!0);const l=[(0,p.qE)(e[0],this.minX_,this.maxX_),(0,p.qE)(e[1],this.minY_,this.maxY_)],h=this.toLonLatTransform_(l);isNaN(h[1])&&(h[1]=Math.abs(this.maxLat_)>=Math.abs(this.minLat_)?this.maxLat_:this.minLat_);let c=(0,p.qE)(h[0],this.minLon_,this.maxLon_),u=(0,p.qE)(h[1],this.minLat_,this.maxLat_);const d=this.maxLines_;let g,m,_,v,y=t;s||(y=[(0,p.qE)(t[0],this.minX_,this.maxX_),(0,p.qE)(t[1],this.minY_,this.maxY_),(0,p.qE)(t[2],this.minX_,this.maxX_),(0,p.qE)(t[3],this.minY_,this.maxY_)]);const x=(0,f.NW)(y,this.toLonLatTransform_,void 0,8);let E=x[3],A=x[2],w=x[1],b=x[0];if(s||((0,f.Ym)(y,this.bottomLeft_)&&(b=this.minLon_,w=this.minLat_),(0,f.Ym)(y,this.bottomRight_)&&(A=this.maxLon_,w=this.minLat_),(0,f.Ym)(y,this.topLeft_)&&(b=this.minLon_,E=this.maxLat_),(0,f.Ym)(y,this.topRight_)&&(A=this.maxLon_,E=this.maxLat_),E=(0,p.qE)(E,u,this.maxLat_),A=(0,p.qE)(A,c,this.maxLon_),w=(0,p.qE)(w,this.minLat_,u),b=(0,p.qE)(b,this.minLon_,c)),c=Math.floor(c/r)*r,v=(0,p.qE)(c,this.minLon_,this.maxLon_),m=this.addMeridian_(v,w,E,n,t,0),g=0,s)for(;(v-=r)>=b&&g++n[s]&&(r=s,s=1);const o=Math.max(e[1],n[r]),a=Math.min(e[3],n[s]),l=(0,p.qE)(e[1]+Math.abs(e[1]-e[3])*this.lonLabelPosition_,o,a),h=[n[r-1]+(n[s-1]-n[r-1])*(l-n[r])/(n[s]-n[r]),l],c=this.meridiansLabels_[i].geom;return c.setCoordinates(h),c}getMeridians(){return this.meridians_}getParallel_(t,e,i,n,r){const s=function(t,e,i,n,r){const s=(0,_.get)("EPSG:4326");return E((function(n){return[e+(i-e)*n,t]}),(0,_.getTransform)(s,n),r)}(t,e,i,this.projection_,n);let o=this.parallels_[r];return o?(o.setFlatCoordinates("XY",s),o.changed()):o=new a.A(s,"XY"),o}getParallelPoint_(t,e,i){const n=t.getFlatCoordinates();let r=0,s=n.length-2;n[r]>n[s]&&(r=s,s=0);const o=Math.max(e[0],n[r]),a=Math.min(e[2],n[s]),l=(0,p.qE)(e[0]+Math.abs(e[0]-e[2])*this.latLabelPosition_,o,a),h=[l,n[r+1]+(n[s+1]-n[r+1])*(l-n[r])/(n[s]-n[r])],c=this.parallelsLabels_[i].geom;return c.setCoordinates(h),c}getParallels(){return this.parallels_}updateProjectionInfo_(t){const e=(0,_.get)("EPSG:4326"),i=t.getWorldExtent();this.maxLat_=i[3],this.maxLon_=i[2],this.minLat_=i[1],this.minLon_=i[0];const n=(0,_.getTransform)(t,e);if(this.minLon_=Math.abs(this.minLat_)?this.maxLat_:this.minLat_),this.projection_=t}}const T=b},1130:(t,e,i)=>{"use strict";i.d(e,{A:()=>_,i:()=>f});var n=i(1856),r=i(2435),s=i(4211),o=i(7777),a=i(8417),l=i(7262),h=i(4504),c=i(3358),u=i(3839),d=i(9891),g=i(554);class f extends o.Ay{constructor(t,e){super(t),this.layer=e}}const p="layers";class m extends n.A{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(p,this.handleLayersChanged_),i?Array.isArray(i)?i=new r.A(i.slice(),{unique:!0}):(0,h.v)("function"==typeof i.getArray,"Expected `layers` to be an array or a `Collection`"):i=new r.A(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(g.JH),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push((0,g.KT)(t,s.A.ADD,this.handleLayersAdd_,this),(0,g.KT)(t,s.A.REMOVE,this.handleLayersRemove_,this));for(const t in this.listenerKeys_)this.listenerKeys_[t].forEach(g.JH);(0,c.I)(this.listenerKeys_);const e=t.getArray();for(let t=0,i=e.length;t{"use strict";i.r(e),i.d(e,{default:()=>g});var n=i(888),r=i(6825),s=i(2470),o=i(4769),a=i(6843);const l="blur",h="gradient",c="radius",u=["#00f","#0ff","#0f0","#ff0","#f00"];class d extends n.A{constructor(t){t=t||{};const e=Object.assign({},t);delete e.gradient,delete e.radius,delete e.blur,delete e.weight,super(e),this.gradient_=null,this.addChangeListener(h,this.handleGradientChanged_),this.setGradient(t.gradient?t.gradient:u),this.setBlur(void 0!==t.blur?t.blur:15),this.setRadius(void 0!==t.radius?t.radius:8);const i=t.weight?t.weight:"weight";this.weightFunction_="string"==typeof i?function(t){return t.get(i)}:i,this.setRenderOrder(null)}getBlur(){return this.get(l)}getGradient(){return this.get(h)}getRadius(){return this.get(c)}handleGradientChanged_(){this.gradient_=function(t){const e=(0,a.Y)(1,256),i=e.createLinearGradient(0,0,1,256),n=1/(t.length-1);for(let e=0,r=t.length;e{const e=this.weightFunction_(t);return void 0!==e?(0,o.qE)(e,0,1):1}}],uniforms:{u_size:()=>2*(this.get(c)+this.get(l)),u_blurSlope:()=>this.get(c)/Math.max(1,this.get(l))},hitDetectionEnabled:!0,vertexShader:t.getSymbolVertexShader(),fragmentShader:t.getSymbolFragmentShader(),postProcesses:[{fragmentShader:"\n precision mediump float;\n\n uniform sampler2D u_image;\n uniform sampler2D u_gradientTexture;\n uniform float u_opacity;\n\n varying vec2 v_texCoord;\n\n void main() {\n vec4 color = texture2D(u_image, v_texCoord);\n gl_FragColor.a = color.a * u_opacity;\n gl_FragColor.rgb = texture2D(u_gradientTexture, vec2(0.5, color.a)).rgb;\n gl_FragColor.rgb *= gl_FragColor.a;\n }",uniforms:{u_gradientTexture:()=>this.gradient_,u_opacity:()=>this.getOpacity()}}]})}renderDeclutter(){}}const g=d},1266:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var n=i(2e3);class r extends n.A{constructor(t){super(t=t||{})}}const s=r;var o=i(3736);const a=class extends s{constructor(t){super(t)}createRenderer(){return new o.A(this)}getData(t){return super.getData(t)}}},2e3:(t,e,i)=>{"use strict";i.d(e,{A:()=>g,l:()=>d});var n=i(1856),r=i(8417),s=i(3064),o=i(6788),a=i(9906),l=i(4504),h=i(3839),c=i(554);class u extends n.A{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(s.A.SOURCE,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return(t=t||[]).push(this),t}getLayerStatesArray(t){return(t=t||[]).push(this.getLayerState()),t}getSource(){return this.get(s.A.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),this.sourceReady_||"ready"!==this.getSource().getState()||(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&((0,c.JH)(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=(0,c.KT)(t,r.A.CHANGE,this.handleSourceChange_,this),"ready"===t.getState()&&(this.sourceReady_=!0,setTimeout((()=>{this.dispatchEvent("sourceready")}),0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();let n;!t&&i&&(t=i.getView()),e=t instanceof a.default?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),n=e.layerStatesArray?e.layerStatesArray.find((t=>t.layer===this)):this.getLayerState();const r=this.getExtent();return d(n,e.viewState)&&(!r||(0,h.HY)(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];let e;const i=this.getSource();if(i&&(e=i.getAttributions()),!e)return[];let n=e(t instanceof a.default?t.getViewStateAndExtent():t);return Array.isArray(n)||(n=[n]),n}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(s.A.MAP,t)}getMapInternal(){return this.get(s.A.MAP)}setMap(t){this.mapPrecomposeKey_&&((0,c.JH)(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&((0,c.JH)(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=(0,c.KT)(t,o.A.PRECOMPOSE,(function(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);(0,l.v)(!e.some((function(t){return t.layer===i.layer})),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}),this),this.mapRenderKey_=(0,c.KT)(this,r.A.CHANGE,t.render,t),this.changed())}setSource(t){this.set(s.A.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}disposeInternal(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),super.disposeInternal()}}function d(t,e){if(!t.visible)return!1;const i=e.resolution;if(i=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}const g=u},3064:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});const n={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"}},9621:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>o});var n=i(5348),r=i(2409);class s extends n.A{constructor(t){super(t)}createRenderer(){return new r.A(this)}}const o=s},9132:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});const n={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"}},2726:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var n=i(888),r=i(208);class s extends n.A{constructor(t){super(t)}createRenderer(){return new r.A(this)}}const o=s},6030:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>T});var n=i(888),r=i(1199),s=i(9084),o=i(2409),a=i(8066),l=i(9611),h=i(9572),c=i(6875),u=i(7659),d=i(2654),g=i(3839),f=i(4580),p=i(9891),m=i(8538),_=i(4137);const v={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},y={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class x extends o.A{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=(0,u.vt)(),this.tileClipContexts_=null}prepareTile(t,e,i){let n;const r=t.getState();return r!==a.A.LOADED&&r!==a.A.ERROR||(this.updateExecutorGroup_(t,e,i),this.tileImageNeedsRender_(t)&&(n=!0)),n}getTile(t,e,i,n){const r=n.pixelRatio,s=n.viewState,o=s.resolution,a=s.projection,h=this.getLayer(),c=h.getSource().getTile(t,e,i,r,a),u=n.viewHints,d=!(u[l.A.ANIMATING]||u[l.A.INTERACTING]);return!d&&c.wantedResolution||(c.wantedResolution=o),this.prepareTile(c,r,a)&&(d||Date.now()-n.time<8)&&"vector"!==h.getRenderMode()&&this.renderTileImage_(c,n),super.getTile(t,e,i,n)}isDrawableTile(t){const e=this.getLayer();return super.isDrawableTile(t)&&("vector"===e.getRenderMode()?(0,p.v6)(e)in t.executorGroups:t.hasContext(e))}getTileImage(t){return t.getImage(this.getLayer())}prepareFrame(t){const e=this.getLayer().getRevision();return this.renderedLayerRevision_!==e&&(this.renderedLayerRevision_=e,this.renderedTiles.length=0),super.prepareFrame(t)}updateExecutorGroup_(t,e,i){const n=this.getLayer(),o=n.getRevision(),l=n.getRenderOrder()||null,h=t.wantedResolution,c=t.getReplayState(n);if(!c.dirty&&c.renderedResolution===h&&c.renderedRevision==o&&c.renderedRenderOrder==l)return;const u=n.getSource(),d=!!n.getDeclutter(),m=u.getTileGrid(),_=u.getTileGridForProjection(i).getTileCoordExtent(t.wrappedTileCoord),v=u.getSourceTiles(e,i,t),y=(0,p.v6)(n);delete t.hitDetectionImageData[y],t.executorGroups[y]=[],c.dirty=!1;for(let i=0,o=v.length;i{const r=v?e.declutter[v].all().map((t=>t.value)):null;for(let e=0,a=n.length;e{const n=this.getLayer(),r=(0,p.v6)(n),s=n.getSource(),o=this.renderedProjection,l=o.getExtent(),h=this.renderedResolution,d=s.getTileGridForProjection(o),f=(0,u.Bb)(this.renderedPixelToCoordinateTransform_,t.slice()),v=d.getTileCoordForCoordAndResolution(f,h);let y;for(let t=0,e=this.renderedTiles.length;t0)return void e([]);const x=d.getTileCoordExtent(y.wrappedTileCoord),E=(0,g.Py)(x),A=[(f[0]-E[0])/h,(E[1]-f[1])/h],w=y.getSourceTiles().reduce((function(t,e){return t.concat(e.getFeatures())}),[]);let b=y.hitDetectionImageData[r];if(!b){const t=(0,m.xq)(d.getTileSize(d.getZForResolution(h,s.zDirection))),e=this.renderedRotation_,i=[this.getRenderTransform(d.getTileCoordCenter(y.wrappedTileCoord),h,0,c.tF,t[0]*c.tF,t[1]*c.tF,0)];b=(0,c._7)(t,i,w,n.getStyleFunction(),d.getTileCoordExtent(y.wrappedTileCoord),y.getReplayState(n).renderedResolution,e),y.hitDetectionImageData[r]=b}e((0,c.F8)(A,w,b))}))}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&void 0!==this.renderedLayerRevision_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}renderDeclutter(t,e){const i=this.context,n=i.globalAlpha;i.globalAlpha=e.opacity;const r=t.viewHints,o=!(r[l.A.ANIMATING]||r[l.A.INTERACTING]),a=this.renderedTiles;for(let e=0,i=a.length;e=0;--e)n[e].execute(this.context,[this.context.canvas.width,this.context.canvas.height],this.getTileRenderTransform(i,t),t.viewState.rotation,o,s.$i,r?t.declutter[r]:void 0)}i.globalAlpha=n}renderDeferredInternal(t){const e=this.renderedTiles.reduce(((t,e,i)=>(e.executorGroups[(0,p.v6)(this.getLayer())].forEach((e=>t.push({executorGroup:e,index:i}))),t)),[]),i=e.map((({executorGroup:t})=>t.getDeferredZIndexContexts())),n={};for(let t=0,i=e.length;t{i.forEach(((i,n)=>{i[t]&&(i[t].forEach((t=>{const{executorGroup:i,index:r}=e[n],s=i.getRenderedContext(),o=s.globalAlpha;s.globalAlpha=this.renderedOpacity_;const a=this.tileClipContexts_[r];a&&a.draw(s),t.draw(s),a&&s.restore(),s.globalAlpha=o,t.clear()})),i[t].length=0)}))}))}getTileRenderTransform(t,e){const i=e.pixelRatio,n=e.viewState,r=n.center,s=n.resolution,o=n.rotation,a=e.size,l=Math.round(a[0]*i),h=Math.round(a[1]*i),c=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),d=t.tileCoord,g=c.getTileCoordExtent(t.wrappedTileCoord),f=c.getTileCoordExtent(d,this.tmpExtent)[0]-g[0];return(0,u.lw)((0,u.hs)(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(r,s,o,i,l,h,f))}postRender(t,e){const i=e.viewHints,n=!(i[l.A.ANIMATING]||i[l.A.INTERACTING]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation,this.renderedOpacity_=e.layerStatesArray[e.layerIndex].opacity;const r=this.getLayer(),o=r.getRenderMode(),a=t.globalAlpha;t.globalAlpha=this.renderedOpacity_;const c=r.getDeclutter(),u=c?y[o].filter((t=>!s.$i.includes(t))):y[o],d=e.viewState,f=d.rotation,m=r.getSource(),_=m.getTileGridForProjection(d.projection).getZForResolution(d.resolution,m.zDirection),v=this.renderedTiles,x=[],E=[],A=[];let w=!0;for(let i=v.length-1;i>=0;--i){const s=v[i];w=w&&!s.getReplayState(r).dirty;const o=s.executorGroups[(0,p.v6)(r)].filter((t=>t.hasExecutors(u)));if(0===o.length)continue;const a=this.getTileRenderTransform(s,e),l=s.tileCoord[0];let d=!1;const m=o[0].getClipCoords(a);let y,b=t;if(m){y=new h.A,b=y.getContext();for(let t=0,e=x.length;t{"use strict";i.r(e),i.d(e,{default:()=>u});var n=i(5348),r=i(3064),s=i(5605),o=i(9837),a=i(7016),l=i(3539);function h(t,e){const i=`\n attribute vec2 ${s.eS.TEXTURE_COORD};\n uniform mat4 ${s.gF.TILE_TRANSFORM};\n uniform float ${s.gF.TEXTURE_PIXEL_WIDTH};\n uniform float ${s.gF.TEXTURE_PIXEL_HEIGHT};\n uniform float ${s.gF.TEXTURE_RESOLUTION};\n uniform float ${s.gF.TEXTURE_ORIGIN_X};\n uniform float ${s.gF.TEXTURE_ORIGIN_Y};\n uniform float ${s.gF.DEPTH};\n\n varying vec2 v_textureCoord;\n varying vec2 v_mapCoord;\n\n void main() {\n v_textureCoord = ${s.eS.TEXTURE_COORD};\n v_mapCoord = vec2(\n ${s.gF.TEXTURE_ORIGIN_X} + ${s.gF.TEXTURE_RESOLUTION} * ${s.gF.TEXTURE_PIXEL_WIDTH} * v_textureCoord[0],\n ${s.gF.TEXTURE_ORIGIN_Y} - ${s.gF.TEXTURE_RESOLUTION} * ${s.gF.TEXTURE_PIXEL_HEIGHT} * v_textureCoord[1]\n );\n gl_Position = ${s.gF.TILE_TRANSFORM} * vec4(${s.eS.TEXTURE_COORD}, ${s.gF.DEPTH}, 1.0);\n }\n `,n={...(0,a.z0)(),inFragmentShader:!0,bandCount:e,style:t},r=[];if(void 0!==t.color){const e=(0,l.s2)(n,t.color,o.mE);r.push(`color = ${e};`)}if(void 0!==t.contrast){const e=(0,l.s2)(n,t.contrast,o.wl);r.push(`color.rgb = clamp((${e} + 1.0) * color.rgb - (${e} / 2.0), vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}if(void 0!==t.exposure){const e=(0,l.s2)(n,t.exposure,o.wl);r.push(`color.rgb = clamp((${e} + 1.0) * color.rgb, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}if(void 0!==t.saturation){const e=(0,l.s2)(n,t.saturation,o.wl);r.push(`\n float saturation = ${e} + 1.0;\n float sr = (1.0 - saturation) * 0.2126;\n float sg = (1.0 - saturation) * 0.7152;\n float sb = (1.0 - saturation) * 0.0722;\n mat3 saturationMatrix = mat3(\n sr + saturation, sr, sr,\n sg, sg + saturation, sg,\n sb, sb, sb + saturation\n );\n color.rgb = clamp(saturationMatrix * color.rgb, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));\n `)}if(void 0!==t.gamma){const e=(0,l.s2)(n,t.gamma,o.wl);r.push(`color.rgb = pow(color.rgb, vec3(1.0 / ${e}));`)}if(void 0!==t.brightness){const e=(0,l.s2)(n,t.brightness,o.wl);r.push(`color.rgb = clamp(color.rgb + ${e}, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}const h={},c=Object.keys(n.variables).length;if(c>1&&!t.variables)throw new Error(`Missing variables in style (expected ${n.variables})`);for(let e=0;e ${s.gF.RENDER_EXTENT}[2] ||\n v_mapCoord[1] > ${s.gF.RENDER_EXTENT}[3]\n ) {\n discard;\n }\n\n vec4 color = texture2D(${s.gF.TILE_TEXTURE_ARRAY}[0], v_textureCoord);\n\n ${r.join("\n")}\n\n gl_FragColor = color;\n gl_FragColor.rgb *= gl_FragColor.a;\n gl_FragColor *= ${s.gF.TRANSITION_ALPHA};\n }`,uniforms:h,paletteTextures:n.paletteTextures}}class c extends n.A{constructor(t){const e=(t=t?Object.assign({},t):{}).style||{};delete t.style;const i=t.cacheSize;delete t.cacheSize,super(t),this.sources_=t.sources,this.renderedSource_=null,this.renderedResolution_=NaN,this.style_=e,this.cacheSize_=i,this.styleVariables_=this.style_.variables||{},this.addChangeListener(r.A.SOURCE,this.handleSourceUpdate_)}getSources(t,e){const i=this.getSource();return this.sources_?"function"==typeof this.sources_?this.sources_(t,e):this.sources_:i?[i]:[]}getRenderSource(){return this.renderedSource_||this.getSource()}getSourceState(){const t=this.getRenderSource();return t?t.getState():"undefined"}handleSourceUpdate_(){this.hasRenderer()&&this.getRenderer().clearCache(),this.getSource()&&this.setStyle(this.style_)}getSourceBandCount_(){const t=Number.MAX_SAFE_INTEGER,e=this.getSources([-t,-t,t,t],t);return e&&e.length&&"bandCount"in e[0]?e[0].bandCount:4}createRenderer(){const t=h(this.style_,this.getSourceBandCount_());return new s.Ay(this,{vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms,cacheSize:this.cacheSize_,paletteTextures:t.paletteTextures})}renderSources(t,e){const i=this.getRenderer();let n;for(let r=0,s=e.length;r{"ready"==e.getState()&&(e.removeEventListener("change",t),this.changed())};e.addEventListener("change",t)}r=r&&"ready"==i}const s=this.renderSources(t,n);if(this.getRenderer().renderComplete&&r)return this.renderedResolution_=i.resolution,s;if(this.renderedResolution_>.5*i.resolution){const e=this.getSources(t.extent,this.renderedResolution_).filter((t=>!n.includes(t)));if(e.length>0)return this.renderSources(t,e)}return s}setStyle(t){this.styleVariables_=t.variables||{},this.style_=t;const e=h(this.style_,this.getSourceBandCount_());this.getRenderer().reset({vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,uniforms:e.uniforms,paletteTextures:e.paletteTextures}),this.changed()}updateStyleVariables(t){Object.assign(this.styleVariables_,t),this.changed()}}c.prototype.dispose;const u=c},4769:(t,e,i)=>{"use strict";function n(t,e,i){return Math.min(Math.max(t,e),i)}function r(t,e,i,n,r,o){const a=r-i,l=o-n;if(0!==a||0!==l){const s=((t-i)*a+(e-n)*l)/(a*a+l*l);s>1?(i=r,n=o):s>0&&(i+=a*s,n+=l*s)}return s(t,e,i,n)}function s(t,e,i,n){const r=i-t,s=n-e;return r*r+s*s}function o(t){const e=t.length;for(let i=0;ir&&(r=e,n=s)}if(0===r)return null;const s=t[n];t[n]=t[i],t[i]=s;for(let n=i+1;n=0;n--){i[n]=t[n][e]/t[n][n];for(let r=n-1;r>=0;r--)t[r][e]-=t[r][n]*i[n]}return i}function a(t){return 180*t/Math.PI}function l(t){return t*Math.PI/180}function h(t,e){const i=t%e;return i*e<0?i+e:i}function c(t,e,i){return t+i*(e-t)}function u(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function d(t,e){return Math.round(u(t,e))}function g(t,e){return Math.floor(u(t,e))}function f(t,e){return Math.ceil(u(t,e))}i.d(e,{Cc:()=>c,KU:()=>o,LI:()=>d,Mg:()=>u,Q1:()=>r,RI:()=>g,eh:()=>l,hG:()=>s,mk:()=>f,qE:()=>n,xP:()=>h,xW:()=>a})},3358:(t,e,i)=>{"use strict";function n(t){for(const e in t)delete t[e]}function r(t){let e;for(e in t)return!1;return!e}i.d(e,{I:()=>n,p:()=>r})},7601:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});const n={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"}},6409:(t,e,i)=>{"use strict";i.r(e),i.d(e,{METERS_PER_UNIT:()=>_.I,Projection:()=>n.A,addCommon:()=>ot,addCoordinateTransforms:()=>G,addEquivalentProjections:()=>D,addEquivalentTransforms:()=>F,addProjection:()=>P,addProjections:()=>L,clearAllProjections:()=>k,clearUserProjection:()=>H,cloneTransform:()=>R,createProjection:()=>N,createSafeCoordinateTransform:()=>st,createTransformFromCoordinateTransform:()=>j,disableCoordinateWarning:()=>S,equivalent:()=>U,fromLonLat:()=>z,fromUserCoordinate:()=>tt,fromUserExtent:()=>it,fromUserResolution:()=>rt,get:()=>M,getPointResolution:()=>O,getTransform:()=>X,getTransformFromProjections:()=>V,getUserProjection:()=>K,identityTransform:()=>I,setUserProjection:()=>Y,toLonLat:()=>B,toUserCoordinate:()=>Q,toUserExtent:()=>et,toUserResolution:()=>nt,transform:()=>Z,transformExtent:()=>W,transformWithProjections:()=>$,useGeographic:()=>J});var n=i(1338);const r=6378137,s=Math.PI*r,o=[-s,-s,s,s],a=[-180,-85,180,85],l=r*Math.log(Math.tan(Math.PI/2));class h extends n.A{constructor(t){super({code:t,units:"m",extent:o,global:!0,worldExtent:a,getPointResolution:function(t,e){return t/Math.cosh(e[1]/r)}})}}const c=[new h("EPSG:3857"),new h("EPSG:102100"),new h("EPSG:102113"),new h("EPSG:900913"),new h("http://www.opengis.net/def/crs/EPSG/0/3857"),new h("http://www.opengis.net/gml/srs/epsg.xml#3857")];function u(t,e,i){const n=t.length;i=i>1?i:2,void 0===e&&(e=i>2?t.slice():new Array(n));for(let o=0;ol?i=l:i<-l&&(i=-l),e[o+1]=i}return e}function d(t,e,i){const n=t.length;i=i>1?i:2,void 0===e&&(e=i>2?t.slice():new Array(n));for(let o=0;o=o?e[s+t]:r[t]}return i}}function G(t,e,i,n){const r=M(t),s=M(e);x(r,s,j(i)),x(s,r,j(n))}function z(t,e){return S(),Z(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")}function B(t,e){const i=Z(t,void 0!==e?e:"EPSG:3857","EPSG:4326"),n=i[0];return(n<-180||n>180)&&(i[0]=(0,A.xP)(n+180,360)-180),i}function U(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();return(t.getCode()===e.getCode()||V(t,e)===R)&&i}function V(t,e){let i=function(t,e){let i;return t in y&&e in y[t]&&(i=y[t][e]),i}(t.getCode(),e.getCode());return i||(i=I),i}function X(t,e){return V(M(t),M(e))}function Z(t,e,i){return X(e,i)(t,void 0,t.length)}function W(t,e,i,n){const r=X(e,i);return(0,E.NW)(t,r,void 0,n)}function $(t,e,i){return V(e,i)(t)}let q=null;function Y(t){q=M(t)}function H(){q=null}function K(){return q}function J(){Y("EPSG:4326")}function Q(t,e){return q?Z(t,e,q):t}function tt(t,e){return q?Z(t,q,e):(C&&!(0,w.aI)(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(C=!1,(0,T.R8)("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t)}function et(t,e){return q?W(t,e,q):t}function it(t,e){return q?W(t,q,e):t}function nt(t,e){if(!q)return t;const i=M(e).getMetersPerUnit(),n=q.getMetersPerUnit();return i&&n?t*i/n:t}function rt(t,e){if(!q)return t;const i=M(e).getMetersPerUnit(),n=q.getMetersPerUnit();return i&&n?t*n/i:t}function st(t,e,i){return function(n){let r,s;if(t.canWrapX()){const e=t.getExtent(),o=(0,E.RG)(e);n=n.slice(0),s=(0,w.U$)(n,t,o),s&&(n[0]=n[0]-s*o),n[0]=(0,A.qE)(n[0],e[0],e[2]),n[1]=(0,A.qE)(n[1],e[1],e[3]),r=i(n)}else r=i(n);return s&&e.canWrapX()&&(r[0]+=s*(0,E.RG)(e.getExtent())),r}}function ot(){D(c),D(m),F(m,c,u,d)}ot()},1338:(t,e,i)=>{"use strict";i.d(e,{A:()=>r});var n=i(4304);const r=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||n.I[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}}},4304:(t,e,i)=>{"use strict";i.d(e,{I:()=>s,q:()=>r});const n={9001:"m",9002:"ft",9003:"us-ft",9101:"radians",9102:"degrees"};function r(t){return n[t]}const s={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937}},4156:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var n=i(7777);class r extends n.Ay{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}}const s=r},6788:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});const n={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"}},1070:(t,e,i)=>{"use strict";i.d(e,{Ay:()=>m});var n=i(7659),r=i(3839),s=i(4507),o=i(2654),a=i(1988),l=i(6409),h=i(6693),c=i(973),u=i(8781),d=i(2138),g=i(6178);const f=(0,n.vt)();class p{constructor(t,e,i,n,r,s){this.styleFunction,this.extent_,this.id_=s,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=r,this.squaredTolerance_,this.stride_=n,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?(0,r.dP)(this.flatCoordinates_):(0,r.Vy)(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=(0,r.q1)(this.getExtent());this.flatInteriorPoints_=(0,a.J)(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=(0,h.yJ)(this.flatCoordinates_,this.ends_),e=(0,u.C)(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=(0,a.p)(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=(0,c.SH)(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let n=0,r=i.length;n{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let n;switch(this.type_){case"LineString":i.length=(0,s.P4)(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=(0,s.AL)(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,n);break;case"Polygon":n=[],i.length=(0,s.Hg)(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,n)}return n&&(this.simplifiedGeometry_=new p(this.type_,i,n,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_})),this}}p.prototype.getFlatCoordinates=p.prototype.getOrientedFlatCoordinates;const m=p},7310:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});const n=class{drawCustom(t,e,i,n,r){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}},8778:(t,e,i)=>{"use strict";i.d(e,{Jw:()=>P,M8:()=>_,MY:()=>m,NT:()=>p,Oq:()=>u,TA:()=>R,Tq:()=>v,ZV:()=>l,_K:()=>g,_m:()=>c,aq:()=>y,eL:()=>f,fZ:()=>b,jT:()=>I,qY:()=>h,vk:()=>d,yY:()=>x});var n=i(1796),r=i(4919),s=i(3358),o=i(6843),a=i(9988);const l="10px sans-serif",h="#000",c="round",u=[],d=0,g="round",f=10,p="#000",m="center",_="middle",v=[0,0,0,0],y=1,x=new n.A;let E,A=null;const w={},b=function(){const t="32px ",e=["monospace","serif"],i=e.length,n="wmytzilWMYTZIL@#/&?$%10";let r,o;function l(r,s,a){let l=!0;for(let h=0;hMath.max(e,S(t,i))),0);return i[e]=n,n}function I(t,e){const i=[],n=[],r=[];let s=0,o=0,a=0,l=0;for(let h=0,c=e.length;h<=c;h+=2){const u=e[h];if("\n"===u||h===c){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}const d=e[h+1]||t.font,g=S(d,u);i.push(g),o+=g;const f=T(d);n.push(f),l=Math.max(l,f)}return{width:s,height:a,widths:i,heights:n,lineWidths:r}}function P(t,e,i,n,r,s,o,a,l,h,c){t.save(),1!==i&&(void 0===t.globalAlpha?t.globalAlpha=t=>t.globalAlpha*=i:t.globalAlpha*=i),e&&t.transform.apply(t,e),n.contextInstructions?(t.translate(l,h),t.scale(c[0],c[1]),function(t,e){const i=t.contextInstructions;for(let t=0,n=i.length;t{"use strict";i.d(e,{A:()=>d});var n=i(713),r=i(7136),s=i(7310),o=i(6291),a=i(3839),l=i(8778),h=i(2654),c=i(4373);class u extends s.A{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return 1==e?t:t.map((function(t){return t*e}))}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,r=this.coordinates;let s=r.length;for(let o=0,l=t.length;ol&&(this.instructions.push([n.Ay.CUSTOM,l,u,t,i,c.n2,s]),this.hitDetectionInstructions.push([n.Ay.CUSTOM,l,u,t,r||i,c.n2,s]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),u=this.coordinates.length,this.instructions.push([n.Ay.CUSTOM,l,u,t,i,void 0,s]),this.hitDetectionInstructions.push([n.Ay.CUSTOM,l,u,t,r||i,void 0,s])}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[n.Ay.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[n.Ay.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let r,s,o=-1;for(e=0;ethis.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0}createFill(t){const e=t.fillStyle,i=[n.Ay.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[n.Ay.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;"string"==typeof i&&t.currentFillStyle==i||(void 0!==i&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,r=t.lineDash,s=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!(0,h.aI)(t.currentLineDash,r)||t.currentLineDashOffset!=s||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=s,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[n.Ay.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=(0,a.o8)(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;(0,a.r)(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}const d=u},1199:(t,e,i)=>{"use strict";i.d(e,{A:()=>m});var n=i(174),r=i(713),s=i(3839);class o extends n.A{constructor(t,e,i,n){super(t,e,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!(0,s.Ym)(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),o=t.getStride(),a=this.coordinates.length,l=this.appendFlatPointCoordinates(n,o);this.instructions.push([r.Ay.DRAW_IMAGE,a,l,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([r.Ay.DRAW_IMAGE,a,l,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),o=[];for(let e=0,i=n.length;e{"use strict";i.d(e,{y2:()=>C,$i:()=>S,x$:()=>R,Ay:()=>P});var n=i(713),r=i(9572),s=i(1710),o=i(7659),a=i(3839),l=i(8778),h=i(4769),c=i(6178);function u(t,e,i,n,r,s,o,a,l,u,d,g){let f=t[e],p=t[e+1],m=0,_=0,v=0,y=0;function x(){m=f,_=p,f=t[e+=n],p=t[e+1],y+=v,v=Math.sqrt((f-m)*(f-m)+(p-_)*(p-_))}do{x()}while(et[2]}else I=A>S;const P=Math.PI,L=[],M=b+n===e;let O;if(v=0,y=T,f=t[e=b],p=t[e+1],M){x(),O=Math.atan2(p-_,f-m),I&&(O+=O>0?-P:P);const t=(S+A)/2,e=(R+w)/2;return L[0]=[t,e,(C-s)/2,O,r],L}for(let t=0,c=(r=r.replace(/\n/g," ")).length;t0?-P:P),void 0!==O){let t=g-O;if(t+=t>P?-2*P:t<-P?2*P:0,Math.abs(t)>o)return null}O=g;const A=t;let w=0;for(;t0&&t.push("\n",""),t.push(e,""),t}const w=class{constructor(t,e,i,n,s){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=(0,o.vt)(),this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=s?new r.A:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,n){const r=t+e+i+n;if(this.labels_[r])return this.labels_[r];const o=n?this.strokeStates[n]:null,a=i?this.fillStates[i]:null,h=this.textStates[e],c=this.pixelRatio,u=[h.scale[0]*c,h.scale[1]*c],d=Array.isArray(t),g=h.justify?s.E[h.justify]:E(Array.isArray(t)?t[0]:t,h.textAlign||l.MY),f=n&&o.lineWidth?o.lineWidth:0,p=d?t:t.split("\n").reduce(A,[]),{width:m,height:_,widths:v,heights:y,lineWidths:x}=(0,l.jT)(h,p),w=m+f,b=[],T=(w+2)*u[0],C=(_+f)*u[1],S={width:T<0?Math.floor(T):Math.ceil(T),height:C<0?Math.floor(C):Math.ceil(C),contextInstructions:b};1==u[0]&&1==u[1]||b.push("scale",u),n&&(b.push("strokeStyle",o.strokeStyle),b.push("lineWidth",f),b.push("lineCap",o.lineCap),b.push("lineJoin",o.lineJoin),b.push("miterLimit",o.miterLimit),b.push("setLineDash",[o.lineDash]),b.push("lineDashOffset",o.lineDashOffset)),i&&b.push("fillStyle",a.fillStyle),b.push("textBaseline","middle"),b.push("textAlign","center");const R=.5-g;let I=g*w+R*f;const P=[],L=[];let M,O=0,D=0,F=0,k=0;for(let t=0,e=p.length;tt?t-c:r,C=s+u>e?e-u:s,S=x[3]+T*g[0]+x[1],R=x[0]+C*g[1]+x[2],I=w-x[3],P=b-x[0];let L;return(E||0!==d)&&(p[0]=I,v[0]=I,p[1]=P,m[1]=P,m[0]=I+S,_[0]=m[0],_[1]=P+R,v[1]=_[1]),0!==d?(L=(0,o.Zz)((0,o.vt)(),i,n,1,1,d,-i,-n),(0,o.Bb)(L,p),(0,o.Bb)(L,m),(0,o.Bb)(L,_),(0,o.Bb)(L,v),(0,a.N)(Math.min(p[0],m[0],_[0],v[0]),Math.min(p[1],m[1],_[1],v[1]),Math.max(p[0],m[0],_[0],v[0]),Math.max(p[1],m[1],_[1],v[1]),f)):(0,a.N)(Math.min(I,I+S),Math.min(P,P+R),Math.max(I,I+S),Math.max(P,P+R),f),y&&(w=Math.round(w),b=Math.round(b)),{drawImageX:w,drawImageY:b,drawImageW:T,drawImageH:C,originX:c,originY:u,declutterBox:{minX:f[0],minY:f[1],maxX:f[2],maxY:f[3],value:A},canvasTransform:L,scale:g}}replayImageOrLabel_(t,e,i,n,r,s,o){const a=!(!s&&!o),h=n.declutterBox,c=o?o[2]*n.scale[0]/2:0;return h.minX-c<=e[0]&&h.maxX+c>=0&&h.minY-c<=e[1]&&h.maxY+c>=0&&(a&&this.replayTextBackground_(t,p,m,_,v,s,o),(0,l.Jw)(t,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=(0,o.Bb)(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(i[0]%n,i[1]%n),1!==e&&t.scale(e,e),t.rotate(this.viewRotation_)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6])}drawLabelWithPointPlacement_(t,e,i,n){const r=this.textStates[e],o=this.createLabel(t,e,n,i),a=this.strokeStates[i],h=this.pixelRatio,c=E(Array.isArray(t)?t[0]:t,r.textAlign||l.MY),u=s.E[r.textBaseline||l.M8],d=a&&a.lineWidth?a.lineWidth:0;return{label:o,anchorX:c*(o.width/h-2*r.scale[0])+2*(.5-c)*d,anchorY:u*o.height/h+2*(.5-u)*d}}execute_(t,e,i,r,s,h,f,p){const m=this.zIndexContext_;let _;this.pixelCoordinates_&&(0,d.aI)(i,this.renderedTransform_)?_=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),_=(0,c.Rc)(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),(0,o.k3)(this.renderedTransform_,i));let v=0;const x=r.length;let A,w,b,T,C,S,R,I,P,L,M,O,D,F=0,k=0,N=0,j=null,G=null;const z=this.coordinateCache_,B=this.viewRotation_,U=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,V={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:B},X=this.instructions!=r||this.overlaps?0:200;let Z,W,$,q;for(;vX&&(this.fill_(t),k=0),N>X&&(t.stroke(),N=0),k||N||(t.beginPath(),C=NaN,S=NaN),++v;break;case n.Ay.CIRCLE:F=i[1];const r=_[F],o=_[F+1],c=_[F+2]-r,d=_[F+3]-o,x=Math.sqrt(c*c+d*d);t.moveTo(r+x,o),t.arc(r,o,x,0,2*Math.PI,!0),++v;break;case n.Ay.CLOSE_PATH:t.closePath(),++v;break;case n.Ay.CUSTOM:F=i[1],A=i[2];const Y=i[3],H=i[4],K=i[5];V.geometry=Y,V.feature=Z,v in z||(z[v]=[]);const J=z[v];K?K(_,F,A,2,J):(J[0]=_[F],J[1]=_[F+1],J.length=2),m&&(m.zIndex=i[6]),H(J,V),++v;break;case n.Ay.DRAW_IMAGE:F=i[1],A=i[2],P=i[3],w=i[4],b=i[5];let Q=i[6];const tt=i[7],et=i[8],it=i[9],nt=i[10];let rt=i[11];const st=i[12];let ot=i[13];T=i[14]||"declutter";const at=i[15];if(!P&&i.length>=20){L=i[19],M=i[20],O=i[21],D=i[22];const t=this.drawLabelWithPointPlacement_(L,M,O,D);P=t.label,i[3]=P;const e=i[23];w=(t.anchorX-e)*this.pixelRatio,i[4]=w;const n=i[24];b=(t.anchorY-n)*this.pixelRatio,i[5]=b,Q=P.height,i[6]=Q,ot=P.width,i[13]=ot}let lt,ht,ct,ut;i.length>25&&(lt=i[25]),i.length>17?(ht=i[16],ct=i[17],ut=i[18]):(ht=l.Tq,ct=!1,ut=!1),nt&&U?rt+=B:nt||U||(rt-=B);let dt=0;for(;F!S.includes(t))),I={},P=class{constructor(t,e,i,n,r,s,a){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=s,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=(0,o.vt)(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,a)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let n=this.executorsByZIndex_[i];void 0===n&&(n={},this.executorsByZIndex_[i]=n);const r=t[i];for(const t in r){const i=r[t];n[t]=new w(this.resolution_,this.pixelRatio_,this.overlaps_,i,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let e=0,n=t.length;ei)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+r)*e+(t+s))+3),r>0&&a.push(4*((t-r)*e+(t+s))+3),s>0&&(a.push(4*((t+r)*e+(t-s))+3),r>0&&a.push(4*((t-r)*e+(t-s))+3))}const r=[];for(let t=0,e=n.length;t0){if(!s||"none"===i||"Image"!==p&&"Text"!==p||s.includes(t)){const i=(f[a]-3)/4,s=n-i%l,o=n-(i/l|0),h=r(t,e,s*s+o*o);if(h)return h}u.clearRect(0,0,l,l);break}}const _=Object.keys(this.executorsByZIndex_).map(Number);let v,y,x,E,A;for(_.sort(d.V_),v=_.length-1;v>=0;--v){const t=_[v].toString();for(x=this.executorsByZIndex_[t],y=C.length-1;y>=0;--y)if(p=C[y],E=x[p],void 0!==E&&(A=E.executeHitDetection(u,h,i,m,g),A))return A}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],r=e[2],s=e[3],o=[i,n,i,s,r,s,r,n];return(0,c.Rc)(o,0,8,2,t,o),o}isEmpty(){return(0,T.p)(this.executorsByZIndex_)}execute(t,e,i,n,r,s,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(d.V_),s=s||C;const l=C.length;let h,c,u,g,f;for(o&&a.reverse(),h=0,c=a.length;hd.execute(t,e,i,n,r,o))):d.execute(g,e,i,n,r,o),f&&g.restore(),s){s.offset();const t=a[h]*l+u;this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(s)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(d.V_);for(let i=0,n=e.length;i{t.draw(this.renderedContext_),t.clear()})),t[e[i]].length=0}}},7672:(t,e,i)=>{"use strict";i.d(e,{A:()=>g});var n=i(7310),r=i(6291),s=i(7659),o=i(8778),a=i(2654),l=i(3839),h=i(4769),c=i(6178),u=i(5276);class d extends n.A{constructor(t,e,i,n,r,o,a){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?(0,h.Mg)(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=(0,s.vt)()}drawImages_(t,e,i,n){if(!this.image_)return;const r=(0,c.Rc)(t,e,i,n,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;1!=this.imageOpacity_&&(o.globalAlpha=l*this.imageOpacity_);let h=this.imageRotation_;0===this.transformRotation_&&(h-=this.viewRotation_),this.imageRotateWithView_&&(h+=this.viewRotation_);for(let t=0,e=r.length;tt*this.pixelRatio_)),lineDashOffset:(s||o.vk)*this.pixelRatio_,lineJoin:void 0!==a?a:o._K,lineWidth:(void 0!==l?l:o.aq)*this.pixelRatio_,miterLimit:void 0!==h?h:o.eL,strokeStyle:(0,r.F)(t||o.NT)}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const s=t.getScaleArray();this.imageScale_=[s[0]*this.pixelRatio_/i,s[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:(0,r.F)(t||o.qY)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),s=i.getLineDashOffset(),a=i.getLineJoin(),l=i.getWidth(),h=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:o._m,lineDash:n||o.Oq,lineDashOffset:s||o.vk,lineJoin:void 0!==a?a:o._K,lineWidth:void 0!==l?l:o.aq,miterLimit:void 0!==h?h:o.eL,strokeStyle:(0,r.F)(t||o.NT)}}else this.textStrokeState_=null;const n=t.getFont(),s=t.getOffsetX(),a=t.getOffsetY(),l=t.getRotateWithView(),h=t.getRotation(),c=t.getScaleArray(),u=t.getText(),d=t.getTextAlign(),g=t.getTextBaseline();this.textState_={font:void 0!==n?n:o.ZV,textAlign:void 0!==d?d:o.MY,textBaseline:void 0!==g?g:o.M8},this.text_=void 0!==u?Array.isArray(u)?u.reduce(((t,e,i)=>t+(i%2?" ":e)),""):u:"",this.textOffsetX_=void 0!==s?this.pixelRatio_*s:0,this.textOffsetY_=void 0!==a?this.pixelRatio_*a:0,this.textRotateWithView_=void 0!==l&&l,this.textRotation_=void 0!==h?h:0,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}else this.text_=""}}const g=d},713:(t,e,i)=>{"use strict";i.d(e,{Ay:()=>l,I5:()=>r,VD:()=>s,kx:()=>a,th:()=>o});const n={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},r=[n.FILL],s=[n.STROKE],o=[n.BEGIN_PATH],a=[n.CLOSE_PATH],l=n},1710:(t,e,i)=>{"use strict";i.d(e,{E:()=>d,A:()=>f});var n=i(174),r=i(713),s=i(6291),o=i(8778),a=i(9891),l=i(3839),h=i(4769);function c(t,e,i,n,r){const s=[];let o=i,a=0,l=e.slice(i,2);for(;a=t){const e=(t-a+d)/d,g=(0,h.Cc)(i,c,e),f=(0,h.Cc)(n,u,e);l.push(g,f),s.push(l),l=[g,f],a==t&&(o+=r),a=0}else if(a0&&s.push(l),s}function u(t,e,i,n,r){let s,o,a,l,h,c,u,d,g,f,p=i,m=i,_=0,v=0,y=i;for(o=i;ot&&(v>_&&(_=v,p=y,m=o),v=0,y=o-r)),a=l,u=g,d=f),h=i,c=n}return v+=l,v>_?[y,o]:[p,m]}const d={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class g extends n.A{constructor(t,e,i,n){super(t,e,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[o.qY]={fillStyle:o.qY},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){const n=this.textFillState_,s=this.textStrokeState_,a=this.textState_;if(""===this.text_||!a||!n&&!s)return;const h=this.coordinates;let d=h.length;const g=t.getType();let f=null,p=t.getStride();if("line"!==a.placement||"LineString"!=g&&"MultiLineString"!=g&&"Polygon"!=g&&"MultiPolygon"!=g){let n=a.overflow?null:[];switch(g){case"Point":case"MultiPoint":f=t.getFlatCoordinates();break;case"LineString":f=t.getFlatMidpoint();break;case"Circle":f=t.getCenter();break;case"MultiLineString":f=t.getFlatMidpoints(),p=2;break;case"Polygon":f=t.getFlatInteriorPoint(),a.overflow||n.push(f[2]/this.resolution),p=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();f=[];for(let t=0,i=e.length;t{const n=h[2*(t+i)]===f[i*p]&&h[2*(t+i)+1]===f[i*p+1];return n||--t,n}))}this.saveTextStates_(),(a.backgroundFill||a.backgroundStroke)&&(this.setFillStrokeStyle(a.backgroundFill,a.backgroundStroke),a.backgroundFill&&this.updateFillStyle(this.state,this.createFill),a.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,e,i);let l=a.padding;if(l!=o.Tq&&(a.scale[0]<0||a.scale[1]<0)){let t=a.padding[0],e=a.padding[1],i=a.padding[2],n=a.padding[3];a.scale[0]<0&&(e=-e,n=-n),a.scale[1]<0&&(t=-t,i=-i),l=[t,e,i,n]}const c=this.pixelRatio;this.instructions.push([r.Ay.DRAW_IMAGE,d,s,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,l==o.Tq?o.Tq:l.map((function(t){return t*c})),!!a.backgroundFill,!!a.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]);const u=1/c,m=this.state.fillStyle;a.backgroundFill&&(this.state.fillStyle=o.qY,this.hitDetectionInstructions.push(this.createFill(this.state))),this.hitDetectionInstructions.push([r.Ay.DRAW_IMAGE,d,s,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[u,u],NaN,this.declutterMode_,this.declutterImageWithText_,l,!!a.backgroundFill,!!a.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?o.qY:this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]),a.backgroundFill&&(this.state.fillStyle=m,this.hitDetectionInstructions.push(this.createFill(this.state))),this.endGeometry(e)}else{if(!(0,l.HY)(this.maxExtent,t.getExtent()))return;let n;if(f=t.getFlatCoordinates(),"LineString"==g)n=[f.length];else if("MultiLineString"==g)n=t.getEnds();else if("Polygon"==g)n=t.getEnds().slice(0,1);else if("MultiPolygon"==g){const e=t.getEndss();n=[];for(let t=0,i=e.length;t{"use strict";i.d(e,{A:()=>r});var n=i(6843);const r=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy((0,n.lr)(),{get:(t,e)=>{if("function"==typeof(0,n.lr)()[e])return this.instructions_[this.zIndex+this.offset_]||(this.instructions_[this.zIndex+this.offset_]=[]),this.instructions_[this.zIndex+this.offset_].push(e),this.pushMethodArgs_},set:(t,e,i)=>(this.instructions_[this.zIndex+this.offset_]||(this.instructions_[this.zIndex+this.offset_]=[]),this.instructions_[this.zIndex+this.offset_].push(e,i),!0)})}pushMethodArgs_=(...t)=>(this.instructions_[this.zIndex+this.offset_].push(t),this);pushFunction(t){this.instructions_[this.zIndex+this.offset_].push(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach((e=>{for(let i=0,n=e.length;i{"use strict";i.d(e,{F8:()=>d,_7:()=>u,tF:()=>c});var n=i(7672),r=i(4728),s=i(2654),o=i(4769),a=i(6843),l=i(6409),h=i(3839);const c=.5;function u(t,e,i,o,u,d,g,f,p){const m=p?(0,l.toUserExtent)(u,p):u,_=t[0]*c,v=t[1]*c,y=(0,a.Y)(_,v);y.imageSmoothingEnabled=!1;const x=y.canvas,E=new n.A(y,c,u,null,g,f,p?(0,l.getTransformFromProjections)((0,l.getUserProjection)(),p):null),A=i.length,w=Math.floor(16777215/A),b={};for(let t=1;t<=A;++t){const e=i[t-1],n=e.getStyleFunction()||o;if(!n)continue;let s=n(e,d);if(!s)continue;Array.isArray(s)||(s=[s]);const l=(t*w).toString(16).padStart(7,"#00000");for(let t=0,i=s.length;t{"use strict";i.d(e,{LW:()=>s,bA:()=>r,qS:()=>n}),i(7700);const n=.985;function r(t,e){const i=256,n=255;return(e=e||[])[0]=Math.floor(t/i/i/i)/n,e[1]=Math.floor(t/i/i)%i/n,e[2]=Math.floor(t/i)%i/n,e[3]=t%i/n,e}function s(t){let e=0;const i=256,n=255;return e+=Math.round(t[0]*i*i*i*n),e+=Math.round(t[1]*i*i*n),e+=Math.round(t[2]*i*n),e+=Math.round(t[3]*n),e}},6102:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var n=i(8417),r=i(4289),s=i(6490),o=i(9891);class a extends s.A{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t}getFeatures(t){return(0,o.b0)()}getData(t){return null}prepareFrame(t){return(0,o.b0)()}renderFrame(t,e){return(0,o.b0)()}loadedTileCallback(t,e,i){t[e]||(t[e]={}),t[e][i.tileCoord.toString()]=i}createLoadedTileFinder(t,e,i){return(n,r)=>{const s=this.loadedTileCallback.bind(this,i,n);return t.forEachLoadedTile(e,n,r,s)}}forEachFeatureAtCoordinate(t,e,i,n,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;e.getState()!==r.A.LOADED&&e.getState()!==r.A.ERROR||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=r.A.LOADED&&e!=r.A.ERROR&&t.addEventListener(n.A.CHANGE,this.boundHandleImageChange_),e==r.A.IDLE&&(t.load(),e=t.getState()),e==r.A.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const l=a},3736:(t,e,i)=>{"use strict";i.d(e,{A:()=>c});var n=i(3429),r=i(4289),s=i(9611),o=i(7659),a=i(3839),l=i(6409);class h extends n.A{constructor(t){super(t),this.image_=null}getImage(){return this.image_?this.image_.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],i=t.pixelRatio,n=t.viewState,o=n.resolution,h=this.getLayer().getSource(),c=t.viewHints;let u=t.extent;if(void 0!==e.extent&&(u=(0,a._N)(u,(0,l.fromUserExtent)(e.extent,n.projection))),!c[s.A.ANIMATING]&&!c[s.A.INTERACTING]&&!(0,a.Im)(u))if(h){const t=n.projection,e=h.getImage(u,o,i,t);e&&(this.loadImage(e)?this.image_=e:e.getState()===r.A.EMPTY&&(this.image_=null))}else this.image_=null;return!!this.image_}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=(0,o.Bb)(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!(0,a.Ym)(r,n))return null;const s=this.image_.getExtent(),l=this.image_.getImage(),h=(0,a.RG)(s),c=Math.floor(l.width*((n[0]-s[0])/h));if(c<0||c>=l.width)return null;const u=(0,a.Oq)(s),d=Math.floor(l.height*((s[3]-n[1])/u));return d<0||d>=l.height?null:this.getImageData(l,c,d)}renderFrame(t,e){const i=this.image_,n=i.getExtent(),r=i.getResolution(),[s,h]=Array.isArray(r)?r:[r,r],c=i.getPixelRatio(),u=t.layerStatesArray[t.layerIndex],d=t.pixelRatio,g=t.viewState,f=g.center,p=g.resolution,m=d*s/(p*c),_=d*h/(p*c);this.prepareContainer(t,e);const v=this.context.canvas.width,y=this.context.canvas.height,x=this.getRenderContext(t);let E=!1,A=!0;if(u.extent){const e=(0,l.fromUserExtent)(u.extent,g.projection);A=(0,a.HY)(e,t.extent),E=A&&!(0,a.ms)(e,t.extent),E&&this.clipUnrotated(x,t,e)}const w=i.getImage(),b=(0,o.Zz)(this.tempTransform,v/2,y/2,m,_,0,c*(n[0]-f[0])/s,c*(f[1]-n[3])/h);this.renderedResolution=h*d/c;const T=w.width*b[0],C=w.height*b[3];if(this.getLayer().getSource().getInterpolate()||(x.imageSmoothingEnabled=!1),this.preRender(x,t),A&&T>=.5&&C>=.5){const t=b[4],e=b[5],i=u.opacity;1!==i&&(x.save(),x.globalAlpha=i),x.drawImage(w,0,0,+w.width,+w.height,t,e,T,C),1!==i&&x.restore()}return this.postRender(this.context,t),E&&x.restore(),x.imageSmoothingEnabled=!0,this.container}}const c=h},3429:(t,e,i)=>{"use strict";i.d(e,{A:()=>p,B:()=>d});var n=i(6102),r=i(4156),s=i(6788),o=i(9572),a=i(7659),l=i(8e3),h=i(6843),c=i(2654),u=i(3839);const d=[];let g=null;class f extends n.A{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=(0,a.vt)(),this.pixelTransform=(0,a.vt)(),this.inversePixelTransform=(0,a.vt)(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(t,e,i){let n;g||(g=(0,h.Y)(1,1,void 0,{willReadFrequently:!0})),g.clearRect(0,0,1,1);try{g.drawImage(t,e,i,1,1,0,0,1,1),n=g.getImageData(0,0,1,1).data}catch(t){return g=null,null}return n}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let r,s;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&(0,c.aI)((0,l._j)(t.style.backgroundColor),(0,l._j)(i)))){const e=t.firstElementChild;e instanceof HTMLCanvasElement&&(s=e.getContext("2d"))}if(s&&s.canvas.style.transform===e?(this.container=t,this.context=s,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=document.createElement("div"),r.className=n;let t=r.style;t.position="absolute",t.width="100%",t.height="100%",s=(0,h.Y)();const e=s.canvas;r.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=r,this.context=s}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=(0,u.Py)(i),r=(0,u.WU)(i),s=(0,u.k_)(i),o=(0,u.R)(i);(0,a.Bb)(e.coordinateToPixelTransform,n),(0,a.Bb)(e.coordinateToPixelTransform,r),(0,a.Bb)(e.coordinateToPixelTransform,s),(0,a.Bb)(e.coordinateToPixelTransform,o);const l=this.inversePixelTransform;(0,a.Bb)(l,n),(0,a.Bb)(l,r),(0,a.Bb)(l,s),(0,a.Bb)(l,o),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const i=t.extent,n=t.viewState.resolution,r=t.viewState.rotation,s=t.pixelRatio,o=Math.round((0,u.RG)(i)/n*s),l=Math.round((0,u.Oq)(i)/n*s);(0,a.Zz)(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/s,1/s,r,-o/2,-l/2),(0,a.T9)(this.inversePixelTransform,this.pixelTransform);const h=(0,a.dI)(this.pixelTransform);if(this.useContainer(e,h,this.getBackground(t)),!this.containerReused){const t=this.context.canvas;t.width!=o||t.height!=l?(t.width=o,t.height=l):this.context.clearRect(0,0,o,l),h!==t.style.transform&&(t.style.transform=h)}}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const s=new r.A(t,this.inversePixelTransform,i,e);n.dispatchEvent(s)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(s.A.PRERENDER,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(s.A.POSTRENDER,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new o.A),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(s.A.PRERENDER,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(s.A.POSTRENDER,this.context,t))}getRenderTransform(t,e,i,n,r,s,o){const l=r/2,h=s/2,c=n/e,u=-c,d=-t[0]+o,g=-t[1];return(0,a.Zz)(this.tempTransform,l,h,c,u,-i,d,g)}disposeInternal(){delete this.frameState,super.disposeInternal()}}const p=f},2409:(t,e,i)=>{"use strict";i.d(e,{A:()=>p});var n=i(3429),r=i(8026),s=i(3816),o=i(1218),a=i(8066),l=i(7659),h=i(2654),c=i(3839),u=i(6409),d=i(9891),g=i(8538);class f extends n.A{constructor(t){super(t),this.extentChanged=!0,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=(0,c.S5)(),this.tmpTileRange_=new o.A(0,0,0,0)}isDrawableTile(t){const e=this.getLayer(),i=t.getState(),n=e.getUseInterimTilesOnError();return i==a.A.LOADED||i==a.A.EMPTY||i==a.A.ERROR&&!n}getTile(t,e,i,n){const r=n.pixelRatio,s=n.viewState.projection,o=this.getLayer();let l=o.getSource().getTile(t,e,i,r,s);return l.getState()==a.A.ERROR&&o.getUseInterimTilesOnError()&&o.getPreload()>0&&(this.newTiles_=!0),this.isDrawableTile(l)||(l=l.getInterimTile()),l}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=(0,l.Bb)(e.pixelToCoordinateTransform,t.slice()),o=i.getExtent();if(o&&!(0,c.Ym)(o,n))return null;const h=e.pixelRatio,u=e.viewState.projection,d=e.viewState,f=i.getRenderSource(),p=f.getTileGridForProjection(d.projection),m=f.getTilePixelRatio(e.pixelRatio);for(let t=p.getZForResolution(d.resolution);t>=p.getMinZoom();--t){const e=p.getTileCoordForCoordAndZ(n,t),i=f.getTile(t,e[1],e[2],h,u);if(!(i instanceof r.A||i instanceof s.A)||i instanceof s.A&&i.getState()===a.A.EMPTY)return null;if(i.getState()!==a.A.LOADED)continue;const o=p.getOrigin(t),l=(0,g.xq)(p.getTileSize(t)),c=p.getResolution(t),_=Math.floor(m*((n[0]-o[0])/c-e[1]*l[0])),v=Math.floor(m*((o[1]-n[1])/c-e[2]*l[1])),y=Math.round(m*f.getGutterForProjection(d.projection));return this.getImageData(i.getImage(),_+y,v+y)}return null}loadedTileCallback(t,e,i){return!!this.isDrawableTile(i)&&super.loadedTileCallback(t,e,i)}prepareFrame(t){return!!this.getLayer().getSource()}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex],n=t.viewState,r=n.projection,s=n.resolution,o=n.center,g=n.rotation,f=t.pixelRatio,p=this.getLayer(),m=p.getSource(),_=m.getRevision(),v=m.getTileGridForProjection(r),y=v.getZForResolution(s,m.zDirection),x=v.getResolution(y);let E=t.extent;const A=t.viewState.resolution,w=m.getTilePixelRatio(f);this.prepareContainer(t,e);const b=this.context.canvas.width,T=this.context.canvas.height,C=i.extent&&(0,u.fromUserExtent)(i.extent,r);C&&(E=(0,c._N)(E,(0,u.fromUserExtent)(i.extent,r)));const S=x*b/2/w,R=x*T/2/w,I=[o[0]-S,o[1]-R,o[0]+S,o[1]+R],P=v.getTileRangeForExtentAndZ(E,y),L={};L[y]={};const M=this.createLoadedTileFinder(m,r,L),O=this.tmpExtent,D=this.tmpTileRange_;this.newTiles_=!1;const F=g?(0,c.Yw)(n.center,A,g,t.size):void 0;for(let e=P.minX;e<=P.maxX;++e)for(let n=P.minY;n<=P.maxY;++n){if(g&&!v.tileCoordIntersectsViewport([y,e,n],F))continue;const r=this.getTile(y,e,n,t);if(this.isDrawableTile(r)){const e=(0,d.v6)(this);if(r.getState()==a.A.LOADED){L[y][r.tileCoord.toString()]=r;let t=r.inTransition(e);t&&1!==i.opacity&&(r.endTransition(e),t=!1),this.newTiles_||!t&&this.renderedTiles.includes(r)||(this.newTiles_=!0)}if(1===r.getAlpha(e,t.time))continue}const s=v.getTileCoordChildTileRange(r.tileCoord,D,O);let o=!1;s&&(o=M(y+1,s)),o||v.forEachTileCoordParentTileRange(r.tileCoord,M,D,O)}const k=x/s*f/w,N=this.getRenderContext(t);(0,l.Zz)(this.tempTransform,b/2,T/2,k,k,0,-b/2,-T/2),C&&this.clipUnrotated(N,t,C),m.getInterpolate()||(N.imageSmoothingEnabled=!1),this.preRender(N,t),this.renderedTiles.length=0;let j,G,z,B=Object.keys(L).map(Number);B.sort(h.V_),1!==i.opacity||this.containerReused&&!m.getOpaque(t.viewState.projection)?(j=[],G=[]):B=B.reverse();for(let e=B.length-1;e>=0;--e){const i=B[e],n=m.getTilePixelSize(i,f,r),s=v.getResolution(i)/x,o=n[0]*s*k,a=n[1]*s*k,h=v.getTileCoordForCoordAndZ((0,c.Py)(I),i),u=v.getTileCoordExtent(h),g=(0,l.Bb)(this.tempTransform,[w*(u[0]-I[0])/x,w*(I[3]-u[3])/x]),p=w*m.getGutterForProjection(r),_=L[i];for(const e in _){const n=_[e],r=n.tileCoord,s=h[1]-r[1],l=Math.round(g[0]-(s-1)*o),u=h[2]-r[2],f=Math.round(g[1]-(u-1)*a),v=Math.round(g[0]-s*o),x=Math.round(g[1]-u*a),E=l-v,A=f-x,w=y===i,b=w&&1!==n.getAlpha((0,d.v6)(this),t.time);let T=!1;if(!b)if(j){z=[v,x,v+E,x,v+E,x+A,v,x+A];for(let t=0,e=j.length;t{"use strict";i.d(e,{A:()=>_});var n=i(1199),r=i(3429),s=i(9084),o=i(6788),a=i(9611),l=i(6875),h=i(3839),c=i(6843),u=i(4580),d=i(2654),g=i(6409),f=i(9891),p=i(4137);class m extends r.A{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipped_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=(0,h.S5)(),this.wrappedRenderedExtent_=(0,h.S5)(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,i){const n=e.extent,r=e.viewState,o=r.center,l=r.resolution,c=r.projection,u=r.rotation,d=c.getExtent(),g=this.getLayer().getSource(),f=this.getLayer().getDeclutter(),p=e.pixelRatio,m=e.viewHints,_=!(m[a.A.ANIMATING]||m[a.A.INTERACTING]),v=this.context,y=Math.round((0,h.RG)(n)/l*p),x=Math.round((0,h.Oq)(n)/l*p),E=g.getWrapX()&&c.canWrapX(),A=E?(0,h.RG)(d):null,w=E?Math.ceil((n[2]-d[2])/A)+1:1;let b=E?Math.floor((n[0]-d[0])/A):0;do{let n=this.getRenderTransform(o,l,0,p,y,x,b*A);e.declutter&&(n=n.slice(0)),t.execute(v,[v.canvas.width,v.canvas.height],n,u,_,void 0===i?s.y2:i?s.$i:s.x$,i?f&&e.declutter[f]:void 0)}while(++b{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=this.frameState.size.slice(),e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,r=this.renderedProjection_,s=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],c=t[0]*l.tF,d=t[1]*l.tF;a.push(this.getRenderTransform(e,i,n,l.tF,c,d,0).slice());const f=o.getSource(),p=r.getExtent();if(f.getWrapX()&&r.canWrapX()&&!(0,h.ms)(p,s)){let t=s[0];const r=(0,h.RG)(p);let o,u=0;for(;tp[2];)++u,o=r*u,a.push(this.getRenderTransform(e,i,n,l.tF,c,d,o).slice()),t-=r}const m=(0,g.getUserProjection)();this.hitDetectionImageData_=(0,l._7)(t,a,this.renderedFeatures_,o.getStyleFunction(),s,i,n,(0,u.j)(i,this.renderedPixelRatio_),m?r:null)}e((0,l.F8)(t,this.renderedFeatures_,this.hitDetectionImageData_))}))}forEachFeatureAtCoordinate(t,e,i,n,r){if(!this.replayGroup_)return;const s=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),l={},h=function(t,e,i){const s=(0,f.v6)(t),o=l[s];if(o){if(!0!==o&&ic=n.forEachFeatureAtCoordinate(t,s,o,i,h,d&&e.declutter[d]?e.declutter[d].all().map((t=>t.value)):null))),c}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const r=t.viewHints[a.A.ANIMATING],o=t.viewHints[a.A.INTERACTING],l=e.getUpdateWhileAnimating(),c=e.getUpdateWhileInteracting();if(this.ready&&!l&&r||!c&&o)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const f=t.extent,m=t.viewState,_=m.projection,v=m.resolution,y=t.pixelRatio,x=e.getRevision(),E=e.getRenderBuffer();let A=e.getRenderOrder();void 0===A&&(A=u.Eo);const w=m.center.slice(),b=(0,h.r)(f,E*v),T=b.slice(),C=[b.slice()],S=_.getExtent();if(i.getWrapX()&&_.canWrapX()&&!(0,h.ms)(S,t.extent)){const t=(0,h.RG)(S),e=Math.max((0,h.RG)(b)/2,t);b[0]=S[0]-e,b[2]=S[2]+e,(0,p.Li)(w,_);const i=(0,h.Li)(C[0],_);i[0]S[0]&&i[2]>S[2]&&C.push([i[0]-t,i[1],i[2]-t,i[3]])}if(this.ready&&this.renderedResolution_==v&&this.renderedRevision_==x&&this.renderedRenderOrder_==A&&this.renderedFrameDeclutter_===!!t.declutter&&(0,h.ms)(this.wrappedRenderedExtent_,b))return(0,d.aI)(this.renderedExtent_,T)||(this.hitDetectionImageData_=null,this.renderedExtent_=T),this.renderedCenter_=w,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const R=new n.A((0,u.gY)(v,y),b,v,y),I=(0,g.getUserProjection)();let P;if(I){for(let t=0,e=C.length;t{let n;const r=t.getStyleFunction()||e.getStyleFunction();if(r&&(n=r(t,v)),n){const e=this.renderFeature(t,L,n,R,P,this.getLayer().getDeclutter(),i);M=M&&!e}},D=(0,g.toUserExtent)(b,_),F=i.getFeaturesInExtent(D);A&&F.sort(A);for(let t=0,e=F.length;t{"use strict";i.d(e,{Eo:()=>a,gY:()=>h,j:()=>l,nl:()=>c});var n=i(4289),r=i(9891);const s=.5,o={Point:function(t,e,i,r,s,o){const a=i.getImage(),l=i.getText(),h=l&&l.getText(),c=o&&a&&h?{}:void 0;if(a){if(a.getImageState()!=n.A.LOADED)return;const o=t.getBuilder(i.getZIndex(),"Image");o.setImageStyle(a,c),o.drawPoint(e,r,s)}if(h){const n=t.getBuilder(i.getZIndex(),"Text");n.setTextStyle(l,c),n.drawText(e,r,s)}},LineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawLineString(e,n,r)}const o=i.getText();if(o&&o.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n,r)}},Polygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(s||o){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawPolygon(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}},MultiPoint:function(t,e,i,r,s,o){const a=i.getImage(),l=a&&0!==a.getOpacity(),h=i.getText(),c=h&&h.getText(),u=o&&l&&c?{}:void 0;if(l){if(a.getImageState()!=n.A.LOADED)return;const o=t.getBuilder(i.getZIndex(),"Image");o.setImageStyle(a,u),o.drawMultiPoint(e,r,s)}if(c){const n=t.getBuilder(i.getZIndex(),"Text");n.setTextStyle(h,u),n.drawText(e,r,s)}},MultiLineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawMultiLineString(e,n,r)}const o=i.getText();if(o&&o.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n,r)}},MultiPolygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(o||s){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawMultiPolygon(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}},GeometryCollection:function(t,e,i,n,r,s){const a=e.getGeometriesArray();let l,h;for(l=0,h=a.length;l0;return f&&Promise.all(c).then((()=>s(null))),function(t,e,i,n,r,s,a){const l=i.getGeometryFunction()(e);if(!l)return;const h=l.simplifyTransformed(n,r);i.getRenderer()?u(t,h,i,e,a):(0,o[h.getType()])(t,h,i,e,a,s)}(t,e,i,r,a,l,h),f}function u(t,e,i,n,r){if("GeometryCollection"!=e.getType())t.getBuilder(i.getZIndex(),"Default").drawCustom(e,n,i.getRenderer(),i.getHitDetectionRenderer(),r);else{const s=e.getGeometries();for(let e=0,o=s.length;e{"use strict";i.d(e,{A:()=>c});var n=i(3064),r=i(6102),s=i(4156),o=i(6788),a=i(3237),l=i(7659);class h extends r.A{constructor(t,e){super(t),e=e||{},this.inversePixelTransform_=(0,l.vt)(),this.pixelContext_=null,this.postProcesses_=e.postProcesses,this.uniforms_=e.uniforms,this.helper,t.addChangeListener(n.A.MAP,this.removeHelper.bind(this)),this.dispatchPreComposeEvent=this.dispatchPreComposeEvent.bind(this),this.dispatchPostComposeEvent=this.dispatchPostComposeEvent.bind(this)}dispatchPreComposeEvent(t,e){const i=this.getLayer();if(i.hasListener(o.A.PRECOMPOSE)){const n=new s.A(o.A.PRECOMPOSE,void 0,e,t);i.dispatchEvent(n)}}dispatchPostComposeEvent(t,e){const i=this.getLayer();if(i.hasListener(o.A.POSTCOMPOSE)){const n=new s.A(o.A.POSTCOMPOSE,void 0,e,t);i.dispatchEvent(n)}}reset(t){this.uniforms_=t.uniforms,this.helper&&this.helper.setUniforms(this.uniforms_)}removeHelper(){this.helper&&(this.helper.dispose(),delete this.helper)}prepareFrame(t){if(this.getLayer().getRenderSource()){let e,i=!0,n=-1;for(let r=0,s=t.layerStatesArray.length;r{"use strict";i.d(e,{A:()=>A});var n=i(888),r=i(7476),s=i(9611),o=i(9087),a=i(8744),l=i(2654);const h=new Uint8Array(4),c=class{constructor(t,e){this.helper_=t;const i=t.getGL();this.texture_=i.createTexture(),this.framebuffer_=i.createFramebuffer(),this.depthbuffer_=i.createRenderbuffer(),this.size_=e||[1,1],this.data_=new Uint8Array(0),this.dataCacheDirty_=!0,this.updateSize_()}setSize(t){(0,l.aI)(t,this.size_)||(this.size_[0]=t[0],this.size_[1]=t[1],this.updateSize_())}getSize(){return this.size_}clearCachedData(){this.dataCacheDirty_=!0}readAll(){if(this.dataCacheDirty_){const t=this.size_,e=this.helper_.getGL();e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer_),e.readPixels(0,0,t[0],t[1],e.RGBA,e.UNSIGNED_BYTE,this.data_),this.dataCacheDirty_=!1}return this.data_}readPixel(t,e){if(t<0||e<0||t>this.size_[0]||e>=this.size_[1])return h[0]=0,h[1]=0,h[2]=0,h[3]=0,h;this.readAll();const i=Math.floor(t)+(this.size_[1]-Math.floor(e)-1)*this.size_[0];return h[0]=this.data_[4*i],h[1]=this.data_[4*i+1],h[2]=this.data_[4*i+2],h[3]=this.data_[4*i+3],h}getTexture(){return this.texture_}getFramebuffer(){return this.framebuffer_}getDepthbuffer(){return this.depthbuffer_}updateSize_(){const t=this.size_,e=this.helper_.getGL();this.texture_=this.helper_.createTexture(t,null,this.texture_),e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer_),e.viewport(0,0,t[0],t[1]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.texture_,0),e.bindRenderbuffer(e.RENDERBUFFER,this.depthbuffer_),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,t[0],t[1]),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,this.depthbuffer_),this.data_=new Uint8Array(t[0]*t[1]*4)}};var u=i(9790),d=i(3237);const g="GENERATE_POINT_BUFFERS";var f=i(7659),p=i(4504),m=i(3839),_=i(1743),v=i(6409),y=i(9891),x=i(554);class E extends a.A{constructor(t,e){const i=e.uniforms||{},n=(0,f.vt)();i[d.M8.PROJECTION_MATRIX]=n,super(t,{uniforms:i,postProcesses:e.postProcesses}),this.sourceRevision_=-1,this.verticesBuffer_=new o.Ay(u.H7,u.Be),this.indicesBuffer_=new o.Ay(u.IP,u.Be),this.vertexShader_=e.vertexShader,this.fragmentShader_=e.fragmentShader,this.program_,this.hitDetectionEnabled_=e.hitDetectionEnabled??!0;const s=e.attributes?e.attributes.map((function(t){return{name:"a_prop_"+t.name,size:1,type:d.jQ.FLOAT}})):[];this.attributes=[{name:"a_position",size:2,type:d.jQ.FLOAT},{name:"a_index",size:1,type:d.jQ.FLOAT}],this.hitDetectionEnabled_&&(this.attributes.push({name:"a_prop_hitColor",size:4,type:d.jQ.FLOAT}),this.attributes.push({name:"a_featureUid",size:1,type:d.jQ.FLOAT})),this.attributes.push(...s),this.customAttributes=e.attributes?e.attributes:[],this.previousExtent_=(0,m.S5)(),this.currentTransform_=n,this.renderTransform_=(0,f.vt)(),this.invertRenderTransform_=(0,f.vt)(),this.renderInstructions_=new Float32Array(0),this.hitRenderTarget_,this.lastSentId=0,this.worker_=function(){const t='const e="GENERATE_POLYGON_BUFFERS",t="GENERATE_POINT_BUFFERS",n="GENERATE_LINE_STRING_BUFFERS";function r(e,t){const n=t[0],r=t[1];return t[0]=e[0]*n+e[2]*r+e[4],t[1]=e[1]*n+e[3]*r+e[5],t}function x(e,t){const n=(r=t)[0]*r[3]-r[1]*r[2];var r;!function(e,t){if(!e)throw new Error(t)}(0!==n,"Transformation matrix cannot be inverted");const x=t[0],i=t[1],u=t[2],o=t[3],f=t[4],s=t[5];return e[0]=o/n,e[1]=-i/n,e[2]=-u/n,e[3]=x/n,e[4]=(u*s-o*f)/n,e[5]=-(x*s-i*f)/n,e}function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}new Array(6);var u={exports:{}};function o(e,t,n){n=n||2;var r,x,i,u,o,s,l,v=t&&t.length,h=v?t[0]*n:e.length,c=f(e,0,h,n,!0),g=[];if(!c||c.next===c.prev)return g;if(v&&(c=function(e,t,n,r){var x,i,u,o=[];for(x=0,i=t.length;x80*n){r=i=e[0],x=u=e[1];for(var b=n;bi&&(i=o),s>u&&(u=s);l=0!==(l=Math.max(i-r,u-x))?32767/l:0}return a(c,g,n,r,x,l,0),g}function f(e,t,n,r,x){var i,u;if(x===O(e,t,n,r)>0)for(i=t;i=t;i-=r)u=P(i,e[i],e[i+1],u);return u&&m(u,u.next)&&(B(u),u=u.next),u}function s(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!m(r,r.next)&&0!==w(r.prev,r,r.next))r=r.next;else{if(B(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function a(e,t,n,r,x,i,u){if(e){!u&&i&&function(e,t,n,r){var x=e;do{0===x.z&&(x.z=b(x.x,x.y,t,n,r)),x.prevZ=x.prev,x.nextZ=x.next,x=x.next}while(x!==e);x.prevZ.nextZ=null,x.prevZ=null,function(e){var t,n,r,x,i,u,o,f,s=1;do{for(n=e,e=null,i=null,u=0;n;){for(u++,r=n,o=0,t=0;t0||f>0&&r;)0!==o&&(0===f||!r||n.z<=r.z)?(x=n,n=n.nextZ,o--):(x=r,r=r.nextZ,f--),i?i.nextZ=x:e=x,x.prevZ=i,i=x;n=r}i.nextZ=null,s*=2}while(u>1)}(x)}(e,r,x,i);for(var o,f,p=e;e.prev!==e.next;)if(o=e.prev,f=e.next,i?v(e,r,x,i):l(e))t.push(o.i/n|0),t.push(e.i/n|0),t.push(f.i/n|0),B(e),e=f.next,p=f.next;else if((e=f)===p){u?1===u?a(e=h(s(e),t,n),t,n,r,x,i,2):2===u&&c(e,t,n,r,x,i):a(s(e),t,n,r,x,i,1);break}}}function l(e){var t=e.prev,n=e,r=e.next;if(w(t,n,r)>=0)return!1;for(var x=t.x,i=n.x,u=r.x,o=t.y,f=n.y,s=r.y,a=xi?x>u?x:u:i>u?i:u,h=o>f?o>s?o:s:f>s?f:s,c=r.next;c!==t;){if(c.x>=a&&c.x<=v&&c.y>=l&&c.y<=h&&M(x,o,i,f,u,s,c.x,c.y)&&w(c.prev,c,c.next)>=0)return!1;c=c.next}return!0}function v(e,t,n,r){var x=e.prev,i=e,u=e.next;if(w(x,i,u)>=0)return!1;for(var o=x.x,f=i.x,s=u.x,a=x.y,l=i.y,v=u.y,h=of?o>s?o:s:f>s?f:s,y=a>l?a>v?a:v:l>v?l:v,g=b(h,c,t,n,r),d=b(p,y,t,n,r),Z=e.prevZ,m=e.nextZ;Z&&Z.z>=g&&m&&m.z<=d;){if(Z.x>=h&&Z.x<=p&&Z.y>=c&&Z.y<=y&&Z!==x&&Z!==u&&M(o,a,f,l,s,v,Z.x,Z.y)&&w(Z.prev,Z,Z.next)>=0)return!1;if(Z=Z.prevZ,m.x>=h&&m.x<=p&&m.y>=c&&m.y<=y&&m!==x&&m!==u&&M(o,a,f,l,s,v,m.x,m.y)&&w(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;Z&&Z.z>=g;){if(Z.x>=h&&Z.x<=p&&Z.y>=c&&Z.y<=y&&Z!==x&&Z!==u&&M(o,a,f,l,s,v,Z.x,Z.y)&&w(Z.prev,Z,Z.next)>=0)return!1;Z=Z.prevZ}for(;m&&m.z<=d;){if(m.x>=h&&m.x<=p&&m.y>=c&&m.y<=y&&m!==x&&m!==u&&M(o,a,f,l,s,v,m.x,m.y)&&w(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function h(e,t,n){var r=e;do{var x=r.prev,i=r.next.next;!m(x,i)&&A(x,r,r.next,i)&&z(x,i)&&z(i,x)&&(t.push(x.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),B(r),B(r.next),r=e=i),r=r.next}while(r!==e);return s(r)}function c(e,t,n,r,x,i){var u=e;do{for(var o=u.next.next;o!==u.prev;){if(u.i!==o.i&&Z(u,o)){var f=F(u,o);return u=s(u,u.next),f=s(f,f.next),a(u,t,n,r,x,i,0),void a(f,t,n,r,x,i,0)}o=o.next}u=u.next}while(u!==e)}function p(e,t){return e.x-t.x}function y(e,t){var n=function(e,t){var n,r=t,x=e.x,i=e.y,u=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var o=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(o<=x&&o>u&&(u=o,n=r.x=r.x&&r.x>=a&&x!==r.x&&M(in.x||r.x===n.x&&g(n,r)))&&(n=r,v=f)),r=r.next}while(r!==s);return n}(e,t);if(!n)return t;var r=F(n,e);return s(r,r.next),s(n,n.next)}function g(e,t){return w(e.prev,e,t.prev)<0&&w(t.next,e,e.next)<0}function b(e,t,n,r,x){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*x|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*x|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function d(e){var t=e,n=e;do{(t.x=(e-u)*(i-o)&&(e-u)*(r-o)>=(n-u)*(t-o)&&(n-u)*(i-o)>=(x-u)*(r-o)}function Z(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&A(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(z(e,t)&&z(t,e)&&function(e,t){var n=e,r=!1,x=(e.x+t.x)/2,i=(e.y+t.y)/2;do{n.y>i!=n.next.y>i&&n.next.y!==n.y&&x<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(w(e.prev,e,t.prev)||w(e,t.prev,t))||m(e,t)&&w(e.prev,e,e.next)>0&&w(t.prev,t,t.next)>0)}function w(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function m(e,t){return e.x===t.x&&e.y===t.y}function A(e,t,n,r){var x=I(w(e,t,n)),i=I(w(e,t,r)),u=I(w(n,r,e)),o=I(w(n,r,t));return x!==i&&u!==o||(!(0!==x||!E(e,n,t))||(!(0!==i||!E(e,r,t))||(!(0!==u||!E(n,e,r))||!(0!==o||!E(n,t,r)))))}function E(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function I(e){return e>0?1:e<0?-1:0}function z(e,t){return w(e.prev,e,e.next)<0?w(e,t,e.next)>=0&&w(e,e.prev,t)>=0:w(e,t,e.prev)<0||w(e,e.next,t)<0}function F(e,t){var n=new _(e.i,e.x,e.y),r=new _(t.i,t.x,t.y),x=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=x,x.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function P(e,t,n,r){var x=new _(e,t,n);return r?(x.next=r.next,x.prev=r,r.next.prev=x,r.next=x):(x.prev=x,x.next=x),x}function B(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 _(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function O(e,t,n,r){for(var x=0,i=t,u=n-r;i0&&(r+=e[x-1].length,n.holes.push(r))}return n};var N=i(u.exports);const R=[],S={vertexPosition:0,indexPosition:0};function T(e,t,n,r,x){e[t+0]=n,e[t+1]=r,e[t+2]=x}function U(e,t,n,r,x,i){const u=3+x,o=e[t+0],f=e[t+1],s=R;s.length=x;for(let n=0;n0?f:2*Math.PI-f}let d=-1,M=-1,Z=l;const w=null!==i;if(null!==x){d=b(y,g,r(s,[...[e[x],e[x+1]]])),Math.cos(d)<=.985&&(Z+=Math.tan((d-Math.PI)/2))}if(w){M=b(g,y,r(s,[...[e[i],e[i+1]]])),Math.cos(M)<=.985&&(Z+=Math.tan((Math.PI-M)/2))}function m(e,t){return 0===t?1e4*e:Math.sign(t)*(1e4*e+Math.abs(t))}return u.push(c[0],c[1],p[0],p[1],d,M,a,m(0,l)),u.push(...f),u.push(c[0],c[1],p[0],p[1],d,M,a,m(1,l)),u.push(...f),u.push(c[0],c[1],p[0],p[1],d,M,a,m(2,l)),u.push(...f),u.push(c[0],c[1],p[0],p[1],d,M,a,m(3,l)),u.push(...f),o.push(h,h+1,h+2,h+1,h+3,h+2),{length:a+Math.sqrt((g[0]-y[0])*(g[0]-y[0])+(g[1]-y[1])*(g[1]-y[1])),angle:Z}}function G(e,t,n,r,x){const i=2+x;let u=t;const o=e.slice(u,u+x);u+=x;const f=e[u++];let s=0;const a=new Array(f-1);for(let t=0;t{const i=r.data;switch(i.type){case t:{const e=3,t=2,n=i.customAttributesSize,r=t+n,x=new Float32Array(i.renderInstructions),u=x.length/r,o=4*u*(n+e),f=new Uint32Array(6*u),s=new Float32Array(o);let a;for(let e=0;e0?c=o+(n-1)*r:l&&(c=i-r);let p=null;n{const e=t.data;if(e.type===g){const i=e.projectionTransform;this.verticesBuffer_.fromArrayBuffer(e.vertexBuffer),this.helper.flushBufferData(this.verticesBuffer_),this.indicesBuffer_.fromArrayBuffer(e.indexBuffer),this.helper.flushBufferData(this.indicesBuffer_),this.renderTransform_=i,(0,f.T9)(this.invertRenderTransform_,this.renderTransform_),this.renderInstructions_=new Float32Array(t.data.renderInstructions),e.id===this.lastSentId&&(this.ready=!0),this.getLayer().changed()}})),this.featureCache_={},this.featureCount_=0;const a=this.getLayer().getSource();this.sourceListenKeys_=[(0,x.KT)(a,r.A.ADDFEATURE,this.handleSourceFeatureAdded_,this),(0,x.KT)(a,r.A.CHANGEFEATURE,this.handleSourceFeatureChanged_,this),(0,x.KT)(a,r.A.REMOVEFEATURE,this.handleSourceFeatureDelete_,this),(0,x.KT)(a,r.A.CLEAR,this.handleSourceFeatureClear_,this)],a.forEachFeature((t=>{this.featureCache_[(0,y.v6)(t)]={feature:t,properties:t.getProperties(),geometry:t.getGeometry()},this.featureCount_++}))}afterHelperCreated(){this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_),this.hitDetectionEnabled_&&(this.hitRenderTarget_=new c(this.helper))}handleSourceFeatureAdded_(t){const e=t.feature;this.featureCache_[(0,y.v6)(e)]={feature:e,properties:e.getProperties(),geometry:e.getGeometry()},this.featureCount_++}handleSourceFeatureChanged_(t){const e=t.feature;this.featureCache_[(0,y.v6)(e)]={feature:e,properties:e.getProperties(),geometry:e.getGeometry()}}handleSourceFeatureDelete_(t){const e=t.feature;delete this.featureCache_[(0,y.v6)(e)],this.featureCount_--}handleSourceFeatureClear_(){this.featureCache_={},this.featureCount_=0}renderFrame(t){const e=this.helper.getGL();this.preRender(e,t);const[i,n,r]=function(t,e){const i=t.viewState.projection,n=e.getSource().getWrapX()&&i.canWrapX(),r=i.getExtent(),s=t.extent,o=n?(0,m.RG)(r):null,a=n?Math.ceil((s[2]-r[2])/o)+1:1;return[n?Math.floor((s[0]-r[0])/o):0,a,o]}(t,this.getLayer());return this.renderWorlds(t,!1,i,n,r),this.helper.finalizeDraw(t,this.dispatchPreComposeEvent,this.dispatchPostComposeEvent),this.hitDetectionEnabled_&&(this.renderWorlds(t,!0,i,n,r),this.hitRenderTarget_.clearCachedData()),this.postRender(e,t),this.helper.getCanvas()}prepareFrameInternal(t){const e=this.getLayer(),i=e.getSource(),r=t.viewState,o=!t.viewHints[s.A.ANIMATING]&&!t.viewHints[s.A.INTERACTING],a=!(0,m.aI)(this.previousExtent_,t.extent),l=this.sourceRevision_{"use strict";i.d(e,{eS:()=>z,gF:()=>G,Ay:()=>U});var n=i(8928),r=i(3816),s=i(8066),o=i(2272),a=i(8417),l=i(8026),h=i(9891);class c extends o.A{constructor(t){super(),this.tile,this.handleTileChange_=this.handleTileChange_.bind(this),this.gutter_=t.gutter||0,this.helper_=t.helper,this.loaded=!1,this.ready=!1}setTile(t){if(t!==this.tile)if(this.tile&&this.tile.removeEventListener(a.A.CHANGE,this.handleTileChange_),this.tile=t,this.loaded=t.getState()===s.A.LOADED,this.loaded)this.uploadTile();else{if(t instanceof l.A){const e=t.getImage();e instanceof Image&&!e.crossOrigin&&(e.crossOrigin="anonymous")}t.addEventListener(a.A.CHANGE,this.handleTileChange_)}}uploadTile(){(0,h.b0)()}setReady(){this.ready=!0,this.dispatchEvent(a.A.CHANGE)}handleTileChange_(){this.tile.getState()===s.A.LOADED&&(this.loaded=!0,this.uploadTile())}disposeInternal(){this.tile.removeEventListener(a.A.CHANGE,this.handleTileChange_)}}const u=c;var d=i(2771),g=i(9087),f=i(9790),p=i(6843),m=i(8538);function _(t,e,i){const n=i?t.LINEAR:t.NEAREST;t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,n)}function v(t,e,i,n,r,s){const o=t.getGL();let a,l;i instanceof Float32Array?(a=o.FLOAT,t.getExtension("OES_texture_float"),l=null!==t.getExtension("OES_texture_float_linear")):(a=o.UNSIGNED_BYTE,l=!0),_(o,e,s&&l);const h=i.byteLength/n[1];let c,u=1;switch(h%8==0?u=8:h%4==0?u=4:h%2==0&&(u=2),r){case 1:c=o.LUMINANCE;break;case 2:c=o.LUMINANCE_ALPHA;break;case 3:c=o.RGB;break;case 4:c=o.RGBA;break;default:throw new Error(`Unsupported number of bands: ${r}`)}const d=o.getParameter(o.UNPACK_ALIGNMENT);o.pixelStorei(o.UNPACK_ALIGNMENT,u),o.texImage2D(o.TEXTURE_2D,0,c,n[0],n[1],0,c,a,i),o.pixelStorei(o.UNPACK_ALIGNMENT,d)}let y=null;const x=class extends u{constructor(t){super(t),this.textures=[],this.renderSize_=(0,m.xq)(t.grid.getTileSize(t.tile.tileCoord[0])),this.bandCount=NaN;const e=new g.Ay(f.H7,f.Ek);e.fromArray([0,1,1,1,1,0,0,0]),this.helper_.flushBufferData(e),this.coords=e,this.setTile(t.tile)}uploadTile(){const t=this.helper_,e=t.getGL(),i=this.tile;let n;this.textures.length=0,n=i instanceof l.A||i instanceof r.A?i.getImage():i.getData();const s=(0,d.xo)(n);if(s){const t=e.createTexture();return this.textures.push(t),this.bandCount=4,function(t,e,i,n){_(t,e,n),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,i)}(e,t,s,i.interpolate),void this.setReady()}n=(0,d.bL)(n);const o=i.getSize(),a=[o[0]+2*this.gutter_,o[1]+2*this.gutter_],h=n instanceof Float32Array,c=a[0]*a[1],u=h?Float32Array:Uint8Array,g=u.BYTES_PER_ELEMENT,f=n.byteLength/a[1];this.bandCount=Math.floor(f/g/a[0]);const p=Math.ceil(this.bandCount/4);if(1===p){const r=e.createTexture();return this.textures.push(r),v(t,r,n,a,this.bandCount,i.interpolate),void this.setReady()}const m=new Array(p);for(let t=0;t=m;--r){const i=c.getTileRangeForExtentAndZ(e,r,this.tempTileRange_),a=c.getResolution(r);for(let e=i.minX;e<=i.maxX;++e)for(let h=i.minY;h<=i.maxY;++h){const i=(0,T.N)(r,e,h,this.tempTileCoord_),p=F(l,i);let m,_;if(f.containsKey(p)&&(m=f.get(p),_=m.tile),m&&m.tile.key===l.getKey()||(_=l.getTile(r,e,h,t.pixelRatio,o.projection)),M(n,_))continue;if(m)if(this.isDrawableTile_(_))m.setTile(_);else{const t=_.getInterimTile();m.setTile(t)}else m=this.createTileRepresentation({tile:_,grid:c,helper:this.helper,gutter:u}),f.set(p,m);O(n,m,r);const v=_.getKey();g[v]=!0,_.getState()===s.A.IDLE&&(t.tileQueue.isKeyQueued(v)||t.tileQueue.enqueue([_,d,c.getTileCoordCenter(i),a]))}}}beforeTilesRender(t,e){this.helper.prepareDraw(this.frameState,!e,!0)}beforeTilesMaskRender(t){return!1}renderTile(t,e,i,n,r,s,o,a,l,h,c){}renderTileMask(t,e,i,n){}drawTile_(t,e,i,n,r,s,o){if(!e.ready)return;const a=e.tile.tileCoord,l=(0,T.i7)(a),h=l in s?s[l]:1,c=o.getResolution(i),u=(0,m.xq)(o.getTileSize(i),this.tempSize_),d=o.getOrigin(i),g=o.getTileCoordExtent(a),f=h<1?-1:L(i);h<1&&(t.animate=!0);const p=t.viewState,_=p.center[0],v=p.center[1],y=u[0]+2*n,x=u[1]+2*n,E=y/x,A=(_-d[0])/(u[0]*c),w=(d[1]-v)/(u[1]*c),b=p.resolution/c,S=a[1],R=a[2];(0,C.cL)(this.tileTransform_),(0,C.hs)(this.tileTransform_,2/(t.size[0]*b/y),-2/(t.size[1]*b/y)),(0,C.e$)(this.tileTransform_,p.rotation),(0,C.hs)(this.tileTransform_,1,1/E),(0,C.Tl)(this.tileTransform_,(u[0]*(S-A)-n)/y,(u[1]*(R-w)-n)/x),this.renderTile(e,this.tileTransform_,t,r,c,u,d,g,f,n,h)}renderFrame(t){this.frameState=t,this.renderComplete=!0;const e=this.helper.getGL();this.preRender(e,t);const i=t.viewState,o=this.getLayer(),a=o.getRenderSource(),l=a.getTileGridForProjection(i.projection),c=a.getGutterForProjection(i.projection),u=D(t,t.extent),d=l.getZForResolution(i.resolution,a.zDirection),g={tileIds:new Set,representationsByZ:{}},f=o.getPreload();if(t.nextExtent){const e=l.getZForResolution(i.nextResolution,a.zDirection),n=D(t,t.nextExtent);this.enqueueTiles(t,n,e,g,f)}this.enqueueTiles(t,u,d,g,0),f>0&&setTimeout((()=>{this.enqueueTiles(t,u,d-1,g,f-1)}),0);const p={},m=(0,h.v6)(this),_=t.time;let v=!1;for(const t of g.representationsByZ[d]){const e=t.tile;if((e instanceof r.A||e instanceof n.A)&&e.getState()===s.A.EMPTY)continue;const i=e.tileCoord;if(t.ready){const t=e.getAlpha(m,_);if(1===t){e.endTransition(m);continue}v=!0,p[(0,T.i7)(i)]=t}if(this.renderComplete=!1,this.findAltTiles_(l,i,d+1,g))continue;const o=l.getMinZoom();for(let t=d-1;t>=o&&!this.findAltTiles_(l,i,t,g);--t);}const y=g.representationsByZ,x=Object.keys(y).map(Number).sort(S.rG);if(this.beforeTilesMaskRender(t))for(let t=0,e=x.length;tt.dispose())),t.clear()}removeHelper(){this.helper&&this.clearCache(),super.removeHelper()}disposeInternal(){super.disposeInternal(),delete this.frameState}}const N=k;var j=i(3237);const G={TILE_TRANSFORM:"u_tileTransform",TRANSITION_ALPHA:"u_transitionAlpha",DEPTH:"u_depth",RENDER_EXTENT:"u_renderExtent",PATTERN_ORIGIN:"u_patternOrigin",RESOLUTION:"u_resolution",ZOOM:"u_zoom",GLOBAL_ALPHA:"u_globalAlpha",PROJECTION_MATRIX:"u_projectionMatrix",SCREEN_TO_WORLD_MATRIX:"u_screenToWorldMatrix",TILE_TEXTURE_ARRAY:"u_tileTextures",TEXTURE_PIXEL_WIDTH:"u_texturePixelWidth",TEXTURE_PIXEL_HEIGHT:"u_texturePixelHeight",TEXTURE_RESOLUTION:"u_textureResolution",TEXTURE_ORIGIN_X:"u_textureOriginX",TEXTURE_ORIGIN_Y:"u_textureOriginY"},z={TEXTURE_COORD:"a_textureCoord"},B=[{name:z.TEXTURE_COORD,size:2,type:j.jQ.FLOAT}],U=class extends N{constructor(t,e){super(t,e),this.program_,this.vertexShader_=e.vertexShader,this.fragmentShader_=e.fragmentShader,this.indices_=new g.Ay(f.IP,f.Ek),this.indices_.fromArray([0,1,3,1,2,3]),this.paletteTextures_=e.paletteTextures||[]}reset(t){if(super.reset(t),this.helper){const t=this.helper.getGL();for(const e of this.paletteTextures_)e.delete(t)}this.vertexShader_=t.vertexShader,this.fragmentShader_=t.fragmentShader,this.paletteTextures_=t.paletteTextures||[],this.helper&&(this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_))}afterHelperCreated(){this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_),this.helper.flushBufferData(this.indices_)}removeHelper(){if(this.helper){const t=this.helper.getGL();for(const e of this.paletteTextures_)e.delete(t)}super.removeHelper()}createTileRepresentation(t){return new x(t)}beforeTilesRender(t,e){super.beforeTilesRender(t,e),this.helper.useProgram(this.program_,t)}renderTile(t,e,i,n,r,s,o,a,l,h,c){const u=this.helper.getGL();this.helper.bindBuffer(t.coords),this.helper.bindBuffer(this.indices_),this.helper.enableAttributes(B);let d=0;for(;d0&&(y=a,(0,I._N)(y,n,y)),this.helper.setUniformFloatVec4(G.RENDER_EXTENT,y),this.helper.setUniformFloatValue(G.RESOLUTION,g.resolution),this.helper.setUniformFloatValue(G.ZOOM,g.zoom),this.helper.setUniformFloatValue(G.TEXTURE_PIXEL_WIDTH,f),this.helper.setUniformFloatValue(G.TEXTURE_PIXEL_HEIGHT,p),this.helper.setUniformFloatValue(G.TEXTURE_RESOLUTION,r),this.helper.setUniformFloatValue(G.TEXTURE_ORIGIN_X,o[0]+_*s[0]*r-h*r),this.helper.setUniformFloatValue(G.TEXTURE_ORIGIN_Y,o[1]-v*s[1]*r+h*r),this.helper.drawElements(0,this.indices_.getSize())}getData(t){if(!this.helper.getGL())return null;const e=this.frameState;if(!e)return null;const i=this.getLayer(),o=(0,C.Bb)(e.pixelToCoordinateTransform,t.slice()),a=e.viewState,l=i.getExtent();if(l&&!(0,I.Ym)((0,R.fromUserExtent)(l,a.projection),o))return null;const h=i.getSources((0,I.Tr)([o]),a.resolution);let c,u,d;for(c=h.length-1;c>=0;--c)if(u=h[c],"ready"===u.getState()){if(d=u.getTileGridForProjection(a.projection),u.getWrapX())break;const t=d.getExtent();if(!t||(0,I.Ym)(t,o))break}if(c<0)return null;const g=this.tileRepresentationCache;for(let t=d.getZForResolution(a.resolution);t>=d.getMinZoom();--t){const e=d.getTileCoordForCoordAndZ(o,t),i=F(u,e);if(!g.containsKey(i))continue;const a=g.get(i),l=a.tile;if((l instanceof r.A||l instanceof n.A)&&l.getState()===s.A.EMPTY)return null;if(!a.loaded)continue;const h=d.getOrigin(t),c=(0,m.xq)(d.getTileSize(t)),f=d.getResolution(t),p=(o[0]-h[0])/f-e[1]*c[0],_=(h[1]-o[1])/f-e[2]*c[1];return a.getPixelData(p,_)}return null}disposeInternal(){const t=this.helper;if(t){const e=t.getGL();for(const t of this.paletteTextures_)t.delete(e);this.paletteTextures_.length=0,e.deleteProgram(this.program_),delete this.program_,t.deleteBuffer(this.indices_)}super.disposeInternal(),delete this.indices_}}},2253:(t,e,i)=>{"use strict";i.d(e,{BV:()=>l,KQ:()=>u,XX:()=>g,aY:()=>d});var n=i(3839),r=i(6843),s=i(6409),o=i(4769);let a;const l=[];function h(t,e,i,n,r){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,r),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,r)),t.restore()}function c(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function u(t,e,i,r){const o=(0,s.transform)(i,e,t);let a=(0,s.getPointResolution)(e,r,i);const l=e.getMetersPerUnit();void 0!==l&&(a*=l);const h=t.getMetersPerUnit();void 0!==h&&(a/=h);const c=t.getExtent();if(!c||(0,n.Ym)(c,o)){const e=(0,s.getPointResolution)(t,a,o)/a;isFinite(e)&&e>0&&(a/=e)}return a}function d(t,e,i,r){const s=(0,n.q1)(i);let o=u(t,e,s,r);return(!isFinite(o)||o<=0)&&(0,n.sB)(i,(function(i){return o=u(t,e,i,r),isFinite(o)&&o>0})),o}function g(t,e,i,s,u,d,g,f,p,m,_,v,y,x){const E=(0,r.Y)(Math.round(i*t),Math.round(i*e),l);if(v||(E.imageSmoothingEnabled=!1),0===p.length)return E.canvas;function A(t){return Math.round(t*i)/i}E.scale(i,i),E.globalCompositeOperation="lighter";const w=(0,n.S5)();let b;p.forEach((function(t,e,i){(0,n.X$)(w,t.extent)}));const T=i/s,C=(v?1:1+Math.pow(2,-24))/T;if(!y||1!==p.length||0!==m){if(b=(0,r.Y)(Math.round((0,n.RG)(w)*T),Math.round((0,n.Oq)(w)*T),l),v||(b.imageSmoothingEnabled=!1),u&&x){const t=(u[0]-w[0])*T,e=-(u[3]-w[3])*T,i=(0,n.RG)(u)*T,r=(0,n.Oq)(u)*T;b.rect(t,e,i,r),b.clip()}p.forEach((function(t,e,i){if(t.image.width>0&&t.image.height>0){if(t.clipExtent){b.save();const e=(t.clipExtent[0]-w[0])*T,i=-(t.clipExtent[3]-w[3])*T,r=(0,n.RG)(t.clipExtent)*T,s=(0,n.Oq)(t.clipExtent)*T;b.rect(v?e:Math.round(e),v?i:Math.round(i),v?r:Math.round(e+r)-Math.round(e),v?s:Math.round(i+s)-Math.round(i)),b.clip()}const e=(t.extent[0]-w[0])*T,i=-(t.extent[3]-w[3])*T,r=(0,n.RG)(t.extent)*T,s=(0,n.Oq)(t.extent)*T;b.drawImage(t.image,m,m,t.image.width-2*m,t.image.height-2*m,v?e:Math.round(e),v?i:Math.round(i),v?r:Math.round(e+r)-Math.round(e),v?s:Math.round(i+s)-Math.round(i)),t.clipExtent&&b.restore()}}))}const S=(0,n.Py)(g);return f.getTriangles().forEach((function(t,e,i){const s=t.source,u=t.target;let g=s[0][0],f=s[0][1],m=s[1][0],_=s[1][1],y=s[2][0],x=s[2][1];const T=A((u[0][0]-S[0])/d),R=A(-(u[0][1]-S[1])/d),I=A((u[1][0]-S[0])/d),P=A(-(u[1][1]-S[1])/d),L=A((u[2][0]-S[0])/d),M=A(-(u[2][1]-S[1])/d),O=g,D=f;g=0,f=0,m-=O,_-=D,y-=O,x-=D;const F=[[m,_,0,0,I-T],[y,x,0,0,L-T],[0,0,m,_,P-R],[0,0,y,x,M-R]],k=(0,o.KU)(F);if(!k)return;if(E.save(),E.beginPath(),function(){if(void 0===a){const t=(0,r.Y)(6,6,l);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",h(t,4,5,4,0),h(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;a=c(e,0)||c(e,4)||c(e,8),(0,r.Yg)(t),l.push(t.canvas)}return a}()||!v){E.moveTo(I,P);const t=4,e=T-I,i=R-P;for(let n=0;n{"use strict";i.d(e,{A:()=>f});var n=i(3801),r=i(2771),s=i(8417),o=i(8066),a=i(2973),l=i(2253),h=i(4769),c=i(6843),u=i(3839),d=i(554);class g extends r.Ay{constructor(t){super({tileCoord:t.tileCoord,loader:()=>Promise.resolve(new Uint8Array(4)),interpolate:t.interpolate,transition:t.transition}),this.pixelRatio_=t.pixelRatio,this.gutter_=t.gutter,this.reprojData_=null,this.reprojError_=null,this.reprojSize_=void 0,this.sourceTileGrid_=t.sourceTileGrid,this.targetTileGrid_=t.targetTileGrid,this.wrappedTileCoord_=t.wrappedTileCoord||t.tileCoord,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const e=t.sourceProj,i=e.getExtent(),r=t.sourceTileGrid.getExtent();this.clipExtent_=e.canWrapX()?r?(0,u._N)(i,r):i:r;const s=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),c=this.targetTileGrid_.getExtent();let d=this.sourceTileGrid_.getExtent();const g=c?(0,u._N)(s,c):s;if(0===(0,u.UG)(g))return void(this.state=o.A.EMPTY);i&&(d=d?(0,u._N)(d,i):i);const f=this.targetTileGrid_.getResolution(this.wrappedTileCoord_[0]),p=t.targetProj,m=(0,l.aY)(e,p,g,f);if(!isFinite(m)||m<=0)return void(this.state=o.A.EMPTY);const _=void 0!==t.errorThreshold?t.errorThreshold:n.l;if(this.triangulation_=new a.A(e,p,g,d,m*_,f),0===this.triangulation_.getTriangles().length)return void(this.state=o.A.EMPTY);this.sourceZ_=this.sourceTileGrid_.getZForResolution(m);let v=this.triangulation_.calculateSourceExtent();if(d&&(e.canWrapX()?(v[1]=(0,h.qE)(v[1],d[1],d[3]),v[3]=(0,h.qE)(v[3],d[1],d[3])):v=(0,u._N)(v,d)),(0,u.UG)(v)){let n=0,r=0;e.canWrapX()&&(n=(0,u.RG)(i),r=Math.floor((v[0]-i[0])/n)),(0,u.QJ)(v.slice(),e,!0).forEach((e=>{const i=this.sourceTileGrid_.getTileRangeForExtentAndZ(e,this.sourceZ_),s=t.getTileFunction;for(let t=i.minX;t<=i.maxX;t++)for(let e=i.minY;e<=i.maxY;e++){const i=s(this.sourceZ_,t,e,this.pixelRatio_);if(i){const t=r*n;this.sourceTiles_.push({tile:i,offset:t})}}++r})),0===this.sourceTiles_.length&&(this.state=o.A.EMPTY)}else this.state=o.A.EMPTY}getSize(){return this.reprojSize_}getData(){return this.reprojData_}getError(){return this.reprojError_}reproject_(){const t=[];if(this.sourceTiles_.forEach((e=>{const i=e.tile;if(!i||i.getState()!==o.A.LOADED)return;const n=i.getSize(),s=this.gutter_;let a;a=(0,r.bL)(i.getData())||(0,r.$r)((0,r.xo)(i.getData()));const l=[n[0]+2*s,n[1]+2*s],h=a instanceof Float32Array,c=l[0]*l[1],u=h?Float32Array:Uint8Array,d=new u(a.buffer),g=u.BYTES_PER_ELEMENT,f=g*d.length/c,p=d.byteLength/l[1],m=Math.floor(p/g/l[0]),_=c*m;let v=d;if(d.length!==_){v=new u(_);let t=0,e=0;const i=l[0]*m;for(let n=0;n=0;--e){const i=[];for(let n=0,r=t.length;n{const i=e.getState();if(i!==o.A.IDLE&&i!==o.A.LOADING)return;t++;const n=(0,d.KT)(e,s.A.CHANGE,(function(){const i=e.getState();i!=o.A.LOADED&&i!=o.A.ERROR&&i!=o.A.EMPTY||((0,d.JH)(n),t--,0===t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(n)})),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function({tile:t}){t.getState()==o.A.IDLE&&t.load()}))}unlistenSources_(){this.sourcesListenerKeys_.forEach(d.JH),this.sourcesListenerKeys_=null}}const f=g},3816:(t,e,i)=>{"use strict";i.d(e,{A:()=>f});var n=i(3801),r=i(8417),s=i(5291),o=i(8066),a=i(2973),l=i(2253),h=i(4769),c=i(3839),u=i(554),d=i(6843);class g extends s.A{constructor(t,e,i,r,s,u,d,g,f,p,m,_){super(s,o.A.IDLE,_),this.renderEdges_=void 0!==m&&m,this.pixelRatio_=d,this.gutter_=g,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=r,this.wrappedTileCoord_=u||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const v=r.getTileCoordExtent(this.wrappedTileCoord_),y=this.targetTileGrid_.getExtent();let x=this.sourceTileGrid_.getExtent();const E=y?(0,c._N)(v,y):v;if(0===(0,c.UG)(E))return void(this.state=o.A.EMPTY);const A=t.getExtent();A&&(x=x?(0,c._N)(x,A):A);const w=r.getResolution(this.wrappedTileCoord_[0]),b=(0,l.aY)(t,i,E,w);if(!isFinite(b)||b<=0)return void(this.state=o.A.EMPTY);const T=void 0!==p?p:n.l;if(this.triangulation_=new a.A(t,i,E,x,b*T,w),0===this.triangulation_.getTriangles().length)return void(this.state=o.A.EMPTY);this.sourceZ_=e.getZForResolution(b);let C=this.triangulation_.calculateSourceExtent();if(x&&(t.canWrapX()?(C[1]=(0,h.qE)(C[1],x[1],x[3]),C[3]=(0,h.qE)(C[3],x[1],x[3])):C=(0,c._N)(C,x)),(0,c.UG)(C)){let i=0,n=0;t.canWrapX()&&(i=(0,c.RG)(A),n=Math.floor((C[0]-A[0])/i)),(0,c.QJ)(C.slice(),t,!0).forEach((t=>{const r=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let t=r.minX;t<=r.maxX;t++)for(let e=r.minY;e<=r.maxY;e++){const r=f(this.sourceZ_,t,e,d);if(r){const t=n*i;this.sourceTiles_.push({tile:r,offset:t})}}++n})),0===this.sourceTiles_.length&&(this.state=o.A.EMPTY)}else this.state=o.A.EMPTY}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach((e=>{const i=e.tile;if(i&&i.getState()==o.A.LOADED){const n=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);n[0]+=e.offset,n[2]+=e.offset;const r=this.clipExtent_?.slice();r&&(r[0]+=e.offset,r[2]+=e.offset),t.push({extent:n,clipExtent:r,image:i.getImage()})}})),this.sourceTiles_.length=0,0===t.length)this.state=o.A.ERROR;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],r="number"==typeof i?i:i[1],s=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),h=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=(0,l.XX)(n,r,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),s,h,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=o.A.LOADED}this.changed()}load(){if(this.state==o.A.IDLE){this.state=o.A.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach((({tile:e})=>{const i=e.getState();if(i==o.A.IDLE||i==o.A.LOADING){t++;const i=(0,u.KT)(e,r.A.CHANGE,(function(n){const r=e.getState();r!=o.A.LOADED&&r!=o.A.ERROR&&r!=o.A.EMPTY||((0,u.JH)(i),t--,0===t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(i)}})),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function({tile:t},e,i){t.getState()==o.A.IDLE&&t.load()}))}}unlistenSources_(){this.sourcesListenerKeys_.forEach(u.JH),this.sourcesListenerKeys_=null}release(){this.canvas_&&((0,d.Yg)(this.canvas_.getContext("2d")),l.BV.push(this.canvas_),this.canvas_=null),super.release()}}const f=g},2973:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var n=i(3839),r=i(6409),s=i(4769);const o=class{constructor(t,e,i,s,o,a){this.sourceProj_=t,this.targetProj_=e;let l={};const h=(0,r.getTransform)(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){const e=t[0]+"/"+t[1];return l[e]||(l[e]=h(t)),l[e]},this.maxSourceExtent_=s,this.errorThresholdSquared_=o*o,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&(0,n.RG)(s)>=(0,n.RG)(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?(0,n.RG)(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?(0,n.RG)(this.targetProj_.getExtent()):null;const c=(0,n.Py)(i),u=(0,n.WU)(i),d=(0,n.k_)(i),g=(0,n.R)(i),f=this.transformInv_(c),p=this.transformInv_(u),m=this.transformInv_(d),_=this.transformInv_(g),v=10+(a?Math.max(0,Math.ceil(Math.log2((0,n.UG)(i)/(a*a*256*256)))):0);if(this.addQuad_(c,u,d,g,f,p,m,_,v),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach((function(e,i,n){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])})),this.triangles_.forEach((e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const i=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];i[0][0]-t>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-t>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-t>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);const n=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-n.5&&d<1;let p=!1;if(c>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const s=(0,n.Tr)([t,e,i,r]);p=(0,n.RG)(s)/this.targetWorldWidth_>.25||p}!f&&this.sourceProj_.isGlobal()&&d&&(p=d>.25||p)}if(!p&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3])&&!(0,n.HY)(u,this.maxSourceExtent_))return;let m=0;if(!(p||isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])&&isFinite(l[0])&&isFinite(l[1])&&isFinite(h[0])&&isFinite(h[1])))if(c>0)p=!0;else if(m=(isFinite(o[0])&&isFinite(o[1])?0:8)+(isFinite(a[0])&&isFinite(a[1])?0:4)+(isFinite(l[0])&&isFinite(l[1])?0:2)+(isFinite(h[0])&&isFinite(h[1])?0:1),1!=m&&2!=m&&4!=m&&8!=m)return;if(c>0){if(!p){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],n=this.transformInv_(e);let r;r=f?((0,s.xP)(o[0],g)+(0,s.xP)(l[0],g))/2-(0,s.xP)(n[0],g):(o[0]+l[0])/2-n[0];const a=(o[1]+l[1])/2-n[1];p=r*r+a*a>this.errorThresholdSquared_}if(p){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const n=[(e[0]+i[0])/2,(e[1]+i[1])/2],s=this.transformInv_(n),u=[(r[0]+t[0])/2,(r[1]+t[1])/2],d=this.transformInv_(u);this.addQuad_(t,e,n,u,o,a,s,d,c-1),this.addQuad_(u,n,i,r,d,s,l,h,c-1)}else{const n=[(t[0]+e[0])/2,(t[1]+e[1])/2],s=this.transformInv_(n),u=[(i[0]+r[0])/2,(i[1]+r[1])/2],d=this.transformInv_(u);this.addQuad_(t,n,u,r,o,s,d,h,c-1),this.addQuad_(n,e,i,u,s,a,l,d,c-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}11&m||this.addTriangle_(t,i,r,o,l,h),14&m||this.addTriangle_(t,i,e,o,l,a),m&&(13&m||this.addTriangle_(e,r,t,a,h,o),7&m||this.addTriangle_(e,r,i,a,h,l))}calculateSourceExtent(){const t=(0,n.S5)();return this.triangles_.forEach((function(e,i,r){const s=e.source;(0,n.$C)(t,s[0]),(0,n.$C)(t,s[1]),(0,n.$C)(t,s[2])})),t}getTriangles(){return this.triangles_}}},3801:(t,e,i)=>{"use strict";i.d(e,{l:()=>n});const n=.5},2005:(t,e,i)=>{"use strict";function n(t){return Array.isArray(t)?Math.min(...t):t}i.d(e,{m:()=>n})},4214:(t,e,i)=>{"use strict";i.d(e,{a$:()=>o,b8:()=>r,cq:()=>a,dv:()=>s});var n=i(4769);function r(t){if(void 0!==t)return 0}function s(t){if(void 0!==t)return t}function o(t){const e=2*Math.PI/t;return function(t,i){return i?t:void 0!==t?t=Math.floor(t/e+.5)*e:void 0}}function a(t){const e=void 0===t?(0,n.eh)(5):t;return function(t,i){return i||void 0===t?t:Math.abs(t)<=e?0:t}}},8538:(t,e,i)=>{"use strict";function n(t){return t[0]>0&&t[1]>0}function r(t,e,i){return void 0===i&&(i=[0,0]),i[0]=t[0]*e+.5|0,i[1]=t[1]*e+.5|0,i}function s(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}i.d(e,{Ie:()=>n,hs:()=>r,xq:()=>s})},9340:(t,e,i)=>{"use strict";i.r(e),i.d(e,{BingMaps:()=>u,CartoDB:()=>f,Cluster:()=>w,DataTile:()=>b.A,GeoTIFF:()=>T.default,Google:()=>R,IIIF:()=>Z,Image:()=>ct,ImageArcGISRest:()=>ft,ImageCanvas:()=>mt,ImageMapGuide:()=>vt,ImageStatic:()=>xt,ImageWMS:()=>Rt,OGCMapTile:()=>Bt,OGCVectorTile:()=>Xt,OSM:()=>$t,Raster:()=>ce,Source:()=>it.A,StadiaMaps:()=>fe,Tile:()=>Jt.A,TileArcGISRest:()=>me,TileDebug:()=>ve,TileImage:()=>s.A,TileJSON:()=>xe,TileWMS:()=>Ae,UTFGrid:()=>Se,UrlTile:()=>we.A,Vector:()=>v.A,VectorTile:()=>Ut.default,WMTS:()=>Ie,XYZ:()=>d.default,Zoomify:()=>N,createArcGISRestLoader:()=>gt,createMapGuideLoader:()=>_t,createStaticLoader:()=>yt,createWMSLoader:()=>St,sourcesFromTileGrid:()=>Pe});var n=i(5941),r=i(3839),s=i(7828),o=i(4610),a=i(4614),l=i(1990),h=i(6409);class c extends s.A{constructor(t){const e=void 0!==t.hidpi&&t.hidpi;super({cacheSize:t.cacheSize,crossOrigin:"anonymous",interpolate:t.interpolate,opaque:!0,projection:(0,h.get)("EPSG:3857"),reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,tilePixelRatio:e?2:1,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.hidpi_=e,this.culture_=void 0!==t.culture?t.culture:"en-us",this.maxZoom_=void 0!==t.maxZoom?t.maxZoom:-1,this.apiKey_=t.key,this.imagerySet_=t.imagerySet,this.placeholderTiles_=t.placeholderTiles;const i="https://dev.virtualearth.net/REST/v1/Imagery/Metadata/"+this.imagerySet_+"?uriScheme=https&include=ImageryProviders&key="+this.apiKey_+"&c="+this.culture_;fetch(i).then((t=>t.json())).then((t=>this.handleImageryMetadataResponse(t)))}getApiKey(){return this.apiKey_}getImagerySet(){return this.imagerySet_}handleImageryMetadataResponse(t){if(200!=t.statusCode||"OK"!=t.statusDescription||"ValidCredentials"!=t.authenticationResultCode||1!=t.resourceSets.length||1!=t.resourceSets[0].resources.length)return void this.setState("error");const e=t.resourceSets[0].resources[0],i=-1==this.maxZoom_?e.zoomMax:this.maxZoom_,n=this.getProjection(),s=(0,l.extentFromProjection)(n),c=this.hidpi_?2:1,u=e.imageWidth==e.imageHeight?e.imageWidth/c:[e.imageWidth/c,e.imageHeight/c],d=(0,l.createXYZ)({extent:s,minZoom:e.zoomMin,maxZoom:i,tileSize:u});this.tileGrid=d;const g=this.culture_,f=this.hidpi_,p=this.placeholderTiles_;if(this.tileUrlFunction=(0,o.FD)(e.imageUrlSubdomains.map((function(t){const i=[0,0,0],n=e.imageUrl.replace("{subdomain}",t).replace("{culture}",g);return function(t,e,r){if(!t)return;(0,a.N)(t[0],t[1],t[2],i);const s=new URL(n.replace("{quadkey}",function(t){const e=t[0],i=new Array(e);let n,r,s=1<>=1;return i.join("")}(i))),o=s.searchParams;return f&&(o.set("dpi","d1"),o.set("device","mobile")),!0===p?o.delete("n"):!1===p&&o.set("n","z"),s.toString()}}))),e.imageryProviders){const t=(0,h.getTransformFromProjections)((0,h.get)("EPSG:4326"),this.getProjection());this.setAttributions((i=>{const n=[],s=i.viewState,o=this.getTileGrid(),a=o.getZForResolution(s.resolution,this.zDirection),l=o.getTileCoordForCoordAndZ(s.center,a)[0];return e.imageryProviders.map((function(e){let s=!1;const o=e.coverageAreas;for(let e=0,n=o.length;e=n.zoomMin&&l<=n.zoomMax){const e=n.bbox,o=[e[1],e[0],e[3],e[2]],a=(0,r.NW)(o,t);if((0,r.HY)(a,i.extent)){s=!0;break}}}s&&n.push(e.attribution)})),n.push('Terms of Use'),n}))}this.setState("ready")}}const u=c;var d=i(5778);class g extends d.default{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,maxZoom:void 0!==t.maxZoom?t.maxZoom:18,minZoom:t.minZoom,projection:t.projection,transition:t.transition,wrapX:t.wrapX,zDirection:t.zDirection}),this.account_=t.account,this.mapId_=t.map||"",this.config_=t.config||{},this.templateCache_={},this.initializeMap_()}getConfig(){return this.config_}updateConfig(t){Object.assign(this.config_,t),this.initializeMap_()}setConfig(t){this.config_=t||{},this.initializeMap_()}initializeMap_(){const t=JSON.stringify(this.config_);if(this.templateCache_[t])return void this.applyTemplate_(this.templateCache_[t]);let e="https://"+this.account_+".carto.com/api/v1/map";this.mapId_&&(e+="/named/"+this.mapId_);const i=new XMLHttpRequest;i.addEventListener("load",this.handleInitResponse_.bind(this,t)),i.addEventListener("error",this.handleInitError_.bind(this)),i.open("POST",e),i.setRequestHeader("Content-type","application/json"),i.send(JSON.stringify(this.config_))}handleInitResponse_(t,e){const i=e.target;if(!i.status||i.status>=200&&i.status<300){let e;try{e=JSON.parse(i.responseText)}catch(t){return void this.setState("error")}this.applyTemplate_(e),this.templateCache_[t]=e,this.setState("ready")}else this.setState("error")}handleInitError_(t){this.setState("error")}applyTemplate_(t){const e="https://"+t.cdn_url.https+"/"+this.account_+"/api/v1/map/"+t.layergroupid+"/{z}/{x}/{y}.png";this.setUrl(e)}}const f=g;var p=i(8417),m=i(6097),_=i(250),v=i(1736),y=i(4137),x=i(4504),E=i(9891);class A extends v.A{constructor(t){super({attributions:(t=t||{}).attributions,wrapX:t.wrapX}),this.resolution=void 0,this.distance=void 0!==t.distance?t.distance:20,this.minDistance=t.minDistance||0,this.interpolationRatio=0,this.features=[],this.geometryFunction=t.geometryFunction||function(t){const e=t.getGeometry();return(0,x.v)(!e||"Point"===e.getType(),"The default `geometryFunction` can only handle `Point` or null geometries"),e},this.createCustomCluster_=t.createCluster,this.source=null,this.boundRefresh_=this.refresh.bind(this),this.updateDistance(this.distance,this.minDistance),this.setSource(t.source||null)}clear(t){this.features.length=0,super.clear(t)}getDistance(){return this.distance}getSource(){return this.source}loadFeatures(t,e,i){this.source?.loadFeatures(t,e,i),e!==this.resolution&&(this.resolution=e,this.refresh())}setDistance(t){this.updateDistance(t,this.minDistance)}setMinDistance(t){this.updateDistance(this.distance,t)}getMinDistance(){return this.minDistance}setSource(t){this.source&&this.source.removeEventListener(p.A.CHANGE,this.boundRefresh_),this.source=t,t&&t.addEventListener(p.A.CHANGE,this.boundRefresh_),this.refresh()}refresh(){this.clear(),this.cluster(),this.addFeatures(this.features)}updateDistance(t,e){const i=0===t?0:Math.min(e,t)/t,n=t!==this.distance||this.interpolationRatio!==i;this.distance=t,this.minDistance=e,this.interpolationRatio=i,n&&this.refresh()}cluster(){if(void 0===this.resolution||!this.source)return;const t=(0,r.S5)(),e=this.distance*this.resolution,i=this.source.getFeatures(),n={};for(let s=0,o=i.length;s=0;--e){const n=this.geometryFunction(t[e]);n?(0,y.WQ)(i,n.getCoordinates()):t.splice(e,1)}(0,y.hs)(i,1/t.length);const n=(0,r.q1)(e),s=this.interpolationRatio,o=new _.default([i[0]*(1-s)+n[0]*s,i[1]*(1-s)+n[1]*s]);return this.createCustomCluster_?this.createCustomCluster_(o,t):new m.default({geometry:o,features:t})}}const w=A;var b=i(1733),T=i(5913),C=i(9611);class S extends s.A{constructor(t){const e=!!t.highDpi,i=!(!0===t.overlay);super({attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:"anonymous",interpolate:t.interpolate,opaque:i,projection:"EPSG:3857",reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,tilePixelRatio:e?2:1,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.apiKey_=t.key,this.error_=null;const n={mapType:t.mapType||"roadmap",language:t.language||"en-US",region:t.region||"US"};t.imageFormat&&(n.imageFormat=t.imageFormat),t.scale&&(n.scale=t.scale),e&&(n.highDpi=!0),t.layerTypes&&(n.layerTypes=t.layerTypes),t.styles&&(n.styles=t.styles),!0===t.overlay&&(n.overlay=!0),this.sessionTokenRequest_=n,this.sessionTokenValue_,this.sessionRefreshId_,this.previousViewportAttribution_,this.previousViewportExtent_,this.createSession_()}getError(){return this.error_}fetchSessionToken(t,e){return fetch(t,e)}async createSession_(){const t="https://tile.googleapis.com/v1/createSession?key="+this.apiKey_,e={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(this.sessionTokenRequest_)},i=await this.fetchSessionToken(t,e);if(!i.ok){try{const t=await i.json();this.error_=new Error(t.error.message)}catch{this.error_=new Error("Error fetching session token")}return void this.setState("error")}const n=await i.json(),r=this.getTilePixelRatio(1),s=[n.tileWidth/r,n.tileHeight/r];this.tileGrid=(0,l.createXYZ)({extent:(0,l.extentFromProjection)(this.getProjection()),maxZoom:22,tileSize:s});const o=n.session;this.sessionTokenValue_=o;const a=this.apiKey_;this.tileUrlFunction=function(t,e,i){return`https://tile.googleapis.com/v1/2dtiles/${t[0]}/${t[1]}/${t[2]}?session=${o}&key=${a}`};const h=1e3*parseInt(n.expiry,10),c=Math.max(h-Date.now()-6e4,1);this.sessionRefreshId_=setTimeout((()=>this.createSession_()),c),this.setAttributions(this.fetchAttributions_.bind(this)),this.setState("ready")}async fetchAttributions_(t){if(t.viewHints[C.A.ANIMATING]||t.viewHints[C.A.INTERACTING]||t.animate)return this.previousViewportAttribution_;const[e,i]=(0,h.toLonLat)((0,r.R)(t.extent),t.viewState.projection),[n,s]=(0,h.toLonLat)((0,r.WU)(t.extent),t.viewState.projection),o=`zoom=${this.getTileGrid().getZForResolution(t.viewState.resolution,this.zDirection)}&north=${s}&south=${i}&east=${n}&west=${e}`;if(this.previousViewportExtent_==o)return this.previousViewportAttribution_;this.previousViewportExtent_=o;const a=`https://tile.googleapis.com/tile/v1/viewport?session=${this.sessionTokenValue_}&key=${this.apiKey_}&${o}`;return this.previousViewportAttribution_=await fetch(a).then((t=>t.json())).then((t=>t.copyright)),this.previousViewportAttribution_}disposeInternal(){clearTimeout(this.sessionRefreshId_),super.disposeInternal()}}const R=S;var I=i(5978),P=i(8943),L=i(8026),M=i(8066),O=i(6843),D=i(8538);class F extends L.A{constructor(t,e,i,n,r,s,o){super(e,i,n,r,s,o),this.zoomifyImage_=null,this.tileSize_=t}getImage(){if(this.zoomifyImage_)return this.zoomifyImage_;const t=super.getImage();if(this.state==M.A.LOADED){const e=this.tileSize_;if(t.width==e[0]&&t.height==e[1])return this.zoomifyImage_=t,t;const i=(0,O.Y)(e[0],e[1]);return i.drawImage(t,0,0),this.zoomifyImage_=i.canvas,i.canvas}return t}}class k extends s.A{constructor(t){const e=t.size,i=void 0!==t.tierSizeCalculation?t.tierSizeCalculation:"default",n=t.tilePixelRatio||1,s=e[0],a=e[1],l=[],h=t.tileSize||P.R;let c=h*n;switch(i){case"default":for(;s>c||a>c;)l.push([Math.ceil(s/c),Math.ceil(a/c)]),c+=c;break;case"truncated":let t=s,e=a;for(;t>c||e>c;)l.push([Math.ceil(t/c),Math.ceil(e/c)]),t>>=1,e>>=1;break;default:throw new Error("Unknown `tierSizeCalculation` configured")}l.push([1,1]),l.reverse();const u=[n],d=[0];for(let t=1,e=l.length;t{m=h,this.changed()})),x.src=y}}const N=k,j="version1",G="version2",z="version3",B={};B[j]={level0:{supports:[],formats:[],qualities:["native"]},level1:{supports:["regionByPx","sizeByW","sizeByH","sizeByPct"],formats:["jpg"],qualities:["native"]},level2:{supports:["regionByPx","regionByPct","sizeByW","sizeByH","sizeByPct","sizeByConfinedWh","sizeByWh"],formats:["jpg","png"],qualities:["native","color","grey","bitonal"]}},B[G]={level0:{supports:[],formats:["jpg"],qualities:["default"]},level1:{supports:["regionByPx","sizeByW","sizeByH","sizeByPct"],formats:["jpg"],qualities:["default"]},level2:{supports:["regionByPx","regionByPct","sizeByW","sizeByH","sizeByPct","sizeByConfinedWh","sizeByDistortedWh","sizeByWh"],formats:["jpg","png"],qualities:["default","bitonal"]}},B[z]={level0:{supports:[],formats:["jpg"],qualities:["default"]},level1:{supports:["regionByPx","regionSquare","sizeByW","sizeByH","sizeByWh"],formats:["jpg"],qualities:["default"]},level2:{supports:["regionByPx","regionSquare","regionByPct","sizeByW","sizeByH","sizeByPct","sizeByConfinedWh","sizeByWh"],formats:["jpg","png"],qualities:["default"]}},B.none={none:{supports:[],formats:[],qualities:[]}};const U={};function V(t){return t.toLocaleString("en",{maximumFractionDigits:10})}U[j]=function(t){let e=t.getComplianceLevelSupportedFeatures();return void 0===e&&(e=B[j].level0),{url:void 0===t.imageInfo["@id"]?void 0:t.imageInfo["@id"].replace(/\/?(?:info\.json)?$/g,""),supports:e.supports,formats:[...e.formats,void 0===t.imageInfo.formats?[]:t.imageInfo.formats],qualities:[...e.qualities,void 0===t.imageInfo.qualities?[]:t.imageInfo.qualities],resolutions:t.imageInfo.scale_factors,tileSize:void 0!==t.imageInfo.tile_width?void 0!==t.imageInfo.tile_height?[t.imageInfo.tile_width,t.imageInfo.tile_height]:[t.imageInfo.tile_width,t.imageInfo.tile_width]:null!=t.imageInfo.tile_height?[t.imageInfo.tile_height,t.imageInfo.tile_height]:void 0}},U[G]=function(t){const e=t.getComplianceLevelSupportedFeatures(),i=Array.isArray(t.imageInfo.profile)&&t.imageInfo.profile.length>1,n=i&&t.imageInfo.profile[1].supports?t.imageInfo.profile[1].supports:[],r=i&&t.imageInfo.profile[1].formats?t.imageInfo.profile[1].formats:[],s=i&&t.imageInfo.profile[1].qualities?t.imageInfo.profile[1].qualities:[];return{url:t.imageInfo["@id"].replace(/\/?(?:info\.json)?$/g,""),sizes:void 0===t.imageInfo.sizes?void 0:t.imageInfo.sizes.map((function(t){return[t.width,t.height]})),tileSize:void 0===t.imageInfo.tiles?void 0:[t.imageInfo.tiles.map((function(t){return t.width}))[0],t.imageInfo.tiles.map((function(t){return void 0===t.height?t.width:t.height}))[0]],resolutions:void 0===t.imageInfo.tiles?void 0:t.imageInfo.tiles.map((function(t){return t.scaleFactors}))[0],supports:[...e.supports,...n],formats:[...e.formats,...r],qualities:[...e.qualities,...s]}},U[z]=function(t){const e=t.getComplianceLevelSupportedFeatures(),i=void 0===t.imageInfo.extraFormats?e.formats:[...e.formats,...t.imageInfo.extraFormats],n=void 0!==t.imageInfo.preferredFormats&&Array.isArray(t.imageInfo.preferredFormats)&&t.imageInfo.preferredFormats.length>0?t.imageInfo.preferredFormats.filter((function(t){return["jpg","png","gif"].includes(t)})).reduce((function(t,e){return void 0===t&&i.includes(e)?e:t}),void 0):void 0;return{url:t.imageInfo.id,sizes:void 0===t.imageInfo.sizes?void 0:t.imageInfo.sizes.map((function(t){return[t.width,t.height]})),tileSize:void 0===t.imageInfo.tiles?void 0:[t.imageInfo.tiles.map((function(t){return t.width}))[0],t.imageInfo.tiles.map((function(t){return t.height}))[0]],resolutions:void 0===t.imageInfo.tiles?void 0:t.imageInfo.tiles.map((function(t){return t.scaleFactors}))[0],supports:void 0===t.imageInfo.extraFeatures?e.supports:[...e.supports,...t.imageInfo.extraFeatures],formats:i,qualities:void 0===t.imageInfo.extraQualities?e.qualities:[...e.qualities,...t.imageInfo.extraQualities],preferredFormat:n}};class X extends s.A{constructor(t){const e=t||{};let i=e.url||"";i+=i.lastIndexOf("/")===i.length-1||""===i?"":"/";const n=e.version||G,s=e.sizes||[],o=e.size;(0,x.v)(null!=o&&Array.isArray(o)&&2==o.length&&!isNaN(o[0])&&o[0]>0&&!isNaN(o[1])&&o[1]>0,"Missing or invalid `size`");const a=o[0],l=o[1],h=e.tileSize,c=e.tilePixelRatio||1,u=e.format||"jpg",d=e.quality||(e.version==j?"native":"default");let g=e.resolutions||[];const f=e.supports||[],p=e.extent||[0,-l,a,0],m=null!=s&&Array.isArray(s)&&s.length>0,_=void 0!==h&&("number"==typeof h&&Number.isInteger(h)&&h>0||Array.isArray(h)&&h.length>0),v=null!=f&&Array.isArray(f)&&(f.includes("regionByPx")||f.includes("regionByPct"))&&(f.includes("sizeByWh")||f.includes("sizeByH")||f.includes("sizeByW")||f.includes("sizeByPct"));let y,E,A;if(g.sort((function(t,e){return e-t})),_||v)if(null!=h&&("number"==typeof h&&Number.isInteger(h)&&h>0?(y=h,E=h):Array.isArray(h)&&h.length>0&&((1==h.length||null==h[1]&&Number.isInteger(h[0]))&&(y=h[0],E=h[0]),2==h.length&&(Number.isInteger(h[0])&&Number.isInteger(h[1])?(y=h[0],E=h[1]):null==h[0]&&Number.isInteger(h[1])&&(y=h[1],E=h[1])))),void 0!==y&&void 0!==E||(y=P.R,E=P.R),0==g.length){A=Math.max(Math.ceil(Math.log(a/y)/Math.LN2),Math.ceil(Math.log(l/E)/Math.LN2));for(let t=A;t>=0;t--)g.push(Math.pow(2,t))}else{const t=Math.max(...g);A=Math.round(Math.log(t)/Math.LN2)}else if(y=a,E=l,g=[],m){s.sort((function(t,e){return t[0]-e[0]})),A=-1;const t=[];for(let e=0;e0&&g[g.length-1]==i?t.push(e):(g.push(i),A++)}if(t.length>0)for(let e=0;eA)return;const p=t[1],x=t[2],w=g[c];if(!(void 0===p||void 0===x||void 0===w||p<0||Math.ceil(a/w/y)<=p||x<0||Math.ceil(l/w/E)<=x)){if(v||_){const t=p*y*w,e=x*E*w;let i=y*w,r=E*w,s=y,c=E;t+i>a&&(i=a-t),e+r>l&&(r=l-e),t+y*w>a&&(s=Math.floor((a-t+w-1)/w)),e+E*w>l&&(c=Math.floor((l-e+w-1)/w)),0==t&&i==a&&0==e&&r==l?o="full":!v||f.includes("regionByPx")?o=t+","+e+","+i+","+r:f.includes("regionByPct")&&(o="pct:"+V(t/a*100)+","+V(e/l*100)+","+V(i/a*100)+","+V(r/l*100)),n!=z||v&&!f.includes("sizeByWh")?!v||f.includes("sizeByW")?h=s+",":f.includes("sizeByH")?h=","+c:f.includes("sizeByWh")?h=s+","+c:f.includes("sizeByPct")&&(h="pct:"+V(100/w)):h=s+","+c}else if(o="full",m){const t=s[c][0],e=s[c][1];h=n==z?t==a&&e==l?"max":t+","+e:t==a?"full":t+","}else h=n==z?"max":"full";return i+o+"/"+h+"/0/"+d+"."+u}},transition:e.transition}),this.zDirection=e.zDirection}}const Z=X;var W=i(7777),$=i(4289),q=i(966),Y=i(3801),H=i(2973),K=i(2253),J=i(2005),Q=i(554);class tt extends q.Ay{constructor(t,e,i,n,s,o,a){let l=t.getExtent();l&&t.canWrapX()&&(l=l.slice(),l[0]=-1/0,l[2]=1/0);let h=e.getExtent();h&&e.canWrapX()&&(h=h.slice(),h[0]=-1/0,h[2]=1/0);const c=h?(0,r._N)(i,h):i,u=(0,r.q1)(c),d=(0,K.KQ)(t,e,u,n),g=Y.l,f=new H.A(t,e,c,l,d*g,n),p=f.calculateSourceExtent(),m=(0,r.Im)(p)?null:o(p,d,s),_=m?$.A.IDLE:$.A.EMPTY,v=m?m.getPixelRatio():1;super(i,n,v,_),this.targetProj_=e,this.maxSourceExtent_=l,this.triangulation_=f,this.targetResolution_=n,this.targetExtent_=i,this.sourceImage_=m,this.sourcePixelRatio_=v,this.interpolate_=a,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==$.A.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const t=this.sourceImage_.getState();if(t==$.A.LOADED){const t=(0,r.RG)(this.targetExtent_)/this.targetResolution_,e=(0,r.Oq)(this.targetExtent_)/this.targetResolution_;this.canvas_=(0,K.XX)(t,e,this.sourcePixelRatio_,(0,J.m)(this.sourceImage_.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_,!0)}this.state=t,this.changed()}load(){if(this.state==$.A.IDLE){this.state=$.A.LOADING,this.changed();const t=this.sourceImage_.getState();t==$.A.LOADED||t==$.A.ERROR?this.reproject_():(this.sourceListenerKey_=(0,Q.KT)(this.sourceImage_,p.A.CHANGE,(function(t){const e=this.sourceImage_.getState();e!=$.A.LOADED&&e!=$.A.ERROR||(this.unlistenSource_(),this.reproject_())}),this),this.sourceImage_.load())}}unlistenSource_(){(0,Q.JH)(this.sourceListenerKey_),this.sourceListenerKey_=null}}const et=tt;var it=i(2848);const nt=4;var rt=i(4769),st=i(2654);class ot extends W.Ay{constructor(t,e){super(t),this.image=e}}class at extends it.A{constructor(t){super({attributions:t.attributions,projection:t.projection,state:t.state,interpolate:void 0===t.interpolate||t.interpolate}),this.on,this.once,this.un,this.loader=t.loader||null,this.resolutions_=void 0!==t.resolutions?t.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=!!t.loader&&0===t.loader.length,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(t){this.resolutions_=t}findNearestResolution(t){const e=this.getResolutions();return e&&(t=e[(0,st.FT)(e,t,0)]),t}getImage(t,e,i,n){const s=this.getProjection();if(!s||!n||(0,h.equivalent)(s,n))return s&&(n=s),this.getImageInternal(t,e,i,n);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&(0,h.equivalent)(this.reprojectedImage_.getProjection(),n)&&this.reprojectedImage_.getResolution()==e&&(0,r.aI)(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new et(s,n,t,e,i,((t,e,i)=>this.getImageInternal(t,e,i,s)),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,i,n){if(this.loader){const s=ht(t,e,i,1),o=this.findNearestResolution(e);if(this.image&&(this.static_||this.wantedProjection_===n&&(this.wantedExtent_&&(0,r.ms)(this.wantedExtent_,s)||(0,r.ms)(this.image.getExtent(),s))&&(this.wantedResolution_&&(0,J.m)(this.wantedResolution_)===o||(0,J.m)(this.image.getResolution())===o)))return this.image;this.wantedProjection_=n,this.wantedExtent_=s,this.wantedResolution_=o,this.image=new q.Ay(s,o,i,this.loader),this.image.addEventListener(p.A.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let i;switch(e.getState()){case $.A.LOADING:this.loading=!0,i="imageloadstart";break;case $.A.LOADED:this.loading=!1,i="imageloadend";break;case $.A.ERROR:this.loading=!1,i="imageloaderror";break;default:return}this.hasListener(i)&&this.dispatchEvent(new ot(i,e))}}function lt(t,e){t.getImage().src=e}function ht(t,e,i,n){const s=e/i,o=(0,r.q1)(t),a=(0,rt.mk)((0,r.RG)(t)/s,nt),l=(0,rt.mk)((0,r.Oq)(t)/s,nt),h=a+2*(0,rt.mk)((n-1)*a/2,nt),c=l+2*(0,rt.mk)((n-1)*l/2,nt);return(0,r.Bg)(o,s,0,[h,c])}const ct=at;function ut(t,e){const i=[];Object.keys(e).forEach((function(t){null!==e[t]&&void 0!==e[t]&&i.push(t+"="+encodeURIComponent(e[t]))}));const n=i.join("&");return t=t.replace(/[?&]$/,""),(t+=t.includes("?")?"&":"?")+n}function dt(t,e,i,n,s,o){const a=s.getCode().split(/:(?=\d+$)/).pop(),l=i/n,h=[(0,rt.LI)((0,r.RG)(e)/l,nt),(0,rt.LI)((0,r.Oq)(e)/l,nt)];return o.SIZE=h[0]+","+h[1],o.BBOX=e.join(","),o.BBOXSR=a,o.IMAGESR=a,o.DPI=Math.round(o.DPI?o.DPI*n:90*n),ut(t.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage"),o)}function gt(t){const e=t.load?t.load:q.D4,i=(0,h.get)(t.projection||"EPSG:3857");return function(n,s,o){o=t.hidpi?o:1;const a={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};Object.assign(a,t.params),n=ht(n,s,o,t.ratio);const l=dt(t.url,n,s,o,i,a),h=new Image;return null!==t.crossOrigin&&(h.crossOrigin=t.crossOrigin),e(h,l).then((t=>{const e=(0,r.RG)(n)/t.width*o;return{image:t,extent:n,resolution:e,pixelRatio:o}}))}}const ft=class extends ct{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.hidpi_=void 0===t.hidpi||t.hidpi,this.url_=t.url,this.imageLoadFunction_=void 0!==t.imageLoadFunction?t.imageLoadFunction:lt,this.params_=Object.assign({},t.params),this.imageSize_=[0,0],this.renderedRevision_=0,this.ratio_=void 0!==t.ratio?t.ratio:1.5,this.loaderProjection_=null}getParams(){return this.params_}getImageInternal(t,e,i,n){return void 0===this.url_?null:(this.loader&&this.loaderProjection_===n||(this.loaderProjection_=n,this.loader=gt({crossOrigin:this.crossOrigin_,params:this.params_,projection:n,hidpi:this.hidpi_,url:this.url_,ratio:this.ratio_,load:(t,e)=>(this.image.setImage(t),this.imageLoadFunction_(this.image,e),(0,q.D4)(t))})),super.getImageInternal(t,e,i,n))}getImageLoadFunction(){return this.imageLoadFunction_}getUrl(){return this.url_}setImageLoadFunction(t){this.imageLoadFunction_=t,this.changed()}setUrl(t){t!=this.url_&&(this.url_=t,this.loader=null,this.changed())}updateParams(t){Object.assign(this.params_,t),this.changed()}changed(){this.image=null,super.changed()}};var pt=i(5770);const mt=class extends ct{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions,state:t.state}),this.canvasFunction_=t.canvasFunction,this.canvas_=null,this.renderedRevision_=0,this.ratio_=void 0!==t.ratio?t.ratio:1.5}getImageInternal(t,e,i,n){e=this.findNearestResolution(e);let s=this.canvas_;if(s&&this.renderedRevision_==this.getRevision()&&s.getResolution()==e&&s.getPixelRatio()==i&&(0,r.ms)(s.getExtent(),t))return s;t=t.slice(),(0,r.Af)(t,this.ratio_);const o=[(0,r.RG)(t)/e*i,(0,r.Oq)(t)/e*i],a=this.canvasFunction_.call(this,t,e,i,o,n);return a&&(s=new pt.A(t,e,i,a)),this.canvas_=s,this.renderedRevision_=this.getRevision(),s}};function _t(t){const e=t.load||q.D4;return function(i,n,s){const o=new Image;null!==t.crossOrigin&&(o.crossOrigin=t.crossOrigin),i=ht(i,n,s,t.ratio);const a=(0,r.RG)(i)/n,l=(0,r.Oq)(i)/n,h=[a*s,l*s],c=function(t,e,i,n,s,o,a){const l=function(t,e,i,n){const s=(0,r.RG)(t),o=(0,r.Oq)(t),a=e[0],l=e[1],h=.0254/n;return l*s>a*o?s*i/(a*h):o*i/(l*h)}(i,n,o,a),h=(0,r.q1)(i),c={OPERATION:s?"GETDYNAMICMAPOVERLAYIMAGE":"GETMAPIMAGE",VERSION:"2.0.0",LOCALE:"en",CLIENTAGENT:"ol/source/ImageMapGuide source",CLIP:"1",SETDISPLAYDPI:a,SETDISPLAYWIDTH:Math.round(n[0]),SETDISPLAYHEIGHT:Math.round(n[1]),SETVIEWSCALE:l,SETVIEWCENTERX:h[0],SETVIEWCENTERY:h[1]};return Object.assign(c,e),ut(t,c)}(t.url,t.params,i,h,t.useOverlay,t.metersPerUnit||1,t.displayDpi||96);return e(o,c).then((t=>({image:t,extent:i,pixelRatio:s})))}}const vt=class extends ct{constructor(t){super({interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.displayDpi_=void 0!==t.displayDpi?t.displayDpi:96,this.params_=Object.assign({},t.params),this.url_=t.url,this.imageLoadFunction_=void 0!==t.imageLoadFunction?t.imageLoadFunction:lt,this.hidpi_=void 0===t.hidpi||t.hidpi,this.metersPerUnit_=void 0!==t.metersPerUnit?t.metersPerUnit:1,this.ratio_=void 0!==t.ratio?t.ratio:1,this.useOverlay_=void 0!==t.useOverlay&&t.useOverlay,this.renderedRevision_=0,this.loaderProjection_=null}getParams(){return this.params_}getImageInternal(t,e,i,n){return void 0===this.url_?null:(this.loader&&this.loaderProjection_===n||(this.loaderProjection_=n,this.loader=_t({crossOrigin:this.crossOrigin_,params:this.params_,hidpi:this.hidpi_,metersPerUnit:this.metersPerUnit_,url:this.url_,useOverlay:this.useOverlay_,ratio:this.ratio_,load:(t,e)=>(this.image.setImage(t),this.imageLoadFunction_(this.image,e),(0,q.D4)(t))})),super.getImageInternal(t,e,i,n))}getImageLoadFunction(){return this.imageLoadFunction_}updateParams(t){Object.assign(this.params_,t),this.changed()}setImageLoadFunction(t){this.imageLoadFunction_=t,this.changed()}changed(){this.image=null,super.changed()}};function yt(t){const e=t.load||q.D4,i=t.imageExtent,n=new Image;return null!==t.crossOrigin&&(n.crossOrigin=t.crossOrigin),()=>e(n,t.url).then((t=>{const e=(0,r.RG)(i)/t.width,n=(0,r.Oq)(i)/t.height;return{image:t,extent:i,resolution:e!==n?[e,n]:n,pixelRatio:1}}))}const xt=class extends ct{constructor(t){const e=void 0!==t.crossOrigin?t.crossOrigin:null,i=void 0!==t.imageLoadFunction?t.imageLoadFunction:lt;super({attributions:t.attributions,interpolate:t.interpolate,projection:(0,h.get)(t.projection)}),this.url_=t.url,this.imageExtent_=t.imageExtent,this.image=null,this.image=new q.Ay(this.imageExtent_,void 0,1,yt({url:t.url,imageExtent:t.imageExtent,crossOrigin:e,load:(t,e)=>(this.image.setImage(t),i(this.image,e),(0,q.D4)(t))})),this.image.addEventListener(p.A.CHANGE,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(t,e,i,n){return(0,r.HY)(t,this.image.getExtent())?this.image:null}getUrl(){return this.url_}};var Et=i(7170);const At="1.3.0",wt=[101,101];function bt(t,e,i,n,r){r.WIDTH=i[0],r.HEIGHT=i[1];const s=n.getAxisOrientation();let o;const a=(0,Et.Z)(r.VERSION,"1.3")>=0;return r[a?"CRS":"SRS"]=n.getCode(),o=a&&"ne"==s.substr(0,2)?[e[1],e[0],e[3],e[2]]:e,r.BBOX=o.join(","),ut(t,r)}function Tt(t,e,i,n,s,o,a){o=Object.assign({REQUEST:"GetMap"},o);const l=e/i,h=[(0,rt.LI)((0,r.RG)(t)/l,nt),(0,rt.LI)((0,r.Oq)(t)/l,nt)];if(1!=i)switch(a){case"geoserver":const t=90*i+.5|0;"FORMAT_OPTIONS"in o?o.FORMAT_OPTIONS+=";dpi:"+t:o.FORMAT_OPTIONS="dpi:"+t;break;case"mapserver":o.MAP_RESOLUTION=90*i;break;case"carmentaserver":case"qgis":o.DPI=90*i;break;default:throw new Error("Unknown `serverType` configured")}return bt(s,t,h,n,o)}function Ct(t,e){return Object.assign({REQUEST:e,SERVICE:"WMS",VERSION:At,FORMAT:"image/png",STYLES:"",TRANSPARENT:!0},t)}function St(t){const e=void 0===t.hidpi||t.hidpi,i=(0,h.get)(t.projection||"EPSG:3857"),n=t.ratio||1.5,r=t.load||q.D4;return(s,o,a)=>{s=ht(s,o,a,n),1==a||e&&void 0!==t.serverType||(a=1);const l=Tt(s,o,a,i,t.url,Ct(t.params,"GetMap"),t.serverType),h=new Image;return null!==t.crossOrigin&&(h.crossOrigin=t.crossOrigin),r(h,l).then((t=>({image:t,extent:s,pixelRatio:a})))}}const Rt=class extends ct{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.url_=t.url,this.imageLoadFunction_=void 0!==t.imageLoadFunction?t.imageLoadFunction:lt,this.params_=Object.assign({},t.params),this.serverType_=t.serverType,this.hidpi_=void 0===t.hidpi||t.hidpi,this.renderedRevision_=0,this.ratio_=void 0!==t.ratio?t.ratio:1.5,this.loaderProjection_=null}getFeatureInfoUrl(t,e,i,n){const s=(0,h.get)(i),o=this.getProjection();return o&&o!==s&&(e=(0,K.KQ)(o,s,t,e),t=(0,h.transform)(t,s,o)),function(t,e,i){if(void 0===t.url)return;const n=(0,h.get)(t.projection||"EPSG:3857"),s=(0,r.Bg)(e,i,0,wt),o={QUERY_LAYERS:t.params.LAYERS,INFO_FORMAT:"application/json"};Object.assign(o,Ct(t.params,"GetFeatureInfo"),t.params);const a=(0,rt.RI)((e[0]-s[0])/i,nt),l=(0,rt.RI)((s[3]-e[1])/i,nt),c=(0,Et.Z)(o.VERSION,"1.3")>=0;return o[c?"I":"X"]=a,o[c?"J":"Y"]=l,bt(t.url,s,wt,n,o)}({url:this.url_,params:{...this.params_,...n},projection:o||s},t,e)}getLegendUrl(t,e){return function(t,e){if(void 0===t.url)return;const i={SERVICE:"WMS",VERSION:At,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===t.params||void 0===t.params.LAYER){const e=t.params.LAYERS;if(Array.isArray(e)&&1!==e.length)return;i.LAYER=e}if(void 0!==e){const n=(0,h.get)(t.projection||"EPSG:3857").getMetersPerUnit()||1,r=28e-5;i.SCALE=e*n/r}return Object.assign(i,t.params),ut(t.url,i)}({url:this.url_,params:{...this.params_,...e}},t)}getParams(){return this.params_}getImageInternal(t,e,i,n){return void 0===this.url_?null:(this.loader&&this.loaderProjection_===n||(this.loaderProjection_=n,this.loader=St({crossOrigin:this.crossOrigin_,params:this.params_,projection:n,serverType:this.serverType_,hidpi:this.hidpi_,url:this.url_,ratio:this.ratio_,load:(t,e)=>(this.image.setImage(t),this.imageLoadFunction_(this.image,e),(0,q.D4)(t))})),super.getImageInternal(t,e,i,n))}getImageLoadFunction(){return this.imageLoadFunction_}getUrl(){return this.url_}setImageLoadFunction(t){this.imageLoadFunction_=t,this.changed()}setUrl(t){t!=this.url_&&(this.url_=t,this.loader=null,this.changed())}updateParams(t){Object.assign(this.params_,t),this.changed()}changed(){this.image=null,super.changed()}};function It(t,e,i,n){const r=document.createElement("script"),s="olc_"+(0,E.v6)(e);function o(){delete window[s],r.parentNode.removeChild(r)}r.async=!0,r.src=t+(t.includes("?")?"&":"?")+(n||"callback")+"="+s;const a=setTimeout((function(){o(),i&&i()}),1e4);window[s]=function(t){clearTimeout(a),o(),e(t)},document.head.appendChild(r)}class Pt extends Error{constructor(t){super("Unexpected response status: "+t.status),this.name="ResponseError",this.response=t}}class Lt extends Error{constructor(t){super("Failed to issue request"),this.name="ClientError",this.client=t}}function Mt(t){return new Promise((function(e,i){const n=new XMLHttpRequest;n.addEventListener("load",(function(t){const n=t.target;if(!n.status||n.status>=200&&n.status<300){let t;try{t=JSON.parse(n.responseText)}catch(t){const e="Error parsing response text as JSON: "+t.message;return void i(new Error(e))}e(t)}else i(new Pt(n))})),n.addEventListener("error",(function(t){i(new Lt(t.target))})),n.open("GET",t),n.setRequestHeader("Accept","application/json"),n.send()}))}function Ot(t,e){return e.includes("://")?e:new URL(e,t).href}var Dt=i(2602);const Ft={"image/png":!0,"image/jpeg":!0,"image/gif":!0,"image/webp":!0},kt={"application/vnd.mapbox-vector-tile":!0,"application/geo+json":!0};function Nt(t,e){if(!e.length)return t;const i=new URL(t,"file:/");if(i.pathname.split("/").includes("collections"))return(0,Dt.z3)('The "collections" query parameter cannot be added to collection endpoints'),t;const n=e.map((t=>encodeURIComponent(t))).join(",");return i.searchParams.append("collections",n),`${t.split("?")[0]}?${decodeURIComponent(i.searchParams.toString())}`}function jt(t,e,i,n){let s=t.projection;if(!s&&(s=(0,h.get)(e.crs),!s))throw new Error(`Unsupported CRS: ${e.crs}`);const o=e.orderedAxes,a="en"!==(o?o.slice(0,2).map((t=>t.replace(/E|X|Lon/i,"e").replace(/N|Y|Lat/i,"n"))).join(""):s.getAxisOrientation().substr(0,2)),l=e.tileMatrices,c={};for(let t=0;tt.maxTileCol||l.tileRowt.maxTileRow)return}Object.assign(l,x);const h=i.replace(/\{(\w+?)\}/g,(function(t,e){return l[e]}));return Ot(E,h)}}}function Gt(t){return Mt(t.url).then((function(e){return function(t,e){const i=e.tileMatrixSetLimits;let n;if("map"===e.dataType)n=function(t,e,i){let n,r;for(let i=0;i"http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme"===t.rel));if(!r)throw new Error("Expected http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme link or tileMatrixSet");const s=r.href;return Mt(Ot(t.url,s)).then((function(e){return jt(t,e,n,i)}))}(t,e)}))}class zt extends s.A{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition}),Gt({url:t.url,projection:this.getProjection(),mediaType:t.mediaType,context:t.context||null,collections:t.collections}).then(this.handleTileSetInfo_.bind(this)).catch(this.handleError_.bind(this))}handleTileSetInfo_(t){this.tileGrid=t.grid,this.setTileUrlFunction(t.urlFunction,t.urlTemplate),this.setState("ready")}handleError_(t){(0,Dt.z3)(t),this.setState("error")}}const Bt=zt;var Ut=i(2618);class Vt extends Ut.default{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,format:t.format,overlaps:t.overlaps,projection:t.projection,tileClass:t.tileClass,transition:t.transition,wrapX:t.wrapX,zDirection:t.zDirection,state:"loading"}),Gt({url:t.url,projection:this.getProjection(),mediaType:t.mediaType,supportedMediaTypes:t.format.supportedMediaTypes,context:t.context||null,collections:t.collections}).then(this.handleTileSetInfo_.bind(this)).catch(this.handleError_.bind(this))}handleTileSetInfo_(t){this.tileGrid=t.grid,this.setTileUrlFunction(t.urlFunction,t.urlTemplate),this.setState("ready")}handleError_(t){(0,Dt.z3)(t),this.setState("error")}}const Xt=Vt,Zt='© OpenStreetMap contributors.';class Wt extends d.default{constructor(t){let e;e=void 0!==(t=t||{}).attributions?t.attributions:[Zt];const i=void 0!==t.crossOrigin?t.crossOrigin:"anonymous",n=void 0!==t.url?t.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:e,attributionsCollapsible:!1,cacheSize:t.cacheSize,crossOrigin:i,interpolate:t.interpolate,maxZoom:void 0!==t.maxZoom?t.maxZoom:19,opaque:void 0===t.opaque||t.opaque,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:t.tileLoadFunction,transition:t.transition,url:n,wrapX:t.wrapX,zDirection:t.zDirection})}}const $t=Wt;var qt=i(1581),Yt=i(1266),Ht=i(9621),Kt=i(3171),Jt=i(7221),Qt=i(7659);let te,ee=!0;try{new ImageData(10,10)}catch(t){ee=!1}function ie(t){let e=!0;try{new ImageData(10,10)}catch(t){e=!1}function i(t,i,n){return e?new ImageData(t,i,n):{data:t,width:i,height:n}}return function(e){const n=e.buffers,r=e.meta,s=e.imageOps,o=e.width,a=e.height,l=n.length,h=n[0].byteLength;if(s){const e=new Array(l);for(let t=0;tthis._maxQueueLength;)this._queue.shift().callback(null,null)}_dispatch(){if(this._running||0===this._queue.length)return;const t=this._queue.shift();this._job=t;const e=t.inputs[0].width,i=t.inputs[0].height,n=t.inputs.map((function(t){return t.data.buffer})),r=this._workers.length;if(this._running=r,1===r)return void this._workers[0].postMessage({buffers:n,meta:t.meta,imageOps:this._imageOps,width:e,height:i},n);const s=t.inputs[0].data.length,o=4*Math.ceil(s/4/r);for(let s=0;sStadia Maps','© OpenMapTiles',Zt];t.layer.startsWith("stamen_")&&l.splice(1,0,'© Stamen Design'),super({attributions:l,cacheSize:t.cacheSize,crossOrigin:"anonymous",interpolate:t.interpolate,maxZoom:void 0!==t.maxZoom?t.maxZoom:n.maxZoom,minZoom:void 0!==t.minZoom?t.minZoom:n.minZoom,opaque:r.opaque,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:t.tileLoadFunction,transition:t.transition,url:a,tilePixelRatio:o?2:1,wrapX:t.wrapX,zDirection:t.zDirection})}}const fe=ge;class pe extends s.A{constructor(t){super({attributions:(t=t||{}).attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.params_=Object.assign({},t.params),this.hidpi_=void 0===t.hidpi||t.hidpi,this.tmpExtent_=(0,r.S5)(),this.setKey(this.getKeyForParams_())}getKeyForParams_(){let t=0;const e=[];for(const i in this.params_)e[t++]=i+"-"+this.params_[i];return e.join("/")}getParams(){return this.params_}getRequestUrl_(t,e,i,n,r,s){const o=this.urls;if(!o)return;let l;return l=1==o.length?o[0]:o[(0,rt.xP)((0,a.tW)(t),o.length)],dt(l,i,(this.tileGrid||this.getTileGridForProjection(r)).getResolution(t[0]),n,r,s)}getTilePixelRatio(t){return this.hidpi_?t:1}updateParams(t){Object.assign(this.params_,t),this.setKey(this.getKeyForParams_())}tileUrlFunction(t,e,i){let n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(i)),n.getResolutions().length<=t[0])return;1==e||this.hidpi_||(e=1);const r=n.getTileCoordExtent(t,this.tmpExtent_);let s=(0,D.xq)(n.getTileSize(t[0]),this.tmpSize);1!=e&&(s=(0,D.hs)(s,e,this.tmpSize));const o={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};return Object.assign(o,this.params_),this.getRequestUrl_(t,s,r,e,i,o)}}const me=pe;class _e extends d.default{constructor(t){super({opaque:!1,projection:(t=t||{}).projection,tileGrid:t.tileGrid,wrapX:void 0===t.wrapX||t.wrapX,zDirection:t.zDirection,url:t.template||"z:{z} x:{x} y:{y}",tileLoadFunction:(t,e)=>{const i=t.getTileCoord()[0],n=(0,D.xq)(this.tileGrid.getTileSize(i)),r=(0,O.Y)(n[0],n[1]);r.strokeStyle="grey",r.strokeRect(.5,.5,n[0]+.5,n[1]+.5),r.fillStyle="grey",r.strokeStyle="white",r.textAlign="center",r.textBaseline="middle",r.font="24px sans-serif",r.lineWidth=4,r.strokeText(e,n[0]/2,n[1]/2,n[0]),r.fillText(e,n[0]/2,n[1]/2,n[0]),t.setImage(r.canvas)}})}}const ve=_e;class ye extends s.A{constructor(t){if(super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:(0,h.get)("EPSG:3857"),reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.tileJSON_=null,this.tileSize_=t.tileSize,t.url)if(t.jsonp)It(t.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const e=new XMLHttpRequest;e.addEventListener("load",this.onXHRLoad_.bind(this)),e.addEventListener("error",this.onXHRError_.bind(this)),e.open("GET",t.url),e.send()}else{if(!t.tileJSON)throw new Error("Either `url` or `tileJSON` options must be provided");this.handleTileJSONResponse(t.tileJSON)}}onXHRLoad_(t){const e=t.target;if(!e.status||e.status>=200&&e.status<300){let t;try{t=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(t)}else this.handleTileJSONError()}onXHRError_(t){this.handleTileJSONError()}getTileJSON(){return this.tileJSON_}handleTileJSONResponse(t){const e=(0,h.get)("EPSG:4326"),i=this.getProjection();let n;if(void 0!==t.bounds){const s=(0,h.getTransformFromProjections)(e,i);n=(0,r.NW)(t.bounds,s)}const s=(0,l.extentFromProjection)(i),a=t.minzoom||0,c=t.maxzoom||22,u=(0,l.createXYZ)({extent:s,maxZoom:c,minZoom:a,tileSize:this.tileSize_});if(this.tileGrid=u,this.tileUrlFunction=(0,o.Qz)(t.tiles,u),t.attribution&&!this.getAttributions()){const e=void 0!==n?n:s;this.setAttributions((function(i){return(0,r.HY)(e,i.extent)?[t.attribution]:null}))}this.tileJSON_=t,this.setState("ready")}handleTileJSONError(){this.setState("error")}}const xe=ye;class Ee extends s.A{constructor(t){t=t||{};const e=Object.assign({},t.params),i=!("TRANSPARENT"in e)||e.TRANSPARENT;super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,opaque:!i,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.gutter_=void 0!==t.gutter?t.gutter:0,this.params_=e,this.v13_=!0,this.serverType_=t.serverType,this.hidpi_=void 0===t.hidpi||t.hidpi,this.tmpExtent_=(0,r.S5)(),this.updateV13_(),this.setKey(this.getKeyForParams_())}getFeatureInfoUrl(t,e,i,n){const s=(0,h.get)(i),o=this.getProjection()||s;let a=this.getTileGrid();a||(a=this.getTileGridForProjection(o));const l=(0,h.transform)(t,s,o),c=(0,K.KQ)(o,s,t,e),u=a.getZForResolution(c,this.zDirection),d=a.getResolution(u),g=a.getTileCoordForCoordAndZ(l,u);if(a.getResolutions().length<=g[0])return;let f=a.getTileCoordExtent(g,this.tmpExtent_);const p=this.gutter_;0!==p&&(f=(0,r.r)(f,d*p,f));const m={QUERY_LAYERS:this.params_.LAYERS};Object.assign(m,Ct(this.params_,"GetFeatureInfo"),n);const _=Math.floor((l[0]-f[0])/d),v=Math.floor((f[3]-l[1])/d);return m[this.v13_?"I":"X"]=_,m[this.v13_?"J":"Y"]=v,this.getRequestUrl_(g,f,1,o||s,m)}getLegendUrl(t,e){if(void 0===this.urls[0])return;const i={SERVICE:"WMS",VERSION:At,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){const t=this.params_.LAYERS;if(Array.isArray(t)&&1!==t.length)return;i.LAYER=t}if(void 0!==t){const e=this.getProjection()?this.getProjection().getMetersPerUnit():1,n=28e-5;i.SCALE=t*e/n}return Object.assign(i,e),ut(this.urls[0],i)}getGutter(){return this.gutter_}getParams(){return this.params_}getRequestUrl_(t,e,i,n,r){const s=this.urls;if(!s)return;let o;return o=1==s.length?s[0]:s[(0,rt.xP)((0,a.tW)(t),s.length)],Tt(e,(this.tileGrid||this.getTileGridForProjection(n)).getResolution(t[0]),i,n,o,r,this.serverType_)}getTilePixelRatio(t){return this.hidpi_&&void 0!==this.serverType_?t:1}getKeyForParams_(){let t=0;const e=[];for(const i in this.params_)e[t++]=i+"-"+this.params_[i];return e.join("/")}updateParams(t){Object.assign(this.params_,t),this.updateV13_(),this.setKey(this.getKeyForParams_())}updateV13_(){const t=this.params_.VERSION||At;this.v13_=(0,Et.Z)(t,"1.3")>=0}tileUrlFunction(t,e,i){let n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(i)),n.getResolutions().length<=t[0])return;1==e||this.hidpi_&&void 0!==this.serverType_||(e=1);const s=n.getResolution(t[0]);let o=n.getTileCoordExtent(t,this.tmpExtent_);const a=this.gutter_;0!==a&&(o=(0,r.r)(o,s*a,o));const l=Object.assign({},Ct(this.params_,"GetMap"));return this.getRequestUrl_(t,o,e,i,l)}}const Ae=Ee;var we=i(8912),be=i(5291);class Te extends be.A{constructor(t,e,i,n,r,s){super(t,e),this.src_=i,this.extent_=n,this.preemptive_=r,this.grid_=null,this.keys_=null,this.data_=null,this.jsonp_=s}getImage(){return null}getData(t){if(!this.grid_||!this.keys_)return null;const e=(t[0]-this.extent_[0])/(this.extent_[2]-this.extent_[0]),i=(t[1]-this.extent_[1])/(this.extent_[3]-this.extent_[1]),n=this.grid_[Math.floor((1-i)*this.grid_.length)];if("string"!=typeof n)return null;let r=n.charCodeAt(Math.floor(e*n.length));r>=93&&r--,r>=35&&r--,r-=32;let s=null;if(r in this.keys_){const t=this.keys_[r];s=this.data_&&t in this.data_?this.data_[t]:t}return s}forDataAtCoordinate(t,e,i){this.state==M.A.EMPTY&&!0===i?(this.state=M.A.IDLE,(0,Q.Jz)(this,p.A.CHANGE,(function(i){e(this.getData(t))}),this),this.loadInternal_()):!0===i?setTimeout((()=>{e(this.getData(t))}),0):e(this.getData(t))}getKey(){return this.src_}handleError_(){this.state=M.A.ERROR,this.changed()}handleLoad_(t){this.grid_=t.grid,this.keys_=t.keys,this.data_=t.data,this.state=M.A.LOADED,this.changed()}loadInternal_(){if(this.state==M.A.IDLE)if(this.state=M.A.LOADING,this.jsonp_)It(this.src_,this.handleLoad_.bind(this),this.handleError_.bind(this));else{const t=new XMLHttpRequest;t.addEventListener("load",this.onXHRLoad_.bind(this)),t.addEventListener("error",this.onXHRError_.bind(this)),t.open("GET",this.src_),t.send()}}onXHRLoad_(t){const e=t.target;if(!e.status||e.status>=200&&e.status<300){let t;try{t=JSON.parse(e.responseText)}catch(t){return void this.handleError_()}this.handleLoad_(t)}else this.handleError_()}onXHRError_(t){this.handleError_()}load(){this.preemptive_?this.loadInternal_():this.setState(M.A.EMPTY)}}class Ce extends Jt.A{constructor(t){if(super({projection:(0,h.get)("EPSG:3857"),state:"loading",wrapX:void 0===t.wrapX||t.wrapX,zDirection:t.zDirection}),this.preemptive_=void 0===t.preemptive||t.preemptive,this.tileUrlFunction_=o.lg,this.template_=void 0,this.jsonp_=t.jsonp||!1,t.url)if(this.jsonp_)It(t.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const e=new XMLHttpRequest;e.addEventListener("load",this.onXHRLoad_.bind(this)),e.addEventListener("error",this.onXHRError_.bind(this)),e.open("GET",t.url),e.send()}else{if(!t.tileJSON)throw new Error("Either `url` or `tileJSON` options must be provided");this.handleTileJSONResponse(t.tileJSON)}}onXHRLoad_(t){const e=t.target;if(!e.status||e.status>=200&&e.status<300){let t;try{t=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(t)}else this.handleTileJSONError()}onXHRError_(t){this.handleTileJSONError()}getTemplate(){return this.template_}forDataAtCoordinateAndResolution(t,e,i,n){if(this.tileGrid){const r=this.tileGrid.getZForResolution(e,this.zDirection),s=this.tileGrid.getTileCoordForCoordAndZ(t,r);this.getTile(s[0],s[1],s[2],1,this.getProjection()).forDataAtCoordinate(t,i,n)}else!0===n?setTimeout((function(){i(null)}),0):i(null)}handleTileJSONError(){this.setState("error")}handleTileJSONResponse(t){const e=(0,h.get)("EPSG:4326"),i=this.getProjection();let n;if(void 0!==t.bounds){const s=(0,h.getTransformFromProjections)(e,i);n=(0,r.NW)(t.bounds,s)}const s=(0,l.extentFromProjection)(i),a=t.minzoom||0,c=t.maxzoom||22,u=(0,l.createXYZ)({extent:s,maxZoom:c,minZoom:a});this.tileGrid=u,this.template_=t.template;const d=t.grids;if(d){if(this.tileUrlFunction_=(0,o.Qz)(d,u),t.attribution){const e=void 0!==n?n:s;this.setAttributions((function(i){return(0,r.HY)(e,i.extent)?[t.attribution]:null}))}this.setState("ready")}else this.setState("error")}getTile(t,e,i,n,r){const s=(0,a.dp)(t,e,i);if(this.tileCache.containsKey(s))return this.tileCache.get(s);const o=[t,e,i],l=this.getTileCoordForTileUrlFunction(o,r),h=this.tileUrlFunction_(l,n,r),c=new Te(o,void 0!==h?M.A.IDLE:M.A.EMPTY,void 0!==h?h:"",this.tileGrid.getTileCoordExtent(o),this.preemptive_,this.jsonp_);return this.tileCache.set(s,c),c}useTile(t,e,i){const n=(0,a.dp)(t,e,i);this.tileCache.containsKey(n)&&this.tileCache.get(n)}}const Se=Ce;class Re extends s.A{constructor(t){const e=void 0!==t.requestEncoding?t.requestEncoding:"KVP",i=t.tileGrid;let n=t.urls;void 0===n&&void 0!==t.url&&(n=(0,o.Uu)(t.url)),super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,urls:n,wrapX:void 0!==t.wrapX&&t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.version_=void 0!==t.version?t.version:"1.0.0",this.format_=void 0!==t.format?t.format:"image/jpeg",this.dimensions_=void 0!==t.dimensions?t.dimensions:{},this.layer_=t.layer,this.matrixSet_=t.matrixSet,this.style_=t.style,this.requestEncoding_=e,this.setKey(this.getKeyForDimensions_()),n&&n.length>0&&(this.tileUrlFunction=(0,o.FD)(n.map(this.createFromWMTSTemplate.bind(this))))}setUrls(t){this.urls=t;const e=t.join("\n");this.setTileUrlFunction((0,o.FD)(t.map(this.createFromWMTSTemplate.bind(this))),e)}getDimensions(){return this.dimensions_}getFormat(){return this.format_}getLayer(){return this.layer_}getMatrixSet(){return this.matrixSet_}getRequestEncoding(){return this.requestEncoding_}getStyle(){return this.style_}getVersion(){return this.version_}getKeyForDimensions_(){const t=this.urls?this.urls.slice(0):[];for(const e in this.dimensions_)t.push(e+"-"+this.dimensions_[e]);return t.join("/")}updateDimensions(t){Object.assign(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())}createFromWMTSTemplate(t){const e=this.requestEncoding_,i={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};"KVP"==e&&Object.assign(i,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t="KVP"==e?ut(t,i):t.replace(/\{(\w+?)\}/g,(function(t,e){return e.toLowerCase()in i?i[e.toLowerCase()]:t}));const n=this.tileGrid,r=this.dimensions_;return function(i,s,o){if(!i)return;const a={TileMatrix:n.getMatrixId(i[0]),TileCol:i[1],TileRow:i[2]};Object.assign(a,r);let l=t;return l="KVP"==e?ut(l,a):l.replace(/\{(\w+?)\}/g,(function(t,e){return a[e]})),l}}}const Ie=Re;function Pe(t,e){const i=new n.A(32),s=t.getExtent();return function(n,o){i.expireCache(),s&&(n=(0,r._N)(s,n));const a=t.getZForResolution(o),l=[];return t.forEachTileCoord(n,a,(t=>{const n=t.toString();if(!i.containsKey(n)){const r=e(t);i.set(n,r)}l.push(i.get(n))})),l}}},1733:(t,e,i)=>{"use strict";i.d(e,{A:()=>_});var n=i(2771),r=i(8417),s=i(8928),o=i(2473),a=i(5209),l=i(7221),h=i(8066),c=i(1990),u=i(6409),d=i(4614),g=i(9891),f=i(2138),p=i(8538);class m extends l.A{constructor(t){const e=void 0===t.projection?"EPSG:3857":t.projection;let i=t.tileGrid;void 0===i&&e&&(i=(0,c.createXYZ)({extent:(0,c.extentFromProjection)(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize})),super({cacheSize:.1,attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:e,tileGrid:i,opaque:t.opaque,state:t.state,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate}),this.gutter_=void 0!==t.gutter?t.gutter:0,this.tileSize_=t.tileSize?(0,p.xq)(t.tileSize):null,this.tileSizes_=null,this.tileLoadingKeys_={},this.loader_=t.loader,this.handleTileChange_=this.handleTileChange_.bind(this),this.bandCount=void 0===t.bandCount?4:t.bandCount,this.tileGridForProjection_={},this.tileCacheForProjection_={}}setTileSizes(t){this.tileSizes_=t}getTileSize(t){if(this.tileSizes_)return this.tileSizes_[t];if(this.tileSize_)return this.tileSize_;const e=this.getTileGrid();return e?(0,p.xq)(e.getTileSize(t)):[256,256]}getGutterForProjection(t){const e=this.getProjection();return!e||(0,u.equivalent)(e,t)?this.gutter_:0}setLoader(t){this.loader_=t}getReprojTile_(t,e,i,n,r){const o=this.getTileCacheForProjection(n),a=(0,d.dp)(t,e,i);if(o.containsKey(a)){const t=o.get(a);if(t&&t.key==this.getKey())return t}const l=this.getTileGrid(),h=Math.max.apply(null,l.getResolutions().map(((t,e)=>{const i=(0,p.xq)(l.getTileSize(e)),n=this.getTileSize(e);return Math.max(n[0]/i[0],n[1]/i[1])}))),c=this.getTileGridForProjection(r),u=this.getTileGridForProjection(n),g=[t,e,i],f=this.getTileCoordForTileUrlFunction(g,n),m=Object.assign({sourceProj:r,sourceTileGrid:c,targetProj:n,targetTileGrid:u,tileCoord:g,wrappedTileCoord:f,pixelRatio:h,gutter:this.getGutterForProjection(r),getTileFunction:(t,e,i,n)=>this.getTile(t,e,i,n,r)},this.tileOptions),_=new s.A(m);return _.key=this.getKey(),_}getTile(t,e,i,s,o){const a=this.getProjection();if(a&&o&&!(0,u.equivalent)(a,o))return this.getReprojTile_(t,e,i,o,a);const l=this.getTileSize(t),h=(0,d.dp)(t,e,i);if(this.tileCache.containsKey(h))return this.tileCache.get(h);const c=this.loader_,g=Object.assign({tileCoord:[t,e,i],loader:function(){return(0,f.hq)((function(){return c(t,e,i)}))},size:l},this.tileOptions),p=new n.Ay(g);return p.key=this.getKey(),p.addEventListener(r.A.CHANGE,this.handleTileChange_),this.tileCache.set(h,p),p}handleTileChange_(t){const e=t.target,i=(0,g.v6)(e),n=e.getState();let r;n==h.A.LOADING?(this.tileLoadingKeys_[i]=!0,r=a.A.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=n==h.A.ERROR?a.A.TILELOADERROR:n==h.A.LOADED?a.A.TILELOADEND:void 0),r&&this.dispatchEvent(new l.c(r,e))}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||(0,u.equivalent)(e,t)))return this.tileGrid;const i=(0,g.v6)(t);return i in this.tileGridForProjection_||(this.tileGridForProjection_[i]=(0,c.getForProjection)(t)),this.tileGridForProjection_[i]}setTileGridForProjection(t,e){const i=(0,u.get)(t);if(i){const t=(0,g.v6)(i);t in this.tileGridForProjection_||(this.tileGridForProjection_[t]=e)}}getTileCacheForProjection(t){const e=this.getProjection();if(!e||(0,u.equivalent)(e,t))return this.tileCache;const i=(0,g.v6)(t);return i in this.tileCacheForProjection_||(this.tileCacheForProjection_[i]=new o.A(.1)),this.tileCacheForProjection_[i]}expireCache(t,e){const i=this.getTileCacheForProjection(t);this.tileCache.expireCache(this.tileCache==i?e:{});for(const t in this.tileCacheForProjection_){const n=this.tileCacheForProjection_[t];n.expireCache(n==i?e:{})}}clear(){super.clear();for(const t in this.tileCacheForProjection_)this.tileCacheForProjection_[t].clear()}}const _=m},5913:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>Ie});var n=i(1733),r=i(5978),s=i(4946);const o=new Map;function a(t,e){Array.isArray(t)||(t=[t]),t.forEach((t=>o.set(t,e)))}async function l(t){const e=o.get(t.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${t.Compression}`);return new(await e())(t)}a([void 0,1],(()=>i.e(749).then(i.bind(i,6749)).then((t=>t.default)))),a(5,(()=>i.e(64).then(i.bind(i,2064)).then((t=>t.default)))),a(6,(()=>{throw new Error("old style JPEG compression is not supported.")})),a(7,(()=>i.e(709).then(i.bind(i,4709)).then((t=>t.default)))),a([8,32946],(()=>Promise.all([i.e(342),i.e(124)]).then(i.bind(i,2124)).then((t=>t.default)))),a(32773,(()=>i.e(242).then(i.bind(i,5242)).then((t=>t.default)))),a(34887,(()=>Promise.all([i.e(342),i.e(597)]).then(i.bind(i,8597)).then((async t=>(await t.zstd.init(),t))).then((t=>t.default)))),a(50001,(()=>i.e(540).then(i.bind(i,2540)).then((t=>t.default))));const h="undefined"!=typeof navigator&&navigator.hardwareConcurrency||2,c=class{constructor(t=h,e){this.workers=null,this._awaitingDecoder=null,this.size=t,this.messageId=0,t&&(this._awaitingDecoder=e?Promise.resolve(e):new Promise((t=>{i.e(145).then(i.bind(i,145)).then((e=>{t(e.create)}))})),this._awaitingDecoder.then((e=>{this._awaitingDecoder=null,this.workers=[];for(let i=0;ii.decode(t,e))):new Promise((i=>{const n=this.workers.find((t=>t.idle))||this.workers[Math.floor(Math.random()*this.size)];n.idle=!1;const r=this.messageId++,s=t=>{t.data.id===r&&(n.idle=!0,i(t.data.decoded),n.worker.removeEventListener("message",s))};n.worker.addEventListener("message",s),n.worker.postMessage({fileDirectory:t,buffer:e,id:r},[e])}))}destroy(){this.workers&&(this.workers.forEach((t=>{t.worker.terminate()})),this.workers=null)}};function u(t){return(e,...i)=>g(t,e,i)}function d(t,e){return u(_(t,e).get)}const{apply:g,construct:f,defineProperty:p,get:m,getOwnPropertyDescriptor:_,getPrototypeOf:v,has:y,ownKeys:x,set:E,setPrototypeOf:A}=Reflect,{EPSILON:w,MAX_SAFE_INTEGER:b,isFinite:T,isNaN:C}=Number,{iterator:S,species:R,toStringTag:I,for:P}=Symbol,L=Object,{create:M,defineProperty:O,freeze:D,is:F}=L,k=L.prototype,N=(k.__lookupGetter__&&u(k.__lookupGetter__),L.hasOwn||u(k.hasOwnProperty),Array),j=(N.isArray,N.prototype),G=(u(j.join),u(j.push),u(j.toLocaleString),j[S]),z=u(G),{abs:B,trunc:U}=Math,V=ArrayBuffer,X=(V.isView,V.prototype),Z=(u(X.slice),d(X,"byteLength"),"undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:null),W=(Z&&d(Z.prototype,"byteLength"),v(Uint8Array)),$=(W.from,W.prototype),q=($[S],u($.keys),u($.values),u($.entries),u($.set),u($.reverse),u($.fill),u($.copyWithin),u($.sort),u($.slice),u($.subarray),d($,"buffer"),d($,"byteOffset"),d($,"length"),d($,I),Uint8Array),Y=Uint16Array,H=Uint32Array,K=Float32Array,J=v([][S]()),Q=u(J.next),tt=u(function*(){}().next),et=v(J),it=DataView.prototype,nt=u(it.getUint16),rt=(u(it.setUint16),TypeError,WeakSet.prototype),st=(u(rt.add),u(rt.has),WeakMap),ot=st.prototype,at=u(ot.get),lt=(u(ot.has),u(ot.set)),ht=new st,ct=M(null,{next:{value:function(){const t=at(ht,this);return Q(t)}},[S]:{value:function(){return this}}}),ut=new st,dt=M(et,{next:{value:function(){const t=at(ut,this);return tt(t)},writable:!0,configurable:!0}});for(const t of x(J))"next"!==t&&O(dt,t,_(J,t));const gt=new V(4),ft=new K(gt),pt=new H(gt),mt=new Y(512),_t=new q(512);for(let t=0;t<256;++t){const e=t-127;e<-24?(mt[t]=0,mt[256|t]=32768,_t[t]=24,_t[256|t]=24):e<-14?(mt[t]=1024>>-e-14,mt[256|t]=1024>>-e-14|32768,_t[t]=-e-1,_t[256|t]=-e-1):e<=15?(mt[t]=e+15<<10,mt[256|t]=e+15<<10|32768,_t[t]=13,_t[256|t]=13):e<128?(mt[t]=31744,mt[256|t]=64512,_t[t]=24,_t[256|t]=24):(mt[t]=31744,mt[256|t]=64512,_t[t]=13,_t[256|t]=13)}const vt=new H(2048);for(let t=1;t<1024;++t){let e=t<<13,i=0;for(;!(8388608&e);)e<<=1,i-=8388608;e&=-8388609,i+=947912704,vt[t]=e|i}for(let t=1024;t<2048;++t)vt[t]=939524096+(t-1024<<13);const yt=new H(64);for(let t=1;t<31;++t)yt[t]=t<<23;yt[31]=1199570944,yt[32]=2147483648;for(let t=33;t<63;++t)yt[t]=2147483648+(t-32<<23);yt[63]=3347054592;const xt=new Y(64);for(let t=1;t<64;++t)32!==t&&(xt[t]=1024);function Et(t,e,...i){return function(t){const e=t>>10;return pt[0]=vt[xt[e]+(1023&t)]+yt[e],ft[0]}(nt(t,e,...function(t){if(t[S]===G&&J.next===Q)return t;const e=M(ct);return lt(ht,e,z(t)),e}(i)))}var At=i(845),wt=i(2585);function bt(t,e,i,n=1){return new(Object.getPrototypeOf(t).constructor)(e*i*n)}function Tt(t,e,i){return(1-i)*t+i*e}function Ct(t,e,i){let n=0;for(let r=e;r=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${t} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[t]/8)}getReaderForSample(t){const e=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[t]:1,i=this.fileDirectory.BitsPerSample[t];switch(e){case 1:if(i<=8)return DataView.prototype.getUint8;if(i<=16)return DataView.prototype.getUint16;if(i<=32)return DataView.prototype.getUint32;break;case 2:if(i<=8)return DataView.prototype.getInt8;if(i<=16)return DataView.prototype.getInt16;if(i<=32)return DataView.prototype.getInt32;break;case 3:switch(i){case 16:return function(t,e){return Et(this,t,e)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(t=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[t]:1}getBitsPerSample(t=0){return this.fileDirectory.BitsPerSample[t]}getArrayForSample(t,e){return St(this.getSampleFormat(t),this.getBitsPerSample(t),e)}async getTileOrStrip(t,e,i,n,r){const s=Math.ceil(this.getWidth()/this.getTileWidth()),o=Math.ceil(this.getHeight()/this.getTileHeight());let a;const{tiles:l}=this;let h,c;1===this.planarConfiguration?a=e*s+t:2===this.planarConfiguration&&(a=i*s*o+e*s+t),this.isTiled?(h=this.fileDirectory.TileOffsets[a],c=this.fileDirectory.TileByteCounts[a]):(h=this.fileDirectory.StripOffsets[a],c=this.fileDirectory.StripByteCounts[a]);const u=(await this.source.fetch([{offset:h,length:c}],r))[0];let d;return null!==l&&l[a]?d=l[a]:(d=(async()=>{let t=await n.decode(this.fileDirectory,u);const i=this.getSampleFormat(),r=this.getBitsPerSample();return function(t,e){return(1!==t&&2!==t||!(e<=32)||e%8!=0)&&(3!==t||16!==e&&32!==e&&64!==e)}(i,r)&&(t=function(t,e,i,n,r,s,o){const a=new DataView(t),l=2===i?1:n,h=St(e,r,2===i?o*s:o*s*n),c=parseInt("1".repeat(r),2);if(1===e){let t;t=1===i?n*r:r;let e=s*t;7&e&&(e=e+7&-8);for(let t=0;t>8-r-g&c;else if(g+r<=16)h[u]=a.getUint16(d)>>16-r-g&c;else if(g+r<=24){const t=a.getUint16(d)<<8|a.getUint8(d+2);h[u]=t>>24-r-g&c}else h[u]=a.getUint32(d)>>32-r-g&c}}}}return h.buffer}(t,i,this.planarConfiguration,this.getSamplesPerPixel(),r,this.getTileWidth(),this.getBlockHeight(e))),t})(),null!==l&&(l[a]=d)),{x:t,y:e,sample:i,data:await d}}async _readRaster(t,e,i,n,r,s,o,a,l){const h=this.getTileWidth(),c=this.getTileHeight(),u=this.getWidth(),d=this.getHeight(),g=Math.max(Math.floor(t[0]/h),0),f=Math.min(Math.ceil(t[2]/h),Math.ceil(u/h)),p=Math.max(Math.floor(t[1]/c),0),m=Math.min(Math.ceil(t[3]/c),Math.ceil(d/c)),_=t[2]-t[0];let v=this.getBytesPerPixel();const y=[],x=[];for(let t=0;t{const s=r.data,o=new DataView(s),a=this.getBlockHeight(r.y),l=r.y*c,g=r.x*h,p=l+a,m=(r.x+1)*h,E=x[f],w=Math.min(a,a-(p-t[3]),d-l),b=Math.min(h,h-(m-t[2]),u-g);for(let r=Math.max(0,t[1]-l);r{const a=bt(t,n,r);for(let l=0;l{const a=bt(t,n,r);for(let l=0;lc[2]||c[1]>c[3])throw new Error("Invalid subsets");const u=(c[2]-c[0])*(c[3]-c[1]),d=this.getSamplesPerPixel();if(e&&e.length){for(let t=0;t=d)return Promise.reject(new RangeError(`Invalid sample index '${e[t]}'.`))}else for(let t=0;th[2]||h[1]>h[3])throw new Error("Invalid subsets");const c=this.fileDirectory.PhotometricInterpretation;if(c===s.ub.RGB){let h=[0,1,2];if(this.fileDirectory.ExtraSamples!==s.AC.Unspecified&&a){h=[];for(let t=0;t>24)/500+a,h=a-(t[e+2]<<24>>24)/200;l=.95047*(l*l*l>.008856?l*l*l:(l-16/116)/7.787),a=1*(a*a*a>.008856?a*a*a:(a-16/116)/7.787),h=1.08883*(h*h*h>.008856?h*h*h:(h-16/116)/7.787),r=3.2406*l+-1.5372*a+-.4986*h,s=-.9689*l+1.8758*a+.0415*h,o=.0557*l+-.204*a+1.057*h,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,n[i]=255*Math.max(0,Math.min(1,r)),n[i+1]=255*Math.max(0,Math.min(1,s)),n[i+2]=255*Math.max(0,Math.min(1,o))}return n}(f);break;default:throw new Error("Unsupported photometric interpretation.")}if(!e){const t=new Uint8Array(m.length/3),e=new Uint8Array(m.length/3),i=new Uint8Array(m.length/3);for(let n=0,r=0;nvoid 0===At(t,"sample"))):n.filter((e=>Number(At(e,"sample"))===t));for(let t=0;t[s+t*e+n*i,h+o*e+a*i])),u=c.map((t=>t[0])),d=c.map((t=>t[1]));return[Math.min(...u),Math.min(...d),Math.max(...u),Math.max(...d)]}{const t=this.getOrigin(),n=this.getResolution(),r=t[0],s=t[1],o=r+n[0]*i,a=s+n[1]*e;return[Math.min(r,o),Math.min(s,a),Math.max(r,o),Math.max(s,a)]}}};class It{constructor(t){this._dataView=new DataView(t)}get buffer(){return this._dataView.buffer}getUint64(t,e){const i=this.getUint32(t,e),n=this.getUint32(t+4,e);let r;if(e){if(r=i+2**32*n,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}if(r=2**32*i+n,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}getInt64(t,e){let i=0;const n=(128&this._dataView.getUint8(t+(e?7:0)))>0;let r=!0;for(let s=0;s<8;s++){let o=this._dataView.getUint8(t+(e?s:7-s));n&&(r?0!==o&&(o=255&~(o-1),r=!1):o=255&~o),i+=o*256**s}return n&&(i=-i),i}getUint8(t,e){return this._dataView.getUint8(t,e)}getInt8(t,e){return this._dataView.getInt8(t,e)}getUint16(t,e){return this._dataView.getUint16(t,e)}getInt16(t,e){return this._dataView.getInt16(t,e)}getUint32(t,e){return this._dataView.getUint32(t,e)}getInt32(t,e){return this._dataView.getInt32(t,e)}getFloat16(t,e){return Et(this._dataView,t,e)}getFloat32(t,e){return this._dataView.getFloat32(t,e)}getFloat64(t,e){return this._dataView.getFloat64(t,e)}}class Pt{constructor(t,e,i,n){this._dataView=new DataView(t),this._sliceOffset=e,this._littleEndian=i,this._bigTiff=n}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(t,e){return this.sliceOffset<=t&&this.sliceTop>=t+e}readUint8(t){return this._dataView.getUint8(t-this._sliceOffset,this._littleEndian)}readInt8(t){return this._dataView.getInt8(t-this._sliceOffset,this._littleEndian)}readUint16(t){return this._dataView.getUint16(t-this._sliceOffset,this._littleEndian)}readInt16(t){return this._dataView.getInt16(t-this._sliceOffset,this._littleEndian)}readUint32(t){return this._dataView.getUint32(t-this._sliceOffset,this._littleEndian)}readInt32(t){return this._dataView.getInt32(t-this._sliceOffset,this._littleEndian)}readFloat32(t){return this._dataView.getFloat32(t-this._sliceOffset,this._littleEndian)}readFloat64(t){return this._dataView.getFloat64(t-this._sliceOffset,this._littleEndian)}readUint64(t){const e=this.readUint32(t),i=this.readUint32(t+4);let n;if(this._littleEndian){if(n=e+2**32*i,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}if(n=2**32*e+i,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}readInt64(t){let e=0;const i=(128&this._dataView.getUint8(t+(this._littleEndian?7:0)))>0;let n=!0;for(let r=0;r<8;r++){let s=this._dataView.getUint8(t+(this._littleEndian?r:7-r));i&&(n?0!==s&&(s=255&~(s-1),n=!1):s=255&~s),e+=s*256**r}return i&&(e=-e),e}readOffset(t){return this._bigTiff?this.readUint64(t):this.readUint32(t)}}function Lt(t){if(void 0!==Object.fromEntries)return Object.fromEntries(t);const e={};for(const[i,n]of t)e[i.toLowerCase()]=n;return e}function Mt(t){return Lt(t.split("\r\n").map((t=>{const e=t.split(":").map((t=>t.trim()));return e[0]=e[0].toLowerCase(),e})))}function Ot(t){let e,i,n;return t&&([,e,i,n]=t.match(/bytes (\d+)-(\d+)\/(\d+)/),e=parseInt(e,10),i=parseInt(i,10),n=parseInt(n,10)),{start:e,end:i,total:n}}class Dt{async fetch(t,e=void 0){return Promise.all(t.map((t=>this.fetchSlice(t,e))))}async fetchSlice(t){throw new Error(`fetching of slice ${t} not possible, not implemented`)}get fileSize(){return null}async close(){}}class Ft extends Map{constructor(t={}){if(super(),!(t.maxSize&&t.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if("number"==typeof t.maxAge&&0===t.maxAge)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=t.maxSize,this.maxAge=t.maxAge||Number.POSITIVE_INFINITY,this.onEviction=t.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(t){if("function"==typeof this.onEviction)for(const[e,i]of t)this.onEviction(e,i.value)}_deleteIfExpired(t,e){return"number"==typeof e.expiry&&e.expiry<=Date.now()&&("function"==typeof this.onEviction&&this.onEviction(t,e.value),this.delete(t))}_getOrDeleteIfExpired(t,e){if(!1===this._deleteIfExpired(t,e))return e.value}_getItemValue(t,e){return e.expiry?this._getOrDeleteIfExpired(t,e):e.value}_peek(t,e){const i=e.get(t);return this._getItemValue(t,i)}_set(t,e){this.cache.set(t,e),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(t,e){this.oldCache.delete(t),this._set(t,e)}*_entriesAscending(){for(const t of this.oldCache){const[e,i]=t;this.cache.has(e)||!1===this._deleteIfExpired(e,i)&&(yield t)}for(const t of this.cache){const[e,i]=t;!1===this._deleteIfExpired(e,i)&&(yield t)}}get(t){if(this.cache.has(t)){const e=this.cache.get(t);return this._getItemValue(t,e)}if(this.oldCache.has(t)){const e=this.oldCache.get(t);if(!1===this._deleteIfExpired(t,e))return this._moveToRecent(t,e),e.value}}set(t,e,{maxAge:i=this.maxAge}={}){const n="number"==typeof i&&i!==Number.POSITIVE_INFINITY?Date.now()+i:void 0;return this.cache.has(t)?this.cache.set(t,{value:e,expiry:n}):this._set(t,{value:e,expiry:n}),this}has(t){return this.cache.has(t)?!this._deleteIfExpired(t,this.cache.get(t)):!!this.oldCache.has(t)&&!this._deleteIfExpired(t,this.oldCache.get(t))}peek(t){return this.cache.has(t)?this._peek(t,this.cache):this.oldCache.has(t)?this._peek(t,this.oldCache):void 0}delete(t){const e=this.cache.delete(t);return e&&this._size--,this.oldCache.delete(t)||e}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(t){if(!(t&&t>0))throw new TypeError("`maxSize` must be a number greater than 0");const e=[...this._entriesAscending()],i=e.length-t;i<0?(this.cache=new Map(e),this.oldCache=new Map,this._size=e.length):(i>0&&this._emitEvictions(e.slice(0,i)),this.oldCache=new Map(e.slice(i)),this.cache=new Map,this._size=0),this.maxSize=t}*keys(){for(const[t]of this)yield t}*values(){for(const[,t]of this)yield t}*[Symbol.iterator](){for(const t of this.cache){const[e,i]=t;!1===this._deleteIfExpired(e,i)&&(yield[e,i.value])}for(const t of this.oldCache){const[e,i]=t;this.cache.has(e)||!1===this._deleteIfExpired(e,i)&&(yield[e,i.value])}}*entriesDescending(){let t=[...this.cache];for(let e=t.length-1;e>=0;--e){const i=t[e],[n,r]=i;!1===this._deleteIfExpired(n,r)&&(yield[n,r.value])}t=[...this.oldCache];for(let e=t.length-1;e>=0;--e){const i=t[e],[n,r]=i;this.cache.has(n)||!1===this._deleteIfExpired(n,r)&&(yield[n,r.value])}}*entriesAscending(){for(const[t,e]of this._entriesAscending())yield[t,e.value]}get size(){if(!this._size)return this.oldCache.size;let t=0;for(const e of this.oldCache.keys())this.cache.has(e)||t++;return Math.min(this._size+t,this.maxSize)}entries(){return this.entriesAscending()}forEach(t,e=this){for(const[i,n]of this.entriesAscending())t.call(e,n,i,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}class kt extends Error{constructor(t){super(t),Error.captureStackTrace&&Error.captureStackTrace(this,kt),this.name="AbortError"}}class Nt extends Error{constructor(t,e){super(e),this.errors=t,this.message=e,this.name="AggregateError"}}const jt=Nt;class Gt{constructor(t,e,i=null){this.offset=t,this.length=e,this.data=i}get top(){return this.offset+this.length}}class zt{constructor(t,e,i){this.offset=t,this.length=e,this.blockIds=i}}class Bt extends Dt{constructor(t,{blockSize:e=65536,cacheSize:i=100}={}){super(),this.source=t,this.blockSize=e,this.blockCache=new Ft({maxSize:i,onEviction:(t,e)=>{this.evictedBlocks.set(t,e)}}),this.evictedBlocks=new Map,this.blockRequests=new Map,this.blockIdsToFetch=new Set,this.abortedBlockIds=new Set}get fileSize(){return this.source.fileSize}async fetch(t,e){const i=[],n=[],r=[];this.evictedBlocks.clear();for(const{offset:e,length:s}of t){let t=e+s;const{fileSize:o}=this;null!==o&&(t=Math.min(t,o));for(let s=Math.floor(e/this.blockSize)*this.blockSize;ssetTimeout(t,undefined)))}(),this.fetchBlocks(e);const s=[];for(const t of n)this.blockRequests.has(t)&&s.push(this.blockRequests.get(t));await Promise.allSettled(i),await Promise.allSettled(s);const o=[],a=r.filter((t=>this.abortedBlockIds.has(t)||!this.blockCache.has(t)));if(a.forEach((t=>this.blockIdsToFetch.add(t))),a.length>0&&e&&!e.aborted){this.fetchBlocks(null);for(const t of a){const e=this.blockRequests.get(t);if(!e)throw new Error(`Block ${t} is not in the block requests`);o.push(e)}await Promise.allSettled(o)}if(e&&e.aborted)throw new kt("Request was aborted");const l=r.map((t=>this.blockCache.get(t)||this.evictedBlocks.get(t))),h=l.filter((t=>!t));if(h.length)throw new jt(h,"Request failed");const c=new Map(function(t,e){const i=Array.isArray(t)?t:Array.from(t),n=Array.isArray(e)?e:Array.from(e);return i.map(((t,e)=>[t,n[e]]))}(r,l));return this.readSliceData(t,c)}fetchBlocks(t){if(this.blockIdsToFetch.size>0){const e=this.groupBlocks(this.blockIdsToFetch),i=this.source.fetch(e,t);for(let n=0;n{try{const t=(await i)[n],r=e*this.blockSize,s=r-t.offset,o=Math.min(s+this.blockSize,t.data.byteLength),a=t.data.slice(s,o),l=new Gt(r,a.byteLength,a,e);this.blockCache.set(e,l),this.abortedBlockIds.delete(e)}catch(i){if("AbortError"!==i.name)throw i;i.signal=t,this.blockCache.delete(e),this.abortedBlockIds.add(e)}finally{this.blockRequests.delete(e)}})())}this.blockIdsToFetch.clear()}}groupBlocks(t){const e=Array.from(t).sort(((t,e)=>t-e));if(0===e.length)return[];let i=[],n=null;const r=[];for(const t of e)null===n||n+1===t?(i.push(t),n=t):(r.push(new zt(i[0]*this.blockSize,i.length*this.blockSize,i)),i=[t],n=t);return r.push(new zt(i[0]*this.blockSize,i.length*this.blockSize,i)),r}readSliceData(t,e){return t.map((t=>{let i=t.offset+t.length;null!==this.fileSize&&(i=Math.min(this.fileSize,i));const n=Math.floor(t.offset/this.blockSize),r=Math.floor(i/this.blockSize),s=new ArrayBuffer(t.length),o=new Uint8Array(s);for(let s=n;s<=r;++s){const n=e.get(s),r=n.offset-t.offset;let a,l=0,h=0;r<0?l=-r:r>0&&(h=r),a=n.top-i<0?n.length-l:i-n.offset-l;const c=new Uint8Array(n.data,l,a);o.set(c,h)}return s}))}}class Ut{get ok(){return this.status>=200&&this.status<=299}get status(){throw new Error("not implemented")}getHeader(t){throw new Error("not implemented")}async getData(){throw new Error("not implemented")}}class Vt{constructor(t){this.url=t}async request({headers:t,signal:e}={}){throw new Error("request is not implemented")}}class Xt extends Ut{constructor(t){super(),this.response=t}get status(){return this.response.status}getHeader(t){return this.response.headers.get(t)}async getData(){return this.response.arrayBuffer?await this.response.arrayBuffer():(await this.response.buffer()).buffer}}class Zt extends Vt{constructor(t,e){super(t),this.credentials=e}async request({headers:t,signal:e}={}){const i=await fetch(this.url,{headers:t,credentials:this.credentials,signal:e});return new Xt(i)}}class Wt extends Ut{constructor(t,e){super(),this.xhr=t,this.data=e}get status(){return this.xhr.status}getHeader(t){return this.xhr.getResponseHeader(t)}async getData(){return this.data}}class $t extends Vt{constructRequest(t,e){return new Promise(((i,n)=>{const r=new XMLHttpRequest;r.open("GET",this.url),r.responseType="arraybuffer";for(const[e,i]of Object.entries(t))r.setRequestHeader(e,i);r.onload=()=>{const t=r.response;i(new Wt(r,t))},r.onerror=n,r.onabort=()=>n(new kt("Request aborted")),r.send(),e&&(e.aborted&&r.abort(),e.addEventListener("abort",(()=>r.abort())))}))}async request({headers:t,signal:e}={}){return await this.constructRequest(t,e)}}var qt=i(8625),Yt=i(6504),Ht=i(6580);class Kt extends Ut{constructor(t,e){super(),this.response=t,this.dataPromise=e}get status(){return this.response.statusCode}getHeader(t){return this.response.headers[t]}async getData(){return await this.dataPromise}}class Jt extends Vt{constructor(t){super(t),this.parsedUrl=Ht.parse(this.url),this.httpApi="http:"===this.parsedUrl.protocol?qt:Yt}constructRequest(t,e){return new Promise(((i,n)=>{const r=this.httpApi.get({...this.parsedUrl,headers:t},(t=>{const e=new Promise((e=>{const i=[];t.on("data",(t=>{i.push(t)})),t.on("end",(()=>{const t=Buffer.concat(i).buffer;e(t)})),t.on("error",n)}));i(new Kt(t,e))}));r.on("error",n),e&&(e.aborted&&r.destroy(new kt("Request aborted")),e.addEventListener("abort",(()=>r.destroy(new kt("Request aborted")))))}))}async request({headers:t,signal:e}={}){return await this.constructRequest(t,e)}}class Qt extends Dt{constructor(t,e,i,n){super(),this.client=t,this.headers=e,this.maxRanges=i,this.allowFullFile=n,this._fileSize=null}async fetch(t,e){return this.maxRanges>=t.length?this.fetchSlices(t,e):(this.maxRanges>0&&t.length,Promise.all(t.map((t=>this.fetchSlice(t,e)))))}async fetchSlices(t,e){const i=await this.client.request({headers:{...this.headers,Range:`bytes=${t.map((({offset:t,length:e})=>`${t}-${t+e}`)).join(",")}`},signal:e});if(i.ok){if(206===i.status){const{type:n,params:r}=function(t){const[e,...i]=t.split(";").map((t=>t.trim()));return{type:e,params:Lt(i.map((t=>t.split("="))))}}(i.getHeader("content-type"));if("multipart/byteranges"===n){const t=function(t,e){let i=null;const n=new TextDecoder("ascii"),r=[],s=`--${e}`,o=`${s}--`;for(let e=0;e<10;++e)n.decode(new Uint8Array(t,e,s.length))===s&&(i=e);if(null===i)throw new Error("Could not find initial boundary");for(;i1){const i=await Promise.all(t.slice(1).map((t=>this.fetchSlice(t,e))));return h.concat(i)}return h}{if(!this.allowFullFile)throw new Error("Server responded with full file");const t=await i.getData();return this._fileSize=t.byteLength,[{data:t,offset:0,length:t.byteLength}]}}throw new Error("Error fetching data.")}async fetchSlice(t,e){const{offset:i,length:n}=t,r=await this.client.request({headers:{...this.headers,Range:`bytes=${i}-${i+n}`},signal:e});if(r.ok){if(206===r.status){const t=await r.getData(),{total:e}=Ot(r.getHeader("content-range"));return this._fileSize=e||null,{data:t,offset:i,length:n}}{if(!this.allowFullFile)throw new Error("Server responded with full file");const t=await r.getData();return this._fileSize=t.byteLength,{data:t,offset:0,length:t.byteLength}}}throw new Error("Error fetching data.")}get fileSize(){return this._fileSize}}function te(t,{blockSize:e,cacheSize:i}){return null===e?t:new Bt(t,{blockSize:e,cacheSize:i})}function ee(t,{forceXHR:e=!1,...i}={}){return"function"!=typeof fetch||e?"undefined"!=typeof XMLHttpRequest?function(t,{headers:e={},maxRanges:i=0,allowFullFile:n=!1,...r}={}){const s=new $t(t);return te(new Qt(s,e,i,n),r)}(t,i):function(t,{headers:e={},maxRanges:i=0,allowFullFile:n=!1,...r}={}){const s=new Jt(t);return te(new Qt(s,e,i,n),r)}(t,i):function(t,{headers:e={},credentials:i,maxRanges:n=0,allowFullFile:r=!1,...s}={}){const o=new Zt(t,i);return te(new Qt(o,e,n,r),s)}(t,i)}class ie extends Dt{constructor(t){super(),this.file=t}async fetchSlice(t,e){return new Promise(((i,n)=>{const r=this.file.slice(t.offset,t.offset+t.length),s=new FileReader;s.onload=t=>i(t.target.result),s.onerror=n,s.onabort=n,s.readAsArrayBuffer(r),e&&e.addEventListener("abort",(()=>s.abort()))}))}}function ne(t){switch(t){case s.s$.BYTE:case s.s$.ASCII:case s.s$.SBYTE:case s.s$.UNDEFINED:return 1;case s.s$.SHORT:case s.s$.SSHORT:return 2;case s.s$.LONG:case s.s$.SLONG:case s.s$.FLOAT:case s.s$.IFD:return 4;case s.s$.RATIONAL:case s.s$.SRATIONAL:case s.s$.DOUBLE:case s.s$.LONG8:case s.s$.SLONG8:case s.s$.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${t}`)}}function re(t,e,i,n){let r=null,o=null;const a=ne(e);switch(e){case s.s$.BYTE:case s.s$.ASCII:case s.s$.UNDEFINED:r=new Uint8Array(i),o=t.readUint8;break;case s.s$.SBYTE:r=new Int8Array(i),o=t.readInt8;break;case s.s$.SHORT:r=new Uint16Array(i),o=t.readUint16;break;case s.s$.SSHORT:r=new Int16Array(i),o=t.readInt16;break;case s.s$.LONG:case s.s$.IFD:r=new Uint32Array(i),o=t.readUint32;break;case s.s$.SLONG:r=new Int32Array(i),o=t.readInt32;break;case s.s$.LONG8:case s.s$.IFD8:r=new Array(i),o=t.readUint64;break;case s.s$.SLONG8:r=new Array(i),o=t.readInt64;break;case s.s$.RATIONAL:r=new Uint32Array(2*i),o=t.readUint32;break;case s.s$.SRATIONAL:r=new Int32Array(2*i),o=t.readInt32;break;case s.s$.FLOAT:r=new Float32Array(i),o=t.readFloat32;break;case s.s$.DOUBLE:r=new Float64Array(i),o=t.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e!==s.s$.RATIONAL&&e!==s.s$.SRATIONAL)for(let e=0;et.getWidth()-e.getWidth()));for(let e=0;en||s&&s>o)break}}let u=e;if(o){const[t,e]=a.getOrigin(),[i,n]=l.getResolution(a);u=[Math.round((o[0]-t)/i),Math.round((o[1]-e)/n),Math.round((o[2]-t)/i),Math.round((o[3]-e)/n)],u=[Math.min(u[0],u[2]),Math.min(u[1],u[3]),Math.max(u[0],u[2]),Math.max(u[1],u[3])]}return l.readRasters({...t,window:u})}}class le extends ae{constructor(t,e,i,n,r={}){super(),this.source=t,this.littleEndian=e,this.bigTiff=i,this.firstIFDOffset=n,this.cache=r.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(t,e){const i=this.bigTiff?4048:1024;return new Pt((await this.source.fetch([{offset:t,length:void 0!==e?e:i}]))[0],t,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(t){const e=this.bigTiff?20:12,i=this.bigTiff?8:2;let n=await this.getSlice(t);const r=this.bigTiff?n.readUint64(t):n.readUint16(t),o=r*e+(this.bigTiff?16:6);n.covers(t,o)||(n=await this.getSlice(t,o));const a={};let l=t+(this.bigTiff?8:2);for(let t=0;t{const e=await this.ifdRequests[t-1];if(0===e.nextIFDByteOffset)throw new oe(t);return this.parseFileDirectoryAt(e.nextIFDByteOffset)})(),this.ifdRequests[t]}async getImage(t=0){const e=await this.requestIFD(t);return new Rt(e.fileDirectory,e.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let t=0,e=!0;for(;e;)try{await this.requestIFD(t),++t}catch(t){if(!(t instanceof oe))throw t;e=!1}return t}async getGhostValues(){const t=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;let e=await this.getSlice(t,130);if("GDAL_STRUCTURAL_METADATA_SIZE="===re(e,s.s$.ASCII,30,t)){const i=re(e,s.s$.ASCII,130,t).split("\n")[0],n=Number(i.split("=")[1].split(" ")[0])+i.length;n>130&&(e=await this.getSlice(t,n));const r=re(e,s.s$.ASCII,n,t);this.ghostValues={},r.split("\n").filter((t=>t.length>0)).map((t=>t.split("="))).forEach((([t,e])=>{this.ghostValues[t]=e}))}return this.ghostValues}static async fromSource(t,e,i){const n=(await t.fetch([{offset:0,length:1024}],i))[0],r=new It(n),s=r.getUint16(0,0);let o;if(18761===s)o=!0;else{if(19789!==s)throw new TypeError("Invalid byte order value.");o=!1}const a=r.getUint16(2,o);let l;if(42===a)l=!1;else{if(43!==a)throw new TypeError("Invalid magic number.");if(l=!0,8!==r.getUint16(4,o))throw new Error("Unsupported offset byte-size.")}const h=l?r.getUint64(8,o):r.getUint32(4,o);return new le(t,o,l,h,e)}close(){return"function"==typeof this.source.close&&this.source.close()}}class he extends ae{constructor(t,e){super(),this.mainFile=t,this.overviewFiles=e,this.imageFiles=[t].concat(e),this.fileDirectoriesPerFile=null,this.fileDirectoriesPerFileParsing=null,this.imageCount=null}async parseFileDirectoriesPerFile(){const t=[this.mainFile.parseFileDirectoryAt(this.mainFile.firstIFDOffset)].concat(this.overviewFiles.map((t=>t.parseFileDirectoryAt(t.firstIFDOffset))));return this.fileDirectoriesPerFile=await Promise.all(t),this.fileDirectoriesPerFile}async getImage(t=0){await this.getImageCount(),await this.parseFileDirectoriesPerFile();let e=0,i=0;for(let n=0;nt.getImageCount())));return this.imageCounts=await Promise.all(t),this.imageCount=this.imageCounts.reduce(((t,e)=>t+e),0),this.imageCount}}var ce=i(6409),ue=i(4769),de=i(3839),ge=i(2602),fe=i(4304);function pe(t,e){if(!t)return!1;if(!0===t)return!0;if(3!==e.getSamplesPerPixel())return!1;const i=e.fileDirectory.PhotometricInterpretation,n=s.ub;return i===n.CMYK||i===n.YCbCr||i===n.CIELab||i===n.ICCLab}const me="STATISTICS_MAXIMUM",_e="STATISTICS_MINIMUM";let ve;function ye(){return ve||(ve=new c),ve}function xe(t){try{return t.getBoundingBox()}catch(e){return[0,0,t.getWidth(),t.getHeight()]}}function Ee(t){try{return t.getOrigin().slice(0,2)}catch(e){return[0,t.getHeight()]}}function Ae(t,e){try{return t.getResolution(e)}catch(i){return[e.getWidth()/t.getWidth(),e.getHeight()/t.getHeight()]}}function we(t){const e=t.geoKeys;if(!e)return null;if(e.ProjectedCSTypeGeoKey&&32767!==e.ProjectedCSTypeGeoKey){const t="EPSG:"+e.ProjectedCSTypeGeoKey;let i=(0,ce.get)(t);if(!i){const n=(0,fe.q)(e.ProjLinearUnitsGeoKey);n&&(i=new ce.Projection({code:t,units:n}))}return i}if(e.GeographicTypeGeoKey&&32767!==e.GeographicTypeGeoKey){const t="EPSG:"+e.GeographicTypeGeoKey;let i=(0,ce.get)(t);if(!i){const n=(0,fe.q)(e.GeogAngularUnitsGeoKey);n&&(i=new ce.Projection({code:t,units:n}))}return i}return null}function be(t){return t.getImageCount().then((function(e){const i=new Array(e);for(let n=0;nle.fromSource(ee(t,i)))));return new he(r,s)}(t.url,t.overviews,e):async function(t,e={},i){return le.fromSource(ee(t,e),i)}(t.url,e),i.then(be)}function Ce(t,e,i,n,r){if(Array.isArray(t)){const s=t.length;if(!Array.isArray(e)||s!=e.length){const t=new Error(n);throw r(t),t}for(let o=0;oi*t)throw new Error(n)}function Se(t){return t instanceof Int8Array?127:t instanceof Uint8Array||t instanceof Uint8ClampedArray?255:t instanceof Int16Array?32767:t instanceof Uint16Array?65535:t instanceof Int32Array?2147483647:t instanceof Uint32Array?4294967295:t instanceof Float32Array?34e37:255}class Re extends n.A{constructor(t){super({state:"loading",tileGrid:null,projection:t.projection||null,opaque:t.opaque,transition:t.transition,interpolate:!1!==t.interpolate,wrapX:t.wrapX}),this.sourceInfo_=t.sources;const e=this.sourceInfo_.length;this.sourceOptions_=t.sourceOptions,this.sourceImagery_=new Array(e),this.sourceMasks_=new Array(e),this.resolutionFactors_=new Array(e),this.samplesPerPixel_,this.nodataValues_,this.metadata_,this.normalize_=!1!==t.normalize,this.addAlpha_=!1,this.error_=null,this.convertToRGB_=t.convertToRGB||!1,this.setKey(this.sourceInfo_.map((t=>t.url)).join(","));const i=this,n=new Array(e);for(let t=0;t=0;--t){const i=we(e[t]);if(i){this.projection=i;break}}}configure_(t){let e,i,n,s,o;const a=new Array(t.length),l=new Array(t.length),h=new Array(t.length);let c=0;const u=t.length;for(let r=0;r{4&~(t.fileDirectory.NewSubfileType||0)?u.push(t):d.push(t)}));const g=u.length;if(d.length>0&&d.length!==g)throw new Error(`Expected one mask per image found ${d.length} masks and ${g} images`);let f,p;const m=new Array(g),_=new Array(g),v=new Array(g);l[r]=new Array(g),h[r]=new Array(g);for(let t=0;tv.length&&(c=o.length-v.length);const t=o[o.length-1]/v[v.length-1];this.resolutionFactors_[r]=t;const e=v.map((e=>e*t)),i=`Resolution mismatch for source ${r}, got [${e}] but expected [${o}]`;Ce(o.slice(c,o.length),e,.02,i,this.viewRejector)}else o=v,this.resolutionFactors_[r]=1;n?Ce(n.slice(c,n.length),_,.01,`Tile size mismatch for source ${r}`,this.viewRejector):n=_,s?Ce(s.slice(c,s.length),m,0,`Tile size mismatch for source ${r}`,this.viewRejector):s=m,this.sourceImagery_[r]=u.reverse(),this.sourceMasks_[r]=d.reverse()}for(let t=0,e=this.sourceImagery_.length;t{"use strict";i.d(e,{A:()=>a});var n=i(1796),r=i(6409);class s extends n.A{constructor(t){super(),this.projection=(0,r.get)(t.projection),this.attributions_=o(t.attributions),this.attributionsCollapsible_=void 0===t.attributionsCollapsible||t.attributionsCollapsible,this.loading=!1,this.state_=void 0!==t.state?t.state:"ready",this.wrapX_=void 0!==t.wrapX&&t.wrapX,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise((function(t,i){e.viewResolver=t,e.viewRejector=i}))}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=o(t),this.changed()}setState(t){this.state_=t,this.changed()}}function o(t){return t?Array.isArray(t)?function(e){return t}:"function"==typeof t?t:function(e){return[t]}:null}const a=s},7221:(t,e,i)=>{"use strict";i.d(e,{A:()=>p,c:()=>f});var n=i(7777),r=i(2848),s=i(2473),o=i(8066),a=i(9891),l=i(4504),h=i(6409),c=i(4614),u=i(1990),d=i(8538);class g extends r.A{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.opaque_=void 0!==t.opaque&&t.opaque,this.tilePixelRatio_=void 0!==t.tilePixelRatio?t.tilePixelRatio:1,this.tileGrid=void 0!==t.tileGrid?t.tileGrid:null;this.tileGrid&&(0,d.xq)(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),[256,256]),this.tileCache=new s.A(t.cacheSize||0),this.tmpSize=[0,0],this.key_=t.key||"",this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}canExpireCache(){return this.tileCache.canExpireCache()}expireCache(t,e){const i=this.getTileCacheForProjection(t);i&&i.expireCache(e)}forEachLoadedTile(t,e,i,n){const r=this.getTileCacheForProjection(t);if(!r)return!1;let s,a,l,h=!0;for(let t=i.minX;t<=i.maxX;++t)for(let u=i.minY;u<=i.maxY;++u)a=(0,c.dp)(e,t,u),l=!1,r.containsKey(a)&&(s=r.get(a),l=s.getState()===o.A.LOADED,l&&(l=!1!==n(s))),l||(h=!1);return h}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getOpaque(t){return this.opaque_}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,n,r){return(0,a.b0)()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:(0,u.getForProjection)(t)}getTileCacheForProjection(t){const e=this.getProjection();return(0,l.v)(null===e||(0,h.equivalent)(e,t),"A VectorTile source can only be rendered if it has a projection compatible with the view projection."),this.tileCache}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),s=(0,d.xq)(n.getTileSize(t),this.tmpSize);return 1==r?s:(0,d.hs)(s,r,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){e=void 0!==e?e:this.getProjection();const i=this.getTileGridForProjection(e);return this.getWrapX()&&e.isGlobal()&&(t=(0,u.wrapX)(i,t,e)),(0,c.N5)(t,i)?t:null}clear(){this.tileCache.clear()}refresh(){this.clear(),super.refresh()}updateCacheSize(t,e){const i=this.getTileCacheForProjection(e);t>i.highWaterMark&&(i.highWaterMark=t)}useTile(t,e,i,n){}}class f extends n.Ay{constructor(t,e){super(t),this.tile=e}}const p=g},5209:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});const n={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"}},7828:(t,e,i)=>{"use strict";i.d(e,{A:()=>p});var n=i(8417),r=i(8026),s=i(3816),o=i(2473),a=i(8066),l=i(8912),h=i(6409),c=i(4614),u=i(1990),d=i(9891);class g extends l.A{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:f,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:void 0===t.interpolate||t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=void 0!==t.crossOrigin?t.crossOrigin:null,this.tileClass=void 0!==t.tileClass?t.tileClass:r.A,this.tileCacheForProjection={},this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}canExpireCache(){if(this.tileCache.canExpireCache())return!0;for(const t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1}expireCache(t,e){const i=this.getTileCacheForProjection(t);this.tileCache.expireCache(this.tileCache==i?e:{});for(const t in this.tileCacheForProjection){const n=this.tileCacheForProjection[t];n.expireCache(n==i?e:{})}}getGutterForProjection(t){return this.getProjection()&&t&&!(0,h.equivalent)(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getOpaque(t){return!(this.getProjection()&&t&&!(0,h.equivalent)(this.getProjection(),t))&&super.getOpaque(t)}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||(0,h.equivalent)(e,t)))return this.tileGrid;const i=(0,d.v6)(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=(0,u.getForProjection)(t)),this.tileGridForProjection[i]}getTileCacheForProjection(t){const e=this.getProjection();if(!e||(0,h.equivalent)(e,t))return this.tileCache;const i=(0,d.v6)(t);return i in this.tileCacheForProjection||(this.tileCacheForProjection[i]=new o.A(this.tileCache.highWaterMark)),this.tileCacheForProjection[i]}createTile_(t,e,i,r,s,o){const l=[t,e,i],h=this.getTileCoordForTileUrlFunction(l,s),c=h?this.tileUrlFunction(h,r,s):void 0,u=new this.tileClass(l,void 0!==c?a.A.IDLE:a.A.EMPTY,void 0!==c?c:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return u.key=o,u.addEventListener(n.A.CHANGE,this.handleTileChange.bind(this)),u}getTile(t,e,i,n,r){const o=this.getProjection();if(!o||!r||(0,h.equivalent)(o,r))return this.getTileInternal(t,e,i,n,o||r);const a=this.getTileCacheForProjection(r),l=[t,e,i];let u;const d=(0,c.i7)(l);a.containsKey(d)&&(u=a.get(d));const g=this.getKey();if(u&&u.key==g)return u;const f=this.getTileGridForProjection(o),p=this.getTileGridForProjection(r),m=this.getTileCoordForTileUrlFunction(l,r),_=new s.A(o,f,r,p,l,m,this.getTilePixelRatio(n),this.getGutter(),((t,e,i,n)=>this.getTileInternal(t,e,i,n,o)),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return _.key=g,u?(_.interimTile=u,_.refreshInterimChain(),a.replace(d,_)):a.set(d,_),_}getTileInternal(t,e,i,n,r){let s=null;const o=(0,c.dp)(t,e,i),l=this.getKey();if(this.tileCache.containsKey(o)){if(s=this.tileCache.get(o),s.key!=l){const h=s;s=this.createTile_(t,e,i,n,r,l),h.getState()==a.A.IDLE?s.interimTile=h.interimTile:s.interimTile=h,s.refreshInterimChain(),this.tileCache.replace(o,s)}}else s=this.createTile_(t,e,i,n,r,l),this.tileCache.set(o,s);return s}setRenderReprojectionEdges(t){if(this.renderReprojectionEdges_!=t){this.renderReprojectionEdges_=t;for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear();this.changed()}}setTileGridForProjection(t,e){const i=(0,h.get)(t);if(i){const t=(0,d.v6)(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}clear(){super.clear();for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear()}}function f(t,e){t.getImage().src=e}const p=g},8912:(t,e,i)=>{"use strict";i.d(e,{A:()=>c});var n=i(5209),r=i(7221),s=i(8066),o=i(4610),a=i(4614),l=i(9891);class h extends r.A{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===h.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,i=(0,l.v6)(e),o=e.getState();let a;o==s.A.LOADING?(this.tileLoadingKeys_[i]=!0,a=n.A.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],a=o==s.A.ERROR?n.A.TILELOADERROR:o==s.A.LOADED?n.A.TILELOADEND:void 0),null!=a&&this.dispatchEvent(new r.c(a,e))}setTileLoadFunction(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),void 0!==e?this.setKey(e):this.changed()}setUrl(t){const e=(0,o.Uu)(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction((0,o.Qz)(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}useTile(t,e,i){const n=(0,a.dp)(t,e,i);this.tileCache.containsKey(n)&&this.tileCache.get(n)}}const c=h},1736:(t,e,i)=>{"use strict";i.d(e,{A:()=>b});var n=i(2435),r=i(4211),s=i(7777),o=i(8417),a=i(7262),l=i(8495),h=i(3839),c=i(9891),u=i(3358);const d=class{constructor(t){this.rbush_=new l(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[(0,c.v6)(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,r=e.length;n{e||(e=!0,this.addFeature(t.element),e=!1)})),t.addEventListener(r.A.REMOVE,(t=>{e||(e=!0,this.removeFeature(t.element),e=!1)})),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_)this.featureChangeKeys_[t].forEach(x.JH);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){const t=t=>{this.removeFeatureInternal(t)};this.featuresRtree_.forEach(t);for(const t in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[t])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new A(p.A.CLEAR);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,(function(i){const n=i.getGeometry();if(n instanceof g.Ay||n.intersectsCoordinate(t))return e(i)}))}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,(function(i){const n=i.getGeometry();if(n instanceof g.Ay||n.intersectsExtent(t)){const t=e(i);if(t)return t}}))}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),(0,u.p)(this.nullGeometryFeatures_)||(0,y.X$)(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,(function(t){e.push(t)})),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const i=(0,h.QJ)(t,e);return[].concat(...i.map((t=>this.featuresRtree_.getInExtent(t))))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let r=null;const s=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||m.rT,this.featuresRtree_.forEachInExtent(a,(function(t){if(e(t)){const e=t.getGeometry(),l=o;if(o=e instanceof g.Ay?0:e.closestPointXY(i,n,s,o),o{--this.loadingExtentsCount_,this.dispatchEvent(new A(p.A.FEATURESLOADEND,void 0,t))}),(()=>{--this.loadingExtentsCount_,this.dispatchEvent(new A(p.A.FEATURESLOADERROR))})),n.insert(s,{extent:s.slice()}))}this.loading=!(this.loader_.length<4)&&this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_;let i;e.forEachInExtent(t,(function(e){if((0,h.aI)(e.extent,t))return i=e,!0})),i&&e.remove(i)}removeFeatures(t){const e=[];for(let i=0,n=t.length;i0&&this.changed()}removeFeature(t){t&&this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=(0,c.v6)(t);if(!(e in this.uidIndex_))return;e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t);const i=this.featureChangeKeys_[e];i?.forEach(x.JH),delete this.featureChangeKeys_[e];const n=t.getId();if(void 0!==n){const e=n.toString(),i=this.idIndex_[e];i===t?delete this.idIndex_[e]:Array.isArray(i)&&(i.splice(i.indexOf(t),1),1===i.length&&(this.idIndex_[e]=i[0]))}return delete this.uidIndex_[e],this.hasListener(p.A.REMOVEFEATURE)&&this.dispatchEvent(new A(p.A.REMOVEFEATURE,t)),t}removeFromIdIndex_(t){let e=!1;for(const i in this.idIndex_){const n=this.idIndex_[i];if(t instanceof g.Ay&&Array.isArray(n)&&n.includes(t))n.splice(n.indexOf(t),1);else if(this.idIndex_[i]===t){delete this.idIndex_[i],e=!0;break}}return e}setLoader(t){this.loader_=t}setUrl(t){(0,v.v)(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader((0,E.nF)(t,this.format_))}}const b=w},7476:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});const n={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"}},2618:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>v,defaultLoadFunction:()=>y});var n=i(8417),r=i(64),s=i(2473),o=i(5978),a=i(8066),l=i(8912),h=i(8724),c=i(8943),u=i(3839),d=i(1990),g=i(4614),f=i(3358),p=i(2698),m=i(8538);class _ extends l.A{constructor(t){const e=t.projection||"EPSG:3857",i=t.extent||(0,d.extentFromProjection)(e),n=t.tileGrid||(0,d.createXYZ)({extent:i,maxResolution:t.maxResolution,maxZoom:void 0!==t.maxZoom?t.maxZoom:22,minZoom:t.minZoom,tileSize:t.tileSize||512});super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,interpolate:!0,opaque:!1,projection:e,state:t.state,tileGrid:n,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:y,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:void 0===t.zDirection?1:t.zDirection}),this.format_=t.format?t.format:null,this.sourceTileCache=new s.A(this.tileCache.highWaterMark),this.overlaps_=null==t.overlaps||t.overlaps,this.tileClass=t.tileClass?t.tileClass:r.A,this.tileGrids_={}}getFeaturesInExtent(t){const e=[],i=this.tileCache;if(0===i.getCount())return e;const n=(0,g.K)(i.peekFirstKey())[0],r=this.tileGrid;return i.forEach((function(i){if(i.tileCoord[0]!==n||i.getState()!==a.A.LOADED)return;const s=i.getSourceTiles();for(let i=0,n=s.length;i{const n=(0,g.gr)(e),r=i.peek(n);if(r){const e=r.sourceTiles;for(let i=0,n=e.length;i{const s=this.tileUrlFunction(r,t,e),o=this.sourceTileCache.containsKey(s)?this.sourceTileCache.get(s):new this.tileClass(r,s?a.A.IDLE:a.A.EMPTY,s,this.format_,this.tileLoadFunction);i.sourceTiles.push(o);const l=o.getState();if(l{this.handleTileChange(e);const r=o.getState();if(r===a.A.LOADED||r===a.A.ERROR){const e=o.getKey();e in i.errorTileKeys?o.getState()===a.A.LOADED&&delete i.errorTileKeys[e]:i.loadingSourceTiles--,r===a.A.ERROR?i.errorTileKeys[e]=!0:o.removeEventListener(n.A.CHANGE,t),0===i.loadingSourceTiles&&i.setState((0,f.p)(i.errorTileKeys)?a.A.LOADED:a.A.ERROR)}};o.addEventListener(n.A.CHANGE,t),i.loadingSourceTiles++}l===a.A.IDLE&&(o.extent=c.getTileCoordExtent(r),o.projection=e,o.resolution=c.getResolution(r[0]),this.sourceTileCache.set(s,o),o.load())})),i.loadingSourceTiles||i.setState(i.sourceTiles.some((t=>t.getState()===a.A.ERROR))?a.A.ERROR:a.A.LOADED)}return i.sourceTiles}getTile(t,e,i,n,r){const s=(0,g.dp)(t,e,i),o=this.getKey();let l;if(this.tileCache.containsKey(s)&&(l=this.tileCache.get(s),l.key===o))return l;const c=[t,e,i];let d=this.getTileCoordForTileUrlFunction(c,r);const f=this.getTileGrid().getExtent(),p=this.getTileGridForProjection(r);if(d&&f){const e=p.getTileCoordExtent(d);(0,u.r)(e,-p.getResolution(t),e),(0,u.HY)(f,e)||(d=null)}let m=!0;if(null!==d){const e=this.tileGrid,i=p.getResolution(t),s=e.getZForResolution(i,1),o=p.getTileCoordExtent(d);(0,u.r)(o,-i,o),e.forEachTileCoord(o,s,(t=>{m=m&&!this.tileUrlFunction(t,n,r)}))}const _=new h.A(c,m?a.A.EMPTY:a.A.IDLE,d,this.getSourceTiles.bind(this,n,r));return _.key=o,l?(_.interimTile=l,_.refreshInterimChain(),this.tileCache.replace(s,_)):this.tileCache.set(s,_),_}getTileGridForProjection(t){const e=t.getCode();let i=this.tileGrids_[e];if(!i){const t=this.tileGrid,n=t.getResolutions().slice(),r=n.map((function(e,i){return t.getOrigin(i)})),s=n.map((function(e,i){return t.getTileSize(i)})),a=c.L+1;for(let t=n.length;t{"use strict";i.r(e),i.d(e,{default:()=>o});var n=i(7828),r=i(1990);class s extends n.A{constructor(t){const e=void 0!==(t=t||{}).projection?t.projection:"EPSG:3857",i=void 0!==t.tileGrid?t.tileGrid:(0,r.createXYZ)({extent:(0,r.extentFromProjection)(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,opaque:t.opaque,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=void 0!==t.gutter?t.gutter:0}getGutter(){return this.gutter_}}const o=s},3294:(t,e,i)=>{"use strict";i.d(e,{Yf:()=>s,cY:()=>o});var n=i(4769);const r=6371008.8;function s(t,e,i){i=i||r;const s=(0,n.eh)(t[1]),o=(0,n.eh)(e[1]),a=(o-s)/2,l=(0,n.eh)(e[0]-t[0])/2,h=Math.sin(a)*Math.sin(a)+Math.sin(l)*Math.sin(l)*Math.cos(s)*Math.cos(o);return 2*i*Math.atan2(Math.sqrt(h),Math.sqrt(1-h))}function o(t,e,i,s){s=s||r;const o=(0,n.eh)(t[1]),a=(0,n.eh)(t[0]),l=e/s,h=Math.asin(Math.sin(o)*Math.cos(l)+Math.cos(o)*Math.sin(l)*Math.cos(i)),c=a+Math.atan2(Math.sin(i)*Math.sin(l)*Math.cos(o),Math.cos(l)-Math.sin(o)*Math.sin(h));return[(0,n.xW)(c),(0,n.xW)(h)]}},7170:(t,e,i)=>{"use strict";function n(t,e,i){const n=void 0!==i?t.toFixed(i):""+t;let r=n.indexOf(".");return r=-1===r?n.length:r,r>e?n:new Array(1+e-r).join("0")+n}function r(t,e){const i=(""+t).split("."),n=(""+e).split(".");for(let t=0;tr)return 1;if(r>e)return-1}return 0}i.d(e,{H:()=>n,Z:()=>r})},5941:(t,e,i)=>{"use strict";i.d(e,{A:()=>r});var n=i(4504);const r=class{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.pop()}clear(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return(0,n.v)(void 0!==i,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){const e=this.entries_[t];return(0,n.v)(void 0!==e,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.key_;return t}getValues(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){return this.entries_[t]?.value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){(0,n.v)(!(t in this.entries_),"Tried to set a value for a key that is used already");const i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}}},9806:(t,e,i)=>{"use strict";i.r(e),i.d(e,{Circle:()=>n.A,Fill:()=>r.A,Icon:()=>s.A,IconImage:()=>o.A,Image:()=>a.A,RegularShape:()=>l.A,Stroke:()=>h.A,Style:()=>c.Ay,Text:()=>u.A});var n=i(7033),r=i(6808),s=i(4728),o=i(9767),a=i(5728),l=i(7604),h=i(5893),c=i(5152),u=i(1518)},7033:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var n=i(7604);class r extends n.A{constructor(t){super({points:1/0,fill:(t=t||{radius:5}).fill,radius:t.radius,stroke:t.stroke,scale:void 0!==t.scale?t.scale:1,rotation:void 0!==t.rotation?t.rotation:0,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){const t=this.getScale(),e=new r({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}setRadius(t){this.radius_=t,this.render()}}const s=r},6808:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var n=i(4289),r=i(9767);class s{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,void 0!==t.color&&this.setColor(t.color)}clone(){const t=this.getColor();return new s({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(null!==t&&"object"==typeof t&&"src"in t){const e=(0,r.J)(null,t.src,"anonymous",void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then((()=>{this.patternImage_=null})),e.getImageState()===n.A.IDLE&&e.load(),e.getImageState()===n.A.LOADING&&(this.patternImage_=e)}this.color_=t}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}const o=s},4728:(t,e,i)=>{"use strict";i.d(e,{A:()=>d});var n=i(8417),r=i(4289),s=i(5728),o=i(8e3),a=i(4504),l=i(9767),h=i(9891);function c(t,e,i,n){return void 0!==i&&void 0!==n?[i/t,n/e]:void 0!==i?i/t:void 0!==n?n/e:1}class u extends s.A{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,n=void 0!==t.scale?t.scale:1,s=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:n,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:s,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null;const u=void 0!==t.img?t.img:null;let d,g=t.src;if((0,a.v)(!(void 0!==g&&u),"`image` and `src` cannot be provided at the same time"),void 0!==g&&0!==g.length||!u||(g=u.src||(0,h.v6)(u)),(0,a.v)(void 0!==g&&g.length>0,"A defined and non-empty `src` or `image` must be provided"),(0,a.v)(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?d=r.A.IDLE:void 0!==u&&(d="complete"in u?u.complete?u.src?r.A.LOADED:r.A.IDLE:r.A.LOADING:r.A.LOADED),this.color_=void 0!==t.color?(0,o._j)(t.color):null,this.iconImage_=(0,l.J)(u,g,this.crossOrigin_,d,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const n=this.getImage(1);if(n.width&&n.height)e=n.width,i=n.height;else if(n instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(c(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(c(e,i,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new u({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const e=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!e)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=e[0]),"fraction"==this.anchorYUnits_&&(t[1]*=e[1])}if("top-left"!=this.anchorOrigin_){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+e[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+e[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:this.iconImage_.getImageState()==r.A.LOADED?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:this.iconImage_.getImageState()==r.A.LOADED?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(n.A.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(n.A.CHANGE,t)}ready(){return this.iconImage_.ready()}}const d=u},9767:(t,e,i)=>{"use strict";i.d(e,{A:()=>g,J:()=>d});var n=i(2272),r=i(8417),s=i(4289),o=i(8e3),a=i(6843),l=i(966),h=i(6533);let c=null;class u extends n.A{constructor(t,e,i,n,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=r,this.imageState_=void 0===n?s.A.IDLE:n,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(void 0===this.tainted_&&this.imageState_===s.A.LOADED){c||(c=(0,a.Y)(1,1,void 0,{willReadFrequently:!0})),c.drawImage(this.image_,0,0);try{c.getImageData(0,0,1,1),this.tainted_=!1}catch(t){c=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(r.A.CHANGE)}handleImageError_(){this.imageState_=s.A.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=s.A.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=(0,a.Y)(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===s.A.IDLE){this.image_||this.initializeImage_(),this.imageState_=s.A.LOADING;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch(t){this.handleImageError_()}this.image_ instanceof HTMLImageElement&&(0,l.RA)(this.image_,this.src_).then((t=>{this.image_=t,this.handleImageLoad_()})).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==s.A.LOADED)return;const e=this.image_,i=document.createElement("canvas");i.width=Math.ceil(e.width*t),i.height=Math.ceil(e.height*t);const n=i.getContext("2d");n.scale(t,t),n.drawImage(e,0,0),n.globalCompositeOperation="multiply",n.fillStyle=(0,o.oJ)(this.color_),n.fillRect(0,0,i.width/t,i.height/t),n.globalCompositeOperation="destination-in",n.drawImage(e,0,0),this.canvas_[t]=i}ready(){return this.ready_||(this.ready_=new Promise((t=>{this.imageState_===s.A.LOADED||this.imageState_===s.A.ERROR?t():this.addEventListener(r.A.CHANGE,(function e(){this.imageState_!==s.A.LOADED&&this.imageState_!==s.A.ERROR||(this.removeEventListener(r.A.CHANGE,e),t())}))}))),this.ready_}}function d(t,e,i,n,r,s){let o=void 0===e?void 0:h.ue.get(e,i,r);return o||(o=new u(t,t&&"src"in t?t.src||void 0:e,i,n,r),h.ue.set(e,i,r,o,s)),s&&o&&!h.ue.getPattern(e,i,r)&&h.ue.set(e,i,r,o,s),o}const g=u},6533:(t,e,i)=>{"use strict";i.d(e,{ue:()=>a});var n=i(4289),r=i(8e3),s=i(6843);function o(t,e,i){return e+":"+t+":"+(i?(0,r._j)(i):"null")}const a=new class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=32}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];3&t++||i.hasListener()||(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,i){const n=o(t,e,i);return n in this.cache_?this.cache_[n]:null}getPattern(t,e,i){const n=o(t,e,i);return n in this.patternCache_?this.patternCache_[n]:null}set(t,e,i,r,a){const l=o(t,e,i),h=l in this.cache_;this.cache_[l]=r,a&&(r.getImageState()===n.A.IDLE&&r.load(),r.getImageState()===n.A.LOADING?r.ready().then((()=>{this.patternCache_[l]=(0,s.lr)().createPattern(r.getImage(1),"repeat")})):this.patternCache_[l]=(0,s.lr)().createPattern(r.getImage(1),"repeat")),h||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}},5728:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var n=i(9891),r=i(8538);class s{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=(0,r.xq)(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new s({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return(0,n.b0)()}getImage(t){return(0,n.b0)()}getHitDetectionImage(){return(0,n.b0)()}getPixelRatio(t){return 1}getImageState(){return(0,n.b0)()}getImageSize(){return(0,n.b0)()}getOrigin(){return(0,n.b0)()}getSize(){return(0,n.b0)()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=(0,r.xq)(t)}listenImageChange(t){(0,n.b0)()}load(){(0,n.b0)()}unlistenImageChange(t){(0,n.b0)()}ready(){return Promise.resolve()}}const o=s},7604:(t,e,i)=>{"use strict";i.d(e,{A:()=>c});var n=i(4289),r=i(5728),s=i(8e3),o=i(6291),a=i(6843),l=i(8778);class h extends r.A{constructor(t){super({opacity:1,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,rotation:void 0!==t.rotation?t.rotation:0,scale:void 0!==t.scale?t.scale:1,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode}),this.canvases_,this.hitDetectionCanvas_=null,this.fill_=void 0!==t.fill?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius_=t.radius,this.radius2_=t.radius2,this.angle_=void 0!==t.angle?t.angle:0,this.stroke_=void 0!==t.stroke?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?n.A.LOADING:n.A.LOADED,this.imageState_===n.A.LOADING&&this.ready().then((()=>this.imageState_=n.A.LOADED)),this.render()}clone(){const t=this.getScale(),e=new h({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){let e=this.canvases_[t];if(!e){const i=this.renderOptions_,n=(0,a.Y)(i.size*t,i.size*t);this.draw_(i,n,t),e=n.canvas,this.canvases_[t]=e}return e}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius_}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let n=this.radius_,r=void 0===this.radius2_?n:this.radius2_;if(n{"use strict";i.d(e,{A:()=>r});class n{constructor(t){t=t||{},this.color_=void 0!==t.color?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=void 0!==t.lineDash?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.width_=t.width}clone(){const t=this.getColor();return new n({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setWidth(t){this.width_=t}}const r=n},5152:(t,e,i)=>{"use strict";i.d(e,{Ay:()=>d,d1:()=>c,mC:()=>l});var n=i(7033),r=i(6808),s=i(5893),o=i(4504);class a{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=u,void 0!==t.geometry&&this.setGeometry(t.geometry),this.fill_=void 0!==t.fill?t.fill:null,this.image_=void 0!==t.image?t.image:null,this.renderer_=void 0!==t.renderer?t.renderer:null,this.hitDetectionRenderer_=void 0!==t.hitDetectionRenderer?t.hitDetectionRenderer:null,this.stroke_=void 0!==t.stroke?t.stroke:null,this.text_=void 0!==t.text?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&"object"==typeof t&&(t=t.clone()),new a({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=u,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function l(t){let e;if("function"==typeof t)e=t;else{let i;Array.isArray(t)?i=t:((0,o.v)("function"==typeof t.getZIndex,"Expected an `Style` or an array of `Style`"),i=[t]),e=function(){return i}}return e}let h=null;function c(t,e){if(!h){const t=new r.A({color:"rgba(255,255,255,0.4)"}),e=new s.A({color:"#3399CC",width:1.25});h=[new a({image:new n.A({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return h}function u(t){return t.getGeometry()}const d=a},1518:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var n=i(6808),r=i(8538);class s{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.scale_=t.scale,this.scaleArray_=(0,r.xq)(void 0!==t.scale?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=void 0!==t.fill?t.fill:new n.A({color:"#333"}),this.maxAngle_=void 0!==t.maxAngle?t.maxAngle:Math.PI/4,this.placement_=void 0!==t.placement?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=void 0!==t.stroke?t.stroke:null,this.offsetX_=void 0!==t.offsetX?t.offsetX:0,this.offsetY_=void 0!==t.offsetY?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=void 0===t.padding?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new s({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=(0,r.xq)(void 0!==t?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}const o=s},4614:(t,e,i)=>{"use strict";function n(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function r(t,e,i){return t+"/"+e+"/"+i}function s(t){return r(t[0],t[1],t[2])}function o(t){const[e,i,n]=t.substring(t.lastIndexOf("/")+1,t.length).split(",").map(Number);return r(e,i,n)}function a(t){return t.split("/").map(Number)}function l(t){return(t[1]<i||i>e.getMaxZoom())return!1;const s=e.getFullTileRange(i);return!s||s.containsXY(n,r)}i.d(e,{K:()=>a,N:()=>n,N5:()=>h,dp:()=>r,gr:()=>o,i7:()=>s,tW:()=>l})},1990:(t,e,i)=>{"use strict";i.r(e),i.d(e,{TileGrid:()=>n.A,WMTS:()=>h,createForExtent:()=>d,createForProjection:()=>p,createXYZ:()=>g,extentFromProjection:()=>m,getForProjection:()=>c,wrapX:()=>u});var n=i(5978),r=i(8943),s=i(6409),o=i(3839),a=i(8538);class l extends n.A{constructor(t){super({extent:t.extent,origin:t.origin,origins:t.origins,resolutions:t.resolutions,tileSize:t.tileSize,tileSizes:t.tileSizes,sizes:t.sizes}),this.matrixIds_=t.matrixIds}getMatrixId(t){return this.matrixIds_[t]}getMatrixIds(){return this.matrixIds_}}const h=l;function c(t){let e=t.getDefaultTileGrid();return e||(e=p(t),t.setDefaultTileGrid(e)),e}function u(t,e,i){const n=e[0],r=t.getTileCoordCenter(e),s=m(i);if(!(0,o.Ym)(s,r)){const e=(0,o.RG)(s),i=Math.ceil((s[0]-r[0])/e);return r[0]+=e*i,t.getTileCoordForCoordAndZ(r,n)}return e}function d(t,e,i,r){r=void 0!==r?r:"top-left";const s=f(t,e,i);return new n.A({extent:t,origin:(0,o.qF)(t,r),resolutions:s,tileSize:i})}function g(t){const e=t||{},i=e.extent||(0,s.get)("EPSG:3857").getExtent(),r={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:f(i,e.maxZoom,e.tileSize,e.maxResolution)};return new n.A(r)}function f(t,e,i,n){e=void 0!==e?e:r.L,i=(0,a.xq)(void 0!==i?i:r.R);const s=(0,o.Oq)(t),l=(0,o.RG)(t);n=n>0?n:Math.max(l/i[0],s/i[1]);const h=e+1,c=new Array(h);for(let t=0;t{"use strict";i.d(e,{A:()=>g});var n=i(1218),r=i(8943),s=i(4504),o=i(4769),a=i(3839),l=i(4614),h=i(634),c=i(2654),u=i(8538);const d=[0,0,0],g=class{constructor(t){let e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,(0,s.v)((0,c.WC)(this.resolutions_,((t,e)=>e-t),!0),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,i=this.resolutions_.length-1;t{const r=new n.A(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(i){const t=this.getTileRangeForExtentAndZ(i,e);r.minX=Math.max(t.minX,r.minX),r.maxX=Math.min(t.maxX,r.maxX),r.minY=Math.max(t.minY,r.minY),r.maxY=Math.min(t.maxY,r.maxY)}return r})):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let t=n.minX,r=n.maxX;t<=r;++t)for(let r=n.minY,s=n.maxY;r<=s;++r)i([e,t,r])}forEachTileCoordParentTileRange(t,e,i,r){let s,o,a,l=null,h=t[0]-1;for(2===this.zoomFactor_?(o=t[1],a=t[2]):l=this.getTileCoordExtent(t,r);h>=this.minZoom;){if(void 0!==o&&void 0!==a?(o=Math.floor(o/2),a=Math.floor(a/2),s=(0,n.N)(o,o,a,a,i)):s=this.getTileRangeForExtentAndZ(l,h,i),e(h,s))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]this.maxZoom||e{"use strict";i.d(e,{L:()=>n,R:()=>r});const n=42,r=256},4610:(t,e,i)=>{"use strict";i.d(e,{FD:()=>a,Qz:()=>o,Uu:()=>h,lg:()=>l});var n=i(4769),r=i(4614);function s(t,e){const i=/\{z\}/g,n=/\{x\}/g,r=/\{y\}/g,s=/\{-y\}/g;return function(o,a,l){if(o)return t.replace(i,o[0].toString()).replace(n,o[1].toString()).replace(r,o[2].toString()).replace(s,(function(){const t=o[0],i=e.getFullTileRange(t);if(!i)throw new Error("The {-y} placeholder requires a tile grid with extent");return(i.getHeight()-o[2]-1).toString()}))}}function o(t,e){const i=t.length,n=new Array(i);for(let r=0;r{"use strict";i.d(e,{Bb:()=>c,T9:()=>p,Tl:()=>g,Zz:()=>f,cL:()=>o,dI:()=>_,e$:()=>u,hs:()=>d,k3:()=>h,lw:()=>a,vt:()=>s});var n=i(4504);const r=new Array(6);function s(){return[1,0,0,1,0,0]}function o(t){return l(t,1,0,0,1,0,0)}function a(t,e){const i=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=e[0],h=e[1],c=e[2],u=e[3],d=e[4],g=e[5];return t[0]=i*l+r*h,t[1]=n*l+s*h,t[2]=i*c+r*u,t[3]=n*c+s*u,t[4]=i*d+r*g+o,t[5]=n*d+s*g+a,t}function l(t,e,i,n,r,s,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=r,t[4]=s,t[5]=o,t}function h(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function c(t,e){const i=e[0],n=e[1];return e[0]=t[0]*i+t[2]*n+t[4],e[1]=t[1]*i+t[3]*n+t[5],e}function u(t,e){const i=Math.cos(e),n=Math.sin(e);return a(t,l(r,i,n,-n,i,0,0))}function d(t,e,i){return a(t,l(r,e,0,0,i,0,0))}function g(t,e,i){return a(t,l(r,1,0,0,1,e,i))}function f(t,e,i,n,r,s,o,a){const l=Math.sin(s),h=Math.cos(s);return t[0]=n*h,t[1]=r*l,t[2]=-n*l,t[3]=r*h,t[4]=o*n*h-a*n*l+e,t[5]=o*r*l+a*r*h+i,t}function p(t,e){const i=(r=e)[0]*r[3]-r[1]*r[2];var r;(0,n.v)(0!==i,"Transformation matrix cannot be inverted");const s=e[0],o=e[1],a=e[2],l=e[3],h=e[4],c=e[5];return t[0]=l/i,t[1]=-o/i,t[2]=-a/i,t[3]=s/i,t[4]=(a*c-l*h)/i,t[5]=-(s*c-o*h)/i,t}const m=[1e6,1e6,1e6,1e6,2,2];function _(t){return"matrix("+t.map(((t,e)=>Math.round(t*m[e])/m[e])).join(", ")+")"}},9891:(t,e,i)=>{"use strict";function n(){throw new Error("Unimplemented abstract method.")}i.d(e,{b0:()=>n,v6:()=>s,xv:()=>o});let r=0;function s(t){return t.ol_uid||(t.ol_uid=String(++r))}const o="9.2.4"},8934:(t,e,i)=>{"use strict";function n(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function r(t,e){return t[0]=e[0],t[1]=e[1],t[4]=e[2],t[5]=e[3],t[12]=e[4],t[13]=e[5],t}i.d(e,{Z:()=>r,v:()=>n})},9790:(t,e,i)=>{"use strict";i.d(e,{Be:()=>l,Ek:()=>a,H7:()=>r,IP:()=>s,JL:()=>c,SD:()=>f,Ss:()=>o,UD:()=>u,l4:()=>h,zH:()=>d});var n=i(4919);const r=34962,s=34963,o=35040,a=35044,l=35048,h=5121,c=5123,u=5125,d=5126,g=["experimental-webgl","webgl","webkit-3d","moz-webgl"];function f(t,e){e=Object.assign({preserveDrawingBuffer:!0,antialias:!n.oF},e);const i=g.length;for(let n=0;n{"use strict";i.d(e,{Ay:()=>a});var n=i(9790),r=i(4504);const s={STATIC_DRAW:n.Ek,STREAM_DRAW:n.Ss,DYNAMIC_DRAW:n.Be};function o(t){switch(t){case n.H7:return Float32Array;case n.IP:return Uint32Array;default:return Float32Array}}const a=class{constructor(t,e){this.array_=null,this.type_=t,(0,r.v)(t===n.H7||t===n.IP,"A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`"),this.usage_=void 0!==e?e:s.STATIC_DRAW}ofSize(t){return this.array_=new(o(this.type_))(t),this}fromArray(t){return this.array_=o(this.type_).from(t),this}fromArrayBuffer(t){return this.array_=new(o(this.type_))(t),this}getType(){return this.type_}getArray(){return this.array_}getUsage(){return this.usage_}getSize(){return this.array_?this.array_.length:0}}},3237:(t,e,i)=>{"use strict";i.d(e,{jQ:()=>g,M8:()=>d,Ay:()=>y});const n="webglcontextlost",r="webglcontextrestored";var s=i(1581),o=i(9891);const a=class{constructor(t){this.gl_=t.webGlContext;const e=this.gl_;this.scaleRatio_=t.scaleRatio||1,this.renderTargetTexture_=e.createTexture(),this.renderTargetTextureSize_=null,this.frameBuffer_=e.createFramebuffer(),this.depthBuffer_=e.createRenderbuffer();const i=e.createShader(e.VERTEX_SHADER);e.shaderSource(i,t.vertexShader||"\n precision mediump float;\n \n attribute vec2 a_position;\n varying vec2 v_texCoord;\n varying vec2 v_screenCoord;\n \n uniform vec2 u_screenSize;\n \n void main() {\n v_texCoord = a_position * 0.5 + 0.5;\n v_screenCoord = v_texCoord * u_screenSize;\n gl_Position = vec4(a_position, 0.0, 1.0);\n }\n"),e.compileShader(i);const n=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(n,t.fragmentShader||"\n precision mediump float;\n \n uniform sampler2D u_image;\n uniform float u_opacity;\n \n varying vec2 v_texCoord;\n \n void main() {\n gl_FragColor = texture2D(u_image, v_texCoord) * u_opacity;\n }\n"),e.compileShader(n),this.renderTargetProgram_=e.createProgram(),e.attachShader(this.renderTargetProgram_,i),e.attachShader(this.renderTargetProgram_,n),e.linkProgram(this.renderTargetProgram_),this.renderTargetVerticesBuffer_=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,-1,1,1,-1,1]),e.STATIC_DRAW),this.renderTargetAttribLocation_=e.getAttribLocation(this.renderTargetProgram_,"a_position"),this.renderTargetUniformLocation_=e.getUniformLocation(this.renderTargetProgram_,"u_screenSize"),this.renderTargetOpacityLocation_=e.getUniformLocation(this.renderTargetProgram_,"u_opacity"),this.renderTargetTextureLocation_=e.getUniformLocation(this.renderTargetProgram_,"u_image"),this.uniforms_=[],t.uniforms&&Object.keys(t.uniforms).forEach((i=>{this.uniforms_.push({value:t.uniforms[i],location:e.getUniformLocation(this.renderTargetProgram_,i)})}))}getGL(){return this.gl_}init(t){const e=this.getGL(),i=[e.drawingBufferWidth*this.scaleRatio_,e.drawingBufferHeight*this.scaleRatio_];if(e.bindFramebuffer(e.FRAMEBUFFER,this.getFrameBuffer()),e.bindRenderbuffer(e.RENDERBUFFER,this.getDepthBuffer()),e.viewport(0,0,i[0],i[1]),!this.renderTargetTextureSize_||this.renderTargetTextureSize_[0]!==i[0]||this.renderTargetTextureSize_[1]!==i[1]){this.renderTargetTextureSize_=i;const t=0,n=e.RGBA,r=0,s=e.RGBA,o=e.UNSIGNED_BYTE,a=null;e.bindTexture(e.TEXTURE_2D,this.renderTargetTexture_),e.texImage2D(e.TEXTURE_2D,t,n,i[0],i[1],r,s,o,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.renderTargetTexture_,0),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,i[0],i[1]),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,this.depthBuffer_)}}apply(t,e,i,n){const r=this.getGL(),s=t.size;if(r.bindFramebuffer(r.FRAMEBUFFER,e?e.getFrameBuffer():null),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.renderTargetTexture_),!e){const e=(0,o.v6)(r.canvas);if(!t.renderTargets[e]){const i=r.getContextAttributes();i&&i.preserveDrawingBuffer&&(r.clearColor(0,0,0,0),r.clearDepth(1),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT)),t.renderTargets[e]=!0}}r.disable(r.DEPTH_TEST),r.enable(r.BLEND),r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA),r.viewport(0,0,r.drawingBufferWidth,r.drawingBufferHeight),r.bindBuffer(r.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),r.useProgram(this.renderTargetProgram_),r.enableVertexAttribArray(this.renderTargetAttribLocation_),r.vertexAttribPointer(this.renderTargetAttribLocation_,2,r.FLOAT,!1,0,0),r.uniform2f(this.renderTargetUniformLocation_,s[0],s[1]),r.uniform1i(this.renderTargetTextureLocation_,0);const a=t.layerStatesArray[t.layerIndex].opacity;r.uniform1f(this.renderTargetOpacityLocation_,a),this.applyUniforms(t),i&&i(r,t),r.drawArrays(r.TRIANGLES,0,6),n&&n(r,t)}getFrameBuffer(){return this.frameBuffer_}getDepthBuffer(){return this.depthBuffer_}applyUniforms(t){const e=this.getGL();let i,n=1;this.uniforms_.forEach((function(r){if(i="function"==typeof r.value?r.value(t):r.value,i instanceof HTMLCanvasElement||i instanceof ImageData)r.texture||(r.texture=e.createTexture()),e.activeTexture(e[`TEXTURE${n}`]),e.bindTexture(e.TEXTURE_2D,r.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),i instanceof ImageData?e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,i.width,i.height,0,e.UNSIGNED_BYTE,new Uint8Array(i.data)):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,i),e.uniform1i(r.location,n++);else if(Array.isArray(i))switch(i.length){case 2:return void e.uniform2f(r.location,i[0],i[1]);case 3:return void e.uniform3f(r.location,i[0],i[1],i[2]);case 4:return void e.uniform4f(r.location,i[0],i[1],i[2],i[3]);default:return}else"number"==typeof i&&e.uniform1f(r.location,i)}))}};var l=i(9790),h=i(3358),c=i(7659),u=i(8934);const d={PROJECTION_MATRIX:"u_projectionMatrix",SCREEN_TO_WORLD_MATRIX:"u_screenToWorldMatrix",TIME:"u_time",ZOOM:"u_zoom",RESOLUTION:"u_resolution",ROTATION:"u_rotation",VIEWPORT_SIZE_PX:"u_viewportSizePx",PIXEL_RATIO:"u_pixelRatio",HIT_DETECTION:"u_hitDetection"},g={UNSIGNED_BYTE:l.l4,UNSIGNED_SHORT:l.JL,UNSIGNED_INT:l.UD,FLOAT:l.zH},f={};function p(t){return"shared/"+t}let m=0;class _ extends s.A{constructor(t){super(),t=t||{},this.boundHandleWebGLContextLost_=this.handleWebGLContextLost.bind(this),this.boundHandleWebGLContextRestored_=this.handleWebGLContextRestored.bind(this),this.canvasCacheKey_=t.canvasCacheKey?p(t.canvasCacheKey):function(){const t="unique/"+m;return m+=1,t}(),this.gl_=function(t){let e=f[t];if(!e){const i=document.createElement("canvas");i.width=1,i.height=1,i.style.position="absolute",i.style.left="0",e={users:0,context:(0,l.SD)(i)},f[t]=e}return e.users+=1,e.context}(this.canvasCacheKey_),this.bufferCache_={},this.extensionCache_={},this.currentProgram_=null,this.needsToBeRecreated_=!1;const e=this.gl_.canvas;e.addEventListener(n,this.boundHandleWebGLContextLost_),e.addEventListener(r,this.boundHandleWebGLContextRestored_),this.offsetRotateMatrix_=(0,c.vt)(),this.offsetScaleMatrix_=(0,c.vt)(),this.tmpMat4_=(0,u.v)(),this.uniformLocationsByProgram_={},this.attribLocationsByProgram_={},this.uniforms_=[],t.uniforms&&this.setUniforms(t.uniforms),this.postProcessPasses_=t.postProcesses?t.postProcesses.map((t=>new a({webGlContext:this.gl_,scaleRatio:t.scaleRatio,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms}))):[new a({webGlContext:this.gl_})],this.shaderCompileErrors_=null,this.startTime_=Date.now()}setUniforms(t){this.uniforms_=[],this.addUniforms(t)}addUniforms(t){for(const e in t)this.uniforms_.push({name:e,value:t[e]})}canvasCacheKeyMatches(t){return this.canvasCacheKey_===p(t)}getExtension(t){if(t in this.extensionCache_)return this.extensionCache_[t];const e=this.gl_.getExtension(t);return this.extensionCache_[t]=e,e}bindBuffer(t){const e=this.gl_,i=(0,o.v6)(t);let n=this.bufferCache_[i];n||(n={buffer:t,webGlBuffer:e.createBuffer()},this.bufferCache_[i]=n),e.bindBuffer(t.getType(),n.webGlBuffer)}flushBufferData(t){const e=this.gl_;this.bindBuffer(t),e.bufferData(t.getType(),t.getArray(),t.getUsage())}deleteBuffer(t){const e=this.gl_,i=(0,o.v6)(t),n=this.bufferCache_[i];n&&!e.isContextLost()&&e.deleteBuffer(n.webGlBuffer),delete this.bufferCache_[i]}disposeInternal(){const t=this.gl_.canvas;t.removeEventListener(n,this.boundHandleWebGLContextLost_),t.removeEventListener(r,this.boundHandleWebGLContextRestored_),function(t){const e=f[t];if(!e)return;if(e.users-=1,e.users>0)return;const i=e.context,n=i.getExtension("WEBGL_lose_context");n&&n.loseContext();const r=i.canvas;r.width=1,r.height=1,delete f[t]}(this.canvasCacheKey_),delete this.gl_}prepareDraw(t,e,i){const n=this.gl_,r=this.getCanvas(),s=t.size,o=t.pixelRatio;r.width===s[0]*o&&r.height===s[1]*o||(r.width=s[0]*o,r.height=s[1]*o,r.style.width=s[0]+"px",r.style.height=s[1]+"px");for(let e=this.postProcessPasses_.length-1;e>=0;e--)this.postProcessPasses_[e].init(t);n.bindTexture(n.TEXTURE_2D,null),n.clearColor(0,0,0,0),n.depthRange(0,1),n.clearDepth(1),n.clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.ONE,e?n.ZERO:n.ONE_MINUS_SRC_ALPHA),i?(n.enable(n.DEPTH_TEST),n.depthFunc(n.LEQUAL)):n.disable(n.DEPTH_TEST)}bindTexture(t,e,i){const n=this.gl_;n.activeTexture(n.TEXTURE0+e),n.bindTexture(n.TEXTURE_2D,t),n.uniform1i(this.getUniformLocation(i),e)}prepareDrawToRenderTarget(t,e,i,n){const r=this.gl_,s=e.getSize();r.bindFramebuffer(r.FRAMEBUFFER,e.getFramebuffer()),r.bindRenderbuffer(r.RENDERBUFFER,e.getDepthbuffer()),r.viewport(0,0,s[0],s[1]),r.bindTexture(r.TEXTURE_2D,e.getTexture()),r.clearColor(0,0,0,0),r.depthRange(0,1),r.clearDepth(1),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT),r.enable(r.BLEND),r.blendFunc(r.ONE,i?r.ZERO:r.ONE_MINUS_SRC_ALPHA),n?(r.enable(r.DEPTH_TEST),r.depthFunc(r.LEQUAL)):r.disable(r.DEPTH_TEST)}drawElements(t,e){const i=this.gl_;this.getExtension("OES_element_index_uint");const n=i.UNSIGNED_INT,r=e-t,s=4*t;i.drawElements(i.TRIANGLES,r,n,s)}finalizeDraw(t,e,i){for(let n=0,r=this.postProcessPasses_.length;n{if(i="function"==typeof r.value?r.value(t):r.value,i instanceof HTMLCanvasElement||i instanceof HTMLImageElement||i instanceof ImageData||i instanceof WebGLTexture){i instanceof WebGLTexture&&!r.texture?(r.prevValue=void 0,r.texture=i):r.texture||(r.prevValue=void 0,r.texture=e.createTexture()),this.bindTexture(r.texture,n,r.name),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);const t=!(i instanceof HTMLImageElement)||i.complete;i instanceof WebGLTexture||!t||r.prevValue===i||(r.prevValue=i,e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,i)),n++}else if(Array.isArray(i)&&6===i.length)this.setUniformMatrixValue(r.name,(0,u.Z)(this.tmpMat4_,i));else if(Array.isArray(i)&&i.length<=4)switch(i.length){case 2:return void e.uniform2f(this.getUniformLocation(r.name),i[0],i[1]);case 3:return void e.uniform3f(this.getUniformLocation(r.name),i[0],i[1],i[2]);case 4:return void e.uniform4f(this.getUniformLocation(r.name),i[0],i[1],i[2],i[3]);default:return}else"number"==typeof i&&e.uniform1f(this.getUniformLocation(r.name),i)}))}useProgram(t,e){this.gl_.useProgram(t),this.currentProgram_=t,this.applyFrameState(e),this.applyUniforms(e)}compileShader(t,e){const i=this.gl_,n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}getProgram(t,e){const i=this.gl_,n=this.compileShader(t,i.FRAGMENT_SHADER),r=this.compileShader(e,i.VERTEX_SHADER),s=i.createProgram();if(i.attachShader(s,n),i.attachShader(s,r),i.linkProgram(s),!i.getShaderParameter(n,i.COMPILE_STATUS)){const t=`Fragment shader compilation failed: ${i.getShaderInfoLog(n)}`;throw new Error(t)}if(i.deleteShader(n),!i.getShaderParameter(r,i.COMPILE_STATUS)){const t=`Vertex shader compilation failed: ${i.getShaderInfoLog(r)}`;throw new Error(t)}if(i.deleteShader(r),!i.getProgramParameter(s,i.LINK_STATUS)){const t=`GL program linking failed: ${i.getProgramInfoLog(s)}`;throw new Error(t)}return s}getUniformLocation(t){const e=(0,o.v6)(this.currentProgram_);return void 0===this.uniformLocationsByProgram_[e]&&(this.uniformLocationsByProgram_[e]={}),void 0===this.uniformLocationsByProgram_[e][t]&&(this.uniformLocationsByProgram_[e][t]=this.gl_.getUniformLocation(this.currentProgram_,t)),this.uniformLocationsByProgram_[e][t]}getAttributeLocation(t){const e=(0,o.v6)(this.currentProgram_);return void 0===this.attribLocationsByProgram_[e]&&(this.attribLocationsByProgram_[e]={}),void 0===this.attribLocationsByProgram_[e][t]&&(this.attribLocationsByProgram_[e][t]=this.gl_.getAttribLocation(this.currentProgram_,t)),this.attribLocationsByProgram_[e][t]}makeProjectionTransform(t,e){const i=t.size,n=t.viewState.rotation,r=t.viewState.resolution,s=t.viewState.center;return(0,c.Zz)(e,0,0,2/(r*i[0]),2/(r*i[1]),-n,-s[0],-s[1]),e}setUniformFloatValue(t,e){this.gl_.uniform1f(this.getUniformLocation(t),e)}setUniformFloatVec2(t,e){this.gl_.uniform2fv(this.getUniformLocation(t),e)}setUniformFloatVec4(t,e){this.gl_.uniform4fv(this.getUniformLocation(t),e)}setUniformMatrixValue(t,e){this.gl_.uniformMatrix4fv(this.getUniformLocation(t),!1,e)}enableAttributeArray_(t,e,i,n,r){const s=this.getAttributeLocation(t);s<0||(this.gl_.enableVertexAttribArray(s),this.gl_.vertexAttribPointer(s,e,i,!1,n,r))}enableAttributes(t){const e=function(t){let e=0;for(let i=0;i{"use strict";i.d(e,{N:()=>d});var n=i(1743),r=i(7016);const s="#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_screenToWorldMatrix;\nuniform vec2 u_viewportSizePx;\nuniform float u_pixelRatio;\nuniform float u_globalAlpha;\nuniform float u_time;\nuniform float u_zoom;\nuniform float u_resolution;\nuniform float u_rotation;\nuniform vec4 u_renderExtent;\nuniform vec2 u_patternOrigin;\nuniform float u_depth;\nuniform mediump int u_hitDetection;\n\nconst float PI = 3.141592653589793238;\nconst float TWO_PI = 2.0 * PI;\n\n// this used to produce an alpha-premultiplied color from a texture\nvec4 samplePremultiplied(sampler2D sampler, vec2 texCoord) {\n vec4 color = texture2D(sampler, texCoord);\n return vec4(color.rgb * color.a, color.a);\n}\n",o="rgba(255,255,255,0.4)",a="#3399CC",l=1.25,h=5,c="rgba(255,255,255,0.4)",u=1.25;class d{constructor(){this.uniforms_=[],this.attributes_=[],this.varyings_=[],this.hasSymbol_=!1,this.symbolSizeExpression_=`vec2(${(0,r.$R)(h)} + ${(0,r.$R)(.5*u)})`,this.symbolRotationExpression_="0.0",this.symbolOffsetExpression_="vec2(0.0)",this.symbolColorExpression_=(0,r.VO)(c),this.texCoordExpression_="vec4(0.0, 0.0, 1.0, 1.0)",this.discardExpression_="false",this.symbolRotateWithView_=!1,this.hasStroke_=!1,this.strokeWidthExpression_=(0,r.$R)(l),this.strokeColorExpression_=(0,r.VO)(a),this.strokeOffsetExpression_="0.",this.strokeCapExpression_=(0,r.Tl)("round"),this.strokeJoinExpression_=(0,r.Tl)("round"),this.strokeMiterLimitExpression_="10.",this.strokeDistanceFieldExpression_="-1000.",this.hasFill_=!1,this.fillColorExpression_=(0,r.VO)(o),this.vertexShaderFunctions_=[],this.fragmentShaderFunctions_=[]}addUniform(t){return this.uniforms_.push(t),this}addAttribute(t){return this.attributes_.push(t),this}addVarying(t,e,i){return this.varyings_.push({name:t,type:e,expression:i}),this}setSymbolSizeExpression(t){return this.hasSymbol_=!0,this.symbolSizeExpression_=t,this}getSymbolSizeExpression(){return this.symbolSizeExpression_}setSymbolRotationExpression(t){return this.symbolRotationExpression_=t,this}setSymbolOffsetExpression(t){return this.symbolOffsetExpression_=t,this}getSymbolOffsetExpression(){return this.symbolOffsetExpression_}setSymbolColorExpression(t){return this.hasSymbol_=!0,this.symbolColorExpression_=t,this}getSymbolColorExpression(){return this.symbolColorExpression_}setTextureCoordinateExpression(t){return this.texCoordExpression_=t,this}setFragmentDiscardExpression(t){return this.discardExpression_=t,this}getFragmentDiscardExpression(){return this.discardExpression_}setSymbolRotateWithView(t){return this.symbolRotateWithView_=t,this}setStrokeWidthExpression(t){return this.hasStroke_=!0,this.strokeWidthExpression_=t,this}setStrokeColorExpression(t){return this.hasStroke_=!0,this.strokeColorExpression_=t,this}getStrokeColorExpression(){return this.strokeColorExpression_}setStrokeOffsetExpression(t){return this.strokeOffsetExpression_=t,this}setStrokeCapExpression(t){return this.strokeCapExpression_=t,this}setStrokeJoinExpression(t){return this.strokeJoinExpression_=t,this}setStrokeMiterLimitExpression(t){return this.strokeMiterLimitExpression_=t,this}setStrokeDistanceFieldExpression(t){return this.strokeDistanceFieldExpression_=t,this}setFillColorExpression(t){return this.hasFill_=!0,this.fillColorExpression_=t,this}getFillColorExpression(){return this.fillColorExpression_}addVertexShaderFunction(t){this.vertexShaderFunctions_.includes(t)||this.vertexShaderFunctions_.push(t)}addFragmentShaderFunction(t){this.fragmentShaderFunctions_.includes(t)||this.fragmentShaderFunctions_.push(t)}getSymbolVertexShader(){return this.hasSymbol_?`${s}\n${this.uniforms_.map((function(t){return"uniform "+t+";"})).join("\n")}\nattribute vec2 a_position;\nattribute float a_index;\nattribute vec4 a_prop_hitColor;\n${this.attributes_.map((function(t){return"attribute "+t+";"})).join("\n")}\nvarying vec2 v_texCoord;\nvarying vec2 v_quadCoord;\nvarying vec4 v_prop_hitColor;\nvarying vec2 v_centerPx;\nvarying float v_angle;\nvarying vec2 v_quadSizePx;\n${this.varyings_.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\n${this.vertexShaderFunctions_.join("\n")}\nvec2 pxToScreen(vec2 coordPx) {\n vec2 scaled = coordPx / u_viewportSizePx / 0.5;\n return scaled;\n}\n\nvec2 screenToPx(vec2 coordScreen) {\n return (coordScreen * 0.5 + 0.5) * u_viewportSizePx;\n}\n\nvoid main(void) {\n v_quadSizePx = ${this.symbolSizeExpression_};\n vec2 halfSizePx = v_quadSizePx * 0.5;\n vec2 centerOffsetPx = ${this.symbolOffsetExpression_};\n vec2 offsetPx = centerOffsetPx;\n if (a_index == 0.0) {\n offsetPx -= halfSizePx;\n } else if (a_index == 1.0) {\n offsetPx += halfSizePx * vec2(1., -1.);\n } else if (a_index == 2.0) {\n offsetPx += halfSizePx;\n } else {\n offsetPx += halfSizePx * vec2(-1., 1.);\n }\n float angle = ${this.symbolRotationExpression_};\n ${this.symbolRotateWithView_?"angle += u_rotation;":""}\n float c = cos(-angle);\n float s = sin(-angle);\n offsetPx = vec2(c * offsetPx.x - s * offsetPx.y, s * offsetPx.x + c * offsetPx.y);\n vec4 center = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\n gl_Position = center + vec4(pxToScreen(offsetPx), u_depth, 0.);\n vec4 texCoord = ${this.texCoordExpression_};\n float u = a_index == 0.0 || a_index == 3.0 ? texCoord.s : texCoord.p;\n float v = a_index == 2.0 || a_index == 3.0 ? texCoord.t : texCoord.q;\n v_texCoord = vec2(u, v);\n v_prop_hitColor = a_prop_hitColor;\n v_angle = angle;\n c = cos(-v_angle);\n s = sin(-v_angle);\n centerOffsetPx = vec2(c * centerOffsetPx.x - s * centerOffsetPx.y, s * centerOffsetPx.x + c * centerOffsetPx.y); \n v_centerPx = screenToPx(center.xy) + centerOffsetPx;\n${this.varyings_.map((function(t){return" "+t.name+" = "+t.expression+";"})).join("\n")}\n}`:null}getSymbolFragmentShader(){return this.hasSymbol_?`${s}\n${this.uniforms_.map((function(t){return"uniform "+t+";"})).join("\n")}\nvarying vec2 v_texCoord;\nvarying vec4 v_prop_hitColor;\nvarying vec2 v_centerPx;\nvarying float v_angle;\nvarying vec2 v_quadSizePx;\n${this.varyings_.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\n${this.fragmentShaderFunctions_.join("\n")}\n\nvoid main(void) {\n if (${this.discardExpression_}) { discard; }\n vec2 coordsPx = gl_FragCoord.xy / u_pixelRatio - v_centerPx; // relative to center\n float c = cos(v_angle);\n float s = sin(v_angle);\n coordsPx = vec2(c * coordsPx.x - s * coordsPx.y, s * coordsPx.x + c * coordsPx.y);\n gl_FragColor = ${this.symbolColorExpression_};\n if (u_hitDetection > 0) {\n if (gl_FragColor.a < 0.05) { discard; };\n gl_FragColor = v_prop_hitColor;\n }\n}`:null}getStrokeVertexShader(){return this.hasStroke_?`${s}\n${this.uniforms_.map((function(t){return"uniform "+t+";"})).join("\n")}\nattribute vec2 a_position;\nattribute float a_index;\nattribute vec2 a_segmentStart;\nattribute vec2 a_segmentEnd;\nattribute float a_parameters;\nattribute float a_distance;\nattribute vec2 a_joinAngles;\nattribute vec4 a_prop_hitColor;\n${this.attributes_.map((function(t){return"attribute "+t+";"})).join("\n")}\nvarying vec2 v_segmentStart;\nvarying vec2 v_segmentEnd;\nvarying float v_angleStart;\nvarying float v_angleEnd;\nvarying float v_width;\nvarying vec4 v_prop_hitColor;\nvarying float v_distanceOffsetPx;\n${this.varyings_.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\n${this.vertexShaderFunctions_.join("\n")}\nvec2 worldToPx(vec2 worldPos) {\n vec4 screenPos = u_projectionMatrix * vec4(worldPos, 0.0, 1.0);\n return (0.5 * screenPos.xy + 0.5) * u_viewportSizePx;\n}\n\nvec4 pxToScreen(vec2 pxPos) {\n vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;\n return vec4(screenPos, u_depth, 1.0);\n}\n\nbool isCap(float joinAngle) {\n return joinAngle < -0.1;\n}\n\nvec2 getJoinOffsetDirection(vec2 normalPx, float joinAngle) {\n float halfAngle = joinAngle / 2.0;\n float c = cos(halfAngle);\n float s = sin(halfAngle);\n vec2 angleBisectorNormal = vec2(s * normalPx.x + c * normalPx.y, -c * normalPx.x + s * normalPx.y);\n float length = 1.0 / s;\n return angleBisectorNormal * length;\n}\n\nvec2 getOffsetPoint(vec2 point, vec2 normal, float joinAngle, float offsetPx) {\n // if on a cap or the join angle is too high, offset the line along the segment normal\n if (cos(joinAngle) > 0.998 || isCap(joinAngle)) {\n return point - normal * offsetPx;\n }\n // offset is applied along the inverted normal (positive offset goes "right" relative to line direction)\n return point - getJoinOffsetDirection(normal, joinAngle) * offsetPx;\n}\n\nvoid main(void) {\n v_angleStart = a_joinAngles.x;\n v_angleEnd = a_joinAngles.y;\n float vertexNumber = floor(abs(a_parameters) / 10000. + 0.5);\n // we're reading the fractional part while keeping the sign (so -4.12 gives -0.12, 3.45 gives 0.45)\n float angleTangentSum = fract(abs(a_parameters) / 10000.) * 10000. * sign(a_parameters);\n\n float lineWidth = ${this.strokeWidthExpression_};\n float lineOffsetPx = ${this.strokeOffsetExpression_};\n\n // compute segment start/end in px with offset\n vec2 segmentStartPx = worldToPx(a_segmentStart);\n vec2 segmentEndPx = worldToPx(a_segmentEnd);\n vec2 tangentPx = normalize(segmentEndPx - segmentStartPx);\n vec2 normalPx = vec2(-tangentPx.y, tangentPx.x);\n segmentStartPx = getOffsetPoint(segmentStartPx, normalPx, v_angleStart, lineOffsetPx),\n segmentEndPx = getOffsetPoint(segmentEndPx, normalPx, v_angleEnd, lineOffsetPx);\n \n // compute current vertex position\n float normalDir = vertexNumber < 0.5 || (vertexNumber > 1.5 && vertexNumber < 2.5) ? 1.0 : -1.0;\n float tangentDir = vertexNumber < 1.5 ? 1.0 : -1.0;\n float angle = vertexNumber < 1.5 ? v_angleStart : v_angleEnd;\n vec2 joinDirection;\n vec2 positionPx = vertexNumber < 1.5 ? segmentStartPx : segmentEndPx;\n // if angle is too high, do not make a proper join\n if (cos(angle) > ${n.qS} || isCap(angle)) {\n joinDirection = normalPx * normalDir - tangentPx * tangentDir;\n } else {\n joinDirection = getJoinOffsetDirection(normalPx * normalDir, angle);\n }\n positionPx = positionPx + joinDirection * (lineWidth * 0.5 + 1.); // adding 1 pixel for antialiasing\n gl_Position = pxToScreen(positionPx);\n\n v_segmentStart = segmentStartPx;\n v_segmentEnd = segmentEndPx;\n v_width = lineWidth;\n v_prop_hitColor = a_prop_hitColor;\n v_distanceOffsetPx = a_distance / u_resolution - (lineOffsetPx * angleTangentSum);\n${this.varyings_.map((function(t){return" "+t.name+" = "+t.expression+";"})).join("\n")}\n}`:null}getStrokeFragmentShader(){return this.hasStroke_?`${s}\n${this.uniforms_.map((function(t){return"uniform "+t+";"})).join("\n")}\nvarying vec2 v_segmentStart;\nvarying vec2 v_segmentEnd;\nvarying float v_angleStart;\nvarying float v_angleEnd;\nvarying float v_width;\nvarying vec4 v_prop_hitColor;\nvarying float v_distanceOffsetPx;\n${this.varyings_.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\n${this.fragmentShaderFunctions_.join("\n")}\n\nvec2 pxToWorld(vec2 pxPos) {\n vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;\n return (u_screenToWorldMatrix * vec4(screenPos, 0.0, 1.0)).xy;\n}\n\nbool isCap(float joinAngle) {\n return joinAngle < -0.1;\n}\n\nfloat segmentDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n vec2 tangent = normalize(end - start);\n vec2 normal = vec2(-tangent.y, tangent.x);\n vec2 startToPoint = point - start;\n return abs(dot(startToPoint, normal)) - width * 0.5;\n}\n\nfloat buttCapDistanceField(vec2 point, vec2 start, vec2 end) {\n vec2 startToPoint = point - start;\n vec2 tangent = normalize(end - start);\n return dot(startToPoint, -tangent);\n}\n\nfloat squareCapDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n return buttCapDistanceField(point, start, end) - width * 0.5;\n}\n\nfloat roundCapDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n float onSegment = max(0., 1000. * dot(point - start, end - start)); // this is very high when inside the segment\n return length(point - start) - width * 0.5 - onSegment;\n}\n\nfloat roundJoinDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n return roundCapDistanceField(point, start, end, width);\n}\n\nfloat bevelJoinField(vec2 point, vec2 start, vec2 end, float width, float joinAngle) {\n vec2 startToPoint = point - start;\n vec2 tangent = normalize(end - start);\n float c = cos(joinAngle * 0.5);\n float s = sin(joinAngle * 0.5);\n float direction = -sign(sin(joinAngle));\n vec2 bisector = vec2(c * tangent.x - s * tangent.y, s * tangent.x + c * tangent.y);\n float radius = width * 0.5 * s;\n return dot(startToPoint, bisector * direction) - radius;\n}\n\nfloat miterJoinDistanceField(vec2 point, vec2 start, vec2 end, float width, float joinAngle) {\n if (cos(joinAngle) > ${n.qS}) { // avoid risking a division by zero\n return bevelJoinField(point, start, end, width, joinAngle);\n }\n float miterLength = 1. / sin(joinAngle * 0.5);\n float miterLimit = ${this.strokeMiterLimitExpression_};\n if (miterLength > miterLimit) {\n return bevelJoinField(point, start, end, width, joinAngle);\n }\n return -1000.;\n}\n\nfloat capDistanceField(vec2 point, vec2 start, vec2 end, float width, float capType) {\n if (capType == ${(0,r.Tl)("butt")}) {\n return buttCapDistanceField(point, start, end);\n } else if (capType == ${(0,r.Tl)("square")}) {\n return squareCapDistanceField(point, start, end, width);\n }\n return roundCapDistanceField(point, start, end, width);\n}\n\nfloat joinDistanceField(vec2 point, vec2 start, vec2 end, float width, float joinAngle, float joinType) {\n if (joinType == ${(0,r.Tl)("bevel")}) {\n return bevelJoinField(point, start, end, width, joinAngle);\n } else if (joinType == ${(0,r.Tl)("miter")}) {\n return miterJoinDistanceField(point, start, end, width, joinAngle);\n }\n return roundJoinDistanceField(point, start, end, width);\n}\n\nfloat computeSegmentPointDistance(vec2 point, vec2 start, vec2 end, float width, float joinAngle, float capType, float joinType) {\n if (isCap(joinAngle)) {\n return capDistanceField(point, start, end, width, capType);\n }\n return joinDistanceField(point, start, end, width, joinAngle, joinType);\n}\n\nvoid main(void) {\n vec2 currentPoint = gl_FragCoord.xy / u_pixelRatio;\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n vec2 worldPos = pxToWorld(currentPoint);\n if (\n abs(u_renderExtent[0] - u_renderExtent[2]) > 0.0 && (\n worldPos[0] < u_renderExtent[0] ||\n worldPos[1] < u_renderExtent[1] ||\n worldPos[0] > u_renderExtent[2] ||\n worldPos[1] > u_renderExtent[3]\n )\n ) {\n discard;\n }\n #endif\n if (${this.discardExpression_}) { discard; }\n\n float segmentLength = length(v_segmentEnd - v_segmentStart);\n vec2 segmentTangent = (v_segmentEnd - v_segmentStart) / segmentLength;\n vec2 segmentNormal = vec2(-segmentTangent.y, segmentTangent.x);\n vec2 startToPoint = currentPoint - v_segmentStart;\n float currentLengthPx = max(0., min(dot(segmentTangent, startToPoint), segmentLength)) + v_distanceOffsetPx; \n float currentRadiusPx = abs(dot(segmentNormal, startToPoint));\n float currentRadiusRatio = dot(segmentNormal, startToPoint) * 2. / v_width;\n vec4 color = ${this.strokeColorExpression_} * u_globalAlpha;\n float capType = ${this.strokeCapExpression_};\n float joinType = ${this.strokeJoinExpression_};\n float segmentStartDistance = computeSegmentPointDistance(currentPoint, v_segmentStart, v_segmentEnd, v_width, v_angleStart, capType, joinType);\n float segmentEndDistance = computeSegmentPointDistance(currentPoint, v_segmentEnd, v_segmentStart, v_width, v_angleEnd, capType, joinType);\n float distance = max(\n segmentDistanceField(currentPoint, v_segmentStart, v_segmentEnd, v_width),\n max(segmentStartDistance, segmentEndDistance)\n );\n distance = max(distance, ${this.strokeDistanceFieldExpression_});\n gl_FragColor = color * smoothstep(0.5, -0.5, distance);\n if (u_hitDetection > 0) {\n if (gl_FragColor.a < 0.1) { discard; };\n gl_FragColor = v_prop_hitColor;\n }\n}`:null}getFillVertexShader(){return this.hasFill_?`${s}\n${this.uniforms_.map((function(t){return"uniform "+t+";"})).join("\n")}\nattribute vec2 a_position;\nattribute vec4 a_prop_hitColor;\n${this.attributes_.map((function(t){return"attribute "+t+";"})).join("\n")}\nvarying vec4 v_prop_hitColor;\n${this.varyings_.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\n${this.vertexShaderFunctions_.join("\n")}\nvoid main(void) {\n gl_Position = u_projectionMatrix * vec4(a_position, u_depth, 1.0);\n v_prop_hitColor = a_prop_hitColor;\n${this.varyings_.map((function(t){return" "+t.name+" = "+t.expression+";"})).join("\n")}\n}`:null}getFillFragmentShader(){return this.hasFill_?`${s}\n${this.uniforms_.map((function(t){return"uniform "+t+";"})).join("\n")}\nvarying vec4 v_prop_hitColor;\n${this.varyings_.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\n${this.fragmentShaderFunctions_.join("\n")}\nvec2 pxToWorld(vec2 pxPos) {\n vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;\n return (u_screenToWorldMatrix * vec4(screenPos, 0.0, 1.0)).xy;\n}\n\nvec2 worldToPx(vec2 worldPos) {\n vec4 screenPos = u_projectionMatrix * vec4(worldPos, 0.0, 1.0);\n return (0.5 * screenPos.xy + 0.5) * u_viewportSizePx;\n}\n\nvoid main(void) {\n vec2 pxPos = gl_FragCoord.xy / u_pixelRatio;\n vec2 pxOrigin = worldToPx(u_patternOrigin);\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n vec2 worldPos = pxToWorld(pxPos);\n if (\n abs(u_renderExtent[0] - u_renderExtent[2]) > 0.0 && (\n worldPos[0] < u_renderExtent[0] ||\n worldPos[1] < u_renderExtent[1] ||\n worldPos[0] > u_renderExtent[2] ||\n worldPos[1] > u_renderExtent[3]\n )\n ) {\n discard;\n }\n #endif\n if (${this.discardExpression_}) { discard; }\n gl_FragColor = ${this.fillColorExpression_} * u_globalAlpha;\n if (u_hitDetection > 0) {\n if (gl_FragColor.a < 0.1) { discard; };\n gl_FragColor = v_prop_hitColor;\n }\n}`:null}}},3539:(t,e,i)=>{"use strict";i.d(e,{my:()=>_,s2:()=>a});var n=i(9837),r=i(2470),s=i(7016),o=i(8e3);function a(t,e,i){const r=(0,n.SR)();return r.style=t.style,(0,s.nR)(e,i,r,t)}function l(t){const e=(0,o._j)(t);return[256*e[0]+e[1],256*e[2]+Math.round(255*e[3])]}const h="vec4 unpackColor(vec2 packedColor) {\n return fract(packedColor[1] / 256.0) * vec4(\n fract(floor(packedColor[0] / 256.0) / 256.0),\n fract(packedColor[0] / 256.0),\n fract(floor(packedColor[1] / 256.0) / 256.0),\n 1.0\n );\n}";function c(t){return t===n.mE||t===n.qA?2:t===n.Fq?4:1}function u(t){const e=c(t);return e>1?`vec${e}`:"float"}function d(t){return(JSON.stringify(t).split("").reduce(((t,e)=>(t<<5)-t+e.charCodeAt(0)),0)>>>0).toString()}function g(t,e,i,r){if(`${r}radius`in t&&"icon-"!==r){let s=a(i,t[`${r}radius`],n.wl);`${r}radius2`in t&&(s=`max(${s}, ${a(i,t[`${r}radius2`],n.wl)})`),`${r}stroke-width`in t&&(s=`(${s} + ${a(i,t[`${r}stroke-width`],n.wl)} * 0.5)`),e.setSymbolSizeExpression(`vec2(${s} * 2. + 0.5)`)}if(`${r}scale`in t){const s=a(i,t[`${r}scale`],n.qA);e.setSymbolSizeExpression(`${e.getSymbolSizeExpression()} * ${s}`)}`${r}displacement`in t&&e.setSymbolOffsetExpression(a(i,t[`${r}displacement`],n.Fq)),`${r}rotation`in t&&e.setSymbolRotationExpression(a(i,t[`${r}rotation`],n.wl)),`${r}rotate-with-view`in t&&e.setSymbolRotateWithView(!!t[`${r}rotate-with-view`])}function f(t,e,i,n,r){let s="vec4(0.)";null!==e&&(s=e),null!==i&&null!==n&&(s=`mix(${i}, ${s}, smoothstep(-${n} + 0.63, -${n} - 0.58, ${t}))`);let o=`${s} * (1.0 - smoothstep(-0.63, 0.58, ${t}))`;return null!==r&&(o=`${o} * ${r}`),o}function p(t,e,i,n,r){const o=new Image;let a;return o.crossOrigin=void 0===t[`${n}cross-origin`]?"anonymous":t[`${n}cross-origin`],o.src=t[`${n}src`],o.complete&&o.width&&o.height?a=(0,s.ZB)([o.width,o.height]):(i[`u_texture${r}_size`]=()=>o.complete?[o.width,o.height]:[0,0],e.addUniform(`vec2 u_texture${r}_size`),a=`u_texture${r}_size`),i[`u_texture${r}`]=o,e.addUniform(`sampler2D u_texture${r}`),a}function m(t,e,i,r,s){let o=a(i,t[`${e}offset`],n.Fq);if(`${e}offset-origin`in t)switch(t[`${e}offset-origin`]){case"top-right":o=`vec2(${r}.x, 0.) + ${s} * vec2(-1., 0.) + ${o} * vec2(-1., 1.)`;break;case"bottom-left":o=`vec2(0., ${r}.y) + ${s} * vec2(0., -1.) + ${o} * vec2(1., -1.)`;break;case"bottom-right":o=`${r} - ${s} - ${o}`}return o}function _(t){const e={inFragmentShader:!1,properties:{},variables:{},functions:{},style:t},i={inFragmentShader:!0,variables:e.variables,properties:{},functions:{},style:t},_=new r.N,v={};if("icon-src"in t?function(t,e,i,r,s){let o="vec4(1.0)";"icon-color"in t&&(o=a(s,t["icon-color"],n.mE)),"icon-opacity"in t&&(o=`${o} * ${a(s,t["icon-opacity"],n.wl)}`);const l=d(t["icon-src"]),h=p(t,e,i,"icon-",l);if(e.setSymbolColorExpression(`${o} * samplePremultiplied(u_texture${l}, v_texCoord)`).setSymbolSizeExpression(h),"icon-width"in t&&"icon-height"in t&&e.setSymbolSizeExpression(`vec2(${a(r,t["icon-width"],n.wl)}, ${a(r,t["icon-height"],n.wl)})`),"icon-offset"in t&&"icon-size"in t){const i=a(r,t["icon-size"],n.Fq),s=e.getSymbolSizeExpression();e.setSymbolSizeExpression(i);const o=m(t,"icon-",r,"v_quadSizePx",i);e.setTextureCoordinateExpression(`(vec4((${o}).xyxy) + vec4(0., 0., ${i})) / (${s}).xyxy`)}if(g(t,e,r,"icon-"),"icon-anchor"in t){const i=a(r,t["icon-anchor"],n.Fq);let s,o="1.0";"icon-scale"in t&&(o=a(r,t["icon-scale"],n.qA)),s="pixels"===t["icon-anchor-x-units"]&&"pixels"===t["icon-anchor-y-units"]?`${i} * ${o}`:"pixels"===t["icon-anchor-x-units"]?`${i} * vec2(vec2(${o}).x, v_quadSizePx.y)`:"pixels"===t["icon-anchor-y-units"]?`${i} * vec2(v_quadSizePx.x, vec2(${o}).x)`:`${i} * v_quadSizePx`;let l=`v_quadSizePx * vec2(0.5, -0.5) + ${s} * vec2(-1., 1.)`;if("icon-anchor-origin"in t)switch(t["icon-anchor-origin"]){case"top-right":l=`v_quadSizePx * -0.5 + ${s}`;break;case"bottom-left":l=`v_quadSizePx * 0.5 - ${s}`;break;case"bottom-right":l=`v_quadSizePx * vec2(-0.5, 0.5) + ${s} * vec2(1., -1.)`}e.setSymbolOffsetExpression(`${e.getSymbolOffsetExpression()} + ${l}`)}}(t,_,v,e,i):"shape-points"in t?function(t,e,i,r,s){s.functions.round="float round(float v) {\n return sign(v) * floor(abs(v) + 0.5);\n}",s.functions.starDistanceField="float starDistanceField(vec2 point, float numPoints, float radius, float radius2, float angle) {\n float startAngle = -PI * 0.5 + angle; // tip starts upwards and rotates clockwise with angle\n float c = cos(startAngle);\n float s = sin(startAngle);\n vec2 pointRotated = vec2(c * point.x - s * point.y, s * point.x + c * point.y);\n float alpha = TWO_PI / numPoints; // the angle of one sector\n float beta = atan(pointRotated.y, pointRotated.x);\n float gamma = round(beta / alpha) * alpha; // angle in sector\n c = cos(-gamma);\n s = sin(-gamma);\n vec2 inSector = vec2(c * pointRotated.x - s * pointRotated.y, abs(s * pointRotated.x + c * pointRotated.y));\n vec2 tipToPoint = inSector + vec2(-radius, 0.);\n vec2 edgeNormal = vec2(radius2 * sin(alpha * 0.5), -radius2 * cos(alpha * 0.5) + radius);\n return dot(normalize(edgeNormal), tipToPoint);\n}",s.functions.regularDistanceField="float regularDistanceField(vec2 point, float numPoints, float radius, float angle) {\n float startAngle = -PI * 0.5 + angle; // tip starts upwards and rotates clockwise with angle\n float c = cos(startAngle);\n float s = sin(startAngle);\n vec2 pointRotated = vec2(c * point.x - s * point.y, s * point.x + c * point.y);\n float alpha = TWO_PI / numPoints; // the angle of one sector\n float radiusIn = radius * cos(PI / numPoints);\n float beta = atan(pointRotated.y, pointRotated.x);\n float gamma = round((beta - alpha * 0.5) / alpha) * alpha + alpha * 0.5; // angle in sector from mid\n c = cos(-gamma);\n s = sin(-gamma);\n vec2 inSector = vec2(c * pointRotated.x - s * pointRotated.y, abs(s * pointRotated.x + c * pointRotated.y));\n return inSector.x - radiusIn;\n}",g(t,e,r,"shape-");let o=null;"shape-opacity"in t&&(o=a(s,t["shape-opacity"],n.wl));let l="coordsPx";"shape-scale"in t&&(l=`coordsPx / ${a(s,t["shape-scale"],n.qA)}`);let h=null;"shape-fill-color"in t&&(h=a(s,t["shape-fill-color"],n.mE));let c=null;"shape-stroke-color"in t&&(c=a(s,t["shape-stroke-color"],n.mE));let u=null;"shape-stroke-width"in t&&(u=a(s,t["shape-stroke-width"],n.wl));const d=a(s,t["shape-points"],n.wl);let p,m="0.";"shape-angle"in t&&(m=a(s,t["shape-angle"],n.wl));let _=a(s,t["shape-radius"],n.wl);if(null!==u&&(_=`${_} + ${u} * 0.5`),"shape-radius2"in t){let e=a(s,t["shape-radius2"],n.wl);null!==u&&(e=`${e} + ${u} * 0.5`),p=`starDistanceField(${l}, ${d}, ${_}, ${e}, ${m})`}else p=`regularDistanceField(${l}, ${d}, ${_}, ${m})`;const v=f(p,h,c,u,o);e.setSymbolColorExpression(v)}(t,_,0,e,i):"circle-radius"in t&&function(t,e,i,r,s){s.functions.circleDistanceField="float circleDistanceField(vec2 point, float radius) {\n return length(point) - radius;\n}",g(t,e,r,"circle-");let o=null;"circle-opacity"in t&&(o=a(s,t["circle-opacity"],n.wl));let l="coordsPx";"circle-scale"in t&&(l=`coordsPx / ${a(s,t["circle-scale"],n.qA)}`);let h=null;"circle-fill-color"in t&&(h=a(s,t["circle-fill-color"],n.mE));let c=null;"circle-stroke-color"in t&&(c=a(s,t["circle-stroke-color"],n.mE));let u=a(s,t["circle-radius"],n.wl),d=null;"circle-stroke-width"in t&&(d=a(s,t["circle-stroke-width"],n.wl),u=`(${u} + ${d} * 0.5)`);const p=f(`circleDistanceField(${l}, ${u})`,h,c,d,o);e.setSymbolColorExpression(p)}(t,_,0,e,i),function(t,e,i,r,o){if("stroke-color"in t&&e.setStrokeColorExpression(a(o,t["stroke-color"],n.mE)),"stroke-pattern-src"in t){const r=d(t["stroke-pattern-src"]),s=p(t,e,i,"stroke-pattern-",r);let l=s,h="vec2(0.)";"stroke-pattern-offset"in t&&"stroke-pattern-size"in t&&(l=a(o,t["stroke-pattern-size"],n.Fq),h=m(t,"stroke-pattern-",o,s,l));let c="0.";"stroke-pattern-spacing"in t&&(c=a(o,t["stroke-pattern-spacing"],n.wl)),o.functions.sampleStrokePattern="vec4 sampleStrokePattern(sampler2D texture, vec2 textureSize, vec2 textureOffset, vec2 sampleSize, float spacingPx, float currentLengthPx, float currentRadiusRatio, float lineWidth) {\n float currentLengthScaled = currentLengthPx * sampleSize.y / lineWidth;\n float spacingScaled = spacingPx * sampleSize.y / lineWidth;\n float uCoordPx = mod(currentLengthScaled, (sampleSize.x + spacingScaled));\n // make sure that we're not sampling too close to the borders to avoid interpolation with outside pixels\n uCoordPx = clamp(uCoordPx, 0.5, sampleSize.x - 0.5);\n float vCoordPx = (-currentRadiusRatio * 0.5 + 0.5) * sampleSize.y;\n vec2 texCoord = (vec2(uCoordPx, vCoordPx) + textureOffset) / textureSize;\n return samplePremultiplied(texture, texCoord);\n}";const u=`u_texture${r}`;let g="1.";"stroke-color"in t&&(g=e.getStrokeColorExpression()),e.setStrokeColorExpression(`${g} * sampleStrokePattern(${u}, ${s}, ${h}, ${l}, ${c}, currentLengthPx, currentRadiusRatio, v_width)`)}if("stroke-width"in t&&e.setStrokeWidthExpression(a(r,t["stroke-width"],n.wl)),"stroke-offset"in t&&e.setStrokeOffsetExpression(a(r,t["stroke-offset"],n.wl)),"stroke-line-cap"in t&&e.setStrokeCapExpression(a(r,t["stroke-line-cap"],n.cT)),"stroke-line-join"in t&&e.setStrokeJoinExpression(a(r,t["stroke-line-join"],n.cT)),"stroke-miter-limit"in t&&e.setStrokeMiterLimitExpression(a(r,t["stroke-miter-limit"],n.wl)),"stroke-line-dash"in t){o.functions.getSingleDashDistance=`float getSingleDashDistance(float distance, float radius, float dashOffset, float dashLength, float dashLengthTotal, float capType) {\n float localDistance = mod(distance, dashLengthTotal);\n float distanceSegment = abs(localDistance - dashOffset - dashLength * 0.5) - dashLength * 0.5;\n distanceSegment = min(distanceSegment, dashLengthTotal - localDistance);\n if (capType == ${(0,s.Tl)("square")}) {\n distanceSegment -= v_width * 0.5;\n } else if (capType == ${(0,s.Tl)("round")}) {\n distanceSegment = min(distanceSegment, sqrt(distanceSegment * distanceSegment + radius * radius) - v_width * 0.5);\n }\n return distanceSegment;\n}`;let i=t["stroke-line-dash"].map((t=>a(o,t,n.wl)));i.length%2==1&&(i=[...i,...i]);let l="0.";"stroke-line-dash-offset"in t&&(l=a(r,t["stroke-line-dash-offset"],n.wl));const h=`dashDistanceField_${d(t["stroke-line-dash"])}`,c=i.map(((t,e)=>`float dashLength${e} = ${t};`)),u=i.map(((t,e)=>`dashLength${e}`)).join(" + ");let g="0.",f=`getSingleDashDistance(distance, radius, ${g}, dashLength0, totalDashLength, capType)`;for(let t=2;t(0,s.Lm)(t.variables[r.name]):r.type===n.mE?()=>l([...(0,o._j)(t.variables[r.name]||"#eee")]):r.type===n.T8?()=>t.variables[r.name]?1:0:()=>t.variables[r.name],v[a]=h})),Object.keys(i.properties).forEach((function(t){const r=i.properties[t];e.properties[t]||(e.properties[t]=r);let s=u(r.type),o=`a_prop_${r.name}`;r.type===n.mE&&(s="vec4",o=`unpackColor(${o})`,_.addVertexShaderFunction(h)),_.addVarying(`v_prop_${r.name}`,s,o)})),Object.keys(e.properties).forEach((function(t){const i=e.properties[t];_.addAttribute(`${u(i.type)} a_prop_${i.name}`)}));const y=Object.keys(e.properties).map((function(t){const i=e.properties[t];let r;return r=i.evaluator?i.evaluator:i.type===n.cT?t=>(0,s.Lm)(t.get(i.name)):i.type===n.mE?t=>l([...(0,o._j)(t.get(i.name)||"#eee")]):i.type===n.T8?t=>t.get(i.name)?1:0:t=>t.get(i.name),{name:i.name,size:c(i.type),callback:r}}));for(const t in e.functions)_.addVertexShaderFunction(e.functions[t]);for(const t in i.functions)_.addFragmentShaderFunction(i.functions[t]);return{builder:_,attributes:y.reduce(((t,e)=>({...t,[e.name]:{callback:e.callback,size:e.size}})),{}),uniforms:v}}},8330:t=>{"use strict";t.exports=JSON.parse('{"name":"ipyopenlayers","version":"0.1.0","description":"OpenLayers Jupyter Widget","keywords":["jupyter","jupyterlab","jupyterlab-extension","widgets"],"files":["lib/**/*.js","dist/*.js","css/*.css"],"homepage":"https://github.com/QuantStack/ipyopenlayers","bugs":{"url":"https://github.com/QuantStack/ipyopenlayers/issues"},"license":"BSD-3-Clause","author":{"name":"QuantStack","email":"me@me.com"},"main":"lib/index.js","types":"./lib/index.d.ts","repository":{"type":"git","url":"https://github.com/QuantStack/ipyopenlayers"},"scripts":{"build":"jlpm run build:lib && jlpm run build:nbextension && jlpm run build:labextension:dev","build:prod":"jlpm run build:lib && jlpm run build:nbextension && jlpm run build:labextension","build:labextension":"jupyter labextension build .","build:labextension:dev":"jupyter labextension build --development True .","build:lib":"tsc","build:nbextension":"webpack","clean":"jlpm run clean:lib && jlpm run clean:nbextension && jlpm run clean:labextension","clean:lib":"rimraf lib","clean:labextension":"rimraf ipyopenlayers/labextension","clean:nbextension":"rimraf ipyopenlayers/nbextension/static/index.js","lint":"eslint . --ext .ts,.tsx --fix","lint:check":"eslint . --ext .ts,.tsx","prepack":"jlpm run build:lib","test":"jest","watch":"npm-run-all -p watch:*","watch:lib":"tsc -w","watch:nbextension":"webpack --watch --mode=development","watch:labextension":"jupyter labextension watch ."},"dependencies":{"@jupyter-widgets/base":"^1.1.10 || ^2 || ^3 || ^4 || ^5 || ^6","ol":"^9.1.0"},"devDependencies":{"@babel/core":"^7.23.7","@babel/preset-env":"^7.23.8","@jupyter-widgets/base-manager":"^1.0.7","@jupyterlab/builder":"^4.0.11","@lumino/application":"^2.3.0","@lumino/widgets":"^2.3.1","@types/jest":"^29.5.11","@types/webpack-env":"^1.18.4","@typescript-eslint/eslint-plugin":"^6.19.1","@typescript-eslint/parser":"^6.19.1","acorn":"^8.11.3","css-loader":"^7.1.2","eslint":"^8.56.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.1.3","fs-extra":"^11.2.0","identity-obj-proxy":"^3.0.0","jest":"^29.7.0","mkdirp":"^3.0.1","npm-run-all":"^4.1.5","prettier":"^3.2.4","rimraf":"^5.0.5","source-map-loader":"^5.0.0","style-loader":"^4.0.0","ts-jest":"^29.1.2","ts-loader":"^9.5.1","typescript":"~5.3.3","webpack":"^5.93.0","webpack-cli":"^5.1.4"},"devDependenciesComments":{"@jupyterlab/builder":"pinned to the latest JupyterLab 3.x release","@lumino/application":"pinned to the latest Lumino 1.x release","@lumino/widgets":"pinned to the latest Lumino 1.x release"},"jupyterlab":{"extension":"lib/plugin","outputDir":"ipyopenlayers/labextension/","sharedPackages":{"@jupyter-widgets/base":{"bundled":false,"singleton":true}}}}')}},r={};function s(t){var e=r[t];if(void 0!==e)return e.exports;var i=r[t]={id:t,exports:{}};return n[t].call(i.exports,i,i.exports,s),i.exports}return s.m=n,s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.f={},s.e=t=>Promise.all(Object.keys(s.f).reduce(((e,i)=>(s.f[i](t,e),e)),[])),s.u=t=>t+".embed-bundle.js",s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),e={},i="ipyopenlayers:",s.l=(t,n,r,o)=>{if(e[t])e[t].push(n);else{var a,l;if(void 0!==r)for(var h=document.getElementsByTagName("script"),c=0;c{a.onerror=a.onload=null,clearTimeout(g);var r=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),r&&r.forEach((t=>t(n))),i)return i(n)},g=setTimeout(d.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=d.bind(null,a.onerror),a.onload=d.bind(null,a.onload),l&&document.head.appendChild(a)}},s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;s.g.importScripts&&(t=s.g.location+"");var e=s.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var i=e.getElementsByTagName("script");if(i.length)for(var n=i.length-1;n>-1&&(!t||!/^http(s?):/.test(t));)t=i[n--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s.p=t})(),(()=>{var t={792:0};s.f.j=(e,i)=>{var n=s.o(t,e)?t[e]:void 0;if(0!==n)if(n)i.push(n[2]);else{var r=new Promise(((i,r)=>n=t[e]=[i,r]));i.push(n[2]=r);var o=s.p+s.u(e),a=new Error;s.l(o,(i=>{if(s.o(t,e)&&(0!==(n=t[e])&&(t[e]=void 0),n)){var r=i&&("load"===i.type?"missing":i.type),o=i&&i.target&&i.target.src;a.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",a.name="ChunkLoadError",a.type=r,a.request=o,n[1](a)}}),"chunk-"+e,e)}};var e=(e,i)=>{var n,r,[o,a,l]=i,h=0;if(o.some((e=>0!==t[e]))){for(n in a)s.o(a,n)&&(s.m[n]=a[n]);l&&l(s)}for(e&&e(i);h {\n\tif(inProgress[url]) { inProgress[url].push(done); return; }\n\tvar script, needAttach;\n\tif(key !== undefined) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tfor(var i = 0; i < scripts.length; i++) {\n\t\t\tvar s = scripts[i];\n\t\t\tif(s.getAttribute(\"src\") == url || s.getAttribute(\"data-webpack\") == dataWebpackPrefix + key) { script = s; break; }\n\t\t}\n\t}\n\tif(!script) {\n\t\tneedAttach = true;\n\t\tscript = document.createElement('script');\n\n\t\tscript.charset = 'utf-8';\n\t\tscript.timeout = 120;\n\t\tif (__webpack_require__.nc) {\n\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n\t\t}\n\t\tscript.setAttribute(\"data-webpack\", dataWebpackPrefix + key);\n\n\t\tscript.src = url;\n\t}\n\tinProgress[url] = [done];\n\tvar onScriptComplete = (prev, event) => {\n\t\t// avoid mem leaks in IE.\n\t\tscript.onerror = script.onload = null;\n\t\tclearTimeout(timeout);\n\t\tvar doneFns = inProgress[url];\n\t\tdelete inProgress[url];\n\t\tscript.parentNode && script.parentNode.removeChild(script);\n\t\tdoneFns && doneFns.forEach((fn) => (fn(event)));\n\t\tif(prev) return prev(event);\n\t}\n\tvar timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);\n\tscript.onerror = onScriptComplete.bind(null, script.onerror);\n\tscript.onload = onScriptComplete.bind(null, script.onload);\n\tneedAttach && document.head.appendChild(script);\n};","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../node_modules/css-loader/dist/runtime/sourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `.lm-Widget.lm-Panel.jp-OutputArea-output.ipyopenlayer-map-container-wrapper {\n height: 100%;\n}\n.lm-Widget.lm-Panel.jp-OutputArea-child.jp-OutputArea-executeResult.ipyopenlayer-map-container-wrapper-parent {\n height: 100%;\n}\n\n.ol-container {\n height: 100%;\n width: 100%;\n}\n.jp-LinkedOutputView .jupyter-widgets.ipyopenlayer-widgets {\n min-height: 500px;\n height: 100%;\n}\n\n.jupyter-widgets.ipyopenlayer-widgets {\n height: 400px;\n overflow: hidden;\n flex: 1 1 auto;\n}\n`, \"\",{\"version\":3,\"sources\":[\"webpack://./css/widget.css\"],\"names\":[],\"mappings\":\"AAAA;EACE,YAAY;AACd;AACA;EACE,YAAY;AACd;;AAEA;EACE,YAAY;EACZ,WAAW;AACb;AACA;EACE,iBAAiB;EACjB,YAAY;AACd;;AAEA;EACE,aAAa;EACb,gBAAgB;EAChB,cAAc;AAChB\",\"sourcesContent\":[\".lm-Widget.lm-Panel.jp-OutputArea-output.ipyopenlayer-map-container-wrapper {\\n height: 100%;\\n}\\n.lm-Widget.lm-Panel.jp-OutputArea-child.jp-OutputArea-executeResult.ipyopenlayer-map-container-wrapper-parent {\\n height: 100%;\\n}\\n\\n.ol-container {\\n height: 100%;\\n width: 100%;\\n}\\n.jp-LinkedOutputView .jupyter-widgets.ipyopenlayer-widgets {\\n min-height: 500px;\\n height: 100%;\\n}\\n\\n.jupyter-widgets.ipyopenlayer-widgets {\\n height: 400px;\\n overflow: hidden;\\n flex: 1 1 auto;\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../css-loader/dist/runtime/sourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `:root,\n:host {\n --ol-background-color: white;\n --ol-accent-background-color: #F5F5F5;\n --ol-subtle-background-color: rgba(128, 128, 128, 0.25);\n --ol-partial-background-color: rgba(255, 255, 255, 0.75);\n --ol-foreground-color: #333333;\n --ol-subtle-foreground-color: #666666;\n --ol-brand-color: #00AAFF;\n}\n\n.ol-box {\n box-sizing: border-box;\n border-radius: 2px;\n border: 1.5px solid var(--ol-background-color);\n background-color: var(--ol-partial-background-color);\n}\n\n.ol-mouse-position {\n top: 8px;\n right: 8px;\n position: absolute;\n}\n\n.ol-scale-line {\n background: var(--ol-partial-background-color);\n border-radius: 4px;\n bottom: 8px;\n left: 8px;\n padding: 2px;\n position: absolute;\n}\n\n.ol-scale-line-inner {\n border: 1px solid var(--ol-subtle-foreground-color);\n border-top: none;\n color: var(--ol-foreground-color);\n font-size: 10px;\n text-align: center;\n margin: 1px;\n will-change: contents, width;\n transition: all 0.25s;\n}\n\n.ol-scale-bar {\n position: absolute;\n bottom: 8px;\n left: 8px;\n}\n\n.ol-scale-bar-inner {\n display: flex;\n}\n\n.ol-scale-step-marker {\n width: 1px;\n height: 15px;\n background-color: var(--ol-foreground-color);\n float: right;\n z-index: 10;\n}\n\n.ol-scale-step-text {\n position: absolute;\n bottom: -5px;\n font-size: 10px;\n z-index: 11;\n color: var(--ol-foreground-color);\n text-shadow: -1.5px 0 var(--ol-partial-background-color), 0 1.5px var(--ol-partial-background-color), 1.5px 0 var(--ol-partial-background-color), 0 -1.5px var(--ol-partial-background-color);\n}\n\n.ol-scale-text {\n position: absolute;\n font-size: 12px;\n text-align: center;\n bottom: 25px;\n color: var(--ol-foreground-color);\n text-shadow: -1.5px 0 var(--ol-partial-background-color), 0 1.5px var(--ol-partial-background-color), 1.5px 0 var(--ol-partial-background-color), 0 -1.5px var(--ol-partial-background-color);\n}\n\n.ol-scale-singlebar {\n position: relative;\n height: 10px;\n z-index: 9;\n box-sizing: border-box;\n border: 1px solid var(--ol-foreground-color);\n}\n\n.ol-scale-singlebar-even {\n background-color: var(--ol-subtle-foreground-color);\n}\n\n.ol-scale-singlebar-odd {\n background-color: var(--ol-background-color);\n}\n\n.ol-unsupported {\n display: none;\n}\n\n.ol-viewport,\n.ol-unselectable {\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n.ol-viewport canvas {\n all: unset;\n overflow: hidden;\n}\n\n.ol-viewport {\n touch-action: pan-x pan-y;\n}\n\n.ol-selectable {\n -webkit-touch-callout: default;\n -webkit-user-select: text;\n -moz-user-select: text;\n user-select: text;\n}\n\n.ol-grabbing {\n cursor: -webkit-grabbing;\n cursor: -moz-grabbing;\n cursor: grabbing;\n}\n\n.ol-grab {\n cursor: move;\n cursor: -webkit-grab;\n cursor: -moz-grab;\n cursor: grab;\n}\n\n.ol-control {\n position: absolute;\n background-color: var(--ol-subtle-background-color);\n border-radius: 4px;\n}\n\n.ol-zoom {\n top: .5em;\n left: .5em;\n}\n\n.ol-rotate {\n top: .5em;\n right: .5em;\n transition: opacity .25s linear, visibility 0s linear;\n}\n\n.ol-rotate.ol-hidden {\n opacity: 0;\n visibility: hidden;\n transition: opacity .25s linear, visibility 0s linear .25s;\n}\n\n.ol-zoom-extent {\n top: 4.643em;\n left: .5em;\n}\n\n.ol-full-screen {\n right: .5em;\n top: .5em;\n}\n\n.ol-control button {\n display: block;\n margin: 1px;\n padding: 0;\n color: var(--ol-subtle-foreground-color);\n font-weight: bold;\n text-decoration: none;\n font-size: inherit;\n text-align: center;\n height: 1.375em;\n width: 1.375em;\n line-height: .4em;\n background-color: var(--ol-background-color);\n border: none;\n border-radius: 2px;\n}\n\n.ol-control button::-moz-focus-inner {\n border: none;\n padding: 0;\n}\n\n.ol-zoom-extent button {\n line-height: 1.4em;\n}\n\n.ol-compass {\n display: block;\n font-weight: normal;\n will-change: transform;\n}\n\n.ol-touch .ol-control button {\n font-size: 1.5em;\n}\n\n.ol-touch .ol-zoom-extent {\n top: 5.5em;\n}\n\n.ol-control button:hover,\n.ol-control button:focus {\n text-decoration: none;\n outline: 1px solid var(--ol-subtle-foreground-color);\n color: var(--ol-foreground-color);\n}\n\n.ol-zoom .ol-zoom-in {\n border-radius: 2px 2px 0 0;\n}\n\n.ol-zoom .ol-zoom-out {\n border-radius: 0 0 2px 2px;\n}\n\n.ol-attribution {\n text-align: right;\n bottom: .5em;\n right: .5em;\n max-width: calc(100% - 1.3em);\n display: flex;\n flex-flow: row-reverse;\n align-items: center;\n}\n\n.ol-attribution a {\n color: var(--ol-subtle-foreground-color);\n text-decoration: none;\n}\n\n.ol-attribution ul {\n margin: 0;\n padding: 1px .5em;\n color: var(--ol-foreground-color);\n text-shadow: 0 0 2px var(--ol-background-color);\n font-size: 12px;\n}\n\n.ol-attribution li {\n display: inline;\n list-style: none;\n}\n\n.ol-attribution li:not(:last-child):after {\n content: \" \";\n}\n\n.ol-attribution img {\n max-height: 2em;\n max-width: inherit;\n vertical-align: middle;\n}\n\n.ol-attribution button {\n flex-shrink: 0;\n}\n\n.ol-attribution.ol-collapsed ul {\n display: none;\n}\n\n.ol-attribution:not(.ol-collapsed) {\n background: var(--ol-partial-background-color);\n}\n\n.ol-attribution.ol-uncollapsible {\n bottom: 0;\n right: 0;\n border-radius: 4px 0 0;\n}\n\n.ol-attribution.ol-uncollapsible img {\n margin-top: -.2em;\n max-height: 1.6em;\n}\n\n.ol-attribution.ol-uncollapsible button {\n display: none;\n}\n\n.ol-zoomslider {\n top: 4.5em;\n left: .5em;\n height: 200px;\n}\n\n.ol-zoomslider button {\n position: relative;\n height: 10px;\n}\n\n.ol-touch .ol-zoomslider {\n top: 5.5em;\n}\n\n.ol-overviewmap {\n left: 0.5em;\n bottom: 0.5em;\n}\n\n.ol-overviewmap.ol-uncollapsible {\n bottom: 0;\n left: 0;\n border-radius: 0 4px 0 0;\n}\n\n.ol-overviewmap .ol-overviewmap-map,\n.ol-overviewmap button {\n display: block;\n}\n\n.ol-overviewmap .ol-overviewmap-map {\n border: 1px solid var(--ol-subtle-foreground-color);\n height: 150px;\n width: 150px;\n}\n\n.ol-overviewmap:not(.ol-collapsed) button {\n bottom: 0;\n left: 0;\n position: absolute;\n}\n\n.ol-overviewmap.ol-collapsed .ol-overviewmap-map,\n.ol-overviewmap.ol-uncollapsible button {\n display: none;\n}\n\n.ol-overviewmap:not(.ol-collapsed) {\n background: var(--ol-subtle-background-color);\n}\n\n.ol-overviewmap-box {\n border: 1.5px dotted var(--ol-subtle-foreground-color);\n}\n\n.ol-overviewmap .ol-overviewmap-box:hover {\n cursor: move;\n}\n`, \"\",{\"version\":3,\"sources\":[\"webpack://./node_modules/ol/ol.css\"],\"names\":[],\"mappings\":\"AAAA;;EAEE,4BAA4B;EAC5B,qCAAqC;EACrC,uDAAuD;EACvD,wDAAwD;EACxD,8BAA8B;EAC9B,qCAAqC;EACrC,yBAAyB;AAC3B;;AAEA;EACE,sBAAsB;EACtB,kBAAkB;EAClB,8CAA8C;EAC9C,oDAAoD;AACtD;;AAEA;EACE,QAAQ;EACR,UAAU;EACV,kBAAkB;AACpB;;AAEA;EACE,8CAA8C;EAC9C,kBAAkB;EAClB,WAAW;EACX,SAAS;EACT,YAAY;EACZ,kBAAkB;AACpB;;AAEA;EACE,mDAAmD;EACnD,gBAAgB;EAChB,iCAAiC;EACjC,eAAe;EACf,kBAAkB;EAClB,WAAW;EACX,4BAA4B;EAC5B,qBAAqB;AACvB;;AAEA;EACE,kBAAkB;EAClB,WAAW;EACX,SAAS;AACX;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,UAAU;EACV,YAAY;EACZ,4CAA4C;EAC5C,YAAY;EACZ,WAAW;AACb;;AAEA;EACE,kBAAkB;EAClB,YAAY;EACZ,eAAe;EACf,WAAW;EACX,iCAAiC;EACjC,6LAA6L;AAC/L;;AAEA;EACE,kBAAkB;EAClB,eAAe;EACf,kBAAkB;EAClB,YAAY;EACZ,iCAAiC;EACjC,6LAA6L;AAC/L;;AAEA;EACE,kBAAkB;EAClB,YAAY;EACZ,UAAU;EACV,sBAAsB;EACtB,4CAA4C;AAC9C;;AAEA;EACE,mDAAmD;AACrD;;AAEA;EACE,4CAA4C;AAC9C;;AAEA;EACE,aAAa;AACf;;AAEA;;EAEE,2BAA2B;EAC3B,yBAAyB;EACzB,sBAAsB;EACtB,iBAAiB;EACjB,wCAAwC;AAC1C;;AAEA;EACE,UAAU;EACV,gBAAgB;AAClB;;AAEA;EACE,yBAAyB;AAC3B;;AAEA;EACE,8BAA8B;EAC9B,yBAAyB;EACzB,sBAAsB;EACtB,iBAAiB;AACnB;;AAEA;EACE,wBAAwB;EACxB,qBAAqB;EACrB,gBAAgB;AAClB;;AAEA;EACE,YAAY;EACZ,oBAAoB;EACpB,iBAAiB;EACjB,YAAY;AACd;;AAEA;EACE,kBAAkB;EAClB,mDAAmD;EACnD,kBAAkB;AACpB;;AAEA;EACE,SAAS;EACT,UAAU;AACZ;;AAEA;EACE,SAAS;EACT,WAAW;EACX,qDAAqD;AACvD;;AAEA;EACE,UAAU;EACV,kBAAkB;EAClB,0DAA0D;AAC5D;;AAEA;EACE,YAAY;EACZ,UAAU;AACZ;;AAEA;EACE,WAAW;EACX,SAAS;AACX;;AAEA;EACE,cAAc;EACd,WAAW;EACX,UAAU;EACV,wCAAwC;EACxC,iBAAiB;EACjB,qBAAqB;EACrB,kBAAkB;EAClB,kBAAkB;EAClB,eAAe;EACf,cAAc;EACd,iBAAiB;EACjB,4CAA4C;EAC5C,YAAY;EACZ,kBAAkB;AACpB;;AAEA;EACE,YAAY;EACZ,UAAU;AACZ;;AAEA;EACE,kBAAkB;AACpB;;AAEA;EACE,cAAc;EACd,mBAAmB;EACnB,sBAAsB;AACxB;;AAEA;EACE,gBAAgB;AAClB;;AAEA;EACE,UAAU;AACZ;;AAEA;;EAEE,qBAAqB;EACrB,oDAAoD;EACpD,iCAAiC;AACnC;;AAEA;EACE,0BAA0B;AAC5B;;AAEA;EACE,0BAA0B;AAC5B;;AAEA;EACE,iBAAiB;EACjB,YAAY;EACZ,WAAW;EACX,6BAA6B;EAC7B,aAAa;EACb,sBAAsB;EACtB,mBAAmB;AACrB;;AAEA;EACE,wCAAwC;EACxC,qBAAqB;AACvB;;AAEA;EACE,SAAS;EACT,iBAAiB;EACjB,iCAAiC;EACjC,+CAA+C;EAC/C,eAAe;AACjB;;AAEA;EACE,eAAe;EACf,gBAAgB;AAClB;;AAEA;EACE,YAAY;AACd;;AAEA;EACE,eAAe;EACf,kBAAkB;EAClB,sBAAsB;AACxB;;AAEA;EACE,cAAc;AAChB;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,8CAA8C;AAChD;;AAEA;EACE,SAAS;EACT,QAAQ;EACR,sBAAsB;AACxB;;AAEA;EACE,iBAAiB;EACjB,iBAAiB;AACnB;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,UAAU;EACV,UAAU;EACV,aAAa;AACf;;AAEA;EACE,kBAAkB;EAClB,YAAY;AACd;;AAEA;EACE,UAAU;AACZ;;AAEA;EACE,WAAW;EACX,aAAa;AACf;;AAEA;EACE,SAAS;EACT,OAAO;EACP,wBAAwB;AAC1B;;AAEA;;EAEE,cAAc;AAChB;;AAEA;EACE,mDAAmD;EACnD,aAAa;EACb,YAAY;AACd;;AAEA;EACE,SAAS;EACT,OAAO;EACP,kBAAkB;AACpB;;AAEA;;EAEE,aAAa;AACf;;AAEA;EACE,6CAA6C;AAC/C;;AAEA;EACE,sDAAsD;AACxD;;AAEA;EACE,YAAY;AACd\",\"sourcesContent\":[\":root,\\n:host {\\n --ol-background-color: white;\\n --ol-accent-background-color: #F5F5F5;\\n --ol-subtle-background-color: rgba(128, 128, 128, 0.25);\\n --ol-partial-background-color: rgba(255, 255, 255, 0.75);\\n --ol-foreground-color: #333333;\\n --ol-subtle-foreground-color: #666666;\\n --ol-brand-color: #00AAFF;\\n}\\n\\n.ol-box {\\n box-sizing: border-box;\\n border-radius: 2px;\\n border: 1.5px solid var(--ol-background-color);\\n background-color: var(--ol-partial-background-color);\\n}\\n\\n.ol-mouse-position {\\n top: 8px;\\n right: 8px;\\n position: absolute;\\n}\\n\\n.ol-scale-line {\\n background: var(--ol-partial-background-color);\\n border-radius: 4px;\\n bottom: 8px;\\n left: 8px;\\n padding: 2px;\\n position: absolute;\\n}\\n\\n.ol-scale-line-inner {\\n border: 1px solid var(--ol-subtle-foreground-color);\\n border-top: none;\\n color: var(--ol-foreground-color);\\n font-size: 10px;\\n text-align: center;\\n margin: 1px;\\n will-change: contents, width;\\n transition: all 0.25s;\\n}\\n\\n.ol-scale-bar {\\n position: absolute;\\n bottom: 8px;\\n left: 8px;\\n}\\n\\n.ol-scale-bar-inner {\\n display: flex;\\n}\\n\\n.ol-scale-step-marker {\\n width: 1px;\\n height: 15px;\\n background-color: var(--ol-foreground-color);\\n float: right;\\n z-index: 10;\\n}\\n\\n.ol-scale-step-text {\\n position: absolute;\\n bottom: -5px;\\n font-size: 10px;\\n z-index: 11;\\n color: var(--ol-foreground-color);\\n text-shadow: -1.5px 0 var(--ol-partial-background-color), 0 1.5px var(--ol-partial-background-color), 1.5px 0 var(--ol-partial-background-color), 0 -1.5px var(--ol-partial-background-color);\\n}\\n\\n.ol-scale-text {\\n position: absolute;\\n font-size: 12px;\\n text-align: center;\\n bottom: 25px;\\n color: var(--ol-foreground-color);\\n text-shadow: -1.5px 0 var(--ol-partial-background-color), 0 1.5px var(--ol-partial-background-color), 1.5px 0 var(--ol-partial-background-color), 0 -1.5px var(--ol-partial-background-color);\\n}\\n\\n.ol-scale-singlebar {\\n position: relative;\\n height: 10px;\\n z-index: 9;\\n box-sizing: border-box;\\n border: 1px solid var(--ol-foreground-color);\\n}\\n\\n.ol-scale-singlebar-even {\\n background-color: var(--ol-subtle-foreground-color);\\n}\\n\\n.ol-scale-singlebar-odd {\\n background-color: var(--ol-background-color);\\n}\\n\\n.ol-unsupported {\\n display: none;\\n}\\n\\n.ol-viewport,\\n.ol-unselectable {\\n -webkit-touch-callout: none;\\n -webkit-user-select: none;\\n -moz-user-select: none;\\n user-select: none;\\n -webkit-tap-highlight-color: transparent;\\n}\\n\\n.ol-viewport canvas {\\n all: unset;\\n overflow: hidden;\\n}\\n\\n.ol-viewport {\\n touch-action: pan-x pan-y;\\n}\\n\\n.ol-selectable {\\n -webkit-touch-callout: default;\\n -webkit-user-select: text;\\n -moz-user-select: text;\\n user-select: text;\\n}\\n\\n.ol-grabbing {\\n cursor: -webkit-grabbing;\\n cursor: -moz-grabbing;\\n cursor: grabbing;\\n}\\n\\n.ol-grab {\\n cursor: move;\\n cursor: -webkit-grab;\\n cursor: -moz-grab;\\n cursor: grab;\\n}\\n\\n.ol-control {\\n position: absolute;\\n background-color: var(--ol-subtle-background-color);\\n border-radius: 4px;\\n}\\n\\n.ol-zoom {\\n top: .5em;\\n left: .5em;\\n}\\n\\n.ol-rotate {\\n top: .5em;\\n right: .5em;\\n transition: opacity .25s linear, visibility 0s linear;\\n}\\n\\n.ol-rotate.ol-hidden {\\n opacity: 0;\\n visibility: hidden;\\n transition: opacity .25s linear, visibility 0s linear .25s;\\n}\\n\\n.ol-zoom-extent {\\n top: 4.643em;\\n left: .5em;\\n}\\n\\n.ol-full-screen {\\n right: .5em;\\n top: .5em;\\n}\\n\\n.ol-control button {\\n display: block;\\n margin: 1px;\\n padding: 0;\\n color: var(--ol-subtle-foreground-color);\\n font-weight: bold;\\n text-decoration: none;\\n font-size: inherit;\\n text-align: center;\\n height: 1.375em;\\n width: 1.375em;\\n line-height: .4em;\\n background-color: var(--ol-background-color);\\n border: none;\\n border-radius: 2px;\\n}\\n\\n.ol-control button::-moz-focus-inner {\\n border: none;\\n padding: 0;\\n}\\n\\n.ol-zoom-extent button {\\n line-height: 1.4em;\\n}\\n\\n.ol-compass {\\n display: block;\\n font-weight: normal;\\n will-change: transform;\\n}\\n\\n.ol-touch .ol-control button {\\n font-size: 1.5em;\\n}\\n\\n.ol-touch .ol-zoom-extent {\\n top: 5.5em;\\n}\\n\\n.ol-control button:hover,\\n.ol-control button:focus {\\n text-decoration: none;\\n outline: 1px solid var(--ol-subtle-foreground-color);\\n color: var(--ol-foreground-color);\\n}\\n\\n.ol-zoom .ol-zoom-in {\\n border-radius: 2px 2px 0 0;\\n}\\n\\n.ol-zoom .ol-zoom-out {\\n border-radius: 0 0 2px 2px;\\n}\\n\\n.ol-attribution {\\n text-align: right;\\n bottom: .5em;\\n right: .5em;\\n max-width: calc(100% - 1.3em);\\n display: flex;\\n flex-flow: row-reverse;\\n align-items: center;\\n}\\n\\n.ol-attribution a {\\n color: var(--ol-subtle-foreground-color);\\n text-decoration: none;\\n}\\n\\n.ol-attribution ul {\\n margin: 0;\\n padding: 1px .5em;\\n color: var(--ol-foreground-color);\\n text-shadow: 0 0 2px var(--ol-background-color);\\n font-size: 12px;\\n}\\n\\n.ol-attribution li {\\n display: inline;\\n list-style: none;\\n}\\n\\n.ol-attribution li:not(:last-child):after {\\n content: \\\" \\\";\\n}\\n\\n.ol-attribution img {\\n max-height: 2em;\\n max-width: inherit;\\n vertical-align: middle;\\n}\\n\\n.ol-attribution button {\\n flex-shrink: 0;\\n}\\n\\n.ol-attribution.ol-collapsed ul {\\n display: none;\\n}\\n\\n.ol-attribution:not(.ol-collapsed) {\\n background: var(--ol-partial-background-color);\\n}\\n\\n.ol-attribution.ol-uncollapsible {\\n bottom: 0;\\n right: 0;\\n border-radius: 4px 0 0;\\n}\\n\\n.ol-attribution.ol-uncollapsible img {\\n margin-top: -.2em;\\n max-height: 1.6em;\\n}\\n\\n.ol-attribution.ol-uncollapsible button {\\n display: none;\\n}\\n\\n.ol-zoomslider {\\n top: 4.5em;\\n left: .5em;\\n height: 200px;\\n}\\n\\n.ol-zoomslider button {\\n position: relative;\\n height: 10px;\\n}\\n\\n.ol-touch .ol-zoomslider {\\n top: 5.5em;\\n}\\n\\n.ol-overviewmap {\\n left: 0.5em;\\n bottom: 0.5em;\\n}\\n\\n.ol-overviewmap.ol-uncollapsible {\\n bottom: 0;\\n left: 0;\\n border-radius: 0 4px 0 0;\\n}\\n\\n.ol-overviewmap .ol-overviewmap-map,\\n.ol-overviewmap button {\\n display: block;\\n}\\n\\n.ol-overviewmap .ol-overviewmap-map {\\n border: 1px solid var(--ol-subtle-foreground-color);\\n height: 150px;\\n width: 150px;\\n}\\n\\n.ol-overviewmap:not(.ol-collapsed) button {\\n bottom: 0;\\n left: 0;\\n position: absolute;\\n}\\n\\n.ol-overviewmap.ol-collapsed .ol-overviewmap-map,\\n.ol-overviewmap.ol-uncollapsible button {\\n display: none;\\n}\\n\\n.ol-overviewmap:not(.ol-collapsed) {\\n background: var(--ol-subtle-background-color);\\n}\\n\\n.ol-overviewmap-box {\\n border: 1.5px dotted var(--ol-subtle-foreground-color);\\n}\\n\\n.ol-overviewmap .ol-overviewmap-box:hover {\\n cursor: move;\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","\"use strict\";\n\n/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\nmodule.exports = function (cssWithMappingToString) {\n var list = [];\n\n // return the list of modules as css string\n list.toString = function toString() {\n return this.map(function (item) {\n var content = \"\";\n var needLayer = typeof item[5] !== \"undefined\";\n if (item[4]) {\n content += \"@supports (\".concat(item[4], \") {\");\n }\n if (item[2]) {\n content += \"@media \".concat(item[2], \" {\");\n }\n if (needLayer) {\n content += \"@layer\".concat(item[5].length > 0 ? \" \".concat(item[5]) : \"\", \" {\");\n }\n content += cssWithMappingToString(item);\n if (needLayer) {\n content += \"}\";\n }\n if (item[2]) {\n content += \"}\";\n }\n if (item[4]) {\n content += \"}\";\n }\n return content;\n }).join(\"\");\n };\n\n // import a list of modules into the list\n list.i = function i(modules, media, dedupe, supports, layer) {\n if (typeof modules === \"string\") {\n modules = [[null, modules, undefined]];\n }\n var alreadyImportedModules = {};\n if (dedupe) {\n for (var k = 0; k < this.length; k++) {\n var id = this[k][0];\n if (id != null) {\n alreadyImportedModules[id] = true;\n }\n }\n }\n for (var _k = 0; _k < modules.length; _k++) {\n var item = [].concat(modules[_k]);\n if (dedupe && alreadyImportedModules[item[0]]) {\n continue;\n }\n if (typeof layer !== \"undefined\") {\n if (typeof item[5] === \"undefined\") {\n item[5] = layer;\n } else {\n item[1] = \"@layer\".concat(item[5].length > 0 ? \" \".concat(item[5]) : \"\", \" {\").concat(item[1], \"}\");\n item[5] = layer;\n }\n }\n if (media) {\n if (!item[2]) {\n item[2] = media;\n } else {\n item[1] = \"@media \".concat(item[2], \" {\").concat(item[1], \"}\");\n item[2] = media;\n }\n }\n if (supports) {\n if (!item[4]) {\n item[4] = \"\".concat(supports);\n } else {\n item[1] = \"@supports (\".concat(item[4], \") {\").concat(item[1], \"}\");\n item[4] = supports;\n }\n }\n list.push(item);\n }\n };\n return list;\n};","\"use strict\";\n\nmodule.exports = function (item) {\n var content = item[1];\n var cssMapping = item[3];\n if (!cssMapping) {\n return content;\n }\n if (typeof btoa === \"function\") {\n var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping))));\n var data = \"sourceMappingURL=data:application/json;charset=utf-8;base64,\".concat(base64);\n var sourceMapping = \"/*# \".concat(data, \" */\");\n return [content].concat([sourceMapping]).join(\"\\n\");\n }\n return [content].join(\"\\n\");\n};","'use strict';\n\nmodule.exports = earcut;\nmodule.exports.default = earcut;\n\nfunction earcut(data, holeIndices, dim) {\n\n dim = dim || 2;\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = linkedList(data, 0, outerLen, dim, true),\n triangles = [];\n\n if (!outerNode || outerNode.next === outerNode.prev) return triangles;\n\n var minX, minY, maxX, maxY, x, y, invSize;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and invSize are later used to transform coords into integers for z-order calculation\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 32767 / invSize : 0;\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var i, last;\n\n if (clockwise === (signedArea(data, start, end, dim) > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && invSize) indexCurve(ear, minX, minY, invSize);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim | 0);\n triangles.push(ear.i / dim | 0);\n triangles.push(next.i / dim | 0);\n\n removeNode(ear);\n\n // skipping the next vertex leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(filterPoints(ear), triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, invSize);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n // triangle bbox; min & max are calculated like this for speed\n var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),\n y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),\n x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),\n y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy);\n\n var p = c.next;\n while (p !== a) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 &&\n pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, invSize) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n // triangle bbox; min & max are calculated like this for speed\n var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),\n y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),\n x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),\n y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(x0, y0, minX, minY, invSize),\n maxZ = zOrder(x1, y1, minX, minY, invSize);\n\n var p = ear.prevZ,\n n = ear.nextZ;\n\n // look for points inside the triangle in both directions\n while (p && p.z >= minZ && n && n.z <= maxZ) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n\n if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n // look for remaining points in decreasing z-order\n while (p && p.z >= minZ) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n // look for remaining points in increasing z-order\n while (n && n.z <= maxZ) {\n if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim | 0);\n triangles.push(p.i / dim | 0);\n triangles.push(b.i / dim | 0);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return filterPoints(p);\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, invSize) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, invSize, 0);\n earcutLinked(c, triangles, dim, minX, minY, invSize, 0);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n outerNode = eliminateHole(queue[i], outerNode);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n var bridge = findHoleBridge(hole, outerNode);\n if (!bridge) {\n return outerNode;\n }\n\n var bridgeReverse = splitPolygon(bridge, hole);\n\n // filter collinear points around the cuts\n filterPoints(bridgeReverse, bridgeReverse.next);\n return filterPoints(bridge, bridge.next);\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n m = p.x < p.next.x ? p : p.next;\n if (x === hx) return m; // hole touches outer segment; pick leftmost endpoint\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n mx = m.x,\n my = m.y,\n tanMin = Infinity,\n tan;\n\n p = m;\n\n do {\n if (hx >= p.x && p.x >= mx && hx !== p.x &&\n pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if (locallyInside(p, hole) &&\n (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n } while (p !== stop);\n\n return m;\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector(m, p) {\n return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, invSize) {\n var p = start;\n do {\n if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = (x - minX) * invSize | 0;\n y = (y - minY) * invSize | 0;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) >= (ax - px) * (cy - py) &&\n (ax - px) * (by - py) >= (bx - px) * (ay - py) &&\n (bx - px) * (cy - py) >= (cx - px) * (by - py);\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges\n (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible\n (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors\n equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n var o1 = sign(area(p1, q1, p2));\n var o2 = sign(area(p1, q1, q2));\n var o3 = sign(area(p2, q2, p1));\n var o4 = sign(area(p2, q2, q1));\n\n if (o1 !== o2 && o3 !== o4) return true; // general case\n\n if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n return false;\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}\n\nfunction sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertex index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertex nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = 0;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n// return a percentage difference between the polygon area and its triangulation area;\n// used to verify correctness of triangulation\nearcut.deviation = function (data, holeIndices, dim, triangles) {\n var hasHoles = holeIndices && holeIndices.length;\n var outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n\n var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));\n if (hasHoles) {\n for (var i = 0, len = holeIndices.length; i < len; i++) {\n var start = holeIndices[i] * dim;\n var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n polygonArea -= Math.abs(signedArea(data, start, end, dim));\n }\n }\n\n var trianglesArea = 0;\n for (i = 0; i < triangles.length; i += 3) {\n var a = triangles[i] * dim;\n var b = triangles[i + 1] * dim;\n var c = triangles[i + 2] * dim;\n trianglesArea += Math.abs(\n (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -\n (data[a] - data[b]) * (data[c + 1] - data[a + 1]));\n }\n\n return polygonArea === 0 && trianglesArea === 0 ? 0 :\n Math.abs((trianglesArea - polygonArea) / polygonArea);\n};\n\nfunction signedArea(data, start, end, dim) {\n var sum = 0;\n for (var i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}\n\n// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts\nearcut.flatten = function (data) {\n var dim = data[0][0].length,\n result = {vertices: [], holes: [], dimensions: dim},\n holeIndex = 0;\n\n for (var i = 0; i < data.length; i++) {\n for (var j = 0; j < data[i].length; j++) {\n for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]);\n }\n if (i > 0) {\n holeIndex += data[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n return result;\n};\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","'use strict';\n\nmodule.exports = Pbf;\n\nvar ieee754 = require('ieee754');\n\nfunction Pbf(buf) {\n this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);\n this.pos = 0;\n this.type = 0;\n this.length = this.buf.length;\n}\n\nPbf.Varint = 0; // varint: int32, int64, uint32, uint64, sint32, sint64, bool, enum\nPbf.Fixed64 = 1; // 64-bit: double, fixed64, sfixed64\nPbf.Bytes = 2; // length-delimited: string, bytes, embedded messages, packed repeated fields\nPbf.Fixed32 = 5; // 32-bit: float, fixed32, sfixed32\n\nvar SHIFT_LEFT_32 = (1 << 16) * (1 << 16),\n SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;\n\n// Threshold chosen based on both benchmarking and knowledge about browser string\n// data structures (which currently switch structure types at 12 bytes or more)\nvar TEXT_DECODER_MIN_LENGTH = 12;\nvar utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf8');\n\nPbf.prototype = {\n\n destroy: function() {\n this.buf = null;\n },\n\n // === READING =================================================================\n\n readFields: function(readField, result, end) {\n end = end || this.length;\n\n while (this.pos < end) {\n var val = this.readVarint(),\n tag = val >> 3,\n startPos = this.pos;\n\n this.type = val & 0x7;\n readField(tag, result, this);\n\n if (this.pos === startPos) this.skip(val);\n }\n return result;\n },\n\n readMessage: function(readField, result) {\n return this.readFields(readField, result, this.readVarint() + this.pos);\n },\n\n readFixed32: function() {\n var val = readUInt32(this.buf, this.pos);\n this.pos += 4;\n return val;\n },\n\n readSFixed32: function() {\n var val = readInt32(this.buf, this.pos);\n this.pos += 4;\n return val;\n },\n\n // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)\n\n readFixed64: function() {\n var val = readUInt32(this.buf, this.pos) + readUInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;\n this.pos += 8;\n return val;\n },\n\n readSFixed64: function() {\n var val = readUInt32(this.buf, this.pos) + readInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;\n this.pos += 8;\n return val;\n },\n\n readFloat: function() {\n var val = ieee754.read(this.buf, this.pos, true, 23, 4);\n this.pos += 4;\n return val;\n },\n\n readDouble: function() {\n var val = ieee754.read(this.buf, this.pos, true, 52, 8);\n this.pos += 8;\n return val;\n },\n\n readVarint: function(isSigned) {\n var buf = this.buf,\n val, b;\n\n b = buf[this.pos++]; val = b & 0x7f; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 7; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 14; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 21; if (b < 0x80) return val;\n b = buf[this.pos]; val |= (b & 0x0f) << 28;\n\n return readVarintRemainder(val, isSigned, this);\n },\n\n readVarint64: function() { // for compatibility with v2.0.1\n return this.readVarint(true);\n },\n\n readSVarint: function() {\n var num = this.readVarint();\n return num % 2 === 1 ? (num + 1) / -2 : num / 2; // zigzag encoding\n },\n\n readBoolean: function() {\n return Boolean(this.readVarint());\n },\n\n readString: function() {\n var end = this.readVarint() + this.pos;\n var pos = this.pos;\n this.pos = end;\n\n if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {\n // longer strings are fast with the built-in browser TextDecoder API\n return readUtf8TextDecoder(this.buf, pos, end);\n }\n // short strings are fast with our custom implementation\n return readUtf8(this.buf, pos, end);\n },\n\n readBytes: function() {\n var end = this.readVarint() + this.pos,\n buffer = this.buf.subarray(this.pos, end);\n this.pos = end;\n return buffer;\n },\n\n // verbose for performance reasons; doesn't affect gzipped size\n\n readPackedVarint: function(arr, isSigned) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readVarint(isSigned));\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readVarint(isSigned));\n return arr;\n },\n readPackedSVarint: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readSVarint());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readSVarint());\n return arr;\n },\n readPackedBoolean: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readBoolean());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readBoolean());\n return arr;\n },\n readPackedFloat: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readFloat());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readFloat());\n return arr;\n },\n readPackedDouble: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readDouble());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readDouble());\n return arr;\n },\n readPackedFixed32: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readFixed32());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readFixed32());\n return arr;\n },\n readPackedSFixed32: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed32());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readSFixed32());\n return arr;\n },\n readPackedFixed64: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readFixed64());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readFixed64());\n return arr;\n },\n readPackedSFixed64: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed64());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readSFixed64());\n return arr;\n },\n\n skip: function(val) {\n var type = val & 0x7;\n if (type === Pbf.Varint) while (this.buf[this.pos++] > 0x7f) {}\n else if (type === Pbf.Bytes) this.pos = this.readVarint() + this.pos;\n else if (type === Pbf.Fixed32) this.pos += 4;\n else if (type === Pbf.Fixed64) this.pos += 8;\n else throw new Error('Unimplemented type: ' + type);\n },\n\n // === WRITING =================================================================\n\n writeTag: function(tag, type) {\n this.writeVarint((tag << 3) | type);\n },\n\n realloc: function(min) {\n var length = this.length || 16;\n\n while (length < this.pos + min) length *= 2;\n\n if (length !== this.length) {\n var buf = new Uint8Array(length);\n buf.set(this.buf);\n this.buf = buf;\n this.length = length;\n }\n },\n\n finish: function() {\n this.length = this.pos;\n this.pos = 0;\n return this.buf.subarray(0, this.length);\n },\n\n writeFixed32: function(val) {\n this.realloc(4);\n writeInt32(this.buf, val, this.pos);\n this.pos += 4;\n },\n\n writeSFixed32: function(val) {\n this.realloc(4);\n writeInt32(this.buf, val, this.pos);\n this.pos += 4;\n },\n\n writeFixed64: function(val) {\n this.realloc(8);\n writeInt32(this.buf, val & -1, this.pos);\n writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);\n this.pos += 8;\n },\n\n writeSFixed64: function(val) {\n this.realloc(8);\n writeInt32(this.buf, val & -1, this.pos);\n writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);\n this.pos += 8;\n },\n\n writeVarint: function(val) {\n val = +val || 0;\n\n if (val > 0xfffffff || val < 0) {\n writeBigVarint(val, this);\n return;\n }\n\n this.realloc(4);\n\n this.buf[this.pos++] = val & 0x7f | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = (val >>> 7) & 0x7f;\n },\n\n writeSVarint: function(val) {\n this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);\n },\n\n writeBoolean: function(val) {\n this.writeVarint(Boolean(val));\n },\n\n writeString: function(str) {\n str = String(str);\n this.realloc(str.length * 4);\n\n this.pos++; // reserve 1 byte for short string length\n\n var startPos = this.pos;\n // write the string directly to the buffer and see how much was written\n this.pos = writeUtf8(this.buf, str, this.pos);\n var len = this.pos - startPos;\n\n if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);\n\n // finally, write the message length in the reserved place and restore the position\n this.pos = startPos - 1;\n this.writeVarint(len);\n this.pos += len;\n },\n\n writeFloat: function(val) {\n this.realloc(4);\n ieee754.write(this.buf, val, this.pos, true, 23, 4);\n this.pos += 4;\n },\n\n writeDouble: function(val) {\n this.realloc(8);\n ieee754.write(this.buf, val, this.pos, true, 52, 8);\n this.pos += 8;\n },\n\n writeBytes: function(buffer) {\n var len = buffer.length;\n this.writeVarint(len);\n this.realloc(len);\n for (var i = 0; i < len; i++) this.buf[this.pos++] = buffer[i];\n },\n\n writeRawMessage: function(fn, obj) {\n this.pos++; // reserve 1 byte for short message length\n\n // write the message directly to the buffer and see how much was written\n var startPos = this.pos;\n fn(obj, this);\n var len = this.pos - startPos;\n\n if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);\n\n // finally, write the message length in the reserved place and restore the position\n this.pos = startPos - 1;\n this.writeVarint(len);\n this.pos += len;\n },\n\n writeMessage: function(tag, fn, obj) {\n this.writeTag(tag, Pbf.Bytes);\n this.writeRawMessage(fn, obj);\n },\n\n writePackedVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedVarint, arr); },\n writePackedSVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSVarint, arr); },\n writePackedBoolean: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedBoolean, arr); },\n writePackedFloat: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFloat, arr); },\n writePackedDouble: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedDouble, arr); },\n writePackedFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed32, arr); },\n writePackedSFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed32, arr); },\n writePackedFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed64, arr); },\n writePackedSFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed64, arr); },\n\n writeBytesField: function(tag, buffer) {\n this.writeTag(tag, Pbf.Bytes);\n this.writeBytes(buffer);\n },\n writeFixed32Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed32);\n this.writeFixed32(val);\n },\n writeSFixed32Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed32);\n this.writeSFixed32(val);\n },\n writeFixed64Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed64);\n this.writeFixed64(val);\n },\n writeSFixed64Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed64);\n this.writeSFixed64(val);\n },\n writeVarintField: function(tag, val) {\n this.writeTag(tag, Pbf.Varint);\n this.writeVarint(val);\n },\n writeSVarintField: function(tag, val) {\n this.writeTag(tag, Pbf.Varint);\n this.writeSVarint(val);\n },\n writeStringField: function(tag, str) {\n this.writeTag(tag, Pbf.Bytes);\n this.writeString(str);\n },\n writeFloatField: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed32);\n this.writeFloat(val);\n },\n writeDoubleField: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed64);\n this.writeDouble(val);\n },\n writeBooleanField: function(tag, val) {\n this.writeVarintField(tag, Boolean(val));\n }\n};\n\nfunction readVarintRemainder(l, s, p) {\n var buf = p.buf,\n h, b;\n\n b = buf[p.pos++]; h = (b & 0x70) >> 4; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 3; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 10; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 17; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 24; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x01) << 31; if (b < 0x80) return toNum(l, h, s);\n\n throw new Error('Expected varint not more than 10 bytes');\n}\n\nfunction readPackedEnd(pbf) {\n return pbf.type === Pbf.Bytes ?\n pbf.readVarint() + pbf.pos : pbf.pos + 1;\n}\n\nfunction toNum(low, high, isSigned) {\n if (isSigned) {\n return high * 0x100000000 + (low >>> 0);\n }\n\n return ((high >>> 0) * 0x100000000) + (low >>> 0);\n}\n\nfunction writeBigVarint(val, pbf) {\n var low, high;\n\n if (val >= 0) {\n low = (val % 0x100000000) | 0;\n high = (val / 0x100000000) | 0;\n } else {\n low = ~(-val % 0x100000000);\n high = ~(-val / 0x100000000);\n\n if (low ^ 0xffffffff) {\n low = (low + 1) | 0;\n } else {\n low = 0;\n high = (high + 1) | 0;\n }\n }\n\n if (val >= 0x10000000000000000 || val < -0x10000000000000000) {\n throw new Error('Given varint doesn\\'t fit into 10 bytes');\n }\n\n pbf.realloc(10);\n\n writeBigVarintLow(low, high, pbf);\n writeBigVarintHigh(high, pbf);\n}\n\nfunction writeBigVarintLow(low, high, pbf) {\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos] = low & 0x7f;\n}\n\nfunction writeBigVarintHigh(high, pbf) {\n var lsb = (high & 0x07) << 4;\n\n pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f;\n}\n\nfunction makeRoomForExtraLength(startPos, len, pbf) {\n var extraLen =\n len <= 0x3fff ? 1 :\n len <= 0x1fffff ? 2 :\n len <= 0xfffffff ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));\n\n // if 1 byte isn't enough for encoding message length, shift the data to the right\n pbf.realloc(extraLen);\n for (var i = pbf.pos - 1; i >= startPos; i--) pbf.buf[i + extraLen] = pbf.buf[i];\n}\n\nfunction writePackedVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeVarint(arr[i]); }\nfunction writePackedSVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSVarint(arr[i]); }\nfunction writePackedFloat(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFloat(arr[i]); }\nfunction writePackedDouble(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeDouble(arr[i]); }\nfunction writePackedBoolean(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeBoolean(arr[i]); }\nfunction writePackedFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed32(arr[i]); }\nfunction writePackedSFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed32(arr[i]); }\nfunction writePackedFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed64(arr[i]); }\nfunction writePackedSFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed64(arr[i]); }\n\n// Buffer code below from https://github.com/feross/buffer, MIT-licensed\n\nfunction readUInt32(buf, pos) {\n return ((buf[pos]) |\n (buf[pos + 1] << 8) |\n (buf[pos + 2] << 16)) +\n (buf[pos + 3] * 0x1000000);\n}\n\nfunction writeInt32(buf, val, pos) {\n buf[pos] = val;\n buf[pos + 1] = (val >>> 8);\n buf[pos + 2] = (val >>> 16);\n buf[pos + 3] = (val >>> 24);\n}\n\nfunction readInt32(buf, pos) {\n return ((buf[pos]) |\n (buf[pos + 1] << 8) |\n (buf[pos + 2] << 16)) +\n (buf[pos + 3] << 24);\n}\n\nfunction readUtf8(buf, pos, end) {\n var str = '';\n var i = pos;\n\n while (i < end) {\n var b0 = buf[i];\n var c = null; // codepoint\n var bytesPerSequence =\n b0 > 0xEF ? 4 :\n b0 > 0xDF ? 3 :\n b0 > 0xBF ? 2 : 1;\n\n if (i + bytesPerSequence > end) break;\n\n var b1, b2, b3;\n\n if (bytesPerSequence === 1) {\n if (b0 < 0x80) {\n c = b0;\n }\n } else if (bytesPerSequence === 2) {\n b1 = buf[i + 1];\n if ((b1 & 0xC0) === 0x80) {\n c = (b0 & 0x1F) << 0x6 | (b1 & 0x3F);\n if (c <= 0x7F) {\n c = null;\n }\n }\n } else if (bytesPerSequence === 3) {\n b1 = buf[i + 1];\n b2 = buf[i + 2];\n if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80) {\n c = (b0 & 0xF) << 0xC | (b1 & 0x3F) << 0x6 | (b2 & 0x3F);\n if (c <= 0x7FF || (c >= 0xD800 && c <= 0xDFFF)) {\n c = null;\n }\n }\n } else if (bytesPerSequence === 4) {\n b1 = buf[i + 1];\n b2 = buf[i + 2];\n b3 = buf[i + 3];\n if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {\n c = (b0 & 0xF) << 0x12 | (b1 & 0x3F) << 0xC | (b2 & 0x3F) << 0x6 | (b3 & 0x3F);\n if (c <= 0xFFFF || c >= 0x110000) {\n c = null;\n }\n }\n }\n\n if (c === null) {\n c = 0xFFFD;\n bytesPerSequence = 1;\n\n } else if (c > 0xFFFF) {\n c -= 0x10000;\n str += String.fromCharCode(c >>> 10 & 0x3FF | 0xD800);\n c = 0xDC00 | c & 0x3FF;\n }\n\n str += String.fromCharCode(c);\n i += bytesPerSequence;\n }\n\n return str;\n}\n\nfunction readUtf8TextDecoder(buf, pos, end) {\n return utf8TextDecoder.decode(buf.subarray(pos, end));\n}\n\nfunction writeUtf8(buf, str, pos) {\n for (var i = 0, c, lead; i < str.length; i++) {\n c = str.charCodeAt(i); // code point\n\n if (c > 0xD7FF && c < 0xE000) {\n if (lead) {\n if (c < 0xDC00) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n lead = c;\n continue;\n } else {\n c = lead - 0xD800 << 10 | c - 0xDC00 | 0x10000;\n lead = null;\n }\n } else {\n if (c > 0xDBFF || (i + 1 === str.length)) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n } else {\n lead = c;\n }\n continue;\n }\n } else if (lead) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n lead = null;\n }\n\n if (c < 0x80) {\n buf[pos++] = c;\n } else {\n if (c < 0x800) {\n buf[pos++] = c >> 0x6 | 0xC0;\n } else {\n if (c < 0x10000) {\n buf[pos++] = c >> 0xC | 0xE0;\n } else {\n buf[pos++] = c >> 0x12 | 0xF0;\n buf[pos++] = c >> 0xC & 0x3F | 0x80;\n }\n buf[pos++] = c >> 0x6 & 0x3F | 0x80;\n }\n buf[pos++] = c & 0x3F | 0x80;\n }\n }\n return pos;\n}\n","!function(t,i){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=i():\"function\"==typeof define&&define.amd?define(i):(t=t||self).RBush=i()}(this,function(){\"use strict\";function t(t,r,e,a,h){!function t(n,r,e,a,h){for(;a>e;){if(a-e>600){var o=a-e+1,s=r-e+1,l=Math.log(o),f=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*f*(o-f)/o)*(s-o/2<0?-1:1),m=Math.max(e,Math.floor(r-s*f/o+u)),c=Math.min(a,Math.floor(r+(o-s)*f/o+u));t(n,r,m,c,h)}var p=n[r],d=e,x=a;for(i(n,e,r),h(n[a],p)>0&&i(n,e,a);d0;)x--}0===h(n[e],p)?i(n,e,x):i(n,++x,a),x<=r&&(e=x+1),r<=x&&(a=x-1)}}(t,r,e||0,a||t.length-1,h||n)}function i(t,i,n){var r=t[i];t[i]=t[n],t[n]=r}function n(t,i){return ti?1:0}var r=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function e(t,i,n){if(!n)return i.indexOf(t);for(var r=0;r=t.minX&&i.maxY>=t.minY}function p(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function d(i,n,r,e,a){for(var h=[n,r];h.length;)if(!((r=h.pop())-(n=h.pop())<=e)){var o=n+Math.ceil((r-n)/e/2)*e;t(i,o,n,r,a),h.push(n,o,o,r)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(t){var i=this.data,n=[];if(!c(t,i))return n;for(var r=this.toBBox,e=[];i;){for(var a=0;a=0&&e[i].children.length>this._maxEntries;)this._split(e,i),i--;this._adjustParentBBoxes(r,e,i)},r.prototype._split=function(t,i){var n=t[i],r=n.children.length,e=this._minEntries;this._chooseSplitAxis(n,e,r);var h=this._chooseSplitIndex(n,e,r),o=p(n.children.splice(h,n.children.length-h));o.height=n.height,o.leaf=n.leaf,a(n,this.toBBox),a(o,this.toBBox),i?t[i-1].children.push(o):this._splitRoot(n,o)},r.prototype._splitRoot=function(t,i){this.data=p([t,i]),this.data.height=t.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(t,i,n){for(var r,e,a,o,s,l,u,m=1/0,c=1/0,p=i;p<=n-i;p++){var d=h(t,0,p,this.toBBox),x=h(t,p,n,this.toBBox),v=(e=d,a=x,o=void 0,s=void 0,l=void 0,u=void 0,o=Math.max(e.minX,a.minX),s=Math.max(e.minY,a.minY),l=Math.min(e.maxX,a.maxX),u=Math.min(e.maxY,a.maxY),Math.max(0,l-o)*Math.max(0,u-s)),M=f(d)+f(x);v=i;c--){var p=t.children[c];o(s,t.leaf?e(p):p),l+=u(s)}return l},r.prototype._adjustParentBBoxes=function(t,i,n){for(var r=n;r>=0;r--)o(i[r],t)},r.prototype._condense=function(t){for(var i=t.length-1,n=void 0;i>=0;i--)0===t[i].children.length?i>0?(n=t[i-1].children).splice(n.indexOf(t[i]),1):this.clear():a(t[i],this.toBBox)},r});\n","function countSubstring(string, substring) {\n const pattern = new RegExp(substring, \"g\");\n const match = string.match(pattern);\n return match ? match.length : 0;\n}\n\nmodule.exports = countSubstring;\nmodule.exports.default = countSubstring;\n","const indexOfMatch = require(\"./index-of-match.js\");\nconst indexOfMatchEnd = require(\"./index-of-match-end.js\");\nconst countSubstring = require(\"./count-substring.js\");\n\nfunction findTagByName(xml, tagName, options) {\n const debug = (options && options.debug) || false;\n const nested = !(options && typeof options.nested === false);\n\n const startIndex = (options && options.startIndex) || 0;\n\n if (debug) console.log(\"[xml-utils] starting findTagByName with\", tagName, \" and \", options);\n\n const start = indexOfMatch(xml, `\\<${tagName}[ \\n\\>\\/]`, startIndex);\n if (debug) console.log(\"[xml-utils] start:\", start);\n if (start === -1) return undefined;\n\n const afterStart = xml.slice(start + tagName.length);\n\n let relativeEnd = indexOfMatchEnd(afterStart, \"^[^<]*[ /]>\", 0);\n\n const selfClosing = relativeEnd !== -1 && afterStart[relativeEnd - 1] === \"/\";\n if (debug) console.log(\"[xml-utils] selfClosing:\", selfClosing);\n\n if (selfClosing === false) {\n // check if tag has subtags with the same name\n if (nested) {\n let startIndex = 0;\n let openings = 1;\n let closings = 0;\n while ((relativeEnd = indexOfMatchEnd(afterStart, \"[ /]\" + tagName + \">\", startIndex)) !== -1) {\n const clip = afterStart.substring(startIndex, relativeEnd + 1);\n openings += countSubstring(clip, \"<\" + tagName + \"[ \\n\\t>]\");\n closings += countSubstring(clip, \"\");\n // we can't have more openings than closings\n if (closings >= openings) break;\n startIndex = relativeEnd;\n }\n } else {\n relativeEnd = indexOfMatchEnd(afterStart, \"[ /]\" + tagName + \">\", 0);\n }\n }\n\n const end = start + tagName.length + relativeEnd + 1;\n if (debug) console.log(\"[xml-utils] end:\", end);\n if (end === -1) return undefined;\n\n const outer = xml.slice(start, end);\n // tag is like urn:ogc:def:crs:EPSG::32617\n\n let inner;\n if (selfClosing) {\n inner = null;\n } else {\n inner = outer.slice(outer.indexOf(\">\") + 1, outer.lastIndexOf(\"<\"));\n }\n\n return { inner, outer, start, end };\n}\n\nmodule.exports = findTagByName;\nmodule.exports.default = findTagByName;\n","const findTagByName = require(\"./find-tag-by-name.js\");\n\nfunction findTagsByName(xml, tagName, options) {\n const tags = [];\n const debug = (options && options.debug) || false;\n const nested = options && typeof options.nested === \"boolean\" ? options.nested : true;\n let startIndex = (options && options.startIndex) || 0;\n let tag;\n while ((tag = findTagByName(xml, tagName, { debug, startIndex }))) {\n if (nested) {\n startIndex = tag.start + 1 + tagName.length;\n } else {\n startIndex = tag.end;\n }\n tags.push(tag);\n }\n if (debug) console.log(\"findTagsByName found\", tags.length, \"tags\");\n return tags;\n}\n\nmodule.exports = findTagsByName;\nmodule.exports.default = findTagsByName;\n","function getAttribute(tag, attributeName, options) {\n const debug = (options && options.debug) || false;\n if (debug) console.log(\"[xml-utils] getting \" + attributeName + \" in \" + tag);\n\n const xml = typeof tag === \"object\" ? tag.outer : tag;\n\n // only search for attributes in the opening tag\n const opening = xml.slice(0, xml.indexOf(\">\") + 1);\n\n const quotechars = ['\"', \"'\"];\n for (let i = 0; i < quotechars.length; i++) {\n const char = quotechars[i];\n const pattern = attributeName + \"\\\\=\" + char + \"([^\" + char + \"]*)\" + char;\n if (debug) console.log(\"[xml-utils] pattern:\", pattern);\n\n const re = new RegExp(pattern);\n const match = re.exec(opening);\n if (debug) console.log(\"[xml-utils] match:\", match);\n if (match) return match[1];\n }\n}\n\nmodule.exports = getAttribute;\nmodule.exports.default = getAttribute;\n","function indexOfMatchEnd(xml, pattern, startIndex) {\n const re = new RegExp(pattern);\n const match = re.exec(xml.slice(startIndex));\n if (match) return startIndex + match.index + match[0].length - 1;\n else return -1;\n}\n\nmodule.exports = indexOfMatchEnd;\nmodule.exports.default = indexOfMatchEnd;\n","function indexOfMatch(xml, pattern, startIndex) {\n const re = new RegExp(pattern);\n const match = re.exec(xml.slice(startIndex));\n if (match) return startIndex + match.index;\n else return -1;\n}\n\nmodule.exports = indexOfMatch;\nmodule.exports.default = indexOfMatch;\n","\n import API from \"!../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import domAPI from \"!../node_modules/style-loader/dist/runtime/styleDomAPI.js\";\n import insertFn from \"!../node_modules/style-loader/dist/runtime/insertBySelector.js\";\n import setAttributes from \"!../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js\";\n import insertStyleElement from \"!../node_modules/style-loader/dist/runtime/insertStyleElement.js\";\n import styleTagTransformFn from \"!../node_modules/style-loader/dist/runtime/styleTagTransform.js\";\n import content, * as namedExport from \"!!../node_modules/css-loader/dist/cjs.js!./widget.css\";\n \n \n\nvar options = {};\n\noptions.styleTagTransform = styleTagTransformFn;\noptions.setAttributes = setAttributes;\noptions.insert = insertFn.bind(null, \"head\");\noptions.domAPI = domAPI;\noptions.insertStyleElement = insertStyleElement;\n\nvar update = API(content, options);\n\n\n\nexport * from \"!!../node_modules/css-loader/dist/cjs.js!./widget.css\";\n export default content && content.locals ? content.locals : undefined;\n","\n import API from \"!../style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import domAPI from \"!../style-loader/dist/runtime/styleDomAPI.js\";\n import insertFn from \"!../style-loader/dist/runtime/insertBySelector.js\";\n import setAttributes from \"!../style-loader/dist/runtime/setAttributesWithoutAttributes.js\";\n import insertStyleElement from \"!../style-loader/dist/runtime/insertStyleElement.js\";\n import styleTagTransformFn from \"!../style-loader/dist/runtime/styleTagTransform.js\";\n import content, * as namedExport from \"!!../css-loader/dist/cjs.js!./ol.css\";\n \n \n\nvar options = {};\n\noptions.styleTagTransform = styleTagTransformFn;\noptions.setAttributes = setAttributes;\noptions.insert = insertFn.bind(null, \"head\");\noptions.domAPI = domAPI;\noptions.insertStyleElement = insertStyleElement;\n\nvar update = API(content, options);\n\n\n\nexport * from \"!!../css-loader/dist/cjs.js!./ol.css\";\n export default content && content.locals ? content.locals : undefined;\n","\"use strict\";\n\nvar stylesInDOM = [];\nfunction getIndexByIdentifier(identifier) {\n var result = -1;\n for (var i = 0; i < stylesInDOM.length; i++) {\n if (stylesInDOM[i].identifier === identifier) {\n result = i;\n break;\n }\n }\n return result;\n}\nfunction modulesToDom(list, options) {\n var idCountMap = {};\n var identifiers = [];\n for (var i = 0; i < list.length; i++) {\n var item = list[i];\n var id = options.base ? item[0] + options.base : item[0];\n var count = idCountMap[id] || 0;\n var identifier = \"\".concat(id, \" \").concat(count);\n idCountMap[id] = count + 1;\n var indexByIdentifier = getIndexByIdentifier(identifier);\n var obj = {\n css: item[1],\n media: item[2],\n sourceMap: item[3],\n supports: item[4],\n layer: item[5]\n };\n if (indexByIdentifier !== -1) {\n stylesInDOM[indexByIdentifier].references++;\n stylesInDOM[indexByIdentifier].updater(obj);\n } else {\n var updater = addElementStyle(obj, options);\n options.byIndex = i;\n stylesInDOM.splice(i, 0, {\n identifier: identifier,\n updater: updater,\n references: 1\n });\n }\n identifiers.push(identifier);\n }\n return identifiers;\n}\nfunction addElementStyle(obj, options) {\n var api = options.domAPI(options);\n api.update(obj);\n var updater = function updater(newObj) {\n if (newObj) {\n if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) {\n return;\n }\n api.update(obj = newObj);\n } else {\n api.remove();\n }\n };\n return updater;\n}\nmodule.exports = function (list, options) {\n options = options || {};\n list = list || [];\n var lastIdentifiers = modulesToDom(list, options);\n return function update(newList) {\n newList = newList || [];\n for (var i = 0; i < lastIdentifiers.length; i++) {\n var identifier = lastIdentifiers[i];\n var index = getIndexByIdentifier(identifier);\n stylesInDOM[index].references--;\n }\n var newLastIdentifiers = modulesToDom(newList, options);\n for (var _i = 0; _i < lastIdentifiers.length; _i++) {\n var _identifier = lastIdentifiers[_i];\n var _index = getIndexByIdentifier(_identifier);\n if (stylesInDOM[_index].references === 0) {\n stylesInDOM[_index].updater();\n stylesInDOM.splice(_index, 1);\n }\n }\n lastIdentifiers = newLastIdentifiers;\n };\n};","\"use strict\";\n\nvar memo = {};\n\n/* istanbul ignore next */\nfunction getTarget(target) {\n if (typeof memo[target] === \"undefined\") {\n var styleTarget = document.querySelector(target);\n\n // Special case to return head of iframe instead of iframe itself\n if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n try {\n // This will throw an exception if access to iframe is blocked\n // due to cross-origin restrictions\n styleTarget = styleTarget.contentDocument.head;\n } catch (e) {\n // istanbul ignore next\n styleTarget = null;\n }\n }\n memo[target] = styleTarget;\n }\n return memo[target];\n}\n\n/* istanbul ignore next */\nfunction insertBySelector(insert, style) {\n var target = getTarget(insert);\n if (!target) {\n throw new Error(\"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.\");\n }\n target.appendChild(style);\n}\nmodule.exports = insertBySelector;","\"use strict\";\n\n/* istanbul ignore next */\nfunction insertStyleElement(options) {\n var element = document.createElement(\"style\");\n options.setAttributes(element, options.attributes);\n options.insert(element, options.options);\n return element;\n}\nmodule.exports = insertStyleElement;","\"use strict\";\n\n/* istanbul ignore next */\nfunction setAttributesWithoutAttributes(styleElement) {\n var nonce = typeof __webpack_nonce__ !== \"undefined\" ? __webpack_nonce__ : null;\n if (nonce) {\n styleElement.setAttribute(\"nonce\", nonce);\n }\n}\nmodule.exports = setAttributesWithoutAttributes;","\"use strict\";\n\n/* istanbul ignore next */\nfunction apply(styleElement, options, obj) {\n var css = \"\";\n if (obj.supports) {\n css += \"@supports (\".concat(obj.supports, \") {\");\n }\n if (obj.media) {\n css += \"@media \".concat(obj.media, \" {\");\n }\n var needLayer = typeof obj.layer !== \"undefined\";\n if (needLayer) {\n css += \"@layer\".concat(obj.layer.length > 0 ? \" \".concat(obj.layer) : \"\", \" {\");\n }\n css += obj.css;\n if (needLayer) {\n css += \"}\";\n }\n if (obj.media) {\n css += \"}\";\n }\n if (obj.supports) {\n css += \"}\";\n }\n var sourceMap = obj.sourceMap;\n if (sourceMap && typeof btoa !== \"undefined\") {\n css += \"\\n/*# sourceMappingURL=data:application/json;base64,\".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), \" */\");\n }\n\n // For old IE\n /* istanbul ignore if */\n options.styleTagTransform(css, styleElement, options.options);\n}\nfunction removeStyleElement(styleElement) {\n // istanbul ignore if\n if (styleElement.parentNode === null) {\n return false;\n }\n styleElement.parentNode.removeChild(styleElement);\n}\n\n/* istanbul ignore next */\nfunction domAPI(options) {\n if (typeof document === \"undefined\") {\n return {\n update: function update() {},\n remove: function remove() {}\n };\n }\n var styleElement = options.insertStyleElement(options);\n return {\n update: function update(obj) {\n apply(styleElement, options, obj);\n },\n remove: function remove() {\n removeStyleElement(styleElement);\n }\n };\n}\nmodule.exports = domAPI;","\"use strict\";\n\n/* istanbul ignore next */\nfunction styleTagTransform(css, styleElement) {\n if (styleElement.styleSheet) {\n styleElement.styleSheet.cssText = css;\n } else {\n while (styleElement.firstChild) {\n styleElement.removeChild(styleElement.firstChild);\n }\n styleElement.appendChild(document.createTextNode(css));\n }\n}\nmodule.exports = styleTagTransform;","// Copyright (c) QuantStack\n// Distributed under the terms of the Modified BSD License.\nimport Control from 'ol/control/Control.js';\nimport 'ol/ol.css';\nimport '../css/widget.css';\nimport {\n DOMWidgetModel,\n DOMWidgetView,\n ISerializers,\n} from '@jupyter-widgets/base';\n\nimport 'ol/ol.css';\nimport { MODULE_NAME, MODULE_VERSION } from './version';\nimport '../css/widget.css';\n\nexport class BaseControlModel extends DOMWidgetModel {\n defaults() {\n return {\n ...super.defaults(),\n _model_name: BaseControlModel.model_name,\n _model_module: BaseControlModel.model_module,\n _model_module_version: BaseControlModel.model_module_version,\n _view_name: BaseControlModel.view_name,\n _view_module: BaseControlModel.view_module,\n _view_module_version: BaseControlModel.view_module_version,\n };\n }\n\n static serializers: ISerializers = {\n ...DOMWidgetModel.serializers,\n };\n\n static model_name = 'BaseControlModel';\n static model_module = MODULE_NAME;\n static model_module_version = MODULE_VERSION;\n static view_name = 'BaseControlView';\n static view_module = MODULE_NAME;\n static view_module_version = MODULE_VERSION;\n}\n\nexport abstract class BaseControlView extends DOMWidgetView {\n map_view: any;\n element: HTMLElement;\n obj: Control;\n\n render() {\n super.render();\n this.createObj();\n }\n\n abstract createObj(): void;\n}\n","// Copyright (c) QuantStack\n// Distributed under the terms of the Modified BSD License.\nimport {\n DOMWidgetModel,\n DOMWidgetView,\n ISerializers,\n} from '@jupyter-widgets/base';\n\nimport 'ol/ol.css';\nimport { MODULE_NAME, MODULE_VERSION } from './version';\nimport '../css/widget.css';\nimport Overlay from 'ol/Overlay';\n\nexport class BaseOverlayModel extends DOMWidgetModel {\n defaults() {\n return {\n ...super.defaults(),\n _model_name: BaseOverlayModel.model_name,\n _model_module: BaseOverlayModel.model_module,\n _model_module_version: BaseOverlayModel.model_module_version,\n _view_name: BaseOverlayModel.view_name,\n _view_module: BaseOverlayModel.view_module,\n _view_module_version: BaseOverlayModel.view_module_version,\n };\n }\n\n static serializers: ISerializers = {\n ...DOMWidgetModel.serializers,\n };\n\n static model_name = 'BaseOverlayModel';\n static model_module = MODULE_NAME;\n static model_module_version = MODULE_VERSION;\n static view_name = 'BaseOverlayView';\n static view_module = MODULE_NAME;\n static view_module_version = MODULE_VERSION;\n}\n\nexport abstract class BaseOverlayView extends DOMWidgetView {\n overlay: Overlay;\n element: HTMLElement;\n\n render() {\n super.render();\n this.createElement();\n this.createOverlay();\n this.model_events();\n }\n abstract createElement(): void;\n\n createOverlay() {\n const position = this.model.get('position');\n this.overlay = new Overlay({\n position: position,\n element: this.element,\n });\n return this.overlay;\n }\n\n model_events() {\n this.listenTo(this.model, 'change:position', this.updatePosition);\n }\n\n updatePosition() {\n const position = this.model.get('position');\n this.overlay.setPosition(position);\n }\n}\n","// Copyright (c) QuantStack\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetModel, ISerializers } from '@jupyter-widgets/base';\nimport { BaseControlModel, BaseControlView } from './basecontrol';\nimport FullScreen from 'ol/control/FullScreen.js';\n\nimport 'ol/ol.css';\nimport { MODULE_NAME, MODULE_VERSION } from './version';\nimport '../css/widget.css';\n\nexport class FullScreenModel extends BaseControlModel {\n defaults() {\n return {\n ...super.defaults(),\n _model_name: FullScreenModel.model_name,\n _model_module: FullScreenModel.model_module,\n _model_module_version: FullScreenModel.model_module_version,\n _view_name: FullScreenModel.view_name,\n _view_module: FullScreenModel.view_module,\n _view_module_version: FullScreenModel.view_module_version,\n };\n }\n\n static serializers: ISerializers = {\n ...DOMWidgetModel.serializers,\n // Ajoutez ici tous les sérialiseurs supplémentaires\n };\n\n static model_name = 'FullScreenModel';\n static model_module = MODULE_NAME;\n static model_module_version = MODULE_VERSION;\n static view_name = 'FullScreenView';\n static view_module = MODULE_NAME;\n static view_module_version = MODULE_VERSION;\n}\nexport class FullScreenView extends BaseControlView {\n createObj() {\n this.obj = new FullScreen({\n className: 'ol-full-screen',\n });\n }\n}\n","// Copyright (c) QuantStack\n// Distributed under the terms of the Modified BSD License.\nimport { StyleFunction } from 'ol/style/Style';\nimport { DOMWidgetModel, ISerializers } from '@jupyter-widgets/base';\nimport 'ol/ol.css';\nimport { MODULE_NAME, MODULE_VERSION } from './version';\nimport '../css/widget.css';\nimport GeoJSON from 'ol/format/GeoJSON.js';\nimport { Circle as CircleStyle, Fill, Stroke, Style } from 'ol/style.js';\nimport { Vector as VectorSource } from 'ol/source.js';\nimport { Vector as VectorLayer } from 'ol/layer.js';\nimport { LayerModel, LayerView } from './layer';\n\nexport class OpenLayersGeoJSONModel extends LayerModel {\n defaults() {\n return {\n ...super.defaults(),\n _model_name: OpenLayersGeoJSONModel.model_name,\n _model_module: OpenLayersGeoJSONModel.model_module,\n _model_module_version: OpenLayersGeoJSONModel.model_module_version,\n _view_name: OpenLayersGeoJSONModel.view_name,\n _view_module: OpenLayersGeoJSONModel.view_module,\n _view_module_version: OpenLayersGeoJSONModel.view_module_version,\n layers: [],\n };\n }\n\n static serializers: ISerializers = {\n ...DOMWidgetModel.serializers,\n // Add any extra serializers here\n };\n\n static model_name = 'OpenLayersGeoJSONModel';\n static model_module = MODULE_NAME;\n static model_module_version = MODULE_VERSION;\n static view_name = 'OpenLayersGeoJSONView';\n static view_module = MODULE_NAME;\n static view_module_version = MODULE_VERSION;\n}\n\nexport class OpenLayersGeoJSONView extends LayerView {\n obj: VectorLayer;\n render() {\n this.initVectorLayer();\n this.create_obj();\n this.modelEvents();\n }\n create_obj() {\n this.obj = this.vectorLayer;\n }\n initVectorLayer() {\n this.vectorSource = new VectorSource({\n features: new GeoJSON().readFeatures(this.model.get('data')),\n });\n this.vectorLayer = new VectorLayer({\n source: this.vectorSource,\n style: this.createStyleFunction(),\n });\n }\n\n createStyleFunction(): StyleFunction {\n const modelStyle = this.model.get('style') || {};\n return (feature) => {\n return new Style({\n stroke: new Stroke({\n color: modelStyle.strokeColor || '#3399CC',\n width: modelStyle.strokeWidth || 1.25,\n }),\n fill: new Fill({\n color: modelStyle.fillColor || 'rgba(255, 255, 255, 0.4)',\n }),\n image: new CircleStyle({\n radius: modelStyle.pointRadius || 5,\n fill: new Fill({\n color: modelStyle.pointFillColor || '#FF0000',\n }),\n stroke: new Stroke({\n color: modelStyle.pointStrokeColor || '#000000',\n width: modelStyle.pointStrokeWidth || 1,\n }),\n }),\n });\n };\n }\n\n updateStyle() {\n this.vectorLayer.setStyle(this.createStyleFunction());\n }\n\n invisibleStyle = new Style({\n fill: new Fill({ color: 'rgba(0, 0, 0, 0)' }),\n stroke: new Stroke({ color: 'rgba(0, 0, 0, 0)', width: 0 }),\n });\n updateVisibility() {\n const visibility = this.model.get('visible');\n this.vectorSource.getFeatures().forEach((feature) => {\n feature.setStyle(visibility ? undefined : this.invisibleStyle);\n });\n }\n updateData() {\n this.vectorSource.clear();\n this.vectorSource.addFeatures(\n new GeoJSON().readFeatures(this.model.get('data')),\n );\n }\n\n modelEvents() {\n this.listenTo(this.model, 'change:style', this.updateStyle);\n this.listenTo(this.model, 'change:data', this.updateData);\n this.listenTo(this.model, 'change:visible', this.updateVisibility);\n }\n vectorLayer: VectorLayer;\n vectorSource: VectorSource;\n}\n","// Copyright (c) QuantStack\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetModel, ISerializers } from '@jupyter-widgets/base';\nimport WebGLTileLayer from 'ol/layer/WebGLTile.js';\nimport GeoTIFF from 'ol/source/GeoTIFF.js';\nimport { MODULE_NAME, MODULE_VERSION } from './version';\nimport { LayerModel, LayerView } from './layer';\n\nexport class GeoTIFFTileLayerModel extends LayerModel {\n defaults() {\n return {\n ...super.defaults(),\n _model_name: GeoTIFFTileLayerModel.model_name,\n _model_module: GeoTIFFTileLayerModel.model_module,\n _model_module_version: GeoTIFFTileLayerModel.model_module_version,\n _view_name: GeoTIFFTileLayerModel.view_name,\n _view_module: GeoTIFFTileLayerModel.view_module,\n _view_module_version: GeoTIFFTileLayerModel.view_module_version,\n url: '',\n };\n }\n\n static serializers: ISerializers = {\n ...DOMWidgetModel.serializers,\n // Add any extra serializers here\n };\n\n static model_name = 'GeoTIFFTileLayerModel';\n static model_module = MODULE_NAME;\n static model_module_version = MODULE_VERSION;\n static view_name = 'GeoTIFFTileLayerView';\n static view_module = MODULE_NAME;\n static view_module_version = MODULE_VERSION;\n}\n\nexport class GeoTIFFTileLayerView extends LayerView {\n render() {\n super.render();\n this.sourcesChanged();\n this.model.on('change:url', this.sourcesChanged, this);\n }\n\n create_obj() {\n const url = this.model.get('url');\n\n if (url) {\n this.obj = new WebGLTileLayer({\n source: new GeoTIFF({\n sources: [{ url: url }],\n }),\n });\n }\n }\n sourcesChanged() {\n const newUrl = this.model.get('url');\n\n if (newUrl) {\n const newSource = new GeoTIFF({\n sources: [{ url: newUrl }],\n });\n this.obj.setSource(newSource);\n }\n }\n\n obj: WebGLTileLayer;\n}\n","import { ISerializers } from '@jupyter-widgets/base';\nimport { LayerModel, LayerView } from './layer';\nimport { MODULE_NAME, MODULE_VERSION } from './version';\nimport Heatmap from 'ol/layer/Heatmap';\nimport { Vector as VectorSource } from 'ol/source';\nimport Feature from 'ol/Feature';\nimport Point from 'ol/geom/Point';\n\nexport class HeatmapLayerModel extends LayerModel {\n defaults() {\n return {\n ...super.defaults(),\n _model_name: HeatmapLayerModel.model_name,\n _model_module: HeatmapLayerModel.model_module,\n _model_module_version: HeatmapLayerModel.model_module_version,\n _view_name: HeatmapLayerModel.view_name,\n _view_module: HeatmapLayerModel.view_module,\n _view_module_version: HeatmapLayerModel.view_module_version,\n blur: 15,\n radius: 8,\n points: [],\n };\n }\n\n static serializers: ISerializers = {\n ...LayerModel.serializers,\n // Add any extra serializers here\n };\n\n static model_name = 'HeatmapLayerModel';\n static model_module = MODULE_NAME;\n static model_module_version = MODULE_VERSION;\n static view_name = 'HeatmapLayerView';\n static view_module = MODULE_NAME;\n static view_module_version = MODULE_VERSION;\n}\n\nexport class HeatmapLayerView extends LayerView {\n obj: Heatmap;\n\n render() {\n this.create_obj();\n this.modelEvents();\n }\n\n create_obj() {\n const source = new VectorSource({\n features: this.model\n .get('points')\n .map((point: [number, number, number]) => {\n const feature = new Feature(new Point([point[1], point[0]])); // Note: [lon, lat]\n feature.set('weight', point[2]);\n return feature;\n }),\n });\n\n this.obj = new Heatmap({\n source: source,\n blur: this.model.get('blur'),\n radius: this.model.get('radius'),\n });\n }\n\n modelEvents() {\n this.model.on('change:blur', this.update_blur, this);\n this.model.on('change:radius', this.update_radius, this);\n this.model.on('change:points', this.update_points, this);\n }\n\n update_blur() {\n this.obj.setBlur(this.model.get('blur'));\n }\n\n update_radius() {\n this.obj.setRadius(this.model.get('radius'));\n }\n\n update_points() {\n const source = new VectorSource({\n features: this.model\n .get('points')\n .map((point: [number, number, number]) => {\n const feature = new Feature(new Point([point[1], point[0]])); // Note: [lon, lat]\n feature.set('weight', point[2]);\n return feature;\n }),\n });\n this.obj.setSource(source);\n }\n}\n","// Copyright (c) QuantStack\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetModel, ISerializers } from '@jupyter-widgets/base';\nimport { BaseOverlayModel, BaseOverlayView } from './baseoverlay';\n\nimport 'ol/ol.css';\nimport { MODULE_NAME, MODULE_VERSION } from './version';\nimport '../css/widget.css';\n\nexport class ImageOverlayModel extends BaseOverlayModel {\n defaults() {\n return {\n ...super.defaults(),\n _model_name: ImageOverlayModel.model_name,\n _model_module: ImageOverlayModel.model_module,\n _model_module_version: ImageOverlayModel.model_module_version,\n _view_name: ImageOverlayModel.view_name,\n _view_module: ImageOverlayModel.view_module,\n _view_module_version: ImageOverlayModel.view_module_version,\n image_url: '',\n };\n }\n\n static serializers: ISerializers = {\n ...DOMWidgetModel.serializers,\n // Ajoutez ici tous les sérialiseurs supplémentaires\n };\n\n static model_name = 'ImageOverlayModel';\n static model_module = MODULE_NAME;\n static model_module_version = MODULE_VERSION;\n static view_name = 'ImageOverlayView';\n static view_module = MODULE_NAME;\n static view_module_version = MODULE_VERSION;\n}\n\nexport class ImageOverlayView extends BaseOverlayView {\n render() {\n super.render();\n this.updateImageElement();\n }\n createElement() {\n this.element = document.createElement('img');\n }\n model_events() {\n super.model_events();\n this.listenTo(this.model, 'change:image_url', this.updateImageElement);\n }\n\n updateImageElement() {\n const imageUrl = this.model.get('image_url');\n if (imageUrl) {\n (this.element as HTMLImageElement).src = imageUrl;\n }\n }\n}\n","// Copyright (c) QuantStack\n// Distributed under the terms of the Modified BSD License.\nexport * from './version';\nexport * from './widget';\n","// Copyright (c) QuantStack\n// Distributed under the terms of the Modified BSD License.\nimport { WidgetModel, WidgetView, ISerializers } from '@jupyter-widgets/base';\nimport { MODULE_NAME, MODULE_VERSION } from './version';\nimport Layer from 'ol/layer/Layer.js';\n\nexport class LayerModel extends WidgetModel {\n defaults() {\n return {\n ...super.defaults(),\n _model_name: LayerModel.model_name,\n _model_module: LayerModel.model_module,\n _model_module_version: LayerModel.model_module_version,\n _view_name: LayerModel.view_name,\n _view_module: LayerModel.view_module,\n _view_module_version: LayerModel.view_module_version,\n value: 'Hello World',\n };\n }\n\n static serializers: ISerializers = {\n ...WidgetModel.serializers,\n // Add any extra serializers here\n };\n\n static model_name = 'LayerModel';\n static model_module = MODULE_NAME;\n static model_module_version = MODULE_VERSION;\n static view_name = 'LayerView';\n static view_module = MODULE_NAME;\n static view_module_version = MODULE_VERSION;\n}\n\nexport abstract class LayerView extends WidgetView {\n obj: Layer;\n\n render() {\n super.render();\n this.create_obj();\n }\n\n abstract create_obj(): void;\n}\n","// Copyright (c) QuantStack\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetModel, ISerializers } from '@jupyter-widgets/base';\nimport { BaseControlModel, BaseControlView } from './basecontrol';\nimport MousePosition from 'ol/control/MousePosition.js';\n\nimport 'ol/ol.css';\nimport { MODULE_NAME, MODULE_VERSION } from './version';\nimport '../css/widget.css';\n\nexport class MousePositionModel extends BaseControlModel {\n defaults() {\n return {\n ...super.defaults(),\n _model_name: MousePositionModel.model_name,\n _model_module: MousePositionModel.model_module,\n _model_module_version: MousePositionModel.model_module_version,\n _view_name: MousePositionModel.view_name,\n _view_module: MousePositionModel.view_module,\n _view_module_version: MousePositionModel.view_module_version,\n };\n }\n\n static serializers: ISerializers = {\n ...DOMWidgetModel.serializers,\n // Ajoutez ici tous les sérialiseurs supplémentaires\n };\n\n static model_name = 'MousePositionModel';\n static model_module = MODULE_NAME;\n static model_module_version = MODULE_VERSION;\n static view_name = 'MousePositionView';\n static view_module = MODULE_NAME;\n static view_module_version = MODULE_VERSION;\n}\nexport class MousePositionView extends BaseControlView {\n createObj() {\n this.obj = new MousePosition({\n className: 'ol-mouse-position',\n });\n }\n}\n","// Copyright (c) QuantStack\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetModel, ISerializers } from '@jupyter-widgets/base';\n\nimport 'ol/ol.css';\nimport { MODULE_NAME, MODULE_VERSION } from './version';\nimport '../css/widget.css';\nimport { BaseOverlayModel, BaseOverlayView } from './baseoverlay';\n\nexport class PopupOverlayModel extends BaseOverlayModel {\n defaults() {\n return {\n ...super.defaults(),\n _model_name: PopupOverlayModel.model_name,\n _model_module: PopupOverlayModel.model_module,\n _model_module_version: PopupOverlayModel.model_module_version,\n _view_name: PopupOverlayModel.view_name,\n _view_module: PopupOverlayModel.view_module,\n _view_module_version: PopupOverlayModel.view_module_version,\n };\n }\n\n static serializers: ISerializers = {\n ...DOMWidgetModel.serializers,\n // Ajoutez ici tous les sérialiseurs supplémentaires\n };\n\n static model_name = 'PopupOverlayModel';\n static model_module = MODULE_NAME;\n static model_module_version = MODULE_VERSION;\n static view_name = 'PopupOverlayView';\n static view_module = MODULE_NAME;\n static view_module_version = MODULE_VERSION;\n}\nexport class PopupOverlayView extends BaseOverlayView {\n render() {\n super.render();\n this.updatePopupElement();\n }\n createElement() {\n this.element = document.createElement('div');\n }\n\n model_events() {\n super.model_events();\n this.listenTo(this.model, 'change:popup_content', this.updatePopupElement);\n }\n\n updatePopupElement() {\n const popupContent = this.model.get('popup_content');\n if (popupContent) {\n this.element.innerHTML = popupContent;\n }\n }\n}\n","// Copyright (c) QuantStack\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetModel, ISerializers } from '@jupyter-widgets/base';\nimport TileLayer from 'ol/layer/WebGLTile.js';\nimport XYZ from 'ol/source/XYZ.js';\nimport { MODULE_NAME, MODULE_VERSION } from './version';\nimport { MapView } from './widget';\nimport { LayerModel, LayerView } from './layer';\n\nexport class RasterTileLayerModel extends LayerModel {\n defaults() {\n return {\n ...super.defaults(),\n _model_name: RasterTileLayerModel.model_name,\n _model_module: RasterTileLayerModel.model_module,\n _model_module_version: RasterTileLayerModel.model_module_version,\n _view_name: RasterTileLayerModel.view_name,\n _view_module: RasterTileLayerModel.view_module,\n _view_module_version: RasterTileLayerModel.view_module_version,\n layers: [],\n url: '',\n attributions: [],\n tileSize: 256,\n max_zoom: 19,\n min_zoom: 0,\n };\n }\n\n static serializers: ISerializers = {\n ...DOMWidgetModel.serializers,\n // Add any extra serializers here\n };\n\n static model_name = 'RasterTileLayerModel';\n static model_module = MODULE_NAME;\n static model_module_version = MODULE_VERSION;\n static view_name = 'RasterTileLayerView';\n static view_module = MODULE_NAME;\n static view_module_version = MODULE_VERSION;\n}\n\nexport class RasterTileLayerView extends LayerView {\n map_view: MapView;\n\n render() {\n super.render();\n this.urlChanged();\n this.model.on('change:url', this.urlChanged, this);\n }\n\n create_obj() {\n this.obj = this.tileLayer = new TileLayer({\n source: new XYZ({\n url: this.model.get('url'),\n attributions: this.model.get('attributions'),\n tileSize: this.model.get('tileSize'),\n maxZoom: this.model.get('max_zoom'),\n minZoom: this.model.get('min_zoom'),\n }),\n });\n }\n\n urlChanged() {\n const newUrl = this.model.get('url');\n if (newUrl) {\n const newSource = new XYZ({\n url: newUrl,\n attributions: this.model.get('attributions'),\n tileSize: this.model.get('tileSize'),\n maxZoom: this.model.get('max_zoom'),\n minZoom: this.model.get('min_zoom'),\n });\n this.tileLayer.setSource(newSource);\n }\n }\n\n tileLayer: TileLayer;\n}\n","// Copyright (c) QuantStack\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetModel, ISerializers } from '@jupyter-widgets/base';\nimport { BaseControlModel, BaseControlView } from './basecontrol';\nimport ScaleLine from 'ol/control/ScaleLine.js';\nimport 'ol/ol.css';\nimport { MODULE_NAME, MODULE_VERSION } from './version';\nimport '../css/widget.css';\n\nexport class ScaleLineModel extends BaseControlModel {\n defaults() {\n return {\n ...super.defaults(),\n _model_name: ScaleLineModel.model_name,\n _model_module: ScaleLineModel.model_module,\n _model_module_version: ScaleLineModel.model_module_version,\n _view_name: ScaleLineModel.view_name,\n _view_module: ScaleLineModel.view_module,\n _view_module_version: ScaleLineModel.view_module_version,\n };\n }\n\n static serializers: ISerializers = {\n ...DOMWidgetModel.serializers,\n // Ajoutez ici tous les sérialiseurs supplémentaires\n };\n\n static model_name = 'ScaleLineModel';\n static model_module = MODULE_NAME;\n static model_module_version = MODULE_VERSION;\n static view_name = 'ScaleLineView';\n static view_module = MODULE_NAME;\n static view_module_version = MODULE_VERSION;\n}\nexport class ScaleLineView extends BaseControlView {\n createObj() {\n this.obj = new ScaleLine({\n className: 'ol-scale-line',\n });\n }\n}\n","// Copyright (c) QuantStack\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetModel, ISerializers } from '@jupyter-widgets/base';\nimport VectorTileLayer from 'ol/layer/VectorTile';\nimport VectorTileSource from 'ol/source/VectorTile';\nimport { MODULE_NAME, MODULE_VERSION } from './version';\nimport { LayerModel, LayerView } from './layer';\nimport { createXYZ } from 'ol/tilegrid';\nimport MVT from 'ol/format/MVT';\nimport GeoJSON from 'ol/format/GeoJSON';\nimport TopoJSON from 'ol/format/TopoJSON';\nimport { Circle as CircleStyle, Fill, Stroke, Style } from 'ol/style.js';\nimport { StyleFunction } from 'ol/style/Style';\n\nexport class VectorTileLayerModel extends LayerModel {\n defaults() {\n return {\n ...super.defaults(),\n _model_name: VectorTileLayerModel.model_name,\n _model_module: VectorTileLayerModel.model_module,\n _model_module_version: VectorTileLayerModel.model_module_version,\n _view_name: VectorTileLayerModel.view_name,\n _view_module: VectorTileLayerModel.view_module,\n _view_module_version: VectorTileLayerModel.view_module_version,\n features: [],\n };\n }\n\n static serializers: ISerializers = {\n ...DOMWidgetModel.serializers,\n // Add any extra serializers here\n };\n\n static model_name = 'VectorTileLayerModel';\n static model_module = MODULE_NAME;\n static model_module_version = MODULE_VERSION;\n static view_name = 'VectorTileLayerView';\n static view_module = MODULE_NAME;\n static view_module_version = MODULE_VERSION;\n}\n\nexport class VectorTileLayerView extends LayerView {\n obj: VectorTileLayer;\n render() {\n super.render();\n this.model.on('change:url', this.urlChanged, this);\n this.model.on('change:style', this.styleChanged, this);\n this.model.on('change:visible', this.visibilityChanged, this);\n this.model.on('change:opacity', this.opacityChanged, this);\n this.model.on('change:attribution', this.attributionChanged, this);\n this.model.on('change:max_zoom', this.maxZoomChanged, this);\n this.model.on('change:min_zoom', this.minZoomChanged, this);\n }\n create_obj() {\n this.urlChanged();\n this.styleChanged();\n this.visibilityChanged();\n this.opacityChanged();\n this.attributionChanged();\n this.maxZoomChanged();\n this.minZoomChanged();\n }\n\n urlChanged() {\n const newUrl = this.model.get('url');\n\n if (newUrl) {\n const sourceFormat = this.model.get('source_format') || { type: 'MVT' };\n let format: any;\n\n switch (sourceFormat.type) {\n case 'MVT':\n format = new MVT({\n layerName: sourceFormat.layer_name,\n layers: sourceFormat.layers,\n });\n break;\n case 'GeoJSON':\n format = new GeoJSON({\n dataProjection: sourceFormat.dataProjection || 'EPSG:4326',\n featureProjection: sourceFormat.featureProjection,\n geometryName: sourceFormat.geometry_name,\n extractGeometryName: sourceFormat.extractGeometryName || false,\n });\n break;\n case 'TopoJSON':\n format = new TopoJSON({\n dataProjection: sourceFormat.dataProjection || 'EPSG:4326',\n layerName: sourceFormat.layer_name,\n layers: sourceFormat.layers,\n });\n break;\n default:\n format = new MVT({\n layerName: sourceFormat.layer_name,\n layers: sourceFormat.layers,\n });\n break;\n }\n\n const vectorTileSource = new VectorTileSource({\n format: format,\n url: newUrl,\n tileGrid: createXYZ({ maxZoom: 19 }),\n attributions: this.model.get('attribution'),\n maxZoom: this.model.get('max_zoom'),\n minZoom: this.model.get('min_zoom'),\n });\n\n if (this.obj) {\n this.obj.setSource(vectorTileSource);\n } else {\n this.obj = new VectorTileLayer({\n source: vectorTileSource,\n visible: this.model.get('visible'),\n opacity: this.model.get('opacity'),\n style: this.createStyleFunction(),\n });\n }\n }\n }\n\n visibilityChanged() {\n const visible = this.model.get('visible');\n if (this.obj) {\n this.obj.setVisible(visible);\n }\n }\n\n opacityChanged() {\n const opacity = this.model.get('opacity');\n if (this.obj) {\n this.obj.setOpacity(opacity);\n }\n }\n\n attributionChanged() {\n const attribution = this.model.get('attribution');\n if (this.obj) {\n const source = this.obj.getSource();\n if (source) {\n source.setAttributions(attribution);\n }\n }\n }\n\n maxZoomChanged() {\n const maxZoom = this.model.get('max_zoom');\n if (this.obj) {\n const source = this.obj.getSource();\n if (source) {\n source.set('maxZoom', maxZoom);\n }\n }\n }\n\n minZoomChanged() {\n const minZoom = this.model.get('min_zoom');\n if (this.obj) {\n const source = this.obj.getSource();\n if (source) {\n source.set('minZoom', minZoom);\n }\n }\n }\n\n styleChanged() {\n if (this.obj) {\n const styleFunction = this.createStyleFunction();\n this.obj.setStyle(styleFunction);\n }\n }\n\n createStyleFunction(): StyleFunction {\n const modelStyle = this.model.get('style') || {};\n\n return (feature) => {\n return new Style({\n stroke: new Stroke({\n color: modelStyle.strokeColor || '#3399CC',\n width: modelStyle.strokeWidth || 1.25,\n }),\n fill: new Fill({\n color: modelStyle.fillColor || 'rgba(255, 255, 255, 0.4)',\n }),\n image: new CircleStyle({\n radius: modelStyle.pointRadius || 5,\n fill: new Fill({\n color: modelStyle.pointFillColor || '#0000FF',\n }),\n stroke: new Stroke({\n color: modelStyle.pointStrokeColor || '#000000',\n width: modelStyle.pointStrokeWidth || 1,\n }),\n }),\n });\n };\n }\n}\n","// Copyright (c) QuantStack\n// Distributed under the terms of the Modified BSD License.\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst data = require('../package.json');\n\n/**\n * The _model_module_version/_view_module_version this package implements.\n *\n * The html widget manager assumes that this is the same as the npm package\n * version number.\n */\nexport const MODULE_VERSION = data.version;\n\n/*\n * The current package name.\n */\nexport const MODULE_NAME = data.name;\n","// Copyright (c) QuantStack\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetModel, ISerializers } from '@jupyter-widgets/base';\nimport 'ol/ol.css';\nimport { MODULE_NAME, MODULE_VERSION } from './version';\nimport '../css/widget.css';\nimport { BaseOverlayModel, BaseOverlayView } from './baseoverlay';\n\nexport class VideoOverlayModel extends BaseOverlayModel {\n defaults() {\n return {\n ...super.defaults(),\n _model_name: VideoOverlayModel.model_name,\n _model_module: VideoOverlayModel.model_module,\n _model_module_version: VideoOverlayModel.model_module_version,\n _view_name: VideoOverlayModel.view_name,\n _view_module: VideoOverlayModel.view_module,\n _view_module_version: VideoOverlayModel.view_module_version,\n };\n }\n\n static serializers: ISerializers = {\n ...DOMWidgetModel.serializers,\n // Ajoutez ici tous les sérialiseurs supplémentaires\n };\n\n static model_name = 'VideoOverlayModel';\n static model_module = MODULE_NAME;\n static model_module_version = MODULE_VERSION;\n static view_name = 'VideoOverlayVIew';\n static view_module = MODULE_NAME;\n static view_module_version = MODULE_VERSION;\n}\nexport class VideoOverlayView extends BaseOverlayView {\n videoElement: HTMLVideoElement;\n\n render() {\n super.render();\n this.updateVideoElement();\n }\n createElement() {\n this.element = document.createElement('div');\n this.videoElement = document.createElement('video');\n this.videoElement.controls = true;\n this.element.appendChild(this.videoElement);\n }\n\n model_events() {\n super.model_events();\n this.listenTo(this.model, 'change:video_url', this.updateVideoElement);\n }\n\n updateVideoElement() {\n const videoUrl = this.model.get('video_url');\n if (videoUrl) {\n this.videoElement.src = videoUrl;\n }\n }\n}\n","// Copyright (c) QuantStack\n// Distributed under the terms of the Modified BSD License.\nimport {\n DOMWidgetModel,\n DOMWidgetView,\n ISerializers,\n unpack_models,\n ViewList,\n} from '@jupyter-widgets/base';\nimport { LayerModel, LayerView } from './layer';\nimport { BaseOverlayModel, BaseOverlayView } from './baseoverlay';\nimport { BaseControlModel, BaseControlView } from './basecontrol';\nimport { ViewObjectEventTypes } from 'ol/View';\nimport TileLayer from 'ol/layer/Tile';\nimport MapBrowserEvent from 'ol/MapBrowserEvent';\nimport { Map } from 'ol';\nimport View from 'ol/View';\nimport 'ol/ol.css';\nimport { MODULE_NAME, MODULE_VERSION } from './version';\nimport '../css/widget.css';\nimport { useGeographic } from 'ol/proj';\nimport { ObjectEvent } from 'ol/Object';\nimport { OSM } from 'ol/source';\nexport * from './imageoverlay';\nexport * from './geojson';\nexport * from './video_overlay';\nexport * from './popupoverlay';\nexport * from './zoomslider';\nexport * from './fullscreen';\nexport * from './scaleline';\nexport * from './mouseposition';\nexport * from './heatmap';\nexport * from './rastertilelayer';\nexport * from './geotifflayer';\nexport * from './vectortilelayer';\n\nconst DEFAULT_LOCATION = [0.0, 0.0];\n\nexport class MapModel extends DOMWidgetModel {\n defaults() {\n return {\n ...super.defaults(),\n _model_name: MapModel.model_name,\n _model_module: MapModel.model_module,\n _model_module_version: MapModel.model_module_version,\n _view_name: MapModel.view_name,\n _view_module: MapModel.view_module,\n _view_module_version: MapModel.view_module_version,\n layers: [],\n controls: [],\n overlays: [],\n zoom: 2,\n center: DEFAULT_LOCATION,\n };\n }\n\n static serializers: ISerializers = {\n ...DOMWidgetModel.serializers,\n layers: { deserialize: unpack_models },\n overlays: { deserialize: unpack_models },\n controls: { deserialize: unpack_models },\n\n // Add any extra serializers here\n };\n\n static model_name = 'MapModel';\n static model_module = MODULE_NAME;\n static model_module_version = MODULE_VERSION;\n static view_name = 'MapView';\n static view_module = MODULE_NAME;\n static view_module_version = MODULE_VERSION;\n}\n\nexport class MapView extends DOMWidgetView {\n render() {\n useGeographic();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('ipyopenlayer-widgets');\n\n this.map_container = document.createElement('div');\n this.map_container.classList.add('ol-container');\n requestAnimationFrame(() => {\n const parentElement = this.el.parentElement;\n if (parentElement) {\n parentElement.classList.add('ipyopenlayer-map-container-wrapper');\n const grandParentElement = parentElement.parentElement;\n if (grandParentElement) {\n grandParentElement.classList.add(\n 'ipyopenlayer-map-container-wrapper-parent',\n );\n }\n }\n });\n this.el.appendChild(this.map_container);\n\n this.layerViews = new ViewList(\n this.addLayerModel,\n this.removeLayerView,\n this,\n );\n\n this.overlayViews = new ViewList(\n this.addOverlayModel,\n this.removeOverlayView,\n this,\n );\n\n this.controlViews = new ViewList(\n this.addControlModel,\n this.removeControlView,\n this,\n );\n this.map = new Map({\n target: this.map_container,\n view: new View({\n center: this.model.get('center'),\n zoom: this.model.get('zoom'),\n }),\n layers: [\n new TileLayer({\n source: new OSM(),\n }),\n ],\n });\n\n this.map.on('click', (event: MapBrowserEvent) => {\n this.handleMapClick(event);\n });\n\n this.map.getView().on('change:center', () => {\n this.model.set('center', this.map.getView().getCenter());\n this.model.save_changes();\n });\n\n this.map\n .getView()\n .on('change:resolution' as ViewObjectEventTypes, (event: ObjectEvent) => {\n this.model.set('zoom', this.map.getView().getZoom());\n this.model.save_changes();\n });\n\n this.layersChanged();\n this.overlayChanged();\n this.controlChanged();\n this.model.on('change:layers', this.layersChanged, this);\n this.model.on('change:overlays', this.overlayChanged, this);\n this.model.on('change:controls', this.controlChanged, this);\n this.model.on('change:zoom', this.zoomChanged, this);\n this.model.on('change:center', this.centerChanged, this);\n }\n\n handleMapClick(event: MapBrowserEvent) {\n const coordinate = event.coordinate;\n const [lon, lat] = coordinate;\n this.send({ type: 'click', lon, lat });\n }\n layersChanged() {\n const layers = this.model.get('layers') as LayerModel[];\n this.layerViews.update(layers);\n }\n\n overlayChanged() {\n const overlay = this.model.get('overlays') as BaseOverlayModel[];\n this.overlayViews.update(overlay);\n }\n\n controlChanged() {\n const control = this.model.get('controls') as BaseOverlayModel[];\n this.controlViews.update(control);\n }\n\n zoomChanged() {\n const newZoom = this.model.get('zoom');\n if (newZoom !== undefined && newZoom !== null) {\n this.map.getView().setZoom(newZoom);\n }\n }\n\n centerChanged() {\n const newCenter = this.model.get('center');\n if (newCenter !== undefined && newCenter !== null) {\n this.map.getView().setCenter(newCenter);\n }\n }\n\n removeLayerView(child_view: LayerView) {\n this.map.removeLayer(child_view.obj);\n child_view.remove();\n }\n\n removeOverlayView(child_view: BaseOverlayView) {\n if (child_view.overlay) {\n this.map.removeOverlay(child_view.overlay);\n }\n child_view.remove();\n }\n\n removeControlView(child_view: BaseControlView) {\n this.map.removeControl(child_view.obj);\n child_view.remove();\n }\n\n async addLayerModel(child_model: LayerModel) {\n const view = await this.create_child_view(child_model, {\n map_view: this,\n });\n this.map.addLayer(view.obj);\n this.displayed.then(() => {\n view.trigger('displayed', this);\n });\n return view;\n }\n\n async addOverlayModel(child_model: BaseOverlayModel) {\n const view = await this.create_child_view(child_model, {\n map_view: this,\n });\n this.map.addOverlay(view.overlay);\n this.displayed.then(() => {\n view.trigger('displayed', this);\n });\n return view;\n }\n\n async addControlModel(child_model: BaseControlModel) {\n const view = await this.create_child_view(child_model, {\n map_view: this,\n });\n if (view.obj) {\n this.map.addControl(view.obj);\n\n this.displayed.then(() => {\n view.trigger('displayed', this);\n });\n }\n\n return view;\n }\n\n imageElement: HTMLImageElement;\n map_container: HTMLDivElement;\n map: Map;\n layerViews: ViewList;\n overlayViews: ViewList;\n controlViews: ViewList;\n}\n","// Copyright (c) QuantStack\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetModel, ISerializers } from '@jupyter-widgets/base';\nimport { BaseControlModel, BaseControlView } from './basecontrol';\nimport ZoomSlider from 'ol/control/ZoomSlider';\n\nimport 'ol/ol.css';\nimport { MODULE_NAME, MODULE_VERSION } from './version';\nimport '../css/widget.css';\n\nexport class ZoomSliderModel extends BaseControlModel {\n defaults() {\n return {\n ...super.defaults(),\n _model_name: ZoomSliderModel.model_name,\n _model_module: ZoomSliderModel.model_module,\n _model_module_version: ZoomSliderModel.model_module_version,\n _view_name: ZoomSliderModel.view_name,\n _view_module: ZoomSliderModel.view_module,\n _view_module_version: ZoomSliderModel.view_module_version,\n };\n }\n\n static serializers: ISerializers = {\n ...DOMWidgetModel.serializers,\n // Ajoutez ici tous les sérialiseurs supplémentaires\n };\n\n static model_name = 'ZoomSliderModel';\n static model_module = MODULE_NAME;\n static model_module_version = MODULE_VERSION;\n static view_name = 'ZoomSliderView';\n static view_module = MODULE_NAME;\n static view_module_version = MODULE_VERSION;\n}\nexport class ZoomSliderView extends BaseControlView {\n createObj() {\n this.obj = new ZoomSlider({\n className: 'ol-zoomslider',\n });\n }\n}\n","module.exports = __WEBPACK_EXTERNAL_MODULE__2055__;","export const fieldTagNames = {\n // TIFF Baseline\n 0x013B: 'Artist',\n 0x0102: 'BitsPerSample',\n 0x0109: 'CellLength',\n 0x0108: 'CellWidth',\n 0x0140: 'ColorMap',\n 0x0103: 'Compression',\n 0x8298: 'Copyright',\n 0x0132: 'DateTime',\n 0x0152: 'ExtraSamples',\n 0x010A: 'FillOrder',\n 0x0121: 'FreeByteCounts',\n 0x0120: 'FreeOffsets',\n 0x0123: 'GrayResponseCurve',\n 0x0122: 'GrayResponseUnit',\n 0x013C: 'HostComputer',\n 0x010E: 'ImageDescription',\n 0x0101: 'ImageLength',\n 0x0100: 'ImageWidth',\n 0x010F: 'Make',\n 0x0119: 'MaxSampleValue',\n 0x0118: 'MinSampleValue',\n 0x0110: 'Model',\n 0x00FE: 'NewSubfileType',\n 0x0112: 'Orientation',\n 0x0106: 'PhotometricInterpretation',\n 0x011C: 'PlanarConfiguration',\n 0x0128: 'ResolutionUnit',\n 0x0116: 'RowsPerStrip',\n 0x0115: 'SamplesPerPixel',\n 0x0131: 'Software',\n 0x0117: 'StripByteCounts',\n 0x0111: 'StripOffsets',\n 0x00FF: 'SubfileType',\n 0x0107: 'Threshholding',\n 0x011A: 'XResolution',\n 0x011B: 'YResolution',\n\n // TIFF Extended\n 0x0146: 'BadFaxLines',\n 0x0147: 'CleanFaxData',\n 0x0157: 'ClipPath',\n 0x0148: 'ConsecutiveBadFaxLines',\n 0x01B1: 'Decode',\n 0x01B2: 'DefaultImageColor',\n 0x010D: 'DocumentName',\n 0x0150: 'DotRange',\n 0x0141: 'HalftoneHints',\n 0x015A: 'Indexed',\n 0x015B: 'JPEGTables',\n 0x011D: 'PageName',\n 0x0129: 'PageNumber',\n 0x013D: 'Predictor',\n 0x013F: 'PrimaryChromaticities',\n 0x0214: 'ReferenceBlackWhite',\n 0x0153: 'SampleFormat',\n 0x0154: 'SMinSampleValue',\n 0x0155: 'SMaxSampleValue',\n 0x022F: 'StripRowCounts',\n 0x014A: 'SubIFDs',\n 0x0124: 'T4Options',\n 0x0125: 'T6Options',\n 0x0145: 'TileByteCounts',\n 0x0143: 'TileLength',\n 0x0144: 'TileOffsets',\n 0x0142: 'TileWidth',\n 0x012D: 'TransferFunction',\n 0x013E: 'WhitePoint',\n 0x0158: 'XClipPathUnits',\n 0x011E: 'XPosition',\n 0x0211: 'YCbCrCoefficients',\n 0x0213: 'YCbCrPositioning',\n 0x0212: 'YCbCrSubSampling',\n 0x0159: 'YClipPathUnits',\n 0x011F: 'YPosition',\n\n // EXIF\n 0x9202: 'ApertureValue',\n 0xA001: 'ColorSpace',\n 0x9004: 'DateTimeDigitized',\n 0x9003: 'DateTimeOriginal',\n 0x8769: 'Exif IFD',\n 0x9000: 'ExifVersion',\n 0x829A: 'ExposureTime',\n 0xA300: 'FileSource',\n 0x9209: 'Flash',\n 0xA000: 'FlashpixVersion',\n 0x829D: 'FNumber',\n 0xA420: 'ImageUniqueID',\n 0x9208: 'LightSource',\n 0x927C: 'MakerNote',\n 0x9201: 'ShutterSpeedValue',\n 0x9286: 'UserComment',\n\n // IPTC\n 0x83BB: 'IPTC',\n\n // ICC\n 0x8773: 'ICC Profile',\n\n // XMP\n 0x02BC: 'XMP',\n\n // GDAL\n 0xA480: 'GDAL_METADATA',\n 0xA481: 'GDAL_NODATA',\n\n // Photoshop\n 0x8649: 'Photoshop',\n\n // GeoTiff\n 0x830E: 'ModelPixelScale',\n 0x8482: 'ModelTiepoint',\n 0x85D8: 'ModelTransformation',\n 0x87AF: 'GeoKeyDirectory',\n 0x87B0: 'GeoDoubleParams',\n 0x87B1: 'GeoAsciiParams',\n\n // LERC\n 0xC5F2: 'LercParameters',\n};\n\nexport const fieldTags = {};\nfor (const key in fieldTagNames) {\n if (fieldTagNames.hasOwnProperty(key)) {\n fieldTags[fieldTagNames[key]] = parseInt(key, 10);\n }\n}\n\nexport const fieldTagTypes = {\n 256: 'SHORT',\n 257: 'SHORT',\n 258: 'SHORT',\n 259: 'SHORT',\n 262: 'SHORT',\n 273: 'LONG',\n 274: 'SHORT',\n 277: 'SHORT',\n 278: 'LONG',\n 279: 'LONG',\n 282: 'RATIONAL',\n 283: 'RATIONAL',\n 284: 'SHORT',\n 286: 'SHORT',\n 287: 'RATIONAL',\n 296: 'SHORT',\n 297: 'SHORT',\n 305: 'ASCII',\n 306: 'ASCII',\n 338: 'SHORT',\n 339: 'SHORT',\n 513: 'LONG',\n 514: 'LONG',\n 1024: 'SHORT',\n 1025: 'SHORT',\n 2048: 'SHORT',\n 2049: 'ASCII',\n 3072: 'SHORT',\n 3073: 'ASCII',\n 33550: 'DOUBLE',\n 33922: 'DOUBLE',\n 34264: 'DOUBLE',\n 34665: 'LONG',\n 34735: 'SHORT',\n 34736: 'DOUBLE',\n 34737: 'ASCII',\n 42113: 'ASCII',\n};\n\nexport const arrayFields = [\n fieldTags.BitsPerSample,\n fieldTags.ExtraSamples,\n fieldTags.SampleFormat,\n fieldTags.StripByteCounts,\n fieldTags.StripOffsets,\n fieldTags.StripRowCounts,\n fieldTags.TileByteCounts,\n fieldTags.TileOffsets,\n fieldTags.SubIFDs,\n];\n\nexport const fieldTypeNames = {\n 0x0001: 'BYTE',\n 0x0002: 'ASCII',\n 0x0003: 'SHORT',\n 0x0004: 'LONG',\n 0x0005: 'RATIONAL',\n 0x0006: 'SBYTE',\n 0x0007: 'UNDEFINED',\n 0x0008: 'SSHORT',\n 0x0009: 'SLONG',\n 0x000A: 'SRATIONAL',\n 0x000B: 'FLOAT',\n 0x000C: 'DOUBLE',\n // IFD offset, suggested by https://owl.phy.queensu.ca/~phil/exiftool/standards.html\n 0x000D: 'IFD',\n // introduced by BigTIFF\n 0x0010: 'LONG8',\n 0x0011: 'SLONG8',\n 0x0012: 'IFD8',\n};\n\nexport const fieldTypes = {};\nfor (const key in fieldTypeNames) {\n if (fieldTypeNames.hasOwnProperty(key)) {\n fieldTypes[fieldTypeNames[key]] = parseInt(key, 10);\n }\n}\n\nexport const photometricInterpretations = {\n WhiteIsZero: 0,\n BlackIsZero: 1,\n RGB: 2,\n Palette: 3,\n TransparencyMask: 4,\n CMYK: 5,\n YCbCr: 6,\n\n CIELab: 8,\n ICCLab: 9,\n};\n\nexport const ExtraSamplesValues = {\n Unspecified: 0,\n Assocalpha: 1,\n Unassalpha: 2,\n};\n\nexport const LercParameters = {\n Version: 0,\n AddCompression: 1,\n};\n\nexport const LercAddCompression = {\n None: 0,\n Deflate: 1,\n Zstandard: 2,\n};\n\nexport const geoKeyNames = {\n 1024: 'GTModelTypeGeoKey',\n 1025: 'GTRasterTypeGeoKey',\n 1026: 'GTCitationGeoKey',\n 2048: 'GeographicTypeGeoKey',\n 2049: 'GeogCitationGeoKey',\n 2050: 'GeogGeodeticDatumGeoKey',\n 2051: 'GeogPrimeMeridianGeoKey',\n 2052: 'GeogLinearUnitsGeoKey',\n 2053: 'GeogLinearUnitSizeGeoKey',\n 2054: 'GeogAngularUnitsGeoKey',\n 2055: 'GeogAngularUnitSizeGeoKey',\n 2056: 'GeogEllipsoidGeoKey',\n 2057: 'GeogSemiMajorAxisGeoKey',\n 2058: 'GeogSemiMinorAxisGeoKey',\n 2059: 'GeogInvFlatteningGeoKey',\n 2060: 'GeogAzimuthUnitsGeoKey',\n 2061: 'GeogPrimeMeridianLongGeoKey',\n 2062: 'GeogTOWGS84GeoKey',\n 3072: 'ProjectedCSTypeGeoKey',\n 3073: 'PCSCitationGeoKey',\n 3074: 'ProjectionGeoKey',\n 3075: 'ProjCoordTransGeoKey',\n 3076: 'ProjLinearUnitsGeoKey',\n 3077: 'ProjLinearUnitSizeGeoKey',\n 3078: 'ProjStdParallel1GeoKey',\n 3079: 'ProjStdParallel2GeoKey',\n 3080: 'ProjNatOriginLongGeoKey',\n 3081: 'ProjNatOriginLatGeoKey',\n 3082: 'ProjFalseEastingGeoKey',\n 3083: 'ProjFalseNorthingGeoKey',\n 3084: 'ProjFalseOriginLongGeoKey',\n 3085: 'ProjFalseOriginLatGeoKey',\n 3086: 'ProjFalseOriginEastingGeoKey',\n 3087: 'ProjFalseOriginNorthingGeoKey',\n 3088: 'ProjCenterLongGeoKey',\n 3089: 'ProjCenterLatGeoKey',\n 3090: 'ProjCenterEastingGeoKey',\n 3091: 'ProjCenterNorthingGeoKey',\n 3092: 'ProjScaleAtNatOriginGeoKey',\n 3093: 'ProjScaleAtCenterGeoKey',\n 3094: 'ProjAzimuthAngleGeoKey',\n 3095: 'ProjStraightVertPoleLongGeoKey',\n 3096: 'ProjRectifiedGridAngleGeoKey',\n 4096: 'VerticalCSTypeGeoKey',\n 4097: 'VerticalCitationGeoKey',\n 4098: 'VerticalDatumGeoKey',\n 4099: 'VerticalUnitsGeoKey',\n};\n\nexport const geoKeys = {};\nfor (const key in geoKeyNames) {\n if (geoKeyNames.hasOwnProperty(key)) {\n geoKeys[geoKeyNames[key]] = parseInt(key, 10);\n }\n}\n","/**\n * @module ol/Collection\n */\nimport BaseObject from './Object.js';\nimport CollectionEventType from './CollectionEventType.js';\nimport Event from './events/Event.js';\n\n/**\n * @enum {string}\n * @private\n */\nconst Property = {\n LENGTH: 'length',\n};\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/Collection~Collection} instances are instances of this\n * type.\n * @template T\n */\nexport class CollectionEvent extends Event {\n /**\n * @param {import(\"./CollectionEventType.js\").default} type Type.\n * @param {T} element Element.\n * @param {number} index The index of the added or removed element.\n */\n constructor(type, element, index) {\n super(type);\n\n /**\n * The element that is added to or removed from the collection.\n * @type {T}\n * @api\n */\n this.element = element;\n\n /**\n * The index of the added or removed element.\n * @type {number}\n * @api\n */\n this.index = index;\n }\n}\n\n/***\n * @template T\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature<'add'|'remove', CollectionEvent, Return> &\n * import(\"./Observable\").CombinedOnSignature} CollectionOnSignature\n */\n\n/**\n * @typedef {Object} Options\n * @property {boolean} [unique=false] Disallow the same item from being added to\n * the collection twice.\n */\n\n/**\n * @classdesc\n * An expanded version of standard JS Array, adding convenience methods for\n * manipulation. Add and remove changes to the Collection trigger a Collection\n * event. Note that this does not cover changes to the objects _within_ the\n * Collection; they trigger events on the appropriate object, not on the\n * Collection as a whole.\n *\n * @fires CollectionEvent\n *\n * @template T\n * @api\n */\nclass Collection extends BaseObject {\n /**\n * @param {Array} [array] Array.\n * @param {Options} [options] Collection options.\n */\n constructor(array, options) {\n super();\n\n /***\n * @type {CollectionOnSignature}\n */\n this.on;\n\n /***\n * @type {CollectionOnSignature}\n */\n this.once;\n\n /***\n * @type {CollectionOnSignature}\n */\n this.un;\n\n options = options || {};\n\n /**\n * @private\n * @type {boolean}\n */\n this.unique_ = !!options.unique;\n\n /**\n * @private\n * @type {!Array}\n */\n this.array_ = array ? array : [];\n\n if (this.unique_) {\n for (let i = 0, ii = this.array_.length; i < ii; ++i) {\n this.assertUnique_(this.array_[i], i);\n }\n }\n\n this.updateLength_();\n }\n\n /**\n * Remove all elements from the collection.\n * @api\n */\n clear() {\n while (this.getLength() > 0) {\n this.pop();\n }\n }\n\n /**\n * Add elements to the collection. This pushes each item in the provided array\n * to the end of the collection.\n * @param {!Array} arr Array.\n * @return {Collection} This collection.\n * @api\n */\n extend(arr) {\n for (let i = 0, ii = arr.length; i < ii; ++i) {\n this.push(arr[i]);\n }\n return this;\n }\n\n /**\n * Iterate over each element, calling the provided callback.\n * @param {function(T, number, Array): *} f The function to call\n * for every element. This function takes 3 arguments (the element, the\n * index and the array). The return value is ignored.\n * @api\n */\n forEach(f) {\n const array = this.array_;\n for (let i = 0, ii = array.length; i < ii; ++i) {\n f(array[i], i, array);\n }\n }\n\n /**\n * Get a reference to the underlying Array object. Warning: if the array\n * is mutated, no events will be dispatched by the collection, and the\n * collection's \"length\" property won't be in sync with the actual length\n * of the array.\n * @return {!Array} Array.\n * @api\n */\n getArray() {\n return this.array_;\n }\n\n /**\n * Get the element at the provided index.\n * @param {number} index Index.\n * @return {T} Element.\n * @api\n */\n item(index) {\n return this.array_[index];\n }\n\n /**\n * Get the length of this collection.\n * @return {number} The length of the array.\n * @observable\n * @api\n */\n getLength() {\n return this.get(Property.LENGTH);\n }\n\n /**\n * Insert an element at the provided index.\n * @param {number} index Index.\n * @param {T} elem Element.\n * @api\n */\n insertAt(index, elem) {\n if (index < 0 || index > this.getLength()) {\n throw new Error('Index out of bounds: ' + index);\n }\n if (this.unique_) {\n this.assertUnique_(elem);\n }\n this.array_.splice(index, 0, elem);\n this.updateLength_();\n this.dispatchEvent(\n new CollectionEvent(CollectionEventType.ADD, elem, index),\n );\n }\n\n /**\n * Remove the last element of the collection and return it.\n * Return `undefined` if the collection is empty.\n * @return {T|undefined} Element.\n * @api\n */\n pop() {\n return this.removeAt(this.getLength() - 1);\n }\n\n /**\n * Insert the provided element at the end of the collection.\n * @param {T} elem Element.\n * @return {number} New length of the collection.\n * @api\n */\n push(elem) {\n if (this.unique_) {\n this.assertUnique_(elem);\n }\n const n = this.getLength();\n this.insertAt(n, elem);\n return this.getLength();\n }\n\n /**\n * Remove the first occurrence of an element from the collection.\n * @param {T} elem Element.\n * @return {T|undefined} The removed element or undefined if none found.\n * @api\n */\n remove(elem) {\n const arr = this.array_;\n for (let i = 0, ii = arr.length; i < ii; ++i) {\n if (arr[i] === elem) {\n return this.removeAt(i);\n }\n }\n return undefined;\n }\n\n /**\n * Remove the element at the provided index and return it.\n * Return `undefined` if the collection does not contain this index.\n * @param {number} index Index.\n * @return {T|undefined} Value.\n * @api\n */\n removeAt(index) {\n if (index < 0 || index >= this.getLength()) {\n return undefined;\n }\n const prev = this.array_[index];\n this.array_.splice(index, 1);\n this.updateLength_();\n this.dispatchEvent(\n /** @type {CollectionEvent} */ (\n new CollectionEvent(CollectionEventType.REMOVE, prev, index)\n ),\n );\n return prev;\n }\n\n /**\n * Set the element at the provided index.\n * @param {number} index Index.\n * @param {T} elem Element.\n * @api\n */\n setAt(index, elem) {\n const n = this.getLength();\n if (index >= n) {\n this.insertAt(index, elem);\n return;\n }\n if (index < 0) {\n throw new Error('Index out of bounds: ' + index);\n }\n if (this.unique_) {\n this.assertUnique_(elem, index);\n }\n const prev = this.array_[index];\n this.array_[index] = elem;\n this.dispatchEvent(\n /** @type {CollectionEvent} */ (\n new CollectionEvent(CollectionEventType.REMOVE, prev, index)\n ),\n );\n this.dispatchEvent(\n /** @type {CollectionEvent} */ (\n new CollectionEvent(CollectionEventType.ADD, elem, index)\n ),\n );\n }\n\n /**\n * @private\n */\n updateLength_() {\n this.set(Property.LENGTH, this.array_.length);\n }\n\n /**\n * @private\n * @param {T} elem Element.\n * @param {number} [except] Optional index to ignore.\n */\n assertUnique_(elem, except) {\n for (let i = 0, ii = this.array_.length; i < ii; ++i) {\n if (this.array_[i] === elem && i !== except) {\n throw new Error('Duplicate item added to a unique collection');\n }\n }\n }\n}\n\nexport default Collection;\n","/**\n * @module ol/CollectionEventType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered when an item is added to the collection.\n * @event module:ol/Collection.CollectionEvent#add\n * @api\n */\n ADD: 'add',\n /**\n * Triggered when an item is removed from the collection.\n * @event module:ol/Collection.CollectionEvent#remove\n * @api\n */\n REMOVE: 'remove',\n};\n","/**\n * @module ol/DataTile\n */\nimport Tile from './Tile.js';\nimport TileState from './TileState.js';\nimport {createCanvasContext2D} from './dom.js';\n\n/**\n * @typedef {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|ImageBitmap} ImageLike\n */\n\n/**\n * @typedef {Uint8Array|Uint8ClampedArray|Float32Array|DataView} ArrayLike\n */\n\n/**\n * Data that can be used with a DataTile.\n * @typedef {ArrayLike|ImageLike} Data\n */\n\n/**\n * @param {Data} data Tile data.\n * @return {ImageLike|null} The image-like data.\n */\nexport function asImageLike(data) {\n return data instanceof Image ||\n data instanceof HTMLCanvasElement ||\n data instanceof HTMLVideoElement ||\n data instanceof ImageBitmap\n ? data\n : null;\n}\n\n/**\n * @param {Data} data Tile data.\n * @return {ArrayLike|null} The array-like data.\n */\nexport function asArrayLike(data) {\n return data instanceof Uint8Array ||\n data instanceof Uint8ClampedArray ||\n data instanceof Float32Array ||\n data instanceof DataView\n ? data\n : null;\n}\n\n/**\n * @type {CanvasRenderingContext2D|null}\n */\nlet sharedContext = null;\n\n/**\n * @param {ImageLike} image The image.\n * @return {Uint8ClampedArray} The data.\n */\nexport function toArray(image) {\n if (!sharedContext) {\n sharedContext = createCanvasContext2D(\n image.width,\n image.height,\n undefined,\n {willReadFrequently: true},\n );\n }\n const canvas = sharedContext.canvas;\n const width = image.width;\n if (canvas.width !== width) {\n canvas.width = width;\n }\n const height = image.height;\n if (canvas.height !== height) {\n canvas.height = height;\n }\n sharedContext.clearRect(0, 0, width, height);\n sharedContext.drawImage(image, 0, 0);\n return sharedContext.getImageData(0, 0, width, height).data;\n}\n\n/**\n * @type {import('./size.js').Size}\n */\nconst defaultSize = [256, 256];\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @property {function(): Promise} loader Data loader. For loaders that generate images,\n * the promise should not resolve until the image is loaded.\n * @property {number} [transition=250] A duration for tile opacity\n * transitions in milliseconds. A duration of 0 disables the opacity transition.\n * @property {boolean} [interpolate=false] Use interpolated values when resampling. By default,\n * the nearest neighbor is used when resampling.\n * @property {import('./size.js').Size} [size=[256, 256]] Tile size.\n * @api\n */\n\nclass DataTile extends Tile {\n /**\n * @param {Options} options Tile options.\n */\n constructor(options) {\n const state = TileState.IDLE;\n\n super(options.tileCoord, state, {\n transition: options.transition,\n interpolate: options.interpolate,\n });\n\n /**\n * @type {function(): Promise}\n * @private\n */\n this.loader_ = options.loader;\n\n /**\n * @type {Data}\n * @private\n */\n this.data_ = null;\n\n /**\n * @type {Error}\n * @private\n */\n this.error_ = null;\n\n /**\n * @type {import('./size.js').Size|null}\n * @private\n */\n this.size_ = options.size || null;\n }\n\n /**\n * Get the tile size.\n * @return {import('./size.js').Size} Tile size.\n */\n getSize() {\n if (this.size_) {\n return this.size_;\n }\n const imageData = asImageLike(this.data_);\n if (imageData) {\n return [imageData.width, imageData.height];\n }\n return defaultSize;\n }\n\n /**\n * Get the data for the tile.\n * @return {Data} Tile data.\n * @api\n */\n getData() {\n return this.data_;\n }\n\n /**\n * Get any loading error.\n * @return {Error} Loading error.\n * @api\n */\n getError() {\n return this.error_;\n }\n\n /**\n * Load not yet loaded URI.\n * @api\n */\n load() {\n if (this.state !== TileState.IDLE && this.state !== TileState.ERROR) {\n return;\n }\n this.state = TileState.LOADING;\n this.changed();\n\n const self = this;\n this.loader_()\n .then(function (data) {\n self.data_ = data;\n self.state = TileState.LOADED;\n self.changed();\n })\n .catch(function (error) {\n self.error_ = error;\n self.state = TileState.ERROR;\n self.changed();\n });\n }\n}\n\nexport default DataTile;\n","/**\n * @module ol/Disposable\n */\n\n/**\n * @classdesc\n * Objects that need to clean up after themselves.\n */\nclass Disposable {\n constructor() {\n /**\n * The object has already been disposed.\n * @type {boolean}\n * @protected\n */\n this.disposed = false;\n }\n\n /**\n * Clean up.\n */\n dispose() {\n if (!this.disposed) {\n this.disposed = true;\n this.disposeInternal();\n }\n }\n\n /**\n * Extension point for disposable objects.\n * @protected\n */\n disposeInternal() {}\n}\n\nexport default Disposable;\n","/**\n * @module ol/Feature\n */\nimport BaseObject from './Object.js';\nimport EventType from './events/EventType.js';\nimport {assert} from './asserts.js';\nimport {listen, unlistenByKey} from './events.js';\n\n/**\n * @typedef {typeof Feature|typeof import(\"./render/Feature.js\").default} FeatureClass\n */\n\n/**\n * @typedef {Feature|import(\"./render/Feature.js\").default} FeatureLike\n */\n\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature &\n * import(\"./Observable\").CombinedOnSignature} FeatureOnSignature\n */\n\n/***\n * @template {import(\"./geom/Geometry.js\").default} [Geometry=import(\"./geom/Geometry.js\").default]\n * @typedef {Object & { geometry?: Geometry }} ObjectWithGeometry\n */\n\n/**\n * @classdesc\n * A vector object for geographic features with a geometry and other\n * attribute properties, similar to the features in vector file formats like\n * GeoJSON.\n *\n * Features can be styled individually with `setStyle`; otherwise they use the\n * style of their vector layer.\n *\n * Note that attribute properties are set as {@link module:ol/Object~BaseObject} properties on\n * the feature object, so they are observable, and have get/set accessors.\n *\n * Typically, a feature has a single geometry property. You can set the\n * geometry using the `setGeometry` method and get it with `getGeometry`.\n * It is possible to store more than one geometry on a feature using attribute\n * properties. By default, the geometry used for rendering is identified by\n * the property name `geometry`. If you want to use another geometry property\n * for rendering, use the `setGeometryName` method to change the attribute\n * property associated with the geometry for the feature. For example:\n *\n * ```js\n *\n * import Feature from 'ol/Feature.js';\n * import Polygon from 'ol/geom/Polygon.js';\n * import Point from 'ol/geom/Point.js';\n *\n * const feature = new Feature({\n * geometry: new Polygon(polyCoords),\n * labelPoint: new Point(labelCoords),\n * name: 'My Polygon',\n * });\n *\n * // get the polygon geometry\n * const poly = feature.getGeometry();\n *\n * // Render the feature as a point using the coordinates from labelPoint\n * feature.setGeometryName('labelPoint');\n *\n * // get the point geometry\n * const point = feature.getGeometry();\n * ```\n *\n * @api\n * @template {import(\"./geom/Geometry.js\").default} [Geometry=import(\"./geom/Geometry.js\").default]\n */\nclass Feature extends BaseObject {\n /**\n * @param {Geometry|ObjectWithGeometry} [geometryOrProperties]\n * You may pass a Geometry object directly, or an object literal containing\n * properties. If you pass an object literal, you may include a Geometry\n * associated with a `geometry` key.\n */\n constructor(geometryOrProperties) {\n super();\n\n /***\n * @type {FeatureOnSignature}\n */\n this.on;\n\n /***\n * @type {FeatureOnSignature}\n */\n this.once;\n\n /***\n * @type {FeatureOnSignature}\n */\n this.un;\n\n /**\n * @private\n * @type {number|string|undefined}\n */\n this.id_ = undefined;\n\n /**\n * @type {string}\n * @private\n */\n this.geometryName_ = 'geometry';\n\n /**\n * User provided style.\n * @private\n * @type {import(\"./style/Style.js\").StyleLike}\n */\n this.style_ = null;\n\n /**\n * @private\n * @type {import(\"./style/Style.js\").StyleFunction|undefined}\n */\n this.styleFunction_ = undefined;\n\n /**\n * @private\n * @type {?import(\"./events.js\").EventsKey}\n */\n this.geometryChangeKey_ = null;\n\n this.addChangeListener(this.geometryName_, this.handleGeometryChanged_);\n\n if (geometryOrProperties) {\n if (\n typeof (\n /** @type {?} */ (geometryOrProperties).getSimplifiedGeometry\n ) === 'function'\n ) {\n const geometry = /** @type {Geometry} */ (geometryOrProperties);\n this.setGeometry(geometry);\n } else {\n /** @type {Object} */\n const properties = geometryOrProperties;\n this.setProperties(properties);\n }\n }\n }\n\n /**\n * Clone this feature. If the original feature has a geometry it\n * is also cloned. The feature id is not set in the clone.\n * @return {Feature} The clone.\n * @api\n */\n clone() {\n const clone = /** @type {Feature} */ (\n new Feature(this.hasProperties() ? this.getProperties() : null)\n );\n clone.setGeometryName(this.getGeometryName());\n const geometry = this.getGeometry();\n if (geometry) {\n clone.setGeometry(/** @type {Geometry} */ (geometry.clone()));\n }\n const style = this.getStyle();\n if (style) {\n clone.setStyle(style);\n }\n return clone;\n }\n\n /**\n * Get the feature's default geometry. A feature may have any number of named\n * geometries. The \"default\" geometry (the one that is rendered by default) is\n * set when calling {@link module:ol/Feature~Feature#setGeometry}.\n * @return {Geometry|undefined} The default geometry for the feature.\n * @api\n * @observable\n */\n getGeometry() {\n return /** @type {Geometry|undefined} */ (this.get(this.geometryName_));\n }\n\n /**\n * Get the feature identifier. This is a stable identifier for the feature and\n * is either set when reading data from a remote source or set explicitly by\n * calling {@link module:ol/Feature~Feature#setId}.\n * @return {number|string|undefined} Id.\n * @api\n */\n getId() {\n return this.id_;\n }\n\n /**\n * Get the name of the feature's default geometry. By default, the default\n * geometry is named `geometry`.\n * @return {string} Get the property name associated with the default geometry\n * for this feature.\n * @api\n */\n getGeometryName() {\n return this.geometryName_;\n }\n\n /**\n * Get the feature's style. Will return what was provided to the\n * {@link module:ol/Feature~Feature#setStyle} method.\n * @return {import(\"./style/Style.js\").StyleLike|undefined} The feature style.\n * @api\n */\n getStyle() {\n return this.style_;\n }\n\n /**\n * Get the feature's style function.\n * @return {import(\"./style/Style.js\").StyleFunction|undefined} Return a function\n * representing the current style of this feature.\n * @api\n */\n getStyleFunction() {\n return this.styleFunction_;\n }\n\n /**\n * @private\n */\n handleGeometryChange_() {\n this.changed();\n }\n\n /**\n * @private\n */\n handleGeometryChanged_() {\n if (this.geometryChangeKey_) {\n unlistenByKey(this.geometryChangeKey_);\n this.geometryChangeKey_ = null;\n }\n const geometry = this.getGeometry();\n if (geometry) {\n this.geometryChangeKey_ = listen(\n geometry,\n EventType.CHANGE,\n this.handleGeometryChange_,\n this,\n );\n }\n this.changed();\n }\n\n /**\n * Set the default geometry for the feature. This will update the property\n * with the name returned by {@link module:ol/Feature~Feature#getGeometryName}.\n * @param {Geometry|undefined} geometry The new geometry.\n * @api\n * @observable\n */\n setGeometry(geometry) {\n this.set(this.geometryName_, geometry);\n }\n\n /**\n * Set the style for the feature to override the layer style. This can be a\n * single style object, an array of styles, or a function that takes a\n * resolution and returns an array of styles. To unset the feature style, call\n * `setStyle()` without arguments or a falsey value.\n * @param {import(\"./style/Style.js\").StyleLike} [style] Style for this feature.\n * @api\n * @fires module:ol/events/Event~BaseEvent#event:change\n */\n setStyle(style) {\n this.style_ = style;\n this.styleFunction_ = !style ? undefined : createStyleFunction(style);\n this.changed();\n }\n\n /**\n * Set the feature id. The feature id is considered stable and may be used when\n * requesting features or comparing identifiers returned from a remote source.\n * The feature id can be used with the\n * {@link module:ol/source/Vector~VectorSource#getFeatureById} method.\n * @param {number|string|undefined} id The feature id.\n * @api\n * @fires module:ol/events/Event~BaseEvent#event:change\n */\n setId(id) {\n this.id_ = id;\n this.changed();\n }\n\n /**\n * Set the property name to be used when getting the feature's default geometry.\n * When calling {@link module:ol/Feature~Feature#getGeometry}, the value of the property with\n * this name will be returned.\n * @param {string} name The property name of the default geometry.\n * @api\n */\n setGeometryName(name) {\n this.removeChangeListener(this.geometryName_, this.handleGeometryChanged_);\n this.geometryName_ = name;\n this.addChangeListener(this.geometryName_, this.handleGeometryChanged_);\n this.handleGeometryChanged_();\n }\n}\n\n/**\n * Convert the provided object into a feature style function. Functions passed\n * through unchanged. Arrays of Style or single style objects wrapped\n * in a new feature style function.\n * @param {!import(\"./style/Style.js\").StyleFunction|!Array|!import(\"./style/Style.js\").default} obj\n * A feature style function, a single style, or an array of styles.\n * @return {import(\"./style/Style.js\").StyleFunction} A style function.\n */\nexport function createStyleFunction(obj) {\n if (typeof obj === 'function') {\n return obj;\n }\n /**\n * @type {Array}\n */\n let styles;\n if (Array.isArray(obj)) {\n styles = obj;\n } else {\n assert(\n typeof (/** @type {?} */ (obj).getZIndex) === 'function',\n 'Expected an `ol/style/Style` or an array of `ol/style/Style.js`',\n );\n const style = /** @type {import(\"./style/Style.js\").default} */ (obj);\n styles = [style];\n }\n return function () {\n return styles;\n };\n}\nexport default Feature;\n","/**\n * @module ol/Image\n */\nimport EventTarget from './events/Target.js';\nimport EventType from './events/EventType.js';\nimport ImageState from './ImageState.js';\nimport {CREATE_IMAGE_BITMAP, IMAGE_DECODE} from './has.js';\nimport {listenOnce, unlistenByKey} from './events.js';\nimport {toPromise} from './functions.js';\n\n/**\n * A function that takes an {@link module:ol/Image~ImageWrapper} for the image and a\n * `{string}` for the src as arguments. It is supposed to make it so the\n * underlying image {@link module:ol/Image~ImageWrapper#getImage} is assigned the\n * content specified by the src. If not specified, the default is\n *\n * function(image, src) {\n * image.getImage().src = src;\n * }\n *\n * Providing a custom `imageLoadFunction` can be useful to load images with\n * post requests or - in general - through XHR requests, where the src of the\n * image element would be set to a data URI when the content is loaded.\n *\n * @typedef {function(import(\"./Image.js\").default, string): void} LoadFunction\n * @api\n */\n\n/**\n * @typedef {Object} ImageObject\n * @property {import(\"./extent.js\").Extent} [extent] Extent, if different from the requested one.\n * @property {import(\"./resolution.js\").ResolutionLike} [resolution] Resolution, if different from the requested one.\n * When x and y resolution are different, use the array type (`[xResolution, yResolution]`).\n * @property {number} [pixelRatio] Pixel ratio, if different from the requested one.\n * @property {import('./DataTile.js').ImageLike} image Image.\n */\n\n/**\n * Loader function used for image sources. Receives extent, resolution and pixel ratio as arguments.\n * For images that cover any extent and resolution (static images), the loader function should not accept\n * any arguments. The function returns an {@link import(\"./DataTile.js\").ImageLike image}, an\n * {@link import(\"./Image.js\").ImageObject image object}, or a promise for the same.\n * For loaders that generate images, the promise should not resolve until the image is loaded.\n * If the returned image does not match the extent, resolution or pixel ratio passed to the loader,\n * it has to return an {@link import(\"./Image.js\").ImageObject image object} with the `image` and the\n * correct `extent`, `resolution` and `pixelRatio`.\n *\n * @typedef {function(import(\"./extent.js\").Extent, number, number, (function(HTMLImageElement, string): void)=): import(\"./DataTile.js\").ImageLike|ImageObject|Promise} Loader\n * @api\n */\n\n/**\n * Loader function used for image sources. Receives extent, resolution and pixel ratio as arguments.\n * The function returns a promise for an {@link import(\"./Image.js\").ImageObject image object}.\n *\n * @typedef {function(import(\"./extent.js\").Extent, number, number, (function(HTMLImageElement, string): void)=): import(\"./DataTile.js\").ImageLike|ImageObject|Promise} ImageObjectPromiseLoader\n */\n\nclass ImageWrapper extends EventTarget {\n /**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number|Array|undefined} resolution Resolution. If provided as array, x and y\n * resolution will be assumed.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"./ImageState.js\").default|import(\"./Image.js\").Loader} stateOrLoader State.\n */\n constructor(extent, resolution, pixelRatio, stateOrLoader) {\n super();\n\n /**\n * @protected\n * @type {import(\"./extent.js\").Extent}\n */\n this.extent = extent;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelRatio_ = pixelRatio;\n\n /**\n * @protected\n * @type {number|Array|undefined}\n */\n this.resolution = resolution;\n\n /**\n * @protected\n * @type {import(\"./ImageState.js\").default}\n */\n this.state =\n typeof stateOrLoader === 'function' ? ImageState.IDLE : stateOrLoader;\n\n /**\n * @private\n * @type {import('./DataTile.js').ImageLike|null}\n */\n this.image_ = null;\n\n /**\n * @protected\n * @type {import(\"./Image.js\").Loader}\n */\n this.loader = typeof stateOrLoader === 'function' ? stateOrLoader : null;\n }\n\n /**\n * @protected\n */\n changed() {\n this.dispatchEvent(EventType.CHANGE);\n }\n\n /**\n * @return {import(\"./extent.js\").Extent} Extent.\n */\n getExtent() {\n return this.extent;\n }\n\n /**\n * @return {import('./DataTile.js').ImageLike} Image.\n */\n getImage() {\n return this.image_;\n }\n\n /**\n * @return {number} PixelRatio.\n */\n getPixelRatio() {\n return this.pixelRatio_;\n }\n\n /**\n * @return {number|Array} Resolution.\n */\n getResolution() {\n return /** @type {number} */ (this.resolution);\n }\n\n /**\n * @return {import(\"./ImageState.js\").default} State.\n */\n getState() {\n return this.state;\n }\n\n /**\n * Load not yet loaded URI.\n */\n load() {\n if (this.state == ImageState.IDLE) {\n if (this.loader) {\n this.state = ImageState.LOADING;\n this.changed();\n const resolution = this.getResolution();\n const requestResolution = Array.isArray(resolution)\n ? resolution[0]\n : resolution;\n toPromise(() =>\n this.loader(\n this.getExtent(),\n requestResolution,\n this.getPixelRatio(),\n ),\n )\n .then((image) => {\n if ('image' in image) {\n this.image_ = image.image;\n }\n if ('extent' in image) {\n this.extent = image.extent;\n }\n if ('resolution' in image) {\n this.resolution = image.resolution;\n }\n if ('pixelRatio' in image) {\n this.pixelRatio_ = image.pixelRatio;\n }\n if (\n image instanceof HTMLImageElement ||\n image instanceof ImageBitmap ||\n image instanceof HTMLCanvasElement ||\n image instanceof HTMLVideoElement\n ) {\n this.image_ = image;\n }\n this.state = ImageState.LOADED;\n })\n .catch((error) => {\n this.state = ImageState.ERROR;\n console.error(error); // eslint-disable-line no-console\n })\n .finally(() => this.changed());\n }\n }\n }\n\n /**\n * @param {import('./DataTile.js').ImageLike} image The image.\n */\n setImage(image) {\n this.image_ = image;\n }\n\n /**\n * @param {number|Array} resolution Resolution.\n */\n setResolution(resolution) {\n this.resolution = resolution;\n }\n}\n\n/**\n * @param {import('./DataTile.js').ImageLike} image Image element.\n * @param {function():any} loadHandler Load callback function.\n * @param {function():any} errorHandler Error callback function.\n * @return {function():void} Callback to stop listening.\n */\nexport function listenImage(image, loadHandler, errorHandler) {\n const img = /** @type {HTMLImageElement} */ (image);\n let listening = true;\n let decoding = false;\n let loaded = false;\n\n const listenerKeys = [\n listenOnce(img, EventType.LOAD, function () {\n loaded = true;\n if (!decoding) {\n loadHandler();\n }\n }),\n ];\n\n if (img.src && IMAGE_DECODE) {\n decoding = true;\n img\n .decode()\n .then(function () {\n if (listening) {\n loadHandler();\n }\n })\n .catch(function (error) {\n if (listening) {\n if (loaded) {\n loadHandler();\n } else {\n errorHandler();\n }\n }\n });\n } else {\n listenerKeys.push(listenOnce(img, EventType.ERROR, errorHandler));\n }\n\n return function unlisten() {\n listening = false;\n listenerKeys.forEach(unlistenByKey);\n };\n}\n\n/**\n * Loads an image.\n * @param {HTMLImageElement} image Image, not yet loaded.\n * @param {string} [src] `src` attribute of the image. Optional, not required if already present.\n * @return {Promise} Promise resolving to an `HTMLImageElement`.\n * @api\n */\nexport function load(image, src) {\n return new Promise((resolve, reject) => {\n function handleLoad() {\n unlisten();\n resolve(image);\n }\n function handleError() {\n unlisten();\n reject(new Error('Image load error'));\n }\n function unlisten() {\n image.removeEventListener('load', handleLoad);\n image.removeEventListener('error', handleError);\n }\n image.addEventListener('load', handleLoad);\n image.addEventListener('error', handleError);\n if (src) {\n image.src = src;\n }\n });\n}\n\n/**\n * @param {HTMLImageElement} image Image, not yet loaded.\n * @param {string} [src] `src` attribute of the image. Optional, not required if already present.\n * @return {Promise} Promise resolving to an `HTMLImageElement`.\n */\nexport function decodeFallback(image, src) {\n if (src) {\n image.src = src;\n }\n return image.src && IMAGE_DECODE\n ? new Promise((resolve, reject) =>\n image\n .decode()\n .then(() => resolve(image))\n .catch((e) =>\n image.complete && image.width ? resolve(image) : reject(e),\n ),\n )\n : load(image);\n}\n\n/**\n * Loads an image and decodes it to an `ImageBitmap` if `createImageBitmap()` is supported. Returns\n * the loaded image otherwise.\n * @param {HTMLImageElement} image Image, not yet loaded.\n * @param {string} [src] `src` attribute of the image. Optional, not required if already present.\n * @return {Promise} Promise resolving to an `ImageBitmap` or an\n * `HTMLImageElement` if `createImageBitmap()` is not supported.\n * @api\n */\nexport function decode(image, src) {\n if (src) {\n image.src = src;\n }\n return image.src && IMAGE_DECODE && CREATE_IMAGE_BITMAP\n ? image\n .decode()\n .then(() => createImageBitmap(image))\n .catch((e) => {\n if (image.complete && image.width) {\n return image;\n }\n throw e;\n })\n : decodeFallback(image);\n}\n\nexport default ImageWrapper;\n","/**\n * @module ol/ImageCanvas\n */\nimport ImageState from './ImageState.js';\nimport ImageWrapper from './Image.js';\n\n/**\n * A function that is called to trigger asynchronous canvas drawing. It is\n * called with a \"done\" callback that should be called when drawing is done.\n * If any error occurs during drawing, the \"done\" callback should be called with\n * that error.\n *\n * @typedef {function(function(Error=): void): void} Loader\n */\n\nclass ImageCanvas extends ImageWrapper {\n /**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {HTMLCanvasElement} canvas Canvas.\n * @param {Loader} [loader] Optional loader function to\n * support asynchronous canvas drawing.\n */\n constructor(extent, resolution, pixelRatio, canvas, loader) {\n const state = loader !== undefined ? ImageState.IDLE : ImageState.LOADED;\n\n super(extent, resolution, pixelRatio, state);\n\n /**\n * Optional canvas loader function.\n * @type {?Loader}\n * @private\n */\n this.loader_ = loader !== undefined ? loader : null;\n\n /**\n * @private\n * @type {HTMLCanvasElement}\n */\n this.canvas_ = canvas;\n\n /**\n * @private\n * @type {?Error}\n */\n this.error_ = null;\n }\n\n /**\n * Get any error associated with asynchronous rendering.\n * @return {?Error} Any error that occurred during rendering.\n */\n getError() {\n return this.error_;\n }\n\n /**\n * Handle async drawing complete.\n * @param {Error} [err] Any error during drawing.\n * @private\n */\n handleLoad_(err) {\n if (err) {\n this.error_ = err;\n this.state = ImageState.ERROR;\n } else {\n this.state = ImageState.LOADED;\n }\n this.changed();\n }\n\n /**\n * Load not yet loaded URI.\n */\n load() {\n if (this.state == ImageState.IDLE) {\n this.state = ImageState.LOADING;\n this.changed();\n this.loader_(this.handleLoad_.bind(this));\n }\n }\n\n /**\n * @return {HTMLCanvasElement} Canvas element.\n */\n getImage() {\n return this.canvas_;\n }\n}\n\nexport default ImageCanvas;\n","/**\n * @module ol/ImageState\n */\n\n/**\n * @enum {number}\n */\nexport default {\n IDLE: 0,\n LOADING: 1,\n LOADED: 2,\n ERROR: 3,\n EMPTY: 4,\n};\n","/**\n * @module ol/ImageTile\n */\nimport Tile from './Tile.js';\nimport TileState from './TileState.js';\nimport {createCanvasContext2D} from './dom.js';\nimport {listenImage} from './Image.js';\n\nclass ImageTile extends Tile {\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"./TileState.js\").default} state State.\n * @param {string} src Image source URI.\n * @param {?string} crossOrigin Cross origin.\n * @param {import(\"./Tile.js\").LoadFunction} tileLoadFunction Tile load function.\n * @param {import(\"./Tile.js\").Options} [options] Tile options.\n */\n constructor(tileCoord, state, src, crossOrigin, tileLoadFunction, options) {\n super(tileCoord, state, options);\n\n /**\n * @private\n * @type {?string}\n */\n this.crossOrigin_ = crossOrigin;\n\n /**\n * Image URI\n *\n * @private\n * @type {string}\n */\n this.src_ = src;\n\n this.key = src;\n\n /**\n * @private\n * @type {HTMLImageElement|HTMLCanvasElement}\n */\n this.image_ = new Image();\n if (crossOrigin !== null) {\n this.image_.crossOrigin = crossOrigin;\n }\n\n /**\n * @private\n * @type {?function():void}\n */\n this.unlisten_ = null;\n\n /**\n * @private\n * @type {import(\"./Tile.js\").LoadFunction}\n */\n this.tileLoadFunction_ = tileLoadFunction;\n }\n\n /**\n * Get the HTML image element for this tile (may be a Canvas, Image, or Video).\n * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.\n * @api\n */\n getImage() {\n return this.image_;\n }\n\n /**\n * Sets an HTML image element for this tile (may be a Canvas or preloaded Image).\n * @param {HTMLCanvasElement|HTMLImageElement} element Element.\n */\n setImage(element) {\n this.image_ = element;\n this.state = TileState.LOADED;\n this.unlistenImage_();\n this.changed();\n }\n\n /**\n * Tracks loading or read errors.\n *\n * @private\n */\n handleImageError_() {\n this.state = TileState.ERROR;\n this.unlistenImage_();\n this.image_ = getBlankImage();\n this.changed();\n }\n\n /**\n * Tracks successful image load.\n *\n * @private\n */\n handleImageLoad_() {\n const image = /** @type {HTMLImageElement} */ (this.image_);\n if (image.naturalWidth && image.naturalHeight) {\n this.state = TileState.LOADED;\n } else {\n this.state = TileState.EMPTY;\n }\n this.unlistenImage_();\n this.changed();\n }\n\n /**\n * Load the image or retry if loading previously failed.\n * Loading is taken care of by the tile queue, and calling this method is\n * only needed for preloading or for reloading in case of an error.\n *\n * To retry loading tiles on failed requests, use a custom `tileLoadFunction`\n * that checks for error status codes and reloads only when the status code is\n * 408, 429, 500, 502, 503 and 504, and only when not too many retries have been\n * made already:\n *\n * ```js\n * const retryCodes = [408, 429, 500, 502, 503, 504];\n * const retries = {};\n * source.setTileLoadFunction((tile, src) => {\n * const image = tile.getImage();\n * fetch(src)\n * .then((response) => {\n * if (retryCodes.includes(response.status)) {\n * retries[src] = (retries[src] || 0) + 1;\n * if (retries[src] <= 3) {\n * setTimeout(() => tile.load(), retries[src] * 1000);\n * }\n * return Promise.reject();\n * }\n * return response.blob();\n * })\n * .then((blob) => {\n * const imageUrl = URL.createObjectURL(blob);\n * image.src = imageUrl;\n * setTimeout(() => URL.revokeObjectURL(imageUrl), 5000);\n * })\n * .catch(() => tile.setState(3)); // error\n * });\n * ```\n *\n * @api\n */\n load() {\n if (this.state == TileState.ERROR) {\n this.state = TileState.IDLE;\n this.image_ = new Image();\n if (this.crossOrigin_ !== null) {\n this.image_.crossOrigin = this.crossOrigin_;\n }\n }\n if (this.state == TileState.IDLE) {\n this.state = TileState.LOADING;\n this.changed();\n this.tileLoadFunction_(this, this.src_);\n this.unlisten_ = listenImage(\n this.image_,\n this.handleImageLoad_.bind(this),\n this.handleImageError_.bind(this),\n );\n }\n }\n\n /**\n * Discards event handlers which listen for load completion or errors.\n *\n * @private\n */\n unlistenImage_() {\n if (this.unlisten_) {\n this.unlisten_();\n this.unlisten_ = null;\n }\n }\n}\n\n/**\n * Get a 1-pixel blank image.\n * @return {HTMLCanvasElement} Blank image.\n */\nfunction getBlankImage() {\n const ctx = createCanvasContext2D(1, 1);\n ctx.fillStyle = 'rgba(0,0,0,0)';\n ctx.fillRect(0, 0, 1, 1);\n return ctx.canvas;\n}\n\nexport default ImageTile;\n","/**\n * @module ol/MapEventType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered after a map frame is rendered.\n * @event module:ol/MapEvent~MapEvent#postrender\n * @api\n */\n POSTRENDER: 'postrender',\n\n /**\n * Triggered when the map starts moving.\n * @event module:ol/MapEvent~MapEvent#movestart\n * @api\n */\n MOVESTART: 'movestart',\n\n /**\n * Triggered after the map is moved.\n * @event module:ol/MapEvent~MapEvent#moveend\n * @api\n */\n MOVEEND: 'moveend',\n\n /**\n * Triggered when loading of additional map data (tiles, images, features) starts.\n * @event module:ol/MapEvent~MapEvent#loadstart\n * @api\n */\n LOADSTART: 'loadstart',\n\n /**\n * Triggered when loading of additional map data has completed.\n * @event module:ol/MapEvent~MapEvent#loadend\n * @api\n */\n LOADEND: 'loadend',\n};\n\n/***\n * @typedef {'postrender'|'movestart'|'moveend'|'loadstart'|'loadend'} Types\n */\n","/**\n * @module ol/MapProperty\n */\n\n/**\n * @enum {string}\n */\nexport default {\n LAYERGROUP: 'layergroup',\n SIZE: 'size',\n TARGET: 'target',\n VIEW: 'view',\n};\n","/**\n * @module ol/Object\n */\nimport Event from './events/Event.js';\nimport ObjectEventType from './ObjectEventType.js';\nimport Observable from './Observable.js';\nimport {getUid} from './util.js';\nimport {isEmpty} from './obj.js';\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/Object~BaseObject} instances are instances of this type.\n */\nexport class ObjectEvent extends Event {\n /**\n * @param {string} type The event type.\n * @param {string} key The property name.\n * @param {*} oldValue The old value for `key`.\n */\n constructor(type, key, oldValue) {\n super(type);\n\n /**\n * The name of the property whose value is changing.\n * @type {string}\n * @api\n */\n this.key = key;\n\n /**\n * The old value. To get the new value use `e.target.get(e.key)` where\n * `e` is the event object.\n * @type {*}\n * @api\n */\n this.oldValue = oldValue;\n }\n}\n\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature &\n * import(\"./Observable\").CombinedOnSignature} ObjectOnSignature\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Most non-trivial classes inherit from this.\n *\n * This extends {@link module:ol/Observable~Observable} with observable\n * properties, where each property is observable as well as the object as a\n * whole.\n *\n * Classes that inherit from this have pre-defined properties, to which you can\n * add your owns. The pre-defined properties are listed in this documentation as\n * 'Observable Properties', and have their own accessors; for example,\n * {@link module:ol/Map~Map} has a `target` property, accessed with\n * `getTarget()` and changed with `setTarget()`. Not all properties are however\n * settable. There are also general-purpose accessors `get()` and `set()`. For\n * example, `get('target')` is equivalent to `getTarget()`.\n *\n * The `set` accessors trigger a change event, and you can monitor this by\n * registering a listener. For example, {@link module:ol/View~View} has a\n * `center` property, so `view.on('change:center', function(evt) {...});` would\n * call the function whenever the value of the center property changes. Within\n * the function, `evt.target` would be the view, so `evt.target.getCenter()`\n * would return the new center.\n *\n * You can add your own observable properties with\n * `object.set('prop', 'value')`, and retrieve that with `object.get('prop')`.\n * You can listen for changes on that property value with\n * `object.on('change:prop', listener)`. You can get a list of all\n * properties with {@link module:ol/Object~BaseObject#getProperties}.\n *\n * Note that the observable properties are separate from standard JS properties.\n * You can, for example, give your map object a title with\n * `map.title='New title'` and with `map.set('title', 'Another title')`. The\n * first will be a `hasOwnProperty`; the second will appear in\n * `getProperties()`. Only the second is observable.\n *\n * Properties can be deleted by using the unset method. E.g.\n * object.unset('foo').\n *\n * @fires ObjectEvent\n * @api\n */\nclass BaseObject extends Observable {\n /**\n * @param {Object} [values] An object with key-value pairs.\n */\n constructor(values) {\n super();\n\n /***\n * @type {ObjectOnSignature}\n */\n this.on;\n\n /***\n * @type {ObjectOnSignature}\n */\n this.once;\n\n /***\n * @type {ObjectOnSignature}\n */\n this.un;\n\n // Call {@link module:ol/util.getUid} to ensure that the order of objects' ids is\n // the same as the order in which they were created. This also helps to\n // ensure that object properties are always added in the same order, which\n // helps many JavaScript engines generate faster code.\n getUid(this);\n\n /**\n * @private\n * @type {Object|null}\n */\n this.values_ = null;\n\n if (values !== undefined) {\n this.setProperties(values);\n }\n }\n\n /**\n * Gets a value.\n * @param {string} key Key name.\n * @return {*} Value.\n * @api\n */\n get(key) {\n let value;\n if (this.values_ && this.values_.hasOwnProperty(key)) {\n value = this.values_[key];\n }\n return value;\n }\n\n /**\n * Get a list of object property names.\n * @return {Array} List of property names.\n * @api\n */\n getKeys() {\n return (this.values_ && Object.keys(this.values_)) || [];\n }\n\n /**\n * Get an object of all property names and values.\n * @return {Object} Object.\n * @api\n */\n getProperties() {\n return (this.values_ && Object.assign({}, this.values_)) || {};\n }\n\n /**\n * Get an object of all property names and values.\n * @return {Object?} Object.\n */\n getPropertiesInternal() {\n return this.values_;\n }\n\n /**\n * @return {boolean} The object has properties.\n */\n hasProperties() {\n return !!this.values_;\n }\n\n /**\n * @param {string} key Key name.\n * @param {*} oldValue Old value.\n */\n notify(key, oldValue) {\n let eventType;\n eventType = `change:${key}`;\n if (this.hasListener(eventType)) {\n this.dispatchEvent(new ObjectEvent(eventType, key, oldValue));\n }\n eventType = ObjectEventType.PROPERTYCHANGE;\n if (this.hasListener(eventType)) {\n this.dispatchEvent(new ObjectEvent(eventType, key, oldValue));\n }\n }\n\n /**\n * @param {string} key Key name.\n * @param {import(\"./events.js\").Listener} listener Listener.\n */\n addChangeListener(key, listener) {\n this.addEventListener(`change:${key}`, listener);\n }\n\n /**\n * @param {string} key Key name.\n * @param {import(\"./events.js\").Listener} listener Listener.\n */\n removeChangeListener(key, listener) {\n this.removeEventListener(`change:${key}`, listener);\n }\n\n /**\n * Sets a value.\n * @param {string} key Key name.\n * @param {*} value Value.\n * @param {boolean} [silent] Update without triggering an event.\n * @api\n */\n set(key, value, silent) {\n const values = this.values_ || (this.values_ = {});\n if (silent) {\n values[key] = value;\n } else {\n const oldValue = values[key];\n values[key] = value;\n if (oldValue !== value) {\n this.notify(key, oldValue);\n }\n }\n }\n\n /**\n * Sets a collection of key-value pairs. Note that this changes any existing\n * properties and adds new ones (it does not remove any existing properties).\n * @param {Object} values Values.\n * @param {boolean} [silent] Update without triggering an event.\n * @api\n */\n setProperties(values, silent) {\n for (const key in values) {\n this.set(key, values[key], silent);\n }\n }\n\n /**\n * Apply any properties from another object without triggering events.\n * @param {BaseObject} source The source object.\n * @protected\n */\n applyProperties(source) {\n if (!source.values_) {\n return;\n }\n Object.assign(this.values_ || (this.values_ = {}), source.values_);\n }\n\n /**\n * Unsets a property.\n * @param {string} key Key name.\n * @param {boolean} [silent] Unset without triggering an event.\n * @api\n */\n unset(key, silent) {\n if (this.values_ && key in this.values_) {\n const oldValue = this.values_[key];\n delete this.values_[key];\n if (isEmpty(this.values_)) {\n this.values_ = null;\n }\n if (!silent) {\n this.notify(key, oldValue);\n }\n }\n }\n}\n\nexport default BaseObject;\n","/**\n * @module ol/ObjectEventType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered when a property is changed.\n * @event module:ol/Object.ObjectEvent#propertychange\n * @api\n */\n PROPERTYCHANGE: 'propertychange',\n};\n\n/**\n * @typedef {'propertychange'} Types\n */\n","/**\n * @module ol/Observable\n */\nimport EventTarget from './events/Target.js';\nimport EventType from './events/EventType.js';\nimport {listen, listenOnce, unlistenByKey} from './events.js';\n\n/***\n * @template {string} Type\n * @template {Event|import(\"./events/Event.js\").default} EventClass\n * @template Return\n * @typedef {(type: Type, listener: (event: EventClass) => ?) => Return} OnSignature\n */\n\n/***\n * @template {string} Type\n * @template Return\n * @typedef {(type: Type[], listener: (event: Event|import(\"./events/Event\").default) => ?) => Return extends void ? void : Return[]} CombinedOnSignature\n */\n\n/**\n * @typedef {'change'|'error'} EventTypes\n */\n\n/***\n * @template Return\n * @typedef {OnSignature & CombinedOnSignature} ObservableOnSignature\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * An event target providing convenient methods for listener registration\n * and unregistration. A generic `change` event is always available through\n * {@link module:ol/Observable~Observable#changed}.\n *\n * @fires import(\"./events/Event.js\").default\n * @api\n */\nclass Observable extends EventTarget {\n constructor() {\n super();\n\n this.on =\n /** @type {ObservableOnSignature} */ (\n this.onInternal\n );\n\n this.once =\n /** @type {ObservableOnSignature} */ (\n this.onceInternal\n );\n\n this.un = /** @type {ObservableOnSignature} */ (this.unInternal);\n\n /**\n * @private\n * @type {number}\n */\n this.revision_ = 0;\n }\n\n /**\n * Increases the revision counter and dispatches a 'change' event.\n * @api\n */\n changed() {\n ++this.revision_;\n this.dispatchEvent(EventType.CHANGE);\n }\n\n /**\n * Get the version number for this object. Each time the object is modified,\n * its version number will be incremented.\n * @return {number} Revision.\n * @api\n */\n getRevision() {\n return this.revision_;\n }\n\n /**\n * @param {string|Array} type Type.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener Listener.\n * @return {import(\"./events.js\").EventsKey|Array} Event key.\n * @protected\n */\n onInternal(type, listener) {\n if (Array.isArray(type)) {\n const len = type.length;\n const keys = new Array(len);\n for (let i = 0; i < len; ++i) {\n keys[i] = listen(this, type[i], listener);\n }\n return keys;\n }\n return listen(this, /** @type {string} */ (type), listener);\n }\n\n /**\n * @param {string|Array} type Type.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener Listener.\n * @return {import(\"./events.js\").EventsKey|Array} Event key.\n * @protected\n */\n onceInternal(type, listener) {\n let key;\n if (Array.isArray(type)) {\n const len = type.length;\n key = new Array(len);\n for (let i = 0; i < len; ++i) {\n key[i] = listenOnce(this, type[i], listener);\n }\n } else {\n key = listenOnce(this, /** @type {string} */ (type), listener);\n }\n /** @type {Object} */ (listener).ol_key = key;\n return key;\n }\n\n /**\n * Unlisten for a certain type of event.\n * @param {string|Array} type Type.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener Listener.\n * @protected\n */\n unInternal(type, listener) {\n const key = /** @type {Object} */ (listener).ol_key;\n if (key) {\n unByKey(key);\n } else if (Array.isArray(type)) {\n for (let i = 0, ii = type.length; i < ii; ++i) {\n this.removeEventListener(type[i], listener);\n }\n } else {\n this.removeEventListener(type, listener);\n }\n }\n}\n\n/**\n * Listen for a certain type of event.\n * @function\n * @param {string|Array} type The event type or array of event types.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener The listener function.\n * @return {import(\"./events.js\").EventsKey|Array} Unique key for the listener. If\n * called with an array of event types as the first argument, the return\n * will be an array of keys.\n * @api\n */\nObservable.prototype.on;\n\n/**\n * Listen once for a certain type of event.\n * @function\n * @param {string|Array} type The event type or array of event types.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener The listener function.\n * @return {import(\"./events.js\").EventsKey|Array} Unique key for the listener. If\n * called with an array of event types as the first argument, the return\n * will be an array of keys.\n * @api\n */\nObservable.prototype.once;\n\n/**\n * Unlisten for a certain type of event.\n * @function\n * @param {string|Array} type The event type or array of event types.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener The listener function.\n * @api\n */\nObservable.prototype.un;\n\n/**\n * Removes an event listener using the key returned by `on()` or `once()`.\n * @param {import(\"./events.js\").EventsKey|Array} key The key returned by `on()`\n * or `once()` (or an array of keys).\n * @api\n */\nexport function unByKey(key) {\n if (Array.isArray(key)) {\n for (let i = 0, ii = key.length; i < ii; ++i) {\n unlistenByKey(key[i]);\n }\n } else {\n unlistenByKey(/** @type {import(\"./events.js\").EventsKey} */ (key));\n }\n}\n\nexport default Observable;\n","/**\n * @module ol/Overlay\n */\nimport BaseObject from './Object.js';\nimport MapEventType from './MapEventType.js';\nimport {CLASS_SELECTABLE} from './css.js';\nimport {containsExtent} from './extent.js';\nimport {listen, unlistenByKey} from './events.js';\nimport {outerHeight, outerWidth, removeChildren, removeNode} from './dom.js';\n\n/**\n * @typedef {'bottom-left' | 'bottom-center' | 'bottom-right' | 'center-left' | 'center-center' | 'center-right' | 'top-left' | 'top-center' | 'top-right'} Positioning\n * The overlay position: `'bottom-left'`, `'bottom-center'`, `'bottom-right'`,\n * `'center-left'`, `'center-center'`, `'center-right'`, `'top-left'`,\n * `'top-center'`, or `'top-right'`.\n */\n\n/**\n * @typedef {Object} Options\n * @property {number|string} [id] Set the overlay id. The overlay id can be used\n * with the {@link module:ol/Map~Map#getOverlayById} method.\n * @property {HTMLElement} [element] The overlay element.\n * @property {Array} [offset=[0, 0]] Offsets in pixels used when positioning\n * the overlay. The first element in the\n * array is the horizontal offset. A positive value shifts the overlay right.\n * The second element in the array is the vertical offset. A positive value\n * shifts the overlay down.\n * @property {import(\"./coordinate.js\").Coordinate} [position] The overlay position\n * in map projection.\n * @property {Positioning} [positioning='top-left'] Defines how\n * the overlay is actually positioned with respect to its `position` property.\n * Possible values are `'bottom-left'`, `'bottom-center'`, `'bottom-right'`,\n * `'center-left'`, `'center-center'`, `'center-right'`, `'top-left'`,\n * `'top-center'`, and `'top-right'`.\n * @property {boolean} [stopEvent=true] Whether event propagation to the map\n * viewport should be stopped. If `true` the overlay is placed in the same\n * container as that of the controls (CSS class name\n * `ol-overlaycontainer-stopevent`); if `false` it is placed in the container\n * with CSS class name specified by the `className` property.\n * @property {boolean} [insertFirst=true] Whether the overlay is inserted first\n * in the overlay container, or appended. If the overlay is placed in the same\n * container as that of the controls (see the `stopEvent` option) you will\n * probably set `insertFirst` to `true` so the overlay is displayed below the\n * controls.\n * @property {PanIntoViewOptions|boolean} [autoPan=false] Pan the map when calling\n * `setPosition`, so that the overlay is entirely visible in the current viewport.\n * @property {string} [className='ol-overlay-container ol-selectable'] CSS class\n * name.\n */\n\n/**\n * @typedef {Object} PanOptions\n * @property {number} [duration=1000] The duration of the animation in\n * milliseconds.\n * @property {function(number):number} [easing] The easing function to use. Can\n * be one from {@link module:ol/easing} or a custom function.\n * Default is {@link module:ol/easing.inAndOut}.\n */\n\n/**\n * @typedef {Object} PanIntoViewOptions\n * @property {PanOptions} [animation={}] The animation parameters for the pan\n * @property {number} [margin=20] The margin (in pixels) between the\n * overlay and the borders of the map when panning into view.\n */\n\n/**\n * @enum {string}\n * @protected\n */\nconst Property = {\n ELEMENT: 'element',\n MAP: 'map',\n OFFSET: 'offset',\n POSITION: 'position',\n POSITIONING: 'positioning',\n};\n\n/**\n * @typedef {import(\"./ObjectEventType\").Types|'change:element'|'change:map'|'change:offset'|'change:position'|\n * 'change:positioning'} OverlayObjectEventTypes\n */\n\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature &\n * import(\"./Observable\").CombinedOnSignature} OverlayOnSignature\n */\n\n/**\n * @classdesc\n * An element to be displayed over the map and attached to a single map\n * location. Like {@link module:ol/control/Control~Control}, Overlays are\n * visible widgets. Unlike Controls, they are not in a fixed position on the\n * screen, but are tied to a geographical coordinate, so panning the map will\n * move an Overlay but not a Control.\n *\n * Example:\n *\n * import Overlay from 'ol/Overlay.js';\n *\n * // ...\n * const popup = new Overlay({\n * element: document.getElementById('popup'),\n * });\n * popup.setPosition(coordinate);\n * map.addOverlay(popup);\n *\n * @api\n */\nclass Overlay extends BaseObject {\n /**\n * @param {Options} options Overlay options.\n */\n constructor(options) {\n super();\n\n /***\n * @type {OverlayOnSignature}\n */\n this.on;\n\n /***\n * @type {OverlayOnSignature}\n */\n this.once;\n\n /***\n * @type {OverlayOnSignature}\n */\n this.un;\n\n /**\n * @protected\n * @type {Options}\n */\n this.options = options;\n\n /**\n * @protected\n * @type {number|string|undefined}\n */\n this.id = options.id;\n\n /**\n * @protected\n * @type {boolean}\n */\n this.insertFirst =\n options.insertFirst !== undefined ? options.insertFirst : true;\n\n /**\n * @protected\n * @type {boolean}\n */\n this.stopEvent = options.stopEvent !== undefined ? options.stopEvent : true;\n\n /**\n * @protected\n * @type {HTMLElement}\n */\n this.element = document.createElement('div');\n this.element.className =\n options.className !== undefined\n ? options.className\n : 'ol-overlay-container ' + CLASS_SELECTABLE;\n this.element.style.position = 'absolute';\n this.element.style.pointerEvents = 'auto';\n\n /**\n * @protected\n * @type {PanIntoViewOptions|undefined}\n */\n this.autoPan = options.autoPan === true ? {} : options.autoPan || undefined;\n\n /**\n * @protected\n * @type {{transform_: string,\n * visible: boolean}}\n */\n this.rendered = {\n transform_: '',\n visible: true,\n };\n\n /**\n * @protected\n * @type {?import(\"./events.js\").EventsKey}\n */\n this.mapPostrenderListenerKey = null;\n\n this.addChangeListener(Property.ELEMENT, this.handleElementChanged);\n this.addChangeListener(Property.MAP, this.handleMapChanged);\n this.addChangeListener(Property.OFFSET, this.handleOffsetChanged);\n this.addChangeListener(Property.POSITION, this.handlePositionChanged);\n this.addChangeListener(Property.POSITIONING, this.handlePositioningChanged);\n\n if (options.element !== undefined) {\n this.setElement(options.element);\n }\n\n this.setOffset(options.offset !== undefined ? options.offset : [0, 0]);\n\n this.setPositioning(options.positioning || 'top-left');\n\n if (options.position !== undefined) {\n this.setPosition(options.position);\n }\n }\n\n /**\n * Get the DOM element of this overlay.\n * @return {HTMLElement|undefined} The Element containing the overlay.\n * @observable\n * @api\n */\n getElement() {\n return /** @type {HTMLElement|undefined} */ (this.get(Property.ELEMENT));\n }\n\n /**\n * Get the overlay identifier which is set on constructor.\n * @return {number|string|undefined} Id.\n * @api\n */\n getId() {\n return this.id;\n }\n\n /**\n * Get the map associated with this overlay.\n * @return {import(\"./Map.js\").default|null} The map that the\n * overlay is part of.\n * @observable\n * @api\n */\n getMap() {\n return /** @type {import(\"./Map.js\").default|null} */ (\n this.get(Property.MAP) || null\n );\n }\n\n /**\n * Get the offset of this overlay.\n * @return {Array} The offset.\n * @observable\n * @api\n */\n getOffset() {\n return /** @type {Array} */ (this.get(Property.OFFSET));\n }\n\n /**\n * Get the current position of this overlay.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} The spatial point that the overlay is\n * anchored at.\n * @observable\n * @api\n */\n getPosition() {\n return /** @type {import(\"./coordinate.js\").Coordinate|undefined} */ (\n this.get(Property.POSITION)\n );\n }\n\n /**\n * Get the current positioning of this overlay.\n * @return {Positioning} How the overlay is positioned\n * relative to its point on the map.\n * @observable\n * @api\n */\n getPositioning() {\n return /** @type {Positioning} */ (this.get(Property.POSITIONING));\n }\n\n /**\n * @protected\n */\n handleElementChanged() {\n removeChildren(this.element);\n const element = this.getElement();\n if (element) {\n this.element.appendChild(element);\n }\n }\n\n /**\n * @protected\n */\n handleMapChanged() {\n if (this.mapPostrenderListenerKey) {\n removeNode(this.element);\n unlistenByKey(this.mapPostrenderListenerKey);\n this.mapPostrenderListenerKey = null;\n }\n const map = this.getMap();\n if (map) {\n this.mapPostrenderListenerKey = listen(\n map,\n MapEventType.POSTRENDER,\n this.render,\n this,\n );\n this.updatePixelPosition();\n const container = this.stopEvent\n ? map.getOverlayContainerStopEvent()\n : map.getOverlayContainer();\n if (this.insertFirst) {\n container.insertBefore(this.element, container.childNodes[0] || null);\n } else {\n container.appendChild(this.element);\n }\n this.performAutoPan();\n }\n }\n\n /**\n * @protected\n */\n render() {\n this.updatePixelPosition();\n }\n\n /**\n * @protected\n */\n handleOffsetChanged() {\n this.updatePixelPosition();\n }\n\n /**\n * @protected\n */\n handlePositionChanged() {\n this.updatePixelPosition();\n this.performAutoPan();\n }\n\n /**\n * @protected\n */\n handlePositioningChanged() {\n this.updatePixelPosition();\n }\n\n /**\n * Set the DOM element to be associated with this overlay.\n * @param {HTMLElement|undefined} element The Element containing the overlay.\n * @observable\n * @api\n */\n setElement(element) {\n this.set(Property.ELEMENT, element);\n }\n\n /**\n * Set the map to be associated with this overlay.\n * @param {import(\"./Map.js\").default|null} map The map that the\n * overlay is part of. Pass `null` to just remove the overlay from the current map.\n * @observable\n * @api\n */\n setMap(map) {\n this.set(Property.MAP, map);\n }\n\n /**\n * Set the offset for this overlay.\n * @param {Array} offset Offset.\n * @observable\n * @api\n */\n setOffset(offset) {\n this.set(Property.OFFSET, offset);\n }\n\n /**\n * Set the position for this overlay. If the position is `undefined` the\n * overlay is hidden.\n * @param {import(\"./coordinate.js\").Coordinate|undefined} position The spatial point that the overlay\n * is anchored at.\n * @observable\n * @api\n */\n setPosition(position) {\n this.set(Property.POSITION, position);\n }\n\n /**\n * Pan the map so that the overlay is entirely visible in the current viewport\n * (if necessary) using the configured autoPan parameters\n * @protected\n */\n performAutoPan() {\n if (this.autoPan) {\n this.panIntoView(this.autoPan);\n }\n }\n\n /**\n * Pan the map so that the overlay is entirely visible in the current viewport\n * (if necessary).\n * @param {PanIntoViewOptions} [panIntoViewOptions] Options for the pan action\n * @api\n */\n panIntoView(panIntoViewOptions) {\n const map = this.getMap();\n\n if (!map || !map.getTargetElement() || !this.get(Property.POSITION)) {\n return;\n }\n\n const mapRect = this.getRect(map.getTargetElement(), map.getSize());\n const element = this.getElement();\n const overlayRect = this.getRect(element, [\n outerWidth(element),\n outerHeight(element),\n ]);\n\n panIntoViewOptions = panIntoViewOptions || {};\n\n const myMargin =\n panIntoViewOptions.margin === undefined ? 20 : panIntoViewOptions.margin;\n if (!containsExtent(mapRect, overlayRect)) {\n // the overlay is not completely inside the viewport, so pan the map\n const offsetLeft = overlayRect[0] - mapRect[0];\n const offsetRight = mapRect[2] - overlayRect[2];\n const offsetTop = overlayRect[1] - mapRect[1];\n const offsetBottom = mapRect[3] - overlayRect[3];\n\n const delta = [0, 0];\n if (offsetLeft < 0) {\n // move map to the left\n delta[0] = offsetLeft - myMargin;\n } else if (offsetRight < 0) {\n // move map to the right\n delta[0] = Math.abs(offsetRight) + myMargin;\n }\n if (offsetTop < 0) {\n // move map up\n delta[1] = offsetTop - myMargin;\n } else if (offsetBottom < 0) {\n // move map down\n delta[1] = Math.abs(offsetBottom) + myMargin;\n }\n\n if (delta[0] !== 0 || delta[1] !== 0) {\n const center = /** @type {import(\"./coordinate.js\").Coordinate} */ (\n map.getView().getCenterInternal()\n );\n const centerPx = map.getPixelFromCoordinateInternal(center);\n if (!centerPx) {\n return;\n }\n const newCenterPx = [centerPx[0] + delta[0], centerPx[1] + delta[1]];\n\n const panOptions = panIntoViewOptions.animation || {};\n map.getView().animateInternal({\n center: map.getCoordinateFromPixelInternal(newCenterPx),\n duration: panOptions.duration,\n easing: panOptions.easing,\n });\n }\n }\n }\n\n /**\n * Get the extent of an element relative to the document\n * @param {HTMLElement} element The element.\n * @param {import(\"./size.js\").Size} size The size of the element.\n * @return {import(\"./extent.js\").Extent} The extent.\n * @protected\n */\n getRect(element, size) {\n const box = element.getBoundingClientRect();\n const offsetX = box.left + window.pageXOffset;\n const offsetY = box.top + window.pageYOffset;\n return [offsetX, offsetY, offsetX + size[0], offsetY + size[1]];\n }\n\n /**\n * Set the positioning for this overlay.\n * @param {Positioning} positioning how the overlay is\n * positioned relative to its point on the map.\n * @observable\n * @api\n */\n setPositioning(positioning) {\n this.set(Property.POSITIONING, positioning);\n }\n\n /**\n * Modify the visibility of the element.\n * @param {boolean} visible Element visibility.\n * @protected\n */\n setVisible(visible) {\n if (this.rendered.visible !== visible) {\n this.element.style.display = visible ? '' : 'none';\n this.rendered.visible = visible;\n }\n }\n\n /**\n * Update pixel position.\n * @protected\n */\n updatePixelPosition() {\n const map = this.getMap();\n const position = this.getPosition();\n if (!map || !map.isRendered() || !position) {\n this.setVisible(false);\n return;\n }\n\n const pixel = map.getPixelFromCoordinate(position);\n const mapSize = map.getSize();\n this.updateRenderedPosition(pixel, mapSize);\n }\n\n /**\n * @param {import(\"./pixel.js\").Pixel} pixel The pixel location.\n * @param {import(\"./size.js\").Size|undefined} mapSize The map size.\n * @protected\n */\n updateRenderedPosition(pixel, mapSize) {\n const style = this.element.style;\n const offset = this.getOffset();\n\n const positioning = this.getPositioning();\n\n this.setVisible(true);\n\n const x = Math.round(pixel[0] + offset[0]) + 'px';\n const y = Math.round(pixel[1] + offset[1]) + 'px';\n let posX = '0%';\n let posY = '0%';\n if (\n positioning == 'bottom-right' ||\n positioning == 'center-right' ||\n positioning == 'top-right'\n ) {\n posX = '-100%';\n } else if (\n positioning == 'bottom-center' ||\n positioning == 'center-center' ||\n positioning == 'top-center'\n ) {\n posX = '-50%';\n }\n if (\n positioning == 'bottom-left' ||\n positioning == 'bottom-center' ||\n positioning == 'bottom-right'\n ) {\n posY = '-100%';\n } else if (\n positioning == 'center-left' ||\n positioning == 'center-center' ||\n positioning == 'center-right'\n ) {\n posY = '-50%';\n }\n const transform = `translate(${posX}, ${posY}) translate(${x}, ${y})`;\n if (this.rendered.transform_ != transform) {\n this.rendered.transform_ = transform;\n style.transform = transform;\n }\n }\n\n /**\n * returns the options this Overlay has been created with\n * @return {Options} overlay options\n */\n getOptions() {\n return this.options;\n }\n}\n\nexport default Overlay;\n","/**\n * @module ol/Tile\n */\nimport EventTarget from './events/Target.js';\nimport EventType from './events/EventType.js';\nimport TileState from './TileState.js';\nimport {abstract} from './util.js';\nimport {easeIn} from './easing.js';\n\n/**\n * A function that takes an {@link module:ol/Tile~Tile} for the tile and a\n * `{string}` for the url as arguments. The default is\n * ```js\n * source.setTileLoadFunction(function(tile, src) {\n * tile.getImage().src = src;\n * });\n * ```\n * For more fine grained control, the load function can use fetch or XMLHttpRequest and involve\n * error handling:\n *\n * ```js\n * import TileState from 'ol/TileState.js';\n *\n * source.setTileLoadFunction(function(tile, src) {\n * const xhr = new XMLHttpRequest();\n * xhr.responseType = 'blob';\n * xhr.addEventListener('loadend', function (evt) {\n * const data = this.response;\n * if (data !== undefined) {\n * tile.getImage().src = URL.createObjectURL(data);\n * } else {\n * tile.setState(TileState.ERROR);\n * }\n * });\n * xhr.addEventListener('error', function () {\n * tile.setState(TileState.ERROR);\n * });\n * xhr.open('GET', src);\n * xhr.send();\n * });\n * ```\n *\n * @typedef {function(Tile, string): void} LoadFunction\n * @api\n */\n\n/**\n * {@link module:ol/source/Tile~TileSource} sources use a function of this type to get\n * the url that provides a tile for a given tile coordinate.\n *\n * This function takes an {@link module:ol/tilecoord~TileCoord} for the tile\n * coordinate, a `{number}` representing the pixel ratio and a\n * {@link module:ol/proj/Projection~Projection} for the projection as arguments\n * and returns a `{string}` representing the tile URL, or undefined if no tile\n * should be requested for the passed tile coordinate.\n *\n * @typedef {function(import(\"./tilecoord.js\").TileCoord, number,\n * import(\"./proj/Projection.js\").default): (string|undefined)} UrlFunction\n * @api\n */\n\n/**\n * @typedef {Object} Options\n * @property {number} [transition=250] A duration for tile opacity\n * transitions in milliseconds. A duration of 0 disables the opacity transition.\n * @property {boolean} [interpolate=false] Use interpolated values when resampling. By default,\n * the nearest neighbor is used when resampling.\n * @api\n */\n\n/**\n * @classdesc\n * Base class for tiles.\n *\n * @abstract\n */\nclass Tile extends EventTarget {\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"./TileState.js\").default} state State.\n * @param {Options} [options] Tile options.\n */\n constructor(tileCoord, state, options) {\n super();\n\n options = options ? options : {};\n\n /**\n * @type {import(\"./tilecoord.js\").TileCoord}\n */\n this.tileCoord = tileCoord;\n\n /**\n * @protected\n * @type {import(\"./TileState.js\").default}\n */\n this.state = state;\n\n /**\n * An \"interim\" tile for this tile. The interim tile may be used while this\n * one is loading, for \"smooth\" transitions when changing params/dimensions\n * on the source.\n * @type {Tile|null}\n */\n this.interimTile = null;\n\n /**\n * A key assigned to the tile. This is used by the tile source to determine\n * if this tile can effectively be used, or if a new tile should be created\n * and this one be used as an interim tile for this new tile.\n * @type {string}\n */\n this.key = '';\n\n /**\n * The duration for the opacity transition.\n * @type {number}\n */\n this.transition_ =\n options.transition === undefined ? 250 : options.transition;\n\n /**\n * Lookup of start times for rendering transitions. If the start time is\n * equal to -1, the transition is complete.\n * @type {Object}\n */\n this.transitionStarts_ = {};\n\n /**\n * @type {boolean}\n */\n this.interpolate = !!options.interpolate;\n }\n\n /**\n * @protected\n */\n changed() {\n this.dispatchEvent(EventType.CHANGE);\n }\n\n /**\n * Called by the tile cache when the tile is removed from the cache due to expiry\n */\n release() {\n if (this.state === TileState.ERROR) {\n // to remove the `change` listener on this tile in `ol/TileQueue#handleTileChange`\n this.setState(TileState.EMPTY);\n }\n }\n\n /**\n * @return {string} Key.\n */\n getKey() {\n return this.key + '/' + this.tileCoord;\n }\n\n /**\n * Get the interim tile most suitable for rendering using the chain of interim\n * tiles. This corresponds to the most recent tile that has been loaded, if no\n * such tile exists, the original tile is returned.\n * @return {!Tile} Best tile for rendering.\n */\n getInterimTile() {\n let tile = this.interimTile;\n if (!tile) {\n //empty chain\n return this;\n }\n\n // find the first loaded tile and return it. Since the chain is sorted in\n // decreasing order of creation time, there is no need to search the remainder\n // of the list (all those tiles correspond to older requests and will be\n // cleaned up by refreshInterimChain)\n do {\n if (tile.getState() == TileState.LOADED) {\n // Show tile immediately instead of fading it in after loading, because\n // the interim tile is in place already\n this.transition_ = 0;\n return tile;\n }\n tile = tile.interimTile;\n } while (tile);\n\n // we can not find a better tile\n return this;\n }\n\n /**\n * Goes through the chain of interim tiles and discards sections of the chain\n * that are no longer relevant.\n */\n refreshInterimChain() {\n let tile = this.interimTile;\n if (!tile) {\n return;\n }\n\n /** @type {Tile} */\n let prev = this;\n do {\n if (tile.getState() == TileState.LOADED) {\n //we have a loaded tile, we can discard the rest of the list\n //we would could abort any LOADING tile request\n //older than this tile (i.e. any LOADING tile following this entry in the chain)\n tile.interimTile = null;\n break;\n }\n if (tile.getState() == TileState.LOADING) {\n //keep this LOADING tile any loaded tiles later in the chain are\n //older than this tile, so we're still interested in the request\n prev = tile;\n } else if (tile.getState() == TileState.IDLE) {\n //the head of the list is the most current tile, we don't need\n //to start any other requests for this chain\n prev.interimTile = tile.interimTile;\n } else {\n prev = tile;\n }\n tile = prev.interimTile;\n } while (tile);\n }\n\n /**\n * Get the tile coordinate for this tile.\n * @return {import(\"./tilecoord.js\").TileCoord} The tile coordinate.\n * @api\n */\n getTileCoord() {\n return this.tileCoord;\n }\n\n /**\n * @return {import(\"./TileState.js\").default} State.\n */\n getState() {\n return this.state;\n }\n\n /**\n * Sets the state of this tile. If you write your own {@link module:ol/Tile~LoadFunction tileLoadFunction} ,\n * it is important to set the state correctly to {@link module:ol/TileState~ERROR}\n * when the tile cannot be loaded. Otherwise the tile cannot be removed from\n * the tile queue and will block other requests.\n * @param {import(\"./TileState.js\").default} state State.\n * @api\n */\n setState(state) {\n if (this.state !== TileState.ERROR && this.state > state) {\n throw new Error('Tile load sequence violation');\n }\n this.state = state;\n this.changed();\n }\n\n /**\n * Load the image or retry if loading previously failed.\n * Loading is taken care of by the tile queue, and calling this method is\n * only needed for preloading or for reloading in case of an error.\n * @abstract\n * @api\n */\n load() {\n abstract();\n }\n\n /**\n * Get the alpha value for rendering.\n * @param {string} id An id for the renderer.\n * @param {number} time The render frame time.\n * @return {number} A number between 0 and 1.\n */\n getAlpha(id, time) {\n if (!this.transition_) {\n return 1;\n }\n\n let start = this.transitionStarts_[id];\n if (!start) {\n start = time;\n this.transitionStarts_[id] = start;\n } else if (start === -1) {\n return 1;\n }\n\n const delta = time - start + 1000 / 60; // avoid rendering at 0\n if (delta >= this.transition_) {\n return 1;\n }\n return easeIn(delta / this.transition_);\n }\n\n /**\n * Determine if a tile is in an alpha transition. A tile is considered in\n * transition if tile.getAlpha() has not yet been called or has been called\n * and returned 1.\n * @param {string} id An id for the renderer.\n * @return {boolean} The tile is in transition.\n */\n inTransition(id) {\n if (!this.transition_) {\n return false;\n }\n return this.transitionStarts_[id] !== -1;\n }\n\n /**\n * Mark a transition as complete.\n * @param {string} id An id for the renderer.\n */\n endTransition(id) {\n if (this.transition_) {\n this.transitionStarts_[id] = -1;\n }\n }\n}\n\nexport default Tile;\n","/**\n * @module ol/TileCache\n */\nimport LRUCache from './structs/LRUCache.js';\nimport {fromKey, getKey} from './tilecoord.js';\n\nclass TileCache extends LRUCache {\n clear() {\n while (this.getCount() > 0) {\n this.pop().release();\n }\n super.clear();\n }\n\n /**\n * @param {!Object} usedTiles Used tiles.\n */\n expireCache(usedTiles) {\n while (this.canExpireCache()) {\n const tile = this.peekLast();\n if (tile.getKey() in usedTiles) {\n break;\n } else {\n this.pop().release();\n }\n }\n }\n\n /**\n * Prune all tiles from the cache that don't have the same z as the newest tile.\n */\n pruneExceptNewestZ() {\n if (this.getCount() === 0) {\n return;\n }\n const key = this.peekFirstKey();\n const tileCoord = fromKey(key);\n const z = tileCoord[0];\n this.forEach((tile) => {\n if (tile.tileCoord[0] !== z) {\n this.remove(getKey(tile.tileCoord));\n tile.release();\n }\n });\n }\n}\n\nexport default TileCache;\n","/**\n * @module ol/structs/PriorityQueue\n */\nimport {assert} from '../asserts.js';\nimport {clear} from '../obj.js';\n\n/**\n * @type {number}\n */\nexport const DROP = Infinity;\n\n/**\n * @classdesc\n * Priority queue.\n *\n * The implementation is inspired from the Closure Library's Heap class and\n * Python's heapq module.\n *\n * See https://github.com/google/closure-library/blob/master/closure/goog/structs/heap.js\n * and https://hg.python.org/cpython/file/2.7/Lib/heapq.py.\n *\n * @template T\n */\nclass PriorityQueue {\n /**\n * @param {function(T): number} priorityFunction Priority function.\n * @param {function(T): string} keyFunction Key function.\n */\n constructor(priorityFunction, keyFunction) {\n /**\n * @type {function(T): number}\n * @private\n */\n this.priorityFunction_ = priorityFunction;\n\n /**\n * @type {function(T): string}\n * @private\n */\n this.keyFunction_ = keyFunction;\n\n /**\n * @type {Array}\n * @private\n */\n this.elements_ = [];\n\n /**\n * @type {Array}\n * @private\n */\n this.priorities_ = [];\n\n /**\n * @type {!Object}\n * @private\n */\n this.queuedElements_ = {};\n }\n\n /**\n * FIXME empty description for jsdoc\n */\n clear() {\n this.elements_.length = 0;\n this.priorities_.length = 0;\n clear(this.queuedElements_);\n }\n\n /**\n * Remove and return the highest-priority element. O(log N).\n * @return {T} Element.\n */\n dequeue() {\n const elements = this.elements_;\n const priorities = this.priorities_;\n const element = elements[0];\n if (elements.length == 1) {\n elements.length = 0;\n priorities.length = 0;\n } else {\n elements[0] = /** @type {T} */ (elements.pop());\n priorities[0] = /** @type {number} */ (priorities.pop());\n this.siftUp_(0);\n }\n const elementKey = this.keyFunction_(element);\n delete this.queuedElements_[elementKey];\n return element;\n }\n\n /**\n * Enqueue an element. O(log N).\n * @param {T} element Element.\n * @return {boolean} The element was added to the queue.\n */\n enqueue(element) {\n assert(\n !(this.keyFunction_(element) in this.queuedElements_),\n 'Tried to enqueue an `element` that was already added to the queue',\n );\n const priority = this.priorityFunction_(element);\n if (priority != DROP) {\n this.elements_.push(element);\n this.priorities_.push(priority);\n this.queuedElements_[this.keyFunction_(element)] = true;\n this.siftDown_(0, this.elements_.length - 1);\n return true;\n }\n return false;\n }\n\n /**\n * @return {number} Count.\n */\n getCount() {\n return this.elements_.length;\n }\n\n /**\n * Gets the index of the left child of the node at the given index.\n * @param {number} index The index of the node to get the left child for.\n * @return {number} The index of the left child.\n * @private\n */\n getLeftChildIndex_(index) {\n return index * 2 + 1;\n }\n\n /**\n * Gets the index of the right child of the node at the given index.\n * @param {number} index The index of the node to get the right child for.\n * @return {number} The index of the right child.\n * @private\n */\n getRightChildIndex_(index) {\n return index * 2 + 2;\n }\n\n /**\n * Gets the index of the parent of the node at the given index.\n * @param {number} index The index of the node to get the parent for.\n * @return {number} The index of the parent.\n * @private\n */\n getParentIndex_(index) {\n return (index - 1) >> 1;\n }\n\n /**\n * Make this a heap. O(N).\n * @private\n */\n heapify_() {\n let i;\n for (i = (this.elements_.length >> 1) - 1; i >= 0; i--) {\n this.siftUp_(i);\n }\n }\n\n /**\n * @return {boolean} Is empty.\n */\n isEmpty() {\n return this.elements_.length === 0;\n }\n\n /**\n * @param {string} key Key.\n * @return {boolean} Is key queued.\n */\n isKeyQueued(key) {\n return key in this.queuedElements_;\n }\n\n /**\n * @param {T} element Element.\n * @return {boolean} Is queued.\n */\n isQueued(element) {\n return this.isKeyQueued(this.keyFunction_(element));\n }\n\n /**\n * @param {number} index The index of the node to move down.\n * @private\n */\n siftUp_(index) {\n const elements = this.elements_;\n const priorities = this.priorities_;\n const count = elements.length;\n const element = elements[index];\n const priority = priorities[index];\n const startIndex = index;\n\n while (index < count >> 1) {\n const lIndex = this.getLeftChildIndex_(index);\n const rIndex = this.getRightChildIndex_(index);\n\n const smallerChildIndex =\n rIndex < count && priorities[rIndex] < priorities[lIndex]\n ? rIndex\n : lIndex;\n\n elements[index] = elements[smallerChildIndex];\n priorities[index] = priorities[smallerChildIndex];\n index = smallerChildIndex;\n }\n\n elements[index] = element;\n priorities[index] = priority;\n this.siftDown_(startIndex, index);\n }\n\n /**\n * @param {number} startIndex The index of the root.\n * @param {number} index The index of the node to move up.\n * @private\n */\n siftDown_(startIndex, index) {\n const elements = this.elements_;\n const priorities = this.priorities_;\n const element = elements[index];\n const priority = priorities[index];\n\n while (index > startIndex) {\n const parentIndex = this.getParentIndex_(index);\n if (priorities[parentIndex] > priority) {\n elements[index] = elements[parentIndex];\n priorities[index] = priorities[parentIndex];\n index = parentIndex;\n } else {\n break;\n }\n }\n elements[index] = element;\n priorities[index] = priority;\n }\n\n /**\n * FIXME empty description for jsdoc\n */\n reprioritize() {\n const priorityFunction = this.priorityFunction_;\n const elements = this.elements_;\n const priorities = this.priorities_;\n let index = 0;\n const n = elements.length;\n let element, i, priority;\n for (i = 0; i < n; ++i) {\n element = elements[i];\n priority = priorityFunction(element);\n if (priority == DROP) {\n delete this.queuedElements_[this.keyFunction_(element)];\n } else {\n priorities[index] = priority;\n elements[index++] = element;\n }\n }\n elements.length = index;\n priorities.length = index;\n this.heapify_();\n }\n}\n\nexport default PriorityQueue;\n","/**\n * @module ol/TileQueue\n */\nimport EventType from './events/EventType.js';\nimport PriorityQueue, {DROP} from './structs/PriorityQueue.js';\nimport TileState from './TileState.js';\n\n/**\n * @typedef {function(import(\"./Tile.js\").default, string, import(\"./coordinate.js\").Coordinate, number): number} PriorityFunction\n */\n\nclass TileQueue extends PriorityQueue {\n /**\n * @param {PriorityFunction} tilePriorityFunction Tile priority function.\n * @param {function(): ?} tileChangeCallback Function called on each tile change event.\n */\n constructor(tilePriorityFunction, tileChangeCallback) {\n super(\n /**\n * @param {Array} element Element.\n * @return {number} Priority.\n */\n function (element) {\n return tilePriorityFunction.apply(null, element);\n },\n /**\n * @param {Array} element Element.\n * @return {string} Key.\n */\n function (element) {\n return /** @type {import(\"./Tile.js\").default} */ (element[0]).getKey();\n },\n );\n\n /** @private */\n this.boundHandleTileChange_ = this.handleTileChange.bind(this);\n\n /**\n * @private\n * @type {function(): ?}\n */\n this.tileChangeCallback_ = tileChangeCallback;\n\n /**\n * @private\n * @type {number}\n */\n this.tilesLoading_ = 0;\n\n /**\n * @private\n * @type {!Object}\n */\n this.tilesLoadingKeys_ = {};\n }\n\n /**\n * @param {Array} element Element.\n * @return {boolean} The element was added to the queue.\n */\n enqueue(element) {\n const added = super.enqueue(element);\n if (added) {\n const tile = element[0];\n tile.addEventListener(EventType.CHANGE, this.boundHandleTileChange_);\n }\n return added;\n }\n\n /**\n * @return {number} Number of tiles loading.\n */\n getTilesLoading() {\n return this.tilesLoading_;\n }\n\n /**\n * @param {import(\"./events/Event.js\").default} event Event.\n * @protected\n */\n handleTileChange(event) {\n const tile = /** @type {import(\"./Tile.js\").default} */ (event.target);\n const state = tile.getState();\n if (\n state === TileState.LOADED ||\n state === TileState.ERROR ||\n state === TileState.EMPTY\n ) {\n if (state !== TileState.ERROR) {\n tile.removeEventListener(EventType.CHANGE, this.boundHandleTileChange_);\n }\n const tileKey = tile.getKey();\n if (tileKey in this.tilesLoadingKeys_) {\n delete this.tilesLoadingKeys_[tileKey];\n --this.tilesLoading_;\n }\n this.tileChangeCallback_();\n }\n }\n\n /**\n * @param {number} maxTotalLoading Maximum number tiles to load simultaneously.\n * @param {number} maxNewLoads Maximum number of new tiles to load.\n */\n loadMoreTiles(maxTotalLoading, maxNewLoads) {\n let newLoads = 0;\n let state, tile, tileKey;\n while (\n this.tilesLoading_ < maxTotalLoading &&\n newLoads < maxNewLoads &&\n this.getCount() > 0\n ) {\n tile = /** @type {import(\"./Tile.js\").default} */ (this.dequeue()[0]);\n tileKey = tile.getKey();\n state = tile.getState();\n if (state === TileState.IDLE && !(tileKey in this.tilesLoadingKeys_)) {\n this.tilesLoadingKeys_[tileKey] = true;\n ++this.tilesLoading_;\n ++newLoads;\n tile.load();\n }\n }\n }\n}\n\nexport default TileQueue;\n\n/**\n * @param {import('./Map.js').FrameState} frameState Frame state.\n * @param {import(\"./Tile.js\").default} tile Tile.\n * @param {string} tileSourceKey Tile source key.\n * @param {import(\"./coordinate.js\").Coordinate} tileCenter Tile center.\n * @param {number} tileResolution Tile resolution.\n * @return {number} Tile priority.\n */\nexport function getTilePriority(\n frameState,\n tile,\n tileSourceKey,\n tileCenter,\n tileResolution,\n) {\n // Filter out tiles at higher zoom levels than the current zoom level, or that\n // are outside the visible extent.\n if (!frameState || !(tileSourceKey in frameState.wantedTiles)) {\n return DROP;\n }\n if (!frameState.wantedTiles[tileSourceKey][tile.getKey()]) {\n return DROP;\n }\n // Prioritize the highest zoom level tiles closest to the focus.\n // Tiles at higher zoom levels are prioritized using Math.log(tileResolution).\n // Within a zoom level, tiles are prioritized by the distance in pixels between\n // the center of the tile and the center of the viewport. The factor of 65536\n // means that the prioritization should behave as desired for tiles up to\n // 65536 * Math.log(2) = 45426 pixels from the focus.\n const center = frameState.viewState.center;\n const deltaX = tileCenter[0] - center[0];\n const deltaY = tileCenter[1] - center[1];\n return (\n 65536 * Math.log(tileResolution) +\n Math.sqrt(deltaX * deltaX + deltaY * deltaY) / tileResolution\n );\n}\n","/**\n * @module ol/TileRange\n */\n\n/**\n * A representation of a contiguous block of tiles. A tile range is specified\n * by its min/max tile coordinates and is inclusive of coordinates.\n */\nclass TileRange {\n /**\n * @param {number} minX Minimum X.\n * @param {number} maxX Maximum X.\n * @param {number} minY Minimum Y.\n * @param {number} maxY Maximum Y.\n */\n constructor(minX, maxX, minY, maxY) {\n /**\n * @type {number}\n */\n this.minX = minX;\n\n /**\n * @type {number}\n */\n this.maxX = maxX;\n\n /**\n * @type {number}\n */\n this.minY = minY;\n\n /**\n * @type {number}\n */\n this.maxY = maxY;\n }\n\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @return {boolean} Contains tile coordinate.\n */\n contains(tileCoord) {\n return this.containsXY(tileCoord[1], tileCoord[2]);\n }\n\n /**\n * @param {TileRange} tileRange Tile range.\n * @return {boolean} Contains.\n */\n containsTileRange(tileRange) {\n return (\n this.minX <= tileRange.minX &&\n tileRange.maxX <= this.maxX &&\n this.minY <= tileRange.minY &&\n tileRange.maxY <= this.maxY\n );\n }\n\n /**\n * @param {number} x Tile coordinate x.\n * @param {number} y Tile coordinate y.\n * @return {boolean} Contains coordinate.\n */\n containsXY(x, y) {\n return this.minX <= x && x <= this.maxX && this.minY <= y && y <= this.maxY;\n }\n\n /**\n * @param {TileRange} tileRange Tile range.\n * @return {boolean} Equals.\n */\n equals(tileRange) {\n return (\n this.minX == tileRange.minX &&\n this.minY == tileRange.minY &&\n this.maxX == tileRange.maxX &&\n this.maxY == tileRange.maxY\n );\n }\n\n /**\n * @param {TileRange} tileRange Tile range.\n */\n extend(tileRange) {\n if (tileRange.minX < this.minX) {\n this.minX = tileRange.minX;\n }\n if (tileRange.maxX > this.maxX) {\n this.maxX = tileRange.maxX;\n }\n if (tileRange.minY < this.minY) {\n this.minY = tileRange.minY;\n }\n if (tileRange.maxY > this.maxY) {\n this.maxY = tileRange.maxY;\n }\n }\n\n /**\n * @return {number} Height.\n */\n getHeight() {\n return this.maxY - this.minY + 1;\n }\n\n /**\n * @return {import(\"./size.js\").Size} Size.\n */\n getSize() {\n return [this.getWidth(), this.getHeight()];\n }\n\n /**\n * @return {number} Width.\n */\n getWidth() {\n return this.maxX - this.minX + 1;\n }\n\n /**\n * @param {TileRange} tileRange Tile range.\n * @return {boolean} Intersects.\n */\n intersects(tileRange) {\n return (\n this.minX <= tileRange.maxX &&\n this.maxX >= tileRange.minX &&\n this.minY <= tileRange.maxY &&\n this.maxY >= tileRange.minY\n );\n }\n}\n\n/**\n * @param {number} minX Minimum X.\n * @param {number} maxX Maximum X.\n * @param {number} minY Minimum Y.\n * @param {number} maxY Maximum Y.\n * @param {TileRange} [tileRange] TileRange.\n * @return {TileRange} Tile range.\n */\nexport function createOrUpdate(minX, maxX, minY, maxY, tileRange) {\n if (tileRange !== undefined) {\n tileRange.minX = minX;\n tileRange.maxX = maxX;\n tileRange.minY = minY;\n tileRange.maxY = maxY;\n return tileRange;\n }\n return new TileRange(minX, maxX, minY, maxY);\n}\n\nexport default TileRange;\n","/**\n * @module ol/TileState\n */\n\n/**\n * @enum {number}\n */\nexport default {\n IDLE: 0,\n LOADING: 1,\n LOADED: 2,\n /**\n * Indicates that tile loading failed\n * @type {number}\n */\n ERROR: 3,\n EMPTY: 4,\n};\n","/**\n * @module ol/VectorRenderTile\n */\nimport Tile from './Tile.js';\nimport {createCanvasContext2D, releaseCanvas} from './dom.js';\nimport {getUid} from './util.js';\n\n/**\n * @typedef {Object} ReplayState\n * @property {boolean} dirty Dirty.\n * @property {null|import(\"./render.js\").OrderFunction} renderedRenderOrder RenderedRenderOrder.\n * @property {number} renderedTileRevision RenderedTileRevision.\n * @property {number} renderedResolution RenderedResolution.\n * @property {number} renderedRevision RenderedRevision.\n * @property {number} renderedTileResolution RenderedTileResolution.\n * @property {number} renderedTileZ RenderedTileZ.\n */\n\n/**\n * @type {Array}\n */\nconst canvasPool = [];\n\nclass VectorRenderTile extends Tile {\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"./TileState.js\").default} state State.\n * @param {import(\"./tilecoord.js\").TileCoord} urlTileCoord Wrapped tile coordinate for source urls.\n * @param {function(VectorRenderTile):Array} getSourceTiles Function\n * to get source tiles for this tile.\n */\n constructor(tileCoord, state, urlTileCoord, getSourceTiles) {\n super(tileCoord, state, {transition: 0});\n\n /**\n * @private\n * @type {!Object}\n */\n this.context_ = {};\n\n /**\n * Executor groups by layer uid. Entries are read/written by the renderer.\n * @type {Object>}\n */\n this.executorGroups = {};\n\n /**\n * Number of loading source tiles. Read/written by the source.\n * @type {number}\n */\n this.loadingSourceTiles = 0;\n\n /**\n * @type {Object}\n */\n this.hitDetectionImageData = {};\n\n /**\n * @private\n * @type {!Object}\n */\n this.replayState_ = {};\n\n /**\n * @type {Array}\n */\n this.sourceTiles = [];\n\n /**\n * @type {Object}\n */\n this.errorTileKeys = {};\n\n /**\n * @type {number}\n */\n this.wantedResolution;\n\n /**\n * @type {!function():Array}\n */\n this.getSourceTiles = getSourceTiles.bind(undefined, this);\n\n /**\n * @type {import(\"./tilecoord.js\").TileCoord}\n */\n this.wrappedTileCoord = urlTileCoord;\n }\n\n /**\n * @param {import(\"./layer/Layer.js\").default} layer Layer.\n * @return {CanvasRenderingContext2D} The rendering context.\n */\n getContext(layer) {\n const key = getUid(layer);\n if (!(key in this.context_)) {\n this.context_[key] = createCanvasContext2D(1, 1, canvasPool);\n }\n return this.context_[key];\n }\n\n /**\n * @param {import(\"./layer/Layer.js\").default} layer Layer.\n * @return {boolean} Tile has a rendering context for the given layer.\n */\n hasContext(layer) {\n return getUid(layer) in this.context_;\n }\n\n /**\n * Get the Canvas for this tile.\n * @param {import(\"./layer/Layer.js\").default} layer Layer.\n * @return {HTMLCanvasElement} Canvas.\n */\n getImage(layer) {\n return this.hasContext(layer) ? this.getContext(layer).canvas : null;\n }\n\n /**\n * @param {import(\"./layer/Layer.js\").default} layer Layer.\n * @return {ReplayState} The replay state.\n */\n getReplayState(layer) {\n const key = getUid(layer);\n if (!(key in this.replayState_)) {\n this.replayState_[key] = {\n dirty: false,\n renderedRenderOrder: null,\n renderedResolution: NaN,\n renderedRevision: -1,\n renderedTileResolution: NaN,\n renderedTileRevision: -1,\n renderedTileZ: -1,\n };\n }\n return this.replayState_[key];\n }\n\n /**\n * Load the tile.\n */\n load() {\n this.getSourceTiles();\n }\n\n /**\n * Remove from the cache due to expiry\n */\n release() {\n for (const key in this.context_) {\n const context = this.context_[key];\n releaseCanvas(context);\n canvasPool.push(context.canvas);\n delete this.context_[key];\n }\n super.release();\n }\n}\n\nexport default VectorRenderTile;\n","/**\n * @module ol/VectorTile\n */\nimport Tile from './Tile.js';\nimport TileState from './TileState.js';\n\nclass VectorTile extends Tile {\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"./TileState.js\").default} state State.\n * @param {string} src Data source url.\n * @param {import(\"./format/Feature.js\").default} format Feature format.\n * @param {import(\"./Tile.js\").LoadFunction} tileLoadFunction Tile load function.\n * @param {import(\"./Tile.js\").Options} [options] Tile options.\n */\n constructor(tileCoord, state, src, format, tileLoadFunction, options) {\n super(tileCoord, state, options);\n\n /**\n * Extent of this tile; set by the source.\n * @type {import(\"./extent.js\").Extent}\n */\n this.extent = null;\n\n /**\n * @private\n * @type {import(\"./format/Feature.js\").default}\n */\n this.format_ = format;\n\n /**\n * @private\n * @type {Array}\n */\n this.features_ = null;\n\n /**\n * @private\n * @type {import(\"./featureloader.js\").FeatureLoader}\n */\n this.loader_;\n\n /**\n * Feature projection of this tile; set by the source.\n * @type {import(\"./proj/Projection.js\").default}\n */\n this.projection = null;\n\n /**\n * Resolution of this tile; set by the source.\n * @type {number}\n */\n this.resolution;\n\n /**\n * @private\n * @type {import(\"./Tile.js\").LoadFunction}\n */\n this.tileLoadFunction_ = tileLoadFunction;\n\n /**\n * @private\n * @type {string}\n */\n this.url_ = src;\n\n this.key = src;\n }\n\n /**\n * Get the feature format assigned for reading this tile's features.\n * @return {import(\"./format/Feature.js\").default} Feature format.\n * @api\n */\n getFormat() {\n return this.format_;\n }\n\n /**\n * Get the features for this tile. Geometries will be in the view projection.\n * @return {Array} Features.\n * @api\n */\n getFeatures() {\n return this.features_;\n }\n\n /**\n * Load not yet loaded URI.\n */\n load() {\n if (this.state == TileState.IDLE) {\n this.setState(TileState.LOADING);\n this.tileLoadFunction_(this, this.url_);\n if (this.loader_) {\n this.loader_(this.extent, this.resolution, this.projection);\n }\n }\n }\n\n /**\n * Handler for successful tile load.\n * @param {Array} features The loaded features.\n * @param {import(\"./proj/Projection.js\").default} dataProjection Data projection.\n */\n onLoad(features, dataProjection) {\n this.setFeatures(features);\n }\n\n /**\n * Handler for tile load errors.\n */\n onError() {\n this.setState(TileState.ERROR);\n }\n\n /**\n * Function for use in an {@link module:ol/source/VectorTile~VectorTile}'s `tileLoadFunction`.\n * Sets the features for the tile.\n * @param {Array} features Features.\n * @api\n */\n setFeatures(features) {\n this.features_ = features;\n this.setState(TileState.LOADED);\n }\n\n /**\n * Set the feature loader for reading this tile's features.\n * @param {import(\"./featureloader.js\").FeatureLoader} loader Feature loader.\n * @api\n */\n setLoader(loader) {\n this.loader_ = loader;\n }\n}\n\nexport default VectorTile;\n","/**\n * @module ol/ViewProperty\n */\n\n/**\n * @enum {string}\n */\nexport default {\n CENTER: 'center',\n RESOLUTION: 'resolution',\n ROTATION: 'rotation',\n};\n","/**\n * @module ol/centerconstraint\n */\nimport {clamp} from './math.js';\n\n/**\n * @typedef {function((import(\"./coordinate.js\").Coordinate|undefined), number, import(\"./size.js\").Size, boolean=, Array=): (import(\"./coordinate.js\").Coordinate|undefined)} Type\n */\n\n/**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {boolean} onlyCenter If true, the constraint will only apply to the view center.\n * @param {boolean} smooth If true, the view will be able to go slightly out of the given extent\n * (only during interaction and animation).\n * @return {Type} The constraint.\n */\nexport function createExtent(extent, onlyCenter, smooth) {\n return (\n /**\n * @param {import(\"./coordinate.js\").Coordinate|undefined} center Center.\n * @param {number|undefined} resolution Resolution.\n * @param {import(\"./size.js\").Size} size Viewport size; unused if `onlyCenter` was specified.\n * @param {boolean} [isMoving] True if an interaction or animation is in progress.\n * @param {Array} [centerShift] Shift between map center and viewport center.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center.\n */\n function (center, resolution, size, isMoving, centerShift) {\n if (!center) {\n return undefined;\n }\n if (!resolution && !onlyCenter) {\n return center;\n }\n const viewWidth = onlyCenter ? 0 : size[0] * resolution;\n const viewHeight = onlyCenter ? 0 : size[1] * resolution;\n const shiftX = centerShift ? centerShift[0] : 0;\n const shiftY = centerShift ? centerShift[1] : 0;\n let minX = extent[0] + viewWidth / 2 + shiftX;\n let maxX = extent[2] - viewWidth / 2 + shiftX;\n let minY = extent[1] + viewHeight / 2 + shiftY;\n let maxY = extent[3] - viewHeight / 2 + shiftY;\n\n // note: when zooming out of bounds, min and max values for x and y may\n // end up inverted (min > max); this has to be accounted for\n if (minX > maxX) {\n minX = (maxX + minX) / 2;\n maxX = minX;\n }\n if (minY > maxY) {\n minY = (maxY + minY) / 2;\n maxY = minY;\n }\n\n let x = clamp(center[0], minX, maxX);\n let y = clamp(center[1], minY, maxY);\n\n // during an interaction, allow some overscroll\n if (isMoving && smooth && resolution) {\n const ratio = 30 * resolution;\n x +=\n -ratio * Math.log(1 + Math.max(0, minX - center[0]) / ratio) +\n ratio * Math.log(1 + Math.max(0, center[0] - maxX) / ratio);\n y +=\n -ratio * Math.log(1 + Math.max(0, minY - center[1]) / ratio) +\n ratio * Math.log(1 + Math.max(0, center[1] - maxY) / ratio);\n }\n\n return [x, y];\n }\n );\n}\n\n/**\n * @param {import(\"./coordinate.js\").Coordinate} [center] Center.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center.\n */\nexport function none(center) {\n return center;\n}\n","/**\n * @module ol/resolutionconstraint\n */\nimport {clamp} from './math.js';\nimport {getHeight, getWidth} from './extent.js';\nimport {linearFindNearest} from './array.js';\n\n/**\n * @typedef {function((number|undefined), number, import(\"./size.js\").Size, boolean=): (number|undefined)} Type\n */\n\n/**\n * Returns a modified resolution taking into account the viewport size and maximum\n * allowed extent.\n * @param {number} resolution Resolution\n * @param {import(\"./extent.js\").Extent} maxExtent Maximum allowed extent.\n * @param {import(\"./size.js\").Size} viewportSize Viewport size.\n * @param {boolean} showFullExtent Whether to show the full extent.\n * @return {number} Capped resolution.\n */\nfunction getViewportClampedResolution(\n resolution,\n maxExtent,\n viewportSize,\n showFullExtent,\n) {\n const xResolution = getWidth(maxExtent) / viewportSize[0];\n const yResolution = getHeight(maxExtent) / viewportSize[1];\n\n if (showFullExtent) {\n return Math.min(resolution, Math.max(xResolution, yResolution));\n }\n return Math.min(resolution, Math.min(xResolution, yResolution));\n}\n\n/**\n * Returns a modified resolution to be between maxResolution and minResolution while\n * still allowing the value to be slightly out of bounds.\n * Note: the computation is based on the logarithm function (ln):\n * - at 1, ln(x) is 0\n * - above 1, ln(x) keeps increasing but at a much slower pace than x\n * The final result is clamped to prevent getting too far away from bounds.\n * @param {number} resolution Resolution.\n * @param {number} maxResolution Max resolution.\n * @param {number} minResolution Min resolution.\n * @return {number} Smoothed resolution.\n */\nfunction getSmoothClampedResolution(resolution, maxResolution, minResolution) {\n let result = Math.min(resolution, maxResolution);\n const ratio = 50;\n\n result *=\n Math.log(1 + ratio * Math.max(0, resolution / maxResolution - 1)) / ratio +\n 1;\n if (minResolution) {\n result = Math.max(result, minResolution);\n result /=\n Math.log(1 + ratio * Math.max(0, minResolution / resolution - 1)) /\n ratio +\n 1;\n }\n return clamp(result, minResolution / 2, maxResolution * 2);\n}\n\n/**\n * @param {Array} resolutions Resolutions.\n * @param {boolean} [smooth] If true, the view will be able to slightly exceed resolution limits. Default: true.\n * @param {import(\"./extent.js\").Extent} [maxExtent] Maximum allowed extent.\n * @param {boolean} [showFullExtent] If true, allows us to show the full extent. Default: false.\n * @return {Type} Zoom function.\n */\nexport function createSnapToResolutions(\n resolutions,\n smooth,\n maxExtent,\n showFullExtent,\n) {\n smooth = smooth !== undefined ? smooth : true;\n return (\n /**\n * @param {number|undefined} resolution Resolution.\n * @param {number} direction Direction.\n * @param {import(\"./size.js\").Size} size Viewport size.\n * @param {boolean} [isMoving] True if an interaction or animation is in progress.\n * @return {number|undefined} Resolution.\n */\n function (resolution, direction, size, isMoving) {\n if (resolution !== undefined) {\n const maxResolution = resolutions[0];\n const minResolution = resolutions[resolutions.length - 1];\n const cappedMaxRes = maxExtent\n ? getViewportClampedResolution(\n maxResolution,\n maxExtent,\n size,\n showFullExtent,\n )\n : maxResolution;\n\n // during interacting or animating, allow intermediary values\n if (isMoving) {\n if (!smooth) {\n return clamp(resolution, minResolution, cappedMaxRes);\n }\n return getSmoothClampedResolution(\n resolution,\n cappedMaxRes,\n minResolution,\n );\n }\n\n const capped = Math.min(cappedMaxRes, resolution);\n const z = Math.floor(linearFindNearest(resolutions, capped, direction));\n if (resolutions[z] > cappedMaxRes && z < resolutions.length - 1) {\n return resolutions[z + 1];\n }\n return resolutions[z];\n }\n return undefined;\n }\n );\n}\n\n/**\n * @param {number} power Power.\n * @param {number} maxResolution Maximum resolution.\n * @param {number} [minResolution] Minimum resolution.\n * @param {boolean} [smooth] If true, the view will be able to slightly exceed resolution limits. Default: true.\n * @param {import(\"./extent.js\").Extent} [maxExtent] Maximum allowed extent.\n * @param {boolean} [showFullExtent] If true, allows us to show the full extent. Default: false.\n * @return {Type} Zoom function.\n */\nexport function createSnapToPower(\n power,\n maxResolution,\n minResolution,\n smooth,\n maxExtent,\n showFullExtent,\n) {\n smooth = smooth !== undefined ? smooth : true;\n minResolution = minResolution !== undefined ? minResolution : 0;\n\n return (\n /**\n * @param {number|undefined} resolution Resolution.\n * @param {number} direction Direction.\n * @param {import(\"./size.js\").Size} size Viewport size.\n * @param {boolean} [isMoving] True if an interaction or animation is in progress.\n * @return {number|undefined} Resolution.\n */\n function (resolution, direction, size, isMoving) {\n if (resolution !== undefined) {\n const cappedMaxRes = maxExtent\n ? getViewportClampedResolution(\n maxResolution,\n maxExtent,\n size,\n showFullExtent,\n )\n : maxResolution;\n\n // during interacting or animating, allow intermediary values\n if (isMoving) {\n if (!smooth) {\n return clamp(resolution, minResolution, cappedMaxRes);\n }\n return getSmoothClampedResolution(\n resolution,\n cappedMaxRes,\n minResolution,\n );\n }\n\n const tolerance = 1e-9;\n const minZoomLevel = Math.ceil(\n Math.log(maxResolution / cappedMaxRes) / Math.log(power) - tolerance,\n );\n const offset = -direction * (0.5 - tolerance) + 0.5;\n const capped = Math.min(cappedMaxRes, resolution);\n const cappedZoomLevel = Math.floor(\n Math.log(maxResolution / capped) / Math.log(power) + offset,\n );\n const zoomLevel = Math.max(minZoomLevel, cappedZoomLevel);\n const newResolution = maxResolution / Math.pow(power, zoomLevel);\n return clamp(newResolution, minResolution, cappedMaxRes);\n }\n return undefined;\n }\n );\n}\n\n/**\n * @param {number} maxResolution Max resolution.\n * @param {number} minResolution Min resolution.\n * @param {boolean} [smooth] If true, the view will be able to slightly exceed resolution limits. Default: true.\n * @param {import(\"./extent.js\").Extent} [maxExtent] Maximum allowed extent.\n * @param {boolean} [showFullExtent] If true, allows us to show the full extent. Default: false.\n * @return {Type} Zoom function.\n */\nexport function createMinMaxResolution(\n maxResolution,\n minResolution,\n smooth,\n maxExtent,\n showFullExtent,\n) {\n smooth = smooth !== undefined ? smooth : true;\n\n return (\n /**\n * @param {number|undefined} resolution Resolution.\n * @param {number} direction Direction.\n * @param {import(\"./size.js\").Size} size Viewport size.\n * @param {boolean} [isMoving] True if an interaction or animation is in progress.\n * @return {number|undefined} Resolution.\n */\n function (resolution, direction, size, isMoving) {\n if (resolution !== undefined) {\n const cappedMaxRes = maxExtent\n ? getViewportClampedResolution(\n maxResolution,\n maxExtent,\n size,\n showFullExtent,\n )\n : maxResolution;\n\n if (!smooth || !isMoving) {\n return clamp(resolution, minResolution, cappedMaxRes);\n }\n return getSmoothClampedResolution(\n resolution,\n cappedMaxRes,\n minResolution,\n );\n }\n return undefined;\n }\n );\n}\n","/**\n * @module ol/View\n */\nimport BaseObject from './Object.js';\nimport ViewHint from './ViewHint.js';\nimport ViewProperty from './ViewProperty.js';\nimport {DEFAULT_TILE_SIZE} from './tilegrid/common.js';\nimport {\n METERS_PER_UNIT,\n createProjection,\n disableCoordinateWarning,\n fromUserCoordinate,\n fromUserExtent,\n getUserProjection,\n toUserCoordinate,\n toUserExtent,\n} from './proj.js';\nimport {VOID} from './functions.js';\nimport {\n add as addCoordinate,\n equals as coordinatesEqual,\n equals,\n rotate as rotateCoordinate,\n} from './coordinate.js';\nimport {assert} from './asserts.js';\nimport {none as centerNone, createExtent} from './centerconstraint.js';\nimport {clamp, modulo} from './math.js';\nimport {\n createMinMaxResolution,\n createSnapToPower,\n createSnapToResolutions,\n} from './resolutionconstraint.js';\nimport {\n createSnapToN,\n createSnapToZero,\n disable,\n none as rotationNone,\n} from './rotationconstraint.js';\nimport {easeOut, inAndOut} from './easing.js';\nimport {\n getCenter,\n getForViewAndSize,\n getHeight,\n getWidth,\n isEmpty,\n} from './extent.js';\nimport {linearFindNearest} from './array.js';\nimport {fromExtent as polygonFromExtent} from './geom/Polygon.js';\n\n/**\n * An animation configuration\n *\n * @typedef {Object} Animation\n * @property {import(\"./coordinate.js\").Coordinate} [sourceCenter] Source center.\n * @property {import(\"./coordinate.js\").Coordinate} [targetCenter] Target center.\n * @property {number} [sourceResolution] Source resolution.\n * @property {number} [targetResolution] Target resolution.\n * @property {number} [sourceRotation] Source rotation.\n * @property {number} [targetRotation] Target rotation.\n * @property {import(\"./coordinate.js\").Coordinate} [anchor] Anchor.\n * @property {number} start Start.\n * @property {number} duration Duration.\n * @property {boolean} complete Complete.\n * @property {function(number):number} easing Easing.\n * @property {function(boolean):void} callback Callback.\n */\n\n/**\n * @typedef {Object} Constraints\n * @property {import(\"./centerconstraint.js\").Type} center Center.\n * @property {import(\"./resolutionconstraint.js\").Type} resolution Resolution.\n * @property {import(\"./rotationconstraint.js\").Type} rotation Rotation.\n */\n\n/**\n * @typedef {Object} FitOptions\n * @property {import(\"./size.js\").Size} [size] The size in pixels of the box to\n * fit the extent into. Defaults to the size of the map the view is associated with.\n * If no map or multiple maps are connected to the view, provide the desired box size\n * (e.g. `map.getSize()`).\n * @property {!Array} [padding=[0, 0, 0, 0]] Padding (in pixels) to be\n * cleared inside the view. Values in the array are top, right, bottom and left\n * padding.\n * @property {boolean} [nearest=false] If the view `constrainResolution` option is `true`,\n * get the nearest extent instead of the closest that actually fits the view.\n * @property {number} [minResolution=0] Minimum resolution that we zoom to.\n * @property {number} [maxZoom] Maximum zoom level that we zoom to. If\n * `minResolution` is given, this property is ignored.\n * @property {number} [duration] The duration of the animation in milliseconds.\n * By default, there is no animation to the target extent.\n * @property {function(number):number} [easing] The easing function used during\n * the animation (defaults to {@link module:ol/easing.inAndOut}).\n * The function will be called for each frame with a number representing a\n * fraction of the animation's duration. The function should return a number\n * between 0 and 1 representing the progress toward the destination state.\n * @property {function(boolean):void} [callback] Function called when the view is in\n * its final position. The callback will be called with `true` if the animation\n * series completed on its own or `false` if it was cancelled.\n */\n\n/**\n * @typedef {Object} ViewOptions\n * @property {import(\"./coordinate.js\").Coordinate} [center] The initial center for\n * the view. If a user projection is not set, the coordinate system for the center is\n * specified with the `projection` option. Layer sources will not be fetched if this\n * is not set, but the center can be set later with {@link #setCenter}.\n * @property {boolean|number} [constrainRotation=true] Rotation constraint.\n * `false` means no constraint. `true` means no constraint, but snap to zero\n * near zero. A number constrains the rotation to that number of values. For\n * example, `4` will constrain the rotation to 0, 90, 180, and 270 degrees.\n * @property {boolean} [enableRotation=true] Enable rotation.\n * If `false`, a rotation constraint that always sets the rotation to zero is\n * used. The `constrainRotation` option has no effect if `enableRotation` is\n * `false`.\n * @property {import(\"./extent.js\").Extent} [extent] The extent that constrains the\n * view, in other words, nothing outside of this extent can be visible on the map.\n * @property {boolean} [constrainOnlyCenter=false] If true, the extent\n * constraint will only apply to the view center and not the whole extent.\n * @property {boolean} [smoothExtentConstraint=true] If true, the extent\n * constraint will be applied smoothly, i.e. allow the view to go slightly outside\n * of the given `extent`.\n * @property {number} [maxResolution] The maximum resolution used to determine\n * the resolution constraint. It is used together with `minResolution` (or\n * `maxZoom`) and `zoomFactor`. If unspecified it is calculated in such a way\n * that the projection's validity extent fits in a 256x256 px tile. If the\n * projection is Spherical Mercator (the default) then `maxResolution` defaults\n * to `40075016.68557849 / 256 = 156543.03392804097`.\n * @property {number} [minResolution] The minimum resolution used to determine\n * the resolution constraint. It is used together with `maxResolution` (or\n * `minZoom`) and `zoomFactor`. If unspecified it is calculated assuming 29\n * zoom levels (with a factor of 2). If the projection is Spherical Mercator\n * (the default) then `minResolution` defaults to\n * `40075016.68557849 / 256 / Math.pow(2, 28) = 0.0005831682455839253`.\n * @property {number} [maxZoom=28] The maximum zoom level used to determine the\n * resolution constraint. It is used together with `minZoom` (or\n * `maxResolution`) and `zoomFactor`. Note that if `minResolution` is also\n * provided, it is given precedence over `maxZoom`.\n * @property {number} [minZoom=0] The minimum zoom level used to determine the\n * resolution constraint. It is used together with `maxZoom` (or\n * `minResolution`) and `zoomFactor`. Note that if `maxResolution` is also\n * provided, it is given precedence over `minZoom`.\n * @property {boolean} [multiWorld=false] If `false` the view is constrained so\n * only one world is visible, and you cannot pan off the edge. If `true` the map\n * may show multiple worlds at low zoom levels. Only used if the `projection` is\n * global. Note that if `extent` is also provided it is given precedence.\n * @property {boolean} [constrainResolution=false] If true, the view will always\n * animate to the closest zoom level after an interaction; false means\n * intermediary zoom levels are allowed.\n * @property {boolean} [smoothResolutionConstraint=true] If true, the resolution\n * min/max values will be applied smoothly, i. e. allow the view to exceed slightly\n * the given resolution or zoom bounds.\n * @property {boolean} [showFullExtent=false] Allow the view to be zoomed out to\n * show the full configured extent. By default, when a view is configured with an\n * extent, users will not be able to zoom out so the viewport exceeds the extent in\n * either dimension. This means the full extent may not be visible if the viewport\n * is taller or wider than the aspect ratio of the configured extent. If\n * showFullExtent is true, the user will be able to zoom out so that the viewport\n * exceeds the height or width of the configured extent, but not both, allowing the\n * full extent to be shown.\n * @property {import(\"./proj.js\").ProjectionLike} [projection='EPSG:3857'] The\n * projection. The default is Spherical Mercator.\n * @property {number} [resolution] The initial resolution for the view. The\n * units are `projection` units per pixel (e.g. meters per pixel). An\n * alternative to setting this is to set `zoom`. Layer sources will not be\n * fetched if neither this nor `zoom` are defined, but they can be set later\n * with {@link #setZoom} or {@link #setResolution}.\n * @property {Array} [resolutions] Resolutions that determine the\n * zoom levels if specified. The index in the array corresponds to the zoom level,\n * therefore the resolution values have to be in descending order. It also constrains\n * the resolution by the minimum and maximum value. If set the `maxResolution`,\n * `minResolution`, `minZoom`, `maxZoom`, and `zoomFactor` options are ignored.\n * @property {number} [rotation=0] The initial rotation for the view in radians\n * (positive rotation clockwise, 0 means North).\n * @property {number} [zoom] Only used if `resolution` is not defined. Zoom\n * level used to calculate the initial resolution for the view.\n * @property {number} [zoomFactor=2] The zoom factor used to compute the\n * corresponding resolution.\n * @property {!Array} [padding=[0, 0, 0, 0]] Padding (in css pixels).\n * If the map viewport is partially covered with other content (overlays) along\n * its edges, this setting allows to shift the center of the viewport away from\n * that content. The order of the values is top, right, bottom, left.\n */\n\n/**\n * @typedef {Object} AnimationOptions\n * @property {import(\"./coordinate.js\").Coordinate} [center] The center of the view at the end of\n * the animation.\n * @property {number} [zoom] The zoom level of the view at the end of the\n * animation. This takes precedence over `resolution`.\n * @property {number} [resolution] The resolution of the view at the end\n * of the animation. If `zoom` is also provided, this option will be ignored.\n * @property {number} [rotation] The rotation of the view at the end of\n * the animation.\n * @property {import(\"./coordinate.js\").Coordinate} [anchor] Optional anchor to remain fixed\n * during a rotation or resolution animation.\n * @property {number} [duration=1000] The duration of the animation in milliseconds.\n * @property {function(number):number} [easing] The easing function used\n * during the animation (defaults to {@link module:ol/easing.inAndOut}).\n * The function will be called for each frame with a number representing a\n * fraction of the animation's duration. The function should return a number\n * between 0 and 1 representing the progress toward the destination state.\n */\n\n/**\n * @typedef {Object} State\n * @property {import(\"./coordinate.js\").Coordinate} center Center (in view projection coordinates).\n * @property {import(\"./proj/Projection.js\").default} projection Projection.\n * @property {number} resolution Resolution.\n * @property {import(\"./coordinate.js\").Coordinate} [nextCenter] The next center during an animation series.\n * @property {number} [nextResolution] The next resolution during an animation series.\n * @property {number} [nextRotation] The next rotation during an animation series.\n * @property {number} rotation Rotation.\n * @property {number} zoom Zoom.\n */\n\n/**\n * Like {@link import(\"./Map.js\").FrameState}, but just `viewState` and `extent`.\n * @typedef {Object} ViewStateLayerStateExtent\n * @property {State} viewState View state.\n * @property {import(\"./extent.js\").Extent} extent Extent (in user projection coordinates).\n * @property {Array} [layerStatesArray] Layer states.\n */\n\n/**\n * Default min zoom level for the map view.\n * @type {number}\n */\nconst DEFAULT_MIN_ZOOM = 0;\n\n/**\n * @typedef {import(\"./ObjectEventType\").Types|'change:center'|'change:resolution'|'change:rotation'} ViewObjectEventTypes\n */\n\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature &\n * import(\"./Observable\").CombinedOnSignature} ViewOnSignature\n */\n\n/**\n * @classdesc\n * A View object represents a simple 2D view of the map.\n *\n * This is the object to act upon to change the center, resolution,\n * and rotation of the map.\n *\n * A View has a `projection`. The projection determines the\n * coordinate system of the center, and its units determine the units of the\n * resolution (projection units per pixel). The default projection is\n * Web Mercator (EPSG:3857).\n *\n * ### The view states\n *\n * A View is determined by three states: `center`, `resolution`,\n * and `rotation`. Each state has a corresponding getter and setter, e.g.\n * `getCenter` and `setCenter` for the `center` state.\n *\n * The `zoom` state is actually not saved on the view: all computations\n * internally use the `resolution` state. Still, the `setZoom` and `getZoom`\n * methods are available, as well as `getResolutionForZoom` and\n * `getZoomForResolution` to switch from one system to the other.\n *\n * ### The constraints\n *\n * `setCenter`, `setResolution` and `setRotation` can be used to change the\n * states of the view, but any constraint defined in the constructor will\n * be applied along the way.\n *\n * A View object can have a *resolution constraint*, a *rotation constraint*\n * and a *center constraint*.\n *\n * The *resolution constraint* typically restricts min/max values and\n * snaps to specific resolutions. It is determined by the following\n * options: `resolutions`, `maxResolution`, `maxZoom` and `zoomFactor`.\n * If `resolutions` is set, the other three options are ignored. See\n * documentation for each option for more information. By default, the view\n * only has a min/max restriction and allow intermediary zoom levels when\n * pinch-zooming for example.\n *\n * The *rotation constraint* snaps to specific angles. It is determined\n * by the following options: `enableRotation` and `constrainRotation`.\n * By default rotation is allowed and its value is snapped to zero when approaching the\n * horizontal.\n *\n * The *center constraint* is determined by the `extent` option. By\n * default the view center is not constrained at all.\n *\n * ### Changing the view state\n *\n * It is important to note that `setZoom`, `setResolution`, `setCenter` and\n * `setRotation` are subject to the above mentioned constraints. As such, it\n * may sometimes not be possible to know in advance the resulting state of the\n * View. For example, calling `setResolution(10)` does not guarantee that\n * `getResolution()` will return `10`.\n *\n * A consequence of this is that, when applying a delta on the view state, one\n * should use `adjustCenter`, `adjustRotation`, `adjustZoom` and `adjustResolution`\n * rather than the corresponding setters. This will let view do its internal\n * computations. Besides, the `adjust*` methods also take an `anchor`\n * argument which allows specifying an origin for the transformation.\n *\n * ### Interacting with the view\n *\n * View constraints are usually only applied when the view is *at rest*, meaning that\n * no interaction or animation is ongoing. As such, if the user puts the view in a\n * state that is not equivalent to a constrained one (e.g. rotating the view when\n * the snap angle is 0), an animation will be triggered at the interaction end to\n * put back the view to a stable state;\n *\n * @api\n */\nclass View extends BaseObject {\n /**\n * @param {ViewOptions} [options] View options.\n */\n constructor(options) {\n super();\n\n /***\n * @type {ViewOnSignature}\n */\n this.on;\n\n /***\n * @type {ViewOnSignature}\n */\n this.once;\n\n /***\n * @type {ViewOnSignature}\n */\n this.un;\n\n options = Object.assign({}, options);\n\n /**\n * @private\n * @type {Array}\n */\n this.hints_ = [0, 0];\n\n /**\n * @private\n * @type {Array>}\n */\n this.animations_ = [];\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.updateAnimationKey_;\n\n /**\n * @private\n * @const\n * @type {import(\"./proj/Projection.js\").default}\n */\n this.projection_ = createProjection(options.projection, 'EPSG:3857');\n\n /**\n * @private\n * @type {import(\"./size.js\").Size}\n */\n this.viewportSize_ = [100, 100];\n\n /**\n * @private\n * @type {import(\"./coordinate.js\").Coordinate|undefined}\n */\n this.targetCenter_ = null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.targetResolution_;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.targetRotation_;\n\n /**\n * @private\n * @type {import(\"./coordinate.js\").Coordinate}\n */\n this.nextCenter_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.nextResolution_;\n\n /**\n * @private\n * @type {number}\n */\n this.nextRotation_;\n\n /**\n * @private\n * @type {import(\"./coordinate.js\").Coordinate|undefined}\n */\n this.cancelAnchor_ = undefined;\n\n if (options.projection) {\n disableCoordinateWarning();\n }\n if (options.center) {\n options.center = fromUserCoordinate(options.center, this.projection_);\n }\n if (options.extent) {\n options.extent = fromUserExtent(options.extent, this.projection_);\n }\n\n this.applyOptions_(options);\n }\n\n /**\n * Set up the view with the given options.\n * @param {ViewOptions} options View options.\n */\n applyOptions_(options) {\n const properties = Object.assign({}, options);\n for (const key in ViewProperty) {\n delete properties[key];\n }\n this.setProperties(properties, true);\n\n const resolutionConstraintInfo = createResolutionConstraint(options);\n\n /**\n * @private\n * @type {number}\n */\n this.maxResolution_ = resolutionConstraintInfo.maxResolution;\n\n /**\n * @private\n * @type {number}\n */\n this.minResolution_ = resolutionConstraintInfo.minResolution;\n\n /**\n * @private\n * @type {number}\n */\n this.zoomFactor_ = resolutionConstraintInfo.zoomFactor;\n\n /**\n * @private\n * @type {Array|undefined}\n */\n this.resolutions_ = options.resolutions;\n\n /**\n * @type {Array|undefined}\n * @private\n */\n this.padding_ = options.padding;\n\n /**\n * @private\n * @type {number}\n */\n this.minZoom_ = resolutionConstraintInfo.minZoom;\n\n const centerConstraint = createCenterConstraint(options);\n const resolutionConstraint = resolutionConstraintInfo.constraint;\n const rotationConstraint = createRotationConstraint(options);\n\n /**\n * @private\n * @type {Constraints}\n */\n this.constraints_ = {\n center: centerConstraint,\n resolution: resolutionConstraint,\n rotation: rotationConstraint,\n };\n\n this.setRotation(options.rotation !== undefined ? options.rotation : 0);\n this.setCenterInternal(\n options.center !== undefined ? options.center : null,\n );\n if (options.resolution !== undefined) {\n this.setResolution(options.resolution);\n } else if (options.zoom !== undefined) {\n this.setZoom(options.zoom);\n }\n }\n\n /**\n * Padding (in css pixels).\n * If the map viewport is partially covered with other content (overlays) along\n * its edges, this setting allows to shift the center of the viewport away from that\n * content. The order of the values in the array is top, right, bottom, left.\n * The default is no padding, which is equivalent to `[0, 0, 0, 0]`.\n * @type {Array|undefined}\n * @api\n */\n get padding() {\n return this.padding_;\n }\n set padding(padding) {\n let oldPadding = this.padding_;\n this.padding_ = padding;\n const center = this.getCenterInternal();\n if (center) {\n const newPadding = padding || [0, 0, 0, 0];\n oldPadding = oldPadding || [0, 0, 0, 0];\n const resolution = this.getResolution();\n const offsetX =\n (resolution / 2) *\n (newPadding[3] - oldPadding[3] + oldPadding[1] - newPadding[1]);\n const offsetY =\n (resolution / 2) *\n (newPadding[0] - oldPadding[0] + oldPadding[2] - newPadding[2]);\n this.setCenterInternal([center[0] + offsetX, center[1] - offsetY]);\n }\n }\n\n /**\n * Get an updated version of the view options used to construct the view. The\n * current resolution (or zoom), center, and rotation are applied to any stored\n * options. The provided options can be used to apply new min/max zoom or\n * resolution limits.\n * @param {ViewOptions} newOptions New options to be applied.\n * @return {ViewOptions} New options updated with the current view state.\n */\n getUpdatedOptions_(newOptions) {\n const options = this.getProperties();\n\n // preserve resolution (or zoom)\n if (options.resolution !== undefined) {\n options.resolution = this.getResolution();\n } else {\n options.zoom = this.getZoom();\n }\n\n // preserve center\n options.center = this.getCenterInternal();\n\n // preserve rotation\n options.rotation = this.getRotation();\n\n return Object.assign({}, options, newOptions);\n }\n\n /**\n * Animate the view. The view's center, zoom (or resolution), and rotation\n * can be animated for smooth transitions between view states. For example,\n * to animate the view to a new zoom level:\n *\n * view.animate({zoom: view.getZoom() + 1});\n *\n * By default, the animation lasts one second and uses in-and-out easing. You\n * can customize this behavior by including `duration` (in milliseconds) and\n * `easing` options (see {@link module:ol/easing}).\n *\n * To chain together multiple animations, call the method with multiple\n * animation objects. For example, to first zoom and then pan:\n *\n * view.animate({zoom: 10}, {center: [0, 0]});\n *\n * If you provide a function as the last argument to the animate method, it\n * will get called at the end of an animation series. The callback will be\n * called with `true` if the animation series completed on its own or `false`\n * if it was cancelled.\n *\n * Animations are cancelled by user interactions (e.g. dragging the map) or by\n * calling `view.setCenter()`, `view.setResolution()`, or `view.setRotation()`\n * (or another method that calls one of these).\n *\n * @param {...(AnimationOptions|function(boolean): void)} var_args Animation\n * options. Multiple animations can be run in series by passing multiple\n * options objects. To run multiple animations in parallel, call the method\n * multiple times. An optional callback can be provided as a final\n * argument. The callback will be called with a boolean indicating whether\n * the animation completed without being cancelled.\n * @api\n */\n animate(var_args) {\n if (this.isDef() && !this.getAnimating()) {\n this.resolveConstraints(0);\n }\n const args = new Array(arguments.length);\n for (let i = 0; i < args.length; ++i) {\n let options = arguments[i];\n if (options.center) {\n options = Object.assign({}, options);\n options.center = fromUserCoordinate(\n options.center,\n this.getProjection(),\n );\n }\n if (options.anchor) {\n options = Object.assign({}, options);\n options.anchor = fromUserCoordinate(\n options.anchor,\n this.getProjection(),\n );\n }\n args[i] = options;\n }\n this.animateInternal.apply(this, args);\n }\n\n /**\n * @param {...(AnimationOptions|function(boolean): void)} var_args Animation options.\n */\n animateInternal(var_args) {\n let animationCount = arguments.length;\n let callback;\n if (\n animationCount > 1 &&\n typeof arguments[animationCount - 1] === 'function'\n ) {\n callback = arguments[animationCount - 1];\n --animationCount;\n }\n\n let i = 0;\n for (; i < animationCount && !this.isDef(); ++i) {\n // if view properties are not yet set, shortcut to the final state\n const state = arguments[i];\n if (state.center) {\n this.setCenterInternal(state.center);\n }\n if (state.zoom !== undefined) {\n this.setZoom(state.zoom);\n } else if (state.resolution) {\n this.setResolution(state.resolution);\n }\n if (state.rotation !== undefined) {\n this.setRotation(state.rotation);\n }\n }\n if (i === animationCount) {\n if (callback) {\n animationCallback(callback, true);\n }\n return;\n }\n\n let start = Date.now();\n let center = this.targetCenter_.slice();\n let resolution = this.targetResolution_;\n let rotation = this.targetRotation_;\n const series = [];\n for (; i < animationCount; ++i) {\n const options = /** @type {AnimationOptions} */ (arguments[i]);\n\n const animation = {\n start: start,\n complete: false,\n anchor: options.anchor,\n duration: options.duration !== undefined ? options.duration : 1000,\n easing: options.easing || inAndOut,\n callback: callback,\n };\n\n if (options.center) {\n animation.sourceCenter = center;\n animation.targetCenter = options.center.slice();\n center = animation.targetCenter;\n }\n\n if (options.zoom !== undefined) {\n animation.sourceResolution = resolution;\n animation.targetResolution = this.getResolutionForZoom(options.zoom);\n resolution = animation.targetResolution;\n } else if (options.resolution) {\n animation.sourceResolution = resolution;\n animation.targetResolution = options.resolution;\n resolution = animation.targetResolution;\n }\n\n if (options.rotation !== undefined) {\n animation.sourceRotation = rotation;\n const delta =\n modulo(options.rotation - rotation + Math.PI, 2 * Math.PI) - Math.PI;\n animation.targetRotation = rotation + delta;\n rotation = animation.targetRotation;\n }\n\n // check if animation is a no-op\n if (isNoopAnimation(animation)) {\n animation.complete = true;\n // we still push it onto the series for callback handling\n } else {\n start += animation.duration;\n }\n series.push(animation);\n }\n this.animations_.push(series);\n this.setHint(ViewHint.ANIMATING, 1);\n this.updateAnimations_();\n }\n\n /**\n * Determine if the view is being animated.\n * @return {boolean} The view is being animated.\n * @api\n */\n getAnimating() {\n return this.hints_[ViewHint.ANIMATING] > 0;\n }\n\n /**\n * Determine if the user is interacting with the view, such as panning or zooming.\n * @return {boolean} The view is being interacted with.\n * @api\n */\n getInteracting() {\n return this.hints_[ViewHint.INTERACTING] > 0;\n }\n\n /**\n * Cancel any ongoing animations.\n * @api\n */\n cancelAnimations() {\n this.setHint(ViewHint.ANIMATING, -this.hints_[ViewHint.ANIMATING]);\n let anchor;\n for (let i = 0, ii = this.animations_.length; i < ii; ++i) {\n const series = this.animations_[i];\n if (series[0].callback) {\n animationCallback(series[0].callback, false);\n }\n if (!anchor) {\n for (let j = 0, jj = series.length; j < jj; ++j) {\n const animation = series[j];\n if (!animation.complete) {\n anchor = animation.anchor;\n break;\n }\n }\n }\n }\n this.animations_.length = 0;\n this.cancelAnchor_ = anchor;\n this.nextCenter_ = null;\n this.nextResolution_ = NaN;\n this.nextRotation_ = NaN;\n }\n\n /**\n * Update all animations.\n */\n updateAnimations_() {\n if (this.updateAnimationKey_ !== undefined) {\n cancelAnimationFrame(this.updateAnimationKey_);\n this.updateAnimationKey_ = undefined;\n }\n if (!this.getAnimating()) {\n return;\n }\n const now = Date.now();\n let more = false;\n for (let i = this.animations_.length - 1; i >= 0; --i) {\n const series = this.animations_[i];\n let seriesComplete = true;\n for (let j = 0, jj = series.length; j < jj; ++j) {\n const animation = series[j];\n if (animation.complete) {\n continue;\n }\n const elapsed = now - animation.start;\n let fraction =\n animation.duration > 0 ? elapsed / animation.duration : 1;\n if (fraction >= 1) {\n animation.complete = true;\n fraction = 1;\n } else {\n seriesComplete = false;\n }\n const progress = animation.easing(fraction);\n if (animation.sourceCenter) {\n const x0 = animation.sourceCenter[0];\n const y0 = animation.sourceCenter[1];\n const x1 = animation.targetCenter[0];\n const y1 = animation.targetCenter[1];\n this.nextCenter_ = animation.targetCenter;\n const x = x0 + progress * (x1 - x0);\n const y = y0 + progress * (y1 - y0);\n this.targetCenter_ = [x, y];\n }\n if (animation.sourceResolution && animation.targetResolution) {\n const resolution =\n progress === 1\n ? animation.targetResolution\n : animation.sourceResolution +\n progress *\n (animation.targetResolution - animation.sourceResolution);\n if (animation.anchor) {\n const size = this.getViewportSize_(this.getRotation());\n const constrainedResolution = this.constraints_.resolution(\n resolution,\n 0,\n size,\n true,\n );\n this.targetCenter_ = this.calculateCenterZoom(\n constrainedResolution,\n animation.anchor,\n );\n }\n this.nextResolution_ = animation.targetResolution;\n this.targetResolution_ = resolution;\n this.applyTargetState_(true);\n }\n if (\n animation.sourceRotation !== undefined &&\n animation.targetRotation !== undefined\n ) {\n const rotation =\n progress === 1\n ? modulo(animation.targetRotation + Math.PI, 2 * Math.PI) -\n Math.PI\n : animation.sourceRotation +\n progress *\n (animation.targetRotation - animation.sourceRotation);\n if (animation.anchor) {\n const constrainedRotation = this.constraints_.rotation(\n rotation,\n true,\n );\n this.targetCenter_ = this.calculateCenterRotate(\n constrainedRotation,\n animation.anchor,\n );\n }\n this.nextRotation_ = animation.targetRotation;\n this.targetRotation_ = rotation;\n }\n this.applyTargetState_(true);\n more = true;\n if (!animation.complete) {\n break;\n }\n }\n if (seriesComplete) {\n this.animations_[i] = null;\n this.setHint(ViewHint.ANIMATING, -1);\n this.nextCenter_ = null;\n this.nextResolution_ = NaN;\n this.nextRotation_ = NaN;\n const callback = series[0].callback;\n if (callback) {\n animationCallback(callback, true);\n }\n }\n }\n // prune completed series\n this.animations_ = this.animations_.filter(Boolean);\n if (more && this.updateAnimationKey_ === undefined) {\n this.updateAnimationKey_ = requestAnimationFrame(\n this.updateAnimations_.bind(this),\n );\n }\n }\n\n /**\n * @param {number} rotation Target rotation.\n * @param {import(\"./coordinate.js\").Coordinate} anchor Rotation anchor.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center for rotation and anchor.\n */\n calculateCenterRotate(rotation, anchor) {\n let center;\n const currentCenter = this.getCenterInternal();\n if (currentCenter !== undefined) {\n center = [currentCenter[0] - anchor[0], currentCenter[1] - anchor[1]];\n rotateCoordinate(center, rotation - this.getRotation());\n addCoordinate(center, anchor);\n }\n return center;\n }\n\n /**\n * @param {number} resolution Target resolution.\n * @param {import(\"./coordinate.js\").Coordinate} anchor Zoom anchor.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center for resolution and anchor.\n */\n calculateCenterZoom(resolution, anchor) {\n let center;\n const currentCenter = this.getCenterInternal();\n const currentResolution = this.getResolution();\n if (currentCenter !== undefined && currentResolution !== undefined) {\n const x =\n anchor[0] -\n (resolution * (anchor[0] - currentCenter[0])) / currentResolution;\n const y =\n anchor[1] -\n (resolution * (anchor[1] - currentCenter[1])) / currentResolution;\n center = [x, y];\n }\n return center;\n }\n\n /**\n * Returns the current viewport size.\n * @private\n * @param {number} [rotation] Take into account the rotation of the viewport when giving the size\n * @return {import(\"./size.js\").Size} Viewport size or `[100, 100]` when no viewport is found.\n */\n getViewportSize_(rotation) {\n const size = this.viewportSize_;\n if (rotation) {\n const w = size[0];\n const h = size[1];\n return [\n Math.abs(w * Math.cos(rotation)) + Math.abs(h * Math.sin(rotation)),\n Math.abs(w * Math.sin(rotation)) + Math.abs(h * Math.cos(rotation)),\n ];\n }\n return size;\n }\n\n /**\n * Stores the viewport size on the view. The viewport size is not read every time from the DOM\n * to avoid performance hit and layout reflow.\n * This should be done on map size change.\n * Note: the constraints are not resolved during an animation to avoid stopping it\n * @param {import(\"./size.js\").Size} [size] Viewport size; if undefined, [100, 100] is assumed\n */\n setViewportSize(size) {\n this.viewportSize_ = Array.isArray(size) ? size.slice() : [100, 100];\n if (!this.getAnimating()) {\n this.resolveConstraints(0);\n }\n }\n\n /**\n * Get the view center.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} The center of the view.\n * @observable\n * @api\n */\n getCenter() {\n const center = this.getCenterInternal();\n if (!center) {\n return center;\n }\n return toUserCoordinate(center, this.getProjection());\n }\n\n /**\n * Get the view center without transforming to user projection.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} The center of the view.\n */\n getCenterInternal() {\n return /** @type {import(\"./coordinate.js\").Coordinate|undefined} */ (\n this.get(ViewProperty.CENTER)\n );\n }\n\n /**\n * @return {Constraints} Constraints.\n */\n getConstraints() {\n return this.constraints_;\n }\n\n /**\n * @return {boolean} Resolution constraint is set\n */\n getConstrainResolution() {\n return this.get('constrainResolution');\n }\n\n /**\n * @param {Array} [hints] Destination array.\n * @return {Array} Hint.\n */\n getHints(hints) {\n if (hints !== undefined) {\n hints[0] = this.hints_[0];\n hints[1] = this.hints_[1];\n return hints;\n }\n return this.hints_.slice();\n }\n\n /**\n * Calculate the extent for the current view state and the passed box size.\n * @param {import(\"./size.js\").Size} [size] The pixel dimensions of the box\n * into which the calculated extent should fit. Defaults to the size of the\n * map the view is associated with.\n * If no map or multiple maps are connected to the view, provide the desired\n * box size (e.g. `map.getSize()`).\n * @return {import(\"./extent.js\").Extent} Extent.\n * @api\n */\n calculateExtent(size) {\n const extent = this.calculateExtentInternal(size);\n return toUserExtent(extent, this.getProjection());\n }\n\n /**\n * @param {import(\"./size.js\").Size} [size] Box pixel size. If not provided,\n * the map's last known viewport size will be used.\n * @return {import(\"./extent.js\").Extent} Extent.\n */\n calculateExtentInternal(size) {\n size = size || this.getViewportSizeMinusPadding_();\n const center = /** @type {!import(\"./coordinate.js\").Coordinate} */ (\n this.getCenterInternal()\n );\n assert(center, 'The view center is not defined');\n const resolution = /** @type {!number} */ (this.getResolution());\n assert(resolution !== undefined, 'The view resolution is not defined');\n const rotation = /** @type {!number} */ (this.getRotation());\n assert(rotation !== undefined, 'The view rotation is not defined');\n\n return getForViewAndSize(center, resolution, rotation, size);\n }\n\n /**\n * Get the maximum resolution of the view.\n * @return {number} The maximum resolution of the view.\n * @api\n */\n getMaxResolution() {\n return this.maxResolution_;\n }\n\n /**\n * Get the minimum resolution of the view.\n * @return {number} The minimum resolution of the view.\n * @api\n */\n getMinResolution() {\n return this.minResolution_;\n }\n\n /**\n * Get the maximum zoom level for the view.\n * @return {number} The maximum zoom level.\n * @api\n */\n getMaxZoom() {\n return /** @type {number} */ (\n this.getZoomForResolution(this.minResolution_)\n );\n }\n\n /**\n * Set a new maximum zoom level for the view.\n * @param {number} zoom The maximum zoom level.\n * @api\n */\n setMaxZoom(zoom) {\n this.applyOptions_(this.getUpdatedOptions_({maxZoom: zoom}));\n }\n\n /**\n * Get the minimum zoom level for the view.\n * @return {number} The minimum zoom level.\n * @api\n */\n getMinZoom() {\n return /** @type {number} */ (\n this.getZoomForResolution(this.maxResolution_)\n );\n }\n\n /**\n * Set a new minimum zoom level for the view.\n * @param {number} zoom The minimum zoom level.\n * @api\n */\n setMinZoom(zoom) {\n this.applyOptions_(this.getUpdatedOptions_({minZoom: zoom}));\n }\n\n /**\n * Set whether the view should allow intermediary zoom levels.\n * @param {boolean} enabled Whether the resolution is constrained.\n * @api\n */\n setConstrainResolution(enabled) {\n this.applyOptions_(this.getUpdatedOptions_({constrainResolution: enabled}));\n }\n\n /**\n * Get the view projection.\n * @return {import(\"./proj/Projection.js\").default} The projection of the view.\n * @api\n */\n getProjection() {\n return this.projection_;\n }\n\n /**\n * Get the view resolution.\n * @return {number|undefined} The resolution of the view.\n * @observable\n * @api\n */\n getResolution() {\n return /** @type {number|undefined} */ (this.get(ViewProperty.RESOLUTION));\n }\n\n /**\n * Get the resolutions for the view. This returns the array of resolutions\n * passed to the constructor of the View, or undefined if none were given.\n * @return {Array|undefined} The resolutions of the view.\n * @api\n */\n getResolutions() {\n return this.resolutions_;\n }\n\n /**\n * Get the resolution for a provided extent (in map units) and size (in pixels).\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {import(\"./size.js\").Size} [size] Box pixel size.\n * @return {number} The resolution at which the provided extent will render at\n * the given size.\n * @api\n */\n getResolutionForExtent(extent, size) {\n return this.getResolutionForExtentInternal(\n fromUserExtent(extent, this.getProjection()),\n size,\n );\n }\n\n /**\n * Get the resolution for a provided extent (in map units) and size (in pixels).\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {import(\"./size.js\").Size} [size] Box pixel size.\n * @return {number} The resolution at which the provided extent will render at\n * the given size.\n */\n getResolutionForExtentInternal(extent, size) {\n size = size || this.getViewportSizeMinusPadding_();\n const xResolution = getWidth(extent) / size[0];\n const yResolution = getHeight(extent) / size[1];\n return Math.max(xResolution, yResolution);\n }\n\n /**\n * Return a function that returns a value between 0 and 1 for a\n * resolution. Exponential scaling is assumed.\n * @param {number} [power] Power.\n * @return {function(number): number} Resolution for value function.\n */\n getResolutionForValueFunction(power) {\n power = power || 2;\n const maxResolution = this.getConstrainedResolution(this.maxResolution_);\n const minResolution = this.minResolution_;\n const max = Math.log(maxResolution / minResolution) / Math.log(power);\n return (\n /**\n * @param {number} value Value.\n * @return {number} Resolution.\n */\n function (value) {\n const resolution = maxResolution / Math.pow(power, value * max);\n return resolution;\n }\n );\n }\n\n /**\n * Get the view rotation.\n * @return {number} The rotation of the view in radians.\n * @observable\n * @api\n */\n getRotation() {\n return /** @type {number} */ (this.get(ViewProperty.ROTATION));\n }\n\n /**\n * Return a function that returns a resolution for a value between\n * 0 and 1. Exponential scaling is assumed.\n * @param {number} [power] Power.\n * @return {function(number): number} Value for resolution function.\n */\n getValueForResolutionFunction(power) {\n const logPower = Math.log(power || 2);\n const maxResolution = this.getConstrainedResolution(this.maxResolution_);\n const minResolution = this.minResolution_;\n const max = Math.log(maxResolution / minResolution) / logPower;\n return (\n /**\n * @param {number} resolution Resolution.\n * @return {number} Value.\n */\n function (resolution) {\n const value = Math.log(maxResolution / resolution) / logPower / max;\n return value;\n }\n );\n }\n\n /**\n * Returns the size of the viewport minus padding.\n * @private\n * @param {number} [rotation] Take into account the rotation of the viewport when giving the size\n * @return {import(\"./size.js\").Size} Viewport size reduced by the padding.\n */\n getViewportSizeMinusPadding_(rotation) {\n let size = this.getViewportSize_(rotation);\n const padding = this.padding_;\n if (padding) {\n size = [\n size[0] - padding[1] - padding[3],\n size[1] - padding[0] - padding[2],\n ];\n }\n return size;\n }\n\n /**\n * @return {State} View state.\n */\n getState() {\n const projection = this.getProjection();\n const resolution = this.getResolution();\n const rotation = this.getRotation();\n let center = /** @type {import(\"./coordinate.js\").Coordinate} */ (\n this.getCenterInternal()\n );\n const padding = this.padding_;\n if (padding) {\n const reducedSize = this.getViewportSizeMinusPadding_();\n center = calculateCenterOn(\n center,\n this.getViewportSize_(),\n [reducedSize[0] / 2 + padding[3], reducedSize[1] / 2 + padding[0]],\n resolution,\n rotation,\n );\n }\n return {\n center: center.slice(0),\n projection: projection !== undefined ? projection : null,\n resolution: resolution,\n nextCenter: this.nextCenter_,\n nextResolution: this.nextResolution_,\n nextRotation: this.nextRotation_,\n rotation: rotation,\n zoom: this.getZoom(),\n };\n }\n\n /**\n * @return {ViewStateLayerStateExtent} Like `FrameState`, but just `viewState` and `extent`.\n */\n getViewStateAndExtent() {\n return {\n viewState: this.getState(),\n extent: this.calculateExtent(),\n };\n }\n\n /**\n * Get the current zoom level. This method may return non-integer zoom levels\n * if the view does not constrain the resolution, or if an interaction or\n * animation is underway.\n * @return {number|undefined} Zoom.\n * @api\n */\n getZoom() {\n let zoom;\n const resolution = this.getResolution();\n if (resolution !== undefined) {\n zoom = this.getZoomForResolution(resolution);\n }\n return zoom;\n }\n\n /**\n * Get the zoom level for a resolution.\n * @param {number} resolution The resolution.\n * @return {number|undefined} The zoom level for the provided resolution.\n * @api\n */\n getZoomForResolution(resolution) {\n let offset = this.minZoom_ || 0;\n let max, zoomFactor;\n if (this.resolutions_) {\n const nearest = linearFindNearest(this.resolutions_, resolution, 1);\n offset = nearest;\n max = this.resolutions_[nearest];\n if (nearest == this.resolutions_.length - 1) {\n zoomFactor = 2;\n } else {\n zoomFactor = max / this.resolutions_[nearest + 1];\n }\n } else {\n max = this.maxResolution_;\n zoomFactor = this.zoomFactor_;\n }\n return offset + Math.log(max / resolution) / Math.log(zoomFactor);\n }\n\n /**\n * Get the resolution for a zoom level.\n * @param {number} zoom Zoom level.\n * @return {number} The view resolution for the provided zoom level.\n * @api\n */\n getResolutionForZoom(zoom) {\n if (this.resolutions_) {\n if (this.resolutions_.length <= 1) {\n return 0;\n }\n const baseLevel = clamp(\n Math.floor(zoom),\n 0,\n this.resolutions_.length - 2,\n );\n const zoomFactor =\n this.resolutions_[baseLevel] / this.resolutions_[baseLevel + 1];\n return (\n this.resolutions_[baseLevel] /\n Math.pow(zoomFactor, clamp(zoom - baseLevel, 0, 1))\n );\n }\n return (\n this.maxResolution_ / Math.pow(this.zoomFactor_, zoom - this.minZoom_)\n );\n }\n\n /**\n * Fit the given geometry or extent based on the given map size and border.\n * The size is pixel dimensions of the box to fit the extent into.\n * In most cases you will want to use the map size, that is `map.getSize()`.\n * Takes care of the map angle.\n * @param {import(\"./geom/SimpleGeometry.js\").default|import(\"./extent.js\").Extent} geometryOrExtent The geometry or\n * extent to fit the view to.\n * @param {FitOptions} [options] Options.\n * @api\n */\n fit(geometryOrExtent, options) {\n /** @type {import(\"./geom/SimpleGeometry.js\").default} */\n let geometry;\n assert(\n Array.isArray(geometryOrExtent) ||\n typeof (/** @type {?} */ (geometryOrExtent).getSimplifiedGeometry) ===\n 'function',\n 'Invalid extent or geometry provided as `geometry`',\n );\n if (Array.isArray(geometryOrExtent)) {\n assert(\n !isEmpty(geometryOrExtent),\n 'Cannot fit empty extent provided as `geometry`',\n );\n const extent = fromUserExtent(geometryOrExtent, this.getProjection());\n geometry = polygonFromExtent(extent);\n } else if (geometryOrExtent.getType() === 'Circle') {\n const extent = fromUserExtent(\n geometryOrExtent.getExtent(),\n this.getProjection(),\n );\n geometry = polygonFromExtent(extent);\n geometry.rotate(this.getRotation(), getCenter(extent));\n } else {\n const userProjection = getUserProjection();\n if (userProjection) {\n geometry = /** @type {import(\"./geom/SimpleGeometry.js\").default} */ (\n geometryOrExtent\n .clone()\n .transform(userProjection, this.getProjection())\n );\n } else {\n geometry = geometryOrExtent;\n }\n }\n\n this.fitInternal(geometry, options);\n }\n\n /**\n * Calculate rotated extent\n * @param {import(\"./geom/SimpleGeometry.js\").default} geometry The geometry.\n * @return {import(\"./extent\").Extent} The rotated extent for the geometry.\n */\n rotatedExtentForGeometry(geometry) {\n const rotation = this.getRotation();\n const cosAngle = Math.cos(rotation);\n const sinAngle = Math.sin(-rotation);\n const coords = geometry.getFlatCoordinates();\n const stride = geometry.getStride();\n let minRotX = +Infinity;\n let minRotY = +Infinity;\n let maxRotX = -Infinity;\n let maxRotY = -Infinity;\n for (let i = 0, ii = coords.length; i < ii; i += stride) {\n const rotX = coords[i] * cosAngle - coords[i + 1] * sinAngle;\n const rotY = coords[i] * sinAngle + coords[i + 1] * cosAngle;\n minRotX = Math.min(minRotX, rotX);\n minRotY = Math.min(minRotY, rotY);\n maxRotX = Math.max(maxRotX, rotX);\n maxRotY = Math.max(maxRotY, rotY);\n }\n return [minRotX, minRotY, maxRotX, maxRotY];\n }\n\n /**\n * @param {import(\"./geom/SimpleGeometry.js\").default} geometry The geometry.\n * @param {FitOptions} [options] Options.\n */\n fitInternal(geometry, options) {\n options = options || {};\n let size = options.size;\n if (!size) {\n size = this.getViewportSizeMinusPadding_();\n }\n const padding =\n options.padding !== undefined ? options.padding : [0, 0, 0, 0];\n const nearest = options.nearest !== undefined ? options.nearest : false;\n let minResolution;\n if (options.minResolution !== undefined) {\n minResolution = options.minResolution;\n } else if (options.maxZoom !== undefined) {\n minResolution = this.getResolutionForZoom(options.maxZoom);\n } else {\n minResolution = 0;\n }\n\n const rotatedExtent = this.rotatedExtentForGeometry(geometry);\n\n // calculate resolution\n let resolution = this.getResolutionForExtentInternal(rotatedExtent, [\n size[0] - padding[1] - padding[3],\n size[1] - padding[0] - padding[2],\n ]);\n resolution = isNaN(resolution)\n ? minResolution\n : Math.max(resolution, minResolution);\n resolution = this.getConstrainedResolution(resolution, nearest ? 0 : 1);\n\n // calculate center\n const rotation = this.getRotation();\n const sinAngle = Math.sin(rotation);\n const cosAngle = Math.cos(rotation);\n const centerRot = getCenter(rotatedExtent);\n centerRot[0] += ((padding[1] - padding[3]) / 2) * resolution;\n centerRot[1] += ((padding[0] - padding[2]) / 2) * resolution;\n const centerX = centerRot[0] * cosAngle - centerRot[1] * sinAngle;\n const centerY = centerRot[1] * cosAngle + centerRot[0] * sinAngle;\n const center = this.getConstrainedCenter([centerX, centerY], resolution);\n const callback = options.callback ? options.callback : VOID;\n\n if (options.duration !== undefined) {\n this.animateInternal(\n {\n resolution: resolution,\n center: center,\n duration: options.duration,\n easing: options.easing,\n },\n callback,\n );\n } else {\n this.targetResolution_ = resolution;\n this.targetCenter_ = center;\n this.applyTargetState_(false, true);\n animationCallback(callback, true);\n }\n }\n\n /**\n * Center on coordinate and view position.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"./size.js\").Size} size Box pixel size.\n * @param {import(\"./pixel.js\").Pixel} position Position on the view to center on.\n * @api\n */\n centerOn(coordinate, size, position) {\n this.centerOnInternal(\n fromUserCoordinate(coordinate, this.getProjection()),\n size,\n position,\n );\n }\n\n /**\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"./size.js\").Size} size Box pixel size.\n * @param {import(\"./pixel.js\").Pixel} position Position on the view to center on.\n */\n centerOnInternal(coordinate, size, position) {\n this.setCenterInternal(\n calculateCenterOn(\n coordinate,\n size,\n position,\n this.getResolution(),\n this.getRotation(),\n ),\n );\n }\n\n /**\n * Calculates the shift between map and viewport center.\n * @param {import(\"./coordinate.js\").Coordinate} center Center.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @param {import(\"./size.js\").Size} size Size.\n * @return {Array|undefined} Center shift.\n */\n calculateCenterShift(center, resolution, rotation, size) {\n let centerShift;\n const padding = this.padding_;\n if (padding && center) {\n const reducedSize = this.getViewportSizeMinusPadding_(-rotation);\n const shiftedCenter = calculateCenterOn(\n center,\n size,\n [reducedSize[0] / 2 + padding[3], reducedSize[1] / 2 + padding[0]],\n resolution,\n rotation,\n );\n centerShift = [\n center[0] - shiftedCenter[0],\n center[1] - shiftedCenter[1],\n ];\n }\n return centerShift;\n }\n\n /**\n * @return {boolean} Is defined.\n */\n isDef() {\n return !!this.getCenterInternal() && this.getResolution() !== undefined;\n }\n\n /**\n * Adds relative coordinates to the center of the view. Any extent constraint will apply.\n * @param {import(\"./coordinate.js\").Coordinate} deltaCoordinates Relative value to add.\n * @api\n */\n adjustCenter(deltaCoordinates) {\n const center = toUserCoordinate(this.targetCenter_, this.getProjection());\n this.setCenter([\n center[0] + deltaCoordinates[0],\n center[1] + deltaCoordinates[1],\n ]);\n }\n\n /**\n * Adds relative coordinates to the center of the view. Any extent constraint will apply.\n * @param {import(\"./coordinate.js\").Coordinate} deltaCoordinates Relative value to add.\n */\n adjustCenterInternal(deltaCoordinates) {\n const center = this.targetCenter_;\n this.setCenterInternal([\n center[0] + deltaCoordinates[0],\n center[1] + deltaCoordinates[1],\n ]);\n }\n\n /**\n * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution\n * constraint will apply.\n * @param {number} ratio The ratio to apply on the view resolution.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n * @api\n */\n adjustResolution(ratio, anchor) {\n anchor = anchor && fromUserCoordinate(anchor, this.getProjection());\n this.adjustResolutionInternal(ratio, anchor);\n }\n\n /**\n * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution\n * constraint will apply.\n * @param {number} ratio The ratio to apply on the view resolution.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n */\n adjustResolutionInternal(ratio, anchor) {\n const isMoving = this.getAnimating() || this.getInteracting();\n const size = this.getViewportSize_(this.getRotation());\n const newResolution = this.constraints_.resolution(\n this.targetResolution_ * ratio,\n 0,\n size,\n isMoving,\n );\n\n if (anchor) {\n this.targetCenter_ = this.calculateCenterZoom(newResolution, anchor);\n }\n\n this.targetResolution_ *= ratio;\n this.applyTargetState_();\n }\n\n /**\n * Adds a value to the view zoom level, optionally using an anchor. Any resolution\n * constraint will apply.\n * @param {number} delta Relative value to add to the zoom level.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n * @api\n */\n adjustZoom(delta, anchor) {\n this.adjustResolution(Math.pow(this.zoomFactor_, -delta), anchor);\n }\n\n /**\n * Adds a value to the view rotation, optionally using an anchor. Any rotation\n * constraint will apply.\n * @param {number} delta Relative value to add to the zoom rotation, in radians.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The rotation center.\n * @api\n */\n adjustRotation(delta, anchor) {\n if (anchor) {\n anchor = fromUserCoordinate(anchor, this.getProjection());\n }\n this.adjustRotationInternal(delta, anchor);\n }\n\n /**\n * @param {number} delta Relative value to add to the zoom rotation, in radians.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The rotation center.\n */\n adjustRotationInternal(delta, anchor) {\n const isMoving = this.getAnimating() || this.getInteracting();\n const newRotation = this.constraints_.rotation(\n this.targetRotation_ + delta,\n isMoving,\n );\n if (anchor) {\n this.targetCenter_ = this.calculateCenterRotate(newRotation, anchor);\n }\n this.targetRotation_ += delta;\n this.applyTargetState_();\n }\n\n /**\n * Set the center of the current view. Any extent constraint will apply.\n * @param {import(\"./coordinate.js\").Coordinate|undefined} center The center of the view.\n * @observable\n * @api\n */\n setCenter(center) {\n this.setCenterInternal(\n center ? fromUserCoordinate(center, this.getProjection()) : center,\n );\n }\n\n /**\n * Set the center using the view projection (not the user projection).\n * @param {import(\"./coordinate.js\").Coordinate|undefined} center The center of the view.\n */\n setCenterInternal(center) {\n this.targetCenter_ = center;\n this.applyTargetState_();\n }\n\n /**\n * @param {import(\"./ViewHint.js\").default} hint Hint.\n * @param {number} delta Delta.\n * @return {number} New value.\n */\n setHint(hint, delta) {\n this.hints_[hint] += delta;\n this.changed();\n return this.hints_[hint];\n }\n\n /**\n * Set the resolution for this view. Any resolution constraint will apply.\n * @param {number|undefined} resolution The resolution of the view.\n * @observable\n * @api\n */\n setResolution(resolution) {\n this.targetResolution_ = resolution;\n this.applyTargetState_();\n }\n\n /**\n * Set the rotation for this view. Any rotation constraint will apply.\n * @param {number} rotation The rotation of the view in radians.\n * @observable\n * @api\n */\n setRotation(rotation) {\n this.targetRotation_ = rotation;\n this.applyTargetState_();\n }\n\n /**\n * Zoom to a specific zoom level. Any resolution constrain will apply.\n * @param {number} zoom Zoom level.\n * @api\n */\n setZoom(zoom) {\n this.setResolution(this.getResolutionForZoom(zoom));\n }\n\n /**\n * Recompute rotation/resolution/center based on target values.\n * Note: we have to compute rotation first, then resolution and center considering that\n * parameters can influence one another in case a view extent constraint is present.\n * @param {boolean} [doNotCancelAnims] Do not cancel animations.\n * @param {boolean} [forceMoving] Apply constraints as if the view is moving.\n * @private\n */\n applyTargetState_(doNotCancelAnims, forceMoving) {\n const isMoving =\n this.getAnimating() || this.getInteracting() || forceMoving;\n\n // compute rotation\n const newRotation = this.constraints_.rotation(\n this.targetRotation_,\n isMoving,\n );\n const size = this.getViewportSize_(newRotation);\n const newResolution = this.constraints_.resolution(\n this.targetResolution_,\n 0,\n size,\n isMoving,\n );\n const newCenter = this.constraints_.center(\n this.targetCenter_,\n newResolution,\n size,\n isMoving,\n this.calculateCenterShift(\n this.targetCenter_,\n newResolution,\n newRotation,\n size,\n ),\n );\n\n if (this.get(ViewProperty.ROTATION) !== newRotation) {\n this.set(ViewProperty.ROTATION, newRotation);\n }\n if (this.get(ViewProperty.RESOLUTION) !== newResolution) {\n this.set(ViewProperty.RESOLUTION, newResolution);\n this.set('zoom', this.getZoom(), true);\n }\n if (\n !newCenter ||\n !this.get(ViewProperty.CENTER) ||\n !equals(this.get(ViewProperty.CENTER), newCenter)\n ) {\n this.set(ViewProperty.CENTER, newCenter);\n }\n\n if (this.getAnimating() && !doNotCancelAnims) {\n this.cancelAnimations();\n }\n this.cancelAnchor_ = undefined;\n }\n\n /**\n * If any constraints need to be applied, an animation will be triggered.\n * This is typically done on interaction end.\n * Note: calling this with a duration of 0 will apply the constrained values straight away,\n * without animation.\n * @param {number} [duration] The animation duration in ms.\n * @param {number} [resolutionDirection] Which direction to zoom.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n */\n resolveConstraints(duration, resolutionDirection, anchor) {\n duration = duration !== undefined ? duration : 200;\n const direction = resolutionDirection || 0;\n\n const newRotation = this.constraints_.rotation(this.targetRotation_);\n const size = this.getViewportSize_(newRotation);\n const newResolution = this.constraints_.resolution(\n this.targetResolution_,\n direction,\n size,\n );\n const newCenter = this.constraints_.center(\n this.targetCenter_,\n newResolution,\n size,\n false,\n this.calculateCenterShift(\n this.targetCenter_,\n newResolution,\n newRotation,\n size,\n ),\n );\n\n if (duration === 0 && !this.cancelAnchor_) {\n this.targetResolution_ = newResolution;\n this.targetRotation_ = newRotation;\n this.targetCenter_ = newCenter;\n this.applyTargetState_();\n return;\n }\n\n anchor = anchor || (duration === 0 ? this.cancelAnchor_ : undefined);\n this.cancelAnchor_ = undefined;\n\n if (\n this.getResolution() !== newResolution ||\n this.getRotation() !== newRotation ||\n !this.getCenterInternal() ||\n !equals(this.getCenterInternal(), newCenter)\n ) {\n if (this.getAnimating()) {\n this.cancelAnimations();\n }\n\n this.animateInternal({\n rotation: newRotation,\n center: newCenter,\n resolution: newResolution,\n duration: duration,\n easing: easeOut,\n anchor: anchor,\n });\n }\n }\n\n /**\n * Notify the View that an interaction has started.\n * The view state will be resolved to a stable one if needed\n * (depending on its constraints).\n * @api\n */\n beginInteraction() {\n this.resolveConstraints(0);\n\n this.setHint(ViewHint.INTERACTING, 1);\n }\n\n /**\n * Notify the View that an interaction has ended. The view state will be resolved\n * to a stable one if needed (depending on its constraints).\n * @param {number} [duration] Animation duration in ms.\n * @param {number} [resolutionDirection] Which direction to zoom.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n * @api\n */\n endInteraction(duration, resolutionDirection, anchor) {\n anchor = anchor && fromUserCoordinate(anchor, this.getProjection());\n this.endInteractionInternal(duration, resolutionDirection, anchor);\n }\n\n /**\n * Notify the View that an interaction has ended. The view state will be resolved\n * to a stable one if needed (depending on its constraints).\n * @param {number} [duration] Animation duration in ms.\n * @param {number} [resolutionDirection] Which direction to zoom.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n */\n endInteractionInternal(duration, resolutionDirection, anchor) {\n if (!this.getInteracting()) {\n return;\n }\n this.setHint(ViewHint.INTERACTING, -1);\n this.resolveConstraints(duration, resolutionDirection, anchor);\n }\n\n /**\n * Get a valid position for the view center according to the current constraints.\n * @param {import(\"./coordinate.js\").Coordinate|undefined} targetCenter Target center position.\n * @param {number} [targetResolution] Target resolution. If not supplied, the current one will be used.\n * This is useful to guess a valid center position at a different zoom level.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Valid center position.\n */\n getConstrainedCenter(targetCenter, targetResolution) {\n const size = this.getViewportSize_(this.getRotation());\n return this.constraints_.center(\n targetCenter,\n targetResolution || this.getResolution(),\n size,\n );\n }\n\n /**\n * Get a valid zoom level according to the current view constraints.\n * @param {number|undefined} targetZoom Target zoom.\n * @param {number} [direction=0] Indicate which resolution should be used\n * by a renderer if the view resolution does not match any resolution of the tile source.\n * If 0, the nearest resolution will be used. If 1, the nearest lower resolution\n * will be used. If -1, the nearest higher resolution will be used.\n * @return {number|undefined} Valid zoom level.\n */\n getConstrainedZoom(targetZoom, direction) {\n const targetRes = this.getResolutionForZoom(targetZoom);\n return this.getZoomForResolution(\n this.getConstrainedResolution(targetRes, direction),\n );\n }\n\n /**\n * Get a valid resolution according to the current view constraints.\n * @param {number|undefined} targetResolution Target resolution.\n * @param {number} [direction=0] Indicate which resolution should be used\n * by a renderer if the view resolution does not match any resolution of the tile source.\n * If 0, the nearest resolution will be used. If 1, the nearest lower resolution\n * will be used. If -1, the nearest higher resolution will be used.\n * @return {number|undefined} Valid resolution.\n */\n getConstrainedResolution(targetResolution, direction) {\n direction = direction || 0;\n const size = this.getViewportSize_(this.getRotation());\n\n return this.constraints_.resolution(targetResolution, direction, size);\n }\n}\n\n/**\n * @param {Function} callback Callback.\n * @param {*} returnValue Return value.\n */\nfunction animationCallback(callback, returnValue) {\n setTimeout(function () {\n callback(returnValue);\n }, 0);\n}\n\n/**\n * @param {ViewOptions} options View options.\n * @return {import(\"./centerconstraint.js\").Type} The constraint.\n */\nexport function createCenterConstraint(options) {\n if (options.extent !== undefined) {\n const smooth =\n options.smoothExtentConstraint !== undefined\n ? options.smoothExtentConstraint\n : true;\n return createExtent(options.extent, options.constrainOnlyCenter, smooth);\n }\n\n const projection = createProjection(options.projection, 'EPSG:3857');\n if (options.multiWorld !== true && projection.isGlobal()) {\n const extent = projection.getExtent().slice();\n extent[0] = -Infinity;\n extent[2] = Infinity;\n return createExtent(extent, false, false);\n }\n\n return centerNone;\n}\n\n/**\n * @param {ViewOptions} options View options.\n * @return {{constraint: import(\"./resolutionconstraint.js\").Type, maxResolution: number,\n * minResolution: number, minZoom: number, zoomFactor: number}} The constraint.\n */\nexport function createResolutionConstraint(options) {\n let resolutionConstraint;\n let maxResolution;\n let minResolution;\n\n // TODO: move these to be ol constants\n // see https://github.com/openlayers/openlayers/issues/2076\n const defaultMaxZoom = 28;\n const defaultZoomFactor = 2;\n\n let minZoom =\n options.minZoom !== undefined ? options.minZoom : DEFAULT_MIN_ZOOM;\n\n let maxZoom =\n options.maxZoom !== undefined ? options.maxZoom : defaultMaxZoom;\n\n const zoomFactor =\n options.zoomFactor !== undefined ? options.zoomFactor : defaultZoomFactor;\n\n const multiWorld =\n options.multiWorld !== undefined ? options.multiWorld : false;\n\n const smooth =\n options.smoothResolutionConstraint !== undefined\n ? options.smoothResolutionConstraint\n : true;\n\n const showFullExtent =\n options.showFullExtent !== undefined ? options.showFullExtent : false;\n\n const projection = createProjection(options.projection, 'EPSG:3857');\n const projExtent = projection.getExtent();\n let constrainOnlyCenter = options.constrainOnlyCenter;\n let extent = options.extent;\n if (!multiWorld && !extent && projection.isGlobal()) {\n constrainOnlyCenter = false;\n extent = projExtent;\n }\n\n if (options.resolutions !== undefined) {\n const resolutions = options.resolutions;\n maxResolution = resolutions[minZoom];\n minResolution =\n resolutions[maxZoom] !== undefined\n ? resolutions[maxZoom]\n : resolutions[resolutions.length - 1];\n\n if (options.constrainResolution) {\n resolutionConstraint = createSnapToResolutions(\n resolutions,\n smooth,\n !constrainOnlyCenter && extent,\n showFullExtent,\n );\n } else {\n resolutionConstraint = createMinMaxResolution(\n maxResolution,\n minResolution,\n smooth,\n !constrainOnlyCenter && extent,\n showFullExtent,\n );\n }\n } else {\n // calculate the default min and max resolution\n const size = !projExtent\n ? // use an extent that can fit the whole world if need be\n (360 * METERS_PER_UNIT.degrees) / projection.getMetersPerUnit()\n : Math.max(getWidth(projExtent), getHeight(projExtent));\n\n const defaultMaxResolution =\n size / DEFAULT_TILE_SIZE / Math.pow(defaultZoomFactor, DEFAULT_MIN_ZOOM);\n\n const defaultMinResolution =\n defaultMaxResolution /\n Math.pow(defaultZoomFactor, defaultMaxZoom - DEFAULT_MIN_ZOOM);\n\n // user provided maxResolution takes precedence\n maxResolution = options.maxResolution;\n if (maxResolution !== undefined) {\n minZoom = 0;\n } else {\n maxResolution = defaultMaxResolution / Math.pow(zoomFactor, minZoom);\n }\n\n // user provided minResolution takes precedence\n minResolution = options.minResolution;\n if (minResolution === undefined) {\n if (options.maxZoom !== undefined) {\n if (options.maxResolution !== undefined) {\n minResolution = maxResolution / Math.pow(zoomFactor, maxZoom);\n } else {\n minResolution = defaultMaxResolution / Math.pow(zoomFactor, maxZoom);\n }\n } else {\n minResolution = defaultMinResolution;\n }\n }\n\n // given discrete zoom levels, minResolution may be different than provided\n maxZoom =\n minZoom +\n Math.floor(\n Math.log(maxResolution / minResolution) / Math.log(zoomFactor),\n );\n minResolution = maxResolution / Math.pow(zoomFactor, maxZoom - minZoom);\n\n if (options.constrainResolution) {\n resolutionConstraint = createSnapToPower(\n zoomFactor,\n maxResolution,\n minResolution,\n smooth,\n !constrainOnlyCenter && extent,\n showFullExtent,\n );\n } else {\n resolutionConstraint = createMinMaxResolution(\n maxResolution,\n minResolution,\n smooth,\n !constrainOnlyCenter && extent,\n showFullExtent,\n );\n }\n }\n return {\n constraint: resolutionConstraint,\n maxResolution: maxResolution,\n minResolution: minResolution,\n minZoom: minZoom,\n zoomFactor: zoomFactor,\n };\n}\n\n/**\n * @param {ViewOptions} options View options.\n * @return {import(\"./rotationconstraint.js\").Type} Rotation constraint.\n */\nexport function createRotationConstraint(options) {\n const enableRotation =\n options.enableRotation !== undefined ? options.enableRotation : true;\n if (enableRotation) {\n const constrainRotation = options.constrainRotation;\n if (constrainRotation === undefined || constrainRotation === true) {\n return createSnapToZero();\n }\n if (constrainRotation === false) {\n return rotationNone;\n }\n if (typeof constrainRotation === 'number') {\n return createSnapToN(constrainRotation);\n }\n return rotationNone;\n }\n return disable;\n}\n\n/**\n * Determine if an animation involves no view change.\n * @param {Animation} animation The animation.\n * @return {boolean} The animation involves no view change.\n */\nexport function isNoopAnimation(animation) {\n if (animation.sourceCenter && animation.targetCenter) {\n if (!coordinatesEqual(animation.sourceCenter, animation.targetCenter)) {\n return false;\n }\n }\n if (animation.sourceResolution !== animation.targetResolution) {\n return false;\n }\n if (animation.sourceRotation !== animation.targetRotation) {\n return false;\n }\n return true;\n}\n\n/**\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"./size.js\").Size} size Box pixel size.\n * @param {import(\"./pixel.js\").Pixel} position Position on the view to center on.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @return {import(\"./coordinate.js\").Coordinate} Shifted center.\n */\nfunction calculateCenterOn(coordinate, size, position, resolution, rotation) {\n // calculate rotated position\n const cosAngle = Math.cos(-rotation);\n let sinAngle = Math.sin(-rotation);\n let rotX = coordinate[0] * cosAngle - coordinate[1] * sinAngle;\n let rotY = coordinate[1] * cosAngle + coordinate[0] * sinAngle;\n rotX += (size[0] / 2 - position[0]) * resolution;\n rotY += (position[1] - size[1] / 2) * resolution;\n\n // go back to original angle\n sinAngle = -sinAngle; // go back to original rotation\n const centerX = rotX * cosAngle - rotY * sinAngle;\n const centerY = rotY * cosAngle + rotX * sinAngle;\n\n return [centerX, centerY];\n}\n\nexport default View;\n","/**\n * @module ol/ViewHint\n */\n\n/**\n * @enum {number}\n */\nexport default {\n ANIMATING: 0,\n INTERACTING: 1,\n};\n","/**\n * @module ol/array\n */\n\n/**\n * Performs a binary search on the provided sorted list and returns the index of the item if found. If it can't be found it'll return -1.\n * https://github.com/darkskyapp/binary-search\n *\n * @param {Array<*>} haystack Items to search through.\n * @param {*} needle The item to look for.\n * @param {Function} [comparator] Comparator function.\n * @return {number} The index of the item if found, -1 if not.\n */\nexport function binarySearch(haystack, needle, comparator) {\n let mid, cmp;\n comparator = comparator || ascending;\n let low = 0;\n let high = haystack.length;\n let found = false;\n\n while (low < high) {\n /* Note that \"(low + high) >>> 1\" may overflow, and results in a typecast\n * to double (which gives the wrong results). */\n mid = low + ((high - low) >> 1);\n cmp = +comparator(haystack[mid], needle);\n\n if (cmp < 0.0) {\n /* Too low. */\n low = mid + 1;\n } else {\n /* Key found or too high */\n high = mid;\n found = !cmp;\n }\n }\n\n /* Key not found. */\n return found ? low : ~low;\n}\n\n/**\n * Compare function sorting arrays in ascending order. Safe to use for numeric values.\n * @param {*} a The first object to be compared.\n * @param {*} b The second object to be compared.\n * @return {number} A negative number, zero, or a positive number as the first\n * argument is less than, equal to, or greater than the second.\n */\nexport function ascending(a, b) {\n return a > b ? 1 : a < b ? -1 : 0;\n}\n\n/**\n * Compare function sorting arrays in descending order. Safe to use for numeric values.\n * @param {*} a The first object to be compared.\n * @param {*} b The second object to be compared.\n * @return {number} A negative number, zero, or a positive number as the first\n * argument is greater than, equal to, or less than the second.\n */\nexport function descending(a, b) {\n return a < b ? 1 : a > b ? -1 : 0;\n}\n\n/**\n * {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution} can use a function\n * of this type to determine which nearest resolution to use.\n *\n * This function takes a `{number}` representing a value between two array entries,\n * a `{number}` representing the value of the nearest higher entry and\n * a `{number}` representing the value of the nearest lower entry\n * as arguments and returns a `{number}`. If a negative number or zero is returned\n * the lower value will be used, if a positive number is returned the higher value\n * will be used.\n * @typedef {function(number, number, number): number} NearestDirectionFunction\n * @api\n */\n\n/**\n * @param {Array} arr Array in descending order.\n * @param {number} target Target.\n * @param {number|NearestDirectionFunction} direction\n * 0 means return the nearest,\n * > 0 means return the largest nearest,\n * < 0 means return the smallest nearest.\n * @return {number} Index.\n */\nexport function linearFindNearest(arr, target, direction) {\n if (arr[0] <= target) {\n return 0;\n }\n\n const n = arr.length;\n if (target <= arr[n - 1]) {\n return n - 1;\n }\n\n if (typeof direction === 'function') {\n for (let i = 1; i < n; ++i) {\n const candidate = arr[i];\n if (candidate === target) {\n return i;\n }\n if (candidate < target) {\n if (direction(target, arr[i - 1], candidate) > 0) {\n return i - 1;\n }\n return i;\n }\n }\n return n - 1;\n }\n\n if (direction > 0) {\n for (let i = 1; i < n; ++i) {\n if (arr[i] < target) {\n return i - 1;\n }\n }\n return n - 1;\n }\n\n if (direction < 0) {\n for (let i = 1; i < n; ++i) {\n if (arr[i] <= target) {\n return i;\n }\n }\n return n - 1;\n }\n\n for (let i = 1; i < n; ++i) {\n if (arr[i] == target) {\n return i;\n }\n if (arr[i] < target) {\n if (arr[i - 1] - target < target - arr[i]) {\n return i - 1;\n }\n return i;\n }\n }\n return n - 1;\n}\n\n/**\n * @param {Array<*>} arr Array.\n * @param {number} begin Begin index.\n * @param {number} end End index.\n */\nexport function reverseSubArray(arr, begin, end) {\n while (begin < end) {\n const tmp = arr[begin];\n arr[begin] = arr[end];\n arr[end] = tmp;\n ++begin;\n --end;\n }\n}\n\n/**\n * @param {Array} arr The array to modify.\n * @param {!Array|VALUE} data The elements or arrays of elements to add to arr.\n * @template VALUE\n */\nexport function extend(arr, data) {\n const extension = Array.isArray(data) ? data : [data];\n const length = extension.length;\n for (let i = 0; i < length; i++) {\n arr[arr.length] = extension[i];\n }\n}\n\n/**\n * @param {Array} arr The array to modify.\n * @param {VALUE} obj The element to remove.\n * @template VALUE\n * @return {boolean} If the element was removed.\n */\nexport function remove(arr, obj) {\n const i = arr.indexOf(obj);\n const found = i > -1;\n if (found) {\n arr.splice(i, 1);\n }\n return found;\n}\n\n/**\n * @param {Array|Uint8ClampedArray} arr1 The first array to compare.\n * @param {Array|Uint8ClampedArray} arr2 The second array to compare.\n * @return {boolean} Whether the two arrays are equal.\n */\nexport function equals(arr1, arr2) {\n const len1 = arr1.length;\n if (len1 !== arr2.length) {\n return false;\n }\n for (let i = 0; i < len1; i++) {\n if (arr1[i] !== arr2[i]) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Sort the passed array such that the relative order of equal elements is preserved.\n * See https://en.wikipedia.org/wiki/Sorting_algorithm#Stability for details.\n * @param {Array<*>} arr The array to sort (modifies original).\n * @param {!function(*, *): number} compareFnc Comparison function.\n * @api\n */\nexport function stableSort(arr, compareFnc) {\n const length = arr.length;\n const tmp = Array(arr.length);\n let i;\n for (i = 0; i < length; i++) {\n tmp[i] = {index: i, value: arr[i]};\n }\n tmp.sort(function (a, b) {\n return compareFnc(a.value, b.value) || a.index - b.index;\n });\n for (i = 0; i < arr.length; i++) {\n arr[i] = tmp[i].value;\n }\n}\n\n/**\n * @param {Array<*>} arr The array to test.\n * @param {Function} [func] Comparison function.\n * @param {boolean} [strict] Strictly sorted (default false).\n * @return {boolean} Return index.\n */\nexport function isSorted(arr, func, strict) {\n const compare = func || ascending;\n return arr.every(function (currentVal, index) {\n if (index === 0) {\n return true;\n }\n const res = compare(arr[index - 1], currentVal);\n return !(res > 0 || (strict && res === 0));\n });\n}\n","/**\n * @module ol/asserts\n */\n\n/**\n * @param {*} assertion Assertion we expected to be truthy.\n * @param {string} errorMessage Error message.\n */\nexport function assert(assertion, errorMessage) {\n if (!assertion) {\n throw new Error(errorMessage);\n }\n}\n","/**\n * RGB space.\n *\n * @module color-space/rgb\n */\n\nexport default {\n\tname: 'rgb',\n\tmin: [0,0,0],\n\tmax: [255,255,255],\n\tchannel: ['red', 'green', 'blue'],\n\talias: ['RGB']\n};\n","/**\n * CIE XYZ\n *\n * @module color-space/xyz\n */\nimport rgb from './rgb.js';\n\nvar xyz = {\n\tname: 'xyz',\n\tmin: [0,0,0],\n\tchannel: ['X','Y','Z'],\n\talias: ['XYZ', 'ciexyz', 'cie1931']\n};\n\n\n/**\n * Whitepoint reference values with observer/illuminant\n *\n * http://en.wikipedia.org/wiki/Standard_illuminant\n */\nxyz.whitepoint = {\n\t//1931 2°\n\t2: {\n\t\t//incadescent\n\t\tA:[109.85, 100, 35.585],\n\t\t// B:[],\n\t\tC: [98.074, 100, 118.232],\n\t\tD50: [96.422, 100, 82.521],\n\t\tD55: [95.682, 100, 92.149],\n\t\t//daylight\n\t\tD65: [95.045592705167, 100, 108.9057750759878],\n\t\tD75: [94.972, 100, 122.638],\n\t\t//flourescent\n\t\t// F1: [],\n\t\tF2: [99.187, 100, 67.395],\n\t\t// F3: [],\n\t\t// F4: [],\n\t\t// F5: [],\n\t\t// F6:[],\n\t\tF7: [95.044, 100, 108.755],\n\t\t// F8: [],\n\t\t// F9: [],\n\t\t// F10: [],\n\t\tF11: [100.966, 100, 64.370],\n\t\t// F12: [],\n\t\tE: [100,100,100]\n\t},\n\n\t//1964 10°\n\t10: {\n\t\t//incadescent\n\t\tA:[111.144, 100, 35.200],\n\t\tC: [97.285, 100, 116.145],\n\t\tD50: [96.720, 100, 81.427],\n\t\tD55: [95.799, 100, 90.926],\n\t\t//daylight\n\t\tD65: [94.811, 100, 107.304],\n\t\tD75: [94.416, 100, 120.641],\n\t\t//flourescent\n\t\tF2: [103.280, 100, 69.026],\n\t\tF7: [95.792, 100, 107.687],\n\t\tF11: [103.866, 100, 65.627],\n\t\tE: [100,100,100]\n\t}\n};\n\n\n/**\n * Top values are the whitepoint’s top values, default are D65\n */\nxyz.max = xyz.whitepoint[2].D65;\n\n\n/**\n * Transform xyz to rgb\n *\n * @param {Array} xyz Array of xyz values\n *\n * @return {Array} RGB values\n */\nxyz.rgb = function (_xyz, white) {\n\t//FIXME: make sure we have to divide like this. Probably we have to replace matrix as well then\n\twhite = white || xyz.whitepoint[2].E;\n\n\tvar x = _xyz[0] / white[0],\n\t\ty = _xyz[1] / white[1],\n\t\tz = _xyz[2] / white[2],\n\t\tr, g, b;\n\n\t// assume sRGB\n\t// http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html\n\tr = (x * 3.240969941904521) + (y * -1.537383177570093) + (z * -0.498610760293);\n\tg = (x * -0.96924363628087) + (y * 1.87596750150772) + (z * 0.041555057407175);\n\tb = (x * 0.055630079696993) + (y * -0.20397695888897) + (z * 1.056971514242878);\n\n\tr = r > 0.0031308 ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)\n\t\t: r = (r * 12.92);\n\n\tg = g > 0.0031308 ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)\n\t\t: g = (g * 12.92);\n\n\tb = b > 0.0031308 ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)\n\t\t: b = (b * 12.92);\n\n\tr = Math.min(Math.max(0, r), 1);\n\tg = Math.min(Math.max(0, g), 1);\n\tb = Math.min(Math.max(0, b), 1);\n\n\treturn [r * 255, g * 255, b * 255];\n}\n\n\n\n/**\n * RGB to XYZ\n *\n * @param {Array} rgb RGB channels\n *\n * @return {Array} XYZ channels\n */\nrgb.xyz = function(rgb, white) {\n\tvar r = rgb[0] / 255,\n\t\t\tg = rgb[1] / 255,\n\t\t\tb = rgb[2] / 255;\n\n\t// assume sRGB\n\tr = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);\n\tg = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);\n\tb = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);\n\n\tvar x = (r * 0.41239079926595) + (g * 0.35758433938387) + (b * 0.18048078840183);\n\tvar y = (r * 0.21263900587151) + (g * 0.71516867876775) + (b * 0.072192315360733);\n\tvar z = (r * 0.019330818715591) + (g * 0.11919477979462) + (b * 0.95053215224966);\n\n\twhite = white || xyz.whitepoint[2].E;\n\n\treturn [x * white[0], y * white[1], z * white[2]];\n};\n\n\n\nexport default xyz;\n","/**\n * CIE LUV (C'est la vie)\n *\n * @module color-space/luv\n */\n import xyz from './xyz.js';\n\nexport default {\n\tname: 'luv',\n\t//NOTE: luv has no rigidly defined limits\n\t//easyrgb fails to get proper coords\n\t//boronine states no rigid limits\n\t//colorMine refers this ones:\n\tmin: [0,-134,-140],\n\tmax: [100,224,122],\n\tchannel: ['lightness', 'u', 'v'],\n\talias: ['LUV', 'cieluv', 'cie1976'],\n\n\txyz: function(arg, i, o){\n\t\tvar _u, _v, l, u, v, x, y, z, xn, yn, zn, un, vn;\n\t\tl = arg[0], u = arg[1], v = arg[2];\n\n\t\tif (l === 0) return [0,0,0];\n\n\t\t//get constants\n\t\t//var e = 0.008856451679035631; //(6/29)^3\n\t\tvar k = 0.0011070564598794539; //(3/29)^3\n\n\t\t//get illuminant/observer\n\t\ti = i || 'D65';\n\t\to = o || 2;\n\n\t\txn = xyz.whitepoint[o][i][0];\n\t\tyn = xyz.whitepoint[o][i][1];\n\t\tzn = xyz.whitepoint[o][i][2];\n\n\t\tun = (4 * xn) / (xn + (15 * yn) + (3 * zn));\n\t\tvn = (9 * yn) / (xn + (15 * yn) + (3 * zn));\n\t\t// un = 0.19783000664283;\n\t\t// vn = 0.46831999493879;\n\n\n\t\t_u = u / (13 * l) + un || 0;\n\t\t_v = v / (13 * l) + vn || 0;\n\n\t\ty = l > 8 ? yn * Math.pow( (l + 16) / 116 , 3) : yn * l * k;\n\n\t\t//wikipedia method\n\t\tx = y * 9 * _u / (4 * _v) || 0;\n\t\tz = y * (12 - 3 * _u - 20 * _v) / (4 * _v) || 0;\n\n\t\t//boronine method\n\t\t//https://github.com/boronine/husl/blob/master/husl.coffee#L201\n\t\t// x = 0 - (9 * y * _u) / ((_u - 4) * _v - _u * _v);\n\t\t// z = (9 * y - (15 * _v * y) - (_v * x)) / (3 * _v);\n\n\t\treturn [x, y, z];\n\t}\n};\n\n// http://www.brucelindbloom.com/index.html?Equations.html\n// https://github.com/boronine/husl/blob/master/husl.coffee\n//i - illuminant\n//o - observer\nxyz.luv = function(arg, i, o) {\n\tvar _u, _v, l, u, v, x, y, z, xn, yn, zn, un, vn;\n\n\t//get constants\n\tvar e = 0.008856451679035631; //(6/29)^3\n\tvar k = 903.2962962962961; //(29/3)^3\n\n\t//get illuminant/observer coords\n\ti = i || 'D65';\n\to = o || 2;\n\n\txn = xyz.whitepoint[o][i][0];\n\tyn = xyz.whitepoint[o][i][1];\n\tzn = xyz.whitepoint[o][i][2];\n\n\tun = (4 * xn) / (xn + (15 * yn) + (3 * zn));\n\tvn = (9 * yn) / (xn + (15 * yn) + (3 * zn));\n\n\n\tx = arg[0], y = arg[1], z = arg[2];\n\n\n\t_u = (4 * x) / (x + (15 * y) + (3 * z)) || 0;\n\t_v = (9 * y) / (x + (15 * y) + (3 * z)) || 0;\n\n\tvar yr = y/yn;\n\n\tl = yr <= e ? k * yr : 116 * Math.pow(yr, 1/3) - 16;\n\n\tu = 13 * l * (_u - un);\n\tv = 13 * l * (_v - vn);\n\n\treturn [l, u, v];\n};\n","/**\n * Cylindrical CIE LUV\n *\n * @module color-space/lchuv\n */\nimport luv from './luv.js';\nimport xyz from './xyz.js';\n\n//cylindrical luv\nvar lchuv = {\n\tname: 'lchuv',\n\tchannel: ['lightness', 'chroma', 'hue'],\n\talias: ['LCHuv', 'cielchuv'],\n\tmin: [0,0,0],\n\tmax: [100,100,360],\n\n\tluv: function(luv){\n\t\tvar l = luv[0],\n\t\tc = luv[1],\n\t\th = luv[2],\n\t\tu, v, hr;\n\n\t\thr = h / 360 * 2 * Math.PI;\n\t\tu = c * Math.cos(hr);\n\t\tv = c * Math.sin(hr);\n\t\treturn [l, u, v];\n\t},\n\n\txyz: function(arg) {\n\t\treturn luv.xyz(lchuv.luv(arg));\n\t}\n};\n\nexport default lchuv;\n\nluv.lchuv = function(luv){\n\tvar l = luv[0], u = luv[1], v = luv[2];\n\n\tvar c = Math.sqrt(u*u + v*v);\n\tvar hr = Math.atan2(v,u);\n\tvar h = hr * 360 / 2 / Math.PI;\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\treturn [l,c,h]\n};\n\nxyz.lchuv = function(arg){\n return luv.lchuv(xyz.luv(arg));\n};\n","export default {\n\taliceblue: [240, 248, 255],\n\tantiquewhite: [250, 235, 215],\n\taqua: [0, 255, 255],\n\taquamarine: [127, 255, 212],\n\tazure: [240, 255, 255],\n\tbeige: [245, 245, 220],\n\tbisque: [255, 228, 196],\n\tblack: [0, 0, 0],\n\tblanchedalmond: [255, 235, 205],\n\tblue: [0, 0, 255],\n\tblueviolet: [138, 43, 226],\n\tbrown: [165, 42, 42],\n\tburlywood: [222, 184, 135],\n\tcadetblue: [95, 158, 160],\n\tchartreuse: [127, 255, 0],\n\tchocolate: [210, 105, 30],\n\tcoral: [255, 127, 80],\n\tcornflowerblue: [100, 149, 237],\n\tcornsilk: [255, 248, 220],\n\tcrimson: [220, 20, 60],\n\tcyan: [0, 255, 255],\n\tdarkblue: [0, 0, 139],\n\tdarkcyan: [0, 139, 139],\n\tdarkgoldenrod: [184, 134, 11],\n\tdarkgray: [169, 169, 169],\n\tdarkgreen: [0, 100, 0],\n\tdarkgrey: [169, 169, 169],\n\tdarkkhaki: [189, 183, 107],\n\tdarkmagenta: [139, 0, 139],\n\tdarkolivegreen: [85, 107, 47],\n\tdarkorange: [255, 140, 0],\n\tdarkorchid: [153, 50, 204],\n\tdarkred: [139, 0, 0],\n\tdarksalmon: [233, 150, 122],\n\tdarkseagreen: [143, 188, 143],\n\tdarkslateblue: [72, 61, 139],\n\tdarkslategray: [47, 79, 79],\n\tdarkslategrey: [47, 79, 79],\n\tdarkturquoise: [0, 206, 209],\n\tdarkviolet: [148, 0, 211],\n\tdeeppink: [255, 20, 147],\n\tdeepskyblue: [0, 191, 255],\n\tdimgray: [105, 105, 105],\n\tdimgrey: [105, 105, 105],\n\tdodgerblue: [30, 144, 255],\n\tfirebrick: [178, 34, 34],\n\tfloralwhite: [255, 250, 240],\n\tforestgreen: [34, 139, 34],\n\tfuchsia: [255, 0, 255],\n\tgainsboro: [220, 220, 220],\n\tghostwhite: [248, 248, 255],\n\tgold: [255, 215, 0],\n\tgoldenrod: [218, 165, 32],\n\tgray: [128, 128, 128],\n\tgreen: [0, 128, 0],\n\tgreenyellow: [173, 255, 47],\n\tgrey: [128, 128, 128],\n\thoneydew: [240, 255, 240],\n\thotpink: [255, 105, 180],\n\tindianred: [205, 92, 92],\n\tindigo: [75, 0, 130],\n\tivory: [255, 255, 240],\n\tkhaki: [240, 230, 140],\n\tlavender: [230, 230, 250],\n\tlavenderblush: [255, 240, 245],\n\tlawngreen: [124, 252, 0],\n\tlemonchiffon: [255, 250, 205],\n\tlightblue: [173, 216, 230],\n\tlightcoral: [240, 128, 128],\n\tlightcyan: [224, 255, 255],\n\tlightgoldenrodyellow: [250, 250, 210],\n\tlightgray: [211, 211, 211],\n\tlightgreen: [144, 238, 144],\n\tlightgrey: [211, 211, 211],\n\tlightpink: [255, 182, 193],\n\tlightsalmon: [255, 160, 122],\n\tlightseagreen: [32, 178, 170],\n\tlightskyblue: [135, 206, 250],\n\tlightslategray: [119, 136, 153],\n\tlightslategrey: [119, 136, 153],\n\tlightsteelblue: [176, 196, 222],\n\tlightyellow: [255, 255, 224],\n\tlime: [0, 255, 0],\n\tlimegreen: [50, 205, 50],\n\tlinen: [250, 240, 230],\n\tmagenta: [255, 0, 255],\n\tmaroon: [128, 0, 0],\n\tmediumaquamarine: [102, 205, 170],\n\tmediumblue: [0, 0, 205],\n\tmediumorchid: [186, 85, 211],\n\tmediumpurple: [147, 112, 219],\n\tmediumseagreen: [60, 179, 113],\n\tmediumslateblue: [123, 104, 238],\n\tmediumspringgreen: [0, 250, 154],\n\tmediumturquoise: [72, 209, 204],\n\tmediumvioletred: [199, 21, 133],\n\tmidnightblue: [25, 25, 112],\n\tmintcream: [245, 255, 250],\n\tmistyrose: [255, 228, 225],\n\tmoccasin: [255, 228, 181],\n\tnavajowhite: [255, 222, 173],\n\tnavy: [0, 0, 128],\n\toldlace: [253, 245, 230],\n\tolive: [128, 128, 0],\n\tolivedrab: [107, 142, 35],\n\torange: [255, 165, 0],\n\torangered: [255, 69, 0],\n\torchid: [218, 112, 214],\n\tpalegoldenrod: [238, 232, 170],\n\tpalegreen: [152, 251, 152],\n\tpaleturquoise: [175, 238, 238],\n\tpalevioletred: [219, 112, 147],\n\tpapayawhip: [255, 239, 213],\n\tpeachpuff: [255, 218, 185],\n\tperu: [205, 133, 63],\n\tpink: [255, 192, 203],\n\tplum: [221, 160, 221],\n\tpowderblue: [176, 224, 230],\n\tpurple: [128, 0, 128],\n\trebeccapurple: [102, 51, 153],\n\tred: [255, 0, 0],\n\trosybrown: [188, 143, 143],\n\troyalblue: [65, 105, 225],\n\tsaddlebrown: [139, 69, 19],\n\tsalmon: [250, 128, 114],\n\tsandybrown: [244, 164, 96],\n\tseagreen: [46, 139, 87],\n\tseashell: [255, 245, 238],\n\tsienna: [160, 82, 45],\n\tsilver: [192, 192, 192],\n\tskyblue: [135, 206, 235],\n\tslateblue: [106, 90, 205],\n\tslategray: [112, 128, 144],\n\tslategrey: [112, 128, 144],\n\tsnow: [255, 250, 250],\n\tspringgreen: [0, 255, 127],\n\tsteelblue: [70, 130, 180],\n\ttan: [210, 180, 140],\n\tteal: [0, 128, 128],\n\tthistle: [216, 191, 216],\n\ttomato: [255, 99, 71],\n\tturquoise: [64, 224, 208],\n\tviolet: [238, 130, 238],\n\twheat: [245, 222, 179],\n\twhite: [255, 255, 255],\n\twhitesmoke: [245, 245, 245],\n\tyellow: [255, 255, 0],\n\tyellowgreen: [154, 205, 50]\n}\n","/**\n * @module color-parse\n */\nimport names from 'color-name'\n\nexport default parse\n\n/**\n * Base hues\n * http://dev.w3.org/csswg/css-color/#typedef-named-hue\n */\n//FIXME: use external hue detector\nvar baseHues = {\n\tred: 0,\n\torange: 60,\n\tyellow: 120,\n\tgreen: 180,\n\tblue: 240,\n\tpurple: 300\n}\n\n/**\n * Parse color from the string passed\n *\n * @return {Object} A space indicator `space`, an array `values` and `alpha`\n */\nfunction parse(cstr) {\n\tvar m, parts = [], alpha = 1, space\n\n\t//numeric case\n\tif (typeof cstr === 'number') {\n\t\treturn { space: 'rgb', values: [cstr >>> 16, (cstr & 0x00ff00) >>> 8, cstr & 0x0000ff], alpha: 1 }\n\t}\n\tif (typeof cstr === 'number') return { space: 'rgb', values: [cstr >>> 16, (cstr & 0x00ff00) >>> 8, cstr & 0x0000ff], alpha: 1 }\n\n\tcstr = String(cstr).toLowerCase();\n\n\t//keyword\n\tif (names[cstr]) {\n\t\tparts = names[cstr].slice()\n\t\tspace = 'rgb'\n\t}\n\n\t//reserved words\n\telse if (cstr === 'transparent') {\n\t\talpha = 0\n\t\tspace = 'rgb'\n\t\tparts = [0, 0, 0]\n\t}\n\n\t//hex\n\telse if (cstr[0] === '#') {\n\t\tvar base = cstr.slice(1)\n\t\tvar size = base.length\n\t\tvar isShort = size <= 4\n\t\talpha = 1\n\n\t\tif (isShort) {\n\t\t\tparts = [\n\t\t\t\tparseInt(base[0] + base[0], 16),\n\t\t\t\tparseInt(base[1] + base[1], 16),\n\t\t\t\tparseInt(base[2] + base[2], 16)\n\t\t\t]\n\t\t\tif (size === 4) {\n\t\t\t\talpha = parseInt(base[3] + base[3], 16) / 255\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tparts = [\n\t\t\t\tparseInt(base[0] + base[1], 16),\n\t\t\t\tparseInt(base[2] + base[3], 16),\n\t\t\t\tparseInt(base[4] + base[5], 16)\n\t\t\t]\n\t\t\tif (size === 8) {\n\t\t\t\talpha = parseInt(base[6] + base[7], 16) / 255\n\t\t\t}\n\t\t}\n\n\t\tif (!parts[0]) parts[0] = 0\n\t\tif (!parts[1]) parts[1] = 0\n\t\tif (!parts[2]) parts[2] = 0\n\n\t\tspace = 'rgb'\n\t}\n\n\t// color space\n\telse if (m = /^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\\s*\\(([^\\)]*)\\)/.exec(cstr)) {\n\t\tvar name = m[1]\n\t\tspace = name.replace(/a$/, '')\n\t\tvar dims = space === 'cmyk' ? 4 : space === 'gray' ? 1 : 3\n\t\tparts = m[2].trim().split(/\\s*[,\\/]\\s*|\\s+/)\n\n\t\t// color(srgb-linear x x x) -> srgb-linear(x x x)\n\t\tif (space === 'color') space = parts.shift()\n\n\t\tparts = parts.map(function (x, i) {\n\t\t\t//\n\t\t\tif (x[x.length - 1] === '%') {\n\t\t\t\tx = parseFloat(x) / 100\n\t\t\t\t// alpha -> 0..1\n\t\t\t\tif (i === 3) return x\n\t\t\t\t// rgb -> 0..255\n\t\t\t\tif (space === 'rgb') return x * 255\n\t\t\t\t// hsl, hwb H -> 0..100\n\t\t\t\tif (space[0] === 'h') return x * 100\n\t\t\t\t// lch, lab L -> 0..100\n\t\t\t\tif (space[0] === 'l' && !i) return x * 100\n\t\t\t\t// lab A B -> -125..125\n\t\t\t\tif (space === 'lab') return x * 125\n\t\t\t\t// lch C -> 0..150, H -> 0..360\n\t\t\t\tif (space === 'lch') return i < 2 ? x * 150 : x * 360\n\t\t\t\t// oklch/oklab L -> 0..1\n\t\t\t\tif (space[0] === 'o' && !i) return x\n\t\t\t\t// oklab A B -> -0.4..0.4\n\t\t\t\tif (space === 'oklab') return x * 0.4\n\t\t\t\t// oklch C -> 0..0.4, H -> 0..360\n\t\t\t\tif (space === 'oklch') return i < 2 ? x * 0.4 : x * 360\n\t\t\t\t// color(xxx) -> 0..1\n\t\t\t\treturn x\n\t\t\t}\n\n\t\t\t//hue\n\t\t\tif (space[i] === 'h' || (i === 2 && space[space.length - 1] === 'h')) {\n\t\t\t\t//\n\t\t\t\tif (baseHues[x] !== undefined) return baseHues[x]\n\t\t\t\t//\n\t\t\t\tif (x.endsWith('deg')) return parseFloat(x)\n\t\t\t\t//\n\t\t\t\tif (x.endsWith('turn')) return parseFloat(x) * 360\n\t\t\t\tif (x.endsWith('grad')) return parseFloat(x) * 360 / 400\n\t\t\t\tif (x.endsWith('rad')) return parseFloat(x) * 180 / Math.PI\n\t\t\t}\n\t\t\tif (x === 'none') return 0\n\t\t\treturn parseFloat(x)\n\t\t});\n\n\t\talpha = parts.length > dims ? parts.pop() : 1\n\t}\n\n\t//named channels case\n\telse if (/[0-9](?:\\s|\\/|,)/.test(cstr)) {\n\t\tparts = cstr.match(/([0-9]+)/g).map(function (value) {\n\t\t\treturn parseFloat(value)\n\t\t})\n\n\t\tspace = cstr.match(/([a-z])/ig)?.join('')?.toLowerCase() || 'rgb'\n\t}\n\n\treturn {\n\t\tspace,\n\t\tvalues: parts,\n\t\talpha\n\t}\n}\n","/**\n * @module color-space/hsl\n */\nimport rgb from './rgb.js';\n\nexport default {\n\tname: 'hsl',\n\tmin: [0,0,0],\n\tmax: [360,100,100],\n\tchannel: ['hue', 'saturation', 'lightness'],\n\talias: ['HSL'],\n\n\trgb: function(hsl) {\n\t\tvar h = hsl[0]/360, s = hsl[1]/100, l = hsl[2]/100, t1, t2, t3, rgb, val, i=0;\n\n\t\tif (s === 0) return val = l * 255, [val, val, val];\n\n\t\tt2 = l < 0.5 ? l * (1 + s) : l + s - l * s;\n\t\tt1 = 2 * l - t2;\n\n\t\trgb = [0, 0, 0];\n\t\tfor (;i<3;) {\n\t\t\tt3 = h + 1 / 3 * - (i - 1);\n\t\t\tt3 < 0 ? t3++ : t3 > 1 && t3--;\n\t\t\tval = 6 * t3 < 1 ? t1 + (t2 - t1) * 6 * t3 :\n\t\t\t2 * t3 < 1 ? t2 :\n\t\t\t3 * t3 < 2 ? t1 + (t2 - t1) * (2 / 3 - t3) * 6 :\n\t\t\tt1;\n\t\t\trgb[i++] = val * 255;\n\t\t}\n\n\t\treturn rgb;\n\t}\n};\n\n\n//extend rgb\nrgb.hsl = function(rgb) {\n\tvar r = rgb[0]/255,\n\t\t\tg = rgb[1]/255,\n\t\t\tb = rgb[2]/255,\n\t\t\tmin = Math.min(r, g, b),\n\t\t\tmax = Math.max(r, g, b),\n\t\t\tdelta = max - min,\n\t\t\th, s, l;\n\n\tif (max === min) {\n\t\th = 0;\n\t}\n\telse if (r === max) {\n\t\th = (g - b) / delta;\n\t}\n\telse if (g === max) {\n\t\th = 2 + (b - r) / delta;\n\t}\n\telse if (b === max) {\n\t\th = 4 + (r - g)/ delta;\n\t}\n\n\th = Math.min(h * 60, 360);\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tl = (min + max) / 2;\n\n\tif (max === min) {\n\t\ts = 0;\n\t}\n\telse if (l <= 0.5) {\n\t\ts = delta / (max + min);\n\t}\n\telse {\n\t\ts = delta / (2 - max - min);\n\t}\n\n\treturn [h, s * 100, l * 100];\n};\n","/**\n * @module ol/color\n */\nimport lchuv from 'color-space/lchuv.js';\nimport parseRgba from 'color-rgba';\nimport rgb from 'color-space/rgb.js';\nimport xyz from 'color-space/xyz.js';\nimport {clamp} from './math.js';\n\n/**\n * A color represented as a short array [red, green, blue, alpha].\n * red, green, and blue should be integers in the range 0..255 inclusive.\n * alpha should be a float in the range 0..1 inclusive. If no alpha value is\n * given then `1` will be used.\n * @typedef {Array} Color\n * @api\n */\n\n/**\n * Return the color as an rgba string.\n * @param {Color|string} color Color.\n * @return {string} Rgba string.\n * @api\n */\nexport function asString(color) {\n if (typeof color === 'string') {\n return color;\n }\n return toString(color);\n}\n\n/**\n * @type {number}\n */\nconst MAX_CACHE_SIZE = 1024;\n\n/**\n * We maintain a small cache of parsed strings. Whenever the cache grows too large,\n * we delete an arbitrary set of the entries.\n *\n * @type {Object}\n */\nconst cache = {};\n\n/**\n * @type {number}\n */\nlet cacheSize = 0;\n\n/**\n * @param {Color} color A color that may or may not have an alpha channel.\n * @return {Color} The input color with an alpha channel. If the input color has\n * an alpha channel, the input color will be returned unchanged. Otherwise, a new\n * array will be returned with the input color and an alpha channel of 1.\n */\nexport function withAlpha(color) {\n if (color.length === 4) {\n return color;\n }\n const output = color.slice();\n output[3] = 1;\n return output;\n}\n\n/**\n * @param {Color} color RGBA color.\n * @return {Color} LCHuv color with alpha.\n */\nexport function rgbaToLcha(color) {\n const output = xyz.lchuv(rgb.xyz(color));\n output[3] = color[3];\n return output;\n}\n\n/**\n * @param {Color} color LCHuv color with alpha.\n * @return {Color} RGBA color.\n */\nexport function lchaToRgba(color) {\n const output = xyz.rgb(lchuv.xyz(color));\n output[3] = color[3];\n return output;\n}\n\n/**\n * @param {string} s String.\n * @return {Color} Color.\n */\nexport function fromString(s) {\n if (cache.hasOwnProperty(s)) {\n return cache[s];\n }\n if (cacheSize >= MAX_CACHE_SIZE) {\n let i = 0;\n for (const key in cache) {\n if ((i++ & 3) === 0) {\n delete cache[key];\n --cacheSize;\n }\n }\n }\n\n const color = parseRgba(s);\n if (color.length !== 4) {\n throw new Error('Failed to parse \"' + s + '\" as color');\n }\n for (const c of color) {\n if (isNaN(c)) {\n throw new Error('Failed to parse \"' + s + '\" as color');\n }\n }\n normalize(color);\n cache[s] = color;\n ++cacheSize;\n return color;\n}\n\n/**\n * Return the color as an array. This function maintains a cache of calculated\n * arrays which means the result should not be modified.\n * @param {Color|string} color Color.\n * @return {Color} Color.\n * @api\n */\nexport function asArray(color) {\n if (Array.isArray(color)) {\n return color;\n }\n return fromString(color);\n}\n\n/**\n * Exported for the tests.\n * @param {Color} color Color.\n * @return {Color} Clamped color.\n */\nexport function normalize(color) {\n color[0] = clamp((color[0] + 0.5) | 0, 0, 255);\n color[1] = clamp((color[1] + 0.5) | 0, 0, 255);\n color[2] = clamp((color[2] + 0.5) | 0, 0, 255);\n color[3] = clamp(color[3], 0, 1);\n return color;\n}\n\n/**\n * @param {Color} color Color.\n * @return {string} String.\n */\nexport function toString(color) {\n let r = color[0];\n if (r != (r | 0)) {\n r = (r + 0.5) | 0;\n }\n let g = color[1];\n if (g != (g | 0)) {\n g = (g + 0.5) | 0;\n }\n let b = color[2];\n if (b != (b | 0)) {\n b = (b + 0.5) | 0;\n }\n const a = color[3] === undefined ? 1 : Math.round(color[3] * 1000) / 1000;\n return 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';\n}\n\n/**\n * @param {string} s String.\n * @return {boolean} Whether the string is actually a valid color\n */\nexport function isStringColor(s) {\n try {\n fromString(s);\n return true;\n } catch (_) {\n return false;\n }\n}\n","/** @module color-rgba */\nimport parse from 'color-parse'\nimport rgb from 'color-space/rgb.js'\nimport hsl from 'color-space/hsl.js'\n\nexport default function rgba(color) {\n\t// template literals\n\tif (Array.isArray(color) && color.raw) color = String.raw(...arguments)\n\tif (color instanceof Number) color = +color\n\n\tvar values, i, l\n\n\t//attempt to parse non-array arguments\n\tvar parsed = parse(color)\n\n\tif (!parsed.space) return []\n\n\tconst min = parsed.space[0] === 'h' ? hsl.min : rgb.min\n\tconst max = parsed.space[0] === 'h' ? hsl.max : rgb.max\n\n\tvalues = Array(3)\n\tvalues[0] = Math.min(Math.max(parsed.values[0], min[0]), max[0])\n\tvalues[1] = Math.min(Math.max(parsed.values[1], min[1]), max[1])\n\tvalues[2] = Math.min(Math.max(parsed.values[2], min[2]), max[2])\n\n\tif (parsed.space[0] === 'h') {\n\t\tvalues = hsl.rgb(values)\n\t}\n\n\tvalues.push(Math.min(Math.max(parsed.alpha, 0), 1))\n\n\treturn values\n}\n","/**\n * @module ol/colorlike\n */\nimport ImageState from './ImageState.js';\nimport {createCanvasContext2D} from './dom.js';\nimport {get as getIconImage} from './style/IconImage.js';\nimport {shared as iconCache} from './style/IconImageCache.js';\nimport {toString} from './color.js';\n\n/**\n * @typedef {Object} PatternDescriptor\n * @property {string} src Pattern image URL\n * @property {import(\"./color.js\").Color|string} [color] Color to tint the pattern with.\n * @property {import(\"./size.js\").Size} [size] Size of the desired slice from the pattern image.\n * Use this together with `offset` when the pattern image is a sprite sheet.\n * @property {import(\"./size.js\").Size} [offset] Offset of the desired slice from the pattern image.\n * Use this together with `size` when the pattern image is a sprite sheet.\n */\n\n/**\n * A type accepted by CanvasRenderingContext2D.fillStyle\n * or CanvasRenderingContext2D.strokeStyle.\n * Represents a color, [CanvasPattern](https://developer.mozilla.org/en-US/docs/Web/API/CanvasPattern),\n * or [CanvasGradient](https://developer.mozilla.org/en-US/docs/Web/API/CanvasGradient). The origin for\n * patterns and gradients as fill style is an increment of 512 css pixels from map coordinate\n * `[0, 0]`. For seamless repeat patterns, width and height of the pattern image\n * must be a factor of two (2, 4, 8, ..., 512).\n *\n * @typedef {string|CanvasPattern|CanvasGradient} ColorLike\n * @api\n */\n\n/**\n * @param {import(\"./color.js\").Color|ColorLike|PatternDescriptor|null} color Color.\n * @return {ColorLike|null} The color as an {@link ol/colorlike~ColorLike}.\n * @api\n */\nexport function asColorLike(color) {\n if (!color) {\n return null;\n }\n if (Array.isArray(color)) {\n return toString(color);\n }\n if (typeof color === 'object' && 'src' in color) {\n return asCanvasPattern(color);\n }\n return color;\n}\n\n/**\n * @param {PatternDescriptor} pattern Pattern descriptor.\n * @return {CanvasPattern|null} Canvas pattern or null if the pattern referenced in the\n * PatternDescriptor was not found in the icon image cache.\n */\nfunction asCanvasPattern(pattern) {\n if (!pattern.offset || !pattern.size) {\n return iconCache.getPattern(pattern.src, 'anonymous', pattern.color);\n }\n\n const cacheKey = pattern.src + ':' + pattern.offset;\n\n const canvasPattern = iconCache.getPattern(\n cacheKey,\n undefined,\n pattern.color,\n );\n if (canvasPattern) {\n return canvasPattern;\n }\n\n const iconImage = iconCache.get(pattern.src, 'anonymous', null);\n if (iconImage.getImageState() !== ImageState.LOADED) {\n return null;\n }\n const patternCanvasContext = createCanvasContext2D(\n pattern.size[0],\n pattern.size[1],\n );\n patternCanvasContext.drawImage(\n iconImage.getImage(1),\n pattern.offset[0],\n pattern.offset[1],\n pattern.size[0],\n pattern.size[1],\n 0,\n 0,\n pattern.size[0],\n pattern.size[1],\n );\n getIconImage(\n patternCanvasContext.canvas,\n cacheKey,\n undefined,\n ImageState.LOADED,\n pattern.color,\n true,\n );\n return iconCache.getPattern(cacheKey, undefined, pattern.color);\n}\n","/**\n * @module ol/console\n */\n\n/**\n * @typedef {'info'|'warn'|'error'|'none'} Level\n */\n\n/**\n * @type {Object}\n */\nconst levels = {\n info: 1,\n warn: 2,\n error: 3,\n none: 4,\n};\n\n/**\n * @type {number}\n */\nlet level = levels.info;\n\n/**\n * Set the logging level. By default, the level is set to 'info' and all\n * messages will be logged. Set to 'warn' to only display warnings and errors.\n * Set to 'error' to only display errors. Set to 'none' to silence all messages.\n *\n * @param {Level} l The new level.\n */\nexport function setLevel(l) {\n level = levels[l];\n}\n\n/**\n * @param {...any} args Arguments to log\n */\nexport function log(...args) {\n if (level > levels.info) {\n return;\n }\n console.log(...args); // eslint-disable-line no-console\n}\n\n/**\n * @param {...any} args Arguments to log\n */\nexport function warn(...args) {\n if (level > levels.warn) {\n return;\n }\n console.warn(...args); // eslint-disable-line no-console\n}\n\n/**\n * @param {...any} args Arguments to log\n */\nexport function error(...args) {\n if (level > levels.error) {\n return;\n }\n console.error(...args); // eslint-disable-line no-console\n}\n","/**\n * @module ol/control/Control\n */\nimport BaseObject from '../Object.js';\nimport MapEventType from '../MapEventType.js';\nimport {VOID} from '../functions.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {removeNode} from '../dom.js';\n\n/**\n * @typedef {Object} Options\n * @property {HTMLElement} [element] The element is the control's\n * container element. This only needs to be specified if you're developing\n * a custom control.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when\n * the control should be re-rendered. This is called in a `requestAnimationFrame`\n * callback.\n * @property {HTMLElement|string} [target] Specify a target if you want\n * the control to be rendered outside of the map's viewport.\n */\n\n/**\n * @classdesc\n * A control is a visible widget with a DOM element in a fixed position on the\n * screen. They can involve user input (buttons), or be informational only;\n * the position is determined using CSS. By default these are placed in the\n * container with CSS class name `ol-overlaycontainer-stopevent`, but can use\n * any outside DOM element.\n *\n * This is the base class for controls. You can use it for simple custom\n * controls by creating the element with listeners, creating an instance:\n * ```js\n * const myControl = new Control({element: myElement});\n * ```\n * and then adding this to the map.\n *\n * The main advantage of having this as a control rather than a simple separate\n * DOM element is that preventing propagation is handled for you. Controls\n * will also be objects in a {@link module:ol/Collection~Collection}, so you can use their methods.\n *\n * You can also extend this base for your own control class. See\n * examples/custom-controls for an example of how to do this.\n *\n * @api\n */\nclass Control extends BaseObject {\n /**\n * @param {Options} options Control options.\n */\n constructor(options) {\n super();\n\n const element = options.element;\n if (element && !options.target && !element.style.pointerEvents) {\n element.style.pointerEvents = 'auto';\n }\n\n /**\n * @protected\n * @type {HTMLElement}\n */\n this.element = element ? element : null;\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.target_ = null;\n\n /**\n * @private\n * @type {import(\"../Map.js\").default|null}\n */\n this.map_ = null;\n\n /**\n * @protected\n * @type {!Array}\n */\n this.listenerKeys = [];\n\n if (options.render) {\n this.render = options.render;\n }\n\n if (options.target) {\n this.setTarget(options.target);\n }\n }\n\n /**\n * Clean up.\n */\n disposeInternal() {\n removeNode(this.element);\n super.disposeInternal();\n }\n\n /**\n * Get the map associated with this control.\n * @return {import(\"../Map.js\").default|null} Map.\n * @api\n */\n getMap() {\n return this.map_;\n }\n\n /**\n * Remove the control from its current map and attach it to the new map.\n * Pass `null` to just remove the control from the current map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default|null} map Map.\n * @api\n */\n setMap(map) {\n if (this.map_) {\n removeNode(this.element);\n }\n for (let i = 0, ii = this.listenerKeys.length; i < ii; ++i) {\n unlistenByKey(this.listenerKeys[i]);\n }\n this.listenerKeys.length = 0;\n this.map_ = map;\n if (map) {\n const target = this.target_\n ? this.target_\n : map.getOverlayContainerStopEvent();\n target.appendChild(this.element);\n if (this.render !== VOID) {\n this.listenerKeys.push(\n listen(map, MapEventType.POSTRENDER, this.render, this),\n );\n }\n map.render();\n }\n }\n\n /**\n * Renders the control.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @api\n */\n render(mapEvent) {}\n\n /**\n * This function is used to set a target element for the control. It has no\n * effect if it is called after the control has been added to the map (i.e.\n * after `setMap` is called on the control). If no `target` is set in the\n * options passed to the control constructor and if `setTarget` is not called\n * then the control is added to the map's overlay container.\n * @param {HTMLElement|string} target Target.\n * @api\n */\n setTarget(target) {\n this.target_ =\n typeof target === 'string' ? document.getElementById(target) : target;\n }\n}\n\nexport default Control;\n","/**\n * @module ol/control/FullScreen\n */\nimport Control from './Control.js';\nimport EventType from '../events/EventType.js';\nimport MapProperty from '../MapProperty.js';\nimport {CLASS_CONTROL, CLASS_UNSELECTABLE, CLASS_UNSUPPORTED} from '../css.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {replaceNode} from '../dom.js';\n\nconst events = [\n 'fullscreenchange',\n 'webkitfullscreenchange',\n 'MSFullscreenChange',\n];\n\n/**\n * @enum {string}\n */\nconst FullScreenEventType = {\n /**\n * Triggered after the map entered fullscreen.\n * @event FullScreenEventType#enterfullscreen\n * @api\n */\n ENTERFULLSCREEN: 'enterfullscreen',\n\n /**\n * Triggered after the map leave fullscreen.\n * @event FullScreenEventType#leavefullscreen\n * @api\n */\n LEAVEFULLSCREEN: 'leavefullscreen',\n};\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature &\n * import(\"../Observable\").OnSignature &\n * import(\"../Observable\").CombinedOnSignature} FullScreenOnSignature\n */\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-full-screen'] CSS class name.\n * @property {string|Text|HTMLElement} [label='\\u2922'] Text label to use for the button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string|Text|HTMLElement} [labelActive='\\u00d7'] Text label to use for the\n * button when full-screen is active.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [activeClassName=className + '-true'] CSS class name for the button\n * when full-screen is active.\n * @property {string} [inactiveClassName=className + '-false'] CSS class name for the button\n * when full-screen is inactive.\n * @property {string} [tipLabel='Toggle full-screen'] Text label to use for the button tip.\n * @property {boolean} [keys=false] Full keyboard access.\n * @property {HTMLElement|string} [target] Specify a target if you want the\n * control to be rendered outside of the map's viewport.\n * @property {HTMLElement|string} [source] The element to be displayed\n * fullscreen. When not provided, the element containing the map viewport will\n * be displayed fullscreen.\n */\n\n/**\n * @classdesc\n * Provides a button that when clicked fills up the full screen with the map.\n * The full screen source element is by default the element containing the map viewport unless\n * overridden by providing the `source` option. In which case, the dom\n * element introduced using this parameter will be displayed in full screen.\n *\n * When in full screen mode, a close button is shown to exit full screen mode.\n * The [Fullscreen API](https://www.w3.org/TR/fullscreen/) is used to\n * toggle the map in full screen mode.\n *\n * @fires FullScreenEventType#enterfullscreen\n * @fires FullScreenEventType#leavefullscreen\n * @api\n */\nclass FullScreen extends Control {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n element: document.createElement('div'),\n target: options.target,\n });\n\n /***\n * @type {FullScreenOnSignature}\n */\n this.on;\n\n /***\n * @type {FullScreenOnSignature}\n */\n this.once;\n\n /***\n * @type {FullScreenOnSignature}\n */\n this.un;\n\n /**\n * @private\n * @type {boolean}\n */\n this.keys_ = options.keys !== undefined ? options.keys : false;\n\n /**\n * @private\n * @type {HTMLElement|string|undefined}\n */\n this.source_ = options.source;\n\n /**\n * @type {boolean}\n * @private\n */\n this.isInFullscreen_ = false;\n\n /**\n * @private\n */\n this.boundHandleMapTargetChange_ = this.handleMapTargetChange_.bind(this);\n\n /**\n * @private\n * @type {string}\n */\n this.cssClassName_ =\n options.className !== undefined ? options.className : 'ol-full-screen';\n\n /**\n * @private\n * @type {Array}\n */\n this.documentListeners_ = [];\n\n /**\n * @private\n * @type {Array}\n */\n this.activeClassName_ =\n options.activeClassName !== undefined\n ? options.activeClassName.split(' ')\n : [this.cssClassName_ + '-true'];\n\n /**\n * @private\n * @type {Array}\n */\n this.inactiveClassName_ =\n options.inactiveClassName !== undefined\n ? options.inactiveClassName.split(' ')\n : [this.cssClassName_ + '-false'];\n\n const label = options.label !== undefined ? options.label : '\\u2922';\n\n /**\n * @private\n * @type {Text|HTMLElement}\n */\n this.labelNode_ =\n typeof label === 'string' ? document.createTextNode(label) : label;\n\n const labelActive =\n options.labelActive !== undefined ? options.labelActive : '\\u00d7';\n\n /**\n * @private\n * @type {Text|HTMLElement}\n */\n this.labelActiveNode_ =\n typeof labelActive === 'string'\n ? document.createTextNode(labelActive)\n : labelActive;\n\n const tipLabel = options.tipLabel ? options.tipLabel : 'Toggle full-screen';\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.button_ = document.createElement('button');\n this.button_.title = tipLabel;\n this.button_.setAttribute('type', 'button');\n this.button_.appendChild(this.labelNode_);\n this.button_.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this),\n false,\n );\n this.setClassName_(this.button_, this.isInFullscreen_);\n\n this.element.className = `${this.cssClassName_} ${CLASS_UNSELECTABLE} ${CLASS_CONTROL}`;\n this.element.appendChild(this.button_);\n }\n\n /**\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(event) {\n event.preventDefault();\n this.handleFullScreen_();\n }\n\n /**\n * @private\n */\n handleFullScreen_() {\n const map = this.getMap();\n if (!map) {\n return;\n }\n const doc = map.getOwnerDocument();\n if (!isFullScreenSupported(doc)) {\n return;\n }\n if (isFullScreen(doc)) {\n exitFullScreen(doc);\n } else {\n let element;\n if (this.source_) {\n element =\n typeof this.source_ === 'string'\n ? doc.getElementById(this.source_)\n : this.source_;\n } else {\n element = map.getTargetElement();\n }\n if (this.keys_) {\n requestFullScreenWithKeys(element);\n } else {\n requestFullScreen(element);\n }\n }\n }\n\n /**\n * @private\n */\n handleFullScreenChange_() {\n const map = this.getMap();\n if (!map) {\n return;\n }\n const wasInFullscreen = this.isInFullscreen_;\n this.isInFullscreen_ = isFullScreen(map.getOwnerDocument());\n if (wasInFullscreen !== this.isInFullscreen_) {\n this.setClassName_(this.button_, this.isInFullscreen_);\n if (this.isInFullscreen_) {\n replaceNode(this.labelActiveNode_, this.labelNode_);\n this.dispatchEvent(FullScreenEventType.ENTERFULLSCREEN);\n } else {\n replaceNode(this.labelNode_, this.labelActiveNode_);\n this.dispatchEvent(FullScreenEventType.LEAVEFULLSCREEN);\n }\n map.updateSize();\n }\n }\n\n /**\n * @param {HTMLElement} element Target element\n * @param {boolean} fullscreen True if fullscreen class name should be active\n * @private\n */\n setClassName_(element, fullscreen) {\n if (fullscreen) {\n element.classList.remove(...this.inactiveClassName_);\n element.classList.add(...this.activeClassName_);\n } else {\n element.classList.remove(...this.activeClassName_);\n element.classList.add(...this.inactiveClassName_);\n }\n }\n\n /**\n * Remove the control from its current map and attach it to the new map.\n * Pass `null` to just remove the control from the current map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default|null} map Map.\n * @api\n */\n setMap(map) {\n const oldMap = this.getMap();\n if (oldMap) {\n oldMap.removeChangeListener(\n MapProperty.TARGET,\n this.boundHandleMapTargetChange_,\n );\n }\n\n super.setMap(map);\n\n this.handleMapTargetChange_();\n if (map) {\n map.addChangeListener(\n MapProperty.TARGET,\n this.boundHandleMapTargetChange_,\n );\n }\n }\n\n /**\n * @private\n */\n handleMapTargetChange_() {\n const listeners = this.documentListeners_;\n for (let i = 0, ii = listeners.length; i < ii; ++i) {\n unlistenByKey(listeners[i]);\n }\n listeners.length = 0;\n\n const map = this.getMap();\n if (map) {\n const doc = map.getOwnerDocument();\n if (isFullScreenSupported(doc)) {\n this.element.classList.remove(CLASS_UNSUPPORTED);\n } else {\n this.element.classList.add(CLASS_UNSUPPORTED);\n }\n\n for (let i = 0, ii = events.length; i < ii; ++i) {\n listeners.push(\n listen(doc, events[i], this.handleFullScreenChange_, this),\n );\n }\n this.handleFullScreenChange_();\n }\n }\n}\n\n/**\n * @param {Document} doc The root document to check.\n * @return {boolean} Fullscreen is supported by the current platform.\n */\nfunction isFullScreenSupported(doc) {\n const body = doc.body;\n return !!(\n body['webkitRequestFullscreen'] ||\n (body.requestFullscreen && doc.fullscreenEnabled)\n );\n}\n\n/**\n * @param {Document} doc The root document to check.\n * @return {boolean} Element is currently in fullscreen.\n */\nfunction isFullScreen(doc) {\n return !!(doc['webkitIsFullScreen'] || doc.fullscreenElement);\n}\n\n/**\n * Request to fullscreen an element.\n * @param {HTMLElement} element Element to request fullscreen\n */\nfunction requestFullScreen(element) {\n if (element.requestFullscreen) {\n element.requestFullscreen();\n } else if (element['webkitRequestFullscreen']) {\n element['webkitRequestFullscreen']();\n }\n}\n\n/**\n * Request to fullscreen an element with keyboard input.\n * @param {HTMLElement} element Element to request fullscreen\n */\nfunction requestFullScreenWithKeys(element) {\n if (element['webkitRequestFullscreen']) {\n element['webkitRequestFullscreen']();\n } else {\n requestFullScreen(element);\n }\n}\n\n/**\n * Exit fullscreen.\n * @param {Document} doc The document to exit fullscren from\n */\nfunction exitFullScreen(doc) {\n if (doc.exitFullscreen) {\n doc.exitFullscreen();\n } else if (doc['webkitExitFullscreen']) {\n doc['webkitExitFullscreen']();\n }\n}\n\nexport default FullScreen;\n","/**\n * @module ol/control/MousePosition\n */\n\nimport Control from './Control.js';\nimport EventType from '../pointer/EventType.js';\nimport {\n get as getProjection,\n getTransformFromProjections,\n getUserProjection,\n identityTransform,\n} from '../proj.js';\nimport {listen} from '../events.js';\nimport {wrapX} from '../coordinate.js';\n\n/**\n * @type {string}\n */\nconst PROJECTION = 'projection';\n\n/**\n * @type {string}\n */\nconst COORDINATE_FORMAT = 'coordinateFormat';\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature &\n * import(\"../Observable\").OnSignature &\n * import(\"../Observable\").CombinedOnSignature} MousePositionOnSignature\n */\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-mouse-position'] CSS class name.\n * @property {import(\"../coordinate.js\").CoordinateFormat} [coordinateFormat] Coordinate format.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection. Default is the view projection.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when the\n * control should be re-rendered. This is called in a `requestAnimationFrame`\n * callback.\n * @property {HTMLElement|string} [target] Specify a target if you want the\n * control to be rendered outside of the map's viewport.\n * @property {string} [placeholder] Markup to show when the mouse position is not\n * available (e.g. when the pointer leaves the map viewport). By default, a non-breaking space is rendered\n * initially and the last position is retained when the mouse leaves the viewport.\n * When a string is provided (e.g. `'no position'` or `''` for an empty string) it is used as a\n * placeholder.\n * @property {boolean} [wrapX=true] Wrap the world horizontally on the projection's antimeridian, if it\n * is a global projection.\n */\n\n/**\n * @classdesc\n * A control to show the 2D coordinates of the mouse cursor. By default, these\n * are in the view projection, but can be in any supported projection.\n * By default the control is shown in the top right corner of the map, but this\n * can be changed by using the css selector `.ol-mouse-position`.\n *\n * On touch devices, which usually do not have a mouse cursor, the coordinates\n * of the currently touched position are shown.\n *\n * @api\n */\nclass MousePosition extends Control {\n /**\n * @param {Options} [options] Mouse position options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const element = document.createElement('div');\n element.className =\n options.className !== undefined ? options.className : 'ol-mouse-position';\n\n super({\n element: element,\n render: options.render,\n target: options.target,\n });\n\n /***\n * @type {MousePositionOnSignature}\n */\n this.on;\n\n /***\n * @type {MousePositionOnSignature}\n */\n this.once;\n\n /***\n * @type {MousePositionOnSignature}\n */\n this.un;\n\n this.addChangeListener(PROJECTION, this.handleProjectionChanged_);\n\n if (options.coordinateFormat) {\n this.setCoordinateFormat(options.coordinateFormat);\n }\n if (options.projection) {\n this.setProjection(options.projection);\n }\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderOnMouseOut_ = options.placeholder !== undefined;\n\n /**\n * @private\n * @type {string}\n */\n this.placeholder_ = this.renderOnMouseOut_ ? options.placeholder : ' ';\n\n /**\n * @private\n * @type {string}\n */\n this.renderedHTML_ = element.innerHTML;\n\n /**\n * @private\n * @type {?import(\"../proj/Projection.js\").default}\n */\n this.mapProjection_ = null;\n\n /**\n * @private\n * @type {?import(\"../proj.js\").TransformFunction}\n */\n this.transform_ = null;\n\n /**\n * @private\n * @type {boolean}\n */\n this.wrapX_ = options.wrapX === false ? false : true;\n }\n\n /**\n * @private\n */\n handleProjectionChanged_() {\n this.transform_ = null;\n }\n\n /**\n * Return the coordinate format type used to render the current position or\n * undefined.\n * @return {import(\"../coordinate.js\").CoordinateFormat|undefined} The format to render the current\n * position in.\n * @observable\n * @api\n */\n getCoordinateFormat() {\n return /** @type {import(\"../coordinate.js\").CoordinateFormat|undefined} */ (\n this.get(COORDINATE_FORMAT)\n );\n }\n\n /**\n * Return the projection that is used to report the mouse position.\n * @return {import(\"../proj/Projection.js\").default|undefined} The projection to report mouse\n * position in.\n * @observable\n * @api\n */\n getProjection() {\n return /** @type {import(\"../proj/Projection.js\").default|undefined} */ (\n this.get(PROJECTION)\n );\n }\n\n /**\n * @param {MouseEvent} event Browser event.\n * @protected\n */\n handleMouseMove(event) {\n const map = this.getMap();\n this.updateHTML_(map.getEventPixel(event));\n }\n\n /**\n * @param {Event} event Browser event.\n * @protected\n */\n handleMouseOut(event) {\n this.updateHTML_(null);\n }\n\n /**\n * Remove the control from its current map and attach it to the new map.\n * Pass `null` to just remove the control from the current map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default|null} map Map.\n * @api\n */\n setMap(map) {\n super.setMap(map);\n if (map) {\n const viewport = map.getViewport();\n this.listenerKeys.push(\n listen(viewport, EventType.POINTERMOVE, this.handleMouseMove, this),\n );\n if (this.renderOnMouseOut_) {\n this.listenerKeys.push(\n listen(viewport, EventType.POINTEROUT, this.handleMouseOut, this),\n );\n }\n this.updateHTML_(null);\n }\n }\n\n /**\n * Set the coordinate format type used to render the current position.\n * @param {import(\"../coordinate.js\").CoordinateFormat} format The format to render the current\n * position in.\n * @observable\n * @api\n */\n setCoordinateFormat(format) {\n this.set(COORDINATE_FORMAT, format);\n }\n\n /**\n * Set the projection that is used to report the mouse position.\n * @param {import(\"../proj.js\").ProjectionLike} projection The projection to report mouse\n * position in.\n * @observable\n * @api\n */\n setProjection(projection) {\n this.set(PROJECTION, getProjection(projection));\n }\n\n /**\n * @param {?import(\"../pixel.js\").Pixel} pixel Pixel.\n * @private\n */\n updateHTML_(pixel) {\n let html = this.placeholder_;\n if (pixel && this.mapProjection_) {\n if (!this.transform_) {\n const projection = this.getProjection();\n if (projection) {\n this.transform_ = getTransformFromProjections(\n this.mapProjection_,\n projection,\n );\n } else {\n this.transform_ = identityTransform;\n }\n }\n const map = this.getMap();\n const coordinate = map.getCoordinateFromPixelInternal(pixel);\n if (coordinate) {\n const userProjection = getUserProjection();\n if (userProjection) {\n this.transform_ = getTransformFromProjections(\n this.mapProjection_,\n userProjection,\n );\n }\n this.transform_(coordinate, coordinate);\n if (this.wrapX_) {\n const projection =\n userProjection || this.getProjection() || this.mapProjection_;\n wrapX(coordinate, projection);\n }\n const coordinateFormat = this.getCoordinateFormat();\n if (coordinateFormat) {\n html = coordinateFormat(coordinate);\n } else {\n html = coordinate.toString();\n }\n }\n }\n if (!this.renderedHTML_ || html !== this.renderedHTML_) {\n this.element.innerHTML = html;\n this.renderedHTML_ = html;\n }\n }\n\n /**\n * Update the projection. Rendering of the coordinates is done in\n * `handleMouseMove` and `handleMouseUp`.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n const frameState = mapEvent.frameState;\n if (!frameState) {\n this.mapProjection_ = null;\n } else {\n if (this.mapProjection_ != frameState.viewState.projection) {\n this.mapProjection_ = frameState.viewState.projection;\n this.transform_ = null;\n }\n }\n }\n}\n\nexport default MousePosition;\n","/**\n * @module ol/control/ScaleLine\n */\nimport Control from './Control.js';\nimport {CLASS_UNSELECTABLE} from '../css.js';\nimport {METERS_PER_UNIT, getPointResolution} from '../proj.js';\n\n/**\n * @type {string}\n */\nconst UNITS_PROP = 'units';\n\n/**\n * @typedef {'degrees' | 'imperial' | 'nautical' | 'metric' | 'us'} Units\n * Units for the scale line.\n */\n\n/**\n * @const\n * @type {Array}\n */\nconst LEADING_DIGITS = [1, 2, 5];\n\n/**\n * @const\n * @type {number}\n */\nconst DEFAULT_DPI = 25.4 / 0.28;\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature &\n * import(\"../Observable\").OnSignature &\n * import(\"../Observable\").CombinedOnSignature} ScaleLineOnSignature\n */\n\n/**\n * @typedef {Object} Options\n * @property {string} [className] CSS class name. The default is `ol-scale-bar` when configured with\n * `bar: true`. Otherwise the default is `ol-scale-line`.\n * @property {number} [minWidth=64] Minimum width in pixels at the OGC default dpi. The width will be\n * adjusted to match the dpi used.\n * @property {number} [maxWidth] Maximum width in pixels at the OGC default dpi. The width will be\n * adjusted to match the dpi used.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when the control\n * should be re-rendered. This is called in a `requestAnimationFrame` callback.\n * @property {HTMLElement|string} [target] Specify a target if you want the control\n * to be rendered outside of the map's viewport.\n * @property {Units} [units='metric'] Units.\n * @property {boolean} [bar=false] Render scalebars instead of a line.\n * @property {number} [steps=4] Number of steps the scalebar should use. Use even numbers\n * for best results. Only applies when `bar` is `true`.\n * @property {boolean} [text=false] Render the text scale above of the scalebar. Only applies\n * when `bar` is `true`.\n * @property {number|undefined} [dpi=undefined] dpi of output device such as printer. Only applies\n * when `bar` is `true`. If undefined the OGC default screen pixel size of 0.28mm will be assumed.\n */\n\n/**\n * @classdesc\n * A control displaying rough y-axis distances, calculated for the center of the\n * viewport. For conformal projections (e.g. EPSG:3857, the default view\n * projection in OpenLayers), the scale is valid for all directions.\n * No scale line will be shown when the y-axis distance of a pixel at the\n * viewport center cannot be calculated in the view projection.\n * By default the scale line will show in the bottom left portion of the map,\n * but this can be changed by using the css selector `.ol-scale-line`.\n * When specifying `bar` as `true`, a scalebar will be rendered instead\n * of a scaleline.\n * For cartesian measurements of the scaleline, you need to set the\n * `getPointResolution` method of your projection to simply return the input\n * value, e.g. `projection.setGetPointResolution(r => r);`\n *\n * @api\n */\nclass ScaleLine extends Control {\n /**\n * @param {Options} [options] Scale line options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const element = document.createElement('div');\n element.style.pointerEvents = 'none';\n\n super({\n element: element,\n render: options.render,\n target: options.target,\n });\n\n /***\n * @type {ScaleLineOnSignature}\n */\n this.on;\n\n /***\n * @type {ScaleLineOnSignature}\n */\n this.once;\n\n /***\n * @type {ScaleLineOnSignature}\n */\n this.un;\n\n const className =\n options.className !== undefined\n ? options.className\n : options.bar\n ? 'ol-scale-bar'\n : 'ol-scale-line';\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.innerElement_ = document.createElement('div');\n this.innerElement_.className = className + '-inner';\n\n this.element.className = className + ' ' + CLASS_UNSELECTABLE;\n this.element.appendChild(this.innerElement_);\n\n /**\n * @private\n * @type {?import(\"../View.js\").State}\n */\n this.viewState_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.minWidth_ = options.minWidth !== undefined ? options.minWidth : 64;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.maxWidth_ = options.maxWidth;\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderedVisible_ = false;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.renderedWidth_ = undefined;\n\n /**\n * @private\n * @type {string}\n */\n this.renderedHTML_ = '';\n\n this.addChangeListener(UNITS_PROP, this.handleUnitsChanged_);\n\n this.setUnits(options.units || 'metric');\n\n /**\n * @private\n * @type {boolean}\n */\n this.scaleBar_ = options.bar || false;\n\n /**\n * @private\n * @type {number}\n */\n this.scaleBarSteps_ = options.steps || 4;\n\n /**\n * @private\n * @type {boolean}\n */\n this.scaleBarText_ = options.text || false;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.dpi_ = options.dpi || undefined;\n }\n\n /**\n * Return the units to use in the scale line.\n * @return {Units} The units\n * to use in the scale line.\n * @observable\n * @api\n */\n getUnits() {\n return this.get(UNITS_PROP);\n }\n\n /**\n * @private\n */\n handleUnitsChanged_() {\n this.updateElement_();\n }\n\n /**\n * Set the units to use in the scale line.\n * @param {Units} units The units to use in the scale line.\n * @observable\n * @api\n */\n setUnits(units) {\n this.set(UNITS_PROP, units);\n }\n\n /**\n * Specify the dpi of output device such as printer.\n * @param {number|undefined} dpi The dpi of output device.\n * @api\n */\n setDpi(dpi) {\n this.dpi_ = dpi;\n }\n\n /**\n * @private\n */\n updateElement_() {\n const viewState = this.viewState_;\n\n if (!viewState) {\n if (this.renderedVisible_) {\n this.element.style.display = 'none';\n this.renderedVisible_ = false;\n }\n return;\n }\n\n const center = viewState.center;\n const projection = viewState.projection;\n const units = this.getUnits();\n const pointResolutionUnits = units == 'degrees' ? 'degrees' : 'm';\n let pointResolution = getPointResolution(\n projection,\n viewState.resolution,\n center,\n pointResolutionUnits,\n );\n\n const minWidth =\n (this.minWidth_ * (this.dpi_ || DEFAULT_DPI)) / DEFAULT_DPI;\n\n const maxWidth =\n this.maxWidth_ !== undefined\n ? (this.maxWidth_ * (this.dpi_ || DEFAULT_DPI)) / DEFAULT_DPI\n : undefined;\n\n let nominalCount = minWidth * pointResolution;\n let suffix = '';\n if (units == 'degrees') {\n const metersPerDegree = METERS_PER_UNIT.degrees;\n nominalCount *= metersPerDegree;\n if (nominalCount < metersPerDegree / 60) {\n suffix = '\\u2033'; // seconds\n pointResolution *= 3600;\n } else if (nominalCount < metersPerDegree) {\n suffix = '\\u2032'; // minutes\n pointResolution *= 60;\n } else {\n suffix = '\\u00b0'; // degrees\n }\n } else if (units == 'imperial') {\n if (nominalCount < 0.9144) {\n suffix = 'in';\n pointResolution /= 0.0254;\n } else if (nominalCount < 1609.344) {\n suffix = 'ft';\n pointResolution /= 0.3048;\n } else {\n suffix = 'mi';\n pointResolution /= 1609.344;\n }\n } else if (units == 'nautical') {\n pointResolution /= 1852;\n suffix = 'NM';\n } else if (units == 'metric') {\n if (nominalCount < 1e-6) {\n suffix = 'nm';\n pointResolution *= 1e9;\n } else if (nominalCount < 0.001) {\n suffix = 'μm';\n pointResolution *= 1000000;\n } else if (nominalCount < 1) {\n suffix = 'mm';\n pointResolution *= 1000;\n } else if (nominalCount < 1000) {\n suffix = 'm';\n } else {\n suffix = 'km';\n pointResolution /= 1000;\n }\n } else if (units == 'us') {\n if (nominalCount < 0.9144) {\n suffix = 'in';\n pointResolution *= 39.37;\n } else if (nominalCount < 1609.344) {\n suffix = 'ft';\n pointResolution /= 0.30480061;\n } else {\n suffix = 'mi';\n pointResolution /= 1609.3472;\n }\n } else {\n throw new Error('Invalid units');\n }\n\n let i = 3 * Math.floor(Math.log(minWidth * pointResolution) / Math.log(10));\n let count, width, decimalCount;\n let previousCount, previousWidth, previousDecimalCount;\n while (true) {\n decimalCount = Math.floor(i / 3);\n const decimal = Math.pow(10, decimalCount);\n count = LEADING_DIGITS[((i % 3) + 3) % 3] * decimal;\n width = Math.round(count / pointResolution);\n if (isNaN(width)) {\n this.element.style.display = 'none';\n this.renderedVisible_ = false;\n return;\n }\n if (maxWidth !== undefined && width >= maxWidth) {\n count = previousCount;\n width = previousWidth;\n decimalCount = previousDecimalCount;\n break;\n } else if (width >= minWidth) {\n break;\n }\n previousCount = count;\n previousWidth = width;\n previousDecimalCount = decimalCount;\n ++i;\n }\n const html = this.scaleBar_\n ? this.createScaleBar(width, count, suffix)\n : count.toFixed(decimalCount < 0 ? -decimalCount : 0) + ' ' + suffix;\n\n if (this.renderedHTML_ != html) {\n this.innerElement_.innerHTML = html;\n this.renderedHTML_ = html;\n }\n\n if (this.renderedWidth_ != width) {\n this.innerElement_.style.width = width + 'px';\n this.renderedWidth_ = width;\n }\n\n if (!this.renderedVisible_) {\n this.element.style.display = '';\n this.renderedVisible_ = true;\n }\n }\n\n /**\n * @private\n * @param {number} width The current width of the scalebar.\n * @param {number} scale The current scale.\n * @param {string} suffix The suffix to append to the scale text.\n * @return {string} The stringified HTML of the scalebar.\n */\n createScaleBar(width, scale, suffix) {\n const resolutionScale = this.getScaleForResolution();\n const mapScale =\n resolutionScale < 1\n ? Math.round(1 / resolutionScale).toLocaleString() + ' : 1'\n : '1 : ' + Math.round(resolutionScale).toLocaleString();\n const steps = this.scaleBarSteps_;\n const stepWidth = width / steps;\n const scaleSteps = [this.createMarker('absolute')];\n for (let i = 0; i < steps; ++i) {\n const cls =\n i % 2 === 0 ? 'ol-scale-singlebar-odd' : 'ol-scale-singlebar-even';\n scaleSteps.push(\n '
' +\n '
' +\n '
' +\n this.createMarker('relative') +\n // render text every second step, except when only 2 steps\n (i % 2 === 0 || steps === 2\n ? this.createStepText(i, width, false, scale, suffix)\n : '') +\n '
',\n );\n }\n // render text at the end\n scaleSteps.push(this.createStepText(steps, width, true, scale, suffix));\n\n const scaleBarText = this.scaleBarText_\n ? `
` +\n mapScale +\n '
'\n : '';\n return scaleBarText + scaleSteps.join('');\n }\n\n /**\n * Creates a marker at given position\n * @param {'absolute'|'relative'} position The position, absolute or relative\n * @return {string} The stringified div containing the marker\n */\n createMarker(position) {\n const top = position === 'absolute' ? 3 : -10;\n return (\n '
'\n );\n }\n\n /**\n * Creates the label for a marker marker at given position\n * @param {number} i The iterator\n * @param {number} width The width the scalebar will currently use\n * @param {boolean} isLast Flag indicating if we add the last step text\n * @param {number} scale The current scale for the whole scalebar\n * @param {string} suffix The suffix for the scale\n * @return {string} The stringified div containing the step text\n */\n createStepText(i, width, isLast, scale, suffix) {\n const length =\n i === 0 ? 0 : Math.round((scale / this.scaleBarSteps_) * i * 100) / 100;\n const lengthString = length + (i === 0 ? '' : ' ' + suffix);\n const margin = i === 0 ? -3 : (width / this.scaleBarSteps_) * -1;\n const minWidth = i === 0 ? 0 : (width / this.scaleBarSteps_) * 2;\n return (\n '
' +\n lengthString +\n '
'\n );\n }\n\n /**\n * Returns the appropriate scale for the given resolution and units.\n * @return {number} The appropriate scale.\n */\n getScaleForResolution() {\n const resolution = getPointResolution(\n this.viewState_.projection,\n this.viewState_.resolution,\n this.viewState_.center,\n 'm',\n );\n const dpi = this.dpi_ || DEFAULT_DPI;\n const inchesPerMeter = 1000 / 25.4;\n return resolution * inchesPerMeter * dpi;\n }\n\n /**\n * Update the scale line element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n const frameState = mapEvent.frameState;\n if (!frameState) {\n this.viewState_ = null;\n } else {\n this.viewState_ = frameState.viewState;\n }\n this.updateElement_();\n }\n}\n\nexport default ScaleLine;\n","/**\n * @module ol/control/ZoomSlider\n */\n\nimport Control from './Control.js';\nimport EventType from '../events/EventType.js';\nimport PointerEventType from '../pointer/EventType.js';\nimport {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';\nimport {clamp} from '../math.js';\nimport {easeOut} from '../easing.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {stopPropagation} from '../events/Event.js';\n\n/**\n * The enum for available directions.\n *\n * @enum {number}\n */\nconst Direction = {\n VERTICAL: 0,\n HORIZONTAL: 1,\n};\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-zoomslider'] CSS class name.\n * @property {number} [duration=200] Animation duration in milliseconds.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when the control\n * should be re-rendered. This is called in a `requestAnimationFrame` callback.\n * @property {HTMLElement|string} [target] Specify a target if you want the control to be\n * rendered outside of the map's viewport.\n */\n\n/**\n * @classdesc\n * A slider type of control for zooming.\n *\n * Example:\n *\n * map.addControl(new ZoomSlider());\n *\n * @api\n */\nclass ZoomSlider extends Control {\n /**\n * @param {Options} [options] Zoom slider options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n target: options.target,\n element: document.createElement('div'),\n render: options.render,\n });\n\n /**\n * @type {!Array}\n * @private\n */\n this.dragListenerKeys_ = [];\n\n /**\n * Will hold the current resolution of the view.\n *\n * @type {number|undefined}\n * @private\n */\n this.currentResolution_ = undefined;\n\n /**\n * The direction of the slider. Will be determined from actual display of the\n * container and defaults to Direction.VERTICAL.\n *\n * @type {Direction}\n * @private\n */\n this.direction_ = Direction.VERTICAL;\n\n /**\n * @type {boolean}\n * @private\n */\n this.dragging_;\n\n /**\n * @type {number}\n * @private\n */\n this.heightLimit_ = 0;\n\n /**\n * @type {number}\n * @private\n */\n this.widthLimit_ = 0;\n\n /**\n * @type {number|undefined}\n * @private\n */\n this.startX_;\n\n /**\n * @type {number|undefined}\n * @private\n */\n this.startY_;\n\n /**\n * The calculated thumb size (border box plus margins). Set when initSlider_\n * is called.\n * @type {import(\"../size.js\").Size}\n * @private\n */\n this.thumbSize_ = null;\n\n /**\n * Whether the slider is initialized.\n * @type {boolean}\n * @private\n */\n this.sliderInitialized_ = false;\n\n /**\n * @type {number}\n * @private\n */\n this.duration_ = options.duration !== undefined ? options.duration : 200;\n\n const className =\n options.className !== undefined ? options.className : 'ol-zoomslider';\n const thumbElement = document.createElement('button');\n thumbElement.setAttribute('type', 'button');\n thumbElement.className = className + '-thumb ' + CLASS_UNSELECTABLE;\n const containerElement = this.element;\n containerElement.className =\n className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;\n containerElement.appendChild(thumbElement);\n\n containerElement.addEventListener(\n PointerEventType.POINTERDOWN,\n this.handleDraggerStart_.bind(this),\n false,\n );\n containerElement.addEventListener(\n PointerEventType.POINTERMOVE,\n this.handleDraggerDrag_.bind(this),\n false,\n );\n containerElement.addEventListener(\n PointerEventType.POINTERUP,\n this.handleDraggerEnd_.bind(this),\n false,\n );\n\n containerElement.addEventListener(\n EventType.CLICK,\n this.handleContainerClick_.bind(this),\n false,\n );\n thumbElement.addEventListener(EventType.CLICK, stopPropagation, false);\n }\n\n /**\n * Remove the control from its current map and attach it to the new map.\n * Pass `null` to just remove the control from the current map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default|null} map Map.\n * @api\n */\n setMap(map) {\n super.setMap(map);\n if (map) {\n map.render();\n }\n }\n\n /**\n * Initializes the slider element. This will determine and set this controls\n * direction_ and also constrain the dragging of the thumb to always be within\n * the bounds of the container.\n *\n * @return {boolean} Initialization successful\n * @private\n */\n initSlider_() {\n const container = this.element;\n let containerWidth = container.offsetWidth;\n let containerHeight = container.offsetHeight;\n if (containerWidth === 0 && containerHeight === 0) {\n return (this.sliderInitialized_ = false);\n }\n\n const containerStyle = getComputedStyle(container);\n containerWidth -=\n parseFloat(containerStyle['paddingRight']) +\n parseFloat(containerStyle['paddingLeft']);\n containerHeight -=\n parseFloat(containerStyle['paddingTop']) +\n parseFloat(containerStyle['paddingBottom']);\n const thumb = /** @type {HTMLElement} */ (container.firstElementChild);\n const thumbStyle = getComputedStyle(thumb);\n const thumbWidth =\n thumb.offsetWidth +\n parseFloat(thumbStyle['marginRight']) +\n parseFloat(thumbStyle['marginLeft']);\n const thumbHeight =\n thumb.offsetHeight +\n parseFloat(thumbStyle['marginTop']) +\n parseFloat(thumbStyle['marginBottom']);\n this.thumbSize_ = [thumbWidth, thumbHeight];\n\n if (containerWidth > containerHeight) {\n this.direction_ = Direction.HORIZONTAL;\n this.widthLimit_ = containerWidth - thumbWidth;\n } else {\n this.direction_ = Direction.VERTICAL;\n this.heightLimit_ = containerHeight - thumbHeight;\n }\n return (this.sliderInitialized_ = true);\n }\n\n /**\n * @param {PointerEvent} event The browser event to handle.\n * @private\n */\n handleContainerClick_(event) {\n const view = this.getMap().getView();\n\n const relativePosition = this.getRelativePosition_(\n event.offsetX - this.thumbSize_[0] / 2,\n event.offsetY - this.thumbSize_[1] / 2,\n );\n\n const resolution = this.getResolutionForPosition_(relativePosition);\n const zoom = view.getConstrainedZoom(view.getZoomForResolution(resolution));\n\n view.animateInternal({\n zoom: zoom,\n duration: this.duration_,\n easing: easeOut,\n });\n }\n\n /**\n * Handle dragger start events.\n * @param {PointerEvent} event The drag event.\n * @private\n */\n handleDraggerStart_(event) {\n if (!this.dragging_ && event.target === this.element.firstElementChild) {\n const element = /** @type {HTMLElement} */ (\n this.element.firstElementChild\n );\n this.getMap().getView().beginInteraction();\n this.startX_ = event.clientX - parseFloat(element.style.left);\n this.startY_ = event.clientY - parseFloat(element.style.top);\n this.dragging_ = true;\n\n if (this.dragListenerKeys_.length === 0) {\n const drag = this.handleDraggerDrag_;\n const end = this.handleDraggerEnd_;\n const doc = this.getMap().getOwnerDocument();\n this.dragListenerKeys_.push(\n listen(doc, PointerEventType.POINTERMOVE, drag, this),\n listen(doc, PointerEventType.POINTERUP, end, this),\n );\n }\n }\n }\n\n /**\n * Handle dragger drag events.\n *\n * @param {PointerEvent} event The drag event.\n * @private\n */\n handleDraggerDrag_(event) {\n if (this.dragging_) {\n const deltaX = event.clientX - this.startX_;\n const deltaY = event.clientY - this.startY_;\n const relativePosition = this.getRelativePosition_(deltaX, deltaY);\n this.currentResolution_ =\n this.getResolutionForPosition_(relativePosition);\n this.getMap().getView().setResolution(this.currentResolution_);\n }\n }\n\n /**\n * Handle dragger end events.\n * @param {PointerEvent} event The drag event.\n * @private\n */\n handleDraggerEnd_(event) {\n if (this.dragging_) {\n const view = this.getMap().getView();\n view.endInteraction();\n\n this.dragging_ = false;\n this.startX_ = undefined;\n this.startY_ = undefined;\n this.dragListenerKeys_.forEach(unlistenByKey);\n this.dragListenerKeys_.length = 0;\n }\n }\n\n /**\n * Positions the thumb inside its container according to the given resolution.\n *\n * @param {number} res The res.\n * @private\n */\n setThumbPosition_(res) {\n const position = this.getPositionForResolution_(res);\n const thumb = /** @type {HTMLElement} */ (this.element.firstElementChild);\n\n if (this.direction_ == Direction.HORIZONTAL) {\n thumb.style.left = this.widthLimit_ * position + 'px';\n } else {\n thumb.style.top = this.heightLimit_ * position + 'px';\n }\n }\n\n /**\n * Calculates the relative position of the thumb given x and y offsets. The\n * relative position scales from 0 to 1. The x and y offsets are assumed to be\n * in pixel units within the dragger limits.\n *\n * @param {number} x Pixel position relative to the left of the slider.\n * @param {number} y Pixel position relative to the top of the slider.\n * @return {number} The relative position of the thumb.\n * @private\n */\n getRelativePosition_(x, y) {\n let amount;\n if (this.direction_ === Direction.HORIZONTAL) {\n amount = x / this.widthLimit_;\n } else {\n amount = y / this.heightLimit_;\n }\n return clamp(amount, 0, 1);\n }\n\n /**\n * Calculates the corresponding resolution of the thumb given its relative\n * position (where 0 is the minimum and 1 is the maximum).\n *\n * @param {number} position The relative position of the thumb.\n * @return {number} The corresponding resolution.\n * @private\n */\n getResolutionForPosition_(position) {\n const fn = this.getMap().getView().getResolutionForValueFunction();\n return fn(1 - position);\n }\n\n /**\n * Determines the relative position of the slider for the given resolution. A\n * relative position of 0 corresponds to the minimum view resolution. A\n * relative position of 1 corresponds to the maximum view resolution.\n *\n * @param {number} res The resolution.\n * @return {number} The relative position value (between 0 and 1).\n * @private\n */\n getPositionForResolution_(res) {\n const fn = this.getMap().getView().getValueForResolutionFunction();\n return clamp(1 - fn(res), 0, 1);\n }\n\n /**\n * Update the zoomslider element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n if (!mapEvent.frameState) {\n return;\n }\n if (!this.sliderInitialized_ && !this.initSlider_()) {\n return;\n }\n const res = mapEvent.frameState.viewState.resolution;\n this.currentResolution_ = res;\n this.setThumbPosition_(res);\n }\n}\n\nexport default ZoomSlider;\n","/**\n * @module ol/coordinate\n */\nimport {getWidth} from './extent.js';\nimport {modulo, toFixed} from './math.js';\nimport {padNumber} from './string.js';\n\n/**\n * An array of numbers representing an `xy`, `xyz` or `xyzm` coordinate.\n * Example: `[16, 48]`.\n * @typedef {Array} Coordinate\n * @api\n */\n\n/**\n * A function that takes a {@link module:ol/coordinate~Coordinate} and\n * transforms it into a `{string}`.\n *\n * @typedef {function((Coordinate|undefined)): string} CoordinateFormat\n * @api\n */\n\n/**\n * Add `delta` to `coordinate`. `coordinate` is modified in place and returned\n * by the function.\n *\n * Example:\n *\n * import {add} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * add(coord, [-2, 4]);\n * // coord is now [5.85, 51.983333]\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {Coordinate} delta Delta.\n * @return {Coordinate} The input coordinate adjusted by\n * the given delta.\n * @api\n */\nexport function add(coordinate, delta) {\n coordinate[0] += +delta[0];\n coordinate[1] += +delta[1];\n return coordinate;\n}\n\n/**\n * Calculates the point closest to the passed coordinate on the passed circle.\n *\n * @param {Coordinate} coordinate The coordinate.\n * @param {import(\"./geom/Circle.js\").default} circle The circle.\n * @return {Coordinate} Closest point on the circumference.\n */\nexport function closestOnCircle(coordinate, circle) {\n const r = circle.getRadius();\n const center = circle.getCenter();\n const x0 = center[0];\n const y0 = center[1];\n const x1 = coordinate[0];\n const y1 = coordinate[1];\n\n let dx = x1 - x0;\n const dy = y1 - y0;\n if (dx === 0 && dy === 0) {\n dx = 1;\n }\n const d = Math.sqrt(dx * dx + dy * dy);\n\n const x = x0 + (r * dx) / d;\n const y = y0 + (r * dy) / d;\n\n return [x, y];\n}\n\n/**\n * Calculates the point closest to the passed coordinate on the passed segment.\n * This is the foot of the perpendicular of the coordinate to the segment when\n * the foot is on the segment, or the closest segment coordinate when the foot\n * is outside the segment.\n *\n * @param {Coordinate} coordinate The coordinate.\n * @param {Array} segment The two coordinates\n * of the segment.\n * @return {Coordinate} The foot of the perpendicular of\n * the coordinate to the segment.\n */\nexport function closestOnSegment(coordinate, segment) {\n const x0 = coordinate[0];\n const y0 = coordinate[1];\n const start = segment[0];\n const end = segment[1];\n const x1 = start[0];\n const y1 = start[1];\n const x2 = end[0];\n const y2 = end[1];\n const dx = x2 - x1;\n const dy = y2 - y1;\n const along =\n dx === 0 && dy === 0\n ? 0\n : (dx * (x0 - x1) + dy * (y0 - y1)) / (dx * dx + dy * dy || 0);\n let x, y;\n if (along <= 0) {\n x = x1;\n y = y1;\n } else if (along >= 1) {\n x = x2;\n y = y2;\n } else {\n x = x1 + along * dx;\n y = y1 + along * dy;\n }\n return [x, y];\n}\n\n/**\n * Returns a {@link module:ol/coordinate~CoordinateFormat} function that can be\n * used to format\n * a {Coordinate} to a string.\n *\n * Example without specifying the fractional digits:\n *\n * import {createStringXY} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const stringifyFunc = createStringXY();\n * const out = stringifyFunc(coord);\n * // out is now '8, 48'\n *\n * Example with explicitly specifying 2 fractional digits:\n *\n * import {createStringXY} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const stringifyFunc = createStringXY(2);\n * const out = stringifyFunc(coord);\n * // out is now '7.85, 47.98'\n *\n * @param {number} [fractionDigits] The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {CoordinateFormat} Coordinate format.\n * @api\n */\nexport function createStringXY(fractionDigits) {\n return (\n /**\n * @param {Coordinate} coordinate Coordinate.\n * @return {string} String XY.\n */\n function (coordinate) {\n return toStringXY(coordinate, fractionDigits);\n }\n );\n}\n\n/**\n * @param {string} hemispheres Hemispheres.\n * @param {number} degrees Degrees.\n * @param {number} [fractionDigits] The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} String.\n */\nexport function degreesToStringHDMS(hemispheres, degrees, fractionDigits) {\n const normalizedDegrees = modulo(degrees + 180, 360) - 180;\n const x = Math.abs(3600 * normalizedDegrees);\n const decimals = fractionDigits || 0;\n\n let deg = Math.floor(x / 3600);\n let min = Math.floor((x - deg * 3600) / 60);\n let sec = toFixed(x - deg * 3600 - min * 60, decimals);\n\n if (sec >= 60) {\n sec = 0;\n min += 1;\n }\n\n if (min >= 60) {\n min = 0;\n deg += 1;\n }\n\n let hdms = deg + '\\u00b0';\n if (min !== 0 || sec !== 0) {\n hdms += ' ' + padNumber(min, 2) + '\\u2032';\n }\n if (sec !== 0) {\n hdms += ' ' + padNumber(sec, 2, decimals) + '\\u2033';\n }\n if (normalizedDegrees !== 0) {\n hdms += ' ' + hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0);\n }\n\n return hdms;\n}\n\n/**\n * Transforms the given {@link module:ol/coordinate~Coordinate} to a string\n * using the given string template. The strings `{x}` and `{y}` in the template\n * will be replaced with the first and second coordinate values respectively.\n *\n * Example without specifying the fractional digits:\n *\n * import {format} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const template = 'Coordinate is ({x}|{y}).';\n * const out = format(coord, template);\n * // out is now 'Coordinate is (8|48).'\n *\n * Example explicitly specifying the fractional digits:\n *\n * import {format} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const template = 'Coordinate is ({x}|{y}).';\n * const out = format(coord, template, 2);\n * // out is now 'Coordinate is (7.85|47.98).'\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {string} template A template string with `{x}` and `{y}` placeholders\n * that will be replaced by first and second coordinate values.\n * @param {number} [fractionDigits] The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} Formatted coordinate.\n * @api\n */\nexport function format(coordinate, template, fractionDigits) {\n if (coordinate) {\n return template\n .replace('{x}', coordinate[0].toFixed(fractionDigits))\n .replace('{y}', coordinate[1].toFixed(fractionDigits));\n }\n return '';\n}\n\n/**\n * @param {Coordinate} coordinate1 First coordinate.\n * @param {Coordinate} coordinate2 Second coordinate.\n * @return {boolean} The two coordinates are equal.\n */\nexport function equals(coordinate1, coordinate2) {\n let equals = true;\n for (let i = coordinate1.length - 1; i >= 0; --i) {\n if (coordinate1[i] != coordinate2[i]) {\n equals = false;\n break;\n }\n }\n return equals;\n}\n\n/**\n * Rotate `coordinate` by `angle`. `coordinate` is modified in place and\n * returned by the function.\n *\n * Example:\n *\n * import {rotate} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const rotateRadians = Math.PI / 2; // 90 degrees\n * rotate(coord, rotateRadians);\n * // coord is now [-47.983333, 7.85]\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number} angle Angle in radian.\n * @return {Coordinate} Coordinate.\n * @api\n */\nexport function rotate(coordinate, angle) {\n const cosAngle = Math.cos(angle);\n const sinAngle = Math.sin(angle);\n const x = coordinate[0] * cosAngle - coordinate[1] * sinAngle;\n const y = coordinate[1] * cosAngle + coordinate[0] * sinAngle;\n coordinate[0] = x;\n coordinate[1] = y;\n return coordinate;\n}\n\n/**\n * Scale `coordinate` by `scale`. `coordinate` is modified in place and returned\n * by the function.\n *\n * Example:\n *\n * import {scale as scaleCoordinate} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const scale = 1.2;\n * scaleCoordinate(coord, scale);\n * // coord is now [9.42, 57.5799996]\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number} scale Scale factor.\n * @return {Coordinate} Coordinate.\n */\nexport function scale(coordinate, scale) {\n coordinate[0] *= scale;\n coordinate[1] *= scale;\n return coordinate;\n}\n\n/**\n * @param {Coordinate} coord1 First coordinate.\n * @param {Coordinate} coord2 Second coordinate.\n * @return {number} Squared distance between coord1 and coord2.\n */\nexport function squaredDistance(coord1, coord2) {\n const dx = coord1[0] - coord2[0];\n const dy = coord1[1] - coord2[1];\n return dx * dx + dy * dy;\n}\n\n/**\n * @param {Coordinate} coord1 First coordinate.\n * @param {Coordinate} coord2 Second coordinate.\n * @return {number} Distance between coord1 and coord2.\n */\nexport function distance(coord1, coord2) {\n return Math.sqrt(squaredDistance(coord1, coord2));\n}\n\n/**\n * Calculate the squared distance from a coordinate to a line segment.\n *\n * @param {Coordinate} coordinate Coordinate of the point.\n * @param {Array} segment Line segment (2\n * coordinates).\n * @return {number} Squared distance from the point to the line segment.\n */\nexport function squaredDistanceToSegment(coordinate, segment) {\n return squaredDistance(coordinate, closestOnSegment(coordinate, segment));\n}\n\n/**\n * Format a geographic coordinate with the hemisphere, degrees, minutes, and\n * seconds.\n *\n * Example without specifying fractional digits:\n *\n * import {toStringHDMS} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const out = toStringHDMS(coord);\n * // out is now '47° 58′ 60″ N 7° 50′ 60″ E'\n *\n * Example explicitly specifying 1 fractional digit:\n *\n * import {toStringHDMS} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const out = toStringHDMS(coord, 1);\n * // out is now '47° 58′ 60.0″ N 7° 50′ 60.0″ E'\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number} [fractionDigits] The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} Hemisphere, degrees, minutes and seconds.\n * @api\n */\nexport function toStringHDMS(coordinate, fractionDigits) {\n if (coordinate) {\n return (\n degreesToStringHDMS('NS', coordinate[1], fractionDigits) +\n ' ' +\n degreesToStringHDMS('EW', coordinate[0], fractionDigits)\n );\n }\n return '';\n}\n\n/**\n * Format a coordinate as a comma delimited string.\n *\n * Example without specifying fractional digits:\n *\n * import {toStringXY} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const out = toStringXY(coord);\n * // out is now '8, 48'\n *\n * Example explicitly specifying 1 fractional digit:\n *\n * import {toStringXY} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const out = toStringXY(coord, 1);\n * // out is now '7.8, 48.0'\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number} [fractionDigits] The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} XY.\n * @api\n */\nexport function toStringXY(coordinate, fractionDigits) {\n return format(coordinate, '{x}, {y}', fractionDigits);\n}\n\n/**\n * Modifies the provided coordinate in-place to be within the real world\n * extent. The lower projection extent boundary is inclusive, the upper one\n * exclusive.\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @return {Coordinate} The coordinate within the real world extent.\n */\nexport function wrapX(coordinate, projection) {\n if (projection.canWrapX()) {\n const worldWidth = getWidth(projection.getExtent());\n const worldsAway = getWorldsAway(coordinate, projection, worldWidth);\n if (worldsAway) {\n coordinate[0] -= worldsAway * worldWidth;\n }\n }\n return coordinate;\n}\n/**\n * @param {Coordinate} coordinate Coordinate.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @param {number} [sourceExtentWidth] Width of the source extent.\n * @return {number} Offset in world widths.\n */\nexport function getWorldsAway(coordinate, projection, sourceExtentWidth) {\n const projectionExtent = projection.getExtent();\n let worldsAway = 0;\n if (\n projection.canWrapX() &&\n (coordinate[0] < projectionExtent[0] || coordinate[0] > projectionExtent[2])\n ) {\n sourceExtentWidth = sourceExtentWidth || getWidth(projectionExtent);\n worldsAway = Math.floor(\n (coordinate[0] - projectionExtent[0]) / sourceExtentWidth,\n );\n }\n return worldsAway;\n}\n","/**\n * @module ol/css\n */\n\n/**\n * @typedef {Object} FontParameters\n * @property {string} style Style.\n * @property {string} variant Variant.\n * @property {string} weight Weight.\n * @property {string} size Size.\n * @property {string} lineHeight LineHeight.\n * @property {string} family Family.\n * @property {Array} families Families.\n */\n\n/**\n * The CSS class for hidden feature.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_HIDDEN = 'ol-hidden';\n\n/**\n * The CSS class that we'll give the DOM elements to have them selectable.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_SELECTABLE = 'ol-selectable';\n\n/**\n * The CSS class that we'll give the DOM elements to have them unselectable.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_UNSELECTABLE = 'ol-unselectable';\n\n/**\n * The CSS class for unsupported feature.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_UNSUPPORTED = 'ol-unsupported';\n\n/**\n * The CSS class for controls.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_CONTROL = 'ol-control';\n\n/**\n * The CSS class that we'll give the DOM elements that are collapsed, i.e.\n * to those elements which usually can be expanded.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_COLLAPSED = 'ol-collapsed';\n\n/**\n * From https://stackoverflow.com/questions/10135697/regex-to-parse-any-css-font\n * @type {RegExp}\n */\nconst fontRegEx = new RegExp(\n [\n '^\\\\s*(?=(?:(?:[-a-z]+\\\\s*){0,2}(italic|oblique))?)',\n '(?=(?:(?:[-a-z]+\\\\s*){0,2}(small-caps))?)',\n '(?=(?:(?:[-a-z]+\\\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)',\n '(?:(?:normal|\\\\1|\\\\2|\\\\3)\\\\s*){0,3}((?:xx?-)?',\n '(?:small|large)|medium|smaller|larger|[\\\\.\\\\d]+(?:\\\\%|in|[cem]m|ex|p[ctx]))',\n '(?:\\\\s*\\\\/\\\\s*(normal|[\\\\.\\\\d]+(?:\\\\%|in|[cem]m|ex|p[ctx])?))',\n '?\\\\s*([-,\\\\\"\\\\\\'\\\\sa-z]+?)\\\\s*$',\n ].join(''),\n 'i',\n);\n/** @type {Array<'style'|'variant'|'weight'|'size'|'lineHeight'|'family'>} */\nconst fontRegExMatchIndex = [\n 'style',\n 'variant',\n 'weight',\n 'size',\n 'lineHeight',\n 'family',\n];\n\n/**\n * Get the list of font families from a font spec. Note that this doesn't work\n * for font families that have commas in them.\n * @param {string} fontSpec The CSS font property.\n * @return {FontParameters|null} The font parameters (or null if the input spec is invalid).\n */\nexport const getFontParameters = function (fontSpec) {\n const match = fontSpec.match(fontRegEx);\n if (!match) {\n return null;\n }\n const style = /** @type {FontParameters} */ ({\n lineHeight: 'normal',\n size: '1.2em',\n style: 'normal',\n weight: 'normal',\n variant: 'normal',\n });\n for (let i = 0, ii = fontRegExMatchIndex.length; i < ii; ++i) {\n const value = match[i + 1];\n if (value !== undefined) {\n style[fontRegExMatchIndex[i]] = value;\n }\n }\n style.families = style.family.split(/,\\s?/);\n return style;\n};\n","import {WORKER_OFFSCREEN_CANVAS} from './has.js';\n\n/**\n * @module ol/dom\n */\n\n//FIXME Move this function to the canvas module\n/**\n * Create an html canvas element and returns its 2d context.\n * @param {number} [width] Canvas width.\n * @param {number} [height] Canvas height.\n * @param {Array} [canvasPool] Canvas pool to take existing canvas from.\n * @param {CanvasRenderingContext2DSettings} [settings] CanvasRenderingContext2DSettings\n * @return {CanvasRenderingContext2D} The context.\n */\nexport function createCanvasContext2D(width, height, canvasPool, settings) {\n /** @type {HTMLCanvasElement|OffscreenCanvas} */\n let canvas;\n if (canvasPool && canvasPool.length) {\n canvas = /** @type {HTMLCanvasElement} */ (canvasPool.shift());\n } else if (WORKER_OFFSCREEN_CANVAS) {\n canvas = new OffscreenCanvas(width || 300, height || 300);\n } else {\n canvas = document.createElement('canvas');\n }\n if (width) {\n canvas.width = width;\n }\n if (height) {\n canvas.height = height;\n }\n //FIXME Allow OffscreenCanvasRenderingContext2D as return type\n return /** @type {CanvasRenderingContext2D} */ (\n canvas.getContext('2d', settings)\n );\n}\n\n/** @type {CanvasRenderingContext2D} */\nlet sharedCanvasContext;\n\n/**\n * @return {CanvasRenderingContext2D} Shared canvas context.\n */\nexport function getSharedCanvasContext2D() {\n if (!sharedCanvasContext) {\n sharedCanvasContext = createCanvasContext2D(1, 1);\n }\n return sharedCanvasContext;\n}\n\n/**\n * Releases canvas memory to avoid exceeding memory limits in Safari.\n * See https://pqina.nl/blog/total-canvas-memory-use-exceeds-the-maximum-limit/\n * @param {CanvasRenderingContext2D} context Context.\n */\nexport function releaseCanvas(context) {\n const canvas = context.canvas;\n canvas.width = 1;\n canvas.height = 1;\n context.clearRect(0, 0, 1, 1);\n}\n\n/**\n * Get the current computed width for the given element including margin,\n * padding and border.\n * Equivalent to jQuery's `$(el).outerWidth(true)`.\n * @param {!HTMLElement} element Element.\n * @return {number} The width.\n */\nexport function outerWidth(element) {\n let width = element.offsetWidth;\n const style = getComputedStyle(element);\n width += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);\n\n return width;\n}\n\n/**\n * Get the current computed height for the given element including margin,\n * padding and border.\n * Equivalent to jQuery's `$(el).outerHeight(true)`.\n * @param {!HTMLElement} element Element.\n * @return {number} The height.\n */\nexport function outerHeight(element) {\n let height = element.offsetHeight;\n const style = getComputedStyle(element);\n height += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10);\n\n return height;\n}\n\n/**\n * @param {Node} newNode Node to replace old node\n * @param {Node} oldNode The node to be replaced\n */\nexport function replaceNode(newNode, oldNode) {\n const parent = oldNode.parentNode;\n if (parent) {\n parent.replaceChild(newNode, oldNode);\n }\n}\n\n/**\n * @param {Node} node The node to remove.\n * @return {Node|null} The node that was removed or null.\n */\nexport function removeNode(node) {\n return node && node.parentNode ? node.parentNode.removeChild(node) : null;\n}\n\n/**\n * @param {Node} node The node to remove the children from.\n */\nexport function removeChildren(node) {\n while (node.lastChild) {\n node.removeChild(node.lastChild);\n }\n}\n\n/**\n * Transform the children of a parent node so they match the\n * provided list of children. This function aims to efficiently\n * remove, add, and reorder child nodes while maintaining a simple\n * implementation (it is not guaranteed to minimize DOM operations).\n * @param {Node} node The parent node whose children need reworking.\n * @param {Array} children The desired children.\n */\nexport function replaceChildren(node, children) {\n const oldChildren = node.childNodes;\n\n for (let i = 0; true; ++i) {\n const oldChild = oldChildren[i];\n const newChild = children[i];\n\n // check if our work is done\n if (!oldChild && !newChild) {\n break;\n }\n\n // check if children match\n if (oldChild === newChild) {\n continue;\n }\n\n // check if a new child needs to be added\n if (!oldChild) {\n node.appendChild(newChild);\n continue;\n }\n\n // check if an old child needs to be removed\n if (!newChild) {\n node.removeChild(oldChild);\n --i;\n continue;\n }\n\n // reorder\n node.insertBefore(newChild, oldChild);\n }\n}\n","/**\n * @module ol/easing\n */\n\n/**\n * Start slow and speed up.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function easeIn(t) {\n return Math.pow(t, 3);\n}\n\n/**\n * Start fast and slow down.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function easeOut(t) {\n return 1 - easeIn(1 - t);\n}\n\n/**\n * Start slow, speed up, and then slow down again.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function inAndOut(t) {\n return 3 * t * t - 2 * t * t * t;\n}\n\n/**\n * Maintain a constant speed over time.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function linear(t) {\n return t;\n}\n\n/**\n * Start slow, speed up, and at the very end slow down again. This has the\n * same general behavior as {@link module:ol/easing.inAndOut}, but the final\n * slowdown is delayed.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function upAndDown(t) {\n if (t < 0.5) {\n return inAndOut(2 * t);\n }\n return 1 - inAndOut(2 * (t - 0.5));\n}\n","/**\n * @module ol/events\n */\nimport {clear} from './obj.js';\n\n/**\n * Key to use with {@link module:ol/Observable.unByKey}.\n * @typedef {Object} EventsKey\n * @property {ListenerFunction} listener Listener.\n * @property {import(\"./events/Target.js\").EventTargetLike} target Target.\n * @property {string} type Type.\n * @api\n */\n\n/**\n * Listener function. This function is called with an event object as argument.\n * When the function returns `false`, event propagation will stop.\n *\n * @typedef {function((Event|import(\"./events/Event.js\").default)): (void|boolean)} ListenerFunction\n * @api\n */\n\n/**\n * @typedef {Object} ListenerObject\n * @property {ListenerFunction} handleEvent HandleEvent listener function.\n */\n\n/**\n * @typedef {ListenerFunction|ListenerObject} Listener\n */\n\n/**\n * Registers an event listener on an event target. Inspired by\n * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html\n *\n * This function efficiently binds a `listener` to a `this` object, and returns\n * a key for use with {@link module:ol/events.unlistenByKey}.\n *\n * @param {import(\"./events/Target.js\").EventTargetLike} target Event target.\n * @param {string} type Event type.\n * @param {ListenerFunction} listener Listener.\n * @param {Object} [thisArg] Object referenced by the `this` keyword in the\n * listener. Default is the `target`.\n * @param {boolean} [once] If true, add the listener as one-off listener.\n * @return {EventsKey} Unique key for the listener.\n */\nexport function listen(target, type, listener, thisArg, once) {\n if (thisArg && thisArg !== target) {\n listener = listener.bind(thisArg);\n }\n if (once) {\n const originalListener = listener;\n listener = function () {\n target.removeEventListener(type, listener);\n originalListener.apply(this, arguments);\n };\n }\n const eventsKey = {\n target: target,\n type: type,\n listener: listener,\n };\n target.addEventListener(type, listener);\n return eventsKey;\n}\n\n/**\n * Registers a one-off event listener on an event target. Inspired by\n * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html\n *\n * This function efficiently binds a `listener` as self-unregistering listener\n * to a `this` object, and returns a key for use with\n * {@link module:ol/events.unlistenByKey} in case the listener needs to be\n * unregistered before it is called.\n *\n * When {@link module:ol/events.listen} is called with the same arguments after this\n * function, the self-unregistering listener will be turned into a permanent\n * listener.\n *\n * @param {import(\"./events/Target.js\").EventTargetLike} target Event target.\n * @param {string} type Event type.\n * @param {ListenerFunction} listener Listener.\n * @param {Object} [thisArg] Object referenced by the `this` keyword in the\n * listener. Default is the `target`.\n * @return {EventsKey} Key for unlistenByKey.\n */\nexport function listenOnce(target, type, listener, thisArg) {\n return listen(target, type, listener, thisArg, true);\n}\n\n/**\n * Unregisters event listeners on an event target. Inspired by\n * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html\n *\n * The argument passed to this function is the key returned from\n * {@link module:ol/events.listen} or {@link module:ol/events.listenOnce}.\n *\n * @param {EventsKey} key The key.\n */\nexport function unlistenByKey(key) {\n if (key && key.target) {\n key.target.removeEventListener(key.type, key.listener);\n clear(key);\n }\n}\n","/**\n * @module ol/events/Event\n */\n\n/**\n * @classdesc\n * Stripped down implementation of the W3C DOM Level 2 Event interface.\n * See https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-interface.\n *\n * This implementation only provides `type` and `target` properties, and\n * `stopPropagation` and `preventDefault` methods. It is meant as base class\n * for higher level events defined in the library, and works with\n * {@link module:ol/events/Target~Target}.\n */\nclass BaseEvent {\n /**\n * @param {string} type Type.\n */\n constructor(type) {\n /**\n * @type {boolean}\n */\n this.propagationStopped;\n\n /**\n * @type {boolean}\n */\n this.defaultPrevented;\n\n /**\n * The event type.\n * @type {string}\n * @api\n */\n this.type = type;\n\n /**\n * The event target.\n * @type {Object}\n * @api\n */\n this.target = null;\n }\n\n /**\n * Prevent default. This means that no emulated `click`, `singleclick` or `doubleclick` events\n * will be fired.\n * @api\n */\n preventDefault() {\n this.defaultPrevented = true;\n }\n\n /**\n * Stop event propagation.\n * @api\n */\n stopPropagation() {\n this.propagationStopped = true;\n }\n}\n\n/**\n * @param {Event|import(\"./Event.js\").default} evt Event\n */\nexport function stopPropagation(evt) {\n evt.stopPropagation();\n}\n\n/**\n * @param {Event|import(\"./Event.js\").default} evt Event\n */\nexport function preventDefault(evt) {\n evt.preventDefault();\n}\n\nexport default BaseEvent;\n","/**\n * @module ol/events/EventType\n */\n\n/**\n * @enum {string}\n * @const\n */\nexport default {\n /**\n * Generic change event. Triggered when the revision counter is increased.\n * @event module:ol/events/Event~BaseEvent#change\n * @api\n */\n CHANGE: 'change',\n\n /**\n * Generic error event. Triggered when an error occurs.\n * @event module:ol/events/Event~BaseEvent#error\n * @api\n */\n ERROR: 'error',\n\n BLUR: 'blur',\n CLEAR: 'clear',\n CONTEXTMENU: 'contextmenu',\n CLICK: 'click',\n DBLCLICK: 'dblclick',\n DRAGENTER: 'dragenter',\n DRAGOVER: 'dragover',\n DROP: 'drop',\n FOCUS: 'focus',\n KEYDOWN: 'keydown',\n KEYPRESS: 'keypress',\n LOAD: 'load',\n RESIZE: 'resize',\n TOUCHMOVE: 'touchmove',\n WHEEL: 'wheel',\n};\n","/**\n * @module ol/events/Target\n */\nimport Disposable from '../Disposable.js';\nimport Event from './Event.js';\nimport {VOID} from '../functions.js';\nimport {clear} from '../obj.js';\n\n/**\n * @typedef {EventTarget|Target} EventTargetLike\n */\n\n/**\n * @classdesc\n * A simplified implementation of the W3C DOM Level 2 EventTarget interface.\n * See https://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-EventTarget.\n *\n * There are two important simplifications compared to the specification:\n *\n * 1. The handling of `useCapture` in `addEventListener` and\n * `removeEventListener`. There is no real capture model.\n * 2. The handling of `stopPropagation` and `preventDefault` on `dispatchEvent`.\n * There is no event target hierarchy. When a listener calls\n * `stopPropagation` or `preventDefault` on an event object, it means that no\n * more listeners after this one will be called. Same as when the listener\n * returns false.\n */\nclass Target extends Disposable {\n /**\n * @param {*} [target] Default event target for dispatched events.\n */\n constructor(target) {\n super();\n\n /**\n * @private\n * @type {*}\n */\n this.eventTarget_ = target;\n\n /**\n * @private\n * @type {Object|null}\n */\n this.pendingRemovals_ = null;\n\n /**\n * @private\n * @type {Object|null}\n */\n this.dispatching_ = null;\n\n /**\n * @private\n * @type {Object>|null}\n */\n this.listeners_ = null;\n }\n\n /**\n * @param {string} type Type.\n * @param {import(\"../events.js\").Listener} listener Listener.\n */\n addEventListener(type, listener) {\n if (!type || !listener) {\n return;\n }\n const listeners = this.listeners_ || (this.listeners_ = {});\n const listenersForType = listeners[type] || (listeners[type] = []);\n if (!listenersForType.includes(listener)) {\n listenersForType.push(listener);\n }\n }\n\n /**\n * Dispatches an event and calls all listeners listening for events\n * of this type. The event parameter can either be a string or an\n * Object with a `type` property.\n *\n * @param {import(\"./Event.js\").default|string} event Event object.\n * @return {boolean|undefined} `false` if anyone called preventDefault on the\n * event object or if any of the listeners returned false.\n * @api\n */\n dispatchEvent(event) {\n const isString = typeof event === 'string';\n const type = isString ? event : event.type;\n const listeners = this.listeners_ && this.listeners_[type];\n if (!listeners) {\n return;\n }\n\n const evt = isString ? new Event(event) : /** @type {Event} */ (event);\n if (!evt.target) {\n evt.target = this.eventTarget_ || this;\n }\n const dispatching = this.dispatching_ || (this.dispatching_ = {});\n const pendingRemovals =\n this.pendingRemovals_ || (this.pendingRemovals_ = {});\n if (!(type in dispatching)) {\n dispatching[type] = 0;\n pendingRemovals[type] = 0;\n }\n ++dispatching[type];\n let propagate;\n for (let i = 0, ii = listeners.length; i < ii; ++i) {\n if ('handleEvent' in listeners[i]) {\n propagate = /** @type {import(\"../events.js\").ListenerObject} */ (\n listeners[i]\n ).handleEvent(evt);\n } else {\n propagate = /** @type {import(\"../events.js\").ListenerFunction} */ (\n listeners[i]\n ).call(this, evt);\n }\n if (propagate === false || evt.propagationStopped) {\n propagate = false;\n break;\n }\n }\n if (--dispatching[type] === 0) {\n let pr = pendingRemovals[type];\n delete pendingRemovals[type];\n while (pr--) {\n this.removeEventListener(type, VOID);\n }\n delete dispatching[type];\n }\n return propagate;\n }\n\n /**\n * Clean up.\n */\n disposeInternal() {\n this.listeners_ && clear(this.listeners_);\n }\n\n /**\n * Get the listeners for a specified event type. Listeners are returned in the\n * order that they will be called in.\n *\n * @param {string} type Type.\n * @return {Array|undefined} Listeners.\n */\n getListeners(type) {\n return (this.listeners_ && this.listeners_[type]) || undefined;\n }\n\n /**\n * @param {string} [type] Type. If not provided,\n * `true` will be returned if this event target has any listeners.\n * @return {boolean} Has listeners.\n */\n hasListener(type) {\n if (!this.listeners_) {\n return false;\n }\n return type\n ? type in this.listeners_\n : Object.keys(this.listeners_).length > 0;\n }\n\n /**\n * @param {string} type Type.\n * @param {import(\"../events.js\").Listener} listener Listener.\n */\n removeEventListener(type, listener) {\n if (!this.listeners_) {\n return;\n }\n const listeners = this.listeners_[type];\n if (!listeners) {\n return;\n }\n const index = listeners.indexOf(listener);\n if (index !== -1) {\n if (this.pendingRemovals_ && type in this.pendingRemovals_) {\n // make listener a no-op, and remove later in #dispatchEvent()\n listeners[index] = VOID;\n ++this.pendingRemovals_[type];\n } else {\n listeners.splice(index, 1);\n if (listeners.length === 0) {\n delete this.listeners_[type];\n }\n }\n }\n }\n}\n\nexport default Target;\n","/**\n * @module ol/expr/expression\n */\nimport {ascending} from '../array.js';\nimport {isStringColor} from '../color.js';\n\n/**\n * @fileoverview This module includes types and functions for parsing array encoded expressions.\n * The result of parsing an encoded expression is one of the specific expression classes.\n * During parsing, information is added to the parsing context about the data accessed by the\n * expression.\n */\n\n/**\n * Base type used for literal style parameters; can be a number literal or the output of an operator,\n * which in turns takes {@link import(\"./expression.js\").ExpressionValue} arguments.\n *\n * See below for details on the available operators (with notes for those that are WebGL or Canvas only).\n *\n * * Reading operators:\n * * `['band', bandIndex, xOffset, yOffset]` For tile layers only. Fetches pixel values from band\n * `bandIndex` of the source's data. The first `bandIndex` of the source data is `1`. Fetched values\n * are in the 0..1 range. {@link import(\"../source/TileImage.js\").default} sources have 4 bands: red,\n * green, blue and alpha. {@link import(\"../source/DataTile.js\").default} sources can have any number\n * of bands, depending on the underlying data source and\n * {@link import(\"../source/GeoTIFF.js\").Options configuration}. `xOffset` and `yOffset` are optional\n * and allow specifying pixel offsets for x and y. This is used for sampling data from neighboring pixels (WebGL only).\n * * `['get', 'attributeName', typeHint]` fetches a feature property value, similar to `feature.get('attributeName')`\n * A type hint can optionally be specified, in case the resulting expression contains a type ambiguity which\n * will make it invalid. Type hints can be one of: 'string', 'color', 'number', 'boolean', 'number[]'\n * * `['geometry-type']` returns a feature's geometry type as string, either: 'LineString', 'Point' or 'Polygon'\n * `Multi*` values are returned as their singular equivalent\n * `Circle` geometries are returned as 'Polygon'\n * `GeometryCollection` geometries are returned as the type of the first geometry found in the collection (WebGL only).\n * * `['resolution']` returns the current resolution\n * * `['time']` The time in seconds since the creation of the layer (WebGL only).\n * * `['var', 'varName']` fetches a value from the style variables; will throw an error if that variable is undefined\n * * `['zoom']` The current zoom level (WebGL only).\n *\n * * Math operators:\n * * `['*', value1, value2, ...]` multiplies the values (either numbers or colors)\n * * `['/', value1, value2]` divides `value1` by `value2`\n * * `['+', value1, value2, ...]` adds the values\n * * `['-', value1, value2]` subtracts `value2` from `value1`\n * * `['clamp', value, low, high]` clamps `value` between `low` and `high`\n * * `['%', value1, value2]` returns the result of `value1 % value2` (modulo)\n * * `['^', value1, value2]` returns the value of `value1` raised to the `value2` power\n * * `['abs', value1]` returns the absolute value of `value1`\n * * `['floor', value1]` returns the nearest integer less than or equal to `value1`\n * * `['round', value1]` returns the nearest integer to `value1`\n * * `['ceil', value1]` returns the nearest integer greater than or equal to `value1`\n * * `['sin', value1]` returns the sine of `value1`\n * * `['cos', value1]` returns the cosine of `value1`\n * * `['atan', value1, value2]` returns `atan2(value1, value2)`. If `value2` is not provided, returns `atan(value1)`\n * * `['sqrt', value1]` returns the square root of `value1`\n *\n * * Transform operators:\n * * `['case', condition1, output1, ...conditionN, outputN, fallback]` selects the first output whose corresponding\n * condition evaluates to `true`. If no match is found, returns the `fallback` value.\n * All conditions should be `boolean`, output and fallback can be any kind.\n * * `['match', input, match1, output1, ...matchN, outputN, fallback]` compares the `input` value against all\n * provided `matchX` values, returning the output associated with the first valid match. If no match is found,\n * returns the `fallback` value.\n * `input` and `matchX` values must all be of the same type, and can be `number` or `string`. `outputX` and\n * `fallback` values must be of the same type, and can be of any kind.\n * * `['interpolate', interpolation, input, stop1, output1, ...stopN, outputN]` returns a value by interpolating between\n * pairs of inputs and outputs; `interpolation` can either be `['linear']` or `['exponential', base]` where `base` is\n * the rate of increase from stop A to stop B (i.e. power to which the interpolation ratio is raised); a value\n * of 1 is equivalent to `['linear']`.\n * `input` and `stopX` values must all be of type `number`. `outputX` values can be `number` or `color` values.\n * Note: `input` will be clamped between `stop1` and `stopN`, meaning that all output values will be comprised\n * between `output1` and `outputN`.\n * * `['string', value1, value2, ...]` returns the first value in the list that evaluates to a string.\n * An example would be to provide a default value for get: `['string', ['get', 'propertyname'], 'default value']]`\n * (Canvas only).\n * * `['number', value1, value2, ...]` returns the first value in the list that evaluates to a number.\n * An example would be to provide a default value for get: `['string', ['get', 'propertyname'], 42]]`\n * (Canvas only).\n * * `['coalesce', value1, value2, ...]` returns the first value in the list which is not null or undefined.\n * An example would be to provide a default value for get: `['coalesce', ['get','propertyname'], 'default value']]`\n * (Canvas only).\n *\n * * Logical operators:\n * * `['<', value1, value2]` returns `true` if `value1` is strictly lower than `value2`, or `false` otherwise.\n * * `['<=', value1, value2]` returns `true` if `value1` is lower than or equals `value2`, or `false` otherwise.\n * * `['>', value1, value2]` returns `true` if `value1` is strictly greater than `value2`, or `false` otherwise.\n * * `['>=', value1, value2]` returns `true` if `value1` is greater than or equals `value2`, or `false` otherwise.\n * * `['==', value1, value2]` returns `true` if `value1` equals `value2`, or `false` otherwise.\n * * `['!=', value1, value2]` returns `true` if `value1` does not equal `value2`, or `false` otherwise.\n * * `['!', value1]` returns `false` if `value1` is `true` or greater than `0`, or `true` otherwise.\n * * `['all', value1, value2, ...]` returns `true` if all the inputs are `true`, `false` otherwise.\n * * `['any', value1, value2, ...]` returns `true` if any of the inputs are `true`, `false` otherwise.\n * * `['between', value1, value2, value3]` returns `true` if `value1` is contained between `value2` and `value3`\n * (inclusively), or `false` otherwise.\n * * `['in', needle, haystack]` returns `true` if `needle` is found in `haystack`, and\n * `false` otherwise.\n * This operator has the following limitations:\n * * `haystack` has to be an array of numbers or strings (searching for a substring in a string is not supported yet)\n * * Only literal arrays are supported as `haystack` for now; this means that `haystack` cannot be the result of an\n * expression. If `haystack` is an array of strings, use the `literal` operator to disambiguate from an expression:\n * `['literal', ['abc', 'def', 'ghi']]`\n *\n * * Conversion operators:\n * * `['array', value1, ...valueN]` creates a numerical array from `number` values; please note that the amount of\n * values can currently only be 2, 3 or 4 (WebGL only).\n * * `['color', red, green, blue, alpha]` or `['color', shade, alpha]` creates a `color` value from `number` values;\n * the `alpha` parameter is optional; if not specified, it will be set to 1 (WebGL only).\n * Note: `red`, `green` and `blue` or `shade` components must be values between 0 and 255; `alpha` between 0 and 1.\n * * `['palette', index, colors]` picks a `color` value from an array of colors using the given index; the `index`\n * expression must evaluate to a number; the items in the `colors` array must be strings with hex colors\n * (e.g. `'#86A136'`), colors using the rgba[a] functional notation (e.g. `'rgb(134, 161, 54)'` or `'rgba(134, 161, 54, 1)'`),\n * named colors (e.g. `'red'`), or array literals with 3 ([r, g, b]) or 4 ([r, g, b, a]) values (with r, g, and b\n * in the 0-255 range and a in the 0-1 range) (WebGL only).\n * * `['to-string', value]` converts the input value to a string. If the input is a boolean, the result is \"true\" or \"false\".\n * If the input is a number, it is converted to a string as specified by the \"NumberToString\" algorithm of the ECMAScript\n * Language Specification. If the input is a color, it is converted to a string of the form \"rgba(r,g,b,a)\". (Canvas only)\n *\n * Values can either be literals or another operator, as they will be evaluated recursively.\n * Literal values can be of the following types:\n * * `boolean`\n * * `number`\n * * `number[]` (number arrays can only have a length of 2, 3 or 4)\n * * `string`\n * * {@link module:ol/color~Color}\n *\n * @typedef {Array<*>|import(\"../color.js\").Color|string|number|boolean} ExpressionValue\n * @api\n */\n\nlet numTypes = 0;\nexport const NoneType = 0;\nexport const BooleanType = 1 << numTypes++;\nexport const NumberType = 1 << numTypes++;\nexport const StringType = 1 << numTypes++;\nexport const ColorType = 1 << numTypes++;\nexport const NumberArrayType = 1 << numTypes++;\nexport const SizeType = 1 << numTypes++;\nexport const AnyType = Math.pow(2, numTypes) - 1;\n\nconst typeNames = {\n [BooleanType]: 'boolean',\n [NumberType]: 'number',\n [StringType]: 'string',\n [ColorType]: 'color',\n [NumberArrayType]: 'number[]',\n [SizeType]: 'size',\n};\n\nconst namedTypes = Object.keys(typeNames).map(Number).sort(ascending);\n\n/**\n * Get a string representation for a type.\n * @param {number} type The type.\n * @return {string} The type name.\n */\nexport function typeName(type) {\n const names = [];\n for (const namedType of namedTypes) {\n if (includesType(type, namedType)) {\n names.push(typeNames[namedType]);\n }\n }\n if (names.length === 0) {\n return 'untyped';\n }\n if (names.length < 3) {\n return names.join(' or ');\n }\n return names.slice(0, -1).join(', ') + ', or ' + names[names.length - 1];\n}\n\n/**\n * @param {number} broad The broad type.\n * @param {number} specific The specific type.\n * @return {boolean} The broad type includes the specific type.\n */\nexport function includesType(broad, specific) {\n return (broad & specific) === specific;\n}\n\n/**\n * @param {number} oneType One type.\n * @param {number} otherType Another type.\n * @return {boolean} The set of types overlap (share a common specific type)\n */\nexport function overlapsType(oneType, otherType) {\n return !!(oneType & otherType);\n}\n\n/**\n * @param {number} type The type.\n * @param {number} expected The expected type.\n * @return {boolean} The given type is exactly the expected type.\n */\nexport function isType(type, expected) {\n return type === expected;\n}\n\n/**\n * @typedef {boolean|number|string|Array} LiteralValue\n */\n\nexport class LiteralExpression {\n /**\n * @param {number} type The value type.\n * @param {LiteralValue} value The literal value.\n */\n constructor(type, value) {\n this.type = type;\n this.value = value;\n }\n}\n\nexport class CallExpression {\n /**\n * @param {number} type The return type.\n * @param {string} operator The operator.\n * @param {...Expression} args The arguments.\n */\n constructor(type, operator, ...args) {\n this.type = type;\n this.operator = operator;\n this.args = args;\n }\n}\n\n/**\n * @typedef {LiteralExpression|CallExpression} Expression\n */\n\n/**\n * @typedef {Object} ParsingContext\n * @property {Set} variables Variables referenced with the 'var' operator.\n * @property {Set} properties Properties referenced with the 'get' operator.\n * @property {boolean} featureId The style uses the feature id.\n * @property {boolean} geometryType The style uses the feature geometry type.\n * @property {import(\"../style/flat.js\").FlatStyle|import(\"../style/webgl.js\").WebGLStyle} style The style being parsed\n */\n\n/**\n * @return {ParsingContext} A new parsing context.\n */\nexport function newParsingContext() {\n return {\n variables: new Set(),\n properties: new Set(),\n featureId: false,\n geometryType: false,\n style: {},\n };\n}\n\n/**\n * @param {string} typeHint Type hint\n * @return {number} Resulting value type (will be a single type)\n */\nfunction getTypeFromHint(typeHint) {\n switch (typeHint) {\n case 'string':\n return StringType;\n case 'color':\n return ColorType;\n case 'number':\n return NumberType;\n case 'boolean':\n return BooleanType;\n case 'number[]':\n return NumberArrayType;\n default:\n throw new Error(`Unrecognized type hint: ${typeHint}`);\n }\n}\n\n/**\n * @typedef {LiteralValue|Array} EncodedExpression\n */\n\n/**\n * @param {EncodedExpression} encoded The encoded expression.\n * @param {ParsingContext} context The parsing context.\n * @param {number} [typeHint] Optional type hint\n * @return {Expression} The parsed expression result.\n */\nexport function parse(encoded, context, typeHint) {\n switch (typeof encoded) {\n case 'boolean': {\n return new LiteralExpression(BooleanType, encoded);\n }\n case 'number': {\n return new LiteralExpression(\n typeHint === SizeType ? SizeType : NumberType,\n encoded,\n );\n }\n case 'string': {\n let type = StringType;\n if (isStringColor(encoded)) {\n type |= ColorType;\n }\n // apply the given type hint only if it won't result in an empty type\n if (!isType(type & typeHint, NoneType)) {\n type &= typeHint;\n }\n return new LiteralExpression(type, encoded);\n }\n default: {\n // pass\n }\n }\n\n if (!Array.isArray(encoded)) {\n throw new Error('Expression must be an array or a primitive value');\n }\n\n if (encoded.length === 0) {\n throw new Error('Empty expression');\n }\n\n if (typeof encoded[0] === 'string') {\n return parseCallExpression(encoded, context, typeHint);\n }\n\n for (const item of encoded) {\n if (typeof item !== 'number') {\n throw new Error('Expected an array of numbers');\n }\n }\n\n let type = NumberArrayType;\n if (encoded.length === 2) {\n type |= SizeType;\n } else if (encoded.length === 3 || encoded.length === 4) {\n type |= ColorType;\n }\n if (typeHint) {\n type &= typeHint;\n }\n return new LiteralExpression(type, encoded);\n}\n\n/**\n * @type {Object}\n */\nexport const Ops = {\n Get: 'get',\n Var: 'var',\n Concat: 'concat',\n GeometryType: 'geometry-type',\n Any: 'any',\n All: 'all',\n Not: '!',\n Resolution: 'resolution',\n Zoom: 'zoom',\n Time: 'time',\n Equal: '==',\n NotEqual: '!=',\n GreaterThan: '>',\n GreaterThanOrEqualTo: '>=',\n LessThan: '<',\n LessThanOrEqualTo: '<=',\n Multiply: '*',\n Divide: '/',\n Add: '+',\n Subtract: '-',\n Clamp: 'clamp',\n Mod: '%',\n Pow: '^',\n Abs: 'abs',\n Floor: 'floor',\n Ceil: 'ceil',\n Round: 'round',\n Sin: 'sin',\n Cos: 'cos',\n Atan: 'atan',\n Sqrt: 'sqrt',\n Match: 'match',\n Between: 'between',\n Interpolate: 'interpolate',\n Coalesce: 'coalesce',\n Case: 'case',\n In: 'in',\n Number: 'number',\n String: 'string',\n Array: 'array',\n Color: 'color',\n Id: 'id',\n Band: 'band',\n Palette: 'palette',\n ToString: 'to-string',\n};\n\n/**\n * @typedef {function(Array, ParsingContext, number):Expression} Parser\n * Third argument is a type hint\n */\n\n/**\n * @type {Object}\n */\nconst parsers = {\n [Ops.Get]: createParser(\n ([_, typeHint]) => {\n if (typeHint !== undefined) {\n return getTypeFromHint(\n /** @type {string} */ (\n /** @type {LiteralExpression} */ (typeHint).value\n ),\n );\n }\n return AnyType;\n },\n withArgsCount(1, 2),\n withGetArgs,\n ),\n [Ops.Var]: createParser(\n ([firstArg]) => firstArg.type,\n withArgsCount(1, 1),\n withVarArgs,\n ),\n [Ops.Id]: createParser(NumberType | StringType, withNoArgs, usesFeatureId),\n [Ops.Concat]: createParser(\n StringType,\n withArgsCount(2, Infinity),\n parseArgsOfType(AnyType),\n ),\n [Ops.GeometryType]: createParser(StringType, withNoArgs, usesGeometryType),\n [Ops.Resolution]: createParser(NumberType, withNoArgs),\n [Ops.Zoom]: createParser(NumberType, withNoArgs),\n [Ops.Time]: createParser(NumberType, withNoArgs),\n [Ops.Any]: createParser(\n BooleanType,\n withArgsCount(2, Infinity),\n parseArgsOfType(BooleanType),\n ),\n [Ops.All]: createParser(\n BooleanType,\n withArgsCount(2, Infinity),\n parseArgsOfType(BooleanType),\n ),\n [Ops.Not]: createParser(\n BooleanType,\n withArgsCount(1, 1),\n parseArgsOfType(BooleanType),\n ),\n [Ops.Equal]: createParser(\n BooleanType,\n withArgsCount(2, 2),\n parseArgsOfType(AnyType),\n narrowArgsType,\n ),\n [Ops.NotEqual]: createParser(\n BooleanType,\n withArgsCount(2, 2),\n parseArgsOfType(AnyType),\n narrowArgsType,\n ),\n [Ops.GreaterThan]: createParser(\n BooleanType,\n withArgsCount(2, 2),\n parseArgsOfType(AnyType),\n narrowArgsType,\n ),\n [Ops.GreaterThanOrEqualTo]: createParser(\n BooleanType,\n withArgsCount(2, 2),\n parseArgsOfType(AnyType),\n narrowArgsType,\n ),\n [Ops.LessThan]: createParser(\n BooleanType,\n withArgsCount(2, 2),\n parseArgsOfType(AnyType),\n narrowArgsType,\n ),\n [Ops.LessThanOrEqualTo]: createParser(\n BooleanType,\n withArgsCount(2, 2),\n parseArgsOfType(AnyType),\n narrowArgsType,\n ),\n [Ops.Multiply]: createParser(\n (parsedArgs) => {\n let outputType = NumberType | ColorType;\n for (let i = 0; i < parsedArgs.length; i++) {\n outputType &= parsedArgs[i].type;\n }\n return outputType;\n },\n withArgsCount(2, Infinity),\n parseArgsOfType(NumberType | ColorType),\n narrowArgsType,\n ),\n [Ops.Coalesce]: createParser(\n (parsedArgs) => {\n let type = AnyType;\n for (let i = 1; i < parsedArgs.length; i += 2) {\n type &= parsedArgs[i].type;\n }\n type &= parsedArgs[parsedArgs.length - 1].type;\n return type;\n },\n withArgsCount(2, Infinity),\n parseArgsOfType(AnyType),\n narrowArgsType,\n ),\n [Ops.Divide]: createParser(\n NumberType,\n withArgsCount(2, 2),\n parseArgsOfType(NumberType),\n ),\n [Ops.Add]: createParser(\n NumberType,\n withArgsCount(2, Infinity),\n parseArgsOfType(NumberType),\n ),\n [Ops.Subtract]: createParser(\n NumberType,\n withArgsCount(2, 2),\n parseArgsOfType(NumberType),\n ),\n [Ops.Clamp]: createParser(\n NumberType,\n withArgsCount(3, 3),\n parseArgsOfType(NumberType),\n ),\n [Ops.Mod]: createParser(\n NumberType,\n withArgsCount(2, 2),\n parseArgsOfType(NumberType),\n ),\n [Ops.Pow]: createParser(\n NumberType,\n withArgsCount(2, 2),\n parseArgsOfType(NumberType),\n ),\n [Ops.Abs]: createParser(\n NumberType,\n withArgsCount(1, 1),\n parseArgsOfType(NumberType),\n ),\n [Ops.Floor]: createParser(\n NumberType,\n withArgsCount(1, 1),\n parseArgsOfType(NumberType),\n ),\n [Ops.Ceil]: createParser(\n NumberType,\n withArgsCount(1, 1),\n parseArgsOfType(NumberType),\n ),\n [Ops.Round]: createParser(\n NumberType,\n withArgsCount(1, 1),\n parseArgsOfType(NumberType),\n ),\n [Ops.Sin]: createParser(\n NumberType,\n withArgsCount(1, 1),\n parseArgsOfType(NumberType),\n ),\n [Ops.Cos]: createParser(\n NumberType,\n withArgsCount(1, 1),\n parseArgsOfType(NumberType),\n ),\n [Ops.Atan]: createParser(\n NumberType,\n withArgsCount(1, 2),\n parseArgsOfType(NumberType),\n ),\n [Ops.Sqrt]: createParser(\n NumberType,\n withArgsCount(1, 1),\n parseArgsOfType(NumberType),\n ),\n [Ops.Match]: createParser(\n (parsedArgs) => {\n let type = AnyType;\n for (let i = 2; i < parsedArgs.length; i += 2) {\n type &= parsedArgs[i].type;\n }\n type &= parsedArgs[parsedArgs.length - 1].type;\n return type;\n },\n withArgsCount(4, Infinity),\n withEvenArgs,\n parseMatchArgs,\n ),\n [Ops.Between]: createParser(\n BooleanType,\n withArgsCount(3, 3),\n parseArgsOfType(NumberType),\n ),\n [Ops.Interpolate]: createParser(\n (parsedArgs) => {\n let type = ColorType | NumberType;\n for (let i = 3; i < parsedArgs.length; i += 2) {\n type &= parsedArgs[i].type;\n }\n return type;\n },\n withArgsCount(6, Infinity),\n withEvenArgs,\n parseInterpolateArgs,\n ),\n [Ops.Case]: createParser(\n (parsedArgs) => {\n let type = AnyType;\n for (let i = 1; i < parsedArgs.length; i += 2) {\n type &= parsedArgs[i].type;\n }\n type &= parsedArgs[parsedArgs.length - 1].type;\n return type;\n },\n withArgsCount(3, Infinity),\n withOddArgs,\n parseCaseArgs,\n ),\n [Ops.In]: createParser(BooleanType, withArgsCount(2, 2), parseInArgs),\n [Ops.Number]: createParser(\n NumberType,\n withArgsCount(1, Infinity),\n parseArgsOfType(AnyType),\n ),\n [Ops.String]: createParser(\n StringType,\n withArgsCount(1, Infinity),\n parseArgsOfType(AnyType),\n ),\n [Ops.Array]: createParser(\n (parsedArgs) => {\n return parsedArgs.length === 2\n ? NumberArrayType | SizeType\n : parsedArgs.length === 3 || parsedArgs.length === 4\n ? NumberArrayType | ColorType\n : NumberArrayType;\n },\n withArgsCount(1, Infinity),\n parseArgsOfType(NumberType),\n ),\n [Ops.Color]: createParser(\n ColorType,\n withArgsCount(1, 4),\n parseArgsOfType(NumberType),\n ),\n [Ops.Band]: createParser(\n NumberType,\n withArgsCount(1, 3),\n parseArgsOfType(NumberType),\n ),\n [Ops.Palette]: createParser(ColorType, withArgsCount(2, 2), parsePaletteArgs),\n [Ops.ToString]: createParser(\n StringType,\n withArgsCount(1, 1),\n parseArgsOfType(BooleanType | NumberType | StringType | ColorType),\n ),\n};\n\n/**\n * @typedef {function(Array, ParsingContext, Array, number?):Array|void} ArgValidator\n * An argument validator applies various checks to an encoded expression arguments\n * Returns the parsed arguments if any.\n * Third argument is the array of parsed arguments from previous validators\n * Fourth argument is an optional type hint\n */\n\n/**\n * @type ArgValidator\n */\nfunction withGetArgs(encoded, context) {\n const arg = parse(encoded[1], context);\n if (!(arg instanceof LiteralExpression)) {\n throw new Error('Expected a literal argument for get operation');\n }\n if (typeof arg.value !== 'string') {\n throw new Error('Expected a string argument for get operation');\n }\n context.properties.add(arg.value);\n if (encoded.length === 3) {\n const hint = parse(encoded[2], context);\n return [arg, hint];\n }\n return [arg];\n}\n\n/**\n * @type ArgValidator\n */\nfunction withVarArgs(encoded, context, parsedArgs, typeHint) {\n const varName = encoded[1];\n if (typeof varName !== 'string') {\n throw new Error('Expected a string argument for var operation');\n }\n context.variables.add(varName);\n if (\n !('variables' in context.style) ||\n context.style.variables[varName] === undefined\n ) {\n return [new LiteralExpression(AnyType, varName)];\n }\n const initialValue = context.style.variables[varName];\n const arg = /** @type {LiteralExpression} */ (parse(initialValue, context));\n arg.value = varName;\n if (typeHint && !overlapsType(typeHint, arg.type)) {\n throw new Error(\n `The variable ${varName} has type ${typeName(\n arg.type,\n )} but the following type was expected: ${typeName(typeHint)}`,\n );\n }\n return [arg];\n}\n\n/**\n * @type ArgValidator\n */\nfunction usesFeatureId(encoded, context) {\n context.featureId = true;\n}\n\n/**\n * @type ArgValidator\n */\nfunction usesGeometryType(encoded, context) {\n context.geometryType = true;\n}\n\n/**\n * @type ArgValidator\n */\nfunction withNoArgs(encoded, context) {\n const operation = encoded[0];\n if (encoded.length !== 1) {\n throw new Error(`Expected no arguments for ${operation} operation`);\n }\n return [];\n}\n\n/**\n * @param {number} minArgs The minimum number of arguments.\n * @param {number} maxArgs The maximum number of arguments.\n * @return {ArgValidator} The argument validator\n */\nfunction withArgsCount(minArgs, maxArgs) {\n return function (encoded, context) {\n const operation = encoded[0];\n const argCount = encoded.length - 1;\n if (minArgs === maxArgs) {\n if (argCount !== minArgs) {\n const plural = minArgs === 1 ? '' : 's';\n throw new Error(\n `Expected ${minArgs} argument${plural} for ${operation}, got ${argCount}`,\n );\n }\n } else if (argCount < minArgs || argCount > maxArgs) {\n const range =\n maxArgs === Infinity\n ? `${minArgs} or more`\n : `${minArgs} to ${maxArgs}`;\n throw new Error(\n `Expected ${range} arguments for ${operation}, got ${argCount}`,\n );\n }\n };\n}\n\n/**\n * @param {number} argType The argument type.\n * @return {ArgValidator} The argument validator\n */\nfunction parseArgsOfType(argType) {\n return function (encoded, context) {\n const operation = encoded[0];\n const argCount = encoded.length - 1;\n /**\n * @type {Array}\n */\n const args = new Array(argCount);\n for (let i = 0; i < argCount; ++i) {\n const expression = parse(encoded[i + 1], context);\n if (!overlapsType(argType, expression.type)) {\n const gotType = typeName(argType);\n const expectedType = typeName(expression.type);\n throw new Error(\n `Unexpected type for argument ${i} of ${operation} operation` +\n `, got ${gotType} but expected ${expectedType}`,\n );\n }\n expression.type &= argType;\n args[i] = expression;\n }\n return args;\n };\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction narrowArgsType(encoded, context, parsedArgs) {\n const operation = encoded[0];\n const argCount = encoded.length - 1;\n\n // first pass to determine a narrowed down type\n let sameType = AnyType;\n for (let i = 0; i < parsedArgs.length; ++i) {\n sameType &= parsedArgs[i].type;\n }\n\n if (sameType === NoneType) {\n throw new Error(\n `No common type could be found for arguments of ${operation} operation`,\n );\n }\n\n // re-parse args\n const args = new Array(argCount);\n for (let i = 0; i < argCount; ++i) {\n args[i] = parse(encoded[i + 1], context, sameType);\n }\n return args;\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction withOddArgs(encoded, context) {\n const operation = encoded[0];\n const argCount = encoded.length - 1;\n if (argCount % 2 === 0) {\n throw new Error(\n `An odd amount of arguments was expected for operation ${operation}, got ${JSON.stringify(\n argCount,\n )} instead`,\n );\n }\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction withEvenArgs(encoded, context) {\n const operation = encoded[0];\n const argCount = encoded.length - 1;\n if (argCount % 2 === 1) {\n throw new Error(\n `An even amount of arguments was expected for operation ${operation}, got ${JSON.stringify(\n argCount,\n )} instead`,\n );\n }\n}\n\n/**\n * @type ArgValidator\n */\nfunction parseMatchArgs(encoded, context, parsedArgs, typeHint) {\n const argsCount = encoded.length - 1;\n\n const input = parse(encoded[1], context);\n let inputType = input.type;\n const fallback = parse(encoded[encoded.length - 1], context);\n let outputType =\n typeHint !== undefined ? typeHint & fallback.type : fallback.type;\n\n // first parse args to figure out possible types\n const args = new Array(argsCount - 2);\n for (let i = 0; i < argsCount - 2; i += 2) {\n const match = parse(encoded[i + 2], context);\n const output = parse(encoded[i + 3], context);\n inputType &= match.type;\n outputType &= output.type;\n args[i] = match;\n args[i + 1] = output;\n }\n\n // check input and output types validity\n const expectedInputType = StringType | NumberType | BooleanType;\n if (!overlapsType(expectedInputType, inputType)) {\n throw new Error(\n `Expected an input of type ${typeName(\n expectedInputType,\n )} for the interpolate operation` +\n `, got ${typeName(inputType)} instead`,\n );\n }\n inputType &= expectedInputType;\n if (isType(outputType, NoneType)) {\n throw new Error(\n `Could not find a common output type for the following match operation: ` +\n JSON.stringify(encoded),\n );\n }\n\n // parse again inputs and outputs with common type\n for (let i = 0; i < argsCount - 2; i += 2) {\n const match = parse(encoded[i + 2], context, inputType);\n const output = parse(encoded[i + 3], context, outputType);\n args[i] = match;\n args[i + 1] = output;\n }\n\n return [\n parse(encoded[1], context, inputType),\n ...args,\n parse(encoded[encoded.length - 1], context, outputType),\n ];\n}\n\n/**\n * @type ArgValidator\n */\nfunction parseInterpolateArgs(encoded, context, parsedArgs, typeHint) {\n const interpolationType = encoded[1];\n let interpolation;\n switch (interpolationType[0]) {\n case 'linear':\n interpolation = 1;\n break;\n case 'exponential':\n interpolation = interpolationType[1];\n if (typeof interpolation !== 'number') {\n throw new Error(\n `Expected a number base for exponential interpolation` +\n `, got ${JSON.stringify(interpolation)} instead`,\n );\n }\n break;\n default:\n interpolation = null;\n }\n if (!interpolation) {\n throw new Error(\n `Invalid interpolation type: ${JSON.stringify(interpolationType)}`,\n );\n }\n interpolation = parse(interpolation, context);\n\n // check input types\n let input = parse(encoded[2], context);\n if (!overlapsType(NumberType, input.type)) {\n throw new Error(\n `Expected an input of type number for the interpolate operation` +\n `, got ${typeName(input.type)} instead`,\n );\n }\n input = parse(encoded[2], context, NumberType); // parse again with narrower output\n\n const args = new Array(encoded.length - 3);\n for (let i = 0; i < args.length; i += 2) {\n let stop = parse(encoded[i + 3], context);\n if (!overlapsType(NumberType, stop.type)) {\n throw new Error(\n `Expected all stop input values in the interpolate operation to be of type number` +\n `, got ${typeName(stop.type)} at position ${i + 2} instead`,\n );\n }\n let output = parse(encoded[i + 4], context);\n if (!overlapsType(NumberType | ColorType, output.type)) {\n throw new Error(\n `Expected all stop output values in the interpolate operation to be a number or color` +\n `, got ${typeName(output.type)} at position ${i + 3} instead`,\n );\n }\n // parse again with narrower types\n stop = parse(encoded[i + 3], context, NumberType);\n output = parse(encoded[i + 4], context, NumberType | ColorType);\n args[i] = stop;\n args[i + 1] = output;\n }\n\n return [interpolation, input, ...args];\n}\n\n/**\n * @type ArgValidator\n */\nfunction parseCaseArgs(encoded, context, parsedArgs, typeHint) {\n const fallback = parse(encoded[encoded.length - 1], context, typeHint);\n let outputType =\n typeHint !== undefined ? typeHint & fallback.type : fallback.type;\n\n // first parse args to figure out possible types\n const args = new Array(encoded.length - 1);\n for (let i = 0; i < args.length - 1; i += 2) {\n const condition = parse(encoded[i + 1], context);\n const output = parse(encoded[i + 2], context, typeHint);\n if (!overlapsType(BooleanType, condition.type)) {\n throw new Error(\n `Expected all conditions in the case operation to be of type boolean` +\n `, got ${typeName(condition.type)} at position ${i} instead`,\n );\n }\n outputType &= output.type;\n args[i] = condition;\n args[i + 1] = output;\n }\n\n if (isType(outputType, NoneType)) {\n throw new Error(\n `Could not find a common output type for the following case operation: ` +\n JSON.stringify(encoded),\n );\n }\n\n // parse again args with common output type\n for (let i = 0; i < args.length - 1; i += 2) {\n args[i + 1] = parse(encoded[i + 2], context, outputType);\n }\n args[args.length - 1] = parse(\n encoded[encoded.length - 1],\n context,\n outputType,\n );\n\n return args;\n}\n\n/**\n * @type ArgValidator\n */\nfunction parseInArgs(encoded, context) {\n /** @type {Array} */\n let haystack = /** @type {any} */ (encoded[2]);\n if (!Array.isArray(haystack)) {\n throw new Error(\n `The \"in\" operator was provided a literal value which was not an array as second argument.`,\n );\n }\n if (typeof haystack[0] === 'string') {\n if (haystack[0] !== 'literal') {\n throw new Error(\n `For the \"in\" operator, a string array should be wrapped in a \"literal\" operator to disambiguate from expressions.`,\n );\n }\n if (!Array.isArray(haystack[1])) {\n throw new Error(\n `The \"in\" operator was provided a literal value which was not an array as second argument.`,\n );\n }\n haystack = haystack[1];\n }\n\n let needleType = StringType | NumberType;\n const args = new Array(haystack.length);\n for (let i = 0; i < args.length; i++) {\n const arg = parse(haystack[i], context);\n needleType &= arg.type;\n args[i] = arg;\n }\n if (isType(needleType, NoneType)) {\n throw new Error(\n `Could not find a common type for the following in operation: ` +\n JSON.stringify(encoded),\n );\n }\n\n const needle = parse(encoded[1], context, needleType);\n return [needle, ...args];\n}\n\n/**\n * @type ArgValidator\n */\nfunction parsePaletteArgs(encoded, context) {\n const index = parse(encoded[1], context, NumberType);\n if (index.type !== NumberType) {\n throw new Error(\n `The first argument of palette must be an number, got ${typeName(\n index.type,\n )} instead`,\n );\n }\n const colors = encoded[2];\n if (!Array.isArray(colors)) {\n throw new Error('The second argument of palette must be an array');\n }\n const parsedColors = new Array(colors.length);\n for (let i = 0; i < parsedColors.length; i++) {\n const color = parse(colors[i], context, ColorType);\n if (!(color instanceof LiteralExpression)) {\n throw new Error(\n `The palette color at index ${i} must be a literal value`,\n );\n }\n if (!overlapsType(color.type, ColorType)) {\n throw new Error(\n `The palette color at index ${i} should be of type color, got ${typeName(\n color.type,\n )} instead`,\n );\n }\n parsedColors[i] = color;\n }\n return [index, ...parsedColors];\n}\n\n/**\n * @param {number|function(Array):number} returnType The return type of the operator; can be a fixed value or a callback taking the parsed\n * arguments\n * @param {Array} argValidators A chain of argument validators; the return value of the last validator\n * will be used as parsed arguments\n * @return {Parser} The parser.\n */\nfunction createParser(returnType, ...argValidators) {\n return function (encoded, context, typeHint) {\n const operator = encoded[0];\n let parsedArgs = [];\n for (let i = 0; i < argValidators.length; i++) {\n parsedArgs =\n argValidators[i](encoded, context, parsedArgs, typeHint) || parsedArgs;\n }\n let actualType =\n typeof returnType === 'function' ? returnType(parsedArgs) : returnType;\n if (typeHint !== undefined) {\n if (!overlapsType(actualType, typeHint)) {\n throw new Error(\n `The following expression was expected to return ${typeName(\n typeHint,\n )}, but returns ${typeName(actualType)} instead: ${JSON.stringify(\n encoded,\n )}`,\n );\n }\n actualType &= typeHint;\n }\n if (actualType === NoneType) {\n throw new Error(\n `No matching type was found for the following expression: ${JSON.stringify(\n encoded,\n )}`,\n );\n }\n return new CallExpression(actualType, operator, ...parsedArgs);\n };\n}\n\n/**\n * @param {Array} encoded The encoded expression.\n * @param {ParsingContext} context The parsing context.\n * @param {number} [typeHint] Optional type hint\n * @return {Expression} The parsed expression.\n */\nfunction parseCallExpression(encoded, context, typeHint) {\n const operator = encoded[0];\n\n const parser = parsers[operator];\n if (!parser) {\n throw new Error(`Unknown operator: ${operator}`);\n }\n return parser(encoded, context, typeHint);\n}\n\n/**\n * Returns a simplified geometry type suited for the `geometry-type` operator\n * @param {import('../geom/Geometry.js').default|import('../render/Feature.js').default} geometry Geometry object\n * @return {'Point'|'LineString'|'Polygon'|''} Simplified geometry type; empty string of no geometry found\n */\nexport function computeGeometryType(geometry) {\n if (!geometry) {\n return '';\n }\n const type = geometry.getType();\n switch (type) {\n case 'Point':\n case 'LineString':\n case 'Polygon':\n return type;\n case 'MultiPoint':\n case 'MultiLineString':\n case 'MultiPolygon':\n return /** @type {'Point'|'LineString'|'Polygon'} */ (type.substring(5));\n case 'Circle':\n return 'Polygon';\n case 'GeometryCollection':\n return computeGeometryType(\n /** @type {import(\"../geom/GeometryCollection.js\").default} */ (\n geometry\n ).getGeometries()[0],\n );\n default:\n return '';\n }\n}\n","/**\n * @module ol/webgl/PaletteTexture\n */\n\nclass PaletteTexture {\n /**\n * @param {string} name The name of the texture.\n * @param {Uint8Array} data The texture data.\n */\n constructor(name, data) {\n this.name = name;\n this.data = data;\n\n /**\n * @type {WebGLTexture|null}\n * @private\n */\n this.texture_ = null;\n }\n\n /**\n * @param {WebGLRenderingContext} gl Rendering context.\n * @return {WebGLTexture} The texture.\n */\n getTexture(gl) {\n if (!this.texture_) {\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texImage2D(\n gl.TEXTURE_2D,\n 0,\n gl.RGBA,\n this.data.length / 4,\n 1,\n 0,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n this.data,\n );\n this.texture_ = texture;\n }\n return this.texture_;\n }\n\n /**\n * @param {WebGLRenderingContext} gl Rendering context.\n */\n delete(gl) {\n if (this.texture_) {\n gl.deleteTexture(this.texture_);\n }\n this.texture_ = null;\n }\n}\n\nexport default PaletteTexture;\n","/**\n * @module ol/expr/gpu\n */\nimport PaletteTexture from '../webgl/PaletteTexture.js';\nimport {\n BooleanType,\n CallExpression,\n ColorType,\n NoneType,\n NumberArrayType,\n NumberType,\n Ops,\n SizeType,\n StringType,\n computeGeometryType,\n isType,\n overlapsType,\n parse,\n typeName,\n} from './expression.js';\nimport {Uniforms} from '../renderer/webgl/TileLayer.js';\nimport {asArray} from '../color.js';\nimport {toSize} from '../size.js';\n\n/**\n * @param {string} operator Operator\n * @param {CompilationContext} context Compilation context\n * @return {string} A function name based on the operator, unique in the given context\n */\nfunction computeOperatorFunctionName(operator, context) {\n return `operator_${operator}_${Object.keys(context.functions).length}`;\n}\n\n/**\n * Will return the number as a float with a dot separator, which is required by GLSL.\n * @param {number} v Numerical value.\n * @return {string} The value as string.\n */\nexport function numberToGlsl(v) {\n const s = v.toString();\n return s.includes('.') ? s : s + '.0';\n}\n\n/**\n * Will return the number array as a float with a dot separator, concatenated with ', '.\n * @param {Array} array Numerical values array.\n * @return {string} The array as a vector, e. g.: `vec3(1.0, 2.0, 3.0)`.\n */\nexport function arrayToGlsl(array) {\n if (array.length < 2 || array.length > 4) {\n throw new Error(\n '`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.',\n );\n }\n return `vec${array.length}(${array.map(numberToGlsl).join(', ')})`;\n}\n\n/**\n * Will normalize and converts to string a `vec4` color array compatible with GLSL.\n * @param {string|import(\"../color.js\").Color} color Color either in string format or [r, g, b, a] array format,\n * with RGB components in the 0..255 range and the alpha component in the 0..1 range.\n * Note that the final array will always have 4 components.\n * @return {string} The color expressed in the `vec4(1.0, 1.0, 1.0, 1.0)` form.\n */\nexport function colorToGlsl(color) {\n const array = asArray(color);\n const alpha = array.length > 3 ? array[3] : 1;\n // all components are premultiplied with alpha value\n return arrayToGlsl([\n (array[0] / 255) * alpha,\n (array[1] / 255) * alpha,\n (array[2] / 255) * alpha,\n alpha,\n ]);\n}\n\n/**\n * Normalizes and converts a number or array toa `vec2` array compatible with GLSL.\n * @param {number|import('../size.js').Size} size Size.\n * @return {string} The color expressed in the `vec4(1.0, 1.0, 1.0, 1.0)` form.\n */\nexport function sizeToGlsl(size) {\n const array = toSize(size);\n return arrayToGlsl(array);\n}\n\n/** @type {Object} */\nconst stringToFloatMap = {};\nlet stringToFloatCounter = 0;\n\n/**\n * Returns a stable equivalent number for the string literal.\n * @param {string} string String literal value\n * @return {number} Number equivalent\n */\nexport function getStringNumberEquivalent(string) {\n if (!(string in stringToFloatMap)) {\n stringToFloatMap[string] = stringToFloatCounter++;\n }\n return stringToFloatMap[string];\n}\n\n/**\n * Returns a stable equivalent number for the string literal, for use in shaders. This number is then\n * converted to be a GLSL-compatible string.\n * Note: with a float precision of `mediump`, the amount of unique strings supported is 16,777,216\n * @param {string} string String literal value\n * @return {string} GLSL-compatible string containing a number\n */\nexport function stringToGlsl(string) {\n return numberToGlsl(getStringNumberEquivalent(string));\n}\n\n/**\n * Get the uniform name given a variable name.\n * @param {string} variableName The variable name.\n * @return {string} The uniform name.\n */\nexport function uniformNameForVariable(variableName) {\n return 'u_var_' + variableName;\n}\n\n/**\n * @typedef {import('./expression.js').ParsingContext} ParsingContext\n */\n/**\n *\n * @typedef {import(\"./expression.js\").Expression} Expression\n */\n/**\n *\n * @typedef {import(\"./expression.js\").LiteralExpression} LiteralExpression\n */\n\n/**\n * @typedef {Object} CompilationContextProperty\n * @property {string} name Name\n * @property {number} type Resolved property type\n * @property {function(import(\"../Feature.js\").FeatureLike): *} [evaluator] Function used for evaluating the value;\n */\n\n/**\n * @typedef {Object} CompilationContextVariable\n * @property {string} name Name\n * @property {number} type Resolved variable type\n * @property {function(Object): *} [evaluator] Function used for evaluating the value; argument is the style variables object\n */\n\n/**\n * @typedef {Object} CompilationContext\n * @property {boolean} [inFragmentShader] If false, means the expression output should be made for a vertex shader\n * @property {Object} properties The values for properties used in 'get' expressions.\n * @property {Object} variables The values for variables used in 'var' expressions.\n * @property {Object} functions Lookup of functions used by the style.\n * @property {number} [bandCount] Number of bands per pixel.\n * @property {Array} [paletteTextures] List of palettes used by the style.\n * @property {import(\"../style/webgl.js\").WebGLStyle} style Literal style.\n */\n\n/**\n * @return {CompilationContext} A new compilation context.\n */\nexport function newCompilationContext() {\n return {\n inFragmentShader: false,\n variables: {},\n properties: {},\n functions: {},\n bandCount: 0,\n style: {},\n };\n}\n\nconst GET_BAND_VALUE_FUNC = 'getBandValue';\n\nexport const PALETTE_TEXTURE_ARRAY = 'u_paletteTextures';\n\n/**\n * @typedef {string} CompiledExpression\n */\n\n/**\n * @typedef {function(CompilationContext, CallExpression, number): string} Compiler\n * Third argument is the expected value types\n */\n\n/**\n * @param {import('./expression.js').EncodedExpression} encoded The encoded expression.\n * @param {number} type The expected type.\n * @param {import('./expression.js').ParsingContext} parsingContext The parsing context.\n * @param {CompilationContext} compilationContext An existing compilation context\n * @return {CompiledExpression} The compiled expression.\n */\nexport function buildExpression(\n encoded,\n type,\n parsingContext,\n compilationContext,\n) {\n const expression = parse(encoded, parsingContext, type);\n if (isType(expression.type, NoneType)) {\n throw new Error(`No matching type was found`);\n }\n if (!overlapsType(type, expression.type)) {\n const expected = typeName(type);\n const actual = typeName(expression.type);\n throw new Error(\n `Expected expression to be of type ${expected}, got ${actual}`,\n );\n }\n return compile(expression, type, compilationContext);\n}\n\n/**\n * @param {function(Array, CompilationContext): string} output Function that takes in parsed arguments and returns a string\n * @return {function(CompilationContext, import(\"./expression.js\").CallExpression, number): string} Compiler for the call expression\n */\nfunction createCompiler(output) {\n return (context, expression, type) => {\n const length = expression.args.length;\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compile(expression.args[i], type, context);\n }\n return output(args, context);\n };\n}\n\n/**\n * @type {Object}\n */\nconst compilers = {\n [Ops.Get]: (context, expression) => {\n const firstArg = /** @type {LiteralExpression} */ (expression.args[0]);\n const propName = /** @type {string} */ (firstArg.value);\n const isExisting = propName in context.properties;\n if (!isExisting) {\n context.properties[propName] = {\n name: propName,\n type: expression.type,\n };\n }\n const prefix = context.inFragmentShader ? 'v_prop_' : 'a_prop_';\n return prefix + propName;\n },\n [Ops.GeometryType]: (context, expression, type) => {\n const propName = 'geometryType';\n const isExisting = propName in context.properties;\n if (!isExisting) {\n context.properties[propName] = {\n name: propName,\n type: StringType,\n evaluator: (feature) => {\n return computeGeometryType(feature.getGeometry());\n },\n };\n }\n const prefix = context.inFragmentShader ? 'v_prop_' : 'a_prop_';\n return prefix + propName;\n },\n [Ops.Var]: (context, expression) => {\n const firstArg = /** @type {LiteralExpression} */ (expression.args[0]);\n const varName = /** @type {string} */ (firstArg.value);\n const isExisting = varName in context.variables;\n if (!isExisting) {\n context.variables[varName] = {\n name: varName,\n type: expression.type,\n };\n }\n return uniformNameForVariable(varName);\n },\n [Ops.Resolution]: () => 'u_resolution',\n [Ops.Zoom]: () => 'u_zoom',\n [Ops.Time]: () => 'u_time',\n [Ops.Any]: createCompiler((compiledArgs) => `(${compiledArgs.join(` || `)})`),\n [Ops.All]: createCompiler((compiledArgs) => `(${compiledArgs.join(` && `)})`),\n [Ops.Not]: createCompiler(([value]) => `(!${value})`),\n [Ops.Equal]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} == ${secondValue})`,\n ),\n [Ops.NotEqual]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} != ${secondValue})`,\n ),\n [Ops.GreaterThan]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} > ${secondValue})`,\n ),\n [Ops.GreaterThanOrEqualTo]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} >= ${secondValue})`,\n ),\n [Ops.LessThan]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} < ${secondValue})`,\n ),\n [Ops.LessThanOrEqualTo]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} <= ${secondValue})`,\n ),\n [Ops.Multiply]: createCompiler(\n (compiledArgs) => `(${compiledArgs.join(' * ')})`,\n ),\n [Ops.Divide]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} / ${secondValue})`,\n ),\n [Ops.Add]: createCompiler((compiledArgs) => `(${compiledArgs.join(' + ')})`),\n [Ops.Subtract]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} - ${secondValue})`,\n ),\n [Ops.Clamp]: createCompiler(\n ([value, min, max]) => `clamp(${value}, ${min}, ${max})`,\n ),\n [Ops.Mod]: createCompiler(([value, modulo]) => `mod(${value}, ${modulo})`),\n [Ops.Pow]: createCompiler(([value, power]) => `pow(${value}, ${power})`),\n [Ops.Abs]: createCompiler(([value]) => `abs(${value})`),\n [Ops.Floor]: createCompiler(([value]) => `floor(${value})`),\n [Ops.Ceil]: createCompiler(([value]) => `ceil(${value})`),\n [Ops.Round]: createCompiler(([value]) => `floor(${value} + 0.5)`),\n [Ops.Sin]: createCompiler(([value]) => `sin(${value})`),\n [Ops.Cos]: createCompiler(([value]) => `cos(${value})`),\n [Ops.Atan]: createCompiler(([firstValue, secondValue]) => {\n return secondValue !== undefined\n ? `atan(${firstValue}, ${secondValue})`\n : `atan(${firstValue})`;\n }),\n [Ops.Sqrt]: createCompiler(([value]) => `sqrt(${value})`),\n [Ops.Match]: createCompiler((compiledArgs) => {\n const input = compiledArgs[0];\n const fallback = compiledArgs[compiledArgs.length - 1];\n let result = null;\n for (let i = compiledArgs.length - 3; i >= 1; i -= 2) {\n const match = compiledArgs[i];\n const output = compiledArgs[i + 1];\n result = `(${input} == ${match} ? ${output} : ${result || fallback})`;\n }\n return result;\n }),\n [Ops.Between]: createCompiler(\n ([value, min, max]) => `(${value} >= ${min} && ${value} <= ${max})`,\n ),\n [Ops.Interpolate]: createCompiler(([exponent, input, ...compiledArgs]) => {\n let result = '';\n for (let i = 0; i < compiledArgs.length - 2; i += 2) {\n const stop1 = compiledArgs[i];\n const output1 = result || compiledArgs[i + 1];\n const stop2 = compiledArgs[i + 2];\n const output2 = compiledArgs[i + 3];\n let ratio;\n if (exponent === numberToGlsl(1)) {\n ratio = `(${input} - ${stop1}) / (${stop2} - ${stop1})`;\n } else {\n ratio = `(pow(${exponent}, (${input} - ${stop1})) - 1.0) / (pow(${exponent}, (${stop2} - ${stop1})) - 1.0)`;\n }\n result = `mix(${output1}, ${output2}, clamp(${ratio}, 0.0, 1.0))`;\n }\n return result;\n }),\n [Ops.Case]: createCompiler((compiledArgs) => {\n const fallback = compiledArgs[compiledArgs.length - 1];\n let result = null;\n for (let i = compiledArgs.length - 3; i >= 0; i -= 2) {\n const condition = compiledArgs[i];\n const output = compiledArgs[i + 1];\n result = `(${condition} ? ${output} : ${result || fallback})`;\n }\n return result;\n }),\n [Ops.In]: createCompiler(([needle, ...haystack], context) => {\n const funcName = computeOperatorFunctionName('in', context);\n const tests = [];\n for (let i = 0; i < haystack.length; i += 1) {\n tests.push(` if (inputValue == ${haystack[i]}) { return true; }`);\n }\n context.functions[funcName] = `bool ${funcName}(float inputValue) {\n${tests.join('\\n')}\n return false;\n}`;\n return `${funcName}(${needle})`;\n }),\n [Ops.Array]: createCompiler(\n (args) => `vec${args.length}(${args.join(', ')})`,\n ),\n [Ops.Color]: createCompiler((compiledArgs) => {\n if (compiledArgs.length === 1) {\n //grayscale\n return `vec4(vec3(${compiledArgs[0]} / 255.0), 1.0)`;\n }\n if (compiledArgs.length === 2) {\n //grayscale with alpha\n return `(${compiledArgs[1]} * vec4(vec3(${compiledArgs[0]} / 255.0), 1.0))`;\n }\n const rgb = compiledArgs.slice(0, 3).map((color) => `${color} / 255.0`);\n if (compiledArgs.length === 3) {\n return `vec4(${rgb.join(', ')}, 1.0)`;\n }\n const alpha = compiledArgs[3];\n return `(${alpha} * vec4(${rgb.join(', ')}, 1.0))`;\n }),\n [Ops.Band]: createCompiler(([band, xOffset, yOffset], context) => {\n if (!(GET_BAND_VALUE_FUNC in context.functions)) {\n let ifBlocks = '';\n const bandCount = context.bandCount || 1;\n for (let i = 0; i < bandCount; i++) {\n const colorIndex = Math.floor(i / 4);\n let bandIndex = i % 4;\n if (i === bandCount - 1 && bandIndex === 1) {\n // LUMINANCE_ALPHA - band 1 assigned to rgb and band 2 assigned to alpha\n bandIndex = 3;\n }\n const textureName = `${Uniforms.TILE_TEXTURE_ARRAY}[${colorIndex}]`;\n ifBlocks += ` if (band == ${i + 1}.0) {\n return texture2D(${textureName}, v_textureCoord + vec2(dx, dy))[${bandIndex}];\n }\n`;\n }\n\n context.functions[GET_BAND_VALUE_FUNC] =\n `float getBandValue(float band, float xOffset, float yOffset) {\n float dx = xOffset / ${Uniforms.TEXTURE_PIXEL_WIDTH};\n float dy = yOffset / ${Uniforms.TEXTURE_PIXEL_HEIGHT};\n${ifBlocks}\n}`;\n }\n\n return `${GET_BAND_VALUE_FUNC}(${band}, ${xOffset ?? '0.0'}, ${\n yOffset ?? '0.0'\n })`;\n }),\n [Ops.Palette]: (context, expression) => {\n const [index, ...colors] = expression.args;\n const numColors = colors.length;\n const palette = new Uint8Array(numColors * 4);\n for (let i = 0; i < colors.length; i++) {\n const parsedValue = /** @type {string | Array} */ (\n /** @type {LiteralExpression} */ (colors[i]).value\n );\n const color = asArray(parsedValue);\n const offset = i * 4;\n palette[offset] = color[0];\n palette[offset + 1] = color[1];\n palette[offset + 2] = color[2];\n palette[offset + 3] = color[3] * 255;\n }\n if (!context.paletteTextures) {\n context.paletteTextures = [];\n }\n const paletteName = `${PALETTE_TEXTURE_ARRAY}[${context.paletteTextures.length}]`;\n const paletteTexture = new PaletteTexture(paletteName, palette);\n context.paletteTextures.push(paletteTexture);\n const compiledIndex = compile(index, NumberType, context);\n return `texture2D(${paletteName}, vec2((${compiledIndex} + 0.5) / ${numColors}.0, 0.5))`;\n },\n // TODO: unimplemented\n // Ops.Number\n // Ops.String\n // Ops.Coalesce\n // Ops.Concat\n // Ops.ToString\n};\n\n/**\n * @param {Expression} expression The expression.\n * @param {number} returnType The expected return type.\n * @param {CompilationContext} context The compilation context.\n * @return {CompiledExpression} The compiled expression\n */\nfunction compile(expression, returnType, context) {\n // operator\n if (expression instanceof CallExpression) {\n const compiler = compilers[expression.operator];\n if (compiler === undefined) {\n throw new Error(\n `No compiler defined for this operator: ${JSON.stringify(\n expression.operator,\n )}`,\n );\n }\n return compiler(context, expression, returnType);\n }\n\n if ((expression.type & NumberType) > 0) {\n return numberToGlsl(/** @type {number} */ (expression.value));\n }\n\n if ((expression.type & BooleanType) > 0) {\n return expression.value.toString();\n }\n\n if ((expression.type & StringType) > 0) {\n return stringToGlsl(expression.value.toString());\n }\n\n if ((expression.type & ColorType) > 0) {\n return colorToGlsl(\n /** @type {Array | string} */ (expression.value),\n );\n }\n\n if ((expression.type & NumberArrayType) > 0) {\n return arrayToGlsl(/** @type {Array} */ (expression.value));\n }\n\n if ((expression.type & SizeType) > 0) {\n return sizeToGlsl(\n /** @type {number|import('../size.js').Size} */ (expression.value),\n );\n }\n\n throw new Error(\n `Unexpected expression ${expression.value} (expected type ${typeName(\n returnType,\n )})`,\n );\n}\n","/**\n * @module ol/extent\n */\nimport Relationship from './extent/Relationship.js';\n\n/**\n * An array of numbers representing an extent: `[minx, miny, maxx, maxy]`.\n * @typedef {Array} Extent\n * @api\n */\n\n/**\n * Extent corner.\n * @typedef {'bottom-left' | 'bottom-right' | 'top-left' | 'top-right'} Corner\n */\n\n/**\n * Build an extent that includes all given coordinates.\n *\n * @param {Array} coordinates Coordinates.\n * @return {Extent} Bounding extent.\n * @api\n */\nexport function boundingExtent(coordinates) {\n const extent = createEmpty();\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n extendCoordinate(extent, coordinates[i]);\n }\n return extent;\n}\n\n/**\n * @param {Array} xs Xs.\n * @param {Array} ys Ys.\n * @param {Extent} [dest] Destination extent.\n * @private\n * @return {Extent} Extent.\n */\nfunction _boundingExtentXYs(xs, ys, dest) {\n const minX = Math.min.apply(null, xs);\n const minY = Math.min.apply(null, ys);\n const maxX = Math.max.apply(null, xs);\n const maxY = Math.max.apply(null, ys);\n return createOrUpdate(minX, minY, maxX, maxY, dest);\n}\n\n/**\n * Return extent increased by the provided value.\n * @param {Extent} extent Extent.\n * @param {number} value The amount by which the extent should be buffered.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n * @api\n */\nexport function buffer(extent, value, dest) {\n if (dest) {\n dest[0] = extent[0] - value;\n dest[1] = extent[1] - value;\n dest[2] = extent[2] + value;\n dest[3] = extent[3] + value;\n return dest;\n }\n return [\n extent[0] - value,\n extent[1] - value,\n extent[2] + value,\n extent[3] + value,\n ];\n}\n\n/**\n * Creates a clone of an extent.\n *\n * @param {Extent} extent Extent to clone.\n * @param {Extent} [dest] Extent.\n * @return {Extent} The clone.\n */\nexport function clone(extent, dest) {\n if (dest) {\n dest[0] = extent[0];\n dest[1] = extent[1];\n dest[2] = extent[2];\n dest[3] = extent[3];\n return dest;\n }\n return extent.slice();\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {number} x X.\n * @param {number} y Y.\n * @return {number} Closest squared distance.\n */\nexport function closestSquaredDistanceXY(extent, x, y) {\n let dx, dy;\n if (x < extent[0]) {\n dx = extent[0] - x;\n } else if (extent[2] < x) {\n dx = x - extent[2];\n } else {\n dx = 0;\n }\n if (y < extent[1]) {\n dy = extent[1] - y;\n } else if (extent[3] < y) {\n dy = y - extent[3];\n } else {\n dy = 0;\n }\n return dx * dx + dy * dy;\n}\n\n/**\n * Check if the passed coordinate is contained or on the edge of the extent.\n *\n * @param {Extent} extent Extent.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @return {boolean} The coordinate is contained in the extent.\n * @api\n */\nexport function containsCoordinate(extent, coordinate) {\n return containsXY(extent, coordinate[0], coordinate[1]);\n}\n\n/**\n * Check if one extent contains another.\n *\n * An extent is deemed contained if it lies completely within the other extent,\n * including if they share one or more edges.\n *\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {boolean} The second extent is contained by or on the edge of the\n * first.\n * @api\n */\nexport function containsExtent(extent1, extent2) {\n return (\n extent1[0] <= extent2[0] &&\n extent2[2] <= extent1[2] &&\n extent1[1] <= extent2[1] &&\n extent2[3] <= extent1[3]\n );\n}\n\n/**\n * Check if the passed coordinate is contained or on the edge of the extent.\n *\n * @param {Extent} extent Extent.\n * @param {number} x X coordinate.\n * @param {number} y Y coordinate.\n * @return {boolean} The x, y values are contained in the extent.\n * @api\n */\nexport function containsXY(extent, x, y) {\n return extent[0] <= x && x <= extent[2] && extent[1] <= y && y <= extent[3];\n}\n\n/**\n * Get the relationship between a coordinate and extent.\n * @param {Extent} extent The extent.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate The coordinate.\n * @return {import(\"./extent/Relationship.js\").default} The relationship (bitwise compare with\n * import(\"./extent/Relationship.js\").Relationship).\n */\nexport function coordinateRelationship(extent, coordinate) {\n const minX = extent[0];\n const minY = extent[1];\n const maxX = extent[2];\n const maxY = extent[3];\n const x = coordinate[0];\n const y = coordinate[1];\n let relationship = Relationship.UNKNOWN;\n if (x < minX) {\n relationship = relationship | Relationship.LEFT;\n } else if (x > maxX) {\n relationship = relationship | Relationship.RIGHT;\n }\n if (y < minY) {\n relationship = relationship | Relationship.BELOW;\n } else if (y > maxY) {\n relationship = relationship | Relationship.ABOVE;\n }\n if (relationship === Relationship.UNKNOWN) {\n relationship = Relationship.INTERSECTING;\n }\n return relationship;\n}\n\n/**\n * Create an empty extent.\n * @return {Extent} Empty extent.\n * @api\n */\nexport function createEmpty() {\n return [Infinity, Infinity, -Infinity, -Infinity];\n}\n\n/**\n * Create a new extent or update the provided extent.\n * @param {number} minX Minimum X.\n * @param {number} minY Minimum Y.\n * @param {number} maxX Maximum X.\n * @param {number} maxY Maximum Y.\n * @param {Extent} [dest] Destination extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdate(minX, minY, maxX, maxY, dest) {\n if (dest) {\n dest[0] = minX;\n dest[1] = minY;\n dest[2] = maxX;\n dest[3] = maxY;\n return dest;\n }\n return [minX, minY, maxX, maxY];\n}\n\n/**\n * Create a new empty extent or make the provided one empty.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateEmpty(dest) {\n return createOrUpdate(Infinity, Infinity, -Infinity, -Infinity, dest);\n}\n\n/**\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromCoordinate(coordinate, dest) {\n const x = coordinate[0];\n const y = coordinate[1];\n return createOrUpdate(x, y, x, y, dest);\n}\n\n/**\n * @param {Array} coordinates Coordinates.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromCoordinates(coordinates, dest) {\n const extent = createOrUpdateEmpty(dest);\n return extendCoordinates(extent, coordinates);\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromFlatCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n dest,\n) {\n const extent = createOrUpdateEmpty(dest);\n return extendFlatCoordinates(extent, flatCoordinates, offset, end, stride);\n}\n\n/**\n * @param {Array>} rings Rings.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromRings(rings, dest) {\n const extent = createOrUpdateEmpty(dest);\n return extendRings(extent, rings);\n}\n\n/**\n * Determine if two extents are equivalent.\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {boolean} The two extents are equivalent.\n * @api\n */\nexport function equals(extent1, extent2) {\n return (\n extent1[0] == extent2[0] &&\n extent1[2] == extent2[2] &&\n extent1[1] == extent2[1] &&\n extent1[3] == extent2[3]\n );\n}\n\n/**\n * Determine if two extents are approximately equivalent.\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @param {number} tolerance Tolerance in extent coordinate units.\n * @return {boolean} The two extents differ by less than the tolerance.\n */\nexport function approximatelyEquals(extent1, extent2, tolerance) {\n return (\n Math.abs(extent1[0] - extent2[0]) < tolerance &&\n Math.abs(extent1[2] - extent2[2]) < tolerance &&\n Math.abs(extent1[1] - extent2[1]) < tolerance &&\n Math.abs(extent1[3] - extent2[3]) < tolerance\n );\n}\n\n/**\n * Modify an extent to include another extent.\n * @param {Extent} extent1 The extent to be modified.\n * @param {Extent} extent2 The extent that will be included in the first.\n * @return {Extent} A reference to the first (extended) extent.\n * @api\n */\nexport function extend(extent1, extent2) {\n if (extent2[0] < extent1[0]) {\n extent1[0] = extent2[0];\n }\n if (extent2[2] > extent1[2]) {\n extent1[2] = extent2[2];\n }\n if (extent2[1] < extent1[1]) {\n extent1[1] = extent2[1];\n }\n if (extent2[3] > extent1[3]) {\n extent1[3] = extent2[3];\n }\n return extent1;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n */\nexport function extendCoordinate(extent, coordinate) {\n if (coordinate[0] < extent[0]) {\n extent[0] = coordinate[0];\n }\n if (coordinate[0] > extent[2]) {\n extent[2] = coordinate[0];\n }\n if (coordinate[1] < extent[1]) {\n extent[1] = coordinate[1];\n }\n if (coordinate[1] > extent[3]) {\n extent[3] = coordinate[1];\n }\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {Array} coordinates Coordinates.\n * @return {Extent} Extent.\n */\nexport function extendCoordinates(extent, coordinates) {\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n extendCoordinate(extent, coordinates[i]);\n }\n return extent;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {Extent} Extent.\n */\nexport function extendFlatCoordinates(\n extent,\n flatCoordinates,\n offset,\n end,\n stride,\n) {\n for (; offset < end; offset += stride) {\n extendXY(extent, flatCoordinates[offset], flatCoordinates[offset + 1]);\n }\n return extent;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {Array>} rings Rings.\n * @return {Extent} Extent.\n */\nexport function extendRings(extent, rings) {\n for (let i = 0, ii = rings.length; i < ii; ++i) {\n extendCoordinates(extent, rings[i]);\n }\n return extent;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {number} x X.\n * @param {number} y Y.\n */\nexport function extendXY(extent, x, y) {\n extent[0] = Math.min(extent[0], x);\n extent[1] = Math.min(extent[1], y);\n extent[2] = Math.max(extent[2], x);\n extent[3] = Math.max(extent[3], y);\n}\n\n/**\n * This function calls `callback` for each corner of the extent. If the\n * callback returns a truthy value the function returns that value\n * immediately. Otherwise the function returns `false`.\n * @param {Extent} extent Extent.\n * @param {function(import(\"./coordinate.js\").Coordinate): S} callback Callback.\n * @return {S|boolean} Value.\n * @template S\n */\nexport function forEachCorner(extent, callback) {\n let val;\n val = callback(getBottomLeft(extent));\n if (val) {\n return val;\n }\n val = callback(getBottomRight(extent));\n if (val) {\n return val;\n }\n val = callback(getTopRight(extent));\n if (val) {\n return val;\n }\n val = callback(getTopLeft(extent));\n if (val) {\n return val;\n }\n return false;\n}\n\n/**\n * Get the size of an extent.\n * @param {Extent} extent Extent.\n * @return {number} Area.\n * @api\n */\nexport function getArea(extent) {\n let area = 0;\n if (!isEmpty(extent)) {\n area = getWidth(extent) * getHeight(extent);\n }\n return area;\n}\n\n/**\n * Get the bottom left coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Bottom left coordinate.\n * @api\n */\nexport function getBottomLeft(extent) {\n return [extent[0], extent[1]];\n}\n\n/**\n * Get the bottom right coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Bottom right coordinate.\n * @api\n */\nexport function getBottomRight(extent) {\n return [extent[2], extent[1]];\n}\n\n/**\n * Get the center coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Center.\n * @api\n */\nexport function getCenter(extent) {\n return [(extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2];\n}\n\n/**\n * Get a corner coordinate of an extent.\n * @param {Extent} extent Extent.\n * @param {Corner} corner Corner.\n * @return {import(\"./coordinate.js\").Coordinate} Corner coordinate.\n */\nexport function getCorner(extent, corner) {\n let coordinate;\n if (corner === 'bottom-left') {\n coordinate = getBottomLeft(extent);\n } else if (corner === 'bottom-right') {\n coordinate = getBottomRight(extent);\n } else if (corner === 'top-left') {\n coordinate = getTopLeft(extent);\n } else if (corner === 'top-right') {\n coordinate = getTopRight(extent);\n } else {\n throw new Error('Invalid corner');\n }\n return coordinate;\n}\n\n/**\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {number} Enlarged area.\n */\nexport function getEnlargedArea(extent1, extent2) {\n const minX = Math.min(extent1[0], extent2[0]);\n const minY = Math.min(extent1[1], extent2[1]);\n const maxX = Math.max(extent1[2], extent2[2]);\n const maxY = Math.max(extent1[3], extent2[3]);\n return (maxX - minX) * (maxY - minY);\n}\n\n/**\n * @param {import(\"./coordinate.js\").Coordinate} center Center.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @param {import(\"./size.js\").Size} size Size.\n * @param {Extent} [dest] Destination extent.\n * @return {Extent} Extent.\n */\nexport function getForViewAndSize(center, resolution, rotation, size, dest) {\n const [x0, y0, x1, y1, x2, y2, x3, y3] = getRotatedViewport(\n center,\n resolution,\n rotation,\n size,\n );\n return createOrUpdate(\n Math.min(x0, x1, x2, x3),\n Math.min(y0, y1, y2, y3),\n Math.max(x0, x1, x2, x3),\n Math.max(y0, y1, y2, y3),\n dest,\n );\n}\n\n/**\n * @param {import(\"./coordinate.js\").Coordinate} center Center.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @param {import(\"./size.js\").Size} size Size.\n * @return {Array} Linear ring representing the viewport.\n */\nexport function getRotatedViewport(center, resolution, rotation, size) {\n const dx = (resolution * size[0]) / 2;\n const dy = (resolution * size[1]) / 2;\n const cosRotation = Math.cos(rotation);\n const sinRotation = Math.sin(rotation);\n const xCos = dx * cosRotation;\n const xSin = dx * sinRotation;\n const yCos = dy * cosRotation;\n const ySin = dy * sinRotation;\n const x = center[0];\n const y = center[1];\n return [\n x - xCos + ySin,\n y - xSin - yCos,\n x - xCos - ySin,\n y - xSin + yCos,\n x + xCos - ySin,\n y + xSin + yCos,\n x + xCos + ySin,\n y + xSin - yCos,\n x - xCos + ySin,\n y - xSin - yCos,\n ];\n}\n\n/**\n * Get the height of an extent.\n * @param {Extent} extent Extent.\n * @return {number} Height.\n * @api\n */\nexport function getHeight(extent) {\n return extent[3] - extent[1];\n}\n\n/**\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {number} Intersection area.\n */\nexport function getIntersectionArea(extent1, extent2) {\n const intersection = getIntersection(extent1, extent2);\n return getArea(intersection);\n}\n\n/**\n * Get the intersection of two extents.\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @param {Extent} [dest] Optional extent to populate with intersection.\n * @return {Extent} Intersecting extent.\n * @api\n */\nexport function getIntersection(extent1, extent2, dest) {\n const intersection = dest ? dest : createEmpty();\n if (intersects(extent1, extent2)) {\n if (extent1[0] > extent2[0]) {\n intersection[0] = extent1[0];\n } else {\n intersection[0] = extent2[0];\n }\n if (extent1[1] > extent2[1]) {\n intersection[1] = extent1[1];\n } else {\n intersection[1] = extent2[1];\n }\n if (extent1[2] < extent2[2]) {\n intersection[2] = extent1[2];\n } else {\n intersection[2] = extent2[2];\n }\n if (extent1[3] < extent2[3]) {\n intersection[3] = extent1[3];\n } else {\n intersection[3] = extent2[3];\n }\n } else {\n createOrUpdateEmpty(intersection);\n }\n return intersection;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @return {number} Margin.\n */\nexport function getMargin(extent) {\n return getWidth(extent) + getHeight(extent);\n}\n\n/**\n * Get the size (width, height) of an extent.\n * @param {Extent} extent The extent.\n * @return {import(\"./size.js\").Size} The extent size.\n * @api\n */\nexport function getSize(extent) {\n return [extent[2] - extent[0], extent[3] - extent[1]];\n}\n\n/**\n * Get the top left coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Top left coordinate.\n * @api\n */\nexport function getTopLeft(extent) {\n return [extent[0], extent[3]];\n}\n\n/**\n * Get the top right coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Top right coordinate.\n * @api\n */\nexport function getTopRight(extent) {\n return [extent[2], extent[3]];\n}\n\n/**\n * Get the width of an extent.\n * @param {Extent} extent Extent.\n * @return {number} Width.\n * @api\n */\nexport function getWidth(extent) {\n return extent[2] - extent[0];\n}\n\n/**\n * Determine if one extent intersects another.\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent.\n * @return {boolean} The two extents intersect.\n * @api\n */\nexport function intersects(extent1, extent2) {\n return (\n extent1[0] <= extent2[2] &&\n extent1[2] >= extent2[0] &&\n extent1[1] <= extent2[3] &&\n extent1[3] >= extent2[1]\n );\n}\n\n/**\n * Determine if an extent is empty.\n * @param {Extent} extent Extent.\n * @return {boolean} Is empty.\n * @api\n */\nexport function isEmpty(extent) {\n return extent[2] < extent[0] || extent[3] < extent[1];\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function returnOrUpdate(extent, dest) {\n if (dest) {\n dest[0] = extent[0];\n dest[1] = extent[1];\n dest[2] = extent[2];\n dest[3] = extent[3];\n return dest;\n }\n return extent;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {number} value Value.\n */\nexport function scaleFromCenter(extent, value) {\n const deltaX = ((extent[2] - extent[0]) / 2) * (value - 1);\n const deltaY = ((extent[3] - extent[1]) / 2) * (value - 1);\n extent[0] -= deltaX;\n extent[2] += deltaX;\n extent[1] -= deltaY;\n extent[3] += deltaY;\n}\n\n/**\n * Determine if the segment between two coordinates intersects (crosses,\n * touches, or is contained by) the provided extent.\n * @param {Extent} extent The extent.\n * @param {import(\"./coordinate.js\").Coordinate} start Segment start coordinate.\n * @param {import(\"./coordinate.js\").Coordinate} end Segment end coordinate.\n * @return {boolean} The segment intersects the extent.\n */\nexport function intersectsSegment(extent, start, end) {\n let intersects = false;\n const startRel = coordinateRelationship(extent, start);\n const endRel = coordinateRelationship(extent, end);\n if (\n startRel === Relationship.INTERSECTING ||\n endRel === Relationship.INTERSECTING\n ) {\n intersects = true;\n } else {\n const minX = extent[0];\n const minY = extent[1];\n const maxX = extent[2];\n const maxY = extent[3];\n const startX = start[0];\n const startY = start[1];\n const endX = end[0];\n const endY = end[1];\n const slope = (endY - startY) / (endX - startX);\n let x, y;\n if (!!(endRel & Relationship.ABOVE) && !(startRel & Relationship.ABOVE)) {\n // potentially intersects top\n x = endX - (endY - maxY) / slope;\n intersects = x >= minX && x <= maxX;\n }\n if (\n !intersects &&\n !!(endRel & Relationship.RIGHT) &&\n !(startRel & Relationship.RIGHT)\n ) {\n // potentially intersects right\n y = endY - (endX - maxX) * slope;\n intersects = y >= minY && y <= maxY;\n }\n if (\n !intersects &&\n !!(endRel & Relationship.BELOW) &&\n !(startRel & Relationship.BELOW)\n ) {\n // potentially intersects bottom\n x = endX - (endY - minY) / slope;\n intersects = x >= minX && x <= maxX;\n }\n if (\n !intersects &&\n !!(endRel & Relationship.LEFT) &&\n !(startRel & Relationship.LEFT)\n ) {\n // potentially intersects left\n y = endY - (endX - minX) * slope;\n intersects = y >= minY && y <= maxY;\n }\n }\n return intersects;\n}\n\n/**\n * Apply a transform function to the extent.\n * @param {Extent} extent Extent.\n * @param {import(\"./proj.js\").TransformFunction} transformFn Transform function.\n * Called with `[minX, minY, maxX, maxY]` extent coordinates.\n * @param {Extent} [dest] Destination extent.\n * @param {number} [stops] Number of stops per side used for the transform.\n * By default only the corners are used.\n * @return {Extent} Extent.\n * @api\n */\nexport function applyTransform(extent, transformFn, dest, stops) {\n if (isEmpty(extent)) {\n return createOrUpdateEmpty(dest);\n }\n let coordinates = [];\n if (stops > 1) {\n const width = extent[2] - extent[0];\n const height = extent[3] - extent[1];\n for (let i = 0; i < stops; ++i) {\n coordinates.push(\n extent[0] + (width * i) / stops,\n extent[1],\n extent[2],\n extent[1] + (height * i) / stops,\n extent[2] - (width * i) / stops,\n extent[3],\n extent[0],\n extent[3] - (height * i) / stops,\n );\n }\n } else {\n coordinates = [\n extent[0],\n extent[1],\n extent[2],\n extent[1],\n extent[2],\n extent[3],\n extent[0],\n extent[3],\n ];\n }\n transformFn(coordinates, coordinates, 2);\n const xs = [];\n const ys = [];\n for (let i = 0, l = coordinates.length; i < l; i += 2) {\n xs.push(coordinates[i]);\n ys.push(coordinates[i + 1]);\n }\n return _boundingExtentXYs(xs, ys, dest);\n}\n\n/**\n * Modifies the provided extent in-place to be within the real world\n * extent.\n *\n * @param {Extent} extent Extent.\n * @param {import(\"./proj/Projection.js\").default} projection Projection\n * @return {Extent} The extent within the real world extent.\n */\nexport function wrapX(extent, projection) {\n const projectionExtent = projection.getExtent();\n const center = getCenter(extent);\n if (\n projection.canWrapX() &&\n (center[0] < projectionExtent[0] || center[0] >= projectionExtent[2])\n ) {\n const worldWidth = getWidth(projectionExtent);\n const worldsAway = Math.floor(\n (center[0] - projectionExtent[0]) / worldWidth,\n );\n const offset = worldsAway * worldWidth;\n extent[0] -= offset;\n extent[2] -= offset;\n }\n return extent;\n}\n\n/**\n * Fits the extent to the real world\n *\n * If the extent does not cross the anti meridian, this will return the extent in an array\n * If the extent crosses the anti meridian, the extent will be sliced, so each part fits within the\n * real world\n *\n *\n * @param {Extent} extent Extent.\n * @param {import(\"./proj/Projection.js\").default} projection Projection\n * @param {boolean} [multiWorld] Return all worlds\n * @return {Array} The extent within the real world extent.\n */\nexport function wrapAndSliceX(extent, projection, multiWorld) {\n if (projection.canWrapX()) {\n const projectionExtent = projection.getExtent();\n\n if (!isFinite(extent[0]) || !isFinite(extent[2])) {\n return [[projectionExtent[0], extent[1], projectionExtent[2], extent[3]]];\n }\n\n wrapX(extent, projection);\n const worldWidth = getWidth(projectionExtent);\n\n if (getWidth(extent) > worldWidth && !multiWorld) {\n // the extent wraps around on itself\n return [[projectionExtent[0], extent[1], projectionExtent[2], extent[3]]];\n }\n if (extent[0] < projectionExtent[0]) {\n // the extent crosses the anti meridian, so it needs to be sliced\n return [\n [extent[0] + worldWidth, extent[1], projectionExtent[2], extent[3]],\n [projectionExtent[0], extent[1], extent[2], extent[3]],\n ];\n }\n if (extent[2] > projectionExtent[2]) {\n // the extent crosses the anti meridian, so it needs to be sliced\n return [\n [extent[0], extent[1], projectionExtent[2], extent[3]],\n [projectionExtent[0], extent[1], extent[2] - worldWidth, extent[3]],\n ];\n }\n }\n\n return [extent];\n}\n","/**\n * @module ol/extent/Relationship\n */\n\n/**\n * Relationship to an extent.\n * @enum {number}\n */\nexport default {\n UNKNOWN: 0,\n INTERSECTING: 1,\n ABOVE: 2,\n RIGHT: 4,\n BELOW: 8,\n LEFT: 16,\n};\n","/**\n * @module ol/featureloader\n */\nimport {VOID} from './functions.js';\n\n/**\n *\n * @type {boolean}\n * @private\n */\nlet withCredentials = false;\n\n/**\n * {@link module:ol/source/Vector~VectorSource} sources use a function of this type to\n * load features.\n *\n * This function takes up to 5 arguments. These are an {@link module:ol/extent~Extent} representing\n * the area to be loaded, a `{number}` representing the resolution (map units per pixel), an\n * {@link module:ol/proj/Projection~Projection} for the projection, an optional success callback that should get\n * the loaded features passed as an argument and an optional failure callback with no arguments. If\n * the callbacks are not used, the corresponding vector source will not fire `'featuresloadend'` and\n * `'featuresloaderror'` events. `this` within the function is bound to the\n * {@link module:ol/source/Vector~VectorSource} it's called from.\n *\n * The function is responsible for loading the features and adding them to the\n * source.\n *\n * @template {import(\"./Feature.js\").FeatureLike} [FeatureType=import(\"./Feature.js\").default]\n * @typedef {function(this:(import(\"./source/Vector\").default|import(\"./VectorTile.js\").default),\n * import(\"./extent.js\").Extent,\n * number,\n * import(\"./proj/Projection.js\").default,\n * function(Array): void=,\n * function(): void=): void} FeatureLoader\n * @api\n */\n\n/**\n * {@link module:ol/source/Vector~VectorSource} sources use a function of this type to\n * get the url to load features from.\n *\n * This function takes an {@link module:ol/extent~Extent} representing the area\n * to be loaded, a `{number}` representing the resolution (map units per pixel)\n * and an {@link module:ol/proj/Projection~Projection} for the projection as\n * arguments and returns a `{string}` representing the URL.\n * @typedef {function(import(\"./extent.js\").Extent, number, import(\"./proj/Projection.js\").default): string} FeatureUrlFunction\n * @api\n */\n\n/**\n * @template {import(\"./Feature.js\").FeatureLike} [FeatureType=import(\"./Feature.js\").FeatureLike]\n * @param {string|FeatureUrlFunction} url Feature URL service.\n * @param {import(\"./format/Feature.js\").default>} format Feature format.\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @param {function(Array, import(\"./proj/Projection.js\").default): void} success Success\n * Function called with the loaded features and optionally with the data projection.\n * @param {function(): void} failure Failure\n * Function called when loading failed.\n */\nexport function loadFeaturesXhr(\n url,\n format,\n extent,\n resolution,\n projection,\n success,\n failure,\n) {\n const xhr = new XMLHttpRequest();\n xhr.open(\n 'GET',\n typeof url === 'function' ? url(extent, resolution, projection) : url,\n true,\n );\n if (format.getType() == 'arraybuffer') {\n xhr.responseType = 'arraybuffer';\n }\n xhr.withCredentials = withCredentials;\n /**\n * @param {Event} event Event.\n * @private\n */\n xhr.onload = function (event) {\n // status will be 0 for file:// urls\n if (!xhr.status || (xhr.status >= 200 && xhr.status < 300)) {\n const type = format.getType();\n try {\n /** @type {Document|Node|Object|string|undefined} */\n let source;\n if (type == 'text' || type == 'json') {\n source = xhr.responseText;\n } else if (type == 'xml') {\n source = xhr.responseXML || xhr.responseText;\n } else if (type == 'arraybuffer') {\n source = /** @type {ArrayBuffer} */ (xhr.response);\n }\n if (source) {\n success(\n /** @type {Array} */\n (\n format.readFeatures(source, {\n extent: extent,\n featureProjection: projection,\n })\n ),\n format.readProjection(source),\n );\n } else {\n failure();\n }\n } catch {\n failure();\n }\n } else {\n failure();\n }\n };\n /**\n * @private\n */\n xhr.onerror = failure;\n xhr.send();\n}\n\n/**\n * Create an XHR feature loader for a `url` and `format`. The feature loader\n * loads features (with XHR), parses the features, and adds them to the\n * vector source.\n * @template {import(\"./Feature.js\").FeatureLike} [FeatureType=import(\"./Feature.js\").FeatureLike]\n * @param {string|FeatureUrlFunction} url Feature URL service.\n * @param {import(\"./format/Feature.js\").default>} format Feature format.\n * @return {FeatureLoader} The feature loader.\n * @api\n */\nexport function xhr(url, format) {\n /**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @param {function(Array): void} [success] Success\n * Function called when loading succeeded.\n * @param {function(): void} [failure] Failure\n * Function called when loading failed.\n */\n return function (extent, resolution, projection, success, failure) {\n const source =\n /** @type {import(\"./source/Vector\").default} */ (this);\n loadFeaturesXhr(\n url,\n format,\n extent,\n resolution,\n projection,\n /**\n * @param {Array} features The loaded features.\n * @param {import(\"./proj/Projection.js\").default} dataProjection Data\n * projection.\n */\n function (features, dataProjection) {\n source.addFeatures(features);\n if (success !== undefined) {\n success(features);\n }\n },\n /* FIXME handle error */ failure ? failure : VOID,\n );\n };\n}\n\n/**\n * Setter for the withCredentials configuration for the XHR.\n *\n * @param {boolean} xhrWithCredentials The value of withCredentials to set.\n * Compare https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/\n * @api\n */\nexport function setWithCredentials(xhrWithCredentials) {\n withCredentials = xhrWithCredentials;\n}\n","/**\n * @module ol/geom/GeometryCollection\n */\nimport EventType from '../events/EventType.js';\nimport Geometry from './Geometry.js';\nimport {\n closestSquaredDistanceXY,\n createOrUpdateEmpty,\n extend,\n getCenter,\n} from '../extent.js';\nimport {listen, unlistenByKey} from '../events.js';\n\n/**\n * @classdesc\n * An array of {@link module:ol/geom/Geometry~Geometry} objects.\n *\n * @api\n */\nclass GeometryCollection extends Geometry {\n /**\n * @param {Array} geometries Geometries.\n */\n constructor(geometries) {\n super();\n\n /**\n * @private\n * @type {Array}\n */\n this.geometries_ = geometries;\n\n /**\n * @type {Array}\n */\n this.changeEventsKeys_ = [];\n\n this.listenGeometriesChange_();\n }\n\n /**\n * @private\n */\n unlistenGeometriesChange_() {\n this.changeEventsKeys_.forEach(unlistenByKey);\n this.changeEventsKeys_.length = 0;\n }\n\n /**\n * @private\n */\n listenGeometriesChange_() {\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n this.changeEventsKeys_.push(\n listen(geometries[i], EventType.CHANGE, this.changed, this),\n );\n }\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!GeometryCollection} Clone.\n * @api\n */\n clone() {\n const geometryCollection = new GeometryCollection(\n cloneGeometries(this.geometries_),\n );\n geometryCollection.applyProperties(this);\n return geometryCollection;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n minSquaredDistance = geometries[i].closestPointXY(\n x,\n y,\n closestPoint,\n minSquaredDistance,\n );\n }\n return minSquaredDistance;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\n containsXY(x, y) {\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n if (geometries[i].containsXY(x, y)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @protected\n * @return {import(\"../extent.js\").Extent} extent Extent.\n */\n computeExtent(extent) {\n createOrUpdateEmpty(extent);\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n extend(extent, geometries[i].getExtent());\n }\n return extent;\n }\n\n /**\n * Return the geometries that make up this geometry collection.\n * @return {Array} Geometries.\n * @api\n */\n getGeometries() {\n return cloneGeometries(this.geometries_);\n }\n\n /**\n * @return {Array} Geometries.\n */\n getGeometriesArray() {\n return this.geometries_;\n }\n\n /**\n * @return {Array} Geometries.\n */\n getGeometriesArrayRecursive() {\n /** @type {Array} */\n let geometriesArray = [];\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n if (geometries[i].getType() === this.getType()) {\n geometriesArray = geometriesArray.concat(\n /** @type {GeometryCollection} */ (\n geometries[i]\n ).getGeometriesArrayRecursive(),\n );\n } else {\n geometriesArray.push(geometries[i]);\n }\n }\n return geometriesArray;\n }\n\n /**\n * Create a simplified version of this geometry using the Douglas Peucker algorithm.\n * @param {number} squaredTolerance Squared tolerance.\n * @return {GeometryCollection} Simplified GeometryCollection.\n */\n getSimplifiedGeometry(squaredTolerance) {\n if (this.simplifiedGeometryRevision !== this.getRevision()) {\n this.simplifiedGeometryMaxMinSquaredTolerance = 0;\n this.simplifiedGeometryRevision = this.getRevision();\n }\n if (\n squaredTolerance < 0 ||\n (this.simplifiedGeometryMaxMinSquaredTolerance !== 0 &&\n squaredTolerance < this.simplifiedGeometryMaxMinSquaredTolerance)\n ) {\n return this;\n }\n\n const simplifiedGeometries = [];\n const geometries = this.geometries_;\n let simplified = false;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n const geometry = geometries[i];\n const simplifiedGeometry =\n geometry.getSimplifiedGeometry(squaredTolerance);\n simplifiedGeometries.push(simplifiedGeometry);\n if (simplifiedGeometry !== geometry) {\n simplified = true;\n }\n }\n if (simplified) {\n const simplifiedGeometryCollection = new GeometryCollection(\n simplifiedGeometries,\n );\n return simplifiedGeometryCollection;\n }\n this.simplifiedGeometryMaxMinSquaredTolerance = squaredTolerance;\n return this;\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n */\n getType() {\n return 'GeometryCollection';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n */\n intersectsExtent(extent) {\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n if (geometries[i].intersectsExtent(extent)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @return {boolean} Is empty.\n */\n isEmpty() {\n return this.geometries_.length === 0;\n }\n\n /**\n * Rotate the geometry around a given coordinate. This modifies the geometry\n * coordinates in place.\n * @param {number} angle Rotation angle in radians.\n * @param {import(\"../coordinate.js\").Coordinate} anchor The rotation center.\n * @api\n */\n rotate(angle, anchor) {\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n geometries[i].rotate(angle, anchor);\n }\n this.changed();\n }\n\n /**\n * Scale the geometry (with an optional origin). This modifies the geometry\n * coordinates in place.\n * @abstract\n * @param {number} sx The scaling factor in the x-direction.\n * @param {number} [sy] The scaling factor in the y-direction (defaults to sx).\n * @param {import(\"../coordinate.js\").Coordinate} [anchor] The scale origin (defaults to the center\n * of the geometry extent).\n * @api\n */\n scale(sx, sy, anchor) {\n if (!anchor) {\n anchor = getCenter(this.getExtent());\n }\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n geometries[i].scale(sx, sy, anchor);\n }\n this.changed();\n }\n\n /**\n * Set the geometries that make up this geometry collection.\n * @param {Array} geometries Geometries.\n * @api\n */\n setGeometries(geometries) {\n this.setGeometriesArray(cloneGeometries(geometries));\n }\n\n /**\n * @param {Array} geometries Geometries.\n */\n setGeometriesArray(geometries) {\n this.unlistenGeometriesChange_();\n this.geometries_ = geometries;\n this.listenGeometriesChange_();\n this.changed();\n }\n\n /**\n * Apply a transform function to the coordinates of the geometry.\n * The geometry is modified in place.\n * If you do not want the geometry modified in place, first `clone()` it and\n * then use this function on the clone.\n * @param {import(\"../proj.js\").TransformFunction} transformFn Transform function.\n * Called with a flat array of geometry coordinates.\n * @api\n */\n applyTransform(transformFn) {\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n geometries[i].applyTransform(transformFn);\n }\n this.changed();\n }\n\n /**\n * Translate the geometry. This modifies the geometry coordinates in place. If\n * instead you want a new geometry, first `clone()` this geometry.\n * @param {number} deltaX Delta X.\n * @param {number} deltaY Delta Y.\n * @api\n */\n translate(deltaX, deltaY) {\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n geometries[i].translate(deltaX, deltaY);\n }\n this.changed();\n }\n\n /**\n * Clean up.\n */\n disposeInternal() {\n this.unlistenGeometriesChange_();\n super.disposeInternal();\n }\n}\n\n/**\n * @param {Array} geometries Geometries.\n * @return {Array} Cloned geometries.\n */\nfunction cloneGeometries(geometries) {\n return geometries.map((geometry) => geometry.clone());\n}\n\nexport default GeometryCollection;\n","/**\n * @module ol/format/Feature\n */\nimport Feature from '../Feature.js';\nimport RenderFeature from '../render/Feature.js';\nimport {\n GeometryCollection,\n LineString,\n MultiLineString,\n MultiPoint,\n MultiPolygon,\n Point,\n Polygon,\n} from '../geom.js';\nimport {abstract} from '../util.js';\nimport {\n equivalent as equivalentProjection,\n get as getProjection,\n getTransform,\n transformExtent,\n} from '../proj.js';\nimport {\n linearRingsAreOriented,\n linearRingssAreOriented,\n orientLinearRings,\n orientLinearRingsArray,\n} from '../geom/flat/orient.js';\n\n/**\n * @typedef {Object} ReadOptions\n * @property {import(\"../proj.js\").ProjectionLike} [dataProjection] Projection of the data we are reading.\n * If not provided, the projection will be derived from the data (where possible) or\n * the `dataProjection` of the format is assigned (where set). If the projection\n * can not be derived from the data and if no `dataProjection` is set for a format,\n * the features will not be reprojected.\n * @property {import(\"../extent.js\").Extent} [extent] Tile extent in map units of the tile being read.\n * This is only required when reading data with tile pixels as geometry units. When configured,\n * a `dataProjection` with `TILE_PIXELS` as `units` and the tile's pixel extent as `extent` needs to be\n * provided.\n * @property {import(\"../proj.js\").ProjectionLike} [featureProjection] Projection of the feature geometries\n * created by the format reader. If not provided, features will be returned in the\n * `dataProjection`.\n */\n\n/**\n * @typedef {Object} WriteOptions\n * @property {import(\"../proj.js\").ProjectionLike} [dataProjection] Projection of the data we are writing.\n * If not provided, the `dataProjection` of the format is assigned (where set).\n * If no `dataProjection` is set for a format, the features will be returned\n * in the `featureProjection`.\n * @property {import(\"../proj.js\").ProjectionLike} [featureProjection] Projection of the feature geometries\n * that will be serialized by the format writer. If not provided, geometries are assumed\n * to be in the `dataProjection` if that is set; in other words, they are not transformed.\n * @property {boolean} [rightHanded] When writing geometries, follow the right-hand\n * rule for linear ring orientation. This means that polygons will have counter-clockwise\n * exterior rings and clockwise interior rings. By default, coordinates are serialized\n * as they are provided at construction. If `true`, the right-hand rule will\n * be applied. If `false`, the left-hand rule will be applied (clockwise for\n * exterior and counter-clockwise for interior rings). Note that not all\n * formats support this. The GeoJSON format does use this property when writing\n * geometries.\n * @property {number} [decimals] Maximum number of decimal places for coordinates.\n * Coordinates are stored internally as floats, but floating-point arithmetic can create\n * coordinates with a large number of decimal places, not generally wanted on output.\n * Set a number here to round coordinates. Can also be used to ensure that\n * coordinates read in can be written back out with the same number of decimals.\n * Default is no rounding.\n */\n\n/**\n * @typedef {'arraybuffer' | 'json' | 'text' | 'xml'} Type\n */\n\n/**\n * @typedef {Object} SimpleGeometryObject\n * @property {import('../geom/Geometry.js').Type} type Type.\n * @property {Array} flatCoordinates Flat coordinates.\n * @property {Array|Array>} [ends] Ends or endss.\n * @property {import('../geom/Geometry.js').GeometryLayout} [layout] Layout.\n */\n\n/**\n * @typedef {Array} GeometryCollectionObject\n */\n\n/**\n * @typedef {SimpleGeometryObject|GeometryCollectionObject} GeometryObject\n */\n\n/**\n * @typedef {Object} FeatureObject\n * @property {string|number} [id] Id.\n * @property {GeometryObject} [geometry] Geometry.\n * @property {Object} [properties] Properties.\n */\n\n/***\n * @template {Feature|RenderFeature} T\n * @typedef {T extends RenderFeature ? typeof RenderFeature : typeof Feature} FeatureToFeatureClass\n */\n\n/***\n * @template {import(\"../Feature.js\").FeatureClass} T\n * @typedef {T[keyof T] extends RenderFeature ? RenderFeature : Feature} FeatureClassToFeature\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Base class for feature formats.\n * {@link module:ol/format/Feature~FeatureFormat} subclasses provide the ability to decode and encode\n * {@link module:ol/Feature~Feature} objects from a variety of commonly used geospatial\n * file formats. See the documentation for each format for more details.\n *\n * @template {import('../Feature.js').FeatureClass} [T=typeof import('../Feature.js').default]\n * @abstract\n * @api\n */\nclass FeatureFormat {\n constructor() {\n /**\n * @protected\n * @type {import(\"../proj/Projection.js\").default|undefined}\n */\n this.dataProjection = undefined;\n\n /**\n * @protected\n * @type {import(\"../proj/Projection.js\").default|undefined}\n */\n this.defaultFeatureProjection = undefined;\n\n /**\n * @protected\n * @type {T}\n */\n this.featureClass = /** @type {T} */ (Feature);\n\n /**\n * A list media types supported by the format in descending order of preference.\n * @type {Array}\n */\n this.supportedMediaTypes = null;\n }\n\n /**\n * Adds the data projection to the read options.\n * @param {Document|Element|Object|string} source Source.\n * @param {ReadOptions} [options] Options.\n * @return {ReadOptions|undefined} Options.\n * @protected\n */\n getReadOptions(source, options) {\n if (options) {\n let dataProjection = options.dataProjection\n ? getProjection(options.dataProjection)\n : this.readProjection(source);\n if (\n options.extent &&\n dataProjection &&\n dataProjection.getUnits() === 'tile-pixels'\n ) {\n dataProjection = getProjection(dataProjection);\n dataProjection.setWorldExtent(options.extent);\n }\n options = {\n dataProjection: dataProjection,\n featureProjection: options.featureProjection,\n };\n }\n return this.adaptOptions(options);\n }\n\n /**\n * Sets the `dataProjection` on the options, if no `dataProjection`\n * is set.\n * @param {WriteOptions|ReadOptions|undefined} options\n * Options.\n * @protected\n * @return {WriteOptions|ReadOptions|undefined}\n * Updated options.\n */\n adaptOptions(options) {\n return Object.assign(\n {\n dataProjection: this.dataProjection,\n featureProjection: this.defaultFeatureProjection,\n featureClass: this.featureClass,\n },\n options,\n );\n }\n\n /**\n * @abstract\n * @return {Type} The format type.\n */\n getType() {\n return abstract();\n }\n\n /**\n * Read a single feature from a source.\n *\n * @abstract\n * @param {Document|Element|Object|string} source Source.\n * @param {ReadOptions} [options] Read options.\n * @return {import(\"../Feature.js\").FeatureLike|Array} Feature.\n */\n readFeature(source, options) {\n return abstract();\n }\n\n /**\n * Read all features from a source.\n *\n * @abstract\n * @param {Document|Element|ArrayBuffer|Object|string} source Source.\n * @param {ReadOptions} [options] Read options.\n * @return {Array>} Features.\n */\n readFeatures(source, options) {\n return abstract();\n }\n\n /**\n * Read a single geometry from a source.\n *\n * @abstract\n * @param {Document|Element|Object|string} source Source.\n * @param {ReadOptions} [options] Read options.\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n */\n readGeometry(source, options) {\n return abstract();\n }\n\n /**\n * Read the projection from a source.\n *\n * @abstract\n * @param {Document|Element|Object|string} source Source.\n * @return {import(\"../proj/Projection.js\").default|undefined} Projection.\n */\n readProjection(source) {\n return abstract();\n }\n\n /**\n * Encode a feature in this format.\n *\n * @abstract\n * @param {Feature} feature Feature.\n * @param {WriteOptions} [options] Write options.\n * @return {string|ArrayBuffer} Result.\n */\n writeFeature(feature, options) {\n return abstract();\n }\n\n /**\n * Encode an array of features in this format.\n *\n * @abstract\n * @param {Array} features Features.\n * @param {WriteOptions} [options] Write options.\n * @return {string|ArrayBuffer} Result.\n */\n writeFeatures(features, options) {\n return abstract();\n }\n\n /**\n * Write a single geometry in this format.\n *\n * @abstract\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {WriteOptions} [options] Write options.\n * @return {string|ArrayBuffer} Result.\n */\n writeGeometry(geometry, options) {\n return abstract();\n }\n}\n\nexport default FeatureFormat;\n\n/**\n * @template {import(\"../geom/Geometry.js\").default|RenderFeature} T\n * @param {T} geometry Geometry.\n * @param {boolean} write Set to true for writing, false for reading.\n * @param {WriteOptions|ReadOptions} [options] Options.\n * @return {T} Transformed geometry.\n */\nexport function transformGeometryWithOptions(geometry, write, options) {\n const featureProjection = options\n ? getProjection(options.featureProjection)\n : null;\n const dataProjection = options ? getProjection(options.dataProjection) : null;\n\n let transformed = geometry;\n if (\n featureProjection &&\n dataProjection &&\n !equivalentProjection(featureProjection, dataProjection)\n ) {\n if (write) {\n transformed = /** @type {T} */ (geometry.clone());\n }\n const fromProjection = write ? featureProjection : dataProjection;\n const toProjection = write ? dataProjection : featureProjection;\n if (fromProjection.getUnits() === 'tile-pixels') {\n transformed.transform(fromProjection, toProjection);\n } else {\n transformed.applyTransform(getTransform(fromProjection, toProjection));\n }\n }\n if (\n write &&\n options &&\n /** @type {WriteOptions} */ (options).decimals !== undefined\n ) {\n const power = Math.pow(10, /** @type {WriteOptions} */ (options).decimals);\n // if decimals option on write, round each coordinate appropriately\n /**\n * @param {Array} coordinates Coordinates.\n * @return {Array} Transformed coordinates.\n */\n const transform = function (coordinates) {\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n coordinates[i] = Math.round(coordinates[i] * power) / power;\n }\n return coordinates;\n };\n if (transformed === geometry) {\n transformed = /** @type {T} */ (geometry.clone());\n }\n transformed.applyTransform(transform);\n }\n return transformed;\n}\n\n/**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {ReadOptions} [options] Read options.\n * @return {import(\"../extent.js\").Extent} Transformed extent.\n */\nexport function transformExtentWithOptions(extent, options) {\n const featureProjection = options\n ? getProjection(options.featureProjection)\n : null;\n const dataProjection = options ? getProjection(options.dataProjection) : null;\n\n if (\n featureProjection &&\n dataProjection &&\n !equivalentProjection(featureProjection, dataProjection)\n ) {\n return transformExtent(extent, dataProjection, featureProjection);\n }\n return extent;\n}\n\nconst GeometryConstructor = {\n Point: Point,\n LineString: LineString,\n Polygon: Polygon,\n MultiPoint: MultiPoint,\n MultiLineString: MultiLineString,\n MultiPolygon: MultiPolygon,\n};\n\nfunction orientFlatCoordinates(flatCoordinates, ends, stride) {\n if (Array.isArray(ends[0])) {\n // MultiPolagon\n if (!linearRingssAreOriented(flatCoordinates, 0, ends, stride)) {\n flatCoordinates = flatCoordinates.slice();\n orientLinearRingsArray(flatCoordinates, 0, ends, stride);\n }\n return flatCoordinates;\n }\n if (!linearRingsAreOriented(flatCoordinates, 0, ends, stride)) {\n flatCoordinates = flatCoordinates.slice();\n orientLinearRings(flatCoordinates, 0, ends, stride);\n }\n return flatCoordinates;\n}\n\n/**\n * @param {FeatureObject} object Feature object.\n * @param {WriteOptions|ReadOptions} [options] Options.\n * @return {RenderFeature|Array} Render feature.\n */\nexport function createRenderFeature(object, options) {\n const geometry = object.geometry;\n if (!geometry) {\n return [];\n }\n if (Array.isArray(geometry)) {\n return geometry\n .map((geometry) => createRenderFeature({...object, geometry}))\n .flat();\n }\n\n const geometryType =\n geometry.type === 'MultiPolygon' ? 'Polygon' : geometry.type;\n if (geometryType === 'GeometryCollection' || geometryType === 'Circle') {\n throw new Error('Unsupported geometry type: ' + geometryType);\n }\n\n const stride = geometry.layout.length;\n return transformGeometryWithOptions(\n new RenderFeature(\n geometryType,\n geometryType === 'Polygon'\n ? orientFlatCoordinates(geometry.flatCoordinates, geometry.ends, stride)\n : geometry.flatCoordinates,\n geometry.ends?.flat(),\n stride,\n object.properties || {},\n object.id,\n ).enableSimplifyTransformed(),\n false,\n options,\n );\n}\n\n/**\n * @param {GeometryObject|null} object Geometry object.\n * @param {WriteOptions|ReadOptions} [options] Options.\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n */\nexport function createGeometry(object, options) {\n if (!object) {\n return null;\n }\n if (Array.isArray(object)) {\n const geometries = object.map((geometry) =>\n createGeometry(geometry, options),\n );\n return new GeometryCollection(geometries);\n }\n const Geometry = GeometryConstructor[object.type];\n return transformGeometryWithOptions(\n new Geometry(object.flatCoordinates, object.layout, object.ends),\n false,\n options,\n );\n}\n","/**\n * @module ol/format/GeoJSON\n */\n\nimport Feature from '../Feature.js';\nimport JSONFeature from './JSONFeature.js';\nimport RenderFeature from '../render/Feature.js';\nimport {\n createGeometry,\n createRenderFeature,\n transformGeometryWithOptions,\n} from './Feature.js';\nimport {\n deflateCoordinatesArray,\n deflateMultiCoordinatesArray,\n} from '../geom/flat/deflate.js';\nimport {getLayoutForStride} from '../geom/SimpleGeometry.js';\nimport {get as getProjection} from '../proj.js';\nimport {isEmpty} from '../obj.js';\n\n/**\n * @typedef {import(\"geojson\").GeoJSON} GeoJSONObject\n * @typedef {import(\"geojson\").Feature} GeoJSONFeature\n * @typedef {import(\"geojson\").FeatureCollection} GeoJSONFeatureCollection\n * @typedef {import(\"geojson\").Geometry} GeoJSONGeometry\n * @typedef {import(\"geojson\").Point} GeoJSONPoint\n * @typedef {import(\"geojson\").LineString} GeoJSONLineString\n * @typedef {import(\"geojson\").Polygon} GeoJSONPolygon\n * @typedef {import(\"geojson\").MultiPoint} GeoJSONMultiPoint\n * @typedef {import(\"geojson\").MultiLineString} GeoJSONMultiLineString\n * @typedef {import(\"geojson\").MultiPolygon} GeoJSONMultiPolygon\n * @typedef {import(\"geojson\").GeometryCollection} GeoJSONGeometryCollection\n */\n\n/**\n * @template {import(\"../Feature.js\").FeatureClass} FeatureClassToFeature\n * @typedef {Object} Options\n *\n * @property {import(\"../proj.js\").ProjectionLike} [dataProjection='EPSG:4326'] Default data projection.\n * @property {import(\"../proj.js\").ProjectionLike} [featureProjection] Projection for features read or\n * written by the format. Options passed to read or write methods will take precedence.\n * @property {string} [geometryName] Geometry name to use when creating features.\n * @property {boolean} [extractGeometryName=false] Certain GeoJSON providers include\n * the geometry_name field in the feature GeoJSON. If set to `true` the GeoJSON reader\n * will look for that field to set the geometry name. If both this field is set to `true`\n * and a `geometryName` is provided, the `geometryName` will take precedence.\n * @property {FeatureClassToFeature} [featureClass] Feature class\n * to be used when reading features. The default is {@link module:ol/Feature~Feature}. If performance is\n * the primary concern, and features are not going to be modified or round-tripped through the format,\n * consider using {@link module:ol/render/Feature~RenderFeature}\n */\n\n/**\n * @classdesc\n * Feature format for reading and writing data in the GeoJSON format.\n *\n * @template {import('../Feature.js').FeatureClass} [T=typeof Feature]\n * @extends {JSONFeature}\n * @api\n */\nclass GeoJSON extends JSONFeature {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super();\n\n /**\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.dataProjection = getProjection(\n options.dataProjection ? options.dataProjection : 'EPSG:4326',\n );\n\n if (options.featureProjection) {\n /**\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.defaultFeatureProjection = getProjection(options.featureProjection);\n }\n\n if (options.featureClass) {\n this.featureClass = options.featureClass;\n }\n\n /**\n * Name of the geometry attribute for features.\n * @type {string|undefined}\n * @private\n */\n this.geometryName_ = options.geometryName;\n\n /**\n * Look for the `geometry_name` in the feature GeoJSON\n * @type {boolean|undefined}\n * @private\n */\n this.extractGeometryName_ = options.extractGeometryName;\n\n this.supportedMediaTypes = [\n 'application/geo+json',\n 'application/vnd.geo+json',\n ];\n }\n\n /**\n * @param {Object} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {Feature|RenderFeature|Array}.default} Feature.\n */\n readFeatureFromObject(object, options) {\n /**\n * @type {GeoJSONFeature}\n */\n let geoJSONFeature = null;\n if (object['type'] === 'Feature') {\n geoJSONFeature = /** @type {GeoJSONFeature} */ (object);\n } else {\n geoJSONFeature = {\n 'type': 'Feature',\n 'geometry': /** @type {GeoJSONGeometry} */ (object),\n 'properties': null,\n };\n }\n\n const geometry = readGeometryInternal(geoJSONFeature['geometry'], options);\n if (this.featureClass === RenderFeature) {\n return createRenderFeature(\n {\n geometry,\n id: geoJSONFeature['id'],\n properties: geoJSONFeature['properties'],\n },\n options,\n );\n }\n\n const feature = new Feature();\n if (this.geometryName_) {\n feature.setGeometryName(this.geometryName_);\n } else if (this.extractGeometryName_ && geoJSONFeature['geometry_name']) {\n feature.setGeometryName(geoJSONFeature['geometry_name']);\n }\n feature.setGeometry(createGeometry(geometry, options));\n\n if ('id' in geoJSONFeature) {\n feature.setId(geoJSONFeature['id']);\n }\n\n if (geoJSONFeature['properties']) {\n feature.setProperties(geoJSONFeature['properties'], true);\n }\n return feature;\n }\n\n /**\n * @param {Object} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {Array} Features.\n */\n readFeaturesFromObject(object, options) {\n const geoJSONObject = /** @type {GeoJSONObject} */ (object);\n /** @type {Array>} */\n let features = null;\n if (geoJSONObject['type'] === 'FeatureCollection') {\n const geoJSONFeatureCollection = /** @type {GeoJSONFeatureCollection} */ (\n object\n );\n features = [];\n const geoJSONFeatures = geoJSONFeatureCollection['features'];\n for (let i = 0, ii = geoJSONFeatures.length; i < ii; ++i) {\n const featureObject = this.readFeatureFromObject(\n geoJSONFeatures[i],\n options,\n );\n if (!featureObject) {\n continue;\n }\n features.push(featureObject);\n }\n } else {\n features = [this.readFeatureFromObject(object, options)];\n }\n return features.flat();\n }\n\n /**\n * @param {GeoJSONGeometry} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n */\n readGeometryFromObject(object, options) {\n return readGeometry(object, options);\n }\n\n /**\n * @param {Object} object Object.\n * @protected\n * @return {import(\"../proj/Projection.js\").default} Projection.\n */\n readProjectionFromObject(object) {\n const crs = object['crs'];\n let projection;\n if (crs) {\n if (crs['type'] == 'name') {\n projection = getProjection(crs['properties']['name']);\n } else if (crs['type'] === 'EPSG') {\n projection = getProjection('EPSG:' + crs['properties']['code']);\n } else {\n throw new Error('Unknown SRS type');\n }\n } else {\n projection = this.dataProjection;\n }\n return /** @type {import(\"../proj/Projection.js\").default} */ (projection);\n }\n\n /**\n * Encode a feature as a GeoJSON Feature object.\n *\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONFeature} Object.\n * @api\n */\n writeFeatureObject(feature, options) {\n options = this.adaptOptions(options);\n\n /** @type {GeoJSONFeature} */\n const object = {\n 'type': 'Feature',\n geometry: null,\n properties: null,\n };\n\n const id = feature.getId();\n if (id !== undefined) {\n object.id = id;\n }\n\n if (!feature.hasProperties()) {\n return object;\n }\n\n const properties = feature.getProperties();\n const geometry = feature.getGeometry();\n if (geometry) {\n object.geometry = writeGeometry(geometry, options);\n\n delete properties[feature.getGeometryName()];\n }\n\n if (!isEmpty(properties)) {\n object.properties = properties;\n }\n\n return object;\n }\n\n /**\n * Encode an array of features as a GeoJSON object.\n *\n * @param {Array} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONFeatureCollection} GeoJSON Object.\n * @api\n */\n writeFeaturesObject(features, options) {\n options = this.adaptOptions(options);\n const objects = [];\n for (let i = 0, ii = features.length; i < ii; ++i) {\n objects.push(this.writeFeatureObject(features[i], options));\n }\n return {\n type: 'FeatureCollection',\n features: objects,\n };\n }\n\n /**\n * Encode a geometry as a GeoJSON object.\n *\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry|GeoJSONGeometryCollection} Object.\n * @api\n */\n writeGeometryObject(geometry, options) {\n return writeGeometry(geometry, this.adaptOptions(options));\n }\n}\n\n/**\n * @param {GeoJSONGeometry|GeoJSONGeometryCollection} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"./Feature.js\").GeometryObject} Geometry.\n */\nfunction readGeometryInternal(object, options) {\n if (!object) {\n return null;\n }\n\n /** @type {import(\"./Feature.js\").GeometryObject} */\n let geometry;\n switch (object['type']) {\n case 'Point': {\n geometry = readPointGeometry(/** @type {GeoJSONPoint} */ (object));\n break;\n }\n case 'LineString': {\n geometry = readLineStringGeometry(\n /** @type {GeoJSONLineString} */ (object),\n );\n break;\n }\n case 'Polygon': {\n geometry = readPolygonGeometry(/** @type {GeoJSONPolygon} */ (object));\n break;\n }\n case 'MultiPoint': {\n geometry = readMultiPointGeometry(\n /** @type {GeoJSONMultiPoint} */ (object),\n );\n break;\n }\n case 'MultiLineString': {\n geometry = readMultiLineStringGeometry(\n /** @type {GeoJSONMultiLineString} */ (object),\n );\n break;\n }\n case 'MultiPolygon': {\n geometry = readMultiPolygonGeometry(\n /** @type {GeoJSONMultiPolygon} */ (object),\n );\n break;\n }\n case 'GeometryCollection': {\n geometry = readGeometryCollectionGeometry(\n /** @type {GeoJSONGeometryCollection} */ (object),\n );\n break;\n }\n default: {\n throw new Error('Unsupported GeoJSON type: ' + object['type']);\n }\n }\n return geometry;\n}\n\n/**\n * @param {GeoJSONGeometry|GeoJSONGeometryCollection} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n */\nfunction readGeometry(object, options) {\n const geometryObject = readGeometryInternal(object, options);\n return createGeometry(geometryObject, options);\n}\n\n/**\n * @param {GeoJSONGeometryCollection} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"./Feature.js\").GeometryCollectionObject} Geometry collection.\n */\nfunction readGeometryCollectionGeometry(object, options) {\n const geometries = object['geometries'].map(\n /**\n * @param {GeoJSONGeometry} geometry Geometry.\n * @return {import(\"./Feature.js\").GeometryObject} geometry Geometry.\n */\n function (geometry) {\n return readGeometryInternal(geometry, options);\n },\n );\n return geometries;\n}\n\n/**\n * @param {GeoJSONPoint} object Input object.\n * @return {import(\"./Feature.js\").GeometryObject} Point geometry.\n */\nfunction readPointGeometry(object) {\n const flatCoordinates = object['coordinates'];\n return {\n type: 'Point',\n flatCoordinates,\n layout: getLayoutForStride(flatCoordinates.length),\n };\n}\n\n/**\n * @param {GeoJSONLineString} object Object.\n * @return {import(\"./Feature.js\").GeometryObject} LineString geometry.\n */\nfunction readLineStringGeometry(object) {\n const coordinates = object['coordinates'];\n const flatCoordinates = coordinates.flat();\n return {\n type: 'LineString',\n flatCoordinates,\n ends: [flatCoordinates.length],\n layout: getLayoutForStride(coordinates[0]?.length || 2),\n };\n}\n\n/**\n * @param {GeoJSONMultiLineString} object Object.\n * @return {import(\"./Feature.js\").GeometryObject} MultiLineString geometry.\n */\nfunction readMultiLineStringGeometry(object) {\n const coordinates = object['coordinates'];\n const stride = coordinates[0]?.[0]?.length || 2;\n const flatCoordinates = [];\n const ends = deflateCoordinatesArray(flatCoordinates, 0, coordinates, stride);\n return {\n type: 'MultiLineString',\n flatCoordinates,\n ends,\n layout: getLayoutForStride(stride),\n };\n}\n\n/**\n * @param {GeoJSONMultiPoint} object Object.\n * @return {import(\"./Feature.js\").GeometryObject} MultiPoint geometry.\n */\nfunction readMultiPointGeometry(object) {\n const coordinates = object['coordinates'];\n return {\n type: 'MultiPoint',\n flatCoordinates: coordinates.flat(),\n layout: getLayoutForStride(coordinates[0]?.length || 2),\n };\n}\n\n/**\n * @param {GeoJSONMultiPolygon} object Object.\n * @return {import(\"./Feature.js\").GeometryObject} MultiPolygon geometry.\n */\nfunction readMultiPolygonGeometry(object) {\n const coordinates = object['coordinates'];\n const flatCoordinates = [];\n const stride = coordinates[0]?.[0]?.[0].length || 2;\n const endss = deflateMultiCoordinatesArray(\n flatCoordinates,\n 0,\n coordinates,\n stride,\n );\n return {\n type: 'MultiPolygon',\n flatCoordinates,\n ends: endss,\n layout: getLayoutForStride(stride),\n };\n}\n\n/**\n * @param {GeoJSONPolygon} object Object.\n * @return {import(\"./Feature.js\").GeometryObject} Polygon.\n */\nfunction readPolygonGeometry(object) {\n const coordinates = object['coordinates'];\n const flatCoordinates = [];\n const stride = coordinates[0]?.[0]?.length;\n const ends = deflateCoordinatesArray(flatCoordinates, 0, coordinates, stride);\n return {\n type: 'Polygon',\n flatCoordinates,\n ends,\n layout: getLayoutForStride(stride),\n };\n}\n\n/**\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry} GeoJSON geometry.\n */\nfunction writeGeometry(geometry, options) {\n geometry = transformGeometryWithOptions(geometry, true, options);\n\n const type = geometry.getType();\n\n /** @type {GeoJSONGeometry} */\n let geoJSON;\n switch (type) {\n case 'Point': {\n geoJSON = writePointGeometry(\n /** @type {import(\"../geom/Point.js\").default} */ (geometry),\n options,\n );\n break;\n }\n case 'LineString': {\n geoJSON = writeLineStringGeometry(\n /** @type {import(\"../geom/LineString.js\").default} */ (geometry),\n options,\n );\n break;\n }\n case 'Polygon': {\n geoJSON = writePolygonGeometry(\n /** @type {import(\"../geom/Polygon.js\").default} */ (geometry),\n options,\n );\n break;\n }\n case 'MultiPoint': {\n geoJSON = writeMultiPointGeometry(\n /** @type {import(\"../geom/MultiPoint.js\").default} */ (geometry),\n options,\n );\n break;\n }\n case 'MultiLineString': {\n geoJSON = writeMultiLineStringGeometry(\n /** @type {import(\"../geom/MultiLineString.js\").default} */ (geometry),\n options,\n );\n break;\n }\n case 'MultiPolygon': {\n geoJSON = writeMultiPolygonGeometry(\n /** @type {import(\"../geom/MultiPolygon.js\").default} */ (geometry),\n options,\n );\n break;\n }\n case 'GeometryCollection': {\n geoJSON = writeGeometryCollectionGeometry(\n /** @type {import(\"../geom/GeometryCollection.js\").default} */ (\n geometry\n ),\n options,\n );\n break;\n }\n case 'Circle': {\n geoJSON = {\n type: 'GeometryCollection',\n geometries: [],\n };\n break;\n }\n default: {\n throw new Error('Unsupported geometry type: ' + type);\n }\n }\n return geoJSON;\n}\n\n/**\n * @param {import(\"../geom/GeometryCollection.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometryCollection} GeoJSON geometry collection.\n */\nfunction writeGeometryCollectionGeometry(geometry, options) {\n options = Object.assign({}, options);\n delete options.featureProjection;\n const geometries = geometry.getGeometriesArray().map(function (geometry) {\n return writeGeometry(geometry, options);\n });\n return {\n type: 'GeometryCollection',\n geometries: geometries,\n };\n}\n\n/**\n * @param {import(\"../geom/LineString.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry} GeoJSON geometry.\n */\nfunction writeLineStringGeometry(geometry, options) {\n return {\n type: 'LineString',\n coordinates: geometry.getCoordinates(),\n };\n}\n\n/**\n * @param {import(\"../geom/MultiLineString.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry} GeoJSON geometry.\n */\nfunction writeMultiLineStringGeometry(geometry, options) {\n return {\n type: 'MultiLineString',\n coordinates: geometry.getCoordinates(),\n };\n}\n\n/**\n * @param {import(\"../geom/MultiPoint.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry} GeoJSON geometry.\n */\nfunction writeMultiPointGeometry(geometry, options) {\n return {\n type: 'MultiPoint',\n coordinates: geometry.getCoordinates(),\n };\n}\n\n/**\n * @param {import(\"../geom/MultiPolygon.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry} GeoJSON geometry.\n */\nfunction writeMultiPolygonGeometry(geometry, options) {\n let right;\n if (options) {\n right = options.rightHanded;\n }\n return {\n type: 'MultiPolygon',\n coordinates: geometry.getCoordinates(right),\n };\n}\n\n/**\n * @param {import(\"../geom/Point.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry} GeoJSON geometry.\n */\nfunction writePointGeometry(geometry, options) {\n return {\n type: 'Point',\n coordinates: geometry.getCoordinates(),\n };\n}\n\n/**\n * @param {import(\"../geom/Polygon.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry} GeoJSON geometry.\n */\nfunction writePolygonGeometry(geometry, options) {\n let right;\n if (options) {\n right = options.rightHanded;\n }\n return {\n type: 'Polygon',\n coordinates: geometry.getCoordinates(right),\n };\n}\n\nexport default GeoJSON;\n","/**\n * @module ol/format/JSONFeature\n */\nimport FeatureFormat from './Feature.js';\nimport {abstract} from '../util.js';\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Base class for JSON feature formats.\n *\n * @template {import('../Feature.js').FeatureClass} [T=typeof import('../Feature.js').default]\n * @extends {FeatureFormat}\n * @abstract\n */\nclass JSONFeature extends FeatureFormat {\n constructor() {\n super();\n }\n\n /**\n * @return {import(\"./Feature.js\").Type} Format.\n */\n getType() {\n return 'json';\n }\n\n /**\n * Read a feature. Only works for a single feature. Use `readFeatures` to\n * read a feature collection.\n *\n * @param {ArrayBuffer|Document|Element|Object|string} source Source.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import('./Feature.js').FeatureClassToFeature} Feature.\n * @api\n */\n readFeature(source, options) {\n return /** @type {import('./Feature.js').FeatureClassToFeature} */ (\n this.readFeatureFromObject(\n getObject(source),\n this.getReadOptions(source, options),\n )\n );\n }\n\n /**\n * Read all features. Works with both a single feature and a feature\n * collection.\n *\n * @param {ArrayBuffer|Document|Element|Object|string} source Source.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {Array>} Features.\n * @api\n */\n readFeatures(source, options) {\n return /** @type {Array>} */ (\n this.readFeaturesFromObject(\n getObject(source),\n this.getReadOptions(source, options),\n )\n );\n }\n\n /**\n * @abstract\n * @param {Object} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {import(\"../Feature.js\").default|import(\"../render/Feature.js\").default|Array} Feature.\n */\n readFeatureFromObject(object, options) {\n return abstract();\n }\n\n /**\n * @abstract\n * @param {Object} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {Array} Features.\n */\n readFeaturesFromObject(object, options) {\n return abstract();\n }\n\n /**\n * Read a geometry.\n *\n * @param {ArrayBuffer|Document|Element|Object|string} source Source.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n * @api\n */\n readGeometry(source, options) {\n return this.readGeometryFromObject(\n getObject(source),\n this.getReadOptions(source, options),\n );\n }\n\n /**\n * @abstract\n * @param {Object} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n */\n readGeometryFromObject(object, options) {\n return abstract();\n }\n\n /**\n * Read the projection.\n *\n * @param {ArrayBuffer|Document|Element|Object|string} source Source.\n * @return {import(\"../proj/Projection.js\").default} Projection.\n * @api\n */\n readProjection(source) {\n return this.readProjectionFromObject(getObject(source));\n }\n\n /**\n * @abstract\n * @param {Object} object Object.\n * @protected\n * @return {import(\"../proj/Projection.js\").default} Projection.\n */\n readProjectionFromObject(object) {\n return abstract();\n }\n\n /**\n * Encode a feature as string.\n *\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {string} Encoded feature.\n * @api\n */\n writeFeature(feature, options) {\n return JSON.stringify(this.writeFeatureObject(feature, options));\n }\n\n /**\n * @abstract\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {Object} Object.\n */\n writeFeatureObject(feature, options) {\n return abstract();\n }\n\n /**\n * Encode an array of features as string.\n *\n * @param {Array} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {string} Encoded features.\n * @api\n */\n writeFeatures(features, options) {\n return JSON.stringify(this.writeFeaturesObject(features, options));\n }\n\n /**\n * @abstract\n * @param {Array} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {Object} Object.\n */\n writeFeaturesObject(features, options) {\n return abstract();\n }\n\n /**\n * Encode a geometry as string.\n *\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {string} Encoded geometry.\n * @api\n */\n writeGeometry(geometry, options) {\n return JSON.stringify(this.writeGeometryObject(geometry, options));\n }\n\n /**\n * @abstract\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {Object} Object.\n */\n writeGeometryObject(geometry, options) {\n return abstract();\n }\n}\n\n/**\n * @param {Document|Element|Object|string} source Source.\n * @return {Object} Object.\n */\nfunction getObject(source) {\n if (typeof source === 'string') {\n const object = JSON.parse(source);\n return object ? /** @type {Object} */ (object) : null;\n }\n if (source !== null) {\n return source;\n }\n return null;\n}\n\nexport default JSONFeature;\n","/**\n * @module ol/format/MVT\n */\n//FIXME Implement projection handling\n\nimport FeatureFormat, {transformGeometryWithOptions} from './Feature.js';\nimport LineString from '../geom/LineString.js';\nimport MultiLineString from '../geom/MultiLineString.js';\nimport MultiPoint from '../geom/MultiPoint.js';\nimport MultiPolygon from '../geom/MultiPolygon.js';\nimport PBF from 'pbf';\nimport Point from '../geom/Point.js';\nimport Polygon from '../geom/Polygon.js';\nimport Projection from '../proj/Projection.js';\nimport RenderFeature from '../render/Feature.js';\nimport {get} from '../proj.js';\nimport {inflateEnds} from '../geom/flat/orient.js';\n\n/**\n * @template {import(\"../Feature.js\").FeatureClass} FeatureClassToFeature\n * @typedef {Object} Options\n * @property {FeatureClassToFeature} [featureClass] Class for features returned by\n * {@link module:ol/format/MVT~MVT#readFeatures}. Set to {@link module:ol/Feature~Feature} to get full editing and geometry\n * support at the cost of decreased rendering performance. The default is\n * {@link module:ol/render/Feature~RenderFeature}, which is optimized for rendering and hit detection.\n * @property {string} [geometryName='geometry'] Geometry name to use when creating features.\n * @property {string} [layerName='layer'] Name of the feature attribute that holds the layer name.\n * @property {Array} [layers] Layers to read features from. If not provided, features will be read from all\n * @property {string} [idProperty] Optional property that will be assigned as the feature id and removed from the properties.\n * layers.\n */\n\n/**\n * @classdesc\n * Feature format for reading data in the Mapbox MVT format.\n *\n * @template {import('../Feature.js').FeatureClass} [T=typeof import(\"../render/Feature.js\").default]\n * @extends {FeatureFormat}\n * @api\n */\nclass MVT extends FeatureFormat {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n options = options ? options : {};\n\n /**\n * @type {Projection}\n */\n this.dataProjection = new Projection({\n code: '',\n units: 'tile-pixels',\n });\n\n this.featureClass = options.featureClass\n ? options.featureClass\n : /** @type {T} */ (RenderFeature);\n\n /**\n * @private\n * @type {string|undefined}\n */\n this.geometryName_ = options.geometryName;\n\n /**\n * @private\n * @type {string}\n */\n this.layerName_ = options.layerName ? options.layerName : 'layer';\n\n /**\n * @private\n * @type {Array|null}\n */\n this.layers_ = options.layers ? options.layers : null;\n\n /**\n * @private\n * @type {string}\n */\n this.idProperty_ = options.idProperty;\n\n this.supportedMediaTypes = [\n 'application/vnd.mapbox-vector-tile',\n 'application/x-protobuf',\n ];\n }\n\n /**\n * Read the raw geometry from the pbf offset stored in a raw feature's geometry\n * property.\n * @param {PBF} pbf PBF.\n * @param {Object} feature Raw feature.\n * @param {Array} flatCoordinates Array to store flat coordinates in.\n * @param {Array} ends Array to store ends in.\n * @private\n */\n readRawGeometry_(pbf, feature, flatCoordinates, ends) {\n pbf.pos = feature.geometry;\n\n const end = pbf.readVarint() + pbf.pos;\n let cmd = 1;\n let length = 0;\n let x = 0;\n let y = 0;\n let coordsLen = 0;\n let currentEnd = 0;\n\n while (pbf.pos < end) {\n if (!length) {\n const cmdLen = pbf.readVarint();\n cmd = cmdLen & 0x7;\n length = cmdLen >> 3;\n }\n\n length--;\n\n if (cmd === 1 || cmd === 2) {\n x += pbf.readSVarint();\n y += pbf.readSVarint();\n\n if (cmd === 1) {\n // moveTo\n if (coordsLen > currentEnd) {\n ends.push(coordsLen);\n currentEnd = coordsLen;\n }\n }\n\n flatCoordinates.push(x, y);\n coordsLen += 2;\n } else if (cmd === 7) {\n if (coordsLen > currentEnd) {\n // close polygon\n flatCoordinates.push(\n flatCoordinates[currentEnd],\n flatCoordinates[currentEnd + 1],\n );\n coordsLen += 2;\n }\n } else {\n throw new Error('Invalid command found in the PBF');\n }\n }\n\n if (coordsLen > currentEnd) {\n ends.push(coordsLen);\n currentEnd = coordsLen;\n }\n }\n\n /**\n * @private\n * @param {PBF} pbf PBF\n * @param {Object} rawFeature Raw Mapbox feature.\n * @param {import(\"./Feature.js\").ReadOptions} options Read options.\n * @return {import(\"../Feature.js\").FeatureLike|null} Feature.\n */\n createFeature_(pbf, rawFeature, options) {\n const type = rawFeature.type;\n if (type === 0) {\n return null;\n }\n\n let feature;\n const values = rawFeature.properties;\n\n let id;\n if (!this.idProperty_) {\n id = rawFeature.id;\n } else {\n id = values[this.idProperty_];\n delete values[this.idProperty_];\n }\n\n values[this.layerName_] = rawFeature.layer.name;\n\n const flatCoordinates = /** @type {Array} */ ([]);\n const ends = /** @type {Array} */ ([]);\n this.readRawGeometry_(pbf, rawFeature, flatCoordinates, ends);\n\n const geometryType = getGeometryType(type, ends.length);\n\n if (this.featureClass === RenderFeature) {\n feature = new /** @type {typeof RenderFeature} */ (this.featureClass)(\n geometryType,\n flatCoordinates,\n ends,\n 2,\n values,\n id,\n );\n feature.transform(options.dataProjection);\n } else {\n let geom;\n if (geometryType == 'Polygon') {\n const endss = inflateEnds(flatCoordinates, ends);\n geom =\n endss.length > 1\n ? new MultiPolygon(flatCoordinates, 'XY', endss)\n : new Polygon(flatCoordinates, 'XY', ends);\n } else {\n geom =\n geometryType === 'Point'\n ? new Point(flatCoordinates, 'XY')\n : geometryType === 'LineString'\n ? new LineString(flatCoordinates, 'XY')\n : geometryType === 'MultiPoint'\n ? new MultiPoint(flatCoordinates, 'XY')\n : geometryType === 'MultiLineString'\n ? new MultiLineString(flatCoordinates, 'XY', ends)\n : null;\n }\n const ctor = /** @type {typeof import(\"../Feature.js\").default} */ (\n this.featureClass\n );\n feature = new ctor();\n if (this.geometryName_) {\n feature.setGeometryName(this.geometryName_);\n }\n const geometry = transformGeometryWithOptions(geom, false, options);\n feature.setGeometry(geometry);\n if (id !== undefined) {\n feature.setId(id);\n }\n feature.setProperties(values, true);\n }\n\n return feature;\n }\n\n /**\n * @return {import(\"./Feature.js\").Type} Format.\n */\n getType() {\n return 'arraybuffer';\n }\n\n /**\n * Read all features.\n *\n * @param {ArrayBuffer} source Source.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {Array>} Features.\n * @api\n */\n readFeatures(source, options) {\n const layers = this.layers_;\n options = this.adaptOptions(options);\n const dataProjection = get(options.dataProjection);\n dataProjection.setWorldExtent(options.extent);\n options.dataProjection = dataProjection;\n\n const pbf = new PBF(/** @type {ArrayBuffer} */ (source));\n const pbfLayers = pbf.readFields(layersPBFReader, {});\n const features = [];\n for (const name in pbfLayers) {\n if (layers && !layers.includes(name)) {\n continue;\n }\n const pbfLayer = pbfLayers[name];\n\n const extent = pbfLayer ? [0, 0, pbfLayer.extent, pbfLayer.extent] : null;\n dataProjection.setExtent(extent);\n\n for (let i = 0, ii = pbfLayer.length; i < ii; ++i) {\n const rawFeature = readRawFeature(pbf, pbfLayer, i);\n const feature = this.createFeature_(pbf, rawFeature, options);\n if (feature !== null) {\n features.push(feature);\n }\n }\n }\n\n return /** @type {Array>} */ (\n features\n );\n }\n\n /**\n * Read the projection from the source.\n *\n * @param {Document|Element|Object|string} source Source.\n * @return {import(\"../proj/Projection.js\").default} Projection.\n * @api\n */\n readProjection(source) {\n return this.dataProjection;\n }\n\n /**\n * Sets the layers that features will be read from.\n * @param {Array} layers Layers.\n * @api\n */\n setLayers(layers) {\n this.layers_ = layers;\n }\n}\n\n/**\n * Reader callback for parsing layers.\n * @param {number} tag The tag.\n * @param {Object} layers The layers object.\n * @param {PBF} pbf The PBF.\n */\nfunction layersPBFReader(tag, layers, pbf) {\n if (tag === 3) {\n const layer = {\n keys: [],\n values: [],\n features: [],\n };\n const end = pbf.readVarint() + pbf.pos;\n pbf.readFields(layerPBFReader, layer, end);\n layer.length = layer.features.length;\n if (layer.length) {\n layers[layer.name] = layer;\n }\n }\n}\n\n/**\n * Reader callback for parsing layer.\n * @param {number} tag The tag.\n * @param {Object} layer The layer object.\n * @param {PBF} pbf The PBF.\n */\nfunction layerPBFReader(tag, layer, pbf) {\n if (tag === 15) {\n layer.version = pbf.readVarint();\n } else if (tag === 1) {\n layer.name = pbf.readString();\n } else if (tag === 5) {\n layer.extent = pbf.readVarint();\n } else if (tag === 2) {\n layer.features.push(pbf.pos);\n } else if (tag === 3) {\n layer.keys.push(pbf.readString());\n } else if (tag === 4) {\n let value = null;\n const end = pbf.readVarint() + pbf.pos;\n while (pbf.pos < end) {\n tag = pbf.readVarint() >> 3;\n value =\n tag === 1\n ? pbf.readString()\n : tag === 2\n ? pbf.readFloat()\n : tag === 3\n ? pbf.readDouble()\n : tag === 4\n ? pbf.readVarint64()\n : tag === 5\n ? pbf.readVarint()\n : tag === 6\n ? pbf.readSVarint()\n : tag === 7\n ? pbf.readBoolean()\n : null;\n }\n layer.values.push(value);\n }\n}\n\n/**\n * Reader callback for parsing feature.\n * @param {number} tag The tag.\n * @param {Object} feature The feature object.\n * @param {PBF} pbf The PBF.\n */\nfunction featurePBFReader(tag, feature, pbf) {\n if (tag == 1) {\n feature.id = pbf.readVarint();\n } else if (tag == 2) {\n const end = pbf.readVarint() + pbf.pos;\n while (pbf.pos < end) {\n const key = feature.layer.keys[pbf.readVarint()];\n const value = feature.layer.values[pbf.readVarint()];\n feature.properties[key] = value;\n }\n } else if (tag == 3) {\n feature.type = pbf.readVarint();\n } else if (tag == 4) {\n feature.geometry = pbf.pos;\n }\n}\n\n/**\n * Read a raw feature from the pbf offset stored at index `i` in the raw layer.\n * @param {PBF} pbf PBF.\n * @param {Object} layer Raw layer.\n * @param {number} i Index of the feature in the raw layer's `features` array.\n * @return {Object} Raw feature.\n */\nfunction readRawFeature(pbf, layer, i) {\n pbf.pos = layer.features[i];\n const end = pbf.readVarint() + pbf.pos;\n\n const feature = {\n layer: layer,\n type: 0,\n properties: {},\n };\n pbf.readFields(featurePBFReader, feature, end);\n return feature;\n}\n\n/**\n * @param {number} type The raw feature's geometry type\n * @param {number} numEnds Number of ends of the flat coordinates of the\n * geometry.\n * @return {import(\"../render/Feature.js\").Type} The geometry type.\n */\nfunction getGeometryType(type, numEnds) {\n /** @type {import(\"../render/Feature.js\").Type} */\n let geometryType;\n if (type === 1) {\n geometryType = numEnds === 1 ? 'Point' : 'MultiPoint';\n } else if (type === 2) {\n geometryType = numEnds === 1 ? 'LineString' : 'MultiLineString';\n } else if (type === 3) {\n geometryType = 'Polygon';\n // MultiPolygon not relevant for rendering - winding order determines\n // outer rings of polygons.\n }\n return geometryType;\n}\n\nexport default MVT;\n","/**\n * @module ol/format/TopoJSON\n */\nimport Feature from '../Feature.js';\nimport JSONFeature from './JSONFeature.js';\nimport LineString from '../geom/LineString.js';\nimport MultiLineString from '../geom/MultiLineString.js';\nimport MultiPoint from '../geom/MultiPoint.js';\nimport MultiPolygon from '../geom/MultiPolygon.js';\nimport Point from '../geom/Point.js';\nimport Polygon from '../geom/Polygon.js';\nimport {get as getProjection} from '../proj.js';\nimport {transformGeometryWithOptions} from './Feature.js';\n\n/**\n * @typedef {import(\"topojson-specification\").Topology} TopoJSONTopology\n * @typedef {import(\"topojson-specification\").GeometryCollection} TopoJSONGeometryCollection\n * @typedef {import(\"topojson-specification\").GeometryObject} TopoJSONGeometry\n * @typedef {import(\"topojson-specification\").Point} TopoJSONPoint\n * @typedef {import(\"topojson-specification\").MultiPoint} TopoJSONMultiPoint\n * @typedef {import(\"topojson-specification\").LineString} TopoJSONLineString\n * @typedef {import(\"topojson-specification\").MultiLineString} TopoJSONMultiLineString\n * @typedef {import(\"topojson-specification\").Polygon} TopoJSONPolygon\n * @typedef {import(\"topojson-specification\").MultiPolygon} TopoJSONMultiPolygon\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../proj.js\").ProjectionLike} [dataProjection='EPSG:4326'] Default data projection.\n * @property {string} [layerName] Set the name of the TopoJSON topology\n * `objects`'s children as feature property with the specified name. This means\n * that when set to `'layer'`, a topology like\n * ```\n * {\n * \"type\": \"Topology\",\n * \"objects\": {\n * \"example\": {\n * \"type\": \"GeometryCollection\",\n * \"geometries\": []\n * }\n * }\n * }\n * ```\n * will result in features that have a property `'layer'` set to `'example'`.\n * When not set, no property will be added to features.\n * @property {Array} [layers] Names of the TopoJSON topology's\n * `objects`'s children to read features from. If not provided, features will\n * be read from all children.\n */\n\n/**\n * @classdesc\n * Feature format for reading data in the TopoJSON format.\n *\n * @api\n */\nclass TopoJSON extends JSONFeature {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n options = options ? options : {};\n\n /**\n * @private\n * @type {string|undefined}\n */\n this.layerName_ = options.layerName;\n\n /**\n * @private\n * @type {?Array}\n */\n this.layers_ = options.layers ? options.layers : null;\n\n /**\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.dataProjection = getProjection(\n options.dataProjection ? options.dataProjection : 'EPSG:4326',\n );\n }\n\n /**\n * @param {Object} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {Array} Features.\n */\n readFeaturesFromObject(object, options) {\n if (object.type == 'Topology') {\n const topoJSONTopology = /** @type {TopoJSONTopology} */ (object);\n let transform,\n scale = null,\n translate = null;\n if (topoJSONTopology['transform']) {\n transform = topoJSONTopology['transform'];\n scale = transform['scale'];\n translate = transform['translate'];\n }\n const arcs = topoJSONTopology['arcs'];\n if (transform) {\n transformArcs(arcs, scale, translate);\n }\n /** @type {Array} */\n const features = [];\n const topoJSONFeatures = topoJSONTopology['objects'];\n const property = this.layerName_;\n let feature;\n for (const objectName in topoJSONFeatures) {\n if (this.layers_ && !this.layers_.includes(objectName)) {\n continue;\n }\n if (topoJSONFeatures[objectName].type === 'GeometryCollection') {\n feature = /** @type {TopoJSONGeometryCollection} */ (\n topoJSONFeatures[objectName]\n );\n features.push.apply(\n features,\n readFeaturesFromGeometryCollection(\n feature,\n arcs,\n scale,\n translate,\n property,\n objectName,\n options,\n ),\n );\n } else {\n feature = /** @type {TopoJSONGeometry} */ (\n topoJSONFeatures[objectName]\n );\n features.push(\n readFeatureFromGeometry(\n feature,\n arcs,\n scale,\n translate,\n property,\n objectName,\n options,\n ),\n );\n }\n }\n return features;\n }\n return [];\n }\n\n /**\n * @param {Object} object Object.\n * @protected\n * @return {import(\"../proj/Projection.js\").default} Projection.\n */\n readProjectionFromObject(object) {\n return this.dataProjection;\n }\n}\n\n/**\n * @const\n * @type {Object}\n */\nconst GEOMETRY_READERS = {\n 'Point': readPointGeometry,\n 'LineString': readLineStringGeometry,\n 'Polygon': readPolygonGeometry,\n 'MultiPoint': readMultiPointGeometry,\n 'MultiLineString': readMultiLineStringGeometry,\n 'MultiPolygon': readMultiPolygonGeometry,\n};\n\n/**\n * Concatenate arcs into a coordinate array.\n * @param {Array} indices Indices of arcs to concatenate. Negative\n * values indicate arcs need to be reversed.\n * @param {Array>} arcs Array of arcs (already\n * transformed).\n * @return {Array} Coordinates array.\n */\nfunction concatenateArcs(indices, arcs) {\n /** @type {Array} */\n const coordinates = [];\n let index;\n for (let i = 0, ii = indices.length; i < ii; ++i) {\n index = indices[i];\n if (i > 0) {\n // splicing together arcs, discard last point\n coordinates.pop();\n }\n if (index >= 0) {\n // forward arc\n const arc = arcs[index];\n for (let j = 0, jj = arc.length; j < jj; ++j) {\n coordinates.push(arc[j].slice(0));\n }\n } else {\n // reverse arc\n const arc = arcs[~index];\n for (let j = arc.length - 1; j >= 0; --j) {\n coordinates.push(arc[j].slice(0));\n }\n }\n }\n return coordinates;\n}\n\n/**\n * Create a point from a TopoJSON geometry object.\n *\n * @param {TopoJSONPoint} object TopoJSON object.\n * @param {Array} scale Scale for each dimension.\n * @param {Array} translate Translation for each dimension.\n * @return {Point} Geometry.\n */\nfunction readPointGeometry(object, scale, translate) {\n const coordinates = object['coordinates'];\n if (scale && translate) {\n transformVertex(coordinates, scale, translate);\n }\n return new Point(coordinates);\n}\n\n/**\n * Create a multi-point from a TopoJSON geometry object.\n *\n * @param {TopoJSONMultiPoint} object TopoJSON object.\n * @param {Array} scale Scale for each dimension.\n * @param {Array} translate Translation for each dimension.\n * @return {MultiPoint} Geometry.\n */\nfunction readMultiPointGeometry(object, scale, translate) {\n const coordinates = object['coordinates'];\n if (scale && translate) {\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n transformVertex(coordinates[i], scale, translate);\n }\n }\n return new MultiPoint(coordinates);\n}\n\n/**\n * Create a linestring from a TopoJSON geometry object.\n *\n * @param {TopoJSONLineString} object TopoJSON object.\n * @param {Array>} arcs Array of arcs.\n * @return {LineString} Geometry.\n */\nfunction readLineStringGeometry(object, arcs) {\n const coordinates = concatenateArcs(object['arcs'], arcs);\n return new LineString(coordinates);\n}\n\n/**\n * Create a multi-linestring from a TopoJSON geometry object.\n *\n * @param {TopoJSONMultiLineString} object TopoJSON object.\n * @param {Array>} arcs Array of arcs.\n * @return {MultiLineString} Geometry.\n */\nfunction readMultiLineStringGeometry(object, arcs) {\n const coordinates = [];\n for (let i = 0, ii = object['arcs'].length; i < ii; ++i) {\n coordinates[i] = concatenateArcs(object['arcs'][i], arcs);\n }\n return new MultiLineString(coordinates);\n}\n\n/**\n * Create a polygon from a TopoJSON geometry object.\n *\n * @param {TopoJSONPolygon} object TopoJSON object.\n * @param {Array>} arcs Array of arcs.\n * @return {Polygon} Geometry.\n */\nfunction readPolygonGeometry(object, arcs) {\n const coordinates = [];\n for (let i = 0, ii = object['arcs'].length; i < ii; ++i) {\n coordinates[i] = concatenateArcs(object['arcs'][i], arcs);\n }\n return new Polygon(coordinates);\n}\n\n/**\n * Create a multi-polygon from a TopoJSON geometry object.\n *\n * @param {TopoJSONMultiPolygon} object TopoJSON object.\n * @param {Array>} arcs Array of arcs.\n * @return {MultiPolygon} Geometry.\n */\nfunction readMultiPolygonGeometry(object, arcs) {\n const coordinates = [];\n for (let i = 0, ii = object['arcs'].length; i < ii; ++i) {\n // for each polygon\n const polyArray = object['arcs'][i];\n const ringCoords = [];\n for (let j = 0, jj = polyArray.length; j < jj; ++j) {\n // for each ring\n ringCoords[j] = concatenateArcs(polyArray[j], arcs);\n }\n coordinates[i] = ringCoords;\n }\n return new MultiPolygon(coordinates);\n}\n\n/**\n * Create features from a TopoJSON GeometryCollection object.\n *\n * @param {TopoJSONGeometryCollection} collection TopoJSON Geometry\n * object.\n * @param {Array>} arcs Array of arcs.\n * @param {Array} scale Scale for each dimension.\n * @param {Array} translate Translation for each dimension.\n * @param {string|undefined} property Property to set the `GeometryCollection`'s parent\n * object to.\n * @param {string} name Name of the `Topology`'s child object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {Array} Array of features.\n */\nfunction readFeaturesFromGeometryCollection(\n collection,\n arcs,\n scale,\n translate,\n property,\n name,\n options,\n) {\n const geometries = collection['geometries'];\n const features = [];\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n features[i] = readFeatureFromGeometry(\n geometries[i],\n arcs,\n scale,\n translate,\n property,\n name,\n options,\n );\n }\n return features;\n}\n\n/**\n * Create a feature from a TopoJSON geometry object.\n *\n * @param {TopoJSONGeometry} object TopoJSON geometry object.\n * @param {Array>} arcs Array of arcs.\n * @param {Array} scale Scale for each dimension.\n * @param {Array} translate Translation for each dimension.\n * @param {string|undefined} property Property to set the `GeometryCollection`'s parent\n * object to.\n * @param {string} name Name of the `Topology`'s child object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {Feature} Feature.\n */\nfunction readFeatureFromGeometry(\n object,\n arcs,\n scale,\n translate,\n property,\n name,\n options,\n) {\n let geometry = null;\n const type = object.type;\n if (type) {\n const geometryReader = GEOMETRY_READERS[type];\n if (type === 'Point' || type === 'MultiPoint') {\n geometry = geometryReader(object, scale, translate);\n } else {\n geometry = geometryReader(object, arcs);\n }\n geometry = transformGeometryWithOptions(geometry, false, options);\n }\n const feature = new Feature({geometry: geometry});\n if (object.id !== undefined) {\n feature.setId(object.id);\n }\n let properties = object.properties;\n if (property) {\n if (!properties) {\n properties = {};\n }\n properties[property] = name;\n }\n if (properties) {\n feature.setProperties(properties, true);\n }\n return feature;\n}\n\n/**\n * Apply a linear transform to array of arcs. The provided array of arcs is\n * modified in place.\n *\n * @param {Array>} arcs Array of arcs.\n * @param {Array} scale Scale for each dimension.\n * @param {Array} translate Translation for each dimension.\n */\nfunction transformArcs(arcs, scale, translate) {\n for (let i = 0, ii = arcs.length; i < ii; ++i) {\n transformArc(arcs[i], scale, translate);\n }\n}\n\n/**\n * Apply a linear transform to an arc. The provided arc is modified in place.\n *\n * @param {Array} arc Arc.\n * @param {Array} scale Scale for each dimension.\n * @param {Array} translate Translation for each dimension.\n */\nfunction transformArc(arc, scale, translate) {\n let x = 0;\n let y = 0;\n for (let i = 0, ii = arc.length; i < ii; ++i) {\n const vertex = arc[i];\n x += vertex[0];\n y += vertex[1];\n vertex[0] = x;\n vertex[1] = y;\n transformVertex(vertex, scale, translate);\n }\n}\n\n/**\n * Apply a linear transform to a vertex. The provided vertex is modified in\n * place.\n *\n * @param {import(\"../coordinate.js\").Coordinate} vertex Vertex.\n * @param {Array} scale Scale for each dimension.\n * @param {Array} translate Translation for each dimension.\n */\nfunction transformVertex(vertex, scale, translate) {\n vertex[0] = vertex[0] * scale[0] + translate[0];\n vertex[1] = vertex[1] * scale[1] + translate[1];\n}\n\nexport default TopoJSON;\n","/**\n * @module ol/functions\n */\n\nimport {equals as arrayEquals} from './array.js';\n\n/**\n * Always returns true.\n * @return {boolean} true.\n */\nexport function TRUE() {\n return true;\n}\n\n/**\n * Always returns false.\n * @return {boolean} false.\n */\nexport function FALSE() {\n return false;\n}\n\n/**\n * A reusable function, used e.g. as a default for callbacks.\n *\n * @return {void} Nothing.\n */\nexport function VOID() {}\n\n/**\n * Wrap a function in another function that remembers the last return. If the\n * returned function is called twice in a row with the same arguments and the same\n * this object, it will return the value from the first call in the second call.\n *\n * @param {function(...any): ReturnType} fn The function to memoize.\n * @return {function(...any): ReturnType} The memoized function.\n * @template ReturnType\n */\nexport function memoizeOne(fn) {\n let called = false;\n\n /** @type {ReturnType} */\n let lastResult;\n\n /** @type {Array} */\n let lastArgs;\n\n let lastThis;\n\n return function () {\n const nextArgs = Array.prototype.slice.call(arguments);\n if (!called || this !== lastThis || !arrayEquals(nextArgs, lastArgs)) {\n called = true;\n lastThis = this;\n lastArgs = nextArgs;\n lastResult = fn.apply(this, arguments);\n }\n return lastResult;\n };\n}\n\n/**\n * @template T\n * @param {function(): (T | Promise)} getter A function that returns a value or a promise for a value.\n * @return {Promise} A promise for the value.\n */\nexport function toPromise(getter) {\n function promiseGetter() {\n let value;\n try {\n value = getter();\n } catch (err) {\n return Promise.reject(err);\n }\n if (value instanceof Promise) {\n return value;\n }\n return Promise.resolve(value);\n }\n return promiseGetter();\n}\n","/**\n * @module ol/geom/Geometry\n */\nimport BaseObject from '../Object.js';\nimport {abstract} from '../util.js';\nimport {\n compose as composeTransform,\n create as createTransform,\n} from '../transform.js';\nimport {\n createEmpty,\n createOrUpdateEmpty,\n getHeight,\n returnOrUpdate,\n} from '../extent.js';\nimport {get as getProjection, getTransform} from '../proj.js';\nimport {memoizeOne} from '../functions.js';\nimport {transform2D} from './flat/transform.js';\n\n/**\n * @typedef {'XY' | 'XYZ' | 'XYM' | 'XYZM'} GeometryLayout\n * The coordinate layout for geometries, indicating whether a 3rd or 4th z ('Z')\n * or measure ('M') coordinate is available.\n */\n\n/**\n * @typedef {'Point' | 'LineString' | 'LinearRing' | 'Polygon' | 'MultiPoint' | 'MultiLineString' | 'MultiPolygon' | 'GeometryCollection' | 'Circle'} Type\n * The geometry type. One of `'Point'`, `'LineString'`, `'LinearRing'`,\n * `'Polygon'`, `'MultiPoint'`, `'MultiLineString'`, `'MultiPolygon'`,\n * `'GeometryCollection'`, or `'Circle'`.\n */\n\n/**\n * @type {import(\"../transform.js\").Transform}\n */\nconst tmpTransform = createTransform();\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Base class for vector geometries.\n *\n * To get notified of changes to the geometry, register a listener for the\n * generic `change` event on your geometry instance.\n *\n * @abstract\n * @api\n */\nclass Geometry extends BaseObject {\n constructor() {\n super();\n\n /**\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.extent_ = createEmpty();\n\n /**\n * @private\n * @type {number}\n */\n this.extentRevision_ = -1;\n\n /**\n * @protected\n * @type {number}\n */\n this.simplifiedGeometryMaxMinSquaredTolerance = 0;\n\n /**\n * @protected\n * @type {number}\n */\n this.simplifiedGeometryRevision = 0;\n\n /**\n * Get a transformed and simplified version of the geometry.\n * @abstract\n * @param {number} revision The geometry revision.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {import(\"../proj.js\").TransformFunction} [transform] Optional transform function.\n * @return {Geometry} Simplified geometry.\n */\n this.simplifyTransformedInternal = memoizeOne(\n (revision, squaredTolerance, transform) => {\n if (!transform) {\n return this.getSimplifiedGeometry(squaredTolerance);\n }\n const clone = this.clone();\n clone.applyTransform(transform);\n return clone.getSimplifiedGeometry(squaredTolerance);\n },\n );\n }\n\n /**\n * Get a transformed and simplified version of the geometry.\n * @abstract\n * @param {number} squaredTolerance Squared tolerance.\n * @param {import(\"../proj.js\").TransformFunction} [transform] Optional transform function.\n * @return {Geometry} Simplified geometry.\n */\n simplifyTransformed(squaredTolerance, transform) {\n return this.simplifyTransformedInternal(\n this.getRevision(),\n squaredTolerance,\n transform,\n );\n }\n\n /**\n * Make a complete copy of the geometry.\n * @abstract\n * @return {!Geometry} Clone.\n */\n clone() {\n return abstract();\n }\n\n /**\n * @abstract\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n return abstract();\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\n containsXY(x, y) {\n const coord = this.getClosestPoint([x, y]);\n return coord[0] === x && coord[1] === y;\n }\n\n /**\n * Return the closest point of the geometry to the passed point as\n * {@link module:ol/coordinate~Coordinate coordinate}.\n * @param {import(\"../coordinate.js\").Coordinate} point Point.\n * @param {import(\"../coordinate.js\").Coordinate} [closestPoint] Closest point.\n * @return {import(\"../coordinate.js\").Coordinate} Closest point.\n * @api\n */\n getClosestPoint(point, closestPoint) {\n closestPoint = closestPoint ? closestPoint : [NaN, NaN];\n this.closestPointXY(point[0], point[1], closestPoint, Infinity);\n return closestPoint;\n }\n\n /**\n * Returns true if this geometry includes the specified coordinate. If the\n * coordinate is on the boundary of the geometry, returns false.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @return {boolean} Contains coordinate.\n * @api\n */\n intersectsCoordinate(coordinate) {\n return this.containsXY(coordinate[0], coordinate[1]);\n }\n\n /**\n * @abstract\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @protected\n * @return {import(\"../extent.js\").Extent} extent Extent.\n */\n computeExtent(extent) {\n return abstract();\n }\n\n /**\n * Get the extent of the geometry.\n * @param {import(\"../extent.js\").Extent} [extent] Extent.\n * @return {import(\"../extent.js\").Extent} extent Extent.\n * @api\n */\n getExtent(extent) {\n if (this.extentRevision_ != this.getRevision()) {\n const extent = this.computeExtent(this.extent_);\n if (isNaN(extent[0]) || isNaN(extent[1])) {\n createOrUpdateEmpty(extent);\n }\n this.extentRevision_ = this.getRevision();\n }\n return returnOrUpdate(this.extent_, extent);\n }\n\n /**\n * Rotate the geometry around a given coordinate. This modifies the geometry\n * coordinates in place.\n * @abstract\n * @param {number} angle Rotation angle in radians.\n * @param {import(\"../coordinate.js\").Coordinate} anchor The rotation center.\n * @api\n */\n rotate(angle, anchor) {\n abstract();\n }\n\n /**\n * Scale the geometry (with an optional origin). This modifies the geometry\n * coordinates in place.\n * @abstract\n * @param {number} sx The scaling factor in the x-direction.\n * @param {number} [sy] The scaling factor in the y-direction (defaults to sx).\n * @param {import(\"../coordinate.js\").Coordinate} [anchor] The scale origin (defaults to the center\n * of the geometry extent).\n * @api\n */\n scale(sx, sy, anchor) {\n abstract();\n }\n\n /**\n * Create a simplified version of this geometry. For linestrings, this uses\n * the [Douglas Peucker](https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm)\n * algorithm. For polygons, a quantization-based\n * simplification is used to preserve topology.\n * @param {number} tolerance The tolerance distance for simplification.\n * @return {Geometry} A new, simplified version of the original geometry.\n * @api\n */\n simplify(tolerance) {\n return this.getSimplifiedGeometry(tolerance * tolerance);\n }\n\n /**\n * Create a simplified version of this geometry using the Douglas Peucker\n * algorithm.\n * See https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm.\n * @abstract\n * @param {number} squaredTolerance Squared tolerance.\n * @return {Geometry} Simplified geometry.\n */\n getSimplifiedGeometry(squaredTolerance) {\n return abstract();\n }\n\n /**\n * Get the type of this geometry.\n * @abstract\n * @return {Type} Geometry type.\n */\n getType() {\n return abstract();\n }\n\n /**\n * Apply a transform function to the coordinates of the geometry.\n * The geometry is modified in place.\n * If you do not want the geometry modified in place, first `clone()` it and\n * then use this function on the clone.\n * @abstract\n * @param {import(\"../proj.js\").TransformFunction} transformFn Transform function.\n * Called with a flat array of geometry coordinates.\n */\n applyTransform(transformFn) {\n abstract();\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @abstract\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n */\n intersectsExtent(extent) {\n return abstract();\n }\n\n /**\n * Translate the geometry. This modifies the geometry coordinates in place. If\n * instead you want a new geometry, first `clone()` this geometry.\n * @abstract\n * @param {number} deltaX Delta X.\n * @param {number} deltaY Delta Y.\n * @api\n */\n translate(deltaX, deltaY) {\n abstract();\n }\n\n /**\n * Transform each coordinate of the geometry from one coordinate reference\n * system to another. The geometry is modified in place.\n * For example, a line will be transformed to a line and a circle to a circle.\n * If you do not want the geometry modified in place, first `clone()` it and\n * then use this function on the clone.\n *\n * @param {import(\"../proj.js\").ProjectionLike} source The current projection. Can be a\n * string identifier or a {@link module:ol/proj/Projection~Projection} object.\n * @param {import(\"../proj.js\").ProjectionLike} destination The desired projection. Can be a\n * string identifier or a {@link module:ol/proj/Projection~Projection} object.\n * @return {this} This geometry. Note that original geometry is\n * modified in place.\n * @api\n */\n transform(source, destination) {\n /** @type {import(\"../proj/Projection.js\").default} */\n const sourceProj = getProjection(source);\n const transformFn =\n sourceProj.getUnits() == 'tile-pixels'\n ? function (inCoordinates, outCoordinates, stride) {\n const pixelExtent = sourceProj.getExtent();\n const projectedExtent = sourceProj.getWorldExtent();\n const scale = getHeight(projectedExtent) / getHeight(pixelExtent);\n composeTransform(\n tmpTransform,\n projectedExtent[0],\n projectedExtent[3],\n scale,\n -scale,\n 0,\n 0,\n 0,\n );\n transform2D(\n inCoordinates,\n 0,\n inCoordinates.length,\n stride,\n tmpTransform,\n outCoordinates,\n );\n return getTransform(sourceProj, destination)(\n inCoordinates,\n outCoordinates,\n stride,\n );\n }\n : getTransform(sourceProj, destination);\n this.applyTransform(transformFn);\n return this;\n }\n}\n\nexport default Geometry;\n","/**\n * @module ol/geom/LineString\n */\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {assignClosestPoint, maxSquaredDelta} from './flat/closest.js';\nimport {closestSquaredDistanceXY} from '../extent.js';\nimport {deflateCoordinates} from './flat/deflate.js';\nimport {douglasPeucker} from './flat/simplify.js';\nimport {extend} from '../array.js';\nimport {forEach as forEachSegment} from './flat/segments.js';\nimport {inflateCoordinates} from './flat/inflate.js';\nimport {interpolatePoint, lineStringCoordinateAtM} from './flat/interpolate.js';\nimport {intersectsLineString} from './flat/intersectsextent.js';\nimport {lineStringLength} from './flat/length.js';\n\n/**\n * @classdesc\n * Linestring geometry.\n *\n * @api\n */\nclass LineString extends SimpleGeometry {\n /**\n * @param {Array|Array} coordinates Coordinates.\n * For internal use, flat coordinates in combination with `layout` are also accepted.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n */\n constructor(coordinates, layout) {\n super();\n\n /**\n * @private\n * @type {import(\"../coordinate.js\").Coordinate|null}\n */\n this.flatMidpoint_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.flatMidpointRevision_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDeltaRevision_ = -1;\n\n if (layout !== undefined && !Array.isArray(coordinates[0])) {\n this.setFlatCoordinates(\n layout,\n /** @type {Array} */ (coordinates),\n );\n } else {\n this.setCoordinates(\n /** @type {Array} */ (\n coordinates\n ),\n layout,\n );\n }\n }\n\n /**\n * Append the passed coordinate to the coordinates of the linestring.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @api\n */\n appendCoordinate(coordinate) {\n extend(this.flatCoordinates, coordinate);\n this.changed();\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!LineString} Clone.\n * @api\n */\n clone() {\n const lineString = new LineString(\n this.flatCoordinates.slice(),\n this.layout,\n );\n lineString.applyProperties(this);\n return lineString;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n if (this.maxDeltaRevision_ != this.getRevision()) {\n this.maxDelta_ = Math.sqrt(\n maxSquaredDelta(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n 0,\n ),\n );\n this.maxDeltaRevision_ = this.getRevision();\n }\n return assignClosestPoint(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n this.maxDelta_,\n false,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n );\n }\n\n /**\n * Iterate over each segment, calling the provided callback.\n * If the callback returns a truthy value the function returns that\n * value immediately. Otherwise the function returns `false`.\n *\n * @param {function(this: S, import(\"../coordinate.js\").Coordinate, import(\"../coordinate.js\").Coordinate): T} callback Function\n * called for each segment. The function will receive two arguments, the start and end coordinates of the segment.\n * @return {T|boolean} Value.\n * @template T,S\n * @api\n */\n forEachSegment(callback) {\n return forEachSegment(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n callback,\n );\n }\n\n /**\n * Returns the coordinate at `m` using linear interpolation, or `null` if no\n * such coordinate exists.\n *\n * `extrapolate` controls extrapolation beyond the range of Ms in the\n * MultiLineString. If `extrapolate` is `true` then Ms less than the first\n * M will return the first coordinate and Ms greater than the last M will\n * return the last coordinate.\n *\n * @param {number} m M.\n * @param {boolean} [extrapolate] Extrapolate. Default is `false`.\n * @return {import(\"../coordinate.js\").Coordinate|null} Coordinate.\n * @api\n */\n getCoordinateAtM(m, extrapolate) {\n if (this.layout != 'XYM' && this.layout != 'XYZM') {\n return null;\n }\n extrapolate = extrapolate !== undefined ? extrapolate : false;\n return lineStringCoordinateAtM(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n m,\n extrapolate,\n );\n }\n\n /**\n * Return the coordinates of the linestring.\n * @return {Array} Coordinates.\n * @api\n */\n getCoordinates() {\n return inflateCoordinates(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n );\n }\n\n /**\n * Return the coordinate at the provided fraction along the linestring.\n * The `fraction` is a number between 0 and 1, where 0 is the start of the\n * linestring and 1 is the end.\n * @param {number} fraction Fraction.\n * @param {import(\"../coordinate.js\").Coordinate} [dest] Optional coordinate whose values will\n * be modified. If not provided, a new coordinate will be returned.\n * @return {import(\"../coordinate.js\").Coordinate} Coordinate of the interpolated point.\n * @api\n */\n getCoordinateAt(fraction, dest) {\n return interpolatePoint(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n fraction,\n dest,\n this.stride,\n );\n }\n\n /**\n * Return the length of the linestring on projected plane.\n * @return {number} Length (on projected plane).\n * @api\n */\n getLength() {\n return lineStringLength(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n );\n }\n\n /**\n * @return {Array} Flat midpoint.\n */\n getFlatMidpoint() {\n if (this.flatMidpointRevision_ != this.getRevision()) {\n this.flatMidpoint_ = this.getCoordinateAt(\n 0.5,\n this.flatMidpoint_ ?? undefined,\n );\n this.flatMidpointRevision_ = this.getRevision();\n }\n return /** @type {Array} */ (this.flatMidpoint_);\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {LineString} Simplified LineString.\n * @protected\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n /** @type {Array} */\n const simplifiedFlatCoordinates = [];\n simplifiedFlatCoordinates.length = douglasPeucker(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0,\n );\n return new LineString(simplifiedFlatCoordinates, 'XY');\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n */\n getType() {\n return 'LineString';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n */\n intersectsExtent(extent) {\n return intersectsLineString(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n extent,\n );\n }\n\n /**\n * Set the coordinates of the linestring.\n * @param {!Array} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @api\n */\n setCoordinates(coordinates, layout) {\n this.setLayout(layout, coordinates, 1);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n this.flatCoordinates.length = deflateCoordinates(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n );\n this.changed();\n }\n}\n\nexport default LineString;\n","/**\n * @module ol/geom/MultiLineString\n */\nimport LineString from './LineString.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {arrayMaxSquaredDelta, assignClosestArrayPoint} from './flat/closest.js';\nimport {closestSquaredDistanceXY} from '../extent.js';\nimport {deflateCoordinatesArray} from './flat/deflate.js';\nimport {douglasPeuckerArray} from './flat/simplify.js';\nimport {extend} from '../array.js';\nimport {inflateCoordinatesArray} from './flat/inflate.js';\nimport {\n interpolatePoint,\n lineStringsCoordinateAtM,\n} from './flat/interpolate.js';\nimport {intersectsLineStringArray} from './flat/intersectsextent.js';\n\n/**\n * @classdesc\n * Multi-linestring geometry.\n *\n * @api\n */\nclass MultiLineString extends SimpleGeometry {\n /**\n * @param {Array|LineString>|Array} coordinates\n * Coordinates or LineString geometries. (For internal use, flat coordinates in\n * combination with `layout` and `ends` are also accepted.)\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @param {Array} [ends] Flat coordinate ends for internal use.\n */\n constructor(coordinates, layout, ends) {\n super();\n\n /**\n * @type {Array}\n * @private\n */\n this.ends_ = [];\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDeltaRevision_ = -1;\n\n if (Array.isArray(coordinates[0])) {\n this.setCoordinates(\n /** @type {Array>} */ (\n coordinates\n ),\n layout,\n );\n } else if (layout !== undefined && ends) {\n this.setFlatCoordinates(\n layout,\n /** @type {Array} */ (coordinates),\n );\n this.ends_ = ends;\n } else {\n const lineStrings = /** @type {Array} */ (coordinates);\n /** @type {Array} */\n const flatCoordinates = [];\n const ends = [];\n for (let i = 0, ii = lineStrings.length; i < ii; ++i) {\n const lineString = lineStrings[i];\n extend(flatCoordinates, lineString.getFlatCoordinates());\n ends.push(flatCoordinates.length);\n }\n const layout =\n lineStrings.length === 0\n ? this.getLayout()\n : lineStrings[0].getLayout();\n this.setFlatCoordinates(layout, flatCoordinates);\n this.ends_ = ends;\n }\n }\n\n /**\n * Append the passed linestring to the multilinestring.\n * @param {LineString} lineString LineString.\n * @api\n */\n appendLineString(lineString) {\n extend(this.flatCoordinates, lineString.getFlatCoordinates().slice());\n this.ends_.push(this.flatCoordinates.length);\n this.changed();\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!MultiLineString} Clone.\n * @api\n */\n clone() {\n const multiLineString = new MultiLineString(\n this.flatCoordinates.slice(),\n this.layout,\n this.ends_.slice(),\n );\n multiLineString.applyProperties(this);\n return multiLineString;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n if (this.maxDeltaRevision_ != this.getRevision()) {\n this.maxDelta_ = Math.sqrt(\n arrayMaxSquaredDelta(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n 0,\n ),\n );\n this.maxDeltaRevision_ = this.getRevision();\n }\n return assignClosestArrayPoint(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n this.maxDelta_,\n false,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n );\n }\n\n /**\n * Returns the coordinate at `m` using linear interpolation, or `null` if no\n * such coordinate exists.\n *\n * `extrapolate` controls extrapolation beyond the range of Ms in the\n * MultiLineString. If `extrapolate` is `true` then Ms less than the first\n * M will return the first coordinate and Ms greater than the last M will\n * return the last coordinate.\n *\n * `interpolate` controls interpolation between consecutive LineStrings\n * within the MultiLineString. If `interpolate` is `true` the coordinates\n * will be linearly interpolated between the last coordinate of one LineString\n * and the first coordinate of the next LineString. If `interpolate` is\n * `false` then the function will return `null` for Ms falling between\n * LineStrings.\n *\n * @param {number} m M.\n * @param {boolean} [extrapolate] Extrapolate. Default is `false`.\n * @param {boolean} [interpolate] Interpolate. Default is `false`.\n * @return {import(\"../coordinate.js\").Coordinate|null} Coordinate.\n * @api\n */\n getCoordinateAtM(m, extrapolate, interpolate) {\n if (\n (this.layout != 'XYM' && this.layout != 'XYZM') ||\n this.flatCoordinates.length === 0\n ) {\n return null;\n }\n extrapolate = extrapolate !== undefined ? extrapolate : false;\n interpolate = interpolate !== undefined ? interpolate : false;\n return lineStringsCoordinateAtM(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n m,\n extrapolate,\n interpolate,\n );\n }\n\n /**\n * Return the coordinates of the multilinestring.\n * @return {Array>} Coordinates.\n * @api\n */\n getCoordinates() {\n return inflateCoordinatesArray(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n );\n }\n\n /**\n * @return {Array} Ends.\n */\n getEnds() {\n return this.ends_;\n }\n\n /**\n * Return the linestring at the specified index.\n * @param {number} index Index.\n * @return {LineString} LineString.\n * @api\n */\n getLineString(index) {\n if (index < 0 || this.ends_.length <= index) {\n return null;\n }\n return new LineString(\n this.flatCoordinates.slice(\n index === 0 ? 0 : this.ends_[index - 1],\n this.ends_[index],\n ),\n this.layout,\n );\n }\n\n /**\n * Return the linestrings of this multilinestring.\n * @return {Array} LineStrings.\n * @api\n */\n getLineStrings() {\n const flatCoordinates = this.flatCoordinates;\n const ends = this.ends_;\n const layout = this.layout;\n /** @type {Array} */\n const lineStrings = [];\n let offset = 0;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const lineString = new LineString(\n flatCoordinates.slice(offset, end),\n layout,\n );\n lineStrings.push(lineString);\n offset = end;\n }\n return lineStrings;\n }\n\n /**\n * @return {Array} Flat midpoints.\n */\n getFlatMidpoints() {\n /** @type {Array} */\n const midpoints = [];\n const flatCoordinates = this.flatCoordinates;\n let offset = 0;\n const ends = this.ends_;\n const stride = this.stride;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const midpoint = interpolatePoint(\n flatCoordinates,\n offset,\n end,\n stride,\n 0.5,\n );\n extend(midpoints, midpoint);\n offset = end;\n }\n return midpoints;\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {MultiLineString} Simplified MultiLineString.\n * @protected\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n /** @type {Array} */\n const simplifiedFlatCoordinates = [];\n /** @type {Array} */\n const simplifiedEnds = [];\n simplifiedFlatCoordinates.length = douglasPeuckerArray(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0,\n simplifiedEnds,\n );\n return new MultiLineString(simplifiedFlatCoordinates, 'XY', simplifiedEnds);\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n */\n getType() {\n return 'MultiLineString';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n */\n intersectsExtent(extent) {\n return intersectsLineStringArray(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n extent,\n );\n }\n\n /**\n * Set the coordinates of the multilinestring.\n * @param {!Array>} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @api\n */\n setCoordinates(coordinates, layout) {\n this.setLayout(layout, coordinates, 2);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n const ends = deflateCoordinatesArray(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n this.ends_,\n );\n this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1];\n this.changed();\n }\n}\n\nexport default MultiLineString;\n","/**\n * @module ol/geom/MultiPoint\n */\nimport Point from './Point.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {closestSquaredDistanceXY, containsXY} from '../extent.js';\nimport {deflateCoordinates} from './flat/deflate.js';\nimport {extend} from '../array.js';\nimport {inflateCoordinates} from './flat/inflate.js';\nimport {squaredDistance as squaredDx} from '../math.js';\n\n/**\n * @classdesc\n * Multi-point geometry.\n *\n * @api\n */\nclass MultiPoint extends SimpleGeometry {\n /**\n * @param {Array|Array} coordinates Coordinates.\n * For internal use, flat coordinates in combination with `layout` are also accepted.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n */\n constructor(coordinates, layout) {\n super();\n if (layout && !Array.isArray(coordinates[0])) {\n this.setFlatCoordinates(\n layout,\n /** @type {Array} */ (coordinates),\n );\n } else {\n this.setCoordinates(\n /** @type {Array} */ (\n coordinates\n ),\n layout,\n );\n }\n }\n\n /**\n * Append the passed point to this multipoint.\n * @param {Point} point Point.\n * @api\n */\n appendPoint(point) {\n extend(this.flatCoordinates, point.getFlatCoordinates());\n this.changed();\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!MultiPoint} Clone.\n * @api\n */\n clone() {\n const multiPoint = new MultiPoint(\n this.flatCoordinates.slice(),\n this.layout,\n );\n multiPoint.applyProperties(this);\n return multiPoint;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n const flatCoordinates = this.flatCoordinates;\n const stride = this.stride;\n for (let i = 0, ii = flatCoordinates.length; i < ii; i += stride) {\n const squaredDistance = squaredDx(\n x,\n y,\n flatCoordinates[i],\n flatCoordinates[i + 1],\n );\n if (squaredDistance < minSquaredDistance) {\n minSquaredDistance = squaredDistance;\n for (let j = 0; j < stride; ++j) {\n closestPoint[j] = flatCoordinates[i + j];\n }\n closestPoint.length = stride;\n }\n }\n return minSquaredDistance;\n }\n\n /**\n * Return the coordinates of the multipoint.\n * @return {Array} Coordinates.\n * @api\n */\n getCoordinates() {\n return inflateCoordinates(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n );\n }\n\n /**\n * Return the point at the specified index.\n * @param {number} index Index.\n * @return {Point} Point.\n * @api\n */\n getPoint(index) {\n const n = this.flatCoordinates.length / this.stride;\n if (index < 0 || n <= index) {\n return null;\n }\n return new Point(\n this.flatCoordinates.slice(\n index * this.stride,\n (index + 1) * this.stride,\n ),\n this.layout,\n );\n }\n\n /**\n * Return the points of this multipoint.\n * @return {Array} Points.\n * @api\n */\n getPoints() {\n const flatCoordinates = this.flatCoordinates;\n const layout = this.layout;\n const stride = this.stride;\n /** @type {Array} */\n const points = [];\n for (let i = 0, ii = flatCoordinates.length; i < ii; i += stride) {\n const point = new Point(flatCoordinates.slice(i, i + stride), layout);\n points.push(point);\n }\n return points;\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n */\n getType() {\n return 'MultiPoint';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n */\n intersectsExtent(extent) {\n const flatCoordinates = this.flatCoordinates;\n const stride = this.stride;\n for (let i = 0, ii = flatCoordinates.length; i < ii; i += stride) {\n const x = flatCoordinates[i];\n const y = flatCoordinates[i + 1];\n if (containsXY(extent, x, y)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Set the coordinates of the multipoint.\n * @param {!Array} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @api\n */\n setCoordinates(coordinates, layout) {\n this.setLayout(layout, coordinates, 1);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n this.flatCoordinates.length = deflateCoordinates(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n );\n this.changed();\n }\n}\n\nexport default MultiPoint;\n","/**\n * @module ol/geom/MultiPolygon\n */\nimport MultiPoint from './MultiPoint.js';\nimport Polygon from './Polygon.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {\n assignClosestMultiArrayPoint,\n multiArrayMaxSquaredDelta,\n} from './flat/closest.js';\nimport {closestSquaredDistanceXY} from '../extent.js';\nimport {deflateMultiCoordinatesArray} from './flat/deflate.js';\nimport {extend} from '../array.js';\nimport {getInteriorPointsOfMultiArray} from './flat/interiorpoint.js';\nimport {inflateMultiCoordinatesArray} from './flat/inflate.js';\nimport {intersectsLinearRingMultiArray} from './flat/intersectsextent.js';\nimport {\n linearRingssAreOriented,\n orientLinearRingsArray,\n} from './flat/orient.js';\nimport {linearRingss as linearRingssArea} from './flat/area.js';\nimport {linearRingss as linearRingssCenter} from './flat/center.js';\nimport {linearRingssContainsXY} from './flat/contains.js';\nimport {quantizeMultiArray} from './flat/simplify.js';\n\n/**\n * @classdesc\n * Multi-polygon geometry.\n *\n * @api\n */\nclass MultiPolygon extends SimpleGeometry {\n /**\n * @param {Array>|Polygon>|Array} coordinates Coordinates.\n * For internal use, flat coordinates in combination with `layout` and `endss` are also accepted.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @param {Array>} [endss] Array of ends for internal use with flat coordinates.\n */\n constructor(coordinates, layout, endss) {\n super();\n\n /**\n * @type {Array>}\n * @private\n */\n this.endss_ = [];\n\n /**\n * @private\n * @type {number}\n */\n this.flatInteriorPointsRevision_ = -1;\n\n /**\n * @private\n * @type {Array|null}\n */\n this.flatInteriorPoints_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDeltaRevision_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.orientedRevision_ = -1;\n\n /**\n * @private\n * @type {Array|null}\n */\n this.orientedFlatCoordinates_ = null;\n\n if (!endss && !Array.isArray(coordinates[0])) {\n const polygons = /** @type {Array} */ (coordinates);\n /** @type {Array} */\n const flatCoordinates = [];\n const thisEndss = [];\n for (let i = 0, ii = polygons.length; i < ii; ++i) {\n const polygon = polygons[i];\n const offset = flatCoordinates.length;\n const ends = polygon.getEnds();\n for (let j = 0, jj = ends.length; j < jj; ++j) {\n ends[j] += offset;\n }\n extend(flatCoordinates, polygon.getFlatCoordinates());\n thisEndss.push(ends);\n }\n layout =\n polygons.length === 0 ? this.getLayout() : polygons[0].getLayout();\n coordinates = flatCoordinates;\n endss = thisEndss;\n }\n if (layout !== undefined && endss) {\n this.setFlatCoordinates(\n layout,\n /** @type {Array} */ (coordinates),\n );\n this.endss_ = endss;\n } else {\n this.setCoordinates(\n /** @type {Array>>} */ (\n coordinates\n ),\n layout,\n );\n }\n }\n\n /**\n * Append the passed polygon to this multipolygon.\n * @param {Polygon} polygon Polygon.\n * @api\n */\n appendPolygon(polygon) {\n /** @type {Array} */\n let ends;\n if (!this.flatCoordinates) {\n this.flatCoordinates = polygon.getFlatCoordinates().slice();\n ends = polygon.getEnds().slice();\n this.endss_.push();\n } else {\n const offset = this.flatCoordinates.length;\n extend(this.flatCoordinates, polygon.getFlatCoordinates());\n ends = polygon.getEnds().slice();\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n ends[i] += offset;\n }\n }\n this.endss_.push(ends);\n this.changed();\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!MultiPolygon} Clone.\n * @api\n */\n clone() {\n const len = this.endss_.length;\n const newEndss = new Array(len);\n for (let i = 0; i < len; ++i) {\n newEndss[i] = this.endss_[i].slice();\n }\n\n const multiPolygon = new MultiPolygon(\n this.flatCoordinates.slice(),\n this.layout,\n newEndss,\n );\n multiPolygon.applyProperties(this);\n\n return multiPolygon;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n if (this.maxDeltaRevision_ != this.getRevision()) {\n this.maxDelta_ = Math.sqrt(\n multiArrayMaxSquaredDelta(\n this.flatCoordinates,\n 0,\n this.endss_,\n this.stride,\n 0,\n ),\n );\n this.maxDeltaRevision_ = this.getRevision();\n }\n return assignClosestMultiArrayPoint(\n this.getOrientedFlatCoordinates(),\n 0,\n this.endss_,\n this.stride,\n this.maxDelta_,\n true,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n );\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\n containsXY(x, y) {\n return linearRingssContainsXY(\n this.getOrientedFlatCoordinates(),\n 0,\n this.endss_,\n this.stride,\n x,\n y,\n );\n }\n\n /**\n * Return the area of the multipolygon on projected plane.\n * @return {number} Area (on projected plane).\n * @api\n */\n getArea() {\n return linearRingssArea(\n this.getOrientedFlatCoordinates(),\n 0,\n this.endss_,\n this.stride,\n );\n }\n\n /**\n * Get the coordinate array for this geometry. This array has the structure\n * of a GeoJSON coordinate array for multi-polygons.\n *\n * @param {boolean} [right] Orient coordinates according to the right-hand\n * rule (counter-clockwise for exterior and clockwise for interior rings).\n * If `false`, coordinates will be oriented according to the left-hand rule\n * (clockwise for exterior and counter-clockwise for interior rings).\n * By default, coordinate orientation will depend on how the geometry was\n * constructed.\n * @return {Array>>} Coordinates.\n * @api\n */\n getCoordinates(right) {\n let flatCoordinates;\n if (right !== undefined) {\n flatCoordinates = this.getOrientedFlatCoordinates().slice();\n orientLinearRingsArray(\n flatCoordinates,\n 0,\n this.endss_,\n this.stride,\n right,\n );\n } else {\n flatCoordinates = this.flatCoordinates;\n }\n\n return inflateMultiCoordinatesArray(\n flatCoordinates,\n 0,\n this.endss_,\n this.stride,\n );\n }\n\n /**\n * @return {Array>} Endss.\n */\n getEndss() {\n return this.endss_;\n }\n\n /**\n * @return {Array} Flat interior points.\n */\n getFlatInteriorPoints() {\n if (this.flatInteriorPointsRevision_ != this.getRevision()) {\n const flatCenters = linearRingssCenter(\n this.flatCoordinates,\n 0,\n this.endss_,\n this.stride,\n );\n this.flatInteriorPoints_ = getInteriorPointsOfMultiArray(\n this.getOrientedFlatCoordinates(),\n 0,\n this.endss_,\n this.stride,\n flatCenters,\n );\n this.flatInteriorPointsRevision_ = this.getRevision();\n }\n return /** @type {Array} */ (this.flatInteriorPoints_);\n }\n\n /**\n * Return the interior points as {@link module:ol/geom/MultiPoint~MultiPoint multipoint}.\n * @return {MultiPoint} Interior points as XYM coordinates, where M is\n * the length of the horizontal intersection that the point belongs to.\n * @api\n */\n getInteriorPoints() {\n return new MultiPoint(this.getFlatInteriorPoints().slice(), 'XYM');\n }\n\n /**\n * @return {Array} Oriented flat coordinates.\n */\n getOrientedFlatCoordinates() {\n if (this.orientedRevision_ != this.getRevision()) {\n const flatCoordinates = this.flatCoordinates;\n if (\n linearRingssAreOriented(flatCoordinates, 0, this.endss_, this.stride)\n ) {\n this.orientedFlatCoordinates_ = flatCoordinates;\n } else {\n this.orientedFlatCoordinates_ = flatCoordinates.slice();\n this.orientedFlatCoordinates_.length = orientLinearRingsArray(\n this.orientedFlatCoordinates_,\n 0,\n this.endss_,\n this.stride,\n );\n }\n this.orientedRevision_ = this.getRevision();\n }\n return /** @type {Array} */ (this.orientedFlatCoordinates_);\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {MultiPolygon} Simplified MultiPolygon.\n * @protected\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n /** @type {Array} */\n const simplifiedFlatCoordinates = [];\n /** @type {Array>} */\n const simplifiedEndss = [];\n simplifiedFlatCoordinates.length = quantizeMultiArray(\n this.flatCoordinates,\n 0,\n this.endss_,\n this.stride,\n Math.sqrt(squaredTolerance),\n simplifiedFlatCoordinates,\n 0,\n simplifiedEndss,\n );\n return new MultiPolygon(simplifiedFlatCoordinates, 'XY', simplifiedEndss);\n }\n\n /**\n * Return the polygon at the specified index.\n * @param {number} index Index.\n * @return {Polygon} Polygon.\n * @api\n */\n getPolygon(index) {\n if (index < 0 || this.endss_.length <= index) {\n return null;\n }\n let offset;\n if (index === 0) {\n offset = 0;\n } else {\n const prevEnds = this.endss_[index - 1];\n offset = prevEnds[prevEnds.length - 1];\n }\n const ends = this.endss_[index].slice();\n const end = ends[ends.length - 1];\n if (offset !== 0) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n ends[i] -= offset;\n }\n }\n return new Polygon(\n this.flatCoordinates.slice(offset, end),\n this.layout,\n ends,\n );\n }\n\n /**\n * Return the polygons of this multipolygon.\n * @return {Array} Polygons.\n * @api\n */\n getPolygons() {\n const layout = this.layout;\n const flatCoordinates = this.flatCoordinates;\n const endss = this.endss_;\n const polygons = [];\n let offset = 0;\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i].slice();\n const end = ends[ends.length - 1];\n if (offset !== 0) {\n for (let j = 0, jj = ends.length; j < jj; ++j) {\n ends[j] -= offset;\n }\n }\n const polygon = new Polygon(\n flatCoordinates.slice(offset, end),\n layout,\n ends,\n );\n polygons.push(polygon);\n offset = end;\n }\n return polygons;\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n */\n getType() {\n return 'MultiPolygon';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n */\n intersectsExtent(extent) {\n return intersectsLinearRingMultiArray(\n this.getOrientedFlatCoordinates(),\n 0,\n this.endss_,\n this.stride,\n extent,\n );\n }\n\n /**\n * Set the coordinates of the multipolygon.\n * @param {!Array>>} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @api\n */\n setCoordinates(coordinates, layout) {\n this.setLayout(layout, coordinates, 3);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n const endss = deflateMultiCoordinatesArray(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n this.endss_,\n );\n if (endss.length === 0) {\n this.flatCoordinates.length = 0;\n } else {\n const lastEnds = endss[endss.length - 1];\n this.flatCoordinates.length =\n lastEnds.length === 0 ? 0 : lastEnds[lastEnds.length - 1];\n }\n this.changed();\n }\n}\n\nexport default MultiPolygon;\n","/**\n * @module ol/geom/Point\n */\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {containsXY, createOrUpdateFromCoordinate} from '../extent.js';\nimport {deflateCoordinate} from './flat/deflate.js';\nimport {squaredDistance as squaredDx} from '../math.js';\n\n/**\n * @classdesc\n * Point geometry.\n *\n * @api\n */\nclass Point extends SimpleGeometry {\n /**\n * @param {import(\"../coordinate.js\").Coordinate} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n */\n constructor(coordinates, layout) {\n super();\n this.setCoordinates(coordinates, layout);\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!Point} Clone.\n * @api\n */\n clone() {\n const point = new Point(this.flatCoordinates.slice(), this.layout);\n point.applyProperties(this);\n return point;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n const flatCoordinates = this.flatCoordinates;\n const squaredDistance = squaredDx(\n x,\n y,\n flatCoordinates[0],\n flatCoordinates[1],\n );\n if (squaredDistance < minSquaredDistance) {\n const stride = this.stride;\n for (let i = 0; i < stride; ++i) {\n closestPoint[i] = flatCoordinates[i];\n }\n closestPoint.length = stride;\n return squaredDistance;\n }\n return minSquaredDistance;\n }\n\n /**\n * Return the coordinate of the point.\n * @return {import(\"../coordinate.js\").Coordinate} Coordinates.\n * @api\n */\n getCoordinates() {\n return this.flatCoordinates.slice();\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @protected\n * @return {import(\"../extent.js\").Extent} extent Extent.\n */\n computeExtent(extent) {\n return createOrUpdateFromCoordinate(this.flatCoordinates, extent);\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n */\n getType() {\n return 'Point';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n */\n intersectsExtent(extent) {\n return containsXY(extent, this.flatCoordinates[0], this.flatCoordinates[1]);\n }\n\n /**\n * @param {!Array<*>} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @api\n */\n setCoordinates(coordinates, layout) {\n this.setLayout(layout, coordinates, 0);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n this.flatCoordinates.length = deflateCoordinate(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n );\n this.changed();\n }\n}\n\nexport default Point;\n","/**\n * @module ol/geom/LinearRing\n */\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {assignClosestPoint, maxSquaredDelta} from './flat/closest.js';\nimport {closestSquaredDistanceXY} from '../extent.js';\nimport {deflateCoordinates} from './flat/deflate.js';\nimport {douglasPeucker} from './flat/simplify.js';\nimport {inflateCoordinates} from './flat/inflate.js';\nimport {linearRing as linearRingArea} from './flat/area.js';\n\n/**\n * @classdesc\n * Linear ring geometry. Only used as part of polygon; cannot be rendered\n * on its own.\n *\n * @api\n */\nclass LinearRing extends SimpleGeometry {\n /**\n * @param {Array|Array} coordinates Coordinates.\n * For internal use, flat coordinates in combination with `layout` are also accepted.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n */\n constructor(coordinates, layout) {\n super();\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDeltaRevision_ = -1;\n\n if (layout !== undefined && !Array.isArray(coordinates[0])) {\n this.setFlatCoordinates(\n layout,\n /** @type {Array} */ (coordinates),\n );\n } else {\n this.setCoordinates(\n /** @type {Array} */ (\n coordinates\n ),\n layout,\n );\n }\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!LinearRing} Clone.\n * @api\n */\n clone() {\n return new LinearRing(this.flatCoordinates.slice(), this.layout);\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n if (this.maxDeltaRevision_ != this.getRevision()) {\n this.maxDelta_ = Math.sqrt(\n maxSquaredDelta(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n 0,\n ),\n );\n this.maxDeltaRevision_ = this.getRevision();\n }\n return assignClosestPoint(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n this.maxDelta_,\n true,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n );\n }\n\n /**\n * Return the area of the linear ring on projected plane.\n * @return {number} Area (on projected plane).\n * @api\n */\n getArea() {\n return linearRingArea(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n );\n }\n\n /**\n * Return the coordinates of the linear ring.\n * @return {Array} Coordinates.\n * @api\n */\n getCoordinates() {\n return inflateCoordinates(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n );\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {LinearRing} Simplified LinearRing.\n * @protected\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n /** @type {Array} */\n const simplifiedFlatCoordinates = [];\n simplifiedFlatCoordinates.length = douglasPeucker(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0,\n );\n return new LinearRing(simplifiedFlatCoordinates, 'XY');\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n */\n getType() {\n return 'LinearRing';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n */\n intersectsExtent(extent) {\n return false;\n }\n\n /**\n * Set the coordinates of the linear ring.\n * @param {!Array} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @api\n */\n setCoordinates(coordinates, layout) {\n this.setLayout(layout, coordinates, 1);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n this.flatCoordinates.length = deflateCoordinates(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n );\n this.changed();\n }\n}\n\nexport default LinearRing;\n","/**\n * @module ol/geom/Polygon\n */\nimport LinearRing from './LinearRing.js';\nimport Point from './Point.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {arrayMaxSquaredDelta, assignClosestArrayPoint} from './flat/closest.js';\nimport {closestSquaredDistanceXY, getCenter, isEmpty} from '../extent.js';\nimport {deflateCoordinatesArray} from './flat/deflate.js';\nimport {extend} from '../array.js';\nimport {getInteriorPointOfArray} from './flat/interiorpoint.js';\nimport {inflateCoordinatesArray} from './flat/inflate.js';\nimport {intersectsLinearRingArray} from './flat/intersectsextent.js';\nimport {linearRingsAreOriented, orientLinearRings} from './flat/orient.js';\nimport {linearRings as linearRingsArea} from './flat/area.js';\nimport {linearRingsContainsXY} from './flat/contains.js';\nimport {modulo} from '../math.js';\nimport {quantizeArray} from './flat/simplify.js';\nimport {offset as sphereOffset} from '../sphere.js';\n\n/**\n * @classdesc\n * Polygon geometry.\n *\n * @api\n */\nclass Polygon extends SimpleGeometry {\n /**\n * @param {!Array>|!Array} coordinates\n * Array of linear rings that define the polygon. The first linear ring of the\n * array defines the outer-boundary or surface of the polygon. Each subsequent\n * linear ring defines a hole in the surface of the polygon. A linear ring is\n * an array of vertices' coordinates where the first coordinate and the last are\n * equivalent. (For internal use, flat coordinates in combination with\n * `layout` and `ends` are also accepted.)\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @param {Array} [ends] Ends (for internal use with flat coordinates).\n */\n constructor(coordinates, layout, ends) {\n super();\n\n /**\n * @type {Array}\n * @private\n */\n this.ends_ = [];\n\n /**\n * @private\n * @type {number}\n */\n this.flatInteriorPointRevision_ = -1;\n\n /**\n * @private\n * @type {import(\"../coordinate.js\").Coordinate|null}\n */\n this.flatInteriorPoint_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDeltaRevision_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.orientedRevision_ = -1;\n\n /**\n * @private\n * @type {Array|null}\n */\n this.orientedFlatCoordinates_ = null;\n\n if (layout !== undefined && ends) {\n this.setFlatCoordinates(\n layout,\n /** @type {Array} */ (coordinates),\n );\n this.ends_ = ends;\n } else {\n this.setCoordinates(\n /** @type {Array>} */ (\n coordinates\n ),\n layout,\n );\n }\n }\n\n /**\n * Append the passed linear ring to this polygon.\n * @param {LinearRing} linearRing Linear ring.\n * @api\n */\n appendLinearRing(linearRing) {\n if (!this.flatCoordinates) {\n this.flatCoordinates = linearRing.getFlatCoordinates().slice();\n } else {\n extend(this.flatCoordinates, linearRing.getFlatCoordinates());\n }\n this.ends_.push(this.flatCoordinates.length);\n this.changed();\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!Polygon} Clone.\n * @api\n */\n clone() {\n const polygon = new Polygon(\n this.flatCoordinates.slice(),\n this.layout,\n this.ends_.slice(),\n );\n polygon.applyProperties(this);\n return polygon;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n if (this.maxDeltaRevision_ != this.getRevision()) {\n this.maxDelta_ = Math.sqrt(\n arrayMaxSquaredDelta(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n 0,\n ),\n );\n this.maxDeltaRevision_ = this.getRevision();\n }\n return assignClosestArrayPoint(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n this.maxDelta_,\n true,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n );\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\n containsXY(x, y) {\n return linearRingsContainsXY(\n this.getOrientedFlatCoordinates(),\n 0,\n this.ends_,\n this.stride,\n x,\n y,\n );\n }\n\n /**\n * Return the area of the polygon on projected plane.\n * @return {number} Area (on projected plane).\n * @api\n */\n getArea() {\n return linearRingsArea(\n this.getOrientedFlatCoordinates(),\n 0,\n this.ends_,\n this.stride,\n );\n }\n\n /**\n * Get the coordinate array for this geometry. This array has the structure\n * of a GeoJSON coordinate array for polygons.\n *\n * @param {boolean} [right] Orient coordinates according to the right-hand\n * rule (counter-clockwise for exterior and clockwise for interior rings).\n * If `false`, coordinates will be oriented according to the left-hand rule\n * (clockwise for exterior and counter-clockwise for interior rings).\n * By default, coordinate orientation will depend on how the geometry was\n * constructed.\n * @return {Array>} Coordinates.\n * @api\n */\n getCoordinates(right) {\n let flatCoordinates;\n if (right !== undefined) {\n flatCoordinates = this.getOrientedFlatCoordinates().slice();\n orientLinearRings(flatCoordinates, 0, this.ends_, this.stride, right);\n } else {\n flatCoordinates = this.flatCoordinates;\n }\n\n return inflateCoordinatesArray(flatCoordinates, 0, this.ends_, this.stride);\n }\n\n /**\n * @return {Array} Ends.\n */\n getEnds() {\n return this.ends_;\n }\n\n /**\n * @return {Array} Interior point.\n */\n getFlatInteriorPoint() {\n if (this.flatInteriorPointRevision_ != this.getRevision()) {\n const flatCenter = getCenter(this.getExtent());\n this.flatInteriorPoint_ = getInteriorPointOfArray(\n this.getOrientedFlatCoordinates(),\n 0,\n this.ends_,\n this.stride,\n flatCenter,\n 0,\n );\n this.flatInteriorPointRevision_ = this.getRevision();\n }\n return /** @type {import(\"../coordinate.js\").Coordinate} */ (\n this.flatInteriorPoint_\n );\n }\n\n /**\n * Return an interior point of the polygon.\n * @return {Point} Interior point as XYM coordinate, where M is the\n * length of the horizontal intersection that the point belongs to.\n * @api\n */\n getInteriorPoint() {\n return new Point(this.getFlatInteriorPoint(), 'XYM');\n }\n\n /**\n * Return the number of rings of the polygon, this includes the exterior\n * ring and any interior rings.\n *\n * @return {number} Number of rings.\n * @api\n */\n getLinearRingCount() {\n return this.ends_.length;\n }\n\n /**\n * Return the Nth linear ring of the polygon geometry. Return `null` if the\n * given index is out of range.\n * The exterior linear ring is available at index `0` and the interior rings\n * at index `1` and beyond.\n *\n * @param {number} index Index.\n * @return {LinearRing|null} Linear ring.\n * @api\n */\n getLinearRing(index) {\n if (index < 0 || this.ends_.length <= index) {\n return null;\n }\n return new LinearRing(\n this.flatCoordinates.slice(\n index === 0 ? 0 : this.ends_[index - 1],\n this.ends_[index],\n ),\n this.layout,\n );\n }\n\n /**\n * Return the linear rings of the polygon.\n * @return {Array} Linear rings.\n * @api\n */\n getLinearRings() {\n const layout = this.layout;\n const flatCoordinates = this.flatCoordinates;\n const ends = this.ends_;\n const linearRings = [];\n let offset = 0;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const linearRing = new LinearRing(\n flatCoordinates.slice(offset, end),\n layout,\n );\n linearRings.push(linearRing);\n offset = end;\n }\n return linearRings;\n }\n\n /**\n * @return {Array} Oriented flat coordinates.\n */\n getOrientedFlatCoordinates() {\n if (this.orientedRevision_ != this.getRevision()) {\n const flatCoordinates = this.flatCoordinates;\n if (linearRingsAreOriented(flatCoordinates, 0, this.ends_, this.stride)) {\n this.orientedFlatCoordinates_ = flatCoordinates;\n } else {\n this.orientedFlatCoordinates_ = flatCoordinates.slice();\n this.orientedFlatCoordinates_.length = orientLinearRings(\n this.orientedFlatCoordinates_,\n 0,\n this.ends_,\n this.stride,\n );\n }\n this.orientedRevision_ = this.getRevision();\n }\n return /** @type {Array} */ (this.orientedFlatCoordinates_);\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {Polygon} Simplified Polygon.\n * @protected\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n /** @type {Array} */\n const simplifiedFlatCoordinates = [];\n /** @type {Array} */\n const simplifiedEnds = [];\n simplifiedFlatCoordinates.length = quantizeArray(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n Math.sqrt(squaredTolerance),\n simplifiedFlatCoordinates,\n 0,\n simplifiedEnds,\n );\n return new Polygon(simplifiedFlatCoordinates, 'XY', simplifiedEnds);\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n */\n getType() {\n return 'Polygon';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n */\n intersectsExtent(extent) {\n return intersectsLinearRingArray(\n this.getOrientedFlatCoordinates(),\n 0,\n this.ends_,\n this.stride,\n extent,\n );\n }\n\n /**\n * Set the coordinates of the polygon.\n * @param {!Array>} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @api\n */\n setCoordinates(coordinates, layout) {\n this.setLayout(layout, coordinates, 2);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n const ends = deflateCoordinatesArray(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n this.ends_,\n );\n this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1];\n this.changed();\n }\n}\n\nexport default Polygon;\n\n/**\n * Create an approximation of a circle on the surface of a sphere.\n * @param {import(\"../coordinate.js\").Coordinate} center Center (`[lon, lat]` in degrees).\n * @param {number} radius The great-circle distance from the center to\n * the polygon vertices in meters.\n * @param {number} [n] Optional number of vertices for the resulting\n * polygon. Default is `32`.\n * @param {number} [sphereRadius] Optional radius for the sphere (defaults to\n * the Earth's mean radius using the WGS84 ellipsoid).\n * @return {Polygon} The \"circular\" polygon.\n * @api\n */\nexport function circular(center, radius, n, sphereRadius) {\n n = n ? n : 32;\n /** @type {Array} */\n const flatCoordinates = [];\n for (let i = 0; i < n; ++i) {\n extend(\n flatCoordinates,\n sphereOffset(center, radius, (2 * Math.PI * i) / n, sphereRadius),\n );\n }\n flatCoordinates.push(flatCoordinates[0], flatCoordinates[1]);\n return new Polygon(flatCoordinates, 'XY', [flatCoordinates.length]);\n}\n\n/**\n * Create a polygon from an extent. The layout used is `XY`.\n * @param {import(\"../extent.js\").Extent} extent The extent.\n * @return {Polygon} The polygon.\n * @api\n */\nexport function fromExtent(extent) {\n if (isEmpty(extent)) {\n throw new Error('Cannot create polygon from empty extent');\n }\n const minX = extent[0];\n const minY = extent[1];\n const maxX = extent[2];\n const maxY = extent[3];\n const flatCoordinates = [\n minX,\n minY,\n minX,\n maxY,\n maxX,\n maxY,\n maxX,\n minY,\n minX,\n minY,\n ];\n return new Polygon(flatCoordinates, 'XY', [flatCoordinates.length]);\n}\n\n/**\n * Create a regular polygon from a circle.\n * @param {import(\"./Circle.js\").default} circle Circle geometry.\n * @param {number} [sides] Number of sides of the polygon. Default is 32.\n * @param {number} [angle] Start angle for the first vertex of the polygon in\n * counter-clockwise radians. 0 means East. Default is 0.\n * @return {Polygon} Polygon geometry.\n * @api\n */\nexport function fromCircle(circle, sides, angle) {\n sides = sides ? sides : 32;\n const stride = circle.getStride();\n const layout = circle.getLayout();\n const center = circle.getCenter();\n const arrayLength = stride * (sides + 1);\n const flatCoordinates = new Array(arrayLength);\n for (let i = 0; i < arrayLength; i += stride) {\n flatCoordinates[i] = 0;\n flatCoordinates[i + 1] = 0;\n for (let j = 2; j < stride; j++) {\n flatCoordinates[i + j] = center[j];\n }\n }\n const ends = [flatCoordinates.length];\n const polygon = new Polygon(flatCoordinates, layout, ends);\n makeRegular(polygon, center, circle.getRadius(), angle);\n return polygon;\n}\n\n/**\n * Modify the coordinates of a polygon to make it a regular polygon.\n * @param {Polygon} polygon Polygon geometry.\n * @param {import(\"../coordinate.js\").Coordinate} center Center of the regular polygon.\n * @param {number} radius Radius of the regular polygon.\n * @param {number} [angle] Start angle for the first vertex of the polygon in\n * counter-clockwise radians. 0 means East. Default is 0.\n */\nexport function makeRegular(polygon, center, radius, angle) {\n const flatCoordinates = polygon.getFlatCoordinates();\n const stride = polygon.getStride();\n const sides = flatCoordinates.length / stride - 1;\n const startAngle = angle ? angle : 0;\n for (let i = 0; i <= sides; ++i) {\n const offset = i * stride;\n const angle = startAngle + (modulo(i, sides) * 2 * Math.PI) / sides;\n flatCoordinates[offset] = center[0] + radius * Math.cos(angle);\n flatCoordinates[offset + 1] = center[1] + radius * Math.sin(angle);\n }\n polygon.changed();\n}\n","/**\n * @module ol/geom/SimpleGeometry\n */\nimport Geometry from './Geometry.js';\nimport {abstract} from '../util.js';\nimport {createOrUpdateFromFlatCoordinates, getCenter} from '../extent.js';\nimport {rotate, scale, transform2D, translate} from './flat/transform.js';\n\n/**\n * @classdesc\n * Abstract base class; only used for creating subclasses; do not instantiate\n * in apps, as cannot be rendered.\n *\n * @abstract\n * @api\n */\nclass SimpleGeometry extends Geometry {\n constructor() {\n super();\n\n /**\n * @protected\n * @type {import(\"./Geometry.js\").GeometryLayout}\n */\n this.layout = 'XY';\n\n /**\n * @protected\n * @type {number}\n */\n this.stride = 2;\n\n /**\n * @protected\n * @type {Array}\n */\n this.flatCoordinates;\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @protected\n * @return {import(\"../extent.js\").Extent} extent Extent.\n */\n computeExtent(extent) {\n return createOrUpdateFromFlatCoordinates(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n extent,\n );\n }\n\n /**\n * @abstract\n * @return {Array<*> | null} Coordinates.\n */\n getCoordinates() {\n return abstract();\n }\n\n /**\n * Return the first coordinate of the geometry.\n * @return {import(\"../coordinate.js\").Coordinate} First coordinate.\n * @api\n */\n getFirstCoordinate() {\n return this.flatCoordinates.slice(0, this.stride);\n }\n\n /**\n * @return {Array} Flat coordinates.\n */\n getFlatCoordinates() {\n return this.flatCoordinates;\n }\n\n /**\n * Return the last coordinate of the geometry.\n * @return {import(\"../coordinate.js\").Coordinate} Last point.\n * @api\n */\n getLastCoordinate() {\n return this.flatCoordinates.slice(\n this.flatCoordinates.length - this.stride,\n );\n }\n\n /**\n * Return the {@link import(\"./Geometry.js\").GeometryLayout layout} of the geometry.\n * @return {import(\"./Geometry.js\").GeometryLayout} Layout.\n * @api\n */\n getLayout() {\n return this.layout;\n }\n\n /**\n * Create a simplified version of this geometry using the Douglas Peucker algorithm.\n * @param {number} squaredTolerance Squared tolerance.\n * @return {SimpleGeometry} Simplified geometry.\n */\n getSimplifiedGeometry(squaredTolerance) {\n if (this.simplifiedGeometryRevision !== this.getRevision()) {\n this.simplifiedGeometryMaxMinSquaredTolerance = 0;\n this.simplifiedGeometryRevision = this.getRevision();\n }\n // If squaredTolerance is negative or if we know that simplification will not\n // have any effect then just return this.\n if (\n squaredTolerance < 0 ||\n (this.simplifiedGeometryMaxMinSquaredTolerance !== 0 &&\n squaredTolerance <= this.simplifiedGeometryMaxMinSquaredTolerance)\n ) {\n return this;\n }\n\n const simplifiedGeometry =\n this.getSimplifiedGeometryInternal(squaredTolerance);\n const simplifiedFlatCoordinates = simplifiedGeometry.getFlatCoordinates();\n if (simplifiedFlatCoordinates.length < this.flatCoordinates.length) {\n return simplifiedGeometry;\n }\n // Simplification did not actually remove any coordinates. We now know\n // that any calls to getSimplifiedGeometry with a squaredTolerance less\n // than or equal to the current squaredTolerance will also not have any\n // effect. This allows us to short circuit simplification (saving CPU\n // cycles) and prevents the cache of simplified geometries from filling\n // up with useless identical copies of this geometry (saving memory).\n this.simplifiedGeometryMaxMinSquaredTolerance = squaredTolerance;\n return this;\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {SimpleGeometry} Simplified geometry.\n * @protected\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n return this;\n }\n\n /**\n * @return {number} Stride.\n */\n getStride() {\n return this.stride;\n }\n\n /**\n * @param {import(\"./Geometry.js\").GeometryLayout} layout Layout.\n * @param {Array} flatCoordinates Flat coordinates.\n */\n setFlatCoordinates(layout, flatCoordinates) {\n this.stride = getStrideForLayout(layout);\n this.layout = layout;\n this.flatCoordinates = flatCoordinates;\n }\n\n /**\n * @abstract\n * @param {!Array<*>} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n */\n setCoordinates(coordinates, layout) {\n abstract();\n }\n\n /**\n * @param {import(\"./Geometry.js\").GeometryLayout|undefined} layout Layout.\n * @param {Array<*>} coordinates Coordinates.\n * @param {number} nesting Nesting.\n * @protected\n */\n setLayout(layout, coordinates, nesting) {\n let stride;\n if (layout) {\n stride = getStrideForLayout(layout);\n } else {\n for (let i = 0; i < nesting; ++i) {\n if (coordinates.length === 0) {\n this.layout = 'XY';\n this.stride = 2;\n return;\n }\n coordinates = /** @type {Array} */ (coordinates[0]);\n }\n stride = coordinates.length;\n layout = getLayoutForStride(stride);\n }\n this.layout = layout;\n this.stride = stride;\n }\n\n /**\n * Apply a transform function to the coordinates of the geometry.\n * The geometry is modified in place.\n * If you do not want the geometry modified in place, first `clone()` it and\n * then use this function on the clone.\n * @param {import(\"../proj.js\").TransformFunction} transformFn Transform function.\n * Called with a flat array of geometry coordinates.\n * @api\n */\n applyTransform(transformFn) {\n if (this.flatCoordinates) {\n transformFn(this.flatCoordinates, this.flatCoordinates, this.stride);\n this.changed();\n }\n }\n\n /**\n * Rotate the geometry around a given coordinate. This modifies the geometry\n * coordinates in place.\n * @param {number} angle Rotation angle in counter-clockwise radians.\n * @param {import(\"../coordinate.js\").Coordinate} anchor The rotation center.\n * @api\n */\n rotate(angle, anchor) {\n const flatCoordinates = this.getFlatCoordinates();\n if (flatCoordinates) {\n const stride = this.getStride();\n rotate(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n angle,\n anchor,\n flatCoordinates,\n );\n this.changed();\n }\n }\n\n /**\n * Scale the geometry (with an optional origin). This modifies the geometry\n * coordinates in place.\n * @param {number} sx The scaling factor in the x-direction.\n * @param {number} [sy] The scaling factor in the y-direction (defaults to sx).\n * @param {import(\"../coordinate.js\").Coordinate} [anchor] The scale origin (defaults to the center\n * of the geometry extent).\n * @api\n */\n scale(sx, sy, anchor) {\n if (sy === undefined) {\n sy = sx;\n }\n if (!anchor) {\n anchor = getCenter(this.getExtent());\n }\n const flatCoordinates = this.getFlatCoordinates();\n if (flatCoordinates) {\n const stride = this.getStride();\n scale(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n sx,\n sy,\n anchor,\n flatCoordinates,\n );\n this.changed();\n }\n }\n\n /**\n * Translate the geometry. This modifies the geometry coordinates in place. If\n * instead you want a new geometry, first `clone()` this geometry.\n * @param {number} deltaX Delta X.\n * @param {number} deltaY Delta Y.\n * @api\n */\n translate(deltaX, deltaY) {\n const flatCoordinates = this.getFlatCoordinates();\n if (flatCoordinates) {\n const stride = this.getStride();\n translate(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n deltaX,\n deltaY,\n flatCoordinates,\n );\n this.changed();\n }\n }\n}\n\n/**\n * @param {number} stride Stride.\n * @return {import(\"./Geometry.js\").GeometryLayout} layout Layout.\n */\nexport function getLayoutForStride(stride) {\n let layout;\n if (stride == 2) {\n layout = 'XY';\n } else if (stride == 3) {\n layout = 'XYZ';\n } else if (stride == 4) {\n layout = 'XYZM';\n }\n return /** @type {import(\"./Geometry.js\").GeometryLayout} */ (layout);\n}\n\n/**\n * @param {import(\"./Geometry.js\").GeometryLayout} layout Layout.\n * @return {number} Stride.\n */\nexport function getStrideForLayout(layout) {\n let stride;\n if (layout == 'XY') {\n stride = 2;\n } else if (layout == 'XYZ' || layout == 'XYM') {\n stride = 3;\n } else if (layout == 'XYZM') {\n stride = 4;\n }\n return /** @type {number} */ (stride);\n}\n\n/**\n * @param {SimpleGeometry} simpleGeometry Simple geometry.\n * @param {import(\"../transform.js\").Transform} transform Transform.\n * @param {Array} [dest] Destination.\n * @return {Array} Transformed flat coordinates.\n */\nexport function transformGeom2D(simpleGeometry, transform, dest) {\n const flatCoordinates = simpleGeometry.getFlatCoordinates();\n if (!flatCoordinates) {\n return null;\n }\n const stride = simpleGeometry.getStride();\n return transform2D(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n transform,\n dest,\n );\n}\n\nexport default SimpleGeometry;\n","/**\n * @module ol/geom/flat/area\n */\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {number} Area.\n */\nexport function linearRing(flatCoordinates, offset, end, stride) {\n let twiceArea = 0;\n let x1 = flatCoordinates[end - stride];\n let y1 = flatCoordinates[end - stride + 1];\n for (; offset < end; offset += stride) {\n const x2 = flatCoordinates[offset];\n const y2 = flatCoordinates[offset + 1];\n twiceArea += y1 * x2 - x1 * y2;\n x1 = x2;\n y1 = y2;\n }\n return twiceArea / 2;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @return {number} Area.\n */\nexport function linearRings(flatCoordinates, offset, ends, stride) {\n let area = 0;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n area += linearRing(flatCoordinates, offset, end, stride);\n offset = end;\n }\n return area;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @return {number} Area.\n */\nexport function linearRingss(flatCoordinates, offset, endss, stride) {\n let area = 0;\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n area += linearRings(flatCoordinates, offset, ends, stride);\n offset = ends[ends.length - 1];\n }\n return area;\n}\n","/**\n * @module ol/geom/flat/center\n */\nimport {createEmpty, createOrUpdateFromFlatCoordinates} from '../../extent.js';\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @return {Array} Flat centers.\n */\nexport function linearRingss(flatCoordinates, offset, endss, stride) {\n const flatCenters = [];\n let extent = createEmpty();\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n extent = createOrUpdateFromFlatCoordinates(\n flatCoordinates,\n offset,\n ends[0],\n stride,\n );\n flatCenters.push((extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2);\n offset = ends[ends.length - 1];\n }\n return flatCenters;\n}\n","/**\n * @module ol/geom/flat/closest\n */\nimport {lerp, squaredDistance as squaredDx} from '../../math.js';\n\n/**\n * Returns the point on the 2D line segment flatCoordinates[offset1] to\n * flatCoordinates[offset2] that is closest to the point (x, y). Extra\n * dimensions are linearly interpolated.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset1 Offset 1.\n * @param {number} offset2 Offset 2.\n * @param {number} stride Stride.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {Array} closestPoint Closest point.\n */\nfunction assignClosest(\n flatCoordinates,\n offset1,\n offset2,\n stride,\n x,\n y,\n closestPoint,\n) {\n const x1 = flatCoordinates[offset1];\n const y1 = flatCoordinates[offset1 + 1];\n const dx = flatCoordinates[offset2] - x1;\n const dy = flatCoordinates[offset2 + 1] - y1;\n let offset;\n if (dx === 0 && dy === 0) {\n offset = offset1;\n } else {\n const t = ((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy);\n if (t > 1) {\n offset = offset2;\n } else if (t > 0) {\n for (let i = 0; i < stride; ++i) {\n closestPoint[i] = lerp(\n flatCoordinates[offset1 + i],\n flatCoordinates[offset2 + i],\n t,\n );\n }\n closestPoint.length = stride;\n return;\n } else {\n offset = offset1;\n }\n }\n for (let i = 0; i < stride; ++i) {\n closestPoint[i] = flatCoordinates[offset + i];\n }\n closestPoint.length = stride;\n}\n\n/**\n * Return the squared of the largest distance between any pair of consecutive\n * coordinates.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} max Max squared delta.\n * @return {number} Max squared delta.\n */\nexport function maxSquaredDelta(flatCoordinates, offset, end, stride, max) {\n let x1 = flatCoordinates[offset];\n let y1 = flatCoordinates[offset + 1];\n for (offset += stride; offset < end; offset += stride) {\n const x2 = flatCoordinates[offset];\n const y2 = flatCoordinates[offset + 1];\n const squaredDelta = squaredDx(x1, y1, x2, y2);\n if (squaredDelta > max) {\n max = squaredDelta;\n }\n x1 = x2;\n y1 = y2;\n }\n return max;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {number} max Max squared delta.\n * @return {number} Max squared delta.\n */\nexport function arrayMaxSquaredDelta(\n flatCoordinates,\n offset,\n ends,\n stride,\n max,\n) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n max = maxSquaredDelta(flatCoordinates, offset, end, stride, max);\n offset = end;\n }\n return max;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} max Max squared delta.\n * @return {number} Max squared delta.\n */\nexport function multiArrayMaxSquaredDelta(\n flatCoordinates,\n offset,\n endss,\n stride,\n max,\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n max = arrayMaxSquaredDelta(flatCoordinates, offset, ends, stride, max);\n offset = ends[ends.length - 1];\n }\n return max;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} maxDelta Max delta.\n * @param {boolean} isRing Is ring.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {Array} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @param {Array} [tmpPoint] Temporary point object.\n * @return {number} Minimum squared distance.\n */\nexport function assignClosestPoint(\n flatCoordinates,\n offset,\n end,\n stride,\n maxDelta,\n isRing,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n tmpPoint,\n) {\n if (offset == end) {\n return minSquaredDistance;\n }\n let i, squaredDistance;\n if (maxDelta === 0) {\n // All points are identical, so just test the first point.\n squaredDistance = squaredDx(\n x,\n y,\n flatCoordinates[offset],\n flatCoordinates[offset + 1],\n );\n if (squaredDistance < minSquaredDistance) {\n for (i = 0; i < stride; ++i) {\n closestPoint[i] = flatCoordinates[offset + i];\n }\n closestPoint.length = stride;\n return squaredDistance;\n }\n return minSquaredDistance;\n }\n tmpPoint = tmpPoint ? tmpPoint : [NaN, NaN];\n let index = offset + stride;\n while (index < end) {\n assignClosest(\n flatCoordinates,\n index - stride,\n index,\n stride,\n x,\n y,\n tmpPoint,\n );\n squaredDistance = squaredDx(x, y, tmpPoint[0], tmpPoint[1]);\n if (squaredDistance < minSquaredDistance) {\n minSquaredDistance = squaredDistance;\n for (i = 0; i < stride; ++i) {\n closestPoint[i] = tmpPoint[i];\n }\n closestPoint.length = stride;\n index += stride;\n } else {\n // Skip ahead multiple points, because we know that all the skipped\n // points cannot be any closer than the closest point we have found so\n // far. We know this because we know how close the current point is, how\n // close the closest point we have found so far is, and the maximum\n // distance between consecutive points. For example, if we're currently\n // at distance 10, the best we've found so far is 3, and that the maximum\n // distance between consecutive points is 2, then we'll need to skip at\n // least (10 - 3) / 2 == 3 (rounded down) points to have any chance of\n // finding a closer point. We use Math.max(..., 1) to ensure that we\n // always advance at least one point, to avoid an infinite loop.\n index +=\n stride *\n Math.max(\n ((Math.sqrt(squaredDistance) - Math.sqrt(minSquaredDistance)) /\n maxDelta) |\n 0,\n 1,\n );\n }\n }\n if (isRing) {\n // Check the closing segment.\n assignClosest(\n flatCoordinates,\n end - stride,\n offset,\n stride,\n x,\n y,\n tmpPoint,\n );\n squaredDistance = squaredDx(x, y, tmpPoint[0], tmpPoint[1]);\n if (squaredDistance < minSquaredDistance) {\n minSquaredDistance = squaredDistance;\n for (i = 0; i < stride; ++i) {\n closestPoint[i] = tmpPoint[i];\n }\n closestPoint.length = stride;\n }\n }\n return minSquaredDistance;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {number} maxDelta Max delta.\n * @param {boolean} isRing Is ring.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {Array} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @param {Array} [tmpPoint] Temporary point object.\n * @return {number} Minimum squared distance.\n */\nexport function assignClosestArrayPoint(\n flatCoordinates,\n offset,\n ends,\n stride,\n maxDelta,\n isRing,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n tmpPoint,\n) {\n tmpPoint = tmpPoint ? tmpPoint : [NaN, NaN];\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n minSquaredDistance = assignClosestPoint(\n flatCoordinates,\n offset,\n end,\n stride,\n maxDelta,\n isRing,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n tmpPoint,\n );\n offset = end;\n }\n return minSquaredDistance;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} maxDelta Max delta.\n * @param {boolean} isRing Is ring.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {Array} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @param {Array} [tmpPoint] Temporary point object.\n * @return {number} Minimum squared distance.\n */\nexport function assignClosestMultiArrayPoint(\n flatCoordinates,\n offset,\n endss,\n stride,\n maxDelta,\n isRing,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n tmpPoint,\n) {\n tmpPoint = tmpPoint ? tmpPoint : [NaN, NaN];\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n minSquaredDistance = assignClosestArrayPoint(\n flatCoordinates,\n offset,\n ends,\n stride,\n maxDelta,\n isRing,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n tmpPoint,\n );\n offset = ends[ends.length - 1];\n }\n return minSquaredDistance;\n}\n","/**\n * @module ol/geom/flat/contains\n */\nimport {forEachCorner} from '../../extent.js';\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} Contains extent.\n */\nexport function linearRingContainsExtent(\n flatCoordinates,\n offset,\n end,\n stride,\n extent,\n) {\n const outside = forEachCorner(\n extent,\n /**\n * @param {import(\"../../coordinate.js\").Coordinate} coordinate Coordinate.\n * @return {boolean} Contains (x, y).\n */\n function (coordinate) {\n return !linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n coordinate[0],\n coordinate[1],\n );\n },\n );\n return !outside;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\nexport function linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n x,\n y,\n) {\n // https://geomalgorithms.com/a03-_inclusion.html\n // Copyright 2000 softSurfer, 2012 Dan Sunday\n // This code may be freely used and modified for any purpose\n // providing that this copyright notice is included with it.\n // SoftSurfer makes no warranty for this code, and cannot be held\n // liable for any real or imagined damage resulting from its use.\n // Users of this code must verify correctness for their application.\n let wn = 0;\n let x1 = flatCoordinates[end - stride];\n let y1 = flatCoordinates[end - stride + 1];\n for (; offset < end; offset += stride) {\n const x2 = flatCoordinates[offset];\n const y2 = flatCoordinates[offset + 1];\n if (y1 <= y) {\n if (y2 > y && (x2 - x1) * (y - y1) - (x - x1) * (y2 - y1) > 0) {\n wn++;\n }\n } else if (y2 <= y && (x2 - x1) * (y - y1) - (x - x1) * (y2 - y1) < 0) {\n wn--;\n }\n x1 = x2;\n y1 = y2;\n }\n return wn !== 0;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\nexport function linearRingsContainsXY(\n flatCoordinates,\n offset,\n ends,\n stride,\n x,\n y,\n) {\n if (ends.length === 0) {\n return false;\n }\n if (!linearRingContainsXY(flatCoordinates, offset, ends[0], stride, x, y)) {\n return false;\n }\n for (let i = 1, ii = ends.length; i < ii; ++i) {\n if (\n linearRingContainsXY(flatCoordinates, ends[i - 1], ends[i], stride, x, y)\n ) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\nexport function linearRingssContainsXY(\n flatCoordinates,\n offset,\n endss,\n stride,\n x,\n y,\n) {\n if (endss.length === 0) {\n return false;\n }\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n if (linearRingsContainsXY(flatCoordinates, offset, ends, stride, x, y)) {\n return true;\n }\n offset = ends[ends.length - 1];\n }\n return false;\n}\n","/**\n * @module ol/geom/flat/deflate\n */\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {import(\"../../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {number} stride Stride.\n * @return {number} offset Offset.\n */\nexport function deflateCoordinate(flatCoordinates, offset, coordinate, stride) {\n for (let i = 0, ii = coordinate.length; i < ii; ++i) {\n flatCoordinates[offset++] = coordinate[i];\n }\n return offset;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} coordinates Coordinates.\n * @param {number} stride Stride.\n * @return {number} offset Offset.\n */\nexport function deflateCoordinates(\n flatCoordinates,\n offset,\n coordinates,\n stride,\n) {\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n const coordinate = coordinates[i];\n for (let j = 0; j < stride; ++j) {\n flatCoordinates[offset++] = coordinate[j];\n }\n }\n return offset;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} coordinatess Coordinatess.\n * @param {number} stride Stride.\n * @param {Array} [ends] Ends.\n * @return {Array} Ends.\n */\nexport function deflateCoordinatesArray(\n flatCoordinates,\n offset,\n coordinatess,\n stride,\n ends,\n) {\n ends = ends ? ends : [];\n let i = 0;\n for (let j = 0, jj = coordinatess.length; j < jj; ++j) {\n const end = deflateCoordinates(\n flatCoordinates,\n offset,\n coordinatess[j],\n stride,\n );\n ends[i++] = end;\n offset = end;\n }\n ends.length = i;\n return ends;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>>} coordinatesss Coordinatesss.\n * @param {number} stride Stride.\n * @param {Array>} [endss] Endss.\n * @return {Array>} Endss.\n */\nexport function deflateMultiCoordinatesArray(\n flatCoordinates,\n offset,\n coordinatesss,\n stride,\n endss,\n) {\n endss = endss ? endss : [];\n let i = 0;\n for (let j = 0, jj = coordinatesss.length; j < jj; ++j) {\n const ends = deflateCoordinatesArray(\n flatCoordinates,\n offset,\n coordinatesss[j],\n stride,\n endss[i],\n );\n if (ends.length === 0) {\n ends[0] = offset;\n }\n endss[i++] = ends;\n offset = ends[ends.length - 1];\n }\n endss.length = i;\n return endss;\n}\n","/**\n * @module ol/geom/flat/inflate\n */\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {Array} [coordinates] Coordinates.\n * @return {Array} Coordinates.\n */\nexport function inflateCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n coordinates,\n) {\n coordinates = coordinates !== undefined ? coordinates : [];\n let i = 0;\n for (let j = offset; j < end; j += stride) {\n coordinates[i++] = flatCoordinates.slice(j, j + stride);\n }\n coordinates.length = i;\n return coordinates;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {Array>} [coordinatess] Coordinatess.\n * @return {Array>} Coordinatess.\n */\nexport function inflateCoordinatesArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n coordinatess,\n) {\n coordinatess = coordinatess !== undefined ? coordinatess : [];\n let i = 0;\n for (let j = 0, jj = ends.length; j < jj; ++j) {\n const end = ends[j];\n coordinatess[i++] = inflateCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n coordinatess[i],\n );\n offset = end;\n }\n coordinatess.length = i;\n return coordinatess;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {Array>>} [coordinatesss]\n * Coordinatesss.\n * @return {Array>>} Coordinatesss.\n */\nexport function inflateMultiCoordinatesArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n coordinatesss,\n) {\n coordinatesss = coordinatesss !== undefined ? coordinatesss : [];\n let i = 0;\n for (let j = 0, jj = endss.length; j < jj; ++j) {\n const ends = endss[j];\n coordinatesss[i++] =\n ends.length === 1 && ends[0] === offset\n ? []\n : inflateCoordinatesArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n coordinatesss[i],\n );\n offset = ends[ends.length - 1];\n }\n coordinatesss.length = i;\n return coordinatesss;\n}\n","/**\n * @module ol/geom/flat/interiorpoint\n */\nimport {ascending} from '../../array.js';\nimport {linearRingsContainsXY} from './contains.js';\n\n/**\n * Calculates a point that is likely to lie in the interior of the linear rings.\n * Inspired by JTS's com.vividsolutions.jts.geom.Geometry#getInteriorPoint.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {Array} flatCenters Flat centers.\n * @param {number} flatCentersOffset Flat center offset.\n * @param {Array} [dest] Destination.\n * @return {Array} Destination point as XYM coordinate, where M is the\n * length of the horizontal intersection that the point belongs to.\n */\nexport function getInteriorPointOfArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n flatCenters,\n flatCentersOffset,\n dest,\n) {\n let i, ii, x, x1, x2, y1, y2;\n const y = flatCenters[flatCentersOffset + 1];\n /** @type {Array} */\n const intersections = [];\n // Calculate intersections with the horizontal line\n for (let r = 0, rr = ends.length; r < rr; ++r) {\n const end = ends[r];\n x1 = flatCoordinates[end - stride];\n y1 = flatCoordinates[end - stride + 1];\n for (i = offset; i < end; i += stride) {\n x2 = flatCoordinates[i];\n y2 = flatCoordinates[i + 1];\n if ((y <= y1 && y2 <= y) || (y1 <= y && y <= y2)) {\n x = ((y - y1) / (y2 - y1)) * (x2 - x1) + x1;\n intersections.push(x);\n }\n x1 = x2;\n y1 = y2;\n }\n }\n // Find the longest segment of the horizontal line that has its center point\n // inside the linear ring.\n let pointX = NaN;\n let maxSegmentLength = -Infinity;\n intersections.sort(ascending);\n x1 = intersections[0];\n for (i = 1, ii = intersections.length; i < ii; ++i) {\n x2 = intersections[i];\n const segmentLength = Math.abs(x2 - x1);\n if (segmentLength > maxSegmentLength) {\n x = (x1 + x2) / 2;\n if (linearRingsContainsXY(flatCoordinates, offset, ends, stride, x, y)) {\n pointX = x;\n maxSegmentLength = segmentLength;\n }\n }\n x1 = x2;\n }\n if (isNaN(pointX)) {\n // There is no horizontal line that has its center point inside the linear\n // ring. Use the center of the the linear ring's extent.\n pointX = flatCenters[flatCentersOffset];\n }\n if (dest) {\n dest.push(pointX, y, maxSegmentLength);\n return dest;\n }\n return [pointX, y, maxSegmentLength];\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {Array} flatCenters Flat centers.\n * @return {Array} Interior points as XYM coordinates, where M is the\n * length of the horizontal intersection that the point belongs to.\n */\nexport function getInteriorPointsOfMultiArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n flatCenters,\n) {\n /** @type {Array} */\n let interiorPoints = [];\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n interiorPoints = getInteriorPointOfArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n flatCenters,\n 2 * i,\n interiorPoints,\n );\n offset = ends[ends.length - 1];\n }\n return interiorPoints;\n}\n","/**\n * @module ol/geom/flat/interpolate\n */\nimport {binarySearch} from '../../array.js';\nimport {lerp} from '../../math.js';\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} fraction Fraction.\n * @param {Array} [dest] Destination.\n * @param {number} [dimension] Destination dimension (default is `2`)\n * @return {Array} Destination.\n */\nexport function interpolatePoint(\n flatCoordinates,\n offset,\n end,\n stride,\n fraction,\n dest,\n dimension,\n) {\n let o, t;\n const n = (end - offset) / stride;\n if (n === 1) {\n o = offset;\n } else if (n === 2) {\n o = offset;\n t = fraction;\n } else if (n !== 0) {\n let x1 = flatCoordinates[offset];\n let y1 = flatCoordinates[offset + 1];\n let length = 0;\n const cumulativeLengths = [0];\n for (let i = offset + stride; i < end; i += stride) {\n const x2 = flatCoordinates[i];\n const y2 = flatCoordinates[i + 1];\n length += Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));\n cumulativeLengths.push(length);\n x1 = x2;\n y1 = y2;\n }\n const target = fraction * length;\n const index = binarySearch(cumulativeLengths, target);\n if (index < 0) {\n t =\n (target - cumulativeLengths[-index - 2]) /\n (cumulativeLengths[-index - 1] - cumulativeLengths[-index - 2]);\n o = offset + (-index - 2) * stride;\n } else {\n o = offset + index * stride;\n }\n }\n dimension = dimension > 1 ? dimension : 2;\n dest = dest ? dest : new Array(dimension);\n for (let i = 0; i < dimension; ++i) {\n dest[i] =\n o === undefined\n ? NaN\n : t === undefined\n ? flatCoordinates[o + i]\n : lerp(flatCoordinates[o + i], flatCoordinates[o + stride + i], t);\n }\n return dest;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} m M.\n * @param {boolean} extrapolate Extrapolate.\n * @return {import(\"../../coordinate.js\").Coordinate|null} Coordinate.\n */\nexport function lineStringCoordinateAtM(\n flatCoordinates,\n offset,\n end,\n stride,\n m,\n extrapolate,\n) {\n if (end == offset) {\n return null;\n }\n let coordinate;\n if (m < flatCoordinates[offset + stride - 1]) {\n if (extrapolate) {\n coordinate = flatCoordinates.slice(offset, offset + stride);\n coordinate[stride - 1] = m;\n return coordinate;\n }\n return null;\n }\n if (flatCoordinates[end - 1] < m) {\n if (extrapolate) {\n coordinate = flatCoordinates.slice(end - stride, end);\n coordinate[stride - 1] = m;\n return coordinate;\n }\n return null;\n }\n // FIXME use O(1) search\n if (m == flatCoordinates[offset + stride - 1]) {\n return flatCoordinates.slice(offset, offset + stride);\n }\n let lo = offset / stride;\n let hi = end / stride;\n while (lo < hi) {\n const mid = (lo + hi) >> 1;\n if (m < flatCoordinates[(mid + 1) * stride - 1]) {\n hi = mid;\n } else {\n lo = mid + 1;\n }\n }\n const m0 = flatCoordinates[lo * stride - 1];\n if (m == m0) {\n return flatCoordinates.slice((lo - 1) * stride, (lo - 1) * stride + stride);\n }\n const m1 = flatCoordinates[(lo + 1) * stride - 1];\n const t = (m - m0) / (m1 - m0);\n coordinate = [];\n for (let i = 0; i < stride - 1; ++i) {\n coordinate.push(\n lerp(\n flatCoordinates[(lo - 1) * stride + i],\n flatCoordinates[lo * stride + i],\n t,\n ),\n );\n }\n coordinate.push(m);\n return coordinate;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {number} m M.\n * @param {boolean} extrapolate Extrapolate.\n * @param {boolean} interpolate Interpolate.\n * @return {import(\"../../coordinate.js\").Coordinate|null} Coordinate.\n */\nexport function lineStringsCoordinateAtM(\n flatCoordinates,\n offset,\n ends,\n stride,\n m,\n extrapolate,\n interpolate,\n) {\n if (interpolate) {\n return lineStringCoordinateAtM(\n flatCoordinates,\n offset,\n ends[ends.length - 1],\n stride,\n m,\n extrapolate,\n );\n }\n let coordinate;\n if (m < flatCoordinates[stride - 1]) {\n if (extrapolate) {\n coordinate = flatCoordinates.slice(0, stride);\n coordinate[stride - 1] = m;\n return coordinate;\n }\n return null;\n }\n if (flatCoordinates[flatCoordinates.length - 1] < m) {\n if (extrapolate) {\n coordinate = flatCoordinates.slice(flatCoordinates.length - stride);\n coordinate[stride - 1] = m;\n return coordinate;\n }\n return null;\n }\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n if (offset == end) {\n continue;\n }\n if (m < flatCoordinates[offset + stride - 1]) {\n return null;\n }\n if (m <= flatCoordinates[end - 1]) {\n return lineStringCoordinateAtM(\n flatCoordinates,\n offset,\n end,\n stride,\n m,\n false,\n );\n }\n offset = end;\n }\n return null;\n}\n","/**\n * @module ol/geom/flat/intersectsextent\n */\nimport {\n containsExtent,\n createEmpty,\n extendFlatCoordinates,\n intersects,\n intersectsSegment,\n} from '../../extent.js';\nimport {forEach as forEachSegment} from './segments.js';\nimport {linearRingContainsExtent, linearRingContainsXY} from './contains.js';\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLineString(\n flatCoordinates,\n offset,\n end,\n stride,\n extent,\n) {\n const coordinatesExtent = extendFlatCoordinates(\n createEmpty(),\n flatCoordinates,\n offset,\n end,\n stride,\n );\n if (!intersects(extent, coordinatesExtent)) {\n return false;\n }\n if (containsExtent(extent, coordinatesExtent)) {\n return true;\n }\n if (coordinatesExtent[0] >= extent[0] && coordinatesExtent[2] <= extent[2]) {\n return true;\n }\n if (coordinatesExtent[1] >= extent[1] && coordinatesExtent[3] <= extent[3]) {\n return true;\n }\n return forEachSegment(\n flatCoordinates,\n offset,\n end,\n stride,\n /**\n * @param {import(\"../../coordinate.js\").Coordinate} point1 Start point.\n * @param {import(\"../../coordinate.js\").Coordinate} point2 End point.\n * @return {boolean} `true` if the segment and the extent intersect,\n * `false` otherwise.\n */\n function (point1, point2) {\n return intersectsSegment(extent, point1, point2);\n },\n );\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLineStringArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n extent,\n) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n if (\n intersectsLineString(flatCoordinates, offset, ends[i], stride, extent)\n ) {\n return true;\n }\n offset = ends[i];\n }\n return false;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLinearRing(\n flatCoordinates,\n offset,\n end,\n stride,\n extent,\n) {\n if (intersectsLineString(flatCoordinates, offset, end, stride, extent)) {\n return true;\n }\n if (\n linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n extent[0],\n extent[1],\n )\n ) {\n return true;\n }\n if (\n linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n extent[0],\n extent[3],\n )\n ) {\n return true;\n }\n if (\n linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n extent[2],\n extent[1],\n )\n ) {\n return true;\n }\n if (\n linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n extent[2],\n extent[3],\n )\n ) {\n return true;\n }\n return false;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLinearRingArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n extent,\n) {\n if (!intersectsLinearRing(flatCoordinates, offset, ends[0], stride, extent)) {\n return false;\n }\n if (ends.length === 1) {\n return true;\n }\n for (let i = 1, ii = ends.length; i < ii; ++i) {\n if (\n linearRingContainsExtent(\n flatCoordinates,\n ends[i - 1],\n ends[i],\n stride,\n extent,\n )\n ) {\n if (\n !intersectsLineString(\n flatCoordinates,\n ends[i - 1],\n ends[i],\n stride,\n extent,\n )\n ) {\n return false;\n }\n }\n }\n return true;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLinearRingMultiArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n extent,\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n if (\n intersectsLinearRingArray(flatCoordinates, offset, ends, stride, extent)\n ) {\n return true;\n }\n offset = ends[ends.length - 1];\n }\n return false;\n}\n","/**\n * @module ol/geom/flat/length\n */\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {number} Length.\n */\nexport function lineStringLength(flatCoordinates, offset, end, stride) {\n let x1 = flatCoordinates[offset];\n let y1 = flatCoordinates[offset + 1];\n let length = 0;\n for (let i = offset + stride; i < end; i += stride) {\n const x2 = flatCoordinates[i];\n const y2 = flatCoordinates[i + 1];\n length += Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));\n x1 = x2;\n y1 = y2;\n }\n return length;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {number} Perimeter.\n */\nexport function linearRingLength(flatCoordinates, offset, end, stride) {\n let perimeter = lineStringLength(flatCoordinates, offset, end, stride);\n const dx = flatCoordinates[end - stride] - flatCoordinates[offset];\n const dy = flatCoordinates[end - stride + 1] - flatCoordinates[offset + 1];\n perimeter += Math.sqrt(dx * dx + dy * dy);\n return perimeter;\n}\n","/**\n * @module ol/geom/flat/reverse\n */\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n */\nexport function coordinates(flatCoordinates, offset, end, stride) {\n while (offset < end - stride) {\n for (let i = 0; i < stride; ++i) {\n const tmp = flatCoordinates[offset + i];\n flatCoordinates[offset + i] = flatCoordinates[end - stride + i];\n flatCoordinates[end - stride + i] = tmp;\n }\n offset += stride;\n end -= stride;\n }\n}\n","/**\n * @module ol/geom/flat/orient\n */\nimport {coordinates as reverseCoordinates} from './reverse.js';\n\n/**\n * Is the linear ring oriented clockwise in a coordinate system with a bottom-left\n * coordinate origin? For a coordinate system with a top-left coordinate origin,\n * the ring's orientation is clockwise when this function returns false.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {boolean|undefined} Is clockwise.\n */\nexport function linearRingIsClockwise(flatCoordinates, offset, end, stride) {\n // https://stackoverflow.com/q/1165647/clockwise-method#1165943\n // https://github.com/OSGeo/gdal/blob/master/gdal/ogr/ogrlinearring.cpp\n let edge = 0;\n let x1 = flatCoordinates[end - stride];\n let y1 = flatCoordinates[end - stride + 1];\n for (; offset < end; offset += stride) {\n const x2 = flatCoordinates[offset];\n const y2 = flatCoordinates[offset + 1];\n edge += (x2 - x1) * (y2 + y1);\n x1 = x2;\n y1 = y2;\n }\n return edge === 0 ? undefined : edge > 0;\n}\n\n/**\n * Determines if linear rings are oriented. By default, left-hand orientation\n * is tested (first ring must be clockwise, remaining rings counter-clockwise).\n * To test for right-hand orientation, use the `right` argument.\n *\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Array of end indexes.\n * @param {number} stride Stride.\n * @param {boolean} [right] Test for right-hand orientation\n * (counter-clockwise exterior ring and clockwise interior rings).\n * @return {boolean} Rings are correctly oriented.\n */\nexport function linearRingsAreOriented(\n flatCoordinates,\n offset,\n ends,\n stride,\n right,\n) {\n right = right !== undefined ? right : false;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const isClockwise = linearRingIsClockwise(\n flatCoordinates,\n offset,\n end,\n stride,\n );\n if (i === 0) {\n if ((right && isClockwise) || (!right && !isClockwise)) {\n return false;\n }\n } else {\n if ((right && !isClockwise) || (!right && isClockwise)) {\n return false;\n }\n }\n offset = end;\n }\n return true;\n}\n\n/**\n * Determines if linear rings are oriented. By default, left-hand orientation\n * is tested (first ring must be clockwise, remaining rings counter-clockwise).\n * To test for right-hand orientation, use the `right` argument.\n *\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Array of array of end indexes.\n * @param {number} stride Stride.\n * @param {boolean} [right] Test for right-hand orientation\n * (counter-clockwise exterior ring and clockwise interior rings).\n * @return {boolean} Rings are correctly oriented.\n */\nexport function linearRingssAreOriented(\n flatCoordinates,\n offset,\n endss,\n stride,\n right,\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n if (!linearRingsAreOriented(flatCoordinates, offset, ends, stride, right)) {\n return false;\n }\n if (ends.length) {\n offset = ends[ends.length - 1];\n }\n }\n return true;\n}\n\n/**\n * Orient coordinates in a flat array of linear rings. By default, rings\n * are oriented following the left-hand rule (clockwise for exterior and\n * counter-clockwise for interior rings). To orient according to the\n * right-hand rule, use the `right` argument.\n *\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {boolean} [right] Follow the right-hand rule for orientation.\n * @return {number} End.\n */\nexport function orientLinearRings(\n flatCoordinates,\n offset,\n ends,\n stride,\n right,\n) {\n right = right !== undefined ? right : false;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const isClockwise = linearRingIsClockwise(\n flatCoordinates,\n offset,\n end,\n stride,\n );\n const reverse =\n i === 0\n ? (right && isClockwise) || (!right && !isClockwise)\n : (right && !isClockwise) || (!right && isClockwise);\n if (reverse) {\n reverseCoordinates(flatCoordinates, offset, end, stride);\n }\n offset = end;\n }\n return offset;\n}\n\n/**\n * Orient coordinates in a flat array of linear rings. By default, rings\n * are oriented following the left-hand rule (clockwise for exterior and\n * counter-clockwise for interior rings). To orient according to the\n * right-hand rule, use the `right` argument.\n *\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Array of array of end indexes.\n * @param {number} stride Stride.\n * @param {boolean} [right] Follow the right-hand rule for orientation.\n * @return {number} End.\n */\nexport function orientLinearRingsArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n right,\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n offset = orientLinearRings(\n flatCoordinates,\n offset,\n endss[i],\n stride,\n right,\n );\n }\n return offset;\n}\n\n/**\n * Return a two-dimensional endss\n * @param {Array} flatCoordinates Flat coordinates\n * @param {Array} ends Linear ring end indexes\n * @return {Array>} Two dimensional endss array that can\n * be used to construct a MultiPolygon\n */\nexport function inflateEnds(flatCoordinates, ends) {\n const endss = [];\n let offset = 0;\n let prevEndIndex = 0;\n let startOrientation;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n // classifies an array of rings into polygons with outer rings and holes\n const orientation = linearRingIsClockwise(flatCoordinates, offset, end, 2);\n if (startOrientation === undefined) {\n startOrientation = orientation;\n }\n if (orientation === startOrientation) {\n endss.push(ends.slice(prevEndIndex, i + 1));\n } else {\n if (endss.length === 0) {\n continue;\n }\n endss[endss.length - 1].push(ends[prevEndIndex]);\n }\n prevEndIndex = i + 1;\n offset = end;\n }\n return endss;\n}\n","/**\n * @module ol/geom/flat/segments\n */\n\n/**\n * This function calls `callback` for each segment of the flat coordinates\n * array. If the callback returns a truthy value the function returns that\n * value immediately. Otherwise the function returns `false`.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {function(import(\"../../coordinate.js\").Coordinate, import(\"../../coordinate.js\").Coordinate): T} callback Function\n * called for each segment.\n * @return {T|boolean} Value.\n * @template T\n */\nexport function forEach(flatCoordinates, offset, end, stride, callback) {\n let ret;\n offset += stride;\n for (; offset < end; offset += stride) {\n ret = callback(\n flatCoordinates.slice(offset - stride, offset),\n flatCoordinates.slice(offset, offset + stride),\n );\n if (ret) {\n return ret;\n }\n }\n return false;\n}\n","/**\n * @module ol/geom/flat/simplify\n */\n// Based on simplify-js https://github.com/mourner/simplify-js\n// Copyright (c) 2012, Vladimir Agafonkin\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are met:\n//\n// 1. Redistributions of source code must retain the above copyright notice,\n// this list of conditions and the following disclaimer.\n//\n// 2. Redistributions in binary form must reproduce the above copyright\n// notice, this list of conditions and the following disclaimer in the\n// documentation and/or other materials provided with the distribution.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n// POSSIBILITY OF SUCH DAMAGE.\n\nimport {squaredDistance, squaredSegmentDistance} from '../../math.js';\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {boolean} highQuality Highest quality.\n * @param {Array} [simplifiedFlatCoordinates] Simplified flat\n * coordinates.\n * @return {Array} Simplified line string.\n */\nexport function simplifyLineString(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n highQuality,\n simplifiedFlatCoordinates,\n) {\n simplifiedFlatCoordinates =\n simplifiedFlatCoordinates !== undefined ? simplifiedFlatCoordinates : [];\n if (!highQuality) {\n end = radialDistance(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0,\n );\n flatCoordinates = simplifiedFlatCoordinates;\n offset = 0;\n stride = 2;\n }\n simplifiedFlatCoordinates.length = douglasPeucker(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0,\n );\n return simplifiedFlatCoordinates;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {Array} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @return {number} Simplified offset.\n */\nexport function douglasPeucker(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n) {\n const n = (end - offset) / stride;\n if (n < 3) {\n for (; offset < end; offset += stride) {\n simplifiedFlatCoordinates[simplifiedOffset++] = flatCoordinates[offset];\n simplifiedFlatCoordinates[simplifiedOffset++] =\n flatCoordinates[offset + 1];\n }\n return simplifiedOffset;\n }\n /** @type {Array} */\n const markers = new Array(n);\n markers[0] = 1;\n markers[n - 1] = 1;\n /** @type {Array} */\n const stack = [offset, end - stride];\n let index = 0;\n while (stack.length > 0) {\n const last = stack.pop();\n const first = stack.pop();\n let maxSquaredDistance = 0;\n const x1 = flatCoordinates[first];\n const y1 = flatCoordinates[first + 1];\n const x2 = flatCoordinates[last];\n const y2 = flatCoordinates[last + 1];\n for (let i = first + stride; i < last; i += stride) {\n const x = flatCoordinates[i];\n const y = flatCoordinates[i + 1];\n const squaredDistance = squaredSegmentDistance(x, y, x1, y1, x2, y2);\n if (squaredDistance > maxSquaredDistance) {\n index = i;\n maxSquaredDistance = squaredDistance;\n }\n }\n if (maxSquaredDistance > squaredTolerance) {\n markers[(index - offset) / stride] = 1;\n if (first + stride < index) {\n stack.push(first, index);\n }\n if (index + stride < last) {\n stack.push(index, last);\n }\n }\n }\n for (let i = 0; i < n; ++i) {\n if (markers[i]) {\n simplifiedFlatCoordinates[simplifiedOffset++] =\n flatCoordinates[offset + i * stride];\n simplifiedFlatCoordinates[simplifiedOffset++] =\n flatCoordinates[offset + i * stride + 1];\n }\n }\n return simplifiedOffset;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {Array} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @param {Array} simplifiedEnds Simplified ends.\n * @return {number} Simplified offset.\n */\nexport function douglasPeuckerArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEnds,\n) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n simplifiedOffset = douglasPeucker(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n );\n simplifiedEnds.push(simplifiedOffset);\n offset = end;\n }\n return simplifiedOffset;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {Array} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @param {Array>} simplifiedEndss Simplified endss.\n * @return {number} Simplified offset.\n */\nexport function douglasPeuckerMultiArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEndss,\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n /** @type {Array} */\n const simplifiedEnds = [];\n simplifiedOffset = douglasPeuckerArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEnds,\n );\n simplifiedEndss.push(simplifiedEnds);\n offset = ends[ends.length - 1];\n }\n return simplifiedOffset;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {Array} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @return {number} Simplified offset.\n */\nexport function radialDistance(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n) {\n if (end <= offset + stride) {\n // zero or one point, no simplification possible, so copy and return\n for (; offset < end; offset += stride) {\n simplifiedFlatCoordinates[simplifiedOffset++] = flatCoordinates[offset];\n simplifiedFlatCoordinates[simplifiedOffset++] =\n flatCoordinates[offset + 1];\n }\n return simplifiedOffset;\n }\n let x1 = flatCoordinates[offset];\n let y1 = flatCoordinates[offset + 1];\n // copy first point\n simplifiedFlatCoordinates[simplifiedOffset++] = x1;\n simplifiedFlatCoordinates[simplifiedOffset++] = y1;\n let x2 = x1;\n let y2 = y1;\n for (offset += stride; offset < end; offset += stride) {\n x2 = flatCoordinates[offset];\n y2 = flatCoordinates[offset + 1];\n if (squaredDistance(x1, y1, x2, y2) > squaredTolerance) {\n // copy point at offset\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n x1 = x2;\n y1 = y2;\n }\n }\n if (x2 != x1 || y2 != y1) {\n // copy last point\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n }\n return simplifiedOffset;\n}\n\n/**\n * @param {number} value Value.\n * @param {number} tolerance Tolerance.\n * @return {number} Rounded value.\n */\nexport function snap(value, tolerance) {\n return tolerance * Math.round(value / tolerance);\n}\n\n/**\n * Simplifies a line string using an algorithm designed by Tim Schaub.\n * Coordinates are snapped to the nearest value in a virtual grid and\n * consecutive duplicate coordinates are discarded. This effectively preserves\n * topology as the simplification of any subsection of a line string is\n * independent of the rest of the line string. This means that, for examples,\n * the common edge between two polygons will be simplified to the same line\n * string independently in both polygons. This implementation uses a single\n * pass over the coordinates and eliminates intermediate collinear points.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} tolerance Tolerance.\n * @param {Array} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @return {number} Simplified offset.\n */\nexport function quantize(\n flatCoordinates,\n offset,\n end,\n stride,\n tolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n) {\n // do nothing if the line is empty\n if (offset == end) {\n return simplifiedOffset;\n }\n // snap the first coordinate (P1)\n let x1 = snap(flatCoordinates[offset], tolerance);\n let y1 = snap(flatCoordinates[offset + 1], tolerance);\n offset += stride;\n // add the first coordinate to the output\n simplifiedFlatCoordinates[simplifiedOffset++] = x1;\n simplifiedFlatCoordinates[simplifiedOffset++] = y1;\n // find the next coordinate that does not snap to the same value as the first\n // coordinate (P2)\n let x2, y2;\n do {\n x2 = snap(flatCoordinates[offset], tolerance);\n y2 = snap(flatCoordinates[offset + 1], tolerance);\n offset += stride;\n if (offset == end) {\n // all coordinates snap to the same value, the line collapses to a point\n // push the last snapped value anyway to ensure that the output contains\n // at least two points\n // FIXME should we really return at least two points anyway?\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n return simplifiedOffset;\n }\n } while (x2 == x1 && y2 == y1);\n while (offset < end) {\n // snap the next coordinate (P3)\n const x3 = snap(flatCoordinates[offset], tolerance);\n const y3 = snap(flatCoordinates[offset + 1], tolerance);\n offset += stride;\n // skip P3 if it is equal to P2\n if (x3 == x2 && y3 == y2) {\n continue;\n }\n // calculate the delta between P1 and P2\n const dx1 = x2 - x1;\n const dy1 = y2 - y1;\n // calculate the delta between P3 and P1\n const dx2 = x3 - x1;\n const dy2 = y3 - y1;\n // if P1, P2, and P3 are colinear and P3 is further from P1 than P2 is from\n // P1 in the same direction then P2 is on the straight line between P1 and\n // P3\n if (\n dx1 * dy2 == dy1 * dx2 &&\n ((dx1 < 0 && dx2 < dx1) || dx1 == dx2 || (dx1 > 0 && dx2 > dx1)) &&\n ((dy1 < 0 && dy2 < dy1) || dy1 == dy2 || (dy1 > 0 && dy2 > dy1))\n ) {\n // discard P2 and set P2 = P3\n x2 = x3;\n y2 = y3;\n continue;\n }\n // either P1, P2, and P3 are not colinear, or they are colinear but P3 is\n // between P3 and P1 or on the opposite half of the line to P2. add P2,\n // and continue with P1 = P2 and P2 = P3\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n x1 = x2;\n y1 = y2;\n x2 = x3;\n y2 = y3;\n }\n // add the last point (P2)\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n return simplifiedOffset;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {number} tolerance Tolerance.\n * @param {Array} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @param {Array} simplifiedEnds Simplified ends.\n * @return {number} Simplified offset.\n */\nexport function quantizeArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n tolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEnds,\n) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n simplifiedOffset = quantize(\n flatCoordinates,\n offset,\n end,\n stride,\n tolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n );\n simplifiedEnds.push(simplifiedOffset);\n offset = end;\n }\n return simplifiedOffset;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} tolerance Tolerance.\n * @param {Array} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @param {Array>} simplifiedEndss Simplified endss.\n * @return {number} Simplified offset.\n */\nexport function quantizeMultiArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n tolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEndss,\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n /** @type {Array} */\n const simplifiedEnds = [];\n simplifiedOffset = quantizeArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n tolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEnds,\n );\n simplifiedEndss.push(simplifiedEnds);\n offset = ends[ends.length - 1];\n }\n return simplifiedOffset;\n}\n","/**\n * @module ol/geom/flat/transform\n */\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n * @param {Array} [dest] Destination.\n * @return {Array} Transformed coordinates.\n */\nexport function transform2D(\n flatCoordinates,\n offset,\n end,\n stride,\n transform,\n dest,\n) {\n dest = dest ? dest : [];\n let i = 0;\n for (let j = offset; j < end; j += stride) {\n const x = flatCoordinates[j];\n const y = flatCoordinates[j + 1];\n dest[i++] = transform[0] * x + transform[2] * y + transform[4];\n dest[i++] = transform[1] * x + transform[3] * y + transform[5];\n }\n if (dest && dest.length != i) {\n dest.length = i;\n }\n return dest;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} angle Angle.\n * @param {Array} anchor Rotation anchor point.\n * @param {Array} [dest] Destination.\n * @return {Array} Transformed coordinates.\n */\nexport function rotate(\n flatCoordinates,\n offset,\n end,\n stride,\n angle,\n anchor,\n dest,\n) {\n dest = dest ? dest : [];\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n const anchorX = anchor[0];\n const anchorY = anchor[1];\n let i = 0;\n for (let j = offset; j < end; j += stride) {\n const deltaX = flatCoordinates[j] - anchorX;\n const deltaY = flatCoordinates[j + 1] - anchorY;\n dest[i++] = anchorX + deltaX * cos - deltaY * sin;\n dest[i++] = anchorY + deltaX * sin + deltaY * cos;\n for (let k = j + 2; k < j + stride; ++k) {\n dest[i++] = flatCoordinates[k];\n }\n }\n if (dest && dest.length != i) {\n dest.length = i;\n }\n return dest;\n}\n\n/**\n * Scale the coordinates.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} sx Scale factor in the x-direction.\n * @param {number} sy Scale factor in the y-direction.\n * @param {Array} anchor Scale anchor point.\n * @param {Array} [dest] Destination.\n * @return {Array} Transformed coordinates.\n */\nexport function scale(\n flatCoordinates,\n offset,\n end,\n stride,\n sx,\n sy,\n anchor,\n dest,\n) {\n dest = dest ? dest : [];\n const anchorX = anchor[0];\n const anchorY = anchor[1];\n let i = 0;\n for (let j = offset; j < end; j += stride) {\n const deltaX = flatCoordinates[j] - anchorX;\n const deltaY = flatCoordinates[j + 1] - anchorY;\n dest[i++] = anchorX + sx * deltaX;\n dest[i++] = anchorY + sy * deltaY;\n for (let k = j + 2; k < j + stride; ++k) {\n dest[i++] = flatCoordinates[k];\n }\n }\n if (dest && dest.length != i) {\n dest.length = i;\n }\n return dest;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} deltaX Delta X.\n * @param {number} deltaY Delta Y.\n * @param {Array} [dest] Destination.\n * @return {Array} Transformed coordinates.\n */\nexport function translate(\n flatCoordinates,\n offset,\n end,\n stride,\n deltaX,\n deltaY,\n dest,\n) {\n dest = dest ? dest : [];\n let i = 0;\n for (let j = offset; j < end; j += stride) {\n dest[i++] = flatCoordinates[j] + deltaX;\n dest[i++] = flatCoordinates[j + 1] + deltaY;\n for (let k = j + 2; k < j + stride; ++k) {\n dest[i++] = flatCoordinates[k];\n }\n }\n if (dest && dest.length != i) {\n dest.length = i;\n }\n return dest;\n}\n","/**\n * @module ol/has\n */\n\nconst ua =\n typeof navigator !== 'undefined' && typeof navigator.userAgent !== 'undefined'\n ? navigator.userAgent.toLowerCase()\n : '';\n\n/**\n * User agent string says we are dealing with Firefox as browser.\n * @type {boolean}\n */\nexport const FIREFOX = ua.includes('firefox');\n\n/**\n * User agent string says we are dealing with Safari as browser.\n * @type {boolean}\n */\nexport const SAFARI = ua.includes('safari') && !ua.includes('chrom');\n\n/**\n * https://bugs.webkit.org/show_bug.cgi?id=237906\n * @type {boolean}\n */\nexport const SAFARI_BUG_237906 =\n SAFARI &&\n (ua.includes('version/15.4') ||\n /cpu (os|iphone os) 15_4 like mac os x/.test(ua));\n\n/**\n * User agent string says we are dealing with a WebKit engine.\n * @type {boolean}\n */\nexport const WEBKIT = ua.includes('webkit') && !ua.includes('edge');\n\n/**\n * User agent string says we are dealing with a Mac as platform.\n * @type {boolean}\n */\nexport const MAC = ua.includes('macintosh');\n\n/**\n * The ratio between physical pixels and device-independent pixels\n * (dips) on the device (`window.devicePixelRatio`).\n * @const\n * @type {number}\n * @api\n */\nexport const DEVICE_PIXEL_RATIO =\n typeof devicePixelRatio !== 'undefined' ? devicePixelRatio : 1;\n\n/**\n * The execution context is a worker with OffscreenCanvas available.\n * @const\n * @type {boolean}\n */\nexport const WORKER_OFFSCREEN_CANVAS =\n typeof WorkerGlobalScope !== 'undefined' &&\n typeof OffscreenCanvas !== 'undefined' &&\n self instanceof WorkerGlobalScope; //eslint-disable-line\n\n/**\n * Image.prototype.decode() is supported.\n * @type {boolean}\n */\nexport const IMAGE_DECODE =\n typeof Image !== 'undefined' && Image.prototype.decode;\n\n/**\n * createImageBitmap() is supported.\n * @type {boolean}\n */\nexport const CREATE_IMAGE_BITMAP = typeof createImageBitmap === 'function';\n\n/**\n * @type {boolean}\n */\nexport const PASSIVE_EVENT_LISTENERS = (function () {\n let passive = false;\n try {\n const options = Object.defineProperty({}, 'passive', {\n get: function () {\n passive = true;\n },\n });\n\n // @ts-ignore Ignore invalid event type '_'\n window.addEventListener('_', null, options);\n // @ts-ignore Ignore invalid event type '_'\n window.removeEventListener('_', null, options);\n } catch (error) {\n // passive not supported\n }\n return passive;\n})();\n","/**\n * @module ol/Geolocation\n */\nimport BaseEvent from './events/Event.js';\nimport BaseObject from './Object.js';\nimport {circular as circularPolygon} from './geom/Polygon.js';\nimport {\n get as getProjection,\n getTransformFromProjections,\n identityTransform,\n} from './proj.js';\nimport {toRadians} from './math.js';\n\n/**\n * @enum {string}\n */\nconst Property = {\n ACCURACY: 'accuracy',\n ACCURACY_GEOMETRY: 'accuracyGeometry',\n ALTITUDE: 'altitude',\n ALTITUDE_ACCURACY: 'altitudeAccuracy',\n HEADING: 'heading',\n POSITION: 'position',\n PROJECTION: 'projection',\n SPEED: 'speed',\n TRACKING: 'tracking',\n TRACKING_OPTIONS: 'trackingOptions',\n};\n\n/**\n * @enum string\n */\nconst GeolocationErrorType = {\n /**\n * Triggered when a `GeolocationPositionError` occurs.\n * @event module:ol/Geolocation.GeolocationError#error\n * @api\n */\n ERROR: 'error',\n};\n\n/**\n * @classdesc\n * Events emitted on [GeolocationPositionError](https://developer.mozilla.org/en-US/docs/Web/API/GeolocationPositionError).\n */\nexport class GeolocationError extends BaseEvent {\n /**\n * @param {GeolocationPositionError} error error object.\n */\n constructor(error) {\n super(GeolocationErrorType.ERROR);\n\n /**\n * Code of the underlying `GeolocationPositionError`.\n * @type {number}\n * @api\n */\n this.code = error.code;\n\n /**\n * Message of the underlying `GeolocationPositionError`.\n * @type {string}\n * @api\n */\n this.message = error.message;\n }\n}\n\n/**\n * @typedef {Object} Options\n * @property {boolean} [tracking=false] Start Tracking right after\n * instantiation.\n * @property {PositionOptions} [trackingOptions] Tracking options.\n * See https://www.w3.org/TR/geolocation-API/#position_options_interface.\n * @property {import(\"./proj.js\").ProjectionLike} [projection] The projection the position\n * is reported in.\n */\n\n/**\n * @typedef {import(\"./ObjectEventType\").Types|'change:accuracy'|'change:accuracyGeometry'|'change:altitude'|\n * 'change:altitudeAccuracy'|'change:heading'|'change:position'|'change:projection'|'change:speed'|'change:tracking'|\n * 'change:trackingOptions'} GeolocationObjectEventTypes\n */\n\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature<'error', GeolocationError, Return> &\n * import(\"./Observable\").CombinedOnSignature &\n * import(\"./Observable\").OnSignature} GeolocationOnSignature\n */\n\n/**\n * @classdesc\n * Helper class for providing HTML5 Geolocation capabilities.\n * The [Geolocation API](https://www.w3.org/TR/geolocation-API/)\n * is used to locate a user's position.\n *\n * To get notified of position changes and errors, register listeners for the generic\n * `change` event and the `error` event on your instance of {@link module:ol/Geolocation~Geolocation}.\n *\n * Example:\n *\n * const geolocation = new Geolocation({\n * // take the projection to use from the map's view\n * projection: view.getProjection()\n * });\n * // listen to changes in position\n * geolocation.on('change', function(evt) {\n * console.log(geolocation.getPosition());\n * });\n * // listen to error\n * geolocation.on('error', function(evt) {\n * window.console.log(evt.message);\n * });\n *\n * @fires GeolocationError\n * @api\n */\nclass Geolocation extends BaseObject {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n /***\n * @type {GeolocationOnSignature}\n */\n this.on;\n\n /***\n * @type {GeolocationOnSignature}\n */\n this.once;\n\n /***\n * @type {GeolocationOnSignature}\n */\n this.un;\n\n options = options || {};\n\n /**\n * The unprojected (EPSG:4326) device position.\n * @private\n * @type {?import(\"./coordinate.js\").Coordinate}\n */\n this.position_ = null;\n\n /**\n * @private\n * @type {import(\"./proj.js\").TransformFunction}\n */\n this.transform_ = identityTransform;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.watchId_ = undefined;\n\n this.addChangeListener(Property.PROJECTION, this.handleProjectionChanged_);\n this.addChangeListener(Property.TRACKING, this.handleTrackingChanged_);\n\n if (options.projection !== undefined) {\n this.setProjection(options.projection);\n }\n if (options.trackingOptions !== undefined) {\n this.setTrackingOptions(options.trackingOptions);\n }\n\n this.setTracking(options.tracking !== undefined ? options.tracking : false);\n }\n\n /**\n * Clean up.\n */\n disposeInternal() {\n this.setTracking(false);\n super.disposeInternal();\n }\n\n /**\n * @private\n */\n handleProjectionChanged_() {\n const projection = this.getProjection();\n if (projection) {\n this.transform_ = getTransformFromProjections(\n getProjection('EPSG:4326'),\n projection,\n );\n if (this.position_) {\n this.set(Property.POSITION, this.transform_(this.position_));\n }\n }\n }\n\n /**\n * @private\n */\n handleTrackingChanged_() {\n if ('geolocation' in navigator) {\n const tracking = this.getTracking();\n if (tracking && this.watchId_ === undefined) {\n this.watchId_ = navigator.geolocation.watchPosition(\n this.positionChange_.bind(this),\n this.positionError_.bind(this),\n this.getTrackingOptions(),\n );\n } else if (!tracking && this.watchId_ !== undefined) {\n navigator.geolocation.clearWatch(this.watchId_);\n this.watchId_ = undefined;\n }\n }\n }\n\n /**\n * @private\n * @param {GeolocationPosition} position position event.\n */\n positionChange_(position) {\n const coords = position.coords;\n this.set(Property.ACCURACY, coords.accuracy);\n this.set(\n Property.ALTITUDE,\n coords.altitude === null ? undefined : coords.altitude,\n );\n this.set(\n Property.ALTITUDE_ACCURACY,\n coords.altitudeAccuracy === null ? undefined : coords.altitudeAccuracy,\n );\n this.set(\n Property.HEADING,\n coords.heading === null ? undefined : toRadians(coords.heading),\n );\n if (!this.position_) {\n this.position_ = [coords.longitude, coords.latitude];\n } else {\n this.position_[0] = coords.longitude;\n this.position_[1] = coords.latitude;\n }\n const projectedPosition = this.transform_(this.position_);\n this.set(Property.POSITION, projectedPosition.slice());\n this.set(Property.SPEED, coords.speed === null ? undefined : coords.speed);\n const geometry = circularPolygon(this.position_, coords.accuracy);\n geometry.applyTransform(this.transform_);\n this.set(Property.ACCURACY_GEOMETRY, geometry);\n this.changed();\n }\n\n /**\n * @private\n * @param {GeolocationPositionError} error error object.\n */\n positionError_(error) {\n this.dispatchEvent(new GeolocationError(error));\n }\n\n /**\n * Get the accuracy of the position in meters.\n * @return {number|undefined} The accuracy of the position measurement in\n * meters.\n * @observable\n * @api\n */\n getAccuracy() {\n return /** @type {number|undefined} */ (this.get(Property.ACCURACY));\n }\n\n /**\n * Get a geometry of the position accuracy.\n * @return {?import(\"./geom/Polygon.js\").default} A geometry of the position accuracy.\n * @observable\n * @api\n */\n getAccuracyGeometry() {\n return /** @type {?import(\"./geom/Polygon.js\").default} */ (\n this.get(Property.ACCURACY_GEOMETRY) || null\n );\n }\n\n /**\n * Get the altitude associated with the position.\n * @return {number|undefined} The altitude of the position in meters above mean\n * sea level.\n * @observable\n * @api\n */\n getAltitude() {\n return /** @type {number|undefined} */ (this.get(Property.ALTITUDE));\n }\n\n /**\n * Get the altitude accuracy of the position.\n * @return {number|undefined} The accuracy of the altitude measurement in\n * meters.\n * @observable\n * @api\n */\n getAltitudeAccuracy() {\n return /** @type {number|undefined} */ (\n this.get(Property.ALTITUDE_ACCURACY)\n );\n }\n\n /**\n * Get the heading as radians clockwise from North.\n * Note: depending on the browser, the heading is only defined if the `enableHighAccuracy`\n * is set to `true` in the tracking options.\n * @return {number|undefined} The heading of the device in radians from north.\n * @observable\n * @api\n */\n getHeading() {\n return /** @type {number|undefined} */ (this.get(Property.HEADING));\n }\n\n /**\n * Get the position of the device.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} The current position of the device reported\n * in the current projection.\n * @observable\n * @api\n */\n getPosition() {\n return /** @type {import(\"./coordinate.js\").Coordinate|undefined} */ (\n this.get(Property.POSITION)\n );\n }\n\n /**\n * Get the projection associated with the position.\n * @return {import(\"./proj/Projection.js\").default|undefined} The projection the position is\n * reported in.\n * @observable\n * @api\n */\n getProjection() {\n return /** @type {import(\"./proj/Projection.js\").default|undefined} */ (\n this.get(Property.PROJECTION)\n );\n }\n\n /**\n * Get the speed in meters per second.\n * @return {number|undefined} The instantaneous speed of the device in meters\n * per second.\n * @observable\n * @api\n */\n getSpeed() {\n return /** @type {number|undefined} */ (this.get(Property.SPEED));\n }\n\n /**\n * Determine if the device location is being tracked.\n * @return {boolean} The device location is being tracked.\n * @observable\n * @api\n */\n getTracking() {\n return /** @type {boolean} */ (this.get(Property.TRACKING));\n }\n\n /**\n * Get the tracking options.\n * See https://www.w3.org/TR/geolocation-API/#position-options.\n * @return {PositionOptions|undefined} PositionOptions as defined by\n * the [HTML5 Geolocation spec\n * ](https://www.w3.org/TR/geolocation-API/#position_options_interface).\n * @observable\n * @api\n */\n getTrackingOptions() {\n return /** @type {PositionOptions|undefined} */ (\n this.get(Property.TRACKING_OPTIONS)\n );\n }\n\n /**\n * Set the projection to use for transforming the coordinates.\n * @param {import(\"./proj.js\").ProjectionLike} projection The projection the position is\n * reported in.\n * @observable\n * @api\n */\n setProjection(projection) {\n this.set(Property.PROJECTION, getProjection(projection));\n }\n\n /**\n * Enable or disable tracking.\n * @param {boolean} tracking Enable tracking.\n * @observable\n * @api\n */\n setTracking(tracking) {\n this.set(Property.TRACKING, tracking);\n }\n\n /**\n * Set the tracking options.\n * See http://www.w3.org/TR/geolocation-API/#position-options.\n * @param {PositionOptions} options PositionOptions as defined by the\n * [HTML5 Geolocation spec\n * ](http://www.w3.org/TR/geolocation-API/#position_options_interface).\n * @observable\n * @api\n */\n setTrackingOptions(options) {\n this.set(Property.TRACKING_OPTIONS, options);\n }\n}\n\nexport default Geolocation;\n","/**\n * @module ol/Kinetic\n */\n\n/**\n * @classdesc\n * Implementation of inertial deceleration for map movement.\n *\n * @api\n */\nclass Kinetic {\n /**\n * @param {number} decay Rate of decay (must be negative).\n * @param {number} minVelocity Minimum velocity (pixels/millisecond).\n * @param {number} delay Delay to consider to calculate the kinetic\n * initial values (milliseconds).\n */\n constructor(decay, minVelocity, delay) {\n /**\n * @private\n * @type {number}\n */\n this.decay_ = decay;\n\n /**\n * @private\n * @type {number}\n */\n this.minVelocity_ = minVelocity;\n\n /**\n * @private\n * @type {number}\n */\n this.delay_ = delay;\n\n /**\n * @private\n * @type {Array}\n */\n this.points_ = [];\n\n /**\n * @private\n * @type {number}\n */\n this.angle_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.initialVelocity_ = 0;\n }\n\n /**\n * FIXME empty description for jsdoc\n */\n begin() {\n this.points_.length = 0;\n this.angle_ = 0;\n this.initialVelocity_ = 0;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n */\n update(x, y) {\n this.points_.push(x, y, Date.now());\n }\n\n /**\n * @return {boolean} Whether we should do kinetic animation.\n */\n end() {\n if (this.points_.length < 6) {\n // at least 2 points are required (i.e. there must be at least 6 elements\n // in the array)\n return false;\n }\n const delay = Date.now() - this.delay_;\n const lastIndex = this.points_.length - 3;\n if (this.points_[lastIndex + 2] < delay) {\n // the last tracked point is too old, which means that the user stopped\n // panning before releasing the map\n return false;\n }\n\n // get the first point which still falls into the delay time\n let firstIndex = lastIndex - 3;\n while (firstIndex > 0 && this.points_[firstIndex + 2] > delay) {\n firstIndex -= 3;\n }\n\n const duration = this.points_[lastIndex + 2] - this.points_[firstIndex + 2];\n // we don't want a duration of 0 (divide by zero)\n // we also make sure the user panned for a duration of at least one frame\n // (1/60s) to compute sane displacement values\n if (duration < 1000 / 60) {\n return false;\n }\n\n const dx = this.points_[lastIndex] - this.points_[firstIndex];\n const dy = this.points_[lastIndex + 1] - this.points_[firstIndex + 1];\n this.angle_ = Math.atan2(dy, dx);\n this.initialVelocity_ = Math.sqrt(dx * dx + dy * dy) / duration;\n return this.initialVelocity_ > this.minVelocity_;\n }\n\n /**\n * @return {number} Total distance travelled (pixels).\n */\n getDistance() {\n return (this.minVelocity_ - this.initialVelocity_) / this.decay_;\n }\n\n /**\n * @return {number} Angle of the kinetic panning animation (radians).\n */\n getAngle() {\n return this.angle_;\n }\n}\n\nexport default Kinetic;\n","/**\n * @module ol/renderer/Map\n */\nimport Disposable from '../Disposable.js';\nimport {TRUE} from '../functions.js';\nimport {abstract} from '../util.js';\nimport {compose as composeTransform, makeInverse} from '../transform.js';\nimport {getWidth} from '../extent.js';\nimport {shared as iconImageCache} from '../style/IconImageCache.js';\nimport {inView} from '../layer/Layer.js';\nimport {wrapX} from '../coordinate.js';\n\n/**\n * @template T\n * @typedef HitMatch\n * @property {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @property {import(\"../layer/Layer.js\").default} layer Layer.\n * @property {import(\"../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @property {number} distanceSq Squared distance.\n * @property {import(\"./vector.js\").FeatureCallback} callback Callback.\n */\n\n/**\n * @abstract\n */\nclass MapRenderer extends Disposable {\n /**\n * @param {import(\"../Map.js\").default} map Map.\n */\n constructor(map) {\n super();\n\n /**\n * @private\n * @type {import(\"../Map.js\").default}\n */\n this.map_ = map;\n }\n\n /**\n * @abstract\n * @param {import(\"../render/EventType.js\").default} type Event type.\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n */\n dispatchRenderEvent(type, frameState) {\n abstract();\n }\n\n /**\n * @param {import(\"../Map.js\").FrameState} frameState FrameState.\n * @protected\n */\n calculateMatrices2D(frameState) {\n const viewState = frameState.viewState;\n const coordinateToPixelTransform = frameState.coordinateToPixelTransform;\n const pixelToCoordinateTransform = frameState.pixelToCoordinateTransform;\n\n composeTransform(\n coordinateToPixelTransform,\n frameState.size[0] / 2,\n frameState.size[1] / 2,\n 1 / viewState.resolution,\n -1 / viewState.resolution,\n -viewState.rotation,\n -viewState.center[0],\n -viewState.center[1],\n );\n\n makeInverse(pixelToCoordinateTransform, coordinateToPixelTransform);\n }\n\n /**\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"../Map.js\").FrameState} frameState FrameState.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @param {boolean} checkWrapped Check for wrapped geometries.\n * @param {import(\"./vector.js\").FeatureCallback} callback Feature callback.\n * @param {S} thisArg Value to use as `this` when executing `callback`.\n * @param {function(this: U, import(\"../layer/Layer.js\").default): boolean} layerFilter Layer filter\n * function, only layers which are visible and for which this function\n * returns `true` will be tested for features. By default, all visible\n * layers will be tested.\n * @param {U} thisArg2 Value to use as `this` when executing `layerFilter`.\n * @return {T|undefined} Callback result.\n * @template S,T,U\n */\n forEachFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n checkWrapped,\n callback,\n thisArg,\n layerFilter,\n thisArg2,\n ) {\n let result;\n const viewState = frameState.viewState;\n\n /**\n * @param {boolean} managed Managed layer.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {import(\"../layer/Layer.js\").default} layer Layer.\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @return {T|undefined} Callback result.\n */\n function forEachFeatureAtCoordinate(managed, feature, layer, geometry) {\n return callback.call(thisArg, feature, managed ? layer : null, geometry);\n }\n\n const projection = viewState.projection;\n\n const translatedCoordinate = wrapX(coordinate.slice(), projection);\n const offsets = [[0, 0]];\n if (projection.canWrapX() && checkWrapped) {\n const projectionExtent = projection.getExtent();\n const worldWidth = getWidth(projectionExtent);\n offsets.push([-worldWidth, 0], [worldWidth, 0]);\n }\n\n const layerStates = frameState.layerStatesArray;\n const numLayers = layerStates.length;\n\n const matches = /** @type {Array>} */ ([]);\n const tmpCoord = [];\n for (let i = 0; i < offsets.length; i++) {\n for (let j = numLayers - 1; j >= 0; --j) {\n const layerState = layerStates[j];\n const layer = layerState.layer;\n if (\n layer.hasRenderer() &&\n inView(layerState, viewState) &&\n layerFilter.call(thisArg2, layer)\n ) {\n const layerRenderer = layer.getRenderer();\n const source = layer.getSource();\n if (layerRenderer && source) {\n const coordinates = source.getWrapX()\n ? translatedCoordinate\n : coordinate;\n const callback = forEachFeatureAtCoordinate.bind(\n null,\n layerState.managed,\n );\n tmpCoord[0] = coordinates[0] + offsets[i][0];\n tmpCoord[1] = coordinates[1] + offsets[i][1];\n result = layerRenderer.forEachFeatureAtCoordinate(\n tmpCoord,\n frameState,\n hitTolerance,\n callback,\n matches,\n );\n }\n if (result) {\n return result;\n }\n }\n }\n }\n if (matches.length === 0) {\n return undefined;\n }\n const order = 1 / matches.length;\n matches.forEach((m, i) => (m.distanceSq += i * order));\n matches.sort((a, b) => a.distanceSq - b.distanceSq);\n matches.some((m) => {\n return (result = m.callback(m.feature, m.layer, m.geometry));\n });\n return result;\n }\n\n /**\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"../Map.js\").FrameState} frameState FrameState.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @param {boolean} checkWrapped Check for wrapped geometries.\n * @param {function(this: U, import(\"../layer/Layer.js\").default): boolean} layerFilter Layer filter\n * function, only layers which are visible and for which this function\n * returns `true` will be tested for features. By default, all visible\n * layers will be tested.\n * @param {U} thisArg Value to use as `this` when executing `layerFilter`.\n * @return {boolean} Is there a feature at the given coordinate?\n * @template U\n */\n hasFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n checkWrapped,\n layerFilter,\n thisArg,\n ) {\n const hasFeature = this.forEachFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n checkWrapped,\n TRUE,\n this,\n layerFilter,\n thisArg,\n );\n\n return hasFeature !== undefined;\n }\n\n /**\n * @return {import(\"../Map.js\").default} Map.\n */\n getMap() {\n return this.map_;\n }\n\n /**\n * Render.\n * @abstract\n * @param {?import(\"../Map.js\").FrameState} frameState Frame state.\n */\n renderFrame(frameState) {\n abstract();\n }\n\n /**\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n * @protected\n */\n scheduleExpireIconCache(frameState) {\n if (iconImageCache.canExpireCache()) {\n frameState.postRenderFunctions.push(expireIconCache);\n }\n }\n}\n\n/**\n * @param {import(\"../Map.js\").default} map Map.\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n */\nfunction expireIconCache(map, frameState) {\n iconImageCache.expire();\n}\n\nexport default MapRenderer;\n","/**\n * @module ol/renderer/Composite\n */\nimport BaseVectorLayer from '../layer/BaseVector.js';\nimport MapRenderer from './Map.js';\nimport ObjectEventType from '../ObjectEventType.js';\nimport RenderEvent from '../render/Event.js';\nimport RenderEventType from '../render/EventType.js';\nimport {CLASS_UNSELECTABLE} from '../css.js';\nimport {checkedFonts} from '../render/canvas.js';\nimport {inView} from '../layer/Layer.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {replaceChildren} from '../dom.js';\n\n/**\n * @classdesc\n * Canvas map renderer.\n * @api\n */\nclass CompositeMapRenderer extends MapRenderer {\n /**\n * @param {import(\"../Map.js\").default} map Map.\n */\n constructor(map) {\n super(map);\n\n /**\n * @type {import(\"../events.js\").EventsKey}\n */\n this.fontChangeListenerKey_ = listen(\n checkedFonts,\n ObjectEventType.PROPERTYCHANGE,\n map.redrawText.bind(map),\n );\n\n /**\n * @private\n * @type {HTMLDivElement}\n */\n this.element_ = document.createElement('div');\n const style = this.element_.style;\n style.position = 'absolute';\n style.width = '100%';\n style.height = '100%';\n style.zIndex = '0';\n\n this.element_.className = CLASS_UNSELECTABLE + ' ol-layers';\n\n const container = map.getViewport();\n container.insertBefore(this.element_, container.firstChild || null);\n\n /**\n * @private\n * @type {Array}\n */\n this.children_ = [];\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderedVisible_ = true;\n }\n\n /**\n * @param {import(\"../render/EventType.js\").default} type Event type.\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n */\n dispatchRenderEvent(type, frameState) {\n const map = this.getMap();\n if (map.hasListener(type)) {\n const event = new RenderEvent(type, undefined, frameState);\n map.dispatchEvent(event);\n }\n }\n\n disposeInternal() {\n unlistenByKey(this.fontChangeListenerKey_);\n this.element_.parentNode.removeChild(this.element_);\n super.disposeInternal();\n }\n\n /**\n * Render.\n * @param {?import(\"../Map.js\").FrameState} frameState Frame state.\n */\n renderFrame(frameState) {\n if (!frameState) {\n if (this.renderedVisible_) {\n this.element_.style.display = 'none';\n this.renderedVisible_ = false;\n }\n return;\n }\n\n this.calculateMatrices2D(frameState);\n this.dispatchRenderEvent(RenderEventType.PRECOMPOSE, frameState);\n\n const layerStatesArray = frameState.layerStatesArray.sort(function (a, b) {\n return a.zIndex - b.zIndex;\n });\n const declutter = layerStatesArray.some(\n (layerState) =>\n layerState.layer instanceof BaseVectorLayer &&\n layerState.layer.getDeclutter(),\n );\n if (declutter) {\n // Some layers need decluttering, turn on deferred rendering hint\n frameState.declutter = {};\n }\n const viewState = frameState.viewState;\n\n this.children_.length = 0;\n\n const renderedLayerStates = [];\n let previousElement = null;\n for (let i = 0, ii = layerStatesArray.length; i < ii; ++i) {\n const layerState = layerStatesArray[i];\n frameState.layerIndex = i;\n\n const layer = layerState.layer;\n const sourceState = layer.getSourceState();\n if (\n !inView(layerState, viewState) ||\n (sourceState != 'ready' && sourceState != 'undefined')\n ) {\n layer.unrender();\n continue;\n }\n\n const element = layer.render(frameState, previousElement);\n if (!element) {\n continue;\n }\n if (element !== previousElement) {\n this.children_.push(element);\n previousElement = element;\n }\n\n renderedLayerStates.push(layerState);\n }\n\n this.declutter(frameState, renderedLayerStates);\n\n replaceChildren(this.element_, this.children_);\n\n this.dispatchRenderEvent(RenderEventType.POSTCOMPOSE, frameState);\n\n if (!this.renderedVisible_) {\n this.element_.style.display = '';\n this.renderedVisible_ = true;\n }\n\n this.scheduleExpireIconCache(frameState);\n }\n\n /**\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n * @param {Array} layerStates Layers.\n */\n declutter(frameState, layerStates) {\n if (!frameState.declutter) {\n return;\n }\n for (let i = layerStates.length - 1; i >= 0; --i) {\n const layerState = layerStates[i];\n const layer = layerState.layer;\n if (layer.getDeclutter()) {\n layer.renderDeclutter(frameState, layerState);\n }\n }\n layerStates.forEach((layerState) =>\n layerState.layer.renderDeferred(frameState),\n );\n }\n}\n\nexport default CompositeMapRenderer;\n","/**\n * @module ol/MapEvent\n */\nimport Event from './events/Event.js';\n\n/**\n * @classdesc\n * Events emitted as map events are instances of this type.\n * See {@link module:ol/Map~Map} for which events trigger a map event.\n */\nclass MapEvent extends Event {\n /**\n * @param {string} type Event type.\n * @param {import(\"./Map.js\").default} map Map.\n * @param {?import(\"./Map.js\").FrameState} [frameState] Frame state.\n */\n constructor(type, map, frameState) {\n super(type);\n\n /**\n * The map where the event occurred.\n * @type {import(\"./Map.js\").default}\n * @api\n */\n this.map = map;\n\n /**\n * The frame state at the time of the event.\n * @type {?import(\"./Map.js\").FrameState}\n * @api\n */\n this.frameState = frameState !== undefined ? frameState : null;\n }\n}\n\nexport default MapEvent;\n","/**\n * @module ol/MapBrowserEvent\n */\nimport MapEvent from './MapEvent.js';\n\n/**\n * @classdesc\n * Events emitted as map browser events are instances of this type.\n * See {@link module:ol/Map~Map} for which events trigger a map browser event.\n * @template {UIEvent} EVENT\n */\nclass MapBrowserEvent extends MapEvent {\n /**\n * @param {string} type Event type.\n * @param {import(\"./Map.js\").default} map Map.\n * @param {EVENT} originalEvent Original event.\n * @param {boolean} [dragging] Is the map currently being dragged?\n * @param {import(\"./Map.js\").FrameState} [frameState] Frame state.\n * @param {Array} [activePointers] Active pointers.\n */\n constructor(type, map, originalEvent, dragging, frameState, activePointers) {\n super(type, map, frameState);\n\n /**\n * The original browser event.\n * @const\n * @type {EVENT}\n * @api\n */\n this.originalEvent = originalEvent;\n\n /**\n * The map pixel relative to the viewport corresponding to the original browser event.\n * @type {?import(\"./pixel.js\").Pixel}\n */\n this.pixel_ = null;\n\n /**\n * The coordinate in the user projection corresponding to the original browser event.\n * @type {?import(\"./coordinate.js\").Coordinate}\n */\n this.coordinate_ = null;\n\n /**\n * Indicates if the map is currently being dragged. Only set for\n * `POINTERDRAG` and `POINTERMOVE` events. Default is `false`.\n *\n * @type {boolean}\n * @api\n */\n this.dragging = dragging !== undefined ? dragging : false;\n\n /**\n * @type {Array|undefined}\n */\n this.activePointers = activePointers;\n }\n\n /**\n * The map pixel relative to the viewport corresponding to the original event.\n * @type {import(\"./pixel.js\").Pixel}\n * @api\n */\n get pixel() {\n if (!this.pixel_) {\n this.pixel_ = this.map.getEventPixel(this.originalEvent);\n }\n return this.pixel_;\n }\n set pixel(pixel) {\n this.pixel_ = pixel;\n }\n\n /**\n * The coordinate corresponding to the original browser event. This will be in the user\n * projection if one is set. Otherwise it will be in the view projection.\n * @type {import(\"./coordinate.js\").Coordinate}\n * @api\n */\n get coordinate() {\n if (!this.coordinate_) {\n this.coordinate_ = this.map.getCoordinateFromPixel(this.pixel);\n }\n return this.coordinate_;\n }\n set coordinate(coordinate) {\n this.coordinate_ = coordinate;\n }\n\n /**\n * Prevents the default browser action.\n * See https://developer.mozilla.org/en-US/docs/Web/API/event.preventDefault.\n * @api\n */\n preventDefault() {\n super.preventDefault();\n if ('preventDefault' in this.originalEvent) {\n /** @type {UIEvent} */ (this.originalEvent).preventDefault();\n }\n }\n\n /**\n * Prevents further propagation of the current event.\n * See https://developer.mozilla.org/en-US/docs/Web/API/event.stopPropagation.\n * @api\n */\n stopPropagation() {\n super.stopPropagation();\n if ('stopPropagation' in this.originalEvent) {\n /** @type {UIEvent} */ (this.originalEvent).stopPropagation();\n }\n }\n}\n\nexport default MapBrowserEvent;\n","/**\n * @module ol/MapBrowserEventType\n */\nimport EventType from './events/EventType.js';\n\n/**\n * Constants for event names.\n * @enum {string}\n */\nexport default {\n /**\n * A true single click with no dragging and no double click. Note that this\n * event is delayed by 250 ms to ensure that it is not a double click.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#singleclick\n * @api\n */\n SINGLECLICK: 'singleclick',\n\n /**\n * A click with no dragging. A double click will fire two of this.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#click\n * @api\n */\n CLICK: EventType.CLICK,\n\n /**\n * A true double click, with no dragging.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#dblclick\n * @api\n */\n DBLCLICK: EventType.DBLCLICK,\n\n /**\n * Triggered when a pointer is dragged.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointerdrag\n * @api\n */\n POINTERDRAG: 'pointerdrag',\n\n /**\n * Triggered when a pointer is moved. Note that on touch devices this is\n * triggered when the map is panned, so is not the same as mousemove.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointermove\n * @api\n */\n POINTERMOVE: 'pointermove',\n\n POINTERDOWN: 'pointerdown',\n POINTERUP: 'pointerup',\n POINTEROVER: 'pointerover',\n POINTEROUT: 'pointerout',\n POINTERENTER: 'pointerenter',\n POINTERLEAVE: 'pointerleave',\n POINTERCANCEL: 'pointercancel',\n};\n\n/***\n * @typedef {'singleclick'|'click'|'dblclick'|'pointerdrag'|'pointermove'} Types\n */\n","/**\n * @module ol/MapBrowserEventHandler\n */\n\nimport EventType from './events/EventType.js';\nimport MapBrowserEvent from './MapBrowserEvent.js';\nimport MapBrowserEventType from './MapBrowserEventType.js';\nimport PointerEventType from './pointer/EventType.js';\nimport Target from './events/Target.js';\nimport {PASSIVE_EVENT_LISTENERS} from './has.js';\nimport {listen, unlistenByKey} from './events.js';\n\nclass MapBrowserEventHandler extends Target {\n /**\n * @param {import(\"./Map.js\").default} map The map with the viewport to listen to events on.\n * @param {number} [moveTolerance] The minimal distance the pointer must travel to trigger a move.\n */\n constructor(map, moveTolerance) {\n super(map);\n\n /**\n * This is the element that we will listen to the real events on.\n * @type {import(\"./Map.js\").default}\n * @private\n */\n this.map_ = map;\n\n /**\n * @type {ReturnType}\n * @private\n */\n this.clickTimeoutId_;\n\n /**\n * Emulate dblclick and singleclick. Will be true when only one pointer is active.\n * @type {boolean}\n */\n this.emulateClicks_ = false;\n\n /**\n * @type {boolean}\n * @private\n */\n this.dragging_ = false;\n\n /**\n * @type {!Array}\n * @private\n */\n this.dragListenerKeys_ = [];\n\n /**\n * @type {number}\n * @private\n */\n this.moveTolerance_ = moveTolerance === undefined ? 1 : moveTolerance;\n\n /**\n * The most recent \"down\" type event (or null if none have occurred).\n * Set on pointerdown.\n * @type {PointerEvent|null}\n * @private\n */\n this.down_ = null;\n\n const element = this.map_.getViewport();\n\n /**\n * @type {Array}\n * @private\n */\n this.activePointers_ = [];\n\n /**\n * @type {!Object}\n * @private\n */\n this.trackedTouches_ = {};\n\n this.element_ = element;\n\n /**\n * @type {?import(\"./events.js\").EventsKey}\n * @private\n */\n this.pointerdownListenerKey_ = listen(\n element,\n PointerEventType.POINTERDOWN,\n this.handlePointerDown_,\n this,\n );\n\n /**\n * @type {PointerEvent}\n * @private\n */\n this.originalPointerMoveEvent_;\n\n /**\n * @type {?import(\"./events.js\").EventsKey}\n * @private\n */\n this.relayedListenerKey_ = listen(\n element,\n PointerEventType.POINTERMOVE,\n this.relayMoveEvent_,\n this,\n );\n\n /**\n * @private\n */\n this.boundHandleTouchMove_ = this.handleTouchMove_.bind(this);\n\n this.element_.addEventListener(\n EventType.TOUCHMOVE,\n this.boundHandleTouchMove_,\n PASSIVE_EVENT_LISTENERS ? {passive: false} : false,\n );\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n emulateClick_(pointerEvent) {\n let newEvent = new MapBrowserEvent(\n MapBrowserEventType.CLICK,\n this.map_,\n pointerEvent,\n );\n this.dispatchEvent(newEvent);\n if (this.clickTimeoutId_ !== undefined) {\n // double-click\n clearTimeout(this.clickTimeoutId_);\n this.clickTimeoutId_ = undefined;\n newEvent = new MapBrowserEvent(\n MapBrowserEventType.DBLCLICK,\n this.map_,\n pointerEvent,\n );\n this.dispatchEvent(newEvent);\n } else {\n // click\n this.clickTimeoutId_ = setTimeout(() => {\n this.clickTimeoutId_ = undefined;\n const newEvent = new MapBrowserEvent(\n MapBrowserEventType.SINGLECLICK,\n this.map_,\n pointerEvent,\n );\n this.dispatchEvent(newEvent);\n }, 250);\n }\n }\n\n /**\n * Keeps track on how many pointers are currently active.\n *\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n updateActivePointers_(pointerEvent) {\n const event = pointerEvent;\n const id = event.pointerId;\n\n if (\n event.type == MapBrowserEventType.POINTERUP ||\n event.type == MapBrowserEventType.POINTERCANCEL\n ) {\n delete this.trackedTouches_[id];\n for (const pointerId in this.trackedTouches_) {\n if (this.trackedTouches_[pointerId].target !== event.target) {\n // Some platforms assign a new pointerId when the target changes.\n // If this happens, delete one tracked pointer. If there is more\n // than one tracked pointer for the old target, it will be cleared\n // by subsequent POINTERUP events from other pointers.\n delete this.trackedTouches_[pointerId];\n break;\n }\n }\n } else if (\n event.type == MapBrowserEventType.POINTERDOWN ||\n event.type == MapBrowserEventType.POINTERMOVE\n ) {\n this.trackedTouches_[id] = event;\n }\n this.activePointers_ = Object.values(this.trackedTouches_);\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n handlePointerUp_(pointerEvent) {\n this.updateActivePointers_(pointerEvent);\n const newEvent = new MapBrowserEvent(\n MapBrowserEventType.POINTERUP,\n this.map_,\n pointerEvent,\n undefined,\n undefined,\n this.activePointers_,\n );\n this.dispatchEvent(newEvent);\n\n // We emulate click events on left mouse button click, touch contact, and pen\n // contact. isMouseActionButton returns true in these cases (evt.button is set\n // to 0).\n // See http://www.w3.org/TR/pointerevents/#button-states\n // We only fire click, singleclick, and doubleclick if nobody has called\n // event.preventDefault().\n if (\n this.emulateClicks_ &&\n !newEvent.defaultPrevented &&\n !this.dragging_ &&\n this.isMouseActionButton_(pointerEvent)\n ) {\n this.emulateClick_(this.down_);\n }\n\n if (this.activePointers_.length === 0) {\n this.dragListenerKeys_.forEach(unlistenByKey);\n this.dragListenerKeys_.length = 0;\n this.dragging_ = false;\n this.down_ = null;\n }\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @return {boolean} If the left mouse button was pressed.\n * @private\n */\n isMouseActionButton_(pointerEvent) {\n return pointerEvent.button === 0;\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n handlePointerDown_(pointerEvent) {\n this.emulateClicks_ = this.activePointers_.length === 0;\n this.updateActivePointers_(pointerEvent);\n const newEvent = new MapBrowserEvent(\n MapBrowserEventType.POINTERDOWN,\n this.map_,\n pointerEvent,\n undefined,\n undefined,\n this.activePointers_,\n );\n this.dispatchEvent(newEvent);\n\n this.down_ = new PointerEvent(pointerEvent.type, pointerEvent);\n Object.defineProperty(this.down_, 'target', {\n writable: false,\n value: pointerEvent.target,\n });\n\n if (this.dragListenerKeys_.length === 0) {\n const doc = this.map_.getOwnerDocument();\n this.dragListenerKeys_.push(\n listen(\n doc,\n MapBrowserEventType.POINTERMOVE,\n this.handlePointerMove_,\n this,\n ),\n listen(doc, MapBrowserEventType.POINTERUP, this.handlePointerUp_, this),\n /* Note that the listener for `pointercancel is set up on\n * `pointerEventHandler_` and not `documentPointerEventHandler_` like\n * the `pointerup` and `pointermove` listeners.\n *\n * The reason for this is the following: `TouchSource.vacuumTouches_()`\n * issues `pointercancel` events, when there was no `touchend` for a\n * `touchstart`. Now, let's say a first `touchstart` is registered on\n * `pointerEventHandler_`. The `documentPointerEventHandler_` is set up.\n * But `documentPointerEventHandler_` doesn't know about the first\n * `touchstart`. If there is no `touchend` for the `touchstart`, we can\n * only receive a `touchcancel` from `pointerEventHandler_`, because it is\n * only registered there.\n */\n listen(\n this.element_,\n MapBrowserEventType.POINTERCANCEL,\n this.handlePointerUp_,\n this,\n ),\n );\n if (this.element_.getRootNode && this.element_.getRootNode() !== doc) {\n this.dragListenerKeys_.push(\n listen(\n this.element_.getRootNode(),\n MapBrowserEventType.POINTERUP,\n this.handlePointerUp_,\n this,\n ),\n );\n }\n }\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n handlePointerMove_(pointerEvent) {\n // Between pointerdown and pointerup, pointermove events are triggered.\n // To avoid a 'false' touchmove event to be dispatched, we test if the pointer\n // moved a significant distance.\n if (this.isMoving_(pointerEvent)) {\n this.updateActivePointers_(pointerEvent);\n this.dragging_ = true;\n const newEvent = new MapBrowserEvent(\n MapBrowserEventType.POINTERDRAG,\n this.map_,\n pointerEvent,\n this.dragging_,\n undefined,\n this.activePointers_,\n );\n this.dispatchEvent(newEvent);\n }\n }\n\n /**\n * Wrap and relay a pointermove event.\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n relayMoveEvent_(pointerEvent) {\n this.originalPointerMoveEvent_ = pointerEvent;\n const dragging = !!(this.down_ && this.isMoving_(pointerEvent));\n this.dispatchEvent(\n new MapBrowserEvent(\n MapBrowserEventType.POINTERMOVE,\n this.map_,\n pointerEvent,\n dragging,\n ),\n );\n }\n\n /**\n * Flexible handling of a `touch-action: none` css equivalent: because calling\n * `preventDefault()` on a `pointermove` event does not stop native page scrolling\n * and zooming, we also listen for `touchmove` and call `preventDefault()` on it\n * when an interaction (currently `DragPan` handles the event.\n * @param {TouchEvent} event Event.\n * @private\n */\n handleTouchMove_(event) {\n // Due to https://github.com/mpizenberg/elm-pep/issues/2, `this.originalPointerMoveEvent_`\n // may not be initialized yet when we get here on a platform without native pointer events,\n // when elm-pep is used as pointer events polyfill.\n const originalEvent = this.originalPointerMoveEvent_;\n if (\n (!originalEvent || originalEvent.defaultPrevented) &&\n (typeof event.cancelable !== 'boolean' || event.cancelable === true)\n ) {\n event.preventDefault();\n }\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @return {boolean} Is moving.\n * @private\n */\n isMoving_(pointerEvent) {\n return (\n this.dragging_ ||\n Math.abs(pointerEvent.clientX - this.down_.clientX) >\n this.moveTolerance_ ||\n Math.abs(pointerEvent.clientY - this.down_.clientY) > this.moveTolerance_\n );\n }\n\n /**\n * Clean up.\n */\n disposeInternal() {\n if (this.relayedListenerKey_) {\n unlistenByKey(this.relayedListenerKey_);\n this.relayedListenerKey_ = null;\n }\n this.element_.removeEventListener(\n EventType.TOUCHMOVE,\n this.boundHandleTouchMove_,\n );\n\n if (this.pointerdownListenerKey_) {\n unlistenByKey(this.pointerdownListenerKey_);\n this.pointerdownListenerKey_ = null;\n }\n\n this.dragListenerKeys_.forEach(unlistenByKey);\n this.dragListenerKeys_.length = 0;\n\n this.element_ = null;\n super.disposeInternal();\n }\n}\n\nexport default MapBrowserEventHandler;\n","/**\n * @module ol/control/Attribution\n */\nimport Control from './Control.js';\nimport EventType from '../events/EventType.js';\nimport {CLASS_COLLAPSED, CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';\nimport {equals} from '../array.js';\nimport {removeChildren, replaceNode} from '../dom.js';\nimport {toPromise} from '../functions.js';\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-attribution'] CSS class name.\n * @property {HTMLElement|string} [target] Specify a target if you\n * want the control to be rendered outside of the map's\n * viewport.\n * @property {boolean} [collapsible] Specify if attributions can\n * be collapsed. If not specified, sources control this behavior with their\n * `attributionsCollapsible` setting.\n * @property {boolean} [collapsed=true] Specify if attributions should\n * be collapsed at startup.\n * @property {string} [tipLabel='Attributions'] Text label to use for the button tip.\n * @property {string|HTMLElement} [label='i'] Text label to use for the\n * collapsed attributions button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [expandClassName=className + '-expand'] CSS class name for the\n * collapsed attributions button.\n * @property {string|HTMLElement} [collapseLabel='›'] Text label to use\n * for the expanded attributions button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [collapseClassName=className + '-collapse'] CSS class name for the\n * expanded attributions button.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when\n * the control should be re-rendered. This is called in a `requestAnimationFrame`\n * callback.\n */\n\n/**\n * @classdesc\n * Control to show all the attributions associated with the layer sources\n * in the map. This control is one of the default controls included in maps.\n * By default it will show in the bottom right portion of the map, but this can\n * be changed by using a css selector for `.ol-attribution`.\n *\n * @api\n */\nclass Attribution extends Control {\n /**\n * @param {Options} [options] Attribution options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n element: document.createElement('div'),\n render: options.render,\n target: options.target,\n });\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.ulElement_ = document.createElement('ul');\n\n /**\n * @private\n * @type {boolean}\n */\n this.collapsed_ =\n options.collapsed !== undefined ? options.collapsed : true;\n\n /**\n * @private\n * @type {boolean}\n */\n this.userCollapsed_ = this.collapsed_;\n\n /**\n * @private\n * @type {boolean}\n */\n this.overrideCollapsible_ = options.collapsible !== undefined;\n\n /**\n * @private\n * @type {boolean}\n */\n this.collapsible_ =\n options.collapsible !== undefined ? options.collapsible : true;\n\n if (!this.collapsible_) {\n this.collapsed_ = false;\n }\n\n const className =\n options.className !== undefined ? options.className : 'ol-attribution';\n\n const tipLabel =\n options.tipLabel !== undefined ? options.tipLabel : 'Attributions';\n\n const expandClassName =\n options.expandClassName !== undefined\n ? options.expandClassName\n : className + '-expand';\n\n const collapseLabel =\n options.collapseLabel !== undefined ? options.collapseLabel : '\\u203A';\n\n const collapseClassName =\n options.collapseClassName !== undefined\n ? options.collapseClassName\n : className + '-collapse';\n\n if (typeof collapseLabel === 'string') {\n /**\n * @private\n * @type {HTMLElement}\n */\n this.collapseLabel_ = document.createElement('span');\n this.collapseLabel_.textContent = collapseLabel;\n this.collapseLabel_.className = collapseClassName;\n } else {\n this.collapseLabel_ = collapseLabel;\n }\n\n const label = options.label !== undefined ? options.label : 'i';\n\n if (typeof label === 'string') {\n /**\n * @private\n * @type {HTMLElement}\n */\n this.label_ = document.createElement('span');\n this.label_.textContent = label;\n this.label_.className = expandClassName;\n } else {\n this.label_ = label;\n }\n\n const activeLabel =\n this.collapsible_ && !this.collapsed_ ? this.collapseLabel_ : this.label_;\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.toggleButton_ = document.createElement('button');\n this.toggleButton_.setAttribute('type', 'button');\n this.toggleButton_.setAttribute('aria-expanded', String(!this.collapsed_));\n this.toggleButton_.title = tipLabel;\n this.toggleButton_.appendChild(activeLabel);\n\n this.toggleButton_.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this),\n false,\n );\n\n const cssClasses =\n className +\n ' ' +\n CLASS_UNSELECTABLE +\n ' ' +\n CLASS_CONTROL +\n (this.collapsed_ && this.collapsible_ ? ' ' + CLASS_COLLAPSED : '') +\n (this.collapsible_ ? '' : ' ol-uncollapsible');\n const element = this.element;\n element.className = cssClasses;\n element.appendChild(this.toggleButton_);\n element.appendChild(this.ulElement_);\n\n /**\n * A list of currently rendered resolutions.\n * @type {Array}\n * @private\n */\n this.renderedAttributions_ = [];\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderedVisible_ = true;\n }\n\n /**\n * Collect a list of visible attributions and set the collapsible state.\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n * @return {Array} Attributions.\n * @private\n */\n collectSourceAttributions_(frameState) {\n const visibleAttributions = Array.from(\n new Set(\n this.getMap()\n .getAllLayers()\n .flatMap((layer) => layer.getAttributions(frameState)),\n ),\n );\n\n const collapsible = !this.getMap()\n .getAllLayers()\n .some(\n (layer) =>\n layer.getSource() &&\n layer.getSource().getAttributionsCollapsible() === false,\n );\n if (!this.overrideCollapsible_) {\n this.setCollapsible(collapsible);\n }\n return visibleAttributions;\n }\n\n /**\n * @private\n * @param {?import(\"../Map.js\").FrameState} frameState Frame state.\n */\n async updateElement_(frameState) {\n if (!frameState) {\n if (this.renderedVisible_) {\n this.element.style.display = 'none';\n this.renderedVisible_ = false;\n }\n return;\n }\n\n const attributions = await Promise.all(\n this.collectSourceAttributions_(frameState).map((attribution) =>\n toPromise(() => attribution),\n ),\n );\n\n const visible = attributions.length > 0;\n if (this.renderedVisible_ != visible) {\n this.element.style.display = visible ? '' : 'none';\n this.renderedVisible_ = visible;\n }\n\n if (equals(attributions, this.renderedAttributions_)) {\n return;\n }\n\n removeChildren(this.ulElement_);\n\n // append the attributions\n for (let i = 0, ii = attributions.length; i < ii; ++i) {\n const element = document.createElement('li');\n element.innerHTML = attributions[i];\n this.ulElement_.appendChild(element);\n }\n\n this.renderedAttributions_ = attributions;\n }\n\n /**\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(event) {\n event.preventDefault();\n this.handleToggle_();\n this.userCollapsed_ = this.collapsed_;\n }\n\n /**\n * @private\n */\n handleToggle_() {\n this.element.classList.toggle(CLASS_COLLAPSED);\n if (this.collapsed_) {\n replaceNode(this.collapseLabel_, this.label_);\n } else {\n replaceNode(this.label_, this.collapseLabel_);\n }\n this.collapsed_ = !this.collapsed_;\n this.toggleButton_.setAttribute('aria-expanded', String(!this.collapsed_));\n }\n\n /**\n * Return `true` if the attribution is collapsible, `false` otherwise.\n * @return {boolean} True if the widget is collapsible.\n * @api\n */\n getCollapsible() {\n return this.collapsible_;\n }\n\n /**\n * Set whether the attribution should be collapsible.\n * @param {boolean} collapsible True if the widget is collapsible.\n * @api\n */\n setCollapsible(collapsible) {\n if (this.collapsible_ === collapsible) {\n return;\n }\n this.collapsible_ = collapsible;\n this.element.classList.toggle('ol-uncollapsible');\n if (this.userCollapsed_) {\n this.handleToggle_();\n }\n }\n\n /**\n * Collapse or expand the attribution according to the passed parameter. Will\n * not do anything if the attribution isn't collapsible or if the current\n * collapsed state is already the one requested.\n * @param {boolean} collapsed True if the widget is collapsed.\n * @api\n */\n setCollapsed(collapsed) {\n this.userCollapsed_ = collapsed;\n if (!this.collapsible_ || this.collapsed_ === collapsed) {\n return;\n }\n this.handleToggle_();\n }\n\n /**\n * Return `true` when the attribution is currently collapsed or `false`\n * otherwise.\n * @return {boolean} True if the widget is collapsed.\n * @api\n */\n getCollapsed() {\n return this.collapsed_;\n }\n\n /**\n * Update the attribution element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n this.updateElement_(mapEvent.frameState);\n }\n}\n\nexport default Attribution;\n","/**\n * @module ol/control/Rotate\n */\nimport Control from './Control.js';\nimport EventType from '../events/EventType.js';\nimport {CLASS_CONTROL, CLASS_HIDDEN, CLASS_UNSELECTABLE} from '../css.js';\nimport {easeOut} from '../easing.js';\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-rotate'] CSS class name.\n * @property {string|HTMLElement} [label='⇧'] Text label to use for the rotate button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [tipLabel='Reset rotation'] Text label to use for the rotate tip.\n * @property {string} [compassClassName='ol-compass'] CSS class name for the compass.\n * @property {number} [duration=250] Animation duration in milliseconds.\n * @property {boolean} [autoHide=true] Hide the control when rotation is 0.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when the control should\n * be re-rendered. This is called in a `requestAnimationFrame` callback.\n * @property {function():void} [resetNorth] Function called when the control is clicked.\n * This will override the default `resetNorth`.\n * @property {HTMLElement|string} [target] Specify a target if you want the control to be\n * rendered outside of the map's viewport.\n */\n\n/**\n * @classdesc\n * A button control to reset rotation to 0.\n * To style this control use css selector `.ol-rotate`. A `.ol-hidden` css\n * selector is added to the button when the rotation is 0.\n *\n * @api\n */\nclass Rotate extends Control {\n /**\n * @param {Options} [options] Rotate options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n element: document.createElement('div'),\n render: options.render,\n target: options.target,\n });\n\n const className =\n options.className !== undefined ? options.className : 'ol-rotate';\n\n const label = options.label !== undefined ? options.label : '\\u21E7';\n\n const compassClassName =\n options.compassClassName !== undefined\n ? options.compassClassName\n : 'ol-compass';\n\n /**\n * @type {HTMLElement}\n * @private\n */\n this.label_ = null;\n\n if (typeof label === 'string') {\n this.label_ = document.createElement('span');\n this.label_.className = compassClassName;\n this.label_.textContent = label;\n } else {\n this.label_ = label;\n this.label_.classList.add(compassClassName);\n }\n\n const tipLabel = options.tipLabel ? options.tipLabel : 'Reset rotation';\n\n const button = document.createElement('button');\n button.className = className + '-reset';\n button.setAttribute('type', 'button');\n button.title = tipLabel;\n button.appendChild(this.label_);\n\n button.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this),\n false,\n );\n\n const cssClasses =\n className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;\n const element = this.element;\n element.className = cssClasses;\n element.appendChild(button);\n\n this.callResetNorth_ = options.resetNorth ? options.resetNorth : undefined;\n\n /**\n * @type {number}\n * @private\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n\n /**\n * @type {boolean}\n * @private\n */\n this.autoHide_ = options.autoHide !== undefined ? options.autoHide : true;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.rotation_ = undefined;\n\n if (this.autoHide_) {\n this.element.classList.add(CLASS_HIDDEN);\n }\n }\n\n /**\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(event) {\n event.preventDefault();\n if (this.callResetNorth_ !== undefined) {\n this.callResetNorth_();\n } else {\n this.resetNorth_();\n }\n }\n\n /**\n * @private\n */\n resetNorth_() {\n const map = this.getMap();\n const view = map.getView();\n if (!view) {\n // the map does not have a view, so we can't act\n // upon it\n return;\n }\n const rotation = view.getRotation();\n if (rotation !== undefined) {\n if (this.duration_ > 0 && rotation % (2 * Math.PI) !== 0) {\n view.animate({\n rotation: 0,\n duration: this.duration_,\n easing: easeOut,\n });\n } else {\n view.setRotation(0);\n }\n }\n }\n\n /**\n * Update the rotate control element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n const frameState = mapEvent.frameState;\n if (!frameState) {\n return;\n }\n const rotation = frameState.viewState.rotation;\n if (rotation != this.rotation_) {\n const transform = 'rotate(' + rotation + 'rad)';\n if (this.autoHide_) {\n const contains = this.element.classList.contains(CLASS_HIDDEN);\n if (!contains && rotation === 0) {\n this.element.classList.add(CLASS_HIDDEN);\n } else if (contains && rotation !== 0) {\n this.element.classList.remove(CLASS_HIDDEN);\n }\n }\n this.label_.style.transform = transform;\n }\n this.rotation_ = rotation;\n }\n}\n\nexport default Rotate;\n","/**\n * @module ol/control/Zoom\n */\nimport Control from './Control.js';\nimport EventType from '../events/EventType.js';\nimport {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';\nimport {easeOut} from '../easing.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [duration=250] Animation duration in milliseconds.\n * @property {string} [className='ol-zoom'] CSS class name.\n * @property {string} [zoomInClassName=className + '-in'] CSS class name for the zoom-in button.\n * @property {string} [zoomOutClassName=className + '-out'] CSS class name for the zoom-out button.\n * @property {string|HTMLElement} [zoomInLabel='+'] Text label to use for the zoom-in\n * button. Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string|HTMLElement} [zoomOutLabel='–'] Text label to use for the zoom-out button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [zoomInTipLabel='Zoom in'] Text label to use for the button tip.\n * @property {string} [zoomOutTipLabel='Zoom out'] Text label to use for the button tip.\n * @property {number} [delta=1] The zoom delta applied on each click.\n * @property {HTMLElement|string} [target] Specify a target if you want the control to be\n * rendered outside of the map's viewport.\n */\n\n/**\n * @classdesc\n * A control with 2 buttons, one for zoom in and one for zoom out.\n * This control is one of the default controls of a map. To style this control\n * use css selectors `.ol-zoom-in` and `.ol-zoom-out`.\n *\n * @api\n */\nclass Zoom extends Control {\n /**\n * @param {Options} [options] Zoom options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n element: document.createElement('div'),\n target: options.target,\n });\n\n const className =\n options.className !== undefined ? options.className : 'ol-zoom';\n\n const delta = options.delta !== undefined ? options.delta : 1;\n\n const zoomInClassName =\n options.zoomInClassName !== undefined\n ? options.zoomInClassName\n : className + '-in';\n\n const zoomOutClassName =\n options.zoomOutClassName !== undefined\n ? options.zoomOutClassName\n : className + '-out';\n\n const zoomInLabel =\n options.zoomInLabel !== undefined ? options.zoomInLabel : '+';\n const zoomOutLabel =\n options.zoomOutLabel !== undefined ? options.zoomOutLabel : '\\u2013';\n\n const zoomInTipLabel =\n options.zoomInTipLabel !== undefined ? options.zoomInTipLabel : 'Zoom in';\n const zoomOutTipLabel =\n options.zoomOutTipLabel !== undefined\n ? options.zoomOutTipLabel\n : 'Zoom out';\n\n const inElement = document.createElement('button');\n inElement.className = zoomInClassName;\n inElement.setAttribute('type', 'button');\n inElement.title = zoomInTipLabel;\n inElement.appendChild(\n typeof zoomInLabel === 'string'\n ? document.createTextNode(zoomInLabel)\n : zoomInLabel,\n );\n\n inElement.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this, delta),\n false,\n );\n\n const outElement = document.createElement('button');\n outElement.className = zoomOutClassName;\n outElement.setAttribute('type', 'button');\n outElement.title = zoomOutTipLabel;\n outElement.appendChild(\n typeof zoomOutLabel === 'string'\n ? document.createTextNode(zoomOutLabel)\n : zoomOutLabel,\n );\n\n outElement.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this, -delta),\n false,\n );\n\n const cssClasses =\n className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;\n const element = this.element;\n element.className = cssClasses;\n element.appendChild(inElement);\n element.appendChild(outElement);\n\n /**\n * @type {number}\n * @private\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n }\n\n /**\n * @param {number} delta Zoom delta.\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(delta, event) {\n event.preventDefault();\n this.zoomByDelta_(delta);\n }\n\n /**\n * @param {number} delta Zoom delta.\n * @private\n */\n zoomByDelta_(delta) {\n const map = this.getMap();\n const view = map.getView();\n if (!view) {\n // the map does not have a view, so we can't act\n // upon it\n return;\n }\n const currentZoom = view.getZoom();\n if (currentZoom !== undefined) {\n const newZoom = view.getConstrainedZoom(currentZoom + delta);\n if (this.duration_ > 0) {\n if (view.getAnimating()) {\n view.cancelAnimations();\n }\n view.animate({\n zoom: newZoom,\n duration: this.duration_,\n easing: easeOut,\n });\n } else {\n view.setZoom(newZoom);\n }\n }\n }\n}\n\nexport default Zoom;\n","/**\n * @module ol/interaction/Property\n */\n\n/**\n * @enum {string}\n */\nexport default {\n ACTIVE: 'active',\n};\n","/**\n * @module ol/interaction/Interaction\n */\nimport BaseObject from '../Object.js';\nimport InteractionProperty from './Property.js';\nimport {easeOut, linear} from '../easing.js';\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature &\n * import(\"../Observable\").OnSignature &\n * import(\"../Observable\").CombinedOnSignature} InteractionOnSignature\n */\n\n/**\n * Object literal with config options for interactions.\n * @typedef {Object} InteractionOptions\n * @property {function(import(\"../MapBrowserEvent.js\").default):boolean} handleEvent\n * Method called by the map to notify the interaction that a browser event was\n * dispatched to the map. If the function returns a falsy value, propagation of\n * the event to other interactions in the map's interactions chain will be\n * prevented (this includes functions with no explicit return). The interactions\n * are traversed in reverse order of the interactions collection of the map.\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * User actions that change the state of the map. Some are similar to controls,\n * but are not associated with a DOM element.\n * For example, {@link module:ol/interaction/KeyboardZoom~KeyboardZoom} is\n * functionally the same as {@link module:ol/control/Zoom~Zoom}, but triggered\n * by a keyboard event not a button element event.\n * Although interactions do not have a DOM element, some of them do render\n * vectors and so are visible on the screen.\n * @api\n */\nclass Interaction extends BaseObject {\n /**\n * @param {InteractionOptions} [options] Options.\n */\n constructor(options) {\n super();\n\n /***\n * @type {InteractionOnSignature}\n */\n this.on;\n\n /***\n * @type {InteractionOnSignature}\n */\n this.once;\n\n /***\n * @type {InteractionOnSignature}\n */\n this.un;\n\n if (options && options.handleEvent) {\n this.handleEvent = options.handleEvent;\n }\n\n /**\n * @private\n * @type {import(\"../Map.js\").default|null}\n */\n this.map_ = null;\n\n this.setActive(true);\n }\n\n /**\n * Return whether the interaction is currently active.\n * @return {boolean} `true` if the interaction is active, `false` otherwise.\n * @observable\n * @api\n */\n getActive() {\n return /** @type {boolean} */ (this.get(InteractionProperty.ACTIVE));\n }\n\n /**\n * Get the map associated with this interaction.\n * @return {import(\"../Map.js\").default|null} Map.\n * @api\n */\n getMap() {\n return this.map_;\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event}.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @api\n */\n handleEvent(mapBrowserEvent) {\n return true;\n }\n\n /**\n * Activate or deactivate the interaction.\n * @param {boolean} active Active.\n * @observable\n * @api\n */\n setActive(active) {\n this.set(InteractionProperty.ACTIVE, active);\n }\n\n /**\n * Remove the interaction from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default|null} map Map.\n */\n setMap(map) {\n this.map_ = map;\n }\n}\n\n/**\n * @param {import(\"../View.js\").default} view View.\n * @param {import(\"../coordinate.js\").Coordinate} delta Delta.\n * @param {number} [duration] Duration.\n */\nexport function pan(view, delta, duration) {\n const currentCenter = view.getCenterInternal();\n if (currentCenter) {\n const center = [currentCenter[0] + delta[0], currentCenter[1] + delta[1]];\n view.animateInternal({\n duration: duration !== undefined ? duration : 250,\n easing: linear,\n center: view.getConstrainedCenter(center),\n });\n }\n}\n\n/**\n * @param {import(\"../View.js\").default} view View.\n * @param {number} delta Delta from previous zoom level.\n * @param {import(\"../coordinate.js\").Coordinate} [anchor] Anchor coordinate in the user projection.\n * @param {number} [duration] Duration.\n */\nexport function zoomByDelta(view, delta, anchor, duration) {\n const currentZoom = view.getZoom();\n\n if (currentZoom === undefined) {\n return;\n }\n\n const newZoom = view.getConstrainedZoom(currentZoom + delta);\n const newResolution = view.getResolutionForZoom(newZoom);\n\n if (view.getAnimating()) {\n view.cancelAnimations();\n }\n view.animate({\n resolution: newResolution,\n anchor: anchor,\n duration: duration !== undefined ? duration : 250,\n easing: easeOut,\n });\n}\n\nexport default Interaction;\n","/**\n * @module ol/interaction/DoubleClickZoom\n */\nimport Interaction, {zoomByDelta} from './Interaction.js';\nimport MapBrowserEventType from '../MapBrowserEventType.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [duration=250] Animation duration in milliseconds.\n * @property {number} [delta=1] The zoom delta applied on each double click.\n */\n\n/**\n * @classdesc\n * Allows the user to zoom by double-clicking on the map.\n * @api\n */\nclass DoubleClickZoom extends Interaction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n options = options ? options : {};\n\n /**\n * @private\n * @type {number}\n */\n this.delta_ = options.delta ? options.delta : 1;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} (if it was a\n * doubleclick) and eventually zooms the map.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n */\n handleEvent(mapBrowserEvent) {\n let stopEvent = false;\n if (mapBrowserEvent.type == MapBrowserEventType.DBLCLICK) {\n const browserEvent = /** @type {MouseEvent} */ (\n mapBrowserEvent.originalEvent\n );\n const map = mapBrowserEvent.map;\n const anchor = mapBrowserEvent.coordinate;\n const delta = browserEvent.shiftKey ? -this.delta_ : this.delta_;\n const view = map.getView();\n zoomByDelta(view, delta, anchor, this.duration_);\n browserEvent.preventDefault();\n stopEvent = true;\n }\n return !stopEvent;\n }\n}\n\nexport default DoubleClickZoom;\n","/**\n * @module ol/interaction/Pointer\n */\nimport Interaction from './Interaction.js';\nimport MapBrowserEventType from '../MapBrowserEventType.js';\n\n/**\n * @typedef {Object} Options\n * @property {function(import(\"../MapBrowserEvent.js\").default):boolean} [handleDownEvent]\n * Function handling \"down\" events. If the function returns `true` then a drag\n * sequence is started.\n * @property {function(import(\"../MapBrowserEvent.js\").default):void} [handleDragEvent]\n * Function handling \"drag\" events. This function is called on \"move\" events\n * during a drag sequence.\n * @property {function(import(\"../MapBrowserEvent.js\").default):boolean} [handleEvent]\n * Method called by the map to notify the interaction that a browser event was\n * dispatched to the map. The function may return `false` to prevent the\n * propagation of the event to other interactions in the map's interactions\n * chain.\n * @property {function(import(\"../MapBrowserEvent.js\").default):void} [handleMoveEvent]\n * Function handling \"move\" events. This function is called on \"move\" events.\n * This functions is also called during a drag sequence, so during a drag\n * sequence both the `handleDragEvent` function and this function are called.\n * If `handleDownEvent` is defined and it returns true this function will not\n * be called during a drag sequence.\n * @property {function(import(\"../MapBrowserEvent.js\").default):boolean} [handleUpEvent]\n * Function handling \"up\" events. If the function returns `false` then the\n * current drag sequence is stopped.\n * @property {function(boolean):boolean} [stopDown]\n * Should the down event be propagated to other interactions, or should be\n * stopped?\n */\n\n/**\n * @classdesc\n * Base class that calls user-defined functions on `down`, `move` and `up`\n * events. This class also manages \"drag sequences\".\n *\n * When the `handleDownEvent` user function returns `true` a drag sequence is\n * started. During a drag sequence the `handleDragEvent` user function is\n * called on `move` events. The drag sequence ends when the `handleUpEvent`\n * user function is called and returns `false`.\n * @api\n */\nclass PointerInteraction extends Interaction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super(\n /** @type {import(\"./Interaction.js\").InteractionOptions} */ (options),\n );\n\n if (options.handleDownEvent) {\n this.handleDownEvent = options.handleDownEvent;\n }\n\n if (options.handleDragEvent) {\n this.handleDragEvent = options.handleDragEvent;\n }\n\n if (options.handleMoveEvent) {\n this.handleMoveEvent = options.handleMoveEvent;\n }\n\n if (options.handleUpEvent) {\n this.handleUpEvent = options.handleUpEvent;\n }\n\n if (options.stopDown) {\n this.stopDown = options.stopDown;\n }\n\n /**\n * @type {boolean}\n * @protected\n */\n this.handlingDownUpSequence = false;\n\n /**\n * @type {Array}\n * @protected\n */\n this.targetPointers = [];\n }\n\n /**\n * Returns the current number of pointers involved in the interaction,\n * e.g. `2` when two fingers are used.\n * @return {number} The number of pointers.\n * @api\n */\n getPointerCount() {\n return this.targetPointers.length;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @protected\n */\n handleDownEvent(mapBrowserEvent) {\n return false;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @protected\n */\n handleDragEvent(mapBrowserEvent) {}\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may call into\n * other functions, if event sequences like e.g. 'drag' or 'down-up' etc. are\n * detected.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @api\n */\n handleEvent(mapBrowserEvent) {\n if (!mapBrowserEvent.originalEvent) {\n return true;\n }\n\n let stopEvent = false;\n this.updateTrackedPointers_(mapBrowserEvent);\n if (this.handlingDownUpSequence) {\n if (mapBrowserEvent.type == MapBrowserEventType.POINTERDRAG) {\n this.handleDragEvent(mapBrowserEvent);\n // prevent page scrolling during dragging\n mapBrowserEvent.originalEvent.preventDefault();\n } else if (mapBrowserEvent.type == MapBrowserEventType.POINTERUP) {\n const handledUp = this.handleUpEvent(mapBrowserEvent);\n this.handlingDownUpSequence =\n handledUp && this.targetPointers.length > 0;\n }\n } else {\n if (mapBrowserEvent.type == MapBrowserEventType.POINTERDOWN) {\n const handled = this.handleDownEvent(mapBrowserEvent);\n this.handlingDownUpSequence = handled;\n stopEvent = this.stopDown(handled);\n } else if (mapBrowserEvent.type == MapBrowserEventType.POINTERMOVE) {\n this.handleMoveEvent(mapBrowserEvent);\n }\n }\n return !stopEvent;\n }\n\n /**\n * Handle pointer move events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @protected\n */\n handleMoveEvent(mapBrowserEvent) {}\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @protected\n */\n handleUpEvent(mapBrowserEvent) {\n return false;\n }\n\n /**\n * This function is used to determine if \"down\" events should be propagated\n * to other interactions or should be stopped.\n * @param {boolean} handled Was the event handled by the interaction?\n * @return {boolean} Should the `down` event be stopped?\n */\n stopDown(handled) {\n return handled;\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @private\n */\n updateTrackedPointers_(mapBrowserEvent) {\n if (mapBrowserEvent.activePointers) {\n this.targetPointers = mapBrowserEvent.activePointers;\n }\n }\n}\n\n/**\n * @param {Array} pointerEvents List of events.\n * @return {{clientX: number, clientY: number}} Centroid pixel.\n */\nexport function centroid(pointerEvents) {\n const length = pointerEvents.length;\n let clientX = 0;\n let clientY = 0;\n for (let i = 0; i < length; i++) {\n clientX += pointerEvents[i].clientX;\n clientY += pointerEvents[i].clientY;\n }\n return {clientX: clientX / length, clientY: clientY / length};\n}\n\nexport default PointerInteraction;\n","/**\n * @module ol/events/condition\n */\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport {FALSE, TRUE} from '../functions.js';\nimport {MAC, WEBKIT} from '../has.js';\nimport {assert} from '../asserts.js';\n\n/**\n * A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * `{boolean}`. If the condition is met, true should be returned.\n *\n * @typedef {function(this: ?, import(\"../MapBrowserEvent.js\").default): boolean} Condition\n */\n\n/**\n * Creates a condition function that passes when all provided conditions pass.\n * @param {...Condition} var_args Conditions to check.\n * @return {Condition} Condition function.\n */\nexport function all(var_args) {\n const conditions = arguments;\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @return {boolean} All conditions passed.\n */\n return function (event) {\n let pass = true;\n for (let i = 0, ii = conditions.length; i < ii; ++i) {\n pass = pass && conditions[i](event);\n if (!pass) {\n break;\n }\n }\n return pass;\n };\n}\n\n/**\n * Return `true` if only the alt-key is pressed, `false` otherwise (e.g. when\n * additionally the shift-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the alt key is pressed.\n * @api\n */\nexport const altKeyOnly = function (mapBrowserEvent) {\n const originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (\n mapBrowserEvent.originalEvent\n );\n return (\n originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n !originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if only the alt-key and shift-key is pressed, `false` otherwise\n * (e.g. when additionally the platform-modifier-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the alt and shift keys are pressed.\n * @api\n */\nexport const altShiftKeysOnly = function (mapBrowserEvent) {\n const originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (\n mapBrowserEvent.originalEvent\n );\n return (\n originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if the map has the focus. This condition requires a map target\n * element with a `tabindex` attribute, e.g. `
`.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} event Map browser event.\n * @return {boolean} The map has the focus.\n * @api\n */\nexport const focus = function (event) {\n const targetElement = event.map.getTargetElement();\n const activeElement = event.map.getOwnerDocument().activeElement;\n return targetElement.contains(activeElement);\n};\n\n/**\n * Return `true` if the map has the focus or no 'tabindex' attribute set.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} event Map browser event.\n * @return {boolean} The map container has the focus or no 'tabindex' attribute.\n */\nexport const focusWithTabindex = function (event) {\n return event.map.getTargetElement().hasAttribute('tabindex')\n ? focus(event)\n : true;\n};\n\n/**\n * Return always true.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True.\n * @api\n */\nexport const always = TRUE;\n\n/**\n * Return `true` if the event is a `click` event, `false` otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event is a map `click` event.\n * @api\n */\nexport const click = function (mapBrowserEvent) {\n return mapBrowserEvent.type == MapBrowserEventType.CLICK;\n};\n\n/**\n * Return `true` if the event has an \"action\"-producing mouse button.\n *\n * By definition, this includes left-click on windows/linux, and left-click\n * without the ctrl key on Macs.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} The result.\n */\nexport const mouseActionButton = function (mapBrowserEvent) {\n const originalEvent = /** @type {MouseEvent} */ (\n mapBrowserEvent.originalEvent\n );\n return originalEvent.button == 0 && !(WEBKIT && MAC && originalEvent.ctrlKey);\n};\n\n/**\n * Return always false.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} False.\n * @api\n */\nexport const never = FALSE;\n\n/**\n * Return `true` if the browser event is a `pointermove` event, `false`\n * otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the browser event is a `pointermove` event.\n * @api\n */\nexport const pointerMove = function (mapBrowserEvent) {\n return mapBrowserEvent.type == 'pointermove';\n};\n\n/**\n * Return `true` if the event is a map `singleclick` event, `false` otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event is a map `singleclick` event.\n * @api\n */\nexport const singleClick = function (mapBrowserEvent) {\n return mapBrowserEvent.type == MapBrowserEventType.SINGLECLICK;\n};\n\n/**\n * Return `true` if the event is a map `dblclick` event, `false` otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event is a map `dblclick` event.\n * @api\n */\nexport const doubleClick = function (mapBrowserEvent) {\n return mapBrowserEvent.type == MapBrowserEventType.DBLCLICK;\n};\n\n/**\n * Return `true` if no modifier key (alt-, shift- or platform-modifier-key) is\n * pressed.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True only if there no modifier keys are pressed.\n * @api\n */\nexport const noModifierKeys = function (mapBrowserEvent) {\n const originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (\n mapBrowserEvent.originalEvent\n );\n return (\n !originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n !originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if only the platform-modifier-key (the meta-key on Mac,\n * ctrl-key otherwise) is pressed, `false` otherwise (e.g. when additionally\n * the shift-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the platform modifier key is pressed.\n * @api\n */\nexport const platformModifierKeyOnly = function (mapBrowserEvent) {\n const originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (\n mapBrowserEvent.originalEvent\n );\n return (\n !originalEvent.altKey &&\n (MAC ? originalEvent.metaKey : originalEvent.ctrlKey) &&\n !originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if the platform-modifier-key (the meta-key on Mac,\n * ctrl-key otherwise) is pressed.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the platform modifier key is pressed.\n * @api\n */\nexport const platformModifierKey = function (mapBrowserEvent) {\n const originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (\n mapBrowserEvent.originalEvent\n );\n return MAC ? originalEvent.metaKey : originalEvent.ctrlKey;\n};\n\n/**\n * Return `true` if only the shift-key is pressed, `false` otherwise (e.g. when\n * additionally the alt-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the shift key is pressed.\n * @api\n */\nexport const shiftKeyOnly = function (mapBrowserEvent) {\n const originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (\n mapBrowserEvent.originalEvent\n );\n return (\n !originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if the target element is not editable, i.e. not an `input`,\n * `select`, or `textarea` element and no `contenteditable` attribute is\n * set or inherited, `false` otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True only if the target element is not editable.\n * @api\n */\nexport const targetNotEditable = function (mapBrowserEvent) {\n const originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (\n mapBrowserEvent.originalEvent\n );\n const tagName = /** @type {Element} */ (originalEvent.target).tagName;\n return (\n tagName !== 'INPUT' &&\n tagName !== 'SELECT' &&\n tagName !== 'TEXTAREA' &&\n // `isContentEditable` is only available on `HTMLElement`, but it may also be a\n // different type like `SVGElement`.\n // @ts-ignore\n !originalEvent.target.isContentEditable\n );\n};\n\n/**\n * Return `true` if the event originates from a mouse device.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event originates from a mouse device.\n * @api\n */\nexport const mouseOnly = function (mapBrowserEvent) {\n const pointerEvent = /** @type {import(\"../MapBrowserEvent\").default} */ (\n mapBrowserEvent\n ).originalEvent;\n assert(\n pointerEvent !== undefined,\n 'mapBrowserEvent must originate from a pointer event',\n );\n // see https://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType\n return pointerEvent.pointerType == 'mouse';\n};\n\n/**\n * Return `true` if the event originates from a touchable device.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event originates from a touchable device.\n * @api\n */\nexport const touchOnly = function (mapBrowserEvent) {\n const pointerEvt = /** @type {import(\"../MapBrowserEvent\").default} */ (\n mapBrowserEvent\n ).originalEvent;\n assert(\n pointerEvt !== undefined,\n 'mapBrowserEvent must originate from a pointer event',\n );\n // see https://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType\n return pointerEvt.pointerType === 'touch';\n};\n\n/**\n * Return `true` if the event originates from a digital pen.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event originates from a digital pen.\n * @api\n */\nexport const penOnly = function (mapBrowserEvent) {\n const pointerEvt = /** @type {import(\"../MapBrowserEvent\").default} */ (\n mapBrowserEvent\n ).originalEvent;\n assert(\n pointerEvt !== undefined,\n 'mapBrowserEvent must originate from a pointer event',\n );\n // see https://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType\n return pointerEvt.pointerType === 'pen';\n};\n\n/**\n * Return `true` if the event originates from a primary pointer in\n * contact with the surface or if the left mouse button is pressed.\n * See https://www.w3.org/TR/pointerevents/#button-states.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event originates from a primary pointer.\n * @api\n */\nexport const primaryAction = function (mapBrowserEvent) {\n const pointerEvent = /** @type {import(\"../MapBrowserEvent\").default} */ (\n mapBrowserEvent\n ).originalEvent;\n assert(\n pointerEvent !== undefined,\n 'mapBrowserEvent must originate from a pointer event',\n );\n return pointerEvent.isPrimary && pointerEvent.button === 0;\n};\n","/**\n * @module ol/interaction/DragPan\n */\nimport PointerInteraction, {\n centroid as centroidFromPointers,\n} from './Pointer.js';\nimport {FALSE} from '../functions.js';\nimport {\n all,\n focusWithTabindex,\n noModifierKeys,\n primaryAction,\n} from '../events/condition.js';\nimport {easeOut} from '../easing.js';\nimport {\n rotate as rotateCoordinate,\n scale as scaleCoordinate,\n} from '../coordinate.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean\n * to indicate whether that event should be handled.\n * Default is {@link module:ol/events/condition.noModifierKeys} and {@link module:ol/events/condition.primaryAction}.\n * @property {boolean} [onFocusOnly=false] When the map's target has a `tabindex` attribute set,\n * the interaction will only handle events when the map has the focus.\n * @property {import(\"../Kinetic.js\").default} [kinetic] Kinetic inertia to apply to the pan.\n */\n\n/**\n * @classdesc\n * Allows the user to pan the map by dragging the map.\n * @api\n */\nclass DragPan extends PointerInteraction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super({\n stopDown: FALSE,\n });\n\n options = options ? options : {};\n\n /**\n * @private\n * @type {import(\"../Kinetic.js\").default|undefined}\n */\n this.kinetic_ = options.kinetic;\n\n /**\n * @type {import(\"../pixel.js\").Pixel}\n */\n this.lastCentroid = null;\n\n /**\n * @type {number}\n */\n this.lastPointersCount_;\n\n /**\n * @type {boolean}\n */\n this.panning_ = false;\n\n const condition = options.condition\n ? options.condition\n : all(noModifierKeys, primaryAction);\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.onFocusOnly\n ? all(focusWithTabindex, condition)\n : condition;\n\n /**\n * @private\n * @type {boolean}\n */\n this.noKinetic_ = false;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n */\n handleDragEvent(mapBrowserEvent) {\n const map = mapBrowserEvent.map;\n if (!this.panning_) {\n this.panning_ = true;\n map.getView().beginInteraction();\n }\n const targetPointers = this.targetPointers;\n const centroid = map.getEventPixel(centroidFromPointers(targetPointers));\n if (targetPointers.length == this.lastPointersCount_) {\n if (this.kinetic_) {\n this.kinetic_.update(centroid[0], centroid[1]);\n }\n if (this.lastCentroid) {\n const delta = [\n this.lastCentroid[0] - centroid[0],\n centroid[1] - this.lastCentroid[1],\n ];\n const map = mapBrowserEvent.map;\n const view = map.getView();\n scaleCoordinate(delta, view.getResolution());\n rotateCoordinate(delta, view.getRotation());\n view.adjustCenterInternal(delta);\n }\n } else if (this.kinetic_) {\n // reset so we don't overestimate the kinetic energy after\n // after one finger down, tiny drag, second finger down\n this.kinetic_.begin();\n }\n this.lastCentroid = centroid;\n this.lastPointersCount_ = targetPointers.length;\n mapBrowserEvent.originalEvent.preventDefault();\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleUpEvent(mapBrowserEvent) {\n const map = mapBrowserEvent.map;\n const view = map.getView();\n if (this.targetPointers.length === 0) {\n if (!this.noKinetic_ && this.kinetic_ && this.kinetic_.end()) {\n const distance = this.kinetic_.getDistance();\n const angle = this.kinetic_.getAngle();\n const center = view.getCenterInternal();\n const centerpx = map.getPixelFromCoordinateInternal(center);\n const dest = map.getCoordinateFromPixelInternal([\n centerpx[0] - distance * Math.cos(angle),\n centerpx[1] - distance * Math.sin(angle),\n ]);\n view.animateInternal({\n center: view.getConstrainedCenter(dest),\n duration: 500,\n easing: easeOut,\n });\n }\n if (this.panning_) {\n this.panning_ = false;\n view.endInteraction();\n }\n return false;\n }\n if (this.kinetic_) {\n // reset so we don't overestimate the kinetic energy after\n // after one finger up, tiny drag, second finger up\n this.kinetic_.begin();\n }\n this.lastCentroid = null;\n return true;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleDownEvent(mapBrowserEvent) {\n if (this.targetPointers.length > 0 && this.condition_(mapBrowserEvent)) {\n const map = mapBrowserEvent.map;\n const view = map.getView();\n this.lastCentroid = null;\n // stop any current animation\n if (view.getAnimating()) {\n view.cancelAnimations();\n }\n if (this.kinetic_) {\n this.kinetic_.begin();\n }\n // No kinetic as soon as more than one pointer on the screen is\n // detected. This is to prevent nasty pans after pinch.\n this.noKinetic_ = this.targetPointers.length > 1;\n return true;\n }\n return false;\n }\n}\n\nexport default DragPan;\n","/**\n * @module ol/interaction/DragRotate\n */\nimport PointerInteraction from './Pointer.js';\nimport {FALSE} from '../functions.js';\nimport {\n altShiftKeysOnly,\n mouseActionButton,\n mouseOnly,\n} from '../events/condition.js';\nimport {disable} from '../rotationconstraint.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that takes an\n * {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean\n * to indicate whether that event should be handled.\n * Default is {@link module:ol/events/condition.altShiftKeysOnly}.\n * @property {number} [duration=250] Animation duration in milliseconds.\n */\n\n/**\n * @classdesc\n * Allows the user to rotate the map by clicking and dragging on the map,\n * normally combined with an {@link module:ol/events/condition} that limits\n * it to when the alt and shift keys are held down.\n *\n * This interaction is only supported for mouse devices.\n * @api\n */\nclass DragRotate extends PointerInteraction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n stopDown: FALSE,\n });\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition ? options.condition : altShiftKeysOnly;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.lastAngle_ = undefined;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n */\n handleDragEvent(mapBrowserEvent) {\n if (!mouseOnly(mapBrowserEvent)) {\n return;\n }\n\n const map = mapBrowserEvent.map;\n const view = map.getView();\n if (view.getConstraints().rotation === disable) {\n return;\n }\n const size = map.getSize();\n const offset = mapBrowserEvent.pixel;\n const theta = Math.atan2(size[1] / 2 - offset[1], offset[0] - size[0] / 2);\n if (this.lastAngle_ !== undefined) {\n const delta = theta - this.lastAngle_;\n view.adjustRotationInternal(-delta);\n }\n this.lastAngle_ = theta;\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleUpEvent(mapBrowserEvent) {\n if (!mouseOnly(mapBrowserEvent)) {\n return true;\n }\n\n const map = mapBrowserEvent.map;\n const view = map.getView();\n view.endInteraction(this.duration_);\n return false;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleDownEvent(mapBrowserEvent) {\n if (!mouseOnly(mapBrowserEvent)) {\n return false;\n }\n\n if (\n mouseActionButton(mapBrowserEvent) &&\n this.condition_(mapBrowserEvent)\n ) {\n const map = mapBrowserEvent.map;\n map.getView().beginInteraction();\n this.lastAngle_ = undefined;\n return true;\n }\n return false;\n }\n}\n\nexport default DragRotate;\n","/**\n * @module ol/render/Box\n */\n\nimport Disposable from '../Disposable.js';\nimport Polygon from '../geom/Polygon.js';\n\nclass RenderBox extends Disposable {\n /**\n * @param {string} className CSS class name.\n */\n constructor(className) {\n super();\n\n /**\n * @type {import(\"../geom/Polygon.js\").default}\n * @private\n */\n this.geometry_ = null;\n\n /**\n * @type {HTMLDivElement}\n * @private\n */\n this.element_ = document.createElement('div');\n this.element_.style.position = 'absolute';\n this.element_.style.pointerEvents = 'auto';\n this.element_.className = 'ol-box ' + className;\n\n /**\n * @private\n * @type {import(\"../Map.js\").default|null}\n */\n this.map_ = null;\n\n /**\n * @private\n * @type {import(\"../pixel.js\").Pixel}\n */\n this.startPixel_ = null;\n\n /**\n * @private\n * @type {import(\"../pixel.js\").Pixel}\n */\n this.endPixel_ = null;\n }\n\n /**\n * Clean up.\n */\n disposeInternal() {\n this.setMap(null);\n }\n\n /**\n * @private\n */\n render_() {\n const startPixel = this.startPixel_;\n const endPixel = this.endPixel_;\n const px = 'px';\n const style = this.element_.style;\n style.left = Math.min(startPixel[0], endPixel[0]) + px;\n style.top = Math.min(startPixel[1], endPixel[1]) + px;\n style.width = Math.abs(endPixel[0] - startPixel[0]) + px;\n style.height = Math.abs(endPixel[1] - startPixel[1]) + px;\n }\n\n /**\n * @param {import(\"../Map.js\").default|null} map Map.\n */\n setMap(map) {\n if (this.map_) {\n this.map_.getOverlayContainer().removeChild(this.element_);\n const style = this.element_.style;\n style.left = 'inherit';\n style.top = 'inherit';\n style.width = 'inherit';\n style.height = 'inherit';\n }\n this.map_ = map;\n if (this.map_) {\n this.map_.getOverlayContainer().appendChild(this.element_);\n }\n }\n\n /**\n * @param {import(\"../pixel.js\").Pixel} startPixel Start pixel.\n * @param {import(\"../pixel.js\").Pixel} endPixel End pixel.\n */\n setPixels(startPixel, endPixel) {\n this.startPixel_ = startPixel;\n this.endPixel_ = endPixel;\n this.createOrUpdateGeometry();\n this.render_();\n }\n\n /**\n * Creates or updates the cached geometry.\n */\n createOrUpdateGeometry() {\n if (!this.map_) {\n return;\n }\n\n const startPixel = this.startPixel_;\n const endPixel = this.endPixel_;\n const pixels = [\n startPixel,\n [startPixel[0], endPixel[1]],\n endPixel,\n [endPixel[0], startPixel[1]],\n ];\n const coordinates = pixels.map(\n this.map_.getCoordinateFromPixelInternal,\n this.map_,\n );\n // close the polygon\n coordinates[4] = coordinates[0].slice();\n if (!this.geometry_) {\n this.geometry_ = new Polygon([coordinates]);\n } else {\n this.geometry_.setCoordinates([coordinates]);\n }\n }\n\n /**\n * @return {import(\"../geom/Polygon.js\").default} Geometry.\n */\n getGeometry() {\n return this.geometry_;\n }\n}\n\nexport default RenderBox;\n","/**\n * @module ol/interaction/DragBox\n */\n// FIXME draw drag box\nimport Event from '../events/Event.js';\nimport PointerInteraction from './Pointer.js';\nimport RenderBox from '../render/Box.js';\nimport {mouseActionButton} from '../events/condition.js';\n\n/**\n * A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and two\n * {@link module:ol/pixel~Pixel}s and returns a `{boolean}`. If the condition is met,\n * true should be returned.\n * @typedef {function(this: ?, import(\"../MapBrowserEvent.js\").default, import(\"../pixel.js\").Pixel, import(\"../pixel.js\").Pixel):boolean} EndCondition\n */\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-dragbox'] CSS class name for styling the box.\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean\n * to indicate whether that event should be handled.\n * Default is {@link ol/events/condition~mouseActionButton}.\n * @property {number} [minArea=64] The minimum area of the box in pixel, this value is used by the default\n * `boxEndCondition` function.\n * @property {EndCondition} [boxEndCondition] A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and two\n * {@link module:ol/pixel~Pixel}s to indicate whether a `boxend` event should be fired.\n * Default is `true` if the area of the box is bigger than the `minArea` option.\n * @property {function(this:DragBox, import(\"../MapBrowserEvent.js\").default):void} [onBoxEnd] Code to execute just\n * before `boxend` is fired.\n */\n\n/**\n * @enum {string}\n */\nconst DragBoxEventType = {\n /**\n * Triggered upon drag box start.\n * @event DragBoxEvent#boxstart\n * @api\n */\n BOXSTART: 'boxstart',\n\n /**\n * Triggered on drag when box is active.\n * @event DragBoxEvent#boxdrag\n * @api\n */\n BOXDRAG: 'boxdrag',\n\n /**\n * Triggered upon drag box end.\n * @event DragBoxEvent#boxend\n * @api\n */\n BOXEND: 'boxend',\n\n /**\n * Triggered upon drag box canceled.\n * @event DragBoxEvent#boxcancel\n * @api\n */\n BOXCANCEL: 'boxcancel',\n};\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/DragBox~DragBox} instances are instances of\n * this type.\n */\nexport class DragBoxEvent extends Event {\n /**\n * @param {string} type The event type.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate The event coordinate.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Originating event.\n */\n constructor(type, coordinate, mapBrowserEvent) {\n super(type);\n\n /**\n * The coordinate of the drag event.\n * @const\n * @type {import(\"../coordinate.js\").Coordinate}\n * @api\n */\n this.coordinate = coordinate;\n\n /**\n * @const\n * @type {import(\"../MapBrowserEvent.js\").default}\n * @api\n */\n this.mapBrowserEvent = mapBrowserEvent;\n }\n}\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature &\n * import(\"../Observable\").OnSignature &\n * import(\"../Observable\").OnSignature<'boxcancel'|'boxdrag'|'boxend'|'boxstart', DragBoxEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature} DragBoxOnSignature\n */\n\n/**\n * @classdesc\n * Allows the user to draw a vector box by clicking and dragging on the map,\n * normally combined with an {@link module:ol/events/condition} that limits\n * it to when the shift or other key is held down. This is used, for example,\n * for zooming to a specific area of the map\n * (see {@link module:ol/interaction/DragZoom~DragZoom} and\n * {@link module:ol/interaction/DragRotateAndZoom~DragRotateAndZoom}).\n *\n * @fires DragBoxEvent\n * @api\n */\nclass DragBox extends PointerInteraction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n /***\n * @type {DragBoxOnSignature}\n */\n this.on;\n\n /***\n * @type {DragBoxOnSignature}\n */\n this.once;\n\n /***\n * @type {DragBoxOnSignature}\n */\n this.un;\n\n options = options ? options : {};\n\n /**\n * @type {import(\"../render/Box.js\").default}\n * @private\n */\n this.box_ = new RenderBox(options.className || 'ol-dragbox');\n\n /**\n * @type {number}\n * @private\n */\n this.minArea_ = options.minArea !== undefined ? options.minArea : 64;\n\n if (options.onBoxEnd) {\n this.onBoxEnd = options.onBoxEnd;\n }\n\n /**\n * @type {import(\"../pixel.js\").Pixel}\n * @private\n */\n this.startPixel_ = null;\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition ? options.condition : mouseActionButton;\n\n /**\n * @private\n * @type {EndCondition}\n */\n this.boxEndCondition_ = options.boxEndCondition\n ? options.boxEndCondition\n : this.defaultBoxEndCondition;\n }\n\n /**\n * The default condition for determining whether the boxend event\n * should fire.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent The originating MapBrowserEvent\n * leading to the box end.\n * @param {import(\"../pixel.js\").Pixel} startPixel The starting pixel of the box.\n * @param {import(\"../pixel.js\").Pixel} endPixel The end pixel of the box.\n * @return {boolean} Whether or not the boxend condition should be fired.\n */\n defaultBoxEndCondition(mapBrowserEvent, startPixel, endPixel) {\n const width = endPixel[0] - startPixel[0];\n const height = endPixel[1] - startPixel[1];\n return width * width + height * height >= this.minArea_;\n }\n\n /**\n * Returns geometry of last drawn box.\n * @return {import(\"../geom/Polygon.js\").default} Geometry.\n * @api\n */\n getGeometry() {\n return this.box_.getGeometry();\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n */\n handleDragEvent(mapBrowserEvent) {\n if (!this.startPixel_) {\n return;\n }\n\n this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel);\n\n this.dispatchEvent(\n new DragBoxEvent(\n DragBoxEventType.BOXDRAG,\n mapBrowserEvent.coordinate,\n mapBrowserEvent,\n ),\n );\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleUpEvent(mapBrowserEvent) {\n if (!this.startPixel_) {\n return false;\n }\n\n this.box_.setMap(null);\n\n const completeBox = this.boxEndCondition_(\n mapBrowserEvent,\n this.startPixel_,\n mapBrowserEvent.pixel,\n );\n if (completeBox) {\n this.onBoxEnd(mapBrowserEvent);\n }\n this.dispatchEvent(\n new DragBoxEvent(\n completeBox ? DragBoxEventType.BOXEND : DragBoxEventType.BOXCANCEL,\n mapBrowserEvent.coordinate,\n mapBrowserEvent,\n ),\n );\n return false;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleDownEvent(mapBrowserEvent) {\n if (this.condition_(mapBrowserEvent)) {\n this.startPixel_ = mapBrowserEvent.pixel;\n this.box_.setMap(mapBrowserEvent.map);\n this.box_.setPixels(this.startPixel_, this.startPixel_);\n this.dispatchEvent(\n new DragBoxEvent(\n DragBoxEventType.BOXSTART,\n mapBrowserEvent.coordinate,\n mapBrowserEvent,\n ),\n );\n return true;\n }\n return false;\n }\n\n /**\n * Function to execute just before `onboxend` is fired\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n */\n onBoxEnd(event) {}\n\n /**\n * Activate or deactivate the interaction.\n * @param {boolean} active Active.\n * @observable\n * @api\n */\n setActive(active) {\n if (!active) {\n this.box_.setMap(null);\n if (this.startPixel_) {\n this.dispatchEvent(\n new DragBoxEvent(DragBoxEventType.BOXCANCEL, this.startPixel_, null),\n );\n this.startPixel_ = null;\n }\n }\n\n super.setActive(active);\n }\n}\n\nexport default DragBox;\n","/**\n * @module ol/interaction/DragZoom\n */\nimport DragBox from './DragBox.js';\nimport {easeOut} from '../easing.js';\nimport {shiftKeyOnly} from '../events/condition.js';\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-dragzoom'] CSS class name for styling the\n * box.\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled.\n * Default is {@link module:ol/events/condition.shiftKeyOnly}.\n * @property {number} [duration=200] Animation duration in milliseconds.\n * @property {boolean} [out=false] Use interaction for zooming out.\n * @property {number} [minArea=64] The minimum area of the box in pixel, this value is used by the parent default\n * `boxEndCondition` function.\n */\n\n/**\n * @classdesc\n * Allows the user to zoom the map by clicking and dragging on the map,\n * normally combined with an {@link module:ol/events/condition} that limits\n * it to when a key, shift by default, is held down.\n *\n * To change the style of the box, use CSS and the `.ol-dragzoom` selector, or\n * your custom one configured with `className`.\n * @api\n */\nclass DragZoom extends DragBox {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const condition = options.condition ? options.condition : shiftKeyOnly;\n\n super({\n condition: condition,\n className: options.className || 'ol-dragzoom',\n minArea: options.minArea,\n });\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 200;\n\n /**\n * @private\n * @type {boolean}\n */\n this.out_ = options.out !== undefined ? options.out : false;\n }\n\n /**\n * Function to execute just before `onboxend` is fired\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n */\n onBoxEnd(event) {\n const map = this.getMap();\n const view = /** @type {!import(\"../View.js\").default} */ (map.getView());\n let geometry = this.getGeometry();\n\n if (this.out_) {\n const rotatedExtent = view.rotatedExtentForGeometry(geometry);\n const resolution = view.getResolutionForExtentInternal(rotatedExtent);\n const factor = view.getResolution() / resolution;\n geometry = geometry.clone();\n geometry.scale(factor * factor);\n }\n\n view.fitInternal(geometry, {\n duration: this.duration_,\n easing: easeOut,\n });\n }\n}\n\nexport default DragZoom;\n","/**\n * @module ol/events/Key\n */\n\n/**\n * @enum {string}\n * @const\n */\nexport default {\n LEFT: 'ArrowLeft',\n UP: 'ArrowUp',\n RIGHT: 'ArrowRight',\n DOWN: 'ArrowDown',\n};\n","/**\n * @module ol/interaction/KeyboardPan\n */\nimport EventType from '../events/EventType.js';\nimport Interaction, {pan} from './Interaction.js';\nimport Key from '../events/Key.js';\nimport {noModifierKeys, targetNotEditable} from '../events/condition.js';\nimport {rotate as rotateCoordinate} from '../coordinate.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled. Default is\n * {@link module:ol/events/condition.noModifierKeys} and\n * {@link module:ol/events/condition.targetNotEditable}.\n * @property {number} [duration=100] Animation duration in milliseconds.\n * @property {number} [pixelDelta=128] The amount of pixels to pan on each key\n * press.\n */\n\n/**\n * @classdesc\n * Allows the user to pan the map using keyboard arrows.\n * Note that, although this interaction is by default included in maps,\n * the keys can only be used when browser focus is on the element to which\n * the keyboard events are attached. By default, this is the map div,\n * though you can change this with the `keyboardEventTarget` in\n * {@link module:ol/Map~Map}. `document` never loses focus but, for any other\n * element, focus will have to be on, and returned to, this element if the keys\n * are to function.\n * See also {@link module:ol/interaction/KeyboardZoom~KeyboardZoom}.\n * @api\n */\nclass KeyboardPan extends Interaction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n options = options || {};\n\n /**\n * @private\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Browser event.\n * @return {boolean} Combined condition result.\n */\n this.defaultCondition_ = function (mapBrowserEvent) {\n return (\n noModifierKeys(mapBrowserEvent) && targetNotEditable(mapBrowserEvent)\n );\n };\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ =\n options.condition !== undefined\n ? options.condition\n : this.defaultCondition_;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 100;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelDelta_ =\n options.pixelDelta !== undefined ? options.pixelDelta : 128;\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} if it was a\n * `KeyEvent`, and decides the direction to pan to (if an arrow key was\n * pressed).\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n */\n handleEvent(mapBrowserEvent) {\n let stopEvent = false;\n if (mapBrowserEvent.type == EventType.KEYDOWN) {\n const keyEvent = /** @type {KeyboardEvent} */ (\n mapBrowserEvent.originalEvent\n );\n const key = keyEvent.key;\n if (\n this.condition_(mapBrowserEvent) &&\n (key == Key.DOWN ||\n key == Key.LEFT ||\n key == Key.RIGHT ||\n key == Key.UP)\n ) {\n const map = mapBrowserEvent.map;\n const view = map.getView();\n const mapUnitsDelta = view.getResolution() * this.pixelDelta_;\n let deltaX = 0,\n deltaY = 0;\n if (key == Key.DOWN) {\n deltaY = -mapUnitsDelta;\n } else if (key == Key.LEFT) {\n deltaX = -mapUnitsDelta;\n } else if (key == Key.RIGHT) {\n deltaX = mapUnitsDelta;\n } else {\n deltaY = mapUnitsDelta;\n }\n const delta = [deltaX, deltaY];\n rotateCoordinate(delta, view.getRotation());\n pan(view, delta, this.duration_);\n keyEvent.preventDefault();\n stopEvent = true;\n }\n }\n return !stopEvent;\n }\n}\n\nexport default KeyboardPan;\n","/**\n * @module ol/interaction/KeyboardZoom\n */\nimport EventType from '../events/EventType.js';\nimport Interaction, {zoomByDelta} from './Interaction.js';\nimport {platformModifierKey, targetNotEditable} from '../events/condition.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [duration=100] Animation duration in milliseconds.\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled. The default condition is\n * that {@link module:ol/events/condition.targetNotEditable} is fulfilled and that\n * the platform modifier key isn't pressed\n * (!{@link module:ol/events/condition.platformModifierKey}).\n * @property {number} [delta=1] The zoom level delta on each key press.\n */\n\n/**\n * @classdesc\n * Allows the user to zoom the map using keyboard + and -.\n * Note that, although this interaction is by default included in maps,\n * the keys can only be used when browser focus is on the element to which\n * the keyboard events are attached. By default, this is the map div,\n * though you can change this with the `keyboardEventTarget` in\n * {@link module:ol/Map~Map}. `document` never loses focus but, for any other\n * element, focus will have to be on, and returned to, this element if the keys\n * are to function.\n * See also {@link module:ol/interaction/KeyboardPan~KeyboardPan}.\n * @api\n */\nclass KeyboardZoom extends Interaction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n options = options ? options : {};\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition\n ? options.condition\n : function (mapBrowserEvent) {\n return (\n !platformModifierKey(mapBrowserEvent) &&\n targetNotEditable(mapBrowserEvent)\n );\n };\n\n /**\n * @private\n * @type {number}\n */\n this.delta_ = options.delta ? options.delta : 1;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 100;\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} if it was a\n * `KeyEvent`, and decides whether to zoom in or out (depending on whether the\n * key pressed was '+' or '-').\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n */\n handleEvent(mapBrowserEvent) {\n let stopEvent = false;\n if (\n mapBrowserEvent.type == EventType.KEYDOWN ||\n mapBrowserEvent.type == EventType.KEYPRESS\n ) {\n const keyEvent = /** @type {KeyboardEvent} */ (\n mapBrowserEvent.originalEvent\n );\n const key = keyEvent.key;\n if (this.condition_(mapBrowserEvent) && (key === '+' || key === '-')) {\n const map = mapBrowserEvent.map;\n const delta = key === '+' ? this.delta_ : -this.delta_;\n const view = map.getView();\n zoomByDelta(view, delta, undefined, this.duration_);\n keyEvent.preventDefault();\n stopEvent = true;\n }\n }\n return !stopEvent;\n }\n}\n\nexport default KeyboardZoom;\n","/**\n * @module ol/interaction/MouseWheelZoom\n */\nimport EventType from '../events/EventType.js';\nimport Interaction, {zoomByDelta} from './Interaction.js';\nimport {DEVICE_PIXEL_RATIO, FIREFOX} from '../has.js';\nimport {all, always, focusWithTabindex} from '../events/condition.js';\nimport {clamp} from '../math.js';\n\n/**\n * @typedef {'trackpad' | 'wheel'} Mode\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled. Default is\n * {@link module:ol/events/condition.always}.\n * @property {boolean} [onFocusOnly=false] When the map's target has a `tabindex` attribute set,\n * the interaction will only handle events when the map has the focus.\n * @property {number} [maxDelta=1] Maximum mouse wheel delta.\n * @property {number} [duration=250] Animation duration in milliseconds.\n * @property {number} [timeout=80] Mouse wheel timeout duration in milliseconds.\n * @property {boolean} [useAnchor=true] Enable zooming using the mouse's\n * location as the anchor. When set to `false`, zooming in and out will zoom to\n * the center of the screen instead of zooming on the mouse's location.\n * @property {boolean} [constrainResolution=false] If true, the mouse wheel zoom\n * event will always animate to the closest zoom level after an interaction;\n * false means intermediary zoom levels are allowed.\n */\n\n/**\n * @classdesc\n * Allows the user to zoom the map by scrolling the mouse wheel.\n * @api\n */\nclass MouseWheelZoom extends Interaction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super(\n /** @type {import(\"./Interaction.js\").InteractionOptions} */ (options),\n );\n\n /**\n * @private\n * @type {number}\n */\n this.totalDelta_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.lastDelta_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = options.maxDelta !== undefined ? options.maxDelta : 1;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n\n /**\n * @private\n * @type {number}\n */\n this.timeout_ = options.timeout !== undefined ? options.timeout : 80;\n\n /**\n * @private\n * @type {boolean}\n */\n this.useAnchor_ =\n options.useAnchor !== undefined ? options.useAnchor : true;\n\n /**\n * @private\n * @type {boolean}\n */\n this.constrainResolution_ =\n options.constrainResolution !== undefined\n ? options.constrainResolution\n : false;\n\n const condition = options.condition ? options.condition : always;\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.onFocusOnly\n ? all(focusWithTabindex, condition)\n : condition;\n\n /**\n * @private\n * @type {?import(\"../coordinate.js\").Coordinate}\n */\n this.lastAnchor_ = null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.startTime_ = undefined;\n\n /**\n * @private\n * @type {ReturnType}\n */\n this.timeoutId_;\n\n /**\n * @private\n * @type {Mode|undefined}\n */\n this.mode_ = undefined;\n\n /**\n * Trackpad events separated by this delay will be considered separate\n * interactions.\n * @private\n * @type {number}\n */\n this.trackpadEventGap_ = 400;\n\n /**\n * @private\n * @type {ReturnType}\n */\n this.trackpadTimeoutId_;\n\n /**\n * The number of delta values per zoom level\n * @private\n * @type {number}\n */\n this.deltaPerZoom_ = 300;\n }\n\n /**\n * @private\n */\n endInteraction_() {\n this.trackpadTimeoutId_ = undefined;\n const map = this.getMap();\n if (!map) {\n return;\n }\n const view = map.getView();\n view.endInteraction(\n undefined,\n this.lastDelta_ ? (this.lastDelta_ > 0 ? 1 : -1) : 0,\n this.lastAnchor_,\n );\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} (if it was a mousewheel-event) and eventually\n * zooms the map.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n */\n handleEvent(mapBrowserEvent) {\n if (!this.condition_(mapBrowserEvent)) {\n return true;\n }\n const type = mapBrowserEvent.type;\n if (type !== EventType.WHEEL) {\n return true;\n }\n\n const map = mapBrowserEvent.map;\n const wheelEvent = /** @type {WheelEvent} */ (\n mapBrowserEvent.originalEvent\n );\n wheelEvent.preventDefault();\n\n if (this.useAnchor_) {\n this.lastAnchor_ = mapBrowserEvent.coordinate;\n }\n\n // Delta normalisation inspired by\n // https://github.com/mapbox/mapbox-gl-js/blob/001c7b9/js/ui/handler/scroll_zoom.js\n let delta;\n if (mapBrowserEvent.type == EventType.WHEEL) {\n delta = wheelEvent.deltaY;\n if (FIREFOX && wheelEvent.deltaMode === WheelEvent.DOM_DELTA_PIXEL) {\n delta /= DEVICE_PIXEL_RATIO;\n }\n if (wheelEvent.deltaMode === WheelEvent.DOM_DELTA_LINE) {\n delta *= 40;\n }\n }\n\n if (delta === 0) {\n return false;\n }\n this.lastDelta_ = delta;\n\n const now = Date.now();\n\n if (this.startTime_ === undefined) {\n this.startTime_ = now;\n }\n\n if (!this.mode_ || now - this.startTime_ > this.trackpadEventGap_) {\n this.mode_ = Math.abs(delta) < 4 ? 'trackpad' : 'wheel';\n }\n\n const view = map.getView();\n if (\n this.mode_ === 'trackpad' &&\n !(view.getConstrainResolution() || this.constrainResolution_)\n ) {\n if (this.trackpadTimeoutId_) {\n clearTimeout(this.trackpadTimeoutId_);\n } else {\n if (view.getAnimating()) {\n view.cancelAnimations();\n }\n view.beginInteraction();\n }\n this.trackpadTimeoutId_ = setTimeout(\n this.endInteraction_.bind(this),\n this.timeout_,\n );\n view.adjustZoom(-delta / this.deltaPerZoom_, this.lastAnchor_);\n this.startTime_ = now;\n return false;\n }\n\n this.totalDelta_ += delta;\n\n const timeLeft = Math.max(this.timeout_ - (now - this.startTime_), 0);\n\n clearTimeout(this.timeoutId_);\n this.timeoutId_ = setTimeout(\n this.handleWheelZoom_.bind(this, map),\n timeLeft,\n );\n\n return false;\n }\n\n /**\n * @private\n * @param {import(\"../Map.js\").default} map Map.\n */\n handleWheelZoom_(map) {\n const view = map.getView();\n if (view.getAnimating()) {\n view.cancelAnimations();\n }\n let delta =\n -clamp(\n this.totalDelta_,\n -this.maxDelta_ * this.deltaPerZoom_,\n this.maxDelta_ * this.deltaPerZoom_,\n ) / this.deltaPerZoom_;\n if (view.getConstrainResolution() || this.constrainResolution_) {\n // view has a zoom constraint, zoom by 1\n delta = delta ? (delta > 0 ? 1 : -1) : 0;\n }\n zoomByDelta(view, delta, this.lastAnchor_, this.duration_);\n\n this.mode_ = undefined;\n this.totalDelta_ = 0;\n this.lastAnchor_ = null;\n this.startTime_ = undefined;\n this.timeoutId_ = undefined;\n }\n\n /**\n * Enable or disable using the mouse's location as an anchor when zooming\n * @param {boolean} useAnchor true to zoom to the mouse's location, false\n * to zoom to the center of the map\n * @api\n */\n setMouseAnchor(useAnchor) {\n this.useAnchor_ = useAnchor;\n if (!useAnchor) {\n this.lastAnchor_ = null;\n }\n }\n}\n\nexport default MouseWheelZoom;\n","/**\n * @module ol/interaction/PinchRotate\n */\nimport PointerInteraction, {\n centroid as centroidFromPointers,\n} from './Pointer.js';\nimport {FALSE} from '../functions.js';\nimport {disable} from '../rotationconstraint.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [duration=250] The duration of the animation in\n * milliseconds.\n * @property {number} [threshold=0.3] Minimal angle in radians to start a rotation.\n */\n\n/**\n * @classdesc\n * Allows the user to rotate the map by twisting with two fingers\n * on a touch screen.\n * @api\n */\nclass PinchRotate extends PointerInteraction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const pointerOptions = /** @type {import(\"./Pointer.js\").Options} */ (\n options\n );\n\n if (!pointerOptions.stopDown) {\n pointerOptions.stopDown = FALSE;\n }\n\n super(pointerOptions);\n\n /**\n * @private\n * @type {import(\"../coordinate.js\").Coordinate}\n */\n this.anchor_ = null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.lastAngle_ = undefined;\n\n /**\n * @private\n * @type {boolean}\n */\n this.rotating_ = false;\n\n /**\n * @private\n * @type {number}\n */\n this.rotationDelta_ = 0.0;\n\n /**\n * @private\n * @type {number}\n */\n this.threshold_ = options.threshold !== undefined ? options.threshold : 0.3;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n */\n handleDragEvent(mapBrowserEvent) {\n let rotationDelta = 0.0;\n\n const touch0 = this.targetPointers[0];\n const touch1 = this.targetPointers[1];\n\n // angle between touches\n const angle = Math.atan2(\n touch1.clientY - touch0.clientY,\n touch1.clientX - touch0.clientX,\n );\n\n if (this.lastAngle_ !== undefined) {\n const delta = angle - this.lastAngle_;\n this.rotationDelta_ += delta;\n if (!this.rotating_ && Math.abs(this.rotationDelta_) > this.threshold_) {\n this.rotating_ = true;\n }\n rotationDelta = delta;\n }\n this.lastAngle_ = angle;\n\n const map = mapBrowserEvent.map;\n const view = map.getView();\n if (view.getConstraints().rotation === disable) {\n return;\n }\n\n // rotate anchor point.\n // FIXME: should be the intersection point between the lines:\n // touch0,touch1 and previousTouch0,previousTouch1\n this.anchor_ = map.getCoordinateFromPixelInternal(\n map.getEventPixel(centroidFromPointers(this.targetPointers)),\n );\n\n // rotate\n if (this.rotating_) {\n map.render();\n view.adjustRotationInternal(rotationDelta, this.anchor_);\n }\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleUpEvent(mapBrowserEvent) {\n if (this.targetPointers.length < 2) {\n const map = mapBrowserEvent.map;\n const view = map.getView();\n view.endInteraction(this.duration_);\n return false;\n }\n return true;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleDownEvent(mapBrowserEvent) {\n if (this.targetPointers.length >= 2) {\n const map = mapBrowserEvent.map;\n this.anchor_ = null;\n this.lastAngle_ = undefined;\n this.rotating_ = false;\n this.rotationDelta_ = 0.0;\n if (!this.handlingDownUpSequence) {\n map.getView().beginInteraction();\n }\n return true;\n }\n return false;\n }\n}\n\nexport default PinchRotate;\n","/**\n * @module ol/interaction/PinchZoom\n */\nimport PointerInteraction, {\n centroid as centroidFromPointers,\n} from './Pointer.js';\nimport {FALSE} from '../functions.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [duration=400] Animation duration in milliseconds.\n */\n\n/**\n * @classdesc\n * Allows the user to zoom the map by pinching with two fingers\n * on a touch screen.\n * @api\n */\nclass PinchZoom extends PointerInteraction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const pointerOptions = /** @type {import(\"./Pointer.js\").Options} */ (\n options\n );\n\n if (!pointerOptions.stopDown) {\n pointerOptions.stopDown = FALSE;\n }\n\n super(pointerOptions);\n\n /**\n * @private\n * @type {import(\"../coordinate.js\").Coordinate}\n */\n this.anchor_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 400;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.lastDistance_ = undefined;\n\n /**\n * @private\n * @type {number}\n */\n this.lastScaleDelta_ = 1;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n */\n handleDragEvent(mapBrowserEvent) {\n let scaleDelta = 1.0;\n\n const touch0 = this.targetPointers[0];\n const touch1 = this.targetPointers[1];\n const dx = touch0.clientX - touch1.clientX;\n const dy = touch0.clientY - touch1.clientY;\n\n // distance between touches\n const distance = Math.sqrt(dx * dx + dy * dy);\n\n if (this.lastDistance_ !== undefined) {\n scaleDelta = this.lastDistance_ / distance;\n }\n this.lastDistance_ = distance;\n\n const map = mapBrowserEvent.map;\n const view = map.getView();\n\n if (scaleDelta != 1.0) {\n this.lastScaleDelta_ = scaleDelta;\n }\n\n // scale anchor point.\n this.anchor_ = map.getCoordinateFromPixelInternal(\n map.getEventPixel(centroidFromPointers(this.targetPointers)),\n );\n\n // scale, bypass the resolution constraint\n map.render();\n view.adjustResolutionInternal(scaleDelta, this.anchor_);\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleUpEvent(mapBrowserEvent) {\n if (this.targetPointers.length < 2) {\n const map = mapBrowserEvent.map;\n const view = map.getView();\n const direction = this.lastScaleDelta_ > 1 ? 1 : -1;\n view.endInteraction(this.duration_, direction);\n return false;\n }\n return true;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleDownEvent(mapBrowserEvent) {\n if (this.targetPointers.length >= 2) {\n const map = mapBrowserEvent.map;\n this.anchor_ = null;\n this.lastDistance_ = undefined;\n this.lastScaleDelta_ = 1;\n if (!this.handlingDownUpSequence) {\n map.getView().beginInteraction();\n }\n return true;\n }\n return false;\n }\n}\n\nexport default PinchZoom;\n","/**\n * @module ol/Map\n */\nimport BaseObject from './Object.js';\nimport Collection from './Collection.js';\nimport CollectionEventType from './CollectionEventType.js';\nimport CompositeMapRenderer from './renderer/Composite.js';\nimport EventType from './events/EventType.js';\nimport Layer from './layer/Layer.js';\nimport LayerGroup, {GroupEvent} from './layer/Group.js';\nimport MapBrowserEvent from './MapBrowserEvent.js';\nimport MapBrowserEventHandler from './MapBrowserEventHandler.js';\nimport MapBrowserEventType from './MapBrowserEventType.js';\nimport MapEvent from './MapEvent.js';\nimport MapEventType from './MapEventType.js';\nimport MapProperty from './MapProperty.js';\nimport ObjectEventType from './ObjectEventType.js';\nimport PointerEventType from './pointer/EventType.js';\nimport RenderEventType from './render/EventType.js';\nimport TileQueue, {getTilePriority} from './TileQueue.js';\nimport View from './View.js';\nimport ViewHint from './ViewHint.js';\nimport {DEVICE_PIXEL_RATIO, PASSIVE_EVENT_LISTENERS} from './has.js';\nimport {TRUE} from './functions.js';\nimport {\n apply as applyTransform,\n create as createTransform,\n} from './transform.js';\nimport {assert} from './asserts.js';\nimport {\n clone,\n createOrUpdateEmpty,\n equals as equalsExtent,\n getForViewAndSize,\n isEmpty,\n} from './extent.js';\nimport {defaults as defaultControls} from './control/defaults.js';\nimport {defaults as defaultInteractions} from './interaction/defaults.js';\nimport {equals} from './array.js';\nimport {fromUserCoordinate, toUserCoordinate} from './proj.js';\nimport {getUid} from './util.js';\nimport {hasArea} from './size.js';\nimport {listen, unlistenByKey} from './events.js';\nimport {removeNode} from './dom.js';\nimport {warn} from './console.js';\n\n/**\n * State of the current frame. Only `pixelRatio`, `time` and `viewState` should\n * be used in applications.\n * @typedef {Object} FrameState\n * @property {number} pixelRatio The pixel ratio of the frame.\n * @property {number} time The time when rendering of the frame was requested.\n * @property {import(\"./View.js\").State} viewState The state of the current view.\n * @property {boolean} animate Animate.\n * @property {import(\"./transform.js\").Transform} coordinateToPixelTransform CoordinateToPixelTransform.\n * @property {Object|null} declutter Declutter trees by declutter group.\n * When null, no decluttering is needed because no layers have decluttering enabled.\n * @property {null|import(\"./extent.js\").Extent} extent Extent (in view projection coordinates).\n * @property {import(\"./extent.js\").Extent} [nextExtent] Next extent during an animation series.\n * @property {number} index Index.\n * @property {Array} layerStatesArray LayerStatesArray.\n * @property {number} layerIndex LayerIndex.\n * @property {import(\"./transform.js\").Transform} pixelToCoordinateTransform PixelToCoordinateTransform.\n * @property {Array} postRenderFunctions PostRenderFunctions.\n * @property {import(\"./size.js\").Size} size Size.\n * @property {TileQueue} tileQueue TileQueue.\n * @property {!Object>} usedTiles UsedTiles.\n * @property {Array} viewHints ViewHints.\n * @property {!Object>} wantedTiles WantedTiles.\n * @property {string} mapId The id of the map.\n * @property {Object} renderTargets Identifiers of previously rendered elements.\n */\n\n/**\n * @typedef {function(Map, ?FrameState): any} PostRenderFunction\n */\n\n/**\n * @typedef {Object} AtPixelOptions\n * @property {undefined|function(import(\"./layer/Layer.js\").default): boolean} [layerFilter] Layer filter\n * function. The filter function will receive one argument, the\n * {@link module:ol/layer/Layer~Layer layer-candidate} and it should return a boolean value.\n * Only layers which are visible and for which this function returns `true`\n * will be tested for features. By default, all visible layers will be tested.\n * @property {number} [hitTolerance=0] Hit-detection tolerance in css pixels. Pixels\n * inside the radius around the given position will be checked for features.\n * @property {boolean} [checkWrapped=true] Check-Wrapped Will check for wrapped geometries inside the range of\n * +/- 1 world width. Works only if a projection is used that can be wrapped.\n */\n\n/**\n * @typedef {Object} MapOptionsInternal\n * @property {Collection} [controls] Controls.\n * @property {Collection} [interactions] Interactions.\n * @property {HTMLElement|Document} keyboardEventTarget KeyboardEventTarget.\n * @property {Collection} overlays Overlays.\n * @property {Object} values Values.\n */\n\n/**\n * @typedef {import(\"./ObjectEventType\").Types|'change:layergroup'|'change:size'|'change:target'|'change:view'} MapObjectEventTypes\n */\n\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature &\n * import(\"./Observable\").CombinedOnSignature} MapEventHandler\n */\n\n/**\n * Object literal with config options for the map.\n * @typedef {Object} MapOptions\n * @property {Collection|Array} [controls]\n * Controls initially added to the map. If not specified,\n * {@link module:ol/control/defaults.defaults} is used.\n * @property {number} [pixelRatio=window.devicePixelRatio] The ratio between\n * physical pixels and device-independent pixels (dips) on the device.\n * @property {Collection|Array} [interactions]\n * Interactions that are initially added to the map. If not specified,\n * {@link module:ol/interaction/defaults.defaults} is used.\n * @property {HTMLElement|Document|string} [keyboardEventTarget] The element to\n * listen to keyboard events on. This determines when the `KeyboardPan` and\n * `KeyboardZoom` interactions trigger. For example, if this option is set to\n * `document` the keyboard interactions will always trigger. If this option is\n * not specified, the element the library listens to keyboard events on is the\n * map target (i.e. the user-provided div for the map). If this is not\n * `document`, the target element needs to be focused for key events to be\n * emitted, requiring that the target element has a `tabindex` attribute.\n * @property {Array|Collection|LayerGroup} [layers]\n * Layers. If this is not defined, a map with no layers will be rendered. Note\n * that layers are rendered in the order supplied, so if you want, for example,\n * a vector layer to appear on top of a tile layer, it must come after the tile\n * layer.\n * @property {number} [maxTilesLoading=16] Maximum number tiles to load\n * simultaneously.\n * @property {number} [moveTolerance=1] The minimum distance in pixels the\n * cursor must move to be detected as a map move event instead of a click.\n * Increasing this value can make it easier to click on the map.\n * @property {Collection|Array} [overlays]\n * Overlays initially added to the map. By default, no overlays are added.\n * @property {HTMLElement|string} [target] The container for the map, either the\n * element itself or the `id` of the element. If not specified at construction\n * time, {@link module:ol/Map~Map#setTarget} must be called for the map to be\n * rendered. If passed by element, the container can be in a secondary document.\n * **Note:** CSS `transform` support for the target element is limited to `scale`.\n * @property {View|Promise} [view] The map's view. No layer sources will be\n * fetched unless this is specified at construction time or through\n * {@link module:ol/Map~Map#setView}.\n */\n\n/**\n * @param {import(\"./layer/Base.js\").default} layer Layer.\n */\nfunction removeLayerMapProperty(layer) {\n if (layer instanceof Layer) {\n layer.setMapInternal(null);\n return;\n }\n if (layer instanceof LayerGroup) {\n layer.getLayers().forEach(removeLayerMapProperty);\n }\n}\n\n/**\n * @param {import(\"./layer/Base.js\").default} layer Layer.\n * @param {Map} map Map.\n */\nfunction setLayerMapProperty(layer, map) {\n if (layer instanceof Layer) {\n layer.setMapInternal(map);\n return;\n }\n if (layer instanceof LayerGroup) {\n const layers = layer.getLayers().getArray();\n for (let i = 0, ii = layers.length; i < ii; ++i) {\n setLayerMapProperty(layers[i], map);\n }\n }\n}\n\n/**\n * @classdesc\n * The map is the core component of OpenLayers. For a map to render, a view,\n * one or more layers, and a target container are needed:\n *\n * import Map from 'ol/Map.js';\n * import View from 'ol/View.js';\n * import TileLayer from 'ol/layer/Tile.js';\n * import OSM from 'ol/source/OSM.js';\n *\n * const map = new Map({\n * view: new View({\n * center: [0, 0],\n * zoom: 1,\n * }),\n * layers: [\n * new TileLayer({\n * source: new OSM(),\n * }),\n * ],\n * target: 'map',\n * });\n *\n * The above snippet creates a map using a {@link module:ol/layer/Tile~TileLayer} to\n * display {@link module:ol/source/OSM~OSM} OSM data and render it to a DOM\n * element with the id `map`.\n *\n * The constructor places a viewport container (with CSS class name\n * `ol-viewport`) in the target element (see `getViewport()`), and then two\n * further elements within the viewport: one with CSS class name\n * `ol-overlaycontainer-stopevent` for controls and some overlays, and one with\n * CSS class name `ol-overlaycontainer` for other overlays (see the `stopEvent`\n * option of {@link module:ol/Overlay~Overlay} for the difference). The map\n * itself is placed in a further element within the viewport.\n *\n * Layers are stored as a {@link module:ol/Collection~Collection} in\n * layerGroups. A top-level group is provided by the library. This is what is\n * accessed by `getLayerGroup` and `setLayerGroup`. Layers entered in the\n * options are added to this group, and `addLayer` and `removeLayer` change the\n * layer collection in the group. `getLayers` is a convenience function for\n * `getLayerGroup().getLayers()`. Note that {@link module:ol/layer/Group~LayerGroup}\n * is a subclass of {@link module:ol/layer/Base~BaseLayer}, so layers entered in the\n * options or added with `addLayer` can be groups, which can contain further\n * groups, and so on.\n *\n * @fires import(\"./MapBrowserEvent.js\").MapBrowserEvent\n * @fires import(\"./MapEvent.js\").MapEvent\n * @fires import(\"./render/Event.js\").default#precompose\n * @fires import(\"./render/Event.js\").default#postcompose\n * @fires import(\"./render/Event.js\").default#rendercomplete\n * @api\n */\nclass Map extends BaseObject {\n /**\n * @param {MapOptions} [options] Map options.\n */\n constructor(options) {\n super();\n\n options = options || {};\n\n /***\n * @type {MapEventHandler}\n */\n this.on;\n\n /***\n * @type {MapEventHandler}\n */\n this.once;\n\n /***\n * @type {MapEventHandler}\n */\n this.un;\n\n const optionsInternal = createOptionsInternal(options);\n\n /**\n * @private\n * @type {boolean|undefined}\n */\n this.renderComplete_;\n\n /**\n * @private\n * @type {boolean}\n */\n this.loaded_ = true;\n\n /** @private */\n this.boundHandleBrowserEvent_ = this.handleBrowserEvent.bind(this);\n\n /**\n * @type {number}\n * @private\n */\n this.maxTilesLoading_ =\n options.maxTilesLoading !== undefined ? options.maxTilesLoading : 16;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelRatio_ =\n options.pixelRatio !== undefined\n ? options.pixelRatio\n : DEVICE_PIXEL_RATIO;\n\n /**\n * @private\n * @type {ReturnType}\n */\n this.postRenderTimeoutHandle_;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.animationDelayKey_;\n\n /**\n * @private\n */\n this.animationDelay_ = this.animationDelay_.bind(this);\n\n /**\n * @private\n * @type {import(\"./transform.js\").Transform}\n */\n this.coordinateToPixelTransform_ = createTransform();\n\n /**\n * @private\n * @type {import(\"./transform.js\").Transform}\n */\n this.pixelToCoordinateTransform_ = createTransform();\n\n /**\n * @private\n * @type {number}\n */\n this.frameIndex_ = 0;\n\n /**\n * @private\n * @type {?FrameState}\n */\n this.frameState_ = null;\n\n /**\n * The extent at the previous 'moveend' event.\n * @private\n * @type {import(\"./extent.js\").Extent}\n */\n this.previousExtent_ = null;\n\n /**\n * @private\n * @type {?import(\"./events.js\").EventsKey}\n */\n this.viewPropertyListenerKey_ = null;\n\n /**\n * @private\n * @type {?import(\"./events.js\").EventsKey}\n */\n this.viewChangeListenerKey_ = null;\n\n /**\n * @private\n * @type {?Array}\n */\n this.layerGroupPropertyListenerKeys_ = null;\n\n /**\n * @private\n * @type {!HTMLElement}\n */\n this.viewport_ = document.createElement('div');\n this.viewport_.className =\n 'ol-viewport' + ('ontouchstart' in window ? ' ol-touch' : '');\n this.viewport_.style.position = 'relative';\n this.viewport_.style.overflow = 'hidden';\n this.viewport_.style.width = '100%';\n this.viewport_.style.height = '100%';\n\n /**\n * @private\n * @type {!HTMLElement}\n */\n this.overlayContainer_ = document.createElement('div');\n this.overlayContainer_.style.position = 'absolute';\n this.overlayContainer_.style.zIndex = '0';\n this.overlayContainer_.style.width = '100%';\n this.overlayContainer_.style.height = '100%';\n this.overlayContainer_.style.pointerEvents = 'none';\n this.overlayContainer_.className = 'ol-overlaycontainer';\n this.viewport_.appendChild(this.overlayContainer_);\n\n /**\n * @private\n * @type {!HTMLElement}\n */\n this.overlayContainerStopEvent_ = document.createElement('div');\n this.overlayContainerStopEvent_.style.position = 'absolute';\n this.overlayContainerStopEvent_.style.zIndex = '0';\n this.overlayContainerStopEvent_.style.width = '100%';\n this.overlayContainerStopEvent_.style.height = '100%';\n this.overlayContainerStopEvent_.style.pointerEvents = 'none';\n this.overlayContainerStopEvent_.className = 'ol-overlaycontainer-stopevent';\n this.viewport_.appendChild(this.overlayContainerStopEvent_);\n\n /**\n * @private\n * @type {MapBrowserEventHandler}\n */\n this.mapBrowserEventHandler_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.moveTolerance_ = options.moveTolerance;\n\n /**\n * @private\n * @type {HTMLElement|Document}\n */\n this.keyboardEventTarget_ = optionsInternal.keyboardEventTarget;\n\n /**\n * @private\n * @type {?Array}\n */\n this.targetChangeHandlerKeys_ = null;\n\n /**\n * @private\n * @type {HTMLElement|null}\n */\n this.targetElement_ = null;\n\n /**\n * @type {ResizeObserver}\n */\n this.resizeObserver_ = new ResizeObserver(() => this.updateSize());\n\n /**\n * @type {Collection}\n * @protected\n */\n this.controls = optionsInternal.controls || defaultControls();\n\n /**\n * @type {Collection}\n * @protected\n */\n this.interactions =\n optionsInternal.interactions ||\n defaultInteractions({\n onFocusOnly: true,\n });\n\n /**\n * @type {Collection}\n * @private\n */\n this.overlays_ = optionsInternal.overlays;\n\n /**\n * A lookup of overlays by id.\n * @private\n * @type {Object}\n */\n this.overlayIdIndex_ = {};\n\n /**\n * @type {import(\"./renderer/Map.js\").default|null}\n * @private\n */\n this.renderer_ = null;\n\n /**\n * @private\n * @type {!Array}\n */\n this.postRenderFunctions_ = [];\n\n /**\n * @private\n * @type {TileQueue}\n */\n this.tileQueue_ = new TileQueue(\n this.getTilePriority.bind(this),\n this.handleTileChange_.bind(this),\n );\n\n this.addChangeListener(\n MapProperty.LAYERGROUP,\n this.handleLayerGroupChanged_,\n );\n this.addChangeListener(MapProperty.VIEW, this.handleViewChanged_);\n this.addChangeListener(MapProperty.SIZE, this.handleSizeChanged_);\n this.addChangeListener(MapProperty.TARGET, this.handleTargetChanged_);\n\n // setProperties will trigger the rendering of the map if the map\n // is \"defined\" already.\n this.setProperties(optionsInternal.values);\n\n const map = this;\n if (options.view && !(options.view instanceof View)) {\n options.view.then(function (viewOptions) {\n map.setView(new View(viewOptions));\n });\n }\n\n this.controls.addEventListener(\n CollectionEventType.ADD,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent\n */\n (event) => {\n event.element.setMap(this);\n },\n );\n\n this.controls.addEventListener(\n CollectionEventType.REMOVE,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent.\n */\n (event) => {\n event.element.setMap(null);\n },\n );\n\n this.interactions.addEventListener(\n CollectionEventType.ADD,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent.\n */\n (event) => {\n event.element.setMap(this);\n },\n );\n\n this.interactions.addEventListener(\n CollectionEventType.REMOVE,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent.\n */\n (event) => {\n event.element.setMap(null);\n },\n );\n\n this.overlays_.addEventListener(\n CollectionEventType.ADD,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent.\n */\n (event) => {\n this.addOverlayInternal_(event.element);\n },\n );\n\n this.overlays_.addEventListener(\n CollectionEventType.REMOVE,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent.\n */\n (event) => {\n const id = event.element.getId();\n if (id !== undefined) {\n delete this.overlayIdIndex_[id.toString()];\n }\n event.element.setMap(null);\n },\n );\n\n this.controls.forEach(\n /**\n * @param {import(\"./control/Control.js\").default} control Control.\n */\n (control) => {\n control.setMap(this);\n },\n );\n\n this.interactions.forEach(\n /**\n * @param {import(\"./interaction/Interaction.js\").default} interaction Interaction.\n */\n (interaction) => {\n interaction.setMap(this);\n },\n );\n\n this.overlays_.forEach(this.addOverlayInternal_.bind(this));\n }\n\n /**\n * Add the given control to the map.\n * @param {import(\"./control/Control.js\").default} control Control.\n * @api\n */\n addControl(control) {\n this.getControls().push(control);\n }\n\n /**\n * Add the given interaction to the map. If you want to add an interaction\n * at another point of the collection use `getInteractions()` and the methods\n * available on {@link module:ol/Collection~Collection}. This can be used to\n * stop the event propagation from the handleEvent function. The interactions\n * get to handle the events in the reverse order of this collection.\n * @param {import(\"./interaction/Interaction.js\").default} interaction Interaction to add.\n * @api\n */\n addInteraction(interaction) {\n this.getInteractions().push(interaction);\n }\n\n /**\n * Adds the given layer to the top of this map. If you want to add a layer\n * elsewhere in the stack, use `getLayers()` and the methods available on\n * {@link module:ol/Collection~Collection}.\n * @param {import(\"./layer/Base.js\").default} layer Layer.\n * @api\n */\n addLayer(layer) {\n const layers = this.getLayerGroup().getLayers();\n layers.push(layer);\n }\n\n /**\n * @param {import(\"./layer/Group.js\").GroupEvent} event The layer add event.\n * @private\n */\n handleLayerAdd_(event) {\n setLayerMapProperty(event.layer, this);\n }\n\n /**\n * Add the given overlay to the map.\n * @param {import(\"./Overlay.js\").default} overlay Overlay.\n * @api\n */\n addOverlay(overlay) {\n this.getOverlays().push(overlay);\n }\n\n /**\n * This deals with map's overlay collection changes.\n * @param {import(\"./Overlay.js\").default} overlay Overlay.\n * @private\n */\n addOverlayInternal_(overlay) {\n const id = overlay.getId();\n if (id !== undefined) {\n this.overlayIdIndex_[id.toString()] = overlay;\n }\n overlay.setMap(this);\n }\n\n /**\n *\n * Clean up.\n */\n disposeInternal() {\n this.controls.clear();\n this.interactions.clear();\n this.overlays_.clear();\n this.resizeObserver_.disconnect();\n this.setTarget(null);\n super.disposeInternal();\n }\n\n /**\n * Detect features that intersect a pixel on the viewport, and execute a\n * callback with each intersecting feature. Layers included in the detection can\n * be configured through the `layerFilter` option in `options`.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel.\n * @param {function(import(\"./Feature.js\").FeatureLike, import(\"./layer/Layer.js\").default, import(\"./geom/SimpleGeometry.js\").default): T} callback Feature callback. The callback will be\n * called with two arguments. The first argument is one\n * {@link module:ol/Feature~Feature feature} or\n * {@link module:ol/render/Feature~RenderFeature render feature} at the pixel, the second is\n * the {@link module:ol/layer/Layer~Layer layer} of the feature and will be null for\n * unmanaged layers. To stop detection, callback functions can return a\n * truthy value.\n * @param {AtPixelOptions} [options] Optional options.\n * @return {T|undefined} Callback result, i.e. the return value of last\n * callback execution, or the first truthy callback return value.\n * @template T\n * @api\n */\n forEachFeatureAtPixel(pixel, callback, options) {\n if (!this.frameState_ || !this.renderer_) {\n return;\n }\n const coordinate = this.getCoordinateFromPixelInternal(pixel);\n options = options !== undefined ? options : {};\n const hitTolerance =\n options.hitTolerance !== undefined ? options.hitTolerance : 0;\n const layerFilter =\n options.layerFilter !== undefined ? options.layerFilter : TRUE;\n const checkWrapped = options.checkWrapped !== false;\n return this.renderer_.forEachFeatureAtCoordinate(\n coordinate,\n this.frameState_,\n hitTolerance,\n checkWrapped,\n callback,\n null,\n layerFilter,\n null,\n );\n }\n\n /**\n * Get all features that intersect a pixel on the viewport.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel.\n * @param {AtPixelOptions} [options] Optional options.\n * @return {Array} The detected features or\n * an empty array if none were found.\n * @api\n */\n getFeaturesAtPixel(pixel, options) {\n const features = [];\n this.forEachFeatureAtPixel(\n pixel,\n function (feature) {\n features.push(feature);\n },\n options,\n );\n return features;\n }\n\n /**\n * Get all layers from all layer groups.\n * @return {Array} Layers.\n * @api\n */\n getAllLayers() {\n const layers = [];\n function addLayersFrom(layerGroup) {\n layerGroup.forEach(function (layer) {\n if (layer instanceof LayerGroup) {\n addLayersFrom(layer.getLayers());\n } else {\n layers.push(layer);\n }\n });\n }\n addLayersFrom(this.getLayers());\n return layers;\n }\n\n /**\n * Detect if features intersect a pixel on the viewport. Layers included in the\n * detection can be configured through the `layerFilter` option.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel.\n * @param {AtPixelOptions} [options] Optional options.\n * @return {boolean} Is there a feature at the given pixel?\n * @api\n */\n hasFeatureAtPixel(pixel, options) {\n if (!this.frameState_ || !this.renderer_) {\n return false;\n }\n const coordinate = this.getCoordinateFromPixelInternal(pixel);\n options = options !== undefined ? options : {};\n const layerFilter =\n options.layerFilter !== undefined ? options.layerFilter : TRUE;\n const hitTolerance =\n options.hitTolerance !== undefined ? options.hitTolerance : 0;\n const checkWrapped = options.checkWrapped !== false;\n return this.renderer_.hasFeatureAtCoordinate(\n coordinate,\n this.frameState_,\n hitTolerance,\n checkWrapped,\n layerFilter,\n null,\n );\n }\n\n /**\n * Returns the coordinate in user projection for a browser event.\n * @param {MouseEvent} event Event.\n * @return {import(\"./coordinate.js\").Coordinate} Coordinate.\n * @api\n */\n getEventCoordinate(event) {\n return this.getCoordinateFromPixel(this.getEventPixel(event));\n }\n\n /**\n * Returns the coordinate in view projection for a browser event.\n * @param {MouseEvent} event Event.\n * @return {import(\"./coordinate.js\").Coordinate} Coordinate.\n */\n getEventCoordinateInternal(event) {\n return this.getCoordinateFromPixelInternal(this.getEventPixel(event));\n }\n\n /**\n * Returns the map pixel position for a browser event relative to the viewport.\n * @param {UIEvent|{clientX: number, clientY: number}} event Event.\n * @return {import(\"./pixel.js\").Pixel} Pixel.\n * @api\n */\n getEventPixel(event) {\n const viewport = this.viewport_;\n const viewportPosition = viewport.getBoundingClientRect();\n const viewportSize = this.getSize();\n const scaleX = viewportPosition.width / viewportSize[0];\n const scaleY = viewportPosition.height / viewportSize[1];\n const eventPosition =\n //FIXME Are we really calling this with a TouchEvent anywhere?\n 'changedTouches' in event\n ? /** @type {TouchEvent} */ (event).changedTouches[0]\n : /** @type {MouseEvent} */ (event);\n\n return [\n (eventPosition.clientX - viewportPosition.left) / scaleX,\n (eventPosition.clientY - viewportPosition.top) / scaleY,\n ];\n }\n\n /**\n * Get the target in which this map is rendered.\n * Note that this returns what is entered as an option or in setTarget:\n * if that was an element, it returns an element; if a string, it returns that.\n * @return {HTMLElement|string|undefined} The Element or id of the Element that the\n * map is rendered in.\n * @observable\n * @api\n */\n getTarget() {\n return /** @type {HTMLElement|string|undefined} */ (\n this.get(MapProperty.TARGET)\n );\n }\n\n /**\n * Get the DOM element into which this map is rendered. In contrast to\n * `getTarget` this method always return an `Element`, or `null` if the\n * map has no target.\n * @return {HTMLElement} The element that the map is rendered in.\n * @api\n */\n getTargetElement() {\n return this.targetElement_;\n }\n\n /**\n * Get the coordinate for a given pixel. This returns a coordinate in the\n * user projection.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel position in the map viewport.\n * @return {import(\"./coordinate.js\").Coordinate} The coordinate for the pixel position.\n * @api\n */\n getCoordinateFromPixel(pixel) {\n return toUserCoordinate(\n this.getCoordinateFromPixelInternal(pixel),\n this.getView().getProjection(),\n );\n }\n\n /**\n * Get the coordinate for a given pixel. This returns a coordinate in the\n * map view projection.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel position in the map viewport.\n * @return {import(\"./coordinate.js\").Coordinate} The coordinate for the pixel position.\n */\n getCoordinateFromPixelInternal(pixel) {\n const frameState = this.frameState_;\n if (!frameState) {\n return null;\n }\n return applyTransform(frameState.pixelToCoordinateTransform, pixel.slice());\n }\n\n /**\n * Get the map controls. Modifying this collection changes the controls\n * associated with the map.\n * @return {Collection} Controls.\n * @api\n */\n getControls() {\n return this.controls;\n }\n\n /**\n * Get the map overlays. Modifying this collection changes the overlays\n * associated with the map.\n * @return {Collection} Overlays.\n * @api\n */\n getOverlays() {\n return this.overlays_;\n }\n\n /**\n * Get an overlay by its identifier (the value returned by overlay.getId()).\n * Note that the index treats string and numeric identifiers as the same. So\n * `map.getOverlayById(2)` will return an overlay with id `'2'` or `2`.\n * @param {string|number} id Overlay identifier.\n * @return {import(\"./Overlay.js\").default|null} Overlay.\n * @api\n */\n getOverlayById(id) {\n const overlay = this.overlayIdIndex_[id.toString()];\n return overlay !== undefined ? overlay : null;\n }\n\n /**\n * Get the map interactions. Modifying this collection changes the interactions\n * associated with the map.\n *\n * Interactions are used for e.g. pan, zoom and rotate.\n * @return {Collection} Interactions.\n * @api\n */\n getInteractions() {\n return this.interactions;\n }\n\n /**\n * Get the layergroup associated with this map.\n * @return {LayerGroup} A layer group containing the layers in this map.\n * @observable\n * @api\n */\n getLayerGroup() {\n return /** @type {LayerGroup} */ (this.get(MapProperty.LAYERGROUP));\n }\n\n /**\n * Clear any existing layers and add layers to the map.\n * @param {Array|Collection} layers The layers to be added to the map.\n * @api\n */\n setLayers(layers) {\n const group = this.getLayerGroup();\n if (layers instanceof Collection) {\n group.setLayers(layers);\n return;\n }\n\n const collection = group.getLayers();\n collection.clear();\n collection.extend(layers);\n }\n\n /**\n * Get the collection of layers associated with this map.\n * @return {!Collection} Layers.\n * @api\n */\n getLayers() {\n const layers = this.getLayerGroup().getLayers();\n return layers;\n }\n\n /**\n * @return {boolean} Layers have sources that are still loading.\n */\n getLoadingOrNotReady() {\n const layerStatesArray = this.getLayerGroup().getLayerStatesArray();\n for (let i = 0, ii = layerStatesArray.length; i < ii; ++i) {\n const state = layerStatesArray[i];\n if (!state.visible) {\n continue;\n }\n const renderer = state.layer.getRenderer();\n if (renderer && !renderer.ready) {\n return true;\n }\n const source = state.layer.getSource();\n if (source && source.loading) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Get the pixel for a coordinate. This takes a coordinate in the user\n * projection and returns the corresponding pixel.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate A map coordinate.\n * @return {import(\"./pixel.js\").Pixel} A pixel position in the map viewport.\n * @api\n */\n getPixelFromCoordinate(coordinate) {\n const viewCoordinate = fromUserCoordinate(\n coordinate,\n this.getView().getProjection(),\n );\n return this.getPixelFromCoordinateInternal(viewCoordinate);\n }\n\n /**\n * Get the pixel for a coordinate. This takes a coordinate in the map view\n * projection and returns the corresponding pixel.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate A map coordinate.\n * @return {import(\"./pixel.js\").Pixel} A pixel position in the map viewport.\n */\n getPixelFromCoordinateInternal(coordinate) {\n const frameState = this.frameState_;\n if (!frameState) {\n return null;\n }\n return applyTransform(\n frameState.coordinateToPixelTransform,\n coordinate.slice(0, 2),\n );\n }\n\n /**\n * Get the map renderer.\n * @return {import(\"./renderer/Map.js\").default|null} Renderer\n */\n getRenderer() {\n return this.renderer_;\n }\n\n /**\n * Get the size of this map.\n * @return {import(\"./size.js\").Size|undefined} The size in pixels of the map in the DOM.\n * @observable\n * @api\n */\n getSize() {\n return /** @type {import(\"./size.js\").Size|undefined} */ (\n this.get(MapProperty.SIZE)\n );\n }\n\n /**\n * Get the view associated with this map. A view manages properties such as\n * center and resolution.\n * @return {View} The view that controls this map.\n * @observable\n * @api\n */\n getView() {\n return /** @type {View} */ (this.get(MapProperty.VIEW));\n }\n\n /**\n * Get the element that serves as the map viewport.\n * @return {HTMLElement} Viewport.\n * @api\n */\n getViewport() {\n return this.viewport_;\n }\n\n /**\n * Get the element that serves as the container for overlays. Elements added to\n * this container will let mousedown and touchstart events through to the map,\n * so clicks and gestures on an overlay will trigger {@link module:ol/MapBrowserEvent~MapBrowserEvent}\n * events.\n * @return {!HTMLElement} The map's overlay container.\n */\n getOverlayContainer() {\n return this.overlayContainer_;\n }\n\n /**\n * Get the element that serves as a container for overlays that don't allow\n * event propagation. Elements added to this container won't let mousedown and\n * touchstart events through to the map, so clicks and gestures on an overlay\n * don't trigger any {@link module:ol/MapBrowserEvent~MapBrowserEvent}.\n * @return {!HTMLElement} The map's overlay container that stops events.\n */\n getOverlayContainerStopEvent() {\n return this.overlayContainerStopEvent_;\n }\n\n /**\n * @return {!Document} The document where the map is displayed.\n */\n getOwnerDocument() {\n const targetElement = this.getTargetElement();\n return targetElement ? targetElement.ownerDocument : document;\n }\n\n /**\n * @param {import(\"./Tile.js\").default} tile Tile.\n * @param {string} tileSourceKey Tile source key.\n * @param {import(\"./coordinate.js\").Coordinate} tileCenter Tile center.\n * @param {number} tileResolution Tile resolution.\n * @return {number} Tile priority.\n */\n getTilePriority(tile, tileSourceKey, tileCenter, tileResolution) {\n return getTilePriority(\n this.frameState_,\n tile,\n tileSourceKey,\n tileCenter,\n tileResolution,\n );\n }\n\n /**\n * @param {UIEvent} browserEvent Browser event.\n * @param {string} [type] Type.\n */\n handleBrowserEvent(browserEvent, type) {\n type = type || browserEvent.type;\n const mapBrowserEvent = new MapBrowserEvent(type, this, browserEvent);\n this.handleMapBrowserEvent(mapBrowserEvent);\n }\n\n /**\n * @param {MapBrowserEvent} mapBrowserEvent The event to handle.\n */\n handleMapBrowserEvent(mapBrowserEvent) {\n if (!this.frameState_) {\n // With no view defined, we cannot translate pixels into geographical\n // coordinates so interactions cannot be used.\n return;\n }\n const originalEvent = /** @type {PointerEvent} */ (\n mapBrowserEvent.originalEvent\n );\n const eventType = originalEvent.type;\n if (\n eventType === PointerEventType.POINTERDOWN ||\n eventType === EventType.WHEEL ||\n eventType === EventType.KEYDOWN\n ) {\n const doc = this.getOwnerDocument();\n const rootNode = this.viewport_.getRootNode\n ? this.viewport_.getRootNode()\n : doc;\n const target = /** @type {Node} */ (originalEvent.target);\n if (\n // Abort if the target is a child of the container for elements whose events are not meant\n // to be handled by map interactions.\n this.overlayContainerStopEvent_.contains(target) ||\n // Abort if the event target is a child of the container that is no longer in the page.\n // It's possible for the target to no longer be in the page if it has been removed in an\n // event listener, this might happen in a Control that recreates it's content based on\n // user interaction either manually or via a render in something like https://reactjs.org/\n !(rootNode === doc ? doc.documentElement : rootNode).contains(target)\n ) {\n return;\n }\n }\n mapBrowserEvent.frameState = this.frameState_;\n if (this.dispatchEvent(mapBrowserEvent) !== false) {\n const interactionsArray = this.getInteractions().getArray().slice();\n for (let i = interactionsArray.length - 1; i >= 0; i--) {\n const interaction = interactionsArray[i];\n if (\n interaction.getMap() !== this ||\n !interaction.getActive() ||\n !this.getTargetElement()\n ) {\n continue;\n }\n const cont = interaction.handleEvent(mapBrowserEvent);\n if (!cont || mapBrowserEvent.propagationStopped) {\n break;\n }\n }\n }\n }\n\n /**\n * @protected\n */\n handlePostRender() {\n const frameState = this.frameState_;\n\n // Manage the tile queue\n // Image loads are expensive and a limited resource, so try to use them\n // efficiently:\n // * When the view is static we allow a large number of parallel tile loads\n // to complete the frame as quickly as possible.\n // * When animating or interacting, image loads can cause janks, so we reduce\n // the maximum number of loads per frame and limit the number of parallel\n // tile loads to remain reactive to view changes and to reduce the chance of\n // loading tiles that will quickly disappear from view.\n const tileQueue = this.tileQueue_;\n if (!tileQueue.isEmpty()) {\n let maxTotalLoading = this.maxTilesLoading_;\n let maxNewLoads = maxTotalLoading;\n if (frameState) {\n const hints = frameState.viewHints;\n if (hints[ViewHint.ANIMATING] || hints[ViewHint.INTERACTING]) {\n const lowOnFrameBudget = Date.now() - frameState.time > 8;\n maxTotalLoading = lowOnFrameBudget ? 0 : 8;\n maxNewLoads = lowOnFrameBudget ? 0 : 2;\n }\n }\n if (tileQueue.getTilesLoading() < maxTotalLoading) {\n tileQueue.reprioritize(); // FIXME only call if view has changed\n tileQueue.loadMoreTiles(maxTotalLoading, maxNewLoads);\n }\n }\n\n if (frameState && this.renderer_ && !frameState.animate) {\n if (this.renderComplete_ === true) {\n if (this.hasListener(RenderEventType.RENDERCOMPLETE)) {\n this.renderer_.dispatchRenderEvent(\n RenderEventType.RENDERCOMPLETE,\n frameState,\n );\n }\n if (this.loaded_ === false) {\n this.loaded_ = true;\n this.dispatchEvent(\n new MapEvent(MapEventType.LOADEND, this, frameState),\n );\n }\n } else if (this.loaded_ === true) {\n this.loaded_ = false;\n this.dispatchEvent(\n new MapEvent(MapEventType.LOADSTART, this, frameState),\n );\n }\n }\n\n const postRenderFunctions = this.postRenderFunctions_;\n for (let i = 0, ii = postRenderFunctions.length; i < ii; ++i) {\n postRenderFunctions[i](this, frameState);\n }\n postRenderFunctions.length = 0;\n }\n\n /**\n * @private\n */\n handleSizeChanged_() {\n if (this.getView() && !this.getView().getAnimating()) {\n this.getView().resolveConstraints(0);\n }\n\n this.render();\n }\n\n /**\n * @private\n */\n handleTargetChanged_() {\n if (this.mapBrowserEventHandler_) {\n for (let i = 0, ii = this.targetChangeHandlerKeys_.length; i < ii; ++i) {\n unlistenByKey(this.targetChangeHandlerKeys_[i]);\n }\n this.targetChangeHandlerKeys_ = null;\n this.viewport_.removeEventListener(\n EventType.CONTEXTMENU,\n this.boundHandleBrowserEvent_,\n );\n this.viewport_.removeEventListener(\n EventType.WHEEL,\n this.boundHandleBrowserEvent_,\n );\n this.mapBrowserEventHandler_.dispose();\n this.mapBrowserEventHandler_ = null;\n removeNode(this.viewport_);\n }\n\n if (this.targetElement_) {\n this.resizeObserver_.unobserve(this.targetElement_);\n const rootNode = this.targetElement_.getRootNode();\n if (rootNode instanceof ShadowRoot) {\n this.resizeObserver_.unobserve(rootNode.host);\n }\n this.setSize(undefined);\n }\n\n // target may be undefined, null, a string or an Element.\n // If it's a string we convert it to an Element before proceeding.\n // If it's not now an Element we remove the viewport from the DOM.\n // If it's an Element we append the viewport element to it.\n\n const target = this.getTarget();\n const targetElement =\n typeof target === 'string' ? document.getElementById(target) : target;\n this.targetElement_ = targetElement;\n if (!targetElement) {\n if (this.renderer_) {\n clearTimeout(this.postRenderTimeoutHandle_);\n this.postRenderTimeoutHandle_ = undefined;\n this.postRenderFunctions_.length = 0;\n this.renderer_.dispose();\n this.renderer_ = null;\n }\n if (this.animationDelayKey_) {\n cancelAnimationFrame(this.animationDelayKey_);\n this.animationDelayKey_ = undefined;\n }\n } else {\n targetElement.appendChild(this.viewport_);\n if (!this.renderer_) {\n this.renderer_ = new CompositeMapRenderer(this);\n }\n\n this.mapBrowserEventHandler_ = new MapBrowserEventHandler(\n this,\n this.moveTolerance_,\n );\n for (const key in MapBrowserEventType) {\n this.mapBrowserEventHandler_.addEventListener(\n MapBrowserEventType[key],\n this.handleMapBrowserEvent.bind(this),\n );\n }\n this.viewport_.addEventListener(\n EventType.CONTEXTMENU,\n this.boundHandleBrowserEvent_,\n false,\n );\n this.viewport_.addEventListener(\n EventType.WHEEL,\n this.boundHandleBrowserEvent_,\n PASSIVE_EVENT_LISTENERS ? {passive: false} : false,\n );\n\n const keyboardEventTarget = !this.keyboardEventTarget_\n ? targetElement\n : this.keyboardEventTarget_;\n this.targetChangeHandlerKeys_ = [\n listen(\n keyboardEventTarget,\n EventType.KEYDOWN,\n this.handleBrowserEvent,\n this,\n ),\n listen(\n keyboardEventTarget,\n EventType.KEYPRESS,\n this.handleBrowserEvent,\n this,\n ),\n ];\n const rootNode = targetElement.getRootNode();\n if (rootNode instanceof ShadowRoot) {\n this.resizeObserver_.observe(rootNode.host);\n }\n this.resizeObserver_.observe(targetElement);\n }\n\n this.updateSize();\n // updateSize calls setSize, so no need to call this.render\n // ourselves here.\n }\n\n /**\n * @private\n */\n handleTileChange_() {\n this.render();\n }\n\n /**\n * @private\n */\n handleViewPropertyChanged_() {\n this.render();\n }\n\n /**\n * @private\n */\n handleViewChanged_() {\n if (this.viewPropertyListenerKey_) {\n unlistenByKey(this.viewPropertyListenerKey_);\n this.viewPropertyListenerKey_ = null;\n }\n if (this.viewChangeListenerKey_) {\n unlistenByKey(this.viewChangeListenerKey_);\n this.viewChangeListenerKey_ = null;\n }\n const view = this.getView();\n if (view) {\n this.updateViewportSize_(this.getSize());\n\n this.viewPropertyListenerKey_ = listen(\n view,\n ObjectEventType.PROPERTYCHANGE,\n this.handleViewPropertyChanged_,\n this,\n );\n this.viewChangeListenerKey_ = listen(\n view,\n EventType.CHANGE,\n this.handleViewPropertyChanged_,\n this,\n );\n\n view.resolveConstraints(0);\n }\n this.render();\n }\n\n /**\n * @private\n */\n handleLayerGroupChanged_() {\n if (this.layerGroupPropertyListenerKeys_) {\n this.layerGroupPropertyListenerKeys_.forEach(unlistenByKey);\n this.layerGroupPropertyListenerKeys_ = null;\n }\n const layerGroup = this.getLayerGroup();\n if (layerGroup) {\n this.handleLayerAdd_(new GroupEvent('addlayer', layerGroup));\n this.layerGroupPropertyListenerKeys_ = [\n listen(layerGroup, ObjectEventType.PROPERTYCHANGE, this.render, this),\n listen(layerGroup, EventType.CHANGE, this.render, this),\n listen(layerGroup, 'addlayer', this.handleLayerAdd_, this),\n listen(layerGroup, 'removelayer', this.handleLayerRemove_, this),\n ];\n }\n this.render();\n }\n\n /**\n * @return {boolean} Is rendered.\n */\n isRendered() {\n return !!this.frameState_;\n }\n\n /**\n * @private\n */\n animationDelay_() {\n this.animationDelayKey_ = undefined;\n this.renderFrame_(Date.now());\n }\n\n /**\n * Requests an immediate render in a synchronous manner.\n * @api\n */\n renderSync() {\n if (this.animationDelayKey_) {\n cancelAnimationFrame(this.animationDelayKey_);\n }\n this.animationDelay_();\n }\n\n /**\n * Redraws all text after new fonts have loaded\n */\n redrawText() {\n const layerStates = this.getLayerGroup().getLayerStatesArray();\n for (let i = 0, ii = layerStates.length; i < ii; ++i) {\n const layer = layerStates[i].layer;\n if (layer.hasRenderer()) {\n layer.getRenderer().handleFontsChanged();\n }\n }\n }\n\n /**\n * Request a map rendering (at the next animation frame).\n * @api\n */\n render() {\n if (this.renderer_ && this.animationDelayKey_ === undefined) {\n this.animationDelayKey_ = requestAnimationFrame(this.animationDelay_);\n }\n }\n\n /**\n * Remove the given control from the map.\n * @param {import(\"./control/Control.js\").default} control Control.\n * @return {import(\"./control/Control.js\").default|undefined} The removed control (or undefined\n * if the control was not found).\n * @api\n */\n removeControl(control) {\n return this.getControls().remove(control);\n }\n\n /**\n * Remove the given interaction from the map.\n * @param {import(\"./interaction/Interaction.js\").default} interaction Interaction to remove.\n * @return {import(\"./interaction/Interaction.js\").default|undefined} The removed interaction (or\n * undefined if the interaction was not found).\n * @api\n */\n removeInteraction(interaction) {\n return this.getInteractions().remove(interaction);\n }\n\n /**\n * Removes the given layer from the map.\n * @param {import(\"./layer/Base.js\").default} layer Layer.\n * @return {import(\"./layer/Base.js\").default|undefined} The removed layer (or undefined if the\n * layer was not found).\n * @api\n */\n removeLayer(layer) {\n const layers = this.getLayerGroup().getLayers();\n return layers.remove(layer);\n }\n\n /**\n * @param {import(\"./layer/Group.js\").GroupEvent} event The layer remove event.\n * @private\n */\n handleLayerRemove_(event) {\n removeLayerMapProperty(event.layer);\n }\n\n /**\n * Remove the given overlay from the map.\n * @param {import(\"./Overlay.js\").default} overlay Overlay.\n * @return {import(\"./Overlay.js\").default|undefined} The removed overlay (or undefined\n * if the overlay was not found).\n * @api\n */\n removeOverlay(overlay) {\n return this.getOverlays().remove(overlay);\n }\n\n /**\n * @param {number} time Time.\n * @private\n */\n renderFrame_(time) {\n const size = this.getSize();\n const view = this.getView();\n const previousFrameState = this.frameState_;\n /** @type {?FrameState} */\n let frameState = null;\n if (size !== undefined && hasArea(size) && view && view.isDef()) {\n const viewHints = view.getHints(\n this.frameState_ ? this.frameState_.viewHints : undefined,\n );\n const viewState = view.getState();\n frameState = {\n animate: false,\n coordinateToPixelTransform: this.coordinateToPixelTransform_,\n declutter: null,\n extent: getForViewAndSize(\n viewState.center,\n viewState.resolution,\n viewState.rotation,\n size,\n ),\n index: this.frameIndex_++,\n layerIndex: 0,\n layerStatesArray: this.getLayerGroup().getLayerStatesArray(),\n pixelRatio: this.pixelRatio_,\n pixelToCoordinateTransform: this.pixelToCoordinateTransform_,\n postRenderFunctions: [],\n size: size,\n tileQueue: this.tileQueue_,\n time: time,\n usedTiles: {},\n viewState: viewState,\n viewHints: viewHints,\n wantedTiles: {},\n mapId: getUid(this),\n renderTargets: {},\n };\n if (viewState.nextCenter && viewState.nextResolution) {\n const rotation = isNaN(viewState.nextRotation)\n ? viewState.rotation\n : viewState.nextRotation;\n\n frameState.nextExtent = getForViewAndSize(\n viewState.nextCenter,\n viewState.nextResolution,\n rotation,\n size,\n );\n }\n }\n\n this.frameState_ = frameState;\n this.renderer_.renderFrame(frameState);\n\n if (frameState) {\n if (frameState.animate) {\n this.render();\n }\n Array.prototype.push.apply(\n this.postRenderFunctions_,\n frameState.postRenderFunctions,\n );\n\n if (previousFrameState) {\n const moveStart =\n !this.previousExtent_ ||\n (!isEmpty(this.previousExtent_) &&\n !equalsExtent(frameState.extent, this.previousExtent_));\n if (moveStart) {\n this.dispatchEvent(\n new MapEvent(MapEventType.MOVESTART, this, previousFrameState),\n );\n this.previousExtent_ = createOrUpdateEmpty(this.previousExtent_);\n }\n }\n\n const idle =\n this.previousExtent_ &&\n !frameState.viewHints[ViewHint.ANIMATING] &&\n !frameState.viewHints[ViewHint.INTERACTING] &&\n !equalsExtent(frameState.extent, this.previousExtent_);\n\n if (idle) {\n this.dispatchEvent(\n new MapEvent(MapEventType.MOVEEND, this, frameState),\n );\n clone(frameState.extent, this.previousExtent_);\n }\n }\n\n this.dispatchEvent(new MapEvent(MapEventType.POSTRENDER, this, frameState));\n\n this.renderComplete_ =\n this.hasListener(MapEventType.LOADSTART) ||\n this.hasListener(MapEventType.LOADEND) ||\n this.hasListener(RenderEventType.RENDERCOMPLETE)\n ? !this.tileQueue_.getTilesLoading() &&\n !this.tileQueue_.getCount() &&\n !this.getLoadingOrNotReady()\n : undefined;\n\n if (!this.postRenderTimeoutHandle_) {\n this.postRenderTimeoutHandle_ = setTimeout(() => {\n this.postRenderTimeoutHandle_ = undefined;\n this.handlePostRender();\n }, 0);\n }\n }\n\n /**\n * Sets the layergroup of this map.\n * @param {LayerGroup} layerGroup A layer group containing the layers in this map.\n * @observable\n * @api\n */\n setLayerGroup(layerGroup) {\n const oldLayerGroup = this.getLayerGroup();\n if (oldLayerGroup) {\n this.handleLayerRemove_(new GroupEvent('removelayer', oldLayerGroup));\n }\n this.set(MapProperty.LAYERGROUP, layerGroup);\n }\n\n /**\n * Set the size of this map.\n * @param {import(\"./size.js\").Size|undefined} size The size in pixels of the map in the DOM.\n * @observable\n * @api\n */\n setSize(size) {\n this.set(MapProperty.SIZE, size);\n }\n\n /**\n * Set the target element to render this map into.\n * @param {HTMLElement|string} [target] The Element or id of the Element\n * that the map is rendered in.\n * @observable\n * @api\n */\n setTarget(target) {\n this.set(MapProperty.TARGET, target);\n }\n\n /**\n * Set the view for this map.\n * @param {View|Promise} view The view that controls this map.\n * It is also possible to pass a promise that resolves to options for constructing a view. This\n * alternative allows view properties to be resolved by sources or other components that load\n * view-related metadata.\n * @observable\n * @api\n */\n setView(view) {\n if (!view || view instanceof View) {\n this.set(MapProperty.VIEW, view);\n return;\n }\n this.set(MapProperty.VIEW, new View());\n\n const map = this;\n view.then(function (viewOptions) {\n map.setView(new View(viewOptions));\n });\n }\n\n /**\n * Force a recalculation of the map viewport size. This should be called when\n * third-party code changes the size of the map viewport.\n * @api\n */\n updateSize() {\n const targetElement = this.getTargetElement();\n\n let size = undefined;\n if (targetElement) {\n const computedStyle = getComputedStyle(targetElement);\n const width =\n targetElement.offsetWidth -\n parseFloat(computedStyle['borderLeftWidth']) -\n parseFloat(computedStyle['paddingLeft']) -\n parseFloat(computedStyle['paddingRight']) -\n parseFloat(computedStyle['borderRightWidth']);\n const height =\n targetElement.offsetHeight -\n parseFloat(computedStyle['borderTopWidth']) -\n parseFloat(computedStyle['paddingTop']) -\n parseFloat(computedStyle['paddingBottom']) -\n parseFloat(computedStyle['borderBottomWidth']);\n if (!isNaN(width) && !isNaN(height)) {\n size = [width, height];\n if (\n !hasArea(size) &&\n !!(\n targetElement.offsetWidth ||\n targetElement.offsetHeight ||\n targetElement.getClientRects().length\n )\n ) {\n warn(\n \"No map visible because the map container's width or height are 0.\",\n );\n }\n }\n }\n\n const oldSize = this.getSize();\n if (size && (!oldSize || !equals(size, oldSize))) {\n this.setSize(size);\n this.updateViewportSize_(size);\n }\n }\n\n /**\n * Recomputes the viewport size and save it on the view object (if any)\n * @param {import(\"./size.js\").Size|undefined} size The size.\n * @private\n */\n updateViewportSize_(size) {\n const view = this.getView();\n if (view) {\n view.setViewportSize(size);\n }\n }\n}\n\n/**\n * @param {MapOptions} options Map options.\n * @return {MapOptionsInternal} Internal map options.\n */\nfunction createOptionsInternal(options) {\n /**\n * @type {HTMLElement|Document}\n */\n let keyboardEventTarget = null;\n if (options.keyboardEventTarget !== undefined) {\n keyboardEventTarget =\n typeof options.keyboardEventTarget === 'string'\n ? document.getElementById(options.keyboardEventTarget)\n : options.keyboardEventTarget;\n }\n\n /**\n * @type {Object}\n */\n const values = {};\n\n const layerGroup =\n options.layers &&\n typeof (/** @type {?} */ (options.layers).getLayers) === 'function'\n ? /** @type {LayerGroup} */ (options.layers)\n : new LayerGroup({\n layers:\n /** @type {Collection|Array} */ (\n options.layers\n ),\n });\n values[MapProperty.LAYERGROUP] = layerGroup;\n\n values[MapProperty.TARGET] = options.target;\n\n values[MapProperty.VIEW] =\n options.view instanceof View ? options.view : new View();\n\n /** @type {Collection} */\n let controls;\n if (options.controls !== undefined) {\n if (Array.isArray(options.controls)) {\n controls = new Collection(options.controls.slice());\n } else {\n assert(\n typeof (/** @type {?} */ (options.controls).getArray) === 'function',\n 'Expected `controls` to be an array or an `ol/Collection.js`',\n );\n controls = options.controls;\n }\n }\n\n /** @type {Collection} */\n let interactions;\n if (options.interactions !== undefined) {\n if (Array.isArray(options.interactions)) {\n interactions = new Collection(options.interactions.slice());\n } else {\n assert(\n typeof (/** @type {?} */ (options.interactions).getArray) ===\n 'function',\n 'Expected `interactions` to be an array or an `ol/Collection.js`',\n );\n interactions = options.interactions;\n }\n }\n\n /** @type {Collection} */\n let overlays;\n if (options.overlays !== undefined) {\n if (Array.isArray(options.overlays)) {\n overlays = new Collection(options.overlays.slice());\n } else {\n assert(\n typeof (/** @type {?} */ (options.overlays).getArray) === 'function',\n 'Expected `overlays` to be an array or an `ol/Collection.js`',\n );\n overlays = options.overlays;\n }\n } else {\n overlays = new Collection();\n }\n\n return {\n controls: controls,\n interactions: interactions,\n keyboardEventTarget: keyboardEventTarget,\n overlays: overlays,\n values: values,\n };\n}\nexport default Map;\n","/**\n * @module ol/control/defaults\n */\nimport Attribution from './Attribution.js';\nimport Collection from '../Collection.js';\nimport Rotate from './Rotate.js';\nimport Zoom from './Zoom.js';\n\n/**\n * @typedef {Object} DefaultsOptions\n * @property {boolean} [attribution=true] Include\n * {@link module:ol/control/Attribution~Attribution}.\n * @property {import(\"./Attribution.js\").Options} [attributionOptions]\n * Options for {@link module:ol/control/Attribution~Attribution}.\n * @property {boolean} [rotate=true] Include\n * {@link module:ol/control/Rotate~Rotate}.\n * @property {import(\"./Rotate.js\").Options} [rotateOptions] Options\n * for {@link module:ol/control/Rotate~Rotate}.\n * @property {boolean} [zoom] Include {@link module:ol/control/Zoom~Zoom}.\n * @property {import(\"./Zoom.js\").Options} [zoomOptions] Options for\n * {@link module:ol/control/Zoom~Zoom}.\n */\n\n/**\n * Set of controls included in maps by default. Unless configured otherwise,\n * this returns a collection containing an instance of each of the following\n * controls:\n * * {@link module:ol/control/Zoom~Zoom}\n * * {@link module:ol/control/Rotate~Rotate}\n * * {@link module:ol/control/Attribution~Attribution}\n *\n * @param {DefaultsOptions} [options] Options for the default controls.\n * @return {Collection} A collection of controls\n * to be used with the {@link module:ol/Map~Map} constructor's `controls` option.\n * @api\n */\nexport function defaults(options) {\n options = options ? options : {};\n\n /** @type {Collection} */\n const controls = new Collection();\n\n const zoomControl = options.zoom !== undefined ? options.zoom : true;\n if (zoomControl) {\n controls.push(new Zoom(options.zoomOptions));\n }\n\n const rotateControl = options.rotate !== undefined ? options.rotate : true;\n if (rotateControl) {\n controls.push(new Rotate(options.rotateOptions));\n }\n\n const attributionControl =\n options.attribution !== undefined ? options.attribution : true;\n if (attributionControl) {\n controls.push(new Attribution(options.attributionOptions));\n }\n\n return controls;\n}\n","/**\n * @module ol/interaction/defaults\n */\nimport Collection from '../Collection.js';\nimport DoubleClickZoom from './DoubleClickZoom.js';\nimport DragPan from './DragPan.js';\nimport DragRotate from './DragRotate.js';\nimport DragZoom from './DragZoom.js';\nimport KeyboardPan from './KeyboardPan.js';\nimport KeyboardZoom from './KeyboardZoom.js';\nimport Kinetic from '../Kinetic.js';\nimport MouseWheelZoom from './MouseWheelZoom.js';\nimport PinchRotate from './PinchRotate.js';\nimport PinchZoom from './PinchZoom.js';\n\n/**\n * @typedef {Object} DefaultsOptions\n * @property {boolean} [altShiftDragRotate=true] Whether Alt-Shift-drag rotate is\n * desired.\n * @property {boolean} [onFocusOnly=false] Interact only when the map has the\n * focus. This affects the `MouseWheelZoom` and `DragPan` interactions and is\n * useful when page scroll is desired for maps that do not have the browser's\n * focus.\n * @property {boolean} [doubleClickZoom=true] Whether double click zoom is\n * desired.\n * @property {boolean} [keyboard=true] Whether keyboard interaction is desired.\n * @property {boolean} [mouseWheelZoom=true] Whether mousewheel zoom is desired.\n * @property {boolean} [shiftDragZoom=true] Whether Shift-drag zoom is desired.\n * @property {boolean} [dragPan=true] Whether drag pan is desired.\n * @property {boolean} [pinchRotate=true] Whether pinch rotate is desired.\n * @property {boolean} [pinchZoom=true] Whether pinch zoom is desired.\n * @property {number} [zoomDelta] Zoom level delta when using keyboard or double click zoom.\n * @property {number} [zoomDuration] Duration of the zoom animation in\n * milliseconds.\n */\n\n/**\n * Set of interactions included in maps by default. Specific interactions can be\n * excluded by setting the appropriate option to false in the constructor\n * options, but the order of the interactions is fixed. If you want to specify\n * a different order for interactions, you will need to create your own\n * {@link module:ol/interaction/Interaction~Interaction} instances and insert\n * them into a {@link module:ol/Collection~Collection} in the order you want\n * before creating your {@link module:ol/Map~Map} instance. Changing the order can\n * be of interest if the event propagation needs to be stopped at a point.\n * The default set of interactions, in sequence, is:\n * * {@link module:ol/interaction/DragRotate~DragRotate}\n * * {@link module:ol/interaction/DoubleClickZoom~DoubleClickZoom}\n * * {@link module:ol/interaction/DragPan~DragPan}\n * * {@link module:ol/interaction/PinchRotate~PinchRotate}\n * * {@link module:ol/interaction/PinchZoom~PinchZoom}\n * * {@link module:ol/interaction/KeyboardPan~KeyboardPan}\n * * {@link module:ol/interaction/KeyboardZoom~KeyboardZoom}\n * * {@link module:ol/interaction/MouseWheelZoom~MouseWheelZoom}\n * * {@link module:ol/interaction/DragZoom~DragZoom}\n *\n * @param {DefaultsOptions} [options] Defaults options.\n * @return {Collection}\n * A collection of interactions to be used with the {@link module:ol/Map~Map}\n * constructor's `interactions` option.\n * @api\n */\nexport function defaults(options) {\n options = options ? options : {};\n\n /** @type {Collection} */\n const interactions = new Collection();\n\n const kinetic = new Kinetic(-0.005, 0.05, 100);\n\n const altShiftDragRotate =\n options.altShiftDragRotate !== undefined\n ? options.altShiftDragRotate\n : true;\n if (altShiftDragRotate) {\n interactions.push(new DragRotate());\n }\n\n const doubleClickZoom =\n options.doubleClickZoom !== undefined ? options.doubleClickZoom : true;\n if (doubleClickZoom) {\n interactions.push(\n new DoubleClickZoom({\n delta: options.zoomDelta,\n duration: options.zoomDuration,\n }),\n );\n }\n\n const dragPan = options.dragPan !== undefined ? options.dragPan : true;\n if (dragPan) {\n interactions.push(\n new DragPan({\n onFocusOnly: options.onFocusOnly,\n kinetic: kinetic,\n }),\n );\n }\n\n const pinchRotate =\n options.pinchRotate !== undefined ? options.pinchRotate : true;\n if (pinchRotate) {\n interactions.push(new PinchRotate());\n }\n\n const pinchZoom = options.pinchZoom !== undefined ? options.pinchZoom : true;\n if (pinchZoom) {\n interactions.push(\n new PinchZoom({\n duration: options.zoomDuration,\n }),\n );\n }\n\n const keyboard = options.keyboard !== undefined ? options.keyboard : true;\n if (keyboard) {\n interactions.push(new KeyboardPan());\n interactions.push(\n new KeyboardZoom({\n delta: options.zoomDelta,\n duration: options.zoomDuration,\n }),\n );\n }\n\n const mouseWheelZoom =\n options.mouseWheelZoom !== undefined ? options.mouseWheelZoom : true;\n if (mouseWheelZoom) {\n interactions.push(\n new MouseWheelZoom({\n onFocusOnly: options.onFocusOnly,\n duration: options.zoomDuration,\n }),\n );\n }\n\n const shiftDragZoom =\n options.shiftDragZoom !== undefined ? options.shiftDragZoom : true;\n if (shiftDragZoom) {\n interactions.push(\n new DragZoom({\n duration: options.zoomDuration,\n }),\n );\n }\n\n return interactions;\n}\n","/**\n * @module ol/renderer/canvas/VectorImageLayer\n */\nimport CanvasImageLayerRenderer from './ImageLayer.js';\nimport CanvasVectorLayerRenderer from './VectorLayer.js';\nimport EventType from '../../events/EventType.js';\nimport ImageCanvas from '../../ImageCanvas.js';\nimport ImageState from '../../ImageState.js';\nimport RBush from 'rbush';\nimport ViewHint from '../../ViewHint.js';\nimport {apply, compose, create} from '../../transform.js';\nimport {fromResolutionLike} from '../../resolution.js';\nimport {getHeight, getWidth, isEmpty, scaleFromCenter} from '../../extent.js';\n\n/**\n * @classdesc\n * Canvas renderer for image layers.\n * @api\n */\nclass CanvasVectorImageLayerRenderer extends CanvasImageLayerRenderer {\n /**\n * @param {import(\"../../layer/VectorImage.js\").default} layer Vector image layer.\n */\n constructor(layer) {\n super(layer);\n\n /**\n * @private\n * @type {import(\"./VectorLayer.js\").default}\n */\n this.vectorRenderer_ = new CanvasVectorLayerRenderer(layer);\n\n /**\n * @private\n * @type {number}\n */\n this.layerImageRatio_ = layer.getImageRatio();\n\n /**\n * @private\n * @type {import(\"../../transform.js\").Transform}\n */\n this.coordinateToVectorPixelTransform_ = create();\n\n /**\n * @private\n * @type {import(\"../../transform.js\").Transform}\n */\n this.renderedPixelToCoordinateTransform_ = null;\n }\n\n /**\n * Clean up.\n */\n disposeInternal() {\n this.vectorRenderer_.dispose();\n super.disposeInternal();\n }\n\n /**\n * Asynchronous layer level hit detection.\n * @param {import(\"../../pixel.js\").Pixel} pixel Pixel.\n * @return {Promise>} Promise that resolves with an array of features.\n */\n getFeatures(pixel) {\n if (!this.vectorRenderer_) {\n return Promise.resolve([]);\n }\n const vectorPixel = apply(\n this.coordinateToVectorPixelTransform_,\n apply(this.renderedPixelToCoordinateTransform_, pixel.slice()),\n );\n return this.vectorRenderer_.getFeatures(vectorPixel);\n }\n\n /**\n * Perform action necessary to get the layer rendered after new fonts have loaded\n */\n handleFontsChanged() {\n this.vectorRenderer_.handleFontsChanged();\n }\n\n /**\n * Determine whether render should be called.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @return {boolean} Layer is ready to be rendered.\n */\n prepareFrame(frameState) {\n const pixelRatio = frameState.pixelRatio;\n const viewState = frameState.viewState;\n const viewResolution = viewState.resolution;\n\n const hints = frameState.viewHints;\n const vectorRenderer = this.vectorRenderer_;\n let renderedExtent = frameState.extent;\n if (this.layerImageRatio_ !== 1) {\n renderedExtent = renderedExtent.slice(0);\n scaleFromCenter(renderedExtent, this.layerImageRatio_);\n }\n const width = getWidth(renderedExtent) / viewResolution;\n const height = getHeight(renderedExtent) / viewResolution;\n\n if (\n !hints[ViewHint.ANIMATING] &&\n !hints[ViewHint.INTERACTING] &&\n !isEmpty(renderedExtent)\n ) {\n vectorRenderer.useContainer(null, null);\n const context = vectorRenderer.context;\n const layerState = frameState.layerStatesArray[frameState.layerIndex];\n const imageLayerState = Object.assign({}, layerState, {opacity: 1});\n const imageFrameState = /** @type {import(\"../../Map.js\").FrameState} */ (\n Object.assign({}, frameState, {\n extent: renderedExtent,\n size: [width, height],\n viewState: /** @type {import(\"../../View.js\").State} */ (\n Object.assign({}, frameState.viewState, {\n rotation: 0,\n })\n ),\n layerStatesArray: [imageLayerState],\n layerIndex: 0,\n declutter: null,\n })\n );\n const declutter = this.getLayer().getDeclutter();\n if (declutter) {\n imageFrameState.declutter = {\n [declutter]: new RBush(9),\n };\n }\n let emptyImage = true;\n const image = new ImageCanvas(\n renderedExtent,\n viewResolution,\n pixelRatio,\n context.canvas,\n function (callback) {\n if (\n vectorRenderer.prepareFrame(imageFrameState) &&\n vectorRenderer.replayGroupChanged\n ) {\n vectorRenderer.clipping = false;\n if (vectorRenderer.renderFrame(imageFrameState, null)) {\n vectorRenderer.renderDeclutter(imageFrameState);\n vectorRenderer.renderDeferred(imageFrameState);\n emptyImage = false;\n }\n callback();\n }\n },\n );\n\n image.addEventListener(EventType.CHANGE, () => {\n if (image.getState() !== ImageState.LOADED) {\n return;\n }\n this.image_ = emptyImage ? null : image;\n const imagePixelRatio = image.getPixelRatio();\n const renderedResolution =\n (fromResolutionLike(image.getResolution()) * pixelRatio) /\n imagePixelRatio;\n this.renderedResolution = renderedResolution;\n this.coordinateToVectorPixelTransform_ = compose(\n this.coordinateToVectorPixelTransform_,\n width / 2,\n height / 2,\n 1 / renderedResolution,\n -1 / renderedResolution,\n 0,\n -viewState.center[0],\n -viewState.center[1],\n );\n });\n image.load();\n }\n\n if (this.image_) {\n this.renderedPixelToCoordinateTransform_ =\n frameState.pixelToCoordinateTransform.slice();\n }\n\n return !!this.image_;\n }\n\n /**\n */\n preRender() {}\n\n /**\n */\n postRender() {}\n\n /**\n */\n renderDeclutter() {}\n\n /**\n * @param {import(\"../../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @param {import(\"../vector.js\").FeatureCallback} callback Feature callback.\n * @param {Array>} matches The hit detected matches with tolerance.\n * @return {T|undefined} Callback result.\n * @template T\n */\n forEachFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n callback,\n matches,\n ) {\n if (this.vectorRenderer_) {\n return this.vectorRenderer_.forEachFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n callback,\n matches,\n );\n }\n return super.forEachFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n callback,\n matches,\n );\n }\n}\n\nexport default CanvasVectorImageLayerRenderer;\n","/**\n * @module ol/layer/VectorImage\n */\nimport BaseVectorLayer from './BaseVector.js';\nimport CanvasVectorImageLayerRenderer from '../renderer/canvas/VectorImageLayer.js';\n\n/**\n * @template {import(\"../source/Vector.js\").default} VectorSourceType\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {import(\"../render.js\").OrderFunction} [renderOrder] Render order. Function to be used when sorting\n * features before rendering. By default features are drawn in the order that they are created. Use\n * `null` to avoid the sort, but get an undefined draw order.\n * @property {number} [renderBuffer=100] The buffer in pixels around the viewport extent used by the\n * renderer when getting features from the vector source for the rendering or hit-detection.\n * Recommended value: the size of the largest symbol, line width or label.\n * @property {VectorSourceType} [source] Source.\n * @property {import(\"../Map.js\").default} [map] Sets the layer as overlay on a map. The map will not manage\n * this layer in its layers collection, and the layer will be rendered on top. This is useful for\n * temporary layers. The standard way to add a layer to a map and have it managed by the map is to\n * use [map.addLayer()]{@link import(\"../Map.js\").default#addLayer}.\n * @property {boolean|string|number} [declutter=false] Declutter images and text on this layer. Any truthy value will enable\n * decluttering. The priority is defined by the `zIndex` of the style and the render order of features. Higher z-index means higher\n * priority. Within the same z-index, a feature rendered before another has higher priority. Items will\n * not be decluttered against or together with items on other layers with the same `declutter` value. If\n * that is needed, use {@link import(\"../layer/Vector.js\").default} instead.\n * @property {import(\"../style/Style.js\").StyleLike|import(\"../style/flat.js\").FlatStyleLike|null} [style] Layer style. When set to `null`, only\n * features that have their own style will be rendered. See {@link module:ol/style/Style~Style} for the default style\n * which will be used if this is not set.\n * @property {import(\"./Base.js\").BackgroundColor} [background] Background color for the layer. If not specified, no background\n * will be rendered.\n * @property {number} [imageRatio=1] Ratio by which the rendered extent should be larger than the\n * viewport extent. A larger ratio avoids cut images during panning, but will cause a decrease in performance.\n * @property {Object} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n */\n\n/**\n * @classdesc\n * Vector data is rendered client-side, to an image. This layer type provides great performance\n * during panning and zooming, but point symbols and texts are always rotated with the view and\n * pixels are scaled during zoom animations. For more accurate rendering of vector data, use\n * {@link module:ol/layer/Vector~VectorLayer} instead.\n *\n * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}\n * property on the layer object; for example, setting `title: 'My Title'` in the\n * options means that `title` is observable, and has get/set accessors.\n *\n * @template {import(\"../Feature.js\").default} FeatureType\n * @extends {BaseVectorLayer, CanvasVectorImageLayerRenderer>}\n * @api\n */\nclass VectorImageLayer extends BaseVectorLayer {\n /**\n * @param {Options>} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const baseOptions = Object.assign({}, options);\n delete baseOptions.imageRatio;\n super(baseOptions);\n\n /**\n * @type {number}\n * @private\n */\n this.imageRatio_ =\n options.imageRatio !== undefined ? options.imageRatio : 1;\n }\n\n /**\n * @return {number} Ratio between rendered extent size and viewport extent size.\n */\n getImageRatio() {\n return this.imageRatio_;\n }\n\n createRenderer() {\n return new CanvasVectorImageLayerRenderer(this);\n }\n}\n\nexport default VectorImageLayer;\n","/**\n * @module ol/layer/WebGLPoints\n */\nimport Layer from './Layer.js';\nimport WebGLPointsLayerRenderer from '../renderer/webgl/PointsLayer.js';\nimport {parseLiteralStyle} from '../webgl/styleparser.js';\n\n/**\n * @template {import(\"../source/Vector.js\").default} VectorSourceType\n * @typedef {Object} Options\n * @property {import('../style/webgl.js').WebGLStyle} style Literal style to apply to the layer features.\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {VectorSourceType} [source] Point source.\n * @property {boolean} [disableHitDetection=false] Setting this to true will provide a slight performance boost, but will\n * prevent all hit detection on the layer.\n * @property {Object} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n */\n\n/**\n * @classdesc\n * Layer optimized for rendering large point datasets. Takes a `style` property which\n * is a serializable JSON object describing how the layer should be rendered.\n *\n * Here are a few samples of literal style objects:\n * ```js\n * const style = {\n * 'circle-radius': 8,\n * 'circle-fill-color': '#33AAFF',\n * 'circle-opacity': 0.9\n * }\n * ```\n *\n * ```js\n * const style = {\n * 'icon-src': '../static/exclamation-mark.png',\n * 'icon-offset': [0, 12],\n * 'icon-width': 4,\n * 'icon-height': 8\n * }\n * ```\n *\n * **Important: a `WebGLPoints` layer must be manually disposed when removed, otherwise the underlying WebGL context\n * will not be garbage collected.**\n *\n * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}\n * property on the layer object; for example, setting `title: 'My Title'` in the\n * options means that `title` is observable, and has get/set accessors.\n *\n * @template {import(\"../source/Vector.js\").default} VectorSourceType\n * @extends {Layer}\n * @fires import(\"../render/Event.js\").RenderEvent\n */\nclass WebGLPointsLayer extends Layer {\n /**\n * @param {Options} options Options.\n */\n constructor(options) {\n const baseOptions = Object.assign({}, options);\n\n super(baseOptions);\n\n /**\n * @private\n * @type {import('../webgl/styleparser.js').StyleParseResult}\n */\n this.parseResult_ = parseLiteralStyle(options.style);\n\n /**\n * @type {Object|boolean)>}\n * @private\n */\n this.styleVariables_ = options.style.variables || {};\n\n /**\n * @private\n * @type {boolean}\n */\n this.hitDetectionDisabled_ = !!options.disableHitDetection;\n }\n\n createRenderer() {\n const attributes = Object.keys(this.parseResult_.attributes).map(\n (name) => ({\n name,\n ...this.parseResult_.attributes[name],\n }),\n );\n return new WebGLPointsLayerRenderer(this, {\n vertexShader: this.parseResult_.builder.getSymbolVertexShader(),\n fragmentShader: this.parseResult_.builder.getSymbolFragmentShader(),\n hitDetectionEnabled: !this.hitDetectionDisabled_,\n uniforms: this.parseResult_.uniforms,\n attributes:\n /** @type {Array} */ (\n attributes\n ),\n });\n }\n\n /**\n * Update any variables used by the layer style and trigger a re-render.\n * @param {Object} variables Variables to update.\n */\n updateStyleVariables(variables) {\n Object.assign(this.styleVariables_, variables);\n this.changed();\n }\n}\n\nexport default WebGLPointsLayer;\n","/**\n * @module ol/layer/Base\n */\nimport BaseObject from '../Object.js';\nimport LayerProperty from './Property.js';\nimport {abstract} from '../util.js';\nimport {assert} from '../asserts.js';\nimport {clamp} from '../math.js';\n\n/**\n * A css color, or a function called with a view resolution returning a css color.\n *\n * @typedef {string|function(number):string} BackgroundColor\n * @api\n */\n\n/**\n * @typedef {import(\"../ObjectEventType\").Types|'change:extent'|'change:maxResolution'|'change:maxZoom'|\n * 'change:minResolution'|'change:minZoom'|'change:opacity'|'change:visible'|'change:zIndex'} BaseLayerObjectEventTypes\n */\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature &\n * import(\"../Observable\").OnSignature &\n * import(\"../Observable\").CombinedOnSignature} BaseLayerOnSignature\n */\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number | undefined} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {BackgroundColor} [background] Background color for the layer. If not specified, no background\n * will be rendered.\n * @property {Object} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Note that with {@link module:ol/layer/Base~BaseLayer} and all its subclasses, any property set in\n * the options is set as a {@link module:ol/Object~BaseObject} property on the layer object, so\n * is observable, and has get/set accessors.\n *\n * @api\n */\nclass BaseLayer extends BaseObject {\n /**\n * @param {Options} options Layer options.\n */\n constructor(options) {\n super();\n\n /***\n * @type {BaseLayerOnSignature}\n */\n this.on;\n\n /***\n * @type {BaseLayerOnSignature}\n */\n this.once;\n\n /***\n * @type {BaseLayerOnSignature}\n */\n this.un;\n\n /**\n * @type {BackgroundColor|false}\n * @private\n */\n this.background_ = options.background;\n\n /**\n * @type {Object}\n */\n const properties = Object.assign({}, options);\n if (typeof options.properties === 'object') {\n delete properties.properties;\n Object.assign(properties, options.properties);\n }\n\n properties[LayerProperty.OPACITY] =\n options.opacity !== undefined ? options.opacity : 1;\n assert(\n typeof properties[LayerProperty.OPACITY] === 'number',\n 'Layer opacity must be a number',\n );\n\n properties[LayerProperty.VISIBLE] =\n options.visible !== undefined ? options.visible : true;\n properties[LayerProperty.Z_INDEX] = options.zIndex;\n properties[LayerProperty.MAX_RESOLUTION] =\n options.maxResolution !== undefined ? options.maxResolution : Infinity;\n properties[LayerProperty.MIN_RESOLUTION] =\n options.minResolution !== undefined ? options.minResolution : 0;\n properties[LayerProperty.MIN_ZOOM] =\n options.minZoom !== undefined ? options.minZoom : -Infinity;\n properties[LayerProperty.MAX_ZOOM] =\n options.maxZoom !== undefined ? options.maxZoom : Infinity;\n\n /**\n * @type {string}\n * @private\n */\n this.className_ =\n properties.className !== undefined ? properties.className : 'ol-layer';\n delete properties.className;\n\n this.setProperties(properties);\n\n /**\n * @type {import(\"./Layer.js\").State}\n * @private\n */\n this.state_ = null;\n }\n\n /**\n * Get the background for this layer.\n * @return {BackgroundColor|false} Layer background.\n */\n getBackground() {\n return this.background_;\n }\n\n /**\n * @return {string} CSS class name.\n */\n getClassName() {\n return this.className_;\n }\n\n /**\n * This method is not meant to be called by layers or layer renderers because the state\n * is incorrect if the layer is included in a layer group.\n *\n * @param {boolean} [managed] Layer is managed.\n * @return {import(\"./Layer.js\").State} Layer state.\n */\n getLayerState(managed) {\n /** @type {import(\"./Layer.js\").State} */\n const state =\n this.state_ ||\n /** @type {?} */ ({\n layer: this,\n managed: managed === undefined ? true : managed,\n });\n const zIndex = this.getZIndex();\n state.opacity = clamp(Math.round(this.getOpacity() * 100) / 100, 0, 1);\n state.visible = this.getVisible();\n state.extent = this.getExtent();\n state.zIndex = zIndex === undefined && !state.managed ? Infinity : zIndex;\n state.maxResolution = this.getMaxResolution();\n state.minResolution = Math.max(this.getMinResolution(), 0);\n state.minZoom = this.getMinZoom();\n state.maxZoom = this.getMaxZoom();\n this.state_ = state;\n\n return state;\n }\n\n /**\n * @abstract\n * @param {Array} [array] Array of layers (to be\n * modified in place).\n * @return {Array} Array of layers.\n */\n getLayersArray(array) {\n return abstract();\n }\n\n /**\n * @abstract\n * @param {Array} [states] Optional list of layer\n * states (to be modified in place).\n * @return {Array} List of layer states.\n */\n getLayerStatesArray(states) {\n return abstract();\n }\n\n /**\n * Return the {@link module:ol/extent~Extent extent} of the layer or `undefined` if it\n * will be visible regardless of extent.\n * @return {import(\"../extent.js\").Extent|undefined} The layer extent.\n * @observable\n * @api\n */\n getExtent() {\n return /** @type {import(\"../extent.js\").Extent|undefined} */ (\n this.get(LayerProperty.EXTENT)\n );\n }\n\n /**\n * Return the maximum resolution of the layer. Returns Infinity if\n * the layer has no maximum resolution set.\n * @return {number} The maximum resolution of the layer.\n * @observable\n * @api\n */\n getMaxResolution() {\n return /** @type {number} */ (this.get(LayerProperty.MAX_RESOLUTION));\n }\n\n /**\n * Return the minimum resolution of the layer. Returns 0 if\n * the layer has no minimum resolution set.\n * @return {number} The minimum resolution of the layer.\n * @observable\n * @api\n */\n getMinResolution() {\n return /** @type {number} */ (this.get(LayerProperty.MIN_RESOLUTION));\n }\n\n /**\n * Return the minimum zoom level of the layer. Returns -Infinity if\n * the layer has no minimum zoom set.\n * @return {number} The minimum zoom level of the layer.\n * @observable\n * @api\n */\n getMinZoom() {\n return /** @type {number} */ (this.get(LayerProperty.MIN_ZOOM));\n }\n\n /**\n * Return the maximum zoom level of the layer. Returns Infinity if\n * the layer has no maximum zoom set.\n * @return {number} The maximum zoom level of the layer.\n * @observable\n * @api\n */\n getMaxZoom() {\n return /** @type {number} */ (this.get(LayerProperty.MAX_ZOOM));\n }\n\n /**\n * Return the opacity of the layer (between 0 and 1).\n * @return {number} The opacity of the layer.\n * @observable\n * @api\n */\n getOpacity() {\n return /** @type {number} */ (this.get(LayerProperty.OPACITY));\n }\n\n /**\n * @abstract\n * @return {import(\"../source/Source.js\").State} Source state.\n */\n getSourceState() {\n return abstract();\n }\n\n /**\n * Return the value of this layer's `visible` property. To find out whether the layer\n * is visible on a map, use `isVisible()` instead.\n * @return {boolean} The value of the `visible` property of the layer.\n * @observable\n * @api\n */\n getVisible() {\n return /** @type {boolean} */ (this.get(LayerProperty.VISIBLE));\n }\n\n /**\n * Return the Z-index of the layer, which is used to order layers before\n * rendering. Returns undefined if the layer is unmanaged.\n * @return {number|undefined} The Z-index of the layer.\n * @observable\n * @api\n */\n getZIndex() {\n return /** @type {number|undefined} */ (this.get(LayerProperty.Z_INDEX));\n }\n\n /**\n * Sets the background color.\n * @param {BackgroundColor} [background] Background color.\n */\n setBackground(background) {\n this.background_ = background;\n this.changed();\n }\n\n /**\n * Set the extent at which the layer is visible. If `undefined`, the layer\n * will be visible at all extents.\n * @param {import(\"../extent.js\").Extent|undefined} extent The extent of the layer.\n * @observable\n * @api\n */\n setExtent(extent) {\n this.set(LayerProperty.EXTENT, extent);\n }\n\n /**\n * Set the maximum resolution at which the layer is visible.\n * @param {number} maxResolution The maximum resolution of the layer.\n * @observable\n * @api\n */\n setMaxResolution(maxResolution) {\n this.set(LayerProperty.MAX_RESOLUTION, maxResolution);\n }\n\n /**\n * Set the minimum resolution at which the layer is visible.\n * @param {number} minResolution The minimum resolution of the layer.\n * @observable\n * @api\n */\n setMinResolution(minResolution) {\n this.set(LayerProperty.MIN_RESOLUTION, minResolution);\n }\n\n /**\n * Set the maximum zoom (exclusive) at which the layer is visible.\n * Note that the zoom levels for layer visibility are based on the\n * view zoom level, which may be different from a tile source zoom level.\n * @param {number} maxZoom The maximum zoom of the layer.\n * @observable\n * @api\n */\n setMaxZoom(maxZoom) {\n this.set(LayerProperty.MAX_ZOOM, maxZoom);\n }\n\n /**\n * Set the minimum zoom (inclusive) at which the layer is visible.\n * Note that the zoom levels for layer visibility are based on the\n * view zoom level, which may be different from a tile source zoom level.\n * @param {number} minZoom The minimum zoom of the layer.\n * @observable\n * @api\n */\n setMinZoom(minZoom) {\n this.set(LayerProperty.MIN_ZOOM, minZoom);\n }\n\n /**\n * Set the opacity of the layer, allowed values range from 0 to 1.\n * @param {number} opacity The opacity of the layer.\n * @observable\n * @api\n */\n setOpacity(opacity) {\n assert(typeof opacity === 'number', 'Layer opacity must be a number');\n this.set(LayerProperty.OPACITY, opacity);\n }\n\n /**\n * Set the visibility of the layer (`true` or `false`).\n * @param {boolean} visible The visibility of the layer.\n * @observable\n * @api\n */\n setVisible(visible) {\n this.set(LayerProperty.VISIBLE, visible);\n }\n\n /**\n * Set Z-index of the layer, which is used to order layers before rendering.\n * The default Z-index is 0.\n * @param {number} zindex The z-index of the layer.\n * @observable\n * @api\n */\n setZIndex(zindex) {\n this.set(LayerProperty.Z_INDEX, zindex);\n }\n\n /**\n * Clean up.\n */\n disposeInternal() {\n if (this.state_) {\n this.state_.layer = null;\n this.state_ = null;\n }\n super.disposeInternal();\n }\n}\n\nexport default BaseLayer;\n","/**\n * @module ol/layer/BaseTile\n */\nimport Layer from './Layer.js';\nimport TileProperty from './TileProperty.js';\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature &\n * import(\"../Observable\").OnSignature &\n * import(\"../Observable\").OnSignature &\n * import(\"../Observable\").CombinedOnSignature} BaseTileLayerOnSignature\n */\n\n/**\n * @template {import(\"../source/Tile.js\").default} TileSourceType\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {number} [preload=0] Preload. Load low-resolution tiles up to `preload` levels. `0`\n * means no preloading.\n * @property {TileSourceType} [source] Source for this layer.\n * @property {import(\"../Map.js\").default} [map] Sets the layer as overlay on a map. The map will not manage\n * this layer in its layers collection, and the layer will be rendered on top. This is useful for\n * temporary layers. The standard way to add a layer to a map and have it managed by the map is to\n * use {@link import(\"../Map.js\").default#addLayer map.addLayer()}.\n * @property {boolean} [useInterimTilesOnError=true] Use interim tiles on error.\n * @property {Object} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n */\n\n/**\n * @classdesc\n * For layer sources that provide pre-rendered, tiled images in grids that are\n * organized by zoom levels for specific resolutions.\n * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}\n * property on the layer object; for example, setting `title: 'My Title'` in the\n * options means that `title` is observable, and has get/set accessors.\n *\n * @template {import(\"../source/Tile.js\").default} TileSourceType\n * @template {import(\"../renderer/Layer.js\").default} RendererType\n * @extends {Layer}\n * @api\n */\nclass BaseTileLayer extends Layer {\n /**\n * @param {Options} [options] Tile layer options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const baseOptions = Object.assign({}, options);\n\n delete baseOptions.preload;\n delete baseOptions.useInterimTilesOnError;\n super(baseOptions);\n\n /***\n * @type {BaseTileLayerOnSignature}\n */\n this.on;\n\n /***\n * @type {BaseTileLayerOnSignature}\n */\n this.once;\n\n /***\n * @type {BaseTileLayerOnSignature}\n */\n this.un;\n\n this.setPreload(options.preload !== undefined ? options.preload : 0);\n this.setUseInterimTilesOnError(\n options.useInterimTilesOnError !== undefined\n ? options.useInterimTilesOnError\n : true,\n );\n }\n\n /**\n * Return the level as number to which we will preload tiles up to.\n * @return {number} The level to preload tiles up to.\n * @observable\n * @api\n */\n getPreload() {\n return /** @type {number} */ (this.get(TileProperty.PRELOAD));\n }\n\n /**\n * Set the level as number to which we will preload tiles up to.\n * @param {number} preload The level to preload tiles up to.\n * @observable\n * @api\n */\n setPreload(preload) {\n this.set(TileProperty.PRELOAD, preload);\n }\n\n /**\n * Whether we use interim tiles on error.\n * @return {boolean} Use interim tiles on error.\n * @observable\n * @api\n */\n getUseInterimTilesOnError() {\n return /** @type {boolean} */ (\n this.get(TileProperty.USE_INTERIM_TILES_ON_ERROR)\n );\n }\n\n /**\n * Set whether we use interim tiles on error.\n * @param {boolean} useInterimTilesOnError Use interim tiles on error.\n * @observable\n * @api\n */\n setUseInterimTilesOnError(useInterimTilesOnError) {\n this.set(TileProperty.USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError);\n }\n\n /**\n * Get data for a pixel location. The return type depends on the source data. For image tiles,\n * a four element RGBA array will be returned. For data tiles, the array length will match the\n * number of bands in the dataset. For requests outside the layer extent, `null` will be returned.\n * Data for a image tiles can only be retrieved if the source's `crossOrigin` property is set.\n *\n * ```js\n * // display layer data on every pointer move\n * map.on('pointermove', (event) => {\n * console.log(layer.getData(event.pixel));\n * });\n * ```\n * @param {import(\"../pixel\").Pixel} pixel Pixel.\n * @return {Uint8ClampedArray|Uint8Array|Float32Array|DataView|null} Pixel data.\n * @api\n */\n getData(pixel) {\n return super.getData(pixel);\n }\n}\n\nexport default BaseTileLayer;\n","/**\n * @module ol/expr/cpu\n */\n\nimport {\n ColorType,\n LiteralExpression,\n Ops,\n overlapsType,\n parse,\n typeName,\n} from './expression.js';\nimport {\n fromString,\n lchaToRgba,\n normalize,\n rgbaToLcha,\n toString,\n withAlpha,\n} from '../color.js';\n\n/**\n * @fileoverview This module includes functions to build expressions for evaluation on the CPU.\n * Building is composed of two steps: parsing and compiling. The parsing step takes an encoded\n * expression and returns an instance of one of the expression classes. The compiling step takes\n * the expression instance and returns a function that can be evaluated in to return a literal\n * value. The evaluator function should do as little allocation and work as possible.\n */\n\n/**\n * @typedef {Object} EvaluationContext\n * @property {Object} properties The values for properties used in 'get' expressions.\n * @property {Object} variables The values for variables used in 'var' expressions.\n * @property {number} resolution The map resolution.\n * @property {string|number|null} featureId The feature id.\n * @property {string} geometryType Geometry type of the current object.\n */\n\n/**\n * @return {EvaluationContext} A new evaluation context.\n */\nexport function newEvaluationContext() {\n return {\n variables: {},\n properties: {},\n resolution: NaN,\n featureId: null,\n geometryType: '',\n };\n}\n\n/**\n * @typedef {function(EvaluationContext):import(\"./expression.js\").LiteralValue} ExpressionEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):boolean} BooleanEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):number} NumberEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):string} StringEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):(Array|string)} ColorLikeEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):Array} NumberArrayEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):Array} CoordinateEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):(Array)} SizeEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):(Array|number)} SizeLikeEvaluator\n */\n\n/**\n * @param {import('./expression.js').EncodedExpression} encoded The encoded expression.\n * @param {number} type The expected type.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The expression evaluator.\n */\nexport function buildExpression(encoded, type, context) {\n const expression = parse(encoded, context);\n if (!overlapsType(type, expression.type)) {\n const expected = typeName(type);\n const actual = typeName(expression.type);\n throw new Error(\n `Expected expression to be of type ${expected}, got ${actual}`,\n );\n }\n return compileExpression(expression, context);\n}\n\n/**\n * @param {import(\"./expression.js\").Expression} expression The expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileExpression(expression, context) {\n if (expression instanceof LiteralExpression) {\n // convert colors to array if possible\n if (expression.type === ColorType && typeof expression.value === 'string') {\n const colorValue = fromString(expression.value);\n return function () {\n return colorValue;\n };\n }\n return function () {\n return expression.value;\n };\n }\n const operator = expression.operator;\n switch (operator) {\n case Ops.Number:\n case Ops.String:\n case Ops.Coalesce: {\n return compileAssertionExpression(expression, context);\n }\n case Ops.Get:\n case Ops.Var: {\n return compileAccessorExpression(expression, context);\n }\n case Ops.Id: {\n return (context) => context.featureId;\n }\n case Ops.GeometryType: {\n return (context) => context.geometryType;\n }\n case Ops.Concat: {\n const args = expression.args.map((e) => compileExpression(e, context));\n return (context) =>\n ''.concat(...args.map((arg) => arg(context).toString()));\n }\n case Ops.Resolution: {\n return (context) => context.resolution;\n }\n case Ops.Any:\n case Ops.All:\n case Ops.Between:\n case Ops.In:\n case Ops.Not: {\n return compileLogicalExpression(expression, context);\n }\n case Ops.Equal:\n case Ops.NotEqual:\n case Ops.LessThan:\n case Ops.LessThanOrEqualTo:\n case Ops.GreaterThan:\n case Ops.GreaterThanOrEqualTo: {\n return compileComparisonExpression(expression, context);\n }\n case Ops.Multiply:\n case Ops.Divide:\n case Ops.Add:\n case Ops.Subtract:\n case Ops.Clamp:\n case Ops.Mod:\n case Ops.Pow:\n case Ops.Abs:\n case Ops.Floor:\n case Ops.Ceil:\n case Ops.Round:\n case Ops.Sin:\n case Ops.Cos:\n case Ops.Atan:\n case Ops.Sqrt: {\n return compileNumericExpression(expression, context);\n }\n case Ops.Case: {\n return compileCaseExpression(expression, context);\n }\n case Ops.Match: {\n return compileMatchExpression(expression, context);\n }\n case Ops.Interpolate: {\n return compileInterpolateExpression(expression, context);\n }\n case Ops.ToString: {\n return compileConvertExpression(expression, context);\n }\n default: {\n throw new Error(`Unsupported operator ${operator}`);\n }\n // TODO: unimplemented\n // Ops.Zoom\n // Ops.Time\n // Ops.Array\n // Ops.Color\n // Ops.Band\n // Ops.Palette\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileAssertionExpression(expression, context) {\n const type = expression.operator;\n const length = expression.args.length;\n\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n switch (type) {\n case Ops.Coalesce: {\n return (context) => {\n for (let i = 0; i < length; ++i) {\n const value = args[i](context);\n if (typeof value !== 'undefined' && value !== null) {\n return value;\n }\n }\n throw new Error('Expected one of the values to be non-null');\n };\n }\n case Ops.Number:\n case Ops.String: {\n return (context) => {\n for (let i = 0; i < length; ++i) {\n const value = args[i](context);\n if (typeof value === type) {\n return value;\n }\n }\n throw new Error(`Expected one of the values to be a ${type}`);\n };\n }\n default: {\n throw new Error(`Unsupported assertion operator ${type}`);\n }\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileAccessorExpression(expression, context) {\n const nameExpression = /** @type {LiteralExpression} */ (expression.args[0]);\n const name = /** @type {string} */ (nameExpression.value);\n switch (expression.operator) {\n case Ops.Get: {\n return (context) => context.properties[name];\n }\n case Ops.Var: {\n return (context) => context.variables[name];\n }\n default: {\n throw new Error(`Unsupported accessor operator ${expression.operator}`);\n }\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {BooleanEvaluator} The evaluator function.\n */\nfunction compileComparisonExpression(expression, context) {\n const op = expression.operator;\n const left = compileExpression(expression.args[0], context);\n const right = compileExpression(expression.args[1], context);\n switch (op) {\n case Ops.Equal: {\n return (context) => left(context) === right(context);\n }\n case Ops.NotEqual: {\n return (context) => left(context) !== right(context);\n }\n case Ops.LessThan: {\n return (context) => left(context) < right(context);\n }\n case Ops.LessThanOrEqualTo: {\n return (context) => left(context) <= right(context);\n }\n case Ops.GreaterThan: {\n return (context) => left(context) > right(context);\n }\n case Ops.GreaterThanOrEqualTo: {\n return (context) => left(context) >= right(context);\n }\n default: {\n throw new Error(`Unsupported comparison operator ${op}`);\n }\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {BooleanEvaluator} The evaluator function.\n */\nfunction compileLogicalExpression(expression, context) {\n const op = expression.operator;\n const length = expression.args.length;\n\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n switch (op) {\n case Ops.Any: {\n return (context) => {\n for (let i = 0; i < length; ++i) {\n if (args[i](context)) {\n return true;\n }\n }\n return false;\n };\n }\n case Ops.All: {\n return (context) => {\n for (let i = 0; i < length; ++i) {\n if (!args[i](context)) {\n return false;\n }\n }\n return true;\n };\n }\n case Ops.Between: {\n return (context) => {\n const value = args[0](context);\n const min = args[1](context);\n const max = args[2](context);\n return value >= min && value <= max;\n };\n }\n case Ops.In: {\n return (context) => {\n const value = args[0](context);\n for (let i = 1; i < length; ++i) {\n if (value === args[i](context)) {\n return true;\n }\n }\n return false;\n };\n }\n case Ops.Not: {\n return (context) => !args[0](context);\n }\n default: {\n throw new Error(`Unsupported logical operator ${op}`);\n }\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {NumberEvaluator} The evaluator function.\n */\nfunction compileNumericExpression(expression, context) {\n const op = expression.operator;\n const length = expression.args.length;\n\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n switch (op) {\n case Ops.Multiply: {\n return (context) => {\n let value = 1;\n for (let i = 0; i < length; ++i) {\n value *= args[i](context);\n }\n return value;\n };\n }\n case Ops.Divide: {\n return (context) => args[0](context) / args[1](context);\n }\n case Ops.Add: {\n return (context) => {\n let value = 0;\n for (let i = 0; i < length; ++i) {\n value += args[i](context);\n }\n return value;\n };\n }\n case Ops.Subtract: {\n return (context) => args[0](context) - args[1](context);\n }\n case Ops.Clamp: {\n return (context) => {\n const value = args[0](context);\n const min = args[1](context);\n if (value < min) {\n return min;\n }\n const max = args[2](context);\n if (value > max) {\n return max;\n }\n return value;\n };\n }\n case Ops.Mod: {\n return (context) => args[0](context) % args[1](context);\n }\n case Ops.Pow: {\n return (context) => Math.pow(args[0](context), args[1](context));\n }\n case Ops.Abs: {\n return (context) => Math.abs(args[0](context));\n }\n case Ops.Floor: {\n return (context) => Math.floor(args[0](context));\n }\n case Ops.Ceil: {\n return (context) => Math.ceil(args[0](context));\n }\n case Ops.Round: {\n return (context) => Math.round(args[0](context));\n }\n case Ops.Sin: {\n return (context) => Math.sin(args[0](context));\n }\n case Ops.Cos: {\n return (context) => Math.cos(args[0](context));\n }\n case Ops.Atan: {\n if (length === 2) {\n return (context) => Math.atan2(args[0](context), args[1](context));\n }\n return (context) => Math.atan(args[0](context));\n }\n case Ops.Sqrt: {\n return (context) => Math.sqrt(args[0](context));\n }\n default: {\n throw new Error(`Unsupported numeric operator ${op}`);\n }\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileCaseExpression(expression, context) {\n const length = expression.args.length;\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n return (context) => {\n for (let i = 0; i < length - 1; i += 2) {\n const condition = args[i](context);\n if (condition) {\n return args[i + 1](context);\n }\n }\n return args[length - 1](context);\n };\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileMatchExpression(expression, context) {\n const length = expression.args.length;\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n return (context) => {\n const value = args[0](context);\n for (let i = 1; i < length; i += 2) {\n if (value === args[i](context)) {\n return args[i + 1](context);\n }\n }\n return args[length - 1](context);\n };\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileInterpolateExpression(expression, context) {\n const length = expression.args.length;\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n return (context) => {\n const base = args[0](context);\n const value = args[1](context);\n\n let previousInput;\n let previousOutput;\n for (let i = 2; i < length; i += 2) {\n const input = args[i](context);\n let output = args[i + 1](context);\n const isColor = Array.isArray(output);\n if (isColor) {\n output = withAlpha(output);\n }\n if (input >= value) {\n if (i === 2) {\n return output;\n }\n if (isColor) {\n return interpolateColor(\n base,\n value,\n previousInput,\n previousOutput,\n input,\n output,\n );\n }\n return interpolateNumber(\n base,\n value,\n previousInput,\n previousOutput,\n input,\n output,\n );\n }\n previousInput = input;\n previousOutput = output;\n }\n return previousOutput;\n };\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileConvertExpression(expression, context) {\n const op = expression.operator;\n const length = expression.args.length;\n\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n switch (op) {\n case Ops.ToString: {\n return (context) => {\n const value = args[0](context);\n if (expression.args[0].type === ColorType) {\n return toString(value);\n }\n return value.toString();\n };\n }\n default: {\n throw new Error(`Unsupported convert operator ${op}`);\n }\n }\n}\n\n/**\n * @param {number} base The base.\n * @param {number} value The value.\n * @param {number} input1 The first input value.\n * @param {number} output1 The first output value.\n * @param {number} input2 The second input value.\n * @param {number} output2 The second output value.\n * @return {number} The interpolated value.\n */\nfunction interpolateNumber(base, value, input1, output1, input2, output2) {\n const delta = input2 - input1;\n if (delta === 0) {\n return output1;\n }\n const along = value - input1;\n const factor =\n base === 1\n ? along / delta\n : (Math.pow(base, along) - 1) / (Math.pow(base, delta) - 1);\n return output1 + factor * (output2 - output1);\n}\n\n/**\n * @param {number} base The base.\n * @param {number} value The value.\n * @param {number} input1 The first input value.\n * @param {import('../color.js').Color} rgba1 The first output value.\n * @param {number} input2 The second input value.\n * @param {import('../color.js').Color} rgba2 The second output value.\n * @return {import('../color.js').Color} The interpolated color.\n */\nfunction interpolateColor(base, value, input1, rgba1, input2, rgba2) {\n const delta = input2 - input1;\n if (delta === 0) {\n return rgba1;\n }\n const lcha1 = rgbaToLcha(rgba1);\n const lcha2 = rgbaToLcha(rgba2);\n let deltaHue = lcha2[2] - lcha1[2];\n if (deltaHue > 180) {\n deltaHue -= 360;\n } else if (deltaHue < -180) {\n deltaHue += 360;\n }\n\n const lcha = [\n interpolateNumber(base, value, input1, lcha1[0], input2, lcha2[0]),\n interpolateNumber(base, value, input1, lcha1[1], input2, lcha2[1]),\n lcha1[2] + interpolateNumber(base, value, input1, 0, input2, deltaHue),\n interpolateNumber(base, value, input1, rgba1[3], input2, rgba2[3]),\n ];\n return normalize(lchaToRgba(lcha));\n}\n","/**\n * @module ol/render/canvas/style\n */\n\nimport Circle from '../../style/Circle.js';\nimport Fill from '../../style/Fill.js';\nimport Icon from '../../style/Icon.js';\nimport RegularShape from '../../style/RegularShape.js';\nimport Stroke from '../../style/Stroke.js';\nimport Style from '../../style/Style.js';\nimport Text from '../../style/Text.js';\nimport {\n BooleanType,\n ColorType,\n NumberArrayType,\n NumberType,\n StringType,\n computeGeometryType,\n newParsingContext,\n} from '../../expr/expression.js';\nimport {buildExpression, newEvaluationContext} from '../../expr/cpu.js';\nimport {isEmpty} from '../../obj.js';\nimport {toSize} from '../../size.js';\n\n/**\n * @fileoverview This module includes functions to build styles for the canvas renderer. Building\n * is composed of two steps: parsing and compiling. The parsing step takes an encoded expression\n * and returns an instance of one of the expression classes. The compiling step takes the\n * expression instance and returns a function that can be evaluated to return a literal value. The\n * evaluator function should do as little allocation and work as possible.\n */\n\n/**\n * @typedef {import(\"../../style/flat.js\").FlatStyle} FlatStyle\n */\n\n/**\n * @typedef {import(\"../../expr/expression.js\").EncodedExpression} EncodedExpression\n */\n\n/**\n * @typedef {import(\"../../expr/expression.js\").ParsingContext} ParsingContext\n */\n\n/**\n * @typedef {import(\"../../expr/expression.js\").CallExpression} CallExpression\n */\n\n/**\n * @typedef {import(\"../../expr/cpu.js\").EvaluationContext} EvaluationContext\n */\n\n/**\n * @typedef {import(\"../../expr/cpu.js\").ExpressionEvaluator} ExpressionEvaluator\n */\n\n/**\n * @param {EvaluationContext} context The evaluation context.\n * @return {boolean} Always true.\n */\nfunction always(context) {\n return true;\n}\n\n/**\n * This function adapts a rule evaluator to the existing style function interface.\n * After we have deprecated the style function, we can use the compiled rules directly\n * and pass a more complete evaluation context (variables, zoom, time, etc.).\n *\n * @param {Array} rules The rules.\n * @return {import('../../style/Style.js').StyleFunction} A style function.\n */\nexport function rulesToStyleFunction(rules) {\n const parsingContext = newParsingContext();\n const evaluator = buildRuleSet(rules, parsingContext);\n const evaluationContext = newEvaluationContext();\n return function (feature, resolution) {\n evaluationContext.properties = feature.getPropertiesInternal();\n evaluationContext.resolution = resolution;\n if (parsingContext.featureId) {\n const id = feature.getId();\n if (id !== undefined) {\n evaluationContext.featureId = id;\n } else {\n evaluationContext.featureId = null;\n }\n }\n if (parsingContext.geometryType) {\n evaluationContext.geometryType = computeGeometryType(\n feature.getGeometry(),\n );\n }\n return evaluator(evaluationContext);\n };\n}\n\n/**\n * This function adapts a style evaluator to the existing style function interface.\n * After we have deprecated the style function, we can use the compiled rules directly\n * and pass a more complete evaluation context (variables, zoom, time, etc.).\n *\n * @param {Array} flatStyles The flat styles.\n * @return {import('../../style/Style.js').StyleFunction} A style function.\n */\nexport function flatStylesToStyleFunction(flatStyles) {\n const parsingContext = newParsingContext();\n const length = flatStyles.length;\n\n /**\n * @type {Array}\n */\n const evaluators = new Array(length);\n for (let i = 0; i < length; ++i) {\n evaluators[i] = buildStyle(flatStyles[i], parsingContext);\n }\n const evaluationContext = newEvaluationContext();\n\n /**\n * @type {Array